@select-org/select-post-builder 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +287 -0
- package/dist/post-builder.cjs +586 -0
- package/dist/post-builder.css +1 -0
- package/dist/post-builder.js +47456 -0
- package/dist/post-builder.umd.cjs +586 -0
- package/dist/vite.svg +1 -0
- package/package.json +107 -3
- package/.github/workflows/release-package.yml +0 -33
- package/index.js +0 -1
|
@@ -0,0 +1,586 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const M=require("react"),Al=require("react-dom");function eS(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const b=eS(M),Md=eS(Al);function tS(t,e){return function(){return t.apply(e,arguments)}}const{toString:KN}=Object.prototype,{getPrototypeOf:cg}=Object,{iterator:Od,toStringTag:nS}=Symbol,Rd=(t=>e=>{const n=KN.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),xr=t=>(t=t.toLowerCase(),e=>Rd(e)===t),Nd=t=>e=>typeof e===t,{isArray:Gi}=Array,Ai=Nd("undefined");function Ml(t){return t!==null&&!Ai(t)&&t.constructor!==null&&!Ai(t.constructor)&&wn(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const rS=xr("ArrayBuffer");function YN(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&rS(t.buffer),e}const JN=Nd("string"),wn=Nd("function"),oS=Nd("number"),Ol=t=>t!==null&&typeof t=="object",XN=t=>t===!0||t===!1,Hc=t=>{if(Rd(t)!=="object")return!1;const e=cg(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(nS in t)&&!(Od in t)},QN=t=>{if(!Ol(t)||Ml(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},ZN=xr("Date"),e_=xr("File"),t_=xr("Blob"),n_=xr("FileList"),r_=t=>Ol(t)&&wn(t.pipe),o_=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||wn(t.append)&&((e=Rd(t))==="formdata"||e==="object"&&wn(t.toString)&&t.toString()==="[object FormData]"))},s_=xr("URLSearchParams"),[i_,a_,l_,c_]=["ReadableStream","Request","Response","Headers"].map(xr),u_=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Rl(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,o;if(typeof t!="object"&&(t=[t]),Gi(t))for(r=0,o=t.length;r<o;r++)e.call(null,t[r],r,t);else{if(Ml(t))return;const s=n?Object.getOwnPropertyNames(t):Object.keys(t),i=s.length;let a;for(r=0;r<i;r++)a=s[r],e.call(null,t[a],a,t)}}function sS(t,e){if(Ml(t))return null;e=e.toLowerCase();const n=Object.keys(t);let r=n.length,o;for(;r-- >0;)if(o=n[r],e===o.toLowerCase())return o;return null}const bs=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,iS=t=>!Ai(t)&&t!==bs;function yp(){const{caseless:t,skipUndefined:e}=iS(this)&&this||{},n={},r=(o,s)=>{const i=t&&sS(n,s)||s;Hc(n[i])&&Hc(o)?n[i]=yp(n[i],o):Hc(o)?n[i]=yp({},o):Gi(o)?n[i]=o.slice():(!e||!Ai(o))&&(n[i]=o)};for(let o=0,s=arguments.length;o<s;o++)arguments[o]&&Rl(arguments[o],r);return n}const d_=(t,e,n,{allOwnKeys:r}={})=>(Rl(e,(o,s)=>{n&&wn(o)?t[s]=tS(o,n):t[s]=o},{allOwnKeys:r}),t),f_=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),h_=(t,e,n,r)=>{t.prototype=Object.create(e.prototype,r),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},p_=(t,e,n,r)=>{let o,s,i;const a={};if(e=e||{},t==null)return e;do{for(o=Object.getOwnPropertyNames(t),s=o.length;s-- >0;)i=o[s],(!r||r(i,t,e))&&!a[i]&&(e[i]=t[i],a[i]=!0);t=n!==!1&&cg(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},m_=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;const r=t.indexOf(e,n);return r!==-1&&r===n},g_=t=>{if(!t)return null;if(Gi(t))return t;let e=t.length;if(!oS(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},y_=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&cg(Uint8Array)),v_=(t,e)=>{const r=(t&&t[Od]).call(t);let o;for(;(o=r.next())&&!o.done;){const s=o.value;e.call(t,s[0],s[1])}},b_=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},x_=xr("HTMLFormElement"),w_=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,o){return r.toUpperCase()+o}),Uv=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),E_=xr("RegExp"),aS=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};Rl(n,(o,s)=>{let i;(i=e(o,s,t))!==!1&&(r[s]=i||o)}),Object.defineProperties(t,r)},S_=t=>{aS(t,(e,n)=>{if(wn(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(wn(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},k_=(t,e)=>{const n={},r=o=>{o.forEach(s=>{n[s]=!0})};return Gi(t)?r(t):r(String(t).split(e)),n},T_=()=>{},C_=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function A_(t){return!!(t&&wn(t.append)&&t[nS]==="FormData"&&t[Od])}const M_=t=>{const e=new Array(10),n=(r,o)=>{if(Ol(r)){if(e.indexOf(r)>=0)return;if(Ml(r))return r;if(!("toJSON"in r)){e[o]=r;const s=Gi(r)?[]:{};return Rl(r,(i,a)=>{const l=n(i,o+1);!Ai(l)&&(s[a]=l)}),e[o]=void 0,s}}return r};return n(t,0)},O_=xr("AsyncFunction"),R_=t=>t&&(Ol(t)||wn(t))&&wn(t.then)&&wn(t.catch),lS=((t,e)=>t?setImmediate:e?((n,r)=>(bs.addEventListener("message",({source:o,data:s})=>{o===bs&&s===n&&r.length&&r.shift()()},!1),o=>{r.push(o),bs.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",wn(bs.postMessage)),N_=typeof queueMicrotask<"u"?queueMicrotask.bind(bs):typeof process<"u"&&process.nextTick||lS,__=t=>t!=null&&wn(t[Od]),D={isArray:Gi,isArrayBuffer:rS,isBuffer:Ml,isFormData:o_,isArrayBufferView:YN,isString:JN,isNumber:oS,isBoolean:XN,isObject:Ol,isPlainObject:Hc,isEmptyObject:QN,isReadableStream:i_,isRequest:a_,isResponse:l_,isHeaders:c_,isUndefined:Ai,isDate:ZN,isFile:e_,isBlob:t_,isRegExp:E_,isFunction:wn,isStream:r_,isURLSearchParams:s_,isTypedArray:y_,isFileList:n_,forEach:Rl,merge:yp,extend:d_,trim:u_,stripBOM:f_,inherits:h_,toFlatObject:p_,kindOf:Rd,kindOfTest:xr,endsWith:m_,toArray:g_,forEachEntry:v_,matchAll:b_,isHTMLForm:x_,hasOwnProperty:Uv,hasOwnProp:Uv,reduceDescriptors:aS,freezeMethods:S_,toObjectSet:k_,toCamelCase:w_,noop:T_,toFiniteNumber:C_,findKey:sS,global:bs,isContextDefined:iS,isSpecCompliantForm:A_,toJSONObject:M_,isAsyncFn:O_,isThenable:R_,setImmediate:lS,asap:N_,isIterable:__};function Ce(t,e,n,r,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o,this.status=o.status?o.status:null)}D.inherits(Ce,Error,{toJSON:function(){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:D.toJSONObject(this.config),code:this.code,status:this.status}}});const cS=Ce.prototype,uS={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{uS[t]={value:t}});Object.defineProperties(Ce,uS);Object.defineProperty(cS,"isAxiosError",{value:!0});Ce.from=(t,e,n,r,o,s)=>{const i=Object.create(cS);D.toFlatObject(t,i,function(u){return u!==Error.prototype},c=>c!=="isAxiosError");const a=t&&t.message?t.message:"Error",l=e==null&&t?t.code:e;return Ce.call(i,a,l,n,r,o),t&&i.cause==null&&Object.defineProperty(i,"cause",{value:t,configurable:!0}),i.name=t&&t.name||"Error",s&&Object.assign(i,s),i};const D_=null;function vp(t){return D.isPlainObject(t)||D.isArray(t)}function dS(t){return D.endsWith(t,"[]")?t.slice(0,-2):t}function zv(t,e,n){return t?t.concat(e).map(function(o,s){return o=dS(o),!n&&s?"["+o+"]":o}).join(n?".":""):e}function I_(t){return D.isArray(t)&&!t.some(vp)}const P_=D.toFlatObject(D,{},null,function(e){return/^is[A-Z]/.test(e)});function _d(t,e,n){if(!D.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=D.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,y){return!D.isUndefined(y[m])});const r=n.metaTokens,o=n.visitor||u,s=n.dots,i=n.indexes,l=(n.Blob||typeof Blob<"u"&&Blob)&&D.isSpecCompliantForm(e);if(!D.isFunction(o))throw new TypeError("visitor must be a function");function c(p){if(p===null)return"";if(D.isDate(p))return p.toISOString();if(D.isBoolean(p))return p.toString();if(!l&&D.isBlob(p))throw new Ce("Blob is not supported. Use a Buffer instead.");return D.isArrayBuffer(p)||D.isTypedArray(p)?l&&typeof Blob=="function"?new Blob([p]):Buffer.from(p):p}function u(p,m,y){let v=p;if(p&&!y&&typeof p=="object"){if(D.endsWith(m,"{}"))m=r?m:m.slice(0,-2),p=JSON.stringify(p);else if(D.isArray(p)&&I_(p)||(D.isFileList(p)||D.endsWith(m,"[]"))&&(v=D.toArray(p)))return m=dS(m),v.forEach(function(E,x){!(D.isUndefined(E)||E===null)&&e.append(i===!0?zv([m],x,s):i===null?m:m+"[]",c(E))}),!1}return vp(p)?!0:(e.append(zv(y,m,s),c(p)),!1)}const d=[],f=Object.assign(P_,{defaultVisitor:u,convertValue:c,isVisitable:vp});function h(p,m){if(!D.isUndefined(p)){if(d.indexOf(p)!==-1)throw Error("Circular reference detected in "+m.join("."));d.push(p),D.forEach(p,function(v,w){(!(D.isUndefined(v)||v===null)&&o.call(e,v,D.isString(w)?w.trim():w,m,f))===!0&&h(v,m?m.concat(w):[w])}),d.pop()}}if(!D.isObject(t))throw new TypeError("data must be an object");return h(t),e}function Vv(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function ug(t,e){this._pairs=[],t&&_d(t,this,e)}const fS=ug.prototype;fS.append=function(e,n){this._pairs.push([e,n])};fS.toString=function(e){const n=e?function(r){return e.call(this,r,Vv)}:Vv;return this._pairs.map(function(o){return n(o[0])+"="+n(o[1])},"").join("&")};function L_(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function hS(t,e,n){if(!e)return t;const r=n&&n.encode||L_;D.isFunction(n)&&(n={serialize:n});const o=n&&n.serialize;let s;if(o?s=o(e,n):s=D.isURLSearchParams(e)?e.toString():new ug(e,n).toString(r),s){const i=t.indexOf("#");i!==-1&&(t=t.slice(0,i)),t+=(t.indexOf("?")===-1?"?":"&")+s}return t}class Wv{constructor(){this.handlers=[]}use(e,n,r){return this.handlers.push({fulfilled:e,rejected:n,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){D.forEach(this.handlers,function(r){r!==null&&e(r)})}}const pS={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},j_=typeof URLSearchParams<"u"?URLSearchParams:ug,$_=typeof FormData<"u"?FormData:null,B_=typeof Blob<"u"?Blob:null,F_={isBrowser:!0,classes:{URLSearchParams:j_,FormData:$_,Blob:B_},protocols:["http","https","file","blob","url","data"]},dg=typeof window<"u"&&typeof document<"u",bp=typeof navigator=="object"&&navigator||void 0,H_=dg&&(!bp||["ReactNative","NativeScript","NS"].indexOf(bp.product)<0),U_=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",z_=dg&&window.location.href||"http://localhost",V_=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:dg,hasStandardBrowserEnv:H_,hasStandardBrowserWebWorkerEnv:U_,navigator:bp,origin:z_},Symbol.toStringTag,{value:"Module"})),Jt={...V_,...F_};function W_(t,e){return _d(t,new Jt.classes.URLSearchParams,{visitor:function(n,r,o,s){return Jt.isNode&&D.isBuffer(n)?(this.append(r,n.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)},...e})}function G_(t){return D.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function q_(t){const e={},n=Object.keys(t);let r;const o=n.length;let s;for(r=0;r<o;r++)s=n[r],e[s]=t[s];return e}function mS(t){function e(n,r,o,s){let i=n[s++];if(i==="__proto__")return!0;const a=Number.isFinite(+i),l=s>=n.length;return i=!i&&D.isArray(o)?o.length:i,l?(D.hasOwnProp(o,i)?o[i]=[o[i],r]:o[i]=r,!a):((!o[i]||!D.isObject(o[i]))&&(o[i]=[]),e(n,r,o[i],s)&&D.isArray(o[i])&&(o[i]=q_(o[i])),!a)}if(D.isFormData(t)&&D.isFunction(t.entries)){const n={};return D.forEachEntry(t,(r,o)=>{e(G_(r),o,n,0)}),n}return null}function K_(t,e,n){if(D.isString(t))try{return(e||JSON.parse)(t),D.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}const Nl={transitional:pS,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const r=n.getContentType()||"",o=r.indexOf("application/json")>-1,s=D.isObject(e);if(s&&D.isHTMLForm(e)&&(e=new FormData(e)),D.isFormData(e))return o?JSON.stringify(mS(e)):e;if(D.isArrayBuffer(e)||D.isBuffer(e)||D.isStream(e)||D.isFile(e)||D.isBlob(e)||D.isReadableStream(e))return e;if(D.isArrayBufferView(e))return e.buffer;if(D.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(r.indexOf("application/x-www-form-urlencoded")>-1)return W_(e,this.formSerializer).toString();if((a=D.isFileList(e))||r.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return _d(a?{"files[]":e}:e,l&&new l,this.formSerializer)}}return s||o?(n.setContentType("application/json",!1),K_(e)):e}],transformResponse:[function(e){const n=this.transitional||Nl.transitional,r=n&&n.forcedJSONParsing,o=this.responseType==="json";if(D.isResponse(e)||D.isReadableStream(e))return e;if(e&&D.isString(e)&&(r&&!this.responseType||o)){const i=!(n&&n.silentJSONParsing)&&o;try{return JSON.parse(e,this.parseReviver)}catch(a){if(i)throw a.name==="SyntaxError"?Ce.from(a,Ce.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Jt.classes.FormData,Blob:Jt.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};D.forEach(["delete","get","head","post","put","patch"],t=>{Nl.headers[t]={}});const Y_=D.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"]),J_=t=>{const e={};let n,r,o;return t&&t.split(`
|
|
2
|
+
`).forEach(function(i){o=i.indexOf(":"),n=i.substring(0,o).trim().toLowerCase(),r=i.substring(o+1).trim(),!(!n||e[n]&&Y_[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},Gv=Symbol("internals");function la(t){return t&&String(t).trim().toLowerCase()}function Uc(t){return t===!1||t==null?t:D.isArray(t)?t.map(Uc):String(t)}function X_(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(t);)e[r[1]]=r[2];return e}const Q_=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function Wf(t,e,n,r,o){if(D.isFunction(r))return r.call(this,e,n);if(o&&(e=n),!!D.isString(e)){if(D.isString(r))return e.indexOf(r)!==-1;if(D.isRegExp(r))return r.test(e)}}function Z_(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function eD(t,e){const n=D.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(o,s,i){return this[r].call(this,e,o,s,i)},configurable:!0})})}let En=class{constructor(e){e&&this.set(e)}set(e,n,r){const o=this;function s(a,l,c){const u=la(l);if(!u)throw new Error("header name must be a non-empty string");const d=D.findKey(o,u);(!d||o[d]===void 0||c===!0||c===void 0&&o[d]!==!1)&&(o[d||l]=Uc(a))}const i=(a,l)=>D.forEach(a,(c,u)=>s(c,u,l));if(D.isPlainObject(e)||e instanceof this.constructor)i(e,n);else if(D.isString(e)&&(e=e.trim())&&!Q_(e))i(J_(e),n);else if(D.isObject(e)&&D.isIterable(e)){let a={},l,c;for(const u of e){if(!D.isArray(u))throw TypeError("Object iterator must return a key-value pair");a[c=u[0]]=(l=a[c])?D.isArray(l)?[...l,u[1]]:[l,u[1]]:u[1]}i(a,n)}else e!=null&&s(n,e,r);return this}get(e,n){if(e=la(e),e){const r=D.findKey(this,e);if(r){const o=this[r];if(!n)return o;if(n===!0)return X_(o);if(D.isFunction(n))return n.call(this,o,r);if(D.isRegExp(n))return n.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=la(e),e){const r=D.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||Wf(this,this[r],r,n)))}return!1}delete(e,n){const r=this;let o=!1;function s(i){if(i=la(i),i){const a=D.findKey(r,i);a&&(!n||Wf(r,r[a],a,n))&&(delete r[a],o=!0)}}return D.isArray(e)?e.forEach(s):s(e),o}clear(e){const n=Object.keys(this);let r=n.length,o=!1;for(;r--;){const s=n[r];(!e||Wf(this,this[s],s,e,!0))&&(delete this[s],o=!0)}return o}normalize(e){const n=this,r={};return D.forEach(this,(o,s)=>{const i=D.findKey(r,s);if(i){n[i]=Uc(o),delete n[s];return}const a=e?Z_(s):String(s).trim();a!==s&&delete n[s],n[a]=Uc(o),r[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return D.forEach(this,(r,o)=>{r!=null&&r!==!1&&(n[o]=e&&D.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(`
|
|
3
|
+
`)}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,...n){const r=new this(e);return n.forEach(o=>r.set(o)),r}static accessor(e){const r=(this[Gv]=this[Gv]={accessors:{}}).accessors,o=this.prototype;function s(i){const a=la(i);r[a]||(eD(o,i),r[a]=!0)}return D.isArray(e)?e.forEach(s):s(e),this}};En.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);D.reduceDescriptors(En.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}});D.freezeMethods(En);function Gf(t,e){const n=this||Nl,r=e||n,o=En.from(r.headers);let s=r.data;return D.forEach(t,function(a){s=a.call(n,s,o.normalize(),e?e.status:void 0)}),o.normalize(),s}function gS(t){return!!(t&&t.__CANCEL__)}function qi(t,e,n){Ce.call(this,t??"canceled",Ce.ERR_CANCELED,e,n),this.name="CanceledError"}D.inherits(qi,Ce,{__CANCEL__:!0});function yS(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new Ce("Request failed with status code "+n.status,[Ce.ERR_BAD_REQUEST,Ce.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function tD(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function nD(t,e){t=t||10;const n=new Array(t),r=new Array(t);let o=0,s=0,i;return e=e!==void 0?e:1e3,function(l){const c=Date.now(),u=r[s];i||(i=c),n[o]=l,r[o]=c;let d=s,f=0;for(;d!==o;)f+=n[d++],d=d%t;if(o=(o+1)%t,o===s&&(s=(s+1)%t),c-i<e)return;const h=u&&c-u;return h?Math.round(f*1e3/h):void 0}}function rD(t,e){let n=0,r=1e3/e,o,s;const i=(c,u=Date.now())=>{n=u,o=null,s&&(clearTimeout(s),s=null),t(...c)};return[(...c)=>{const u=Date.now(),d=u-n;d>=r?i(c,u):(o=c,s||(s=setTimeout(()=>{s=null,i(o)},r-d)))},()=>o&&i(o)]}const au=(t,e,n=3)=>{let r=0;const o=nD(50,250);return rD(s=>{const i=s.loaded,a=s.lengthComputable?s.total:void 0,l=i-r,c=o(l),u=i<=a;r=i;const d={loaded:i,total:a,progress:a?i/a:void 0,bytes:l,rate:c||void 0,estimated:c&&a&&u?(a-i)/c:void 0,event:s,lengthComputable:a!=null,[e?"download":"upload"]:!0};t(d)},n)},qv=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},Kv=t=>(...e)=>D.asap(()=>t(...e)),oD=Jt.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,Jt.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(Jt.origin),Jt.navigator&&/(msie|trident)/i.test(Jt.navigator.userAgent)):()=>!0,sD=Jt.hasStandardBrowserEnv?{write(t,e,n,r,o,s){const i=[t+"="+encodeURIComponent(e)];D.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),D.isString(r)&&i.push("path="+r),D.isString(o)&&i.push("domain="+o),s===!0&&i.push("secure"),document.cookie=i.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function iD(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function aD(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function vS(t,e,n){let r=!iD(e);return t&&(r||n==!1)?aD(t,e):e}const Yv=t=>t instanceof En?{...t}:t;function _s(t,e){e=e||{};const n={};function r(c,u,d,f){return D.isPlainObject(c)&&D.isPlainObject(u)?D.merge.call({caseless:f},c,u):D.isPlainObject(u)?D.merge({},u):D.isArray(u)?u.slice():u}function o(c,u,d,f){if(D.isUndefined(u)){if(!D.isUndefined(c))return r(void 0,c,d,f)}else return r(c,u,d,f)}function s(c,u){if(!D.isUndefined(u))return r(void 0,u)}function i(c,u){if(D.isUndefined(u)){if(!D.isUndefined(c))return r(void 0,c)}else return r(void 0,u)}function a(c,u,d){if(d in e)return r(c,u);if(d in t)return r(void 0,c)}const l={url:s,method:s,data:s,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(c,u,d)=>o(Yv(c),Yv(u),d,!0)};return D.forEach(Object.keys({...t,...e}),function(u){const d=l[u]||o,f=d(t[u],e[u],u);D.isUndefined(f)&&d!==a||(n[u]=f)}),n}const bS=t=>{const e=_s({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:s,headers:i,auth:a}=e;if(e.headers=i=En.from(i),e.url=hS(vS(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),a&&i.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),D.isFormData(n)){if(Jt.hasStandardBrowserEnv||Jt.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(D.isFunction(n.getHeaders)){const l=n.getHeaders(),c=["content-type","content-length"];Object.entries(l).forEach(([u,d])=>{c.includes(u.toLowerCase())&&i.set(u,d)})}}if(Jt.hasStandardBrowserEnv&&(r&&D.isFunction(r)&&(r=r(e)),r||r!==!1&&oD(e.url))){const l=o&&s&&sD.read(s);l&&i.set(o,l)}return e},lD=typeof XMLHttpRequest<"u",cD=lD&&function(t){return new Promise(function(n,r){const o=bS(t);let s=o.data;const i=En.from(o.headers).normalize();let{responseType:a,onUploadProgress:l,onDownloadProgress:c}=o,u,d,f,h,p;function m(){h&&h(),p&&p(),o.cancelToken&&o.cancelToken.unsubscribe(u),o.signal&&o.signal.removeEventListener("abort",u)}let y=new XMLHttpRequest;y.open(o.method.toUpperCase(),o.url,!0),y.timeout=o.timeout;function v(){if(!y)return;const E=En.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),T={data:!a||a==="text"||a==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:E,config:t,request:y};yS(function(k){n(k),m()},function(k){r(k),m()},T),y=null}"onloadend"in y?y.onloadend=v:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.indexOf("file:")===0)||setTimeout(v)},y.onabort=function(){y&&(r(new Ce("Request aborted",Ce.ECONNABORTED,t,y)),y=null)},y.onerror=function(x){const T=x&&x.message?x.message:"Network Error",S=new Ce(T,Ce.ERR_NETWORK,t,y);S.event=x||null,r(S),y=null},y.ontimeout=function(){let x=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const T=o.transitional||pS;o.timeoutErrorMessage&&(x=o.timeoutErrorMessage),r(new Ce(x,T.clarifyTimeoutError?Ce.ETIMEDOUT:Ce.ECONNABORTED,t,y)),y=null},s===void 0&&i.setContentType(null),"setRequestHeader"in y&&D.forEach(i.toJSON(),function(x,T){y.setRequestHeader(T,x)}),D.isUndefined(o.withCredentials)||(y.withCredentials=!!o.withCredentials),a&&a!=="json"&&(y.responseType=o.responseType),c&&([f,p]=au(c,!0),y.addEventListener("progress",f)),l&&y.upload&&([d,h]=au(l),y.upload.addEventListener("progress",d),y.upload.addEventListener("loadend",h)),(o.cancelToken||o.signal)&&(u=E=>{y&&(r(!E||E.type?new qi(null,t,y):E),y.abort(),y=null)},o.cancelToken&&o.cancelToken.subscribe(u),o.signal&&(o.signal.aborted?u():o.signal.addEventListener("abort",u)));const w=tD(o.url);if(w&&Jt.protocols.indexOf(w)===-1){r(new Ce("Unsupported protocol "+w+":",Ce.ERR_BAD_REQUEST,t));return}y.send(s||null)})},uD=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let r=new AbortController,o;const s=function(c){if(!o){o=!0,a();const u=c instanceof Error?c:this.reason;r.abort(u instanceof Ce?u:new qi(u instanceof Error?u.message:u))}};let i=e&&setTimeout(()=>{i=null,s(new Ce(`timeout ${e} of ms exceeded`,Ce.ETIMEDOUT))},e);const a=()=>{t&&(i&&clearTimeout(i),i=null,t.forEach(c=>{c.unsubscribe?c.unsubscribe(s):c.removeEventListener("abort",s)}),t=null)};t.forEach(c=>c.addEventListener("abort",s));const{signal:l}=r;return l.unsubscribe=()=>D.asap(a),l}},dD=function*(t,e){let n=t.byteLength;if(n<e){yield t;return}let r=0,o;for(;r<n;)o=r+e,yield t.slice(r,o),r=o},fD=async function*(t,e){for await(const n of hD(t))yield*dD(n,e)},hD=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:n,value:r}=await e.read();if(n)break;yield r}}finally{await e.cancel()}},Jv=(t,e,n,r)=>{const o=fD(t,e);let s=0,i,a=l=>{i||(i=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:c,value:u}=await o.next();if(c){a(),l.close();return}let d=u.byteLength;if(n){let f=s+=d;n(f)}l.enqueue(new Uint8Array(u))}catch(c){throw a(c),c}},cancel(l){return a(l),o.return()}},{highWaterMark:2})},Xv=64*1024,{isFunction:oc}=D,pD=(({Request:t,Response:e})=>({Request:t,Response:e}))(D.global),{ReadableStream:Qv,TextEncoder:Zv}=D.global,eb=(t,...e)=>{try{return!!t(...e)}catch{return!1}},mD=t=>{t=D.merge.call({skipUndefined:!0},pD,t);const{fetch:e,Request:n,Response:r}=t,o=e?oc(e):typeof fetch=="function",s=oc(n),i=oc(r);if(!o)return!1;const a=o&&oc(Qv),l=o&&(typeof Zv=="function"?(p=>m=>p.encode(m))(new Zv):async p=>new Uint8Array(await new n(p).arrayBuffer())),c=s&&a&&eb(()=>{let p=!1;const m=new n(Jt.origin,{body:new Qv,method:"POST",get duplex(){return p=!0,"half"}}).headers.has("Content-Type");return p&&!m}),u=i&&a&&eb(()=>D.isReadableStream(new r("").body)),d={stream:u&&(p=>p.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(p=>{!d[p]&&(d[p]=(m,y)=>{let v=m&&m[p];if(v)return v.call(m);throw new Ce(`Response type '${p}' is not supported`,Ce.ERR_NOT_SUPPORT,y)})});const f=async p=>{if(p==null)return 0;if(D.isBlob(p))return p.size;if(D.isSpecCompliantForm(p))return(await new n(Jt.origin,{method:"POST",body:p}).arrayBuffer()).byteLength;if(D.isArrayBufferView(p)||D.isArrayBuffer(p))return p.byteLength;if(D.isURLSearchParams(p)&&(p=p+""),D.isString(p))return(await l(p)).byteLength},h=async(p,m)=>{const y=D.toFiniteNumber(p.getContentLength());return y??f(m)};return async p=>{let{url:m,method:y,data:v,signal:w,cancelToken:E,timeout:x,onDownloadProgress:T,onUploadProgress:S,responseType:k,headers:C,withCredentials:N="same-origin",fetchOptions:R}=bS(p),L=e||fetch;k=k?(k+"").toLowerCase():"text";let $=uD([w,E&&E.toAbortSignal()],x),B=null;const U=$&&$.unsubscribe&&(()=>{$.unsubscribe()});let j;try{if(S&&c&&y!=="get"&&y!=="head"&&(j=await h(C,v))!==0){let te=new n(m,{method:"POST",body:v,duplex:"half"}),ye;if(D.isFormData(v)&&(ye=te.headers.get("content-type"))&&C.setContentType(ye),te.body){const[G,Q]=qv(j,au(Kv(S)));v=Jv(te.body,Xv,G,Q)}}D.isString(N)||(N=N?"include":"omit");const P=s&&"credentials"in n.prototype,H={...R,signal:$,method:y.toUpperCase(),headers:C.normalize().toJSON(),body:v,duplex:"half",credentials:P?N:void 0};B=s&&new n(m,H);let _=await(s?L(B,R):L(m,H));const V=u&&(k==="stream"||k==="response");if(u&&(T||V&&U)){const te={};["status","statusText","headers"].forEach(J=>{te[J]=_[J]});const ye=D.toFiniteNumber(_.headers.get("content-length")),[G,Q]=T&&qv(ye,au(Kv(T),!0))||[];_=new r(Jv(_.body,Xv,G,()=>{Q&&Q(),U&&U()}),te)}k=k||"text";let ie=await d[D.findKey(d,k)||"text"](_,p);return!V&&U&&U(),await new Promise((te,ye)=>{yS(te,ye,{data:ie,headers:En.from(_.headers),status:_.status,statusText:_.statusText,config:p,request:B})})}catch(P){throw U&&U(),P&&P.name==="TypeError"&&/Load failed|fetch/i.test(P.message)?Object.assign(new Ce("Network Error",Ce.ERR_NETWORK,p,B),{cause:P.cause||P}):Ce.from(P,P&&P.code,p,B)}}},gD=new Map,xS=t=>{let e=t?t.env:{};const{fetch:n,Request:r,Response:o}=e,s=[r,o,n];let i=s.length,a=i,l,c,u=gD;for(;a--;)l=s[a],c=u.get(l),c===void 0&&u.set(l,c=a?new Map:mD(e)),u=c;return c};xS();const xp={http:D_,xhr:cD,fetch:{get:xS}};D.forEach(xp,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const tb=t=>`- ${t}`,yD=t=>D.isFunction(t)||t===null||t===!1,wS={getAdapter:(t,e)=>{t=D.isArray(t)?t:[t];const{length:n}=t;let r,o;const s={};for(let i=0;i<n;i++){r=t[i];let a;if(o=r,!yD(r)&&(o=xp[(a=String(r)).toLowerCase()],o===void 0))throw new Ce(`Unknown adapter '${a}'`);if(o&&(D.isFunction(o)||(o=o.get(e))))break;s[a||"#"+i]=o}if(!o){const i=Object.entries(s).map(([l,c])=>`adapter ${l} `+(c===!1?"is not supported by the environment":"is not available in the build"));let a=n?i.length>1?`since :
|
|
4
|
+
`+i.map(tb).join(`
|
|
5
|
+
`):" "+tb(i[0]):"as no adapter specified";throw new Ce("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return o},adapters:xp};function qf(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new qi(null,t)}function nb(t){return qf(t),t.headers=En.from(t.headers),t.data=Gf.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),wS.getAdapter(t.adapter||Nl.adapter,t)(t).then(function(r){return qf(t),r.data=Gf.call(t,t.transformResponse,r),r.headers=En.from(r.headers),r},function(r){return gS(r)||(qf(t),r&&r.response&&(r.response.data=Gf.call(t,t.transformResponse,r.response),r.response.headers=En.from(r.response.headers))),Promise.reject(r)})}const ES="1.12.2",Dd={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{Dd[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const rb={};Dd.transitional=function(e,n,r){function o(s,i){return"[Axios v"+ES+"] Transitional option '"+s+"'"+i+(r?". "+r:"")}return(s,i,a)=>{if(e===!1)throw new Ce(o(i," has been removed"+(n?" in "+n:"")),Ce.ERR_DEPRECATED);return n&&!rb[i]&&(rb[i]=!0,console.warn(o(i," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(s,i,a):!0}};Dd.spelling=function(e){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function vD(t,e,n){if(typeof t!="object")throw new Ce("options must be an object",Ce.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let o=r.length;for(;o-- >0;){const s=r[o],i=e[s];if(i){const a=t[s],l=a===void 0||i(a,s,t);if(l!==!0)throw new Ce("option "+s+" must be "+l,Ce.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Ce("Unknown option "+s,Ce.ERR_BAD_OPTION)}}const zc={assertOptions:vD,validators:Dd},Ar=zc.validators;let ks=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Wv,response:new Wv}}async request(e,n){try{return await this._request(e,n)}catch(r){if(r instanceof Error){let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;const s=o.stack?o.stack.replace(/^.+\n/,""):"";try{r.stack?s&&!String(r.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(r.stack+=`
|
|
6
|
+
`+s):r.stack=s}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=_s(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:s}=n;r!==void 0&&zc.assertOptions(r,{silentJSONParsing:Ar.transitional(Ar.boolean),forcedJSONParsing:Ar.transitional(Ar.boolean),clarifyTimeoutError:Ar.transitional(Ar.boolean)},!1),o!=null&&(D.isFunction(o)?n.paramsSerializer={serialize:o}:zc.assertOptions(o,{encode:Ar.function,serialize:Ar.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),zc.assertOptions(n,{baseUrl:Ar.spelling("baseURL"),withXsrfToken:Ar.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=s&&D.merge(s.common,s[n.method]);s&&D.forEach(["delete","get","head","post","put","patch","common"],p=>{delete s[p]}),n.headers=En.concat(i,s);const a=[];let l=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(n)===!1||(l=l&&m.synchronous,a.unshift(m.fulfilled,m.rejected))});const c=[];this.interceptors.response.forEach(function(m){c.push(m.fulfilled,m.rejected)});let u,d=0,f;if(!l){const p=[nb.bind(this),void 0];for(p.unshift(...a),p.push(...c),f=p.length,u=Promise.resolve(n);d<f;)u=u.then(p[d++],p[d++]);return u}f=a.length;let h=n;for(;d<f;){const p=a[d++],m=a[d++];try{h=p(h)}catch(y){m.call(this,y);break}}try{u=nb.call(this,h)}catch(p){return Promise.reject(p)}for(d=0,f=c.length;d<f;)u=u.then(c[d++],c[d++]);return u}getUri(e){e=_s(this.defaults,e);const n=vS(e.baseURL,e.url,e.allowAbsoluteUrls);return hS(n,e.params,e.paramsSerializer)}};D.forEach(["delete","get","head","options"],function(e){ks.prototype[e]=function(n,r){return this.request(_s(r||{},{method:e,url:n,data:(r||{}).data}))}});D.forEach(["post","put","patch"],function(e){function n(r){return function(s,i,a){return this.request(_s(a||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:i}))}}ks.prototype[e]=n(),ks.prototype[e+"Form"]=n(!0)});let bD=class SS{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(s){n=s});const r=this;this.promise.then(o=>{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](o);r._listeners=null}),this.promise.then=o=>{let s;const i=new Promise(a=>{r.subscribe(a),s=a}).then(o);return i.cancel=function(){r.unsubscribe(s)},i},e(function(s,i,a){r.reason||(r.reason=new qi(s,i,a),n(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 n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=r=>{e.abort(r)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new SS(function(o){e=o}),cancel:e}}};function xD(t){return function(n){return t.apply(null,n)}}function wD(t){return D.isObject(t)&&t.isAxiosError===!0}const wp={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};Object.entries(wp).forEach(([t,e])=>{wp[e]=t});function kS(t){const e=new ks(t),n=tS(ks.prototype.request,e);return D.extend(n,ks.prototype,e,{allOwnKeys:!0}),D.extend(n,e,null,{allOwnKeys:!0}),n.create=function(o){return kS(_s(t,o))},n}const yt=kS(Nl);yt.Axios=ks;yt.CanceledError=qi;yt.CancelToken=bD;yt.isCancel=gS;yt.VERSION=ES;yt.toFormData=_d;yt.AxiosError=Ce;yt.Cancel=yt.CanceledError;yt.all=function(e){return Promise.all(e)};yt.spread=xD;yt.isAxiosError=wD;yt.mergeConfig=_s;yt.AxiosHeaders=En;yt.formToJSON=t=>mS(D.isHTMLForm(t)?new FormData(t):t);yt.getAdapter=wS.getAdapter;yt.HttpStatusCode=wp;yt.default=yt;const{Axios:Yte,AxiosError:ob,CanceledError:Jte,isCancel:Xte,CancelToken:Qte,VERSION:Zte,all:ene,Cancel:tne,isAxiosError:nne,spread:rne,toFormData:one,AxiosHeaders:sne,HttpStatusCode:ine,formToJSON:ane,getAdapter:lne,mergeConfig:cne}=yt;var lu=(t=>(t.Post="post",t.Comment="comment",t))(lu||{}),TS=(t=>(t[t.POST=0]="POST",t[t.FEATURED_POST=1]="FEATURED_POST",t))(TS||{}),Ep=(t=>(t.User="mention",t.Group="hashtag",t))(Ep||{}),_l=(t=>(t.NEW_POST_IMAGE="new:post:image",t.NEW_POST_MEDIA="new:post:media",t.NEW_POST_POLL="new:post:poll",t.NEW_POST_LINK="new:post:link",t.NEW_POST_MESSAGE="new:post:text",t.NEW_COMMENT="new:comment",t.NEW_COMMENT_GUGGY="new:comment:gif",t.NEW_COMMENT_VOICE="new:comment:voice",t.NEW_COMMENT_IMAGE="new:comment:image",t.NEW_COMMENT_MEDIA="new:comment:media",t))(_l||{}),xe=(t=>(t.Image="image",t.Video="video",t.Audio="audio",t.File="file",t))(xe||{}),Wo=(t=>(t.MEDIA_ITEM="mediaItem",t.IMAGE_ITEM="imageItem",t))(Wo||{}),Sp=(t=>(t.Gif="GifSearch",t.Image="ImageSearch",t))(Sp||{}),gt=(t=>(t.Text="Text",t.Media="Media",t.Link="Link",t.Poll="Poll",t))(gt||{}),tt=(t=>(t.LEFT="left",t.CENTER="center",t.RIGHT="right",t))(tt||{}),Id=(t=>(t.Compact="compact",t.Extended="extended",t))(Id||{}),cu=(t=>(t.POLL_TEXT_ITEM="pollTextItem",t.POLL_IMAGE_ITEM="pollImageItem",t.POLL_MEDIA_ITEM="pollMediaItem",t))(cu||{});const ED=300,SD={[xe.Image]:"img",[xe.Video]:"video",[xe.Audio]:"audio",[xe.File]:"div"},kD={[xe.Image]:"image/*",[xe.Video]:"video/*",[xe.Audio]:"audio/*",[xe.File]:"file/*"},Nr={http:{CLIENT_ERROR:"http_client_error",UNAUTHORIZED:"invalid_jwt_token",SERVER_ERROR:"http_server_error",NETWORK_ERROR:"http_network_error",UNKNOWN_ERROR:"http_unknown_error",NOT_FOUND:"general_no_result",ENTITY_TOO_LARGE:"image_upload_file_size_too_big"}},TD=20,sb={images:"scrollableDiv-images",gifs:"scrollableDiv-gifs"},CD=300*1e3,Aa=10,AD=50*1024*1024;class no extends Error{httpCode=0;static className="HTTPError";constructor(e,n){super(e),this.name=no.className,this.message=e,this.httpCode=n}}function Pd(t,e,n){if(t&&t instanceof ob&&!t.isAxiosError)throw t;if(!t)throw new no(e(Nr.http.UNKNOWN_ERROR),0);if(t instanceof ob){const{response:r}=t;if(!r||!r.status)throw new no(e(Nr.http.NETWORK_ERROR),0);const{status:o}=r;if(o&&o<300)return null;throw o&&o>=500&&o<600?new no(e(Nr.http.SERVER_ERROR),o):o&&o===401?(n(Nr.http.UNAUTHORIZED),new no(e(Nr.http.UNAUTHORIZED),o)):o&&o===413?new no(e(Nr.http.ENTITY_TOO_LARGE),o):o&&o>399&&o<500?new no(e(Nr.http.CLIENT_ERROR),o):new no(e(Nr.http.UNKNOWN_ERROR),o)}}function uu(t){return t&&t.status?t.status:t&&t.response&&t.response.status?t.response.status:-1}function MD(t){if(!t.response)return"Network error. Please check your internet connection.";const e=uu(t?.response),n=t.response.data,r=n?.message||n?.error||n?.detail;if(r)return r;switch(e){case 400:return"Invalid Request Payload";case 401:return"Authentication required. Please log in.";case 403:return"You do not have permission to perform this action.";case 404:return"The requested resource was not found.";case 422:return"Invalid data provided.";case 429:return"Too many requests. Please try again later.";case 500:case 502:case 503:case 504:return"Server error. Please try again later.";default:return"Something went wrong. Please try again."}}function fg(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Kf,ib;function OD(){if(ib)return Kf;ib=1;const t=new Set(["ENOTFOUND","ENETUNREACH","UNABLE_TO_GET_ISSUER_CERT","UNABLE_TO_GET_CRL","UNABLE_TO_DECRYPT_CERT_SIGNATURE","UNABLE_TO_DECRYPT_CRL_SIGNATURE","UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY","CERT_SIGNATURE_FAILURE","CRL_SIGNATURE_FAILURE","CERT_NOT_YET_VALID","CERT_HAS_EXPIRED","CRL_NOT_YET_VALID","CRL_HAS_EXPIRED","ERROR_IN_CERT_NOT_BEFORE_FIELD","ERROR_IN_CERT_NOT_AFTER_FIELD","ERROR_IN_CRL_LAST_UPDATE_FIELD","ERROR_IN_CRL_NEXT_UPDATE_FIELD","OUT_OF_MEM","DEPTH_ZERO_SELF_SIGNED_CERT","SELF_SIGNED_CERT_IN_CHAIN","UNABLE_TO_GET_ISSUER_CERT_LOCALLY","UNABLE_TO_VERIFY_LEAF_SIGNATURE","CERT_CHAIN_TOO_LONG","CERT_REVOKED","INVALID_CA","PATH_LENGTH_EXCEEDED","INVALID_PURPOSE","CERT_UNTRUSTED","CERT_REJECTED","HOSTNAME_MISMATCH"]);return Kf=e=>!t.has(e&&e.code),Kf}var RD=OD();const ND=fg(RD),hg="axios-retry";function CS(t){const e=["ERR_CANCELED","ECONNABORTED"];return t.response||!t.code||e.includes(t.code)?!1:ND(t)}const AS=["get","head","options"],_D=AS.concat(["put","delete"]);function pg(t){return t.code!=="ECONNABORTED"&&(!t.response||t.response.status===429||t.response.status>=500&&t.response.status<=599)}function DD(t){return t.config?.method?pg(t)&&AS.indexOf(t.config.method)!==-1:!1}function MS(t){return t.config?.method?pg(t)&&_D.indexOf(t.config.method)!==-1:!1}function OS(t){return CS(t)||MS(t)}function mg(t=void 0){const e=t?.response?.headers["retry-after"];if(!e)return 0;let n=(Number(e)||0)*1e3;return n===0&&(n=(new Date(e).valueOf()||0)-Date.now()),Math.max(0,n)}function ID(t=0,e=void 0){return Math.max(0,mg(e))}function PD(t=0,e=void 0,n=100){const r=2**t*n,o=Math.max(r,mg(e)),s=o*.2*Math.random();return o+s}function LD(t=100){return(e=0,n=void 0)=>{const r=e*t;return Math.max(r,mg(n))}}const jD={retries:3,retryCondition:OS,retryDelay:ID,shouldResetTimeout:!1,onRetry:()=>{},onMaxRetryTimesExceeded:()=>{},validateResponse:null};function $D(t,e){return{...jD,...e,...t[hg]}}function ab(t,e,n=!1){const r=$D(t,e||{});return r.retryCount=r.retryCount||0,(!r.lastRequestTime||n)&&(r.lastRequestTime=Date.now()),t[hg]=r,r}function BD(t,e){t.defaults.agent===e.agent&&delete e.agent,t.defaults.httpAgent===e.httpAgent&&delete e.httpAgent,t.defaults.httpsAgent===e.httpsAgent&&delete e.httpsAgent}async function FD(t,e){const{retries:n,retryCondition:r}=t,o=(t.retryCount||0)<n&&r(e);if(typeof o=="object")try{return await o!==!1}catch{return!1}return o}async function HD(t,e,n,r){e.retryCount+=1;const{retryDelay:o,shouldResetTimeout:s,onRetry:i}=e,a=o(e.retryCount,n);if(BD(t,r),!s&&r.timeout&&e.lastRequestTime){const l=Date.now()-e.lastRequestTime,c=r.timeout-l-a;if(c<=0)return Promise.reject(n);r.timeout=c}return r.transformRequest=[l=>l],await i(e.retryCount,n,r),r.signal?.aborted?Promise.resolve(t(r)):new Promise(l=>{const c=()=>{clearTimeout(u),l(t(r))},u=setTimeout(()=>{l(t(r)),r.signal?.removeEventListener&&r.signal.removeEventListener("abort",c)},a);r.signal?.addEventListener&&r.signal.addEventListener("abort",c,{once:!0})})}async function UD(t,e){t.retryCount>=t.retries&&await t.onMaxRetryTimesExceeded(e,t.retryCount)}const fo=(t,e)=>{const n=t.interceptors.request.use(o=>(ab(o,e,!0),o[hg]?.validateResponse&&(o.validateStatus=()=>!1),o)),r=t.interceptors.response.use(null,async o=>{const{config:s}=o;if(!s)return Promise.reject(o);const i=ab(s,e);return o.response&&i.validateResponse?.(o.response)?o.response:await FD(i,o)?HD(t,i,o,s):(await UD(i,o),Promise.reject(o))});return{requestInterceptorId:n,responseInterceptorId:r}};fo.isNetworkError=CS;fo.isSafeRequestError=DD;fo.isIdempotentRequestError=MS;fo.isNetworkOrIdempotentRequestError=OS;fo.exponentialDelay=PD;fo.linearDelay=LD;fo.isRetryableError=pg;function zD(t){if(typeof document>"u")return;let e=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",e.appendChild(n),n.styleSheet?n.styleSheet.cssText=t:n.appendChild(document.createTextNode(t))}const VD=t=>{switch(t){case"success":return qD;case"info":return YD;case"warning":return KD;case"error":return JD;default:return null}},WD=Array(12).fill(0),GD=({visible:t,className:e})=>M.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":t},M.createElement("div",{className:"sonner-spinner"},WD.map((n,r)=>M.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),qD=M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},M.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),KD=M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},M.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),YD=M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},M.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),JD=M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},M.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),XD=M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},M.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),M.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),QD=()=>{const[t,e]=M.useState(document.hidden);return M.useEffect(()=>{const n=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),t};let kp=1;class ZD{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{const n=this.subscribers.indexOf(e);this.subscribers.splice(n,1)}),this.publish=e=>{this.subscribers.forEach(n=>n(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var n;const{message:r,...o}=e,s=typeof e?.id=="number"||((n=e.id)==null?void 0:n.length)>0?e.id:kp++,i=this.toasts.find(l=>l.id===s),a=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(s)&&this.dismissedToasts.delete(s),i?this.toasts=this.toasts.map(l=>l.id===s?(this.publish({...l,...e,id:s,title:r}),{...l,...e,id:s,dismissible:a,title:r}):l):this.addToast({title:r,...o,dismissible:a,id:s}),s},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:e,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(r=>r({id:n.id,dismiss:!0}))}),e),this.message=(e,n)=>this.create({...n,message:e}),this.error=(e,n)=>this.create({...n,message:e,type:"error"}),this.success=(e,n)=>this.create({...n,type:"success",message:e}),this.info=(e,n)=>this.create({...n,type:"info",message:e}),this.warning=(e,n)=>this.create({...n,type:"warning",message:e}),this.loading=(e,n)=>this.create({...n,type:"loading",message:e}),this.promise=(e,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:e,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const o=Promise.resolve(e instanceof Function?e():e);let s=r!==void 0,i;const a=o.then(async c=>{if(i=["resolve",c],M.isValidElement(c))s=!1,this.create({id:r,type:"default",message:c});else if(tI(c)&&!c.ok){s=!1;const d=typeof n.error=="function"?await n.error(`HTTP error! status: ${c.status}`):n.error,f=typeof n.description=="function"?await n.description(`HTTP error! status: ${c.status}`):n.description,p=typeof d=="object"&&!M.isValidElement(d)?d:{message:d};this.create({id:r,type:"error",description:f,...p})}else if(c instanceof Error){s=!1;const d=typeof n.error=="function"?await n.error(c):n.error,f=typeof n.description=="function"?await n.description(c):n.description,p=typeof d=="object"&&!M.isValidElement(d)?d:{message:d};this.create({id:r,type:"error",description:f,...p})}else if(n.success!==void 0){s=!1;const d=typeof n.success=="function"?await n.success(c):n.success,f=typeof n.description=="function"?await n.description(c):n.description,p=typeof d=="object"&&!M.isValidElement(d)?d:{message:d};this.create({id:r,type:"success",description:f,...p})}}).catch(async c=>{if(i=["reject",c],n.error!==void 0){s=!1;const u=typeof n.error=="function"?await n.error(c):n.error,d=typeof n.description=="function"?await n.description(c):n.description,h=typeof u=="object"&&!M.isValidElement(u)?u:{message:u};this.create({id:r,type:"error",description:d,...h})}}).finally(()=>{s&&(this.dismiss(r),r=void 0),n.finally==null||n.finally.call(n)}),l=()=>new Promise((c,u)=>a.then(()=>i[0]==="reject"?u(i[1]):c(i[1])).catch(u));return typeof r!="string"&&typeof r!="number"?{unwrap:l}:Object.assign(r,{unwrap:l})},this.custom=(e,n)=>{const r=n?.id||kp++;return this.create({jsx:e(r),id:r,...n}),r},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const vn=new ZD,eI=(t,e)=>{const n=e?.id||kp++;return vn.addToast({title:t,...e,id:n}),n},tI=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",nI=eI,rI=()=>vn.toasts,oI=()=>vn.getActiveToasts(),$o=Object.assign(nI,{success:vn.success,info:vn.info,warning:vn.warning,error:vn.error,custom:vn.custom,message:vn.message,promise:vn.promise,dismiss:vn.dismiss,loading:vn.loading},{getHistory:rI,getToasts:oI});zD("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function sc(t){return t.label!==void 0}const sI=3,iI="24px",aI="16px",lb=4e3,lI=356,cI=14,uI=45,dI=200;function Mr(...t){return t.filter(Boolean).join(" ")}function fI(t){const[e,n]=t.split("-"),r=[];return e&&r.push(e),n&&r.push(n),r}const hI=t=>{var e,n,r,o,s,i,a,l,c;const{invert:u,toast:d,unstyled:f,interacting:h,setHeights:p,visibleToasts:m,heights:y,index:v,toasts:w,expanded:E,removeToast:x,defaultRichColors:T,closeButton:S,style:k,cancelButtonStyle:C,actionButtonStyle:N,className:R="",descriptionClassName:L="",duration:$,position:B,gap:U,expandByDefault:j,classNames:P,icons:H,closeButtonAriaLabel:_="Close toast"}=t,[V,ie]=M.useState(null),[te,ye]=M.useState(null),[G,Q]=M.useState(!1),[J,me]=M.useState(!1),[z,Z]=M.useState(!1),[Me,he]=M.useState(!1),[we,Se]=M.useState(!1),[ze,ut]=M.useState(0),[dt,Tt]=M.useState(0),ft=M.useRef(d.duration||$||lb),Ct=M.useRef(null),vt=M.useRef(null),At=v===0,Ft=v+1<=m,it=d.type,Mt=d.dismissible!==!1,pn=d.className||"",mn=d.descriptionClassName||"",Dt=M.useMemo(()=>y.findIndex(ve=>ve.toastId===d.id)||0,[y,d.id]),nn=M.useMemo(()=>{var ve;return(ve=d.closeButton)!=null?ve:S},[d.closeButton,S]),$n=M.useMemo(()=>d.duration||$||lb,[d.duration,$]),kr=M.useRef(0),On=M.useRef(0),Tr=M.useRef(0),rn=M.useRef(null),[or,I]=B.split("-"),X=M.useMemo(()=>y.reduce((ve,Ke,Ee)=>Ee>=Dt?ve:ve+Ke.height,0),[y,Dt]),ae=QD(),Ie=d.invert||u,ke=it==="loading";On.current=M.useMemo(()=>Dt*U+X,[Dt,X]),M.useEffect(()=>{ft.current=$n},[$n]),M.useEffect(()=>{Q(!0)},[]),M.useEffect(()=>{const ve=vt.current;if(ve){const Ke=ve.getBoundingClientRect().height;return Tt(Ke),p(Ee=>[{toastId:d.id,height:Ke,position:d.position},...Ee]),()=>p(Ee=>Ee.filter(at=>at.toastId!==d.id))}},[p,d.id]),M.useLayoutEffect(()=>{if(!G)return;const ve=vt.current,Ke=ve.style.height;ve.style.height="auto";const Ee=ve.getBoundingClientRect().height;ve.style.height=Ke,Tt(Ee),p(at=>at.find(Ye=>Ye.toastId===d.id)?at.map(Ye=>Ye.toastId===d.id?{...Ye,height:Ee}:Ye):[{toastId:d.id,height:Ee,position:d.position},...at])},[G,d.title,d.description,p,d.id,d.jsx,d.action,d.cancel]);const Ge=M.useCallback(()=>{me(!0),ut(On.current),p(ve=>ve.filter(Ke=>Ke.toastId!==d.id)),setTimeout(()=>{x(d)},dI)},[d,x,p,On]);M.useEffect(()=>{if(d.promise&&it==="loading"||d.duration===1/0||d.type==="loading")return;let ve;return E||h||ae?(()=>{if(Tr.current<kr.current){const at=new Date().getTime()-kr.current;ft.current=ft.current-at}Tr.current=new Date().getTime()})():(()=>{ft.current!==1/0&&(kr.current=new Date().getTime(),ve=setTimeout(()=>{d.onAutoClose==null||d.onAutoClose.call(d,d),Ge()},ft.current))})(),()=>clearTimeout(ve)},[E,h,d,it,ae,Ge]),M.useEffect(()=>{d.delete&&(Ge(),d.onDismiss==null||d.onDismiss.call(d,d))},[Ge,d.delete]);function bt(){var ve;if(H?.loading){var Ke;return M.createElement("div",{className:Mr(P?.loader,d==null||(Ke=d.classNames)==null?void 0:Ke.loader,"sonner-loader"),"data-visible":it==="loading"},H.loading)}return M.createElement(GD,{className:Mr(P?.loader,d==null||(ve=d.classNames)==null?void 0:ve.loader),visible:it==="loading"})}const qt=d.icon||H?.[it]||VD(it);var Cr,It;return M.createElement("li",{tabIndex:0,ref:vt,className:Mr(R,pn,P?.toast,d==null||(e=d.classNames)==null?void 0:e.toast,P?.default,P?.[it],d==null||(n=d.classNames)==null?void 0:n[it]),"data-sonner-toast":"","data-rich-colors":(Cr=d.richColors)!=null?Cr:T,"data-styled":!(d.jsx||d.unstyled||f),"data-mounted":G,"data-promise":!!d.promise,"data-swiped":we,"data-removed":J,"data-visible":Ft,"data-y-position":or,"data-x-position":I,"data-index":v,"data-front":At,"data-swiping":z,"data-dismissible":Mt,"data-type":it,"data-invert":Ie,"data-swipe-out":Me,"data-swipe-direction":te,"data-expanded":!!(E||j&&G),"data-testid":d.testId,style:{"--index":v,"--toasts-before":v,"--z-index":w.length-v,"--offset":`${J?ze:On.current}px`,"--initial-height":j?"auto":`${dt}px`,...k,...d.style},onDragEnd:()=>{Z(!1),ie(null),rn.current=null},onPointerDown:ve=>{ve.button!==2&&(ke||!Mt||(Ct.current=new Date,ut(On.current),ve.target.setPointerCapture(ve.pointerId),ve.target.tagName!=="BUTTON"&&(Z(!0),rn.current={x:ve.clientX,y:ve.clientY})))},onPointerUp:()=>{var ve,Ke,Ee;if(Me||!Mt)return;rn.current=null;const at=Number(((ve=vt.current)==null?void 0:ve.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Bn=Number(((Ke=vt.current)==null?void 0:Ke.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Ye=new Date().getTime()-((Ee=Ct.current)==null?void 0:Ee.getTime()),A=V==="x"?at:Bn,W=Math.abs(A)/Ye;if(Math.abs(A)>=uI||W>.11){ut(On.current),d.onDismiss==null||d.onDismiss.call(d,d),ye(V==="x"?at>0?"right":"left":Bn>0?"down":"up"),Ge(),he(!0);return}else{var Y,ce;(Y=vt.current)==null||Y.style.setProperty("--swipe-amount-x","0px"),(ce=vt.current)==null||ce.style.setProperty("--swipe-amount-y","0px")}Se(!1),Z(!1),ie(null)},onPointerMove:ve=>{var Ke,Ee,at;if(!rn.current||!Mt||((Ke=window.getSelection())==null?void 0:Ke.toString().length)>0)return;const Ye=ve.clientY-rn.current.y,A=ve.clientX-rn.current.x;var W;const Y=(W=t.swipeDirections)!=null?W:fI(B);!V&&(Math.abs(A)>1||Math.abs(Ye)>1)&&ie(Math.abs(A)>Math.abs(Ye)?"x":"y");let ce={x:0,y:0};const Re=Te=>1/(1.5+Math.abs(Te)/20);if(V==="y"){if(Y.includes("top")||Y.includes("bottom"))if(Y.includes("top")&&Ye<0||Y.includes("bottom")&&Ye>0)ce.y=Ye;else{const Te=Ye*Re(Ye);ce.y=Math.abs(Te)<Math.abs(Ye)?Te:Ye}}else if(V==="x"&&(Y.includes("left")||Y.includes("right")))if(Y.includes("left")&&A<0||Y.includes("right")&&A>0)ce.x=A;else{const Te=A*Re(A);ce.x=Math.abs(Te)<Math.abs(A)?Te:A}(Math.abs(ce.x)>0||Math.abs(ce.y)>0)&&Se(!0),(Ee=vt.current)==null||Ee.style.setProperty("--swipe-amount-x",`${ce.x}px`),(at=vt.current)==null||at.style.setProperty("--swipe-amount-y",`${ce.y}px`)}},nn&&!d.jsx&&it!=="loading"?M.createElement("button",{"aria-label":_,"data-disabled":ke,"data-close-button":!0,onClick:ke||!Mt?()=>{}:()=>{Ge(),d.onDismiss==null||d.onDismiss.call(d,d)},className:Mr(P?.closeButton,d==null||(r=d.classNames)==null?void 0:r.closeButton)},(It=H?.close)!=null?It:XD):null,(it||d.icon||d.promise)&&d.icon!==null&&(H?.[it]!==null||d.icon)?M.createElement("div",{"data-icon":"",className:Mr(P?.icon,d==null||(o=d.classNames)==null?void 0:o.icon)},d.promise||d.type==="loading"&&!d.icon?d.icon||bt():null,d.type!=="loading"?qt:null):null,M.createElement("div",{"data-content":"",className:Mr(P?.content,d==null||(s=d.classNames)==null?void 0:s.content)},M.createElement("div",{"data-title":"",className:Mr(P?.title,d==null||(i=d.classNames)==null?void 0:i.title)},d.jsx?d.jsx:typeof d.title=="function"?d.title():d.title),d.description?M.createElement("div",{"data-description":"",className:Mr(L,mn,P?.description,d==null||(a=d.classNames)==null?void 0:a.description)},typeof d.description=="function"?d.description():d.description):null),M.isValidElement(d.cancel)?d.cancel:d.cancel&&sc(d.cancel)?M.createElement("button",{"data-button":!0,"data-cancel":!0,style:d.cancelButtonStyle||C,onClick:ve=>{sc(d.cancel)&&Mt&&(d.cancel.onClick==null||d.cancel.onClick.call(d.cancel,ve),Ge())},className:Mr(P?.cancelButton,d==null||(l=d.classNames)==null?void 0:l.cancelButton)},d.cancel.label):null,M.isValidElement(d.action)?d.action:d.action&&sc(d.action)?M.createElement("button",{"data-button":!0,"data-action":!0,style:d.actionButtonStyle||N,onClick:ve=>{sc(d.action)&&(d.action.onClick==null||d.action.onClick.call(d.action,ve),!ve.defaultPrevented&&Ge())},className:Mr(P?.actionButton,d==null||(c=d.classNames)==null?void 0:c.actionButton)},d.action.label):null)};function cb(){if(typeof window>"u"||typeof document>"u")return"ltr";const t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function pI(t,e){const n={};return[t,e].forEach((r,o)=>{const s=o===1,i=s?"--mobile-offset":"--offset",a=s?aI:iI;function l(c){["top","right","bottom","left"].forEach(u=>{n[`${i}-${u}`]=typeof c=="number"?`${c}px`:c})}typeof r=="number"||typeof r=="string"?l(r):typeof r=="object"?["top","right","bottom","left"].forEach(c=>{r[c]===void 0?n[`${i}-${c}`]=a:n[`${i}-${c}`]=typeof r[c]=="number"?`${r[c]}px`:r[c]}):l(a)}),n}const mI=M.forwardRef(function(e,n){const{id:r,invert:o,position:s="bottom-right",hotkey:i=["altKey","KeyT"],expand:a,closeButton:l,className:c,offset:u,mobileOffset:d,theme:f="light",richColors:h,duration:p,style:m,visibleToasts:y=sI,toastOptions:v,dir:w=cb(),gap:E=cI,icons:x,containerAriaLabel:T="Notifications"}=e,[S,k]=M.useState([]),C=M.useMemo(()=>r?S.filter(G=>G.toasterId===r):S.filter(G=>!G.toasterId),[S,r]),N=M.useMemo(()=>Array.from(new Set([s].concat(C.filter(G=>G.position).map(G=>G.position)))),[C,s]),[R,L]=M.useState([]),[$,B]=M.useState(!1),[U,j]=M.useState(!1),[P,H]=M.useState(f!=="system"?f:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),_=M.useRef(null),V=i.join("+").replace(/Key/g,"").replace(/Digit/g,""),ie=M.useRef(null),te=M.useRef(!1),ye=M.useCallback(G=>{k(Q=>{var J;return(J=Q.find(me=>me.id===G.id))!=null&&J.delete||vn.dismiss(G.id),Q.filter(({id:me})=>me!==G.id)})},[]);return M.useEffect(()=>vn.subscribe(G=>{if(G.dismiss){requestAnimationFrame(()=>{k(Q=>Q.map(J=>J.id===G.id?{...J,delete:!0}:J))});return}setTimeout(()=>{Al.flushSync(()=>{k(Q=>{const J=Q.findIndex(me=>me.id===G.id);return J!==-1?[...Q.slice(0,J),{...Q[J],...G},...Q.slice(J+1)]:[G,...Q]})})})}),[S]),M.useEffect(()=>{if(f!=="system"){H(f);return}if(f==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?H("dark"):H("light")),typeof window>"u")return;const G=window.matchMedia("(prefers-color-scheme: dark)");try{G.addEventListener("change",({matches:Q})=>{H(Q?"dark":"light")})}catch{G.addListener(({matches:J})=>{try{H(J?"dark":"light")}catch(me){console.error(me)}})}},[f]),M.useEffect(()=>{S.length<=1&&B(!1)},[S]),M.useEffect(()=>{const G=Q=>{var J;if(i.every(Z=>Q[Z]||Q.code===Z)){var z;B(!0),(z=_.current)==null||z.focus()}Q.code==="Escape"&&(document.activeElement===_.current||(J=_.current)!=null&&J.contains(document.activeElement))&&B(!1)};return document.addEventListener("keydown",G),()=>document.removeEventListener("keydown",G)},[i]),M.useEffect(()=>{if(_.current)return()=>{ie.current&&(ie.current.focus({preventScroll:!0}),ie.current=null,te.current=!1)}},[_.current]),M.createElement("section",{ref:n,"aria-label":`${T} ${V}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},N.map((G,Q)=>{var J;const[me,z]=G.split("-");return C.length?M.createElement("ol",{key:G,dir:w==="auto"?cb():w,tabIndex:-1,ref:_,className:c,"data-sonner-toaster":!0,"data-sonner-theme":P,"data-y-position":me,"data-x-position":z,style:{"--front-toast-height":`${((J=R[0])==null?void 0:J.height)||0}px`,"--width":`${lI}px`,"--gap":`${E}px`,...m,...pI(u,d)},onBlur:Z=>{te.current&&!Z.currentTarget.contains(Z.relatedTarget)&&(te.current=!1,ie.current&&(ie.current.focus({preventScroll:!0}),ie.current=null))},onFocus:Z=>{Z.target instanceof HTMLElement&&Z.target.dataset.dismissible==="false"||te.current||(te.current=!0,ie.current=Z.relatedTarget)},onMouseEnter:()=>B(!0),onMouseMove:()=>B(!0),onMouseLeave:()=>{U||B(!1)},onDragEnd:()=>B(!1),onPointerDown:Z=>{Z.target instanceof HTMLElement&&Z.target.dataset.dismissible==="false"||j(!0)},onPointerUp:()=>j(!1)},C.filter(Z=>!Z.position&&Q===0||Z.position===G).map((Z,Me)=>{var he,we;return M.createElement(hI,{key:Z.id,icons:x,index:Me,toast:Z,defaultRichColors:h,duration:(he=v?.duration)!=null?he:p,className:v?.className,descriptionClassName:v?.descriptionClassName,invert:o,visibleToasts:y,closeButton:(we=v?.closeButton)!=null?we:l,interacting:U,position:G,style:v?.style,unstyled:v?.unstyled,classNames:v?.classNames,cancelButtonStyle:v?.cancelButtonStyle,actionButtonStyle:v?.actionButtonStyle,closeButtonAriaLabel:v?.closeButtonAriaLabel,removeToast:ye,toasts:C.filter(Se=>Se.position==Z.position),heights:R.filter(Se=>Se.position==Z.position),setHeights:L,expandByDefault:a,gap:E,expanded:$,swipeDirections:e.swipeDirections})})):null}))}),gI=18e4,yI="http://localhost:3000/api",RS=()=>"en-US";function gg(t){const{token:e,baseURL:n=yI,timeout:r=gI}=t,o=yt.create({baseURL:n,timeout:r,headers:{"accept-encoding":"gzip","Content-Type":t.isFileStore?"multipart/form-data":"application/json",...t.isFileStore?{}:{"content-language":RS()}},...t.isFileStore?{}:{withCredentials:!0},validateStatus:s=>s<300});return fo(o,{retries:3,retryDelay:fo.exponentialDelay,retryCondition:s=>{const i=uu(s);return!i||i>500||!s||!s.response}}),o.interceptors.request.use(s=>(e&&s.headers&&(t.isFileStore?s.headers.token=e:s.headers.Authorization=`Bearer ${e}`),s),s=>Promise.reject(s)),o.interceptors.response.use(s=>s,s=>{const i=MD(s);return $o.error(i),Pd(s,t.t,()=>{}),Promise.reject(s)}),o}const ub=new Map,ic=new Map,du=(t,e)=>async()=>{const n=Date.now(),r=ub.get(t);if(r&&n-r.timestamp<CD)return r.data;const o=ic.get(t);if(o)return o.promise;const s=e().then(i=>(ub.set(t,{data:i,timestamp:n}),ic.delete(t),i)).catch(i=>{throw ic.delete(t),i});return ic.set(t,{promise:s,timestamp:n}),s};class vI{isAuthorize;url;language;onError;api;token;toI18N;constructor(e,n,r,o){this.isAuthorize=!1,this.url=`${e}v1/`,this.language=o??RS(),this.onError=()=>{},this.toI18N=r,this.initApi(),this.token=n}setToken(e){this.isAuthorize=!!e,this.token=e}addErrorListener(e){this.onError=e}throwHTTPError(e){return Pd(e,this.toI18N,this.onError)}initApi(){this.api=gg({baseURL:this.url,t:this.toI18N,token:this.token,isFileStore:!1})}getErrorMessage(e){return e&&e.response&&e.response.data&&e.response.data.error?e.response.data.error:e&&e.response&&e.response.data&&e.response.data.message?e.response.data.message:null}getAllGroup(){return this.api.get("/group/").then(e=>e.data).catch(e=>this.throwHTTPError(e))}fetchGroupConversations(e,n){return du("group-conversations",()=>this.api.post("/group/fetch/conversations",{amount:e,from_time:n}).then(s=>s.data).catch(s=>this.throwHTTPError(s)))()}searchWebImage(e,n,r){return this.api.get("search/images",{params:{q:e,l:n,o:r}}).then(o=>o.data).catch(o=>this.throwHTTPError(o))}searchWebGif(e,n,r,o=!1){return this.api.get("search/gifs",{params:{q:e,l:n,o:r,in_china:o}}).then(s=>s.data).catch(s=>this.throwHTTPError(s))}fetchRandomGif(e){return this.api.get("search/gifs/random",{params:{q:e}}).then(n=>n.data).catch(n=>this.throwHTTPError(n))}fetchTrendyWebGif(e,n,r=!1){return this.api.get("search/gifs/trending",{params:{l:e,o:n,in_china:r}}).then(o=>o.data).catch(o=>this.throwHTTPError(o))}fetchTrendyWebImage(e,n){return this.api.get("search/images/trending",{params:{l:e,o:n}}).then(r=>r.data).catch(r=>this.throwHTTPError(r))}resolveUrl(e){return du(e,()=>this.api.post("url/resolve",{url:e}).then(o=>o.data).catch(o=>this.throwHTTPError(o)))()}resolveUrlForText(e){return this.api.post("url/resolve-text",{body:e}).then(n=>n.data).catch(n=>this.throwHTTPError(n))}}const Ut=[];for(let t=0;t<256;++t)Ut.push((t+256).toString(16).slice(1));function bI(t,e=0){return(Ut[t[e+0]]+Ut[t[e+1]]+Ut[t[e+2]]+Ut[t[e+3]]+"-"+Ut[t[e+4]]+Ut[t[e+5]]+"-"+Ut[t[e+6]]+Ut[t[e+7]]+"-"+Ut[t[e+8]]+Ut[t[e+9]]+"-"+Ut[t[e+10]]+Ut[t[e+11]]+Ut[t[e+12]]+Ut[t[e+13]]+Ut[t[e+14]]+Ut[t[e+15]]).toLowerCase()}let Yf;const xI=new Uint8Array(16);function wI(){if(!Yf){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Yf=crypto.getRandomValues.bind(crypto)}return Yf(xI)}const EI=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),db={randomUUID:EI};function SI(t,e,n){t=t||{};const r=t.random??t.rng?.()??wI();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=r[6]&15|64,r[8]=r[8]&63|128,bI(r)}function ho(t,e,n){return db.randomUUID&&!t?db.randomUUID():SI(t)}class kI{url;isAuthorize;api;token;toI18N;constructor(e,n,r){this.token=n,this.isAuthorize=!1,this.url=e,this.toI18N=r,this.initApi()}throwHTTPError(e){return Pd(e,this.toI18N,()=>{})}setToken(e){this.isAuthorize=!0,this.token=e}initApi(){this.isAuthorize=!1,this.api=gg({baseURL:this.url,t:this.toI18N,token:this.token,isFileStore:!0})}uploadUrl(e){const n={compress:!0,crop_square:!0,source_url:e};return this.api.post("/api/v1/upload/url",n,{headers:{"Content-Type":"application/json"}}).then(r=>r?.data?.data).catch(r=>this.throwHTTPError(r))}uploadImage(e){const n=new FormData;return n.set("file",e),n.set("compress","true"),n.set("target_name",ho()),this.api.post("/api/v1/upload/file",n).then(r=>r.data?.data??{}).catch(r=>this.throwHTTPError(r))}getFileNameAndExt(e){return e.split("/").pop()}}class TI{url;isAuthorize;api;token;toI18N;constructor(e,n,r){this.token=n,this.isAuthorize=!1,this.url=e,this.toI18N=r,this.initApi()}throwHTTPError(e){return Pd(e,this.toI18N,()=>{})}setToken(e){this.isAuthorize=!0,this.token=e}initApi(){this.api=gg({baseURL:this.url,t:this.toI18N,token:this.token,isFileStore:!1})}getRecommendationPost(e,n,r=0,o=10,s=[],i=[],a="",l=["user_data","post_counter"]){const c=`post-recommendation:${e}${n?`:${n}`:""}`;return du(c,()=>this.api.post("/recommendation/post",{group_id:e,post_id:n,included_user_ids:i,excluded_user_ids:s,keyword:a,offset:r,amount:o,scope:l}).then(d=>d.data).catch(d=>{if([400,404].indexOf(uu(d))>-1)throw new Error(this.toI18N(Nr.http.NOT_FOUND));return this.throwHTTPError(d)}))()}getRecommendationGroup(e,n=0,r=10,o=[],s=[],i="",a=["user_data"]){const l=`group-recommendation:${e}`;return du(l,()=>this.api.post("/recommendation/group",{group_id:e,included_user_ids:s,excluded_user_ids:o,keyword:i,offset:n,amount:r,scope:a}).then(u=>u.data).catch(u=>{if([400,404].indexOf(uu(u))>-1)throw new Error(this.toI18N(Nr.http.NOT_FOUND));return this.throwHTTPError(u)}))()}}const NS=M.createContext(null),CI=()=>{const t=M.useContext(NS);if(!t)throw new Error("usePostBuilder must be used within PostBuilderProvider");return t},Dl=()=>{const{api:t}=CI();return t};var ac={exports:{}},ri={};/*
|
|
7
|
+
object-assign
|
|
8
|
+
(c) Sindre Sorhus
|
|
9
|
+
@license MIT
|
|
10
|
+
*/var Jf,fb;function _S(){if(fb)return Jf;fb=1;var t=Object.getOwnPropertySymbols,e=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function r(s){if(s==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(s)}function o(){try{if(!Object.assign)return!1;var s=new String("abc");if(s[5]="de",Object.getOwnPropertyNames(s)[0]==="5")return!1;for(var i={},a=0;a<10;a++)i["_"+String.fromCharCode(a)]=a;var l=Object.getOwnPropertyNames(i).map(function(u){return i[u]});if(l.join("")!=="0123456789")return!1;var c={};return"abcdefghijklmnopqrst".split("").forEach(function(u){c[u]=u}),Object.keys(Object.assign({},c)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Jf=o()?Object.assign:function(s,i){for(var a,l=r(s),c,u=1;u<arguments.length;u++){a=Object(arguments[u]);for(var d in a)e.call(a,d)&&(l[d]=a[d]);if(t){c=t(a);for(var f=0;f<c.length;f++)n.call(a,c[f])&&(l[c[f]]=a[c[f]])}}return l},Jf}/** @license React v17.0.2
|
|
11
|
+
* react-jsx-runtime.production.min.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var hb;function AI(){if(hb)return ri;hb=1,_S();var t=M,e=60103;if(ri.Fragment=60107,typeof Symbol=="function"&&Symbol.for){var n=Symbol.for;e=n("react.element"),ri.Fragment=n("react.fragment")}var r=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o=Object.prototype.hasOwnProperty,s={key:!0,ref:!0,__self:!0,__source:!0};function i(a,l,c){var u,d={},f=null,h=null;c!==void 0&&(f=""+c),l.key!==void 0&&(f=""+l.key),l.ref!==void 0&&(h=l.ref);for(u in l)o.call(l,u)&&!s.hasOwnProperty(u)&&(d[u]=l[u]);if(a&&a.defaultProps)for(u in l=a.defaultProps,l)d[u]===void 0&&(d[u]=l[u]);return{$$typeof:e,type:a,key:f,ref:h,props:d,_owner:r.current}}return ri.jsx=i,ri.jsxs=i,ri}var Xf={};/** @license React v17.0.2
|
|
18
|
+
* react-jsx-runtime.development.js
|
|
19
|
+
*
|
|
20
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
21
|
+
*
|
|
22
|
+
* This source code is licensed under the MIT license found in the
|
|
23
|
+
* LICENSE file in the root directory of this source tree.
|
|
24
|
+
*/var pb;function MI(){return pb||(pb=1,(function(t){process.env.NODE_ENV!=="production"&&(function(){var e=M,n=_S(),r=60103,o=60106;t.Fragment=60107;var s=60108,i=60114,a=60109,l=60110,c=60112,u=60113,d=60120,f=60115,h=60116,p=60121,m=60122,y=60117,v=60129,w=60131;if(typeof Symbol=="function"&&Symbol.for){var E=Symbol.for;r=E("react.element"),o=E("react.portal"),t.Fragment=E("react.fragment"),s=E("react.strict_mode"),i=E("react.profiler"),a=E("react.provider"),l=E("react.context"),c=E("react.forward_ref"),u=E("react.suspense"),d=E("react.suspense_list"),f=E("react.memo"),h=E("react.lazy"),p=E("react.block"),m=E("react.server.block"),y=E("react.fundamental"),E("react.scope"),E("react.opaque.id"),v=E("react.debug_trace_mode"),E("react.offscreen"),w=E("react.legacy_hidden")}var x=typeof Symbol=="function"&&Symbol.iterator,T="@@iterator";function S(A){if(A===null||typeof A!="object")return null;var W=x&&A[x]||A[T];return typeof W=="function"?W:null}var k=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function C(A){{for(var W=arguments.length,Y=new Array(W>1?W-1:0),ce=1;ce<W;ce++)Y[ce-1]=arguments[ce];N("error",A,Y)}}function N(A,W,Y){{var ce=k.ReactDebugCurrentFrame,Re=ce.getStackAddendum();Re!==""&&(W+="%s",Y=Y.concat([Re]));var Te=Y.map(function(Le){return""+Le});Te.unshift("Warning: "+W),Function.prototype.apply.call(console[A],console,Te)}}var R=!1;function L(A){return!!(typeof A=="string"||typeof A=="function"||A===t.Fragment||A===i||A===v||A===s||A===u||A===d||A===w||R||typeof A=="object"&&A!==null&&(A.$$typeof===h||A.$$typeof===f||A.$$typeof===a||A.$$typeof===l||A.$$typeof===c||A.$$typeof===y||A.$$typeof===p||A[0]===m))}function $(A,W,Y){var ce=W.displayName||W.name||"";return A.displayName||(ce!==""?Y+"("+ce+")":Y)}function B(A){return A.displayName||"Context"}function U(A){if(A==null)return null;if(typeof A.tag=="number"&&C("Received an unexpected object in getComponentName(). This is likely a bug in React. Please file an issue."),typeof A=="function")return A.displayName||A.name||null;if(typeof A=="string")return A;switch(A){case t.Fragment:return"Fragment";case o:return"Portal";case i:return"Profiler";case s:return"StrictMode";case u:return"Suspense";case d:return"SuspenseList"}if(typeof A=="object")switch(A.$$typeof){case l:var W=A;return B(W)+".Consumer";case a:var Y=A;return B(Y._context)+".Provider";case c:return $(A,A.render,"ForwardRef");case f:return U(A.type);case p:return U(A._render);case h:{var ce=A,Re=ce._payload,Te=ce._init;try{return U(Te(Re))}catch{return null}}}return null}var j=0,P,H,_,V,ie,te,ye;function G(){}G.__reactDisabledLog=!0;function Q(){{if(j===0){P=console.log,H=console.info,_=console.warn,V=console.error,ie=console.group,te=console.groupCollapsed,ye=console.groupEnd;var A={configurable:!0,enumerable:!0,value:G,writable:!0};Object.defineProperties(console,{info:A,log:A,warn:A,error:A,group:A,groupCollapsed:A,groupEnd:A})}j++}}function J(){{if(j--,j===0){var A={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:n({},A,{value:P}),info:n({},A,{value:H}),warn:n({},A,{value:_}),error:n({},A,{value:V}),group:n({},A,{value:ie}),groupCollapsed:n({},A,{value:te}),groupEnd:n({},A,{value:ye})})}j<0&&C("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var me=k.ReactCurrentDispatcher,z;function Z(A,W,Y){{if(z===void 0)try{throw Error()}catch(Re){var ce=Re.stack.trim().match(/\n( *(at )?)/);z=ce&&ce[1]||""}return`
|
|
25
|
+
`+z+A}}var Me=!1,he;{var we=typeof WeakMap=="function"?WeakMap:Map;he=new we}function Se(A,W){if(!A||Me)return"";{var Y=he.get(A);if(Y!==void 0)return Y}var ce;Me=!0;var Re=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var Te;Te=me.current,me.current=null,Q();try{if(W){var Le=function(){throw Error()};if(Object.defineProperty(Le.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Le,[])}catch(Hn){ce=Hn}Reflect.construct(A,[],Le)}else{try{Le.call()}catch(Hn){ce=Hn}A.call(Le.prototype)}}else{try{throw Error()}catch(Hn){ce=Hn}A()}}catch(Hn){if(Hn&&ce&&typeof Hn.stack=="string"){for(var Pe=Hn.stack.split(`
|
|
26
|
+
`),Ot=ce.stack.split(`
|
|
27
|
+
`),lt=Pe.length-1,Ve=Ot.length-1;lt>=1&&Ve>=0&&Pe[lt]!==Ot[Ve];)Ve--;for(;lt>=1&&Ve>=0;lt--,Ve--)if(Pe[lt]!==Ot[Ve]){if(lt!==1||Ve!==1)do if(lt--,Ve--,Ve<0||Pe[lt]!==Ot[Ve]){var Fn=`
|
|
28
|
+
`+Pe[lt].replace(" at new "," at ");return typeof A=="function"&&he.set(A,Fn),Fn}while(lt>=1&&Ve>=0);break}}}finally{Me=!1,me.current=Te,J(),Error.prepareStackTrace=Re}var qr=A?A.displayName||A.name:"",aa=qr?Z(qr):"";return typeof A=="function"&&he.set(A,aa),aa}function ze(A,W,Y){return Se(A,!1)}function ut(A){var W=A.prototype;return!!(W&&W.isReactComponent)}function dt(A,W,Y){if(A==null)return"";if(typeof A=="function")return Se(A,ut(A));if(typeof A=="string")return Z(A);switch(A){case u:return Z("Suspense");case d:return Z("SuspenseList")}if(typeof A=="object")switch(A.$$typeof){case c:return ze(A.render);case f:return dt(A.type,W,Y);case p:return ze(A._render);case h:{var ce=A,Re=ce._payload,Te=ce._init;try{return dt(Te(Re),W,Y)}catch{}}}return""}var Tt={},ft=k.ReactDebugCurrentFrame;function Ct(A){if(A){var W=A._owner,Y=dt(A.type,A._source,W?W.type:null);ft.setExtraStackFrame(Y)}else ft.setExtraStackFrame(null)}function vt(A,W,Y,ce,Re){{var Te=Function.call.bind(Object.prototype.hasOwnProperty);for(var Le in A)if(Te(A,Le)){var Pe=void 0;try{if(typeof A[Le]!="function"){var Ot=Error((ce||"React class")+": "+Y+" type `"+Le+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof A[Le]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Ot.name="Invariant Violation",Ot}Pe=A[Le](W,Le,ce,Y,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(lt){Pe=lt}Pe&&!(Pe instanceof Error)&&(Ct(Re),C("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",ce||"React class",Y,Le,typeof Pe),Ct(null)),Pe instanceof Error&&!(Pe.message in Tt)&&(Tt[Pe.message]=!0,Ct(Re),C("Failed %s type: %s",Y,Pe.message),Ct(null))}}}var At=k.ReactCurrentOwner,Ft=Object.prototype.hasOwnProperty,it={key:!0,ref:!0,__self:!0,__source:!0},Mt,pn;function mn(A){if(Ft.call(A,"ref")){var W=Object.getOwnPropertyDescriptor(A,"ref").get;if(W&&W.isReactWarning)return!1}return A.ref!==void 0}function Dt(A){if(Ft.call(A,"key")){var W=Object.getOwnPropertyDescriptor(A,"key").get;if(W&&W.isReactWarning)return!1}return A.key!==void 0}function nn(A,W){typeof A.ref=="string"&&At.current}function $n(A,W){{var Y=function(){Mt||(Mt=!0,C("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",W))};Y.isReactWarning=!0,Object.defineProperty(A,"key",{get:Y,configurable:!0})}}function kr(A,W){{var Y=function(){pn||(pn=!0,C("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",W))};Y.isReactWarning=!0,Object.defineProperty(A,"ref",{get:Y,configurable:!0})}}var On=function(A,W,Y,ce,Re,Te,Le){var Pe={$$typeof:r,type:A,key:W,ref:Y,props:Le,_owner:Te};return Pe._store={},Object.defineProperty(Pe._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(Pe,"_self",{configurable:!1,enumerable:!1,writable:!1,value:ce}),Object.defineProperty(Pe,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Re}),Object.freeze&&(Object.freeze(Pe.props),Object.freeze(Pe)),Pe};function Tr(A,W,Y,ce,Re){{var Te,Le={},Pe=null,Ot=null;Y!==void 0&&(Pe=""+Y),Dt(W)&&(Pe=""+W.key),mn(W)&&(Ot=W.ref,nn(W,Re));for(Te in W)Ft.call(W,Te)&&!it.hasOwnProperty(Te)&&(Le[Te]=W[Te]);if(A&&A.defaultProps){var lt=A.defaultProps;for(Te in lt)Le[Te]===void 0&&(Le[Te]=lt[Te])}if(Pe||Ot){var Ve=typeof A=="function"?A.displayName||A.name||"Unknown":A;Pe&&$n(Le,Ve),Ot&&kr(Le,Ve)}return On(A,Pe,Ot,Re,ce,At.current,Le)}}var rn=k.ReactCurrentOwner,or=k.ReactDebugCurrentFrame;function I(A){if(A){var W=A._owner,Y=dt(A.type,A._source,W?W.type:null);or.setExtraStackFrame(Y)}else or.setExtraStackFrame(null)}var X;X=!1;function ae(A){return typeof A=="object"&&A!==null&&A.$$typeof===r}function Ie(){{if(rn.current){var A=U(rn.current.type);if(A)return`
|
|
29
|
+
|
|
30
|
+
Check the render method of \``+A+"`."}return""}}function ke(A){return""}var Ge={};function bt(A){{var W=Ie();if(!W){var Y=typeof A=="string"?A:A.displayName||A.name;Y&&(W=`
|
|
31
|
+
|
|
32
|
+
Check the top-level render call using <`+Y+">.")}return W}}function qt(A,W){{if(!A._store||A._store.validated||A.key!=null)return;A._store.validated=!0;var Y=bt(W);if(Ge[Y])return;Ge[Y]=!0;var ce="";A&&A._owner&&A._owner!==rn.current&&(ce=" It was passed a child from "+U(A._owner.type)+"."),I(A),C('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',Y,ce),I(null)}}function Cr(A,W){{if(typeof A!="object")return;if(Array.isArray(A))for(var Y=0;Y<A.length;Y++){var ce=A[Y];ae(ce)&&qt(ce,W)}else if(ae(A))A._store&&(A._store.validated=!0);else if(A){var Re=S(A);if(typeof Re=="function"&&Re!==A.entries)for(var Te=Re.call(A),Le;!(Le=Te.next()).done;)ae(Le.value)&&qt(Le.value,W)}}}function It(A){{var W=A.type;if(W==null||typeof W=="string")return;var Y;if(typeof W=="function")Y=W.propTypes;else if(typeof W=="object"&&(W.$$typeof===c||W.$$typeof===f))Y=W.propTypes;else return;if(Y){var ce=U(W);vt(Y,A.props,"prop",ce,A)}else if(W.PropTypes!==void 0&&!X){X=!0;var Re=U(W);C("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Re||"Unknown")}typeof W.getDefaultProps=="function"&&!W.getDefaultProps.isReactClassApproved&&C("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function ve(A){{for(var W=Object.keys(A.props),Y=0;Y<W.length;Y++){var ce=W[Y];if(ce!=="children"&&ce!=="key"){I(A),C("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",ce),I(null);break}}A.ref!==null&&(I(A),C("Invalid attribute `ref` supplied to `React.Fragment`."),I(null))}}function Ke(A,W,Y,ce,Re,Te){{var Le=L(A);if(!Le){var Pe="";(A===void 0||typeof A=="object"&&A!==null&&Object.keys(A).length===0)&&(Pe+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var Ot=ke();Ot?Pe+=Ot:Pe+=Ie();var lt;A===null?lt="null":Array.isArray(A)?lt="array":A!==void 0&&A.$$typeof===r?(lt="<"+(U(A.type)||"Unknown")+" />",Pe=" Did you accidentally export a JSX literal instead of a component?"):lt=typeof A,C("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",lt,Pe)}var Ve=Tr(A,W,Y,Re,Te);if(Ve==null)return Ve;if(Le){var Fn=W.children;if(Fn!==void 0)if(ce)if(Array.isArray(Fn)){for(var qr=0;qr<Fn.length;qr++)Cr(Fn[qr],A);Object.freeze&&Object.freeze(Fn)}else C("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Cr(Fn,A)}return A===t.Fragment?ve(Ve):It(Ve),Ve}}function Ee(A,W,Y){return Ke(A,W,Y,!0)}function at(A,W,Y){return Ke(A,W,Y,!1)}var Bn=at,Ye=Ee;t.jsx=Bn,t.jsxs=Ye})()})(Xf)),Xf}var mb;function OI(){return mb||(mb=1,process.env.NODE_ENV==="production"?ac.exports=AI():ac.exports=MI()),ac.exports}var g=OI();const RI=({children:t,apiBaseURL:e,authToken:n,toI18N:r,i18nKeys:o})=>{const s=M.useCallback((l,c)=>{const u=r(o[l]);return u||c||l},[r,o]),i=M.useMemo(()=>{const l=new vI(e.core,n,r),c=new TI(e.mfs,n,r),u=new kI(e.fileStore,n,r);return l.initApi(),c.initApi(),u.initApi(),{core:l,mfs:c,fileStore:u}},[n,e,r]),a=M.useMemo(()=>({authToken:n,t:s,i18nKeys:o,api:i}),[i,n,s,o]);return g.jsx(NS.Provider,{value:a,children:t})};function ne(t,e,{checkForDefaultPrevented:n=!0}={}){return function(o){if(t?.(o),n===!1||!o.defaultPrevented)return e?.(o)}}function NI(t,e){const n=b.createContext(e),r=s=>{const{children:i,...a}=s,l=b.useMemo(()=>a,Object.values(a));return g.jsx(n.Provider,{value:l,children:i})};r.displayName=t+"Provider";function o(s){const i=b.useContext(n);if(i)return i;if(e!==void 0)return e;throw new Error(`\`${s}\` must be used within \`${t}\``)}return[r,o]}function Ln(t,e=[]){let n=[];function r(s,i){const a=b.createContext(i),l=n.length;n=[...n,i];const c=d=>{const{scope:f,children:h,...p}=d,m=f?.[t]?.[l]||a,y=b.useMemo(()=>p,Object.values(p));return g.jsx(m.Provider,{value:y,children:h})};c.displayName=s+"Provider";function u(d,f){const h=f?.[t]?.[l]||a,p=b.useContext(h);if(p)return p;if(i!==void 0)return i;throw new Error(`\`${d}\` must be used within \`${s}\``)}return[c,u]}const o=()=>{const s=n.map(i=>b.createContext(i));return function(a){const l=a?.[t]||s;return b.useMemo(()=>({[`__scope${t}`]:{...a,[t]:l}}),[a,l])}};return o.scopeName=t,[r,_I(o,...e)]}function _I(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const i=r.reduce((a,{useScope:l,scopeName:c})=>{const d=l(s)[`__scope${c}`];return{...a,...d}},{});return b.useMemo(()=>({[`__scope${e.scopeName}`]:i}),[i])}};return n.scopeName=e.scopeName,n}function gb(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Ld(...t){return e=>{let n=!1;const r=t.map(o=>{const s=gb(o,e);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():gb(t[o],null)}}}}function Fe(...t){return b.useCallback(Ld(...t),t)}function Yo(t){const e=II(t),n=b.forwardRef((r,o)=>{const{children:s,...i}=r,a=b.Children.toArray(s),l=a.find(LI);if(l){const c=l.props.children,u=a.map(d=>d===l?b.Children.count(c)>1?b.Children.only(null):b.isValidElement(c)?c.props.children:null:d);return g.jsx(e,{...i,ref:o,children:b.isValidElement(c)?b.cloneElement(c,void 0,u):null})}return g.jsx(e,{...i,ref:o,children:s})});return n.displayName=`${t}.Slot`,n}var DI=Yo("Slot");function II(t){const e=b.forwardRef((n,r)=>{const{children:o,...s}=n;if(b.isValidElement(o)){const i=$I(o),a=jI(s,o.props);return o.type!==b.Fragment&&(a.ref=r?Ld(r,i):i),b.cloneElement(o,a)}return b.Children.count(o)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var DS=Symbol("radix.slottable");function PI(t){const e=({children:n})=>g.jsx(g.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=DS,e}function LI(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===DS}function jI(t,e){const n={...e};for(const r in e){const o=t[r],s=e[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{const l=s(...a);return o(...a),l}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...t,...n}}function $I(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function yg(t){const e=t+"CollectionProvider",[n,r]=Ln(e),[o,s]=n(e,{collectionRef:{current:null},itemMap:new Map}),i=m=>{const{scope:y,children:v}=m,w=M.useRef(null),E=M.useRef(new Map).current;return g.jsx(o,{scope:y,itemMap:E,collectionRef:w,children:v})};i.displayName=e;const a=t+"CollectionSlot",l=Yo(a),c=M.forwardRef((m,y)=>{const{scope:v,children:w}=m,E=s(a,v),x=Fe(y,E.collectionRef);return g.jsx(l,{ref:x,children:w})});c.displayName=a;const u=t+"CollectionItemSlot",d="data-radix-collection-item",f=Yo(u),h=M.forwardRef((m,y)=>{const{scope:v,children:w,...E}=m,x=M.useRef(null),T=Fe(y,x),S=s(u,v);return M.useEffect(()=>(S.itemMap.set(x,{ref:x,...E}),()=>void S.itemMap.delete(x))),g.jsx(f,{[d]:"",ref:T,children:w})});h.displayName=u;function p(m){const y=s(t+"CollectionConsumer",m);return M.useCallback(()=>{const w=y.collectionRef.current;if(!w)return[];const E=Array.from(w.querySelectorAll(`[${d}]`));return Array.from(y.itemMap.values()).sort((S,k)=>E.indexOf(S.ref.current)-E.indexOf(k.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:i,Slot:c,ItemSlot:h},p,r]}var Nt=globalThis?.document?b.useLayoutEffect:()=>{},BI=b[" useId ".trim().toString()]||(()=>{}),FI=0;function Kn(t){const[e,n]=b.useState(BI());return Nt(()=>{n(r=>r??String(FI++))},[t]),e?`radix-${e}`:""}var HI=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ge=HI.reduce((t,e)=>{const n=Yo(`Primitive.${e}`),r=b.forwardRef((o,s)=>{const{asChild:i,...a}=o,l=i?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),g.jsx(l,{...a,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function IS(t,e){t&&Md.flushSync(()=>t.dispatchEvent(e))}function pr(t){const e=b.useRef(t);return b.useEffect(()=>{e.current=t}),b.useMemo(()=>(...n)=>e.current?.(...n),[])}var UI=b[" useInsertionEffect ".trim().toString()]||Nt;function po({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[o,s,i]=zI({defaultProp:e,onChange:n}),a=t!==void 0,l=a?t:o;{const u=b.useRef(t!==void 0);b.useEffect(()=>{const d=u.current;d!==a&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=a},[a,r])}const c=b.useCallback(u=>{if(a){const d=VI(u)?u(t):u;d!==t&&i.current?.(d)}else s(u)},[a,t,s,i]);return[l,c]}function zI({defaultProp:t,onChange:e}){const[n,r]=b.useState(t),o=b.useRef(n),s=b.useRef(e);return UI(()=>{s.current=e},[e]),b.useEffect(()=>{o.current!==n&&(s.current?.(n),o.current=n)},[n,o]),[n,r,s]}function VI(t){return typeof t=="function"}var WI=b.createContext(void 0);function jd(t){const e=b.useContext(WI);return t||e||"ltr"}var Qf="rovingFocusGroup.onEntryFocus",GI={bubbles:!1,cancelable:!0},Il="RovingFocusGroup",[Tp,PS,qI]=yg(Il),[KI,$d]=Ln(Il,[qI]),[YI,JI]=KI(Il),LS=b.forwardRef((t,e)=>g.jsx(Tp.Provider,{scope:t.__scopeRovingFocusGroup,children:g.jsx(Tp.Slot,{scope:t.__scopeRovingFocusGroup,children:g.jsx(XI,{...t,ref:e})})}));LS.displayName=Il;var XI=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:s,currentTabStopId:i,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...d}=t,f=b.useRef(null),h=Fe(e,f),p=jd(s),[m,y]=po({prop:i,defaultProp:a??null,onChange:l,caller:Il}),[v,w]=b.useState(!1),E=pr(c),x=PS(n),T=b.useRef(!1),[S,k]=b.useState(0);return b.useEffect(()=>{const C=f.current;if(C)return C.addEventListener(Qf,E),()=>C.removeEventListener(Qf,E)},[E]),g.jsx(YI,{scope:n,orientation:r,dir:p,loop:o,currentTabStopId:m,onItemFocus:b.useCallback(C=>y(C),[y]),onItemShiftTab:b.useCallback(()=>w(!0),[]),onFocusableItemAdd:b.useCallback(()=>k(C=>C+1),[]),onFocusableItemRemove:b.useCallback(()=>k(C=>C-1),[]),children:g.jsx(ge.div,{tabIndex:v||S===0?-1:0,"data-orientation":r,...d,ref:h,style:{outline:"none",...t.style},onMouseDown:ne(t.onMouseDown,()=>{T.current=!0}),onFocus:ne(t.onFocus,C=>{const N=!T.current;if(C.target===C.currentTarget&&N&&!v){const R=new CustomEvent(Qf,GI);if(C.currentTarget.dispatchEvent(R),!R.defaultPrevented){const L=x().filter(P=>P.focusable),$=L.find(P=>P.active),B=L.find(P=>P.id===m),j=[$,B,...L].filter(Boolean).map(P=>P.ref.current);BS(j,u)}}T.current=!1}),onBlur:ne(t.onBlur,()=>w(!1))})})}),jS="RovingFocusGroupItem",$S=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,children:i,...a}=t,l=Kn(),c=s||l,u=JI(jS,n),d=u.currentTabStopId===c,f=PS(n),{onFocusableItemAdd:h,onFocusableItemRemove:p,currentTabStopId:m}=u;return b.useEffect(()=>{if(r)return h(),()=>p()},[r,h,p]),g.jsx(Tp.ItemSlot,{scope:n,id:c,focusable:r,active:o,children:g.jsx(ge.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...a,ref:e,onMouseDown:ne(t.onMouseDown,y=>{r?u.onItemFocus(c):y.preventDefault()}),onFocus:ne(t.onFocus,()=>u.onItemFocus(c)),onKeyDown:ne(t.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){u.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const v=eP(y,u.orientation,u.dir);if(v!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let E=f().filter(x=>x.focusable).map(x=>x.ref.current);if(v==="last")E.reverse();else if(v==="prev"||v==="next"){v==="prev"&&E.reverse();const x=E.indexOf(y.currentTarget);E=u.loop?tP(E,x+1):E.slice(x+1)}setTimeout(()=>BS(E))}}),children:typeof i=="function"?i({isCurrentTabStop:d,hasTabStop:m!=null}):i})})});$S.displayName=jS;var QI={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function ZI(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function eP(t,e,n){const r=ZI(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return QI[r]}function BS(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function tP(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var FS=LS,HS=$S;function nP(t,e){return b.useReducer((n,r)=>e[n][r]??n,t)}var jn=t=>{const{present:e,children:n}=t,r=rP(e),o=typeof n=="function"?n({present:r.isPresent}):b.Children.only(n),s=Fe(r.ref,oP(o));return typeof n=="function"||r.isPresent?b.cloneElement(o,{ref:s}):null};jn.displayName="Presence";function rP(t){const[e,n]=b.useState(),r=b.useRef(null),o=b.useRef(t),s=b.useRef("none"),i=t?"mounted":"unmounted",[a,l]=nP(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return b.useEffect(()=>{const c=lc(r.current);s.current=a==="mounted"?c:"none"},[a]),Nt(()=>{const c=r.current,u=o.current;if(u!==t){const f=s.current,h=lc(c);t?l("MOUNT"):h==="none"||c?.display==="none"?l("UNMOUNT"):l(u&&f!==h?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,l]),Nt(()=>{if(e){let c;const u=e.ownerDocument.defaultView??window,d=h=>{const m=lc(r.current).includes(CSS.escape(h.animationName));if(h.target===e&&m&&(l("ANIMATION_END"),!o.current)){const y=e.style.animationFillMode;e.style.animationFillMode="forwards",c=u.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=y)})}},f=h=>{h.target===e&&(s.current=lc(r.current))};return e.addEventListener("animationstart",f),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{u.clearTimeout(c),e.removeEventListener("animationstart",f),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:b.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function lc(t){return t?.animationName||"none"}function oP(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var Bd="Tabs",[sP]=Ln(Bd,[$d]),US=$d(),[iP,vg]=sP(Bd),zS=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:s,orientation:i="horizontal",dir:a,activationMode:l="automatic",...c}=t,u=jd(a),[d,f]=po({prop:r,onChange:o,defaultProp:s??"",caller:Bd});return g.jsx(iP,{scope:n,baseId:Kn(),value:d,onValueChange:f,orientation:i,dir:u,activationMode:l,children:g.jsx(ge.div,{dir:u,"data-orientation":i,...c,ref:e})})});zS.displayName=Bd;var VS="TabsList",WS=b.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...o}=t,s=vg(VS,n),i=US(n);return g.jsx(FS,{asChild:!0,...i,orientation:s.orientation,dir:s.dir,loop:r,children:g.jsx(ge.div,{role:"tablist","aria-orientation":s.orientation,...o,ref:e})})});WS.displayName=VS;var GS="TabsTrigger",qS=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...s}=t,i=vg(GS,n),a=US(n),l=JS(i.baseId,r),c=XS(i.baseId,r),u=r===i.value;return g.jsx(HS,{asChild:!0,...a,focusable:!o,active:u,children:g.jsx(ge.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":c,"data-state":u?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:l,...s,ref:e,onMouseDown:ne(t.onMouseDown,d=>{!o&&d.button===0&&d.ctrlKey===!1?i.onValueChange(r):d.preventDefault()}),onKeyDown:ne(t.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&i.onValueChange(r)}),onFocus:ne(t.onFocus,()=>{const d=i.activationMode!=="manual";!u&&!o&&d&&i.onValueChange(r)})})})});qS.displayName=GS;var KS="TabsContent",YS=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:o,children:s,...i}=t,a=vg(KS,n),l=JS(a.baseId,r),c=XS(a.baseId,r),u=r===a.value,d=b.useRef(u);return b.useEffect(()=>{const f=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(f)},[]),g.jsx(jn,{present:o||u,children:({present:f})=>g.jsx(ge.div,{"data-state":u?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":l,hidden:!f,id:c,tabIndex:0,...i,ref:e,style:{...t.style,animationDuration:d.current?"0s":void 0},children:f&&s})})});YS.displayName=KS;function JS(t,e){return`${t}-trigger-${e}`}function XS(t,e){return`${t}-content-${e}`}var aP=zS,lP=WS,cP=qS,uP=YS;function dP(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)n.hasOwnProperty(r)&&(t[r]=n[r])}return t}function Cp(t,e){return Array(e+1).join(t)}function fP(t){return t.replace(/^\n*/,"")}function hP(t){for(var e=t.length;e>0&&t[e-1]===`
|
|
33
|
+
`;)e--;return t.substring(0,e)}var pP=["ADDRESS","ARTICLE","ASIDE","AUDIO","BLOCKQUOTE","BODY","CANVAS","CENTER","DD","DIR","DIV","DL","DT","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","FRAMESET","H1","H2","H3","H4","H5","H6","HEADER","HGROUP","HR","HTML","ISINDEX","LI","MAIN","MENU","NAV","NOFRAMES","NOSCRIPT","OL","OUTPUT","P","PRE","SECTION","TABLE","TBODY","TD","TFOOT","TH","THEAD","TR","UL"];function bg(t){return xg(t,pP)}var QS=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function ZS(t){return xg(t,QS)}function mP(t){return tk(t,QS)}var ek=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function gP(t){return xg(t,ek)}function yP(t){return tk(t,ek)}function xg(t,e){return e.indexOf(t.nodeName)>=0}function tk(t,e){return t.getElementsByTagName&&e.some(function(n){return t.getElementsByTagName(n).length})}var en={};en.paragraph={filter:"p",replacement:function(t){return`
|
|
34
|
+
|
|
35
|
+
`+t+`
|
|
36
|
+
|
|
37
|
+
`}};en.lineBreak={filter:"br",replacement:function(t,e,n){return n.br+`
|
|
38
|
+
`}};en.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function(t,e,n){var r=Number(e.nodeName.charAt(1));if(n.headingStyle==="setext"&&r<3){var o=Cp(r===1?"=":"-",t.length);return`
|
|
39
|
+
|
|
40
|
+
`+t+`
|
|
41
|
+
`+o+`
|
|
42
|
+
|
|
43
|
+
`}else return`
|
|
44
|
+
|
|
45
|
+
`+Cp("#",r)+" "+t+`
|
|
46
|
+
|
|
47
|
+
`}};en.blockquote={filter:"blockquote",replacement:function(t){return t=t.replace(/^\n+|\n+$/g,""),t=t.replace(/^/gm,"> "),`
|
|
48
|
+
|
|
49
|
+
`+t+`
|
|
50
|
+
|
|
51
|
+
`}};en.list={filter:["ul","ol"],replacement:function(t,e){var n=e.parentNode;return n.nodeName==="LI"&&n.lastElementChild===e?`
|
|
52
|
+
`+t:`
|
|
53
|
+
|
|
54
|
+
`+t+`
|
|
55
|
+
|
|
56
|
+
`}};en.listItem={filter:"li",replacement:function(t,e,n){var r=n.bulletListMarker+" ",o=e.parentNode;if(o.nodeName==="OL"){var s=o.getAttribute("start"),i=Array.prototype.indexOf.call(o.children,e);r=(s?Number(s)+i:i+1)+". "}return t=t.replace(/^\n+/,"").replace(/\n+$/,`
|
|
57
|
+
`).replace(/\n/gm,`
|
|
58
|
+
`+" ".repeat(r.length)),r+t+(e.nextSibling&&!/\n$/.test(t)?`
|
|
59
|
+
`:"")}};en.indentedCodeBlock={filter:function(t,e){return e.codeBlockStyle==="indented"&&t.nodeName==="PRE"&&t.firstChild&&t.firstChild.nodeName==="CODE"},replacement:function(t,e,n){return`
|
|
60
|
+
|
|
61
|
+
`+e.firstChild.textContent.replace(/\n/g,`
|
|
62
|
+
`)+`
|
|
63
|
+
|
|
64
|
+
`}};en.fencedCodeBlock={filter:function(t,e){return e.codeBlockStyle==="fenced"&&t.nodeName==="PRE"&&t.firstChild&&t.firstChild.nodeName==="CODE"},replacement:function(t,e,n){for(var r=e.firstChild.getAttribute("class")||"",o=(r.match(/language-(\S+)/)||[null,""])[1],s=e.firstChild.textContent,i=n.fence.charAt(0),a=3,l=new RegExp("^"+i+"{3,}","gm"),c;c=l.exec(s);)c[0].length>=a&&(a=c[0].length+1);var u=Cp(i,a);return`
|
|
65
|
+
|
|
66
|
+
`+u+o+`
|
|
67
|
+
`+s.replace(/\n$/,"")+`
|
|
68
|
+
`+u+`
|
|
69
|
+
|
|
70
|
+
`}};en.horizontalRule={filter:"hr",replacement:function(t,e,n){return`
|
|
71
|
+
|
|
72
|
+
`+n.hr+`
|
|
73
|
+
|
|
74
|
+
`}};en.inlineLink={filter:function(t,e){return e.linkStyle==="inlined"&&t.nodeName==="A"&&t.getAttribute("href")},replacement:function(t,e){var n=e.getAttribute("href");n&&(n=n.replace(/([()])/g,"\\$1"));var r=fu(e.getAttribute("title"));return r&&(r=' "'+r.replace(/"/g,'\\"')+'"'),"["+t+"]("+n+r+")"}};en.referenceLink={filter:function(t,e){return e.linkStyle==="referenced"&&t.nodeName==="A"&&t.getAttribute("href")},replacement:function(t,e,n){var r=e.getAttribute("href"),o=fu(e.getAttribute("title"));o&&(o=' "'+o+'"');var s,i;switch(n.linkReferenceStyle){case"collapsed":s="["+t+"][]",i="["+t+"]: "+r+o;break;case"shortcut":s="["+t+"]",i="["+t+"]: "+r+o;break;default:var a=this.references.length+1;s="["+t+"]["+a+"]",i="["+a+"]: "+r+o}return this.references.push(i),s},references:[],append:function(t){var e="";return this.references.length&&(e=`
|
|
75
|
+
|
|
76
|
+
`+this.references.join(`
|
|
77
|
+
`)+`
|
|
78
|
+
|
|
79
|
+
`,this.references=[]),e}};en.emphasis={filter:["em","i"],replacement:function(t,e,n){return t.trim()?n.emDelimiter+t+n.emDelimiter:""}};en.strong={filter:["strong","b"],replacement:function(t,e,n){return t.trim()?n.strongDelimiter+t+n.strongDelimiter:""}};en.code={filter:function(t){var e=t.previousSibling||t.nextSibling,n=t.parentNode.nodeName==="PRE"&&!e;return t.nodeName==="CODE"&&!n},replacement:function(t){if(!t)return"";t=t.replace(/\r?\n|\r/g," ");for(var e=/^`|^ .*?[^ ].* $|`$/.test(t)?" ":"",n="`",r=t.match(/`+/gm)||[];r.indexOf(n)!==-1;)n=n+"`";return n+e+t+e+n}};en.image={filter:"img",replacement:function(t,e){var n=fu(e.getAttribute("alt")),r=e.getAttribute("src")||"",o=fu(e.getAttribute("title")),s=o?' "'+o+'"':"";return r?"":""}};function fu(t){return t?t.replace(/(\n+\s*)+/g,`
|
|
80
|
+
`):""}function nk(t){this.options=t,this._keep=[],this._remove=[],this.blankRule={replacement:t.blankReplacement},this.keepReplacement=t.keepReplacement,this.defaultRule={replacement:t.defaultReplacement},this.array=[];for(var e in t.rules)this.array.push(t.rules[e])}nk.prototype={add:function(t,e){this.array.unshift(e)},keep:function(t){this._keep.unshift({filter:t,replacement:this.keepReplacement})},remove:function(t){this._remove.unshift({filter:t,replacement:function(){return""}})},forNode:function(t){if(t.isBlank)return this.blankRule;var e;return(e=Zf(this.array,t,this.options))||(e=Zf(this._keep,t,this.options))||(e=Zf(this._remove,t,this.options))?e:this.defaultRule},forEach:function(t){for(var e=0;e<this.array.length;e++)t(this.array[e],e)}};function Zf(t,e,n){for(var r=0;r<t.length;r++){var o=t[r];if(vP(o,e,n))return o}}function vP(t,e,n){var r=t.filter;if(typeof r=="string"){if(r===e.nodeName.toLowerCase())return!0}else if(Array.isArray(r)){if(r.indexOf(e.nodeName.toLowerCase())>-1)return!0}else if(typeof r=="function"){if(r.call(t,e,n))return!0}else throw new TypeError("`filter` needs to be a string, array, or function")}function bP(t){var e=t.element,n=t.isBlock,r=t.isVoid,o=t.isPre||function(d){return d.nodeName==="PRE"};if(!(!e.firstChild||o(e))){for(var s=null,i=!1,a=null,l=yb(a,e,o);l!==e;){if(l.nodeType===3||l.nodeType===4){var c=l.data.replace(/[ \r\n\t]+/g," ");if((!s||/ $/.test(s.data))&&!i&&c[0]===" "&&(c=c.substr(1)),!c){l=eh(l);continue}l.data=c,s=l}else if(l.nodeType===1)n(l)||l.nodeName==="BR"?(s&&(s.data=s.data.replace(/ $/,"")),s=null,i=!1):r(l)||o(l)?(s=null,i=!0):s&&(i=!1);else{l=eh(l);continue}var u=yb(a,l,o);a=l,l=u}s&&(s.data=s.data.replace(/ $/,""),s.data||eh(s))}}function eh(t){var e=t.nextSibling||t.parentNode;return t.parentNode.removeChild(t),e}function yb(t,e,n){return t&&t.parentNode===e||n(e)?e.nextSibling||e.parentNode:e.firstChild||e.nextSibling||e.parentNode}var wg=typeof window<"u"?window:{};function xP(){var t=wg.DOMParser,e=!1;try{new t().parseFromString("","text/html")&&(e=!0)}catch{}return e}function wP(){var t=function(){};return EP()?t.prototype.parseFromString=function(e){var n=new window.ActiveXObject("htmlfile");return n.designMode="on",n.open(),n.write(e),n.close(),n}:t.prototype.parseFromString=function(e){var n=document.implementation.createHTMLDocument("");return n.open(),n.write(e),n.close(),n},t}function EP(){var t=!1;try{document.implementation.createHTMLDocument("").open()}catch{wg.ActiveXObject&&(t=!0)}return t}var SP=xP()?wg.DOMParser:wP();function kP(t,e){var n;if(typeof t=="string"){var r=TP().parseFromString('<x-turndown id="turndown-root">'+t+"</x-turndown>","text/html");n=r.getElementById("turndown-root")}else n=t.cloneNode(!0);return bP({element:n,isBlock:bg,isVoid:ZS,isPre:e.preformattedCode?CP:null}),n}var th;function TP(){return th=th||new SP,th}function CP(t){return t.nodeName==="PRE"||t.nodeName==="CODE"}function AP(t,e){return t.isBlock=bg(t),t.isCode=t.nodeName==="CODE"||t.parentNode.isCode,t.isBlank=MP(t),t.flankingWhitespace=OP(t,e),t}function MP(t){return!ZS(t)&&!gP(t)&&/^\s*$/i.test(t.textContent)&&!mP(t)&&!yP(t)}function OP(t,e){if(t.isBlock||e.preformattedCode&&t.isCode)return{leading:"",trailing:""};var n=RP(t.textContent);return n.leadingAscii&&vb("left",t,e)&&(n.leading=n.leadingNonAscii),n.trailingAscii&&vb("right",t,e)&&(n.trailing=n.trailingNonAscii),{leading:n.leading,trailing:n.trailing}}function RP(t){var e=t.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);return{leading:e[1],leadingAscii:e[2],leadingNonAscii:e[3],trailing:e[4],trailingNonAscii:e[5],trailingAscii:e[6]}}function vb(t,e,n){var r,o,s;return t==="left"?(r=e.previousSibling,o=/ $/):(r=e.nextSibling,o=/^ /),r&&(r.nodeType===3?s=o.test(r.nodeValue):n.preformattedCode&&r.nodeName==="CODE"?s=!1:r.nodeType===1&&!bg(r)&&(s=o.test(r.textContent))),s}var NP=Array.prototype.reduce,_P=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function hu(t){if(!(this instanceof hu))return new hu(t);var e={rules:en,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(n,r){return r.isBlock?`
|
|
81
|
+
|
|
82
|
+
`:""},keepReplacement:function(n,r){return r.isBlock?`
|
|
83
|
+
|
|
84
|
+
`+r.outerHTML+`
|
|
85
|
+
|
|
86
|
+
`:r.outerHTML},defaultReplacement:function(n,r){return r.isBlock?`
|
|
87
|
+
|
|
88
|
+
`+n+`
|
|
89
|
+
|
|
90
|
+
`:n}};this.options=dP({},e,t),this.rules=new nk(this.options)}hu.prototype={turndown:function(t){if(!PP(t))throw new TypeError(t+" is not a string, or an element/document/fragment node.");if(t==="")return"";var e=rk.call(this,new kP(t,this.options));return DP.call(this,e)},use:function(t){if(Array.isArray(t))for(var e=0;e<t.length;e++)this.use(t[e]);else if(typeof t=="function")t(this);else throw new TypeError("plugin must be a Function or an Array of Functions");return this},addRule:function(t,e){return this.rules.add(t,e),this},keep:function(t){return this.rules.keep(t),this},remove:function(t){return this.rules.remove(t),this},escape:function(t){return _P.reduce(function(e,n){return e.replace(n[0],n[1])},t)}};function rk(t){var e=this;return NP.call(t.childNodes,function(n,r){r=new AP(r,e.options);var o="";return r.nodeType===3?o=r.isCode?r.nodeValue:e.escape(r.nodeValue):r.nodeType===1&&(o=IP.call(e,r)),ok(n,o)},"")}function DP(t){var e=this;return this.rules.forEach(function(n){typeof n.append=="function"&&(t=ok(t,n.append(e.options)))}),t.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function IP(t){var e=this.rules.forNode(t),n=rk.call(this,t),r=t.flankingWhitespace;return(r.leading||r.trailing)&&(n=n.trim()),r.leading+e.replacement(n,t,this.options)+r.trailing}function ok(t,e){var n=hP(t),r=fP(e),o=Math.max(t.length-n.length,e.length-r.length),s=`
|
|
91
|
+
|
|
92
|
+
`.substring(0,o);return n+s+r}function PP(t){return t!=null&&(typeof t=="string"||t.nodeType&&(t.nodeType===1||t.nodeType===9||t.nodeType===11))}const LP=new hu;LP.addRule("linkPreview",{filter:t=>t.nodeName==="DIV"&&t.classList.contains("link-preview-block"),replacement:(t,e)=>{const n=e,o=n.querySelector("p")?.textContent||n.getAttribute("data-url")||"",s=n.getAttribute("data-url")||o;return`[${o}](${s})`}});function sk(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var o=t.length;for(e=0;e<o;e++)t[e]&&(n=sk(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function ik(){for(var t,e,n=0,r="",o=arguments.length;n<o;n++)(t=arguments[n])&&(e=sk(t))&&(r&&(r+=" "),r+=e);return r}const Eg="-",jP=t=>{const e=BP(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:i=>{const a=i.split(Eg);return a[0]===""&&a.length!==1&&a.shift(),ak(a,e)||$P(i)},getConflictingClassGroupIds:(i,a)=>{const l=n[i]||[];return a&&r[i]?[...l,...r[i]]:l}}},ak=(t,e)=>{if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),o=r?ak(t.slice(1),r):void 0;if(o)return o;if(e.validators.length===0)return;const s=t.join(Eg);return e.validators.find(({validator:i})=>i(s))?.classGroupId},bb=/^\[(.+)\]$/,$P=t=>{if(bb.test(t)){const e=bb.exec(t)[1],n=e?.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},BP=t=>{const{theme:e,classGroups:n}=t,r={nextPart:new Map,validators:[]};for(const o in n)Ap(n[o],r,o,e);return r},Ap=(t,e,n,r)=>{t.forEach(o=>{if(typeof o=="string"){const s=o===""?e:xb(e,o);s.classGroupId=n;return}if(typeof o=="function"){if(FP(o)){Ap(o(r),e,n,r);return}e.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([s,i])=>{Ap(i,xb(e,s),n,r)})})},xb=(t,e)=>{let n=t;return e.split(Eg).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},FP=t=>t.isThemeGetter,HP=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map;const o=(s,i)=>{n.set(s,i),e++,e>t&&(e=0,r=n,n=new Map)};return{get(s){let i=n.get(s);if(i!==void 0)return i;if((i=r.get(s))!==void 0)return o(s,i),i},set(s,i){n.has(s)?n.set(s,i):o(s,i)}}},Mp="!",Op=":",UP=Op.length,zP=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=o=>{const s=[];let i=0,a=0,l=0,c;for(let p=0;p<o.length;p++){let m=o[p];if(i===0&&a===0){if(m===Op){s.push(o.slice(l,p)),l=p+UP;continue}if(m==="/"){c=p;continue}}m==="["?i++:m==="]"?i--:m==="("?a++:m===")"&&a--}const u=s.length===0?o:o.substring(l),d=VP(u),f=d!==u,h=c&&c>l?c-l:void 0;return{modifiers:s,hasImportantModifier:f,baseClassName:d,maybePostfixModifierPosition:h}};if(e){const o=e+Op,s=r;r=i=>i.startsWith(o)?s(i.substring(o.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:i,maybePostfixModifierPosition:void 0}}if(n){const o=r;r=s=>n({className:s,parseClassName:o})}return r},VP=t=>t.endsWith(Mp)?t.substring(0,t.length-1):t.startsWith(Mp)?t.substring(1):t,WP=t=>{const e=Object.fromEntries(t.orderSensitiveModifiers.map(r=>[r,!0]));return r=>{if(r.length<=1)return r;const o=[];let s=[];return r.forEach(i=>{i[0]==="["||e[i]?(o.push(...s.sort(),i),s=[]):s.push(i)}),o.push(...s.sort()),o}},GP=t=>({cache:HP(t.cacheSize),parseClassName:zP(t),sortModifiers:WP(t),...jP(t)}),qP=/\s+/,KP=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:s}=e,i=[],a=t.trim().split(qP);let l="";for(let c=a.length-1;c>=0;c-=1){const u=a[c],{isExternal:d,modifiers:f,hasImportantModifier:h,baseClassName:p,maybePostfixModifierPosition:m}=n(u);if(d){l=u+(l.length>0?" "+l:l);continue}let y=!!m,v=r(y?p.substring(0,m):p);if(!v){if(!y){l=u+(l.length>0?" "+l:l);continue}if(v=r(p),!v){l=u+(l.length>0?" "+l:l);continue}y=!1}const w=s(f).join(":"),E=h?w+Mp:w,x=E+v;if(i.includes(x))continue;i.push(x);const T=o(v,y);for(let S=0;S<T.length;++S){const k=T[S];i.push(E+k)}l=u+(l.length>0?" "+l:l)}return l};function YP(){let t=0,e,n,r="";for(;t<arguments.length;)(e=arguments[t++])&&(n=lk(e))&&(r&&(r+=" "),r+=n);return r}const lk=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=lk(t[r]))&&(n&&(n+=" "),n+=e);return n};function JP(t,...e){let n,r,o,s=i;function i(l){const c=e.reduce((u,d)=>d(u),t());return n=GP(c),r=n.cache.get,o=n.cache.set,s=a,a(l)}function a(l){const c=r(l);if(c)return c;const u=KP(l,n);return o(l,u),u}return function(){return s(YP.apply(null,arguments))}}const Rt=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},ck=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,uk=/^\((?:(\w[\w-]*):)?(.+)\)$/i,XP=/^\d+\/\d+$/,QP=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ZP=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,eL=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,tL=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,nL=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,oi=t=>XP.test(t),_e=t=>!!t&&!Number.isNaN(Number(t)),Co=t=>!!t&&Number.isInteger(Number(t)),nh=t=>t.endsWith("%")&&_e(t.slice(0,-1)),Yr=t=>QP.test(t),rL=()=>!0,oL=t=>ZP.test(t)&&!eL.test(t),dk=()=>!1,sL=t=>tL.test(t),iL=t=>nL.test(t),aL=t=>!oe(t)&&!se(t),lL=t=>Ki(t,pk,dk),oe=t=>ck.test(t),ps=t=>Ki(t,mk,oL),rh=t=>Ki(t,hL,_e),wb=t=>Ki(t,fk,dk),cL=t=>Ki(t,hk,iL),cc=t=>Ki(t,gk,sL),se=t=>uk.test(t),ca=t=>Yi(t,mk),uL=t=>Yi(t,pL),Eb=t=>Yi(t,fk),dL=t=>Yi(t,pk),fL=t=>Yi(t,hk),uc=t=>Yi(t,gk,!0),Ki=(t,e,n)=>{const r=ck.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},Yi=(t,e,n=!1)=>{const r=uk.exec(t);return r?r[1]?e(r[1]):n:!1},fk=t=>t==="position"||t==="percentage",hk=t=>t==="image"||t==="url",pk=t=>t==="length"||t==="size"||t==="bg-size",mk=t=>t==="length",hL=t=>t==="number",pL=t=>t==="family-name",gk=t=>t==="shadow",mL=()=>{const t=Rt("color"),e=Rt("font"),n=Rt("text"),r=Rt("font-weight"),o=Rt("tracking"),s=Rt("leading"),i=Rt("breakpoint"),a=Rt("container"),l=Rt("spacing"),c=Rt("radius"),u=Rt("shadow"),d=Rt("inset-shadow"),f=Rt("text-shadow"),h=Rt("drop-shadow"),p=Rt("blur"),m=Rt("perspective"),y=Rt("aspect"),v=Rt("ease"),w=Rt("animate"),E=()=>["auto","avoid","all","avoid-page","page","left","right","column"],x=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],T=()=>[...x(),se,oe],S=()=>["auto","hidden","clip","visible","scroll"],k=()=>["auto","contain","none"],C=()=>[se,oe,l],N=()=>[oi,"full","auto",...C()],R=()=>[Co,"none","subgrid",se,oe],L=()=>["auto",{span:["full",Co,se,oe]},Co,se,oe],$=()=>[Co,"auto",se,oe],B=()=>["auto","min","max","fr",se,oe],U=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],j=()=>["start","end","center","stretch","center-safe","end-safe"],P=()=>["auto",...C()],H=()=>[oi,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...C()],_=()=>[t,se,oe],V=()=>[...x(),Eb,wb,{position:[se,oe]}],ie=()=>["no-repeat",{repeat:["","x","y","space","round"]}],te=()=>["auto","cover","contain",dL,lL,{size:[se,oe]}],ye=()=>[nh,ca,ps],G=()=>["","none","full",c,se,oe],Q=()=>["",_e,ca,ps],J=()=>["solid","dashed","dotted","double"],me=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],z=()=>[_e,nh,Eb,wb],Z=()=>["","none",p,se,oe],Me=()=>["none",_e,se,oe],he=()=>["none",_e,se,oe],we=()=>[_e,se,oe],Se=()=>[oi,"full",...C()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Yr],breakpoint:[Yr],color:[rL],container:[Yr],"drop-shadow":[Yr],ease:["in","out","in-out"],font:[aL],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Yr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Yr],shadow:[Yr],spacing:["px",_e],text:[Yr],"text-shadow":[Yr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",oi,oe,se,y]}],container:["container"],columns:[{columns:[_e,oe,se,a]}],"break-after":[{"break-after":E()}],"break-before":[{"break-before":E()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:T()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:k()}],"overscroll-x":[{"overscroll-x":k()}],"overscroll-y":[{"overscroll-y":k()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:N()}],"inset-x":[{"inset-x":N()}],"inset-y":[{"inset-y":N()}],start:[{start:N()}],end:[{end:N()}],top:[{top:N()}],right:[{right:N()}],bottom:[{bottom:N()}],left:[{left:N()}],visibility:["visible","invisible","collapse"],z:[{z:[Co,"auto",se,oe]}],basis:[{basis:[oi,"full","auto",a,...C()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[_e,oi,"auto","initial","none",oe]}],grow:[{grow:["",_e,se,oe]}],shrink:[{shrink:["",_e,se,oe]}],order:[{order:[Co,"first","last","none",se,oe]}],"grid-cols":[{"grid-cols":R()}],"col-start-end":[{col:L()}],"col-start":[{"col-start":$()}],"col-end":[{"col-end":$()}],"grid-rows":[{"grid-rows":R()}],"row-start-end":[{row:L()}],"row-start":[{"row-start":$()}],"row-end":[{"row-end":$()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":B()}],"auto-rows":[{"auto-rows":B()}],gap:[{gap:C()}],"gap-x":[{"gap-x":C()}],"gap-y":[{"gap-y":C()}],"justify-content":[{justify:[...U(),"normal"]}],"justify-items":[{"justify-items":[...j(),"normal"]}],"justify-self":[{"justify-self":["auto",...j()]}],"align-content":[{content:["normal",...U()]}],"align-items":[{items:[...j(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...j(),{baseline:["","last"]}]}],"place-content":[{"place-content":U()}],"place-items":[{"place-items":[...j(),"baseline"]}],"place-self":[{"place-self":["auto",...j()]}],p:[{p:C()}],px:[{px:C()}],py:[{py:C()}],ps:[{ps:C()}],pe:[{pe:C()}],pt:[{pt:C()}],pr:[{pr:C()}],pb:[{pb:C()}],pl:[{pl:C()}],m:[{m:P()}],mx:[{mx:P()}],my:[{my:P()}],ms:[{ms:P()}],me:[{me:P()}],mt:[{mt:P()}],mr:[{mr:P()}],mb:[{mb:P()}],ml:[{ml:P()}],"space-x":[{"space-x":C()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":C()}],"space-y-reverse":["space-y-reverse"],size:[{size:H()}],w:[{w:[a,"screen",...H()]}],"min-w":[{"min-w":[a,"screen","none",...H()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[i]},...H()]}],h:[{h:["screen","lh",...H()]}],"min-h":[{"min-h":["screen","lh","none",...H()]}],"max-h":[{"max-h":["screen","lh",...H()]}],"font-size":[{text:["base",n,ca,ps]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,se,rh]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",nh,oe]}],"font-family":[{font:[uL,oe,e]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,se,oe]}],"line-clamp":[{"line-clamp":[_e,"none",se,rh]}],leading:[{leading:[s,...C()]}],"list-image":[{"list-image":["none",se,oe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",se,oe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:_()}],"text-color":[{text:_()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...J(),"wavy"]}],"text-decoration-thickness":[{decoration:[_e,"from-font","auto",se,ps]}],"text-decoration-color":[{decoration:_()}],"underline-offset":[{"underline-offset":[_e,"auto",se,oe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:C()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",se,oe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",se,oe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:V()}],"bg-repeat":[{bg:ie()}],"bg-size":[{bg:te()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Co,se,oe],radial:["",se,oe],conic:[Co,se,oe]},fL,cL]}],"bg-color":[{bg:_()}],"gradient-from-pos":[{from:ye()}],"gradient-via-pos":[{via:ye()}],"gradient-to-pos":[{to:ye()}],"gradient-from":[{from:_()}],"gradient-via":[{via:_()}],"gradient-to":[{to:_()}],rounded:[{rounded:G()}],"rounded-s":[{"rounded-s":G()}],"rounded-e":[{"rounded-e":G()}],"rounded-t":[{"rounded-t":G()}],"rounded-r":[{"rounded-r":G()}],"rounded-b":[{"rounded-b":G()}],"rounded-l":[{"rounded-l":G()}],"rounded-ss":[{"rounded-ss":G()}],"rounded-se":[{"rounded-se":G()}],"rounded-ee":[{"rounded-ee":G()}],"rounded-es":[{"rounded-es":G()}],"rounded-tl":[{"rounded-tl":G()}],"rounded-tr":[{"rounded-tr":G()}],"rounded-br":[{"rounded-br":G()}],"rounded-bl":[{"rounded-bl":G()}],"border-w":[{border:Q()}],"border-w-x":[{"border-x":Q()}],"border-w-y":[{"border-y":Q()}],"border-w-s":[{"border-s":Q()}],"border-w-e":[{"border-e":Q()}],"border-w-t":[{"border-t":Q()}],"border-w-r":[{"border-r":Q()}],"border-w-b":[{"border-b":Q()}],"border-w-l":[{"border-l":Q()}],"divide-x":[{"divide-x":Q()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Q()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...J(),"hidden","none"]}],"divide-style":[{divide:[...J(),"hidden","none"]}],"border-color":[{border:_()}],"border-color-x":[{"border-x":_()}],"border-color-y":[{"border-y":_()}],"border-color-s":[{"border-s":_()}],"border-color-e":[{"border-e":_()}],"border-color-t":[{"border-t":_()}],"border-color-r":[{"border-r":_()}],"border-color-b":[{"border-b":_()}],"border-color-l":[{"border-l":_()}],"divide-color":[{divide:_()}],"outline-style":[{outline:[...J(),"none","hidden"]}],"outline-offset":[{"outline-offset":[_e,se,oe]}],"outline-w":[{outline:["",_e,ca,ps]}],"outline-color":[{outline:_()}],shadow:[{shadow:["","none",u,uc,cc]}],"shadow-color":[{shadow:_()}],"inset-shadow":[{"inset-shadow":["none",d,uc,cc]}],"inset-shadow-color":[{"inset-shadow":_()}],"ring-w":[{ring:Q()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:_()}],"ring-offset-w":[{"ring-offset":[_e,ps]}],"ring-offset-color":[{"ring-offset":_()}],"inset-ring-w":[{"inset-ring":Q()}],"inset-ring-color":[{"inset-ring":_()}],"text-shadow":[{"text-shadow":["none",f,uc,cc]}],"text-shadow-color":[{"text-shadow":_()}],opacity:[{opacity:[_e,se,oe]}],"mix-blend":[{"mix-blend":[...me(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":me()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[_e]}],"mask-image-linear-from-pos":[{"mask-linear-from":z()}],"mask-image-linear-to-pos":[{"mask-linear-to":z()}],"mask-image-linear-from-color":[{"mask-linear-from":_()}],"mask-image-linear-to-color":[{"mask-linear-to":_()}],"mask-image-t-from-pos":[{"mask-t-from":z()}],"mask-image-t-to-pos":[{"mask-t-to":z()}],"mask-image-t-from-color":[{"mask-t-from":_()}],"mask-image-t-to-color":[{"mask-t-to":_()}],"mask-image-r-from-pos":[{"mask-r-from":z()}],"mask-image-r-to-pos":[{"mask-r-to":z()}],"mask-image-r-from-color":[{"mask-r-from":_()}],"mask-image-r-to-color":[{"mask-r-to":_()}],"mask-image-b-from-pos":[{"mask-b-from":z()}],"mask-image-b-to-pos":[{"mask-b-to":z()}],"mask-image-b-from-color":[{"mask-b-from":_()}],"mask-image-b-to-color":[{"mask-b-to":_()}],"mask-image-l-from-pos":[{"mask-l-from":z()}],"mask-image-l-to-pos":[{"mask-l-to":z()}],"mask-image-l-from-color":[{"mask-l-from":_()}],"mask-image-l-to-color":[{"mask-l-to":_()}],"mask-image-x-from-pos":[{"mask-x-from":z()}],"mask-image-x-to-pos":[{"mask-x-to":z()}],"mask-image-x-from-color":[{"mask-x-from":_()}],"mask-image-x-to-color":[{"mask-x-to":_()}],"mask-image-y-from-pos":[{"mask-y-from":z()}],"mask-image-y-to-pos":[{"mask-y-to":z()}],"mask-image-y-from-color":[{"mask-y-from":_()}],"mask-image-y-to-color":[{"mask-y-to":_()}],"mask-image-radial":[{"mask-radial":[se,oe]}],"mask-image-radial-from-pos":[{"mask-radial-from":z()}],"mask-image-radial-to-pos":[{"mask-radial-to":z()}],"mask-image-radial-from-color":[{"mask-radial-from":_()}],"mask-image-radial-to-color":[{"mask-radial-to":_()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":x()}],"mask-image-conic-pos":[{"mask-conic":[_e]}],"mask-image-conic-from-pos":[{"mask-conic-from":z()}],"mask-image-conic-to-pos":[{"mask-conic-to":z()}],"mask-image-conic-from-color":[{"mask-conic-from":_()}],"mask-image-conic-to-color":[{"mask-conic-to":_()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:V()}],"mask-repeat":[{mask:ie()}],"mask-size":[{mask:te()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",se,oe]}],filter:[{filter:["","none",se,oe]}],blur:[{blur:Z()}],brightness:[{brightness:[_e,se,oe]}],contrast:[{contrast:[_e,se,oe]}],"drop-shadow":[{"drop-shadow":["","none",h,uc,cc]}],"drop-shadow-color":[{"drop-shadow":_()}],grayscale:[{grayscale:["",_e,se,oe]}],"hue-rotate":[{"hue-rotate":[_e,se,oe]}],invert:[{invert:["",_e,se,oe]}],saturate:[{saturate:[_e,se,oe]}],sepia:[{sepia:["",_e,se,oe]}],"backdrop-filter":[{"backdrop-filter":["","none",se,oe]}],"backdrop-blur":[{"backdrop-blur":Z()}],"backdrop-brightness":[{"backdrop-brightness":[_e,se,oe]}],"backdrop-contrast":[{"backdrop-contrast":[_e,se,oe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",_e,se,oe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[_e,se,oe]}],"backdrop-invert":[{"backdrop-invert":["",_e,se,oe]}],"backdrop-opacity":[{"backdrop-opacity":[_e,se,oe]}],"backdrop-saturate":[{"backdrop-saturate":[_e,se,oe]}],"backdrop-sepia":[{"backdrop-sepia":["",_e,se,oe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":C()}],"border-spacing-x":[{"border-spacing-x":C()}],"border-spacing-y":[{"border-spacing-y":C()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",se,oe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[_e,"initial",se,oe]}],ease:[{ease:["linear","initial",v,se,oe]}],delay:[{delay:[_e,se,oe]}],animate:[{animate:["none",w,se,oe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,se,oe]}],"perspective-origin":[{"perspective-origin":T()}],rotate:[{rotate:Me()}],"rotate-x":[{"rotate-x":Me()}],"rotate-y":[{"rotate-y":Me()}],"rotate-z":[{"rotate-z":Me()}],scale:[{scale:he()}],"scale-x":[{"scale-x":he()}],"scale-y":[{"scale-y":he()}],"scale-z":[{"scale-z":he()}],"scale-3d":["scale-3d"],skew:[{skew:we()}],"skew-x":[{"skew-x":we()}],"skew-y":[{"skew-y":we()}],transform:[{transform:[se,oe,"","none","gpu","cpu"]}],"transform-origin":[{origin:T()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Se()}],"translate-x":[{"translate-x":Se()}],"translate-y":[{"translate-y":Se()}],"translate-z":[{"translate-z":Se()}],"translate-none":["translate-none"],accent:[{accent:_()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:_()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",se,oe]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":C()}],"scroll-mx":[{"scroll-mx":C()}],"scroll-my":[{"scroll-my":C()}],"scroll-ms":[{"scroll-ms":C()}],"scroll-me":[{"scroll-me":C()}],"scroll-mt":[{"scroll-mt":C()}],"scroll-mr":[{"scroll-mr":C()}],"scroll-mb":[{"scroll-mb":C()}],"scroll-ml":[{"scroll-ml":C()}],"scroll-p":[{"scroll-p":C()}],"scroll-px":[{"scroll-px":C()}],"scroll-py":[{"scroll-py":C()}],"scroll-ps":[{"scroll-ps":C()}],"scroll-pe":[{"scroll-pe":C()}],"scroll-pt":[{"scroll-pt":C()}],"scroll-pr":[{"scroll-pr":C()}],"scroll-pb":[{"scroll-pb":C()}],"scroll-pl":[{"scroll-pl":C()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",se,oe]}],fill:[{fill:["none",..._()]}],"stroke-w":[{stroke:[_e,ca,ps,rh]}],stroke:[{stroke:["none",..._()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},gL=JP(mL);function re(...t){return gL(ik(t))}const yk=t=>Object.entries(t).filter(([e])=>isNaN(Number(e))).map(([e,n])=>({label:e,value:n})),dc=t=>t instanceof File||t instanceof Blob,yL=t=>typeof t=="string"&&(t.startsWith("http://")||t.startsWith("https://")),vL=(t,e,n)=>{if(t.size>e)return{valid:!1,error:`File size exceeds ${e/1024/1024}MB limit`};if(t instanceof File&&n.length>0){const r=t.type;if(!n.some(s=>s.endsWith("/*")?r.startsWith(s.replace("/*","")):r===s))return{valid:!1,error:"File type not allowed"}}return{valid:!0}};function vk({className:t,...e}){return g.jsx(aP,{"data-slot":"tabs",className:re("flex flex-col gap-2",t),...e})}function bk({className:t,...e}){return g.jsx(lP,{"data-slot":"tabs-list",className:re("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",t),...e})}function Rp({className:t,...e}){return g.jsx(cP,{"data-slot":"tabs-trigger",className:re("data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...e})}function Sb({className:t,...e}){return g.jsx(uP,{"data-slot":"tabs-content",className:re("flex-1 outline-none",t),...e})}var fc={exports:{}},oh={};/**
|
|
93
|
+
* @license React
|
|
94
|
+
* use-sync-external-store-shim.production.js
|
|
95
|
+
*
|
|
96
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
97
|
+
*
|
|
98
|
+
* This source code is licensed under the MIT license found in the
|
|
99
|
+
* LICENSE file in the root directory of this source tree.
|
|
100
|
+
*/var kb;function bL(){if(kb)return oh;kb=1;var t=M;function e(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,o=t.useEffect,s=t.useLayoutEffect,i=t.useDebugValue;function a(d,f){var h=f(),p=r({inst:{value:h,getSnapshot:f}}),m=p[0].inst,y=p[1];return s(function(){m.value=h,m.getSnapshot=f,l(m)&&y({inst:m})},[d,h,f]),o(function(){return l(m)&&y({inst:m}),d(function(){l(m)&&y({inst:m})})},[d]),i(h),h}function l(d){var f=d.getSnapshot;d=d.value;try{var h=f();return!n(d,h)}catch{return!0}}function c(d,f){return f()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return oh.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:u,oh}var sh={};/**
|
|
101
|
+
* @license React
|
|
102
|
+
* use-sync-external-store-shim.development.js
|
|
103
|
+
*
|
|
104
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
105
|
+
*
|
|
106
|
+
* This source code is licensed under the MIT license found in the
|
|
107
|
+
* LICENSE file in the root directory of this source tree.
|
|
108
|
+
*/var Tb;function xL(){return Tb||(Tb=1,process.env.NODE_ENV!=="production"&&(function(){function t(h,p){return h===p&&(h!==0||1/h===1/p)||h!==h&&p!==p}function e(h,p){u||o.startTransition===void 0||(u=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var m=p();if(!d){var y=p();s(m,y)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),d=!0)}y=i({inst:{value:m,getSnapshot:p}});var v=y[0].inst,w=y[1];return l(function(){v.value=m,v.getSnapshot=p,n(v)&&w({inst:v})},[h,m,p]),a(function(){return n(v)&&w({inst:v}),h(function(){n(v)&&w({inst:v})})},[h]),c(m),m}function n(h){var p=h.getSnapshot;h=h.value;try{var m=p();return!s(h,m)}catch{return!0}}function r(h,p){return p()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=M,s=typeof Object.is=="function"?Object.is:t,i=o.useState,a=o.useEffect,l=o.useLayoutEffect,c=o.useDebugValue,u=!1,d=!1,f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:e;sh.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:f,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),sh}var Cb;function Sg(){return Cb||(Cb=1,process.env.NODE_ENV==="production"?fc.exports=bL():fc.exports=xL()),fc.exports}var kg=Sg();function zt(t){this.content=t}zt.prototype={constructor:zt,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,o=r.find(t),s=r.content.slice();return o==-1?s.push(n||t,e):(s[o+1]=e,n&&(s[o]=n)),new zt(s)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new zt(n)},addToStart:function(t,e){return new zt([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new zt(n)},addBefore:function(t,e,n){var r=this.remove(e),o=r.content.slice(),s=r.find(t);return o.splice(s==-1?o.length:s,0,e,n),new zt(o)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=zt.from(t),t.size?new zt(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=zt.from(t),t.size?new zt(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=zt.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};zt.from=function(t){if(t instanceof zt)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new zt(e)};function xk(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let o=t.child(r),s=e.child(r);if(o==s){n+=o.nodeSize;continue}if(!o.sameMarkup(s))return n;if(o.isText&&o.text!=s.text){for(let i=0;o.text[i]==s.text[i];i++)n++;return n}if(o.content.size||s.content.size){let i=xk(o.content,s.content,n+1);if(i!=null)return i}n+=o.nodeSize}}function wk(t,e,n,r){for(let o=t.childCount,s=e.childCount;;){if(o==0||s==0)return o==s?null:{a:n,b:r};let i=t.child(--o),a=e.child(--s),l=i.nodeSize;if(i==a){n-=l,r-=l;continue}if(!i.sameMarkup(a))return{a:n,b:r};if(i.isText&&i.text!=a.text){let c=0,u=Math.min(i.text.length,a.text.length);for(;c<u&&i.text[i.text.length-c-1]==a.text[a.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(i.content.size||a.content.size){let c=wk(i.content,a.content,n-1,r-1);if(c)return c}n-=l,r-=l}}class F{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,o=0,s){for(let i=0,a=0;a<n;i++){let l=this.content[i],c=a+l.nodeSize;if(c>e&&r(l,o+a,s||null,i)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,n-u),r,o+u)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,o){let s="",i=!0;return this.nodesBetween(e,n,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?o?typeof o=="function"?o(a):o:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(i?i=!1:s+=r),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,o=this.content.slice(),s=0;for(n.isText&&n.sameMarkup(r)&&(o[o.length-1]=n.withText(n.text+r.text),s=1);s<e.content.length;s++)o.push(e.content[s]);return new F(o,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],o=0;if(n>e)for(let s=0,i=0;i<n;s++){let a=this.content[s],l=i+a.nodeSize;l>e&&((i<e||l>n)&&(a.isText?a=a.cut(Math.max(0,e-i),Math.min(a.text.length,n-i)):a=a.cut(Math.max(0,e-i-1),Math.min(a.content.size,n-i-1))),r.push(a),o+=a.nodeSize),i=l}return new F(r,o)}cutByIndex(e,n){return e==n?F.empty:e==0&&n==this.content.length?this:new F(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let o=this.content.slice(),s=this.size+n.nodeSize-r.nodeSize;return o[e]=n,new F(o,s)}addToStart(e){return new F([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new F(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let o=this.content[n];e(o,r,n),r+=o.nodeSize}}findDiffStart(e,n=0){return xk(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return wk(this,e,n,r)}findIndex(e){if(e==0)return hc(0,e);if(e==this.size)return hc(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let o=this.child(n),s=r+o.nodeSize;if(s>=e)return s==e?hc(n+1,s):hc(n,r);r=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return F.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new F(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return F.empty;let n,r=0;for(let o=0;o<e.length;o++){let s=e[o];r+=s.nodeSize,o&&s.isText&&e[o-1].sameMarkup(s)?(n||(n=e.slice(0,o)),n[n.length-1]=s.withText(n[n.length-1].text+s.text)):n&&n.push(s)}return new F(n||e,r)}static from(e){if(!e)return F.empty;if(e instanceof F)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new F([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}F.empty=new F([],0);const ih={index:0,offset:0};function hc(t,e){return ih.index=t,ih.offset=e,ih}function pu(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!pu(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!pu(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let Xe=class Np{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let o=0;o<e.length;o++){let s=e[o];if(this.eq(s))return e;if(this.type.excludes(s.type))n||(n=e.slice(0,o));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(n||(n=e.slice(0,o)),n.push(this),r=!0),n&&n.push(s)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&pu(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let o=r.create(n.attrs);return r.checkAttrs(o.attrs),o}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Np.none;if(e instanceof Np)return[e];let n=e.slice();return n.sort((r,o)=>r.type.rank-o.type.rank),n}};Xe.none=[];class mu extends Error{}class ee{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=Sk(this.content,e+this.openStart,n);return r&&new ee(r,this.openStart,this.openEnd)}removeBetween(e,n){return new ee(Ek(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return ee.empty;let r=n.openStart||0,o=n.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new ee(F.fromJSON(e,n.content),r,o)}static maxOpen(e,n=!0){let r=0,o=0;for(let s=e.firstChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.lastChild)o++;return new ee(e,r,o)}}ee.empty=new ee(F.empty,0,0);function Ek(t,e,n){let{index:r,offset:o}=t.findIndex(e),s=t.maybeChild(r),{index:i,offset:a}=t.findIndex(n);if(o==e||s.isText){if(a!=n&&!t.child(i).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=i)throw new RangeError("Removing non-flat range");return t.replaceChild(r,s.copy(Ek(s.content,e-o-1,n-o-1)))}function Sk(t,e,n,r){let{index:o,offset:s}=t.findIndex(e),i=t.maybeChild(o);if(s==e||i.isText)return r&&!r.canReplace(o,o,n)?null:t.cut(0,e).append(n).append(t.cut(e));let a=Sk(i.content,e-s-1,n,i);return a&&t.replaceChild(o,i.copy(a))}function wL(t,e,n){if(n.openStart>t.depth)throw new mu("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new mu("Inconsistent open depths");return kk(t,e,n,0)}function kk(t,e,n,r){let o=t.index(r),s=t.node(r);if(o==e.index(r)&&r<t.depth-n.openStart){let i=kk(t,e,n,r+1);return s.copy(s.content.replaceChild(o,i))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let i=t.parent,a=i.content;return Cs(i,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:i,end:a}=EL(n,t);return Cs(s,Ck(t,i,a,e,r))}else return Cs(s,gu(t,e,r))}function Tk(t,e){if(!e.type.compatibleContent(t.type))throw new mu("Cannot join "+e.type.name+" onto "+t.type.name)}function _p(t,e,n){let r=t.node(n);return Tk(r,e.node(n)),r}function Ts(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Ma(t,e,n,r){let o=(e||t).node(n),s=0,i=e?e.index(n):o.childCount;t&&(s=t.index(n),t.depth>n?s++:t.textOffset&&(Ts(t.nodeAfter,r),s++));for(let a=s;a<i;a++)Ts(o.child(a),r);e&&e.depth==n&&e.textOffset&&Ts(e.nodeBefore,r)}function Cs(t,e){return t.type.checkContent(e),t.copy(e)}function Ck(t,e,n,r,o){let s=t.depth>o&&_p(t,e,o+1),i=r.depth>o&&_p(n,r,o+1),a=[];return Ma(null,t,o,a),s&&i&&e.index(o)==n.index(o)?(Tk(s,i),Ts(Cs(s,Ck(t,e,n,r,o+1)),a)):(s&&Ts(Cs(s,gu(t,e,o+1)),a),Ma(e,n,o,a),i&&Ts(Cs(i,gu(n,r,o+1)),a)),Ma(r,null,o,a),new F(a)}function gu(t,e,n){let r=[];if(Ma(null,t,n,r),t.depth>n){let o=_p(t,e,n+1);Ts(Cs(o,gu(t,e,n+1)),r)}return Ma(e,null,n,r),new F(r)}function EL(t,e){let n=e.depth-t.openStart,o=e.node(n).copy(t.content);for(let s=n-1;s>=0;s--)o=e.node(s).copy(F.from(o));return{start:o.resolveNoCache(t.openStart+n),end:o.resolveNoCache(o.content.size-t.openEnd-n)}}class Wa{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],o=e.child(n);return r?e.child(n).cut(r):o}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],o=n==0?0:this.path[n*3-1]+1;for(let s=0;s<e;s++)o+=r.child(s).nodeSize;return o}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return Xe.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),o=e.maybeChild(n);if(!r){let a=r;r=o,o=a}let s=r.marks;for(var i=0;i<s.length;i++)s[i].type.spec.inclusive===!1&&(!o||!s[i].isInSet(o.marks))&&(s=s[i--].removeFromSet(s));return s}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,o=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!o||!r[s].isInSet(o.marks))&&(r=r[s--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new Ga(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],o=0,s=n;for(let i=e;;){let{index:a,offset:l}=i.content.findIndex(s),c=s-l;if(r.push(i,a,o+l),!c||(i=i.child(a),i.isText))break;s=c-1,o+=l+1}return new Wa(n,r,s)}static resolveCached(e,n){let r=Ab.get(e);if(r)for(let s=0;s<r.elts.length;s++){let i=r.elts[s];if(i.pos==n)return i}else Ab.set(e,r=new SL);let o=r.elts[r.i]=Wa.resolve(e,n);return r.i=(r.i+1)%kL,o}}class SL{constructor(){this.elts=[],this.i=0}}const kL=12,Ab=new WeakMap;class Ga{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const TL=Object.create(null);let io=class Dp{constructor(e,n,r,o=Xe.none){this.type=e,this.attrs=n,this.marks=o,this.content=r||F.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,o=0){this.content.nodesBetween(e,n,r,o,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,o){return this.content.textBetween(e,n,r,o)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&pu(this.attrs,n||e.defaultAttrs||TL)&&Xe.sameSet(this.marks,r||Xe.none)}copy(e=null){return e==this.content?this:new Dp(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Dp(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return ee.empty;let o=this.resolve(e),s=this.resolve(n),i=r?0:o.sharedDepth(n),a=o.start(i),c=o.node(i).content.cut(o.pos-a,s.pos-a);return new ee(c,o.depth-i,s.depth-i)}replace(e,n,r){return wL(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:o}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(o==e||n.isText)return n;e-=o+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let o=this.content.child(n-1);return{node:o,index:n-1,offset:r-o.nodeSize}}resolve(e){return Wa.resolveCached(this,e)}resolveNoCache(e){return Wa.resolve(this,e)}rangeHasMark(e,n,r){let o=!1;return n>e&&this.nodesBetween(e,n,s=>(r.isInSet(s.marks)&&(o=!0),!o)),o}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()+")"),Ak(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=F.empty,o=0,s=r.childCount){let i=this.contentMatchAt(e).matchFragment(r,o,s),a=i&&i.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=o;l<s;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,o){if(o&&!this.type.allowsMarks(o))return!1;let s=this.contentMatchAt(e).matchType(r),i=s&&s.matchFragment(this.content,n);return i?i.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=Xe.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!Xe.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let o=F.fromJSON(e,n.content),s=e.nodeType(n.type).create(n.attrs,o,r);return s.type.checkAttrs(s.attrs),s}};io.prototype.text=void 0;class yu extends io{constructor(e,n,r,o){if(super(e,n,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Ak(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new yu(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new yu(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Ak(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Ds{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new CL(e,n);if(r.next==null)return Ds.empty;let o=Mk(r);r.next&&r.err("Unexpected trailing text");let s=DL(_L(o));return IL(s,r),s}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let o=this;for(let s=n;o&&s<r;s++)o=o.matchType(e.child(s).type);return o}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let o=[this];function s(i,a){let l=i.matchFragment(e,r);if(l&&(!n||l.validEnd))return F.from(a.map(c=>c.createAndFill()));for(let c=0;c<i.next.length;c++){let{type:u,next:d}=i.next[c];if(!(u.isText||u.hasRequiredAttrs())&&o.indexOf(d)==-1){o.push(d);let f=s(d,a.concat(u));if(f)return f}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let o=r.shift(),s=o.match;if(s.matchType(e)){let i=[];for(let a=o;a.type;a=a.via)i.push(a.type);return i.reverse()}for(let i=0;i<s.next.length;i++){let{type:a,next:l}=s.next[i];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!o.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:o}),n[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let o=0;o<r.next.length;o++)e.indexOf(r.next[o].next)==-1&&n(r.next[o].next)}return n(this),e.map((r,o)=>{let s=o+(r.validEnd?"*":" ")+" ";for(let i=0;i<r.next.length;i++)s+=(i?", ":"")+r.next[i].type.name+"->"+e.indexOf(r.next[i].next);return s}).join(`
|
|
109
|
+
`)}}Ds.empty=new Ds(!0);class CL{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Mk(t){let e=[];do e.push(AL(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function AL(t){let e=[];do e.push(ML(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function ML(t){let e=NL(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=OL(t,e);else break;return e}function Mb(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function OL(t,e){let n=Mb(t),r=n;return t.eat(",")&&(t.next!="}"?r=Mb(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function RL(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let o=[];for(let s in n){let i=n[s];i.isInGroup(e)&&o.push(i)}return o.length==0&&t.err("No node type or group '"+e+"' found"),o}function NL(t){if(t.eat("(")){let e=Mk(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=RL(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function _L(t){let e=[[]];return o(s(t,0),n()),e;function n(){return e.push([])-1}function r(i,a,l){let c={term:l,to:a};return e[i].push(c),c}function o(i,a){i.forEach(l=>l.to=a)}function s(i,a){if(i.type=="choice")return i.exprs.reduce((l,c)=>l.concat(s(c,a)),[]);if(i.type=="seq")for(let l=0;;l++){let c=s(i.exprs[l],a);if(l==i.exprs.length-1)return c;o(c,a=n())}else if(i.type=="star"){let l=n();return r(a,l),o(s(i.expr,l),l),[r(l)]}else if(i.type=="plus"){let l=n();return o(s(i.expr,a),l),o(s(i.expr,l),l),[r(l)]}else{if(i.type=="opt")return[r(a)].concat(s(i.expr,a));if(i.type=="range"){let l=a;for(let c=0;c<i.min;c++){let u=n();o(s(i.expr,l),u),l=u}if(i.max==-1)o(s(i.expr,l),l);else for(let c=i.min;c<i.max;c++){let u=n();r(l,u),o(s(i.expr,l),u),l=u}return[r(l)]}else{if(i.type=="name")return[r(a,void 0,i.value)];throw new Error("Unknown expr type")}}}}function Ok(t,e){return e-t}function Ob(t,e){let n=[];return r(e),n.sort(Ok);function r(o){let s=t[o];if(s.length==1&&!s[0].term)return r(s[0].to);n.push(o);for(let i=0;i<s.length;i++){let{term:a,to:l}=s[i];!a&&n.indexOf(l)==-1&&r(l)}}}function DL(t){let e=Object.create(null);return n(Ob(t,0));function n(r){let o=[];r.forEach(i=>{t[i].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let u=0;u<o.length;u++)o[u][0]==a&&(c=o[u][1]);Ob(t,l).forEach(u=>{c||o.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let s=e[r.join(",")]=new Ds(r.indexOf(t.length-1)>-1);for(let i=0;i<o.length;i++){let a=o[i][1].sort(Ok);s.next.push({type:o[i][0],next:e[a.join(",")]||n(a)})}return s}}function IL(t,e){for(let n=0,r=[t];n<r.length;n++){let o=r[n],s=!o.validEnd,i=[];for(let a=0;a<o.next.length;a++){let{type:l,next:c}=o.next[a];i.push(l.name),s&&!(l.isText||l.hasRequiredAttrs())&&(s=!1),r.indexOf(c)==-1&&r.push(c)}s&&e.err("Only non-generatable nodes ("+i.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Rk(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function Nk(t,e){let n=Object.create(null);for(let r in t){let o=e&&e[r];if(o===void 0){let s=t[r];if(s.hasDefault)o=s.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=o}return n}function _k(t,e,n,r){for(let o in e)if(!(o in t))throw new RangeError(`Unsupported attribute ${o} for ${n} of type ${o}`);for(let o in t){let s=t[o];s.validate&&s.validate(e[o])}}function Dk(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new LL(t,r,e[r]);return n}let Rb=class Ik{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Dk(e,r.attrs),this.defaultAttrs=Rk(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==Ds.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:Nk(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new io(this,this.computeAttrs(e),F.from(n),Xe.setFrom(r))}createChecked(e=null,n,r){return n=F.from(n),this.checkContent(n),new io(this,this.computeAttrs(e),n,Xe.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=F.from(n),n.size){let i=this.contentMatch.fillBefore(n);if(!i)return null;n=i.append(n)}let o=this.contentMatch.matchFragment(n),s=o&&o.fillBefore(F.empty,!0);return s?new io(this,e,n.append(s),Xe.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){_k(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:Xe.none:e}static compile(e,n){let r=Object.create(null);e.forEach((s,i)=>r[s]=new Ik(s,n,i));let o=n.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");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 PL(t,e,n){let r=n.split("|");return o=>{let s=o===null?"null":typeof o;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${s}`)}}class LL{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?PL(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Fd{constructor(e,n,r,o){this.name=e,this.rank=n,this.schema=r,this.spec=o,this.attrs=Dk(e,o.attrs),this.excluded=null;let s=Rk(this.attrs);this.instance=s?new Xe(this,s):null}create(e=null){return!e&&this.instance?this.instance:new Xe(this,Nk(this.attrs,e))}static compile(e,n){let r=Object.create(null),o=0;return e.forEach((s,i)=>r[s]=new Fd(s,o++,n,i)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){_k(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Pk{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let o in e)n[o]=e[o];n.nodes=zt.from(e.nodes),n.marks=zt.from(e.marks||{}),this.nodes=Rb.compile(this.spec.nodes,this),this.marks=Fd.compile(this.spec.marks,this);let r=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let s=this.nodes[o],i=s.spec.content||"",a=s.spec.marks;if(s.contentMatch=r[i]||(r[i]=Ds.parse(i,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?Nb(this,a.split(" ")):a==""||!s.inlineContent?[]:null}for(let o in this.marks){let s=this.marks[o],i=s.spec.excludes;s.excluded=i==null?[s]:i==""?[]:Nb(this,i.split(" "))}this.nodeFromJSON=o=>io.fromJSON(this,o),this.markFromJSON=o=>Xe.fromJSON(this,o),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,o){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Rb){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,o)}text(e,n){let r=this.nodes.text;return new yu(r,r.defaultAttrs,e,Xe.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function Nb(t,e){let n=[];for(let r=0;r<e.length;r++){let o=e[r],s=t.marks[o],i=s;if(s)n.push(s);else for(let a in t.marks){let l=t.marks[a];(o=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(o)>-1)&&n.push(i=l)}if(!i)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function jL(t){return t.tag!=null}function $L(t){return t.style!=null}let Oa=class Ip{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(o=>{if(jL(o))this.tags.push(o);else if($L(o)){let s=/[^=]*/.exec(o.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(o)}}),this.normalizeLists=!this.tags.some(o=>{if(!/^(ul|ol)\b/.test(o.tag)||!o.node)return!1;let s=e.nodes[o.node];return s.contentMatch.matchType(s)})}parse(e,n={}){let r=new Db(this,n,!1);return r.addAll(e,Xe.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new Db(this,n,!0);return r.addAll(e,Xe.none,n.from,n.to),ee.maxOpen(r.finish())}matchTag(e,n,r){for(let o=r?this.tags.indexOf(r)+1:0;o<this.tags.length;o++){let s=this.tags[o];if(HL(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||n.matchesContext(s.context))){if(s.getAttrs){let i=s.getAttrs(e);if(i===!1)continue;s.attrs=i||void 0}return s}}}matchStyle(e,n,r,o){for(let s=o?this.styles.indexOf(o)+1:0;s<this.styles.length;s++){let i=this.styles[s],a=i.style;if(!(a.indexOf(e)!=0||i.context&&!r.matchesContext(i.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(i.getAttrs){let l=i.getAttrs(n);if(l===!1)continue;i.attrs=l||void 0}return i}}}static schemaRules(e){let n=[];function r(o){let s=o.priority==null?50:o.priority,i=0;for(;i<n.length;i++){let a=n[i];if((a.priority==null?50:a.priority)<s)break}n.splice(i,0,o)}for(let o in e.marks){let s=e.marks[o].spec.parseDOM;s&&s.forEach(i=>{r(i=Ib(i)),i.mark||i.ignore||i.clearMark||(i.mark=o)})}for(let o in e.nodes){let s=e.nodes[o].spec.parseDOM;s&&s.forEach(i=>{r(i=Ib(i)),i.node||i.ignore||i.mark||(i.node=o)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Ip(e,Ip.schemaRules(e)))}};const Lk={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},BL={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},jk={ol:!0,ul:!0},qa=1,Pp=2,Ra=4;function _b(t,e,n){return e!=null?(e?qa:0)|(e==="full"?Pp:0):t&&t.whitespace=="pre"?qa|Pp:n&~Ra}class pc{constructor(e,n,r,o,s,i){this.type=e,this.attrs=n,this.marks=r,this.solid=o,this.options=i,this.content=[],this.activeMarks=Xe.none,this.match=s||(i&Ra?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(F.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,o;return(o=r.findWrapping(e.type))?(this.match=r,o):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&qa)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-o[0].length))}}let n=F.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(F.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Lk.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Db{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let o=n.topNode,s,i=_b(null,n.preserveWhitespace,0)|(r?Ra:0);o?s=new pc(o.type,o.attrs,Xe.none,!0,n.topMatch||o.type.contentMatch,i):r?s=new pc(null,null,Xe.none,!0,null,i):s=new pc(e.schema.topNodeType,null,Xe.none,!0,null,i),this.nodes=[s],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,o=this.top,s=o.options&Pp?"full":this.localPreserveWS||(o.options&qa)>0,{schema:i}=this.parser;if(s==="full"||o.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)if(s==="full")r=r.replace(/\r\n?/g,`
|
|
110
|
+
`);else if(i.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(i.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let l=0;l<a.length;l++)l&&this.insertNode(i.linebreakReplacement.create(),n,!0),a[l]&&this.insertNode(i.text(a[l]),n,!/\S/.test(a[l]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let a=o.content[o.content.length-1],l=e.previousSibling;(!a||l&&l.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(i.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let o=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let i=e.nodeName.toLowerCase(),a;jk.hasOwnProperty(i)&&this.parser.normalizeLists&&FL(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:BL.hasOwnProperty(i))this.findInside(e),this.ignoreFallback(e,n);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let c,u=this.needsBlock;if(Lk.hasOwnProperty(i))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),c=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let d=l&&l.skip?n:this.readStyles(e,n);d&&this.addAll(e,d),c&&this.sync(s),this.needsBlock=u}else{let c=this.readStyles(e,n);c&&this.addElementByRule(e,l,c,l.consuming===!1?a:void 0)}this.localPreserveWS=o}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
111
|
+
`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let o=0;o<this.parser.matchedStyles.length;o++){let s=this.parser.matchedStyles[o],i=r.getPropertyValue(s);if(i)for(let a=void 0;;){let l=this.parser.matchStyle(s,i,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?n=n.filter(c=>!l.clearMark(c)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return n}addElementByRule(e,n,r,o){let s,i;if(n.node)if(i=this.parser.schema.nodes[n.node],i.isLeaf)this.insertNode(i.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let l=this.enter(i,n.attrs||null,r,n.preserveWhitespace);l&&(s=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let a=this.top;if(i&&i.isLeaf)this.findInside(e);else if(o)this.addElement(e,r,o);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}s&&this.sync(a)&&this.open--}addAll(e,n,r,o){let s=r||0;for(let i=r?e.childNodes[r]:e.firstChild,a=o==null?null:e.childNodes[o];i!=a;i=i.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(i,n);this.findAtPoint(e,s)}findPlace(e,n,r){let o,s;for(let i=this.open,a=0;i>=0;i--){let l=this.nodes[i],c=l.findWrapping(e);if(c&&(!o||o.length>c.length+a)&&(o=c,s=l,!c.length))break;if(l.solid){if(r)break;a+=2}}if(!o)return null;this.sync(s);for(let i=0;i<o.length;i++)n=this.enterInner(o[i],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(n=this.enterInner(s,null,n))}let o=this.findPlace(e,n,r);if(o){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let i=Xe.none;for(let a of o.concat(e.marks))(s.type?s.type.allowsMarkType(a.type):Pb(a.type,e.type))&&(i=a.addToSet(i));return s.content.push(e.mark(i)),!0}return!1}enter(e,n,r,o){let s=this.findPlace(e.create(n),r,!1);return s&&(s=this.enterInner(e,n,r,!0,o)),s}enterInner(e,n,r,o=!1,s){this.closeExtra();let i=this.top;i.match=i.match&&i.match.matchType(e);let a=_b(e,s,i.options);i.options&Ra&&i.content.length==0&&(a|=Ra);let l=Xe.none;return r=r.filter(c=>(i.type?i.type.allowsMarkType(c.type):Pb(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new pc(e,n,l,o,null,a)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=qa)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let o=r.length-1;o>=0;o--)e+=r[o].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let o=0;o<this.find.length;o++)this.find[o].pos==null&&e.nodeType==1&&e.contains(this.find[o].node)&&n.compareDocumentPosition(this.find[o].node)&(r?2:4)&&(this.find[o].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(o?0:1),i=(a,l)=>{for(;a>=0;a--){let c=n[a];if(c==""){if(a==n.length-1||a==0)continue;for(;l>=s;l--)if(i(a-1,l))return!0;return!1}else{let u=l>0||l==0&&o?this.nodes[l].type:r&&l>=s?r.node(l-s).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;l--}}return!0};return i(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function FL(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&jk.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function HL(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Ib(t){let e={};for(let n in t)e[n]=t[n];return e}function Pb(t,e){let n=e.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(t))continue;let s=[],i=a=>{s.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:u}=a.edge(l);if(c==e||s.indexOf(u)<0&&i(u))return!0}};if(i(o.contentMatch))return!0}}class Ks{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=ah(n).createDocumentFragment());let o=r,s=[];return e.forEach(i=>{if(s.length||i.marks.length){let a=0,l=0;for(;a<s.length&&l<i.marks.length;){let c=i.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(s[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<s.length;)o=s.pop()[1];for(;l<i.marks.length;){let c=i.marks[l++],u=this.serializeMark(c,i.isInline,n);u&&(s.push([c,o]),o.appendChild(u.dom),o=u.contentDOM||u.dom)}}o.appendChild(this.serializeNodeInner(i,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:o}=Vc(ah(n),this.nodes[e.type.name](e),null,e.attrs);if(o){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,o)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let o=e.marks.length-1;o>=0;o--){let s=this.serializeMark(e.marks[o],e.isInline,n);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,n,r={}){let o=this.marks[e.type.name];return o&&Vc(ah(r),o(e,n),null,e.attrs)}static renderSpec(e,n,r=null,o){return Vc(e,n,r,o)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Ks(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=Lb(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return Lb(e.marks)}}function Lb(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function ah(t){return t.document||window.document}const jb=new WeakMap;function UL(t){let e=jb.get(t);return e===void 0&&jb.set(t,e=zL(t)),e}function zL(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let o=0;o<r.length;o++)n(r[o]);else for(let o in r)n(r[o])}return n(t),e}function Vc(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let o=e[0],s;if(typeof o!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=UL(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 i=o.indexOf(" ");i>0&&(n=o.slice(0,i),o=o.slice(i+1));let a,l=n?t.createElementNS(n,o):t.createElement(o),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?l.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):d=="style"&&l.style?l.style.cssText=c[d]:l.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:h,contentDOM:p}=Vc(t,f,n,r);if(l.appendChild(h),p){if(a)throw new RangeError("Multiple content holes");a=p}}}return{dom:l,contentDOM:a}}const $k=65535,Bk=Math.pow(2,16);function VL(t,e){return t+e*Bk}function $b(t){return t&$k}function WL(t){return(t-(t&$k))/Bk}const Fk=1,Hk=2,Wc=4,Uk=8;class Lp{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&Uk)>0}get deletedBefore(){return(this.delInfo&(Fk|Wc))>0}get deletedAfter(){return(this.delInfo&(Hk|Wc))>0}get deletedAcross(){return(this.delInfo&Wc)>0}}class _n{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&_n.empty)return _n.empty}recover(e){let n=0,r=$b(e);if(!this.inverted)for(let o=0;o<r;o++)n+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[r*3]+n+WL(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let o=0,s=this.inverted?2:1,i=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?o:0);if(l>e)break;let c=this.ranges[a+s],u=this.ranges[a+i],d=l+c;if(e<=d){let f=c?e==l?-1:e==d?1:n:n,h=l+o+(f<0?0:u);if(r)return h;let p=e==(n<0?l:d)?null:VL(a/3,e-l),m=e==l?Hk:e==d?Fk:Wc;return(n<0?e!=l:e!=d)&&(m|=Uk),new Lp(h,m,p)}o+=u-c}return r?e+o:new Lp(e+o,0,null)}touches(e,n){let r=0,o=$b(n),s=this.inverted?2:1,i=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let c=this.ranges[a+s],u=l+c;if(e<=u&&a==o*3)return!0;r+=this.ranges[a+i]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,s=0;o<this.ranges.length;o+=3){let i=this.ranges[o],a=i-(this.inverted?s:0),l=i+(this.inverted?0:s),c=this.ranges[o+n],u=this.ranges[o+r];e(a,a+c,l,l+u),s+=u-c}}invert(){return new _n(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?_n.empty:new _n(e<0?[0,-e,0]:[0,0,e])}}_n.empty=new _n([]);class Ka{constructor(e,n,r=0,o=e?e.length:0){this.mirror=n,this.from=r,this.to=o,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new Ka(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let o=e.getMirror(n);this.appendMap(e._maps[n],o!=null&&o<n?r+o:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let o=e.getMirror(n);this.appendMap(e._maps[n].invert(),o!=null&&o>n?r-o-1:void 0)}}invert(){let e=new Ka;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let o=0;for(let s=this.from;s<this.to;s++){let i=this._maps[s],a=i.mapResult(e,n);if(a.recover!=null){let l=this.getMirror(s);if(l!=null&&l>s&&l<this.to){s=l,e=this._maps[l].recover(a.recover);continue}}o|=a.delInfo,e=a.pos}return r?e:new Lp(e,o,null)}}const lh=Object.create(null);class tn{getMap(){return _n.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=lh[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in lh)throw new RangeError("Duplicate use of step JSON ID "+e);return lh[e]=n,n.prototype.jsonID=e,n}}class Et{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Et(e,null)}static fail(e){return new Et(null,e)}static fromReplace(e,n,r,o){try{return Et.ok(e.replace(n,r,o))}catch(s){if(s instanceof mu)return Et.fail(s.message);throw s}}}function Tg(t,e,n){let r=[];for(let o=0;o<t.childCount;o++){let s=t.child(o);s.content.size&&(s=s.copy(Tg(s.content,e,s))),s.isInline&&(s=e(s,n,o)),r.push(s)}return F.fromArray(r)}class Bo extends tn{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),o=r.node(r.sharedDepth(this.to)),s=new ee(Tg(n.content,(i,a)=>!i.isAtom||!a.type.allowsMarkType(this.mark.type)?i:i.mark(this.mark.addToSet(i.marks)),o),n.openStart,n.openEnd);return Et.fromReplace(e,this.from,this.to,s)}invert(){return new ur(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Bo(n.pos,r.pos,this.mark)}merge(e){return e instanceof Bo&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Bo(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Bo(n.from,n.to,e.markFromJSON(n.mark))}}tn.jsonID("addMark",Bo);class ur extends tn{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new ee(Tg(n.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),n.openStart,n.openEnd);return Et.fromReplace(e,this.from,this.to,r)}invert(){return new Bo(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new ur(n.pos,r.pos,this.mark)}merge(e){return e instanceof ur&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ur(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new ur(n.from,n.to,e.markFromJSON(n.mark))}}tn.jsonID("removeMark",ur);class Fo extends tn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Et.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Et.fromReplace(e,this.pos,this.pos+1,new ee(F.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let o=0;o<n.marks.length;o++)if(!n.marks[o].isInSet(r))return new Fo(this.pos,n.marks[o]);return new Fo(this.pos,this.mark)}}return new Is(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Fo(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Fo(n.pos,e.markFromJSON(n.mark))}}tn.jsonID("addNodeMark",Fo);class Is extends tn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Et.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Et.fromReplace(e,this.pos,this.pos+1,new ee(F.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Fo(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Is(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Is(n.pos,e.markFromJSON(n.mark))}}tn.jsonID("removeNodeMark",Is);class Lt extends tn{constructor(e,n,r,o=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=o}apply(e){return this.structure&&jp(e,this.from,this.to)?Et.fail("Structure replace would overwrite content"):Et.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new _n([this.from,this.to-this.from,this.slice.size])}invert(e){return new Lt(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new Lt(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Lt)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?ee.empty:new ee(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Lt(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?ee.empty:new ee(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Lt(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Lt(n.from,n.to,ee.fromJSON(e,n.slice),!!n.structure)}}tn.jsonID("replace",Lt);class jt extends tn{constructor(e,n,r,o,s,i,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=s,this.insert=i,this.structure=a}apply(e){if(this.structure&&(jp(e,this.from,this.gapFrom)||jp(e,this.gapTo,this.to)))return Et.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Et.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Et.fromReplace(e,this.from,this.to,r):Et.fail("Content does not fit in gap")}getMap(){return new _n([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new jt(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),o=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||o<n.pos||s>r.pos?null:new jt(n.pos,r.pos,o,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new jt(n.from,n.to,n.gapFrom,n.gapTo,ee.fromJSON(e,n.slice),n.insert,!!n.structure)}}tn.jsonID("replaceAround",jt);function jp(t,e,n){let r=t.resolve(e),o=n-e,s=r.depth;for(;o>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,o--;if(o>0){let i=r.node(s).maybeChild(r.indexAfter(s));for(;o>0;){if(!i||i.isLeaf)return!0;i=i.firstChild,o--}}return!1}function GL(t,e,n,r){let o=[],s=[],i,a;t.doc.nodesBetween(e,n,(l,c,u)=>{if(!l.isInline)return;let d=l.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,e),h=Math.min(c+l.nodeSize,n),p=r.addToSet(d);for(let m=0;m<d.length;m++)d[m].isInSet(p)||(i&&i.to==f&&i.mark.eq(d[m])?i.to=h:o.push(i=new ur(f,h,d[m])));a&&a.to==f?a.to=h:s.push(a=new Bo(f,h,r))}}),o.forEach(l=>t.step(l)),s.forEach(l=>t.step(l))}function qL(t,e,n,r){let o=[],s=0;t.doc.nodesBetween(e,n,(i,a)=>{if(!i.isInline)return;s++;let l=null;if(r instanceof Fd){let c=i.marks,u;for(;u=r.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(i.marks)&&(l=[r]):l=i.marks;if(l&&l.length){let c=Math.min(a+i.nodeSize,n);for(let u=0;u<l.length;u++){let d=l[u],f;for(let h=0;h<o.length;h++){let p=o[h];p.step==s-1&&d.eq(o[h].style)&&(f=p)}f?(f.to=c,f.step=s):o.push({style:d,from:Math.max(a,e),to:c,step:s})}}}),o.forEach(i=>t.step(new ur(i.from,i.to,i.style)))}function Cg(t,e,n,r=n.contentMatch,o=!0){let s=t.doc.nodeAt(e),i=[],a=e+1;for(let l=0;l<s.childCount;l++){let c=s.child(l),u=a+c.nodeSize,d=r.matchType(c.type);if(!d)i.push(new Lt(a,u,ee.empty));else{r=d;for(let f=0;f<c.marks.length;f++)n.allowsMarkType(c.marks[f].type)||t.step(new ur(a,u,c.marks[f]));if(o&&c.isText&&n.whitespace!="pre"){let f,h=/\r?\n|\r/g,p;for(;f=h.exec(c.text);)p||(p=new ee(F.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),i.push(new Lt(a+f.index,a+f.index+f[0].length,p))}}a=u}if(!r.validEnd){let l=r.fillBefore(F.empty,!0);t.replace(a,a,new ee(l,0,0))}for(let l=i.length-1;l>=0;l--)t.step(i[l])}function KL(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Ji(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth;;--r){let o=t.$from.node(r),s=t.$from.index(r),i=t.$to.indexAfter(r);if(r<t.depth&&o.canReplace(s,i,n))return r;if(r==0||o.type.spec.isolating||!KL(o,s,i))break}return null}function YL(t,e,n){let{$from:r,$to:o,depth:s}=e,i=r.before(s+1),a=o.after(s+1),l=i,c=a,u=F.empty,d=0;for(let p=s,m=!1;p>n;p--)m||r.index(p)>0?(m=!0,u=F.from(r.node(p).copy(u)),d++):l--;let f=F.empty,h=0;for(let p=s,m=!1;p>n;p--)m||o.after(p+1)<o.end(p)?(m=!0,f=F.from(o.node(p).copy(f)),h++):c++;t.step(new jt(l,c,i,a,new ee(u.append(f),d,h),u.size-d,!0))}function Ag(t,e,n=null,r=t){let o=JL(t,e),s=o&&XL(r,e);return s?o.map(Bb).concat({type:e,attrs:n}).concat(s.map(Bb)):null}function Bb(t){return{type:t,attrs:null}}function JL(t,e){let{parent:n,startIndex:r,endIndex:o}=t,s=n.contentMatchAt(r).findWrapping(e);if(!s)return null;let i=s.length?s[0]:e;return n.canReplaceWith(r,o,i)?s:null}function XL(t,e){let{parent:n,startIndex:r,endIndex:o}=t,s=n.child(r),i=e.contentMatch.findWrapping(s.type);if(!i)return null;let l=(i.length?i[i.length-1]:e).contentMatch;for(let c=r;l&&c<o;c++)l=l.matchType(n.child(c).type);return!l||!l.validEnd?null:i}function QL(t,e,n){let r=F.empty;for(let i=n.length-1;i>=0;i--){if(r.size){let a=n[i].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=F.from(n[i].type.create(n[i].attrs,r))}let o=e.start,s=e.end;t.step(new jt(o,s,o,s,new ee(r,0,0),n.length,!0))}function ZL(t,e,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=t.steps.length;t.doc.nodesBetween(e,n,(i,a)=>{let l=typeof o=="function"?o(i):o;if(i.isTextblock&&!i.hasMarkup(r,l)&&ej(t.doc,t.mapping.slice(s).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?c=!1:!h&&p&&(c=!0)}c===!1&&Vk(t,i,a,s),Cg(t,t.mapping.slice(s).map(a,1),r,void 0,c===null);let u=t.mapping.slice(s),d=u.map(a,1),f=u.map(a+i.nodeSize,1);return t.step(new jt(d,f,d+1,f-1,new ee(F.from(r.create(l,null,i.marks)),0,0),1,!0)),c===!0&&zk(t,i,a,s),!1}})}function zk(t,e,n,r){e.forEach((o,s)=>{if(o.isText){let i,a=/\r?\n|\r/g;for(;i=a.exec(o.text);){let l=t.mapping.slice(r).map(n+1+s+i.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function Vk(t,e,n,r){e.forEach((o,s)=>{if(o.type==o.type.schema.linebreakReplacement){let i=t.mapping.slice(r).map(n+1+s);t.replaceWith(i,i+1,e.type.schema.text(`
|
|
112
|
+
`))}})}function ej(t,e,n){let r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}function tj(t,e,n,r,o){let s=t.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let i=n.create(r,null,o||s.marks);if(s.isLeaf)return t.replaceWith(e,e+s.nodeSize,i);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new jt(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new ee(F.from(i),0,0),1,!0))}function ao(t,e,n=1,r){let o=t.resolve(e),s=o.depth-n,i=r&&r[r.length-1]||o.parent;if(s<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!i.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,u=n-2;c>s;c--,u--){let d=o.node(c),f=o.index(c);if(d.type.spec.isolating)return!1;let h=d.content.cutByIndex(f,d.childCount),p=r&&r[u+1];p&&(h=h.replaceChild(0,p.type.create(p.attrs)));let m=r&&r[u]||d;if(!d.canReplace(f+1,d.childCount)||!m.type.validContent(h))return!1}let a=o.indexAfter(s),l=r&&r[0];return o.node(s).canReplaceWith(a,a,l?l.type:o.node(s+1).type)}function nj(t,e,n=1,r){let o=t.doc.resolve(e),s=F.empty,i=F.empty;for(let a=o.depth,l=o.depth-n,c=n-1;a>l;a--,c--){s=F.from(o.node(a).copy(s));let u=r&&r[c];i=F.from(u?u.type.create(u.attrs,i):o.node(a).copy(i))}t.step(new Lt(e,e,new ee(s.append(i),n,n),!0))}function as(t,e){let n=t.resolve(e),r=n.index();return Wk(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function rj(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let o=0;o<e.childCount;o++){let s=e.child(o),i=s.type==r?t.type.schema.nodes.text:s.type;if(n=n.matchType(i),!n||!t.type.allowsMarks(s.marks))return!1}return n.validEnd}function Wk(t,e){return!!(t&&e&&!t.isLeaf&&rj(t,e))}function Hd(t,e,n=-1){let r=t.resolve(e);for(let o=r.depth;;o--){let s,i,a=r.index(o);if(o==r.depth?(s=r.nodeBefore,i=r.nodeAfter):n>0?(s=r.node(o+1),a++,i=r.node(o).maybeChild(a)):(s=r.node(o).maybeChild(a-1),i=r.node(o+1)),s&&!s.isTextblock&&Wk(s,i)&&r.node(o).canReplace(a,a+1))return e;if(o==0)break;e=n<0?r.before(o):r.after(o)}}function oj(t,e,n){let r=null,{linebreakReplacement:o}=t.doc.type.schema,s=t.doc.resolve(e-n),i=s.node().type;if(o&&i.inlineContent){let u=i.whitespace=="pre",d=!!i.contentMatch.matchType(o);u&&!d?r=!1:!u&&d&&(r=!0)}let a=t.steps.length;if(r===!1){let u=t.doc.resolve(e+n);Vk(t,u.node(),u.before(),a)}i.inlineContent&&Cg(t,e+n-1,i,s.node().contentMatchAt(s.index()),r==null);let l=t.mapping.slice(a),c=l.map(e-n);if(t.step(new Lt(c,l.map(e+n,-1),ee.empty,!0)),r===!0){let u=t.doc.resolve(c);zk(t,u.node(),u.before(),t.steps.length)}return t}function sj(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let o=r.depth-1;o>=0;o--){let s=r.index(o);if(r.node(o).canReplaceWith(s,s,n))return r.before(o+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let s=r.indexAfter(o);if(r.node(o).canReplaceWith(s,s,n))return r.after(o+1);if(s<r.node(o).childCount)return null}return null}function Gk(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let o=n.content;for(let s=0;s<n.openStart;s++)o=o.firstChild.content;for(let s=1;s<=(n.openStart==0&&n.size?2:1);s++)for(let i=r.depth;i>=0;i--){let a=i==r.depth?0:r.pos<=(r.start(i+1)+r.end(i+1))/2?-1:1,l=r.index(i)+(a>0?1:0),c=r.node(i),u=!1;if(s==1)u=c.canReplace(l,l,o);else{let d=c.contentMatchAt(l).findWrapping(o.firstChild.type);u=d&&c.canReplaceWith(l,l,d[0])}if(u)return a==0?r.pos:a<0?r.before(i+1):r.after(i+1)}return null}function Ud(t,e,n=e,r=ee.empty){if(e==n&&!r.size)return null;let o=t.resolve(e),s=t.resolve(n);return qk(o,s,r)?new Lt(e,n,r):new ij(o,s,r).fit()}function qk(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class ij{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=F.empty;for(let o=0;o<=e.depth;o++){let s=e.node(o);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(o))})}for(let o=e.depth;o>0;o--)this.placed=F.from(e.node(o).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(e<0?this.$to:r.doc.resolve(e));if(!o)return null;let s=this.placed,i=r.depth,a=o.depth;for(;i&&a&&s.childCount==1;)s=s.firstChild.content,i--,a--;let l=new ee(s,i,a);return e>-1?new jt(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new Lt(r.pos,o.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,o=this.unplaced.openEnd;r<e;r++){let s=n.firstChild;if(n.childCount>1&&(o=0),s.type.spec.isolating&&o<=r){e=r;break}n=s.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let o,s=null;r?(s=ch(this.unplaced.content,r-1).firstChild,o=s.content):o=this.unplaced.content;let i=o.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],u,d=null;if(n==1&&(i?c.matchType(i.type)||(d=c.fillBefore(F.from(i),!1)):s&&l.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:a,parent:s,inject:d};if(n==2&&i&&(u=c.findWrapping(i.type)))return{sliceDepth:r,frontierDepth:a,parent:s,wrap:u};if(s&&c.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,o=ch(e,n);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new ee(e,n+1,Math.max(r,o.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,o=ch(e,n);if(o.childCount<=1&&n>0){let s=e.size-n<=n+o.size;this.unplaced=new ee(wa(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new ee(wa(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:o,wrap:s}){for(;this.depth>n;)this.closeFrontierNode();if(s)for(let m=0;m<s.length;m++)this.openFrontierNode(s[m]);let i=this.unplaced,a=r?r.content:i.content,l=i.openStart-e,c=0,u=[],{match:d,type:f}=this.frontier[n];if(o){for(let m=0;m<o.childCount;m++)u.push(o.child(m));d=d.matchFragment(o)}let h=a.size+e-(i.content.size-i.openEnd);for(;c<a.childCount;){let m=a.child(c),y=d.matchType(m.type);if(!y)break;c++,(c>1||l==0||m.content.size)&&(d=y,u.push(Kk(m.mark(f.allowedMarks(m.marks)),c==1?l:0,c==a.childCount?h:-1)))}let p=c==a.childCount;p||(h=-1),this.placed=Ea(this.placed,n,F.from(u)),this.frontier[n].match=d,p&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,y=a;m<h;m++){let v=y.lastChild;this.frontier.push({type:v.type,match:v.contentMatchAt(v.childCount)}),y=v.content}this.unplaced=p?e==0?ee.empty:new ee(wa(i.content,e-1,1),e-1,h<0?i.openEnd:e-1):new ee(wa(i.content,e,c),i.openStart,i.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!uh(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,o=this.$to.after(r);for(;r>1&&o==this.$to.end(--r);)++o;return o}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:o}=this.frontier[n],s=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),i=uh(e,n,o,r,s);if(i){for(let a=n-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],u=uh(e,a,c,l,!0);if(!u||u.childCount)continue e}return{depth:n,fit:i,move:s?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Ea(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let o=e.node(r),s=o.type.contentMatch.fillBefore(o.content,!0,e.index(r));this.openFrontierNode(o.type,o.attrs,s)}return e}openFrontierNode(e,n=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=Ea(this.placed,this.depth,F.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(F.empty,!0);n.childCount&&(this.placed=Ea(this.placed,this.frontier.length,n))}}function wa(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(wa(t.firstChild.content,e-1,n)))}function Ea(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Ea(t.lastChild.content,e-1,n)))}function ch(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function Kk(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,Kk(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(F.empty,!0)))),t.copy(r)}function uh(t,e,n,r,o){let s=t.node(e),i=o?t.indexAfter(e):t.index(e);if(i==s.childCount&&!n.compatibleContent(s.type))return null;let a=r.fillBefore(s.content,!0,i);return a&&!aj(n,s.content,i)?a:null}function aj(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function lj(t){return t.spec.defining||t.spec.definingForContent}function cj(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let o=t.doc.resolve(e),s=t.doc.resolve(n);if(qk(o,s,r))return t.step(new Lt(e,n,r));let i=Jk(o,t.doc.resolve(n));i[i.length-1]==0&&i.pop();let a=-(o.depth+1);i.unshift(a);for(let f=o.depth,h=o.pos-1;f>0;f--,h--){let p=o.node(f).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;i.indexOf(f)>-1?a=f:o.before(f)==h&&i.splice(1,0,-f)}let l=i.indexOf(a),c=[],u=r.openStart;for(let f=r.content,h=0;;h++){let p=f.firstChild;if(c.push(p),h==r.openStart)break;f=p.content}for(let f=u-1;f>=0;f--){let h=c[f],p=lj(h.type);if(p&&!h.sameMarkup(o.node(Math.abs(a)-1)))u=f;else if(p||!h.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let h=(f+u+1)%(r.openStart+1),p=c[h];if(p)for(let m=0;m<i.length;m++){let y=i[(m+l)%i.length],v=!0;y<0&&(v=!1,y=-y);let w=o.node(y-1),E=o.index(y-1);if(w.canReplaceWith(E,E,p.type,p.marks))return t.replace(o.before(y),v?s.after(y):n,new ee(Yk(r.content,0,r.openStart,h),h,r.openEnd))}}let d=t.steps.length;for(let f=i.length-1;f>=0&&(t.replace(e,n,r),!(t.steps.length>d));f--){let h=i[f];h<0||(e=o.before(h),n=s.after(h))}}function Yk(t,e,n,r,o){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(Yk(s.content,e+1,n,r,s)))}if(e>r){let s=o.contentMatchAt(0),i=s.fillBefore(t).append(t);t=i.append(s.matchFragment(i).fillBefore(F.empty,!0))}return t}function uj(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let o=sj(t.doc,e,r.type);o!=null&&(e=n=o)}t.replaceRange(e,n,new ee(F.from(r),0,0))}function dj(t,e,n){let r=t.doc.resolve(e),o=t.doc.resolve(n),s=Jk(r,o);for(let i=0;i<s.length;i++){let a=s[i],l=i==s.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return t.delete(r.start(a),o.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),o.indexAfter(a-1))))return t.delete(r.before(a),o.after(a))}for(let i=1;i<=r.depth&&i<=o.depth;i++)if(e-r.start(i)==r.depth-i&&n>r.end(i)&&o.end(i)-n!=o.depth-i&&r.start(i-1)==o.start(i-1)&&r.node(i-1).canReplace(r.index(i-1),o.index(i-1)))return t.delete(r.before(i),n);t.delete(e,n)}function Jk(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let o=r;o>=0;o--){let s=t.start(o);if(s<t.pos-(t.depth-o)||e.end(o)>e.pos+(e.depth-o)||t.node(o).type.spec.isolating||e.node(o).type.spec.isolating)break;(s==e.start(o)||o==t.depth&&o==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==s-1)&&n.push(o)}return n}class vi extends tn{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return Et.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let o=n.type.create(r,null,n.marks);return Et.fromReplace(e,this.pos,this.pos+1,new ee(F.from(o),0,n.isLeaf?0:1))}getMap(){return _n.empty}invert(e){return new vi(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new vi(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new vi(n.pos,n.attr,n.value)}}tn.jsonID("attr",vi);class Ya extends tn{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let o in e.attrs)n[o]=e.attrs[o];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Et.ok(r)}getMap(){return _n.empty}invert(e){return new Ya(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Ya(n.attr,n.value)}}tn.jsonID("docAttr",Ya);let Mi=class extends Error{};Mi=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Mi.prototype=Object.create(Error.prototype);Mi.prototype.constructor=Mi;Mi.prototype.name="TransformError";class Xk{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Ka}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Mi(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=ee.empty){let o=Ud(this.doc,e,n,r);return o&&this.step(o),this}replaceWith(e,n,r){return this.replace(e,n,new ee(F.from(r),0,0))}delete(e,n){return this.replace(e,n,ee.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return cj(this,e,n,r),this}replaceRangeWith(e,n,r){return uj(this,e,n,r),this}deleteRange(e,n){return dj(this,e,n),this}lift(e,n){return YL(this,e,n),this}join(e,n=1){return oj(this,e,n),this}wrap(e,n){return QL(this,e,n),this}setBlockType(e,n=e,r,o=null){return ZL(this,e,n,r,o),this}setNodeMarkup(e,n,r=null,o){return tj(this,e,n,r,o),this}setNodeAttribute(e,n,r){return this.step(new vi(e,n,r)),this}setDocAttribute(e,n){return this.step(new Ya(e,n)),this}addNodeMark(e,n){return this.step(new Fo(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof Xe)n.isInSet(r.marks)&&this.step(new Is(e,n));else{let o=r.marks,s,i=[];for(;s=n.isInSet(o);)i.push(new Is(e,s)),o=s.removeFromSet(o);for(let a=i.length-1;a>=0;a--)this.step(i[a])}return this}split(e,n=1,r){return nj(this,e,n,r),this}addMark(e,n,r){return GL(this,e,n,r),this}removeMark(e,n,r){return qL(this,e,n,r),this}clearIncompatible(e,n,r){return Cg(this,e,n,r),this}}const dh=Object.create(null);class Oe{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new Qk(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=ee.empty){let r=n.content.lastChild,o=null;for(let a=0;a<n.openEnd;a++)o=r,r=r.lastChild;let s=e.steps.length,i=this.ranges;for(let a=0;a<i.length;a++){let{$from:l,$to:c}=i[a],u=e.mapping.slice(s);e.replaceRange(u.map(l.pos),u.map(c.pos),a?ee.empty:n),a==0&&Ub(e,s,(r?r.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,o=this.ranges;for(let s=0;s<o.length;s++){let{$from:i,$to:a}=o[s],l=e.mapping.slice(r),c=l.map(i.pos),u=l.map(a.pos);s?e.deleteRange(c,u):(e.replaceRangeWith(c,u,n),Ub(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let o=e.parent.inlineContent?new pe(e):fi(e.node(0),e.parent,e.pos,e.index(),n,r);if(o)return o;for(let s=e.depth-1;s>=0;s--){let i=n<0?fi(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):fi(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,n,r);if(i)return i}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Sn(e.node(0))}static atStart(e){return fi(e,e,0,0,1)||new Sn(e)}static atEnd(e){return fi(e,e,e.content.size,e.childCount,-1)||new Sn(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=dh[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in dh)throw new RangeError("Duplicate use of selection JSON ID "+e);return dh[e]=n,n.prototype.jsonID=e,n}getBookmark(){return pe.between(this.$anchor,this.$head).getBookmark()}}Oe.prototype.visible=!0;class Qk{constructor(e,n){this.$from=e,this.$to=n}}let Fb=!1;function Hb(t){!Fb&&!t.parent.inlineContent&&(Fb=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class pe extends Oe{constructor(e,n=e){Hb(e),Hb(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return Oe.near(r);let o=e.resolve(n.map(this.anchor));return new pe(o.parent.inlineContent?o:r,r)}replace(e,n=ee.empty){if(super.replace(e,n),n==ee.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof pe&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new zd(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new pe(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let o=e.resolve(n);return new this(o,r==n?o:e.resolve(r))}static between(e,n,r){let o=e.pos-n.pos;if((!r||o)&&(r=o>=0?1:-1),!n.parent.inlineContent){let s=Oe.findFrom(n,r,!0)||Oe.findFrom(n,-r,!0);if(s)n=s.$head;else return Oe.near(n,r)}return e.parent.inlineContent||(o==0?e=n:(e=(Oe.findFrom(e,-r,!0)||Oe.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=o<0&&(e=n))),new pe(e,n)}}Oe.jsonID("text",pe);class zd{constructor(e,n){this.anchor=e,this.head=n}map(e){return new zd(e.map(this.anchor),e.map(this.head))}resolve(e){return pe.between(e.resolve(this.anchor),e.resolve(this.head))}}class ue extends Oe{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:o}=n.mapResult(this.anchor),s=e.resolve(o);return r?Oe.near(s):new ue(s)}content(){return new ee(F.from(this.node),0,0)}eq(e){return e instanceof ue&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Mg(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new ue(e.resolve(n.anchor))}static create(e,n){return new ue(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}ue.prototype.visible=!1;Oe.jsonID("node",ue);class Mg{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new zd(r,r):new Mg(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&ue.isSelectable(r)?new ue(n):Oe.near(n)}}class Sn extends Oe{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=ee.empty){if(n==ee.empty){e.delete(0,e.doc.content.size);let r=Oe.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Sn(e)}map(e){return new Sn(e)}eq(e){return e instanceof Sn}getBookmark(){return fj}}Oe.jsonID("all",Sn);const fj={map(){return this},resolve(t){return new Sn(t)}};function fi(t,e,n,r,o,s=!1){if(e.inlineContent)return pe.create(t,n);for(let i=r-(o>0?0:1);o>0?i<e.childCount:i>=0;i+=o){let a=e.child(i);if(a.isAtom){if(!s&&ue.isSelectable(a))return ue.create(t,n-(o<0?a.nodeSize:0))}else{let l=fi(t,a,n+o,o<0?a.childCount:0,o,s);if(l)return l}n+=a.nodeSize*o}return null}function Ub(t,e,n){let r=t.steps.length-1;if(r<e)return;let o=t.steps[r];if(!(o instanceof Lt||o instanceof jt))return;let s=t.mapping.maps[r],i;s.forEach((a,l,c,u)=>{i==null&&(i=u)}),t.setSelection(Oe.near(t.doc.resolve(i),n))}const zb=1,mc=2,Vb=4;let hj=class extends Xk{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|zb)&~mc,this.storedMarks=null,this}get selectionSet(){return(this.updated&zb)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=mc,this}ensureMarks(e){return Xe.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&mc)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~mc,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Xe.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let o=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(o.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),r=r??n,!e)return this.deleteRange(n,r);let s=this.storedMarks;if(!s){let i=this.doc.resolve(n);s=r==n?i.marks():i.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,o.text(e,s)),this.selection.empty||this.setSelection(Oe.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Vb,this}get scrolledIntoView(){return(this.updated&Vb)>0}};function Wb(t,e){return!e||!t?t:t.bind(e)}class Sa{constructor(e,n,r){this.name=e,this.init=Wb(n.init,r),this.apply=Wb(n.apply,r)}}const pj=[new Sa("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Sa("selection",{init(t,e){return t.selection||Oe.atStart(e.doc)},apply(t){return t.selection}}),new Sa("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Sa("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class fh{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=pj.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new Sa(r.key,r.spec.state,r))})}}class yi{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let o=this.config.plugins[r];if(o.spec.filterTransaction&&!o.spec.filterTransaction.call(o,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),o=null;for(;;){let s=!1;for(let i=0;i<this.config.plugins.length;i++){let a=this.config.plugins[i];if(a.spec.appendTransaction){let l=o?o[i].n:0,c=o?o[i].state:this,u=l<n.length&&a.spec.appendTransaction.call(a,l?n.slice(l):n,c,r);if(u&&r.filterTransaction(u,i)){if(u.setMeta("appendedTransaction",e),!o){o=[];for(let d=0;d<this.config.plugins.length;d++)o.push(d<i?{state:r,n:n.length}:{state:this,n:0})}n.push(u),r=r.applyInner(u),s=!0}o&&(o[i]={state:r,n:n.length})}}if(!s)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new yi(this.config),r=this.config.fields;for(let o=0;o<r.length;o++){let s=r[o];n[s.name]=s.apply(e,this[s.name],this,n)}return n}get tr(){return new hj(this)}static create(e){let n=new fh(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new yi(n);for(let o=0;o<n.fields.length;o++)r[n.fields[o].name]=n.fields[o].init(e,r);return r}reconfigure(e){let n=new fh(this.schema,e.plugins),r=n.fields,o=new yi(n);for(let s=0;s<r.length;s++){let i=r[s].name;o[i]=this.hasOwnProperty(i)?this[i]:r[s].init(e,o)}return o}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let o=e[r],s=o.spec.state;s&&s.toJSON&&(n[r]=s.toJSON.call(o,this[o.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let o=new fh(e.schema,e.plugins),s=new yi(o);return o.fields.forEach(i=>{if(i.name=="doc")s.doc=io.fromJSON(e.schema,n.doc);else if(i.name=="selection")s.selection=Oe.fromJSON(s.doc,n.selection);else if(i.name=="storedMarks")n.storedMarks&&(s.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],c=l.spec.state;if(l.key==i.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){s[i.name]=c.fromJSON.call(l,e,n[a],s);return}}s[i.name]=i.init(e,s)}}),s}}function Zk(t,e,n){for(let r in t){let o=t[r];o instanceof Function?o=o.bind(e):r=="handleDOMEvents"&&(o=Zk(o,e,{})),n[r]=o}return n}class Ue{constructor(e){this.spec=e,this.props={},e.props&&Zk(e.props,this,this.props),this.key=e.key?e.key.key:e1("plugin")}getState(e){return e[this.key]}}const hh=Object.create(null);function e1(t){return t in hh?t+"$"+ ++hh[t]:(hh[t]=0,t+"$")}class We{constructor(e="key"){this.key=e1(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Og=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function t1(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const n1=(t,e,n)=>{let r=t1(t,n);if(!r)return!1;let o=Rg(r);if(!o){let i=r.blockRange(),a=i&&Ji(i);return a==null?!1:(e&&e(t.tr.lift(i,a).scrollIntoView()),!0)}let s=o.nodeBefore;if(d1(t,o,e,-1))return!0;if(r.parent.content.size==0&&(Oi(s,"end")||ue.isSelectable(s)))for(let i=r.depth;;i--){let a=Ud(t.doc,r.before(i),r.after(i),ee.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=t.tr.step(a);l.setSelection(Oi(s,"end")?Oe.findFrom(l.doc.resolve(l.mapping.map(o.pos,-1)),-1):ue.create(l.doc,o.pos-s.nodeSize)),e(l.scrollIntoView())}return!0}if(i==1||r.node(i-1).childCount>1)break}return s.isAtom&&o.depth==r.depth-1?(e&&e(t.tr.delete(o.pos-s.nodeSize,o.pos).scrollIntoView()),!0):!1},mj=(t,e,n)=>{let r=t1(t,n);if(!r)return!1;let o=Rg(r);return o?r1(t,o,e):!1},gj=(t,e,n)=>{let r=s1(t,n);if(!r)return!1;let o=Ng(r);return o?r1(t,o,e):!1};function r1(t,e,n){let r=e.nodeBefore,o=r,s=e.pos-1;for(;!o.isTextblock;s--){if(o.type.spec.isolating)return!1;let u=o.lastChild;if(!u)return!1;o=u}let i=e.nodeAfter,a=i,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let u=a.firstChild;if(!u)return!1;a=u}let c=Ud(t.doc,s,l,ee.empty);if(!c||c.from!=s||c instanceof Lt&&c.slice.size>=l-s)return!1;if(n){let u=t.tr.step(c);u.setSelection(pe.create(u.doc,s)),n(u.scrollIntoView())}return!0}function Oi(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const o1=(t,e,n)=>{let{$head:r,empty:o}=t.selection,s=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;s=Rg(r)}let i=s&&s.nodeBefore;return!i||!ue.isSelectable(i)?!1:(e&&e(t.tr.setSelection(ue.create(t.doc,s.pos-i.nodeSize)).scrollIntoView()),!0)};function Rg(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function s1(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const i1=(t,e,n)=>{let r=s1(t,n);if(!r)return!1;let o=Ng(r);if(!o)return!1;let s=o.nodeAfter;if(d1(t,o,e,1))return!0;if(r.parent.content.size==0&&(Oi(s,"start")||ue.isSelectable(s))){let i=Ud(t.doc,r.before(),r.after(),ee.empty);if(i&&i.slice.size<i.to-i.from){if(e){let a=t.tr.step(i);a.setSelection(Oi(s,"start")?Oe.findFrom(a.doc.resolve(a.mapping.map(o.pos)),1):ue.create(a.doc,a.mapping.map(o.pos))),e(a.scrollIntoView())}return!0}}return s.isAtom&&o.depth==r.depth-1?(e&&e(t.tr.delete(o.pos,o.pos+s.nodeSize).scrollIntoView()),!0):!1},a1=(t,e,n)=>{let{$head:r,empty:o}=t.selection,s=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;s=Ng(r)}let i=s&&s.nodeAfter;return!i||!ue.isSelectable(i)?!1:(e&&e(t.tr.setSelection(ue.create(t.doc,s.pos)).scrollIntoView()),!0)};function Ng(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const yj=(t,e)=>{let n=t.selection,r=n instanceof ue,o;if(r){if(n.node.isTextblock||!as(t.doc,n.from))return!1;o=n.from}else if(o=Hd(t.doc,n.from,-1),o==null)return!1;if(e){let s=t.tr.join(o);r&&s.setSelection(ue.create(s.doc,o-t.doc.resolve(o).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},vj=(t,e)=>{let n=t.selection,r;if(n instanceof ue){if(n.node.isTextblock||!as(t.doc,n.to))return!1;r=n.to}else if(r=Hd(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},bj=(t,e)=>{let{$from:n,$to:r}=t.selection,o=n.blockRange(r),s=o&&Ji(o);return s==null?!1:(e&&e(t.tr.lift(o,s).scrollIntoView()),!0)},l1=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
|
|
113
|
+
`).scrollIntoView()),!0)};function _g(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const xj=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),s=n.indexAfter(-1),i=_g(o.contentMatchAt(s));if(!i||!o.canReplaceWith(s,s,i))return!1;if(e){let a=n.after(),l=t.tr.replaceWith(a,a,i.createAndFill());l.setSelection(Oe.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},c1=(t,e)=>{let n=t.selection,{$from:r,$to:o}=n;if(n instanceof Sn||r.parent.inlineContent||o.parent.inlineContent)return!1;let s=_g(o.parent.contentMatchAt(o.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let i=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,a=t.tr.insert(i,s.createAndFill());a.setSelection(pe.create(a.doc,i+1)),e(a.scrollIntoView())}return!0},u1=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let s=n.before();if(ao(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),o=r&&Ji(r);return o==null?!1:(e&&e(t.tr.lift(r,o).scrollIntoView()),!0)};function wj(t){return(e,n)=>{let{$from:r,$to:o}=e.selection;if(e.selection instanceof ue&&e.selection.node.isBlock)return!r.parentOffset||!ao(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],i,a,l=!1,c=!1;for(let h=r.depth;;h--)if(r.node(h).isBlock){l=r.end(h)==r.pos+(r.depth-h),c=r.start(h)==r.pos-(r.depth-h),a=_g(r.node(h-1).contentMatchAt(r.indexAfter(h-1))),s.unshift(l&&a?{type:a}:null),i=h;break}else{if(h==1)return!1;s.unshift(null)}let u=e.tr;(e.selection instanceof pe||e.selection instanceof Sn)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=ao(u.doc,d,s.length,s);if(f||(s[0]=a?{type:a}:null,f=ao(u.doc,d,s.length,s)),!f)return!1;if(u.split(d,s.length,s),!l&&c&&r.node(i).type!=a){let h=u.mapping.map(r.before(i)),p=u.doc.resolve(h);a&&r.node(i-1).canReplaceWith(p.index(),p.index()+1,a)&&u.setNodeMarkup(u.mapping.map(r.before(i)),a)}return n&&n(u.scrollIntoView()),!0}}const Ej=wj(),Sj=(t,e)=>{let{$from:n,to:r}=t.selection,o,s=n.sharedDepth(r);return s==0?!1:(o=n.before(s),e&&e(t.tr.setSelection(ue.create(t.doc,o))),!0)};function kj(t,e,n){let r=e.nodeBefore,o=e.nodeAfter,s=e.index();return!r||!o||!r.type.compatibleContent(o.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(o.isTextblock||as(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function d1(t,e,n,r){let o=e.nodeBefore,s=e.nodeAfter,i,a,l=o.type.spec.isolating||s.type.spec.isolating;if(!l&&kj(t,e,n))return!0;let c=!l&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(i=(a=o.contentMatchAt(o.childCount)).findWrapping(s.type))&&a.matchType(i[0]||s.type).validEnd){if(n){let h=e.pos+s.nodeSize,p=F.empty;for(let v=i.length-1;v>=0;v--)p=F.from(i[v].create(null,p));p=F.from(o.copy(p));let m=t.tr.step(new jt(e.pos-1,h,e.pos,h,new ee(p,1,0),i.length,!0)),y=m.doc.resolve(h+2*i.length);y.nodeAfter&&y.nodeAfter.type==o.type&&as(m.doc,y.pos)&&m.join(y.pos),n(m.scrollIntoView())}return!0}let u=s.type.spec.isolating||r>0&&l?null:Oe.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),f=d&&Ji(d);if(f!=null&&f>=e.depth)return n&&n(t.tr.lift(d,f).scrollIntoView()),!0;if(c&&Oi(s,"start",!0)&&Oi(o,"end")){let h=o,p=[];for(;p.push(h),!h.isTextblock;)h=h.lastChild;let m=s,y=1;for(;!m.isTextblock;m=m.firstChild)y++;if(h.canReplace(h.childCount,h.childCount,m.content)){if(n){let v=F.empty;for(let E=p.length-1;E>=0;E--)v=F.from(p[E].copy(v));let w=t.tr.step(new jt(e.pos-p.length,e.pos+s.nodeSize,e.pos+y,e.pos+s.nodeSize-y,new ee(v,p.length,0),0,!0));n(w.scrollIntoView())}return!0}}return!1}function f1(t){return function(e,n){let r=e.selection,o=t<0?r.$from:r.$to,s=o.depth;for(;o.node(s).isInline;){if(!s)return!1;s--}return o.node(s).isTextblock?(n&&n(e.tr.setSelection(pe.create(e.doc,t<0?o.start(s):o.end(s)))),!0):!1}}const Tj=f1(-1),Cj=f1(1);function Aj(t,e=null){return function(n,r){let{$from:o,$to:s}=n.selection,i=o.blockRange(s),a=i&&Ag(i,t,e);return a?(r&&r(n.tr.wrap(i,a).scrollIntoView()),!0):!1}}function Gb(t,e=null){return function(n,r){let o=!1;for(let s=0;s<n.selection.ranges.length&&!o;s++){let{$from:{pos:i},$to:{pos:a}}=n.selection.ranges[s];n.doc.nodesBetween(i,a,(l,c)=>{if(o)return!1;if(!(!l.isTextblock||l.hasMarkup(t,e)))if(l.type==t)o=!0;else{let u=n.doc.resolve(c),d=u.index();o=u.parent.canReplaceWith(d,d+1,t)}})}if(!o)return!1;if(r){let s=n.tr;for(let i=0;i<n.selection.ranges.length;i++){let{$from:{pos:a},$to:{pos:l}}=n.selection.ranges[i];s.setBlockType(a,l,t,e)}r(s.scrollIntoView())}return!0}}function Dg(...t){return function(e,n,r){for(let o=0;o<t.length;o++)if(t[o](e,n,r))return!0;return!1}}Dg(Og,n1,o1);Dg(Og,i1,a1);Dg(l1,c1,u1,Ej);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function Mj(t,e=null){return function(n,r){let{$from:o,$to:s}=n.selection,i=o.blockRange(s);if(!i)return!1;let a=r?n.tr:null;return Oj(a,i,t,e)?(r&&r(a.scrollIntoView()),!0):!1}}function Oj(t,e,n,r=null){let o=!1,s=e,i=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let l=i.resolve(e.start-2);s=new Ga(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new Ga(e.$from,i.resolve(e.$to.end(e.depth)),e.depth)),o=!0}let a=Ag(s,n,r,e);return a?(t&&Rj(t,e,a,o,n),!0):!1}function Rj(t,e,n,r,o){let s=F.empty;for(let u=n.length-1;u>=0;u--)s=F.from(n[u].type.create(n[u].attrs,s));t.step(new jt(e.start-(r?2:0),e.end,e.start,e.end,new ee(s,0,0),n.length,!0));let i=0;for(let u=0;u<n.length;u++)n[u].type==o&&(i=u+1);let a=n.length-i,l=e.start+n.length-(r?2:0),c=e.parent;for(let u=e.startIndex,d=e.endIndex,f=!0;u<d;u++,f=!1)!f&&ao(t.doc,l,a)&&(t.split(l,a),l+=2*a),l+=c.child(u).nodeSize;return t}function Nj(t){return function(e,n){let{$from:r,$to:o}=e.selection,s=r.blockRange(o,i=>i.childCount>0&&i.firstChild.type==t);return s?n?r.node(s.depth-1).type==t?_j(e,n,t,s):Dj(e,n,s):!0:!1}}function _j(t,e,n,r){let o=t.tr,s=r.end,i=r.$to.end(r.depth);s<i&&(o.step(new jt(s-1,i,s,i,new ee(F.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Ga(o.doc.resolve(r.$from.pos),o.doc.resolve(i),r.depth));const a=Ji(r);if(a==null)return!1;o.lift(r,a);let l=o.doc.resolve(o.mapping.map(s,-1)-1);return as(o.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&o.join(l.pos),e(o.scrollIntoView()),!0}function Dj(t,e,n){let r=t.tr,o=n.parent;for(let h=n.end,p=n.endIndex-1,m=n.startIndex;p>m;p--)h-=o.child(p).nodeSize,r.delete(h-1,h+1);let s=r.doc.resolve(n.start),i=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,l=n.endIndex==o.childCount,c=s.node(-1),u=s.index(-1);if(!c.canReplace(u+(a?0:1),u+1,i.content.append(l?F.empty:F.from(o))))return!1;let d=s.pos,f=d+i.nodeSize;return r.step(new jt(d-(a?1:0),f+(l?1:0),d+1,f-1,new ee((a?F.empty:F.from(o.copy(F.empty))).append(l?F.empty:F.from(o.copy(F.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function Ij(t){return function(e,n){let{$from:r,$to:o}=e.selection,s=r.blockRange(o,c=>c.childCount>0&&c.firstChild.type==t);if(!s)return!1;let i=s.startIndex;if(i==0)return!1;let a=s.parent,l=a.child(i-1);if(l.type!=t)return!1;if(n){let c=l.lastChild&&l.lastChild.type==a.type,u=F.from(c?t.create():null),d=new ee(F.from(t.create(null,F.from(a.type.create(null,u)))),c?3:1,0),f=s.start,h=s.end;n(e.tr.step(new jt(f-(c?3:1),h,f,h,d,1,!0)).scrollIntoView())}return!0}}const Vt=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Ri=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let $p=null;const ro=function(t,e,n){let r=$p||($p=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},Pj=function(){$p=null},Ps=function(t,e,n,r){return n&&(qb(t,e,n,r,-1)||qb(t,e,n,r,1))},Lj=/^(img|br|input|textarea|hr)$/i;function qb(t,e,n,r,o){for(var s;;){if(t==n&&e==r)return!0;if(e==(o<0?0:Gn(t))){let i=t.parentNode;if(!i||i.nodeType!=1||Pl(t)||Lj.test(t.nodeName)||t.contentEditable=="false")return!1;e=Vt(t)+(o<0?0:1),t=i}else if(t.nodeType==1){let i=t.childNodes[e+(o<0?-1:0)];if(i.nodeType==1&&i.contentEditable=="false")if(!((s=i.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=o;else return!1;else t=i,e=o<0?Gn(t):0}else return!1}}function Gn(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function jj(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Gn(t)}else if(t.parentNode&&!Pl(t))e=Vt(t),t=t.parentNode;else return null}}function $j(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!Pl(t))e=Vt(t)+1,t=t.parentNode;else return null}}function Bj(t,e,n){for(let r=e==0,o=e==Gn(t);r||o;){if(t==n)return!0;let s=Vt(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,o=o&&s==Gn(t)}}function Pl(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const Vd=function(t){return t.focusNode&&Ps(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function gs(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function Fj(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Hj(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Gn(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Gn(r.startContainer),r.startOffset)}}}const Hr=typeof navigator<"u"?navigator:null,Kb=typeof document<"u"?document:null,ls=Hr&&Hr.userAgent||"",Bp=/Edge\/(\d+)/.exec(ls),h1=/MSIE \d/.exec(ls),Fp=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ls),kn=!!(h1||Fp||Bp),Go=h1?document.documentMode:Fp?+Fp[1]:Bp?+Bp[1]:0,Yn=!kn&&/gecko\/(\d+)/i.test(ls);Yn&&+(/Firefox\/(\d+)/.exec(ls)||[0,0])[1];const Hp=!kn&&/Chrome\/(\d+)/.exec(ls),Xt=!!Hp,p1=Hp?+Hp[1]:0,ln=!kn&&!!Hr&&/Apple Computer/.test(Hr.vendor),Ni=ln&&(/Mobile\/\w+/.test(ls)||!!Hr&&Hr.maxTouchPoints>2),Wn=Ni||(Hr?/Mac/.test(Hr.platform):!1),Uj=Hr?/Win/.test(Hr.platform):!1,so=/Android \d/.test(ls),Ll=!!Kb&&"webkitFontSmoothing"in Kb.documentElement.style,zj=Ll?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Vj(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function Jr(t,e){return typeof t=="number"?t:t[e]}function Wj(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function Yb(t,e,n){let r=t.someProp("scrollThreshold")||0,o=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(let i=n||t.dom;i;){if(i.nodeType!=1){i=Ri(i);continue}let a=i,l=a==s.body,c=l?Vj(s):Wj(a),u=0,d=0;if(e.top<c.top+Jr(r,"top")?d=-(c.top-e.top+Jr(o,"top")):e.bottom>c.bottom-Jr(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+Jr(o,"top")-c.top:e.bottom-c.bottom+Jr(o,"bottom")),e.left<c.left+Jr(r,"left")?u=-(c.left-e.left+Jr(o,"left")):e.right>c.right-Jr(r,"right")&&(u=e.right-c.right+Jr(o,"right")),u||d)if(l)s.defaultView.scrollBy(u,d);else{let h=a.scrollLeft,p=a.scrollTop;d&&(a.scrollTop+=d),u&&(a.scrollLeft+=u);let m=a.scrollLeft-h,y=a.scrollTop-p;e={left:e.left-m,top:e.top-y,right:e.right-m,bottom:e.bottom-y}}let f=l?"fixed":getComputedStyle(i).position;if(/^(fixed|sticky)$/.test(f))break;i=f=="absolute"?i.offsetParent:Ri(i)}}function Gj(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,o;for(let s=(e.left+e.right)/2,i=n+1;i<Math.min(innerHeight,e.bottom);i+=5){let a=t.root.elementFromPoint(s,i);if(!a||a==t.dom||!t.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=n-20){r=a,o=l.top;break}}return{refDOM:r,refTop:o,stack:m1(t.dom)}}function m1(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Ri(r));return e}function qj({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;g1(n,r==0?0:r-e)}function g1(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:o,left:s}=t[n];r.scrollTop!=o+e&&(r.scrollTop=o+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let si=null;function Kj(t){if(t.setActive)return t.setActive();if(si)return t.focus(si);let e=m1(t);t.focus(si==null?{get preventScroll(){return si={preventScroll:!0},!0}}:void 0),si||(si=!1,g1(e,0))}function y1(t,e){let n,r=2e8,o,s=0,i=e.top,a=e.top,l,c;for(let u=t.firstChild,d=0;u;u=u.nextSibling,d++){let f;if(u.nodeType==1)f=u.getClientRects();else if(u.nodeType==3)f=ro(u).getClientRects();else continue;for(let h=0;h<f.length;h++){let p=f[h];if(p.top<=i&&p.bottom>=a){i=Math.max(p.bottom,i),a=Math.min(p.top,a);let m=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(m<r){n=u,r=m,o=m&&n.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,u.nodeType==1&&m&&(s=d+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!l&&p.left<=e.left&&p.right>=e.left&&(l=u,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!n&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(s=d+1)}}return!n&&l&&(n=l,o=c,r=0),n&&n.nodeType==3?Yj(n,o):!n||r&&n.nodeType==1?{node:t,offset:s}:y1(n,o)}function Yj(t,e){let n=t.nodeValue.length,r=document.createRange();for(let o=0;o<n;o++){r.setEnd(t,o+1),r.setStart(t,o);let s=Oo(r,1);if(s.top!=s.bottom&&Ig(e,s))return{node:t,offset:o+(e.left>=(s.left+s.right)/2?1:0)}}return{node:t,offset:0}}function Ig(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function Jj(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function Xj(t,e,n){let{node:r,offset:o}=y1(e,n),s=-1;if(r.nodeType==1&&!r.firstChild){let i=r.getBoundingClientRect();s=i.left!=i.right&&n.left>(i.left+i.right)/2?1:-1}return t.docView.posFromDOM(r,o,s)}function Qj(t,e,n,r){let o=-1;for(let s=e,i=!1;s!=t.dom;){let a=t.docView.nearestDesc(s,!0),l;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((l=a.dom.getBoundingClientRect()).width||l.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!i&&l.left>r.left||l.top>r.top?o=a.posBefore:(!i&&l.right<r.left||l.bottom<r.top)&&(o=a.posAfter),i=!0),!a.contentDOM&&o<0&&!a.node.isText))return(a.node.isBlock?r.top<(l.top+l.bottom)/2:r.left<(l.left+l.right)/2)?a.posBefore:a.posAfter;s=a.dom.parentNode}return o>-1?o:t.docView.posFromDOM(e,n,-1)}function v1(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),s=o;;){let i=t.childNodes[s];if(i.nodeType==1){let a=i.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(Ig(e,c))return v1(i,e,c)}}if((s=(s+1)%r)==o)break}return t}function Zj(t,e){let n=t.dom.ownerDocument,r,o=0,s=Hj(n,e.left,e.top);s&&({node:r,offset:o}=s);let i=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),a;if(!i||!t.dom.contains(i.nodeType!=1?i.parentNode:i)){let c=t.dom.getBoundingClientRect();if(!Ig(e,c)||(i=v1(t.dom,e,c),!i))return null}if(ln)for(let c=i;r&&c;c=Ri(c))c.draggable&&(r=void 0);if(i=Jj(i,e),r){if(Yn&&r.nodeType==1&&(o=Math.min(o,r.childNodes.length),o<r.childNodes.length)){let u=r.childNodes[o],d;u.nodeName=="IMG"&&(d=u.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&o++}let c;Ll&&o&&r.nodeType==1&&(c=r.childNodes[o-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&o--,r==t.dom&&o==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(o==0||r.nodeType!=1||r.childNodes[o-1].nodeName!="BR")&&(a=Qj(t,r,o,e))}a==null&&(a=Xj(t,i,e));let l=t.docView.nearestDesc(i,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function Jb(t){return t.top<t.bottom||t.left<t.right}function Oo(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(Jb(r))return r}return Array.prototype.find.call(n,Jb)||t.getBoundingClientRect()}const e2=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function b1(t,e,n){let{node:r,offset:o,atom:s}=t.docView.domFromPos(e,n<0?-1:1),i=Ll||Yn;if(r.nodeType==3)if(i&&(e2.test(r.nodeValue)||(n<0?!o:o==r.nodeValue.length))){let l=Oo(ro(r,o,o),n);if(Yn&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let c=Oo(ro(r,o-1,o-1),-1);if(c.top==l.top){let u=Oo(ro(r,o,o+1),-1);if(u.top!=l.top)return ua(u,u.left<c.left)}}return l}else{let l=o,c=o,u=n<0?1:-1;return n<0&&!o?(c++,u=-1):n>=0&&o==r.nodeValue.length?(l--,u=1):n<0?l--:c++,ua(Oo(ro(r,l,c),u),u<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&o&&(n<0||o==Gn(r))){let l=r.childNodes[o-1];if(l.nodeType==1)return ph(l.getBoundingClientRect(),!1)}if(s==null&&o<Gn(r)){let l=r.childNodes[o];if(l.nodeType==1)return ph(l.getBoundingClientRect(),!0)}return ph(r.getBoundingClientRect(),n>=0)}if(s==null&&o&&(n<0||o==Gn(r))){let l=r.childNodes[o-1],c=l.nodeType==3?ro(l,Gn(l)-(i?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return ua(Oo(c,1),!1)}if(s==null&&o<Gn(r)){let l=r.childNodes[o];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?ro(l,0,i?0:1):l.nodeType==1?l:null:null;if(c)return ua(Oo(c,-1),!0)}return ua(Oo(r.nodeType==3?ro(r):r,-n),n>=0)}function ua(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function ph(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function x1(t,e,n){let r=t.state,o=t.root.activeElement;r!=e&&t.updateState(e),o!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),o!=t.dom&&o&&o.focus()}}function t2(t,e,n){let r=e.selection,o=n=="up"?r.$from:r.$to;return x1(t,e,()=>{let{node:s}=t.docView.domFromPos(o.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(s,!0);if(!a)break;if(a.node.isBlock){s=a.contentDOM||a.dom;break}s=a.dom.parentNode}let i=b1(t,o.pos,1);for(let a=s.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=ro(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;c<l.length;c++){let u=l[c];if(u.bottom>u.top+1&&(n=="up"?i.top-u.top>(u.bottom-i.top)*2:u.bottom-i.bottom>(i.bottom-u.top)*2))return!1}}return!0})}const n2=/[\u0590-\u08ac]/;function r2(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,s=!o,i=o==r.parent.content.size,a=t.domSelection();return a?!n2.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?s:i:x1(t,e,()=>{let{focusNode:l,focusOffset:c,anchorNode:u,anchorOffset:d}=t.domSelectionRange(),f=a.caretBidiLevel;a.modify("move",n,"character");let h=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:p,focusOffset:m}=t.domSelectionRange(),y=p&&!h.contains(p.nodeType==1?p:p.parentNode)||l==p&&c==m;try{a.collapse(u,d),l&&(l!=u||c!=d)&&a.extend&&a.extend(l,c)}catch{}return f!=null&&(a.caretBidiLevel=f),y}):r.pos==r.start()||r.pos==r.end()}let Xb=null,Qb=null,Zb=!1;function o2(t,e,n){return Xb==e&&Qb==n?Zb:(Xb=e,Qb=n,Zb=n=="up"||n=="down"?t2(t,e,n):r2(t,e,n))}const Jn=0,e0=1,xs=2,Ur=3;class jl{constructor(e,n,r,o){this.parent=e,this.children=n,this.dom=r,this.contentDOM=o,this.dirty=Jn,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let o=this.children[n];if(o==e)return r;r+=o.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let s,i;if(e==this.contentDOM)s=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((i=s.pmViewDesc)&&i.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(i)+i.size:this.posAtStart}else{let s,i;if(e==this.contentDOM)s=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((i=s.pmViewDesc)&&i.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(i):this.posAtEnd}let o;if(e==this.dom&&this.contentDOM)o=n>Vt(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))o=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let s=e;;s=s.parentNode){if(s==this.dom){o=!1;break}if(s.previousSibling)break}if(o==null&&n==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){o=!0;break}if(s.nextSibling)break}}return o??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,o=e;o;o=o.parentNode){let s=this.getDesc(o),i;if(s&&(!n||s.node))if(r&&(i=s.nodeDOM)&&!(i.nodeType==1?i.contains(e.nodeType==1?e:e.parentNode):i==e))r=!1;else return s}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let o=e;o;o=o.parentNode){let s=this.getDesc(o);if(s)return s.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let o=this.children[n],s=r+o.size;if(r==e&&s!=r){for(;!o.border&&o.children.length;)for(let i=0;i<o.children.length;i++){let a=o.children[i];if(a.size){o=a;break}}return o}if(e<s)return o.descAt(e-r-o.border);r=s}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,o=0;for(let s=0;r<this.children.length;r++){let i=this.children[r],a=s+i.size;if(a>e||i instanceof E1){o=e-s;break}s=a}if(o)return this.children[r].domFromPos(o-this.children[r].border,n);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof w1&&s.side>=0;r--);if(n<=0){let s,i=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,i=!1);return s&&n&&i&&!s.border&&!s.domAtom?s.domFromPos(s.size,n):{node:this.contentDOM,offset:s?Vt(s.dom)+1:0}}else{let s,i=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,i=!1);return s&&i&&!s.border&&!s.domAtom?s.domFromPos(0,n):{node:this.contentDOM,offset:s?Vt(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let o=-1,s=-1;for(let i=r,a=0;;a++){let l=this.children[a],c=i+l.size;if(o==-1&&e<=c){let u=i+l.border;if(e>=u&&n<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,n,u);e=i;for(let d=a;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){o=Vt(f.dom)+1;break}e-=f.size}o==-1&&(o=0)}if(o>-1&&(c>n||a==this.children.length-1)){n=c;for(let u=a+1;u<this.children.length;u++){let d=this.children[u];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){s=Vt(d.dom);break}n+=d.size}s==-1&&(s=this.contentDOM.childNodes.length);break}i=c}return{node:this.contentDOM,from:e,to:n,fromOffset:o,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,o=!1){let s=Math.min(e,n),i=Math.max(e,n);for(let h=0,p=0;h<this.children.length;h++){let m=this.children[h],y=p+m.size;if(s>p&&i<y)return m.setSelection(e-p-m.border,n-p-m.border,r,o);p=y}let a=this.domFromPos(e,e?-1:1),l=n==e?a:this.domFromPos(n,n?-1:1),c=r.root.getSelection(),u=r.domSelectionRange(),d=!1;if((Yn||ln)&&e==n){let{node:h,offset:p}=a;if(h.nodeType==3){if(d=!!(p&&h.nodeValue[p-1]==`
|
|
114
|
+
`),d&&p==h.nodeValue.length)for(let m=h,y;m;m=m.parentNode){if(y=m.nextSibling){y.nodeName=="BR"&&(a=l={node:y.parentNode,offset:Vt(y)+1});break}let v=m.pmViewDesc;if(v&&v.node&&v.node.isBlock)break}}else{let m=h.childNodes[p-1];d=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(Yn&&u.focusNode&&u.focusNode!=l.node&&u.focusNode.nodeType==1){let h=u.focusNode.childNodes[u.focusOffset];h&&h.contentEditable=="false"&&(o=!0)}if(!(o||d&&ln)&&Ps(a.node,a.offset,u.anchorNode,u.anchorOffset)&&Ps(l.node,l.offset,u.focusNode,u.focusOffset))return;let f=!1;if((c.extend||e==n)&&!(d&&Yn)){c.collapse(a.node,a.offset);try{e!=n&&c.extend(l.node,l.offset),f=!0}catch{}}if(!f){if(e>n){let p=a;a=l,l=p}let h=document.createRange();h.setEnd(l.node,l.offset),h.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,o=0;o<this.children.length;o++){let s=this.children[o],i=r+s.size;if(r==i?e<=i&&n>=r:e<i&&n>r){let a=r+s.border,l=i-s.border;if(e>=a&&n<=l){this.dirty=e==r||n==i?xs:e0,e==a&&n==l&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=Ur:s.markDirty(e-a,n-a);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?xs:Ur}r=i}this.dirty=xs}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?xs:e0;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class w1 extends jl{constructor(e,n,r,o){let s,i=n.type.toDOM;if(typeof i=="function"&&(i=i(r,()=>{if(!s)return o;if(s.parent)return s.parent.posBeforeChild(s)})),!n.type.spec.raw){if(i.nodeType!=1){let a=document.createElement("span");a.appendChild(i),i=a}i.contentEditable="false",i.classList.add("ProseMirror-widget")}super(e,[],i,null),this.widget=n,this.widget=n,s=this}matchesWidget(e){return this.dirty==Jn&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class s2 extends jl{constructor(e,n,r,o){super(e,[],n,null),this.textDOM=r,this.text=o}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Ls extends jl{constructor(e,n,r,o,s){super(e,[],r,o),this.mark=n,this.spec=s}static create(e,n,r,o){let s=o.nodeViews[n.type.name],i=s&&s(n,o,r);return(!i||!i.dom)&&(i=Ks.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new Ls(e,n,i.dom,i.contentDOM||i.dom,i)}parseRule(){return this.dirty&Ur||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Ur&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Jn){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Jn}}slice(e,n,r){let o=Ls.create(this.parent,this.mark,!0,r),s=this.children,i=this.size;n<i&&(s=zp(s,n,i,r)),e>0&&(s=zp(s,0,e,r));for(let a=0;a<s.length;a++)s[a].parent=o;return o.children=s,o}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class qo extends jl{constructor(e,n,r,o,s,i,a,l,c){super(e,[],s,i),this.node=n,this.outerDeco=r,this.innerDeco=o,this.nodeDOM=a}static create(e,n,r,o,s,i){let a=s.nodeViews[n.type.name],l,c=a&&a(n,s,()=>{if(!l)return i;if(l.parent)return l.parent.posBeforeChild(l)},r,o),u=c&&c.dom,d=c&&c.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=Ks.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let f=u;return u=T1(u,r,n),c?l=new i2(e,n,r,o,u,d||null,f,c,s,i+1):n.isText?new Wd(e,n,r,o,u,f,s):new qo(e,n,r,o,u,d||null,f,s,i+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>F.empty)}return e}matchesNode(e,n,r){return this.dirty==Jn&&e.eq(this.node)&&vu(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,o=n,s=e.composing?this.localCompositionInfo(e,n):null,i=s&&s.pos>-1?s:null,a=s&&s.pos<0,l=new l2(this,i&&i.node,e);d2(this.node,this.innerDeco,(c,u,d)=>{c.spec.marks?l.syncToMarks(c.spec.marks,r,e):c.type.side>=0&&!d&&l.syncToMarks(u==this.node.childCount?Xe.none:this.node.child(u).marks,r,e),l.placeWidget(c,e,o)},(c,u,d,f)=>{l.syncToMarks(c.marks,r,e);let h;l.findNodeMatch(c,u,d,f)||a&&e.state.selection.from>o&&e.state.selection.to<o+c.nodeSize&&(h=l.findIndexWithChild(s.node))>-1&&l.updateNodeAt(c,u,d,h,e)||l.updateNextNode(c,u,d,e,f,o)||l.addNode(c,u,d,e,o),o+=c.nodeSize}),l.syncToMarks([],r,e),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==xs)&&(i&&this.protectLocalComposition(e,i),S1(this.contentDOM,this.children,e),Ni&&f2(this.dom))}localCompositionInfo(e,n){let{from:r,to:o}=e.state.selection;if(!(e.state.selection instanceof pe)||r<n||o>n+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let i=s.nodeValue,a=h2(this.node.content,i,r-n,o-n);return a<0?null:{node:s,pos:a,text:i}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:o}){if(this.getDesc(n))return;let s=n;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let i=new s2(this,s,n,o);e.input.compositionNodes.push(i),this.children=zp(this.children,r,r+o.length,e,i)}update(e,n,r,o){return this.dirty==Ur||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,o),!0)}updateInner(e,n,r,o){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=Jn}updateOuterDeco(e){if(vu(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=k1(this.dom,this.nodeDOM,Up(this.outerDeco,this.node,n),Up(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function t0(t,e,n,r,o){T1(r,e,t);let s=new qo(void 0,t,e,n,r,r,r,o,0);return s.contentDOM&&s.updateChildren(o,0),s}class Wd extends qo{constructor(e,n,r,o,s,i,a){super(e,n,r,o,s,null,i,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,o){return this.dirty==Ur||this.dirty!=Jn&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Jn||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,o.trackWrites==this.nodeDOM&&(o.trackWrites=null)),this.node=e,this.dirty=Jn,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let o=this.node.cut(e,n),s=document.createTextNode(o.text);return new Wd(this.parent,o,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Ur)}get domAtom(){return!1}isText(e){return this.node.text==e}}class E1 extends jl{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Jn&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class i2 extends qo{constructor(e,n,r,o,s,i,a,l,c,u){super(e,n,r,o,s,i,a,c,u),this.spec=l}update(e,n,r,o){if(this.dirty==Ur)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,n,r);return s&&this.updateInner(e,n,r,o),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,o)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,o){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,o)}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 S1(t,e,n){let r=t.firstChild,o=!1;for(let s=0;s<e.length;s++){let i=e[s],a=i.dom;if(a.parentNode==t){for(;a!=r;)r=n0(r),o=!0;r=r.nextSibling}else o=!0,t.insertBefore(a,r);if(i instanceof Ls){let l=r?r.previousSibling:t.lastChild;S1(i.contentDOM,i.children,n),r=l?l.nextSibling:t.firstChild}}for(;r;)r=n0(r),o=!0;o&&n.trackWrites==t&&(n.trackWrites=null)}const Na=function(t){t&&(this.nodeName=t)};Na.prototype=Object.create(null);const ws=[new Na];function Up(t,e,n){if(t.length==0)return ws;let r=n?ws[0]:new Na,o=[r];for(let s=0;s<t.length;s++){let i=t[s].type.attrs;if(i){i.nodeName&&o.push(r=new Na(i.nodeName));for(let a in i){let l=i[a];l!=null&&(n&&o.length==1&&o.push(r=new Na(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+l:a=="style"?r.style=(r.style?r.style+";":"")+l:a!="nodeName"&&(r[a]=l))}}}return o}function k1(t,e,n,r){if(n==ws&&r==ws)return e;let o=e;for(let s=0;s<r.length;s++){let i=r[s],a=n[s];if(s){let l;a&&a.nodeName==i.nodeName&&o!=t&&(l=o.parentNode)&&l.nodeName.toLowerCase()==i.nodeName||(l=document.createElement(i.nodeName),l.pmIsDeco=!0,l.appendChild(o),a=ws[0]),o=l}a2(o,a||ws[0],i)}return o}function a2(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],o=n.class?n.class.split(" ").filter(Boolean):[];for(let s=0;s<r.length;s++)o.indexOf(r[s])==-1&&t.classList.remove(r[s]);for(let s=0;s<o.length;s++)r.indexOf(o[s])==-1&&t.classList.add(o[s]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,o;for(;o=r.exec(e.style);)t.style.removeProperty(o[1])}n.style&&(t.style.cssText+=n.style)}}function T1(t,e,n){return k1(t,t,ws,Up(e,n,t.nodeType!=1))}function vu(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function n0(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class l2{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=c2(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r){let o=0,s=this.stack.length>>1,i=Math.min(s,e.length);for(;o<i&&(o==s-1?this.top:this.stack[o+1<<1]).matchesMark(e[o])&&e[o].type.spec.spanning!==!1;)o++;for(;o<s;)this.destroyRest(),this.top.dirty=Jn,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let a=-1;for(let l=this.index;l<Math.min(this.index+3,this.top.children.length);l++){let c=this.top.children[l];if(c.matchesMark(e[s])&&!this.isLocked(c.dom)){a=l;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let l=Ls.create(this.top,e[s],n,r);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,s++}}findNodeMatch(e,n,r,o){let s=-1,i;if(o>=this.preMatch.index&&(i=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&i.matchesNode(e,n,r))s=this.top.children.indexOf(i,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let c=this.top.children[a];if(c.matchesNode(e,n,r)&&!this.preMatch.matched.has(c)){s=a;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,n,r,o,s){let i=this.top.children[o];return i.dirty==Ur&&i.dom==i.contentDOM&&(i.dirty=xs),i.update(e,n,r,s)?(this.destroyBetween(this.index,o),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let o=this.index;o<this.top.children.length;o++)if(this.top.children[o]==r)return o}return-1}e=n}}updateNextNode(e,n,r,o,s,i){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof qo){let c=this.preMatch.matched.get(l);if(c!=null&&c!=s)return!1;let u=l.dom,d,f=this.isLocked(u)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=Ur&&vu(n,l.outerDeco));if(!f&&l.update(e,n,r,o))return this.destroyBetween(this.index,a),l.dom!=u&&(this.changed=!0),this.index++,!0;if(!f&&(d=this.recreateWrapper(l,e,n,r,o,i)))return this.destroyBetween(this.index,a),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=xs,d.updateChildren(o,i+1),d.dirty=Jn),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,o,s,i){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!vu(r,e.outerDeco)||!o.eq(e.innerDeco))return null;let a=qo.create(this.top,n,r,o,s,i);if(a.contentDOM){a.children=e.children,e.children=[];for(let l of a.children)l.parent=a}return e.destroy(),a}addNode(e,n,r,o,s){let i=qo.create(this.top,e,n,r,o,s);i.contentDOM&&i.updateChildren(o,s+1),this.top.children.splice(this.index++,0,i),this.changed=!0}placeWidget(e,n,r){let o=this.index<this.top.children.length?this.top.children[this.index]:null;if(o&&o.matchesWidget(e)&&(e==o.widget||!o.widget.type.toDOM.parentNode))this.index++;else{let s=new w1(this.top,e,n,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof Ls;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Wd)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((ln||Xt)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let o=new E1(this.top,[],r,null);n!=this.top?n.children.push(o):n.children.splice(this.index++,0,o),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function c2(t,e){let n=e,r=n.children.length,o=t.childCount,s=new Map,i=[];e:for(;o>0;){let a;for(;;)if(r){let c=n.children[r-1];if(c instanceof Ls)n=c,r=c.children.length;else{a=c,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=t.child(o-1))break;--o,s.set(a,o),i.push(a)}}return{index:o,matched:s,matches:i.reverse()}}function u2(t,e){return t.type.side-e.type.side}function d2(t,e,n,r){let o=e.locals(t),s=0;if(o.length==0){for(let c=0;c<t.childCount;c++){let u=t.child(c);r(u,o,e.forChild(s,u),c),s+=u.nodeSize}return}let i=0,a=[],l=null;for(let c=0;;){let u,d;for(;i<o.length&&o[i].to==s;){let y=o[i++];y.widget&&(u?(d||(d=[u])).push(y):u=y)}if(u)if(d){d.sort(u2);for(let y=0;y<d.length;y++)n(d[y],c,!!l)}else n(u,c,!!l);let f,h;if(l)h=-1,f=l,l=null;else if(c<t.childCount)h=c,f=t.child(c++);else break;for(let y=0;y<a.length;y++)a[y].to<=s&&a.splice(y--,1);for(;i<o.length&&o[i].from<=s&&o[i].to>s;)a.push(o[i++]);let p=s+f.nodeSize;if(f.isText){let y=p;i<o.length&&o[i].from<y&&(y=o[i].from);for(let v=0;v<a.length;v++)a[v].to<y&&(y=a[v].to);y<p&&(l=f.cut(y-s),f=f.cut(0,y-s),p=y,h=-1)}else for(;i<o.length&&o[i].to<p;)i++;let m=f.isInline&&!f.isLeaf?a.filter(y=>!y.inline):a.slice();r(f,m,e.forChild(s,f),h),s=p}}function f2(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function h2(t,e,n,r){for(let o=0,s=0;o<t.childCount&&s<=r;){let i=t.child(o++),a=s;if(s+=i.nodeSize,!i.isText)continue;let l=i.text;for(;o<t.childCount;){let c=t.child(o++);if(s+=c.nodeSize,!c.isText)break;l+=c.text}if(s>=n){if(s>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let c=a<r?l.lastIndexOf(e,r-a-1):-1;if(c>=0&&c+e.length+a>=n)return a+c;if(n==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}function zp(t,e,n,r,o){let s=[];for(let i=0,a=0;i<t.length;i++){let l=t[i],c=a,u=a+=l.size;c>=n||u<=e?s.push(l):(c<e&&s.push(l.slice(0,e-c,r)),o&&(s.push(o),o=void 0),u>n&&s.push(l.slice(n-c,l.size,r)))}return s}function Pg(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let o=t.docView.nearestDesc(n.focusNode),s=o&&o.size==0,i=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(i<0)return null;let a=r.resolve(i),l,c;if(Vd(n)){for(l=i;o&&!o.node;)o=o.parent;let d=o.node;if(o&&d.isAtom&&ue.isSelectable(d)&&o.parent&&!(d.isInline&&Bj(n.focusNode,n.focusOffset,o.dom))){let f=o.posBefore;c=new ue(i==f?a:r.resolve(f))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=i,f=i;for(let h=0;h<n.rangeCount;h++){let p=n.getRangeAt(h);d=Math.min(d,t.docView.posFromDOM(p.startContainer,p.startOffset,1)),f=Math.max(f,t.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(d<0)return null;[l,i]=f==t.state.selection.anchor?[f,d]:[d,f],a=r.resolve(i)}else l=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}let u=r.resolve(l);if(!c){let d=e=="pointer"||t.state.selection.head<a.pos&&!s?1:-1;c=Lg(t,u,a,d)}return c}function C1(t){return t.editable?t.hasFocus():M1(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function lo(t,e=!1){let n=t.state.selection;if(A1(t,n),!!C1(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Xt){let r=t.domSelectionRange(),o=t.domObserver.currentSelection;if(r.anchorNode&&o.anchorNode&&Ps(r.anchorNode,r.anchorOffset,o.anchorNode,o.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)m2(t);else{let{anchor:r,head:o}=n,s,i;r0&&!(n instanceof pe)&&(n.$from.parent.inlineContent||(s=o0(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(i=o0(t,n.to))),t.docView.setSelection(r,o,t,e),r0&&(s&&s0(s),i&&s0(i)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&p2(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const r0=ln||Xt&&p1<63;function o0(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),o=r<n.childNodes.length?n.childNodes[r]:null,s=r?n.childNodes[r-1]:null;if(ln&&o&&o.contentEditable=="false")return mh(o);if((!o||o.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(o)return mh(o);if(s)return mh(s)}}function mh(t){return t.contentEditable="true",ln&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function s0(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function p2(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=o)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!C1(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function m2(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Vt(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&kn&&Go<=11&&(n.disabled=!0,n.disabled=!1)}function A1(t,e){if(e instanceof ue){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(i0(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else i0(t)}function i0(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Lg(t,e,n,r){return t.someProp("createSelectionBetween",o=>o(t,e,n))||pe.between(e,n,r)}function a0(t){return t.editable&&!t.hasFocus()?!1:M1(t)}function M1(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function g2(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Ps(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Vp(t,e){let{$anchor:n,$head:r}=t.selection,o=e>0?n.max(r):n.min(r),s=o.parent.inlineContent?o.depth?t.doc.resolve(e>0?o.after():o.before()):null:o;return s&&Oe.findFrom(s,e)}function Do(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function l0(t,e,n){let r=t.state.selection;if(r instanceof pe)if(n.indexOf("s")>-1){let{$head:o}=r,s=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let i=t.state.doc.resolve(o.pos+s.nodeSize*(e<0?-1:1));return Do(t,new pe(r.$anchor,i))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let o=Vp(t.state,e);return o&&o instanceof ue?Do(t,o):!1}else if(!(Wn&&n.indexOf("m")>-1)){let o=r.$head,s=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter,i;if(!s||s.isText)return!1;let a=e<0?o.pos-s.nodeSize:o.pos;return s.isAtom||(i=t.docView.descAt(a))&&!i.contentDOM?ue.isSelectable(s)?Do(t,new ue(e<0?t.state.doc.resolve(o.pos-s.nodeSize):o)):Ll?Do(t,new pe(t.state.doc.resolve(e<0?a:a+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof ue&&r.node.isInline)return Do(t,new pe(e>0?r.$to:r.$from));{let o=Vp(t.state,e);return o?Do(t,o):!1}}}function bu(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function _a(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function ii(t,e){return e<0?y2(t):v2(t)}function y2(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o,s,i=!1;for(Yn&&n.nodeType==1&&r<bu(n)&&_a(n.childNodes[r],-1)&&(i=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(_a(a,-1))o=n,s=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(O1(n))break;{let a=n.previousSibling;for(;a&&_a(a,-1);)o=n.parentNode,s=Vt(a),a=a.previousSibling;if(a)n=a,r=bu(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}i?Wp(t,n,r):o&&Wp(t,o,s)}function v2(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o=bu(n),s,i;for(;;)if(r<o){if(n.nodeType!=1)break;let a=n.childNodes[r];if(_a(a,1))s=n,i=++r;else break}else{if(O1(n))break;{let a=n.nextSibling;for(;a&&_a(a,1);)s=a.parentNode,i=Vt(a)+1,a=a.nextSibling;if(a)n=a,r=0,o=bu(n);else{if(n=n.parentNode,n==t.dom)break;r=o=0}}}s&&Wp(t,s,i)}function O1(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function b2(t,e){for(;t&&e==t.childNodes.length&&!Pl(t);)e=Vt(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function x2(t,e){for(;t&&!e&&!Pl(t);)e=Vt(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function Wp(t,e,n){if(e.nodeType!=3){let s,i;(i=b2(e,n))?(e=i,n=0):(s=x2(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(Vd(r)){let s=document.createRange();s.setEnd(e,n),s.setStart(e,n),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:o}=t;setTimeout(()=>{t.state==o&&lo(t)},50)}function c0(t,e){let n=t.state.doc.resolve(e);if(!(Xt||Uj)&&n.parent.inlineContent){let o=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),i=(s.top+s.bottom)/2;if(i>o.top&&i<o.bottom&&Math.abs(s.left-o.left)>1)return s.left<o.left?"ltr":"rtl"}if(e<n.end()){let s=t.coordsAtPos(e+1),i=(s.top+s.bottom)/2;if(i>o.top&&i<o.bottom&&Math.abs(s.left-o.left)>1)return s.left>o.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function u0(t,e,n){let r=t.state.selection;if(r instanceof pe&&!r.empty||n.indexOf("s")>-1||Wn&&n.indexOf("m")>-1)return!1;let{$from:o,$to:s}=r;if(!o.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let i=Vp(t.state,e);if(i&&i instanceof ue)return Do(t,i)}if(!o.parent.inlineContent){let i=e<0?o:s,a=r instanceof Sn?Oe.near(i,e):Oe.findFrom(i,e);return a?Do(t,a):!1}return!1}function d0(t,e){if(!(t.state.selection instanceof pe))return!0;let{$head:n,$anchor:r,empty:o}=t.state.selection;if(!n.sameParent(r))return!0;if(!o)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let i=t.state.tr;return e<0?i.delete(n.pos-s.nodeSize,n.pos):i.delete(n.pos,n.pos+s.nodeSize),t.dispatch(i),!0}return!1}function f0(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function w2(t){if(!ln||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;f0(t,r,"true"),setTimeout(()=>f0(t,r,"false"),20)}return!1}function E2(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function S2(t,e){let n=e.keyCode,r=E2(e);if(n==8||Wn&&n==72&&r=="c")return d0(t,-1)||ii(t,-1);if(n==46&&!e.shiftKey||Wn&&n==68&&r=="c")return d0(t,1)||ii(t,1);if(n==13||n==27)return!0;if(n==37||Wn&&n==66&&r=="c"){let o=n==37?c0(t,t.state.selection.from)=="ltr"?-1:1:-1;return l0(t,o,r)||ii(t,o)}else if(n==39||Wn&&n==70&&r=="c"){let o=n==39?c0(t,t.state.selection.from)=="ltr"?1:-1:1;return l0(t,o,r)||ii(t,o)}else{if(n==38||Wn&&n==80&&r=="c")return u0(t,-1,r)||ii(t,-1);if(n==40||Wn&&n==78&&r=="c")return w2(t)||u0(t,1,r)||ii(t,1);if(r==(Wn?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function jg(t,e){t.someProp("transformCopied",h=>{e=h(e,t)});let n=[],{content:r,openStart:o,openEnd:s}=e;for(;o>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){o--,s--;let h=r.firstChild;n.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let i=t.someProp("clipboardSerializer")||Ks.fromSchema(t.state.schema),a=P1(),l=a.createElement("div");l.appendChild(i.serializeFragment(r,{document:a}));let c=l.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=I1[c.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let p=a.createElement(u[h]);for(;l.firstChild;)p.appendChild(l.firstChild);l.appendChild(p),d++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${o} ${s}${d?` -${d}`:""} ${JSON.stringify(n)}`);let f=t.someProp("clipboardTextSerializer",h=>h(e,t))||e.content.textBetween(0,e.content.size,`
|
|
115
|
+
|
|
116
|
+
`);return{dom:l,text:f,slice:e}}function R1(t,e,n,r,o){let s=o.parent.type.spec.code,i,a;if(!n&&!e)return null;let l=!!e&&(r||s||!n);if(l){if(t.someProp("transformPastedText",f=>{e=f(e,s||r,t)}),s)return a=new ee(F.from(t.state.schema.text(e.replace(/\r\n?/g,`
|
|
117
|
+
`))),0,0),t.someProp("transformPasted",f=>{a=f(a,t,!0)}),a;let d=t.someProp("clipboardTextParser",f=>f(e,o,r,t));if(d)a=d;else{let f=o.marks(),{schema:h}=t.state,p=Ks.fromSchema(h);i=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let y=i.appendChild(document.createElement("p"));m&&y.appendChild(p.serializeNode(h.text(m,f)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),i=A2(n),Ll&&M2(i);let c=i&&i.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let f=i.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;i=f}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||Oa.fromSchema(t.state.schema)).parseSlice(i,{preserveWhitespace:!!(l||u),context:o,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!k2.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)a=O2(h0(a,+u[1],+u[2]),u[4]);else if(a=ee.maxOpen(T2(a.content,o),!0),a.openStart||a.openEnd){let d=0,f=0;for(let h=a.content.firstChild;d<a.openStart&&!h.type.spec.isolating;d++,h=h.firstChild);for(let h=a.content.lastChild;f<a.openEnd&&!h.type.spec.isolating;f++,h=h.lastChild);a=h0(a,d,f)}return t.someProp("transformPasted",d=>{a=d(a,t,l)}),a}const k2=/^(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 T2(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let o=e.node(n).contentMatchAt(e.index(n)),s,i=[];if(t.forEach(a=>{if(!i)return;let l=o.findWrapping(a.type),c;if(!l)return i=null;if(c=i.length&&s.length&&_1(l,s,a,i[i.length-1],0))i[i.length-1]=c;else{i.length&&(i[i.length-1]=D1(i[i.length-1],s.length));let u=N1(a,l);i.push(u),o=o.matchType(u.type),s=l}}),i)return F.from(i)}return t}function N1(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,F.from(t));return t}function _1(t,e,n,r,o){if(o<t.length&&o<e.length&&t[o]==e[o]){let s=_1(t,e,n,r.lastChild,o+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(o==t.length-1?n.type:t[o+1]))return r.copy(r.content.append(F.from(N1(n,t,o+1))))}}function D1(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,D1(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(F.empty,!0);return t.copy(n.append(r))}function Gp(t,e,n,r,o,s){let i=e<0?t.firstChild:t.lastChild,a=i.content;return t.childCount>1&&(s=0),o<r-1&&(a=Gp(a,e,n,r,o+1,s)),o>=n&&(a=e<0?i.contentMatchAt(0).fillBefore(a,s<=o).append(a):a.append(i.contentMatchAt(i.childCount).fillBefore(F.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,i.copy(a))}function h0(t,e,n){return e<t.openStart&&(t=new ee(Gp(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new ee(Gp(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const I1={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 p0=null;function P1(){return p0||(p0=document.implementation.createHTMLDocument("title"))}let gh=null;function C2(t){let e=window.trustedTypes;return e?(gh||(gh=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),gh.createHTML(t)):t}function A2(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=P1().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),o;if((o=r&&I1[r[1].toLowerCase()])&&(t=o.map(s=>"<"+s+">").join("")+t+o.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=C2(t),o)for(let s=0;s<o.length;s++)n=n.querySelector(o[s])||n;return n}function M2(t){let e=t.querySelectorAll(Xt?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function O2(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:o,openStart:s,openEnd:i}=t;for(let a=r.length-2;a>=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;o=F.from(l.create(r[a+1],o)),s++,i++}return new ee(o,s,i)}const cn={},un={},R2={touchstart:!0,touchmove:!0};class N2{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.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function _2(t){for(let e in cn){let n=cn[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{I2(t,r)&&!$g(t,r)&&(t.editable||!(r.type in un))&&n(t,r)},R2[e]?{passive:!0}:void 0)}ln&&t.dom.addEventListener("input",()=>null),qp(t)}function Ho(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function D2(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function qp(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>$g(t,r))})}function $g(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function I2(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function P2(t,e){!$g(t,e)&&cn[e.type]&&(t.editable||!(e.type in un))&&cn[e.type](t,e)}un.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!j1(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(so&&Xt&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Ni&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",o=>o(t,gs(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||S2(t,n)?n.preventDefault():Ho(t,"key")};un.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};un.keypress=(t,e)=>{let n=e;if(j1(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Wn&&n.metaKey)return;if(t.someProp("handleKeyPress",o=>o(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof pe)||!r.$from.sameParent(r.$to)){let o=String.fromCharCode(n.charCode),s=()=>t.state.tr.insertText(o).scrollIntoView();!/[\r\n]/.test(o)&&!t.someProp("handleTextInput",i=>i(t,r.$from.pos,r.$to.pos,o,s))&&t.dispatch(s()),n.preventDefault()}};function Gd(t){return{left:t.clientX,top:t.clientY}}function L2(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Bg(t,e,n,r,o){if(r==-1)return!1;let s=t.state.doc.resolve(r);for(let i=s.depth+1;i>0;i--)if(t.someProp(e,a=>i>s.depth?a(t,n,s.nodeAfter,s.before(i),o,!0):a(t,n,s.node(i),s.before(i),o,!1)))return!0;return!1}function bi(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function j2(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&ue.isSelectable(r)?(bi(t,new ue(n)),!0):!1}function $2(t,e){if(e==-1)return!1;let n=t.state.selection,r,o;n instanceof ue&&(r=n.node);let s=t.state.doc.resolve(e);for(let i=s.depth+1;i>0;i--){let a=i>s.depth?s.nodeAfter:s.node(i);if(ue.isSelectable(a)){r&&n.$from.depth>0&&i>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?o=s.before(n.$from.depth):o=s.before(i);break}}return o!=null?(bi(t,ue.create(t.state.doc,o)),!0):!1}function B2(t,e,n,r,o){return Bg(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(o?$2(t,n):j2(t,n))}function F2(t,e,n,r){return Bg(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",o=>o(t,e,r))}function H2(t,e,n,r){return Bg(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",o=>o(t,e,r))||U2(t,n,r)}function U2(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(bi(t,pe.create(r,0,r.content.size)),!0):!1;let o=r.resolve(e);for(let s=o.depth+1;s>0;s--){let i=s>o.depth?o.nodeAfter:o.node(s),a=o.before(s);if(i.inlineContent)bi(t,pe.create(r,a+1,a+1+i.content.size));else if(ue.isSelectable(i))bi(t,ue.create(r,a));else continue;return!0}}function Fg(t){return xu(t)}const L1=Wn?"metaKey":"ctrlKey";cn.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Fg(t),o=Date.now(),s="singleClick";o-t.input.lastClick.time<500&&L2(n,t.input.lastClick)&&!n[L1]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:s,button:n.button};let i=t.posAtCoords(Gd(n));i&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new z2(t,i,n,!!r)):(s=="doubleClick"?F2:H2)(t,i.pos,i.inside,n)?n.preventDefault():Ho(t,"pointer"))};class z2{constructor(e,n,r,o){this.view=e,this.pos=n,this.event=r,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[L1],this.allowDefault=r.shiftKey;let s,i;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),i=n.inside;else{let u=e.state.doc.resolve(n.pos);s=u.parent,i=u.depth?u.before():0}const a=o?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:c}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof ue&&c.from<=i&&c.to>i)&&(this.mightDrag={node:s,pos:i,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Yn&&!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)),Ho(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(()=>lo(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Gd(e))),this.updateAllowDefault(e),this.allowDefault||!n?Ho(this.view,"pointer"):B2(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||ln&&this.mightDrag&&!this.mightDrag.node.isAtom||Xt&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(bi(this.view,Oe.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Ho(this.view,"pointer")}move(e){this.updateAllowDefault(e),Ho(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)}}cn.touchstart=t=>{t.input.lastTouch=Date.now(),Fg(t),Ho(t,"pointer")};cn.touchmove=t=>{t.input.lastTouch=Date.now(),Ho(t,"pointer")};cn.contextmenu=t=>Fg(t);function j1(t,e){return t.composing?!0:ln&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const V2=so?5e3:-1;un.compositionstart=un.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof pe&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||n.marks(),xu(t,!0),t.markCursor=null;else if(xu(t,!e.selection.empty),Yn&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let o=r.focusNode,s=r.focusOffset;o&&o.nodeType==1&&s!=0;){let i=s<0?o.lastChild:o.childNodes[s-1];if(!i)break;if(i.nodeType==3){let a=t.domSelection();a&&a.collapse(i,i.nodeValue.length);break}else o=i,s=-1}}t.input.composing=!0}$1(t,V2)};un.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,$1(t,20))};function $1(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>xu(t),e))}function B1(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=G2());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function W2(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=jj(e.focusNode,e.focusOffset),r=$j(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let o=r.pmViewDesc,s=t.domObserver.lastChangedTextNode;if(n==s||r==s)return s;if(!o||!o.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let i=n.pmViewDesc;if(!(!i||!i.isText(n.nodeValue)))return r}}return n||r}function G2(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function xu(t,e=!1){if(!(so&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),B1(t),e||t.docView&&t.docView.dirty){let n=Pg(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function q2(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Ja=kn&&Go<15||Ni&&zj<604;cn.copy=un.cut=(t,e)=>{let n=e,r=t.state.selection,o=n.type=="cut";if(r.empty)return;let s=Ja?null:n.clipboardData,i=r.content(),{dom:a,text:l}=jg(t,i);s?(n.preventDefault(),s.clearData(),s.setData("text/html",a.innerHTML),s.setData("text/plain",l)):q2(t,a),o&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function K2(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function Y2(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let o=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Xa(t,r.value,null,o,e):Xa(t,r.textContent,r.innerHTML,o,e)},50)}function Xa(t,e,n,r,o){let s=R1(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,o,s||ee.empty)))return!0;if(!s)return!1;let i=K2(s),a=i?t.state.tr.replaceSelectionWith(i,r):t.state.tr.replaceSelection(s);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function F1(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}un.paste=(t,e)=>{let n=e;if(t.composing&&!so)return;let r=Ja?null:n.clipboardData,o=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Xa(t,F1(r),r.getData("text/html"),o,n)?n.preventDefault():Y2(t,n)};class H1{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const J2=Wn?"altKey":"ctrlKey";function U1(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[J2]}cn.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let o=t.state.selection,s=o.empty?null:t.posAtCoords(Gd(n)),i;if(!(s&&s.pos>=o.from&&s.pos<=(o instanceof ue?o.to-1:o.to))){if(r&&r.mightDrag)i=ue.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(i=ue.create(t.state.doc,d.posBefore))}}let a=(i||t.state.selection).content(),{dom:l,text:c,slice:u}=jg(t,a);(!n.dataTransfer.files.length||!Xt||p1>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Ja?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",Ja||n.dataTransfer.setData("text/plain",c),t.dragging=new H1(u,U1(t,n),i)};cn.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};un.dragover=un.dragenter=(t,e)=>e.preventDefault();un.drop=(t,e)=>{let n=e,r=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let o=t.posAtCoords(Gd(n));if(!o)return;let s=t.state.doc.resolve(o.pos),i=r&&r.slice;i?t.someProp("transformPasted",p=>{i=p(i,t,!1)}):i=R1(t,F1(n.dataTransfer),Ja?null:n.dataTransfer.getData("text/html"),!1,s);let a=!!(r&&U1(t,n));if(t.someProp("handleDrop",p=>p(t,n,i||ee.empty,a))){n.preventDefault();return}if(!i)return;n.preventDefault();let l=i?Gk(t.state.doc,s.pos,i):s.pos;l==null&&(l=s.pos);let c=t.state.tr;if(a){let{node:p}=r;p?p.replace(c):c.deleteSelection()}let u=c.mapping.map(l),d=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,f=c.doc;if(d?c.replaceRangeWith(u,u,i.content.firstChild):c.replaceRange(u,u,i),c.doc.eq(f))return;let h=c.doc.resolve(u);if(d&&ue.isSelectable(i.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(i.content.firstChild))c.setSelection(new ue(h));else{let p=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((m,y,v,w)=>p=w),c.setSelection(Lg(t,h,c.doc.resolve(p)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))};cn.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&lo(t)},20))};cn.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};cn.beforeinput=(t,e)=>{if(Xt&&so&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",s=>s(t,gs(8,"Backspace")))))return;let{$cursor:o}=t.state.selection;o&&o.pos>0&&t.dispatch(t.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let t in un)cn[t]=un[t];function Qa(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class wu{constructor(e,n){this.toDOM=e,this.spec=n||As,this.side=this.spec.side||0}map(e,n,r,o){let{pos:s,deleted:i}=e.mapResult(n.from+o,this.side<0?-1:1);return i?null:new Gt(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof wu&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Qa(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Ko{constructor(e,n){this.attrs=e,this.spec=n||As}map(e,n,r,o){let s=e.map(n.from+o,this.spec.inclusiveStart?-1:1)-r,i=e.map(n.to+o,this.spec.inclusiveEnd?1:-1)-r;return s>=i?null:new Gt(s,i,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof Ko&&Qa(this.attrs,e.attrs)&&Qa(this.spec,e.spec)}static is(e){return e.type instanceof Ko}destroy(){}}class Hg{constructor(e,n){this.attrs=e,this.spec=n||As}map(e,n,r,o){let s=e.mapResult(n.from+o,1);if(s.deleted)return null;let i=e.mapResult(n.to+o,-1);return i.deleted||i.pos<=s.pos?null:new Gt(s.pos-r,i.pos-r,this)}valid(e,n){let{index:r,offset:o}=e.content.findIndex(n.from),s;return o==n.from&&!(s=e.child(r)).isText&&o+s.nodeSize==n.to}eq(e){return this==e||e instanceof Hg&&Qa(this.attrs,e.attrs)&&Qa(this.spec,e.spec)}destroy(){}}class Gt{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new Gt(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new Gt(e,e,new wu(n,r))}static inline(e,n,r,o){return new Gt(e,n,new Ko(r,o))}static node(e,n,r,o){return new Gt(e,n,new Hg(r,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof Ko}get widget(){return this.type instanceof wu}}const hi=[],As={};class et{constructor(e,n){this.local=e.length?e:hi,this.children=n.length?n:hi}static create(e,n){return n.length?Eu(n,e,0,As):Yt}find(e,n,r){let o=[];return this.findInner(e??0,n??1e9,o,0,r),o}findInner(e,n,r,o,s){for(let i=0;i<this.local.length;i++){let a=this.local[i];a.from<=n&&a.to>=e&&(!s||s(a.spec))&&r.push(a.copy(a.from+o,a.to+o))}for(let i=0;i<this.children.length;i+=3)if(this.children[i]<n&&this.children[i+1]>e){let a=this.children[i]+1;this.children[i+2].findInner(e-a,n-a,r,o+a,s)}}map(e,n,r){return this==Yt||e.maps.length==0?this:this.mapInner(e,n,0,0,r||As)}mapInner(e,n,r,o,s){let i;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,r,o);l&&l.type.valid(n,l)?(i||(i=[])).push(l):s.onRemove&&s.onRemove(this.local[a].spec)}return this.children.length?X2(this.children,i||[],e,n,r,o,s):i?new et(i.sort(Ms),hi):Yt}add(e,n){return n.length?this==Yt?et.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let o,s=0;e.forEach((a,l)=>{let c=l+r,u;if(u=V1(n,a,c)){for(o||(o=this.children.slice());s<o.length&&o[s]<l;)s+=3;o[s]==l?o[s+2]=o[s+2].addInner(a,u,c+1):o.splice(s,0,l,l+a.nodeSize,Eu(u,a,c+1,As)),s+=3}});let i=z1(s?W1(n):n,-r);for(let a=0;a<i.length;a++)i[a].type.valid(e,i[a])||i.splice(a--,1);return new et(i.length?this.local.concat(i).sort(Ms):this.local,o||this.children)}remove(e){return e.length==0||this==Yt?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,o=this.local;for(let s=0;s<r.length;s+=3){let i,a=r[s]+n,l=r[s+1]+n;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>a&&d.to<l&&(e[u]=null,(i||(i=[])).push(d));if(!i)continue;r==this.children&&(r=this.children.slice());let c=r[s+2].removeInner(i,a+1);c!=Yt?r[s+2]=c:(r.splice(s,3),s-=3)}if(o.length){for(let s=0,i;s<e.length;s++)if(i=e[s])for(let a=0;a<o.length;a++)o[a].eq(i,n)&&(o==this.local&&(o=this.local.slice()),o.splice(a--,1))}return r==this.children&&o==this.local?this:o.length||r.length?new et(o,r):Yt}forChild(e,n){if(this==Yt)return this;if(n.isLeaf)return et.empty;let r,o;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,i=s+n.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<i&&l.to>s&&l.type instanceof Ko){let c=Math.max(s,l.from)-s,u=Math.min(i,l.to)-s;c<u&&(o||(o=[])).push(l.copy(c,u))}}if(o){let a=new et(o.sort(Ms),hi);return r?new Lo([a,r]):a}return r||Yt}eq(e){if(this==e)return!0;if(!(e instanceof et)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return Ug(this.localsInner(e))}localsInner(e){if(this==Yt)return hi;if(e.inlineContent||!this.local.some(Ko.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Ko||n.push(this.local[r]);return n}forEachSet(e){e(this)}}et.empty=new et([],[]);et.removeOverlap=Ug;const Yt=et.empty;class Lo{constructor(e){this.members=e}map(e,n){const r=this.members.map(o=>o.map(e,n,As));return Lo.from(r)}forChild(e,n){if(n.isLeaf)return et.empty;let r=[];for(let o=0;o<this.members.length;o++){let s=this.members[o].forChild(e,n);s!=Yt&&(s instanceof Lo?r=r.concat(s.members):r.push(s))}return Lo.from(r)}eq(e){if(!(e instanceof Lo)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let o=0;o<this.members.length;o++){let s=this.members[o].localsInner(e);if(s.length)if(!n)n=s;else{r&&(n=n.slice(),r=!1);for(let i=0;i<s.length;i++)n.push(s[i])}}return n?Ug(r?n:n.sort(Ms)):hi}static from(e){switch(e.length){case 0:return Yt;case 1:return e[0];default:return new Lo(e.every(n=>n instanceof et)?e:e.reduce((n,r)=>n.concat(r instanceof et?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function X2(t,e,n,r,o,s,i){let a=t.slice();for(let c=0,u=s;c<n.maps.length;c++){let d=0;n.maps[c].forEach((f,h,p,m)=>{let y=m-p-(h-f);for(let v=0;v<a.length;v+=3){let w=a[v+1];if(w<0||f>w+u-d)continue;let E=a[v]+u-d;h>=E?a[v+1]=f<=E?-2:-1:f>=u&&y&&(a[v]+=y,a[v+1]+=y)}d+=y}),u=n.maps[c].map(u,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){l=!0,a[c+1]=-1;continue}let u=n.map(t[c]+s),d=u-o;if(d<0||d>=r.content.size){l=!0;continue}let f=n.map(t[c+1]+s,-1),h=f-o,{index:p,offset:m}=r.content.findIndex(d),y=r.maybeChild(p);if(y&&m==d&&m+y.nodeSize==h){let v=a[c+2].mapInner(n,y,u+1,t[c]+s+1,i);v!=Yt?(a[c]=d,a[c+1]=h,a[c+2]=v):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=Q2(a,t,e,n,o,s,i),u=Eu(c,r,0,i);e=u.local;for(let d=0;d<a.length;d+=3)a[d+1]<0&&(a.splice(d,3),d-=3);for(let d=0,f=0;d<u.children.length;d+=3){let h=u.children[d];for(;f<a.length&&a[f]<h;)f+=3;a.splice(f,0,u.children[d],u.children[d+1],u.children[d+2])}}return new et(e.sort(Ms),a)}function z1(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let o=t[r];n.push(new Gt(o.from+e,o.to+e,o.type))}return n}function Q2(t,e,n,r,o,s,i){function a(l,c){for(let u=0;u<l.local.length;u++){let d=l.local[u].map(r,o,c);d?n.push(d):i.onRemove&&i.onRemove(l.local[u].spec)}for(let u=0;u<l.children.length;u+=3)a(l.children[u+2],l.children[u]+c+1)}for(let l=0;l<t.length;l+=3)t[l+1]==-1&&a(t[l+2],e[l]+s+1);return n}function V1(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,o=null;for(let s=0,i;s<t.length;s++)(i=t[s])&&i.from>n&&i.to<r&&((o||(o=[])).push(i),t[s]=null);return o}function W1(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Eu(t,e,n,r){let o=[],s=!1;e.forEach((a,l)=>{let c=V1(t,a,l+n);if(c){s=!0;let u=Eu(c,a,n+l+1,r);u!=Yt&&o.push(l,l+a.nodeSize,u)}});let i=z1(s?W1(t):t,-n).sort(Ms);for(let a=0;a<i.length;a++)i[a].type.valid(e,i[a])||(r.onRemove&&r.onRemove(i[a].spec),i.splice(a--,1));return i.length||o.length?new et(i,o):Yt}function Ms(t,e){return t.from-e.from||t.to-e.to}function Ug(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let o=n+1;o<e.length;o++){let s=e[o];if(s.from==r.from){s.to!=r.to&&(e==t&&(e=t.slice()),e[o]=s.copy(s.from,r.to),m0(e,o+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,s.from),m0(e,o,r.copy(s.from,r.to)));break}}}return e}function m0(t,e,n){for(;e<t.length&&Ms(n,t[e])>0;)e++;t.splice(e,0,n)}function yh(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Yt&&e.push(r)}),t.cursorWrapper&&e.push(et.create(t.state.doc,[t.cursorWrapper.deco])),Lo.from(e)}const Z2={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},e$=kn&&Go<=11;class t${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 n${constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new t$,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let o=0;o<r.length;o++)this.queue.push(r[o]);kn&&Go<=11&&r.some(o=>o.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():this.flush()}),e$&&(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,Z2)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(a0(this.view)){if(this.suppressingSelectionUpdates)return lo(this.view);if(kn&&Go<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Ps(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let s=e.focusNode;s;s=Ri(s))n.add(s);for(let s=e.anchorNode;s;s=Ri(s))if(n.has(s)){r=s;break}let o=r&&this.view.docView.nearestDesc(r);if(o&&o.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&a0(e)&&!this.ignoreSelectionChange(r),s=-1,i=-1,a=!1,l=[];if(e.editable)for(let u=0;u<n.length;u++){let d=this.registerMutation(n[u],l);d&&(s=s<0?d.from:Math.min(d.from,s),i=i<0?d.to:Math.max(d.to,i),d.typeOver&&(a=!0))}if(Yn&&l.length){let u=l.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,f]=u;d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let f of u){let h=f.parentNode;h&&h.nodeName=="LI"&&(!d||s$(e,d)!=h)&&f.remove()}}}let c=null;s<0&&o&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Vd(r)&&(c=Pg(e))&&c.eq(Oe.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,lo(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||o)&&(s>-1&&(e.docView.markDirty(s,i),r$(e)),this.handleDOMChange(s,i,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||lo(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let d=e.addedNodes[u];n.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let o=e.previousSibling,s=e.nextSibling;if(kn&&Go<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:d,nextSibling:f}=e.addedNodes[u];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(o=d),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(s=f)}let i=o&&o.parentNode==e.target?Vt(o)+1:0,a=r.localPosFromDOM(e.target,i,-1),l=s&&s.parentNode==e.target?Vt(s):e.target.childNodes.length,c=r.localPosFromDOM(e.target,l,1);return{from:a,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let g0=new WeakMap,y0=!1;function r$(t){if(!g0.has(t)&&(g0.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Yn,y0)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."),y0=!0}}function v0(t,e){let n=e.startContainer,r=e.startOffset,o=e.endContainer,s=e.endOffset,i=t.domAtPos(t.state.selection.anchor);return Ps(i.node,i.offset,o,s)&&([n,r,o,s]=[o,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:s}}function o$(t,e){if(e.getComposedRanges){let o=e.getComposedRanges(t.root)[0];if(o)return v0(t,o)}let n;function r(o){o.preventDefault(),o.stopImmediatePropagation(),n=o.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?v0(t,n):null}function s$(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function i$(t,e,n){let{node:r,fromOffset:o,toOffset:s,from:i,to:a}=t.docView.parseRange(e,n),l=t.domSelectionRange(),c,u=l.anchorNode;if(u&&t.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:l.anchorOffset}],Vd(l)||c.push({node:l.focusNode,offset:l.focusOffset})),Xt&&t.input.lastKeyCode===8)for(let y=s;y>o;y--){let v=r.childNodes[y-1],w=v.pmViewDesc;if(v.nodeName=="BR"&&!w){s=y;break}if(!w||w.size)break}let d=t.state.doc,f=t.someProp("domParser")||Oa.fromSchema(t.state.schema),h=d.resolve(i),p=null,m=f.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:o,to:s,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:a$,context:h});if(c&&c[0].pos!=null){let y=c[0].pos,v=c[1]&&c[1].pos;v==null&&(v=y),p={anchor:y+i,head:v+i}}return{doc:m,sel:p,from:i,to:a}}function a$(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(ln&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||ln&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const l$=/^(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 c$(t,e,n,r,o){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let k=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,C=Pg(t,k);if(C&&!t.state.selection.eq(C)){if(Xt&&so&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",R=>R(t,gs(13,"Enter"))))return;let N=t.state.tr.setSelection(C);k=="pointer"?N.setMeta("pointer",!0):k=="key"&&N.scrollIntoView(),s&&N.setMeta("composition",s),t.dispatch(N)}return}let i=t.state.doc.resolve(e),a=i.sharedDepth(n);e=i.before(a+1),n=t.state.doc.resolve(n).after(a+1);let l=t.state.selection,c=i$(t,e,n),u=t.state.doc,d=u.slice(c.from,c.to),f,h;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(f=t.state.selection.to,h="end"):(f=t.state.selection.from,h="start"),t.input.lastKeyCode=null;let p=f$(d.content,c.doc.content,c.from,f,h);if(p&&t.input.domChangeCount++,(Ni&&t.input.lastIOSEnter>Date.now()-225||so)&&o.some(k=>k.nodeType==1&&!l$.test(k.nodeName))&&(!p||p.endA>=p.endB)&&t.someProp("handleKeyDown",k=>k(t,gs(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!p)if(r&&l instanceof pe&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let k=b0(t,t.state.doc,c.sel);if(k&&!k.eq(t.state.selection)){let C=t.state.tr.setSelection(k);s&&C.setMeta("composition",s),t.dispatch(C)}}return}t.state.selection.from<t.state.selection.to&&p.start==p.endB&&t.state.selection instanceof pe&&(p.start>t.state.selection.from&&p.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?p.start=t.state.selection.from:p.endA<t.state.selection.to&&p.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(p.endB+=t.state.selection.to-p.endA,p.endA=t.state.selection.to)),kn&&Go<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)==" "&&(p.start--,p.endA--,p.endB--);let m=c.doc.resolveNoCache(p.start-c.from),y=c.doc.resolveNoCache(p.endB-c.from),v=u.resolve(p.start),w=m.sameParent(y)&&m.parent.inlineContent&&v.end()>=p.endA;if((Ni&&t.input.lastIOSEnter>Date.now()-225&&(!w||o.some(k=>k.nodeName=="DIV"||k.nodeName=="P"))||!w&&m.pos<c.doc.content.size&&(!m.sameParent(y)||!m.parent.inlineContent)&&m.pos<y.pos&&!/\S/.test(c.doc.textBetween(m.pos,y.pos,"","")))&&t.someProp("handleKeyDown",k=>k(t,gs(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>p.start&&d$(u,p.start,p.endA,m,y)&&t.someProp("handleKeyDown",k=>k(t,gs(8,"Backspace")))){so&&Xt&&t.domObserver.suppressSelectionUpdates();return}Xt&&p.endB==p.start&&(t.input.lastChromeDelete=Date.now()),so&&!w&&m.start()!=y.start()&&y.parentOffset==0&&m.depth==y.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,y=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(k){return k(t,gs(13,"Enter"))})},20));let E=p.start,x=p.endA,T=k=>{let C=k||t.state.tr.replace(E,x,c.doc.slice(p.start-c.from,p.endB-c.from));if(c.sel){let N=b0(t,C.doc,c.sel);N&&!(Xt&&t.composing&&N.empty&&(p.start!=p.endB||t.input.lastChromeDelete<Date.now()-100)&&(N.head==E||N.head==C.mapping.map(x)-1)||kn&&N.empty&&N.head==E)&&C.setSelection(N)}return s&&C.setMeta("composition",s),C.scrollIntoView()},S;if(w)if(m.pos==y.pos){kn&&Go<=11&&m.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>lo(t),20));let k=T(t.state.tr.delete(E,x)),C=u.resolve(p.start).marksAcross(u.resolve(p.endA));C&&k.ensureMarks(C),t.dispatch(k)}else if(p.endA==p.endB&&(S=u$(m.parent.content.cut(m.parentOffset,y.parentOffset),v.parent.content.cut(v.parentOffset,p.endA-v.start())))){let k=T(t.state.tr);S.type=="add"?k.addMark(E,x,S.mark):k.removeMark(E,x,S.mark),t.dispatch(k)}else if(m.parent.child(m.index()).isText&&m.index()==y.index()-(y.textOffset?0:1)){let k=m.parent.textBetween(m.parentOffset,y.parentOffset),C=()=>T(t.state.tr.insertText(k,E,x));t.someProp("handleTextInput",N=>N(t,E,x,k,C))||t.dispatch(C())}else t.dispatch(T());else t.dispatch(T())}function b0(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Lg(t,e.resolve(n.anchor),e.resolve(n.head))}function u$(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,o=n,s=r,i,a,l;for(let u=0;u<r.length;u++)o=r[u].removeFromSet(o);for(let u=0;u<n.length;u++)s=n[u].removeFromSet(s);if(o.length==1&&s.length==0)a=o[0],i="add",l=u=>u.mark(a.addToSet(u.marks));else if(o.length==0&&s.length==1)a=s[0],i="remove",l=u=>u.mark(a.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(l(e.child(u)));if(F.from(c).eq(t))return{mark:a,type:i}}function d$(t,e,n,r,o){if(n-e<=o.pos-r.pos||vh(r,!0,!1)<o.pos)return!1;let s=t.resolve(e);if(!r.parent.isTextblock){let a=s.nodeAfter;return a!=null&&n==e+a.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let i=t.resolve(vh(s,!0,!0));return!i.parent.isTextblock||i.pos>n||vh(i,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(i.parent.content)}function vh(t,e,n){let r=t.depth,o=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,o++,e=!1;if(n){let s=t.node(r).maybeChild(t.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,o++}return o}function f$(t,e,n,r,o){let s=t.findDiffStart(e,n);if(s==null)return null;let{a:i,b:a}=t.findDiffEnd(e,n+t.size,n+e.size);if(o=="end"){let l=Math.max(0,s-Math.min(i,a));r-=i+l-s}if(i<s&&t.size<e.size){let l=r<=s&&r>=i?s-r:0;s-=l,s&&s<e.size&&x0(e.textBetween(s-1,s+1))&&(s+=l?1:-1),a=s+(a-i),i=s}else if(a<s){let l=r<=s&&r>=a?s-r:0;s-=l,s&&s<t.size&&x0(t.textBetween(s-1,s+1))&&(s+=l?1:-1),i=s+(i-a),a=s}return{start:s,endA:i,endB:a}}function x0(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class G1{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new N2,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(T0),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=S0(this),E0(this),this.nodeViews=k0(this),this.docView=t0(this.state.doc,w0(this),yh(this),this.dom,this),this.domObserver=new n$(this,(r,o,s,i)=>c$(this,r,o,s,i)),this.domObserver.start(),_2(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&qp(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(T0),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let o=this.state,s=!1,i=!1;e.storedMarks&&this.composing&&(B1(this),i=!0),this.state=e;let a=o.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let h=k0(this);p$(h,this.nodeViews)&&(this.nodeViews=h,s=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&qp(this),this.editable=S0(this),E0(this);let l=yh(this),c=w0(this),u=o.plugins!=e.plugins&&!o.doc.eq(e.doc)?"reset":e.scrollToSelection>o.scrollToSelection?"to selection":"preserve",d=s||!this.docView.matchesNode(e.doc,c,l);(d||!e.selection.eq(o.selection))&&(i=!0);let f=u=="preserve"&&i&&this.dom.style.overflowAnchor==null&&Gj(this);if(i){this.domObserver.stop();let h=d&&(kn||Xt)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&h$(o.selection,e.selection);if(d){let p=Xt?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=W2(this)),(s||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=t0(e.doc,c,l,this.dom,this)),p&&!this.trackWrites&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&g2(this))?lo(this,h):(A1(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),!((r=this.dragging)===null||r===void 0)&&r.node&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():f&&qj(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof ue){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Yb(this,n.getBoundingClientRect(),e)}else Yb(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,o=-1;if(this.state.doc.nodeAt(r.from)==r.node)o=r.from;else{let s=r.from+(this.state.doc.content.size-n.doc.content.size);(s>0&&this.state.doc.nodeAt(s))==r.node&&(o=s)}this.dragging=new H1(e.slice,e.move,o<0?void 0:ue.create(this.state.doc,o))}someProp(e,n){let r=this._props&&this._props[e],o;if(r!=null&&(o=n?n(r):r))return o;for(let i=0;i<this.directPlugins.length;i++){let a=this.directPlugins[i].props[e];if(a!=null&&(o=n?n(a):a))return o}let s=this.state.plugins;if(s)for(let i=0;i<s.length;i++){let a=s[i].props[e];if(a!=null&&(o=n?n(a):a))return o}}hasFocus(){if(kn){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&&Kj(this.dom),lo(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Zj(this,e)}coordsAtPos(e,n=1){return b1(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let o=this.docView.posFromDOM(e,n,r);if(o==null)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(e,n){return o2(this,n||this.state,e)}pasteHTML(e,n){return Xa(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Xa(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return jg(this,e)}destroy(){this.docView&&(D2(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],yh(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Pj())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return P2(this,e)}domSelectionRange(){let e=this.domSelection();return e?ln&&this.root.nodeType===11&&Fj(this.dom.ownerDocument)==this.dom&&o$(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}G1.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function w0(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[Gt.node(0,t.state.doc.content.size,e)]}function E0(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:Gt.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function S0(t){return!t.someProp("editable",e=>e(t.state)===!1)}function h$(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function k0(t){let e=Object.create(null);function n(r){for(let o in r)Object.prototype.hasOwnProperty.call(e,o)||(e[o]=r[o])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function p$(t,e){let n=0,r=0;for(let o in t){if(t[o]!=e[o])return!0;n++}for(let o in e)r++;return n!=r}function T0(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Jo={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:"'"},Su={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},m$=typeof navigator<"u"&&/Mac/.test(navigator.platform),g$=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Wt=0;Wt<10;Wt++)Jo[48+Wt]=Jo[96+Wt]=String(Wt);for(var Wt=1;Wt<=24;Wt++)Jo[Wt+111]="F"+Wt;for(var Wt=65;Wt<=90;Wt++)Jo[Wt]=String.fromCharCode(Wt+32),Su[Wt]=String.fromCharCode(Wt);for(var bh in Jo)Su.hasOwnProperty(bh)||(Su[bh]=Jo[bh]);function y$(t){var e=m$&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||g$&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Su:Jo)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const v$=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),b$=typeof navigator<"u"&&/Win/.test(navigator.platform);function x$(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,o,s,i;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))i=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))o=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))v$?i=!0:o=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(n="Alt-"+n),o&&(n="Ctrl-"+n),i&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function w$(t){let e=Object.create(null);for(let n in t)e[x$(n)]=t[n];return e}function xh(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function E$(t){return new Ue({props:{handleKeyDown:q1(t)}})}function q1(t){let e=w$(t);return function(n,r){let o=y$(r),s,i=e[xh(o,r)];if(i&&i(n.state,n.dispatch,n))return!0;if(o.length==1&&o!=" "){if(r.shiftKey){let a=e[xh(o,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(b$&&r.ctrlKey&&r.altKey)&&(s=Jo[r.keyCode])&&s!=o){let a=e[xh(s,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}var S$=Object.defineProperty,zg=(t,e)=>{for(var n in e)S$(t,n,{get:e[n],enumerable:!0})};function qd(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:o}=n,{storedMarks:s}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return r},get doc(){return o},get tr(){return r=n.selection,o=n.doc,s=n.storedMarks,n}}}var Kd=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:o}=n,s=this.buildProps(o);return Object.fromEntries(Object.entries(t).map(([i,a])=>[i,(...c)=>{const u=a(...c)(s);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(o),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:o}=this,{view:s}=r,i=[],a=!!t,l=t||o.tr,c=()=>(!a&&e&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(l),i.every(d=>d===!0)),u={...Object.fromEntries(Object.entries(n).map(([d,f])=>[d,(...p)=>{const m=this.buildProps(l,e),y=f(...p)(m);return i.push(y),u}])),run:c};return u}createCan(t){const{rawCommands:e,state:n}=this,r=!1,o=t||n.tr,s=this.buildProps(o,r);return{...Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...c)=>l(...c)({...s,dispatch:void 0})])),chain:()=>this.createChain(o,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:o}=this,{view:s}=r,i={tr:t,editor:r,view:s,state:qd({state:o,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([a,l])=>[a,(...c)=>l(...c)(i)]))}};return i}},K1={};zg(K1,{blur:()=>k$,clearContent:()=>T$,clearNodes:()=>C$,command:()=>A$,createParagraphNear:()=>M$,cut:()=>O$,deleteCurrentNode:()=>R$,deleteNode:()=>N$,deleteRange:()=>_$,deleteSelection:()=>D$,enter:()=>I$,exitCode:()=>P$,extendMarkRange:()=>L$,first:()=>j$,focus:()=>$$,forEach:()=>B$,insertContent:()=>F$,insertContentAt:()=>z$,joinBackward:()=>G$,joinDown:()=>W$,joinForward:()=>q$,joinItemBackward:()=>K$,joinItemForward:()=>Y$,joinTextblockBackward:()=>J$,joinTextblockForward:()=>X$,joinUp:()=>V$,keyboardShortcut:()=>Z$,lift:()=>eB,liftEmptyBlock:()=>tB,liftListItem:()=>nB,newlineInCode:()=>rB,resetAttributes:()=>oB,scrollIntoView:()=>sB,selectAll:()=>iB,selectNodeBackward:()=>aB,selectNodeForward:()=>lB,selectParentNode:()=>cB,selectTextblockEnd:()=>uB,selectTextblockStart:()=>dB,setContent:()=>fB,setMark:()=>RB,setMeta:()=>NB,setNode:()=>_B,setNodeSelection:()=>DB,setTextSelection:()=>IB,sinkListItem:()=>PB,splitBlock:()=>LB,splitListItem:()=>jB,toggleList:()=>$B,toggleMark:()=>BB,toggleNode:()=>FB,toggleWrap:()=>HB,undoInputRule:()=>UB,unsetAllMarks:()=>zB,unsetMark:()=>VB,updateAttributes:()=>WB,wrapIn:()=>GB,wrapInList:()=>qB});var k$=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())==null||n.removeAllRanges())}),!0),T$=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),C$=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:o}=r;return n&&o.forEach(({$from:s,$to:i})=>{t.doc.nodesBetween(s.pos,i.pos,(a,l)=>{if(a.type.isText)return;const{doc:c,mapping:u}=e,d=c.resolve(u.map(l)),f=c.resolve(u.map(l+a.nodeSize)),h=d.blockRange(f);if(!h)return;const p=Ji(h);if(a.type.isTextblock){const{defaultType:m}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(h.start,m)}(p||p===0)&&e.lift(h,p)})}),!0},A$=t=>e=>t(e),M$=()=>({state:t,dispatch:e})=>c1(t,e),O$=(t,e)=>({editor:n,tr:r})=>{const{state:o}=n,s=o.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const i=r.mapping.map(e);return r.insert(i,s.content),r.setSelection(new pe(r.doc.resolve(Math.max(i-1,0)))),!0},R$=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const o=t.selection.$anchor;for(let s=o.depth;s>0;s-=1)if(o.node(s).type===r.type){if(e){const a=o.before(s),l=o.after(s);t.delete(a,l).scrollIntoView()}return!0}return!1};function St(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var N$=t=>({tr:e,state:n,dispatch:r})=>{const o=St(t,n.schema),s=e.selection.$anchor;for(let i=s.depth;i>0;i-=1)if(s.node(i).type===o){if(r){const l=s.before(i),c=s.after(i);e.delete(l,c).scrollIntoView()}return!0}return!1},_$=t=>({tr:e,dispatch:n})=>{const{from:r,to:o}=t;return n&&e.delete(r,o),!0},D$=()=>({state:t,dispatch:e})=>Og(t,e),I$=()=>({commands:t})=>t.keyboardShortcut("Enter"),P$=()=>({state:t,dispatch:e})=>xj(t,e);function Vg(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function ku(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(o=>n.strict?e[o]===t[o]:Vg(e[o])?e[o].test(t[o]):e[o]===t[o]):!0}function Y1(t,e,n={}){return t.find(r=>r.type===e&&ku(Object.fromEntries(Object.keys(n).map(o=>[o,r.attrs[o]])),n))}function C0(t,e,n={}){return!!Y1(t,e,n)}function Wg(t,e,n){var r;if(!t||!e)return;let o=t.parent.childAfter(t.parentOffset);if((!o.node||!o.node.marks.some(u=>u.type===e))&&(o=t.parent.childBefore(t.parentOffset)),!o.node||!o.node.marks.some(u=>u.type===e)||(n=n||((r=o.node.marks[0])==null?void 0:r.attrs),!Y1([...o.node.marks],e,n)))return;let i=o.index,a=t.start()+o.offset,l=i+1,c=a+o.node.nodeSize;for(;i>0&&C0([...t.parent.child(i-1).marks],e,n);)i-=1,a-=t.parent.child(i).nodeSize;for(;l<t.parent.childCount&&C0([...t.parent.child(l).marks],e,n);)c+=t.parent.child(l).nodeSize,l+=1;return{from:a,to:c}}function xo(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}var L$=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const s=xo(t,r.schema),{doc:i,selection:a}=n,{$from:l,from:c,to:u}=a;if(o){const d=Wg(l,s,e);if(d&&d.from<=c&&d.to>=u){const f=pe.create(i,d.from,d.to);n.setSelection(f)}}return!0},j$=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function J1(t){return t instanceof pe}function Es(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function X1(t,e=null){if(!e)return null;const n=Oe.atStart(t),r=Oe.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const o=n.from,s=r.to;return e==="all"?pe.create(t,Es(0,o,s),Es(t.content.size,o,s)):pe.create(t,Es(e,o,s),Es(e,o,s))}function Gg(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function $l(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var $$=(t=null,e={})=>({editor:n,view:r,tr:o,dispatch:s})=>{e={scrollIntoView:!0,...e};const i=()=>{($l()||Gg())&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e?.scrollIntoView&&n.commands.scrollIntoView())})};if(r.hasFocus()&&t===null||t===!1)return!0;if(s&&t===null&&!J1(n.state.selection))return i(),!0;const a=X1(o.doc,t)||n.state.selection,l=n.state.selection.eq(a);return s&&(l||o.setSelection(a),l&&o.storedMarks&&o.setStoredMarks(o.storedMarks),i()),!0},B$=(t,e)=>n=>t.every((r,o)=>e(r,{...n,index:o})),F$=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),Q1=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&Q1(r)}return t};function gc(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return Q1(n)}function Za(t,e,n){if(t instanceof io||t instanceof F)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,o=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return F.fromArray(t.map(a=>e.nodeFromJSON(a)));const i=e.nodeFromJSON(t);return n.errorOnInvalidContent&&i.check(),i}catch(s){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",s),Za("",e,n)}if(o){if(n.errorOnInvalidContent){let i=!1,a="";const l=new Pk({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(i=!0,a=typeof c=="string"?c:c.outerHTML,null)}]}})});if(n.slice?Oa.fromSchema(l).parseSlice(gc(t),n.parseOptions):Oa.fromSchema(l).parse(gc(t),n.parseOptions),n.errorOnInvalidContent&&i)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const s=Oa.fromSchema(e);return n.slice?s.parseSlice(gc(t),n.parseOptions).content:s.parse(gc(t),n.parseOptions)}return Za("",e,n)}function H$(t,e,n){const r=t.steps.length-1;if(r<e)return;const o=t.steps[r];if(!(o instanceof Lt||o instanceof jt))return;const s=t.mapping.maps[r];let i=0;s.forEach((a,l,c,u)=>{i===0&&(i=u)}),t.setSelection(Oe.near(t.doc.resolve(i),n))}var U$=t=>!("type"in t),z$=(t,e,n)=>({tr:r,dispatch:o,editor:s})=>{var i;if(o){n={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let a;const l=y=>{s.emit("contentError",{editor:s,error:y,disableCollaboration:()=>{"collaboration"in s.storage&&typeof s.storage.collaboration=="object"&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{Za(e,s.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(y){l(y)}try{a=Za(e,s.schema,{parseOptions:c,errorOnInvalidContent:(i=n.errorOnInvalidContent)!=null?i:s.options.enableContentCheck})}catch(y){return l(y),!1}let{from:u,to:d}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},f=!0,h=!0;if((U$(a)?a:[a]).forEach(y=>{y.check(),f=f?y.isText&&y.marks.length===0:!1,h=h?y.isBlock:!1}),u===d&&h){const{parent:y}=r.doc.resolve(u);y.isTextblock&&!y.type.spec.code&&!y.childCount&&(u-=1,d+=1)}let m;if(f){if(Array.isArray(e))m=e.map(y=>y.text||"").join("");else if(e instanceof F){let y="";e.forEach(v=>{v.text&&(y+=v.text)}),m=y}else typeof e=="object"&&e&&e.text?m=e.text:m=e;r.insertText(m,u,d)}else{m=a;const y=r.doc.resolve(u),v=y.node(),w=y.parentOffset===0,E=v.isText||v.isTextblock,x=v.content.size>0;w&&E&&x&&(u=Math.max(0,u-1)),r.replaceWith(u,d,m)}n.updateSelection&&H$(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:m}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:m})}return!0},V$=()=>({state:t,dispatch:e})=>yj(t,e),W$=()=>({state:t,dispatch:e})=>vj(t,e),G$=()=>({state:t,dispatch:e})=>n1(t,e),q$=()=>({state:t,dispatch:e})=>i1(t,e),K$=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Hd(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},Y$=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Hd(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},J$=()=>({state:t,dispatch:e})=>mj(t,e),X$=()=>({state:t,dispatch:e})=>gj(t,e);function Z1(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function Q$(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,o,s,i;for(let a=0;a<e.length-1;a+=1){const l=e[a];if(/^(cmd|meta|m)$/i.test(l))i=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))o=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))$l()||Z1()?i=!0:o=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return r&&(n=`Alt-${n}`),o&&(n=`Ctrl-${n}`),i&&(n=`Meta-${n}`),s&&(n=`Shift-${n}`),n}var Z$=t=>({editor:e,view:n,tr:r,dispatch:o})=>{const s=Q$(t).split(/-(?!$)/),i=s.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),a=new KeyboardEvent("keydown",{key:i==="Space"?" ":i,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{n.someProp("handleKeyDown",c=>c(n,a))});return l?.steps.forEach(c=>{const u=c.map(r.mapping);u&&o&&r.maybeStep(u)}),!0};function Xo(t,e,n={}){const{from:r,to:o,empty:s}=t.selection,i=e?St(e,t.schema):null,a=[];t.doc.nodesBetween(r,o,(d,f)=>{if(d.isText)return;const h=Math.max(r,f),p=Math.min(o,f+d.nodeSize);a.push({node:d,from:h,to:p})});const l=o-r,c=a.filter(d=>i?i.name===d.node.type.name:!0).filter(d=>ku(d.node.attrs,n,{strict:!1}));return s?!!c.length:c.reduce((d,f)=>d+f.to-f.from,0)>=l}var eB=(t,e={})=>({state:n,dispatch:r})=>{const o=St(t,n.schema);return Xo(n,o,e)?bj(n,r):!1},tB=()=>({state:t,dispatch:e})=>u1(t,e),nB=t=>({state:e,dispatch:n})=>{const r=St(t,e.schema);return Nj(r)(e,n)},rB=()=>({state:t,dispatch:e})=>l1(t,e);function Yd(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function A0(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,o)=>(n.includes(o)||(r[o]=t[o]),r),{})}var oB=(t,e)=>({tr:n,state:r,dispatch:o})=>{let s=null,i=null;const a=Yd(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(s=St(t,r.schema)),a==="mark"&&(i=xo(t,r.schema)),o&&n.selection.ranges.forEach(l=>{r.doc.nodesBetween(l.$from.pos,l.$to.pos,(c,u)=>{s&&s===c.type&&n.setNodeMarkup(u,void 0,A0(c.attrs,e)),i&&c.marks.length&&c.marks.forEach(d=>{i===d.type&&n.addMark(u,u+c.nodeSize,i.create(A0(d.attrs,e)))})})}),!0):!1},sB=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),iB=()=>({tr:t,dispatch:e})=>{if(e){const n=new Sn(t.doc);t.setSelection(n)}return!0},aB=()=>({state:t,dispatch:e})=>o1(t,e),lB=()=>({state:t,dispatch:e})=>a1(t,e),cB=()=>({state:t,dispatch:e})=>Sj(t,e),uB=()=>({state:t,dispatch:e})=>Cj(t,e),dB=()=>({state:t,dispatch:e})=>Tj(t,e);function Kp(t,e,n={},r={}){return Za(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var fB=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:o,tr:s,dispatch:i,commands:a})=>{const{doc:l}=s;if(r.preserveWhitespace!=="full"){const c=Kp(t,o.schema,r,{errorOnInvalidContent:e??o.options.enableContentCheck});return i&&s.replaceWith(0,l.content.size,c).setMeta("preventUpdate",!n),!0}return i&&s.setMeta("preventUpdate",!n),a.insertContentAt({from:0,to:l.content.size},t,{parseOptions:r,errorOnInvalidContent:e??o.options.enableContentCheck})};function eT(t,e){const n=xo(e,t.schema),{from:r,to:o,empty:s}=t.selection,i=[];s?(t.storedMarks&&i.push(...t.storedMarks),i.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,o,l=>{i.push(...l.marks)});const a=i.find(l=>l.type.name===n.name);return a?{...a.attrs}:{}}function tT(t,e){const n=new Xk(t);return e.forEach(r=>{r.steps.forEach(o=>{n.step(o)})}),n}function hB(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function pB(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(o,s)=>{n(o)&&r.push({node:o,pos:s})}),r}function mB(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function Jd(t){return e=>mB(e.$from,t)}function fe(t,e,n){return t.config[e]===void 0&&t.parent?fe(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?fe(t.parent,e,n):null}):t.config[e]}function qg(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=fe(e,"addExtensions",n);return r?[e,...qg(r())]:e}).flat(10)}function Kg(t,e){const n=Ks.fromSchema(e).serializeFragment(t),o=document.implementation.createHTMLDocument().createElement("div");return o.appendChild(n),o.innerHTML}function nT(t){return typeof t=="function"}function qe(t,e=void 0,...n){return nT(t)?e?t.bind(e)(...n):t(...n):t}function gB(t={}){return Object.keys(t).length===0&&t.constructor===Object}function el(t){const e=t.filter(o=>o.type==="extension"),n=t.filter(o=>o.type==="node"),r=t.filter(o=>o.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function rT(t){const e=[],{nodeExtensions:n,markExtensions:r}=el(t),o=[...n,...r],s={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(i=>{const a={name:i.name,options:i.options,storage:i.storage,extensions:o},l=fe(i,"addGlobalAttributes",a);if(!l)return;l().forEach(u=>{u.types.forEach(d=>{Object.entries(u.attributes).forEach(([f,h])=>{e.push({type:d,name:f,attribute:{...s,...h}})})})})}),o.forEach(i=>{const a={name:i.name,options:i.options,storage:i.storage},l=fe(i,"addAttributes",a);if(!l)return;const c=l();Object.entries(c).forEach(([u,d])=>{const f={...s,...d};typeof f?.default=="function"&&(f.default=f.default()),f?.isRequired&&f?.default===void 0&&delete f.default,e.push({type:i.name,name:u,attribute:f})})}),e}function Be(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([o,s])=>{if(!r[o]){r[o]=s;return}if(o==="class"){const a=s?String(s).split(" "):[],l=r[o]?r[o].split(" "):[],c=a.filter(u=>!l.includes(u));r[o]=[...l,...c].join(" ")}else if(o==="style"){const a=s?s.split(";").map(u=>u.trim()).filter(Boolean):[],l=r[o]?r[o].split(";").map(u=>u.trim()).filter(Boolean):[],c=new Map;l.forEach(u=>{const[d,f]=u.split(":").map(h=>h.trim());c.set(d,f)}),a.forEach(u=>{const[d,f]=u.split(":").map(h=>h.trim());c.set(d,f)}),r[o]=Array.from(c.entries()).map(([u,d])=>`${u}: ${d}`).join("; ")}else r[o]=s}),r},{})}function tl(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>Be(n,r),{})}function yB(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function M0(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const o=e.reduce((s,i)=>{const a=i.attribute.parseHTML?i.attribute.parseHTML(n):yB(n.getAttribute(i.name));return a==null?s:{...s,[i.name]:a}},{});return{...r,...o}}}}function O0(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&gB(n)?!1:n!=null))}function vB(t,e){var n;const r=rT(t),{nodeExtensions:o,markExtensions:s}=el(t),i=(n=o.find(c=>fe(c,"topNode")))==null?void 0:n.name,a=Object.fromEntries(o.map(c=>{const u=r.filter(v=>v.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=t.reduce((v,w)=>{const E=fe(w,"extendNodeSchema",d);return{...v,...E?E(c):{}}},{}),h=O0({...f,content:qe(fe(c,"content",d)),marks:qe(fe(c,"marks",d)),group:qe(fe(c,"group",d)),inline:qe(fe(c,"inline",d)),atom:qe(fe(c,"atom",d)),selectable:qe(fe(c,"selectable",d)),draggable:qe(fe(c,"draggable",d)),code:qe(fe(c,"code",d)),whitespace:qe(fe(c,"whitespace",d)),linebreakReplacement:qe(fe(c,"linebreakReplacement",d)),defining:qe(fe(c,"defining",d)),isolating:qe(fe(c,"isolating",d)),attrs:Object.fromEntries(u.map(v=>{var w,E;return[v.name,{default:(w=v?.attribute)==null?void 0:w.default,validate:(E=v?.attribute)==null?void 0:E.validate}]}))}),p=qe(fe(c,"parseHTML",d));p&&(h.parseDOM=p.map(v=>M0(v,u)));const m=fe(c,"renderHTML",d);m&&(h.toDOM=v=>m({node:v,HTMLAttributes:tl(v,u)}));const y=fe(c,"renderText",d);return y&&(h.toText=y),[c.name,h]})),l=Object.fromEntries(s.map(c=>{const u=r.filter(y=>y.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=t.reduce((y,v)=>{const w=fe(v,"extendMarkSchema",d);return{...y,...w?w(c):{}}},{}),h=O0({...f,inclusive:qe(fe(c,"inclusive",d)),excludes:qe(fe(c,"excludes",d)),group:qe(fe(c,"group",d)),spanning:qe(fe(c,"spanning",d)),code:qe(fe(c,"code",d)),attrs:Object.fromEntries(u.map(y=>{var v,w;return[y.name,{default:(v=y?.attribute)==null?void 0:v.default,validate:(w=y?.attribute)==null?void 0:w.validate}]}))}),p=qe(fe(c,"parseHTML",d));p&&(h.parseDOM=p.map(y=>M0(y,u)));const m=fe(c,"renderHTML",d);return m&&(h.toDOM=y=>m({mark:y,HTMLAttributes:tl(y,u)})),[c.name,h]}));return new Pk({topNode:i,nodes:a,marks:l})}function bB(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function Yg(t){return t.sort((n,r)=>{const o=fe(n,"priority")||100,s=fe(r,"priority")||100;return o>s?-1:o<s?1:0})}function oT(t){const e=Yg(qg(t)),n=bB(e.map(r=>r.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function sT(t,e,n){const{from:r,to:o}=e,{blockSeparator:s=`
|
|
118
|
+
|
|
119
|
+
`,textSerializers:i={}}=n||{};let a="";return t.nodesBetween(r,o,(l,c,u,d)=>{var f;l.isBlock&&c>r&&(a+=s);const h=i?.[l.type.name];if(h)return u&&(a+=h({node:l,pos:c,parent:u,index:d,range:e})),!1;l.isText&&(a+=(f=l?.text)==null?void 0:f.slice(Math.max(r,c)-c,o-c))}),a}function xB(t,e){const n={from:0,to:t.content.size};return sT(t,n,e)}function iT(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function wB(t,e){const n=St(e,t.schema),{from:r,to:o}=t.selection,s=[];t.doc.nodesBetween(r,o,a=>{s.push(a)});const i=s.reverse().find(a=>a.type.name===n.name);return i?{...i.attrs}:{}}function aT(t,e){const n=Yd(typeof e=="string"?e:e.name,t.schema);return n==="node"?wB(t,e):n==="mark"?eT(t,e):{}}function EB(t,e=JSON.stringify){const n={};return t.filter(r=>{const o=e(r);return Object.prototype.hasOwnProperty.call(n,o)?!1:n[o]=!0})}function SB(t){const e=EB(t);return e.length===1?e:e.filter((n,r)=>!e.filter((s,i)=>i!==r).some(s=>n.oldRange.from>=s.oldRange.from&&n.oldRange.to<=s.oldRange.to&&n.newRange.from>=s.newRange.from&&n.newRange.to<=s.newRange.to))}function lT(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((o,s)=>{const i=[];if(o.ranges.length)o.forEach((a,l)=>{i.push({from:a,to:l})});else{const{from:a,to:l}=n[s];if(a===void 0||l===void 0)return;i.push({from:a,to:l})}i.forEach(({from:a,to:l})=>{const c=e.slice(s).map(a,-1),u=e.slice(s).map(l),d=e.invert().map(c,-1),f=e.invert().map(u);r.push({oldRange:{from:d,to:f},newRange:{from:c,to:u}})})}),SB(r)}function Jg(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(o=>{const s=n.resolve(t),i=Wg(s,o.type);i&&r.push({mark:o,...i})}):n.nodesBetween(t,e,(o,s)=>{!o||o?.nodeSize===void 0||r.push(...o.marks.map(i=>({from:s,to:s+o.nodeSize,mark:i})))}),r}var kB=(t,e,n,r=20)=>{const o=t.doc.resolve(n);let s=r,i=null;for(;s>0&&i===null;){const a=o.node(s);a?.type.name===e?i=a:s-=1}return[i,s]};function wh(t,e){return e.nodes[t]||e.marks[t]||null}function Gc(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const o=t.find(s=>s.type===e&&s.name===r);return o?o.attribute.keepOnSplit:!1}))}var TB=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(o,s,i,a)=>{var l,c;const u=((c=(l=o.type.spec).toText)==null?void 0:c.call(l,{node:o,pos:s,parent:i,index:a}))||o.textContent||"%leaf%";n+=o.isAtom&&!o.isText?u:u.slice(0,Math.max(0,r-s))}),n};function Yp(t,e,n={}){const{empty:r,ranges:o}=t.selection,s=e?xo(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(d=>s?s.name===d.type.name:!0).find(d=>ku(d.attrs,n,{strict:!1}));let i=0;const a=[];if(o.forEach(({$from:d,$to:f})=>{const h=d.pos,p=f.pos;t.doc.nodesBetween(h,p,(m,y)=>{if(!m.isText&&!m.marks.length)return;const v=Math.max(h,y),w=Math.min(p,y+m.nodeSize),E=w-v;i+=E,a.push(...m.marks.map(x=>({mark:x,from:v,to:w})))})}),i===0)return!1;const l=a.filter(d=>s?s.name===d.mark.type.name:!0).filter(d=>ku(d.mark.attrs,n,{strict:!1})).reduce((d,f)=>d+f.to-f.from,0),c=a.filter(d=>s?d.mark.type!==s&&d.mark.type.excludes(s):!0).reduce((d,f)=>d+f.to-f.from,0);return(l>0?l+c:l)>=i}function CB(t,e,n={}){if(!e)return Xo(t,null,n)||Yp(t,null,n);const r=Yd(e,t.schema);return r==="node"?Xo(t,e,n):r==="mark"?Yp(t,e,n):!1}var AB=(t,e)=>{const{$from:n,$to:r,$anchor:o}=t.selection;if(e){const s=Jd(a=>a.type.name===e)(t.selection);if(!s)return!1;const i=t.doc.resolve(s.pos+1);return o.pos+1===i.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},MB=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function R0(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function N0(t,e){const{nodeExtensions:n}=el(e),r=n.find(i=>i.name===t);if(!r)return!1;const o={name:r.name,options:r.options,storage:r.storage},s=qe(fe(r,"group",o));return typeof s!="string"?!1:s.split(" ").includes("list")}function Xd(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((r=t.text)!=null?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let o=!0;return t.content.forEach(s=>{o!==!1&&(Xd(s,{ignoreWhitespace:n,checkChildren:e})||(o=!1))}),o}return!1}function cT(t){return t instanceof ue}function OB(t,e,n){var r;const{selection:o}=e;let s=null;if(J1(o)&&(s=o.$cursor),s){const a=(r=t.storedMarks)!=null?r:s.marks();return s.parent.type.allowsMarkType(n)&&(!!n.isInSet(a)||!a.some(c=>c.type.excludes(n)))}const{ranges:i}=o;return i.some(({$from:a,$to:l})=>{let c=a.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(a.pos,l.pos,(u,d,f)=>{if(c)return!1;if(u.isInline){const h=!f||f.type.allowsMarkType(n),p=!!n.isInSet(u.marks)||!u.marks.some(m=>m.type.excludes(n));c=h&&p}return!c}),c})}var RB=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const{selection:s}=n,{empty:i,ranges:a}=s,l=xo(t,r.schema);if(o)if(i){const c=eT(r,l);n.addStoredMark(l.create({...c,...e}))}else a.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;r.doc.nodesBetween(u,d,(f,h)=>{const p=Math.max(h,u),m=Math.min(h+f.nodeSize,d);f.marks.find(v=>v.type===l)?f.marks.forEach(v=>{l===v.type&&n.addMark(p,m,l.create({...v.attrs,...e}))}):n.addMark(p,m,l.create(e))})});return OB(r,n,l)},NB=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),_B=(t,e={})=>({state:n,dispatch:r,chain:o})=>{const s=St(t,n.schema);let i;return n.selection.$anchor.sameParent(n.selection.$head)&&(i=n.selection.$anchor.parent.attrs),s.isTextblock?o().command(({commands:a})=>Gb(s,{...i,...e})(n)?!0:a.clearNodes()).command(({state:a})=>Gb(s,{...i,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},DB=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,o=Es(t,0,r.content.size),s=ue.create(r,o);e.setSelection(s)}return!0},IB=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:o,to:s}=typeof t=="number"?{from:t,to:t}:t,i=pe.atStart(r).from,a=pe.atEnd(r).to,l=Es(o,i,a),c=Es(s,i,a),u=pe.create(r,l,c);e.setSelection(u)}return!0},PB=t=>({state:e,dispatch:n})=>{const r=St(t,e.schema);return Ij(r)(e,n)};function _0(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(o=>e?.includes(o.type.name));t.tr.ensureMarks(r)}}var LB=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:o})=>{const{selection:s,doc:i}=e,{$from:a,$to:l}=s,c=o.extensionManager.attributes,u=Gc(c,a.node().type.name,a.node().attrs);if(s instanceof ue&&s.node.isBlock)return!a.parentOffset||!ao(i,a.pos)?!1:(r&&(t&&_0(n,o.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const d=l.parentOffset===l.parent.content.size,f=a.depth===0?void 0:hB(a.node(-1).contentMatchAt(a.indexAfter(-1)));let h=d&&f?[{type:f,attrs:u}]:void 0,p=ao(e.doc,e.mapping.map(a.pos),1,h);if(!h&&!p&&ao(e.doc,e.mapping.map(a.pos),1,f?[{type:f}]:void 0)&&(p=!0,h=f?[{type:f,attrs:u}]:void 0),r){if(p&&(s instanceof pe&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,h),f&&!d&&!a.parentOffset&&a.parent.type!==f)){const m=e.mapping.map(a.before()),y=e.doc.resolve(m);a.node(-1).canReplaceWith(y.index(),y.index()+1,f)&&e.setNodeMarkup(e.mapping.map(a.before()),f)}t&&_0(n,o.extensionManager.splittableMarks),e.scrollIntoView()}return p},jB=(t,e={})=>({tr:n,state:r,dispatch:o,editor:s})=>{var i;const a=St(t,r.schema),{$from:l,$to:c}=r.selection,u=r.selection.node;if(u&&u.isBlock||l.depth<2||!l.sameParent(c))return!1;const d=l.node(-1);if(d.type!==a)return!1;const f=s.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(o){let v=F.empty;const w=l.index(-1)?1:l.index(-2)?2:3;for(let C=l.depth-w;C>=l.depth-3;C-=1)v=F.from(l.node(C).copy(v));const E=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,x={...Gc(f,l.node().type.name,l.node().attrs),...e},T=((i=a.contentMatch.defaultType)==null?void 0:i.createAndFill(x))||void 0;v=v.append(F.from(a.createAndFill(null,T)||void 0));const S=l.before(l.depth-(w-1));n.replace(S,l.after(-E),new ee(v,4-w,0));let k=-1;n.doc.nodesBetween(S,n.doc.content.size,(C,N)=>{if(k>-1)return!1;C.isTextblock&&C.content.size===0&&(k=N+1)}),k>-1&&n.setSelection(pe.near(n.doc.resolve(k))),n.scrollIntoView()}return!0}const h=c.pos===l.end()?d.contentMatchAt(0).defaultType:null,p={...Gc(f,d.type.name,d.attrs),...e},m={...Gc(f,l.node().type.name,l.node().attrs),...e};n.delete(l.pos,c.pos);const y=h?[{type:a,attrs:p},{type:h,attrs:m}]:[{type:a,attrs:p}];if(!ao(n.doc,l.pos,2))return!1;if(o){const{selection:v,storedMarks:w}=r,{splittableMarks:E}=s.extensionManager,x=w||v.$to.parentOffset&&v.$from.marks();if(n.split(l.pos,2,y).scrollIntoView(),!x||!o)return!0;const T=x.filter(S=>E.includes(S.type.name));n.ensureMarks(T)}return!0},Eh=(t,e)=>{const n=Jd(i=>i.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const o=t.doc.nodeAt(r);return n.node.type===o?.type&&as(t.doc,n.pos)&&t.join(n.pos),!0},Sh=(t,e)=>{const n=Jd(i=>i.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const o=t.doc.nodeAt(r);return n.node.type===o?.type&&as(t.doc,r)&&t.join(r),!0},$B=(t,e,n,r={})=>({editor:o,tr:s,state:i,dispatch:a,chain:l,commands:c,can:u})=>{const{extensions:d,splittableMarks:f}=o.extensionManager,h=St(t,i.schema),p=St(e,i.schema),{selection:m,storedMarks:y}=i,{$from:v,$to:w}=m,E=v.blockRange(w),x=y||m.$to.parentOffset&&m.$from.marks();if(!E)return!1;const T=Jd(S=>N0(S.type.name,d))(m);if(E.depth>=1&&T&&E.depth-T.depth<=1){if(T.node.type===h)return c.liftListItem(p);if(N0(T.node.type.name,d)&&h.validContent(T.node.content)&&a)return l().command(()=>(s.setNodeMarkup(T.pos,h),!0)).command(()=>Eh(s,h)).command(()=>Sh(s,h)).run()}return!n||!x||!a?l().command(()=>u().wrapInList(h,r)?!0:c.clearNodes()).wrapInList(h,r).command(()=>Eh(s,h)).command(()=>Sh(s,h)).run():l().command(()=>{const S=u().wrapInList(h,r),k=x.filter(C=>f.includes(C.type.name));return s.ensureMarks(k),S?!0:c.clearNodes()}).wrapInList(h,r).command(()=>Eh(s,h)).command(()=>Sh(s,h)).run()},BB=(t,e={},n={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:s=!1}=n,i=xo(t,r.schema);return Yp(r,i,e)?o.unsetMark(i,{extendEmptyMarkRange:s}):o.setMark(i,e)},FB=(t,e,n={})=>({state:r,commands:o})=>{const s=St(t,r.schema),i=St(e,r.schema),a=Xo(r,s,n);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),a?o.setNode(i,l):o.setNode(s,{...l,...n})},HB=(t,e={})=>({state:n,commands:r})=>{const o=St(t,n.schema);return Xo(n,o,e)?r.lift(o):r.wrapIn(o,e)},UB=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const o=n[r];let s;if(o.spec.isInputRules&&(s=o.getState(t))){if(e){const i=t.tr,a=s.transform;for(let l=a.steps.length-1;l>=0;l-=1)i.step(a.steps[l].invert(a.docs[l]));if(s.text){const l=i.doc.resolve(s.from).marks();i.replaceWith(s.from,s.to,t.schema.text(s.text,l))}else i.delete(s.from,s.to)}return!0}}return!1},zB=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:o}=n;return r||e&&o.forEach(s=>{t.removeMark(s.$from.pos,s.$to.pos)}),!0},VB=(t,e={})=>({tr:n,state:r,dispatch:o})=>{var s;const{extendEmptyMarkRange:i=!1}=e,{selection:a}=n,l=xo(t,r.schema),{$from:c,empty:u,ranges:d}=a;if(!o)return!0;if(u&&i){let{from:f,to:h}=a;const p=(s=c.marks().find(y=>y.type===l))==null?void 0:s.attrs,m=Wg(c,l,p);m&&(f=m.from,h=m.to),n.removeMark(f,h,l)}else d.forEach(f=>{n.removeMark(f.$from.pos,f.$to.pos,l)});return n.removeStoredMark(l),!0},WB=(t,e={})=>({tr:n,state:r,dispatch:o})=>{let s=null,i=null;const a=Yd(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(s=St(t,r.schema)),a==="mark"&&(i=xo(t,r.schema)),o&&n.selection.ranges.forEach(l=>{const c=l.$from.pos,u=l.$to.pos;let d,f,h,p;n.selection.empty?r.doc.nodesBetween(c,u,(m,y)=>{s&&s===m.type&&(h=Math.max(y,c),p=Math.min(y+m.nodeSize,u),d=y,f=m)}):r.doc.nodesBetween(c,u,(m,y)=>{y<c&&s&&s===m.type&&(h=Math.max(y,c),p=Math.min(y+m.nodeSize,u),d=y,f=m),y>=c&&y<=u&&(s&&s===m.type&&n.setNodeMarkup(y,void 0,{...m.attrs,...e}),i&&m.marks.length&&m.marks.forEach(v=>{if(i===v.type){const w=Math.max(y,c),E=Math.min(y+m.nodeSize,u);n.addMark(w,E,i.create({...v.attrs,...e}))}}))}),f&&(d!==void 0&&n.setNodeMarkup(d,void 0,{...f.attrs,...e}),i&&f.marks.length&&f.marks.forEach(m=>{i===m.type&&n.addMark(h,p,i.create({...m.attrs,...e}))}))}),!0):!1},GB=(t,e={})=>({state:n,dispatch:r})=>{const o=St(t,n.schema);return Aj(o,e)(n,r)},qB=(t,e={})=>({state:n,dispatch:r})=>{const o=St(t,n.schema);return Mj(o,e)(n,r)},KB=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}},Qd=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},YB=(t,e)=>{if(Vg(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function yc(t){var e;const{editor:n,from:r,to:o,text:s,rules:i,plugin:a}=t,{view:l}=n;if(l.composing)return!1;const c=l.state.doc.resolve(r);if(c.parent.type.spec.code||(e=c.nodeBefore||c.nodeAfter)!=null&&e.marks.find(f=>f.type.spec.code))return!1;let u=!1;const d=TB(c)+s;return i.forEach(f=>{if(u)return;const h=YB(d,f.find);if(!h)return;const p=l.state.tr,m=qd({state:l.state,transaction:p}),y={from:r-(h[0].length-s.length),to:o},{commands:v,chain:w,can:E}=new Kd({editor:n,state:m});f.handler({state:m,range:y,match:h,commands:v,chain:w,can:E})===null||!p.steps.length||(f.undoable&&p.setMeta(a,{transform:p,from:r,to:o,text:s}),l.dispatch(p),u=!0)}),u}function JB(t){const{editor:e,rules:n}=t,r=new Ue({state:{init(){return null},apply(o,s,i){const a=o.getMeta(r);if(a)return a;const l=o.getMeta("applyInputRules");return!!l&&setTimeout(()=>{let{text:u}=l;typeof u=="string"?u=u:u=Kg(F.from(u),i.schema);const{from:d}=l,f=d+u.length;yc({editor:e,from:d,to:f,text:u,rules:n,plugin:r})}),o.selectionSet||o.docChanged?null:s}},props:{handleTextInput(o,s,i,a){return yc({editor:e,from:s,to:i,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:o=>(setTimeout(()=>{const{$cursor:s}=o.state.selection;s&&yc({editor:e,from:s.pos,to:s.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(o,s){if(s.key!=="Enter")return!1;const{$cursor:i}=o.state.selection;return i?yc({editor:e,from:i.pos,to:i.pos,text:`
|
|
120
|
+
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function XB(t){return Object.prototype.toString.call(t).slice(8,-1)}function vc(t){return XB(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function uT(t,e){const n={...t};return vc(t)&&vc(e)&&Object.keys(e).forEach(r=>{vc(e[r])&&vc(t[r])?n[r]=uT(t[r],e[r]):n[r]=e[r]}),n}var Xg=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...qe(fe(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...qe(fe(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>uT(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},wo=class dT extends Xg{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new dT(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,o=e.state.selection.$from;if(o.pos===o.end()){const i=o.marks();if(!!!i.find(c=>c?.type.name===n.name))return!1;const l=i.find(c=>c?.type.name===n.name);return l&&r.removeStoredMark(l),r.insertText(" ",o.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function QB(t){return typeof t=="number"}var ZB=class{constructor(t){this.find=t.find,this.handler=t.handler}},eF=(t,e,n)=>{if(Vg(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(o=>{const s=[o.text];return s.index=o.index,s.input=t,s.data=o.data,o.replaceWith&&(o.text.includes(o.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(o.replaceWith)),s}):[]};function tF(t){const{editor:e,state:n,from:r,to:o,rule:s,pasteEvent:i,dropEvent:a}=t,{commands:l,chain:c,can:u}=new Kd({editor:e,state:n}),d=[];return n.doc.nodesBetween(r,o,(h,p)=>{var m,y,v,w,E;if((y=(m=h.type)==null?void 0:m.spec)!=null&&y.code||!(h.isText||h.isTextblock||h.isInline))return;const x=(E=(w=(v=h.content)==null?void 0:v.size)!=null?w:h.nodeSize)!=null?E:0,T=Math.max(r,p),S=Math.min(o,p+x);if(T>=S)return;const k=h.isText?h.text||"":h.textBetween(T-p,S-p,void 0,"");eF(k,s.find,i).forEach(N=>{if(N.index===void 0)return;const R=T+N.index+1,L=R+N[0].length,$={from:n.tr.mapping.map(R),to:n.tr.mapping.map(L)},B=s.handler({state:n,range:$,match:N,commands:l,chain:c,can:u,pasteEvent:i,dropEvent:a});d.push(B)})}),d.every(h=>h!==null)}var bc=null,nF=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function rF(t){const{editor:e,rules:n}=t;let r=null,o=!1,s=!1,i=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const l=({state:u,from:d,to:f,rule:h,pasteEvt:p})=>{const m=u.tr,y=qd({state:u,transaction:m});if(!(!tF({editor:e,state:y,from:Math.max(d-1,0),to:f.b-1,rule:h,pasteEvent:p,dropEvent:a})||!m.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return i=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m}};return n.map(u=>new Ue({view(d){const f=p=>{var m;r=(m=d.dom.parentElement)!=null&&m.contains(p.target)?d.dom.parentElement:null,r&&(bc=e)},h=()=>{bc&&(bc=null)};return window.addEventListener("dragstart",f),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",f),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(d,f)=>{if(s=r===d.dom.parentElement,a=f,!s){const h=bc;h?.isEditable&&setTimeout(()=>{const p=h.state.selection;p&&h.commands.deleteRange({from:p.from,to:p.to})},10)}return!1},paste:(d,f)=>{var h;const p=(h=f.clipboardData)==null?void 0:h.getData("text/html");return i=f,o=!!p?.includes("data-pm-slice"),!1}}},appendTransaction:(d,f,h)=>{const p=d[0],m=p.getMeta("uiEvent")==="paste"&&!o,y=p.getMeta("uiEvent")==="drop"&&!s,v=p.getMeta("applyPasteRules"),w=!!v;if(!m&&!y&&!w)return;if(w){let{text:T}=v;typeof T=="string"?T=T:T=Kg(F.from(T),h.schema);const{from:S}=v,k=S+T.length,C=nF(T);return l({rule:u,state:h,from:S,to:{b:k},pasteEvt:C})}const E=f.doc.content.findDiffStart(h.doc.content),x=f.doc.content.findDiffEnd(h.doc.content);if(!(!QB(E)||!x||E===x.b))return l({rule:u,state:h,from:E,to:x,pasteEvt:i})}}))}var Zd=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=oT(t),this.schema=vB(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:wh(e.name,this.schema)},r=fe(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return Yg([...this.extensions].reverse()).flatMap(r=>{const o={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:wh(r.name,this.schema)},s=[],i=fe(r,"addKeyboardShortcuts",o);let a={};if(r.type==="mark"&&fe(r,"exitable",o)&&(a.ArrowRight=()=>wo.handleExit({editor:t,mark:r})),i){const f=Object.fromEntries(Object.entries(i()).map(([h,p])=>[h,()=>p({editor:t})]));a={...a,...f}}const l=E$(a);s.push(l);const c=fe(r,"addInputRules",o);if(R0(r,t.options.enableInputRules)&&c){const f=c();if(f&&f.length){const h=JB({editor:t,rules:f}),p=Array.isArray(h)?h:[h];s.push(...p)}}const u=fe(r,"addPasteRules",o);if(R0(r,t.options.enablePasteRules)&&u){const f=u();if(f&&f.length){const h=rF({editor:t,rules:f});s.push(...h)}}const d=fe(r,"addProseMirrorPlugins",o);if(d){const f=d();s.push(...f)}return s})}get attributes(){return rT(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=el(this.extensions);return Object.fromEntries(e.filter(n=>!!fe(n,"addNodeView")).map(n=>{const r=this.attributes.filter(a=>a.type===n.name),o={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:St(n.name,this.schema)},s=fe(n,"addNodeView",o);if(!s)return[];const i=(a,l,c,u,d)=>{const f=tl(a,r);return s()({node:a,view:l,getPos:c,decorations:u,innerDecorations:d,editor:t,extension:n,HTMLAttributes:f})};return[n.name,i]}))}get markViews(){const{editor:t}=this,{markExtensions:e}=el(this.extensions);return Object.fromEntries(e.filter(n=>!!fe(n,"addMarkView")).map(n=>{const r=this.attributes.filter(a=>a.type===n.name),o={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:xo(n.name,this.schema)},s=fe(n,"addMarkView",o);if(!s)return[];const i=(a,l,c)=>{const u=tl(a,r);return s()({mark:a,view:l,inline:c,editor:t,extension:n,HTMLAttributes:u,updateAttributes:d=>{ST(a,t,d)}})};return[n.name,i]}))}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:wh(e.name,this.schema)};e.type==="mark"&&((n=qe(fe(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const o=fe(e,"onBeforeCreate",r),s=fe(e,"onCreate",r),i=fe(e,"onUpdate",r),a=fe(e,"onSelectionUpdate",r),l=fe(e,"onTransaction",r),c=fe(e,"onFocus",r),u=fe(e,"onBlur",r),d=fe(e,"onDestroy",r);o&&this.editor.on("beforeCreate",o),s&&this.editor.on("create",s),i&&this.editor.on("update",i),a&&this.editor.on("selectionUpdate",a),l&&this.editor.on("transaction",l),c&&this.editor.on("focus",c),u&&this.editor.on("blur",u),d&&this.editor.on("destroy",d)})}};Zd.resolve=oT;Zd.sort=Yg;Zd.flatten=qg;var oF={};zg(oF,{ClipboardTextSerializer:()=>hT,Commands:()=>pT,Delete:()=>mT,Drop:()=>gT,Editable:()=>yT,FocusEvents:()=>bT,Keymap:()=>xT,Paste:()=>wT,Tabindex:()=>ET,focusEventsPluginKey:()=>vT});var Qe=class fT extends Xg{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new fT(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},hT=Qe.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Ue({key:new We("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:o}=e,{ranges:s}=o,i=Math.min(...s.map(u=>u.$from.pos)),a=Math.max(...s.map(u=>u.$to.pos)),l=iT(n);return sT(r,{from:i,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),pT=Qe.create({name:"commands",addCommands(){return{...K1}}}),mT=Qe.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,o;const s=()=>{var i,a,l,c;if((c=(l=(a=(i=this.editor.options.coreExtensionOptions)==null?void 0:i.delete)==null?void 0:a.filterTransaction)==null?void 0:l.call(a,t))!=null?c:t.getMeta("y-sync$"))return;const u=tT(t.before,[t,...e]);lT(u).forEach(h=>{u.mapping.mapResult(h.oldRange.from).deletedAfter&&u.mapping.mapResult(h.oldRange.to).deletedBefore&&u.before.nodesBetween(h.oldRange.from,h.oldRange.to,(p,m)=>{const y=m+p.nodeSize-2,v=h.oldRange.from<=m&&y<=h.oldRange.to;this.editor.emit("delete",{type:"node",node:p,from:m,to:y,newFrom:u.mapping.map(m),newTo:u.mapping.map(y),deletedRange:h.oldRange,newRange:h.newRange,partial:!v,editor:this.editor,transaction:t,combinedTransform:u})})});const f=u.mapping;u.steps.forEach((h,p)=>{var m,y;if(h instanceof ur){const v=f.slice(p).map(h.from,-1),w=f.slice(p).map(h.to),E=f.invert().map(v,-1),x=f.invert().map(w),T=(m=u.doc.nodeAt(v-1))==null?void 0:m.marks.some(k=>k.eq(h.mark)),S=(y=u.doc.nodeAt(w))==null?void 0:y.marks.some(k=>k.eq(h.mark));this.editor.emit("delete",{type:"mark",mark:h.mark,from:h.from,to:h.to,deletedRange:{from:E,to:x},newRange:{from:v,to:w},partial:!!(S||T),editor:this.editor,transaction:t,combinedTransform:u})}})};(o=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||o?setTimeout(s,0):s()}}),gT=Qe.create({name:"drop",addProseMirrorPlugins(){return[new Ue({key:new We("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),yT=Qe.create({name:"editable",addProseMirrorPlugins(){return[new Ue({key:new We("editable"),props:{editable:()=>this.editor.options.editable}})]}}),vT=new We("focusEvents"),bT=Qe.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Ue({key:vT,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),xT=Qe.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:i})=>[()=>i.undoInputRule(),()=>i.command(({tr:a})=>{const{selection:l,doc:c}=a,{empty:u,$anchor:d}=l,{pos:f,parent:h}=d,p=d.parent.isTextblock&&f>0?a.doc.resolve(f-1):d,m=p.parent.type.spec.isolating,y=d.pos-d.parentOffset,v=m&&p.parent.childCount===1?y===d.pos:Oe.atStart(c).from===f;return!u||!h.type.isTextblock||h.textContent.length||!v||v&&d.parent.type.name==="paragraph"?!1:i.clearNodes()}),()=>i.deleteSelection(),()=>i.joinBackward(),()=>i.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:i})=>[()=>i.deleteSelection(),()=>i.deleteCurrentNode(),()=>i.joinForward(),()=>i.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:i})=>[()=>i.newlineInCode(),()=>i.createParagraphNear(),()=>i.liftEmptyBlock(),()=>i.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},o={...r},s={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return $l()||Z1()?s:o},addProseMirrorPlugins(){return[new Ue({key:new We("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(m=>m.getMeta("composition")))return;const r=t.some(m=>m.docChanged)&&!e.doc.eq(n.doc),o=t.some(m=>m.getMeta("preventClearDocument"));if(!r||o)return;const{empty:s,from:i,to:a}=e.selection,l=Oe.atStart(e.doc).from,c=Oe.atEnd(e.doc).to;if(s||!(i===l&&a===c)||!Xd(n.doc))return;const f=n.tr,h=qd({state:n,transaction:f}),{commands:p}=new Kd({editor:this.editor,state:h});if(p.clearNodes(),!!f.steps.length)return f}})]}}),wT=Qe.create({name:"paste",addProseMirrorPlugins(){return[new Ue({key:new We("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),ET=Qe.create({name:"tabindex",addProseMirrorPlugins(){return[new Ue({key:new We("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),sF=class pi{constructor(e,n,r=!1,o=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=o}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new pi(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new pi(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 pi(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const o=n.isBlock&&!n.isTextblock,s=n.isAtom&&!n.isText,i=this.pos+r+(s?0:1);if(i<0||i>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(i);if(!o&&a.depth<=this.depth)return;const l=new pi(a,this.editor,o,o?n:null);o&&(l.actualDepth=this.depth+1),e.push(new pi(a,this.editor,o,o?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,o=this.parent;for(;o&&!r;){if(o.node.type.name===e)if(Object.keys(n).length>0){const s=o.node.attrs,i=Object.keys(n);for(let a=0;a<i.length;a+=1){const l=i[a];if(s[l]!==n[l])break}}else r=o;o=o.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let o=[];if(!this.children||this.children.length===0)return o;const s=Object.keys(n);return this.children.forEach(i=>{r&&o.length>0||(i.node.type.name===e&&s.every(l=>n[l]===i.node.attrs[l])&&o.push(i),!(r&&o.length>0)&&(o=o.concat(i.querySelectorAll(e,n,r))))}),o}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},iF=`.ProseMirror {
|
|
121
|
+
position: relative;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.ProseMirror {
|
|
125
|
+
word-wrap: break-word;
|
|
126
|
+
white-space: pre-wrap;
|
|
127
|
+
white-space: break-spaces;
|
|
128
|
+
-webkit-font-variant-ligatures: none;
|
|
129
|
+
font-variant-ligatures: none;
|
|
130
|
+
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.ProseMirror [contenteditable="false"] {
|
|
134
|
+
white-space: normal;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
|
|
138
|
+
white-space: pre-wrap;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.ProseMirror pre {
|
|
142
|
+
white-space: pre-wrap;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
img.ProseMirror-separator {
|
|
146
|
+
display: inline !important;
|
|
147
|
+
border: none !important;
|
|
148
|
+
margin: 0 !important;
|
|
149
|
+
width: 0 !important;
|
|
150
|
+
height: 0 !important;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.ProseMirror-gapcursor {
|
|
154
|
+
display: none;
|
|
155
|
+
pointer-events: none;
|
|
156
|
+
position: absolute;
|
|
157
|
+
margin: 0;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.ProseMirror-gapcursor:after {
|
|
161
|
+
content: "";
|
|
162
|
+
display: block;
|
|
163
|
+
position: absolute;
|
|
164
|
+
top: -2px;
|
|
165
|
+
width: 20px;
|
|
166
|
+
border-top: 1px solid black;
|
|
167
|
+
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
@keyframes ProseMirror-cursor-blink {
|
|
171
|
+
to {
|
|
172
|
+
visibility: hidden;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.ProseMirror-hideselection *::selection {
|
|
177
|
+
background: transparent;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.ProseMirror-hideselection *::-moz-selection {
|
|
181
|
+
background: transparent;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.ProseMirror-hideselection * {
|
|
185
|
+
caret-color: transparent;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.ProseMirror-focused .ProseMirror-gapcursor {
|
|
189
|
+
display: block;
|
|
190
|
+
}`;function aF(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const o=document.createElement("style");return e&&o.setAttribute("nonce",e),o.setAttribute("data-tiptap-style",""),o.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(o),o}var lF=class extends KB{constructor(t={}){super(),this.css=null,this.editorView=null,this.isFocused=!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,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},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:r,slice:o,moved:s})=>this.options.onDrop(r,o,s)),this.on("paste",({event:r,slice:o})=>this.options.onPaste(r,o)),this.on("delete",this.options.onDelete);const e=this.createDoc(),n=X1(e,this.options.autofocus);this.editorState=yi.create({doc:e,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const t=this.editorView.dom;t?.editor&&delete t.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",t)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=aF(iF,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in t)return Reflect.get(t,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(t,e){const n=nT(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(o=>{const s=typeof o=="string"?`${o}$`:o.key;n=n.filter(i=>!i.key.startsWith(s))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e;const r=[...this.options.enableCoreExtensions?[yT,hT.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),pT,bT,xT,ET,gT,wT,mT].filter(o=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[o.name]!==!1:!0):[],...this.options.extensions].filter(o=>["extension","node","mark"].includes(o?.type));this.extensionManager=new Zd(r,this)}createCommandManager(){this.commandManager=new Kd({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=Kp(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(n=>n.name!=="collaboration"),this.createExtensionManager()}}),t=Kp(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return t}createView(t){var e;this.editorView=new G1(t,{...this.options.editorProps,attributes:{role:"textbox",...(e=this.options.editorProps)==null?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const n=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(n),this.prependClass(),this.injectCSS();const r=this.view.dom;r.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(c=>{var u;return(u=this.capturedTransaction)==null?void 0:u.step(c)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),o=n.includes(t),s=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!o)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const i=n.findLast(c=>c.getMeta("focus")||c.getMeta("blur")),a=i?.getMeta("focus"),l=i?.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:i}),l&&this.emit("blur",{editor:this,event:l.event,transaction:i}),!(t.getMeta("preventUpdate")||!n.some(c=>c.docChanged)||s.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return aT(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return CB(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Kg(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
|
|
191
|
+
|
|
192
|
+
`,textSerializers:n={}}=t||{};return xB(this.state.doc,{blockSeparator:e,textSerializers:{...iT(this.schema),...n}})}get isEmpty(){return Xd(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var t,e;return(e=(t=this.editorView)==null?void 0:t.isDestroyed)!=null?e:!0}$node(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t);return new sF(e,this)}get $doc(){return this.$pos(0)}};function _i(t){return new Qd({find:t.find,handler:({state:e,range:n,match:r})=>{const o=qe(t.getAttributes,void 0,r);if(o===!1||o===null)return null;const{tr:s}=e,i=r[r.length-1],a=r[0];if(i){const l=a.search(/\S/),c=n.from+a.indexOf(i),u=c+i.length;if(Jg(n.from,n.to,e.doc).filter(h=>h.mark.type.excluded.find(m=>m===t.type&&m!==h.mark.type)).filter(h=>h.to>c).length)return null;u<n.to&&s.delete(u,n.to),c>n.from&&s.delete(n.from+l,c);const f=n.from+l+i.length;s.addMark(n.from+l,f,t.type.create(o||{})),s.removeStoredMark(t.type)}},undoable:t.undoable})}function cF(t){return new Qd({find:t.find,handler:({state:e,range:n,match:r})=>{const o=qe(t.getAttributes,void 0,r)||{},{tr:s}=e,i=n.from;let a=n.to;const l=t.type.create(o);if(r[1]){const c=r[0].lastIndexOf(r[1]);let u=i+c;u>a?u=a:a=u+r[1].length;const d=r[0][r[0].length-1];s.insertText(d,i+r[0].length-1),s.replaceWith(u,a,l)}else if(r[0]){const c=t.type.isInline?i:i-1;s.insert(c,t.type.create(o)).delete(s.mapping.map(i),s.mapping.map(a))}s.scrollIntoView()},undoable:t.undoable})}function Jp(t){return new Qd({find:t.find,handler:({state:e,range:n,match:r})=>{const o=e.doc.resolve(n.from),s=qe(t.getAttributes,void 0,r)||{};if(!o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,s)},undoable:t.undoable})}function Di(t){return new Qd({find:t.find,handler:({state:e,range:n,match:r,chain:o})=>{const s=qe(t.getAttributes,void 0,r)||{},i=e.tr.delete(n.from,n.to),l=i.doc.resolve(n.from).blockRange(),c=l&&Ag(l,t.type,s);if(!c)return null;if(i.wrap(l,c),t.keepMarks&&t.editor){const{selection:d,storedMarks:f}=e,{splittableMarks:h}=t.editor.extensionManager,p=f||d.$to.parentOffset&&d.$from.marks();if(p){const m=p.filter(y=>h.includes(y.type.name));i.ensureMarks(m)}}if(t.keepAttributes){const d=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";o().updateAttributes(d,s).run()}const u=i.doc.resolve(n.from-1).nodeBefore;u&&u.type===t.type&&as(i.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,u))&&i.join(n.from-1)},undoable:t.undoable})}function uF(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof ue){const s=r.index();return r.parent.canReplaceWith(s,s+1,e)}let o=r.depth;for(;o>=0;){const s=r.index(o);if(r.node(o).contentMatchAt(s).matchType(e))return!0;o-=1}return!1}function dF(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}var fF={};zg(fF,{createAtomBlockMarkdownSpec:()=>hF,createBlockMarkdownSpec:()=>pF,createInlineMarkdownSpec:()=>yF,parseAttributes:()=>Qg,parseIndentedBlocks:()=>Xp,renderNestedMarkdownContent:()=>ey,serializeAttributes:()=>Zg});function Qg(t){if(!t?.trim())return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,c=>(n.push(c),`__QUOTED_${n.length-1}__`)),o=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(o){const c=o.map(u=>u.trim().slice(1));e.class=c.join(" ")}const s=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);s&&(e.id=s[1]);const i=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(i)).forEach(([,c,u])=>{var d;const f=parseInt(((d=u.match(/__QUOTED_(\d+)__/))==null?void 0:d[1])||"0",10),h=n[f];h&&(e[c]=h.slice(1,-1))});const l=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return l&&l.split(/\s+/).filter(Boolean).forEach(u=>{u.match(/^[a-zA-Z][\w-]*$/)&&(e[u]=!0)}),e}function Zg(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?e.push(n):r!==!1&&r!=null&&e.push(`${n}="${String(r)}"`))}),e.join(" ")}function hF(t){const{nodeName:e,name:n,parseAttributes:r=Qg,serializeAttributes:o=Zg,defaultAttributes:s={},requiredAttributes:i=[],allowedAttributes:a}=t,l=n||e,c=u=>{if(!a)return u;const d={};return a.forEach(f=>{f in u&&(d[f]=u[f])}),d};return{parseMarkdown:(u,d)=>{const f={...s,...u.attributes};return d.createNode(e,f,[])},markdownTokenizer:{name:e,level:"block",start(u){var d;const f=new RegExp(`^:::${l}(?:\\s|$)`,"m"),h=(d=u.match(f))==null?void 0:d.index;return h!==void 0?h:-1},tokenize(u,d,f){const h=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),p=u.match(h);if(!p)return;const m=p[1]||"",y=r(m);if(!i.find(w=>!(w in y)))return{type:e,raw:p[0],attributes:y}}},renderMarkdown:u=>{const d=c(u.attrs||{}),f=o(d),h=f?` {${f}}`:"";return`:::${l}${h} :::`}}}function pF(t){const{nodeName:e,name:n,getContent:r,parseAttributes:o=Qg,serializeAttributes:s=Zg,defaultAttributes:i={},content:a="block",allowedAttributes:l}=t,c=n||e,u=d=>{if(!l)return d;const f={};return l.forEach(h=>{h in d&&(f[h]=d[h])}),f};return{parseMarkdown:(d,f)=>{let h;if(r){const m=r(d);h=typeof m=="string"?[{type:"text",text:m}]:m}else a==="block"?h=f.parseChildren(d.tokens||[]):h=f.parseInline(d.tokens||[]);const p={...i,...d.attributes};return f.createNode(e,p,h)},markdownTokenizer:{name:e,level:"block",start(d){var f;const h=new RegExp(`^:::${c}`,"m"),p=(f=d.match(h))==null?void 0:f.index;return p!==void 0?p:-1},tokenize(d,f,h){var p;const m=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),y=d.match(m);if(!y)return;const[v,w=""]=y,E=o(w);let x=1;const T=v.length;let S="";const k=/^:::([\w-]*)(\s.*)?/gm,C=d.slice(T);for(k.lastIndex=0;;){const N=k.exec(C);if(N===null)break;const R=N.index,L=N[1];if(!((p=N[2])!=null&&p.endsWith(":::"))){if(L)x+=1;else if(x-=1,x===0){const $=C.slice(0,R);S=$.trim();const B=d.slice(0,T+R+N[0].length);let U=[];if(S)if(a==="block")for(U=h.blockTokens($),U.forEach(j=>{j.text&&(!j.tokens||j.tokens.length===0)&&(j.tokens=h.inlineTokens(j.text))});U.length>0;){const j=U[U.length-1];if(j.type==="paragraph"&&(!j.text||j.text.trim()===""))U.pop();else break}else U=h.inlineTokens(S);return{type:e,raw:B,attributes:E,content:S,tokens:U}}}}}},renderMarkdown:(d,f)=>{const h=u(d.attrs||{}),p=s(h),m=p?` {${p}}`:"",y=f.renderChildren(d.content||[],`
|
|
193
|
+
|
|
194
|
+
`);return`:::${c}${m}
|
|
195
|
+
|
|
196
|
+
${y}
|
|
197
|
+
|
|
198
|
+
:::`}}}function mF(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,o,s,i]=r;e[o]=s||i,r=n.exec(t)}return e}function gF(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function yF(t){const{nodeName:e,name:n,getContent:r,parseAttributes:o=mF,serializeAttributes:s=gF,defaultAttributes:i={},selfClosing:a=!1,allowedAttributes:l}=t,c=n||e,u=f=>{if(!l)return f;const h={};return l.forEach(p=>{p in f&&(h[p]=f[p])}),h},d=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(f,h)=>{const p={...i,...f.attributes};if(a)return h.createNode(e,p);const m=r?r(f):f.content||"";return m?h.createNode(e,p,[h.createTextNode(m)]):h.createNode(e,p,[])},markdownTokenizer:{name:e,level:"inline",start(f){const h=a?new RegExp(`\\[${d}\\s*[^\\]]*\\]`):new RegExp(`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),p=f.match(h),m=p?.index;return m!==void 0?m:-1},tokenize(f,h,p){const m=a?new RegExp(`^\\[${d}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),y=f.match(m);if(!y)return;let v="",w="";if(a){const[,x]=y;w=x}else{const[,x,T]=y;w=x,v=T||""}const E=o(w.trim());return{type:e,raw:y[0],content:v.trim(),attributes:E}}},renderMarkdown:f=>{let h="";r?h=r(f):f.content&&f.content.length>0&&(h=f.content.filter(v=>v.type==="text").map(v=>v.text).join(""));const p=u(f.attrs||{}),m=s(p),y=m?` ${m}`:"";return a?`[${c}${y}]`:`[${c}${y}]${h}[/${c}]`}}}function Xp(t,e,n){var r,o,s,i;const a=t.split(`
|
|
199
|
+
`),l=[];let c="",u=0;const d=e.baseIndentSize||2;for(;u<a.length;){const f=a[u],h=f.match(e.itemPattern);if(!h){if(l.length>0)break;if(f.trim()===""){u+=1;continue}else return}const p=e.extractItemData(h),{indentLevel:m,mainContent:y}=p;c=`${c}${f}
|
|
200
|
+
`;const v=[y];for(u+=1;u<a.length;){const T=a[u];if(T.trim()===""){const k=a.slice(u+1).findIndex(R=>R.trim()!=="");if(k===-1)break;if((((o=(r=a[u+1+k].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:o.length)||0)>m){v.push(T),c=`${c}${T}
|
|
201
|
+
`,u+=1;continue}else break}if((((i=(s=T.match(/^(\s*)/))==null?void 0:s[1])==null?void 0:i.length)||0)>m)v.push(T),c=`${c}${T}
|
|
202
|
+
`,u+=1;else break}let w;const E=v.slice(1);if(E.length>0){const T=E.map(S=>S.slice(m+d)).join(`
|
|
203
|
+
`);T.trim()&&(e.customNestedParser?w=e.customNestedParser(T):w=n.blockTokens(T))}const x=e.createToken(p,w);l.push(x)}if(l.length!==0)return{items:l,raw:c.trim()}}function ey(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const o=typeof n=="function"?n(r):n,[s,...i]=t.content,a=e.renderChildren([s]),l=[`${o}${a}`];return i&&i.length>0&&i.forEach(c=>{const u=e.renderChildren([c]);if(u){const d=u.split(`
|
|
204
|
+
`).map(f=>f?e.indent(f):"").join(`
|
|
205
|
+
`);l.push(d)}}),l.join(`
|
|
206
|
+
`)}function ST(t,e,n={}){const{state:r}=e,{doc:o,tr:s}=r,i=t;o.descendants((a,l)=>{const c=s.mapping.map(l),u=s.mapping.map(l)+a.nodeSize;let d=null;if(a.marks.forEach(h=>{if(h!==i)return!1;d=h}),!d)return;let f=!1;if(Object.keys(n).forEach(h=>{n[h]!==d.attrs[h]&&(f=!0)}),f){const h=t.type.create({...t.attrs,...n});s.removeMark(c,u,t.type),s.addMark(c,u,h)}}),s.docChanged&&e.view.dispatch(s)}var vF=class{constructor(t,e,n){this.component=t,this.editor=e.editor,this.options={...n},this.mark=e.mark,this.HTMLAttributes=e.HTMLAttributes}get dom(){return this.editor.view.dom}get contentDOM(){return null}updateAttributes(t,e){ST(e||this.mark,this.editor,t)}ignoreMutation(t){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:t}):t.type==="selection"||this.dom.contains(t.target)&&t.type==="childList"&&($l()||Gg())&&this.editor.isFocused&&[...Array.from(t.addedNodes),...Array.from(t.removedNodes)].every(n=>n.isContentEditable)?!1:this.contentDOM===t.target&&t.type==="attributes"?!0:!this.contentDOM.contains(t.target)}},_t=class kT extends Xg{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new kT(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},bF=class{constructor(t,e,n){this.isDragging=!1,this.component=t,this.editor=e.editor,this.options={stopEvent:null,ignoreMutation:null,...n},this.extension=e.extension,this.node=e.node,this.decorations=e.decorations,this.innerDecorations=e.innerDecorations,this.view=e.view,this.HTMLAttributes=e.HTMLAttributes,this.getPos=e.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(t){var e,n,r,o,s,i,a;const{view:l}=this.editor,c=t.target,u=c.nodeType===3?(e=c.parentElement)==null?void 0:e.closest("[data-drag-handle]"):c.closest("[data-drag-handle]");if(!this.dom||(n=this.contentDOM)!=null&&n.contains(c)||!u)return;let d=0,f=0;if(this.dom!==u){const w=this.dom.getBoundingClientRect(),E=u.getBoundingClientRect(),x=(o=t.offsetX)!=null?o:(r=t.nativeEvent)==null?void 0:r.offsetX,T=(i=t.offsetY)!=null?i:(s=t.nativeEvent)==null?void 0:s.offsetY;d=E.x-w.x+x,f=E.y-w.y+T}const h=this.dom.cloneNode(!0);try{const w=this.dom.getBoundingClientRect();h.style.width=`${Math.round(w.width)}px`,h.style.height=`${Math.round(w.height)}px`,h.style.boxSizing="border-box",h.style.pointerEvents="none"}catch{}let p=null;try{p=document.createElement("div"),p.style.position="absolute",p.style.top="-9999px",p.style.left="-9999px",p.style.pointerEvents="none",p.appendChild(h),document.body.appendChild(p),(a=t.dataTransfer)==null||a.setDragImage(h,d,f)}finally{p&&setTimeout(()=>{try{p?.remove()}catch{}},0)}const m=this.getPos();if(typeof m!="number")return;const y=ue.create(l.state.doc,m),v=l.state.tr.setSelection(y);l.dispatch(v)}stopEvent(t){var e;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:t});const n=t.target;if(!(this.dom.contains(n)&&!((e=this.contentDOM)!=null&&e.contains(n))))return!1;const o=t.type.startsWith("drag"),s=t.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!s&&!o)return!0;const{isEditable:a}=this.editor,{isDragging:l}=this,c=!!this.node.type.spec.draggable,u=ue.isSelectable(this.node),d=t.type==="copy",f=t.type==="paste",h=t.type==="cut",p=t.type==="mousedown";if(!c&&u&&o&&t.target===this.dom&&t.preventDefault(),c&&o&&!l&&t.target===this.dom)return t.preventDefault(),!1;if(c&&a&&!l&&p){const m=n.closest("[data-drag-handle]");m&&(this.dom===m||this.dom.contains(m))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(l||s||d||f||h||p&&u)}ignoreMutation(t){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:t}):this.node.isLeaf||this.node.isAtom?!0:t.type==="selection"||this.dom.contains(t.target)&&t.type==="childList"&&($l()||Gg())&&this.editor.isFocused&&[...Array.from(t.addedNodes),...Array.from(t.removedNodes)].every(n=>n.isContentEditable)?!1:this.contentDOM===t.target&&t.type==="attributes"?!0:!this.contentDOM.contains(t.target)}updateAttributes(t){this.editor.commands.command(({tr:e})=>{const n=this.getPos();return typeof n!="number"?!1:(e.setNodeMarkup(n,void 0,{...this.node.attrs,...t}),!0)})}deleteNode(){const t=this.getPos();if(typeof t!="number")return;const e=t+this.node.nodeSize;this.editor.commands.deleteRange({from:t,to:e})}};function js(t){return new ZB({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:o})=>{const s=qe(t.getAttributes,void 0,r,o);if(s===!1||s===null)return null;const{tr:i}=e,a=r[r.length-1],l=r[0];let c=n.to;if(a){const u=l.search(/\S/),d=n.from+l.indexOf(a),f=d+a.length;if(Jg(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(y=>y===t.type&&y!==p.mark.type)).filter(p=>p.to>d).length)return null;f<n.to&&i.delete(f,n.to),d>n.from&&i.delete(n.from+u,d),c=n.from+u+a.length,i.addMark(n.from+u,c,t.type.create(s||{})),i.removeStoredMark(t.type)}}})}var kh,D0;function xF(){return D0||(D0=1,kh=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var r,o,s;if(Array.isArray(e)){if(r=e.length,r!=n.length)return!1;for(o=r;o--!==0;)if(!t(e[o],n[o]))return!1;return!0}if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(o of e.entries())if(!n.has(o[0]))return!1;for(o of e.entries())if(!t(o[1],n.get(o[0])))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(o of e.entries())if(!n.has(o[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(n)){if(r=e.length,r!=n.length)return!1;for(o=r;o--!==0;)if(e[o]!==n[o])return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(s=Object.keys(e),r=s.length,r!==Object.keys(n).length)return!1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(n,s[o]))return!1;for(o=r;o--!==0;){var i=s[o];if(!(i==="_owner"&&e.$$typeof)&&!t(e[i],n[i]))return!1}return!0}return e!==e&&n!==n}),kh}var wF=xF();const EF=fg(wF);var xc={exports:{}},Th={};/**
|
|
207
|
+
* @license React
|
|
208
|
+
* use-sync-external-store-shim/with-selector.production.js
|
|
209
|
+
*
|
|
210
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
211
|
+
*
|
|
212
|
+
* This source code is licensed under the MIT license found in the
|
|
213
|
+
* LICENSE file in the root directory of this source tree.
|
|
214
|
+
*/var I0;function SF(){if(I0)return Th;I0=1;var t=M,e=Sg();function n(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var r=typeof Object.is=="function"?Object.is:n,o=e.useSyncExternalStore,s=t.useRef,i=t.useEffect,a=t.useMemo,l=t.useDebugValue;return Th.useSyncExternalStoreWithSelector=function(c,u,d,f,h){var p=s(null);if(p.current===null){var m={hasValue:!1,value:null};p.current=m}else m=p.current;p=a(function(){function v(S){if(!w){if(w=!0,E=S,S=f(S),h!==void 0&&m.hasValue){var k=m.value;if(h(k,S))return x=k}return x=S}if(k=x,r(E,S))return k;var C=f(S);return h!==void 0&&h(k,C)?(E=S,k):(E=S,x=C)}var w=!1,E,x,T=d===void 0?null:d;return[function(){return v(u())},T===null?void 0:function(){return v(T())}]},[u,d,f,h]);var y=o(c,p[0],p[1]);return i(function(){m.hasValue=!0,m.value=y},[y]),l(y),y},Th}var Ch={};/**
|
|
215
|
+
* @license React
|
|
216
|
+
* use-sync-external-store-shim/with-selector.development.js
|
|
217
|
+
*
|
|
218
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
219
|
+
*
|
|
220
|
+
* This source code is licensed under the MIT license found in the
|
|
221
|
+
* LICENSE file in the root directory of this source tree.
|
|
222
|
+
*/var P0;function kF(){return P0||(P0=1,process.env.NODE_ENV!=="production"&&(function(){function t(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var e=M,n=Sg(),r=typeof Object.is=="function"?Object.is:t,o=n.useSyncExternalStore,s=e.useRef,i=e.useEffect,a=e.useMemo,l=e.useDebugValue;Ch.useSyncExternalStoreWithSelector=function(c,u,d,f,h){var p=s(null);if(p.current===null){var m={hasValue:!1,value:null};p.current=m}else m=p.current;p=a(function(){function v(S){if(!w){if(w=!0,E=S,S=f(S),h!==void 0&&m.hasValue){var k=m.value;if(h(k,S))return x=k}return x=S}if(k=x,r(E,S))return k;var C=f(S);return h!==void 0&&h(k,C)?(E=S,k):(E=S,x=C)}var w=!1,E,x,T=d===void 0?null:d;return[function(){return v(u())},T===null?void 0:function(){return v(T())}]},[u,d,f,h]);var y=o(c,p[0],p[1]);return i(function(){m.hasValue=!0,m.value=y},[y]),l(y),y},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Ch}var L0;function TF(){return L0||(L0=1,process.env.NODE_ENV==="production"?xc.exports=SF():xc.exports=kF()),xc.exports}var CF=TF(),AF=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},MF=({contentComponent:t})=>{const e=kg.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return g.jsx(g.Fragment,{children:Object.values(e)})};function OF(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,r){e={...e,[n]:Al.createPortal(r.reactElement,r.element,n)},t.forEach(o=>o())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(o=>o())}}}var RF=class extends M.Component{constructor(t){var e;super(t),this.editorContentRef=M.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=t.editor)!=null&&e.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const t=this.props.editor;if(t&&!t.isDestroyed&&t.options.element){if(t.contentComponent)return;const e=this.editorContentRef.current;e.append(t.view.dom),t.setOptions({element:e}),t.contentComponent=OF(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=t.contentComponent.subscribe(()=>{this.setState(n=>n.hasContentComponentInitialized?n:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),t.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var t;const e=this.props.editor;if(e){this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null;try{if(!((t=e.view.dom)!=null&&t.firstChild))return;const n=document.createElement("div");n.append(e.view.dom),e.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return g.jsxs(g.Fragment,{children:[g.jsx("div",{ref:AF(e,this.editorContentRef),...n}),t?.contentComponent&&g.jsx(MF,{contentComponent:t.contentComponent})]})}},NF=M.forwardRef((t,e)=>{const n=M.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return M.createElement(RF,{key:n,innerRef:e,...t})}),_F=M.memo(NF),DF=typeof window<"u"?M.useLayoutEffect:M.useEffect,IF=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},n=this.editor;return n.on("transaction",e),()=>{n.off("transaction",e)}}}};function TT(t){var e;const[n]=M.useState(()=>new IF(t.editor)),r=CF.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:EF);return DF(()=>n.watch(t.editor),[t.editor,n]),M.useDebugValue(r),r}var j0=process.env.NODE_ENV!=="production",Qp=typeof window>"u",PF=Qp||!!(typeof window<"u"&&window.next),LF=class CT{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){if(this.options.current.immediatelyRender===void 0){if(Qp||PF){if(j0)throw new Error("Tiptap Error: SSR has been detected, please set `immediatelyRender` explicitly to `false` to avoid hydration mismatches.");return null}return this.createEditor()}if(this.options.current.immediatelyRender&&Qp&&j0)throw new Error("Tiptap Error: SSR has been detected, and `immediatelyRender` has been set to `true` this is an unsupported configuration that may result in errors, explicitly set `immediatelyRender` to `false` to avoid hydration mismatches.");return this.options.current.immediatelyRender?this.createEditor():null}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var o,s;return(s=(o=this.options.current).onBeforeCreate)==null?void 0:s.call(o,...r)},onBlur:(...r)=>{var o,s;return(s=(o=this.options.current).onBlur)==null?void 0:s.call(o,...r)},onCreate:(...r)=>{var o,s;return(s=(o=this.options.current).onCreate)==null?void 0:s.call(o,...r)},onDestroy:(...r)=>{var o,s;return(s=(o=this.options.current).onDestroy)==null?void 0:s.call(o,...r)},onFocus:(...r)=>{var o,s;return(s=(o=this.options.current).onFocus)==null?void 0:s.call(o,...r)},onSelectionUpdate:(...r)=>{var o,s;return(s=(o=this.options.current).onSelectionUpdate)==null?void 0:s.call(o,...r)},onTransaction:(...r)=>{var o,s;return(s=(o=this.options.current).onTransaction)==null?void 0:s.call(o,...r)},onUpdate:(...r)=>{var o,s;return(s=(o=this.options.current).onUpdate)==null?void 0:s.call(o,...r)},onContentError:(...r)=>{var o,s;return(s=(o=this.options.current).onContentError)==null?void 0:s.call(o,...r)},onDrop:(...r)=>{var o,s;return(s=(o=this.options.current).onDrop)==null?void 0:s.call(o,...r)},onPaste:(...r)=>{var o,s;return(s=(o=this.options.current).onPaste)==null?void 0:s.call(o,...r)},onDelete:(...r)=>{var o,s;return(s=(o=this.options.current).onDelete)==null?void 0:s.call(o,...r)}};return new lF(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((o,s)=>{var i;return o===((i=n.extensions)==null?void 0:i[s])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?CT.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,o)=>r===e[o]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function jF(t={},e=[]){const n=M.useRef(t);n.current=t;const[r]=M.useState(()=>new LF(n)),o=kg.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return M.useDebugValue(o),M.useEffect(r.onRender(e)),TT({editor:o,selector:({transactionNumber:s})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&s===0?0:s+1}),o}var ty=M.createContext({editor:null});ty.Consumer;var ef=()=>M.useContext(ty),AT=M.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),MT=()=>M.useContext(AT);function $0({as:t="div",...e}){const{nodeViewContentRef:n,nodeViewContentChildren:r}=MT();return g.jsx(t,{...e,ref:n,"data-node-view-content":"",style:{whiteSpace:"pre-wrap",...e.style},children:r})}var Qo=M.forwardRef((t,e)=>{const{onDragStart:n}=MT(),r=t.as||"div";return g.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});function B0(t){return!!(typeof t=="function"&&t.prototype&&t.prototype.isReactComponent)}function F0(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.forward_ref)"||t.$$typeof.description==="react.forward_ref"))}function $F(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.memo)"||t.$$typeof.description==="react.memo"))}function BF(t){if(B0(t)||F0(t))return!0;if($F(t)){const e=t.type;if(e)return B0(e)||F0(e)}return!1}function FF(){try{if(M.version)return parseInt(M.version.split(".")[0],10)>=19}catch{}return!1}var ny=class{constructor(t,{editor:e,props:n={},as:r="div",className:o=""}){this.ref=null,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=t,this.editor=e,this.props=n,this.element=document.createElement(r),this.element.classList.add("react-renderer"),o&&this.element.classList.add(...o.split(" ")),this.editor.isInitialized?Al.flushSync(()=>{this.render()}):queueMicrotask(()=>{this.render()})}render(){var t;const e=this.component,n=this.props,r=this.editor,o=FF(),s=BF(e),i={...n};i.ref&&!(o||s)&&delete i.ref,!i.ref&&(o||s)&&(i.ref=a=>{this.ref=a}),this.reactElement=g.jsx(e,{...i}),(t=r?.contentComponent)==null||t.setRenderer(this.id,this)}updateProps(t={}){this.props={...this.props,...t},this.render()}destroy(){var t;const e=this.editor;(t=e?.contentComponent)==null||t.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(t){Object.keys(t).forEach(e=>{this.element.setAttribute(e,t[e])})}},OT=M.createContext({markViewContentRef:()=>{}}),HF=t=>{const{as:e="span",...n}=t,{markViewContentRef:r}=M.useContext(OT);return g.jsx(e,{...n,ref:r,"data-mark-view-content":""})},UF=class extends vF{constructor(t,e,n){super(t,e,n);const{as:r="span",attrs:o,className:s=""}=n||{},i={...e,updateAttributes:this.updateAttributes.bind(this)};this.contentDOMElement=document.createElement("span");const l={markViewContentRef:u=>{u&&!u.contains(this.contentDOMElement)&&u.appendChild(this.contentDOMElement)}},c=M.memo(u=>g.jsx(OT.Provider,{value:l,children:M.createElement(t,u)}));c.displayName="ReactMarkView",this.renderer=new ny(c,{editor:e.editor,props:i,as:r,className:`mark-${e.mark.type.name} ${s}`.trim()}),o&&this.renderer.updateAttributes(o)}get dom(){return this.renderer.element}get contentDOM(){return this.contentDOMElement}};function zF(t,e={}){return n=>new UF(t,n,e)}var VF=class extends bF{constructor(t,e,n){if(super(t,e,n),!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const r=this.dom.querySelector("[data-node-view-content]");if(!r)return;r.appendChild(this.contentDOMElement)}}mount(){const t={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extension,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(l={})=>this.updateAttributes(l),deleteNode:()=>this.deleteNode(),ref:M.createRef()};if(!this.component.displayName){const l=c=>c.charAt(0).toUpperCase()+c.substring(1);this.component.displayName=l(this.extension.name)}const r={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:l=>{l&&this.contentDOMElement&&l.firstChild!==this.contentDOMElement&&(l.hasAttribute("data-node-view-wrapper")&&l.removeAttribute("data-node-view-wrapper"),l.appendChild(this.contentDOMElement))}},o=this.component,s=M.memo(l=>g.jsx(AT.Provider,{value:r,children:M.createElement(o,l)}));s.displayName="ReactNodeView";let i=this.node.isInline?"span":"div";this.options.as&&(i=this.options.as);const{className:a=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new ny(s,{editor:this.editor,props:t,as:i,className:`node-${this.node.type.name} ${a}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes()}get dom(){var t;if(this.renderer.element.firstElementChild&&!((t=this.renderer.element.firstElementChild)!=null&&t.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){const{from:t,to:e}=this.editor.state.selection,n=this.getPos();if(typeof n=="number")if(t<=n&&e>=n+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}}update(t,e,n){const r=o=>{this.renderer.updateProps(o),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(t.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const o=this.node,s=this.decorations,i=this.innerDecorations;return this.node=t,this.decorations=e,this.innerDecorations=n,this.options.update({oldNode:o,oldDecorations:s,newNode:t,newDecorations:e,oldInnerDecorations:i,innerDecorations:n,updateProps:()=>r({node:t,decorations:e,innerDecorations:n})})}return t===this.node&&this.decorations===e&&this.innerDecorations===n||(this.node=t,this.decorations=e,this.innerDecorations=n,r({node:t,decorations:e,innerDecorations:n})),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.contentDOMElement=null}updateElementAttributes(){if(this.options.attrs){let t={};if(typeof this.options.attrs=="function"){const e=this.editor.extensionManager.attributes,n=tl(this.node,e);t=this.options.attrs({node:this.node,HTMLAttributes:n})}else t=this.options.attrs;this.renderer.updateAttributes(t)}}};function Bl(t,e){return n=>n.editor.contentComponent?new VF(t,n,e):{}}const ry=()=>{const{editor:t}=ef(),e=o=>{if(typeof window>"u"||typeof localStorage>"u"||!t||t.isEmpty)return;const s=t?.getJSON();localStorage.setItem(`${o}-draft`,JSON.stringify(s))},n=M.useCallback(o=>{const s=localStorage.getItem(`${o}-draft`);return s?JSON.parse(s):null},[]);return{saveCurrentTabContent:e,getTabContent:n,clearContent:()=>{yk(gt).forEach(s=>localStorage.removeItem(`${s.value}-draft`))}}},WF=yk(gt),GF=({editorTab:t,onSwitchEditorTab:e})=>{const{saveCurrentTabContent:n}=ry(),r=o=>{n(t),e(o)};return g.jsx(vk,{defaultValue:gt.Text,value:t,onValueChange:r,className:"w-full",children:g.jsx(bk,{className:"w-full rounded-none border-b",children:WF.map(o=>g.jsx(Rp,{value:o.value.toString(),children:o.label},o.value))})})},H0=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,U0=ik,oy=(t,e)=>n=>{var r;if(e?.variants==null)return U0(t,n?.class,n?.className);const{variants:o,defaultVariants:s}=e,i=Object.keys(o).map(c=>{const u=n?.[c],d=s?.[c];if(u===null)return null;const f=H0(u)||H0(d);return o[c][f]}),a=n&&Object.entries(n).reduce((c,u)=>{let[d,f]=u;return f===void 0||(c[d]=f),c},{}),l=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((c,u)=>{let{class:d,className:f,...h}=u;return Object.entries(h).every(p=>{let[m,y]=p;return Array.isArray(y)?y.includes({...s,...a}[m]):{...s,...a}[m]===y})?[...c,d,f]:c},[]);return U0(t,i,l,n?.class,n?.className)},qF=oy("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),Zn=b.forwardRef(({className:t,variant:e,size:n,asChild:r=!1,...o},s)=>{const i=r?DI:"button";return g.jsx(i,{className:re(qF({variant:e,size:n,className:t})),ref:s,...o})});Zn.displayName="Button";function KF(t,e=globalThis?.document){const n=pr(t);b.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var YF="DismissableLayer",Zp="dismissableLayer.update",JF="dismissableLayer.pointerDownOutside",XF="dismissableLayer.focusOutside",z0,RT=b.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Xi=b.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:i,onDismiss:a,...l}=t,c=b.useContext(RT),[u,d]=b.useState(null),f=u?.ownerDocument??globalThis?.document,[,h]=b.useState({}),p=Fe(e,k=>d(k)),m=Array.from(c.layers),[y]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),v=m.indexOf(y),w=u?m.indexOf(u):-1,E=c.layersWithOutsidePointerEventsDisabled.size>0,x=w>=v,T=eH(k=>{const C=k.target,N=[...c.branches].some(R=>R.contains(C));!x||N||(o?.(k),i?.(k),k.defaultPrevented||a?.())},f),S=tH(k=>{const C=k.target;[...c.branches].some(R=>R.contains(C))||(s?.(k),i?.(k),k.defaultPrevented||a?.())},f);return KF(k=>{w===c.layers.size-1&&(r?.(k),!k.defaultPrevented&&a&&(k.preventDefault(),a()))},f),b.useEffect(()=>{if(u)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(z0=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),V0(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=z0)}},[u,f,n,c]),b.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),V0())},[u,c]),b.useEffect(()=>{const k=()=>h({});return document.addEventListener(Zp,k),()=>document.removeEventListener(Zp,k)},[]),g.jsx(ge.div,{...l,ref:p,style:{pointerEvents:E?x?"auto":"none":void 0,...t.style},onFocusCapture:ne(t.onFocusCapture,S.onFocusCapture),onBlurCapture:ne(t.onBlurCapture,S.onBlurCapture),onPointerDownCapture:ne(t.onPointerDownCapture,T.onPointerDownCapture)})});Xi.displayName=YF;var QF="DismissableLayerBranch",ZF=b.forwardRef((t,e)=>{const n=b.useContext(RT),r=b.useRef(null),o=Fe(e,r);return b.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),g.jsx(ge.div,{...t,ref:o})});ZF.displayName=QF;function eH(t,e=globalThis?.document){const n=pr(t),r=b.useRef(!1),o=b.useRef(()=>{});return b.useEffect(()=>{const s=a=>{if(a.target&&!r.current){let l=function(){NT(JF,n,c,{discrete:!0})};const c={originalEvent:a};a.pointerType==="touch"?(e.removeEventListener("click",o.current),o.current=l,e.addEventListener("click",o.current,{once:!0})):l()}else e.removeEventListener("click",o.current);r.current=!1},i=window.setTimeout(()=>{e.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(i),e.removeEventListener("pointerdown",s),e.removeEventListener("click",o.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function tH(t,e=globalThis?.document){const n=pr(t),r=b.useRef(!1);return b.useEffect(()=>{const o=s=>{s.target&&!r.current&&NT(XF,n,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",o),()=>e.removeEventListener("focusin",o)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function V0(){const t=new CustomEvent(Zp);document.dispatchEvent(t)}function NT(t,e,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&o.addEventListener(t,e,{once:!0}),r?IS(o,s):o.dispatchEvent(s)}const nH=["top","right","bottom","left"],Zo=Math.min,Nn=Math.max,Tu=Math.round,wc=Math.floor,jr=t=>({x:t,y:t}),rH={left:"right",right:"left",bottom:"top",top:"bottom"},oH={start:"end",end:"start"};function em(t,e,n){return Nn(t,Zo(e,n))}function mo(t,e){return typeof t=="function"?t(e):t}function go(t){return t.split("-")[0]}function Qi(t){return t.split("-")[1]}function sy(t){return t==="x"?"y":"x"}function iy(t){return t==="y"?"height":"width"}const sH=new Set(["top","bottom"]);function Lr(t){return sH.has(go(t))?"y":"x"}function ay(t){return sy(Lr(t))}function iH(t,e,n){n===void 0&&(n=!1);const r=Qi(t),o=ay(t),s=iy(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(i=Cu(i)),[i,Cu(i)]}function aH(t){const e=Cu(t);return[tm(t),e,tm(e)]}function tm(t){return t.replace(/start|end/g,e=>oH[e])}const W0=["left","right"],G0=["right","left"],lH=["top","bottom"],cH=["bottom","top"];function uH(t,e,n){switch(t){case"top":case"bottom":return n?e?G0:W0:e?W0:G0;case"left":case"right":return e?lH:cH;default:return[]}}function dH(t,e,n,r){const o=Qi(t);let s=uH(go(t),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),e&&(s=s.concat(s.map(tm)))),s}function Cu(t){return t.replace(/left|right|bottom|top/g,e=>rH[e])}function fH(t){return{top:0,right:0,bottom:0,left:0,...t}}function _T(t){return typeof t!="number"?fH(t):{top:t,right:t,bottom:t,left:t}}function Au(t){const{x:e,y:n,width:r,height:o}=t;return{width:r,height:o,top:n,left:e,right:e+r,bottom:n+o,x:e,y:n}}function q0(t,e,n){let{reference:r,floating:o}=t;const s=Lr(e),i=ay(e),a=iy(i),l=go(e),c=s==="y",u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,f=r[a]/2-o[a]/2;let h;switch(l){case"top":h={x:u,y:r.y-o.height};break;case"bottom":h={x:u,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:d};break;case"left":h={x:r.x-o.width,y:d};break;default:h={x:r.x,y:r.y}}switch(Qi(e)){case"start":h[i]-=f*(n&&c?-1:1);break;case"end":h[i]+=f*(n&&c?-1:1);break}return h}const hH=async(t,e,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,a=s.filter(Boolean),l=await(i.isRTL==null?void 0:i.isRTL(e));let c=await i.getElementRects({reference:t,floating:e,strategy:o}),{x:u,y:d}=q0(c,r,l),f=r,h={},p=0;for(let m=0;m<a.length;m++){const{name:y,fn:v}=a[m],{x:w,y:E,data:x,reset:T}=await v({x:u,y:d,initialPlacement:r,placement:f,strategy:o,middlewareData:h,rects:c,platform:i,elements:{reference:t,floating:e}});u=w??u,d=E??d,h={...h,[y]:{...h[y],...x}},T&&p<=50&&(p++,typeof T=="object"&&(T.placement&&(f=T.placement),T.rects&&(c=T.rects===!0?await i.getElementRects({reference:t,floating:e,strategy:o}):T.rects),{x:u,y:d}=q0(c,f,l)),m=-1)}return{x:u,y:d,placement:f,strategy:o,middlewareData:h}};async function nl(t,e){var n;e===void 0&&(e={});const{x:r,y:o,platform:s,rects:i,elements:a,strategy:l}=t,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:h=0}=mo(e,t),p=_T(h),y=a[f?d==="floating"?"reference":"floating":d],v=Au(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(y)))==null||n?y:y.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),w=d==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,E=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),x=await(s.isElement==null?void 0:s.isElement(E))?await(s.getScale==null?void 0:s.getScale(E))||{x:1,y:1}:{x:1,y:1},T=Au(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:w,offsetParent:E,strategy:l}):w);return{top:(v.top-T.top+p.top)/x.y,bottom:(T.bottom-v.bottom+p.bottom)/x.y,left:(v.left-T.left+p.left)/x.x,right:(T.right-v.right+p.right)/x.x}}const pH=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:o,rects:s,platform:i,elements:a,middlewareData:l}=e,{element:c,padding:u=0}=mo(t,e)||{};if(c==null)return{};const d=_T(u),f={x:n,y:r},h=ay(o),p=iy(h),m=await i.getDimensions(c),y=h==="y",v=y?"top":"left",w=y?"bottom":"right",E=y?"clientHeight":"clientWidth",x=s.reference[p]+s.reference[h]-f[h]-s.floating[p],T=f[h]-s.reference[h],S=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c));let k=S?S[E]:0;(!k||!await(i.isElement==null?void 0:i.isElement(S)))&&(k=a.floating[E]||s.floating[p]);const C=x/2-T/2,N=k/2-m[p]/2-1,R=Zo(d[v],N),L=Zo(d[w],N),$=R,B=k-m[p]-L,U=k/2-m[p]/2+C,j=em($,U,B),P=!l.arrow&&Qi(o)!=null&&U!==j&&s.reference[p]/2-(U<$?R:L)-m[p]/2<0,H=P?U<$?U-$:U-B:0;return{[h]:f[h]+H,data:{[h]:j,centerOffset:U-j-H,...P&&{alignmentOffset:H}},reset:P}}}),mH=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:m=!0,...y}=mo(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const v=go(o),w=Lr(a),E=go(a)===a,x=await(l.isRTL==null?void 0:l.isRTL(c.floating)),T=f||(E||!m?[Cu(a)]:aH(a)),S=p!=="none";!f&&S&&T.push(...dH(a,m,p,x));const k=[a,...T],C=await nl(e,y),N=[];let R=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&N.push(C[v]),d){const U=iH(o,i,x);N.push(C[U[0]],C[U[1]])}if(R=[...R,{placement:o,overflows:N}],!N.every(U=>U<=0)){var L,$;const U=(((L=s.flip)==null?void 0:L.index)||0)+1,j=k[U];if(j&&(!(d==="alignment"?w!==Lr(j):!1)||R.every(_=>Lr(_.placement)===w?_.overflows[0]>0:!0)))return{data:{index:U,overflows:R},reset:{placement:j}};let P=($=R.filter(H=>H.overflows[0]<=0).sort((H,_)=>H.overflows[1]-_.overflows[1])[0])==null?void 0:$.placement;if(!P)switch(h){case"bestFit":{var B;const H=(B=R.filter(_=>{if(S){const V=Lr(_.placement);return V===w||V==="y"}return!0}).map(_=>[_.placement,_.overflows.filter(V=>V>0).reduce((V,ie)=>V+ie,0)]).sort((_,V)=>_[1]-V[1])[0])==null?void 0:B[0];H&&(P=H);break}case"initialPlacement":P=a;break}if(o!==P)return{reset:{placement:P}}}return{}}}};function K0(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Y0(t){return nH.some(e=>t[e]>=0)}const gH=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:r="referenceHidden",...o}=mo(t,e);switch(r){case"referenceHidden":{const s=await nl(e,{...o,elementContext:"reference"}),i=K0(s,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:Y0(i)}}}case"escaped":{const s=await nl(e,{...o,altBoundary:!0}),i=K0(s,n.floating);return{data:{escapedOffsets:i,escaped:Y0(i)}}}default:return{}}}}},DT=new Set(["left","top"]);async function yH(t,e){const{placement:n,platform:r,elements:o}=t,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=go(n),a=Qi(n),l=Lr(n)==="y",c=DT.has(i)?-1:1,u=s&&l?-1:1,d=mo(e,t);let{mainAxis:f,crossAxis:h,alignmentAxis:p}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof p=="number"&&(h=a==="end"?p*-1:p),l?{x:h*u,y:f*c}:{x:f*c,y:h*u}}const vH=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:o,y:s,placement:i,middlewareData:a}=e,l=await yH(e,t);return i===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+l.x,y:s+l.y,data:{...l,placement:i}}}}},bH=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:o}=e,{mainAxis:s=!0,crossAxis:i=!1,limiter:a={fn:y=>{let{x:v,y:w}=y;return{x:v,y:w}}},...l}=mo(t,e),c={x:n,y:r},u=await nl(e,l),d=Lr(go(o)),f=sy(d);let h=c[f],p=c[d];if(s){const y=f==="y"?"top":"left",v=f==="y"?"bottom":"right",w=h+u[y],E=h-u[v];h=em(w,h,E)}if(i){const y=d==="y"?"top":"left",v=d==="y"?"bottom":"right",w=p+u[y],E=p-u[v];p=em(w,p,E)}const m=a.fn({...e,[f]:h,[d]:p});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[f]:s,[d]:i}}}}}},xH=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=e,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=mo(t,e),u={x:n,y:r},d=Lr(o),f=sy(d);let h=u[f],p=u[d];const m=mo(a,e),y=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const E=f==="y"?"height":"width",x=s.reference[f]-s.floating[E]+y.mainAxis,T=s.reference[f]+s.reference[E]-y.mainAxis;h<x?h=x:h>T&&(h=T)}if(c){var v,w;const E=f==="y"?"width":"height",x=DT.has(go(o)),T=s.reference[d]-s.floating[E]+(x&&((v=i.offset)==null?void 0:v[d])||0)+(x?0:y.crossAxis),S=s.reference[d]+s.reference[E]+(x?0:((w=i.offset)==null?void 0:w[d])||0)-(x?y.crossAxis:0);p<T?p=T:p>S&&(p=S)}return{[f]:h,[d]:p}}}},wH=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:o,rects:s,platform:i,elements:a}=e,{apply:l=()=>{},...c}=mo(t,e),u=await nl(e,c),d=go(o),f=Qi(o),h=Lr(o)==="y",{width:p,height:m}=s.floating;let y,v;d==="top"||d==="bottom"?(y=d,v=f===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?"start":"end")?"left":"right"):(v=d,y=f==="end"?"top":"bottom");const w=m-u.top-u.bottom,E=p-u.left-u.right,x=Zo(m-u[y],w),T=Zo(p-u[v],E),S=!e.middlewareData.shift;let k=x,C=T;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(C=E),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(k=w),S&&!f){const R=Nn(u.left,0),L=Nn(u.right,0),$=Nn(u.top,0),B=Nn(u.bottom,0);h?C=p-2*(R!==0||L!==0?R+L:Nn(u.left,u.right)):k=m-2*($!==0||B!==0?$+B:Nn(u.top,u.bottom))}await l({...e,availableWidth:C,availableHeight:k});const N=await i.getDimensions(a.floating);return p!==N.width||m!==N.height?{reset:{rects:!0}}:{}}}};function tf(){return typeof window<"u"}function Zi(t){return IT(t)?(t.nodeName||"").toLowerCase():"#document"}function In(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Gr(t){var e;return(e=(IT(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function IT(t){return tf()?t instanceof Node||t instanceof In(t).Node:!1}function mr(t){return tf()?t instanceof Element||t instanceof In(t).Element:!1}function zr(t){return tf()?t instanceof HTMLElement||t instanceof In(t).HTMLElement:!1}function J0(t){return!tf()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof In(t).ShadowRoot}const EH=new Set(["inline","contents"]);function Fl(t){const{overflow:e,overflowX:n,overflowY:r,display:o}=gr(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!EH.has(o)}const SH=new Set(["table","td","th"]);function kH(t){return SH.has(Zi(t))}const TH=[":popover-open",":modal"];function nf(t){return TH.some(e=>{try{return t.matches(e)}catch{return!1}})}const CH=["transform","translate","scale","rotate","perspective"],AH=["transform","translate","scale","rotate","perspective","filter"],MH=["paint","layout","strict","content"];function ly(t){const e=cy(),n=mr(t)?gr(t):t;return CH.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||AH.some(r=>(n.willChange||"").includes(r))||MH.some(r=>(n.contain||"").includes(r))}function OH(t){let e=es(t);for(;zr(e)&&!Ii(e);){if(ly(e))return e;if(nf(e))return null;e=es(e)}return null}function cy(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const RH=new Set(["html","body","#document"]);function Ii(t){return RH.has(Zi(t))}function gr(t){return In(t).getComputedStyle(t)}function rf(t){return mr(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function es(t){if(Zi(t)==="html")return t;const e=t.assignedSlot||t.parentNode||J0(t)&&t.host||Gr(t);return J0(e)?e.host:e}function PT(t){const e=es(t);return Ii(e)?t.ownerDocument?t.ownerDocument.body:t.body:zr(e)&&Fl(e)?e:PT(e)}function rl(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const o=PT(t),s=o===((r=t.ownerDocument)==null?void 0:r.body),i=In(o);if(s){const a=nm(i);return e.concat(i,i.visualViewport||[],Fl(o)?o:[],a&&n?rl(a):[])}return e.concat(o,rl(o,[],n))}function nm(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function LT(t){const e=gr(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const o=zr(t),s=o?t.offsetWidth:n,i=o?t.offsetHeight:r,a=Tu(n)!==s||Tu(r)!==i;return a&&(n=s,r=i),{width:n,height:r,$:a}}function uy(t){return mr(t)?t:t.contextElement}function xi(t){const e=uy(t);if(!zr(e))return jr(1);const n=e.getBoundingClientRect(),{width:r,height:o,$:s}=LT(e);let i=(s?Tu(n.width):n.width)/r,a=(s?Tu(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const NH=jr(0);function jT(t){const e=In(t);return!cy()||!e.visualViewport?NH:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function _H(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==In(t)?!1:e}function $s(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const o=t.getBoundingClientRect(),s=uy(t);let i=jr(1);e&&(r?mr(r)&&(i=xi(r)):i=xi(t));const a=_H(s,n,r)?jT(s):jr(0);let l=(o.left+a.x)/i.x,c=(o.top+a.y)/i.y,u=o.width/i.x,d=o.height/i.y;if(s){const f=In(s),h=r&&mr(r)?In(r):r;let p=f,m=nm(p);for(;m&&r&&h!==p;){const y=xi(m),v=m.getBoundingClientRect(),w=gr(m),E=v.left+(m.clientLeft+parseFloat(w.paddingLeft))*y.x,x=v.top+(m.clientTop+parseFloat(w.paddingTop))*y.y;l*=y.x,c*=y.y,u*=y.x,d*=y.y,l+=E,c+=x,p=In(m),m=nm(p)}}return Au({width:u,height:d,x:l,y:c})}function of(t,e){const n=rf(t).scrollLeft;return e?e.left+n:$s(Gr(t)).left+n}function $T(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-of(t,n),o=n.top+e.scrollTop;return{x:r,y:o}}function DH(t){let{elements:e,rect:n,offsetParent:r,strategy:o}=t;const s=o==="fixed",i=Gr(r),a=e?nf(e.floating):!1;if(r===i||a&&s)return n;let l={scrollLeft:0,scrollTop:0},c=jr(1);const u=jr(0),d=zr(r);if((d||!d&&!s)&&((Zi(r)!=="body"||Fl(i))&&(l=rf(r)),zr(r))){const h=$s(r);c=xi(r),u.x=h.x+r.clientLeft,u.y=h.y+r.clientTop}const f=i&&!d&&!s?$T(i,l):jr(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+f.x,y:n.y*c.y-l.scrollTop*c.y+u.y+f.y}}function IH(t){return Array.from(t.getClientRects())}function PH(t){const e=Gr(t),n=rf(t),r=t.ownerDocument.body,o=Nn(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=Nn(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+of(t);const a=-n.scrollTop;return gr(r).direction==="rtl"&&(i+=Nn(e.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:a}}const X0=25;function LH(t,e){const n=In(t),r=Gr(t),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,a=0,l=0;if(o){s=o.width,i=o.height;const u=cy();(!u||u&&e==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}const c=of(r);if(c<=0){const u=r.ownerDocument,d=u.body,f=getComputedStyle(d),h=u.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,p=Math.abs(r.clientWidth-d.clientWidth-h);p<=X0&&(s-=p)}else c<=X0&&(s+=c);return{width:s,height:i,x:a,y:l}}const jH=new Set(["absolute","fixed"]);function $H(t,e){const n=$s(t,!0,e==="fixed"),r=n.top+t.clientTop,o=n.left+t.clientLeft,s=zr(t)?xi(t):jr(1),i=t.clientWidth*s.x,a=t.clientHeight*s.y,l=o*s.x,c=r*s.y;return{width:i,height:a,x:l,y:c}}function Q0(t,e,n){let r;if(e==="viewport")r=LH(t,n);else if(e==="document")r=PH(Gr(t));else if(mr(e))r=$H(e,n);else{const o=jT(t);r={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return Au(r)}function BT(t,e){const n=es(t);return n===e||!mr(n)||Ii(n)?!1:gr(n).position==="fixed"||BT(n,e)}function BH(t,e){const n=e.get(t);if(n)return n;let r=rl(t,[],!1).filter(a=>mr(a)&&Zi(a)!=="body"),o=null;const s=gr(t).position==="fixed";let i=s?es(t):t;for(;mr(i)&&!Ii(i);){const a=gr(i),l=ly(i);!l&&a.position==="fixed"&&(o=null),(s?!l&&!o:!l&&a.position==="static"&&!!o&&jH.has(o.position)||Fl(i)&&!l&&BT(t,i))?r=r.filter(u=>u!==i):o=a,i=es(i)}return e.set(t,r),r}function FH(t){let{element:e,boundary:n,rootBoundary:r,strategy:o}=t;const i=[...n==="clippingAncestors"?nf(e)?[]:BH(e,this._c):[].concat(n),r],a=i[0],l=i.reduce((c,u)=>{const d=Q0(e,u,o);return c.top=Nn(d.top,c.top),c.right=Zo(d.right,c.right),c.bottom=Zo(d.bottom,c.bottom),c.left=Nn(d.left,c.left),c},Q0(e,a,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function HH(t){const{width:e,height:n}=LT(t);return{width:e,height:n}}function UH(t,e,n){const r=zr(e),o=Gr(e),s=n==="fixed",i=$s(t,!0,s,e);let a={scrollLeft:0,scrollTop:0};const l=jr(0);function c(){l.x=of(o)}if(r||!r&&!s)if((Zi(e)!=="body"||Fl(o))&&(a=rf(e)),r){const h=$s(e,!0,s,e);l.x=h.x+e.clientLeft,l.y=h.y+e.clientTop}else o&&c();s&&!r&&o&&c();const u=o&&!r&&!s?$T(o,a):jr(0),d=i.left+a.scrollLeft-l.x-u.x,f=i.top+a.scrollTop-l.y-u.y;return{x:d,y:f,width:i.width,height:i.height}}function Ah(t){return gr(t).position==="static"}function Z0(t,e){if(!zr(t)||gr(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Gr(t)===n&&(n=n.ownerDocument.body),n}function FT(t,e){const n=In(t);if(nf(t))return n;if(!zr(t)){let o=es(t);for(;o&&!Ii(o);){if(mr(o)&&!Ah(o))return o;o=es(o)}return n}let r=Z0(t,e);for(;r&&kH(r)&&Ah(r);)r=Z0(r,e);return r&&Ii(r)&&Ah(r)&&!ly(r)?n:r||OH(t)||n}const zH=async function(t){const e=this.getOffsetParent||FT,n=this.getDimensions,r=await n(t.floating);return{reference:UH(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function VH(t){return gr(t).direction==="rtl"}const WH={convertOffsetParentRelativeRectToViewportRelativeRect:DH,getDocumentElement:Gr,getClippingRect:FH,getOffsetParent:FT,getElementRects:zH,getClientRects:IH,getDimensions:HH,getScale:xi,isElement:mr,isRTL:VH};function HT(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function GH(t,e){let n=null,r;const o=Gr(t);function s(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function i(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),s();const c=t.getBoundingClientRect(),{left:u,top:d,width:f,height:h}=c;if(a||e(),!f||!h)return;const p=wc(d),m=wc(o.clientWidth-(u+f)),y=wc(o.clientHeight-(d+h)),v=wc(u),E={rootMargin:-p+"px "+-m+"px "+-y+"px "+-v+"px",threshold:Nn(0,Zo(1,l))||1};let x=!0;function T(S){const k=S[0].intersectionRatio;if(k!==l){if(!x)return i();k?i(!1,k):r=setTimeout(()=>{i(!1,1e-7)},1e3)}k===1&&!HT(c,t.getBoundingClientRect())&&i(),x=!1}try{n=new IntersectionObserver(T,{...E,root:o.ownerDocument})}catch{n=new IntersectionObserver(T,E)}n.observe(t)}return i(!0),s}function qH(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=uy(t),u=o||s?[...c?rl(c):[],...rl(e)]:[];u.forEach(v=>{o&&v.addEventListener("scroll",n,{passive:!0}),s&&v.addEventListener("resize",n)});const d=c&&a?GH(c,n):null;let f=-1,h=null;i&&(h=new ResizeObserver(v=>{let[w]=v;w&&w.target===c&&h&&(h.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var E;(E=h)==null||E.observe(e)})),n()}),c&&!l&&h.observe(c),h.observe(e));let p,m=l?$s(t):null;l&&y();function y(){const v=$s(t);m&&!HT(m,v)&&n(),m=v,p=requestAnimationFrame(y)}return n(),()=>{var v;u.forEach(w=>{o&&w.removeEventListener("scroll",n),s&&w.removeEventListener("resize",n)}),d?.(),(v=h)==null||v.disconnect(),h=null,l&&cancelAnimationFrame(p)}}const KH=vH,YH=bH,JH=mH,XH=wH,QH=gH,ex=pH,ZH=xH,UT=(t,e,n)=>{const r=new Map,o={platform:WH,...n},s={...o.platform,_c:r};return hH(t,e,{...o,platform:s})};var eU=typeof document<"u",tU=function(){},qc=eU?M.useLayoutEffect:tU;function Mu(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,o;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!Mu(t[r],e[r]))return!1;return!0}if(o=Object.keys(t),n=o.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&t.$$typeof)&&!Mu(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function zT(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function tx(t,e){const n=zT(t);return Math.round(e*n)/n}function Mh(t){const e=b.useRef(t);return qc(()=>{e.current=t}),e}function nU(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:a=!0,whileElementsMounted:l,open:c}=t,[u,d]=b.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[f,h]=b.useState(r);Mu(f,r)||h(r);const[p,m]=b.useState(null),[y,v]=b.useState(null),w=b.useCallback(_=>{_!==S.current&&(S.current=_,m(_))},[]),E=b.useCallback(_=>{_!==k.current&&(k.current=_,v(_))},[]),x=s||p,T=i||y,S=b.useRef(null),k=b.useRef(null),C=b.useRef(u),N=l!=null,R=Mh(l),L=Mh(o),$=Mh(c),B=b.useCallback(()=>{if(!S.current||!k.current)return;const _={placement:e,strategy:n,middleware:f};L.current&&(_.platform=L.current),UT(S.current,k.current,_).then(V=>{const ie={...V,isPositioned:$.current!==!1};U.current&&!Mu(C.current,ie)&&(C.current=ie,Md.flushSync(()=>{d(ie)}))})},[f,e,n,L,$]);qc(()=>{c===!1&&C.current.isPositioned&&(C.current.isPositioned=!1,d(_=>({..._,isPositioned:!1})))},[c]);const U=b.useRef(!1);qc(()=>(U.current=!0,()=>{U.current=!1}),[]),qc(()=>{if(x&&(S.current=x),T&&(k.current=T),x&&T){if(R.current)return R.current(x,T,B);B()}},[x,T,B,R,N]);const j=b.useMemo(()=>({reference:S,floating:k,setReference:w,setFloating:E}),[w,E]),P=b.useMemo(()=>({reference:x,floating:T}),[x,T]),H=b.useMemo(()=>{const _={position:n,left:0,top:0};if(!P.floating)return _;const V=tx(P.floating,u.x),ie=tx(P.floating,u.y);return a?{..._,transform:"translate("+V+"px, "+ie+"px)",...zT(P.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:V,top:ie}},[n,a,P.floating,u.x,u.y]);return b.useMemo(()=>({...u,update:B,refs:j,elements:P,floatingStyles:H}),[u,B,j,P,H])}const rU=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:o}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?ex({element:r.current,padding:o}).fn(n):{}:r?ex({element:r,padding:o}).fn(n):{}}}},oU=(t,e)=>({...KH(t),options:[t,e]}),sU=(t,e)=>({...YH(t),options:[t,e]}),iU=(t,e)=>({...ZH(t),options:[t,e]}),aU=(t,e)=>({...JH(t),options:[t,e]}),lU=(t,e)=>({...XH(t),options:[t,e]}),cU=(t,e)=>({...QH(t),options:[t,e]}),uU=(t,e)=>({...rU(t),options:[t,e]});var dU="Arrow",VT=b.forwardRef((t,e)=>{const{children:n,width:r=10,height:o=5,...s}=t;return g.jsx(ge.svg,{...s,ref:e,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:g.jsx("polygon",{points:"0,0 30,0 15,10"})})});VT.displayName=dU;var fU=VT;function WT(t){const[e,n]=b.useState(void 0);return Nt(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let i,a;if("borderBoxSize"in s){const l=s.borderBoxSize,c=Array.isArray(l)?l[0]:l;i=c.inlineSize,a=c.blockSize}else i=t.offsetWidth,a=t.offsetHeight;n({width:i,height:a})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var dy="Popper",[GT,cs]=Ln(dy),[hU,qT]=GT(dy),KT=t=>{const{__scopePopper:e,children:n}=t,[r,o]=b.useState(null);return g.jsx(hU,{scope:e,anchor:r,onAnchorChange:o,children:n})};KT.displayName=dy;var YT="PopperAnchor",JT=b.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...o}=t,s=qT(YT,n),i=b.useRef(null),a=Fe(e,i),l=b.useRef(null);return b.useEffect(()=>{const c=l.current;l.current=r?.current||i.current,c!==l.current&&s.onAnchorChange(l.current)}),r?null:g.jsx(ge.div,{...o,ref:a})});JT.displayName=YT;var fy="PopperContent",[pU,mU]=GT(fy),XT=b.forwardRef((t,e)=>{const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:h="optimized",onPlaced:p,...m}=t,y=qT(fy,n),[v,w]=b.useState(null),E=Fe(e,z=>w(z)),[x,T]=b.useState(null),S=WT(x),k=S?.width??0,C=S?.height??0,N=r+(s!=="center"?"-"+s:""),R=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},L=Array.isArray(c)?c:[c],$=L.length>0,B={padding:R,boundary:L.filter(yU),altBoundary:$},{refs:U,floatingStyles:j,placement:P,isPositioned:H,middlewareData:_}=nU({strategy:"fixed",placement:N,whileElementsMounted:(...z)=>qH(...z,{animationFrame:h==="always"}),elements:{reference:y.anchor},middleware:[oU({mainAxis:o+C,alignmentAxis:i}),l&&sU({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?iU():void 0,...B}),l&&aU({...B}),lU({...B,apply:({elements:z,rects:Z,availableWidth:Me,availableHeight:he})=>{const{width:we,height:Se}=Z.reference,ze=z.floating.style;ze.setProperty("--radix-popper-available-width",`${Me}px`),ze.setProperty("--radix-popper-available-height",`${he}px`),ze.setProperty("--radix-popper-anchor-width",`${we}px`),ze.setProperty("--radix-popper-anchor-height",`${Se}px`)}}),x&&uU({element:x,padding:a}),vU({arrowWidth:k,arrowHeight:C}),f&&cU({strategy:"referenceHidden",...B})]}),[V,ie]=eC(P),te=pr(p);Nt(()=>{H&&te?.()},[H,te]);const ye=_.arrow?.x,G=_.arrow?.y,Q=_.arrow?.centerOffset!==0,[J,me]=b.useState();return Nt(()=>{v&&me(window.getComputedStyle(v).zIndex)},[v]),g.jsx("div",{ref:U.setFloating,"data-radix-popper-content-wrapper":"",style:{...j,transform:H?j.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:J,"--radix-popper-transform-origin":[_.transformOrigin?.x,_.transformOrigin?.y].join(" "),..._.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:g.jsx(pU,{scope:n,placedSide:V,onArrowChange:T,arrowX:ye,arrowY:G,shouldHideArrow:Q,children:g.jsx(ge.div,{"data-side":V,"data-align":ie,...m,ref:E,style:{...m.style,animation:H?void 0:"none"}})})})});XT.displayName=fy;var QT="PopperArrow",gU={top:"bottom",right:"left",bottom:"top",left:"right"},ZT=b.forwardRef(function(e,n){const{__scopePopper:r,...o}=e,s=mU(QT,r),i=gU[s.placedSide];return g.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:g.jsx(fU,{...o,ref:n,style:{...o.style,display:"block"}})})});ZT.displayName=QT;function yU(t){return t!==null}var vU=t=>({name:"transformOrigin",options:t,fn(e){const{placement:n,rects:r,middlewareData:o}=e,i=o.arrow?.centerOffset!==0,a=i?0:t.arrowWidth,l=i?0:t.arrowHeight,[c,u]=eC(n),d={start:"0%",center:"50%",end:"100%"}[u],f=(o.arrow?.x??0)+a/2,h=(o.arrow?.y??0)+l/2;let p="",m="";return c==="bottom"?(p=i?d:`${f}px`,m=`${-l}px`):c==="top"?(p=i?d:`${f}px`,m=`${r.floating.height+l}px`):c==="right"?(p=`${-l}px`,m=i?d:`${h}px`):c==="left"&&(p=`${r.floating.width+l}px`,m=i?d:`${h}px`),{data:{x:p,y:m}}}});function eC(t){const[e,n="center"]=t.split("-");return[e,n]}var sf=KT,Hl=JT,af=XT,lf=ZT,bU="Portal",ea=b.forwardRef((t,e)=>{const{container:n,...r}=t,[o,s]=b.useState(!1);Nt(()=>s(!0),[]);const i=n||o&&globalThis?.document?.body;return i?Al.createPortal(g.jsx(ge.div,{...r,ref:e}),i):null});ea.displayName=bU;var tC=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),xU="VisuallyHidden",nC=b.forwardRef((t,e)=>g.jsx(ge.span,{...t,ref:e,style:{...tC,...t.style}}));nC.displayName=xU;var wU=nC,[cf]=Ln("Tooltip",[cs]),uf=cs(),rC="TooltipProvider",EU=700,rm="tooltip.open",[SU,hy]=cf(rC),oC=t=>{const{__scopeTooltip:e,delayDuration:n=EU,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:s}=t,i=b.useRef(!0),a=b.useRef(!1),l=b.useRef(0);return b.useEffect(()=>{const c=l.current;return()=>window.clearTimeout(c)},[]),g.jsx(SU,{scope:e,isOpenDelayedRef:i,delayDuration:n,onOpen:b.useCallback(()=>{window.clearTimeout(l.current),i.current=!1},[]),onClose:b.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>i.current=!0,r)},[r]),isPointerInTransitRef:a,onPointerInTransitChange:b.useCallback(c=>{a.current=c},[]),disableHoverableContent:o,children:s})};oC.displayName=rC;var ol="Tooltip",[kU,Ul]=cf(ol),sC=t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:o,onOpenChange:s,disableHoverableContent:i,delayDuration:a}=t,l=hy(ol,t.__scopeTooltip),c=uf(e),[u,d]=b.useState(null),f=Kn(),h=b.useRef(0),p=i??l.disableHoverableContent,m=a??l.delayDuration,y=b.useRef(!1),[v,w]=po({prop:r,defaultProp:o??!1,onChange:k=>{k?(l.onOpen(),document.dispatchEvent(new CustomEvent(rm))):l.onClose(),s?.(k)},caller:ol}),E=b.useMemo(()=>v?y.current?"delayed-open":"instant-open":"closed",[v]),x=b.useCallback(()=>{window.clearTimeout(h.current),h.current=0,y.current=!1,w(!0)},[w]),T=b.useCallback(()=>{window.clearTimeout(h.current),h.current=0,w(!1)},[w]),S=b.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{y.current=!0,w(!0),h.current=0},m)},[m,w]);return b.useEffect(()=>()=>{h.current&&(window.clearTimeout(h.current),h.current=0)},[]),g.jsx(sf,{...c,children:g.jsx(kU,{scope:e,contentId:f,open:v,stateAttribute:E,trigger:u,onTriggerChange:d,onTriggerEnter:b.useCallback(()=>{l.isOpenDelayedRef.current?S():x()},[l.isOpenDelayedRef,S,x]),onTriggerLeave:b.useCallback(()=>{p?T():(window.clearTimeout(h.current),h.current=0)},[T,p]),onOpen:x,onClose:T,disableHoverableContent:p,children:n})})};sC.displayName=ol;var om="TooltipTrigger",iC=b.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,o=Ul(om,n),s=hy(om,n),i=uf(n),a=b.useRef(null),l=Fe(e,a,o.onTriggerChange),c=b.useRef(!1),u=b.useRef(!1),d=b.useCallback(()=>c.current=!1,[]);return b.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),g.jsx(Hl,{asChild:!0,...i,children:g.jsx(ge.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:l,onPointerMove:ne(t.onPointerMove,f=>{f.pointerType!=="touch"&&!u.current&&!s.isPointerInTransitRef.current&&(o.onTriggerEnter(),u.current=!0)}),onPointerLeave:ne(t.onPointerLeave,()=>{o.onTriggerLeave(),u.current=!1}),onPointerDown:ne(t.onPointerDown,()=>{o.open&&o.onClose(),c.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:ne(t.onFocus,()=>{c.current||o.onOpen()}),onBlur:ne(t.onBlur,o.onClose),onClick:ne(t.onClick,o.onClose)})})});iC.displayName=om;var py="TooltipPortal",[TU,CU]=cf(py,{forceMount:void 0}),aC=t=>{const{__scopeTooltip:e,forceMount:n,children:r,container:o}=t,s=Ul(py,e);return g.jsx(TU,{scope:e,forceMount:n,children:g.jsx(jn,{present:n||s.open,children:g.jsx(ea,{asChild:!0,container:o,children:r})})})};aC.displayName=py;var Pi="TooltipContent",lC=b.forwardRef((t,e)=>{const n=CU(Pi,t.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...s}=t,i=Ul(Pi,t.__scopeTooltip);return g.jsx(jn,{present:r||i.open,children:i.disableHoverableContent?g.jsx(cC,{side:o,...s,ref:e}):g.jsx(AU,{side:o,...s,ref:e})})}),AU=b.forwardRef((t,e)=>{const n=Ul(Pi,t.__scopeTooltip),r=hy(Pi,t.__scopeTooltip),o=b.useRef(null),s=Fe(e,o),[i,a]=b.useState(null),{trigger:l,onClose:c}=n,u=o.current,{onPointerInTransitChange:d}=r,f=b.useCallback(()=>{a(null),d(!1)},[d]),h=b.useCallback((p,m)=>{const y=p.currentTarget,v={x:p.clientX,y:p.clientY},w=NU(v,y.getBoundingClientRect()),E=_U(v,w),x=DU(m.getBoundingClientRect()),T=PU([...E,...x]);a(T),d(!0)},[d]);return b.useEffect(()=>()=>f(),[f]),b.useEffect(()=>{if(l&&u){const p=y=>h(y,u),m=y=>h(y,l);return l.addEventListener("pointerleave",p),u.addEventListener("pointerleave",m),()=>{l.removeEventListener("pointerleave",p),u.removeEventListener("pointerleave",m)}}},[l,u,h,f]),b.useEffect(()=>{if(i){const p=m=>{const y=m.target,v={x:m.clientX,y:m.clientY},w=l?.contains(y)||u?.contains(y),E=!IU(v,i);w?f():E&&(f(),c())};return document.addEventListener("pointermove",p),()=>document.removeEventListener("pointermove",p)}},[l,u,i,c,f]),g.jsx(cC,{...t,ref:s})}),[MU,OU]=cf(ol,{isInside:!1}),RU=PI("TooltipContent"),cC=b.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:s,onPointerDownOutside:i,...a}=t,l=Ul(Pi,n),c=uf(n),{onClose:u}=l;return b.useEffect(()=>(document.addEventListener(rm,u),()=>document.removeEventListener(rm,u)),[u]),b.useEffect(()=>{if(l.trigger){const d=f=>{f.target?.contains(l.trigger)&&u()};return window.addEventListener("scroll",d,{capture:!0}),()=>window.removeEventListener("scroll",d,{capture:!0})}},[l.trigger,u]),g.jsx(Xi,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:d=>d.preventDefault(),onDismiss:u,children:g.jsxs(af,{"data-state":l.stateAttribute,...c,...a,ref:e,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[g.jsx(RU,{children:r}),g.jsx(MU,{scope:n,isInside:!0,children:g.jsx(wU,{id:l.contentId,role:"tooltip",children:o||r})})]})})});lC.displayName=Pi;var uC="TooltipArrow",dC=b.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,o=uf(n);return OU(uC,n).isInside?null:g.jsx(lf,{...o,...r,ref:e})});dC.displayName=uC;function NU(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),o=Math.abs(e.right-t.x),s=Math.abs(e.left-t.x);switch(Math.min(n,r,o,s)){case s:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function _U(t,e,n=5){const r=[];switch(e){case"top":r.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":r.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":r.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":r.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return r}function DU(t){const{top:e,right:n,bottom:r,left:o}=t;return[{x:o,y:e},{x:n,y:e},{x:n,y:r},{x:o,y:r}]}function IU(t,e){const{x:n,y:r}=t;let o=!1;for(let s=0,i=e.length-1;s<e.length;i=s++){const a=e[s],l=e[i],c=a.x,u=a.y,d=l.x,f=l.y;u>r!=f>r&&n<(d-c)*(r-u)/(f-u)+c&&(o=!o)}return o}function PU(t){const e=t.slice();return e.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),LU(e)}function LU(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r<t.length;r++){const o=t[r];for(;e.length>=2;){const s=e[e.length-1],i=e[e.length-2];if((s.x-i.x)*(o.y-i.y)>=(s.y-i.y)*(o.x-i.x))e.pop();else break}e.push(o)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const o=t[r];for(;n.length>=2;){const s=n[n.length-1],i=n[n.length-2];if((s.x-i.x)*(o.y-i.y)>=(s.y-i.y)*(o.x-i.x))n.pop();else break}n.push(o)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var jU=oC,$U=sC,BU=iC,FU=aC,HU=lC,UU=dC;function fC({delayDuration:t=0,...e}){return g.jsx(jU,{delayDuration:t,...e})}function zU(t){return g.jsx(fC,{children:g.jsx($U,{...t})})}const hC=b.forwardRef((t,e)=>g.jsx(BU,{ref:e,...t}));hC.displayName="TooltipTrigger";const pC=b.forwardRef(({className:t,sideOffset:e=0,children:n,...r},o)=>g.jsx(FU,{children:g.jsx("div",{"data-theme":"select-post-builder",children:g.jsxs(HU,{ref:o,sideOffset:e,className:re("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-[--radix-tooltip-content-transform-origin] rounded-md px-3 py-1.5 text-xs text-balance",t),...r,children:[n,g.jsx(UU,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}));pC.displayName="TooltipContent";const be=b.forwardRef(({icon:t,tooltip:e,active:n,children:r,className:o,onClick:s,...i},a)=>{const{editor:l}=ef(),c=u=>{s?.(u),l&&requestAnimationFrame(l?.chain()?.focus)};return g.jsx(fC,{delayDuration:100,children:g.jsxs(zU,{children:[g.jsx(hC,{asChild:!0,children:g.jsx(Zn,{ref:a,variant:"ghost",size:"icon",className:re("size-7 p-1.5 cursor-pointer",n&&"bg-accent text-violet-600 hover:text-violet-500",r?"size-auto":"",o),onClick:c,...i,children:r??(t&&g.jsx(t,{className:"size-full"}))})}),g.jsx(pC,{children:e})]})})});be.displayName="ToolbarButton";var Oh="focusScope.autoFocusOnMount",Rh="focusScope.autoFocusOnUnmount",nx={bubbles:!1,cancelable:!0},VU="FocusScope",zl=b.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...i}=t,[a,l]=b.useState(null),c=pr(o),u=pr(s),d=b.useRef(null),f=Fe(e,m=>l(m)),h=b.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;b.useEffect(()=>{if(r){let m=function(E){if(h.paused||!a)return;const x=E.target;a.contains(x)?d.current=x:Ro(d.current,{select:!0})},y=function(E){if(h.paused||!a)return;const x=E.relatedTarget;x!==null&&(a.contains(x)||Ro(d.current,{select:!0}))},v=function(E){if(document.activeElement===document.body)for(const T of E)T.removedNodes.length>0&&Ro(a)};document.addEventListener("focusin",m),document.addEventListener("focusout",y);const w=new MutationObserver(v);return a&&w.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",y),w.disconnect()}}},[r,a,h.paused]),b.useEffect(()=>{if(a){ox.add(h);const m=document.activeElement;if(!a.contains(m)){const v=new CustomEvent(Oh,nx);a.addEventListener(Oh,c),a.dispatchEvent(v),v.defaultPrevented||(WU(JU(mC(a)),{select:!0}),document.activeElement===m&&Ro(a))}return()=>{a.removeEventListener(Oh,c),setTimeout(()=>{const v=new CustomEvent(Rh,nx);a.addEventListener(Rh,u),a.dispatchEvent(v),v.defaultPrevented||Ro(m??document.body,{select:!0}),a.removeEventListener(Rh,u),ox.remove(h)},0)}}},[a,c,u,h]);const p=b.useCallback(m=>{if(!n&&!r||h.paused)return;const y=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,v=document.activeElement;if(y&&v){const w=m.currentTarget,[E,x]=GU(w);E&&x?!m.shiftKey&&v===x?(m.preventDefault(),n&&Ro(E,{select:!0})):m.shiftKey&&v===E&&(m.preventDefault(),n&&Ro(x,{select:!0})):v===w&&m.preventDefault()}},[n,r,h.paused]);return g.jsx(ge.div,{tabIndex:-1,...i,ref:f,onKeyDown:p})});zl.displayName=VU;function WU(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(Ro(r,{select:e}),document.activeElement!==n)return}function GU(t){const e=mC(t),n=rx(e,t),r=rx(e.reverse(),t);return[n,r]}function mC(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function rx(t,e){for(const n of t)if(!qU(n,{upTo:e}))return n}function qU(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function KU(t){return t instanceof HTMLInputElement&&"select"in t}function Ro(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&KU(t)&&e&&t.select()}}var ox=YU();function YU(){let t=[];return{add(e){const n=t[0];e!==n&&n?.pause(),t=sx(t,e),t.unshift(e)},remove(e){t=sx(t,e),t[0]?.resume()}}}function sx(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function JU(t){return t.filter(e=>e.tagName!=="A")}var Nh=0;function df(){b.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??ix()),document.body.insertAdjacentElement("beforeend",t[1]??ix()),Nh++,()=>{Nh===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Nh--}},[])}function ix(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var Pr=function(){return Pr=Object.assign||function(e){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Pr.apply(this,arguments)};function gC(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]]);return n}function XU(t,e,n){if(n||arguments.length===2)for(var r=0,o=e.length,s;r<o;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return t.concat(s||Array.prototype.slice.call(e))}var Kc="right-scroll-bar-position",Yc="width-before-scroll-bar",QU="with-scroll-bars-hidden",ZU="--removed-body-scroll-bar-size";function _h(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function ez(t,e){var n=M.useState(function(){return{value:t,callback:e,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=e,n.facade}var tz=typeof window<"u"?b.useLayoutEffect:b.useEffect,ax=new WeakMap;function nz(t,e){var n=ez(null,function(r){return t.forEach(function(o){return _h(o,r)})});return tz(function(){var r=ax.get(n);if(r){var o=new Set(r),s=new Set(t),i=n.current;o.forEach(function(a){s.has(a)||_h(a,null)}),s.forEach(function(a){o.has(a)||_h(a,i)})}ax.set(n,t)},[t]),n}function rz(t){return t}function oz(t,e){e===void 0&&(e=rz);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:t},useMedium:function(s){var i=e(s,r);return n.push(i),function(){n=n.filter(function(a){return a!==i})}},assignSyncMedium:function(s){for(r=!0;n.length;){var i=n;n=[],i.forEach(s)}n={push:function(a){return s(a)},filter:function(){return n}}},assignMedium:function(s){r=!0;var i=[];if(n.length){var a=n;n=[],a.forEach(s),i=n}var l=function(){var u=i;i=[],u.forEach(s)},c=function(){return Promise.resolve().then(l)};c(),n={push:function(u){i.push(u),c()},filter:function(u){return i=i.filter(u),n}}}};return o}function sz(t){t===void 0&&(t={});var e=oz(null);return e.options=Pr({async:!0,ssr:!1},t),e}var yC=function(t){var e=t.sideCar,n=gC(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=e.read();if(!r)throw new Error("Sidecar medium not found");return b.createElement(r,Pr({},n))};yC.isSideCarExport=!0;function iz(t,e){return t.useMedium(e),yC}var vC=sz(),Dh=function(){},ff=b.forwardRef(function(t,e){var n=b.useRef(null),r=b.useState({onScrollCapture:Dh,onWheelCapture:Dh,onTouchMoveCapture:Dh}),o=r[0],s=r[1],i=t.forwardProps,a=t.children,l=t.className,c=t.removeScrollBar,u=t.enabled,d=t.shards,f=t.sideCar,h=t.noRelative,p=t.noIsolation,m=t.inert,y=t.allowPinchZoom,v=t.as,w=v===void 0?"div":v,E=t.gapMode,x=gC(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),T=f,S=nz([n,e]),k=Pr(Pr({},x),o);return b.createElement(b.Fragment,null,u&&b.createElement(T,{sideCar:vC,removeScrollBar:c,shards:d,noRelative:h,noIsolation:p,inert:m,setCallbacks:s,allowPinchZoom:!!y,lockRef:n,gapMode:E}),i?b.cloneElement(b.Children.only(a),Pr(Pr({},k),{ref:S})):b.createElement(w,Pr({},k,{className:l,ref:S}),a))});ff.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};ff.classNames={fullWidth:Yc,zeroRight:Kc};var az=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function lz(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=az();return e&&t.setAttribute("nonce",e),t}function cz(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function uz(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var dz=function(){var t=0,e=null;return{add:function(n){t==0&&(e=lz())&&(cz(e,n),uz(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},fz=function(){var t=dz();return function(e,n){b.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},bC=function(){var t=fz(),e=function(n){var r=n.styles,o=n.dynamic;return t(r,o),null};return e},hz={left:0,top:0,right:0,gap:0},Ih=function(t){return parseInt(t||"",10)||0},pz=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],r=e[t==="padding"?"paddingTop":"marginTop"],o=e[t==="padding"?"paddingRight":"marginRight"];return[Ih(n),Ih(r),Ih(o)]},mz=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return hz;var e=pz(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},gz=bC(),wi="data-scroll-locked",yz=function(t,e,n,r){var o=t.left,s=t.top,i=t.right,a=t.gap;return n===void 0&&(n="margin"),`
|
|
223
|
+
.`.concat(QU,` {
|
|
224
|
+
overflow: hidden `).concat(r,`;
|
|
225
|
+
padding-right: `).concat(a,"px ").concat(r,`;
|
|
226
|
+
}
|
|
227
|
+
body[`).concat(wi,`] {
|
|
228
|
+
overflow: hidden `).concat(r,`;
|
|
229
|
+
overscroll-behavior: contain;
|
|
230
|
+
`).concat([e&&"position: relative ".concat(r,";"),n==="margin"&&`
|
|
231
|
+
padding-left: `.concat(o,`px;
|
|
232
|
+
padding-top: `).concat(s,`px;
|
|
233
|
+
padding-right: `).concat(i,`px;
|
|
234
|
+
margin-left:0;
|
|
235
|
+
margin-top:0;
|
|
236
|
+
margin-right: `).concat(a,"px ").concat(r,`;
|
|
237
|
+
`),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),`
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
.`).concat(Kc,` {
|
|
241
|
+
right: `).concat(a,"px ").concat(r,`;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.`).concat(Yc,` {
|
|
245
|
+
margin-right: `).concat(a,"px ").concat(r,`;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.`).concat(Kc," .").concat(Kc,` {
|
|
249
|
+
right: 0 `).concat(r,`;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.`).concat(Yc," .").concat(Yc,` {
|
|
253
|
+
margin-right: 0 `).concat(r,`;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
body[`).concat(wi,`] {
|
|
257
|
+
`).concat(ZU,": ").concat(a,`px;
|
|
258
|
+
}
|
|
259
|
+
`)},lx=function(){var t=parseInt(document.body.getAttribute(wi)||"0",10);return isFinite(t)?t:0},vz=function(){b.useEffect(function(){return document.body.setAttribute(wi,(lx()+1).toString()),function(){var t=lx()-1;t<=0?document.body.removeAttribute(wi):document.body.setAttribute(wi,t.toString())}},[])},bz=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,o=r===void 0?"margin":r;vz();var s=b.useMemo(function(){return mz(o)},[o]);return b.createElement(gz,{styles:yz(s,!e,o,n?"":"!important")})},sm=!1;if(typeof window<"u")try{var Ec=Object.defineProperty({},"passive",{get:function(){return sm=!0,!0}});window.addEventListener("test",Ec,Ec),window.removeEventListener("test",Ec,Ec)}catch{sm=!1}var ai=sm?{passive:!1}:!1,xz=function(t){return t.tagName==="TEXTAREA"},xC=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!xz(t)&&n[e]==="visible")},wz=function(t){return xC(t,"overflowY")},Ez=function(t){return xC(t,"overflowX")},cx=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=wC(t,r);if(o){var s=EC(t,r),i=s[1],a=s[2];if(i>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Sz=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},kz=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},wC=function(t,e){return t==="v"?wz(e):Ez(e)},EC=function(t,e){return t==="v"?Sz(e):kz(e)},Tz=function(t,e){return t==="h"&&e==="rtl"?-1:1},Cz=function(t,e,n,r,o){var s=Tz(t,window.getComputedStyle(e).direction),i=s*r,a=n.target,l=e.contains(a),c=!1,u=i>0,d=0,f=0;do{if(!a)break;var h=EC(t,a),p=h[0],m=h[1],y=h[2],v=m-y-s*p;(p||v)&&wC(t,a)&&(d+=v,f+=p);var w=a.parentNode;a=w&&w.nodeType===Node.DOCUMENT_FRAGMENT_NODE?w.host:w}while(!l&&a!==document.body||l&&(e.contains(a)||e===a));return(u&&Math.abs(d)<1||!u&&Math.abs(f)<1)&&(c=!0),c},Sc=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},ux=function(t){return[t.deltaX,t.deltaY]},dx=function(t){return t&&"current"in t?t.current:t},Az=function(t,e){return t[0]===e[0]&&t[1]===e[1]},Mz=function(t){return`
|
|
260
|
+
.block-interactivity-`.concat(t,` {pointer-events: none;}
|
|
261
|
+
.allow-interactivity-`).concat(t,` {pointer-events: all;}
|
|
262
|
+
`)},Oz=0,li=[];function Rz(t){var e=b.useRef([]),n=b.useRef([0,0]),r=b.useRef(),o=b.useState(Oz++)[0],s=b.useState(bC)[0],i=b.useRef(t);b.useEffect(function(){i.current=t},[t]),b.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var m=XU([t.lockRef.current],(t.shards||[]).map(dx),!0).filter(Boolean);return m.forEach(function(y){return y.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),m.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var a=b.useCallback(function(m,y){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!i.current.allowPinchZoom;var v=Sc(m),w=n.current,E="deltaX"in m?m.deltaX:w[0]-v[0],x="deltaY"in m?m.deltaY:w[1]-v[1],T,S=m.target,k=Math.abs(E)>Math.abs(x)?"h":"v";if("touches"in m&&k==="h"&&S.type==="range")return!1;var C=cx(k,S);if(!C)return!0;if(C?T=k:(T=k==="v"?"h":"v",C=cx(k,S)),!C)return!1;if(!r.current&&"changedTouches"in m&&(E||x)&&(r.current=T),!T)return!0;var N=r.current||T;return Cz(N,y,m,N==="h"?E:x)},[]),l=b.useCallback(function(m){var y=m;if(!(!li.length||li[li.length-1]!==s)){var v="deltaY"in y?ux(y):Sc(y),w=e.current.filter(function(T){return T.name===y.type&&(T.target===y.target||y.target===T.shadowParent)&&Az(T.delta,v)})[0];if(w&&w.should){y.cancelable&&y.preventDefault();return}if(!w){var E=(i.current.shards||[]).map(dx).filter(Boolean).filter(function(T){return T.contains(y.target)}),x=E.length>0?a(y,E[0]):!i.current.noIsolation;x&&y.cancelable&&y.preventDefault()}}},[]),c=b.useCallback(function(m,y,v,w){var E={name:m,delta:y,target:v,should:w,shadowParent:Nz(v)};e.current.push(E),setTimeout(function(){e.current=e.current.filter(function(x){return x!==E})},1)},[]),u=b.useCallback(function(m){n.current=Sc(m),r.current=void 0},[]),d=b.useCallback(function(m){c(m.type,ux(m),m.target,a(m,t.lockRef.current))},[]),f=b.useCallback(function(m){c(m.type,Sc(m),m.target,a(m,t.lockRef.current))},[]);b.useEffect(function(){return li.push(s),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",l,ai),document.addEventListener("touchmove",l,ai),document.addEventListener("touchstart",u,ai),function(){li=li.filter(function(m){return m!==s}),document.removeEventListener("wheel",l,ai),document.removeEventListener("touchmove",l,ai),document.removeEventListener("touchstart",u,ai)}},[]);var h=t.removeScrollBar,p=t.inert;return b.createElement(b.Fragment,null,p?b.createElement(s,{styles:Mz(o)}):null,h?b.createElement(bz,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function Nz(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const _z=iz(vC,Rz);var Vl=b.forwardRef(function(t,e){return b.createElement(ff,Pr({},t,{ref:e,sideCar:_z}))});Vl.classNames=ff.classNames;var Dz=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},ci=new WeakMap,kc=new WeakMap,Tc={},Ph=0,SC=function(t){return t&&(t.host||SC(t.parentNode))},Iz=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=SC(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},Pz=function(t,e,n,r){var o=Iz(e,Array.isArray(t)?t:[t]);Tc[n]||(Tc[n]=new WeakMap);var s=Tc[n],i=[],a=new Set,l=new Set(o),c=function(d){!d||a.has(d)||(a.add(d),c(d.parentNode))};o.forEach(c);var u=function(d){!d||l.has(d)||Array.prototype.forEach.call(d.children,function(f){if(a.has(f))u(f);else try{var h=f.getAttribute(r),p=h!==null&&h!=="false",m=(ci.get(f)||0)+1,y=(s.get(f)||0)+1;ci.set(f,m),s.set(f,y),i.push(f),m===1&&p&&kc.set(f,!0),y===1&&f.setAttribute(n,"true"),p||f.setAttribute(r,"true")}catch(v){console.error("aria-hidden: cannot operate on ",f,v)}})};return u(e),a.clear(),Ph++,function(){i.forEach(function(d){var f=ci.get(d)-1,h=s.get(d)-1;ci.set(d,f),s.set(d,h),f||(kc.has(d)||d.removeAttribute(r),kc.delete(d)),h||d.removeAttribute(n)}),Ph--,Ph||(ci=new WeakMap,ci=new WeakMap,kc=new WeakMap,Tc={})}},hf=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),o=Dz(t);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),Pz(r,o,n,"aria-hidden")):function(){return null}},pf="Dialog",[kC]=Ln(pf),[Lz,wr]=kC(pf),TC=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:i=!0}=t,a=b.useRef(null),l=b.useRef(null),[c,u]=po({prop:r,defaultProp:o??!1,onChange:s,caller:pf});return g.jsx(Lz,{scope:e,triggerRef:a,contentRef:l,contentId:Kn(),titleId:Kn(),descriptionId:Kn(),open:c,onOpenChange:u,onOpenToggle:b.useCallback(()=>u(d=>!d),[u]),modal:i,children:n})};TC.displayName=pf;var CC="DialogTrigger",AC=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,o=wr(CC,n),s=Fe(e,o.triggerRef);return g.jsx(ge.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":yy(o.open),...r,ref:s,onClick:ne(t.onClick,o.onOpenToggle)})});AC.displayName=CC;var my="DialogPortal",[jz,MC]=kC(my,{forceMount:void 0}),OC=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:o}=t,s=wr(my,e);return g.jsx(jz,{scope:e,forceMount:n,children:b.Children.map(r,i=>g.jsx(jn,{present:n||s.open,children:g.jsx(ea,{asChild:!0,container:o,children:i})}))})};OC.displayName=my;var Ou="DialogOverlay",RC=b.forwardRef((t,e)=>{const n=MC(Ou,t.__scopeDialog),{forceMount:r=n.forceMount,...o}=t,s=wr(Ou,t.__scopeDialog);return s.modal?g.jsx(jn,{present:r||s.open,children:g.jsx(Bz,{...o,ref:e})}):null});RC.displayName=Ou;var $z=Yo("DialogOverlay.RemoveScroll"),Bz=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,o=wr(Ou,n);return g.jsx(Vl,{as:$z,allowPinchZoom:!0,shards:[o.contentRef],children:g.jsx(ge.div,{"data-state":yy(o.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),Bs="DialogContent",NC=b.forwardRef((t,e)=>{const n=MC(Bs,t.__scopeDialog),{forceMount:r=n.forceMount,...o}=t,s=wr(Bs,t.__scopeDialog);return g.jsx(jn,{present:r||s.open,children:s.modal?g.jsx(Fz,{...o,ref:e}):g.jsx(Hz,{...o,ref:e})})});NC.displayName=Bs;var Fz=b.forwardRef((t,e)=>{const n=wr(Bs,t.__scopeDialog),r=b.useRef(null),o=Fe(e,n.contentRef,r);return b.useEffect(()=>{const s=r.current;if(s)return hf(s)},[]),g.jsx(_C,{...t,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ne(t.onCloseAutoFocus,s=>{s.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:ne(t.onPointerDownOutside,s=>{const i=s.detail.originalEvent,a=i.button===0&&i.ctrlKey===!0;(i.button===2||a)&&s.preventDefault()}),onFocusOutside:ne(t.onFocusOutside,s=>s.preventDefault())})}),Hz=b.forwardRef((t,e)=>{const n=wr(Bs,t.__scopeDialog),r=b.useRef(!1),o=b.useRef(!1);return g.jsx(_C,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{t.onCloseAutoFocus?.(s),s.defaultPrevented||(r.current||n.triggerRef.current?.focus(),s.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:s=>{t.onInteractOutside?.(s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const i=s.target;n.triggerRef.current?.contains(i)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&o.current&&s.preventDefault()}})}),_C=b.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:s,...i}=t,a=wr(Bs,n),l=b.useRef(null),c=Fe(e,l);return df(),g.jsxs(g.Fragment,{children:[g.jsx(zl,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:s,children:g.jsx(Xi,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":yy(a.open),...i,ref:c,onDismiss:()=>a.onOpenChange(!1)})}),g.jsxs(g.Fragment,{children:[g.jsx(Uz,{titleId:a.titleId}),g.jsx(Vz,{contentRef:l,descriptionId:a.descriptionId})]})]})}),gy="DialogTitle",DC=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,o=wr(gy,n);return g.jsx(ge.h2,{id:o.titleId,...r,ref:e})});DC.displayName=gy;var IC="DialogDescription",PC=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,o=wr(IC,n);return g.jsx(ge.p,{id:o.descriptionId,...r,ref:e})});PC.displayName=IC;var LC="DialogClose",jC=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,o=wr(LC,n);return g.jsx(ge.button,{type:"button",...r,ref:e,onClick:ne(t.onClick,()=>o.onOpenChange(!1))})});jC.displayName=LC;function yy(t){return t?"open":"closed"}var $C="DialogTitleWarning",[dne,BC]=NI($C,{contentName:Bs,titleName:gy,docsSlug:"dialog"}),Uz=({titleId:t})=>{const e=BC($C),n=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
|
|
263
|
+
|
|
264
|
+
If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
265
|
+
|
|
266
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return b.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},zz="DialogDescriptionWarning",Vz=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${BC(zz).contentName}}.`;return b.useEffect(()=>{const o=t.current?.getAttribute("aria-describedby");e&&o&&(document.getElementById(e)||console.warn(r))},[r,t,e]),null},Wz=TC,Gz=AC,qz=OC,Kz=RC,Yz=NC,Jz=DC,Xz=PC,FC=jC;/**
|
|
267
|
+
* @license lucide-react v0.544.0 - ISC
|
|
268
|
+
*
|
|
269
|
+
* This source code is licensed under the ISC license.
|
|
270
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
271
|
+
*/const Qz=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Zz=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase()),fx=t=>{const e=Zz(t);return e.charAt(0).toUpperCase()+e.slice(1)},HC=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim(),eV=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};/**
|
|
272
|
+
* @license lucide-react v0.544.0 - ISC
|
|
273
|
+
*
|
|
274
|
+
* This source code is licensed under the ISC license.
|
|
275
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
276
|
+
*/var tV={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
277
|
+
* @license lucide-react v0.544.0 - ISC
|
|
278
|
+
*
|
|
279
|
+
* This source code is licensed under the ISC license.
|
|
280
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
281
|
+
*/const nV=M.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:i,...a},l)=>M.createElement("svg",{ref:l,...tV,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:HC("lucide",o),...!s&&!eV(a)&&{"aria-hidden":"true"},...a},[...i.map(([c,u])=>M.createElement(c,u)),...Array.isArray(s)?s:[s]]));/**
|
|
282
|
+
* @license lucide-react v0.544.0 - ISC
|
|
283
|
+
*
|
|
284
|
+
* This source code is licensed under the ISC license.
|
|
285
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
286
|
+
*/const Ae=(t,e)=>{const n=M.forwardRef(({className:r,...o},s)=>M.createElement(nV,{ref:s,iconNode:e,className:HC(`lucide-${Qz(fx(t))}`,`lucide-${t}`,r),...o}));return n.displayName=fx(t),n};/**
|
|
287
|
+
* @license lucide-react v0.544.0 - ISC
|
|
288
|
+
*
|
|
289
|
+
* This source code is licensed under the ISC license.
|
|
290
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
291
|
+
*/const rV=[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]],oV=Ae("bold",rV);/**
|
|
292
|
+
* @license lucide-react v0.544.0 - ISC
|
|
293
|
+
*
|
|
294
|
+
* This source code is licensed under the ISC license.
|
|
295
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
296
|
+
*/const sV=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],UC=Ae("check",sV);/**
|
|
297
|
+
* @license lucide-react v0.544.0 - ISC
|
|
298
|
+
*
|
|
299
|
+
* This source code is licensed under the ISC license.
|
|
300
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
301
|
+
*/const iV=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],zC=Ae("chevron-down",iV);/**
|
|
302
|
+
* @license lucide-react v0.544.0 - ISC
|
|
303
|
+
*
|
|
304
|
+
* This source code is licensed under the ISC license.
|
|
305
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
306
|
+
*/const aV=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],lV=Ae("chevron-right",aV);/**
|
|
307
|
+
* @license lucide-react v0.544.0 - ISC
|
|
308
|
+
*
|
|
309
|
+
* This source code is licensed under the ISC license.
|
|
310
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
311
|
+
*/const cV=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],uV=Ae("chevron-up",cV);/**
|
|
312
|
+
* @license lucide-react v0.544.0 - ISC
|
|
313
|
+
*
|
|
314
|
+
* This source code is licensed under the ISC license.
|
|
315
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
316
|
+
*/const dV=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],fV=Ae("circle",dV);/**
|
|
317
|
+
* @license lucide-react v0.544.0 - ISC
|
|
318
|
+
*
|
|
319
|
+
* This source code is licensed under the ISC license.
|
|
320
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
321
|
+
*/const hV=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],hx=Ae("code",hV);/**
|
|
322
|
+
* @license lucide-react v0.544.0 - ISC
|
|
323
|
+
*
|
|
324
|
+
* This source code is licensed under the ISC license.
|
|
325
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
326
|
+
*/const pV=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],mV=Ae("ellipsis",pV);/**
|
|
327
|
+
* @license lucide-react v0.544.0 - ISC
|
|
328
|
+
*
|
|
329
|
+
* This source code is licensed under the ISC license.
|
|
330
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
331
|
+
*/const gV=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],sl=Ae("external-link",gV);/**
|
|
332
|
+
* @license lucide-react v0.544.0 - ISC
|
|
333
|
+
*
|
|
334
|
+
* This source code is licensed under the ISC license.
|
|
335
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
336
|
+
*/const yV=[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]],px=Ae("file-code-2",yV);/**
|
|
337
|
+
* @license lucide-react v0.544.0 - ISC
|
|
338
|
+
*
|
|
339
|
+
* This source code is licensed under the ISC license.
|
|
340
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
341
|
+
*/const vV=[["path",{d:"m15 17 5-5-5-5",key:"nf172w"}],["path",{d:"M4 18v-2a4 4 0 0 1 4-4h12",key:"jmiej9"}]],mx=Ae("forward",vV);/**
|
|
342
|
+
* @license lucide-react v0.544.0 - ISC
|
|
343
|
+
*
|
|
344
|
+
* This source code is licensed under the ISC license.
|
|
345
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
346
|
+
*/const bV=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],xV=Ae("grip-vertical",bV);/**
|
|
347
|
+
* @license lucide-react v0.544.0 - ISC
|
|
348
|
+
*
|
|
349
|
+
* This source code is licensed under the ISC license.
|
|
350
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
351
|
+
*/const wV=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]],gx=Ae("heading-1",wV);/**
|
|
352
|
+
* @license lucide-react v0.544.0 - ISC
|
|
353
|
+
*
|
|
354
|
+
* This source code is licensed under the ISC license.
|
|
355
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
356
|
+
*/const EV=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]],yx=Ae("heading-2",EV);/**
|
|
357
|
+
* @license lucide-react v0.544.0 - ISC
|
|
358
|
+
*
|
|
359
|
+
* This source code is licensed under the ISC license.
|
|
360
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
361
|
+
*/const SV=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]],vx=Ae("heading-3",SV);/**
|
|
362
|
+
* @license lucide-react v0.544.0 - ISC
|
|
363
|
+
*
|
|
364
|
+
* This source code is licensed under the ISC license.
|
|
365
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
366
|
+
*/const kV=[["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17 10v3a1 1 0 0 0 1 1h3",key:"tj5zdr"}],["path",{d:"M21 10v8",key:"1kdml4"}],["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}]],bx=Ae("heading-4",kV);/**
|
|
367
|
+
* @license lucide-react v0.544.0 - ISC
|
|
368
|
+
*
|
|
369
|
+
* This source code is licensed under the ISC license.
|
|
370
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
371
|
+
*/const TV=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17 13v-3h4",key:"1nvgqp"}],["path",{d:"M17 17.7c.4.2.8.3 1.3.3 1.5 0 2.7-1.1 2.7-2.5S19.8 13 18.3 13H17",key:"2nebdn"}]],xx=Ae("heading-5",TV);/**
|
|
372
|
+
* @license lucide-react v0.544.0 - ISC
|
|
373
|
+
*
|
|
374
|
+
* This source code is licensed under the ISC license.
|
|
375
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
376
|
+
*/const CV=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["circle",{cx:"19",cy:"16",r:"2",key:"15mx69"}],["path",{d:"M20 10c-2 2-3 3.5-3 6",key:"f35dl0"}]],wx=Ae("heading-6",CV);/**
|
|
377
|
+
* @license lucide-react v0.544.0 - ISC
|
|
378
|
+
*
|
|
379
|
+
* This source code is licensed under the ISC license.
|
|
380
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
381
|
+
*/const AV=[["path",{d:"M15 15.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997a1 1 0 0 1-1.517-.86z",key:"nrt1m3"}],["path",{d:"M21 12.17V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6",key:"99hgts"}],["path",{d:"m6 21 5-5",key:"1wyjai"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]],MV=Ae("image-play",AV);/**
|
|
382
|
+
* @license lucide-react v0.544.0 - ISC
|
|
383
|
+
*
|
|
384
|
+
* This source code is licensed under the ISC license.
|
|
385
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
386
|
+
*/const OV=[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]],VC=Ae("image-plus",OV);/**
|
|
387
|
+
* @license lucide-react v0.544.0 - ISC
|
|
388
|
+
*
|
|
389
|
+
* This source code is licensed under the ISC license.
|
|
390
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
391
|
+
*/const RV=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],vy=Ae("image",RV);/**
|
|
392
|
+
* @license lucide-react v0.544.0 - ISC
|
|
393
|
+
*
|
|
394
|
+
* This source code is licensed under the ISC license.
|
|
395
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
396
|
+
*/const NV=[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]],Ex=Ae("italic",NV);/**
|
|
397
|
+
* @license lucide-react v0.544.0 - ISC
|
|
398
|
+
*
|
|
399
|
+
* This source code is licensed under the ISC license.
|
|
400
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
401
|
+
*/const _V=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],im=Ae("link",_V);/**
|
|
402
|
+
* @license lucide-react v0.544.0 - ISC
|
|
403
|
+
*
|
|
404
|
+
* This source code is licensed under the ISC license.
|
|
405
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
406
|
+
*/const DV=[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]],IV=Ae("list-ordered",DV);/**
|
|
407
|
+
* @license lucide-react v0.544.0 - ISC
|
|
408
|
+
*
|
|
409
|
+
* This source code is licensed under the ISC license.
|
|
410
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
411
|
+
*/const PV=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],LV=Ae("list",PV);/**
|
|
412
|
+
* @license lucide-react v0.544.0 - ISC
|
|
413
|
+
*
|
|
414
|
+
* This source code is licensed under the ISC license.
|
|
415
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
416
|
+
*/const jV=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],$V=Ae("loader-circle",jV);/**
|
|
417
|
+
* @license lucide-react v0.544.0 - ISC
|
|
418
|
+
*
|
|
419
|
+
* This source code is licensed under the ISC license.
|
|
420
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
421
|
+
*/const BV=[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]],Ru=Ae("music",BV);/**
|
|
422
|
+
* @license lucide-react v0.544.0 - ISC
|
|
423
|
+
*
|
|
424
|
+
* This source code is licensed under the ISC license.
|
|
425
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
426
|
+
*/const FV=[["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]],HV=Ae("redo",FV);/**
|
|
427
|
+
* @license lucide-react v0.544.0 - ISC
|
|
428
|
+
*
|
|
429
|
+
* This source code is licensed under the ISC license.
|
|
430
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
431
|
+
*/const UV=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],WC=Ae("search",UV);/**
|
|
432
|
+
* @license lucide-react v0.544.0 - ISC
|
|
433
|
+
*
|
|
434
|
+
* This source code is licensed under the ISC license.
|
|
435
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
436
|
+
*/const zV=[["path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",key:"117uat"}],["path",{d:"M6 12h16",key:"s4cdu5"}]],VV=Ae("send-horizontal",zV);/**
|
|
437
|
+
* @license lucide-react v0.544.0 - ISC
|
|
438
|
+
*
|
|
439
|
+
* This source code is licensed under the ISC license.
|
|
440
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
441
|
+
*/const WV=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],GV=Ae("square-pen",WV);/**
|
|
442
|
+
* @license lucide-react v0.544.0 - ISC
|
|
443
|
+
*
|
|
444
|
+
* This source code is licensed under the ISC license.
|
|
445
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
446
|
+
*/const qV=[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]],Sx=Ae("strikethrough",qV);/**
|
|
447
|
+
* @license lucide-react v0.544.0 - ISC
|
|
448
|
+
*
|
|
449
|
+
* This source code is licensed under the ISC license.
|
|
450
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
451
|
+
*/const KV=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 19H5",key:"vjpgq2"}]],am=Ae("text-align-center",KV);/**
|
|
452
|
+
* @license lucide-react v0.544.0 - ISC
|
|
453
|
+
*
|
|
454
|
+
* This source code is licensed under the ISC license.
|
|
455
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
456
|
+
*/const YV=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 19H7",key:"4cu937"}]],lm=Ae("text-align-end",YV);/**
|
|
457
|
+
* @license lucide-react v0.544.0 - ISC
|
|
458
|
+
*
|
|
459
|
+
* This source code is licensed under the ISC license.
|
|
460
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
461
|
+
*/const JV=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 19H3",key:"z6ezky"}]],Nu=Ae("text-align-start",JV);/**
|
|
462
|
+
* @license lucide-react v0.544.0 - ISC
|
|
463
|
+
*
|
|
464
|
+
* This source code is licensed under the ISC license.
|
|
465
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
466
|
+
*/const XV=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],by=Ae("trash-2",XV);/**
|
|
467
|
+
* @license lucide-react v0.544.0 - ISC
|
|
468
|
+
*
|
|
469
|
+
* This source code is licensed under the ISC license.
|
|
470
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
471
|
+
*/const QV=[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]],cm=Ae("type",QV);/**
|
|
472
|
+
* @license lucide-react v0.544.0 - ISC
|
|
473
|
+
*
|
|
474
|
+
* This source code is licensed under the ISC license.
|
|
475
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
476
|
+
*/const ZV=[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]],e3=Ae("underline",ZV);/**
|
|
477
|
+
* @license lucide-react v0.544.0 - ISC
|
|
478
|
+
*
|
|
479
|
+
* This source code is licensed under the ISC license.
|
|
480
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
481
|
+
*/const t3=[["path",{d:"M3 7v6h6",key:"1v2h90"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13",key:"1r6uu6"}]],n3=Ae("undo",t3);/**
|
|
482
|
+
* @license lucide-react v0.544.0 - ISC
|
|
483
|
+
*
|
|
484
|
+
* This source code is licensed under the ISC license.
|
|
485
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
486
|
+
*/const r3=[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]],o3=Ae("unlink",r3);/**
|
|
487
|
+
* @license lucide-react v0.544.0 - ISC
|
|
488
|
+
*
|
|
489
|
+
* This source code is licensed under the ISC license.
|
|
490
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
491
|
+
*/const s3=[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]],xy=Ae("video",s3);/**
|
|
492
|
+
* @license lucide-react v0.544.0 - ISC
|
|
493
|
+
*
|
|
494
|
+
* This source code is licensed under the ISC license.
|
|
495
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
496
|
+
*/const i3=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Wl=Ae("x",i3);function wy({...t}){return g.jsx(Wz,{"data-slot":"dialog",...t})}const GC=b.forwardRef((t,e)=>g.jsx(Gz,{ref:e,"data-slot":"dialog-trigger",...t}));function a3({...t}){return g.jsx(qz,{"data-slot":"dialog-portal",...t})}b.forwardRef((t,e)=>g.jsx(FC,{ref:e,"data-slot":"dialog-close",...t}));const l3=b.forwardRef(({className:t,...e},n)=>g.jsx(Kz,{ref:n,"data-slot":"dialog-overlay",className:re("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...e})),Ey=b.forwardRef(({className:t,children:e,showCloseButton:n=!0,...r},o)=>g.jsxs(a3,{children:[g.jsx("div",{"data-theme":"select-post-builder",children:g.jsx(l3,{})}),g.jsx("div",{"data-theme":"select-post-builder",children:g.jsxs(Yz,{ref:o,"data-slot":"dialog-content","data-theme":"select-post-builder",className:re("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",t),...r,children:[e,n&&g.jsxs(FC,{"data-slot":"dialog-close",className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[g.jsx(Wl,{}),g.jsx("span",{className:"sr-only",children:"Close"})]})]})})]})),qC=b.forwardRef(({className:t,...e},n)=>g.jsx("div",{ref:n,"data-slot":"dialog-header",className:re("flex flex-col gap-2 text-center sm:text-left",t),...e})),c3=b.forwardRef(({className:t,...e},n)=>g.jsx("div",{ref:n,"data-slot":"dialog-footer",className:re("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...e})),KC=b.forwardRef((t,e)=>g.jsx(Jz,{ref:e,"data-slot":"dialog-title",className:re("text-lg leading-none font-semibold"),...t}));b.forwardRef(({className:t,...e},n)=>g.jsx(Xz,{ref:n,"data-slot":"dialog-description",className:re("text-muted-foreground text-sm",t),...e}));var u3="Label",YC=b.forwardRef((t,e)=>g.jsx(ge.label,{...t,ref:e,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(t.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));YC.displayName=u3;var d3=YC;function um({className:t,...e}){return g.jsx(d3,{"data-slot":"label",className:re("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),...e})}function f3({className:t,...e}){return g.jsx("fieldset",{"data-slot":"field-set",className:re("flex flex-col gap-6","has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3",t),...e})}function h3({className:t,...e}){return g.jsx("div",{"data-slot":"field-group",className:re("group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4",t),...e})}const p3=oy("group/field flex w-full gap-3 data-[invalid=true]:text-destructive",{variants:{orientation:{vertical:["flex-col [&>*]:w-full [&>.sr-only]:w-auto"],horizontal:["flex-row items-center","[&>[data-slot=field-label]]:flex-auto","has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"],responsive:["flex-col [&>*]:w-full [&>.sr-only]:w-auto @md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto","@md/field-group:[&>[data-slot=field-label]]:flex-auto","@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"]}},defaultVariants:{orientation:"vertical"}});function kx({className:t,orientation:e="vertical",...n}){return g.jsx("div",{role:"group","data-slot":"field","data-orientation":e,className:re(p3({orientation:e}),t),...n})}function Tx({className:t,...e}){return g.jsx(um,{"data-slot":"field-label",className:re("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50","has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border [&>*]:data-[slot=field]:p-4","has-data-[state=checked]:bg-primary/5 has-data-[state=checked]:border-primary dark:has-data-[state=checked]:bg-primary/10",t),...e})}function m3({className:t,children:e,errors:n,...r}){const o=M.useMemo(()=>e||(n?n?.length===1&&n[0]?.message?n[0].message:g.jsx("ul",{className:"ml-4 flex list-disc flex-col gap-1",children:n.map((s,i)=>s?.message&&g.jsx("li",{children:s.message},i))}):null),[e,n]);return o?g.jsx("div",{role:"alert","data-slot":"field-error",className:re("text-destructive text-sm font-normal",t),...r,children:o}):null}function Sy({className:t,type:e,...n}){return g.jsx("input",{type:e,"data-slot":"input",className:re("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",t),...n})}function Cx({className:t,...e}){return g.jsx("div",{"data-slot":"input-group",role:"group",className:re("group/input-group border-input dark:bg-input/30 relative flex w-full items-center rounded-md border shadow-xs transition-[color,box-shadow] outline-none","h-9 min-w-0 has-[>textarea]:h-auto","has-[>[data-align=inline-start]]:[&>input]:pl-2","has-[>[data-align=inline-end]]:[&>input]:pr-2","has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3","has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3","has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot=input-group-control]:focus-visible]:ring-[3px]","has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40",t),...e})}const g3=oy("text-muted-foreground flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium select-none [&>svg:not([class*='size-'])]:size-4 [&>kbd]:rounded-[calc(var(--radius)-5px)] group-data-[disabled=true]/input-group:opacity-50",{variants:{align:{"inline-start":"order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]","inline-end":"order-last pr-3 has-[>button]:mr-[-0.45rem] has-[>kbd]:mr-[-0.35rem]","block-start":"order-first w-full justify-start px-3 pt-3 [.border-b]:pb-3 group-has-[>input]/input-group:pt-2.5","block-end":"order-last w-full justify-start px-3 pb-3 [.border-t]:pt-3 group-has-[>input]/input-group:pb-2.5"}},defaultVariants:{align:"inline-start"}});function Ax({className:t,align:e="inline-start",...n}){return g.jsx("div",{role:"group","data-slot":"input-group-addon","data-align":e,className:re(g3({align:e}),t),onClick:r=>{r.target.closest("button")||r.currentTarget.parentElement?.querySelector("input")?.focus()},...n})}function Mx({className:t,...e}){return g.jsx(Sy,{"data-slot":"input-group-control",className:re("flex-1 rounded-none border-0 bg-transparent shadow-none focus-visible:ring-0 dark:bg-transparent",t),...e})}const mf=M.forwardRef(({className:t,...e},n)=>g.jsx($V,{role:"status","aria-label":"Loading",className:re("h-4 w-4 animate-spin",t),ref:n,...e}));mf.displayName="Spinner";const y3=/^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)+(?:[a-z\u00a1-\uffff]{2,}\.?))(?::\d{2,5})?(?:[/?#]\S*)?$/i,JC=/^(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)[\w-]+/gi,v3=/(?:v=|\/)([a-zA-Z0-9_-]{11})(?:[?&].*)?$/,XC=/^(?:https?:\/\/)?(?:www\.)?open\.spotify\.com\/(track|playlist|album)\/[A-Za-z0-9_-]+/gi,b3=/[\n\r]/g,QC=(t,e,n)=>t.schema.text(e,n),ZC=(t,e,n,r)=>t?.schema?.nodes[e]?.create(n,r),x3=(t,e,n,r)=>ZC(t,"customLink",{href:e},QC(t,n||e,r)),w3=(t,e,n)=>ZC(t,"paragraph",n,e),E3=t=>{const{from:e,to:n}=t.selection;return{from:e,to:n}},eA=t=>{const{from:e,to:n}=E3(t);return t.doc.textBetween(e,n)},S3=t=>!t.selection.empty&&eA(t).length>0,k3=t=>t.type.name,tA=(t,e)=>k3(t)===e,T3=t=>tA(t,"text"),C3=t=>tA(t,"paragraph"),nA=t=>t.text||"",rA=t=>t.content&&t.content.size>0,A3=t=>t.content,M3=t=>t.marks,O3=t=>t.state,oA=t=>F.from(t),sA=(t,e)=>{t.forEach(e)},R3=(t,e=" ")=>t.textBetween(0,t.size,e),N3=(t,e)=>{const{from:n,to:r,empty:o}=t.selection,s=t.schema.marks[e];if(!s)return null;if(o)return(t.storedMarks??t.selection.$from.marks()).find(c=>c.type===s)?.attrs??null;let i=null;return t.doc.nodesBetween(n,r,a=>{const l=a.marks.find(c=>c.type===s);return l?(i=l.attrs,!1):!0}),i},il=t=>t?.startsWith("http://")||t?.startsWith("https://")?t:`https://${t}`,ys=t=>y3.test(t),_3=async t=>{try{return(await yt.head(t,{timeout:5e3})).headers["content-type"]}catch{return null}},D3=async t=>{try{const n=await _3(t);if(n?.startsWith("image/"))return{type:xe.Image,src:t};if(n?.startsWith("video/"))return{type:xe.Video,src:t};if(n?.startsWith("audio/"))return{type:xe.Audio,src:t}}catch(n){console.warn("HEAD request failed, falling back to mime detection:",n)}const e=t.split(".").pop()?.toLowerCase();if(e){if(["jpg","jpeg","png","gif","webp","avif"].includes(e))return{type:xe.Image,src:t};if(["mp4","webm","mov","mkv"].includes(e))return{type:xe.Video,src:t};if(["mp3","wav","ogg","aac"].includes(e))return{type:xe.Audio,src:t}}return null},I3=t=>{const e=[],n=/(https?:\/\/[^\s]+)/g;let r=0,o;for(;(o=n.exec(t))!==null;)o.index>r&&e.push({type:"text",content:t.slice(r,o.index)}),e.push({type:"url",content:o[0]}),r=o.index+o[0].length;return r<t.length&&e.push({type:"text",content:t.slice(r)}),e},P3=(t,e)=>{const n=nA(e),r=M3(e),o=I3(n);return o.length===0?[e]:o.map(s=>s.type==="url"?x3(t,s.content,s.content,r):QC(t,s.content,r))},L3=(t,e)=>{if(!rA(e))return e;const n=[],r=A3(e);return sA(r,o=>{if(T3(o)&&nA(o)){const s=P3(t,o);n.push(...s)}else n.push(o)}),w3(t,oA(n),e.attrs)},j3=(t,e)=>{const n=[];return sA(e.content,r=>{C3(r)&&rA(r)?n.push(L3(t,r)):n.push(r)}),new ee(oA(n),e.openStart,e.openEnd)},dm=({defaultValues:t,open:e,onOpenChange:n,onInsertLink:r,hideTextInput:o=!1,children:s})=>{const{editor:i}=ef(),{core:a}=Dl(),[l,c]=M.useState(t?.uid??null),[u,d]=M.useState(t?.link??""),[f,h]=M.useState(t?.text??""),[p,m]=M.useState(void 0),[y,v]=M.useState(!1),[w,E]=M.useState(!1),x=R=>{if(n?.(R),!R||!i)return;const L=N3(i?.state,"customLink"),$=il(L?.href??"");m(ys($)),v(ys($)),c(L?.uid??null),d(L?.href??""),h(L?.text??L?.href??"")},T=R=>{const L=R.target.value;if(L==="https:/")return;const $=il(L);m(ys($)),d($)},S=R=>h(R.target.value),k=()=>{const R=ys(u);m(R),R&&(o||(E(!0),a?.resolveUrl(u)?.catch(L=>console.log(L))?.finally(()=>E(!1))))},C=(R,L,$)=>{if(o){E(!0),a?.resolveUrl(R)?.catch(B=>console.log(B))?.finally(()=>{E(!1),r(R,L,$),n?.(!1)});return}r(R,L,$),n?.(!1)},N=R=>{R.key==="Enter"&&n?.(!1)};return M.useEffect(()=>{if(console.log({defaultValues:t}),!t?.link)return;const R=ys(t?.link);m(R),v(R),c(t?.uid??null),d(t?.link??""),h(t?.text??"")},[t]),g.jsxs(wy,{open:e,onOpenChange:x,children:[s?g.jsx(GC,{asChild:!0,children:s}):null,g.jsxs(Ey,{onKeyDown:N,className:"-translate-1/2",children:[g.jsx(qC,{children:g.jsx(KC,{children:"Add Link"})}),g.jsx(f3,{children:g.jsxs(h3,{className:"gap-3",children:[g.jsxs(kx,{className:"gap-1.5",children:[g.jsxs(Tx,{children:["Link ",g.jsx("span",{className:"text-destructive",children:"*"})]}),g.jsxs(Cx,{children:[g.jsx(Mx,{value:u,onChange:T,onBlur:k,placeholder:"https://x.com/shadcn"}),g.jsx(Ax,{children:g.jsx(im,{})})]}),!p&&p!==void 0&&g.jsx(m3,{errors:[{message:"Invalid link"}]})]}),!o&&g.jsxs(kx,{className:"gap-1.5",children:[g.jsx(Tx,{children:"Text to display"}),g.jsxs(Cx,{children:[g.jsx(Mx,{value:f,onChange:S,placeholder:"Text to display"}),g.jsx(Ax,{children:g.jsx(Nu,{})})]})]})]})}),g.jsxs(c3,{children:[g.jsx(Zn,{variant:"secondary",children:"Cancel"}),g.jsxs(Zn,{disabled:!p||w,onClick:()=>C(u,f,l??void 0),children:[w&&g.jsx(mf,{}),y?"Update":"Insert"]})]})]})]})};function $3({className:t,...e}){return g.jsx("div",{"data-slot":"card",className:re("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",t),...e})}/*! *****************************************************************************
|
|
497
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
498
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
499
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
500
|
+
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
501
|
+
|
|
502
|
+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
503
|
+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
504
|
+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
505
|
+
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
506
|
+
|
|
507
|
+
See the Apache Version 2.0 License for specific language governing permissions
|
|
508
|
+
and limitations under the License.
|
|
509
|
+
***************************************************************************** */var fm=function(t,e){return fm=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var o in r)r.hasOwnProperty(o)&&(n[o]=r[o])},fm(t,e)};function B3(t,e){fm(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var Da=function(){return Da=Object.assign||function(e){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Da.apply(this,arguments)};function F3(t,e,n,r){var o,s=!1,i=0;function a(){o&&clearTimeout(o)}function l(){a(),s=!0}typeof e!="boolean"&&(r=n,n=e,e=void 0);function c(){var u=this,d=Date.now()-i,f=arguments;if(s)return;function h(){i=Date.now(),n.apply(u,f)}function p(){o=void 0}r&&!o&&h(),a(),r===void 0&&d>t?h():e!==!0&&(o=setTimeout(r?p:h,r===void 0?t-d:t))}return c.cancel=l,c}var Ei={Pixel:"Pixel",Percent:"Percent"},Ox={unit:Ei.Percent,value:.8};function Rx(t){return typeof t=="number"?{unit:Ei.Percent,value:t*100}:typeof t=="string"?t.match(/^(\d*(\.\d+)?)px$/)?{unit:Ei.Pixel,value:parseFloat(t)}:t.match(/^(\d*(\.\d+)?)%$/)?{unit:Ei.Percent,value:parseFloat(t)}:(console.warn('scrollThreshold format is invalid. Valid formats: "120px", "50%"...'),Ox):(console.warn("scrollThreshold should be string or number"),Ox)}var H3=(function(t){B3(e,t);function e(n){var r=t.call(this,n)||this;return r.lastScrollTop=0,r.actionTriggered=!1,r.startY=0,r.currentY=0,r.dragging=!1,r.maxPullDownDistance=0,r.getScrollableTarget=function(){return r.props.scrollableTarget instanceof HTMLElement?r.props.scrollableTarget:typeof r.props.scrollableTarget=="string"?document.getElementById(r.props.scrollableTarget):(r.props.scrollableTarget===null&&console.warn(`You are trying to pass scrollableTarget but it is null. This might
|
|
510
|
+
happen because the element may not have been added to DOM yet.
|
|
511
|
+
See https://github.com/ankeetmaini/react-infinite-scroll-component/issues/59 for more info.
|
|
512
|
+
`),null)},r.onStart=function(o){r.lastScrollTop||(r.dragging=!0,o instanceof MouseEvent?r.startY=o.pageY:o instanceof TouchEvent&&(r.startY=o.touches[0].pageY),r.currentY=r.startY,r._infScroll&&(r._infScroll.style.willChange="transform",r._infScroll.style.transition="transform 0.2s cubic-bezier(0,0,0.31,1)"))},r.onMove=function(o){r.dragging&&(o instanceof MouseEvent?r.currentY=o.pageY:o instanceof TouchEvent&&(r.currentY=o.touches[0].pageY),!(r.currentY<r.startY)&&(r.currentY-r.startY>=Number(r.props.pullDownToRefreshThreshold)&&r.setState({pullToRefreshThresholdBreached:!0}),!(r.currentY-r.startY>r.maxPullDownDistance*1.5)&&r._infScroll&&(r._infScroll.style.overflow="visible",r._infScroll.style.transform="translate3d(0px, "+(r.currentY-r.startY)+"px, 0px)")))},r.onEnd=function(){r.startY=0,r.currentY=0,r.dragging=!1,r.state.pullToRefreshThresholdBreached&&(r.props.refreshFunction&&r.props.refreshFunction(),r.setState({pullToRefreshThresholdBreached:!1})),requestAnimationFrame(function(){r._infScroll&&(r._infScroll.style.overflow="auto",r._infScroll.style.transform="none",r._infScroll.style.willChange="unset")})},r.onScrollListener=function(o){typeof r.props.onScroll=="function"&&setTimeout(function(){return r.props.onScroll&&r.props.onScroll(o)},0);var s=r.props.height||r._scrollableNode?o.target:document.documentElement.scrollTop?document.documentElement:document.body;if(!r.actionTriggered){var i=r.props.inverse?r.isElementAtTop(s,r.props.scrollThreshold):r.isElementAtBottom(s,r.props.scrollThreshold);i&&r.props.hasMore&&(r.actionTriggered=!0,r.setState({showLoader:!0}),r.props.next&&r.props.next()),r.lastScrollTop=s.scrollTop}},r.state={showLoader:!1,pullToRefreshThresholdBreached:!1,prevDataLength:n.dataLength},r.throttledOnScrollListener=F3(150,r.onScrollListener).bind(r),r.onStart=r.onStart.bind(r),r.onMove=r.onMove.bind(r),r.onEnd=r.onEnd.bind(r),r}return e.prototype.componentDidMount=function(){if(typeof this.props.dataLength>"u")throw new Error('mandatory prop "dataLength" is missing. The prop is needed when loading more content. Check README.md for usage');if(this._scrollableNode=this.getScrollableTarget(),this.el=this.props.height?this._infScroll:this._scrollableNode||window,this.el&&this.el.addEventListener("scroll",this.throttledOnScrollListener),typeof this.props.initialScrollY=="number"&&this.el&&this.el instanceof HTMLElement&&this.el.scrollHeight>this.props.initialScrollY&&this.el.scrollTo(0,this.props.initialScrollY),this.props.pullDownToRefresh&&this.el&&(this.el.addEventListener("touchstart",this.onStart),this.el.addEventListener("touchmove",this.onMove),this.el.addEventListener("touchend",this.onEnd),this.el.addEventListener("mousedown",this.onStart),this.el.addEventListener("mousemove",this.onMove),this.el.addEventListener("mouseup",this.onEnd),this.maxPullDownDistance=this._pullDown&&this._pullDown.firstChild&&this._pullDown.firstChild.getBoundingClientRect().height||0,this.forceUpdate(),typeof this.props.refreshFunction!="function"))throw new Error(`Mandatory prop "refreshFunction" missing.
|
|
513
|
+
Pull Down To Refresh functionality will not work
|
|
514
|
+
as expected. Check README.md for usage'`)},e.prototype.componentWillUnmount=function(){this.el&&(this.el.removeEventListener("scroll",this.throttledOnScrollListener),this.props.pullDownToRefresh&&(this.el.removeEventListener("touchstart",this.onStart),this.el.removeEventListener("touchmove",this.onMove),this.el.removeEventListener("touchend",this.onEnd),this.el.removeEventListener("mousedown",this.onStart),this.el.removeEventListener("mousemove",this.onMove),this.el.removeEventListener("mouseup",this.onEnd)))},e.prototype.componentDidUpdate=function(n){this.props.dataLength!==n.dataLength&&(this.actionTriggered=!1,this.setState({showLoader:!1}))},e.getDerivedStateFromProps=function(n,r){var o=n.dataLength!==r.prevDataLength;return o?Da(Da({},r),{prevDataLength:n.dataLength}):null},e.prototype.isElementAtTop=function(n,r){r===void 0&&(r=.8);var o=n===document.body||n===document.documentElement?window.screen.availHeight:n.clientHeight,s=Rx(r);return s.unit===Ei.Pixel?n.scrollTop<=s.value+o-n.scrollHeight+1:n.scrollTop<=s.value/100+o-n.scrollHeight+1},e.prototype.isElementAtBottom=function(n,r){r===void 0&&(r=.8);var o=n===document.body||n===document.documentElement?window.screen.availHeight:n.clientHeight,s=Rx(r);return s.unit===Ei.Pixel?n.scrollTop+o>=n.scrollHeight-s.value:n.scrollTop+o>=s.value/100*n.scrollHeight},e.prototype.render=function(){var n=this,r=Da({height:this.props.height||"auto",overflow:"auto",WebkitOverflowScrolling:"touch"},this.props.style),o=this.props.hasChildren||!!(this.props.children&&this.props.children instanceof Array&&this.props.children.length),s=this.props.pullDownToRefresh&&this.props.height?{overflow:"auto"}:{};return M.createElement("div",{style:s,className:"infinite-scroll-component__outerdiv"},M.createElement("div",{className:"infinite-scroll-component "+(this.props.className||""),ref:function(i){return n._infScroll=i},style:r},this.props.pullDownToRefresh&&M.createElement("div",{style:{position:"relative"},ref:function(i){return n._pullDown=i}},M.createElement("div",{style:{position:"absolute",left:0,right:0,top:-1*this.maxPullDownDistance}},this.state.pullToRefreshThresholdBreached?this.props.releaseToRefreshContent:this.props.pullDownToRefreshContent)),this.props.children,!this.state.showLoader&&!o&&this.props.hasMore&&this.props.loader,this.state.showLoader&&this.props.hasMore&&this.props.loader,!this.props.hasMore&&this.props.endMessage))},e})(M.Component);function U3(t=20){const[e,n]=M.useState({offset:0,limit:t,hasMore:!0,isLoading:!1}),r=M.useCallback(()=>{n({offset:0,limit:t,hasMore:!0,isLoading:!1})},[t]),o=M.useCallback(()=>{n(a=>({...a,offset:a.offset+a.limit}))},[]),s=M.useCallback(a=>{n(l=>({...l,isLoading:a}))},[]),i=M.useCallback(a=>{n(l=>({...l,hasMore:a}))},[]);return{...e,reset:r,loadMore:o,setLoading:s,setHasMore:i}}function Nx(t){const{core:e}=Dl(),[n,r]=M.useState([]),[o,s]=M.useState(""),i=U3(),a=M.useCallback(async({offset:d,limit:f,query:h,reset:p=!1})=>{i.setLoading(!0);try{const m=h?await e.searchWebImage(h,f,d):await e.fetchTrendyWebImage(f,d);m.length===0?i.setHasMore(!1):r(y=>p?m:[...y,...m])}catch(m){console.error("Error fetching images:",m),i.setHasMore(!1)}finally{i.setLoading(!1)}},[e,i]),l=M.useCallback(async({offset:d,limit:f,query:h="",reset:p=!1})=>{i.setLoading(!0);try{const m=h?await e.searchWebGif(h,f,d):await e.fetchTrendyWebGif(f,d);m.length===0?i.setHasMore(!1):r(y=>p?m:[...y,...m])}catch(m){console.error("Error fetching gifs:",m),i.setHasMore(!1)}finally{i.setLoading(!1)}},[e,i]),c=M.useCallback(d=>t==="images"?a(d):l(d),[t,a,l]),u=M.useCallback(()=>{r([]),s(""),i.reset()},[i]);return{items:n,...i,searchQuery:o,setSearchQuery:s,fetch:c,reset:u}}var iA=typeof global=="object"&&global&&global.Object===Object&&global,z3=typeof self=="object"&&self&&self.Object===Object&&self,Er=iA||z3||Function("return this")(),er=Er.Symbol,aA=Object.prototype,V3=aA.hasOwnProperty,W3=aA.toString,da=er?er.toStringTag:void 0;function G3(t){var e=V3.call(t,da),n=t[da];try{t[da]=void 0;var r=!0}catch{}var o=W3.call(t);return r&&(e?t[da]=n:delete t[da]),o}var q3=Object.prototype,K3=q3.toString;function Y3(t){return K3.call(t)}var J3="[object Null]",X3="[object Undefined]",_x=er?er.toStringTag:void 0;function Ys(t){return t==null?t===void 0?X3:J3:_x&&_x in Object(t)?G3(t):Y3(t)}function yo(t){return t!=null&&typeof t=="object"}var Q3="[object Symbol]";function gf(t){return typeof t=="symbol"||yo(t)&&Ys(t)==Q3}function ky(t,e){for(var n=-1,r=t==null?0:t.length,o=Array(r);++n<r;)o[n]=e(t[n],n,t);return o}var yr=Array.isArray,Dx=er?er.prototype:void 0,Ix=Dx?Dx.toString:void 0;function lA(t){if(typeof t=="string")return t;if(yr(t))return ky(t,lA)+"";if(gf(t))return Ix?Ix.call(t):"";var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}var Z3=/\s/;function e5(t){for(var e=t.length;e--&&Z3.test(t.charAt(e)););return e}var t5=/^\s+/;function n5(t){return t&&t.slice(0,e5(t)+1).replace(t5,"")}function Vr(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var Px=NaN,r5=/^[-+]0x[0-9a-f]+$/i,o5=/^0b[01]+$/i,s5=/^0o[0-7]+$/i,i5=parseInt;function Lx(t){if(typeof t=="number")return t;if(gf(t))return Px;if(Vr(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Vr(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=n5(t);var n=o5.test(t);return n||s5.test(t)?i5(t.slice(2),n?2:8):r5.test(t)?Px:+t}function cA(t){return t}var a5="[object AsyncFunction]",l5="[object Function]",c5="[object GeneratorFunction]",u5="[object Proxy]";function uA(t){if(!Vr(t))return!1;var e=Ys(t);return e==l5||e==c5||e==a5||e==u5}var Lh=Er["__core-js_shared__"],jx=(function(){var t=/[^.]+$/.exec(Lh&&Lh.keys&&Lh.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})();function d5(t){return!!jx&&jx in t}var f5=Function.prototype,h5=f5.toString;function Js(t){if(t!=null){try{return h5.call(t)}catch{}try{return t+""}catch{}}return""}var p5=/[\\^$.*+?()[\]{}|]/g,m5=/^\[object .+?Constructor\]$/,g5=Function.prototype,y5=Object.prototype,v5=g5.toString,b5=y5.hasOwnProperty,x5=RegExp("^"+v5.call(b5).replace(p5,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function w5(t){if(!Vr(t)||d5(t))return!1;var e=uA(t)?x5:m5;return e.test(Js(t))}function E5(t,e){return t?.[e]}function Xs(t,e){var n=E5(t,e);return w5(n)?n:void 0}var hm=Xs(Er,"WeakMap");function S5(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}var k5=800,T5=16,C5=Date.now;function A5(t){var e=0,n=0;return function(){var r=C5(),o=T5-(r-n);if(n=r,o>0){if(++e>=k5)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function M5(t){return function(){return t}}var _u=(function(){try{var t=Xs(Object,"defineProperty");return t({},"",{}),t}catch{}})(),O5=_u?function(t,e){return _u(t,"toString",{configurable:!0,enumerable:!1,value:M5(e),writable:!0})}:cA,R5=A5(O5);function N5(t,e){for(var n=-1,r=t==null?0:t.length;++n<r&&e(t[n],n,t)!==!1;);return t}var _5=9007199254740991,D5=/^(?:0|[1-9]\d*)$/;function Ty(t,e){var n=typeof t;return e=e??_5,!!e&&(n=="number"||n!="symbol"&&D5.test(t))&&t>-1&&t%1==0&&t<e}function dA(t,e,n){e=="__proto__"&&_u?_u(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function Cy(t,e){return t===e||t!==t&&e!==e}var I5=Object.prototype,P5=I5.hasOwnProperty;function Ay(t,e,n){var r=t[e];(!(P5.call(t,e)&&Cy(r,n))||n===void 0&&!(e in t))&&dA(t,e,n)}function L5(t,e,n,r){var o=!n;n||(n={});for(var s=-1,i=e.length;++s<i;){var a=e[s],l=void 0;l===void 0&&(l=t[a]),o?dA(n,a,l):Ay(n,a,l)}return n}var $x=Math.max;function j5(t,e,n){return e=$x(e===void 0?t.length-1:e,0),function(){for(var r=arguments,o=-1,s=$x(r.length-e,0),i=Array(s);++o<s;)i[o]=r[e+o];o=-1;for(var a=Array(e+1);++o<e;)a[o]=r[o];return a[e]=n(i),S5(t,this,a)}}var $5=9007199254740991;function My(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=$5}function fA(t){return t!=null&&My(t.length)&&!uA(t)}var B5=Object.prototype;function hA(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||B5;return t===n}function F5(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}var H5="[object Arguments]";function Bx(t){return yo(t)&&Ys(t)==H5}var pA=Object.prototype,U5=pA.hasOwnProperty,z5=pA.propertyIsEnumerable,Oy=Bx((function(){return arguments})())?Bx:function(t){return yo(t)&&U5.call(t,"callee")&&!z5.call(t,"callee")};function V5(){return!1}var mA=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Fx=mA&&typeof module=="object"&&module&&!module.nodeType&&module,W5=Fx&&Fx.exports===mA,Hx=W5?Er.Buffer:void 0,G5=Hx?Hx.isBuffer:void 0,Du=G5||V5,q5="[object Arguments]",K5="[object Array]",Y5="[object Boolean]",J5="[object Date]",X5="[object Error]",Q5="[object Function]",Z5="[object Map]",e4="[object Number]",t4="[object Object]",n4="[object RegExp]",r4="[object Set]",o4="[object String]",s4="[object WeakMap]",i4="[object ArrayBuffer]",a4="[object DataView]",l4="[object Float32Array]",c4="[object Float64Array]",u4="[object Int8Array]",d4="[object Int16Array]",f4="[object Int32Array]",h4="[object Uint8Array]",p4="[object Uint8ClampedArray]",m4="[object Uint16Array]",g4="[object Uint32Array]",rt={};rt[l4]=rt[c4]=rt[u4]=rt[d4]=rt[f4]=rt[h4]=rt[p4]=rt[m4]=rt[g4]=!0;rt[q5]=rt[K5]=rt[i4]=rt[Y5]=rt[a4]=rt[J5]=rt[X5]=rt[Q5]=rt[Z5]=rt[e4]=rt[t4]=rt[n4]=rt[r4]=rt[o4]=rt[s4]=!1;function y4(t){return yo(t)&&My(t.length)&&!!rt[Ys(t)]}function Ry(t){return function(e){return t(e)}}var gA=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ia=gA&&typeof module=="object"&&module&&!module.nodeType&&module,v4=Ia&&Ia.exports===gA,jh=v4&&iA.process,Li=(function(){try{var t=Ia&&Ia.require&&Ia.require("util").types;return t||jh&&jh.binding&&jh.binding("util")}catch{}})(),Ux=Li&&Li.isTypedArray,yA=Ux?Ry(Ux):y4,b4=Object.prototype,x4=b4.hasOwnProperty;function vA(t,e){var n=yr(t),r=!n&&Oy(t),o=!n&&!r&&Du(t),s=!n&&!r&&!o&&yA(t),i=n||r||o||s,a=i?F5(t.length,String):[],l=a.length;for(var c in t)(e||x4.call(t,c))&&!(i&&(c=="length"||o&&(c=="offset"||c=="parent")||s&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||Ty(c,l)))&&a.push(c);return a}function bA(t,e){return function(n){return t(e(n))}}var w4=bA(Object.keys,Object),E4=Object.prototype,S4=E4.hasOwnProperty;function k4(t){if(!hA(t))return w4(t);var e=[];for(var n in Object(t))S4.call(t,n)&&n!="constructor"&&e.push(n);return e}function xA(t){return fA(t)?vA(t):k4(t)}function T4(t){var e=[];if(t!=null)for(var n in Object(t))e.push(n);return e}var C4=Object.prototype,A4=C4.hasOwnProperty;function M4(t){if(!Vr(t))return T4(t);var e=hA(t),n=[];for(var r in t)r=="constructor"&&(e||!A4.call(t,r))||n.push(r);return n}function O4(t){return fA(t)?vA(t,!0):M4(t)}var R4=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,N4=/^\w*$/;function Ny(t,e){if(yr(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||gf(t)?!0:N4.test(t)||!R4.test(t)||e!=null&&t in Object(e)}var al=Xs(Object,"create");function _4(){this.__data__=al?al(null):{},this.size=0}function D4(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var I4="__lodash_hash_undefined__",P4=Object.prototype,L4=P4.hasOwnProperty;function j4(t){var e=this.__data__;if(al){var n=e[t];return n===I4?void 0:n}return L4.call(e,t)?e[t]:void 0}var $4=Object.prototype,B4=$4.hasOwnProperty;function F4(t){var e=this.__data__;return al?e[t]!==void 0:B4.call(e,t)}var H4="__lodash_hash_undefined__";function U4(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=al&&e===void 0?H4:e,this}function Fs(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}Fs.prototype.clear=_4;Fs.prototype.delete=D4;Fs.prototype.get=j4;Fs.prototype.has=F4;Fs.prototype.set=U4;function z4(){this.__data__=[],this.size=0}function yf(t,e){for(var n=t.length;n--;)if(Cy(t[n][0],e))return n;return-1}var V4=Array.prototype,W4=V4.splice;function G4(t){var e=this.__data__,n=yf(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():W4.call(e,n,1),--this.size,!0}function q4(t){var e=this.__data__,n=yf(e,t);return n<0?void 0:e[n][1]}function K4(t){return yf(this.__data__,t)>-1}function Y4(t,e){var n=this.__data__,r=yf(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}function Eo(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}Eo.prototype.clear=z4;Eo.prototype.delete=G4;Eo.prototype.get=q4;Eo.prototype.has=K4;Eo.prototype.set=Y4;var ll=Xs(Er,"Map");function J4(){this.size=0,this.__data__={hash:new Fs,map:new(ll||Eo),string:new Fs}}function X4(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function vf(t,e){var n=t.__data__;return X4(e)?n[typeof e=="string"?"string":"hash"]:n.map}function Q4(t){var e=vf(this,t).delete(t);return this.size-=e?1:0,e}function Z4(t){return vf(this,t).get(t)}function eW(t){return vf(this,t).has(t)}function tW(t,e){var n=vf(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this}function So(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}So.prototype.clear=J4;So.prototype.delete=Q4;So.prototype.get=Z4;So.prototype.has=eW;So.prototype.set=tW;var nW="Expected a function";function _y(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(nW);var n=function(){var r=arguments,o=e?e.apply(this,r):r[0],s=n.cache;if(s.has(o))return s.get(o);var i=t.apply(this,r);return n.cache=s.set(o,i)||s,i};return n.cache=new(_y.Cache||So),n}_y.Cache=So;var rW=500;function oW(t){var e=_y(t,function(r){return n.size===rW&&n.clear(),r}),n=e.cache;return e}var sW=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,iW=/\\(\\)?/g,aW=oW(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(sW,function(n,r,o,s){e.push(o?s.replace(iW,"$1"):r||n)}),e});function lW(t){return t==null?"":lA(t)}function ta(t,e){return yr(t)?t:Ny(t,e)?[t]:aW(lW(t))}function na(t){if(typeof t=="string"||gf(t))return t;var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}function bf(t,e){e=ta(e,t);for(var n=0,r=e.length;t!=null&&n<r;)t=t[na(e[n++])];return n&&n==r?t:void 0}function cW(t,e,n){var r=t==null?void 0:bf(t,e);return r===void 0?n:r}function Dy(t,e){for(var n=-1,r=e.length,o=t.length;++n<r;)t[o+n]=e[n];return t}var zx=er?er.isConcatSpreadable:void 0;function uW(t){return yr(t)||Oy(t)||!!(zx&&t&&t[zx])}function dW(t,e,n,r,o){var s=-1,i=t.length;for(n||(n=uW),o||(o=[]);++s<i;){var a=t[s];n(a)?Dy(o,a):o[o.length]=a}return o}function fW(t){var e=t==null?0:t.length;return e?dW(t):[]}function hW(t){return R5(j5(t,void 0,fW),t+"")}var wA=bA(Object.getPrototypeOf,Object),pW="[object Object]",mW=Function.prototype,gW=Object.prototype,EA=mW.toString,yW=gW.hasOwnProperty,vW=EA.call(Object);function bW(t){if(!yo(t)||Ys(t)!=pW)return!1;var e=wA(t);if(e===null)return!0;var n=yW.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&EA.call(n)==vW}function xW(t,e,n){var r=-1,o=t.length;e<0&&(e=-e>o?0:o+e),n=n>o?o:n,n<0&&(n+=o),o=e>n?0:n-e>>>0,e>>>=0;for(var s=Array(o);++r<o;)s[r]=t[r+e];return s}function wW(){this.__data__=new Eo,this.size=0}function EW(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}function SW(t){return this.__data__.get(t)}function kW(t){return this.__data__.has(t)}var TW=200;function CW(t,e){var n=this.__data__;if(n instanceof Eo){var r=n.__data__;if(!ll||r.length<TW-1)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new So(r)}return n.set(t,e),this.size=n.size,this}function $r(t){var e=this.__data__=new Eo(t);this.size=e.size}$r.prototype.clear=wW;$r.prototype.delete=EW;$r.prototype.get=SW;$r.prototype.has=kW;$r.prototype.set=CW;var SA=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Vx=SA&&typeof module=="object"&&module&&!module.nodeType&&module,AW=Vx&&Vx.exports===SA,Wx=AW?Er.Buffer:void 0;Wx&&Wx.allocUnsafe;function MW(t,e){return t.slice()}function OW(t,e){for(var n=-1,r=t==null?0:t.length,o=0,s=[];++n<r;){var i=t[n];e(i,n,t)&&(s[o++]=i)}return s}function kA(){return[]}var RW=Object.prototype,NW=RW.propertyIsEnumerable,Gx=Object.getOwnPropertySymbols,TA=Gx?function(t){return t==null?[]:(t=Object(t),OW(Gx(t),function(e){return NW.call(t,e)}))}:kA,_W=Object.getOwnPropertySymbols,DW=_W?function(t){for(var e=[];t;)Dy(e,TA(t)),t=wA(t);return e}:kA;function CA(t,e,n){var r=e(t);return yr(t)?r:Dy(r,n(t))}function qx(t){return CA(t,xA,TA)}function Iy(t){return CA(t,O4,DW)}var pm=Xs(Er,"DataView"),mm=Xs(Er,"Promise"),gm=Xs(Er,"Set"),Kx="[object Map]",IW="[object Object]",Yx="[object Promise]",Jx="[object Set]",Xx="[object WeakMap]",Qx="[object DataView]",PW=Js(pm),LW=Js(ll),jW=Js(mm),$W=Js(gm),BW=Js(hm),ar=Ys;(pm&&ar(new pm(new ArrayBuffer(1)))!=Qx||ll&&ar(new ll)!=Kx||mm&&ar(mm.resolve())!=Yx||gm&&ar(new gm)!=Jx||hm&&ar(new hm)!=Xx)&&(ar=function(t){var e=Ys(t),n=e==IW?t.constructor:void 0,r=n?Js(n):"";if(r)switch(r){case PW:return Qx;case LW:return Kx;case jW:return Yx;case $W:return Jx;case BW:return Xx}return e});var FW=Object.prototype,HW=FW.hasOwnProperty;function UW(t){var e=t.length,n=new t.constructor(e);return e&&typeof t[0]=="string"&&HW.call(t,"index")&&(n.index=t.index,n.input=t.input),n}var Iu=Er.Uint8Array;function Py(t){var e=new t.constructor(t.byteLength);return new Iu(e).set(new Iu(t)),e}function zW(t,e){var n=Py(t.buffer);return new t.constructor(n,t.byteOffset,t.byteLength)}var VW=/\w*$/;function WW(t){var e=new t.constructor(t.source,VW.exec(t));return e.lastIndex=t.lastIndex,e}var Zx=er?er.prototype:void 0,ew=Zx?Zx.valueOf:void 0;function GW(t){return ew?Object(ew.call(t)):{}}function qW(t,e){var n=Py(t.buffer);return new t.constructor(n,t.byteOffset,t.length)}var KW="[object Boolean]",YW="[object Date]",JW="[object Map]",XW="[object Number]",QW="[object RegExp]",ZW="[object Set]",e6="[object String]",t6="[object Symbol]",n6="[object ArrayBuffer]",r6="[object DataView]",o6="[object Float32Array]",s6="[object Float64Array]",i6="[object Int8Array]",a6="[object Int16Array]",l6="[object Int32Array]",c6="[object Uint8Array]",u6="[object Uint8ClampedArray]",d6="[object Uint16Array]",f6="[object Uint32Array]";function h6(t,e,n){var r=t.constructor;switch(e){case n6:return Py(t);case KW:case YW:return new r(+t);case r6:return zW(t);case o6:case s6:case i6:case a6:case l6:case c6:case u6:case d6:case f6:return qW(t);case JW:return new r;case XW:case e6:return new r(t);case QW:return WW(t);case ZW:return new r;case t6:return GW(t)}}var p6="[object Map]";function m6(t){return yo(t)&&ar(t)==p6}var tw=Li&&Li.isMap,g6=tw?Ry(tw):m6,y6="[object Set]";function v6(t){return yo(t)&&ar(t)==y6}var nw=Li&&Li.isSet,b6=nw?Ry(nw):v6,AA="[object Arguments]",x6="[object Array]",w6="[object Boolean]",E6="[object Date]",S6="[object Error]",MA="[object Function]",k6="[object GeneratorFunction]",T6="[object Map]",C6="[object Number]",OA="[object Object]",A6="[object RegExp]",M6="[object Set]",O6="[object String]",R6="[object Symbol]",N6="[object WeakMap]",_6="[object ArrayBuffer]",D6="[object DataView]",I6="[object Float32Array]",P6="[object Float64Array]",L6="[object Int8Array]",j6="[object Int16Array]",$6="[object Int32Array]",B6="[object Uint8Array]",F6="[object Uint8ClampedArray]",H6="[object Uint16Array]",U6="[object Uint32Array]",Ze={};Ze[AA]=Ze[x6]=Ze[_6]=Ze[D6]=Ze[w6]=Ze[E6]=Ze[I6]=Ze[P6]=Ze[L6]=Ze[j6]=Ze[$6]=Ze[T6]=Ze[C6]=Ze[OA]=Ze[A6]=Ze[M6]=Ze[O6]=Ze[R6]=Ze[B6]=Ze[F6]=Ze[H6]=Ze[U6]=!0;Ze[S6]=Ze[MA]=Ze[N6]=!1;function Jc(t,e,n,r,o,s){var i;if(n&&(i=o?n(t,r,o,s):n(t)),i!==void 0)return i;if(!Vr(t))return t;var a=yr(t);if(a)i=UW(t);else{var l=ar(t),c=l==MA||l==k6;if(Du(t))return MW(t);if(l==OA||l==AA||c&&!o)i={};else{if(!Ze[l])return o?t:{};i=h6(t,l)}}s||(s=new $r);var u=s.get(t);if(u)return u;s.set(t,i),b6(t)?t.forEach(function(h){i.add(Jc(h,e,n,h,t,s))}):g6(t)&&t.forEach(function(h,p){i.set(p,Jc(h,e,n,p,t,s))});var d=Iy,f=a?void 0:d(t);return N5(f||t,function(h,p){f&&(p=h,h=t[p]),Ay(i,p,Jc(h,e,n,p,t,s))}),i}var z6="__lodash_hash_undefined__";function V6(t){return this.__data__.set(t,z6),this}function W6(t){return this.__data__.has(t)}function Pu(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new So;++e<n;)this.add(t[e])}Pu.prototype.add=Pu.prototype.push=V6;Pu.prototype.has=W6;function G6(t,e){for(var n=-1,r=t==null?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}function q6(t,e){return t.has(e)}var K6=1,Y6=2;function RA(t,e,n,r,o,s){var i=n&K6,a=t.length,l=e.length;if(a!=l&&!(i&&l>a))return!1;var c=s.get(t),u=s.get(e);if(c&&u)return c==e&&u==t;var d=-1,f=!0,h=n&Y6?new Pu:void 0;for(s.set(t,e),s.set(e,t);++d<a;){var p=t[d],m=e[d];if(r)var y=i?r(m,p,d,e,t,s):r(p,m,d,t,e,s);if(y!==void 0){if(y)continue;f=!1;break}if(h){if(!G6(e,function(v,w){if(!q6(h,w)&&(p===v||o(p,v,n,r,s)))return h.push(w)})){f=!1;break}}else if(!(p===m||o(p,m,n,r,s))){f=!1;break}}return s.delete(t),s.delete(e),f}function J6(t){var e=-1,n=Array(t.size);return t.forEach(function(r,o){n[++e]=[o,r]}),n}function X6(t){var e=-1,n=Array(t.size);return t.forEach(function(r){n[++e]=r}),n}var Q6=1,Z6=2,e8="[object Boolean]",t8="[object Date]",n8="[object Error]",r8="[object Map]",o8="[object Number]",s8="[object RegExp]",i8="[object Set]",a8="[object String]",l8="[object Symbol]",c8="[object ArrayBuffer]",u8="[object DataView]",rw=er?er.prototype:void 0,$h=rw?rw.valueOf:void 0;function d8(t,e,n,r,o,s,i){switch(n){case u8:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case c8:return!(t.byteLength!=e.byteLength||!s(new Iu(t),new Iu(e)));case e8:case t8:case o8:return Cy(+t,+e);case n8:return t.name==e.name&&t.message==e.message;case s8:case a8:return t==e+"";case r8:var a=J6;case i8:var l=r&Q6;if(a||(a=X6),t.size!=e.size&&!l)return!1;var c=i.get(t);if(c)return c==e;r|=Z6,i.set(t,e);var u=RA(a(t),a(e),r,o,s,i);return i.delete(t),u;case l8:if($h)return $h.call(t)==$h.call(e)}return!1}var f8=1,h8=Object.prototype,p8=h8.hasOwnProperty;function m8(t,e,n,r,o,s){var i=n&f8,a=qx(t),l=a.length,c=qx(e),u=c.length;if(l!=u&&!i)return!1;for(var d=l;d--;){var f=a[d];if(!(i?f in e:p8.call(e,f)))return!1}var h=s.get(t),p=s.get(e);if(h&&p)return h==e&&p==t;var m=!0;s.set(t,e),s.set(e,t);for(var y=i;++d<l;){f=a[d];var v=t[f],w=e[f];if(r)var E=i?r(w,v,f,e,t,s):r(v,w,f,t,e,s);if(!(E===void 0?v===w||o(v,w,n,r,s):E)){m=!1;break}y||(y=f=="constructor")}if(m&&!y){var x=t.constructor,T=e.constructor;x!=T&&"constructor"in t&&"constructor"in e&&!(typeof x=="function"&&x instanceof x&&typeof T=="function"&&T instanceof T)&&(m=!1)}return s.delete(t),s.delete(e),m}var g8=1,ow="[object Arguments]",sw="[object Array]",Cc="[object Object]",y8=Object.prototype,iw=y8.hasOwnProperty;function v8(t,e,n,r,o,s){var i=yr(t),a=yr(e),l=i?sw:ar(t),c=a?sw:ar(e);l=l==ow?Cc:l,c=c==ow?Cc:c;var u=l==Cc,d=c==Cc,f=l==c;if(f&&Du(t)){if(!Du(e))return!1;i=!0,u=!1}if(f&&!u)return s||(s=new $r),i||yA(t)?RA(t,e,n,r,o,s):d8(t,e,l,n,r,o,s);if(!(n&g8)){var h=u&&iw.call(t,"__wrapped__"),p=d&&iw.call(e,"__wrapped__");if(h||p){var m=h?t.value():t,y=p?e.value():e;return s||(s=new $r),o(m,y,n,r,s)}}return f?(s||(s=new $r),m8(t,e,n,r,o,s)):!1}function Ly(t,e,n,r,o){return t===e?!0:t==null||e==null||!yo(t)&&!yo(e)?t!==t&&e!==e:v8(t,e,n,r,Ly,o)}var b8=1,x8=2;function w8(t,e,n,r){var o=n.length,s=o;if(t==null)return!s;for(t=Object(t);o--;){var i=n[o];if(i[2]?i[1]!==t[i[0]]:!(i[0]in t))return!1}for(;++o<s;){i=n[o];var a=i[0],l=t[a],c=i[1];if(i[2]){if(l===void 0&&!(a in t))return!1}else{var u=new $r,d;if(!(d===void 0?Ly(c,l,b8|x8,r,u):d))return!1}}return!0}function NA(t){return t===t&&!Vr(t)}function E8(t){for(var e=xA(t),n=e.length;n--;){var r=e[n],o=t[r];e[n]=[r,o,NA(o)]}return e}function _A(t,e){return function(n){return n==null?!1:n[t]===e&&(e!==void 0||t in Object(n))}}function S8(t){var e=E8(t);return e.length==1&&e[0][2]?_A(e[0][0],e[0][1]):function(n){return n===t||w8(n,t,e)}}function k8(t,e){return t!=null&&e in Object(t)}function T8(t,e,n){e=ta(e,t);for(var r=-1,o=e.length,s=!1;++r<o;){var i=na(e[r]);if(!(s=t!=null&&n(t,i)))break;t=t[i]}return s||++r!=o?s:(o=t==null?0:t.length,!!o&&My(o)&&Ty(i,o)&&(yr(t)||Oy(t)))}function C8(t,e){return t!=null&&T8(t,e,k8)}var A8=1,M8=2;function O8(t,e){return Ny(t)&&NA(e)?_A(na(t),e):function(n){var r=cW(n,t);return r===void 0&&r===e?C8(n,t):Ly(e,r,A8|M8)}}function R8(t){return function(e){return e?.[t]}}function N8(t){return function(e){return bf(e,t)}}function _8(t){return Ny(t)?R8(na(t)):N8(t)}function DA(t){return typeof t=="function"?t:t==null?cA:typeof t=="object"?yr(t)?O8(t[0],t[1]):S8(t):_8(t)}var Bh=function(){return Er.Date.now()},D8="Expected a function",I8=Math.max,P8=Math.min;function L8(t,e,n){var r,o,s,i,a,l,c=0,u=!1,d=!1,f=!0;if(typeof t!="function")throw new TypeError(D8);e=Lx(e)||0,Vr(n)&&(u=!!n.leading,d="maxWait"in n,s=d?I8(Lx(n.maxWait)||0,e):s,f="trailing"in n?!!n.trailing:f);function h(S){var k=r,C=o;return r=o=void 0,c=S,i=t.apply(C,k),i}function p(S){return c=S,a=setTimeout(v,e),u?h(S):i}function m(S){var k=S-l,C=S-c,N=e-k;return d?P8(N,s-C):N}function y(S){var k=S-l,C=S-c;return l===void 0||k>=e||k<0||d&&C>=s}function v(){var S=Bh();if(y(S))return w(S);a=setTimeout(v,m(S))}function w(S){return a=void 0,f&&r?h(S):(r=o=void 0,i)}function E(){a!==void 0&&clearTimeout(a),c=0,r=l=o=a=void 0}function x(){return a===void 0?i:w(Bh())}function T(){var S=Bh(),k=y(S);if(r=arguments,o=this,l=S,k){if(a===void 0)return p(l);if(d)return clearTimeout(a),a=setTimeout(v,e),h(l)}return a===void 0&&(a=setTimeout(v,e)),i}return T.cancel=E,T.flush=x,T}function j8(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}function $8(t,e){return e.length<2?t:bf(t,xW(e,0,-1))}function B8(t){return t==null}var F8="Expected a function";function H8(t){if(typeof t!="function")throw new TypeError(F8);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}function U8(t,e){return e=ta(e,t),t=$8(t,e),t==null||delete t[na(j8(e))]}function z8(t){return bW(t)?void 0:t}var V8=1,W8=2,G8=4,q8=hW(function(t,e){var n={};if(t==null)return n;var r=!1;e=ky(e,function(s){return s=ta(s,t),r||(r=s.length>1),s}),L5(t,Iy(t),n),r&&(n=Jc(n,V8|W8|G8,z8));for(var o=e.length;o--;)U8(n,e[o]);return n});function K8(t,e,n,r){if(!Vr(t))return t;e=ta(e,t);for(var o=-1,s=e.length,i=s-1,a=t;a!=null&&++o<s;){var l=na(e[o]),c=n;if(l==="__proto__"||l==="constructor"||l==="prototype")return t;if(o!=i){var u=a[l];c=void 0,c===void 0&&(c=Vr(u)?u:Ty(e[o+1])?[]:{})}Ay(a,l,c),a=a[l]}return t}function Y8(t,e,n){for(var r=-1,o=e.length,s={};++r<o;){var i=e[r],a=bf(t,i);n(a,i)&&K8(s,ta(i,t),a)}return s}function J8(t,e){if(t==null)return{};var n=ky(Iy(t),function(r){return[r]});return e=DA(e),Y8(t,n,function(r,o){return e(r,o[0])})}function X8(t,e){return J8(t,H8(DA(e)))}const Fh={limit:TD,offset:0,query:"",reset:!0};function IA({open:t,onOpenChange:e,onImageSelect:n,children:r}){const[o,s]=b.useState("gifs"),[i,a]=b.useState(""),l=Nx("images"),c=Nx("gifs"),u=b.useRef(c);b.useEffect(()=>{u.current=o==="images"?l:c},[o,l,c]);const d=v=>{if(e?.(v),!v){l.reset(),c.reset(),a("");return}c.fetch(Fh).catch(w=>console.log(w)),l.fetch(Fh).catch(w=>console.log(w))},f=b.useMemo(()=>L8(async v=>{const w=u.current;w.reset(),await w.fetch({...Fh,query:v})},500),[]);b.useEffect(()=>()=>{f.cancel()},[f]);const h=b.useCallback(v=>{a(v),f(v)?.catch(w=>console.log(w))},[f]),p=b.useCallback(v=>{s(v),a("")},[]),m=b.useCallback(async()=>{const v=u.current,w=v.offset+v.limit;v.loadMore(),await v.fetch({offset:w,limit:v.limit,query:i})},[i]),y=b.useCallback(v=>{n?.(v,o==="gifs"?Sp?.Gif:o==="images"?Sp.Image:void 0),e(!1)},[o,n,e]);return g.jsxs(wy,{open:t,onOpenChange:d,children:[g.jsx(GC,{asChild:!0,children:r??g.jsx(Zn,{children:"Open Search Modal"})}),g.jsxs(Ey,{className:"max-w-4xl w-full h-[80vh] flex flex-col overflow-hidden px-0 py-0 -translate-1/2",children:[g.jsx(qC,{className:"p-4 border-b bg-accent",children:g.jsx(KC,{children:"Search Media"})}),g.jsxs(vk,{defaultValue:"gifs",value:o,onValueChange:p,className:"flex-1 grow flex flex-col overflow-y-auto",children:[g.jsx("div",{className:"px-4",children:g.jsxs(bk,{className:"grid w-full grid-cols-2",children:[g.jsx(Rp,{value:"gifs",children:"GIF Search"}),g.jsx(Rp,{value:"images",children:"Image Search"})]})}),g.jsx(Q8,{value:i,onChange:h,placeholder:`Search ${o}...`}),g.jsx(Sb,{value:"images",className:"flex-1 grow mt-4 overflow-y-auto",children:g.jsx(aw,{items:l.items,onItemClick:y,hasMore:l.hasMore,loadMore:m,scrollTargetId:sb.images})}),g.jsx(Sb,{value:"gifs",className:"flex-1 grow mt-4 overflow-y-auto",children:g.jsx(aw,{items:c.items,onItemClick:y,hasMore:c.hasMore,loadMore:m,scrollTargetId:sb.gifs})})]})]})]})}function Q8({value:t,onChange:e,placeholder:n}){return g.jsx("div",{className:"mt-2 px-4",children:g.jsxs("div",{className:"relative",children:[g.jsx(WC,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),g.jsx(Sy,{type:"text",placeholder:n,value:t,onChange:r=>e(r.target.value),className:"pl-9"})]})})}function aw({items:t,onItemClick:e,hasMore:n,loadMore:r,scrollTargetId:o}){const s=i=>i?.source?.url||i?.thumbnail?.url;return g.jsx("div",{id:o,className:"h-full overflow-y-auto",children:g.jsx(H3,{dataLength:t.length,next:r,hasMore:n,loader:g.jsx("div",{className:"flex justify-center py-4",children:g.jsx(mf,{className:"h-6 w-6"})}),endMessage:g.jsx("p",{className:"text-center text-muted-foreground py-4",children:t.length===0?"No items found":"No more items to load"}),scrollableTarget:o,children:g.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4 py-2 px-4",children:t.map(i=>g.jsx($3,{className:"py-0 overflow-hidden cursor-pointer hover:ring-2 hover:ring-primary transition-all",onClick:()=>e(s(i)),children:g.jsx("img",{loading:"lazy",src:s(i),alt:"Media item",className:"w-full h-32 object-cover"})},s(i)))})})})}var ym=["Enter"," "],Z8=["ArrowDown","PageUp","Home"],PA=["ArrowUp","PageDown","End"],eG=[...Z8,...PA],tG={ltr:[...ym,"ArrowRight"],rtl:[...ym,"ArrowLeft"]},nG={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Gl="Menu",[cl,rG,oG]=yg(Gl),[Qs,LA]=Ln(Gl,[oG,cs,$d]),xf=cs(),jA=$d(),[sG,Zs]=Qs(Gl),[iG,ql]=Qs(Gl),$A=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:o,onOpenChange:s,modal:i=!0}=t,a=xf(e),[l,c]=b.useState(null),u=b.useRef(!1),d=pr(s),f=jd(o);return b.useEffect(()=>{const h=()=>{u.current=!0,document.addEventListener("pointerdown",p,{capture:!0,once:!0}),document.addEventListener("pointermove",p,{capture:!0,once:!0})},p=()=>u.current=!1;return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",p,{capture:!0}),document.removeEventListener("pointermove",p,{capture:!0})}},[]),g.jsx(sf,{...a,children:g.jsx(sG,{scope:e,open:n,onOpenChange:d,content:l,onContentChange:c,children:g.jsx(iG,{scope:e,onClose:b.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:i,children:r})})})};$A.displayName=Gl;var aG="MenuAnchor",jy=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,o=xf(n);return g.jsx(Hl,{...o,...r,ref:e})});jy.displayName=aG;var $y="MenuPortal",[lG,BA]=Qs($y,{forceMount:void 0}),FA=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:o}=t,s=Zs($y,e);return g.jsx(lG,{scope:e,forceMount:n,children:g.jsx(jn,{present:n||s.open,children:g.jsx(ea,{asChild:!0,container:o,children:r})})})};FA.displayName=$y;var Xn="MenuContent",[cG,By]=Qs(Xn),HA=b.forwardRef((t,e)=>{const n=BA(Xn,t.__scopeMenu),{forceMount:r=n.forceMount,...o}=t,s=Zs(Xn,t.__scopeMenu),i=ql(Xn,t.__scopeMenu);return g.jsx(cl.Provider,{scope:t.__scopeMenu,children:g.jsx(jn,{present:r||s.open,children:g.jsx(cl.Slot,{scope:t.__scopeMenu,children:i.modal?g.jsx(uG,{...o,ref:e}):g.jsx(dG,{...o,ref:e})})})})}),uG=b.forwardRef((t,e)=>{const n=Zs(Xn,t.__scopeMenu),r=b.useRef(null),o=Fe(e,r);return b.useEffect(()=>{const s=r.current;if(s)return hf(s)},[]),g.jsx(Fy,{...t,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:ne(t.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),dG=b.forwardRef((t,e)=>{const n=Zs(Xn,t.__scopeMenu);return g.jsx(Fy,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),fG=Yo("MenuContent.ScrollLock"),Fy=b.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:h,disableOutsideScroll:p,...m}=t,y=Zs(Xn,n),v=ql(Xn,n),w=xf(n),E=jA(n),x=rG(n),[T,S]=b.useState(null),k=b.useRef(null),C=Fe(e,k,y.onContentChange),N=b.useRef(0),R=b.useRef(""),L=b.useRef(0),$=b.useRef(null),B=b.useRef("right"),U=b.useRef(0),j=p?Vl:b.Fragment,P=p?{as:fG,allowPinchZoom:!0}:void 0,H=V=>{const ie=R.current+V,te=x().filter(z=>!z.disabled),ye=document.activeElement,G=te.find(z=>z.ref.current===ye)?.textValue,Q=te.map(z=>z.textValue),J=kG(Q,ie,G),me=te.find(z=>z.textValue===J)?.ref.current;(function z(Z){R.current=Z,window.clearTimeout(N.current),Z!==""&&(N.current=window.setTimeout(()=>z(""),1e3))})(ie),me&&setTimeout(()=>me.focus())};b.useEffect(()=>()=>window.clearTimeout(N.current),[]),df();const _=b.useCallback(V=>B.current===$.current?.side&&CG(V,$.current?.area),[]);return g.jsx(cG,{scope:n,searchRef:R,onItemEnter:b.useCallback(V=>{_(V)&&V.preventDefault()},[_]),onItemLeave:b.useCallback(V=>{_(V)||(k.current?.focus(),S(null))},[_]),onTriggerLeave:b.useCallback(V=>{_(V)&&V.preventDefault()},[_]),pointerGraceTimerRef:L,onPointerGraceIntentChange:b.useCallback(V=>{$.current=V},[]),children:g.jsx(j,{...P,children:g.jsx(zl,{asChild:!0,trapped:o,onMountAutoFocus:ne(s,V=>{V.preventDefault(),k.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:g.jsx(Xi,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:h,children:g.jsx(FS,{asChild:!0,...E,dir:v.dir,orientation:"vertical",loop:r,currentTabStopId:T,onCurrentTabStopIdChange:S,onEntryFocus:ne(l,V=>{v.isUsingKeyboardRef.current||V.preventDefault()}),preventScrollOnEntryFocus:!0,children:g.jsx(af,{role:"menu","aria-orientation":"vertical","data-state":rM(y.open),"data-radix-menu-content":"",dir:v.dir,...w,...m,ref:C,style:{outline:"none",...m.style},onKeyDown:ne(m.onKeyDown,V=>{const te=V.target.closest("[data-radix-menu-content]")===V.currentTarget,ye=V.ctrlKey||V.altKey||V.metaKey,G=V.key.length===1;te&&(V.key==="Tab"&&V.preventDefault(),!ye&&G&&H(V.key));const Q=k.current;if(V.target!==Q||!eG.includes(V.key))return;V.preventDefault();const me=x().filter(z=>!z.disabled).map(z=>z.ref.current);PA.includes(V.key)&&me.reverse(),EG(me)}),onBlur:ne(t.onBlur,V=>{V.currentTarget.contains(V.target)||(window.clearTimeout(N.current),R.current="")}),onPointerMove:ne(t.onPointerMove,ul(V=>{const ie=V.target,te=U.current!==V.clientX;if(V.currentTarget.contains(ie)&&te){const ye=V.clientX>U.current?"right":"left";B.current=ye,U.current=V.clientX}}))})})})})})})});HA.displayName=Xn;var hG="MenuGroup",Hy=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return g.jsx(ge.div,{role:"group",...r,ref:e})});Hy.displayName=hG;var pG="MenuLabel",UA=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return g.jsx(ge.div,{...r,ref:e})});UA.displayName=pG;var Lu="MenuItem",lw="menu.itemSelect",wf=b.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...o}=t,s=b.useRef(null),i=ql(Lu,t.__scopeMenu),a=By(Lu,t.__scopeMenu),l=Fe(e,s),c=b.useRef(!1),u=()=>{const d=s.current;if(!n&&d){const f=new CustomEvent(lw,{bubbles:!0,cancelable:!0});d.addEventListener(lw,h=>r?.(h),{once:!0}),IS(d,f),f.defaultPrevented?c.current=!1:i.onClose()}};return g.jsx(zA,{...o,ref:l,disabled:n,onClick:ne(t.onClick,u),onPointerDown:d=>{t.onPointerDown?.(d),c.current=!0},onPointerUp:ne(t.onPointerUp,d=>{c.current||d.currentTarget?.click()}),onKeyDown:ne(t.onKeyDown,d=>{const f=a.searchRef.current!=="";n||f&&d.key===" "||ym.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});wf.displayName=Lu;var zA=b.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...s}=t,i=By(Lu,n),a=jA(n),l=b.useRef(null),c=Fe(e,l),[u,d]=b.useState(!1),[f,h]=b.useState("");return b.useEffect(()=>{const p=l.current;p&&h((p.textContent??"").trim())},[s.children]),g.jsx(cl.ItemSlot,{scope:n,disabled:r,textValue:o??f,children:g.jsx(HS,{asChild:!0,...a,focusable:!r,children:g.jsx(ge.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:c,onPointerMove:ne(t.onPointerMove,ul(p=>{r?i.onItemLeave(p):(i.onItemEnter(p),p.defaultPrevented||p.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ne(t.onPointerLeave,ul(p=>i.onItemLeave(p))),onFocus:ne(t.onFocus,()=>d(!0)),onBlur:ne(t.onBlur,()=>d(!1))})})})}),mG="MenuCheckboxItem",VA=b.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...o}=t;return g.jsx(YA,{scope:t.__scopeMenu,checked:n,children:g.jsx(wf,{role:"menuitemcheckbox","aria-checked":ju(n)?"mixed":n,...o,ref:e,"data-state":zy(n),onSelect:ne(o.onSelect,()=>r?.(ju(n)?!0:!n),{checkForDefaultPrevented:!1})})})});VA.displayName=mG;var WA="MenuRadioGroup",[gG,yG]=Qs(WA,{value:void 0,onValueChange:()=>{}}),GA=b.forwardRef((t,e)=>{const{value:n,onValueChange:r,...o}=t,s=pr(r);return g.jsx(gG,{scope:t.__scopeMenu,value:n,onValueChange:s,children:g.jsx(Hy,{...o,ref:e})})});GA.displayName=WA;var qA="MenuRadioItem",KA=b.forwardRef((t,e)=>{const{value:n,...r}=t,o=yG(qA,t.__scopeMenu),s=n===o.value;return g.jsx(YA,{scope:t.__scopeMenu,checked:s,children:g.jsx(wf,{role:"menuitemradio","aria-checked":s,...r,ref:e,"data-state":zy(s),onSelect:ne(r.onSelect,()=>o.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});KA.displayName=qA;var Uy="MenuItemIndicator",[YA,vG]=Qs(Uy,{checked:!1}),JA=b.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...o}=t,s=vG(Uy,n);return g.jsx(jn,{present:r||ju(s.checked)||s.checked===!0,children:g.jsx(ge.span,{...o,ref:e,"data-state":zy(s.checked)})})});JA.displayName=Uy;var bG="MenuSeparator",XA=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return g.jsx(ge.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});XA.displayName=bG;var xG="MenuArrow",QA=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,o=xf(n);return g.jsx(lf,{...o,...r,ref:e})});QA.displayName=xG;var wG="MenuSub",[fne,ZA]=Qs(wG),ka="MenuSubTrigger",eM=b.forwardRef((t,e)=>{const n=Zs(ka,t.__scopeMenu),r=ql(ka,t.__scopeMenu),o=ZA(ka,t.__scopeMenu),s=By(ka,t.__scopeMenu),i=b.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=s,c={__scopeMenu:t.__scopeMenu},u=b.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return b.useEffect(()=>u,[u]),b.useEffect(()=>{const d=a.current;return()=>{window.clearTimeout(d),l(null)}},[a,l]),g.jsx(jy,{asChild:!0,...c,children:g.jsx(zA,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":rM(n.open),...t,ref:Ld(e,o.onTriggerChange),onClick:d=>{t.onClick?.(d),!(t.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:ne(t.onPointerMove,ul(d=>{s.onItemEnter(d),!d.defaultPrevented&&!t.disabled&&!n.open&&!i.current&&(s.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:ne(t.onPointerLeave,ul(d=>{u();const f=n.content?.getBoundingClientRect();if(f){const h=n.content?.dataset.side,p=h==="right",m=p?-5:5,y=f[p?"left":"right"],v=f[p?"right":"left"];s.onPointerGraceIntentChange({area:[{x:d.clientX+m,y:d.clientY},{x:y,y:f.top},{x:v,y:f.top},{x:v,y:f.bottom},{x:y,y:f.bottom}],side:h}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(d),d.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:ne(t.onKeyDown,d=>{const f=s.searchRef.current!=="";t.disabled||f&&d.key===" "||tG[r.dir].includes(d.key)&&(n.onOpenChange(!0),n.content?.focus(),d.preventDefault())})})})});eM.displayName=ka;var tM="MenuSubContent",nM=b.forwardRef((t,e)=>{const n=BA(Xn,t.__scopeMenu),{forceMount:r=n.forceMount,...o}=t,s=Zs(Xn,t.__scopeMenu),i=ql(Xn,t.__scopeMenu),a=ZA(tM,t.__scopeMenu),l=b.useRef(null),c=Fe(e,l);return g.jsx(cl.Provider,{scope:t.__scopeMenu,children:g.jsx(jn,{present:r||s.open,children:g.jsx(cl.Slot,{scope:t.__scopeMenu,children:g.jsx(Fy,{id:a.contentId,"aria-labelledby":a.triggerId,...o,ref:c,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{i.isUsingKeyboardRef.current&&l.current?.focus(),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:ne(t.onFocusOutside,u=>{u.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:ne(t.onEscapeKeyDown,u=>{i.onClose(),u.preventDefault()}),onKeyDown:ne(t.onKeyDown,u=>{const d=u.currentTarget.contains(u.target),f=nG[i.dir].includes(u.key);d&&f&&(s.onOpenChange(!1),a.trigger?.focus(),u.preventDefault())})})})})})});nM.displayName=tM;function rM(t){return t?"open":"closed"}function ju(t){return t==="indeterminate"}function zy(t){return ju(t)?"indeterminate":t?"checked":"unchecked"}function EG(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function SG(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function kG(t,e,n){const o=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,s=n?t.indexOf(n):-1;let i=SG(t,Math.max(s,0));o.length===1&&(i=i.filter(c=>c!==n));const l=i.find(c=>c.toLowerCase().startsWith(o.toLowerCase()));return l!==n?l:void 0}function TG(t,e){const{x:n,y:r}=t;let o=!1;for(let s=0,i=e.length-1;s<e.length;i=s++){const a=e[s],l=e[i],c=a.x,u=a.y,d=l.x,f=l.y;u>r!=f>r&&n<(d-c)*(r-u)/(f-u)+c&&(o=!o)}return o}function CG(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return TG(n,e)}function ul(t){return e=>e.pointerType==="mouse"?t(e):void 0}var AG=$A,MG=jy,OG=FA,RG=HA,NG=Hy,_G=UA,DG=wf,IG=VA,PG=GA,LG=KA,jG=JA,$G=XA,BG=QA,FG=eM,HG=nM,Ef="DropdownMenu",[UG]=Ln(Ef,[LA]),hn=LA(),[zG,oM]=UG(Ef),sM=t=>{const{__scopeDropdownMenu:e,children:n,dir:r,open:o,defaultOpen:s,onOpenChange:i,modal:a=!0}=t,l=hn(e),c=b.useRef(null),[u,d]=po({prop:o,defaultProp:s??!1,onChange:i,caller:Ef});return g.jsx(zG,{scope:e,triggerId:Kn(),triggerRef:c,contentId:Kn(),open:u,onOpenChange:d,onOpenToggle:b.useCallback(()=>d(f=>!f),[d]),modal:a,children:g.jsx(AG,{...l,open:u,onOpenChange:d,dir:r,modal:a,children:n})})};sM.displayName=Ef;var iM="DropdownMenuTrigger",aM=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=t,s=oM(iM,n),i=hn(n);return g.jsx(MG,{asChild:!0,...i,children:g.jsx(ge.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...o,ref:Ld(e,s.triggerRef),onPointerDown:ne(t.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(s.onOpenToggle(),s.open||a.preventDefault())}),onKeyDown:ne(t.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&s.onOpenToggle(),a.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});aM.displayName=iM;var VG="DropdownMenuPortal",lM=t=>{const{__scopeDropdownMenu:e,...n}=t,r=hn(e);return g.jsx(OG,{...r,...n})};lM.displayName=VG;var cM="DropdownMenuContent",uM=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=oM(cM,n),s=hn(n),i=b.useRef(!1);return g.jsx(RG,{id:o.contentId,"aria-labelledby":o.triggerId,...s,...r,ref:e,onCloseAutoFocus:ne(t.onCloseAutoFocus,a=>{i.current||o.triggerRef.current?.focus(),i.current=!1,a.preventDefault()}),onInteractOutside:ne(t.onInteractOutside,a=>{const l=a.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;(!o.modal||u)&&(i.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});uM.displayName=cM;var WG="DropdownMenuGroup",dM=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=hn(n);return g.jsx(NG,{...o,...r,ref:e})});dM.displayName=WG;var GG="DropdownMenuLabel",fM=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=hn(n);return g.jsx(_G,{...o,...r,ref:e})});fM.displayName=GG;var qG="DropdownMenuItem",hM=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=hn(n);return g.jsx(DG,{...o,...r,ref:e})});hM.displayName=qG;var KG="DropdownMenuCheckboxItem",pM=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=hn(n);return g.jsx(IG,{...o,...r,ref:e})});pM.displayName=KG;var YG="DropdownMenuRadioGroup",mM=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=hn(n);return g.jsx(PG,{...o,...r,ref:e})});mM.displayName=YG;var JG="DropdownMenuRadioItem",gM=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=hn(n);return g.jsx(LG,{...o,...r,ref:e})});gM.displayName=JG;var XG="DropdownMenuItemIndicator",yM=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=hn(n);return g.jsx(jG,{...o,...r,ref:e})});yM.displayName=XG;var QG="DropdownMenuSeparator",vM=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=hn(n);return g.jsx($G,{...o,...r,ref:e})});vM.displayName=QG;var ZG="DropdownMenuArrow",e9=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=hn(n);return g.jsx(BG,{...o,...r,ref:e})});e9.displayName=ZG;var t9="DropdownMenuSubTrigger",bM=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=hn(n);return g.jsx(FG,{...o,...r,ref:e})});bM.displayName=t9;var n9="DropdownMenuSubContent",xM=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=hn(n);return g.jsx(HG,{...o,...r,ref:e,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});xM.displayName=n9;var r9=sM,o9=aM,s9=lM,i9=uM,a9=dM,l9=fM,c9=hM,u9=pM,d9=mM,f9=gM,wM=yM,h9=vM,p9=bM,m9=xM;function cw(t){return g.jsx(r9,{"data-slot":"dropdown-menu",...t})}const uw=b.forwardRef((t,e)=>g.jsx(o9,{ref:e,"data-slot":"dropdown-menu-trigger",...t})),dw=b.forwardRef(({className:t,sideOffset:e,...n},r)=>g.jsx(s9,{children:g.jsx("div",{"data-theme":"select-post-builder",children:g.jsx(i9,{ref:r,"data-slot":"dropdown-menu-content",sideOffset:e??4,className:re("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",t),...n})})}));b.forwardRef((t,e)=>g.jsx(a9,{ref:e,"data-slot":"dropdown-menu-group",...t}));const yn=b.forwardRef(({className:t,inset:e,variant:n="default",...r},o)=>g.jsx(c9,{ref:o,"data-slot":"dropdown-menu-item","data-inset":e,"data-variant":n,className:re("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...r}));b.forwardRef(({className:t,children:e,checked:n,...r},o)=>g.jsxs(u9,{ref:o,"data-slot":"dropdown-menu-checkbox-item",className:re("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),checked:n,...r,children:[g.jsx("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:g.jsx(wM,{children:g.jsx(UC,{className:"size-4"})})}),e]}));b.forwardRef((t,e)=>g.jsx(d9,{ref:e,"data-slot":"dropdown-menu-radio-group",...t}));b.forwardRef(({className:t,children:e,...n},r)=>g.jsxs(f9,{ref:r,"data-slot":"dropdown-menu-radio-item",className:re("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...n,children:[g.jsx("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:g.jsx(wM,{children:g.jsx(fV,{className:"size-2 fill-current"})})}),e]}));b.forwardRef(({className:t,inset:e,...n},r)=>g.jsx(l9,{ref:r,"data-slot":"dropdown-menu-label","data-inset":e,className:re("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",t),...n}));b.forwardRef(({className:t,...e},n)=>g.jsx(h9,{ref:n,"data-slot":"dropdown-menu-separator",className:re("bg-border -mx-1 my-1 h-px",t),...e}));b.forwardRef(({className:t,...e},n)=>g.jsx("span",{ref:n,"data-slot":"dropdown-menu-shortcut",className:re("text-muted-foreground ml-auto text-xs tracking-widest",t),...e}));b.forwardRef(({className:t,inset:e,children:n,...r},o)=>g.jsxs(p9,{ref:o,"data-slot":"dropdown-menu-sub-trigger","data-inset":e,className:re("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...r,children:[n,g.jsx(lV,{className:"ml-auto size-4"})]}));b.forwardRef(({className:t,...e},n)=>g.jsx(m9,{ref:n,"data-slot":"dropdown-menu-sub-content",className:re("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",t),...e}));function EM(t){const e=b.useRef({value:t,previous:t});return b.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var Sf="Switch",[g9]=Ln(Sf),[y9,v9]=g9(Sf),SM=b.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:o,defaultChecked:s,required:i,disabled:a,value:l="on",onCheckedChange:c,form:u,...d}=t,[f,h]=b.useState(null),p=Fe(e,E=>h(E)),m=b.useRef(!1),y=f?u||!!f.closest("form"):!0,[v,w]=po({prop:o,defaultProp:s??!1,onChange:c,caller:Sf});return g.jsxs(y9,{scope:n,checked:v,disabled:a,children:[g.jsx(ge.button,{type:"button",role:"switch","aria-checked":v,"aria-required":i,"data-state":AM(v),"data-disabled":a?"":void 0,disabled:a,value:l,...d,ref:p,onClick:ne(t.onClick,E=>{w(x=>!x),y&&(m.current=E.isPropagationStopped(),m.current||E.stopPropagation())})}),y&&g.jsx(CM,{control:f,bubbles:!m.current,name:r,value:l,checked:v,required:i,disabled:a,form:u,style:{transform:"translateX(-100%)"}})]})});SM.displayName=Sf;var kM="SwitchThumb",TM=b.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,o=v9(kM,n);return g.jsx(ge.span,{"data-state":AM(o.checked),"data-disabled":o.disabled?"":void 0,...r,ref:e})});TM.displayName=kM;var b9="SwitchBubbleInput",CM=b.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...o},s)=>{const i=b.useRef(null),a=Fe(i,s),l=EM(n),c=WT(e);return b.useEffect(()=>{const u=i.current;if(!u)return;const d=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(d,"checked").set;if(l!==n&&h){const p=new Event("click",{bubbles:r});h.call(u,n),u.dispatchEvent(p)}},[l,n,r]),g.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:a,style:{...o.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});CM.displayName=b9;function AM(t){return t?"checked":"unchecked"}var x9=SM,w9=TM;function fw({className:t,...e}){return g.jsx(x9,{"data-slot":"switch",className:re("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",t),...e,children:g.jsx(w9,{"data-slot":"switch-thumb",className:re("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}const E9=t=>TT({editor:t,selector:e=>{if(!e?.editor)return null;const n=e.editor,r=n.isActive("codeBlock")??!1;return{isEmpty:n.isEmpty??!1,isFocused:n.isFocused??!1,isBold:n.isActive("bold")??!1,canBold:He(n,"toggleBold"),isItalic:n.isActive("italic")??!1,canItalic:He(n,"toggleItalic"),isStrike:n.isActive("strike")??!1,canStrike:He(n,"toggleStrike"),isCode:n.isActive("code")??!1,canCode:He(n,"toggleCode"),isUnderline:n.isActive("underline")??!1,canUnderline:He(n,"toggleUnderline"),isLink:n.isActive("customLink")??!1,canLink:He(n,"toggleLink",{href:""}),canUnlink:He(n,"unsetLink"),isParagraph:n.isActive("paragraph")??!1,canParagraph:He(n,"setParagraph"),isHeading1:n.isActive("heading",{level:1})??!1,canHeading1:He(n,"setHeading",{level:1}),isHeading2:n.isActive("heading",{level:2})??!1,canHeading2:He(n,"setHeading",{level:2}),isHeading3:n.isActive("heading",{level:3})??!1,canHeading3:He(n,"setHeading",{level:3}),isHeading4:n.isActive("heading",{level:4})??!1,canHeading4:He(n,"setHeading",{level:4}),isHeading5:n.isActive("heading",{level:5})??!1,canHeading5:He(n,"setHeading",{level:5}),isHeading6:n.isActive("heading",{level:6})??!1,canHeading6:He(n,"setHeading",{level:6}),isBulletList:n.isActive("bulletList")??!1,canBulletList:He(n,"toggleBulletList"),isOrderedList:n.isActive("orderedList")??!1,canOrderedList:He(n,"toggleOrderedList"),isTaskList:n.isActive("taskList")??!1,canTaskList:He(n,"toggleTaskList"),isBlockquote:n.isActive("blockquote")??!1,canBlockquote:He(n,"toggleBlockquote"),isCodeBlock:r,canCodeBlock:He(n,"toggleCodeBlock"),isAlignLeft:n.isActive({textAlign:"left"})??!1,canAlignLeft:He(n,"setTextAlign","left")&&!r,isAlignCenter:n.isActive({textAlign:"center"})??!1,canAlignCenter:He(n,"setTextAlign","center")&&!r,isAlignRight:n.isActive({textAlign:"right"})??!1,canAlignRight:He(n,"setTextAlign","right")&&!r,isAlignJustify:n.isActive({textAlign:"justify"})??!1,canAlignJustify:He(n,"setTextAlign","justify")&&!r,canUnsetAlign:He(n,"unsetTextAlign"),canInsertImage:He(n,"insertMedia",{type:xe.Image,src:""}),canInsertVideo:He(n,"insertMedia",{type:xe.Video,src:""}),canInsertAudio:He(n,"insertMedia",{type:xe.Audio,src:""}),isPoll:n?.isActive("poll")??!1,canPoll:He(n,"insertPoll",{choices:[]}),canUndo:He(n,"undo"),canRedo:He(n,"redo"),canClearMarks:He(n,"unsetAllMarks"),canClearNodes:He(n,"clearNodes")}}}),He=(t,e,n)=>{if(!t)return!1;try{const o=t.can().chain()[e];if(typeof o!="function")return!1;const s=o,i=n!==void 0?s(n):s();return typeof i?.run=="function"?i.run():!1}catch{return!1}},hw=t=>{const{doc:e}=t.state,n=t.schema.nodes.mention;if(!n)return!1;let r=!1;return e.descendants(o=>o.type===n&&o.attrs.mentionSuggestionChar==="#"?(r=!0,!1):!r),r},S9=(t,e,n={})=>{const{debounceMs:r=0,checkOnTransaction:o=!0}=n;let s=hw(t),i=null;e(s);const a=()=>{const d=hw(t);d!==s&&(s=d,e(d))},l=()=>{r>0?(i&&clearTimeout(i),i=setTimeout(a,r)):a()},c=o?({transaction:d})=>{d.docChanged&&l()}:null,u=o?null:l;return c?t.on("transaction",c):u&&t.on("update",u),()=>{i&&(clearTimeout(i),i=null),c?t.off("transaction",c):u&&t.off("update",u)}},k9=(t,e)=>{const[n,r]=M.useState(!1),o=M.useMemo(()=>({debounceMs:e?.debounceMs,checkOnTransaction:e?.checkOnTransaction??!0}),[e?.debounceMs,e?.checkOnTransaction]);return M.useEffect(()=>{if(!t){r(!1);return}return S9(t,i=>{r(i)},o)},[t,o]),{showCrossMentionIndicator:n}};function T9(t,e,n={}){const{order:r="depth-first",includeRoot:o=!0,maxDepth:s=-1}=n,i=typeof e!="function";function a(c,u,d,f){if(s!==-1&&f>s)return!0;let h=!0;if(i){const p=e[c.type];p&&p(c,u,d,f)===!1&&(h=!1)}else e(c,u,d,f)===!1&&(h=!1);if(!h)return!1;if(c.content&&Array.isArray(c.content))for(let p=0;p<c.content.length;p++){const m=c.content[p];if(r==="depth-first"){if(!a(m,c,p,f+1))return!1}else if(!a(m,c,p,f+1))return!1}return!0}const l=o?0:1;o?a(t,null,0,0):t.content&&t.content.forEach((c,u)=>{a(c,t,u,l)})}function Kl(t,e,n={}){const r=[],o=n.findAll??!0;return T9(t,s=>{if(s.type===e&&(r.push(s),!o))return!1},n),r}function pw(t,e,n={}){return Kl(t,e,{...n,findAll:!1})[0]||null}const C9={[gt.Text]:{showFormatting:!0,showImage:!0,showVideo:!0,showAudio:!0,showImageSearch:!0},[gt.Media]:{showFormatting:!1,showImage:!0,showVideo:!0,showAudio:!1,showImageSearch:!0},[gt.Link]:{showLink:!0},[gt.Poll]:{}},A9=({actions:t,editorType:e,children:n,isSubmitting:r,onSubmit:o})=>{const s=M.useRef(null),[i,a]=M.useState(null),[l,c]=M.useState(!1),[u,d]=M.useState(!1),[f,h]=M.useState(!1),{editor:p}=ef(),m=E9(p),{showCrossMentionIndicator:y}=k9(p,{debounceMs:150});if(!p)return null;const v=C9[e],w=R=>{m?.isLink&&(p.chain().focus().unsetLink().run(),R.preventDefault())},E=(R,L,$)=>{const B=e===gt.Text?L??R:R;if($){p.commands.updateLink($,{href:R,text:B});return}p.commands.insertLink({href:R,text:B})},x=()=>{const R=p.getJSON();return Kl(R,"media").length>=10?($o.error(`You can upload up to ${Aa} files per post. Please remove some files before adding new ones.`),!0):!1},T=()=>{if(e!==gt.Media){s?.current?.click();return}x()||s?.current?.click()},S=R=>{const L=R.target.files;L?.length&&Array.from({length:e===gt.Media?Aa:L?.length}).forEach((B,U)=>{const j=L.item(U);!j||!i||p.commands.insertMediaWithUpload({source:j,type:i,mediaType:Wo.MEDIA_ITEM})}),R.target.value=""},k=R=>{if(x()){R.preventDefault();return}},C=(R,L)=>{p?.commands.insertMediaWithUpload({source:R,type:xe.Image,mediaType:Wo.IMAGE_ITEM,searchFrom:L})},N=R=>R?.isHeading1?gx:R?.isHeading2?yx:R?.isHeading3?vx:R?.isHeading4?bx:R?.isHeading5?xx:R?.isHeading6?wx:cm;return g.jsxs("div",{className:"flex flex-col grow overflow-y-auto",children:[v.showFormatting&&g.jsxs("div",{className:"shrink-0 flex flex-wrap items-center gap-2 sm:gap-2 p-2",children:[g.jsx(be,{icon:n3,tooltip:"Undo",onClick:t.undo,disabled:!m?.canUndo}),g.jsx(be,{icon:HV,tooltip:"Redo",onClick:t.redo,disabled:!m?.canRedo}),g.jsxs(cw,{children:[g.jsx(uw,{asChild:!0,children:g.jsx(be,{tooltip:"Heading Options",icon:N(m),"aria-label":"More formatting options"})}),g.jsx(dw,{align:"start",className:"w-44 px-1 py-1",children:g.jsxs("div",{className:"flex flex-col items-stretch gap-1",children:[g.jsx(yn,{asChild:!0,children:g.jsxs(be,{className:"w-full justify-start",tooltip:"Paragraph",onClick:t.setParagraph,active:m?.isParagraph,disabled:!m?.canParagraph,children:[g.jsx(cm,{})," Paragraph"]})}),g.jsx(yn,{asChild:!0,children:g.jsxs(be,{className:"w-full justify-start",tooltip:"Heading One",onClick:()=>t.toggleHeading(1),active:m?.isHeading1,disabled:!m?.canHeading1,children:[g.jsx(gx,{})," Heading 1"]})}),g.jsx(yn,{asChild:!0,children:g.jsxs(be,{className:"w-full justify-start",tooltip:"Heading Two",onClick:()=>t.toggleHeading(2),active:m?.isHeading2,disabled:!m?.canHeading2,children:[g.jsx(yx,{})," Heading 2"]})}),g.jsx(yn,{asChild:!0,children:g.jsxs(be,{className:"w-full justify-start",tooltip:"Heading Three",onClick:()=>t.toggleHeading(3),active:m?.isHeading3,disabled:!m?.canHeading3,children:[g.jsx(vx,{})," Heading 3"]})}),g.jsx(yn,{asChild:!0,children:g.jsxs(be,{className:"w-full justify-start",tooltip:"Heading Four",onClick:()=>t.toggleHeading(4),active:m?.isHeading4,disabled:!m?.canHeading4,children:[g.jsx(bx,{})," Heading 4"]})}),g.jsx(yn,{asChild:!0,children:g.jsxs(be,{className:"w-full justify-start",tooltip:"Heading Five",onClick:()=>t.toggleHeading(5),active:m?.isHeading5,disabled:!m?.canHeading5,children:[g.jsx(xx,{})," Heading 5"]})}),g.jsx(yn,{asChild:!0,children:g.jsxs(be,{className:"w-full justify-start",tooltip:"Heading Six",onClick:()=>t.toggleHeading(6),active:m?.isHeading6,disabled:!m?.canHeading6,children:[g.jsx(wx,{})," Heading 6"]})})]})})]}),g.jsx(ui,{}),g.jsx(be,{icon:oV,tooltip:"Bold",onClick:t.toggleBold,active:m?.isBold,disabled:!m?.canBold}),g.jsxs("div",{className:"hidden xl:flex items-center gap-2",children:[g.jsx(be,{icon:Ex,tooltip:"Italic",onClick:t.toggleItalic,active:m?.isItalic,disabled:!m?.canItalic}),g.jsx(be,{icon:Sx,tooltip:"Strikethrough",onClick:t.toggleStrikethrough,active:m?.isStrike,disabled:!m?.canStrike})]}),g.jsx(be,{icon:e3,tooltip:"Underline",onClick:t.toggleUnderline,active:m?.isUnderline,disabled:!m?.canUnderline}),g.jsx(ui,{}),g.jsx(dm,{open:l,onOpenChange:c,onInsertLink:E,children:g.jsx(be,{icon:im,tooltip:"Link",onClick:w,active:m?.isLink,disabled:!m?.canLink})}),g.jsx(be,{icon:LV,tooltip:"Bullet List",onClick:t.toggleBulletList,active:m?.isBulletList,disabled:!m?.canBulletList}),g.jsx(be,{icon:IV,tooltip:"Ordered List",onClick:t.toggleOrderedList,active:m?.isOrderedList,disabled:!m?.canOrderedList}),g.jsx(ui,{}),g.jsxs("div",{className:"hidden xl:flex flex-wrap items-center gap-2",children:[g.jsx(be,{icon:hx,tooltip:"Code",onClick:t.toggleCode,active:m?.isCode,disabled:!m?.canCode}),g.jsx(be,{icon:px,tooltip:"Codeblock",onClick:t.toggleCodeBlock,active:m?.isCodeBlock,disabled:!m?.canCodeBlock}),g.jsx(ui,{}),g.jsx(be,{icon:Nu,tooltip:"Align Left",onClick:()=>t.toggleTextAlign(tt.LEFT),active:m?.isAlignLeft,disabled:!m?.canAlignLeft}),g.jsx(be,{icon:am,tooltip:"Align Center",onClick:()=>t.toggleTextAlign(tt.CENTER),active:m?.isAlignCenter,disabled:!m?.canAlignCenter}),g.jsx(be,{icon:lm,tooltip:"Align Right",onClick:()=>t.toggleTextAlign(tt.RIGHT),active:m?.isAlignRight,disabled:!m?.canAlignRight})]}),g.jsx("div",{className:"flex xl:hidden",children:g.jsxs(cw,{children:[g.jsx(uw,{asChild:!0,children:g.jsx(be,{tooltip:"More formatting options",icon:mV,"aria-label":"More formatting options"})}),g.jsx(dw,{align:"end",className:"w-fit px-2 py-1",children:g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(yn,{asChild:!0,children:g.jsx(be,{icon:Ex,tooltip:"Italic",onClick:t.toggleItalic,active:m?.isItalic,disabled:!m?.canItalic})}),g.jsx(yn,{asChild:!0,children:g.jsx(be,{icon:Sx,tooltip:"Strikethrough",onClick:t.toggleStrikethrough,active:m?.isStrike,disabled:!m?.canStrike})}),g.jsx(yn,{asChild:!0,children:g.jsx(be,{icon:hx,tooltip:"Code",onClick:t.toggleCode,active:m?.isCode,disabled:!m?.canCode})}),g.jsx(yn,{asChild:!0,children:g.jsx(be,{icon:px,tooltip:"Codeblock",onClick:t.toggleCodeBlock,active:m?.isCodeBlock,disabled:!m?.canCodeBlock})}),g.jsx(yn,{asChild:!0,children:g.jsx(be,{icon:Nu,tooltip:"Align Left",onClick:()=>t.toggleTextAlign(tt.LEFT),active:m?.isAlignLeft,disabled:!m?.canAlignLeft})}),g.jsx(yn,{asChild:!0,children:g.jsx(be,{icon:am,tooltip:"Align Center",onClick:()=>t.toggleTextAlign(tt.CENTER),active:m?.isAlignCenter,disabled:!m?.canAlignCenter})}),g.jsx(yn,{asChild:!0,children:g.jsx(be,{icon:lm,tooltip:"Align Right",onClick:()=>t.toggleTextAlign(tt.RIGHT),active:m?.isAlignRight,disabled:!m?.canAlignRight})})]})})]})})]}),n,y&&g.jsxs("div",{className:"sm:hidden flex items-center space-x-2 px-2",children:[g.jsx(fw,{id:"send-cross-mention",checked:f,onCheckedChange:h}),g.jsxs(um,{htmlFor:"send-cross-mention",className:"text-xs",children:["Cross-post to groups you #mention? ",g.jsx(mx,{className:"size-4"})]})]}),g.jsxs("div",{className:"shrink-0 flex items-center sm:gap-2 p-2 border-t",children:[g.jsx("input",{ref:s,type:"file",multiple:!0,maxLength:2,accept:kD[i||xe.Image],hidden:!0,onChange:S}),v.showImage&&g.jsx(be,{icon:VC,tooltip:"Insert Image",disabled:!m?.canInsertImage,onMouseOver:()=>a(xe.Image),onClick:T}),v.showVideo&&g.jsx(be,{icon:xy,disabled:!m?.canInsertVideo,tooltip:"Insert Video",onMouseOver:()=>a(xe.Video),onClick:T}),v.showAudio&&g.jsx(be,{icon:Ru,disabled:!m?.canInsertAudio,tooltip:"Insert Audio",onMouseOver:()=>a(xe.Audio),onClick:T}),v.showImageSearch&&g.jsxs(g.Fragment,{children:[g.jsx(ui,{}),g.jsx(IA,{open:u,onOpenChange:d,onImageSelect:C,children:g.jsx(be,{onClick:k,disabled:!m?.canInsertImage,icon:MV,tooltip:"Search Gif/Images Online"})})]}),v.showLink&&g.jsx(dm,{hideTextInput:!0,open:l,onOpenChange:c,onInsertLink:E,children:g.jsx(be,{icon:im,tooltip:"Add link with preview",onClick:w,active:m?.isLink,disabled:!m?.canLink})}),y&&g.jsxs(g.Fragment,{children:[g.jsx(ui,{}),g.jsxs("div",{className:"hidden sm:flex items-center space-x-2 px-2",children:[g.jsx(fw,{id:"send-cross-mention"}),g.jsxs(um,{htmlFor:"send-cross-mention",children:["Cross-post to groups you #mention? ",g.jsx(mx,{})]})]})]}),g.jsxs(Zn,{disabled:m?.isEmpty||r,onClick:()=>o(f),className:re("cursor-pointer bg-primary-send hover:bg-primary-send/85 active:scale-95 w-fit ml-auto"),children:["Post ",r?g.jsx(mf,{}):g.jsx(VV,{})]})]})]})},ui=()=>g.jsx("div",{className:"h-3 w-px bg-border"}),mw=t=>{let e;const n=new Set,r=(c,u)=>{const d=typeof c=="function"?c(e):c;if(!Object.is(d,e)){const f=e;e=u??(typeof d!="object"||d===null)?d:Object.assign({},e,d),n.forEach(h=>h(e,f))}},o=()=>e,a={setState:r,getState:o,getInitialState:()=>l,subscribe:c=>(n.add(c),()=>n.delete(c))},l=e=t(r,o,a);return a},M9=(t=>t?mw(t):mw),O9=t=>{const e=t.postId&&t.groupId?"post":t.groupId?"group":"global";return M9((n,r)=>({contextType:e,groupId:t.groupId??null,postId:t.postId??null,selectedGroupId:t.groupId??null,enableGroupSelector:!t.groupId,editor:null,setEditor:o=>n({editor:o}),setContext:o=>n({contextType:o,enableGroupSelector:o==="global"}),setGroupId:o=>n({groupId:o,selectedGroupId:o??null,enableGroupSelector:!o}),setPostId:o=>n({postId:o}),selectGroup:o=>n({selectedGroupId:o}),getMentionParams:()=>{const{contextType:o,groupId:s,postId:i,selectedGroupId:a}=r();if(o==="post"&&s&&i)return{groupId:s,postId:i};const l=a||s||void 0;return l?{groupId:l}:null}}))};var $u=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,r,n]},R9=/^\s*>\s$/,N9=_t.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return $u("blockquote",{...Be(this.options.HTMLAttributes,t),children:$u("slot",{})})},parseMarkdown:(t,e)=>e.createNode("blockquote",void 0,e.parseChildren(t.tokens||[])),renderMarkdown:(t,e)=>{if(!t.content)return"";const n=[];return t.content.forEach(o=>{const i=e.renderChildren(o).split(`
|
|
515
|
+
`).map(a=>`> ${a}`).join(`
|
|
516
|
+
`);n.push(i)}),n.flatMap(o=>[o,"> "]).slice(0,-1).join(`
|
|
517
|
+
`)},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Di({find:R9,type:this.type})]}}),_9=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,D9=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,I9=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,P9=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,L9=wo.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return $u("strong",{...Be(this.options.HTMLAttributes,t),children:$u("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[_i({find:_9,type:this.type}),_i({find:I9,type:this.type})]},addPasteRules(){return[js({find:D9,type:this.type}),js({find:P9,type:this.type})]}}),j9=/(^|[^`])`([^`]+)`(?!`)$/,$9=/(^|[^`])`([^`]+)`(?!`)/g,B9=wo.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Be(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[_i({find:j9,type:this.type})]},addPasteRules(){return[js({find:$9,type:this.type})]}}),Hh=4,F9=/^```([a-z]+)?[\s\n]$/,H9=/^~~~([a-z]+)?[\s\n]$/,U9=_t.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Hh,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options;if(!n)return null;const s=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]].filter(i=>i.startsWith(n)).map(i=>i.replace(n,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",Be(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var n;return((n=t.raw)==null?void 0:n.startsWith("```"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var n;let r="";const o=((n=t.attrs)==null?void 0:n.language)||"";return t.content?r=[`\`\`\`${o}`,e.renderChildren(t.content),"```"].join(`
|
|
518
|
+
`):r=`\`\`\`${o}
|
|
519
|
+
|
|
520
|
+
\`\`\``,r},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:Hh,{state:r}=t,{selection:o}=r,{$from:s,empty:i}=o;if(s.parent.type!==this.type)return!1;const a=" ".repeat(n);return i?t.commands.insertContent(a):t.commands.command(({tr:l})=>{const{from:c,to:u}=o,h=r.doc.textBetween(c,u,`
|
|
521
|
+
`,`
|
|
522
|
+
`).split(`
|
|
523
|
+
`).map(p=>a+p).join(`
|
|
524
|
+
`);return l.replaceWith(c,u,r.schema.text(h)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:Hh,{state:r}=t,{selection:o}=r,{$from:s,empty:i}=o;return s.parent.type!==this.type?!1:i?t.commands.command(({tr:a})=>{var l;const{pos:c}=s,u=s.start(),d=s.end(),h=r.doc.textBetween(u,d,`
|
|
525
|
+
`,`
|
|
526
|
+
`).split(`
|
|
527
|
+
`);let p=0,m=0;const y=c-u;for(let S=0;S<h.length;S+=1){if(m+h[S].length>=y){p=S;break}m+=h[S].length+1}const w=((l=h[p].match(/^ */))==null?void 0:l[0])||"",E=Math.min(w.length,n);if(E===0)return!0;let x=u;for(let S=0;S<p;S+=1)x+=h[S].length+1;return a.delete(x,x+E),c-x<=E&&a.setSelection(pe.create(a.doc,x)),!0}):t.commands.command(({tr:a})=>{const{from:l,to:c}=o,f=r.doc.textBetween(l,c,`
|
|
528
|
+
`,`
|
|
529
|
+
`).split(`
|
|
530
|
+
`).map(h=>{var p;const m=((p=h.match(/^ */))==null?void 0:p[0])||"",y=Math.min(m.length,n);return h.slice(y)}).join(`
|
|
531
|
+
`);return a.replaceWith(l,c,r.schema.text(f)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:o}=n;if(!o||r.parent.type!==this.type)return!1;const s=r.parentOffset===r.parent.nodeSize-2,i=r.parent.textContent.endsWith(`
|
|
532
|
+
|
|
533
|
+
`);return!s||!i?!1:t.chain().command(({tr:a})=>(a.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:o,empty:s}=n;if(!s||o.parent.type!==this.type||!(o.parentOffset===o.parent.nodeSize-2))return!1;const a=o.after();return a===void 0?!1:r.nodeAt(a)?t.commands.command(({tr:c})=>(c.setSelection(Oe.near(r.resolve(a))),!0)):t.commands.exitCode()}}},addInputRules(){return[Jp({find:F9,type:this.type,getAttributes:t=>({language:t[1]})}),Jp({find:H9,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Ue({key:new We("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),o=r?JSON.parse(r):void 0,s=o?.mode;if(!n||!s)return!1;const{tr:i,schema:a}=t.state,l=a.text(n.replace(/\r\n?/g,`
|
|
534
|
+
`));return i.replaceSelectionWith(this.type.create({language:s},l)),i.selection.$from.parent.type!==this.type&&i.setSelection(pe.near(i.doc.resolve(Math.max(0,i.selection.from-2)))),i.setMeta("paste",!0),t.dispatch(i),!0}}})]}}),MM=_t.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
|
|
535
|
+
|
|
536
|
+
`):""}),z9=MM,OM=_t.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",Be(this.options.HTMLAttributes,t)]},renderText(){return`
|
|
537
|
+
`},renderMarkdown:(t,e)=>e.indent(`
|
|
538
|
+
`),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:o,storedMarks:s}=n;if(o.$from.parent.type.spec.isolating)return!1;const{keepMarks:i}=this.options,{splittableMarks:a}=r.extensionManager,l=s||o.$to.parentOffset&&o.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&l&&i){const d=l.filter(f=>a.includes(f.type.name));c.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Vy=OM,V9=_t.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,Be(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;const r=(n=t.attrs)!=null&&n.level?parseInt(t.attrs.level,10):1,o="#".repeat(r);return t.content?`${o} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>Jp({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),W9=_t.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Be(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!uF(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,o=t();return cT(n)?o.insertContentAt(r.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({state:s,tr:i,dispatch:a})=>{if(a){const{$to:l}=i.selection,c=l.end();if(l.nodeAfter)l.nodeAfter.isTextblock?i.setSelection(pe.create(i.doc,l.pos+1)):l.nodeAfter.isBlock?i.setSelection(ue.create(i.doc,l.pos)):i.setSelection(pe.create(i.doc,l.pos));else{const u=s.schema.nodes[this.options.nextNodeType]||l.parent.type.contentMatch.defaultType,d=u?.create();d&&(i.insert(c,d),i.setSelection(pe.create(i.doc,c+1)))}i.scrollIntoView()}return!0}).run()}}},addInputRules(){return[cF({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),G9=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,q9=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,K9=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Y9=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,J9=wo.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",Be(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[_i({find:G9,type:this.type}),_i({find:K9,type:this.type})]},addPasteRules(){return[js({find:q9,type:this.type}),js({find:Y9,type:this.type})]}});const X9="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Q9="ελ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",vm="numeric",bm="ascii",xm="alpha",Pa="asciinumeric",Ta="alphanumeric",wm="domain",RM="emoji",Z9="scheme",eq="slashscheme",Uh="whitespace";function tq(t,e){return t in e||(e[t]=[]),e[t]}function Ss(t,e,n){e[vm]&&(e[Pa]=!0,e[Ta]=!0),e[bm]&&(e[Pa]=!0,e[xm]=!0),e[Pa]&&(e[Ta]=!0),e[xm]&&(e[Ta]=!0),e[Ta]&&(e[wm]=!0),e[RM]&&(e[wm]=!0);for(const r in e){const o=tq(r,n);o.indexOf(t)<0&&o.push(t)}}function nq(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function bn(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}bn.groups={};bn.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){const o=e.jr[r][0],s=e.jr[r][1];if(s&&o.test(t))return s}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let o=0;o<t.length;o++)this.tt(t[o],e,n,r)},tr(t,e,n,r){r=r||bn.groups;let o;return e&&e.j?o=e:(o=new bn(e),n&&r&&Ss(e,n,r)),this.jr.push([t,o]),o},ts(t,e,n,r){let o=this;const s=t.length;if(!s)return o;for(let i=0;i<s-1;i++)o=o.tt(t[i]);return o.tt(t[s-1],e,n,r)},tt(t,e,n,r){r=r||bn.groups;const o=this;if(e&&e.j)return o.j[t]=e,e;const s=e;let i,a=o.go(t);if(a?(i=new bn,Object.assign(i.j,a.j),i.jr.push.apply(i.jr,a.jr),i.jd=a.jd,i.t=a.t):i=new bn,s){if(r)if(i.t&&typeof i.t=="string"){const l=Object.assign(nq(i.t,r),n);Ss(s,l,r)}else n&&Ss(s,n,r);i.t=s}return o.j[t]=i,i}};const Ne=(t,e,n,r,o)=>t.ta(e,n,r,o),ht=(t,e,n,r,o)=>t.tr(e,n,r,o),gw=(t,e,n,r,o)=>t.ts(e,n,r,o),q=(t,e,n,r,o)=>t.tt(e,n,r,o),eo="WORD",Em="UWORD",NM="ASCIINUMERICAL",_M="ALPHANUMERICAL",dl="LOCALHOST",Sm="TLD",km="UTLD",Xc="SCHEME",mi="SLASH_SCHEME",Wy="NUM",Tm="WS",Gy="NL",La="OPENBRACE",ja="CLOSEBRACE",Bu="OPENBRACKET",Fu="CLOSEBRACKET",Hu="OPENPAREN",Uu="CLOSEPAREN",zu="OPENANGLEBRACKET",Vu="CLOSEANGLEBRACKET",Wu="FULLWIDTHLEFTPAREN",Gu="FULLWIDTHRIGHTPAREN",qu="LEFTCORNERBRACKET",Ku="RIGHTCORNERBRACKET",Yu="LEFTWHITECORNERBRACKET",Ju="RIGHTWHITECORNERBRACKET",Xu="FULLWIDTHLESSTHAN",Qu="FULLWIDTHGREATERTHAN",Zu="AMPERSAND",ed="APOSTROPHE",td="ASTERISK",Io="AT",nd="BACKSLASH",rd="BACKTICK",od="CARET",jo="COLON",qy="COMMA",sd="DOLLAR",_r="DOT",id="EQUALS",Ky="EXCLAMATION",zn="HYPHEN",$a="PERCENT",ad="PIPE",ld="PLUS",cd="POUND",Ba="QUERY",Yy="QUOTE",DM="FULLWIDTHMIDDLEDOT",Jy="SEMI",Dr="SLASH",Fa="TILDE",ud="UNDERSCORE",IM="EMOJI",dd="SYM";var PM=Object.freeze({__proto__:null,ALPHANUMERICAL:_M,AMPERSAND:Zu,APOSTROPHE:ed,ASCIINUMERICAL:NM,ASTERISK:td,AT:Io,BACKSLASH:nd,BACKTICK:rd,CARET:od,CLOSEANGLEBRACKET:Vu,CLOSEBRACE:ja,CLOSEBRACKET:Fu,CLOSEPAREN:Uu,COLON:jo,COMMA:qy,DOLLAR:sd,DOT:_r,EMOJI:IM,EQUALS:id,EXCLAMATION:Ky,FULLWIDTHGREATERTHAN:Qu,FULLWIDTHLEFTPAREN:Wu,FULLWIDTHLESSTHAN:Xu,FULLWIDTHMIDDLEDOT:DM,FULLWIDTHRIGHTPAREN:Gu,HYPHEN:zn,LEFTCORNERBRACKET:qu,LEFTWHITECORNERBRACKET:Yu,LOCALHOST:dl,NL:Gy,NUM:Wy,OPENANGLEBRACKET:zu,OPENBRACE:La,OPENBRACKET:Bu,OPENPAREN:Hu,PERCENT:$a,PIPE:ad,PLUS:ld,POUND:cd,QUERY:Ba,QUOTE:Yy,RIGHTCORNERBRACKET:Ku,RIGHTWHITECORNERBRACKET:Ju,SCHEME:Xc,SEMI:Jy,SLASH:Dr,SLASH_SCHEME:mi,SYM:dd,TILDE:Fa,TLD:Sm,UNDERSCORE:ud,UTLD:km,UWORD:Em,WORD:eo,WS:Tm});const Xr=/[a-z]/,fa=new RegExp("\\p{L}","u"),zh=new RegExp("\\p{Emoji}","u"),Qr=/\d/,Vh=/\s/,yw="\r",Wh=`
|
|
539
|
+
`,rq="️",oq="",Gh="";let Ac=null,Mc=null;function sq(t=[]){const e={};bn.groups=e;const n=new bn;Ac==null&&(Ac=vw(X9)),Mc==null&&(Mc=vw(Q9)),q(n,"'",ed),q(n,"{",La),q(n,"}",ja),q(n,"[",Bu),q(n,"]",Fu),q(n,"(",Hu),q(n,")",Uu),q(n,"<",zu),q(n,">",Vu),q(n,"(",Wu),q(n,")",Gu),q(n,"「",qu),q(n,"」",Ku),q(n,"『",Yu),q(n,"』",Ju),q(n,"<",Xu),q(n,">",Qu),q(n,"&",Zu),q(n,"*",td),q(n,"@",Io),q(n,"`",rd),q(n,"^",od),q(n,":",jo),q(n,",",qy),q(n,"$",sd),q(n,".",_r),q(n,"=",id),q(n,"!",Ky),q(n,"-",zn),q(n,"%",$a),q(n,"|",ad),q(n,"+",ld),q(n,"#",cd),q(n,"?",Ba),q(n,'"',Yy),q(n,"/",Dr),q(n,";",Jy),q(n,"~",Fa),q(n,"_",ud),q(n,"\\",nd),q(n,"・",DM);const r=ht(n,Qr,Wy,{[vm]:!0});ht(r,Qr,r);const o=ht(r,Xr,NM,{[Pa]:!0}),s=ht(r,fa,_M,{[Ta]:!0}),i=ht(n,Xr,eo,{[bm]:!0});ht(i,Qr,o),ht(i,Xr,i),ht(o,Qr,o),ht(o,Xr,o);const a=ht(n,fa,Em,{[xm]:!0});ht(a,Xr),ht(a,Qr,s),ht(a,fa,a),ht(s,Qr,s),ht(s,Xr),ht(s,fa,s);const l=q(n,Wh,Gy,{[Uh]:!0}),c=q(n,yw,Tm,{[Uh]:!0}),u=ht(n,Vh,Tm,{[Uh]:!0});q(n,Gh,u),q(c,Wh,l),q(c,Gh,u),ht(c,Vh,u),q(u,yw),q(u,Wh),ht(u,Vh,u),q(u,Gh,u);const d=ht(n,zh,IM,{[RM]:!0});q(d,"#"),ht(d,zh,d),q(d,rq,d);const f=q(d,oq);q(f,"#"),ht(f,zh,d);const h=[[Xr,i],[Qr,o]],p=[[Xr,null],[fa,a],[Qr,s]];for(let m=0;m<Ac.length;m++)Ao(n,Ac[m],Sm,eo,h);for(let m=0;m<Mc.length;m++)Ao(n,Mc[m],km,Em,p);Ss(Sm,{tld:!0,ascii:!0},e),Ss(km,{utld:!0,alpha:!0},e),Ao(n,"file",Xc,eo,h),Ao(n,"mailto",Xc,eo,h),Ao(n,"http",mi,eo,h),Ao(n,"https",mi,eo,h),Ao(n,"ftp",mi,eo,h),Ao(n,"ftps",mi,eo,h),Ss(Xc,{scheme:!0,ascii:!0},e),Ss(mi,{slashscheme:!0,ascii:!0},e),t=t.sort((m,y)=>m[0]>y[0]?1:-1);for(let m=0;m<t.length;m++){const y=t[m][0],w=t[m][1]?{[Z9]:!0}:{[eq]:!0};y.indexOf("-")>=0?w[wm]=!0:Xr.test(y)?Qr.test(y)?w[Pa]=!0:w[bm]=!0:w[vm]=!0,gw(n,y,y,w)}return gw(n,"localhost",dl,{ascii:!0}),n.jd=new bn(dd),{start:n,tokens:Object.assign({groups:e},PM)}}function LM(t,e){const n=iq(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=n.length,o=[];let s=0,i=0;for(;i<r;){let a=t,l=null,c=0,u=null,d=-1,f=-1;for(;i<r&&(l=a.go(n[i]));)a=l,a.accepts()?(d=0,f=0,u=a):d>=0&&(d+=n[i].length,f++),c+=n[i].length,s+=n[i].length,i++;s-=d,i-=f,c-=d,o.push({t:u.t,v:e.slice(s-c,s),s:s-c,e:s})}return o}function iq(t){const e=[],n=t.length;let r=0;for(;r<n;){let o=t.charCodeAt(r),s,i=o<55296||o>56319||r+1===n||(s=t.charCodeAt(r+1))<56320||s>57343?t[r]:t.slice(r,r+2);e.push(i),r+=i.length}return e}function Ao(t,e,n,r,o){let s;const i=e.length;for(let a=0;a<i-1;a++){const l=e[a];t.j[l]?s=t.j[l]:(s=new bn(r),s.jr=o.slice(),t.j[l]=s),t=s}return s=new bn(n),s.jr=o.slice(),t.j[e[i-1]]=s,s}function vw(t){const e=[],n=[];let r=0,o="0123456789";for(;r<t.length;){let s=0;for(;o.indexOf(t[r+s])>=0;)s++;if(s>0){e.push(n.join(""));for(let i=parseInt(t.substring(r,r+s),10);i>0;i--)n.pop();r+=s}else n.push(t[r]),r++}return e}const fl={defaultProtocol:"http",events:null,format:bw,formatHref:bw,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Xy(t,e=null){let n=Object.assign({},fl);t&&(n=Object.assign(n,t instanceof Xy?t.o:t));const r=n.ignoreTags,o=[];for(let s=0;s<r.length;s++)o.push(r[s].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=o}Xy.prototype={o:fl,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let o=this.o[t];return o&&(typeof o=="object"?(o=n.t in o?o[n.t]:fl[t],typeof o=="function"&&r&&(o=o(e,n))):typeof o=="function"&&r&&(o=o(e,n.t,n)),o)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function bw(t){return t}function jM(t,e){this.t="token",this.v=t,this.tk=e}jM.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=fl.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),o=t.get("tagName",n,e),s=this.toFormattedString(t),i={},a=t.get("className",n,e),l=t.get("target",n,e),c=t.get("rel",n,e),u=t.getObj("attributes",n,e),d=t.getObj("events",n,e);return i.href=r,a&&(i.class=a),l&&(i.target=l),c&&(i.rel=c),u&&Object.assign(i,u),{tagName:o,attributes:i,content:s,eventListeners:d}}};function kf(t,e){class n extends jM{constructor(o,s){super(o,s),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const xw=kf("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),ww=kf("text"),aq=kf("nl"),Oc=kf("url",{isLink:!0,toHref(t=fl.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==dl&&t[1].t===jo}}),Un=t=>new bn(t);function lq({groups:t}){const e=t.domain.concat([Zu,td,Io,nd,rd,od,sd,id,zn,Wy,$a,ad,ld,cd,Dr,dd,Fa,ud]),n=[ed,jo,qy,_r,Ky,$a,Ba,Yy,Jy,zu,Vu,La,ja,Fu,Bu,Hu,Uu,Wu,Gu,qu,Ku,Yu,Ju,Xu,Qu],r=[Zu,ed,td,nd,rd,od,sd,id,zn,La,ja,$a,ad,ld,cd,Ba,Dr,dd,Fa,ud],o=Un(),s=q(o,Fa);Ne(s,r,s),Ne(s,t.domain,s);const i=Un(),a=Un(),l=Un();Ne(o,t.domain,i),Ne(o,t.scheme,a),Ne(o,t.slashscheme,l),Ne(i,r,s),Ne(i,t.domain,i);const c=q(i,Io);q(s,Io,c),q(a,Io,c),q(l,Io,c);const u=q(s,_r);Ne(u,r,s),Ne(u,t.domain,s);const d=Un();Ne(c,t.domain,d),Ne(d,t.domain,d);const f=q(d,_r);Ne(f,t.domain,d);const h=Un(xw);Ne(f,t.tld,h),Ne(f,t.utld,h),q(c,dl,h);const p=q(d,zn);q(p,zn,p),Ne(p,t.domain,d),Ne(h,t.domain,d),q(h,_r,f),q(h,zn,p);const m=q(h,jo);Ne(m,t.numeric,xw);const y=q(i,zn),v=q(i,_r);q(y,zn,y),Ne(y,t.domain,i),Ne(v,r,s),Ne(v,t.domain,i);const w=Un(Oc);Ne(v,t.tld,w),Ne(v,t.utld,w),Ne(w,t.domain,i),Ne(w,r,s),q(w,_r,v),q(w,zn,y),q(w,Io,c);const E=q(w,jo),x=Un(Oc);Ne(E,t.numeric,x);const T=Un(Oc),S=Un();Ne(T,e,T),Ne(T,n,S),Ne(S,e,T),Ne(S,n,S),q(w,Dr,T),q(x,Dr,T);const k=q(a,jo),C=q(l,jo),N=q(C,Dr),R=q(N,Dr);Ne(a,t.domain,i),q(a,_r,v),q(a,zn,y),Ne(l,t.domain,i),q(l,_r,v),q(l,zn,y),Ne(k,t.domain,T),q(k,Dr,T),q(k,Ba,T),Ne(R,t.domain,T),Ne(R,e,T),q(R,Dr,T);const L=[[La,ja],[Bu,Fu],[Hu,Uu],[zu,Vu],[Wu,Gu],[qu,Ku],[Yu,Ju],[Xu,Qu]];for(let $=0;$<L.length;$++){const[B,U]=L[$],j=q(T,B);q(S,B,j),q(j,U,T);const P=Un(Oc);Ne(j,e,P);const H=Un();Ne(j,n),Ne(P,e,P),Ne(P,n,H),Ne(H,e,P),Ne(H,n,H),q(P,U,T),q(H,U,T)}return q(o,dl,w),q(o,Gy,aq),{start:o,tokens:PM}}function cq(t,e,n){let r=n.length,o=0,s=[],i=[];for(;o<r;){let a=t,l=null,c=null,u=0,d=null,f=-1;for(;o<r&&!(l=a.go(n[o].t));)i.push(n[o++]);for(;o<r&&(c=l||a.go(n[o].t));)l=null,a=c,a.accepts()?(f=0,d=a):f>=0&&f++,o++,u++;if(f<0)o-=u,o<r&&(i.push(n[o]),o++);else{i.length>0&&(s.push(qh(ww,e,i)),i=[]),o-=f,u-=f;const h=d.t,p=n.slice(o-u,o);s.push(qh(h,e,p))}}return i.length>0&&s.push(qh(ww,e,i)),s}function qh(t,e,n){const r=n[0].s,o=n[n.length-1].e,s=e.slice(r,o);return new t(s,n)}const uq=typeof console<"u"&&console&&console.warn||(()=>{}),dq="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",ot={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function fq(){return bn.groups={},ot.scanner=null,ot.parser=null,ot.tokenQueue=[],ot.pluginQueue=[],ot.customSchemes=[],ot.initialized=!1,ot}function Ew(t,e=!1){if(ot.initialized&&uq(`linkifyjs: already initialized - will not register custom scheme "${t}" ${dq}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
|
|
540
|
+
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
541
|
+
2. Cannot start or end with "-"
|
|
542
|
+
3. "-" cannot repeat`);ot.customSchemes.push([t,e])}function hq(){ot.scanner=sq(ot.customSchemes);for(let t=0;t<ot.tokenQueue.length;t++)ot.tokenQueue[t][1]({scanner:ot.scanner});ot.parser=lq(ot.scanner.tokens);for(let t=0;t<ot.pluginQueue.length;t++)ot.pluginQueue[t][1]({scanner:ot.scanner,parser:ot.parser});return ot.initialized=!0,ot}function Qy(t){return ot.initialized||hq(),cq(ot.parser.start,t,LM(ot.scanner.start,t))}Qy.scan=LM;function $M(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new Xy(n),o=Qy(t),s=[];for(let i=0;i<o.length;i++){const a=o[i];a.isLink&&(!e||a.t===e)&&r.check(a)&&s.push(a.toFormattedObject(r))}return s}var Zy="[\0- -\u2029 ]",pq=new RegExp(Zy),mq=new RegExp(`${Zy}$`),gq=new RegExp(Zy,"g");function yq(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function vq(t){return new Ue({key:new We("autolink"),appendTransaction:(e,n,r)=>{const o=e.some(c=>c.docChanged)&&!n.doc.eq(r.doc),s=e.some(c=>c.getMeta("preventAutolink"));if(!o||s)return;const{tr:i}=r,a=tT(n.doc,[...e]);if(lT(a).forEach(({newRange:c})=>{const u=pB(r.doc,c,h=>h.isTextblock);let d,f;if(u.length>1)d=u[0],f=r.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ");else if(u.length){const h=r.doc.textBetween(c.from,c.to," "," ");if(!mq.test(h))return;d=u[0],f=r.doc.textBetween(d.pos,c.to,void 0," ")}if(d&&f){const h=f.split(pq).filter(Boolean);if(h.length<=0)return!1;const p=h[h.length-1],m=d.pos+f.lastIndexOf(p);if(!p)return!1;const y=Qy(p).map(v=>v.toObject(t.defaultProtocol));if(!yq(y))return!1;y.filter(v=>v.isLink).map(v=>({...v,from:m+v.start+1,to:m+v.end+1})).filter(v=>r.schema.marks.code?!r.doc.rangeHasMark(v.from,v.to,r.schema.marks.code):!0).filter(v=>t.validate(v.value)).filter(v=>t.shouldAutoLink(v.value)).forEach(v=>{Jg(v.from,v.to,r.doc).some(w=>w.mark.type===t.type)||i.addMark(v.from,v.to,t.type.create({href:v.href}))})}}),!!i.steps.length)return i}})}function bq(t){return new Ue({key:new We("handleClickLink"),props:{handleClick:(e,n,r)=>{var o,s;if(r.button!==0||!e.editable)return!1;let i=null;if(r.target instanceof HTMLAnchorElement)i=r.target;else{let u=r.target;const d=[];for(;u.nodeName!=="DIV";)d.push(u),u=u.parentNode;i=d.find(f=>f.nodeName==="A")}if(!i)return!1;const a=aT(e.state,t.type.name),l=(o=i?.href)!=null?o:a.href,c=(s=i?.target)!=null?s:a.target;return t.enableClickSelection&&t.editor.commands.extendMarkRange(t.type.name),i&&l?(window.open(l,c),!0):!1}}})}function xq(t){return new Ue({key:new We("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:o}=t,{state:s}=e,{selection:i}=s,{empty:a}=i;if(a)return!1;let l="";r.content.forEach(u=>{l+=u.textContent});const c=$M(l,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===l);return!l||!c||o!==void 0&&!o(c.href)?!1:t.editor.commands.setMark(t.type,{href:c.href})}}})}function No(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const o=typeof r=="string"?r:r.scheme;o&&n.push(o)}),!t||t.replace(gq,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var BM=wo.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){Ew(t);return}Ew(t.scheme,t.optionalSlashes)})},onDestroy(){fq()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!No(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>!!t}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!No(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!No(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Be(this.options.HTMLAttributes,t),0]:["a",Be(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n;const r=((n=t.attrs)==null?void 0:n.href)||"";return`[${e.renderChildren(t)}](${r})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!No(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!No(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[js({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,o=$M(t).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:i=>!!No(i,n),protocols:n,defaultProtocol:r}));o.length&&o.forEach(s=>{this.options.shouldAutoLink(s.value)&&e.push({text:s.value,data:{href:s.href},index:s.start})})}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(vq({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!No(o,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(bq({type:this.type,editor:this.editor,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(xq({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),ev=BM,wq=Object.defineProperty,Eq=(t,e)=>{for(var n in e)wq(t,n,{get:e[n],enumerable:!0})},Sq="listItem",Sw="textStyle",kw=/^\s*([-+*])\s$/,FM=_t.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",Be(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
|
|
543
|
+
`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Sq,this.editor.getAttributes(Sw)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Di({find:kw,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Di({find:kw,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Sw),editor:this.editor})),[t]}}),HM=_t.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Be(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{if(t.type!=="list_item")return[];let n=[];if(t.tokens&&t.tokens.length>0)if(t.tokens.some(o=>o.type==="paragraph"))n=e.parseChildren(t.tokens);else{const o=t.tokens[0];if(o&&o.type==="text"&&o.tokens&&o.tokens.length>0){if(n=[{type:"paragraph",content:e.parseInline(o.tokens)}],t.tokens.length>1){const i=t.tokens.slice(1),a=e.parseChildren(i);n.push(...a)}}else n=e.parseChildren(t.tokens)}return n.length===0&&(n=[{type:"paragraph",content:[]}]),{type:"listItem",content:n}},renderMarkdown:(t,e,n)=>ey(t,e,r=>r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${r.index+1}. `:"- ",n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),kq={};Eq(kq,{findListItemPos:()=>Yl,getNextListDepth:()=>tv,handleBackspace:()=>Cm,handleDelete:()=>Am,hasListBefore:()=>UM,hasListItemAfter:()=>Tq,hasListItemBefore:()=>zM,listItemHasSubList:()=>VM,nextListIsDeeper:()=>WM,nextListIsHigher:()=>GM});var Yl=(t,e)=>{const{$from:n}=e.selection,r=St(t,e.schema);let o=null,s=n.depth,i=n.pos,a=null;for(;s>0&&a===null;)o=n.node(s),o.type===r?a=s:(s-=1,i-=1);return a===null?null:{$pos:e.doc.resolve(i),depth:a}},tv=(t,e)=>{const n=Yl(t,e);if(!n)return!1;const[,r]=kB(e,t,n.$pos.pos+4);return r},UM=(t,e,n)=>{const{$anchor:r}=t.selection,o=Math.max(0,r.pos-2),s=t.doc.resolve(o).node();return!(!s||!n.includes(s.type.name))},zM=(t,e)=>{var n;const{$anchor:r}=e.selection,o=e.doc.resolve(r.pos-2);return!(o.index()===0||((n=o.nodeBefore)==null?void 0:n.type.name)!==t)},VM=(t,e,n)=>{if(!n)return!1;const r=St(t,e.schema);let o=!1;return n.descendants(s=>{s.type===r&&(o=!0)}),o},Cm=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!Xo(t.state,e)&&UM(t.state,e,n)){const{$anchor:a}=t.state.selection,l=t.state.doc.resolve(a.before()-1),c=[];l.node().descendants((f,h)=>{f.type.name===e&&c.push({node:f,pos:h})});const u=c.at(-1);if(!u)return!1;const d=t.state.doc.resolve(l.start()+u.pos+1);return t.chain().cut({from:a.start()-1,to:a.end()+1},d.end()).joinForward().run()}if(!Xo(t.state,e)||!MB(t.state))return!1;const r=Yl(e,t.state);if(!r)return!1;const s=t.state.doc.resolve(r.$pos.pos-2).node(r.depth),i=VM(e,t.state,s);return zM(e,t.state)&&!i?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},WM=(t,e)=>{const n=tv(t,e),r=Yl(t,e);return!r||!n?!1:n>r.depth},GM=(t,e)=>{const n=tv(t,e),r=Yl(t,e);return!r||!n?!1:n<r.depth},Am=(t,e)=>{if(!Xo(t.state,e)||!AB(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:o}=n;return!n.empty&&r.sameParent(o)?!1:WM(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():GM(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},Tq=(t,e)=>{var n;const{$anchor:r}=e.selection,o=e.doc.resolve(r.pos-r.parentOffset-2);return!(o.index()===o.parent.childCount-1||((n=o.nodeAfter)==null?void 0:n.type.name)!==t)},qM=Qe.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&Am(t,n)&&(e=!0)}),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&Am(t,n)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&Cm(t,n,r)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&Cm(t,n,r)&&(e=!0)}),e}}}}),Tw=/^(\s*)(\d+)\.\s+(.*)$/,Cq=/^\s/;function Aq(t){const e=[];let n=0,r=0;for(;n<t.length;){const o=t[n],s=o.match(Tw);if(!s)break;const[,i,a,l]=s,c=i.length;let u=l,d=n+1;const f=[o];for(;d<t.length;){const h=t[d];if(h.match(Tw))break;if(h.trim()==="")f.push(h),u+=`
|
|
544
|
+
`,d+=1;else if(h.match(Cq))f.push(h),u+=`
|
|
545
|
+
${h.slice(c+2)}`,d+=1;else break}e.push({indent:c,number:parseInt(a,10),content:u.trim(),raw:f.join(`
|
|
546
|
+
`)}),r=d,n=d}return[e,r]}function KM(t,e,n){var r;const o=[];let s=0;for(;s<t.length;){const i=t[s];if(i.indent===e){const a=i.content.split(`
|
|
547
|
+
`),l=((r=a[0])==null?void 0:r.trim())||"",c=[];l&&c.push({type:"paragraph",raw:l,tokens:n.inlineTokens(l)});const u=a.slice(1).join(`
|
|
548
|
+
`).trim();if(u){const h=n.blockTokens(u);c.push(...h)}let d=s+1;const f=[];for(;d<t.length&&t[d].indent>e;)f.push(t[d]),d+=1;if(f.length>0){const h=Math.min(...f.map(m=>m.indent)),p=KM(f,h,n);c.push({type:"list",ordered:!0,start:f[0].number,items:p,raw:f.map(m=>m.raw).join(`
|
|
549
|
+
`)})}o.push({type:"list_item",raw:i.raw,tokens:c}),s=d}else s+=1}return o}function Mq(t,e){return t.map(n=>{if(n.type!=="list_item")return e.parseChildren([n])[0];const r=[];return n.tokens&&n.tokens.length>0&&n.tokens.forEach(o=>{if(o.type==="paragraph"||o.type==="list"||o.type==="blockquote"||o.type==="code")r.push(...e.parseChildren([o]));else if(o.type==="text"&&o.tokens){const s=e.parseChildren([o]);r.push({type:"paragraph",content:s})}else{const s=e.parseChildren([o]);s.length>0&&r.push(...s)}}),{type:"listItem",content:r}})}var Oq="listItem",Cw="textStyle",Aw=/^(\d+)\.\s$/,YM=_t.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",Be(this.options.HTMLAttributes,n),0]:["ol",Be(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const n=t.start||1,r=t.items?Mq(t.items,e):[];return n!==1?{type:"orderedList",attrs:{start:n},content:r}:{type:"orderedList",content:r}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
|
|
550
|
+
`):"",markdownTokenizer:{name:"orderedList",level:"block",start:t=>{const e=t.match(/^(\s*)(\d+)\.\s+/),n=e?.index;return n!==void 0?n:-1},tokenize:(t,e,n)=>{var r;const o=t.split(`
|
|
551
|
+
`),[s,i]=Aq(o);if(s.length===0)return;const a=KM(s,0,n);return a.length===0?void 0:{type:"list",ordered:!0,start:((r=s[0])==null?void 0:r.number)||1,items:a,raw:o.slice(0,i).join(`
|
|
552
|
+
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Oq,this.editor.getAttributes(Cw)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Di({find:Aw,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Di({find:Aw,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Cw)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),Rq=/^\s*(\[([( |x])?\])\s$/,Nq=_t.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",Be(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const o=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return ey(t,e,o)},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const o=document.createElement("li"),s=document.createElement("label"),i=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),c=u=>{var d,f;a.ariaLabel=((f=(d=this.options.a11y)==null?void 0:d.checkboxLabel)==null?void 0:f.call(d,u,a.checked))||`Task item checkbox for ${u.textContent||"empty task item"}`};return c(t),s.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",u=>u.preventDefault()),a.addEventListener("change",u=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:d}=u.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:f})=>{const h=n();if(typeof h!="number")return!1;const p=f.doc.nodeAt(h);return f.setNodeMarkup(h,void 0,{...p?.attrs,checked:d}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,d)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([u,d])=>{o.setAttribute(u,d)}),o.dataset.checked=t.attrs.checked,a.checked=t.attrs.checked,s.append(a,i),o.append(s,l),Object.entries(e).forEach(([u,d])=>{o.setAttribute(u,d)}),{dom:o,contentDOM:l,update:u=>u.type!==this.type?!1:(o.dataset.checked=u.attrs.checked,a.checked=u.attrs.checked,c(u),!0)}}},addInputRules(){return[Di({find:Rq,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),_q=_t.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",Be(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
|
|
553
|
+
`):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const r=s=>{const i=Xp(s,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:a=>({indentLevel:a[1].length,mainContent:a[4],checked:a[3].toLowerCase()==="x"}),createToken:(a,l)=>({type:"taskItem",raw:"",mainContent:a.mainContent,indentLevel:a.indentLevel,checked:a.checked,text:a.mainContent,tokens:n.inlineTokens(a.mainContent),nestedTokens:l}),customNestedParser:r},n);return i?[{type:"taskList",raw:i.raw,items:i.items}]:n.blockTokens(s)},o=Xp(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:s=>({indentLevel:s[1].length,mainContent:s[4],checked:s[3].toLowerCase()==="x"}),createToken:(s,i)=>({type:"taskItem",raw:"",mainContent:s.mainContent,indentLevel:s.indentLevel,checked:s.checked,text:s.mainContent,tokens:n.inlineTokens(s.mainContent),nestedTokens:i}),customNestedParser:r},n);if(o)return{type:"taskList",raw:o.raw,items:o.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Qe.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(FM.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(HM.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(qM.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(YM.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(Nq.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(_q.configure(this.options.taskList)),t}});var JM=_t.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Be(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];return n.length===1&&n[0].type==="image"?e.parseChildren([n[0]]):e.createNode("paragraph",void 0,e.parseInline(n))},renderMarkdown:(t,e)=>!t||!Array.isArray(t.content)?"":e.renderChildren(t.content),addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),nv=JM,Dq=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Iq=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Pq=wo.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",Be(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[_i({find:Dq,type:this.type})]},addPasteRules(){return[js({find:Iq,type:this.type})]}}),XM=_t.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),rv=XM,Lq=wo.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",Be(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const o=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!o)return;const s=o[2].trim();return{type:"underline",raw:o[0],text:s,tokens:n.inlineTokens(s)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function jq(t={}){return new Ue({view(e){return new $q(e,t)}})}class $q{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(o=>{let s=i=>{this[o](i)};return e.dom.addEventListener(o,s),{name:o,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,o=this.editorView.dom,s=o.getBoundingClientRect(),i=s.width/o.offsetWidth,a=s.height/o.offsetHeight;if(n){let d=e.nodeBefore,f=e.nodeAfter;if(d||f){let h=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(h){let p=h.getBoundingClientRect(),m=d?p.bottom:p.top;d&&f&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*a;r={left:p.left,right:p.right,top:m-y,bottom:m+y}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*i;r={left:d.left-f,right:d.left+f,top:d.top,bottom:d.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let c,u;if(!l||l==document.body&&getComputedStyle(l).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=l.getBoundingClientRect(),f=d.width/l.offsetWidth,h=d.height/l.offsetHeight;c=d.left-l.scrollLeft*f,u=d.top-l.scrollTop*h}this.element.style.left=(r.left-c)/i+"px",this.element.style.top=(r.top-u)/a+"px",this.element.style.width=(r.right-r.left)/i+"px",this.element.style.height=(r.bottom-r.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),o=r&&r.type.spec.disableDropCursor,s=typeof o=="function"?o(this.editorView,n,e):o;if(n&&!s){let i=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=Gk(this.editorView.state.doc,i,this.editorView.dragging.slice);a!=null&&(i=a)}this.setCursor(i),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class mt extends Oe{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return mt.valid(r)?new mt(r):Oe.near(r)}content(){return ee.empty}eq(e){return e instanceof mt&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new mt(e.resolve(n.pos))}getBookmark(){return new ov(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!Bq(e)||!Fq(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let o=n.contentMatchAt(e.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&mt.valid(e))return e;let o=e.pos,s=null;for(let i=e.depth;;i--){let a=e.node(i);if(n>0?e.indexAfter(i)<a.childCount:e.index(i)>0){s=a.child(n>0?e.indexAfter(i):e.index(i)-1);break}else if(i==0)return null;o+=n;let l=e.doc.resolve(o);if(mt.valid(l))return l}for(;;){let i=n>0?s.firstChild:s.lastChild;if(!i){if(s.isAtom&&!s.isText&&!ue.isSelectable(s)){e=e.doc.resolve(o+s.nodeSize*n),r=!1;continue e}break}s=i,o+=n;let a=e.doc.resolve(o);if(mt.valid(a))return a}return null}}}mt.prototype.visible=!1;mt.findFrom=mt.findGapCursorFrom;Oe.jsonID("gapcursor",mt);class ov{constructor(e){this.pos=e}map(e){return new ov(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return mt.valid(n)?new mt(n):Oe.near(n)}}function QM(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function Bq(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(n-1);;o=o.lastChild){if(o.childCount==0&&!o.inlineContent||QM(o.type))return!0;if(o.inlineContent)return!1}}return!0}function Fq(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(n);;o=o.firstChild){if(o.childCount==0&&!o.inlineContent||QM(o.type))return!0;if(o.inlineContent)return!1}}return!0}function Hq(){return new Ue({props:{decorations:Wq,createSelectionBetween(t,e,n){return e.pos==n.pos&&mt.valid(n)?new mt(n):null},handleClick:zq,handleKeyDown:Uq,handleDOMEvents:{beforeinput:Vq}}})}const Uq=q1({ArrowLeft:Rc("horiz",-1),ArrowRight:Rc("horiz",1),ArrowUp:Rc("vert",-1),ArrowDown:Rc("vert",1)});function Rc(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,o,s){let i=r.selection,a=e>0?i.$to:i.$from,l=i.empty;if(i instanceof pe){if(!s.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let c=mt.findGapCursorFrom(a,e,l);return c?(o&&o(r.tr.setSelection(new mt(c))),!0):!1}}function zq(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!mt.valid(r))return!1;let o=t.posAtCoords({left:n.clientX,top:n.clientY});return o&&o.inside>-1&&ue.isSelectable(t.state.doc.nodeAt(o.inside))?!1:(t.dispatch(t.state.tr.setSelection(new mt(r))),!0)}function Vq(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof mt))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let o=F.empty;for(let i=r.length-1;i>=0;i--)o=F.from(r[i].createAndFill(null,o));let s=t.state.tr.replace(n.pos,n.pos,new ee(o,0,0));return s.setSelection(pe.near(s.doc.resolve(n.pos+1))),t.dispatch(s),!1}function Wq(t){if(!(t.selection instanceof mt))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",et.create(t.doc,[Gt.widget(t.selection.head,e,{key:"gapcursor"})])}var fd=200,$t=function(){};$t.prototype.append=function(e){return e.length?(e=$t.from(e),!this.length&&e||e.length<fd&&this.leafAppend(e)||this.length<fd&&e.leafPrepend(this)||this.appendInner(e)):this};$t.prototype.prepend=function(e){return e.length?$t.from(e).append(this):this};$t.prototype.appendInner=function(e){return new Gq(this,e)};$t.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?$t.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};$t.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};$t.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};$t.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(s,i){return o.push(e(s,i))},n,r),o};$t.from=function(e){return e instanceof $t?e:e&&e.length?new ZM(e):$t.empty};var ZM=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(o,s){return o==0&&s==this.length?this:new e(this.values.slice(o,s))},e.prototype.getInner=function(o){return this.values[o]},e.prototype.forEachInner=function(o,s,i,a){for(var l=s;l<i;l++)if(o(this.values[l],a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(o,s,i,a){for(var l=s-1;l>=i;l--)if(o(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(o){if(this.length+o.length<=fd)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=fd)return new e(o.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})($t);$t.empty=new ZM([]);var Gq=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,o,s,i){var a=this.left.length;if(o<a&&this.left.forEachInner(r,o,Math.min(s,a),i)===!1||s>a&&this.right.forEachInner(r,Math.max(o-a,0),Math.min(this.length,s)-a,i+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,o,s,i){var a=this.left.length;if(o>a&&this.right.forEachInvertedInner(r,o-a,Math.max(s,a)-a,i+a)===!1||s<a&&this.left.forEachInvertedInner(r,Math.min(o,a),s,i)===!1)return!1},e.prototype.sliceInner=function(r,o){if(r==0&&o==this.length)return this;var s=this.left.length;return o<=s?this.left.slice(r,o):r>=s?this.right.slice(r-s,o-s):this.left.slice(r,s).append(this.right.slice(0,o-s))},e.prototype.leafAppend=function(r){var o=this.right.leafAppend(r);if(o)return new e(this.left,o)},e.prototype.leafPrepend=function(r){var o=this.left.leafPrepend(r);if(o)return new e(o,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})($t);const qq=500;class lr{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let o,s;n&&(o=this.remapping(r,this.items.length),s=o.maps.length);let i=e.tr,a,l,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){o||(o=this.remapping(r,f+1),s=o.maps.length),s--,u.push(d);return}if(o){u.push(new Mo(d.map));let h=d.step.map(o.slice(s)),p;h&&i.maybeStep(h).doc&&(p=i.mapping.maps[i.mapping.maps.length-1],c.push(new Mo(p,void 0,void 0,c.length+u.length))),s--,p&&o.appendMap(p,s)}else i.maybeStep(d.step);if(d.selection)return a=o?d.selection.map(o.slice(s)):d.selection,l=new lr(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:i,selection:a}}addTransform(e,n,r,o){let s=[],i=this.eventCount,a=this.items,l=!o&&a.length?a.get(a.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),f=new Mo(e.mapping.maps[u],d,n),h;(h=l&&l.merge(f))&&(f=h,u?s.pop():a=a.slice(0,a.length-1)),s.push(f),n&&(i++,n=void 0),o||(l=f)}let c=i-r.depth;return c>Yq&&(a=Kq(a,c),i-=c),new lr(a.append(s),i)}remapping(e,n){let r=new Ka;return this.items.forEach((o,s)=>{let i=o.mirrorOffset!=null&&s-o.mirrorOffset>=e?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,i)},e,n),r}addMaps(e){return this.eventCount==0?this:new lr(this.items.append(e.map(n=>new Mo(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],o=Math.max(0,this.items.length-n),s=e.mapping,i=e.steps.length,a=this.eventCount;this.items.forEach(f=>{f.selection&&a--},o);let l=n;this.items.forEach(f=>{let h=s.getMirror(--l);if(h==null)return;i=Math.min(i,h);let p=s.maps[h];if(f.step){let m=e.steps[h].invert(e.docs[h]),y=f.selection&&f.selection.map(s.slice(l+1,h));y&&a++,r.push(new Mo(p,m,y))}else r.push(new Mo(p))},o);let c=[];for(let f=n;f<i;f++)c.push(new Mo(s.maps[f]));let u=this.items.slice(0,o).append(c).append(r),d=new lr(u,a);return d.emptyItemCount()>qq&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,o=[],s=0;return this.items.forEach((i,a)=>{if(a>=e)o.push(i),i.selection&&s++;else if(i.step){let l=i.step.map(n.slice(r)),c=l&&l.getMap();if(r--,c&&n.appendMap(c,r),l){let u=i.selection&&i.selection.map(n.slice(r));u&&s++;let d=new Mo(c.invert(),l,u),f,h=o.length-1;(f=o.length&&o[h].merge(d))?o[h]=f:o.push(d)}}else i.map&&r--},this.items.length,0),new lr($t.from(o.reverse()),s)}}lr.empty=new lr($t.empty,0);function Kq(t,e){let n;return t.forEach((r,o)=>{if(r.selection&&e--==0)return n=o,!1}),t.slice(n)}let Mo=class eO{constructor(e,n,r,o){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=o}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new eO(n.getMap().invert(),n,this.selection)}}};class Po{constructor(e,n,r,o,s){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=o,this.prevComposition=s}}const Yq=20;function Jq(t,e,n,r){let o=n.getMeta(Os),s;if(o)return o.historyState;n.getMeta(Zq)&&(t=new Po(t.done,t.undone,null,0,-1));let i=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(i&&i.getMeta(Os))return i.getMeta(Os).redo?new Po(t.done.addTransform(n,void 0,r,Qc(e)),t.undone,Mw(n.mapping.maps),t.prevTime,t.prevComposition):new Po(t.done,t.undone.addTransform(n,void 0,r,Qc(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(i&&i.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=t.prevTime==0||!i&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!Xq(n,t.prevRanges)),c=i?Kh(t.prevRanges,n.mapping):Mw(n.mapping.maps);return new Po(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,Qc(e)),lr.empty,c,n.time,a??t.prevComposition)}else return(s=n.getMeta("rebased"))?new Po(t.done.rebased(n,s),t.undone.rebased(n,s),Kh(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Po(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Kh(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function Xq(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,o)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&o>=e[s]&&(n=!0)}),n}function Mw(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,o,s,i)=>e.push(s,i));return e}function Kh(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let o=e.map(t[r],1),s=e.map(t[r+1],-1);o<=s&&n.push(o,s)}return n}function Qq(t,e,n){let r=Qc(e),o=Os.get(e).spec.config,s=(n?t.undone:t.done).popEvent(e,r);if(!s)return null;let i=s.selection.resolve(s.transform.doc),a=(n?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),o,r),l=new Po(n?a:s.remaining,n?s.remaining:a,null,0,-1);return s.transform.setSelection(i).setMeta(Os,{redo:n,historyState:l})}let Yh=!1,Ow=null;function Qc(t){let e=t.plugins;if(Ow!=e){Yh=!1,Ow=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Yh=!0;break}}return Yh}const Os=new We("history"),Zq=new We("closeHistory");function eK(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Ue({key:Os,state:{init(){return new Po(lr.empty,lr.empty,null,0,-1)},apply(e,n,r){return Jq(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,o=r=="historyUndo"?nO:r=="historyRedo"?rO:null;return o?(n.preventDefault(),o(e.state,e.dispatch)):!1}}}})}function tO(t,e){return(n,r)=>{let o=Os.getState(n);if(!o||(t?o.undone:o.done).eventCount==0)return!1;if(r){let s=Qq(o,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const nO=tO(!1,!0),rO=tO(!0,!0);Qe.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=t?.node||this.editor.state.doc;if((t?.mode||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{const e=t?.node||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new Ue({key:new We("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const o=this.options.limit;if(o==null||o===0){t=!0;return}const s=this.storage.characters({node:r.doc});if(s>o){const i=s-o,a=0,l=i;console.warn(`[CharacterCount] Initial content exceeded limit of ${o} characters. Content was automatically trimmed.`);const c=r.tr.deleteRange(a,l);return t=!0,c}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const o=this.storage.characters({node:n.doc}),s=this.storage.characters({node:e.doc});if(s<=r||o>r&&s>r&&s<=o)return!0;if(o>r&&s>r&&s>o||!e.getMeta("paste"))return!1;const a=e.selection.$head.pos,l=s-r,c=a-l,u=a;return e.deleteRange(c,u),!(this.storage.characters({node:e.doc})>r)}})]}});var tK=Qe.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[jq(this.options)]}});Qe.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Ue({key:new We("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:o}=e,s=[];if(!n||!r)return et.create(t,[]);let i=0;this.options.mode==="deepest"&&t.descendants((l,c)=>{if(l.isText)return;if(!(o>=c&&o<=c+l.nodeSize-1))return!1;i+=1});let a=0;return t.descendants((l,c)=>{if(l.isText||!(o>=c&&o<=c+l.nodeSize-1))return!1;if(a+=1,this.options.mode==="deepest"&&i-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";s.push(Gt.node(c,c+l.nodeSize,{class:this.options.className}))}),et.create(t,s)}}})]}});var nK=Qe.create({name:"gapCursor",addProseMirrorPlugins(){return[Hq()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=qe(fe(t,"allowGapCursor",n)))!=null?e:null}}}),rK=Qe.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new Ue({key:new We("placeholder"),props:{decorations:({doc:t,selection:e})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,o=[];if(!n)return null;const s=this.editor.isEmpty;return t.descendants((i,a)=>{const l=r>=a&&r<=a+i.nodeSize,c=!i.isLeaf&&Xd(i);if((l||!this.options.showOnlyCurrent)&&c){const u=[this.options.emptyNodeClass];s&&u.push(this.options.emptyEditorClass);const d=Gt.node(a,a+i.nodeSize,{class:u.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:i,pos:a,hasAnchor:l}):this.options.placeholder});o.push(d)}return this.options.includeChildren}),et.create(t,o)}}})]}});Qe.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new Ue({key:new We("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||cT(n.selection)||t.view.dragging?null:et.create(n.doc,[Gt.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function Rw({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}var oK=Qe.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new We(this.name),n=((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||this.options.node||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,o])=>o).filter(o=>(this.options.notAfter||[]).concat(n).includes(o.name));return[new Ue({key:e,appendTransaction:(o,s,i)=>{const{doc:a,tr:l,schema:c}=i,u=e.getState(i),d=a.content.size,f=c.nodes[n];if(u)return l.insert(d,f.create())},state:{init:(o,s)=>{const i=s.tr.doc.lastChild;return!Rw({node:i,types:r})},apply:(o,s)=>{if(!o.docChanged)return s;const i=o.doc.lastChild;return!Rw({node:i,types:r})}}})]}}),sK=Qe.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>nO(t,e),redo:()=>({state:t,dispatch:e})=>rO(t,e)}},addProseMirrorPlugins(){return[eK(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()}}}),iK=Qe.create({name:"starterKit",addExtensions(){var t,e,n,r;const o=[];return this.options.bold!==!1&&o.push(L9.configure(this.options.bold)),this.options.blockquote!==!1&&o.push(N9.configure(this.options.blockquote)),this.options.bulletList!==!1&&o.push(FM.configure(this.options.bulletList)),this.options.code!==!1&&o.push(B9.configure(this.options.code)),this.options.codeBlock!==!1&&o.push(U9.configure(this.options.codeBlock)),this.options.document!==!1&&o.push(MM.configure(this.options.document)),this.options.dropcursor!==!1&&o.push(tK.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&o.push(nK.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&o.push(OM.configure(this.options.hardBreak)),this.options.heading!==!1&&o.push(V9.configure(this.options.heading)),this.options.undoRedo!==!1&&o.push(sK.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&o.push(W9.configure(this.options.horizontalRule)),this.options.italic!==!1&&o.push(J9.configure(this.options.italic)),this.options.listItem!==!1&&o.push(HM.configure(this.options.listItem)),this.options.listKeymap!==!1&&o.push(qM.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&o.push(BM.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&o.push(YM.configure(this.options.orderedList)),this.options.paragraph!==!1&&o.push(JM.configure(this.options.paragraph)),this.options.strike!==!1&&o.push(Pq.configure(this.options.strike)),this.options.text!==!1&&o.push(XM.configure(this.options.text)),this.options.underline!==!1&&o.push(Lq.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&o.push(oK.configure((r=this.options)==null?void 0:r.trailingNode)),o}}),aK=iK,lK=Qe.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).every(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).every(e=>e),toggleTextAlign:t=>({editor:e,commands:n})=>this.options.alignments.includes(t)?e.isActive({textAlign:t})?n.unsetTextAlign():n.setTextAlign(t):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),cK=lK,uK=wo.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(t){return t!=="super"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sup",Be(this.options.HTMLAttributes,t),0]},addCommands(){return{setSuperscript:()=>({commands:t})=>t.setMark(this.name),toggleSuperscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSuperscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),dK=uK,fK=wo.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(t){return t!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sub",Be(this.options.HTMLAttributes,t),0]},addCommands(){return{setSubscript:()=>({commands:t})=>t.setMark(this.name),toggleSubscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSubscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),hK=fK;const pK=({children:t,width:e=100,minWidth:n=20,maxWidth:r=100,onResize:o,selected:s=!1,className:i=""})=>{const[a,l]=M.useState(!1),[c,u]=M.useState(null),[d,f]=M.useState(e),h=M.useRef(null),p=M.useRef(0),m=M.useRef(e),y=M.useRef(0),v=M.useRef(null),w=(S,k)=>{S.preventDefault(),p.current=S.clientX,m.current=d,u(k),l(!0)},E=()=>{if(!h.current||!c)return;const S=h.current.parentElement?.offsetWidth||1,C=y.current/S*100;let N=m.current;c==="right"?N=m.current+C:c==="left"&&(N=m.current-C),N=Math.min(r,Math.max(n,N)),f(N),o?.(N),v.current=null},x=S=>{!a||!c||(y.current=S.clientX-p.current,v.current||(v.current=requestAnimationFrame(E)))},T=()=>{l(!1),u(null),v.current&&(cancelAnimationFrame(v.current),v.current=null)};return M.useEffect(()=>{if(a)return window.addEventListener("mousemove",x),window.addEventListener("mouseup",T),()=>{window.removeEventListener("mousemove",x),window.removeEventListener("mouseup",T)}},[a]),g.jsxs("div",{ref:h,className:re("relative group",s?"ring-2 ring-blue-400 rounded-md":"",i),style:{width:`${d}%`},children:[t,g.jsx("div",{onMouseDown:S=>w(S,"left"),className:"absolute left-2 top-1/2 -translate-y-1/2 w-2 h-8 bg-blue-500 rounded-full cursor-col-resize opacity-0 group-hover:opacity-100"}),g.jsx("div",{onMouseDown:S=>w(S,"right"),className:"absolute right-2 top-1/2 -translate-y-1/2 w-2 h-8 bg-blue-500 rounded-full cursor-col-resize opacity-0 group-hover:opacity-100"})]})},oO=({open:t,align:e,onAlign:n,onDelete:r})=>t?g.jsxs("div",{className:"z-999 bg-popover/40 border border-border/20 backdrop-blur-2xl text-popover-foreground rounded-lg outline-hidden absolute p-1 top-6 right-3 gap-3 w-fit flex items-center",children:[typeof n=="function"&&g.jsxs(g.Fragment,{children:[g.jsx(be,{active:e===tt.LEFT,icon:Nu,tooltip:"Align left",onClick:()=>n(tt.LEFT)}),g.jsx(be,{active:e===tt.CENTER,icon:am,tooltip:"Align center",onClick:()=>n(tt.CENTER)}),g.jsx(be,{active:e===tt.RIGHT,icon:lm,tooltip:"Align right",onClick:()=>n(tt.RIGHT)})]}),g.jsx(be,{variant:"destructive",className:"bg-transparent hover:bg-accent text-red-300 hover:text-destructive",icon:by,tooltip:"Delete",onClick:r})]}):null;var sv="Progress",iv=100,[mK]=Ln(sv),[gK,yK]=mK(sv),sO=b.forwardRef((t,e)=>{const{__scopeProgress:n,value:r=null,max:o,getValueLabel:s=vK,...i}=t;(o||o===0)&&!Nw(o)&&console.error(bK(`${o}`,"Progress"));const a=Nw(o)?o:iv;r!==null&&!_w(r,a)&&console.error(xK(`${r}`,"Progress"));const l=_w(r,a)?r:null,c=hd(l)?s(l,a):void 0;return g.jsx(gK,{scope:n,value:l,max:a,children:g.jsx(ge.div,{"aria-valuemax":a,"aria-valuemin":0,"aria-valuenow":hd(l)?l:void 0,"aria-valuetext":c,role:"progressbar","data-state":lO(l,a),"data-value":l??void 0,"data-max":a,...i,ref:e})})});sO.displayName=sv;var iO="ProgressIndicator",aO=b.forwardRef((t,e)=>{const{__scopeProgress:n,...r}=t,o=yK(iO,n);return g.jsx(ge.div,{"data-state":lO(o.value,o.max),"data-value":o.value??void 0,"data-max":o.max,...r,ref:e})});aO.displayName=iO;function vK(t,e){return`${Math.round(t/e*100)}%`}function lO(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function hd(t){return typeof t=="number"}function Nw(t){return hd(t)&&!isNaN(t)&&t>0}function _w(t,e){return hd(t)&&!isNaN(t)&&t<=e&&t>=0}function bK(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${iv}\`.`}function xK(t,e){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${e}\`. The \`value\` prop must be:
|
|
554
|
+
- a positive number
|
|
555
|
+
- less than the value passed to \`max\` (or ${iv} if no \`max\` prop is set)
|
|
556
|
+
- \`null\` or \`undefined\` if the progress is indeterminate.
|
|
557
|
+
|
|
558
|
+
Defaulting to \`null\`.`}var wK=sO,EK=aO;function cO({className:t,value:e,...n}){return g.jsx(wK,{"data-slot":"progress",className:re("bg-primary/20 relative h-2 w-full overflow-hidden rounded-full",t),...n,children:g.jsx(EK,{"data-slot":"progress-indicator",className:"bg-primary h-full w-full flex-1 transition-all",style:{transform:`translateX(-${100-(e||0)}%)`}})})}var SK="AspectRatio",uO=b.forwardRef((t,e)=>{const{ratio:n=1/1,style:r,...o}=t;return g.jsx("div",{style:{position:"relative",width:"100%",paddingBottom:`${100/n}%`},"data-radix-aspect-ratio-wrapper":"",children:g.jsx(ge.div,{...o,ref:e,style:{...r,position:"absolute",top:0,right:0,bottom:0,left:0}})})});uO.displayName=SK;var kK=uO;function TK({...t}){return g.jsx(kK,{"data-slot":"aspect-ratio",...t})}const CK=({node:t,updateAttributes:e,editor:n,getPos:r})=>{const[o,s]=M.useState(!1);M.useEffect(()=>{const l=()=>{const c=n.state.selection;(c instanceof ue?c.node:null)===t?requestAnimationFrame(()=>s(!0)):s(!1)};return l(),n.on("selectionUpdate",l),()=>{n.off("selectionUpdate",l)}},[n,t]);const i=()=>{const l=r()??NaN;Number.isFinite(l)&&n.chain().focus().deleteRange({from:l,to:l+t.nodeSize}).focus().run()},a=l=>e({align:l});return t.attrs.uploading?g.jsx(Qo,{className:re("flex my-4",t.attrs.align===tt.CENTER?"justify-center":t.attrs.align===tt.RIGHT?"justify-end":""),children:g.jsxs("div",{className:"w-full max-w-full",children:[g.jsxs("div",{className:"relative bg-muted rounded-lg overflow-hidden",children:[g.jsx(TK,{ratio:t.attrs.type===xe.Audio?4/1:16/4,className:re("flex items-center justify-center bg-muted"),children:g.jsxs("div",{className:"text-center space-y-3",children:[g.jsxs("div",{className:"flex justify-center",children:[t.attrs.type===xe.Image&&g.jsx(vy,{className:"w-12 h-12 text-muted-foreground/50"}),t.attrs.type===xe.Video&&g.jsx(xy,{className:"w-12 h-12 text-muted-foreground/50"}),t.attrs.type===xe.Audio&&g.jsx(Ru,{className:"w-12 h-12 text-muted-foreground/50"})]}),g.jsxs("p",{className:"text-sm text-muted-foreground font-medium",children:["Uploading ",t.attrs.type,"..."]})]})}),g.jsx("div",{className:"absolute bottom-0 left-0 right-0 p-4",children:g.jsx(cO,{value:t.attrs.progress??0,className:"h-2"})}),g.jsx("button",{onClick:i,className:"absolute top-2 right-2 p-2 bg-background/90 hover:bg-background rounded-full shadow-sm transition-colors",title:"Cancel upload",children:g.jsx(Wl,{className:"w-4 h-4"})})]}),g.jsxs("p",{className:"text-xs text-muted-foreground text-center mt-2",children:[Math.round(t.attrs.progress??0),"%"]})]})}):g.jsx(Qo,{"data-drag-handle":!0,className:re("flex",t.attrs.align===tt.CENTER?"justify-center":t.attrs.align===tt.RIGHT?"justify-end":""),children:t.attrs.type===xe.Image?g.jsx(Dw,{open:o,mediaType:t.attrs.type,align:t.attrs.align,onResize:l=>e({maxWidth:l}),onAlign:a,onDelete:i,children:g.jsx("img",{src:t.attrs.src,alt:t.attrs.caption,className:re("object-contain w-full h-auto rounded-lg",o&&"border-2 border-blue-500")})}):t.attrs.type===xe.Video?g.jsx(Dw,{open:o,mediaType:t.attrs.type,align:t.attrs.align,onResize:l=>e({maxWidth:l}),onAlign:a,onDelete:i,children:g.jsx("video",{src:t.attrs.src,controls:!0,className:re("object-contain w-full h-auto",o&&"border-2 border-blue-500")})}):t.attrs.type===xe.Audio?g.jsxs("div",{className:"relative p-4 bg-accent/20 border border-border/20 w-full",children:[g.jsx(oO,{open:o,align:t.attrs.align,onAlign:a,onDelete:i}),g.jsx("audio",{src:t.attrs.src,controls:!0,className:re("w-full",o&&"rounded-full border-2 border-blue-500")})]}):g.jsx("div",{className:"p-4 text-sm text-gray-600",children:"Unsupported media"})})},Dw=({open:t,align:e,onAlign:n,onDelete:r,onResize:o,mediaType:s,children:i})=>g.jsxs(pK,{onResize:o,className:re(s===xe.Audio&&"relative p-4 bg-accent/50"),children:[g.jsx(oO,{open:t,align:e,onAlign:n,onDelete:r}),i]}),dO=t=>e=>({state:n,commands:r})=>{const{doc:o}=n;let s=null,i=null;return o.descendants((a,l)=>{if(a.type.name===t&&a.attrs.uid===e)return s=l,i=a.nodeSize,!1}),s!==null&&i!==null?r.deleteRange({from:s,to:Number(s)+Number(i)}):!1},fO=t=>(e,n)=>({state:r,dispatch:o})=>{if(!o)return!1;const{doc:s,tr:i}=r;let a=!1;return s.descendants((l,c)=>{if(l.type.name===t&&l.attrs.uid===e)return i.setNodeMarkup(c,void 0,{...l.attrs,...n}),a=!0,!1}),a?(o(i),!0):!1},AK=t=>e=>({state:n,dispatch:r})=>{if(!r)return!1;const{doc:o,schema:s}=n;let i=n.tr,a=!1;const l=[];if(o.descendants((c,u)=>{c.isText&&c.marks?.length&&c.marks.forEach(d=>{d.type.name===t&&d.attrs.uid===e&&(l.push({from:u,to:u+c.nodeSize}),a=!0)})}),a){const c=s.marks[t];c&&(l.forEach(({from:u,to:d})=>{i=i.removeMark(u,d,c)}),r(i))}return a},MK=t=>(e,n)=>({state:r,dispatch:o})=>{if(console.log("=== UPDATE MARK COMMAND START ==="),console.log("markName:",t),console.log("uid:",e),console.log("attrs:",n),console.log("state.doc:",r.doc.toJSON()),!o)return console.log("No dispatch, returning false"),!1;const{doc:s,schema:i}=r;let a=r.tr,l=!1;const c=[];return s.descendants((u,d)=>{u.isText&&u.marks?.length&&u.marks.forEach(f=>{console.log("Checking mark:",{markType:f.type.name,markUid:f.attrs.uid,targetMarkName:t,targetUid:e,matches:f.type.name===t&&f.attrs.uid===e}),f.type.name===t&&f.attrs.uid===e&&(c.push({from:d,to:d+u.nodeSize,mark:f}),l=!0,console.log("Found matching mark at:",{from:d,to:d+u.nodeSize}))})}),console.log("Total positions found:",c.length),console.log("Positions:",c),l&&(c.forEach(({from:u,to:d,mark:f})=>{const h={...f.attrs,...n},p=i.marks[t];console.log("Applying update:",{from:u,to:d,oldAttrs:f.attrs,newAttrs:h}),p&&(console.log("Before removeMark - tr.doc:",a.doc.toJSON()),a=a.removeMark(u,d,p),console.log("After removeMark - tr.doc:",a.doc.toJSON()),a=a.addMark(u,d,p.create(h)),console.log("After addMark - tr.doc:",a.doc.toJSON()))}),console.log("About to dispatch transaction"),console.log("Final tr.doc:",a.doc.toJSON()),console.log("Original state.doc:",r.doc.toJSON()),o(a),console.log("Transaction dispatched successfully")),console.log("=== UPDATE MARK COMMAND END ==="),l},Or={uid:"",src:"",type:xe.Image,style:"object-fit: contain; width: 100%; border-radius: 0.5rem;",maxWidth:ED,align:tt.LEFT,caption:"",uploading:!1,progress:0},hO=_t.create({name:"media",group:"block",atom:!0,addAttributes(){return{uid:{default:Or.uid},src:{default:Or.src},type:{default:Or.type},style:{default:Or.style},maxWidth:{default:Or.maxWidth},align:{default:Or.align},caption:{default:Or.caption},uploading:{default:Or.uploading},progress:{default:Or.progress},payload:{default:null,parseHTML:()=>null,renderHTML:()=>({})}}},draggable(){return!this?.options?.attrs?.uploading&&!this?.options?.attrs?.mediaMode},selectable(){return!this?.options?.attrs?.mediaMode},parseHTML(){return[{tag:"div[data-media]",getAttrs:t=>({uid:t.getAttribute("data-uid")||"",src:t.getAttribute("data-src")||"",type:t.getAttribute("data-type")||xe.Image,align:t.getAttribute("data-align")||tt.LEFT,caption:t.getAttribute("data-caption")||"",style:t.getAttribute("style")||Or.style})}]},renderHTML({HTMLAttributes:t}){const{uid:e,src:n,style:r,type:o,align:s,maxWidth:i,caption:a}=t,l=SD[o],c=Be({style:OK(s),"data-media":!0,"data-uid":e,"data-type":o,"data-src":n,"data-caption":a||"","data-align":s}),u=Be({src:n,style:RK(r,o,i)},{controls:o===xe.Audio||o===xe.Video});return["div",c,[l,u]]},addNodeView(){return Bl(CK)},addCommands(){return{insertMedia:t=>({commands:e,chain:n})=>this?.options?.attrs?.mediaMode?n().insertContent([{type:this.name,attrs:t}]).command(({tr:r,dispatch:o})=>{if(o){const s=r.doc.content.size,i=r.doc.resolve(s);r.setSelection(pe.near(i))}return!0}).run():e.insertContent([{type:this.name,attrs:t},{type:"paragraph"}]),updateMediaByUid:fO(this.name),deleteMediaByUid:dO(this.name),updateMediaProgress:(t,e)=>({commands:n})=>n.updateMediaByUid(t,{progress:e})}},addKeyboardShortcuts(){return{Backspace:()=>{const{selection:t,doc:e}=this.editor.state,r=t.$anchor.nodeBefore;if(r?.type.name===this.name&&r.attrs.uploading)return $o.info("Please wait for upload to complete or cancel it first"),!0;const o=e.nodeAt(t.from);return o?.type.name===this.name&&o.attrs.uploading?($o.info("Please wait for upload to complete or cancel it first"),!0):!1},Delete:()=>{const{selection:t,doc:e}=this.editor.state,r=t.$anchor.nodeAfter;if(r?.type.name===this.name&&r.attrs.uploading)return $o.info("Please wait for upload to complete or cancel it first"),!0;const o=e.nodeAt(t.from);return o?.type.name===this.name&&o.attrs.uploading?($o.info("Please wait for upload to complete or cancel it first"),!0):!1}}}}),OK=t=>`width: 100%; display: flex; justify-content: ${NK(t)}; margin:16px 0`,RK=(t,e,n)=>`${t}; max-width: ${e===xe.Audio?"100%":`${n}%`}; ${e!==xe.Audio?"height: auto;":""}`,NK=t=>({[tt.LEFT]:"flex-start",[tt.CENTER]:"center",[tt.RIGHT]:"flex-end"})[t]||"flex-start",ts=["#0091d5","#fcc600","#ce50a0","#139e6b"],Uo={MIN:1,MAX:4,MAX_TEXT_LENGTH:50},_K=({choice:t,index:e,canRemove:n,onRemove:r})=>{const o=ts[e%ts.length];return g.jsxs("div",{style:{backgroundColor:o},className:re("relative rounded-xl flex items-center justify-center h-32 group overflow-hidden transition-all duration-200 hover:scale-[1.02] hover:shadow-md"),children:[g.jsx("span",{className:"text-center text-white font-medium px-4 py-3 text-sm sm:text-base leading-relaxed break-words w-full",children:t.text}),n&&g.jsx(pO,{onRemove:r,index:e}),g.jsx(mO,{number:e+1})]})},DK=({choice:t,index:e,canRemove:n,onRemove:r})=>g.jsxs("div",{style:{backgroundColor:ts[e%ts.length]},className:"relative rounded-xl flex items-center justify-center h-32 group overflow-hidden transition-all duration-200 hover:scale-[1.02] hover:shadow-md bg-muted",children:[t.imageType.includes("video")?g.jsx("video",{src:t?.sources?.original?.url,className:"object-cover w-full h-full"}):g.jsx("img",{src:t.sources.original.url||t.sources.thumbnail.url,alt:`Poll choice ${e+1}`,className:"object-cover w-full h-full"}),n&&g.jsx(pO,{onRemove:r,index:e}),g.jsx(mO,{number:e+1})]}),pO=({onRemove:t,index:e})=>g.jsx("button",{onClick:t,className:"cursor-pointer absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity bg-background hover:bg-red-100 hover:text-destructive rounded-full p-1.5 shadow-md","aria-label":`Remove choice ${e+1}`,children:g.jsx(Wl,{className:"h-4 w-4"})}),mO=({number:t})=>g.jsx("div",{className:"absolute bottom-2 left-2 bg-background/80 backdrop-blur-sm text-foreground text-xs font-semibold rounded-full h-6 w-6 flex items-center justify-center shadow-sm",children:t}),IK=({value:t,onChange:e,onSubmit:n,disabled:r})=>{const o=i=>{i.key==="Enter"&&(i.preventDefault(),n())},s=t.length>Uo.MAX_TEXT_LENGTH*.9;return g.jsx("div",{className:"flex flex-col gap-2",children:g.jsx("div",{className:"flex items-end gap-2",children:g.jsxs("div",{className:"flex-1 space-y-1.5",children:[g.jsx("label",{htmlFor:"poll-text-input",className:"text-sm font-medium text-foreground",children:"Add text option"}),g.jsxs("div",{className:"flex items-center sm:gap-3 gap-1",children:[g.jsx(Sy,{id:"poll-text-input",placeholder:"Enter a text option...",value:t,onChange:i=>e(i.target.value),onKeyDown:o,maxLength:Uo.MAX_TEXT_LENGTH,disabled:r,className:"transition-all"}),g.jsxs(Zn,{onClick:n,disabled:!t.trim()||r,className:"shrink-0",size:"default",children:[g.jsx(cm,{className:"h-4 w-4 sm:mr-2"}),g.jsx("span",{className:"hidden sm:inline",children:"Add"})]})]}),g.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[g.jsx("span",{children:"Press Enter to add"}),g.jsxs("span",{className:re("font-mono",s&&"text-amber-600 dark:text-amber-400 font-semibold"),children:[t.length,"/",Uo.MAX_TEXT_LENGTH]})]})]})})})},PK=({onFileSelect:t,onImageSelect:e,disabled:n})=>{const r=M.useRef(null),[o,s]=M.useState(!1),i=a=>{const l=a.target.files;if(!l)return;const c=Array.from(l);t(c),a.target.value=""};return g.jsxs("div",{className:"flex xl:flex-wrap items-center gap-2",children:[g.jsxs(Zn,{variant:"ghost",className:"flex-1 cursor-pointer flex items-center justify-center gap-2 bg-accent/50 border border-border/40 hover:bg-accent transition-colors",disabled:n,onClick:()=>r.current?.click(),children:[g.jsx(VC,{className:"h-4 w-4"}),"Upload"]}),g.jsx("input",{ref:r,type:"file",accept:"image/*,video/*",multiple:!0,className:"hidden",onChange:i,disabled:n,"aria-label":"Upload image or video for poll choice"}),g.jsx(IA,{open:o,onOpenChange:s,onImageSelect:e,children:g.jsxs(Zn,{disabled:n,className:"cursor-pointer flex-1",children:[g.jsx(WC,{})," Search Images"]})})]})},LK=({choiceCount:t,remainingSlots:e})=>g.jsxs("div",{className:"sm:px-4 sm:py-2 p-2 border-b border-border bg-muted/30 flex items-center justify-between",children:[g.jsxs("div",{children:[g.jsx("h3",{className:"font-semibold sm:text-lg",children:"Create Poll"}),g.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:[t," of ",Uo.MAX," options added"]})]}),e>0&&g.jsxs("span",{className:"text-xs font-medium px-2.5 py-1 rounded-full bg-primary/10 text-primary",children:[e," slot",e!==1?"s":""," left"]})]}),jK=({slotNumber:t,disabled:e,onDrop:n})=>{const r=M.useRef(null),[o,s]=M.useState(!1),i=u=>{u.preventDefault(),u.stopPropagation(),s(!0)},a=u=>{u.preventDefault(),u.stopPropagation(),s(!1)},l=u=>{u.preventDefault(),u.stopPropagation(),s(!1);const d=Array.from(u.dataTransfer.files).filter(f=>f.type.startsWith("image/")||f.type.startsWith("video/"));d.length>0&&n(d)},c=u=>{const d=u.target.files;if(!d)return;const f=Array.from(d);n(f),u.target.value=""};return g.jsxs(g.Fragment,{children:[g.jsx("input",{ref:r,type:"file",accept:"image/*,video/*",multiple:!0,className:"hidden",onChange:c,disabled:e,"aria-label":"Upload image or video for poll choice"}),g.jsxs("div",{onDragOver:i,onDragLeave:a,onDrop:l,onClick:()=>r.current?.click(),className:re("cursor-pointer rounded-xl border-2 border-dashed min-h-16 lg:min-h-32 flex flex-col items-center justify-center text-sm lg:gap-2 transition-all duration-200",o?"border-primary bg-primary/10 text-primary scale-[1.02] shadow-md":"border-muted-foreground/20 text-muted-foreground/60 bg-muted/20"),children:[g.jsx("div",{className:re("text-xl lg:text-2xl font-bold transition-colors",o?"text-primary/50":"text-muted-foreground/30"),children:t}),g.jsx("span",{className:"text-xs",children:o?"Drop here":"Drag & Drop"}),o&&g.jsx(vy,{className:"h-5 w-5 animate-bounce"})]})]})},av=(t,e=Wo.MEDIA_ITEM,n)=>({key:ho(),type:e,imageType:t.type,...n?{searchFrom:n}:{},sources:{original:{url:t?.high_resolution??t.url,width:t.width,height:t.height,isBase64:!1},thumbnail:{url:t.thumbnail,width:t.width,height:t.height,isBase64:!1},...t.placeholder?{placeholder:{url:t.placeholder,width:t.width,height:t.height,isBase64:!0}}:{}},playableDuration:t.playableDuration??null}),$K=t=>"text"in t,BK=(t,e)=>({key:ho(),type:cu.POLL_TEXT_ITEM,option_id:ho(),option_color:ts[e%ts.length],text:t.trim()}),Iw=(t,e,n)=>{const o=t?.type?.includes("video")?cu.POLL_MEDIA_ITEM:cu.POLL_IMAGE_ITEM;return{...av(t,o,n),option_color:ts[e%ts.length],option_id:ho()}},FK=({choices:t,onChange:e})=>{const{fileStore:n}=Dl(),[r,o]=M.useState(""),s=Uo.MAX-t.length,i=t.length<Uo.MAX,a=t.length>Uo.MIN,l=()=>{if(!r.trim()||!i)return;const f=BK(r,t.length);e([...t,f]),o("")},c=async f=>{if(!f||!i)return;const p=f.slice(0,s).map(async(v,w)=>{try{const E=await n.uploadImage(v);return Iw(E,w)}catch(E){return console.error("Upload failed for",v.name,E),null}}),y=(await Promise.all(p)).filter(v=>v!==null);e([...t,...y])},u=(f,h)=>{const p=Uo.MAX-s;n.uploadUrl(f).then(m=>{const y=Iw(m,p,h);e([...t,y])}).catch(m=>console.log(m))},d=f=>{if(!a)return;const h=t.filter((p,m)=>m!==f);e(h)};return console.log({choices:t}),g.jsxs("div",{"data-type":"poll",className:"w-full border border-border rounded-xl bg-card shadow-sm overflow-hidden",children:[g.jsx(LK,{choiceCount:t.length,remainingSlots:s}),g.jsxs("div",{className:"sm:p-4 p-2 space-y-6",children:[g.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3 sm:gap-4",children:[t.map((f,h)=>$K(f)?g.jsx(_K,{choice:f,index:h,canRemove:a,onRemove:()=>d(h)},f.key):g.jsx(DK,{choice:f,index:h,canRemove:a,onRemove:()=>d(h)},f.key)),Array.from({length:s}).map((f,h)=>g.jsx(jK,{disabled:!i,onDrop:c,slotNumber:t.length+h+1},`empty-${h}`))]}),g.jsxs("div",{className:"space-y-3",children:[g.jsx(IK,{value:r,onChange:o,onSubmit:l,disabled:!i}),g.jsx(PK,{onFileSelect:c,onImageSelect:u,disabled:!i}),!i&&g.jsx("p",{className:"text-xs text-muted-foreground text-center py-2 bg-muted/50 rounded-lg",children:"Maximum number of choices reached. Remove a choice to add more."})]})]})]})},HK=({node:t,updateAttributes:e})=>{const{choices:n}=t.attrs,r=o=>{e({choices:o})};return g.jsx(Qo,{"data-type":"poll","data-drag-handle":"false",className:"not-prose",children:g.jsx(FK,{choices:n,onChange:r,onRemovePoll:()=>{}})})},gO=_t.create({name:"poll",group:"block",atom:!0,draggable:!1,selectable:!1,addAttributes(){return{choices:{default:[]}}},parseHTML(){return[{tag:'div[data-type="poll"]'}]},renderHTML({HTMLAttributes:t}){return["div",Be(t,{"data-type":"poll"})]},addNodeView(){return Bl(HK)},addCommands(){return{insertPoll:t=>({chain:e})=>e().insertContent({type:this.name,attrs:t}).run()}},addProseMirrorPlugins(){const t=this.name;return[new Ue({props:{handleKeyDown:(e,n)=>{const{state:r}=e,{selection:o}=r,s=n.key;if(s!=="Backspace"&&s!=="Delete")return!1;if(o instanceof ue&&o.node.type.name===t)return n.preventDefault(),!0;const{$from:i,empty:a}=o;if(a&&i){const l=i.nodeBefore;if(l&&l.type.name===t&&s==="Backspace")return n.preventDefault(),!0;const c=i.nodeAfter;if(c&&c.type.name===t&&s==="Delete")return n.preventDefault(),!0}return!1},handleDOMEvents:{mousedown:(e,n)=>{const r=n,o=r.target;if(!o||o.closest('input, textarea, button, select, [contenteditable="true"]'))return!1;const s=o.closest('[data-type="poll"]')??null;if(!s)return!1;r.preventDefault();const i=e.posAtDOM(s,0);if(typeof i=="number"){const a=e.state.doc.resolve(i);let l=i;const c=a.nodeAfter;if(c&&c.type.name===t&&(l=i+c.nodeSize),l<=e.state.doc.content.size){const u=e.state.tr.setSelection(pe.create(e.state.doc,l));e.dispatch(u),e.focus()}}return!0}}},appendTransaction:(e,n,r)=>{const o=a=>{let l=0;return a.descendants(c=>{c.type.name===t&&l++}),l},s=o(n.doc),i=o(r.doc);if(s>0&&i===0){const a=r.tr;return a.replaceWith(0,r.doc.content.size,n.doc.content),a}}})]}});var Tf="Popover",[yO]=Ln(Tf,[cs]),Jl=cs(),[UK,us]=yO(Tf),vO=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:i=!1}=t,a=Jl(e),l=b.useRef(null),[c,u]=b.useState(!1),[d,f]=po({prop:r,defaultProp:o??!1,onChange:s,caller:Tf});return g.jsx(sf,{...a,children:g.jsx(UK,{scope:e,contentId:Kn(),triggerRef:l,open:d,onOpenChange:f,onOpenToggle:b.useCallback(()=>f(h=>!h),[f]),hasCustomAnchor:c,onCustomAnchorAdd:b.useCallback(()=>u(!0),[]),onCustomAnchorRemove:b.useCallback(()=>u(!1),[]),modal:i,children:n})})};vO.displayName=Tf;var bO="PopoverAnchor",zK=b.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,o=us(bO,n),s=Jl(n),{onCustomAnchorAdd:i,onCustomAnchorRemove:a}=o;return b.useEffect(()=>(i(),()=>a()),[i,a]),g.jsx(Hl,{...s,...r,ref:e})});zK.displayName=bO;var xO="PopoverTrigger",wO=b.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,o=us(xO,n),s=Jl(n),i=Fe(e,o.triggerRef),a=g.jsx(ge.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":CO(o.open),...r,ref:i,onClick:ne(t.onClick,o.onOpenToggle)});return o.hasCustomAnchor?a:g.jsx(Hl,{asChild:!0,...s,children:a})});wO.displayName=xO;var lv="PopoverPortal",[VK,WK]=yO(lv,{forceMount:void 0}),EO=t=>{const{__scopePopover:e,forceMount:n,children:r,container:o}=t,s=us(lv,e);return g.jsx(VK,{scope:e,forceMount:n,children:g.jsx(jn,{present:n||s.open,children:g.jsx(ea,{asChild:!0,container:o,children:r})})})};EO.displayName=lv;var ji="PopoverContent",SO=b.forwardRef((t,e)=>{const n=WK(ji,t.__scopePopover),{forceMount:r=n.forceMount,...o}=t,s=us(ji,t.__scopePopover);return g.jsx(jn,{present:r||s.open,children:s.modal?g.jsx(qK,{...o,ref:e}):g.jsx(KK,{...o,ref:e})})});SO.displayName=ji;var GK=Yo("PopoverContent.RemoveScroll"),qK=b.forwardRef((t,e)=>{const n=us(ji,t.__scopePopover),r=b.useRef(null),o=Fe(e,r),s=b.useRef(!1);return b.useEffect(()=>{const i=r.current;if(i)return hf(i)},[]),g.jsx(Vl,{as:GK,allowPinchZoom:!0,children:g.jsx(kO,{...t,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ne(t.onCloseAutoFocus,i=>{i.preventDefault(),s.current||n.triggerRef.current?.focus()}),onPointerDownOutside:ne(t.onPointerDownOutside,i=>{const a=i.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,c=a.button===2||l;s.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:ne(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1})})})}),KK=b.forwardRef((t,e)=>{const n=us(ji,t.__scopePopover),r=b.useRef(!1),o=b.useRef(!1);return g.jsx(kO,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{t.onCloseAutoFocus?.(s),s.defaultPrevented||(r.current||n.triggerRef.current?.focus(),s.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:s=>{t.onInteractOutside?.(s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const i=s.target;n.triggerRef.current?.contains(i)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&o.current&&s.preventDefault()}})}),kO=b.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:i,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:u,...d}=t,f=us(ji,n),h=Jl(n);return df(),g.jsx(zl,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:s,children:g.jsx(Xi,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:u,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>f.onOpenChange(!1),children:g.jsx(af,{"data-state":CO(f.open),role:"dialog",id:f.contentId,...h,...d,ref:e,style:{...d.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),TO="PopoverClose",YK=b.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,o=us(TO,n);return g.jsx(ge.button,{type:"button",...r,ref:e,onClick:ne(t.onClick,()=>o.onOpenChange(!1))})});YK.displayName=TO;var JK="PopoverArrow",XK=b.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,o=Jl(n);return g.jsx(lf,{...o,...r,ref:e})});XK.displayName=JK;function CO(t){return t?"open":"closed"}var QK=vO,ZK=wO,e7=EO,t7=SO;function n7({...t}){return g.jsx(QK,{"data-slot":"popover",...t})}function r7({...t}){return g.jsx(ZK,{"data-slot":"popover-trigger",...t})}function o7({className:t,align:e="center",sideOffset:n=4,children:r,...o}){return g.jsx(e7,{children:g.jsx("div",{"data-theme":"select-post-builder",children:g.jsx(t7,{"data-slot":"popover-content",align:e,sideOffset:n,className:re("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",t),...o,children:r})})})}const s7=({mark:t,editor:e})=>{const[n,r]=b.useState(!1),[o,s]=b.useState(!1),i=l=>{s(l),l||r(!1)},a=(l,c,u)=>{if(!e.view)return;const d=c||l;if(u){e.commands.updateLink(u,{href:l,text:d});return}};return g.jsxs(n7,{open:n,onOpenChange:r,children:[g.jsx(r7,{children:g.jsx(HF,{className:"text-blue-600 underline hover:text-blue-700 cursor-pointer focus-within:outline-0"})}),g.jsxs(o7,{onOpenAutoFocus:l=>l.preventDefault(),side:"top",align:"center",className:"flex gap-2 items-center p-1 max-w-fit w-fit",children:[g.jsx(be,{size:"icon",tooltip:"Open Link",onClick:()=>window.open(t.attrs.href,"_blank"),children:g.jsx(sl,{})}),g.jsx(dm,{open:o,onOpenChange:i,defaultValues:{link:t?.attrs?.href??"",text:t?.attrs?.text??"",uid:t?.attrs?.uid??""},onInsertLink:a,children:g.jsx(be,{size:"icon",tooltip:"Edit Link",children:g.jsx(GV,{})})}),g.jsx(be,{size:"icon",tooltip:"Unset Link",onClick:()=>{r(!1),e.commands.unsetLink(),t?.attrs?.uid&&e.commands.deleteLinkPreviewByUid(t?.attrs?.uid)},children:g.jsx(o3,{})})]})]})},AO=ev.extend({name:"customLink",addOptions(){return{...this?.parent?.(),api:void 0}},addAttributes(){return{...this?.parent?.(),text:{default:null},uid:{default:null,parseHTML:()=>null,renderHTML:()=>({})}}},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!No(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Be(this.options.HTMLAttributes,t),0]:["a",Be(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{...this?.parent?.(),insertLink:t=>({chain:e,editor:n})=>{const{href:r,text:o}=t,s=ho(),i=i7(n),a=this.options.linkMode?i??s:s;return e().insertContent([{type:"text",text:o,marks:[{type:"customLink",attrs:{uid:s,href:r,text:o}}]},this.options.linkMode?{type:"text",text:" "}:null].filter(l=>l!==null))?.setLinkPreview({uid:a,loading:!0,href:""})?.run(),this?.options?.api?.resolveUrl(r)?.then(l=>{if(l){n?.chain()?.updateLinkPreviewByUid(a,{loading:!1,href:l.url,title:l.title,image:l.image?.url??null,description:l.description,domain:new URL(l.url).hostname})?.run();return}n.commands.deleteLinkPreviewByUid(s)})?.catch(()=>n.commands.deleteLinkPreviewByUid(s)),!0},updateLink:(t,e)=>({state:n,dispatch:r,editor:o})=>{if(!r)return!1;const{doc:s,schema:i,tr:a}=n;let l=a,c=!1;const u=[];return s.descendants((d,f)=>{d.isText&&d.marks?.length&&d.marks.forEach(h=>{h.type.name==="customLink"&&h.attrs.uid===t&&(u.push({from:f,to:f+d.nodeSize,mark:h,oldText:d.text||""}),c=!0)})}),c&&(u.sort((d,f)=>f.from-d.from),u.forEach(({from:d,to:f,mark:h,oldText:p})=>{const m={...h.attrs,href:e.href??h.attrs.href,text:e.text??e.href??h.attrs.text},y=e.text??e.href??p,v=i.marks.customLink;if(v){l=l.delete(d,f);const w=i.text(y,[v.create(m)]);l=l.insert(d,w)}}),r(l),e.href&&queueMicrotask(()=>{this.options.api?.resolveUrl(e.href)?.then(d=>{if(console.log({metadata:d}),d){let f=!1;o.state.doc.descendants(p=>{if(p.type.name==="linkPreview"&&p.attrs.uid===t)return f=!0,!1});const h={uid:t,href:d.url,title:d.title,image:d.image?.url??null,description:d.description,domain:new URL(d.url).hostname,loading:!1};f?o.commands.updateLinkPreviewByUid(t,h):o.commands.setLinkPreview(h)}else o.commands.deleteLinkPreviewByUid(t)}).catch(d=>{console.log("LINK UPDATE ERR::",{err:d}),o.commands.deleteLinkPreviewByUid(t)})})),c},updateLinkByUid:MK("customLink"),deleteLinkByUid:AK("customLink")}},addMarkView(){return zF(s7)},addKeyboardShortcuts(){return{Backspace:({editor:t})=>{const{empty:e}=t.state.selection;if(!e||!(t.state.storedMarks||t.state.selection.$from.marks()).find(l=>l.type.name==="customLink"))return!1;const o=t.state.selection.$from,s=o.nodeBefore,i=o.nodeAfter;return s&&s.marks.some(l=>l.type.name==="customLink")||i&&i.marks.some(l=>l.type.name==="customLink")||t.commands.unsetMark("customLink"),!1}}}}),i7=t=>{const{doc:e}=t.state;let n=null;return e.descendants(r=>{if(r.type.name==="linkPreview")return n=r.attrs.uid,!1}),n},a7=t=>t.includes("spotify.com/embed/track"),l7=({node:t,selected:e,editor:n,deleteNode:r})=>{const{src:o}=t.attrs,s=()=>{r(),n.chain().focus()};return g.jsxs(Qo,{"data-drag-handle":!0,className:re("relative p-4 bg-accent",e&&"border-2 border-blue-500"),children:[g.jsx("iframe",{src:o,allowFullScreen:!0,className:re("w-full rounded-md",a7(o)?"h-38":"h-96")}),g.jsx(Zn,{onClick:s,size:"icon",variant:"ghost",className:"absolute right-2 top-2 bg-background border hover:shadow-lg size-auto p-1.5 rounded-full",children:g.jsx(Wl,{})})]},o)};/*! @license DOMPurify 3.3.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.0/LICENSE */const{entries:MO,setPrototypeOf:Pw,isFrozen:c7,getPrototypeOf:u7,getOwnPropertyDescriptor:d7}=Object;let{freeze:dn,seal:tr,create:Mm}=Object,{apply:Om,construct:Rm}=typeof Reflect<"u"&&Reflect;dn||(dn=function(e){return e});tr||(tr=function(e){return e});Om||(Om=function(e,n){for(var r=arguments.length,o=new Array(r>2?r-2:0),s=2;s<r;s++)o[s-2]=arguments[s];return e.apply(n,o)});Rm||(Rm=function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return new e(...r)});const Nc=fn(Array.prototype.forEach),f7=fn(Array.prototype.lastIndexOf),Lw=fn(Array.prototype.pop),ha=fn(Array.prototype.push),h7=fn(Array.prototype.splice),Zc=fn(String.prototype.toLowerCase),Jh=fn(String.prototype.toString),Xh=fn(String.prototype.match),pa=fn(String.prototype.replace),p7=fn(String.prototype.indexOf),m7=fn(String.prototype.trim),sr=fn(Object.prototype.hasOwnProperty),on=fn(RegExp.prototype.test),ma=g7(TypeError);function fn(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return Om(t,e,r)}}function g7(t){return function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return Rm(t,n)}}function je(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Zc;Pw&&Pw(t,null);let r=e.length;for(;r--;){let o=e[r];if(typeof o=="string"){const s=n(o);s!==o&&(c7(e)||(e[r]=s),o=s)}t[o]=!0}return t}function y7(t){for(let e=0;e<t.length;e++)sr(t,e)||(t[e]=null);return t}function to(t){const e=Mm(null);for(const[n,r]of MO(t))sr(t,n)&&(Array.isArray(r)?e[n]=y7(r):r&&typeof r=="object"&&r.constructor===Object?e[n]=to(r):e[n]=r);return e}function ga(t,e){for(;t!==null;){const r=d7(t,e);if(r){if(r.get)return fn(r.get);if(typeof r.value=="function")return fn(r.value)}t=u7(t)}function n(){return null}return n}const jw=dn(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Qh=dn(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Zh=dn(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),v7=dn(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),ep=dn(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),b7=dn(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),$w=dn(["#text"]),Bw=dn(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),tp=dn(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Fw=dn(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),_c=dn(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),x7=tr(/\{\{[\w\W]*|[\w\W]*\}\}/gm),w7=tr(/<%[\w\W]*|[\w\W]*%>/gm),E7=tr(/\$\{[\w\W]*/gm),S7=tr(/^data-[\-\w.\u00B7-\uFFFF]+$/),k7=tr(/^aria-[\-\w]+$/),OO=tr(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),T7=tr(/^(?:\w+script|data):/i),C7=tr(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),RO=tr(/^html$/i),A7=tr(/^[a-z][.\w]*(-[.\w]+)+$/i);var Hw=Object.freeze({__proto__:null,ARIA_ATTR:k7,ATTR_WHITESPACE:C7,CUSTOM_ELEMENT:A7,DATA_ATTR:S7,DOCTYPE_NAME:RO,ERB_EXPR:w7,IS_ALLOWED_URI:OO,IS_SCRIPT_OR_DATA:T7,MUSTACHE_EXPR:x7,TMPLIT_EXPR:E7});const ya={element:1,text:3,progressingInstruction:7,comment:8,document:9},M7=function(){return typeof window>"u"?null:window},O7=function(e,n){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let r=null;const o="data-tt-policy-suffix";n&&n.hasAttribute(o)&&(r=n.getAttribute(o));const s="dompurify"+(r?"#"+r:"");try{return e.createPolicy(s,{createHTML(i){return i},createScriptURL(i){return i}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},Uw=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function NO(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:M7();const e=de=>NO(de);if(e.version="3.3.0",e.removed=[],!t||!t.document||t.document.nodeType!==ya.document||!t.Element)return e.isSupported=!1,e;let{document:n}=t;const r=n,o=r.currentScript,{DocumentFragment:s,HTMLTemplateElement:i,Node:a,Element:l,NodeFilter:c,NamedNodeMap:u=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:d,DOMParser:f,trustedTypes:h}=t,p=l.prototype,m=ga(p,"cloneNode"),y=ga(p,"remove"),v=ga(p,"nextSibling"),w=ga(p,"childNodes"),E=ga(p,"parentNode");if(typeof i=="function"){const de=n.createElement("template");de.content&&de.content.ownerDocument&&(n=de.content.ownerDocument)}let x,T="";const{implementation:S,createNodeIterator:k,createDocumentFragment:C,getElementsByTagName:N}=n,{importNode:R}=r;let L=Uw();e.isSupported=typeof MO=="function"&&typeof E=="function"&&S&&S.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:$,ERB_EXPR:B,TMPLIT_EXPR:U,DATA_ATTR:j,ARIA_ATTR:P,IS_SCRIPT_OR_DATA:H,ATTR_WHITESPACE:_,CUSTOM_ELEMENT:V}=Hw;let{IS_ALLOWED_URI:ie}=Hw,te=null;const ye=je({},[...jw,...Qh,...Zh,...ep,...$w]);let G=null;const Q=je({},[...Bw,...tp,...Fw,..._c]);let J=Object.seal(Mm(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),me=null,z=null;const Z=Object.seal(Mm(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Me=!0,he=!0,we=!1,Se=!0,ze=!1,ut=!0,dt=!1,Tt=!1,ft=!1,Ct=!1,vt=!1,At=!1,Ft=!0,it=!1;const Mt="user-content-";let pn=!0,mn=!1,Dt={},nn=null;const $n=je({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let kr=null;const On=je({},["audio","video","img","source","image","track"]);let Tr=null;const rn=je({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),or="http://www.w3.org/1998/Math/MathML",I="http://www.w3.org/2000/svg",X="http://www.w3.org/1999/xhtml";let ae=X,Ie=!1,ke=null;const Ge=je({},[or,I,X],Jh);let bt=je({},["mi","mo","mn","ms","mtext"]),qt=je({},["annotation-xml"]);const Cr=je({},["title","style","font","a","script"]);let It=null;const ve=["application/xhtml+xml","text/html"],Ke="text/html";let Ee=null,at=null;const Bn=n.createElement("form"),Ye=function(O){return O instanceof RegExp||O instanceof Function},A=function(){let O=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(at&&at===O)){if((!O||typeof O!="object")&&(O={}),O=to(O),It=ve.indexOf(O.PARSER_MEDIA_TYPE)===-1?Ke:O.PARSER_MEDIA_TYPE,Ee=It==="application/xhtml+xml"?Jh:Zc,te=sr(O,"ALLOWED_TAGS")?je({},O.ALLOWED_TAGS,Ee):ye,G=sr(O,"ALLOWED_ATTR")?je({},O.ALLOWED_ATTR,Ee):Q,ke=sr(O,"ALLOWED_NAMESPACES")?je({},O.ALLOWED_NAMESPACES,Jh):Ge,Tr=sr(O,"ADD_URI_SAFE_ATTR")?je(to(rn),O.ADD_URI_SAFE_ATTR,Ee):rn,kr=sr(O,"ADD_DATA_URI_TAGS")?je(to(On),O.ADD_DATA_URI_TAGS,Ee):On,nn=sr(O,"FORBID_CONTENTS")?je({},O.FORBID_CONTENTS,Ee):$n,me=sr(O,"FORBID_TAGS")?je({},O.FORBID_TAGS,Ee):to({}),z=sr(O,"FORBID_ATTR")?je({},O.FORBID_ATTR,Ee):to({}),Dt=sr(O,"USE_PROFILES")?O.USE_PROFILES:!1,Me=O.ALLOW_ARIA_ATTR!==!1,he=O.ALLOW_DATA_ATTR!==!1,we=O.ALLOW_UNKNOWN_PROTOCOLS||!1,Se=O.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ze=O.SAFE_FOR_TEMPLATES||!1,ut=O.SAFE_FOR_XML!==!1,dt=O.WHOLE_DOCUMENT||!1,Ct=O.RETURN_DOM||!1,vt=O.RETURN_DOM_FRAGMENT||!1,At=O.RETURN_TRUSTED_TYPE||!1,ft=O.FORCE_BODY||!1,Ft=O.SANITIZE_DOM!==!1,it=O.SANITIZE_NAMED_PROPS||!1,pn=O.KEEP_CONTENT!==!1,mn=O.IN_PLACE||!1,ie=O.ALLOWED_URI_REGEXP||OO,ae=O.NAMESPACE||X,bt=O.MATHML_TEXT_INTEGRATION_POINTS||bt,qt=O.HTML_INTEGRATION_POINTS||qt,J=O.CUSTOM_ELEMENT_HANDLING||{},O.CUSTOM_ELEMENT_HANDLING&&Ye(O.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(J.tagNameCheck=O.CUSTOM_ELEMENT_HANDLING.tagNameCheck),O.CUSTOM_ELEMENT_HANDLING&&Ye(O.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(J.attributeNameCheck=O.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),O.CUSTOM_ELEMENT_HANDLING&&typeof O.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(J.allowCustomizedBuiltInElements=O.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),ze&&(he=!1),vt&&(Ct=!0),Dt&&(te=je({},$w),G=[],Dt.html===!0&&(je(te,jw),je(G,Bw)),Dt.svg===!0&&(je(te,Qh),je(G,tp),je(G,_c)),Dt.svgFilters===!0&&(je(te,Zh),je(G,tp),je(G,_c)),Dt.mathMl===!0&&(je(te,ep),je(G,Fw),je(G,_c))),O.ADD_TAGS&&(typeof O.ADD_TAGS=="function"?Z.tagCheck=O.ADD_TAGS:(te===ye&&(te=to(te)),je(te,O.ADD_TAGS,Ee))),O.ADD_ATTR&&(typeof O.ADD_ATTR=="function"?Z.attributeCheck=O.ADD_ATTR:(G===Q&&(G=to(G)),je(G,O.ADD_ATTR,Ee))),O.ADD_URI_SAFE_ATTR&&je(Tr,O.ADD_URI_SAFE_ATTR,Ee),O.FORBID_CONTENTS&&(nn===$n&&(nn=to(nn)),je(nn,O.FORBID_CONTENTS,Ee)),pn&&(te["#text"]=!0),dt&&je(te,["html","head","body"]),te.table&&(je(te,["tbody"]),delete me.tbody),O.TRUSTED_TYPES_POLICY){if(typeof O.TRUSTED_TYPES_POLICY.createHTML!="function")throw ma('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof O.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ma('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');x=O.TRUSTED_TYPES_POLICY,T=x.createHTML("")}else x===void 0&&(x=O7(h,o)),x!==null&&typeof T=="string"&&(T=x.createHTML(""));dn&&dn(O),at=O}},W=je({},[...Qh,...Zh,...v7]),Y=je({},[...ep,...b7]),ce=function(O){let K=E(O);(!K||!K.tagName)&&(K={namespaceURI:ae,tagName:"template"});const le=Zc(O.tagName),ct=Zc(K.tagName);return ke[O.namespaceURI]?O.namespaceURI===I?K.namespaceURI===X?le==="svg":K.namespaceURI===or?le==="svg"&&(ct==="annotation-xml"||bt[ct]):!!W[le]:O.namespaceURI===or?K.namespaceURI===X?le==="math":K.namespaceURI===I?le==="math"&&qt[ct]:!!Y[le]:O.namespaceURI===X?K.namespaceURI===I&&!qt[ct]||K.namespaceURI===or&&!bt[ct]?!1:!Y[le]&&(Cr[le]||!W[le]):!!(It==="application/xhtml+xml"&&ke[O.namespaceURI]):!1},Re=function(O){ha(e.removed,{element:O});try{E(O).removeChild(O)}catch{y(O)}},Te=function(O,K){try{ha(e.removed,{attribute:K.getAttributeNode(O),from:K})}catch{ha(e.removed,{attribute:null,from:K})}if(K.removeAttribute(O),O==="is")if(Ct||vt)try{Re(K)}catch{}else try{K.setAttribute(O,"")}catch{}},Le=function(O){let K=null,le=null;if(ft)O="<remove></remove>"+O;else{const wt=Xh(O,/^[\r\n\t ]+/);le=wt&&wt[0]}It==="application/xhtml+xml"&&ae===X&&(O='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+O+"</body></html>");const ct=x?x.createHTML(O):O;if(ae===X)try{K=new f().parseFromString(ct,It)}catch{}if(!K||!K.documentElement){K=S.createDocument(ae,"template",null);try{K.documentElement.innerHTML=Ie?T:ct}catch{}}const Kt=K.body||K.documentElement;return O&&le&&Kt.insertBefore(n.createTextNode(le),Kt.childNodes[0]||null),ae===X?N.call(K,dt?"html":"body")[0]:dt?K.documentElement:Kt},Pe=function(O){return k.call(O.ownerDocument||O,O,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Ot=function(O){return O instanceof d&&(typeof O.nodeName!="string"||typeof O.textContent!="string"||typeof O.removeChild!="function"||!(O.attributes instanceof u)||typeof O.removeAttribute!="function"||typeof O.setAttribute!="function"||typeof O.namespaceURI!="string"||typeof O.insertBefore!="function"||typeof O.hasChildNodes!="function")},lt=function(O){return typeof a=="function"&&O instanceof a};function Ve(de,O,K){Nc(de,le=>{le.call(e,O,K,at)})}const Fn=function(O){let K=null;if(Ve(L.beforeSanitizeElements,O,null),Ot(O))return Re(O),!0;const le=Ee(O.nodeName);if(Ve(L.uponSanitizeElement,O,{tagName:le,allowedTags:te}),ut&&O.hasChildNodes()&&!lt(O.firstElementChild)&&on(/<[/\w!]/g,O.innerHTML)&&on(/<[/\w!]/g,O.textContent)||O.nodeType===ya.progressingInstruction||ut&&O.nodeType===ya.comment&&on(/<[/\w]/g,O.data))return Re(O),!0;if(!(Z.tagCheck instanceof Function&&Z.tagCheck(le))&&(!te[le]||me[le])){if(!me[le]&&aa(le)&&(J.tagNameCheck instanceof RegExp&&on(J.tagNameCheck,le)||J.tagNameCheck instanceof Function&&J.tagNameCheck(le)))return!1;if(pn&&!nn[le]){const ct=E(O)||O.parentNode,Kt=w(O)||O.childNodes;if(Kt&&ct){const wt=Kt.length;for(let gn=wt-1;gn>=0;--gn){const Kr=m(Kt[gn],!0);Kr.__removalCount=(O.__removalCount||0)+1,ct.insertBefore(Kr,v(O))}}}return Re(O),!0}return O instanceof l&&!ce(O)||(le==="noscript"||le==="noembed"||le==="noframes")&&on(/<\/no(script|embed|frames)/i,O.innerHTML)?(Re(O),!0):(ze&&O.nodeType===ya.text&&(K=O.textContent,Nc([$,B,U],ct=>{K=pa(K,ct," ")}),O.textContent!==K&&(ha(e.removed,{element:O.cloneNode()}),O.textContent=K)),Ve(L.afterSanitizeElements,O,null),!1)},qr=function(O,K,le){if(Ft&&(K==="id"||K==="name")&&(le in n||le in Bn))return!1;if(!(he&&!z[K]&&on(j,K))){if(!(Me&&on(P,K))){if(!(Z.attributeCheck instanceof Function&&Z.attributeCheck(K,O))){if(!G[K]||z[K]){if(!(aa(O)&&(J.tagNameCheck instanceof RegExp&&on(J.tagNameCheck,O)||J.tagNameCheck instanceof Function&&J.tagNameCheck(O))&&(J.attributeNameCheck instanceof RegExp&&on(J.attributeNameCheck,K)||J.attributeNameCheck instanceof Function&&J.attributeNameCheck(K,O))||K==="is"&&J.allowCustomizedBuiltInElements&&(J.tagNameCheck instanceof RegExp&&on(J.tagNameCheck,le)||J.tagNameCheck instanceof Function&&J.tagNameCheck(le))))return!1}else if(!Tr[K]){if(!on(ie,pa(le,_,""))){if(!((K==="src"||K==="xlink:href"||K==="href")&&O!=="script"&&p7(le,"data:")===0&&kr[O])){if(!(we&&!on(H,pa(le,_,"")))){if(le)return!1}}}}}}}return!0},aa=function(O){return O!=="annotation-xml"&&Xh(O,V)},Hn=function(O){Ve(L.beforeSanitizeAttributes,O,null);const{attributes:K}=O;if(!K||Ot(O))return;const le={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:G,forceKeepAttr:void 0};let ct=K.length;for(;ct--;){const Kt=K[ct],{name:wt,namespaceURI:gn,value:Kr}=Kt,ni=Ee(wt),Vf=Kr;let Ht=wt==="value"?Vf:m7(Vf);if(le.attrName=ni,le.attrValue=Ht,le.keepAttr=!0,le.forceKeepAttr=void 0,Ve(L.uponSanitizeAttribute,O,le),Ht=le.attrValue,it&&(ni==="id"||ni==="name")&&(Te(wt,O),Ht=Mt+Ht),ut&&on(/((--!?|])>)|<\/(style|title|textarea)/i,Ht)){Te(wt,O);continue}if(ni==="attributename"&&Xh(Ht,"href")){Te(wt,O);continue}if(le.forceKeepAttr)continue;if(!le.keepAttr){Te(wt,O);continue}if(!Se&&on(/\/>/i,Ht)){Te(wt,O);continue}ze&&Nc([$,B,U],Hv=>{Ht=pa(Ht,Hv," ")});const Fv=Ee(O.nodeName);if(!qr(Fv,ni,Ht)){Te(wt,O);continue}if(x&&typeof h=="object"&&typeof h.getAttributeType=="function"&&!gn)switch(h.getAttributeType(Fv,ni)){case"TrustedHTML":{Ht=x.createHTML(Ht);break}case"TrustedScriptURL":{Ht=x.createScriptURL(Ht);break}}if(Ht!==Vf)try{gn?O.setAttributeNS(gn,wt,Ht):O.setAttribute(wt,Ht),Ot(O)?Re(O):Lw(e.removed)}catch{Te(wt,O)}}Ve(L.afterSanitizeAttributes,O,null)},qN=function de(O){let K=null;const le=Pe(O);for(Ve(L.beforeSanitizeShadowDOM,O,null);K=le.nextNode();)Ve(L.uponSanitizeShadowNode,K,null),Fn(K),Hn(K),K.content instanceof s&&de(K.content);Ve(L.afterSanitizeShadowDOM,O,null)};return e.sanitize=function(de){let O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},K=null,le=null,ct=null,Kt=null;if(Ie=!de,Ie&&(de="<!-->"),typeof de!="string"&&!lt(de))if(typeof de.toString=="function"){if(de=de.toString(),typeof de!="string")throw ma("dirty is not a string, aborting")}else throw ma("toString is not a function");if(!e.isSupported)return de;if(Tt||A(O),e.removed=[],typeof de=="string"&&(mn=!1),mn){if(de.nodeName){const Kr=Ee(de.nodeName);if(!te[Kr]||me[Kr])throw ma("root node is forbidden and cannot be sanitized in-place")}}else if(de instanceof a)K=Le("<!---->"),le=K.ownerDocument.importNode(de,!0),le.nodeType===ya.element&&le.nodeName==="BODY"||le.nodeName==="HTML"?K=le:K.appendChild(le);else{if(!Ct&&!ze&&!dt&&de.indexOf("<")===-1)return x&&At?x.createHTML(de):de;if(K=Le(de),!K)return Ct?null:At?T:""}K&&ft&&Re(K.firstChild);const wt=Pe(mn?de:K);for(;ct=wt.nextNode();)Fn(ct),Hn(ct),ct.content instanceof s&&qN(ct.content);if(mn)return de;if(Ct){if(vt)for(Kt=C.call(K.ownerDocument);K.firstChild;)Kt.appendChild(K.firstChild);else Kt=K;return(G.shadowroot||G.shadowrootmode)&&(Kt=R.call(r,Kt,!0)),Kt}let gn=dt?K.outerHTML:K.innerHTML;return dt&&te["!doctype"]&&K.ownerDocument&&K.ownerDocument.doctype&&K.ownerDocument.doctype.name&&on(RO,K.ownerDocument.doctype.name)&&(gn="<!DOCTYPE "+K.ownerDocument.doctype.name+`>
|
|
559
|
+
`+gn),ze&&Nc([$,B,U],Kr=>{gn=pa(gn,Kr," ")}),x&&At?x.createHTML(gn):gn},e.setConfig=function(){let de=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};A(de),Tt=!0},e.clearConfig=function(){at=null,Tt=!1},e.isValidAttribute=function(de,O,K){at||A({});const le=Ee(de),ct=Ee(O);return qr(le,ct,K)},e.addHook=function(de,O){typeof O=="function"&&ha(L[de],O)},e.removeHook=function(de,O){if(O!==void 0){const K=f7(L[de],O);return K===-1?void 0:h7(L[de],K,1)[0]}return Lw(L[de])},e.removeHooks=function(de){L[de]=[]},e.removeAllHooks=function(){L=Uw()},e}var Nm=NO();const R7=["youtube.com","www.youtube.com","youtube-nocookie.com","www.youtube-nocookie.com","open.spotify.com","spotify.com"];function _O(t){try{const e=new URL(t);if(e.protocol!=="https:")return!1;const n=e.hostname.toLowerCase();return R7.some(r=>n===r||n.endsWith(`.${r}`))}catch{return!1}}const N7=()=>{const t={ADD_TAGS:["iframe"],ADD_ATTR:["src","width","height","frameborder","allowfullscreen","allow","sandbox","loading","referrerpolicy","title"],ALLOWED_URI_REGEXP:/^https:\/\//};return Nm.addHook("uponSanitizeElement",(e,n)=>{if(n.tagName==="iframe"){const o=e.getAttribute("src")||"";_O(o)||(console.warn("🚨 Blocked iframe from non-allowed domain:",o),e.parentNode?.removeChild(e))}}),t};function _7(t){try{const e=N7(),n=Nm.sanitize(t,e);if(!n.includes("<iframe"))return console.warn("⚠️ No valid iframe found after sanitization"),null;const r=n.match(/<iframe[^>]*src=["']([^"']+)["']/i);return!r||!r[1]||!_O(r[1])?null:r[1]}catch(e){return console.error("🚨 Error sanitizing iframe:",e),null}finally{Nm.removeAllHooks()}}const DO=t=>new RegExp(JC).test(t.trim()),IO=t=>new RegExp(XC).test(t.trim()),zw=t=>{const e=t.trim();if(DO(e)){const r=e.match(v3)?.[1];return r?`https://www.youtube.com/embed/${r}`:null}if(IO(e)){const n=e.match(/open\.spotify\.com\/(track|playlist|album)\/([A-Za-z0-9]+)/);if(!n)return null;const[,r,o]=n;return`https://open.spotify.com/embed/${r}/${o}?utm_source=generator`}return null},Vw=t=>DO(t)||IO(t),Ww=t=>e=>{const n=[],r=new RegExp(t.source,"gi");let o;for(;(o=r.exec(e))!==null;)n.push({index:o.index,text:o[0],match:o});return console.log({match:o,matches:n}),n.length>0?n:null},D7=_t.create({name:"iframe",group:"block",atom:!0,selectable:!0,draggable:!0,priority:1e3,addAttributes(){return{src:{default:null},width:{default:"100%"},maxWidth:{default:"100%",renderHTML:t=>({style:`max-width: ${t.maxWidth}`})},height:{default:"320"}}},parseHTML(){return[{tag:"iframe[src]"}]},renderHTML({HTMLAttributes:t}){return["iframe",Be(t,{class:"my-4"})]},addNodeView(){return Bl(l7)},addPasteRules(){return[{find:/<iframe.*?src="(.*?)".*?<\/iframe>/gi,handler:({state:t,range:e,match:n})=>{const r=n[0],o=_7(r);if(!o){console.warn("🚨 Blocked unsafe iframe paste"),$o.error("🚨 Your pasted iframe is not safe to render");return}console.log("✅ Safe iframe URL validated:",o);const s=this.type.create({src:o});t.tr.replaceRangeWith(e.from,e.to,s)}},{find:Ww(JC),handler:({state:t,range:e,match:n})=>{const r=n[0],o=zw(r);if(console.log({match:n,fullUrl:r,embedUrl:o}),!o)return;const s=this.type.create({src:o});t.tr.replaceRangeWith(e.from,e.to,s)}},{find:Ww(XC),handler:({state:t,range:e,match:n})=>{const r=n[0],o=zw(r);if(!o)return;const s=this.type.create({src:o});t.tr.replaceRangeWith(e.from,e.to,s)}}]},addCommands(){return{setIframe:t=>({tr:e,dispatch:n})=>{const r=this.type.create(t);return n&&e.replaceSelectionWith(r),!0}}}}),I7=t=>{const e=t.clipboardData;return e&&e.getData("text/plain")||null},P7=(t,e,n,r)=>{n.preventDefault();const o=il(e);return r&&t.commands.insertMediaWithUpload&&D3(o).then(s=>{s&&t.commands.insertMediaWithUpload({source:s?.src,type:s?.type,mediaType:Wo.MEDIA_ITEM})}).catch(s=>console.error("[SmartLinkPaste] Media detection failed, falling back to link:",s)),console.log("[SmartLinkPaste] Inserting as link node"),t.chain().focus().insertLink({href:o,text:e}).run(),!0},L7=(t,e,n)=>{const r=O3(t);if(!S3(r))return!1;const o=eA(r),s=il(e);return n.chain().focus().deleteSelection().insertLink({href:s,text:o}).run(),!0},j7=(t,e)=>(n,r)=>{try{const o=I7(r);if(!o||!ys(o))return!1;const s=o.trim();return console.log("[SmartLinkPaste] Valid URL detected:",Vw(s)),Vw(s)&&e?.autoEmbed?(r.preventDefault(),!1):!n.state.selection.empty&&e?.autoLinkSelection?(r.preventDefault(),L7(n,s,t)):P7(t,s,r,e?.autoDetectMedia??!0)}catch(o){return console.error("[SmartLinkPaste] Error:",o),!1}},$7=t=>e=>{const n=R3(e.content);if(ys(n.trim()))return e;try{return console.log("[SmartLinkPaste] Transforming inline URLs in pasted content"),j3(t,e)}catch(r){return console.error("[SmartLinkPaste] Transform error:",r),e}},PO=Qe.create({name:"smartLinkPaste",addOptions(){return{enableTransformPasted:!1,autoDetectMedia:!0,autoEmbed:!0,autoLinkSelection:!0,api:void 0}},addProseMirrorPlugins(){const{editor:t,options:e}=this,n={handlePaste:j7(t,e)};return e.enableTransformPasted&&(n.transformPasted=$7(t)),[new Ue({key:new We("smartLinkPaste"),props:n})]}}),B7=async t=>{const e=t?.file,n=t?.api,r=t?.onProgress,o=t?.mediaItemType,s=e instanceof File?e:new File([e],"upload.bin",{type:e.type});r&&r(10);const i=LO(r,10,90);try{const a=await n.uploadImage(s),l=av(a,o);return i&&clearInterval(i),r&&r(100),l}catch(a){throw i&&clearInterval(i),a}},F7=async t=>{const e=t?.url,n=t?.api,r=t?.onProgress,o=t?.mediaItemType,s=t?.searchFrom;r&&r(25);const i=LO(r,25,90);try{const a=await n.uploadUrl(e),l=av(a,o,s);return i&&clearInterval(i),r&&r(100),l}catch(a){throw i&&clearInterval(i),a}};function LO(t,e,n){if(!t)return null;let r=e;const o=5,i=setInterval(()=>{r+=o,r>=n&&(r=n,clearInterval(i)),t(r)},300);return i}const jO=Qe.create({name:"smartMediaUpload",addOptions(){return{api:void 0,maxFileSize:AD,allowedFileTypes:["image/*","video/*","audio/*"],maxConcurrentUploads:Aa,onUploadStart:void 0,onUploadProgress:void 0,onUploadComplete:void 0,onUploadError:void 0}},addCommands(){return{insertMediaWithUpload:({source:t,type:e,caption:n,mediaType:r,searchFrom:o})=>({commands:s,editor:i})=>{const a=ho(),l=this.options;if(!l.api)return console.error("API instance not provided to SmartMediaUpload"),!1;if(dc(t)){const u=vL(t,l.maxFileSize,l.allowedFileTypes);if(!u.valid)return console.error("File validation failed:",u.error),l.onUploadError?.(a,new Error(u.error)),!1}const c=dc(t)?URL.createObjectURL(t):t;return s.insertMedia({uid:a,src:c,type:e,caption:n||"",uploading:!0,progress:0}),dc(t)&&this.storage.blobUrls.set(a,c),this.storage.uploadQueue.push({uid:a,source:t,type:e,caption:n}),this.storage.processUploadQueue(i,r,o),!0}}},addStorage(){return{uploadQueue:[],activeUploads:0,blobUrls:new Map,processUploadQueue:null}},onCreate(){const t=async(e,n,r)=>{const{maxConcurrentUploads:o}=this.options;if(this.storage.activeUploads>=o||this.storage.uploadQueue.length===0)return;const s=this.storage.uploadQueue.shift();this.storage.activeUploads++;const i=this.options;await(async()=>{try{i.onUploadStart?.(s.uid);let a;if(dc(s.source))a=await B7({file:s.source,api:i.api,mediaItemType:n,onProgress:u=>{e.commands.updateMediaProgress(s.uid,u),i.onUploadProgress?.(s.uid,u)}});else if(yL(il(s.source)))a=await F7({url:s.source,api:i.api,mediaItemType:n,searchFrom:r,onProgress:u=>{e.commands.updateMediaProgress(s.uid,u),i.onUploadProgress?.(s.uid,u)}});else throw new Error("Invalid source type");const l=this.storage.blobUrls.get(s.uid);l&&(URL.revokeObjectURL(l),this.storage.blobUrls.delete(s.uid));const c=a?.sources?.original?.url||a?.sources?.thumbnail?.url;c?e.commands.updateMediaByUid(s.uid,{src:c,uploading:!1,progress:100,payload:a}):e.commands.deleteMediaByUid(s.uid),i.onUploadComplete?.(s.uid,c)}catch(a){console.error("Upload failed:",a);const l=this.storage.blobUrls.get(s.uid);l&&(URL.revokeObjectURL(l),this.storage.blobUrls.delete(s.uid)),e.commands.deleteMediaByUid(s.uid),i.onUploadError?.(s.uid,a)}finally{this.storage.activeUploads--,this.storage.processUploadQueue(e)}})().catch(a=>console.log(a)),this.storage.uploadQueue.length>0&&this.storage.processUploadQueue(e)};this.storage.processUploadQueue=t},onDestroy(){this.storage.blobUrls.forEach(t=>URL.revokeObjectURL(t)),this.storage.blobUrls.clear()},addProseMirrorPlugins(){const{editor:t}=this;return[new Ue({key:new We("smartMediaUpload"),props:{handleDrop:(e,n)=>{const r=Array.from(n.dataTransfer?.files||[]);return r.length===0?!1:r.length>Aa?($o.error(`You can upload at most ${Aa} media files at a time`),!1):(n.preventDefault(),r.forEach(o=>{let s;if(o.type.startsWith("image/"))s=xe.Image;else if(o.type.startsWith("video/"))s=xe.Video;else if(o.type.startsWith("audio/"))s=xe.Audio;else return;t.commands.insertMediaWithUpload({source:o,type:s,mediaType:Wo.MEDIA_ITEM})}),!0)},handlePaste:(e,n)=>{const o=Array.from(n.clipboardData?.items||[]).filter(s=>s.type.startsWith("image/"));return o.length===0?!1:(n.preventDefault(),o.forEach(s=>{const i=s.getAsFile();if(i){const a=i.type.toLowerCase()==="image/gif";t.commands.insertMediaWithUpload({source:i,type:xe.Image,mediaType:a?Wo.IMAGE_ITEM:Wo.MEDIA_ITEM})}}),!0)}}})]}});function H7(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:s,startOfLine:i,$position:a}=t,l=r&&!o,c=dF(n),u=new RegExp(`\\s${c}$`),d=i?"^":"",f=o?"":c,h=l?new RegExp(`${d}${c}.*?(?=\\s${f}|$)`,"gm"):new RegExp(`${d}(?:^)?${c}[^\\s${f}]*`,"gm"),p=((e=a.nodeBefore)==null?void 0:e.isText)&&a.nodeBefore.text;if(!p)return null;const m=a.pos-p.length,y=Array.from(p.matchAll(h)).pop();if(!y||y.input===void 0||y.index===void 0)return null;const v=y.input.slice(Math.max(0,y.index-1),y.index),w=new RegExp(`^[${s?.join("")}\0]?$`).test(v);if(s!==null&&!w)return null;const E=m+y.index;let x=E+y[0].length;return l&&u.test(p.slice(x-1,x+1))&&(y[0]+=" ",x+=1),E<a.pos&&x>=a.pos?{range:{from:E,to:x},query:y[0].slice(n.length),text:y[0]}:null}var U7=new We("suggestion");function z7({pluginKey:t=U7,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:o=!1,allowedPrefixes:s=[" "],startOfLine:i=!1,decorationTag:a="span",decorationClass:l="suggestion",decorationContent:c="",decorationEmptyClass:u="is-empty",command:d=()=>null,items:f=()=>[],render:h=()=>({}),allow:p=()=>!0,findSuggestionMatch:m=H7}){let y;const v=h?.(),w=()=>{const S=e.state.selection.$anchor.pos,k=e.view.coordsAtPos(S),{top:C,right:N,bottom:R,left:L}=k;try{return new DOMRect(L,C,N-L,R-C)}catch{return null}},E=(S,k)=>k?()=>{const C=t.getState(e.state),N=C?.decorationId,R=S.dom.querySelector(`[data-decoration-id="${N}"]`);return R?.getBoundingClientRect()||null}:w;function x(S,k){var C;try{const R=t.getState(S.state),L=R?.decorationId?S.dom.querySelector(`[data-decoration-id="${R.decorationId}"]`):null,$={editor:e,range:R?.range||{from:0,to:0},query:R?.query||null,text:R?.text||null,items:[],command:B=>d({editor:e,range:R?.range||{from:0,to:0},props:B}),decorationNode:L,clientRect:E(S,L)};(C=v?.onExit)==null||C.call(v,$)}catch{}const N=S.state.tr.setMeta(k,{exit:!0});S.dispatch(N)}const T=new Ue({key:t,view(){return{update:async(S,k)=>{var C,N,R,L,$,B,U;const j=(C=this.key)==null?void 0:C.getState(k),P=(N=this.key)==null?void 0:N.getState(S.state),H=j.active&&P.active&&j.range.from!==P.range.from,_=!j.active&&P.active,V=j.active&&!P.active,ie=!_&&!V&&j.query!==P.query,te=_||H&&ie,ye=ie||H,G=V||H&&ie;if(!te&&!ye&&!G)return;const Q=G&&!te?j:P,J=S.dom.querySelector(`[data-decoration-id="${Q.decorationId}"]`);y={editor:e,range:Q.range,query:Q.query,text:Q.text,items:[],command:me=>d({editor:e,range:Q.range,props:me}),decorationNode:J,clientRect:E(S,J)},te&&((R=v?.onBeforeStart)==null||R.call(v,y)),ye&&((L=v?.onBeforeUpdate)==null||L.call(v,y)),(ye||te)&&(y.items=await f({editor:e,query:Q.query})),G&&(($=v?.onExit)==null||$.call(v,y)),ye&&((B=v?.onUpdate)==null||B.call(v,y)),te&&((U=v?.onStart)==null||U.call(v,y))},destroy:()=>{var S;y&&((S=v?.onExit)==null||S.call(v,y))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(S,k,C,N){const{isEditable:R}=e,{composing:L}=e.view,{selection:$}=S,{empty:B,from:U}=$,j={...k},P=S.getMeta(t);if(P&&P.exit)return j.active=!1,j.decorationId=null,j.range={from:0,to:0},j.query=null,j.text=null,j;if(j.composing=L,R&&(B||e.view.composing)){(U<k.range.from||U>k.range.to)&&!L&&!k.composing&&(j.active=!1);const H=m({char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:s,startOfLine:i,$position:$.$from}),_=`id_${Math.floor(Math.random()*4294967295)}`;H&&p({editor:e,state:N,range:H.range,isActive:k.active})?(j.active=!0,j.decorationId=k.decorationId?k.decorationId:_,j.range=H.range,j.query=H.query,j.text=H.text):j.active=!1}else j.active=!1;return j.active||(j.decorationId=null,j.range={from:0,to:0},j.query=null,j.text=null),j}},props:{handleKeyDown(S,k){var C,N,R,L;const{active:$,range:B}=T.getState(S.state);if(!$)return!1;if(k.key==="Escape"||k.key==="Esc"){const j=T.getState(S.state),P=(C=y?.decorationNode)!=null?C:null,H=P??(j?.decorationId?S.dom.querySelector(`[data-decoration-id="${j.decorationId}"]`):null);if(((N=v?.onKeyDown)==null?void 0:N.call(v,{view:S,event:k,range:j.range}))||!1)return!0;const V={editor:e,range:j.range,query:j.query,text:j.text,items:[],command:ie=>d({editor:e,range:j.range,props:ie}),decorationNode:H,clientRect:H?()=>H.getBoundingClientRect()||null:null};return(R=v?.onExit)==null||R.call(v,V),x(S,t),!0}return((L=v?.onKeyDown)==null?void 0:L.call(v,{view:S,event:k,range:B}))||!1},decorations(S){const{active:k,range:C,decorationId:N,query:R}=T.getState(S);if(!k)return null;const L=!R?.length,$=[l];return L&&$.push(u),et.create(S.doc,[Gt.inline(C.from,C.to,{nodeName:a,class:$.join(" "),"data-decoration-id":N,"data-decoration-content":c})])}}});return T}var Tn="top",nr="bottom",rr="right",Cn="left",cv="auto",Xl=[Tn,nr,rr,Cn],$i="start",hl="end",V7="clippingParents",$O="viewport",va="popper",W7="reference",Gw=Xl.reduce(function(t,e){return t.concat([e+"-"+$i,e+"-"+hl])},[]),BO=[].concat(Xl,[cv]).reduce(function(t,e){return t.concat([e,e+"-"+$i,e+"-"+hl])},[]),G7="beforeRead",q7="read",K7="afterRead",Y7="beforeMain",J7="main",X7="afterMain",Q7="beforeWrite",Z7="write",eY="afterWrite",tY=[G7,q7,K7,Y7,J7,X7,Q7,Z7,eY];function Wr(t){return t?(t.nodeName||"").toLowerCase():null}function Pn(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function Hs(t){var e=Pn(t).Element;return t instanceof e||t instanceof Element}function Qn(t){var e=Pn(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function uv(t){if(typeof ShadowRoot>"u")return!1;var e=Pn(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function nY(t){var e=t.state;Object.keys(e.elements).forEach(function(n){var r=e.styles[n]||{},o=e.attributes[n]||{},s=e.elements[n];!Qn(s)||!Wr(s)||(Object.assign(s.style,r),Object.keys(o).forEach(function(i){var a=o[i];a===!1?s.removeAttribute(i):s.setAttribute(i,a===!0?"":a)}))})}function rY(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow),function(){Object.keys(e.elements).forEach(function(r){var o=e.elements[r],s=e.attributes[r]||{},i=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:n[r]),a=i.reduce(function(l,c){return l[c]="",l},{});!Qn(o)||!Wr(o)||(Object.assign(o.style,a),Object.keys(s).forEach(function(l){o.removeAttribute(l)}))})}}const FO={name:"applyStyles",enabled:!0,phase:"write",fn:nY,effect:rY,requires:["computeStyles"]};function Br(t){return t.split("-")[0]}var Rs=Math.max,pd=Math.min,Bi=Math.round;function _m(){var t=navigator.userAgentData;return t!=null&&t.brands&&Array.isArray(t.brands)?t.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function HO(){return!/^((?!chrome|android).)*safari/i.test(_m())}function Fi(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);var r=t.getBoundingClientRect(),o=1,s=1;e&&Qn(t)&&(o=t.offsetWidth>0&&Bi(r.width)/t.offsetWidth||1,s=t.offsetHeight>0&&Bi(r.height)/t.offsetHeight||1);var i=Hs(t)?Pn(t):window,a=i.visualViewport,l=!HO()&&n,c=(r.left+(l&&a?a.offsetLeft:0))/o,u=(r.top+(l&&a?a.offsetTop:0))/s,d=r.width/o,f=r.height/s;return{width:d,height:f,top:u,right:c+d,bottom:u+f,left:c,x:c,y:u}}function dv(t){var e=Fi(t),n=t.offsetWidth,r=t.offsetHeight;return Math.abs(e.width-n)<=1&&(n=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:r}}function UO(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&uv(n)){var r=e;do{if(r&&t.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function vo(t){return Pn(t).getComputedStyle(t)}function oY(t){return["table","td","th"].indexOf(Wr(t))>=0}function ds(t){return((Hs(t)?t.ownerDocument:t.document)||window.document).documentElement}function Cf(t){return Wr(t)==="html"?t:t.assignedSlot||t.parentNode||(uv(t)?t.host:null)||ds(t)}function qw(t){return!Qn(t)||vo(t).position==="fixed"?null:t.offsetParent}function sY(t){var e=/firefox/i.test(_m()),n=/Trident/i.test(_m());if(n&&Qn(t)){var r=vo(t);if(r.position==="fixed")return null}var o=Cf(t);for(uv(o)&&(o=o.host);Qn(o)&&["html","body"].indexOf(Wr(o))<0;){var s=vo(o);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||e&&s.willChange==="filter"||e&&s.filter&&s.filter!=="none")return o;o=o.parentNode}return null}function Ql(t){for(var e=Pn(t),n=qw(t);n&&oY(n)&&vo(n).position==="static";)n=qw(n);return n&&(Wr(n)==="html"||Wr(n)==="body"&&vo(n).position==="static")?e:n||sY(t)||e}function fv(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function Ha(t,e,n){return Rs(t,pd(e,n))}function iY(t,e,n){var r=Ha(t,e,n);return r>n?n:r}function zO(){return{top:0,right:0,bottom:0,left:0}}function VO(t){return Object.assign({},zO(),t)}function WO(t,e){return e.reduce(function(n,r){return n[r]=t,n},{})}var aY=function(e,n){return e=typeof e=="function"?e(Object.assign({},n.rects,{placement:n.placement})):e,VO(typeof e!="number"?e:WO(e,Xl))};function lY(t){var e,n=t.state,r=t.name,o=t.options,s=n.elements.arrow,i=n.modifiersData.popperOffsets,a=Br(n.placement),l=fv(a),c=[Cn,rr].indexOf(a)>=0,u=c?"height":"width";if(!(!s||!i)){var d=aY(o.padding,n),f=dv(s),h=l==="y"?Tn:Cn,p=l==="y"?nr:rr,m=n.rects.reference[u]+n.rects.reference[l]-i[l]-n.rects.popper[u],y=i[l]-n.rects.reference[l],v=Ql(s),w=v?l==="y"?v.clientHeight||0:v.clientWidth||0:0,E=m/2-y/2,x=d[h],T=w-f[u]-d[p],S=w/2-f[u]/2+E,k=Ha(x,S,T),C=l;n.modifiersData[r]=(e={},e[C]=k,e.centerOffset=k-S,e)}}function cY(t){var e=t.state,n=t.options,r=n.element,o=r===void 0?"[data-popper-arrow]":r;o!=null&&(typeof o=="string"&&(o=e.elements.popper.querySelector(o),!o)||UO(e.elements.popper,o)&&(e.elements.arrow=o))}const uY={name:"arrow",enabled:!0,phase:"main",fn:lY,effect:cY,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Hi(t){return t.split("-")[1]}var dY={top:"auto",right:"auto",bottom:"auto",left:"auto"};function fY(t,e){var n=t.x,r=t.y,o=e.devicePixelRatio||1;return{x:Bi(n*o)/o||0,y:Bi(r*o)/o||0}}function Kw(t){var e,n=t.popper,r=t.popperRect,o=t.placement,s=t.variation,i=t.offsets,a=t.position,l=t.gpuAcceleration,c=t.adaptive,u=t.roundOffsets,d=t.isFixed,f=i.x,h=f===void 0?0:f,p=i.y,m=p===void 0?0:p,y=typeof u=="function"?u({x:h,y:m}):{x:h,y:m};h=y.x,m=y.y;var v=i.hasOwnProperty("x"),w=i.hasOwnProperty("y"),E=Cn,x=Tn,T=window;if(c){var S=Ql(n),k="clientHeight",C="clientWidth";if(S===Pn(n)&&(S=ds(n),vo(S).position!=="static"&&a==="absolute"&&(k="scrollHeight",C="scrollWidth")),S=S,o===Tn||(o===Cn||o===rr)&&s===hl){x=nr;var N=d&&S===T&&T.visualViewport?T.visualViewport.height:S[k];m-=N-r.height,m*=l?1:-1}if(o===Cn||(o===Tn||o===nr)&&s===hl){E=rr;var R=d&&S===T&&T.visualViewport?T.visualViewport.width:S[C];h-=R-r.width,h*=l?1:-1}}var L=Object.assign({position:a},c&&dY),$=u===!0?fY({x:h,y:m},Pn(n)):{x:h,y:m};if(h=$.x,m=$.y,l){var B;return Object.assign({},L,(B={},B[x]=w?"0":"",B[E]=v?"0":"",B.transform=(T.devicePixelRatio||1)<=1?"translate("+h+"px, "+m+"px)":"translate3d("+h+"px, "+m+"px, 0)",B))}return Object.assign({},L,(e={},e[x]=w?m+"px":"",e[E]=v?h+"px":"",e.transform="",e))}function hY(t){var e=t.state,n=t.options,r=n.gpuAcceleration,o=r===void 0?!0:r,s=n.adaptive,i=s===void 0?!0:s,a=n.roundOffsets,l=a===void 0?!0:a,c={placement:Br(e.placement),variation:Hi(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:o,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,Kw(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:i,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,Kw(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const pY={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:hY,data:{}};var Dc={passive:!0};function mY(t){var e=t.state,n=t.instance,r=t.options,o=r.scroll,s=o===void 0?!0:o,i=r.resize,a=i===void 0?!0:i,l=Pn(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return s&&c.forEach(function(u){u.addEventListener("scroll",n.update,Dc)}),a&&l.addEventListener("resize",n.update,Dc),function(){s&&c.forEach(function(u){u.removeEventListener("scroll",n.update,Dc)}),a&&l.removeEventListener("resize",n.update,Dc)}}const gY={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:mY,data:{}};var yY={left:"right",right:"left",bottom:"top",top:"bottom"};function eu(t){return t.replace(/left|right|bottom|top/g,function(e){return yY[e]})}var vY={start:"end",end:"start"};function Yw(t){return t.replace(/start|end/g,function(e){return vY[e]})}function hv(t){var e=Pn(t),n=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:n,scrollTop:r}}function pv(t){return Fi(ds(t)).left+hv(t).scrollLeft}function bY(t,e){var n=Pn(t),r=ds(t),o=n.visualViewport,s=r.clientWidth,i=r.clientHeight,a=0,l=0;if(o){s=o.width,i=o.height;var c=HO();(c||!c&&e==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}return{width:s,height:i,x:a+pv(t),y:l}}function xY(t){var e,n=ds(t),r=hv(t),o=(e=t.ownerDocument)==null?void 0:e.body,s=Rs(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),i=Rs(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),a=-r.scrollLeft+pv(t),l=-r.scrollTop;return vo(o||n).direction==="rtl"&&(a+=Rs(n.clientWidth,o?o.clientWidth:0)-s),{width:s,height:i,x:a,y:l}}function mv(t){var e=vo(t),n=e.overflow,r=e.overflowX,o=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function GO(t){return["html","body","#document"].indexOf(Wr(t))>=0?t.ownerDocument.body:Qn(t)&&mv(t)?t:GO(Cf(t))}function Ua(t,e){var n;e===void 0&&(e=[]);var r=GO(t),o=r===((n=t.ownerDocument)==null?void 0:n.body),s=Pn(r),i=o?[s].concat(s.visualViewport||[],mv(r)?r:[]):r,a=e.concat(i);return o?a:a.concat(Ua(Cf(i)))}function Dm(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function wY(t,e){var n=Fi(t,!1,e==="fixed");return n.top=n.top+t.clientTop,n.left=n.left+t.clientLeft,n.bottom=n.top+t.clientHeight,n.right=n.left+t.clientWidth,n.width=t.clientWidth,n.height=t.clientHeight,n.x=n.left,n.y=n.top,n}function Jw(t,e,n){return e===$O?Dm(bY(t,n)):Hs(e)?wY(e,n):Dm(xY(ds(t)))}function EY(t){var e=Ua(Cf(t)),n=["absolute","fixed"].indexOf(vo(t).position)>=0,r=n&&Qn(t)?Ql(t):t;return Hs(r)?e.filter(function(o){return Hs(o)&&UO(o,r)&&Wr(o)!=="body"}):[]}function SY(t,e,n,r){var o=e==="clippingParents"?EY(t):[].concat(e),s=[].concat(o,[n]),i=s[0],a=s.reduce(function(l,c){var u=Jw(t,c,r);return l.top=Rs(u.top,l.top),l.right=pd(u.right,l.right),l.bottom=pd(u.bottom,l.bottom),l.left=Rs(u.left,l.left),l},Jw(t,i,r));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function qO(t){var e=t.reference,n=t.element,r=t.placement,o=r?Br(r):null,s=r?Hi(r):null,i=e.x+e.width/2-n.width/2,a=e.y+e.height/2-n.height/2,l;switch(o){case Tn:l={x:i,y:e.y-n.height};break;case nr:l={x:i,y:e.y+e.height};break;case rr:l={x:e.x+e.width,y:a};break;case Cn:l={x:e.x-n.width,y:a};break;default:l={x:e.x,y:e.y}}var c=o?fv(o):null;if(c!=null){var u=c==="y"?"height":"width";switch(s){case $i:l[c]=l[c]-(e[u]/2-n[u]/2);break;case hl:l[c]=l[c]+(e[u]/2-n[u]/2);break}}return l}function pl(t,e){e===void 0&&(e={});var n=e,r=n.placement,o=r===void 0?t.placement:r,s=n.strategy,i=s===void 0?t.strategy:s,a=n.boundary,l=a===void 0?V7:a,c=n.rootBoundary,u=c===void 0?$O:c,d=n.elementContext,f=d===void 0?va:d,h=n.altBoundary,p=h===void 0?!1:h,m=n.padding,y=m===void 0?0:m,v=VO(typeof y!="number"?y:WO(y,Xl)),w=f===va?W7:va,E=t.rects.popper,x=t.elements[p?w:f],T=SY(Hs(x)?x:x.contextElement||ds(t.elements.popper),l,u,i),S=Fi(t.elements.reference),k=qO({reference:S,element:E,placement:o}),C=Dm(Object.assign({},E,k)),N=f===va?C:S,R={top:T.top-N.top+v.top,bottom:N.bottom-T.bottom+v.bottom,left:T.left-N.left+v.left,right:N.right-T.right+v.right},L=t.modifiersData.offset;if(f===va&&L){var $=L[o];Object.keys(R).forEach(function(B){var U=[rr,nr].indexOf(B)>=0?1:-1,j=[Tn,nr].indexOf(B)>=0?"y":"x";R[B]+=$[j]*U})}return R}function kY(t,e){e===void 0&&(e={});var n=e,r=n.placement,o=n.boundary,s=n.rootBoundary,i=n.padding,a=n.flipVariations,l=n.allowedAutoPlacements,c=l===void 0?BO:l,u=Hi(r),d=u?a?Gw:Gw.filter(function(p){return Hi(p)===u}):Xl,f=d.filter(function(p){return c.indexOf(p)>=0});f.length===0&&(f=d);var h=f.reduce(function(p,m){return p[m]=pl(t,{placement:m,boundary:o,rootBoundary:s,padding:i})[Br(m)],p},{});return Object.keys(h).sort(function(p,m){return h[p]-h[m]})}function TY(t){if(Br(t)===cv)return[];var e=eu(t);return[Yw(t),e,Yw(e)]}function CY(t){var e=t.state,n=t.options,r=t.name;if(!e.modifiersData[r]._skip){for(var o=n.mainAxis,s=o===void 0?!0:o,i=n.altAxis,a=i===void 0?!0:i,l=n.fallbackPlacements,c=n.padding,u=n.boundary,d=n.rootBoundary,f=n.altBoundary,h=n.flipVariations,p=h===void 0?!0:h,m=n.allowedAutoPlacements,y=e.options.placement,v=Br(y),w=v===y,E=l||(w||!p?[eu(y)]:TY(y)),x=[y].concat(E).reduce(function(Q,J){return Q.concat(Br(J)===cv?kY(e,{placement:J,boundary:u,rootBoundary:d,padding:c,flipVariations:p,allowedAutoPlacements:m}):J)},[]),T=e.rects.reference,S=e.rects.popper,k=new Map,C=!0,N=x[0],R=0;R<x.length;R++){var L=x[R],$=Br(L),B=Hi(L)===$i,U=[Tn,nr].indexOf($)>=0,j=U?"width":"height",P=pl(e,{placement:L,boundary:u,rootBoundary:d,altBoundary:f,padding:c}),H=U?B?rr:Cn:B?nr:Tn;T[j]>S[j]&&(H=eu(H));var _=eu(H),V=[];if(s&&V.push(P[$]<=0),a&&V.push(P[H]<=0,P[_]<=0),V.every(function(Q){return Q})){N=L,C=!1;break}k.set(L,V)}if(C)for(var ie=p?3:1,te=function(J){var me=x.find(function(z){var Z=k.get(z);if(Z)return Z.slice(0,J).every(function(Me){return Me})});if(me)return N=me,"break"},ye=ie;ye>0;ye--){var G=te(ye);if(G==="break")break}e.placement!==N&&(e.modifiersData[r]._skip=!0,e.placement=N,e.reset=!0)}}const AY={name:"flip",enabled:!0,phase:"main",fn:CY,requiresIfExists:["offset"],data:{_skip:!1}};function Xw(t,e,n){return n===void 0&&(n={x:0,y:0}),{top:t.top-e.height-n.y,right:t.right-e.width+n.x,bottom:t.bottom-e.height+n.y,left:t.left-e.width-n.x}}function Qw(t){return[Tn,rr,nr,Cn].some(function(e){return t[e]>=0})}function MY(t){var e=t.state,n=t.name,r=e.rects.reference,o=e.rects.popper,s=e.modifiersData.preventOverflow,i=pl(e,{elementContext:"reference"}),a=pl(e,{altBoundary:!0}),l=Xw(i,r),c=Xw(a,o,s),u=Qw(l),d=Qw(c);e.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:u,hasPopperEscaped:d},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":d})}const OY={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:MY};function RY(t,e,n){var r=Br(t),o=[Cn,Tn].indexOf(r)>=0?-1:1,s=typeof n=="function"?n(Object.assign({},e,{placement:t})):n,i=s[0],a=s[1];return i=i||0,a=(a||0)*o,[Cn,rr].indexOf(r)>=0?{x:a,y:i}:{x:i,y:a}}function NY(t){var e=t.state,n=t.options,r=t.name,o=n.offset,s=o===void 0?[0,0]:o,i=BO.reduce(function(u,d){return u[d]=RY(d,e.rects,s),u},{}),a=i[e.placement],l=a.x,c=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=c),e.modifiersData[r]=i}const _Y={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:NY};function DY(t){var e=t.state,n=t.name;e.modifiersData[n]=qO({reference:e.rects.reference,element:e.rects.popper,placement:e.placement})}const IY={name:"popperOffsets",enabled:!0,phase:"read",fn:DY,data:{}};function PY(t){return t==="x"?"y":"x"}function LY(t){var e=t.state,n=t.options,r=t.name,o=n.mainAxis,s=o===void 0?!0:o,i=n.altAxis,a=i===void 0?!1:i,l=n.boundary,c=n.rootBoundary,u=n.altBoundary,d=n.padding,f=n.tether,h=f===void 0?!0:f,p=n.tetherOffset,m=p===void 0?0:p,y=pl(e,{boundary:l,rootBoundary:c,padding:d,altBoundary:u}),v=Br(e.placement),w=Hi(e.placement),E=!w,x=fv(v),T=PY(x),S=e.modifiersData.popperOffsets,k=e.rects.reference,C=e.rects.popper,N=typeof m=="function"?m(Object.assign({},e.rects,{placement:e.placement})):m,R=typeof N=="number"?{mainAxis:N,altAxis:N}:Object.assign({mainAxis:0,altAxis:0},N),L=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,$={x:0,y:0};if(S){if(s){var B,U=x==="y"?Tn:Cn,j=x==="y"?nr:rr,P=x==="y"?"height":"width",H=S[x],_=H+y[U],V=H-y[j],ie=h?-C[P]/2:0,te=w===$i?k[P]:C[P],ye=w===$i?-C[P]:-k[P],G=e.elements.arrow,Q=h&&G?dv(G):{width:0,height:0},J=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:zO(),me=J[U],z=J[j],Z=Ha(0,k[P],Q[P]),Me=E?k[P]/2-ie-Z-me-R.mainAxis:te-Z-me-R.mainAxis,he=E?-k[P]/2+ie+Z+z+R.mainAxis:ye+Z+z+R.mainAxis,we=e.elements.arrow&&Ql(e.elements.arrow),Se=we?x==="y"?we.clientTop||0:we.clientLeft||0:0,ze=(B=L?.[x])!=null?B:0,ut=H+Me-ze-Se,dt=H+he-ze,Tt=Ha(h?pd(_,ut):_,H,h?Rs(V,dt):V);S[x]=Tt,$[x]=Tt-H}if(a){var ft,Ct=x==="x"?Tn:Cn,vt=x==="x"?nr:rr,At=S[T],Ft=T==="y"?"height":"width",it=At+y[Ct],Mt=At-y[vt],pn=[Tn,Cn].indexOf(v)!==-1,mn=(ft=L?.[T])!=null?ft:0,Dt=pn?it:At-k[Ft]-C[Ft]-mn+R.altAxis,nn=pn?At+k[Ft]+C[Ft]-mn-R.altAxis:Mt,$n=h&&pn?iY(Dt,At,nn):Ha(h?Dt:it,At,h?nn:Mt);S[T]=$n,$[T]=$n-At}e.modifiersData[r]=$}}const jY={name:"preventOverflow",enabled:!0,phase:"main",fn:LY,requiresIfExists:["offset"]};function $Y(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function BY(t){return t===Pn(t)||!Qn(t)?hv(t):$Y(t)}function FY(t){var e=t.getBoundingClientRect(),n=Bi(e.width)/t.offsetWidth||1,r=Bi(e.height)/t.offsetHeight||1;return n!==1||r!==1}function HY(t,e,n){n===void 0&&(n=!1);var r=Qn(e),o=Qn(e)&&FY(e),s=ds(e),i=Fi(t,o,n),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!n)&&((Wr(e)!=="body"||mv(s))&&(a=BY(e)),Qn(e)?(l=Fi(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):s&&(l.x=pv(s))),{x:i.left+a.scrollLeft-l.x,y:i.top+a.scrollTop-l.y,width:i.width,height:i.height}}function UY(t){var e=new Map,n=new Set,r=[];t.forEach(function(s){e.set(s.name,s)});function o(s){n.add(s.name);var i=[].concat(s.requires||[],s.requiresIfExists||[]);i.forEach(function(a){if(!n.has(a)){var l=e.get(a);l&&o(l)}}),r.push(s)}return t.forEach(function(s){n.has(s.name)||o(s)}),r}function zY(t){var e=UY(t);return tY.reduce(function(n,r){return n.concat(e.filter(function(o){return o.phase===r}))},[])}function VY(t){var e;return function(){return e||(e=new Promise(function(n){Promise.resolve().then(function(){e=void 0,n(t())})})),e}}function WY(t){var e=t.reduce(function(n,r){var o=n[r.name];return n[r.name]=o?Object.assign({},o,r,{options:Object.assign({},o.options,r.options),data:Object.assign({},o.data,r.data)}):r,n},{});return Object.keys(e).map(function(n){return e[n]})}var Zw={placement:"bottom",modifiers:[],strategy:"absolute"};function eE(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return!e.some(function(r){return!(r&&typeof r.getBoundingClientRect=="function")})}function GY(t){t===void 0&&(t={});var e=t,n=e.defaultModifiers,r=n===void 0?[]:n,o=e.defaultOptions,s=o===void 0?Zw:o;return function(a,l,c){c===void 0&&(c=s);var u={placement:"bottom",orderedModifiers:[],options:Object.assign({},Zw,s),modifiersData:{},elements:{reference:a,popper:l},attributes:{},styles:{}},d=[],f=!1,h={state:u,setOptions:function(v){var w=typeof v=="function"?v(u.options):v;m(),u.options=Object.assign({},s,u.options,w),u.scrollParents={reference:Hs(a)?Ua(a):a.contextElement?Ua(a.contextElement):[],popper:Ua(l)};var E=zY(WY([].concat(r,u.options.modifiers)));return u.orderedModifiers=E.filter(function(x){return x.enabled}),p(),h.update()},forceUpdate:function(){if(!f){var v=u.elements,w=v.reference,E=v.popper;if(eE(w,E)){u.rects={reference:HY(w,Ql(E),u.options.strategy==="fixed"),popper:dv(E)},u.reset=!1,u.placement=u.options.placement,u.orderedModifiers.forEach(function(R){return u.modifiersData[R.name]=Object.assign({},R.data)});for(var x=0;x<u.orderedModifiers.length;x++){if(u.reset===!0){u.reset=!1,x=-1;continue}var T=u.orderedModifiers[x],S=T.fn,k=T.options,C=k===void 0?{}:k,N=T.name;typeof S=="function"&&(u=S({state:u,options:C,name:N,instance:h})||u)}}}},update:VY(function(){return new Promise(function(y){h.forceUpdate(),y(u)})}),destroy:function(){m(),f=!0}};if(!eE(a,l))return h;h.setOptions(c).then(function(y){!f&&c.onFirstUpdate&&c.onFirstUpdate(y)});function p(){u.orderedModifiers.forEach(function(y){var v=y.name,w=y.options,E=w===void 0?{}:w,x=y.effect;if(typeof x=="function"){var T=x({state:u,name:v,instance:h,options:E}),S=function(){};d.push(T||S)}})}function m(){d.forEach(function(y){return y()}),d=[]}return h}}var qY=[gY,IY,pY,FO,_Y,AY,jY,uY,OY],KY=GY({defaultModifiers:qY}),YY="tippy-box",KO="tippy-content",JY="tippy-backdrop",YO="tippy-arrow",JO="tippy-svg-arrow",ms={passive:!0,capture:!0},XO=function(){return document.body};function XY(t,e){return{}.hasOwnProperty.call(t,e)}function np(t,e,n){if(Array.isArray(t)){var r=t[e];return r??(Array.isArray(n)?n[e]:n)}return t}function gv(t,e){var n={}.toString.call(t);return n.indexOf("[object")===0&&n.indexOf(e+"]")>-1}function QO(t,e){return typeof t=="function"?t.apply(void 0,e):t}function tE(t,e){if(e===0)return t;var n;return function(r){clearTimeout(n),n=setTimeout(function(){t(r)},e)}}function QY(t,e){var n=Object.assign({},t);return e.forEach(function(r){delete n[r]}),n}function ZY(t){return t.split(/\s+/).filter(Boolean)}function gi(t){return[].concat(t)}function nE(t,e){t.indexOf(e)===-1&&t.push(e)}function eJ(t){return t.filter(function(e,n){return t.indexOf(e)===n})}function tJ(t){return t.split("-")[0]}function md(t){return[].slice.call(t)}function rE(t){return Object.keys(t).reduce(function(e,n){return t[n]!==void 0&&(e[n]=t[n]),e},{})}function za(){return document.createElement("div")}function ml(t){return["Element","Fragment"].some(function(e){return gv(t,e)})}function nJ(t){return gv(t,"NodeList")}function rJ(t){return gv(t,"MouseEvent")}function oJ(t){return!!(t&&t._tippy&&t._tippy.reference===t)}function sJ(t){return ml(t)?[t]:nJ(t)?md(t):Array.isArray(t)?t:md(document.querySelectorAll(t))}function rp(t,e){t.forEach(function(n){n&&(n.style.transitionDuration=e+"ms")})}function oE(t,e){t.forEach(function(n){n&&n.setAttribute("data-state",e)})}function iJ(t){var e,n=gi(t),r=n[0];return r!=null&&(e=r.ownerDocument)!=null&&e.body?r.ownerDocument:document}function aJ(t,e){var n=e.clientX,r=e.clientY;return t.every(function(o){var s=o.popperRect,i=o.popperState,a=o.props,l=a.interactiveBorder,c=tJ(i.placement),u=i.modifiersData.offset;if(!u)return!0;var d=c==="bottom"?u.top.y:0,f=c==="top"?u.bottom.y:0,h=c==="right"?u.left.x:0,p=c==="left"?u.right.x:0,m=s.top-r+d>l,y=r-s.bottom-f>l,v=s.left-n+h>l,w=n-s.right-p>l;return m||y||v||w})}function op(t,e,n){var r=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(o){t[r](o,n)})}function sE(t,e){for(var n=e;n;){var r;if(t.contains(n))return!0;n=n.getRootNode==null||(r=n.getRootNode())==null?void 0:r.host}return!1}var Ir={isTouch:!1},iE=0;function lJ(){Ir.isTouch||(Ir.isTouch=!0,window.performance&&document.addEventListener("mousemove",ZO))}function ZO(){var t=performance.now();t-iE<20&&(Ir.isTouch=!1,document.removeEventListener("mousemove",ZO)),iE=t}function cJ(){var t=document.activeElement;if(oJ(t)){var e=t._tippy;t.blur&&!e.state.isVisible&&t.blur()}}function uJ(){document.addEventListener("touchstart",lJ,ms),window.addEventListener("blur",cJ)}var dJ=typeof window<"u"&&typeof document<"u",fJ=dJ?!!window.msCrypto:!1;function di(t){var e=t==="destroy"?"n already-":" ";return[t+"() was called on a"+e+"destroyed instance. This is a no-op but","indicates a potential memory leak."].join(" ")}function aE(t){var e=/[ \t]{2,}/g,n=/^[ \t]*/gm;return t.replace(e," ").replace(n,"").trim()}function hJ(t){return aE(`
|
|
560
|
+
%ctippy.js
|
|
561
|
+
|
|
562
|
+
%c`+aE(t)+`
|
|
563
|
+
|
|
564
|
+
%c👷 This is a development-only message. It will be removed in production.
|
|
565
|
+
`)}function eR(t){return[hJ(t),"color: #00C584; font-size: 1.3em; font-weight: bold;","line-height: 1.5","color: #a6a095;"]}var gl;process.env.NODE_ENV!=="production"&&pJ();function pJ(){gl=new Set}function oo(t,e){if(t&&!gl.has(e)){var n;gl.add(e),(n=console).warn.apply(n,eR(e))}}function Im(t,e){if(t&&!gl.has(e)){var n;gl.add(e),(n=console).error.apply(n,eR(e))}}function mJ(t){var e=!t,n=Object.prototype.toString.call(t)==="[object Object]"&&!t.addEventListener;Im(e,["tippy() was passed","`"+String(t)+"`","as its targets (first) argument. Valid types are: String, Element,","Element[], or NodeList."].join(" ")),Im(n,["tippy() was passed a plain object which is not supported as an argument","for virtual positioning. Use props.getReferenceClientRect instead."].join(" "))}var tR={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},gJ={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},Dn=Object.assign({appendTo:XO,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},tR,gJ),yJ=Object.keys(Dn),vJ=function(e){process.env.NODE_ENV!=="production"&&rR(e,[]);var n=Object.keys(e);n.forEach(function(r){Dn[r]=e[r]})};function nR(t){var e=t.plugins||[],n=e.reduce(function(r,o){var s=o.name,i=o.defaultValue;if(s){var a;r[s]=t[s]!==void 0?t[s]:(a=Dn[s])!=null?a:i}return r},{});return Object.assign({},t,n)}function bJ(t,e){var n=e?Object.keys(nR(Object.assign({},Dn,{plugins:e}))):yJ,r=n.reduce(function(o,s){var i=(t.getAttribute("data-tippy-"+s)||"").trim();if(!i)return o;if(s==="content")o[s]=i;else try{o[s]=JSON.parse(i)}catch{o[s]=i}return o},{});return r}function lE(t,e){var n=Object.assign({},e,{content:QO(e.content,[t])},e.ignoreAttributes?{}:bJ(t,e.plugins));return n.aria=Object.assign({},Dn.aria,n.aria),n.aria={expanded:n.aria.expanded==="auto"?e.interactive:n.aria.expanded,content:n.aria.content==="auto"?e.interactive?null:"describedby":n.aria.content},n}function rR(t,e){t===void 0&&(t={}),e===void 0&&(e=[]);var n=Object.keys(t);n.forEach(function(r){var o=QY(Dn,Object.keys(tR)),s=!XY(o,r);s&&(s=e.filter(function(i){return i.name===r}).length===0),oo(s,["`"+r+"`","is not a valid prop. You may have spelled it incorrectly, or if it's","a plugin, forgot to pass it in an array as props.plugins.",`
|
|
566
|
+
|
|
567
|
+
`,`All props: https://atomiks.github.io/tippyjs/v6/all-props/
|
|
568
|
+
`,"Plugins: https://atomiks.github.io/tippyjs/v6/plugins/"].join(" "))})}var xJ=function(){return"innerHTML"};function Pm(t,e){t[xJ()]=e}function cE(t){var e=za();return t===!0?e.className=YO:(e.className=JO,ml(t)?e.appendChild(t):Pm(e,t)),e}function uE(t,e){ml(e.content)?(Pm(t,""),t.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?Pm(t,e.content):t.textContent=e.content)}function Lm(t){var e=t.firstElementChild,n=md(e.children);return{box:e,content:n.find(function(r){return r.classList.contains(KO)}),arrow:n.find(function(r){return r.classList.contains(YO)||r.classList.contains(JO)}),backdrop:n.find(function(r){return r.classList.contains(JY)})}}function oR(t){var e=za(),n=za();n.className=YY,n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var r=za();r.className=KO,r.setAttribute("data-state","hidden"),uE(r,t.props),e.appendChild(n),n.appendChild(r),o(t.props,t.props);function o(s,i){var a=Lm(e),l=a.box,c=a.content,u=a.arrow;i.theme?l.setAttribute("data-theme",i.theme):l.removeAttribute("data-theme"),typeof i.animation=="string"?l.setAttribute("data-animation",i.animation):l.removeAttribute("data-animation"),i.inertia?l.setAttribute("data-inertia",""):l.removeAttribute("data-inertia"),l.style.maxWidth=typeof i.maxWidth=="number"?i.maxWidth+"px":i.maxWidth,i.role?l.setAttribute("role",i.role):l.removeAttribute("role"),(s.content!==i.content||s.allowHTML!==i.allowHTML)&&uE(c,t.props),i.arrow?u?s.arrow!==i.arrow&&(l.removeChild(u),l.appendChild(cE(i.arrow))):l.appendChild(cE(i.arrow)):u&&l.removeChild(u)}return{popper:e,onUpdate:o}}oR.$$tippy=!0;var wJ=1,Ic=[],sp=[];function EJ(t,e){var n=lE(t,Object.assign({},Dn,nR(rE(e)))),r,o,s,i=!1,a=!1,l=!1,c=!1,u,d,f,h=[],p=tE(ut,n.interactiveDebounce),m,y=wJ++,v=null,w=eJ(n.plugins),E={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},x={id:y,reference:t,popper:za(),popperInstance:v,props:n,state:E,plugins:w,clearDelayTimeouts:Dt,setProps:nn,setContent:$n,show:kr,hide:On,hideWithInteractivity:Tr,enable:pn,disable:mn,unmount:rn,destroy:or};if(!n.render)return process.env.NODE_ENV!=="production"&&Im(!0,"render() function has not been supplied."),x;var T=n.render(x),S=T.popper,k=T.onUpdate;S.setAttribute("data-tippy-root",""),S.id="tippy-"+x.id,x.popper=S,t._tippy=x,S._tippy=x;var C=w.map(function(I){return I.fn(x)}),N=t.hasAttribute("aria-expanded");return we(),ie(),H(),_("onCreate",[x]),n.showOnCreate&&it(),S.addEventListener("mouseenter",function(){x.props.interactive&&x.state.isVisible&&x.clearDelayTimeouts()}),S.addEventListener("mouseleave",function(){x.props.interactive&&x.props.trigger.indexOf("mouseenter")>=0&&U().addEventListener("mousemove",p)}),x;function R(){var I=x.props.touch;return Array.isArray(I)?I:[I,0]}function L(){return R()[0]==="hold"}function $(){var I;return!!((I=x.props.render)!=null&&I.$$tippy)}function B(){return m||t}function U(){var I=B().parentNode;return I?iJ(I):document}function j(){return Lm(S)}function P(I){return x.state.isMounted&&!x.state.isVisible||Ir.isTouch||u&&u.type==="focus"?0:np(x.props.delay,I?0:1,Dn.delay)}function H(I){I===void 0&&(I=!1),S.style.pointerEvents=x.props.interactive&&!I?"":"none",S.style.zIndex=""+x.props.zIndex}function _(I,X,ae){if(ae===void 0&&(ae=!0),C.forEach(function(ke){ke[I]&&ke[I].apply(ke,X)}),ae){var Ie;(Ie=x.props)[I].apply(Ie,X)}}function V(){var I=x.props.aria;if(I.content){var X="aria-"+I.content,ae=S.id,Ie=gi(x.props.triggerTarget||t);Ie.forEach(function(ke){var Ge=ke.getAttribute(X);if(x.state.isVisible)ke.setAttribute(X,Ge?Ge+" "+ae:ae);else{var bt=Ge&&Ge.replace(ae,"").trim();bt?ke.setAttribute(X,bt):ke.removeAttribute(X)}})}}function ie(){if(!(N||!x.props.aria.expanded)){var I=gi(x.props.triggerTarget||t);I.forEach(function(X){x.props.interactive?X.setAttribute("aria-expanded",x.state.isVisible&&X===B()?"true":"false"):X.removeAttribute("aria-expanded")})}}function te(){U().removeEventListener("mousemove",p),Ic=Ic.filter(function(I){return I!==p})}function ye(I){if(!(Ir.isTouch&&(l||I.type==="mousedown"))){var X=I.composedPath&&I.composedPath()[0]||I.target;if(!(x.props.interactive&&sE(S,X))){if(gi(x.props.triggerTarget||t).some(function(ae){return sE(ae,X)})){if(Ir.isTouch||x.state.isVisible&&x.props.trigger.indexOf("click")>=0)return}else _("onClickOutside",[x,I]);x.props.hideOnClick===!0&&(x.clearDelayTimeouts(),x.hide(),a=!0,setTimeout(function(){a=!1}),x.state.isMounted||me())}}}function G(){l=!0}function Q(){l=!1}function J(){var I=U();I.addEventListener("mousedown",ye,!0),I.addEventListener("touchend",ye,ms),I.addEventListener("touchstart",Q,ms),I.addEventListener("touchmove",G,ms)}function me(){var I=U();I.removeEventListener("mousedown",ye,!0),I.removeEventListener("touchend",ye,ms),I.removeEventListener("touchstart",Q,ms),I.removeEventListener("touchmove",G,ms)}function z(I,X){Me(I,function(){!x.state.isVisible&&S.parentNode&&S.parentNode.contains(S)&&X()})}function Z(I,X){Me(I,X)}function Me(I,X){var ae=j().box;function Ie(ke){ke.target===ae&&(op(ae,"remove",Ie),X())}if(I===0)return X();op(ae,"remove",d),op(ae,"add",Ie),d=Ie}function he(I,X,ae){ae===void 0&&(ae=!1);var Ie=gi(x.props.triggerTarget||t);Ie.forEach(function(ke){ke.addEventListener(I,X,ae),h.push({node:ke,eventType:I,handler:X,options:ae})})}function we(){L()&&(he("touchstart",ze,{passive:!0}),he("touchend",dt,{passive:!0})),ZY(x.props.trigger).forEach(function(I){if(I!=="manual")switch(he(I,ze),I){case"mouseenter":he("mouseleave",dt);break;case"focus":he(fJ?"focusout":"blur",Tt);break;case"focusin":he("focusout",Tt);break}})}function Se(){h.forEach(function(I){var X=I.node,ae=I.eventType,Ie=I.handler,ke=I.options;X.removeEventListener(ae,Ie,ke)}),h=[]}function ze(I){var X,ae=!1;if(!(!x.state.isEnabled||ft(I)||a)){var Ie=((X=u)==null?void 0:X.type)==="focus";u=I,m=I.currentTarget,ie(),!x.state.isVisible&&rJ(I)&&Ic.forEach(function(ke){return ke(I)}),I.type==="click"&&(x.props.trigger.indexOf("mouseenter")<0||i)&&x.props.hideOnClick!==!1&&x.state.isVisible?ae=!0:it(I),I.type==="click"&&(i=!ae),ae&&!Ie&&Mt(I)}}function ut(I){var X=I.target,ae=B().contains(X)||S.contains(X);if(!(I.type==="mousemove"&&ae)){var Ie=Ft().concat(S).map(function(ke){var Ge,bt=ke._tippy,qt=(Ge=bt.popperInstance)==null?void 0:Ge.state;return qt?{popperRect:ke.getBoundingClientRect(),popperState:qt,props:n}:null}).filter(Boolean);aJ(Ie,I)&&(te(),Mt(I))}}function dt(I){var X=ft(I)||x.props.trigger.indexOf("click")>=0&&i;if(!X){if(x.props.interactive){x.hideWithInteractivity(I);return}Mt(I)}}function Tt(I){x.props.trigger.indexOf("focusin")<0&&I.target!==B()||x.props.interactive&&I.relatedTarget&&S.contains(I.relatedTarget)||Mt(I)}function ft(I){return Ir.isTouch?L()!==I.type.indexOf("touch")>=0:!1}function Ct(){vt();var I=x.props,X=I.popperOptions,ae=I.placement,Ie=I.offset,ke=I.getReferenceClientRect,Ge=I.moveTransition,bt=$()?Lm(S).arrow:null,qt=ke?{getBoundingClientRect:ke,contextElement:ke.contextElement||B()}:t,Cr={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(Ke){var Ee=Ke.state;if($()){var at=j(),Bn=at.box;["placement","reference-hidden","escaped"].forEach(function(Ye){Ye==="placement"?Bn.setAttribute("data-placement",Ee.placement):Ee.attributes.popper["data-popper-"+Ye]?Bn.setAttribute("data-"+Ye,""):Bn.removeAttribute("data-"+Ye)}),Ee.attributes.popper={}}}},It=[{name:"offset",options:{offset:Ie}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!Ge}},Cr];$()&&bt&&It.push({name:"arrow",options:{element:bt,padding:3}}),It.push.apply(It,X?.modifiers||[]),x.popperInstance=KY(qt,S,Object.assign({},X,{placement:ae,onFirstUpdate:f,modifiers:It}))}function vt(){x.popperInstance&&(x.popperInstance.destroy(),x.popperInstance=null)}function At(){var I=x.props.appendTo,X,ae=B();x.props.interactive&&I===XO||I==="parent"?X=ae.parentNode:X=QO(I,[ae]),X.contains(S)||X.appendChild(S),x.state.isMounted=!0,Ct(),process.env.NODE_ENV!=="production"&&oo(x.props.interactive&&I===Dn.appendTo&&ae.nextElementSibling!==S,["Interactive tippy element may not be accessible via keyboard","navigation because it is not directly after the reference element","in the DOM source order.",`
|
|
569
|
+
|
|
570
|
+
`,"Using a wrapper <div> or <span> tag around the reference element","solves this by creating a new parentNode context.",`
|
|
571
|
+
|
|
572
|
+
`,"Specifying `appendTo: document.body` silences this warning, but it","assumes you are using a focus management solution to handle","keyboard navigation.",`
|
|
573
|
+
|
|
574
|
+
`,"See: https://atomiks.github.io/tippyjs/v6/accessibility/#interactivity"].join(" "))}function Ft(){return md(S.querySelectorAll("[data-tippy-root]"))}function it(I){x.clearDelayTimeouts(),I&&_("onTrigger",[x,I]),J();var X=P(!0),ae=R(),Ie=ae[0],ke=ae[1];Ir.isTouch&&Ie==="hold"&&ke&&(X=ke),X?r=setTimeout(function(){x.show()},X):x.show()}function Mt(I){if(x.clearDelayTimeouts(),_("onUntrigger",[x,I]),!x.state.isVisible){me();return}if(!(x.props.trigger.indexOf("mouseenter")>=0&&x.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(I.type)>=0&&i)){var X=P(!1);X?o=setTimeout(function(){x.state.isVisible&&x.hide()},X):s=requestAnimationFrame(function(){x.hide()})}}function pn(){x.state.isEnabled=!0}function mn(){x.hide(),x.state.isEnabled=!1}function Dt(){clearTimeout(r),clearTimeout(o),cancelAnimationFrame(s)}function nn(I){if(process.env.NODE_ENV!=="production"&&oo(x.state.isDestroyed,di("setProps")),!x.state.isDestroyed){_("onBeforeUpdate",[x,I]),Se();var X=x.props,ae=lE(t,Object.assign({},X,rE(I),{ignoreAttributes:!0}));x.props=ae,we(),X.interactiveDebounce!==ae.interactiveDebounce&&(te(),p=tE(ut,ae.interactiveDebounce)),X.triggerTarget&&!ae.triggerTarget?gi(X.triggerTarget).forEach(function(Ie){Ie.removeAttribute("aria-expanded")}):ae.triggerTarget&&t.removeAttribute("aria-expanded"),ie(),H(),k&&k(X,ae),x.popperInstance&&(Ct(),Ft().forEach(function(Ie){requestAnimationFrame(Ie._tippy.popperInstance.forceUpdate)})),_("onAfterUpdate",[x,I])}}function $n(I){x.setProps({content:I})}function kr(){process.env.NODE_ENV!=="production"&&oo(x.state.isDestroyed,di("show"));var I=x.state.isVisible,X=x.state.isDestroyed,ae=!x.state.isEnabled,Ie=Ir.isTouch&&!x.props.touch,ke=np(x.props.duration,0,Dn.duration);if(!(I||X||ae||Ie)&&!B().hasAttribute("disabled")&&(_("onShow",[x],!1),x.props.onShow(x)!==!1)){if(x.state.isVisible=!0,$()&&(S.style.visibility="visible"),H(),J(),x.state.isMounted||(S.style.transition="none"),$()){var Ge=j(),bt=Ge.box,qt=Ge.content;rp([bt,qt],0)}f=function(){var It;if(!(!x.state.isVisible||c)){if(c=!0,S.offsetHeight,S.style.transition=x.props.moveTransition,$()&&x.props.animation){var ve=j(),Ke=ve.box,Ee=ve.content;rp([Ke,Ee],ke),oE([Ke,Ee],"visible")}V(),ie(),nE(sp,x),(It=x.popperInstance)==null||It.forceUpdate(),_("onMount",[x]),x.props.animation&&$()&&Z(ke,function(){x.state.isShown=!0,_("onShown",[x])})}},At()}}function On(){process.env.NODE_ENV!=="production"&&oo(x.state.isDestroyed,di("hide"));var I=!x.state.isVisible,X=x.state.isDestroyed,ae=!x.state.isEnabled,Ie=np(x.props.duration,1,Dn.duration);if(!(I||X||ae)&&(_("onHide",[x],!1),x.props.onHide(x)!==!1)){if(x.state.isVisible=!1,x.state.isShown=!1,c=!1,i=!1,$()&&(S.style.visibility="hidden"),te(),me(),H(!0),$()){var ke=j(),Ge=ke.box,bt=ke.content;x.props.animation&&(rp([Ge,bt],Ie),oE([Ge,bt],"hidden"))}V(),ie(),x.props.animation?$()&&z(Ie,x.unmount):x.unmount()}}function Tr(I){process.env.NODE_ENV!=="production"&&oo(x.state.isDestroyed,di("hideWithInteractivity")),U().addEventListener("mousemove",p),nE(Ic,p),p(I)}function rn(){process.env.NODE_ENV!=="production"&&oo(x.state.isDestroyed,di("unmount")),x.state.isVisible&&x.hide(),x.state.isMounted&&(vt(),Ft().forEach(function(I){I._tippy.unmount()}),S.parentNode&&S.parentNode.removeChild(S),sp=sp.filter(function(I){return I!==x}),x.state.isMounted=!1,_("onHidden",[x]))}function or(){process.env.NODE_ENV!=="production"&&oo(x.state.isDestroyed,di("destroy")),!x.state.isDestroyed&&(x.clearDelayTimeouts(),x.unmount(),Se(),delete t._tippy,x.state.isDestroyed=!0,_("onDestroy",[x]))}}function Zl(t,e){e===void 0&&(e={});var n=Dn.plugins.concat(e.plugins||[]);process.env.NODE_ENV!=="production"&&(mJ(t),rR(e,n)),uJ();var r=Object.assign({},e,{plugins:n}),o=sJ(t);if(process.env.NODE_ENV!=="production"){var s=ml(r.content),i=o.length>1;oo(s&&i,["tippy() was passed an Element as the `content` prop, but more than","one tippy instance was created by this invocation. This means the","content element will only be appended to the last tippy instance.",`
|
|
575
|
+
|
|
576
|
+
`,"Instead, pass the .innerHTML of the element, or use a function that","returns a cloned version of the element instead.",`
|
|
577
|
+
|
|
578
|
+
`,`1) content: element.innerHTML
|
|
579
|
+
`,"2) content: () => element.cloneNode(true)"].join(" "))}var a=o.reduce(function(l,c){var u=c&&EJ(c,r);return u&&l.push(u),l},[]);return ml(t)?a[0]:a}Zl.defaultProps=Dn;Zl.setDefaultProps=vJ;Zl.currentInput=Ir;Object.assign({},FO,{effect:function(e){var n=e.state,r={popper:{position:n.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(n.elements.popper.style,r.popper),n.styles=r,n.elements.arrow&&Object.assign(n.elements.arrow.style,r.arrow)}});Zl.setDefaultProps({render:oR});function SJ({editor:t,overrideSuggestionOptions:e,extensionName:n,char:r="@"}){return{editor:t,char:r,pluginKey:new We,command:({editor:o,range:s,props:i})=>{const c=o.getText()?.replace(b3," ")?.trim()?.lastIndexOf(r);console.log({matchStartPosition:c}),o.view.state.selection.$to.nodeAfter?.text?.startsWith(" ")&&(s.to+=1),o.chain().focus().insertContentAt(s,[{type:n,attrs:{...i,mentionSuggestionChar:r,matchStartPosition:c}},{type:"text",text:" "}]).run(),o.view.dom.ownerDocument.defaultView?.getSelection()?.collapseToEnd()},allow:({state:o,range:s})=>{const i=o.doc.resolve(s.from),a=o.schema.nodes[n];return!!i.parent.type.contentMatch.matchType(a)},...e}}function sR(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>SJ({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function dE(t,e){const n=sR(t),r=n.find(o=>o.char===e);return r||(n.length?n[0]:null)}const kJ=_t.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:t,suggestion:e}){return`${e?.char??"@"}${t.attrs.label??t.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e,suggestion:n}){return["span",Be(this.HTMLAttributes,t.HTMLAttributes),`${n?.char??"@"}${e.attrs.label??e.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id"),renderHTML:t=>t.id?{"data-id":t.id}:{}},label:{default:null,parseHTML:t=>t.getAttribute("data-label"),renderHTML:t=>t.label?{"data-label":t.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:t=>t.getAttribute("data-mention-suggestion-char"),renderHTML:t=>({"data-mention-suggestion-char":t.mentionSuggestionChar})},avatar:{default:null,parseHTML:()=>null,renderHTML:()=>({})},inThisThread:{default:1,parseHTML:()=>null,renderHTML:()=>({})},name:{default:null,parseHTML:()=>null,renderHTML:()=>({})},selectId:{default:null,parseHTML:()=>null,renderHTML:()=>({})},type:{default:null,parseHTML:()=>null,renderHTML:()=>({})},from:{default:lu.Post,parseHTML:()=>null,renderHTML:()=>({})},isCrossExposureEnable:{default:null,parseHTML:()=>null,renderHTML:()=>({})},matchStartPosition:{default:-1,parseHTML:()=>null,renderHTML:()=>({})}}},parseHTML(){return[{tag:'span[data-type="mention"]'},{tag:'a[data-type="mention"]'}]},renderHTML({node:t,HTMLAttributes:e}){const n=dE(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",Be({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const r={...this.options},o=this.editor?.isFocused;r.HTMLAttributes=Be({"data-type":this.name},this.options.HTMLAttributes,e);const s=this.options.renderHTML({options:r,node:t,suggestion:n,isFocused:o});return typeof s=="string"?["span",Be({"data-type":this.name},this.options.HTMLAttributes,e),s]:s},renderText({node:t}){const e={options:this.options,node:t,suggestion:dE(this,t.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(e)):this.options.renderText(e)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:r}=e,{empty:o,anchor:s}=r;if(!o)return!1;let i=new io,a=0;return e.doc.nodesBetween(s-1,s,(l,c)=>{if(l.type.name===this.name)return n=!0,i=l,a=c,!1}),n&&t.insertText(this.options.deleteTriggerWithBackspace?"":i.attrs.mentionSuggestionChar,a,a+i.nodeSize),n})}},addProseMirrorPlugins(){return sR(this).map(z7)}});var ba={exports:{}},fE;function TJ(){if(fE)return ba.exports;fE=1;var t={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",Ấ:"A",Ắ:"A",Ẳ:"A",Ẵ:"A",Ặ:"A",Æ:"AE",Ầ:"A",Ằ:"A",Ȃ:"A",Ả:"A",Ạ:"A",Ẩ:"A",Ẫ:"A",Ậ:"A",Ç:"C",Ḉ:"C",È:"E",É:"E",Ê:"E",Ë:"E",Ế:"E",Ḗ:"E",Ề:"E",Ḕ:"E",Ḝ:"E",Ȇ:"E",Ẻ:"E",Ẽ:"E",Ẹ:"E",Ể:"E",Ễ:"E",Ệ:"E",Ì:"I",Í:"I",Î:"I",Ï:"I",Ḯ:"I",Ȋ:"I",Ỉ:"I",Ị:"I",Ð:"D",Ñ:"N",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",Ố:"O",Ṍ:"O",Ṓ:"O",Ȏ:"O",Ỏ:"O",Ọ:"O",Ổ:"O",Ỗ:"O",Ộ:"O",Ờ:"O",Ở:"O",Ỡ:"O",Ớ:"O",Ợ:"O",Ù:"U",Ú:"U",Û:"U",Ü:"U",Ủ:"U",Ụ:"U",Ử:"U",Ữ:"U",Ự:"U",Ý:"Y",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",ấ:"a",ắ:"a",ẳ:"a",ẵ:"a",ặ:"a",æ:"ae",ầ:"a",ằ:"a",ȃ:"a",ả:"a",ạ:"a",ẩ:"a",ẫ:"a",ậ:"a",ç:"c",ḉ:"c",è:"e",é:"e",ê:"e",ë:"e",ế:"e",ḗ:"e",ề:"e",ḕ:"e",ḝ:"e",ȇ:"e",ẻ:"e",ẽ:"e",ẹ:"e",ể:"e",ễ:"e",ệ:"e",ì:"i",í:"i",î:"i",ï:"i",ḯ:"i",ȋ:"i",ỉ:"i",ị:"i",ð:"d",ñ:"n",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",ố:"o",ṍ:"o",ṓ:"o",ȏ:"o",ỏ:"o",ọ:"o",ổ:"o",ỗ:"o",ộ:"o",ờ:"o",ở:"o",ỡ:"o",ớ:"o",ợ:"o",ù:"u",ú:"u",û:"u",ü:"u",ủ:"u",ụ:"u",ử:"u",ữ:"u",ự:"u",ý:"y",ÿ:"y",Ā:"A",ā:"a",Ă:"A",ă:"a",Ą:"A",ą:"a",Ć:"C",ć:"c",Ĉ:"C",ĉ:"c",Ċ:"C",ċ:"c",Č:"C",č:"c",C̆:"C",c̆:"c",Ď:"D",ď:"d",Đ:"D",đ:"d",Ē:"E",ē:"e",Ĕ:"E",ĕ:"e",Ė:"E",ė:"e",Ę:"E",ę:"e",Ě:"E",ě:"e",Ĝ:"G",Ǵ:"G",ĝ:"g",ǵ:"g",Ğ:"G",ğ:"g",Ġ:"G",ġ:"g",Ģ:"G",ģ:"g",Ĥ:"H",ĥ:"h",Ħ:"H",ħ:"h",Ḫ:"H",ḫ:"h",Ĩ:"I",ĩ:"i",Ī:"I",ī:"i",Ĭ:"I",ĭ:"i",Į:"I",į:"i",İ:"I",ı:"i",IJ:"IJ",ij:"ij",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",Ḱ:"K",ḱ:"k",K̆:"K",k̆:"k",Ĺ:"L",ĺ:"l",Ļ:"L",ļ:"l",Ľ:"L",ľ:"l",Ŀ:"L",ŀ:"l",Ł:"l",ł:"l",Ḿ:"M",ḿ:"m",M̆:"M",m̆:"m",Ń:"N",ń:"n",Ņ:"N",ņ:"n",Ň:"N",ň:"n",ʼn:"n",N̆:"N",n̆:"n",Ō:"O",ō:"o",Ŏ:"O",ŏ:"o",Ő:"O",ő:"o",Œ:"OE",œ:"oe",P̆:"P",p̆:"p",Ŕ:"R",ŕ:"r",Ŗ:"R",ŗ:"r",Ř:"R",ř:"r",R̆:"R",r̆:"r",Ȓ:"R",ȓ:"r",Ś:"S",ś:"s",Ŝ:"S",ŝ:"s",Ş:"S",Ș:"S",ș:"s",ş:"s",Š:"S",š:"s",Ţ:"T",ţ:"t",ț:"t",Ț:"T",Ť:"T",ť:"t",Ŧ:"T",ŧ:"t",T̆:"T",t̆:"t",Ũ:"U",ũ:"u",Ū:"U",ū:"u",Ŭ:"U",ŭ:"u",Ů:"U",ů:"u",Ű:"U",ű:"u",Ų:"U",ų:"u",Ȗ:"U",ȗ:"u",V̆:"V",v̆:"v",Ŵ:"W",ŵ:"w",Ẃ:"W",ẃ:"w",X̆:"X",x̆:"x",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Y̆:"Y",y̆:"y",Ź:"Z",ź:"z",Ż:"Z",ż:"z",Ž:"Z",ž:"z",ſ:"s",ƒ:"f",Ơ:"O",ơ:"o",Ư:"U",ư:"u",Ǎ:"A",ǎ:"a",Ǐ:"I",ǐ:"i",Ǒ:"O",ǒ:"o",Ǔ:"U",ǔ:"u",Ǖ:"U",ǖ:"u",Ǘ:"U",ǘ:"u",Ǚ:"U",ǚ:"u",Ǜ:"U",ǜ:"u",Ứ:"U",ứ:"u",Ṹ:"U",ṹ:"u",Ǻ:"A",ǻ:"a",Ǽ:"AE",ǽ:"ae",Ǿ:"O",ǿ:"o",Þ:"TH",þ:"th",Ṕ:"P",ṕ:"p",Ṥ:"S",ṥ:"s",X́:"X",x́:"x",Ѓ:"Г",ѓ:"г",Ќ:"К",ќ:"к",A̋:"A",a̋:"a",E̋:"E",e̋:"e",I̋:"I",i̋:"i",Ǹ:"N",ǹ:"n",Ồ:"O",ồ:"o",Ṑ:"O",ṑ:"o",Ừ:"U",ừ:"u",Ẁ:"W",ẁ:"w",Ỳ:"Y",ỳ:"y",Ȁ:"A",ȁ:"a",Ȅ:"E",ȅ:"e",Ȉ:"I",ȉ:"i",Ȍ:"O",ȍ:"o",Ȑ:"R",ȑ:"r",Ȕ:"U",ȕ:"u",B̌:"B",b̌:"b",Č̣:"C",č̣:"c",Ê̌:"E",ê̌:"e",F̌:"F",f̌:"f",Ǧ:"G",ǧ:"g",Ȟ:"H",ȟ:"h",J̌:"J",ǰ:"j",Ǩ:"K",ǩ:"k",M̌:"M",m̌:"m",P̌:"P",p̌:"p",Q̌:"Q",q̌:"q",Ř̩:"R",ř̩:"r",Ṧ:"S",ṧ:"s",V̌:"V",v̌:"v",W̌:"W",w̌:"w",X̌:"X",x̌:"x",Y̌:"Y",y̌:"y",A̧:"A",a̧:"a",B̧:"B",b̧:"b",Ḑ:"D",ḑ:"d",Ȩ:"E",ȩ:"e",Ɛ̧:"E",ɛ̧:"e",Ḩ:"H",ḩ:"h",I̧:"I",i̧:"i",Ɨ̧:"I",ɨ̧:"i",M̧:"M",m̧:"m",O̧:"O",o̧:"o",Q̧:"Q",q̧:"q",U̧:"U",u̧:"u",X̧:"X",x̧:"x",Z̧:"Z",z̧:"z",й:"и",Й:"И",ё:"е",Ё:"Е"},e=Object.keys(t).join("|"),n=new RegExp(e,"g"),r=new RegExp(e,"");function o(a){return t[a]}var s=function(a){return a.replace(n,o)},i=function(a){return!!a.match(r)};return ba.exports=s,ba.exports.has=i,ba.exports.remove=s,ba.exports}var CJ=TJ();const AJ=fg(CJ);/**
|
|
580
|
+
* @name match-sorter
|
|
581
|
+
* @license MIT license.
|
|
582
|
+
* @copyright (c) 2020 Kent C. Dodds
|
|
583
|
+
* @author Kent C. Dodds <me@kentcdodds.com> (https://kentcdodds.com)
|
|
584
|
+
*/const sn={CASE_SENSITIVE_EQUAL:7,EQUAL:6,STARTS_WITH:5,WORD_STARTS_WITH:4,CONTAINS:3,ACRONYM:2,MATCHES:1,NO_MATCH:0},MJ=(t,e)=>String(t.rankedValue).localeCompare(String(e.rankedValue));function jm(t,e,n={}){const{keys:r,threshold:o=sn.MATCHES,baseSort:s=MJ,sorter:i=c=>c.sort((u,d)=>DJ(u,d,s))}=n,a=t.reduce(l,[]);return i(a).map(({item:c})=>c);function l(c,u,d){const f=OJ(u,r,e,n),{rank:h,keyThreshold:p=o}=f;return h>=p&&c.push({...f,item:u,index:d}),c}}jm.rankings=sn;function OJ(t,e,n,r){if(!e){const s=t;return{rankedValue:s,rank:hE(s,n,r),keyIndex:-1,keyThreshold:r.threshold}}return LJ(t,e).reduce(({rank:s,rankedValue:i,keyIndex:a,keyThreshold:l},{itemValue:c,attributes:u},d)=>{let f=hE(c,n,r),h=i;const{minRanking:p,maxRanking:m,threshold:y}=u;return f<p&&f>=sn.MATCHES?f=p:f>m&&(f=m),f>s&&(s=f,a=d,l=y,h=c),{rankedValue:h,rank:s,keyIndex:a,keyThreshold:l}},{rankedValue:t,rank:sn.NO_MATCH,keyIndex:-1,keyThreshold:r.threshold})}function*RJ(t,e){let n=-1;for(;(n=t.indexOf(e,n+1))>-1;)yield n;return-1}function hE(t,e,n){if(t=pE(t,n),e=pE(e,n),e.length>t.length)return sn.NO_MATCH;if(t===e)return sn.CASE_SENSITIVE_EQUAL;t=t.toLowerCase(),e=e.toLowerCase();const r=RJ(t,e),o=r.next(),s=o.value;if(t.length===e.length&&s===0)return sn.EQUAL;if(s===0)return sn.STARTS_WITH;let i=o;for(;!i.done;){if(i.value>0&&t[i.value-1]===" ")return sn.WORD_STARTS_WITH;i=r.next()}return s>0?sn.CONTAINS:e.length===1?sn.NO_MATCH:NJ(t).includes(e)?sn.ACRONYM:_J(t,e)}function NJ(t){let e="",n=" ";for(let r=0;r<t.length;r++){const o=t.charAt(r);(n===" "||n==="-")&&!(o===" "||o==="-")&&(e+=o),n=o}return e}function _J(t,e){let n=0,r=0;function o(l,c,u){for(let d=u,f=c.length;d<f;d++)if(c[d]===l)return n+=1,d+1;return-1}function s(l){const c=1/l,u=n/e.length;return sn.MATCHES+u*c}const i=o(e[0],t,0);if(i<0)return sn.NO_MATCH;r=i;for(let l=1,c=e.length;l<c;l++){const u=e[l];if(r=o(u,t,r),!(r>-1))return sn.NO_MATCH}const a=r-i;return s(a)}function DJ(t,e,n){const{rank:s,keyIndex:i}=t,{rank:a,keyIndex:l}=e;return s===a?i===l?n(t,e):i<l?-1:1:s>a?-1:1}function pE(t,{keepDiacritics:e}){return t=`${t}`,e||(t=AJ(t)),t}function IJ(t,e){typeof e=="object"&&(e=e.key);let n;if(typeof e=="function")n=e(t);else if(t==null)n=null;else if(Object.hasOwnProperty.call(t,e))n=t[e];else{if(e.includes("."))return PJ(e,t);n=null}return n==null?[]:Array.isArray(n)?n:[String(n)]}function PJ(t,e){const n=t.split(".");let r=[e];for(let o=0,s=n.length;o<s;o++){const i=n[o];let a=[];for(let l=0,c=r.length;l<c;l++){const u=r[l];if(u!=null)if(Object.hasOwnProperty.call(u,i)){const d=u[i];d!=null&&a.push(d)}else i==="*"&&(a=a.concat(u))}r=a}return Array.isArray(r[0])?[].concat(...r):r}function LJ(t,e){const n=[];for(let r=0,o=e.length;r<o;r++){const s=e[r],i=jJ(s),a=IJ(t,s);for(let l=0,c=a.length;l<c;l++)n.push({itemValue:a[l],attributes:i})}return n}const mE={maxRanking:1/0,minRanking:-1/0};function jJ(t){return typeof t=="string"?mE:{...mE,...t}}const iR=M.forwardRef((t,e)=>{const[n,r]=M.useState(0),o=M.useRef([]),s=M.useMemo(()=>t.query?jm(t.items,t.query,{keys:["label","email"],threshold:jm.rankings.CONTAINS}):t.items,[t.items,t.query]),i=d=>{const f=s[d];f&&t.command({...f,id:f?.id,label:f?.label})},a=()=>{r(d=>(d+s.length-1)%s.length)},l=()=>{r(d=>(d+1)%s.length)},c=()=>{i(n)};M.useEffect(()=>{r(0)},[s]),M.useEffect(()=>{const d=o.current[n];d&&d.scrollIntoView({block:"nearest",behavior:"instant"})},[n]),M.useImperativeHandle(e,()=>({onKeyDown:d=>d.key==="ArrowUp"?(a(),!0):d.key==="ArrowDown"?(l(),!0):d.key==="Enter"&&s.length>0?(c(),!0):!1}));const u=t.char==="@";return g.jsxs("div",{className:"w-80 rounded-lg border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 shadow-lg overflow-hidden",children:[g.jsx("div",{className:"px-3 py-2 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-900/50",children:g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("svg",{className:"h-4 w-4 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),g.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-300",children:t.query?g.jsxs(g.Fragment,{children:["Searching for: ",g.jsx("span",{className:"font-medium",children:t.query})]}):`Search ${u?"users":"hashtags"}...`})]})}),g.jsxs("div",{className:"px-3 py-1.5 text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider bg-gray-50 dark:bg-gray-900/50",children:[u?"Users":"Hashtags"," (",s.length,")"]}),g.jsx("ul",{className:"max-h-64 overflow-y-auto",children:s.length===0?g.jsx("div",{className:"p-4 text-center text-sm text-gray-500 dark:text-gray-400",children:t.query?`No ${u?"users":"hashtags"} found for "${t.query}"`:`No ${u?"users":"hashtags"} found`}):g.jsx("div",{className:"p-1",children:s.map((d,f)=>g.jsx("li",{ref:h=>{o.current[f]=h},onClick:()=>i(f),className:`flex items-center gap-3 px-3 py-2.5 cursor-pointer rounded-md transition-colors ${n===f?"bg-blue-50 dark:bg-blue-900/20":"hover:bg-gray-50 dark:hover:bg-gray-700/50"}`,children:u?g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"h-9 w-9 flex-shrink-0 rounded-full bg-gradient-to-br from-blue-400 to-blue-600 flex items-center justify-center",children:d.avatar?g.jsx("img",{src:d.avatar,alt:d.label,className:"h-9 w-9 rounded-full object-cover"}):g.jsx("span",{className:"text-white font-medium text-sm",children:d.label?.charAt(0).toUpperCase()})}),g.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[g.jsx("span",{className:"font-medium text-sm text-gray-900 dark:text-gray-100 truncate",children:d.label}),d.email&&g.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:d.email})]})]}):g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"flex h-9 w-9 flex-shrink-0 items-center justify-center rounded-md bg-gradient-to-br from-purple-400 to-purple-600",children:g.jsx("svg",{className:"h-5 w-5 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 20l4-16m2 16l4-16M6 9h14M4 15h14"})})}),g.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[g.jsxs("span",{className:"font-medium text-sm text-gray-900 dark:text-gray-100 truncate",children:["#",d.label]}),d.count!==void 0&&g.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[d.count.toLocaleString()," posts"]})]})]})},d.id))})}),g.jsx("div",{className:"px-3 py-2 border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-900/50",children:g.jsxs("div",{className:"flex items-center gap-3 text-xs text-gray-500 dark:text-gray-400",children:[g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsx("kbd",{className:"px-1.5 py-0.5 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded text-xs",children:"↑↓"}),g.jsx("span",{children:"Navigate"})]}),g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsx("kbd",{className:"px-1.5 py-0.5 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded text-xs",children:"↵"}),g.jsx("span",{children:"Select"})]}),g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsx("kbd",{className:"px-1.5 py-0.5 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded text-xs",children:"Esc"}),g.jsx("span",{children:"Close"})]})]})})]})});iR.displayName="MentionList";const $J=()=>typeof window<"u"&&window.ReactNativeWebView!==void 0,BJ=(t,e,n)=>({fetchMentions:async()=>{const s=n.getState().getMentionParams();if(!s)return console.error("DEBUG MENTION SERVICE::","No group id or post id has been provided"),[];const{groupId:i,postId:a}=s;return console.log({groupId:i,postId:a}),(a?await e.getRecommendationPost(i,a,0,999):await e.getRecommendationGroup(i,0,999)).entries?.filter(c=>!!c?.user_data)?.map(c=>({id:c?.user_data?.id,label:c?.user_data?.name,avatar:c?.user_data?.avatar,inThisThread:1,name:c?.user_data?.name,selectId:c.user_data?.username,type:Ep.User,from:lu.Post}))},fetchHashtags:async()=>{const{selectedGroupId:s,groupId:i}=n.getState(),a=s??i;return a?(await t.fetchGroupConversations(999,0)).entries.filter(c=>c?.group_id!==a).map(c=>({id:c?.group_id,label:c?.group?.name,avatar:c?.group?.avatar,inThisThread:1,name:c?.group?.name,selectId:c?.group?.select_id,type:Ep.Group,from:lu.Post,isCrossExposureEnable:c?.group?.allow_cross_exposure})):(console.warn("DEBUG HASHTAG SERVICE::","No active group selected or provided"),[])}});function gE(t,e){return{char:t,items:async()=>await e(),render:()=>{let n,r;return{onStart:o=>{n=new ny(iR,{props:{...o,char:t},editor:o.editor}),o.clientRect&&(r=Zl("body",{getReferenceClientRect:o.clientRect,appendTo:()=>document.body,theme:"select-post-builder",content:n.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start"}))},onUpdate(o){n.updateProps({...o,char:t}),o.clientRect&&r[0].setProps({getReferenceClientRect:o.clientRect})},onKeyDown(o){return o.event.key==="Escape"?(r[0].hide(),!0):n?.ref?.onKeyDown(o.event)??!1},onExit(){r[0].destroy(),n.destroy()}}}}}const FJ=(t,e,n)=>{const r=BJ(t,e,n);return kJ.configure({HTMLAttributes:{class:"inline-block px-1.5 py-0.5 rounded font-medium no-underline cursor-pointer transition-all duration-200"},renderText({node:o,suggestion:s}){return`${s?.char??"@"}${o.attrs.label??o.attrs.id}`},renderHTML({node:o,suggestion:s,isFocused:i}){const a=s?.char??"@",l=o.attrs.label??o.attrs.id,c=o.attrs.id,u=$J(),f={"data-type":"mention","data-id":c,"data-label":l,"data-mention-suggestion-char":a,class:a==="@"?"inline-block px-1.5 py-0.5 rounded font-medium cursor-pointer transition-all duration-200 bg-blue-100 text-blue-700 hover:bg-blue-200 dark:bg-blue-900/30 dark:text-blue-300 dark:hover:bg-blue-900/50":"inline-block px-1.5 py-0.5 rounded font-medium cursor-pointer transition-all duration-200 bg-purple-100 text-purple-700 hover:bg-purple-200 dark:bg-purple-900/30 dark:text-purple-300 dark:hover:bg-purple-900/50"};if(u){const p=a==="@"?`window.ReactNativeWebView.postMessage(JSON.stringify({type: 'mention', userId: '${c}'}))`:`window.ReactNativeWebView.postMessage(JSON.stringify({type: 'hashtag', groupId: '${c}'}))`;return["span",{...f,onclick:p},`${a}${l}`]}const h=a==="@"?`/user/${c}`:`/hashtag/${c}`;return["a",{...f,...i?{}:{href:h,target:"_blank"},"data-mention-link":"true"},`${a}${l}`]},suggestions:[gE("@",r.fetchMentions),gE("#",r.fetchHashtags)]})};function HJ({className:t,...e}){return g.jsx("div",{"data-slot":"skeleton",className:re("bg-accent animate-pulse rounded-md",t),...e})}const UJ=({selected:t,href:e,title:n,description:r,image:o,domain:s,onClickDelete:i})=>{const a=b.useMemo(()=>{try{return s||new URL(e).hostname}catch{return"unknown"}},[e,s]),l=c=>{c.preventDefault(),c.stopPropagation(),i()};return g.jsxs("div",{className:re("not-prose relative w-full group my-4",t?"ring-2 ring-blue-500 ring-offset-2 rounded-lg":""),children:[g.jsxs("div",{className:"flex items-center gap-2 absolute z-50 right-2 top-1",children:[g.jsx(be,{asChild:!0,tooltip:"Visit Link",children:g.jsxs("span",{className:"relative",children:[g.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"absolute inset-0"}),g.jsx(sl,{})]})}),g.jsx(be,{tooltip:"Remove Link Preview",onClick:l,"aria-label":"Delete link preview",type:"button",size:"icon",className:"cursor-pointer size-6 shadow-none bg-transparent group-hover:bg-destructive/5 hover:bg-destructive/10 text-destructive hover:text-destructive",children:g.jsx(by,{})})]}),g.jsx("div",{className:"relative z-0 w-full",children:g.jsxs("div",{className:"group flex items-center gap-3 rounded-lg border bg-accent/30 p-3 transition-all hover:border-foreground/20 hover:shadow-sm",children:[g.jsx("div",{className:"relative h-16 w-16 flex-shrink-0 overflow-hidden rounded-md bg-muted",children:g.jsx("img",{src:o,alt:n,className:"size-16 object-cover transition-transform group-hover:scale-105"})}),g.jsxs("div",{className:"min-w-0 flex-1",children:[g.jsx("h3",{className:"truncate text-sm font-semibold leading-tight text-foreground",children:n}),g.jsx("p",{className:"line-clamp-1 text-xs text-muted-foreground",children:r}),g.jsxs("div",{className:"mt-1 flex items-center gap-1 text-xs text-muted-foreground",children:[g.jsx("span",{className:"truncate",children:a}),g.jsx(sl,{className:"h-3 w-3 flex-shrink-0 opacity-50"})]})]})]})})]})},zJ=({selected:t,href:e,title:n,description:r,image:o,domain:s,onClickDelete:i})=>{const a=b.useMemo(()=>{try{return s||new URL(e).hostname}catch{return"unknown"}},[e,s]),l=c=>{c.preventDefault(),c.stopPropagation(),i()};return g.jsxs("div",{className:re("not-prose relative w-full group mt-4",t?"ring-2 ring-blue-500 ring-offset-2 rounded-lg":""),children:[g.jsxs("div",{className:"flex items-center gap-2 absolute z-50 right-3 top-3",children:[g.jsx(be,{asChild:!0,tooltip:"Visit Link",className:"cursor-pointer backdrop-blur-2xl size-6 shadow-none group-hover:bg-accent/70 group-hover:text-accent-foreground text-primary-send",children:g.jsxs("span",{className:"relative",children:[g.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"absolute inset-0"}),g.jsx(sl,{})]})}),g.jsx(be,{tooltip:"Remove Link Preview",onClick:l,"aria-label":"Delete link preview",type:"button",size:"icon",className:"cursor-pointer backdrop-blur-2xl size-6 shadow-none bg-transparent group-hover:bg-red-50/70 hover:bg-red-50 text-destructive hover:text-destructive",children:g.jsx(by,{})})]}),g.jsx("div",{className:"relative z-0 w-full",children:g.jsxs("div",{className:"group overflow-hidden flex flex-col rounded-lg border bg-accent/30 transition-all hover:border-foreground/20 hover:shadow-sm",children:[g.jsx("div",{className:"relative h-80 w-full flex-shrink-0 overflow-hidden bg-muted border-b",children:g.jsx("img",{src:o,alt:n,className:"size-full object-cover transition-transform group-hover:scale-105"})}),g.jsxs("div",{className:"min-w-0 flex-1 p-3",children:[g.jsxs("div",{className:"mt-1 flex items-center gap-1 text-xs text-muted-foreground",children:[g.jsx("span",{className:"truncate",children:a}),g.jsx(sl,{className:"h-3 w-3 flex-shrink-0 opacity-50"})]}),g.jsx("h3",{className:"mt-1 mb-2 truncate text-lg font-semibold leading-tight text-foreground",children:n}),g.jsx("p",{className:"line-clamp-2 text-sm text-muted-foreground",children:r})]})]})})]})},VJ=({node:t,deleteNode:e,selected:n})=>{const{loading:r,href:o,domain:s,variant:i}=t.attrs,a=b.useMemo(()=>{try{return s||new URL(o).hostname}catch{return"unknown"}},[o,s]);return r?g.jsx(Qo,{children:g.jsx(HJ,{className:"w-full h-24 flex items-center justify-center rounded-lg",children:g.jsx("span",{className:"text-sm text-muted-foreground",children:"Fetching Link Metadata..."})})}):o?g.jsx(Qo,{contentEditable:!1,"data-drag-handle":!0,children:i===Id.Compact?g.jsx(UJ,{...t.attrs,selected:n,domain:a,onClickDelete:e}):g.jsx(zJ,{...t.attrs,selected:n,domain:a,onClickDelete:e})}):null},aR=_t.create({name:"linkPreview",group:"block",atom:!0,addOptions(){return{variant:Id.Compact,selectable:!0,draggable:!0}},draggable(){return this?.options?.draggable??!0},selectable(){return this?.options?.selectable??!0},addAttributes(){return{variant:{default:this.options.variant},uid:{default:null},href:{default:null},title:{default:null},description:{default:null},image:{default:null},domain:{default:null},loading:{default:!1}}},parseHTML(){return[{tag:"div[data-link-preview]",getAttrs:t=>{if(typeof t=="string")return!1;const e=t,n=e.querySelector("a");return{href:e.getAttribute("data-href")||n?.getAttribute("href")||"",uid:e.getAttribute("data-uid")||null,title:e.getAttribute("data-title")||null,description:e.getAttribute("data-description")||null,image:e.getAttribute("data-image")||null,domain:e.getAttribute("data-domain")||null}}}]},renderHTML({node:t}){const{href:e,uid:n,title:r,description:o,image:s,domain:i}=t.attrs;if(console.log("INSIDE RENDER HTML::",{href:e,image:s}),!e)return["div",{}];const a=[["a",{href:e,target:"_blank",rel:"noopener noreferrer",class:"absolute inset-0 z-30","aria-label":r||e}],["div",{class:"relative z-20 flex items-center gap-3 w-full"},...s?[["div",{class:"relative h-16 w-16 flex-shrink-0 overflow-hidden rounded-md bg-muted"},["img",{src:s,alt:r||"",class:"h-full w-full object-cover transition-transform group-hover:scale-105"}]]]:[],["div",{class:"min-w-0 flex-1"},...r?[["h3",{class:"truncate text-sm font-semibold leading-tight text-foreground"},r]]:[],...o?[["p",{class:"line-clamp-1 text-xs text-muted-foreground"},o]]:[],...i?[["div",{class:"mt-1 flex items-center gap-1 text-xs text-muted-foreground"},["span",{class:"truncate"},i]]]:[]]]];return["div",{"data-link-preview":"","data-href":e,"data-uid":n||"","data-title":r||"","data-description":o||"","data-image":s||"","data-domain":i||"",class:"not-prose my-4 relative group flex items-center gap-3 rounded-lg border bg-card p-3 transition-all hover:border-foreground/20 hover:shadow-sm"},...a]},addNodeView(){return Bl(VJ)},addCommands(){return{setLinkPreview:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t}),updateLinkPreviewByUid:fO(this.name),deleteLinkPreviewByUid:dO(this.name),updateLinkPreview:t=>({commands:e})=>e.updateAttributes(this.name,t)}},addKeyboardShortcuts(){return{"Mod-Shift-k":()=>this.editor.commands.setLinkPreview({href:"",title:null,description:null,image:null,domain:null}),Backspace:()=>{const{selection:t}=this.editor.state,{$anchor:e}=t;return e.parent.type.name===this.name&&e.parentOffset===0?this.editor.commands.deleteNode(this.name):!1}}}}),yv=Qe.create({name:"customEnterHardBreak",addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.setHardBreak()}}}),WJ=({node:t,editor:e})=>{const n=o=>{e.commands.deleteMediaByUid(o)},r=t?.content?.content||[];return console.log("MediaGroupView render:",{contentSize:t?.content?.size,mediaCount:r?.length,nodes:r?.map(o=>({type:o?.type?.name,uid:o?.attrs?.uid}))}),r.length===0?g.jsxs(Qo,{className:"media-group-wrapper",children:[g.jsx("div",{className:"flex flex-wrap gap-2 p-8 bg-muted/30 rounded-lg border border-dashed border-border mt-4",children:g.jsx("p",{className:"text-sm text-muted-foreground w-full text-center",children:"No media added yet"})}),g.jsx("div",{className:"hidden",children:g.jsx($0,{})})]}):g.jsx(Qo,{className:"not-prose media-group-wrapper select-none leading-none mt-12",contentEditable:!1,children:g.jsxs("div",{className:"flex flex-wrap gap-2 leading-none mt-auto",children:[r.map((o,s)=>{const i=o?.attrs?.uploading,a=o?.attrs?.progress||0;return g.jsxs("div",{className:"relative group leading-none",children:[g.jsx(Zn,{size:"icon",onClick:()=>n(o.attrs.uid),className:"absolute size-6 top-1 right-1 z-10 p-1.5 bg-red-50 hover:bg-red-100 text-destructive rounded-full shadow-lg transition-all opacity-100 group-hover:scale-110",title:"Delete media",children:g.jsx(Wl,{className:"w-3.5 h-3.5"})}),i?g.jsxs("div",{className:"size-20 bg-muted rounded-lg border border-border flex items-center justify-center relative overflow-hidden",children:[g.jsxs("div",{className:"text-center space-y-2",children:[o.attrs.type===xe.Image&&g.jsx(vy,{className:"w-8 h-8 text-muted-foreground/50 mx-auto"}),o.attrs.type===xe.Video&&g.jsx(xy,{className:"w-8 h-8 text-muted-foreground/50 mx-auto"}),o.attrs.type===xe.Audio&&g.jsx(Ru,{className:"w-8 h-8 text-muted-foreground/50 mx-auto"}),g.jsxs("p",{className:"text-xs text-muted-foreground",children:[Math.round(a),"%"]})]}),g.jsx("div",{className:"absolute bottom-0 left-0 right-0 p-2",children:g.jsx(cO,{value:a,className:"h-1"})})]}):g.jsxs(g.Fragment,{children:[o.attrs.type===xe.Image&&g.jsx("img",{src:o.attrs.src,alt:o.attrs.caption||"",className:"size-20 object-cover rounded-lg border border-border"}),o.attrs.type===xe.Video&&g.jsx("video",{src:o.attrs.src,className:"size-20 object-cover rounded-lg border border-border"}),o.attrs.type===xe.Audio&&g.jsx("div",{className:"size-20 flex items-center justify-center bg-accent rounded-lg border border-border",children:g.jsx(Ru,{className:"w-8 h-8 text-muted-foreground"})})]}),o.attrs.caption&&!i&&g.jsx("p",{className:"text-xs text-muted-foreground text-center mt-1 truncate w-32",children:o.attrs.caption})]},o?.attrs?.uid||s)}),g.jsx("div",{className:"hidden",children:g.jsx($0,{})})]})})},GJ=new We("mediaMode"),qJ=()=>{let t=!1;return new Ue({key:GJ,appendTransaction(e,n,r){if(t||!e.some(s=>s.docChanged)||e.some(s=>s.getMeta("mediaMode-plugin"))||e.some(s=>s.getMeta("addToHistory")===!1))return null;try{t=!0;const s=r.tr;let i=!1;const a=[];if(r.doc.forEach((u,d)=>{u.type.name==="media"&&a.push({node:u,pos:d,size:u.nodeSize})}),a.length===0)return r.doc.forEach((u,d)=>{u.type.name==="mediaGroup"&&u.content.size===0&&(s.delete(d,d+u.nodeSize),i=!0)}),i&&(s.setMeta("addToHistory",!1),s.setMeta("mediaMode-plugin",!0)),i?s:null;let l=null,c=null;if(r.doc.forEach((u,d)=>{u.type.name==="mediaGroup"&&(l=d,c=u)}),l!==null&&c){const u=c.content.size;[...a].sort((v,w)=>w.pos-v.pos).forEach(({pos:v,size:w})=>{s.delete(v,v+w)});const h=a.filter(v=>v.pos<l).reduce((v,w)=>v+w.size,0),m=l-h+1+u;let y=0;a.forEach(({node:v})=>{s.insert(m+y,v),y+=v.nodeSize}),i=!0}else{if(!r.schema.nodes.mediaGroup)return null;const u=a.map(h=>h.node);if(u.some(h=>!h||h.type.name!=="media"))return console.warn("Invalid media nodes detected, skipping group creation"),null;const d=r.schema.nodes.mediaGroup.create({},u);[...a].sort((h,p)=>p.pos-h.pos).forEach(({pos:h,size:p})=>{s.delete(h,h+p)}),s.insert(s.doc.content.size,d),i=!0}if(i){const u=s.doc.content.size;if(u>=0&&u<=s.doc.content.size)try{const d=s.doc.resolve(u);s.setSelection(pe.near(d))}catch(d){console.warn("Could not set selection:",d)}s.setMeta("addToHistory",!1),s.setMeta("mediaMode-plugin",!0)}return i?s:null}catch(s){return console.error("MediaMode plugin error:",s),null}finally{t=!1}}})},KJ=_t.create({name:"mediaGroup",group:"block",content:"media*",atom:!1,selectable:!1,draggable:!1,addOptions(){return{mediaMode:!1}},parseHTML(){return[{tag:"div[data-media-group]"}]},renderHTML({HTMLAttributes:t}){return["div",Be(t,{"data-media-group":""}),0]},addNodeView(){return Bl(WJ)},addProseMirrorPlugins(){return this.options.mediaMode?[qJ()]:[]}}),YJ={class:"bg-muted text-foreground border border-border font-mono leading-snug rounded px-0.5 py-px after:content-none before:content-none"},JJ={class:"bg-muted text-foreground border border-border font-mono leading-snug rounded"},vv=t=>z9.extend({content:t}),XJ=vv("paragraph poll"),QJ=vv("paragraph media? mediaGroup?"),ZJ=vv("paragraph linkPreview?"),eX=({includeLink:t=!1,includeDocument:e=!0})=>({...e?{}:{document:!1},...t?{}:{link:!1},code:{HTMLAttributes:YJ},codeBlock:{HTMLAttributes:JJ}}),Af=t=>rK.configure({placeholder:t,showOnlyWhenEditable:!0}),Mf=(t,e,n)=>FJ(t,e,n),tX=({editorType:t,api:e,store:n,user:r})=>{const s={[gt.Text]:nX,[gt.Media]:oX,[gt.Link]:sX,[gt.Poll]:rX}[t];return s?s({api:e,store:n,user:r}):[]},nX=({api:t,store:e,user:n})=>{const{core:r,mfs:o,fileStore:s}=t;return[aK.configure(eX({includeLink:!1})),Af(`What's on your mind, ${n?.name?n?.name:""}`),dK,hK,cK.configure({types:["heading","paragraph","media"],alignments:[tt.LEFT,tt.CENTER,tt.RIGHT],defaultAlignment:tt.LEFT}),hO,gO,D7,AO.configure({openOnClick:!1,linkOnPaste:!1,api:r}),aR,Mf(r,o,e),jO.configure({api:s}),PO.configure({api:r})]},rX=({api:t,store:e})=>{const{core:n,mfs:r}=t;return[XJ,nv,rv,ev,Vy,Af("Ask a Question"),yv,gO,Mf(n,r,e)]},oX=({api:t,store:e,user:n})=>{const{core:r,mfs:o,fileStore:s}=t;return[QJ,nv,rv,ev,Vy,Af(`What's on your mind, ${n?.name?n?.name:""}`),yv,hO.configure({attrs:{mediaMode:!0}}),KJ.configure({mediaMode:!0}),Mf(r,o,e),jO.configure({api:s})]},sX=({api:t,store:e,user:n})=>{const{core:r,mfs:o}=t;return[ZJ,nv,rv,Vy,Af(`What's on your mind, ${n?.name?n?.name:""}`),yv,AO.configure({openOnClick:!1,linkOnPaste:!1,api:r,linkMode:!0}),aR.configure({variant:Id.Extended,selectable:!1,draggable:!1}),PO.configure({api:r,autoEmbed:!1,autoLinkSelection:!1}),Mf(r,o,e)]},iX=()=>({attributes:{class:re("max-w-full prose prose-sm sm:prose-base px-4 py-2 prose-img:my-3 prose-figcaption:text-xs prose-code:text-sm prose-codeblock:text-sm prose-a:text-blue-500 focus:outline-none")}}),aX=t=>({undo:()=>t?.chain().focus().undo().run(),redo:()=>t?.chain().focus().redo().run(),toggleHeading:e=>t?.chain().focus().toggleHeading({level:e}).run(),setParagraph:()=>t?.chain().focus().setParagraph().run(),toggleBold:()=>t?.chain().focus().toggleBold().run(),toggleItalic:()=>t?.chain().focus().toggleItalic().run(),toggleStrikethrough:()=>t?.chain().focus().toggleStrike().run(),toggleUnderline:()=>t?.chain().focus().toggleUnderline().run(),insertLink:e=>t?.chain().focus().setLink({href:e}).run(),toggleBulletList:()=>t?.chain().focus().toggleBulletList().run(),toggleOrderedList:()=>t?.chain().focus().toggleOrderedList().run(),toggleCode:()=>t?.chain().focus().toggleCode().run(),toggleCodeBlock:()=>t?.chain().focus().toggleCodeBlock().run(),toggleTextAlign:e=>t?.chain().focus().setTextAlign(e).run(),insertPoll:()=>t?.chain().focus().insertContent({type:"poll"}).run(),insertMedia:(e,n)=>{t?.chain()?.focus()?.insertContent([{type:"media",attrs:{src:e,type:n}},{type:"paragraph"}])?.run()}}),lX=t=>{t.chain().focus().insertContent({type:"paragraph"}).insertContent({type:"poll"}).command(({tr:e})=>{const{doc:n}=e;let r=-1;if(n.descendants((o,s)=>{if(o.type.name==="paragraph"&&r===-1)return r=s,!1}),r>=0){const o=n.nodeAt(r);if(o){const s=r+o.nodeSize-1,i=e.doc.resolve(s);e.setSelection(pe.near(i))}}return!0}).run()},cX=({editorType:t,groupId:e,postId:n,user:r})=>{const[,o]=M.useState(0),s=Dl(),i=M.useMemo(()=>O9({groupId:e,postId:n}),[e,n]),{getTabContent:a}=ry();M.useEffect(()=>{o(u=>u+1)},[]);const l=jF({extensions:tX({editorType:t,api:s,store:i,user:r}),content:"",editorProps:iX(),onCreate:({editor:u})=>{i.getState().setEditor(u),t===gt.Poll&&lX(u)},immediatelyRender:!1},[t]);M.useEffect(()=>{const u=a(t);u&&l?.isEditable&&l.commands.setContent(u)},[l,t,a]);const c=aX(l);return{editor:l,actions:c,store:i}},fr=()=>new Map,$m=t=>{const e=fr();return t.forEach((n,r)=>{e.set(r,n)}),e},ko=(t,e,n)=>{let r=t.get(e);return r===void 0&&t.set(e,r=n()),r},uX=(t,e)=>{const n=[];for(const[r,o]of t)n.push(e(o,r));return n},dX=(t,e)=>{for(const[n,r]of t)if(e(r,n))return!0;return!1},Us=()=>new Set,ip=t=>t[t.length-1],fX=(t,e)=>{for(let n=0;n<e.length;n++)t.push(e[n])},zs=Array.from,hX=(t,e)=>{for(let n=0;n<t.length;n++)if(e(t[n],n,t))return!0;return!1},Bm=Array.isArray;class lR{constructor(){this._observers=fr()}on(e,n){return ko(this._observers,e,Us).add(n),n}once(e,n){const r=(...o)=>{this.off(e,r),n(...o)};this.on(e,r)}off(e,n){const r=this._observers.get(e);r!==void 0&&(r.delete(n),r.size===0&&this._observers.delete(e))}emit(e,n){return zs((this._observers.get(e)||fr()).values()).forEach(r=>r(...n))}destroy(){this._observers=fr()}}const bo=Math.floor,tu=Math.abs,Ui=(t,e)=>t<e?t:e,ns=(t,e)=>t>e?t:e,cR=t=>t!==0?t<0:1/t<0,yE=1,vE=2,ap=4,lp=8,yl=32,co=64,an=128,pX=1<<29,Of=31,Fm=63,Ns=127,mX=2147483647,uR=Number.MAX_SAFE_INTEGER,gX=Number.isInteger||(t=>typeof t=="number"&&isFinite(t)&&bo(t)===t),yX=String.fromCharCode,vX=t=>t.toLowerCase(),bX=/^\s*/g,xX=t=>t.replace(bX,""),wX=/([A-Z])/g,bE=(t,e)=>xX(t.replace(wX,n=>`${e}${vX(n)}`)),EX=t=>{const e=unescape(encodeURIComponent(t)),n=e.length,r=new Uint8Array(n);for(let o=0;o<n;o++)r[o]=e.codePointAt(o);return r},vl=typeof TextEncoder<"u"?new TextEncoder:null,SX=t=>vl.encode(t),kX=vl?SX:EX;let Va=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Va&&Va.decode(new Uint8Array).length===1&&(Va=null);class ec{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const tc=()=>new ec,TX=t=>{const e=tc();return t(e),dr(e)},CX=t=>{let e=t.cpos;for(let n=0;n<t.bufs.length;n++)e+=t.bufs[n].length;return e},dr=t=>{const e=new Uint8Array(CX(t));let n=0;for(let r=0;r<t.bufs.length;r++){const o=t.bufs[r];e.set(o,n),n+=o.length}return e.set(new Uint8Array(t.cbuf.buffer,0,t.cpos),n),e},AX=(t,e)=>{const n=t.cbuf.length;n-t.cpos<e&&(t.bufs.push(new Uint8Array(t.cbuf.buffer,0,t.cpos)),t.cbuf=new Uint8Array(ns(n,e)*2),t.cpos=0)},Pt=(t,e)=>{const n=t.cbuf.length;t.cpos===n&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(n*2),t.cpos=0),t.cbuf[t.cpos++]=e},Hm=Pt,$e=(t,e)=>{for(;e>Ns;)Pt(t,an|Ns&e),e=bo(e/128);Pt(t,Ns&e)},bv=(t,e)=>{const n=cR(e);for(n&&(e=-e),Pt(t,(e>Fm?an:0)|(n?co:0)|Fm&e),e=bo(e/64);e>0;)Pt(t,(e>Ns?an:0)|Ns&e),e=bo(e/128)},Um=new Uint8Array(3e4),MX=Um.length/3,OX=(t,e)=>{if(e.length<MX){const n=vl.encodeInto(e,Um).written||0;$e(t,n);for(let r=0;r<n;r++)Pt(t,Um[r])}else Rn(t,kX(e))},RX=(t,e)=>{const n=unescape(encodeURIComponent(e)),r=n.length;$e(t,r);for(let o=0;o<r;o++)Pt(t,n.codePointAt(o))},Si=vl&&vl.encodeInto?OX:RX,Rf=(t,e)=>{const n=t.cbuf.length,r=t.cpos,o=Ui(n-r,e.length),s=e.length-o;t.cbuf.set(e.subarray(0,o),r),t.cpos+=o,s>0&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(ns(n*2,s)),t.cbuf.set(e.subarray(o)),t.cpos=s)},Rn=(t,e)=>{$e(t,e.byteLength),Rf(t,e)},xv=(t,e)=>{AX(t,e);const n=new DataView(t.cbuf.buffer,t.cpos,e);return t.cpos+=e,n},NX=(t,e)=>xv(t,4).setFloat32(0,e,!1),_X=(t,e)=>xv(t,8).setFloat64(0,e,!1),DX=(t,e)=>xv(t,8).setBigInt64(0,e,!1),xE=new DataView(new ArrayBuffer(4)),IX=t=>(xE.setFloat32(0,t),xE.getFloat32(0)===t),zi=(t,e)=>{switch(typeof e){case"string":Pt(t,119),Si(t,e);break;case"number":gX(e)&&tu(e)<=mX?(Pt(t,125),bv(t,e)):IX(e)?(Pt(t,124),NX(t,e)):(Pt(t,123),_X(t,e));break;case"bigint":Pt(t,122),DX(t,e);break;case"object":if(e===null)Pt(t,126);else if(Bm(e)){Pt(t,117),$e(t,e.length);for(let n=0;n<e.length;n++)zi(t,e[n])}else if(e instanceof Uint8Array)Pt(t,116),Rn(t,e);else{Pt(t,118);const n=Object.keys(e);$e(t,n.length);for(let r=0;r<n.length;r++){const o=n[r];Si(t,o),zi(t,e[o])}}break;case"boolean":Pt(t,e?120:121);break;default:Pt(t,127)}};class wE extends ec{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&$e(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}}const EE=t=>{t.count>0&&(bv(t.encoder,t.count===1?t.s:-t.s),t.count>1&&$e(t.encoder,t.count-2))};class nu{constructor(){this.encoder=new ec,this.s=0,this.count=0}write(e){this.s===e?this.count++:(EE(this),this.count=1,this.s=e)}toUint8Array(){return EE(this),dr(this.encoder)}}const SE=t=>{if(t.count>0){const e=t.diff*2+(t.count===1?0:1);bv(t.encoder,e),t.count>1&&$e(t.encoder,t.count-2)}};class cp{constructor(){this.encoder=new ec,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(SE(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return SE(this),dr(this.encoder)}}class PX{constructor(){this.sarr=[],this.s="",this.lensE=new nu}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(e.length)}toUint8Array(){const e=new ec;return this.sarr.push(this.s),this.s="",Si(e,this.sarr.join("")),Rf(e,this.lensE.toUint8Array()),dr(e)}}const rs=t=>new Error(t),hr=()=>{throw rs("Method unimplemented")},Mn=()=>{throw rs("Unexpected case")},dR=rs("Unexpected end of array"),fR=rs("Integer out of Range");class Nf{constructor(e){this.arr=e,this.pos=0}}const wv=t=>new Nf(t),LX=t=>t.pos!==t.arr.length,jX=(t,e)=>{const n=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,n},Vn=t=>jX(t,st(t)),bl=t=>t.arr[t.pos++],st=t=>{let e=0,n=1;const r=t.arr.length;for(;t.pos<r;){const o=t.arr[t.pos++];if(e=e+(o&Ns)*n,n*=128,o<an)return e;if(e>uR)throw fR}throw dR},Ev=t=>{let e=t.arr[t.pos++],n=e&Fm,r=64;const o=(e&co)>0?-1:1;if((e&an)===0)return o*n;const s=t.arr.length;for(;t.pos<s;){if(e=t.arr[t.pos++],n=n+(e&Ns)*r,r*=128,e<an)return o*n;if(n>uR)throw fR}throw dR},$X=t=>{let e=st(t);if(e===0)return"";{let n=String.fromCodePoint(bl(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(bl(t));else for(;e>0;){const r=e<1e4?e:1e4,o=t.arr.subarray(t.pos,t.pos+r);t.pos+=r,n+=String.fromCodePoint.apply(null,o),e-=r}return decodeURIComponent(escape(n))}},BX=t=>Va.decode(Vn(t)),zm=Va?BX:$X,Sv=(t,e)=>{const n=new DataView(t.arr.buffer,t.arr.byteOffset+t.pos,e);return t.pos+=e,n},FX=t=>Sv(t,4).getFloat32(0,!1),HX=t=>Sv(t,8).getFloat64(0,!1),UX=t=>Sv(t,8).getBigInt64(0,!1),zX=[t=>{},t=>null,Ev,FX,HX,UX,t=>!1,t=>!0,zm,t=>{const e=st(t),n={};for(let r=0;r<e;r++){const o=zm(t);n[o]=gd(t)}return n},t=>{const e=st(t),n=[];for(let r=0;r<e;r++)n.push(gd(t));return n},Vn],gd=t=>zX[127-bl(t)](t);class kE extends Nf{constructor(e,n){super(e),this.reader=n,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),LX(this)?this.count=st(this)+1:this.count=-1),this.count--,this.s}}class ru extends Nf{constructor(e){super(e),this.s=0,this.count=0}read(){if(this.count===0){this.s=Ev(this);const e=cR(this.s);this.count=1,e&&(this.s=-this.s,this.count=st(this)+2)}return this.count--,this.s}}class up extends Nf{constructor(e){super(e),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){const e=Ev(this),n=e&1;this.diff=bo(e/2),this.count=1,n&&(this.count=st(this)+2)}return this.s+=this.diff,this.count--,this.s}}class VX{constructor(e){this.decoder=new ru(e),this.str=zm(this.decoder),this.spos=0}read(){const e=this.spos+this.decoder.read(),n=this.str.slice(this.spos,e);return this.spos=e,n}}const WX=crypto.getRandomValues.bind(crypto),GX=Math.random,hR=()=>WX(new Uint32Array(1))[0],qX=t=>t[bo(GX()*t.length)],KX="10000000-1000-4000-8000"+-1e11,YX=()=>KX.replace(/[018]/g,t=>(t^hR()&15>>t/4).toString(16)),JX=Date.now,TE=t=>new Promise(t);Promise.all.bind(Promise);const CE=t=>t===void 0?null:t;class XX{constructor(){this.map=new Map}setItem(e,n){this.map.set(e,n)}getItem(e){return this.map.get(e)}}let pR=new XX,QX=!0;try{typeof localStorage<"u"&&localStorage&&(pR=localStorage,QX=!1)}catch{}const ZX=pR,eQ=Object.assign,mR=Object.keys,tQ=(t,e)=>{for(const n in t)e(t[n],n)},AE=t=>mR(t).length,nQ=t=>{for(const e in t)return!1;return!0},gR=(t,e)=>{for(const n in t)if(!e(t[n],n))return!1;return!0},rQ=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),oQ=(t,e)=>t===e||AE(t)===AE(e)&&gR(t,(n,r)=>(n!==void 0||rQ(e,r))&&e[r]===n),sQ=Object.freeze,yR=t=>{for(const e in t){const n=t[e];(typeof n=="object"||typeof n=="function")&&yR(t[e])}return sQ(t)},kv=(t,e,n=0)=>{try{for(;n<t.length;n++)t[n](...e)}finally{n<t.length&&kv(t,e,n+1)}},iQ=(t,e)=>e.includes(t),Vi=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",vR=typeof window<"u"&&typeof document<"u"&&!Vi;let Rr;const aQ=()=>{if(Rr===void 0)if(Vi){Rr=fr();const t=process.argv;let e=null;for(let n=0;n<t.length;n++){const r=t[n];r[0]==="-"?(e!==null&&Rr.set(e,""),e=r):e!==null&&(Rr.set(e,r),e=null)}e!==null&&Rr.set(e,"")}else typeof location=="object"?(Rr=fr(),(location.search||"?").slice(1).split("&").forEach(t=>{if(t.length!==0){const[e,n]=t.split("=");Rr.set(`--${bE(e,"-")}`,n),Rr.set(`-${bE(e,"-")}`,n)}})):Rr=fr();return Rr},Vm=t=>aQ().has(t),yd=t=>CE(Vi?process.env[t.toUpperCase().replaceAll("-","_")]:ZX.getItem(t)),bR=t=>Vm("--"+t)||yd(t)!==null;bR("production");const lQ=Vi&&iQ(process.env.FORCE_COLOR,["true","1","2"]),cQ=lQ||!Vm("--no-colors")&&!bR("no-color")&&(!Vi||process.stdout.isTTY)&&(!Vi||Vm("--color")||yd("COLORTERM")!==null||(yd("TERM")||"").includes("color")),uQ=t=>{let e="";for(let n=0;n<t.byteLength;n++)e+=yX(t[n]);return btoa(e)},dQ=t=>Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("base64"),fQ=vR?uQ:dQ,hQ=t=>TX(e=>zi(e,t));class pQ{constructor(e,n){this.left=e,this.right=n}}const Zr=(t,e)=>new pQ(t,e),mQ=typeof document<"u"?document:{};typeof DOMParser<"u"&&new DOMParser;const gQ=t=>uX(t,(e,n)=>`${n}:${e};`).join(""),yQ=t=>class{constructor(n){this._=n}destroy(){t(this._)}},vQ=yQ(clearTimeout),xR=(t,e)=>new vQ(setTimeout(e,t)),To=Symbol,wR=To(),ER=To(),bQ=To(),xQ=To(),wQ=To(),SR=To(),EQ=To(),Tv=To(),SQ=To(),kQ=t=>{t.length===1&&t[0]?.constructor===Function&&(t=t[0]());const e=[],n=[];let r=0;for(;r<t.length;r++){const o=t[r];if(o===void 0)break;if(o.constructor===String||o.constructor===Number)e.push(o);else if(o.constructor===Object)break}for(r>0&&n.push(e.join(""));r<t.length;r++){const o=t[r];o instanceof Symbol||n.push(o)}return n},TQ={[wR]:Zr("font-weight","bold"),[ER]:Zr("font-weight","normal"),[bQ]:Zr("color","blue"),[wQ]:Zr("color","green"),[xQ]:Zr("color","grey"),[SR]:Zr("color","red"),[EQ]:Zr("color","purple"),[Tv]:Zr("color","orange"),[SQ]:Zr("color","black")},CQ=t=>{t.length===1&&t[0]?.constructor===Function&&(t=t[0]());const e=[],n=[],r=fr();let o=[],s=0;for(;s<t.length;s++){const i=t[s],a=TQ[i];if(a!==void 0)r.set(a.left,a.right);else{if(i===void 0)break;if(i.constructor===String||i.constructor===Number){const l=gQ(r);s>0||l.length>0?(e.push("%c"+i),n.push(l)):e.push(i)}else break}}for(s>0&&(o=n,o.unshift(e.join("")));s<t.length;s++){const i=t[s];i instanceof Symbol||o.push(i)}return o},kR=cQ?CQ:kQ,AQ=(...t)=>{console.log(...kR(t)),CR.forEach(e=>e.print(t))},TR=(...t)=>{console.warn(...kR(t)),t.unshift(Tv),CR.forEach(e=>e.print(t))},CR=Us(),AR=t=>({[Symbol.iterator](){return this},next:t}),MQ=(t,e)=>AR(()=>{let n;do n=t.next();while(!n.done&&!e(n.value));return n}),dp=(t,e)=>AR(()=>{const{done:n,value:r}=t.next();return{done:n,value:n?void 0:e(r)}});class Cv{constructor(e,n){this.clock=e,this.len=n}}class ra{constructor(){this.clients=new Map}}const ss=(t,e,n)=>e.clients.forEach((r,o)=>{const s=t.doc.store.clients.get(o);if(s!=null){const i=s[s.length-1],a=i.id.clock+i.length;for(let l=0,c=r[l];l<r.length&&c.clock<a;c=r[++l])PR(t,s,c.clock,c.len,n)}}),OQ=(t,e)=>{let n=0,r=t.length-1;for(;n<=r;){const o=bo((n+r)/2),s=t[o],i=s.clock;if(i<=e){if(e<i+s.len)return o;n=o+1}else r=o-1}return null},oa=(t,e)=>{const n=t.clients.get(e.client);return n!==void 0&&OQ(n,e.clock)!==null},Av=t=>{t.clients.forEach(e=>{e.sort((o,s)=>o.clock-s.clock);let n,r;for(n=1,r=1;n<e.length;n++){const o=e[r-1],s=e[n];o.clock+o.len>=s.clock?o.len=ns(o.len,s.clock+s.len-o.clock):(r<n&&(e[r]=s),r++)}e.length=r})},Wm=t=>{const e=new ra;for(let n=0;n<t.length;n++)t[n].clients.forEach((r,o)=>{if(!e.clients.has(o)){const s=r.slice();for(let i=n+1;i<t.length;i++)fX(s,t[i].clients.get(o)||[]);e.clients.set(o,s)}});return Av(e),e},xl=(t,e,n,r)=>{ko(t.clients,e,()=>[]).push(new Cv(n,r))},MR=()=>new ra,RQ=t=>{const e=MR();return t.clients.forEach((n,r)=>{const o=[];for(let s=0;s<n.length;s++){const i=n[s];if(i.deleted){const a=i.id.clock;let l=i.length;if(s+1<n.length)for(let c=n[s+1];s+1<n.length&&c.deleted;c=n[++s+1])l+=c.length;o.push(new Cv(a,l))}}o.length>0&&e.clients.set(r,o)}),e},Mv=(t,e)=>{$e(t.restEncoder,e.clients.size),zs(e.clients.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{t.resetDsCurVal(),$e(t.restEncoder,n);const o=r.length;$e(t.restEncoder,o);for(let s=0;s<o;s++){const i=r[s];t.writeDsClock(i.clock),t.writeDsLen(i.len)}})},NQ=t=>{const e=new ra,n=st(t.restDecoder);for(let r=0;r<n;r++){t.resetDsCurVal();const o=st(t.restDecoder),s=st(t.restDecoder);if(s>0){const i=ko(e.clients,o,()=>[]);for(let a=0;a<s;a++)i.push(new Cv(t.readDsClock(),t.readDsLen()))}}return e},ME=(t,e,n)=>{const r=new ra,o=st(t.restDecoder);for(let s=0;s<o;s++){t.resetDsCurVal();const i=st(t.restDecoder),a=st(t.restDecoder),l=n.clients.get(i)||[],c=xt(n,i);for(let u=0;u<a;u++){const d=t.readDsClock(),f=d+t.readDsLen();if(d<c){c<f&&xl(r,i,c,f-c);let h=vr(l,d),p=l[h];for(!p.deleted&&p.id.clock<d&&(l.splice(h+1,0,kd(e,p,d-p.id.clock)),h++);h<l.length&&(p=l[h++],p.id.clock<f);)p.deleted||(f<p.id.clock+p.length&&l.splice(h,0,kd(e,p,f-p.id.clock)),p.delete(e))}else xl(r,i,d,f-d)}}if(r.clients.size>0){const s=new _f;return $e(s.restEncoder,0),Mv(s,r),s.toUint8Array()}return null},OR=hR;class ei extends lR{constructor({guid:e=YX(),collectionid:n=null,gc:r=!0,gcFilter:o=()=>!0,meta:s=null,autoLoad:i=!1,shouldLoad:a=!0}={}){super(),this.gc=r,this.gcFilter=o,this.clientID=OR(),this.guid=e,this.collectionid=n,this.share=new Map,this.store=new DR,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=a,this.autoLoad=i,this.meta=s,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=TE(c=>{this.on("load",()=>{this.isLoaded=!0,c(this)})});const l=()=>TE(c=>{const u=d=>{(d===void 0||d===!0)&&(this.off("sync",u),c())};this.on("sync",u)});this.on("sync",c=>{c===!1&&this.isSynced&&(this.whenSynced=l()),this.isSynced=c===void 0||c===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=l()}load(){const e=this._item;e!==null&&!this.shouldLoad&&Je(e.parent.doc,n=>{n.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(zs(this.subdocs).map(e=>e.guid))}transact(e,n=null){return Je(this,e,n)}get(e,n=Bt){const r=ko(this.share,e,()=>{const s=new n;return s._integrate(this,null),s}),o=r.constructor;if(n!==Bt&&o!==n)if(o===Bt){const s=new n;s._map=r._map,r._map.forEach(i=>{for(;i!==null;i=i.left)i.parent=s}),s._start=r._start;for(let i=s._start;i!==null;i=i.right)i.parent=s;return s._length=r._length,this.share.set(e,s),s._integrate(this,null),s}else throw new Error(`Type with the name ${e} has already been defined with a different constructor`);return r}getArray(e=""){return this.get(e,Ci)}getText(e=""){return this.get(e,is)}getMap(e=""){return this.get(e,Wi)}getXmlElement(e=""){return this.get(e,Qt)}getXmlFragment(e=""){return this.get(e,Vs)}toJSON(){const e={};return this.share.forEach((n,r)=>{e[r]=n.toJSON()}),e}destroy(){this.isDestroyed=!0,zs(this.subdocs).forEach(n=>n.destroy());const e=this._item;if(e!==null){this._item=null;const n=e.content;n.doc=new ei({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=e,Je(e.parent.doc,r=>{const o=n.doc;e.deleted||r.subdocsAdded.add(o),r.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}}class _Q{constructor(e){this.dsCurrVal=0,this.restDecoder=e}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=st(this.restDecoder),this.dsCurrVal}readDsLen(){const e=st(this.restDecoder)+1;return this.dsCurrVal+=e,e}}class vd extends _Q{constructor(e){super(e),this.keys=[],st(e),this.keyClockDecoder=new up(Vn(e)),this.clientDecoder=new ru(Vn(e)),this.leftClockDecoder=new up(Vn(e)),this.rightClockDecoder=new up(Vn(e)),this.infoDecoder=new kE(Vn(e),bl),this.stringDecoder=new VX(Vn(e)),this.parentInfoDecoder=new kE(Vn(e),bl),this.typeRefDecoder=new ru(Vn(e)),this.lenDecoder=new ru(Vn(e))}readLeftID(){return new ki(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new ki(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return this.parentInfoDecoder.read()===1}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return gd(this.restDecoder)}readBuf(){return Vn(this.restDecoder)}readJSON(){return gd(this.restDecoder)}readKey(){const e=this.keyClockDecoder.read();if(e<this.keys.length)return this.keys[e];{const n=this.stringDecoder.read();return this.keys.push(n),n}}}class DQ{constructor(){this.restEncoder=tc()}toUint8Array(){return dr(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){$e(this.restEncoder,e)}writeDsLen(e){$e(this.restEncoder,e)}}class IQ extends DQ{writeLeftID(e){$e(this.restEncoder,e.client),$e(this.restEncoder,e.clock)}writeRightID(e){$e(this.restEncoder,e.client),$e(this.restEncoder,e.clock)}writeClient(e){$e(this.restEncoder,e)}writeInfo(e){Hm(this.restEncoder,e)}writeString(e){Si(this.restEncoder,e)}writeParentInfo(e){$e(this.restEncoder,e?1:0)}writeTypeRef(e){$e(this.restEncoder,e)}writeLen(e){$e(this.restEncoder,e)}writeAny(e){zi(this.restEncoder,e)}writeBuf(e){Rn(this.restEncoder,e)}writeJSON(e){Si(this.restEncoder,JSON.stringify(e))}writeKey(e){Si(this.restEncoder,e)}}class PQ{constructor(){this.restEncoder=tc(),this.dsCurrVal=0}toUint8Array(){return dr(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){const n=e-this.dsCurrVal;this.dsCurrVal=e,$e(this.restEncoder,n)}writeDsLen(e){e===0&&Mn(),$e(this.restEncoder,e-1),this.dsCurrVal+=e}}class _f extends PQ{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new cp,this.clientEncoder=new nu,this.leftClockEncoder=new cp,this.rightClockEncoder=new cp,this.infoEncoder=new wE(Hm),this.stringEncoder=new PX,this.parentInfoEncoder=new wE(Hm),this.typeRefEncoder=new nu,this.lenEncoder=new nu}toUint8Array(){const e=tc();return $e(e,0),Rn(e,this.keyClockEncoder.toUint8Array()),Rn(e,this.clientEncoder.toUint8Array()),Rn(e,this.leftClockEncoder.toUint8Array()),Rn(e,this.rightClockEncoder.toUint8Array()),Rn(e,dr(this.infoEncoder)),Rn(e,this.stringEncoder.toUint8Array()),Rn(e,dr(this.parentInfoEncoder)),Rn(e,this.typeRefEncoder.toUint8Array()),Rn(e,this.lenEncoder.toUint8Array()),Rf(e,dr(this.restEncoder)),dr(e)}writeLeftID(e){this.clientEncoder.write(e.client),this.leftClockEncoder.write(e.clock)}writeRightID(e){this.clientEncoder.write(e.client),this.rightClockEncoder.write(e.clock)}writeClient(e){this.clientEncoder.write(e)}writeInfo(e){this.infoEncoder.write(e)}writeString(e){this.stringEncoder.write(e)}writeParentInfo(e){this.parentInfoEncoder.write(e?1:0)}writeTypeRef(e){this.typeRefEncoder.write(e)}writeLen(e){this.lenEncoder.write(e)}writeAny(e){zi(this.restEncoder,e)}writeBuf(e){Rn(this.restEncoder,e)}writeJSON(e){zi(this.restEncoder,e)}writeKey(e){const n=this.keyMap.get(e);n===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e)):this.keyClockEncoder.write(n)}}const LQ=(t,e,n,r)=>{r=ns(r,e[0].id.clock);const o=vr(e,r);$e(t.restEncoder,e.length-o),t.writeClient(n),$e(t.restEncoder,r);const s=e[o];s.write(t,r-s.id.clock);for(let i=o+1;i<e.length;i++)e[i].write(t,0)},RR=(t,e,n)=>{const r=new Map;n.forEach((o,s)=>{xt(e,s)>o&&r.set(s,o)}),Df(e).forEach((o,s)=>{n.has(s)||r.set(s,0)}),$e(t.restEncoder,r.size),zs(r.entries()).sort((o,s)=>s[0]-o[0]).forEach(([o,s])=>{LQ(t,e.clients.get(o),o,s)})},jQ=(t,e)=>{const n=fr(),r=st(t.restDecoder);for(let o=0;o<r;o++){const s=st(t.restDecoder),i=new Array(s),a=t.readClient();let l=st(t.restDecoder);n.set(a,{i:0,refs:i});for(let c=0;c<s;c++){const u=t.readInfo();switch(Of&u){case 0:{const d=t.readLen();i[c]=new qn(De(a,l),d),l+=d;break}case 10:{const d=st(t.restDecoder);i[c]=new cr(De(a,l),d),l+=d;break}default:{const d=(u&(co|an))===0,f=new nt(De(a,l),null,(u&an)===an?t.readLeftID():null,null,(u&co)===co?t.readRightID():null,d?t.readParentInfo()?e.get(t.readString()):t.readLeftID():null,d&&(u&yl)===yl?t.readString():null,rN(t,u));i[c]=f,l+=f.length}}}}return n},$Q=(t,e,n)=>{const r=[];let o=zs(n.keys()).sort((h,p)=>h-p);if(o.length===0)return null;const s=()=>{if(o.length===0)return null;let h=n.get(o[o.length-1]);for(;h.refs.length===h.i;)if(o.pop(),o.length>0)h=n.get(o[o.length-1]);else return null;return h};let i=s();if(i===null)return null;const a=new DR,l=new Map,c=(h,p)=>{const m=l.get(h);(m==null||m>p)&&l.set(h,p)};let u=i.refs[i.i++];const d=new Map,f=()=>{for(const h of r){const p=h.id.client,m=n.get(p);m?(m.i--,a.clients.set(p,m.refs.slice(m.i)),n.delete(p),m.i=0,m.refs=[]):a.clients.set(p,[h]),o=o.filter(y=>y!==p)}r.length=0};for(;;){if(u.constructor!==cr){const p=ko(d,u.id.client,()=>xt(e,u.id.client))-u.id.clock;if(p<0)r.push(u),c(u.id.client,u.id.clock-1),f();else{const m=u.getMissing(t,e);if(m!==null){r.push(u);const y=n.get(m)||{refs:[],i:0};if(y.refs.length===y.i)c(m,xt(e,m)),f();else{u=y.refs[y.i++];continue}}else(p===0||p<u.length)&&(u.integrate(t,p),d.set(u.id.client,u.id.clock+u.length))}}if(r.length>0)u=r.pop();else if(i!==null&&i.i<i.refs.length)u=i.refs[i.i++];else{if(i=s(),i===null)break;u=i.refs[i.i++]}}if(a.clients.size>0){const h=new _f;return RR(h,a,new Map),$e(h.restEncoder,0),{missing:l,update:h.toUint8Array()}}return null},BQ=(t,e)=>RR(t,e.doc.store,e.beforeState),FQ=(t,e,n,r=new vd(t))=>Je(e,o=>{o.local=!1;let s=!1;const i=o.doc,a=i.store,l=jQ(r,i),c=$Q(o,a,l),u=a.pendingStructs;if(u){for(const[f,h]of u.missing)if(h<xt(a,f)){s=!0;break}if(c){for(const[f,h]of c.missing){const p=u.missing.get(f);(p==null||p>h)&&u.missing.set(f,h)}u.update=jE([u.update,c.update])}}else a.pendingStructs=c;const d=ME(r,o,a);if(a.pendingDs){const f=new vd(wv(a.pendingDs));st(f.restDecoder);const h=ME(f,o,a);d&&h?a.pendingDs=jE([d,h]):a.pendingDs=d||h}else a.pendingDs=d;if(s){const f=a.pendingStructs.update;a.pendingStructs=null,Gm(o.doc,f)}},n,!1),Gm=(t,e,n,r=vd)=>{const o=wv(e);FQ(o,t,n,new r(o))};class HQ{constructor(){this.l=[]}}const OE=()=>new HQ,RE=(t,e)=>t.l.push(e),NE=(t,e)=>{const n=t.l,r=n.length;t.l=n.filter(o=>e!==o),r===t.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},NR=(t,e,n)=>kv(t.l,[e,n]);class ki{constructor(e,n){this.client=e,this.clock=n}}const Pc=(t,e)=>t===e||t!==null&&e!==null&&t.client===e.client&&t.clock===e.clock,De=(t,e)=>new ki(t,e),wl=t=>{for(const[e,n]of t.doc.share.entries())if(n===t)return e;throw Mn()},El=(t,e)=>{for(;e!==null;){if(e.parent===t)return!0;e=e.parent._item}return!1};class bd{constructor(e,n,r,o=0){this.type=e,this.tname=n,this.item=r,this.assoc=o}}class UQ{constructor(e,n,r=0){this.type=e,this.index=n,this.assoc=r}}const zQ=(t,e,n=0)=>new UQ(t,e,n),Lc=(t,e,n)=>{let r=null,o=null;return t._item===null?o=wl(t):r=De(t._item.id.client,t._item.id.clock),new bd(r,o,e,n)},fp=(t,e,n=0)=>{let r=t._start;if(n<0){if(e===0)return Lc(t,null,n);e--}for(;r!==null;){if(!r.deleted&&r.countable){if(r.length>e)return Lc(t,De(r.id.client,r.id.clock+e),n);e-=r.length}if(r.right===null&&n<0)return Lc(t,r.lastId,n);r=r.right}return Lc(t,null,n)},VQ=(t,e)=>{const n=Ti(t,e),r=e.clock-n.id.clock;return{item:n,diff:r}},WQ=(t,e,n=!0)=>{const r=e.store,o=t.item,s=t.type,i=t.tname,a=t.assoc;let l=null,c=0;if(o!==null){if(xt(r,o.client)<=o.clock)return null;const u=n?Jm(r,o):VQ(r,o),d=u.item;if(!(d instanceof nt))return null;if(l=d.parent,l._item===null||!l._item.deleted){c=d.deleted||!d.countable?0:u.diff+(a>=0?0:1);let f=d.left;for(;f!==null;)!f.deleted&&f.countable&&(c+=f.length),f=f.left}}else{if(i!==null)l=e.get(i);else if(s!==null){if(xt(r,s.client)<=s.clock)return null;const{item:u}=n?Jm(r,s):{item:Ti(r,s)};if(u instanceof nt&&u.content instanceof Sr)l=u.content.type;else return null}else throw Mn();a>=0?c=l._length:c=0}return zQ(l,c,t.assoc)};class Ov{constructor(e,n){this.ds=e,this.sv=n}}const _R=(t,e)=>new Ov(t,e),hp=t=>_R(RQ(t.store),Df(t.store)),vs=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&(e.sv.get(t.id.client)||0)>t.id.clock&&!oa(e.ds,t.id),qm=(t,e)=>{const n=ko(t.meta,qm,Us),r=t.doc.store;n.has(e)||(e.sv.forEach((o,s)=>{o<xt(r,s)&&xn(t,De(s,o))}),ss(t,e.ds,o=>{}),n.add(e))};class DR{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const Df=t=>{const e=new Map;return t.clients.forEach((n,r)=>{const o=n[n.length-1];e.set(r,o.id.clock+o.length)}),e},xt=(t,e)=>{const n=t.clients.get(e);if(n===void 0)return 0;const r=n[n.length-1];return r.id.clock+r.length},IR=(t,e)=>{let n=t.clients.get(e.id.client);if(n===void 0)n=[],t.clients.set(e.id.client,n);else{const r=n[n.length-1];if(r.id.clock+r.length!==e.id.clock)throw Mn()}n.push(e)},vr=(t,e)=>{let n=0,r=t.length-1,o=t[r],s=o.id.clock;if(s===e)return r;let i=bo(e/(s+o.length-1)*r);for(;n<=r;){if(o=t[i],s=o.id.clock,s<=e){if(e<s+o.length)return i;n=i+1}else r=i-1;i=bo((n+r)/2)}throw Mn()},GQ=(t,e)=>{const n=t.clients.get(e.client);return n[vr(n,e.clock)]},Ti=GQ,Km=(t,e,n)=>{const r=vr(e,n),o=e[r];return o.id.clock<n&&o instanceof nt?(e.splice(r+1,0,kd(t,o,n-o.id.clock)),r+1):r},xn=(t,e)=>{const n=t.doc.store.clients.get(e.client);return n[Km(t,n,e.clock)]},_E=(t,e,n)=>{const r=e.clients.get(n.client),o=vr(r,n.clock),s=r[o];return n.clock!==s.id.clock+s.length-1&&s.constructor!==qn&&r.splice(o+1,0,kd(t,s,n.clock-s.id.clock+1)),s},qQ=(t,e,n)=>{const r=t.clients.get(e.id.client);r[vr(r,e.id.clock)]=n},PR=(t,e,n,r,o)=>{if(r===0)return;const s=n+r;let i=Km(t,e,n),a;do a=e[i++],s<a.id.clock+a.length&&Km(t,e,s),o(a);while(i<e.length&&e[i].id.clock<s)};class KQ{constructor(e,n,r){this.doc=e,this.deleteSet=new ra,this.beforeState=Df(e.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=n,this.meta=new Map,this.local=r,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}}const DE=(t,e)=>e.deleteSet.clients.size===0&&!dX(e.afterState,(n,r)=>e.beforeState.get(r)!==n)?!1:(Av(e.deleteSet),BQ(t,e),Mv(t,e.deleteSet),!0),IE=(t,e,n)=>{const r=e._item;(r===null||r.id.clock<(t.beforeState.get(r.id.client)||0)&&!r.deleted)&&ko(t.changed,e,Us).add(n)},ou=(t,e)=>{let n=t[e],r=t[e-1],o=e;for(;o>0;n=r,r=t[--o-1]){if(r.deleted===n.deleted&&r.constructor===n.constructor&&r.mergeWith(n)){n instanceof nt&&n.parentSub!==null&&n.parent._map.get(n.parentSub)===n&&n.parent._map.set(n.parentSub,r);continue}break}const s=e-o;return s&&t.splice(e+1-s,s),s},YQ=(t,e,n)=>{for(const[r,o]of t.clients.entries()){const s=e.clients.get(r);for(let i=o.length-1;i>=0;i--){const a=o[i],l=a.clock+a.len;for(let c=vr(s,a.clock),u=s[c];c<s.length&&u.id.clock<l;u=s[++c]){const d=s[c];if(a.clock+a.len<=d.id.clock)break;d instanceof nt&&d.deleted&&!d.keep&&n(d)&&d.gc(e,!1)}}}},JQ=(t,e)=>{t.clients.forEach((n,r)=>{const o=e.clients.get(r);for(let s=n.length-1;s>=0;s--){const i=n[s],a=Ui(o.length-1,1+vr(o,i.clock+i.len-1));for(let l=a,c=o[l];l>0&&c.id.clock>=i.clock;c=o[l])l-=1+ou(o,l)}})},LR=(t,e)=>{if(e<t.length){const n=t[e],r=n.doc,o=r.store,s=n.deleteSet,i=n._mergeStructs;try{Av(s),n.afterState=Df(n.doc.store),r.emit("beforeObserverCalls",[n,r]);const a=[];n.changed.forEach((l,c)=>a.push(()=>{(c._item===null||!c._item.deleted)&&c._callObserver(n,l)})),a.push(()=>{n.changedParentTypes.forEach((l,c)=>{c._dEH.l.length>0&&(c._item===null||!c._item.deleted)&&(l=l.filter(u=>u.target._item===null||!u.target._item.deleted),l.forEach(u=>{u.currentTarget=c,u._path=null}),l.sort((u,d)=>u.path.length-d.path.length),NR(c._dEH,l,n))})}),a.push(()=>r.emit("afterTransaction",[n,r])),kv(a,[]),n._needFormattingCleanup&&gZ(n)}finally{r.gc&&YQ(s,o,r.gcFilter),JQ(s,o),n.afterState.forEach((u,d)=>{const f=n.beforeState.get(d)||0;if(f!==u){const h=o.clients.get(d),p=ns(vr(h,f),1);for(let m=h.length-1;m>=p;)m-=1+ou(h,m)}});for(let u=i.length-1;u>=0;u--){const{client:d,clock:f}=i[u].id,h=o.clients.get(d),p=vr(h,f);p+1<h.length&&ou(h,p+1)>1||p>0&&ou(h,p)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID)&&(AQ(Tv,wR,"[yjs] ",ER,SR,"Changed the client-id because another client seems to be using it."),r.clientID=OR()),r.emit("afterTransactionCleanup",[n,r]),r._observers.has("update")){const u=new IQ;DE(u,n)&&r.emit("update",[u.toUint8Array(),n.origin,r,n])}if(r._observers.has("updateV2")){const u=new _f;DE(u,n)&&r.emit("updateV2",[u.toUint8Array(),n.origin,r,n])}const{subdocsAdded:a,subdocsLoaded:l,subdocsRemoved:c}=n;(a.size>0||c.size>0||l.size>0)&&(a.forEach(u=>{u.clientID=r.clientID,u.collectionid==null&&(u.collectionid=r.collectionid),r.subdocs.add(u)}),c.forEach(u=>r.subdocs.delete(u)),r.emit("subdocs",[{loaded:l,added:a,removed:c},r,n]),c.forEach(u=>u.destroy())),t.length<=e+1?(r._transactionCleanups=[],r.emit("afterAllTransactions",[r,t])):LR(t,e+1)}}},Je=(t,e,n=null,r=!0)=>{const o=t._transactionCleanups;let s=!1,i=null;t._transaction===null&&(s=!0,t._transaction=new KQ(t,n,r),o.push(t._transaction),o.length===1&&t.emit("beforeAllTransactions",[t]),t.emit("beforeTransaction",[t._transaction,t]));try{i=e(t._transaction)}finally{if(s){const a=t._transaction===o[0];t._transaction=null,a&&LR(o,0)}}return i};class XQ{constructor(e,n){this.insertions=n,this.deletions=e,this.meta=new Map}}const PE=(t,e,n)=>{ss(t,n.deletions,r=>{r instanceof nt&&e.scope.some(o=>o===t.doc||El(o,r))&&Iv(r,!1)})},LE=(t,e,n)=>{let r=null;const o=t.doc,s=t.scope;Je(o,a=>{for(;e.length>0&&t.currStackItem===null;){const l=o.store,c=e.pop(),u=new Set,d=[];let f=!1;ss(a,c.insertions,h=>{if(h instanceof nt){if(h.redone!==null){let{item:p,diff:m}=Jm(l,h.id);m>0&&(p=xn(a,De(p.id.client,p.id.clock+m))),h=p}!h.deleted&&s.some(p=>p===a.doc||El(p,h))&&d.push(h)}}),ss(a,c.deletions,h=>{h instanceof nt&&s.some(p=>p===a.doc||El(p,h))&&!oa(c.insertions,h.id)&&u.add(h)}),u.forEach(h=>{f=nN(a,h,u,c.insertions,t.ignoreRemoteMapChanges,t)!==null||f});for(let h=d.length-1;h>=0;h--){const p=d[h];t.deleteFilter(p)&&(p.delete(a),f=!0)}t.currStackItem=f?c:null}a.changed.forEach((l,c)=>{l.has(null)&&c._searchMarker&&(c._searchMarker.length=0)}),r=a},t);const i=t.currStackItem;if(i!=null){const a=r.changedParentTypes;t.emit("stack-item-popped",[{stackItem:i,type:n,changedParentTypes:a,origin:t},t]),t.currStackItem=null}return i};class jR extends lR{constructor(e,{captureTimeout:n=500,captureTransaction:r=l=>!0,deleteFilter:o=()=>!0,trackedOrigins:s=new Set([null]),ignoreRemoteMapChanges:i=!1,doc:a=Bm(e)?e[0].doc:e instanceof ei?e:e.doc}={}){super(),this.scope=[],this.doc=a,this.addToScope(e),this.deleteFilter=o,s.add(this),this.trackedOrigins=s,this.captureTransaction=r,this.undoStack=[],this.redoStack=[],this.undoing=!1,this.redoing=!1,this.currStackItem=null,this.lastChange=0,this.ignoreRemoteMapChanges=i,this.captureTimeout=n,this.afterTransactionHandler=l=>{if(!this.captureTransaction(l)||!this.scope.some(y=>l.changedParentTypes.has(y)||y===this.doc)||!this.trackedOrigins.has(l.origin)&&(!l.origin||!this.trackedOrigins.has(l.origin.constructor)))return;const c=this.undoing,u=this.redoing,d=c?this.redoStack:this.undoStack;c?this.stopCapturing():u||this.clear(!1,!0);const f=new ra;l.afterState.forEach((y,v)=>{const w=l.beforeState.get(v)||0,E=y-w;E>0&&xl(f,v,w,E)});const h=JX();let p=!1;if(this.lastChange>0&&h-this.lastChange<this.captureTimeout&&d.length>0&&!c&&!u){const y=d[d.length-1];y.deletions=Wm([y.deletions,l.deleteSet]),y.insertions=Wm([y.insertions,f])}else d.push(new XQ(l.deleteSet,f)),p=!0;!c&&!u&&(this.lastChange=h),ss(l,l.deleteSet,y=>{y instanceof nt&&this.scope.some(v=>v===l.doc||El(v,y))&&Iv(y,!0)});const m=[{stackItem:d[d.length-1],origin:l.origin,type:c?"redo":"undo",changedParentTypes:l.changedParentTypes},this];p?this.emit("stack-item-added",m):this.emit("stack-item-updated",m)},this.doc.on("afterTransaction",this.afterTransactionHandler),this.doc.on("destroy",()=>{this.destroy()})}addToScope(e){const n=new Set(this.scope);e=Bm(e)?e:[e],e.forEach(r=>{n.has(r)||(n.add(r),(r instanceof Bt?r.doc!==this.doc:r!==this.doc)&&TR("[yjs#509] Not same Y.Doc"),this.scope.push(r))})}addTrackedOrigin(e){this.trackedOrigins.add(e)}removeTrackedOrigin(e){this.trackedOrigins.delete(e)}clear(e=!0,n=!0){(e&&this.canUndo()||n&&this.canRedo())&&this.doc.transact(r=>{e&&(this.undoStack.forEach(o=>PE(r,this,o)),this.undoStack=[]),n&&(this.redoStack.forEach(o=>PE(r,this,o)),this.redoStack=[]),this.emit("stack-cleared",[{undoStackCleared:e,redoStackCleared:n}])})}stopCapturing(){this.lastChange=0}undo(){this.undoing=!0;let e;try{e=LE(this,this.undoStack,"undo")}finally{this.undoing=!1}return e}redo(){this.redoing=!0;let e;try{e=LE(this,this.redoStack,"redo")}finally{this.redoing=!1}return e}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}destroy(){this.trackedOrigins.delete(this),this.doc.off("afterTransaction",this.afterTransactionHandler),super.destroy()}}function*QQ(t){const e=st(t.restDecoder);for(let n=0;n<e;n++){const r=st(t.restDecoder),o=t.readClient();let s=st(t.restDecoder);for(let i=0;i<r;i++){const a=t.readInfo();if(a===10){const l=st(t.restDecoder);yield new cr(De(o,s),l),s+=l}else if((Of&a)!==0){const l=(a&(co|an))===0,c=new nt(De(o,s),null,(a&an)===an?t.readLeftID():null,null,(a&co)===co?t.readRightID():null,l?t.readParentInfo()?t.readString():t.readLeftID():null,l&&(a&yl)===yl?t.readString():null,rN(t,a));yield c,s+=c.length}else{const l=t.readLen();yield new qn(De(o,s),l),s+=l}}}}class ZQ{constructor(e,n){this.gen=QQ(e),this.curr=null,this.done=!1,this.filterSkips=n,this.next()}next(){do this.curr=this.gen.next().value||null;while(this.filterSkips&&this.curr!==null&&this.curr.constructor===cr);return this.curr}}class eZ{constructor(e){this.currClient=0,this.startClock=0,this.written=0,this.encoder=e,this.clientStructs=[]}}const tZ=(t,e)=>{if(t.constructor===qn){const{client:n,clock:r}=t.id;return new qn(De(n,r+e),t.length-e)}else if(t.constructor===cr){const{client:n,clock:r}=t.id;return new cr(De(n,r+e),t.length-e)}else{const n=t,{client:r,clock:o}=n.id;return new nt(De(r,o+e),null,De(r,o+e-1),null,n.rightOrigin,n.parent,n.parentSub,n.content.splice(e))}},jE=(t,e=vd,n=_f)=>{if(t.length===1)return t[0];const r=t.map(u=>new e(wv(u)));let o=r.map(u=>new ZQ(u,!0)),s=null;const i=new n,a=new eZ(i);for(;o=o.filter(f=>f.curr!==null),o.sort((f,h)=>{if(f.curr.id.client===h.curr.id.client){const p=f.curr.id.clock-h.curr.id.clock;return p===0?f.curr.constructor===h.curr.constructor?0:f.curr.constructor===cr?1:-1:p}else return h.curr.id.client-f.curr.id.client}),o.length!==0;){const u=o[0],d=u.curr.id.client;if(s!==null){let f=u.curr,h=!1;for(;f!==null&&f.id.clock+f.length<=s.struct.id.clock+s.struct.length&&f.id.client>=s.struct.id.client;)f=u.next(),h=!0;if(f===null||f.id.client!==d||h&&f.id.clock>s.struct.id.clock+s.struct.length)continue;if(d!==s.struct.id.client)xa(a,s.struct,s.offset),s={struct:f,offset:0},u.next();else if(s.struct.id.clock+s.struct.length<f.id.clock)if(s.struct.constructor===cr)s.struct.length=f.id.clock+f.length-s.struct.id.clock;else{xa(a,s.struct,s.offset);const p=f.id.clock-s.struct.id.clock-s.struct.length;s={struct:new cr(De(d,s.struct.id.clock+s.struct.length),p),offset:0}}else{const p=s.struct.id.clock+s.struct.length-f.id.clock;p>0&&(s.struct.constructor===cr?s.struct.length-=p:f=tZ(f,p)),s.struct.mergeWith(f)||(xa(a,s.struct,s.offset),s={struct:f,offset:0},u.next())}}else s={struct:u.curr,offset:0},u.next();for(let f=u.curr;f!==null&&f.id.client===d&&f.id.clock===s.struct.id.clock+s.struct.length&&f.constructor!==cr;f=u.next())xa(a,s.struct,s.offset),s={struct:f,offset:0}}s!==null&&(xa(a,s.struct,s.offset),s=null),nZ(a);const l=r.map(u=>NQ(u)),c=Wm(l);return Mv(i,c),i.toUint8Array()},$R=t=>{t.written>0&&(t.clientStructs.push({written:t.written,restEncoder:dr(t.encoder.restEncoder)}),t.encoder.restEncoder=tc(),t.written=0)},xa=(t,e,n)=>{t.written>0&&t.currClient!==e.id.client&&$R(t),t.written===0&&(t.currClient=e.id.client,t.encoder.writeClient(e.id.client),$e(t.encoder.restEncoder,e.id.clock+n)),e.write(t.encoder,n),t.written++},nZ=t=>{$R(t);const e=t.encoder.restEncoder;$e(e,t.clientStructs.length);for(let n=0;n<t.clientStructs.length;n++){const r=t.clientStructs[n];$e(e,r.written),Rf(e,r.restEncoder)}},$E="You must not compute changes after the event-handler fired.";class If{constructor(e,n){this.target=e,this.currentTarget=e,this.transaction=n,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=rZ(this.currentTarget,this.target))}deletes(e){return oa(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw rs($E);const e=new Map,n=this.target;this.transaction.changed.get(n).forEach(o=>{if(o!==null){const s=n._map.get(o);let i,a;if(this.adds(s)){let l=s.left;for(;l!==null&&this.adds(l);)l=l.left;if(this.deletes(s))if(l!==null&&this.deletes(l))i="delete",a=ip(l.content.getContent());else return;else l!==null&&this.deletes(l)?(i="update",a=ip(l.content.getContent())):(i="add",a=void 0)}else if(this.deletes(s))i="delete",a=ip(s.content.getContent());else return;e.set(o,{action:i,oldValue:a})}}),this._keys=e}return this._keys}get delta(){return this.changes.delta}adds(e){return e.id.clock>=(this.transaction.beforeState.get(e.id.client)||0)}get changes(){let e=this._changes;if(e===null){if(this.transaction.doc._transactionCleanups.length===0)throw rs($E);const n=this.target,r=Us(),o=Us(),s=[];if(e={added:r,deleted:o,delta:s,keys:this.keys},this.transaction.changed.get(n).has(null)){let a=null;const l=()=>{a&&s.push(a)};for(let c=n._start;c!==null;c=c.right)c.deleted?this.deletes(c)&&!this.adds(c)&&((a===null||a.delete===void 0)&&(l(),a={delete:0}),a.delete+=c.length,o.add(c)):this.adds(c)?((a===null||a.insert===void 0)&&(l(),a={insert:[]}),a.insert=a.insert.concat(c.content.getContent()),r.add(c)):((a===null||a.retain===void 0)&&(l(),a={retain:0}),a.retain+=c.length);a!==null&&a.retain===void 0&&l()}this._changes=e}return e}}const rZ=(t,e)=>{const n=[];for(;e._item!==null&&e!==t;){if(e._item.parentSub!==null)n.unshift(e._item.parentSub);else{let r=0,o=e._item.parent._start;for(;o!==e._item&&o!==null;)!o.deleted&&o.countable&&(r+=o.length),o=o.right;n.unshift(r)}e=e._item.parent}return n},Zt=()=>{TR("Invalid access: Add Yjs type to a document before reading data.")},BR=80;let Rv=0;class oZ{constructor(e,n){e.marker=!0,this.p=e,this.index=n,this.timestamp=Rv++}}const sZ=t=>{t.timestamp=Rv++},FR=(t,e,n)=>{t.p.marker=!1,t.p=e,e.marker=!0,t.index=n,t.timestamp=Rv++},iZ=(t,e,n)=>{if(t.length>=BR){const r=t.reduce((o,s)=>o.timestamp<s.timestamp?o:s);return FR(r,e,n),r}else{const r=new oZ(e,n);return t.push(r),r}},Pf=(t,e)=>{if(t._start===null||e===0||t._searchMarker===null)return null;const n=t._searchMarker.length===0?null:t._searchMarker.reduce((s,i)=>tu(e-s.index)<tu(e-i.index)?s:i);let r=t._start,o=0;for(n!==null&&(r=n.p,o=n.index,sZ(n));r.right!==null&&o<e;){if(!r.deleted&&r.countable){if(e<o+r.length)break;o+=r.length}r=r.right}for(;r.left!==null&&o>e;)r=r.left,!r.deleted&&r.countable&&(o-=r.length);for(;r.left!==null&&r.left.id.client===r.id.client&&r.left.id.clock+r.left.length===r.id.clock;)r=r.left,!r.deleted&&r.countable&&(o-=r.length);return n!==null&&tu(n.index-o)<r.parent.length/BR?(FR(n,r,o),n):iZ(t._searchMarker,r,o)},Sl=(t,e,n)=>{for(let r=t.length-1;r>=0;r--){const o=t[r];if(n>0){let s=o.p;for(s.marker=!1;s&&(s.deleted||!s.countable);)s=s.left,s&&!s.deleted&&s.countable&&(o.index-=s.length);if(s===null||s.marker===!0){t.splice(r,1);continue}o.p=s,s.marker=!0}(e<o.index||n>0&&e===o.index)&&(o.index=ns(e,o.index+n))}},Lf=(t,e,n)=>{const r=t,o=e.changedParentTypes;for(;ko(o,t,()=>[]).push(n),t._item!==null;)t=t._item.parent;NR(r._eH,n,e)};class Bt{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=OE(),this._dEH=OE(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,n){this.doc=e,this._item=n}_copy(){throw hr()}clone(){throw hr()}_write(e){}get _first(){let e=this._start;for(;e!==null&&e.deleted;)e=e.right;return e}_callObserver(e,n){!e.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(e){RE(this._eH,e)}observeDeep(e){RE(this._dEH,e)}unobserve(e){NE(this._eH,e)}unobserveDeep(e){NE(this._dEH,e)}toJSON(){}}const HR=(t,e,n)=>{t.doc??Zt(),e<0&&(e=t._length+e),n<0&&(n=t._length+n);let r=n-e;const o=[];let s=t._start;for(;s!==null&&r>0;){if(s.countable&&!s.deleted){const i=s.content.getContent();if(i.length<=e)e-=i.length;else{for(let a=e;a<i.length&&r>0;a++)o.push(i[a]),r--;e=0}}s=s.right}return o},UR=t=>{t.doc??Zt();const e=[];let n=t._start;for(;n!==null;){if(n.countable&&!n.deleted){const r=n.content.getContent();for(let o=0;o<r.length;o++)e.push(r[o])}n=n.right}return e},zR=(t,e)=>{const n=[];let r=t._start;for(;r!==null;){if(r.countable&&vs(r,e)){const o=r.content.getContent();for(let s=0;s<o.length;s++)n.push(o[s])}r=r.right}return n},kl=(t,e)=>{let n=0,r=t._start;for(t.doc??Zt();r!==null;){if(r.countable&&!r.deleted){const o=r.content.getContent();for(let s=0;s<o.length;s++)e(o[s],n++,t)}r=r.right}},VR=(t,e)=>{const n=[];return kl(t,(r,o)=>{n.push(e(r,o,t))}),n},aZ=t=>{let e=t._start,n=null,r=0;return{[Symbol.iterator](){return this},next:()=>{if(n===null){for(;e!==null&&e.deleted;)e=e.right;if(e===null)return{done:!0,value:void 0};n=e.content.getContent(),r=0,e=e.right}const o=n[r++];return n.length<=r&&(n=null),{done:!1,value:o}}}},WR=(t,e)=>{t.doc??Zt();const n=Pf(t,e);let r=t._start;for(n!==null&&(r=n.p,e-=n.index);r!==null;r=r.right)if(!r.deleted&&r.countable){if(e<r.length)return r.content.getContent()[e];e-=r.length}},xd=(t,e,n,r)=>{let o=n;const s=t.doc,i=s.clientID,a=s.store,l=n===null?e._start:n.right;let c=[];const u=()=>{c.length>0&&(o=new nt(De(i,xt(a,i)),o,o&&o.lastId,l,l&&l.id,e,null,new Ws(c)),o.integrate(t,0),c=[])};r.forEach(d=>{if(d===null)c.push(d);else switch(d.constructor){case Number:case Object:case Boolean:case Array:case String:c.push(d);break;default:switch(u(),d.constructor){case Uint8Array:case ArrayBuffer:o=new nt(De(i,xt(a,i)),o,o&&o.lastId,l,l&&l.id,e,null,new nc(new Uint8Array(d))),o.integrate(t,0);break;case ei:o=new nt(De(i,xt(a,i)),o,o&&o.lastId,l,l&&l.id,e,null,new rc(d)),o.integrate(t,0);break;default:if(d instanceof Bt)o=new nt(De(i,xt(a,i)),o,o&&o.lastId,l,l&&l.id,e,null,new Sr(d)),o.integrate(t,0);else throw new Error("Unexpected content type in insert operation")}}}),u()},GR=()=>rs("Length exceeded!"),qR=(t,e,n,r)=>{if(n>e._length)throw GR();if(n===0)return e._searchMarker&&Sl(e._searchMarker,n,r.length),xd(t,e,null,r);const o=n,s=Pf(e,n);let i=e._start;for(s!==null&&(i=s.p,n-=s.index,n===0&&(i=i.prev,n+=i&&i.countable&&!i.deleted?i.length:0));i!==null;i=i.right)if(!i.deleted&&i.countable){if(n<=i.length){n<i.length&&xn(t,De(i.id.client,i.id.clock+n));break}n-=i.length}return e._searchMarker&&Sl(e._searchMarker,o,r.length),xd(t,e,i,r)},lZ=(t,e,n)=>{let o=(e._searchMarker||[]).reduce((s,i)=>i.index>s.index?i:s,{index:0,p:e._start}).p;if(o)for(;o.right;)o=o.right;return xd(t,e,o,n)},KR=(t,e,n,r)=>{if(r===0)return;const o=n,s=r,i=Pf(e,n);let a=e._start;for(i!==null&&(a=i.p,n-=i.index);a!==null&&n>0;a=a.right)!a.deleted&&a.countable&&(n<a.length&&xn(t,De(a.id.client,a.id.clock+n)),n-=a.length);for(;r>0&&a!==null;)a.deleted||(r<a.length&&xn(t,De(a.id.client,a.id.clock+r)),a.delete(t),r-=a.length),a=a.right;if(r>0)throw GR();e._searchMarker&&Sl(e._searchMarker,o,-s+r)},wd=(t,e,n)=>{const r=e._map.get(n);r!==void 0&&r.delete(t)},Nv=(t,e,n,r)=>{const o=e._map.get(n)||null,s=t.doc,i=s.clientID;let a;if(r==null)a=new Ws([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:a=new Ws([r]);break;case Uint8Array:a=new nc(r);break;case ei:a=new rc(r);break;default:if(r instanceof Bt)a=new Sr(r);else throw new Error("Unexpected content type")}new nt(De(i,xt(s.store,i)),o,o&&o.lastId,null,null,e,n,a).integrate(t,0)},_v=(t,e)=>{t.doc??Zt();const n=t._map.get(e);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},YR=t=>{const e={};return t.doc??Zt(),t._map.forEach((n,r)=>{n.deleted||(e[r]=n.content.getContent()[n.length-1])}),e},JR=(t,e)=>{t.doc??Zt();const n=t._map.get(e);return n!==void 0&&!n.deleted},cZ=(t,e)=>{const n={};return t._map.forEach((r,o)=>{let s=r;for(;s!==null&&(!e.sv.has(s.id.client)||s.id.clock>=(e.sv.get(s.id.client)||0));)s=s.left;s!==null&&vs(s,e)&&(n[o]=s.content.getContent()[s.length-1])}),n},jc=t=>(t.doc??Zt(),MQ(t._map.entries(),e=>!e[1].deleted));class uZ extends If{}class Ci extends Bt{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(e){const n=new Ci;return n.push(e),n}_integrate(e,n){super._integrate(e,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Ci}clone(){const e=new Ci;return e.insert(0,this.toArray().map(n=>n instanceof Bt?n.clone():n)),e}get length(){return this.doc??Zt(),this._length}_callObserver(e,n){super._callObserver(e,n),Lf(this,e,new uZ(this,e))}insert(e,n){this.doc!==null?Je(this.doc,r=>{qR(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}push(e){this.doc!==null?Je(this.doc,n=>{lZ(n,this,e)}):this._prelimContent.push(...e)}unshift(e){this.insert(0,e)}delete(e,n=1){this.doc!==null?Je(this.doc,r=>{KR(r,this,e,n)}):this._prelimContent.splice(e,n)}get(e){return WR(this,e)}toArray(){return UR(this)}slice(e=0,n=this.length){return HR(this,e,n)}toJSON(){return this.map(e=>e instanceof Bt?e.toJSON():e)}map(e){return VR(this,e)}forEach(e){kl(this,e)}[Symbol.iterator](){return aZ(this)}_write(e){e.writeTypeRef(PZ)}}const dZ=t=>new Ci;class fZ extends If{constructor(e,n,r){super(e,n),this.keysChanged=r}}class Wi extends Bt{constructor(e){super(),this._prelimContent=null,e===void 0?this._prelimContent=new Map:this._prelimContent=new Map(e)}_integrate(e,n){super._integrate(e,n),this._prelimContent.forEach((r,o)=>{this.set(o,r)}),this._prelimContent=null}_copy(){return new Wi}clone(){const e=new Wi;return this.forEach((n,r)=>{e.set(r,n instanceof Bt?n.clone():n)}),e}_callObserver(e,n){Lf(this,e,new fZ(this,e,n))}toJSON(){this.doc??Zt();const e={};return this._map.forEach((n,r)=>{if(!n.deleted){const o=n.content.getContent()[n.length-1];e[r]=o instanceof Bt?o.toJSON():o}}),e}get size(){return[...jc(this)].length}keys(){return dp(jc(this),e=>e[0])}values(){return dp(jc(this),e=>e[1].content.getContent()[e[1].length-1])}entries(){return dp(jc(this),e=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this.doc??Zt(),this._map.forEach((n,r)=>{n.deleted||e(n.content.getContent()[n.length-1],r,this)})}[Symbol.iterator](){return this.entries()}delete(e){this.doc!==null?Je(this.doc,n=>{wd(n,this,e)}):this._prelimContent.delete(e)}set(e,n){return this.doc!==null?Je(this.doc,r=>{Nv(r,this,e,n)}):this._prelimContent.set(e,n),n}get(e){return _v(this,e)}has(e){return JR(this,e)}clear(){this.doc!==null?Je(this.doc,e=>{this.forEach(function(n,r,o){wd(e,o,r)})}):this._prelimContent.clear()}_write(e){e.writeTypeRef(LZ)}}const hZ=t=>new Wi,zo=(t,e)=>t===e||typeof t=="object"&&typeof e=="object"&&t&&e&&oQ(t,e);class Ym{constructor(e,n,r,o){this.left=e,this.right=n,this.index=r,this.currentAttributes=o}forward(){switch(this.right===null&&Mn(),this.right.content.constructor){case kt:this.right.deleted||sa(this.currentAttributes,this.right.content);break;default:this.right.deleted||(this.index+=this.right.length);break}this.left=this.right,this.right=this.right.right}}const BE=(t,e,n)=>{for(;e.right!==null&&n>0;){switch(e.right.content.constructor){case kt:e.right.deleted||sa(e.currentAttributes,e.right.content);break;default:e.right.deleted||(n<e.right.length&&xn(t,De(e.right.id.client,e.right.id.clock+n)),e.index+=e.right.length,n-=e.right.length);break}e.left=e.right,e.right=e.right.right}return e},$c=(t,e,n,r)=>{const o=new Map,s=r?Pf(e,n):null;if(s){const i=new Ym(s.p.left,s.p,s.index,o);return BE(t,i,n-s.index)}else{const i=new Ym(null,e._start,0,o);return BE(t,i,n)}},XR=(t,e,n,r)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===kt&&zo(r.get(n.right.content.key),n.right.content.value));)n.right.deleted||r.delete(n.right.content.key),n.forward();const o=t.doc,s=o.clientID;r.forEach((i,a)=>{const l=n.left,c=n.right,u=new nt(De(s,xt(o.store,s)),l,l&&l.lastId,c,c&&c.id,e,null,new kt(a,i));u.integrate(t,0),n.right=u,n.forward()})},sa=(t,e)=>{const{key:n,value:r}=e;r===null?t.delete(n):t.set(n,r)},QR=(t,e)=>{for(;t.right!==null;){if(!(t.right.deleted||t.right.content.constructor===kt&&zo(e[t.right.content.key]??null,t.right.content.value)))break;t.forward()}},ZR=(t,e,n,r)=>{const o=t.doc,s=o.clientID,i=new Map;for(const a in r){const l=r[a],c=n.currentAttributes.get(a)??null;if(!zo(c,l)){i.set(a,c);const{left:u,right:d}=n;n.right=new nt(De(s,xt(o.store,s)),u,u&&u.lastId,d,d&&d.id,e,null,new kt(a,l)),n.right.integrate(t,0),n.forward()}}return i},pp=(t,e,n,r,o)=>{n.currentAttributes.forEach((f,h)=>{o[h]===void 0&&(o[h]=null)});const s=t.doc,i=s.clientID;QR(n,o);const a=ZR(t,e,n,o),l=r.constructor===String?new br(r):r instanceof Bt?new Sr(r):new ti(r);let{left:c,right:u,index:d}=n;e._searchMarker&&Sl(e._searchMarker,n.index,l.getLength()),u=new nt(De(i,xt(s.store,i)),c,c&&c.lastId,u,u&&u.id,e,null,l),u.integrate(t,0),n.right=u,n.index=d,n.forward(),XR(t,e,n,a)},FE=(t,e,n,r,o)=>{const s=t.doc,i=s.clientID;QR(n,o);const a=ZR(t,e,n,o);e:for(;n.right!==null&&(r>0||a.size>0&&(n.right.deleted||n.right.content.constructor===kt));){if(!n.right.deleted)switch(n.right.content.constructor){case kt:{const{key:l,value:c}=n.right.content,u=o[l];if(u!==void 0){if(zo(u,c))a.delete(l);else{if(r===0)break e;a.set(l,c)}n.right.delete(t)}else n.currentAttributes.set(l,c);break}default:r<n.right.length&&xn(t,De(n.right.id.client,n.right.id.clock+r)),r-=n.right.length;break}n.forward()}if(r>0){let l="";for(;r>0;r--)l+=`
|
|
585
|
+
`;n.right=new nt(De(i,xt(s.store,i)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,e,null,new br(l)),n.right.integrate(t,0),n.forward()}XR(t,e,n,a)},eN=(t,e,n,r,o)=>{let s=e;const i=fr();for(;s&&(!s.countable||s.deleted);){if(!s.deleted&&s.content.constructor===kt){const c=s.content;i.set(c.key,c)}s=s.right}let a=0,l=!1;for(;e!==s;){if(n===e&&(l=!0),!e.deleted){const c=e.content;switch(c.constructor){case kt:{const{key:u,value:d}=c,f=r.get(u)??null;(i.get(u)!==c||f===d)&&(e.delete(t),a++,!l&&(o.get(u)??null)===d&&f!==d&&(f===null?o.delete(u):o.set(u,f))),!l&&!e.deleted&&sa(o,c);break}}}e=e.right}return a},pZ=(t,e)=>{for(;e&&e.right&&(e.right.deleted||!e.right.countable);)e=e.right;const n=new Set;for(;e&&(e.deleted||!e.countable);){if(!e.deleted&&e.content.constructor===kt){const r=e.content.key;n.has(r)?e.delete(t):n.add(r)}e=e.left}},mZ=t=>{let e=0;return Je(t.doc,n=>{let r=t._start,o=t._start,s=fr();const i=$m(s);for(;o;){if(o.deleted===!1)switch(o.content.constructor){case kt:sa(i,o.content);break;default:e+=eN(n,r,o,s,i),s=$m(i),r=o;break}o=o.right}}),e},gZ=t=>{const e=new Set,n=t.doc;for(const[r,o]of t.afterState.entries()){const s=t.beforeState.get(r)||0;o!==s&&PR(t,n.store.clients.get(r),s,o,i=>{!i.deleted&&i.content.constructor===kt&&i.constructor!==qn&&e.add(i.parent)})}Je(n,r=>{ss(t,t.deleteSet,o=>{if(o instanceof qn||!o.parent._hasFormatting||e.has(o.parent))return;const s=o.parent;o.content.constructor===kt?e.add(s):pZ(r,o)});for(const o of e)mZ(o)})},HE=(t,e,n)=>{const r=n,o=$m(e.currentAttributes),s=e.right;for(;n>0&&e.right!==null;){if(e.right.deleted===!1)switch(e.right.content.constructor){case Sr:case ti:case br:n<e.right.length&&xn(t,De(e.right.id.client,e.right.id.clock+n)),n-=e.right.length,e.right.delete(t);break}e.forward()}s&&eN(t,s,e.right,o,e.currentAttributes);const i=(e.left||e.right).parent;return i._searchMarker&&Sl(i._searchMarker,e.index,-r+n),e};class yZ extends If{constructor(e,n,r){super(e,n),this.childListChanged=!1,this.keysChanged=new Set,r.forEach(o=>{o===null?this.childListChanged=!0:this.keysChanged.add(o)})}get changes(){if(this._changes===null){const e={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=e}return this._changes}get delta(){if(this._delta===null){const e=this.target.doc,n=[];Je(e,r=>{const o=new Map,s=new Map;let i=this.target._start,a=null;const l={};let c="",u=0,d=0;const f=()=>{if(a!==null){let h=null;switch(a){case"delete":d>0&&(h={delete:d}),d=0;break;case"insert":(typeof c=="object"||c.length>0)&&(h={insert:c},o.size>0&&(h.attributes={},o.forEach((p,m)=>{p!==null&&(h.attributes[m]=p)}))),c="";break;case"retain":u>0&&(h={retain:u},nQ(l)||(h.attributes=eQ({},l))),u=0;break}h&&n.push(h),a=null}};for(;i!==null;){switch(i.content.constructor){case Sr:case ti:this.adds(i)?this.deletes(i)||(f(),a="insert",c=i.content.getContent()[0],f()):this.deletes(i)?(a!=="delete"&&(f(),a="delete"),d+=1):i.deleted||(a!=="retain"&&(f(),a="retain"),u+=1);break;case br:this.adds(i)?this.deletes(i)||(a!=="insert"&&(f(),a="insert"),c+=i.content.str):this.deletes(i)?(a!=="delete"&&(f(),a="delete"),d+=i.length):i.deleted||(a!=="retain"&&(f(),a="retain"),u+=i.length);break;case kt:{const{key:h,value:p}=i.content;if(this.adds(i)){if(!this.deletes(i)){const m=o.get(h)??null;zo(m,p)?p!==null&&i.delete(r):(a==="retain"&&f(),zo(p,s.get(h)??null)?delete l[h]:l[h]=p)}}else if(this.deletes(i)){s.set(h,p);const m=o.get(h)??null;zo(m,p)||(a==="retain"&&f(),l[h]=m)}else if(!i.deleted){s.set(h,p);const m=l[h];m!==void 0&&(zo(m,p)?m!==null&&i.delete(r):(a==="retain"&&f(),p===null?delete l[h]:l[h]=p))}i.deleted||(a==="insert"&&f(),sa(o,i.content));break}}i=i.right}for(f();n.length>0;){const h=n[n.length-1];if(h.retain!==void 0&&h.attributes===void 0)n.pop();else break}}),this._delta=n}return this._delta}}class is extends Bt{constructor(e){super(),this._pending=e!==void 0?[()=>this.insert(0,e)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??Zt(),this._length}_integrate(e,n){super._integrate(e,n);try{this._pending.forEach(r=>r())}catch(r){console.error(r)}this._pending=null}_copy(){return new is}clone(){const e=new is;return e.applyDelta(this.toDelta()),e}_callObserver(e,n){super._callObserver(e,n);const r=new yZ(this,e,n);Lf(this,e,r),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=!0)}toString(){this.doc??Zt();let e="",n=this._start;for(;n!==null;)!n.deleted&&n.countable&&n.content.constructor===br&&(e+=n.content.str),n=n.right;return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:n=!0}={}){this.doc!==null?Je(this.doc,r=>{const o=new Ym(null,this._start,0,new Map);for(let s=0;s<e.length;s++){const i=e[s];if(i.insert!==void 0){const a=!n&&typeof i.insert=="string"&&s===e.length-1&&o.right===null&&i.insert.slice(-1)===`
|
|
586
|
+
`?i.insert.slice(0,-1):i.insert;(typeof a!="string"||a.length>0)&&pp(r,this,o,a,i.attributes||{})}else i.retain!==void 0?FE(r,this,o,i.retain,i.attributes||{}):i.delete!==void 0&&HE(r,o,i.delete)}}):this._pending.push(()=>this.applyDelta(e))}toDelta(e,n,r){this.doc??Zt();const o=[],s=new Map,i=this.doc;let a="",l=this._start;function c(){if(a.length>0){const d={};let f=!1;s.forEach((p,m)=>{f=!0,d[m]=p});const h={insert:a};f&&(h.attributes=d),o.push(h),a=""}}const u=()=>{for(;l!==null;){if(vs(l,e)||n!==void 0&&vs(l,n))switch(l.content.constructor){case br:{const d=s.get("ychange");e!==void 0&&!vs(l,e)?(d===void 0||d.user!==l.id.client||d.type!=="removed")&&(c(),s.set("ychange",r?r("removed",l.id):{type:"removed"})):n!==void 0&&!vs(l,n)?(d===void 0||d.user!==l.id.client||d.type!=="added")&&(c(),s.set("ychange",r?r("added",l.id):{type:"added"})):d!==void 0&&(c(),s.delete("ychange")),a+=l.content.str;break}case Sr:case ti:{c();const d={insert:l.content.getContent()[0]};if(s.size>0){const f={};d.attributes=f,s.forEach((h,p)=>{f[p]=h})}o.push(d);break}case kt:vs(l,e)&&(c(),sa(s,l.content));break}l=l.right}c()};return e||n?Je(i,d=>{e&&qm(d,e),n&&qm(d,n),u()},"cleanup"):u(),o}insert(e,n,r){if(n.length<=0)return;const o=this.doc;o!==null?Je(o,s=>{const i=$c(s,this,e,!r);r||(r={},i.currentAttributes.forEach((a,l)=>{r[l]=a})),pp(s,this,i,n,r)}):this._pending.push(()=>this.insert(e,n,r))}insertEmbed(e,n,r){const o=this.doc;o!==null?Je(o,s=>{const i=$c(s,this,e,!r);pp(s,this,i,n,r||{})}):this._pending.push(()=>this.insertEmbed(e,n,r||{}))}delete(e,n){if(n===0)return;const r=this.doc;r!==null?Je(r,o=>{HE(o,$c(o,this,e,!0),n)}):this._pending.push(()=>this.delete(e,n))}format(e,n,r){if(n===0)return;const o=this.doc;o!==null?Je(o,s=>{const i=$c(s,this,e,!1);i.right!==null&&FE(s,this,i,n,r)}):this._pending.push(()=>this.format(e,n,r))}removeAttribute(e){this.doc!==null?Je(this.doc,n=>{wd(n,this,e)}):this._pending.push(()=>this.removeAttribute(e))}setAttribute(e,n){this.doc!==null?Je(this.doc,r=>{Nv(r,this,e,n)}):this._pending.push(()=>this.setAttribute(e,n))}getAttribute(e){return _v(this,e)}getAttributes(){return YR(this)}_write(e){e.writeTypeRef(jZ)}}const vZ=t=>new is;class mp{constructor(e,n=()=>!0){this._filter=n,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??Zt()}[Symbol.iterator](){return this}next(){let e=this._currentNode,n=e&&e.content&&e.content.type;if(e!==null&&(!this._firstCall||e.deleted||!this._filter(n)))do if(n=e.content.type,!e.deleted&&(n.constructor===Qt||n.constructor===Vs)&&n._start!==null)e=n._start;else for(;e!==null;){const r=e.next;if(r!==null){e=r;break}else e.parent===this._root?e=null:e=e.parent._item}while(e!==null&&(e.deleted||!this._filter(e.content.type)));return this._firstCall=!1,e===null?{value:void 0,done:!0}:(this._currentNode=e,{value:e.content.type,done:!1})}}class Vs extends Bt{constructor(){super(),this._prelimContent=[]}get firstChild(){const e=this._first;return e?e.content.getContent()[0]:null}_integrate(e,n){super._integrate(e,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Vs}clone(){const e=new Vs;return e.insert(0,this.toArray().map(n=>n instanceof Bt?n.clone():n)),e}get length(){return this.doc??Zt(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new mp(this,e)}querySelector(e){e=e.toUpperCase();const r=new mp(this,o=>o.nodeName&&o.nodeName.toUpperCase()===e).next();return r.done?null:r.value}querySelectorAll(e){return e=e.toUpperCase(),zs(new mp(this,n=>n.nodeName&&n.nodeName.toUpperCase()===e))}_callObserver(e,n){Lf(this,e,new wZ(this,n,e))}toString(){return VR(this,e=>e.toString()).join("")}toJSON(){return this.toString()}toDOM(e=document,n={},r){const o=e.createDocumentFragment();return r!==void 0&&r._createAssociation(o,this),kl(this,s=>{o.insertBefore(s.toDOM(e,n,r),null)}),o}insert(e,n){this.doc!==null?Je(this.doc,r=>{qR(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}insertAfter(e,n){if(this.doc!==null)Je(this.doc,r=>{const o=e&&e instanceof Bt?e._item:e;xd(r,this,o,n)});else{const r=this._prelimContent,o=e===null?0:r.findIndex(s=>s===e)+1;if(o===0&&e!==null)throw rs("Reference item not found");r.splice(o,0,...n)}}delete(e,n=1){this.doc!==null?Je(this.doc,r=>{KR(r,this,e,n)}):this._prelimContent.splice(e,n)}toArray(){return UR(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return WR(this,e)}slice(e=0,n=this.length){return HR(this,e,n)}forEach(e){kl(this,e)}_write(e){e.writeTypeRef(BZ)}}const bZ=t=>new Vs;class Qt extends Vs{constructor(e="UNDEFINED"){super(),this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,n){super._integrate(e,n),this._prelimAttrs.forEach((r,o)=>{this.setAttribute(o,r)}),this._prelimAttrs=null}_copy(){return new Qt(this.nodeName)}clone(){const e=new Qt(this.nodeName),n=this.getAttributes();return tQ(n,(r,o)=>{typeof r=="string"&&e.setAttribute(o,r)}),e.insert(0,this.toArray().map(r=>r instanceof Bt?r.clone():r)),e}toString(){const e=this.getAttributes(),n=[],r=[];for(const a in e)r.push(a);r.sort();const o=r.length;for(let a=0;a<o;a++){const l=r[a];n.push(l+'="'+e[l]+'"')}const s=this.nodeName.toLocaleLowerCase(),i=n.length>0?" "+n.join(" "):"";return`<${s}${i}>${super.toString()}</${s}>`}removeAttribute(e){this.doc!==null?Je(this.doc,n=>{wd(n,this,e)}):this._prelimAttrs.delete(e)}setAttribute(e,n){this.doc!==null?Je(this.doc,r=>{Nv(r,this,e,n)}):this._prelimAttrs.set(e,n)}getAttribute(e){return _v(this,e)}hasAttribute(e){return JR(this,e)}getAttributes(e){return e?cZ(this,e):YR(this)}toDOM(e=document,n={},r){const o=e.createElement(this.nodeName),s=this.getAttributes();for(const i in s){const a=s[i];typeof a=="string"&&o.setAttribute(i,a)}return kl(this,i=>{o.appendChild(i.toDOM(e,n,r))}),r!==void 0&&r._createAssociation(o,this),o}_write(e){e.writeTypeRef($Z),e.writeKey(this.nodeName)}}const xZ=t=>new Qt(t.readKey());class wZ extends If{constructor(e,n,r){super(e,r),this.childListChanged=!1,this.attributesChanged=new Set,n.forEach(o=>{o===null?this.childListChanged=!0:this.attributesChanged.add(o)})}}class Ed extends Wi{constructor(e){super(),this.hookName=e}_copy(){return new Ed(this.hookName)}clone(){const e=new Ed(this.hookName);return this.forEach((n,r)=>{e.set(r,n)}),e}toDOM(e=document,n={},r){const o=n[this.hookName];let s;return o!==void 0?s=o.createDom(this):s=document.createElement(this.hookName),s.setAttribute("data-yjs-hook",this.hookName),r!==void 0&&r._createAssociation(s,this),s}_write(e){e.writeTypeRef(FZ),e.writeKey(this.hookName)}}const EZ=t=>new Ed(t.readKey());class An extends is{get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new An}clone(){const e=new An;return e.applyDelta(this.toDelta()),e}toDOM(e=document,n,r){const o=e.createTextNode(this.toString());return r!==void 0&&r._createAssociation(o,this),o}toString(){return this.toDelta().map(e=>{const n=[];for(const o in e.attributes){const s=[];for(const i in e.attributes[o])s.push({key:i,value:e.attributes[o][i]});s.sort((i,a)=>i.key<a.key?-1:1),n.push({nodeName:o,attrs:s})}n.sort((o,s)=>o.nodeName<s.nodeName?-1:1);let r="";for(let o=0;o<n.length;o++){const s=n[o];r+=`<${s.nodeName}`;for(let i=0;i<s.attrs.length;i++){const a=s.attrs[i];r+=` ${a.key}="${a.value}"`}r+=">"}r+=e.insert;for(let o=n.length-1;o>=0;o--)r+=`</${n[o].nodeName}>`;return r}).join("")}toJSON(){return this.toString()}_write(e){e.writeTypeRef(HZ)}}const SZ=t=>new An;class Dv{constructor(e,n){this.id=e,this.length=n}get deleted(){throw hr()}mergeWith(e){return!1}write(e,n,r){throw hr()}integrate(e,n){throw hr()}}const kZ=0;class qn extends Dv{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,n){n>0&&(this.id.clock+=n,this.length-=n),IR(e.doc.store,this)}write(e,n){e.writeInfo(kZ),e.writeLen(this.length-n)}getMissing(e,n){return null}}class nc{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new nc(this.content)}splice(e){throw hr()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeBuf(this.content)}getRef(){return 3}}const TZ=t=>new nc(t.readBuf());class Tl{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new Tl(this.len)}splice(e){const n=new Tl(this.len-e);return this.len=e,n}mergeWith(e){return this.len+=e.len,!0}integrate(e,n){xl(e.deleteSet,n.id.client,n.id.clock,this.len),n.markDeleted()}delete(e){}gc(e){}write(e,n){e.writeLen(this.len-n)}getRef(){return 1}}const CZ=t=>new Tl(t.readLen()),tN=(t,e)=>new ei({guid:t,...e,shouldLoad:e.shouldLoad||e.autoLoad||!1});class rc{constructor(e){e._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=e;const n={};this.opts=n,e.gc||(n.gc=!1),e.autoLoad&&(n.autoLoad=!0),e.meta!==null&&(n.meta=e.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new rc(tN(this.doc.guid,this.opts))}splice(e){throw hr()}mergeWith(e){return!1}integrate(e,n){this.doc._item=n,e.subdocsAdded.add(this.doc),this.doc.shouldLoad&&e.subdocsLoaded.add(this.doc)}delete(e){e.subdocsAdded.has(this.doc)?e.subdocsAdded.delete(this.doc):e.subdocsRemoved.add(this.doc)}gc(e){}write(e,n){e.writeString(this.doc.guid),e.writeAny(this.opts)}getRef(){return 9}}const AZ=t=>new rc(tN(t.readString(),t.readAny()));class ti{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new ti(this.embed)}splice(e){throw hr()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeJSON(this.embed)}getRef(){return 5}}const MZ=t=>new ti(t.readJSON());class kt{constructor(e,n){this.key=e,this.value=n}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new kt(this.key,this.value)}splice(e){throw hr()}mergeWith(e){return!1}integrate(e,n){const r=n.parent;r._searchMarker=null,r._hasFormatting=!0}delete(e){}gc(e){}write(e,n){e.writeKey(this.key),e.writeJSON(this.value)}getRef(){return 6}}const OZ=t=>new kt(t.readKey(),t.readJSON());class Sd{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new Sd(this.arr)}splice(e){const n=new Sd(this.arr.slice(e));return this.arr=this.arr.slice(0,e),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){const r=this.arr.length;e.writeLen(r-n);for(let o=n;o<r;o++){const s=this.arr[o];e.writeString(s===void 0?"undefined":JSON.stringify(s))}}getRef(){return 2}}const RZ=t=>{const e=t.readLen(),n=[];for(let r=0;r<e;r++){const o=t.readString();o==="undefined"?n.push(void 0):n.push(JSON.parse(o))}return new Sd(n)},NZ=yd("node_env")==="development";class Ws{constructor(e){this.arr=e,NZ&&yR(e)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new Ws(this.arr)}splice(e){const n=new Ws(this.arr.slice(e));return this.arr=this.arr.slice(0,e),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){const r=this.arr.length;e.writeLen(r-n);for(let o=n;o<r;o++){const s=this.arr[o];e.writeAny(s)}}getRef(){return 8}}const _Z=t=>{const e=t.readLen(),n=[];for(let r=0;r<e;r++)n.push(t.readAny());return new Ws(n)};class br{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new br(this.str)}splice(e){const n=new br(this.str.slice(e));this.str=this.str.slice(0,e);const r=this.str.charCodeAt(e-1);return r>=55296&&r<=56319&&(this.str=this.str.slice(0,e-1)+"�",n.str="�"+n.str.slice(1)),n}mergeWith(e){return this.str+=e.str,!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeString(n===0?this.str:this.str.slice(n))}getRef(){return 4}}const DZ=t=>new br(t.readString()),IZ=[dZ,hZ,vZ,xZ,bZ,EZ,SZ],PZ=0,LZ=1,jZ=2,$Z=3,BZ=4,FZ=5,HZ=6;class Sr{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new Sr(this.type._copy())}splice(e){throw hr()}mergeWith(e){return!1}integrate(e,n){this.type._integrate(e.doc,n)}delete(e){let n=this.type._start;for(;n!==null;)n.deleted?n.id.clock<(e.beforeState.get(n.id.client)||0)&&e._mergeStructs.push(n):n.delete(e),n=n.right;this.type._map.forEach(r=>{r.deleted?r.id.clock<(e.beforeState.get(r.id.client)||0)&&e._mergeStructs.push(r):r.delete(e)}),e.changed.delete(this.type)}gc(e){let n=this.type._start;for(;n!==null;)n.gc(e,!0),n=n.right;this.type._start=null,this.type._map.forEach(r=>{for(;r!==null;)r.gc(e,!0),r=r.left}),this.type._map=new Map}write(e,n){this.type._write(e)}getRef(){return 7}}const UZ=t=>new Sr(IZ[t.readTypeRef()](t)),Jm=(t,e)=>{let n=e,r=0,o;do r>0&&(n=De(n.client,n.clock+r)),o=Ti(t,n),r=n.clock-o.id.clock,n=o.redone;while(n!==null&&o instanceof nt);return{item:o,diff:r}},Iv=(t,e)=>{for(;t!==null&&t.keep!==e;)t.keep=e,t=t.parent._item},kd=(t,e,n)=>{const{client:r,clock:o}=e.id,s=new nt(De(r,o+n),e,De(r,o+n-1),e.right,e.rightOrigin,e.parent,e.parentSub,e.content.splice(n));return e.deleted&&s.markDeleted(),e.keep&&(s.keep=!0),e.redone!==null&&(s.redone=De(e.redone.client,e.redone.clock+n)),e.right=s,s.right!==null&&(s.right.left=s),t._mergeStructs.push(s),s.parentSub!==null&&s.right===null&&s.parent._map.set(s.parentSub,s),e.length=n,s},UE=(t,e)=>hX(t,n=>oa(n.deletions,e)),nN=(t,e,n,r,o,s)=>{const i=t.doc,a=i.store,l=i.clientID,c=e.redone;if(c!==null)return xn(t,c);let u=e.parent._item,d=null,f;if(u!==null&&u.deleted===!0){if(u.redone===null&&(!n.has(u)||nN(t,u,n,r,o,s)===null))return null;for(;u.redone!==null;)u=xn(t,u.redone)}const h=u===null?e.parent:u.content.type;if(e.parentSub===null){for(d=e.left,f=e;d!==null;){let v=d;for(;v!==null&&v.parent._item!==u;)v=v.redone===null?null:xn(t,v.redone);if(v!==null&&v.parent._item===u){d=v;break}d=d.left}for(;f!==null;){let v=f;for(;v!==null&&v.parent._item!==u;)v=v.redone===null?null:xn(t,v.redone);if(v!==null&&v.parent._item===u){f=v;break}f=f.right}}else if(f=null,e.right&&!o){for(d=e;d!==null&&d.right!==null&&(d.right.redone||oa(r,d.right.id)||UE(s.undoStack,d.right.id)||UE(s.redoStack,d.right.id));)for(d=d.right;d.redone;)d=xn(t,d.redone);if(d&&d.right!==null)return null}else d=h._map.get(e.parentSub)||null;const p=xt(a,l),m=De(l,p),y=new nt(m,d,d&&d.lastId,f,f&&f.id,h,e.parentSub,e.content.copy());return e.redone=m,Iv(y,!0),y.integrate(t,0),y};let nt=class Xm extends Dv{constructor(e,n,r,o,s,i,a,l){super(e,l.getLength()),this.origin=r,this.left=n,this.right=o,this.rightOrigin=s,this.parent=i,this.parentSub=a,this.redone=null,this.content=l,this.info=this.content.isCountable()?vE:0}set marker(e){(this.info&lp)>0!==e&&(this.info^=lp)}get marker(){return(this.info&lp)>0}get keep(){return(this.info&yE)>0}set keep(e){this.keep!==e&&(this.info^=yE)}get countable(){return(this.info&vE)>0}get deleted(){return(this.info&ap)>0}set deleted(e){this.deleted!==e&&(this.info^=ap)}markDeleted(){this.info|=ap}getMissing(e,n){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=xt(n,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=xt(n,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===ki&&this.id.client!==this.parent.client&&this.parent.clock>=xt(n,this.parent.client))return this.parent.client;if(this.origin&&(this.left=_E(e,n,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=xn(e,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===qn||this.right&&this.right.constructor===qn)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===Xm?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===Xm&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===ki){const r=Ti(n,this.parent);r.constructor===qn?this.parent=null:this.parent=r.content.type}return null}integrate(e,n){if(n>0&&(this.id.clock+=n,this.left=_E(e,e.doc.store,De(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(n),this.length-=n),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let r=this.left,o;if(r!==null)o=r.right;else if(this.parentSub!==null)for(o=this.parent._map.get(this.parentSub)||null;o!==null&&o.left!==null;)o=o.left;else o=this.parent._start;const s=new Set,i=new Set;for(;o!==null&&o!==this.right;){if(i.add(o),s.add(o),Pc(this.origin,o.origin)){if(o.id.client<this.id.client)r=o,s.clear();else if(Pc(this.rightOrigin,o.rightOrigin))break}else if(o.origin!==null&&i.has(Ti(e.doc.store,o.origin)))s.has(Ti(e.doc.store,o.origin))||(r=o,s.clear());else break;o=o.right}this.left=r}if(this.left!==null){const r=this.left.right;this.right=r,this.left.right=this}else{let r;if(this.parentSub!==null)for(r=this.parent._map.get(this.parentSub)||null;r!==null&&r.left!==null;)r=r.left;else r=this.parent._start,this.parent._start=this;this.right=r}this.right!==null?this.right.left=this:this.parentSub!==null&&(this.parent._map.set(this.parentSub,this),this.left!==null&&this.left.delete(e)),this.parentSub===null&&this.countable&&!this.deleted&&(this.parent._length+=this.length),IR(e.doc.store,this),this.content.integrate(e,this),IE(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new qn(this.id,this.length).integrate(e,0)}get next(){let e=this.right;for(;e!==null&&e.deleted;)e=e.right;return e}get prev(){let e=this.left;for(;e!==null&&e.deleted;)e=e.left;return e}get lastId(){return this.length===1?this.id:De(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&Pc(e.origin,this.lastId)&&this.right===e&&Pc(this.rightOrigin,e.rightOrigin)&&this.id.client===e.id.client&&this.id.clock+this.length===e.id.clock&&this.deleted===e.deleted&&this.redone===null&&e.redone===null&&this.content.constructor===e.content.constructor&&this.content.mergeWith(e.content)){const n=this.parent._searchMarker;return n&&n.forEach(r=>{r.p===e&&(r.p=this,!this.deleted&&this.countable&&(r.index-=this.length))}),e.keep&&(this.keep=!0),this.right=e.right,this.right!==null&&(this.right.left=this),this.length+=e.length,!0}return!1}delete(e){if(!this.deleted){const n=this.parent;this.countable&&this.parentSub===null&&(n._length-=this.length),this.markDeleted(),xl(e.deleteSet,this.id.client,this.id.clock,this.length),IE(e,n,this.parentSub),this.content.delete(e)}}gc(e,n){if(!this.deleted)throw Mn();this.content.gc(e),n?qQ(e,this,new qn(this.id,this.length)):this.content=new Tl(this.length)}write(e,n){const r=n>0?De(this.id.client,this.id.clock+n-1):this.origin,o=this.rightOrigin,s=this.parentSub,i=this.content.getRef()&Of|(r===null?0:an)|(o===null?0:co)|(s===null?0:yl);if(e.writeInfo(i),r!==null&&e.writeLeftID(r),o!==null&&e.writeRightID(o),r===null&&o===null){const a=this.parent;if(a._item!==void 0){const l=a._item;if(l===null){const c=wl(a);e.writeParentInfo(!0),e.writeString(c)}else e.writeParentInfo(!1),e.writeLeftID(l.id)}else a.constructor===String?(e.writeParentInfo(!0),e.writeString(a)):a.constructor===ki?(e.writeParentInfo(!1),e.writeLeftID(a)):Mn();s!==null&&e.writeString(s)}this.content.write(e,n)}};const rN=(t,e)=>zZ[e&Of](t),zZ=[()=>{Mn()},CZ,RZ,TZ,DZ,MZ,OZ,UZ,_Z,AZ,()=>{Mn()}],VZ=10;class cr extends Dv{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,n){Mn()}write(e,n){e.writeInfo(VZ),$e(e.restEncoder,this.length-n)}getMissing(e,n){return null}}const oN=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},sN="__ $YJS$ __";oN[sN]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");oN[sN]=!0;const WZ=()=>{let t=!0;return(e,n)=>{if(t){t=!1;try{e()}finally{t=!0}}else n!==void 0&&n()}},GZ=/[\uD800-\uDBFF]/,qZ=/[\uDC00-\uDFFF]/,KZ=(t,e)=>{let n=0,r=0;for(;n<t.length&&n<e.length&&t[n]===e[n];)n++;for(n>0&&GZ.test(t[n-1])&&n--;r+n<t.length&&r+n<e.length&&t[t.length-r-1]===e[e.length-r-1];)r++;return r>0&&qZ.test(t[t.length-r])&&r--,{index:n,remove:t.length-n-r,insert:e.slice(n,e.length-r)}},YZ=KZ,Fr=(t,e)=>t>>>e|t<<32-e,JZ=t=>Fr(t,2)^Fr(t,13)^Fr(t,22),XZ=t=>Fr(t,6)^Fr(t,11)^Fr(t,25),QZ=t=>Fr(t,7)^Fr(t,18)^t>>>3,ZZ=t=>Fr(t,17)^Fr(t,19)^t>>>10,eee=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),tee=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);class nee{constructor(){const e=new ArrayBuffer(320);this._H=new Uint32Array(e,0,8),this._H.set(tee),this._W=new Uint32Array(e,64,64)}_updateHash(){const e=this._H,n=this._W;for(let d=16;d<64;d++)n[d]=ZZ(n[d-2])+n[d-7]+QZ(n[d-15])+n[d-16];let r=e[0],o=e[1],s=e[2],i=e[3],a=e[4],l=e[5],c=e[6],u=e[7];for(let d=0,f,h;d<64;d++)f=u+XZ(a)+(a&l^~a&c)+eee[d]+n[d]>>>0,h=JZ(r)+(r&o^r&s^o&s)>>>0,u=c,c=l,l=a,a=i+f>>>0,i=s,s=o,o=r,r=f+h>>>0;e[0]+=r,e[1]+=o,e[2]+=s,e[3]+=i,e[4]+=a,e[5]+=l,e[6]+=c,e[7]+=u}digest(e){let n=0;for(;n+56<=e.length;){let i=0;for(;i<16&&n+3<e.length;i++)this._W[i]=e[n++]<<24|e[n++]<<16|e[n++]<<8|e[n++];if(n%64!==0){for(this._W.fill(0,i,16);n<e.length;)this._W[i]|=e[n]<<(3-n%4)*8,n++;this._W[i]|=an<<(3-n%4)*8}this._updateHash()}const r=n%64!==0;this._W.fill(0,0,16);let o=0;for(;n<e.length;o++)for(let i=3;i>=0&&n<e.length;i--)this._W[o]|=e[n++]<<i*8;r||(this._W[o-(n%4===0?0:1)]|=an<<(3-n%4)*8),this._W[14]=e.byteLength/pX,this._W[15]=e.byteLength*8,this._updateHash();const s=new Uint8Array(32);for(let i=0;i<this._H.length;i++)for(let a=0;a<4;a++)s[i*4+a]=this._H[i]>>>(3-a)*8;return s}}const ree=t=>new nee().digest(t),pt=new We("y-sync"),uo=new We("y-undo");new We("yjs-cursor");const oee=t=>{for(let n=6;n<t.length;n++)t[n%6]=t[n%6]^t[n];return t.slice(0,6)},see=t=>fQ(oee(ree(hQ(t)))),Td=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&e.sv.get(t.id.client)>t.id.clock&&!oa(e.ds,t.id),iee=[{light:"#ecd44433",dark:"#ecd444"}],aee=(t,e,n)=>{if(!t.has(n)){if(t.size<e.length){const r=Us();t.forEach(o=>r.add(o)),e=e.filter(o=>!r.has(o))}t.set(n,qX(e))}return t.get(n)},lee=(t,{colors:e=iee,colorMapping:n=new Map,permanentUserData:r=null,onFirstRender:o=()=>{},mapping:s}={})=>{let i=!1;const a=new uee(t,s),l=new Ue({props:{editable:c=>{const u=pt.getState(c);return u.snapshot==null&&u.prevSnapshot==null}},key:pt,state:{init:(c,u)=>({type:t,doc:t.doc,binding:a,snapshot:null,prevSnapshot:null,isChangeOrigin:!1,isUndoRedoOperation:!1,addToHistory:!0,colors:e,colorMapping:n,permanentUserData:r}),apply:(c,u)=>{const d=c.getMeta(pt);if(d!==void 0){u=Object.assign({},u);for(const f in d)u[f]=d[f]}return u.addToHistory=c.getMeta("addToHistory")!==!1,u.isChangeOrigin=d!==void 0&&!!d.isChangeOrigin,u.isUndoRedoOperation=d!==void 0&&!!d.isChangeOrigin&&!!d.isUndoRedoOperation,a.prosemirrorView!==null&&d!==void 0&&(d.snapshot!=null||d.prevSnapshot!=null)&&xR(0,()=>{a.prosemirrorView!=null&&(d.restore==null?a._renderSnapshot(d.snapshot,d.prevSnapshot,u):(a._renderSnapshot(d.snapshot,d.snapshot,u),delete u.restore,delete u.snapshot,delete u.prevSnapshot,a.mux(()=>{a._prosemirrorChanged(a.prosemirrorView.state.doc)})))}),u}},view:c=>(a.initView(c),s==null&&a._forceRerender(),o(),{update:()=>{const u=l.getState(c.state);if(u.snapshot==null&&u.prevSnapshot==null&&(i||c.state.doc.content.findDiffStart(c.state.doc.type.createAndFill().content)!==null)){if(i=!0,u.addToHistory===!1&&!u.isChangeOrigin){const d=uo.getState(c.state),f=d&&d.undoManager;f&&f.stopCapturing()}a.mux(()=>{u.doc.transact(d=>{d.meta.set("addToHistory",u.addToHistory),a._prosemirrorChanged(c.state.doc)},pt)})}},destroy:()=>{a.destroy()}})});return l},cee=(t,e,n)=>{if(e!==null&&e.anchor!==null&&e.head!==null)if(e.type==="all")t.setSelection(new Sn(t.doc));else if(e.type==="node"){const r=iu(n.doc,n.type,e.anchor,n.mapping);t.setSelection(ue.create(t.doc,r))}else{const r=iu(n.doc,n.type,e.anchor,n.mapping),o=iu(n.doc,n.type,e.head,n.mapping);r!==null&&o!==null&&t.setSelection(pe.between(t.doc.resolve(r),t.doc.resolve(o)))}},Qm=(t,e)=>({type:e.selection.jsonID,anchor:ng(e.selection.anchor,t.type,t.mapping),head:ng(e.selection.head,t.type,t.mapping)});class uee{constructor(e,n=new Map){this.type=e,this.prosemirrorView=null,this.mux=WZ(),this.mapping=n,this.isOMark=new Map,this._observeFunction=this._typeChanged.bind(this),this.doc=e.doc,this.beforeTransactionSelection=null,this.beforeAllTransactions=()=>{this.beforeTransactionSelection===null&&this.prosemirrorView!=null&&(this.beforeTransactionSelection=Qm(this,this.prosemirrorView.state))},this.afterAllTransactions=()=>{this.beforeTransactionSelection=null},this._domSelectionInView=null}get _tr(){return this.prosemirrorView.state.tr.setMeta("addToHistory",!1)}_isLocalCursorInView(){return this.prosemirrorView.hasFocus()?(vR&&this._domSelectionInView===null&&(xR(0,()=>{this._domSelectionInView=null}),this._domSelectionInView=this._isDomSelectionInView()),this._domSelectionInView):!1}_isDomSelectionInView(){const e=this.prosemirrorView._root.getSelection();if(e==null||e.anchorNode==null)return!1;const n=this.prosemirrorView._root.createRange();n.setStart(e.anchorNode,e.anchorOffset),n.setEnd(e.focusNode,e.focusOffset),n.getClientRects().length===0&&n.startContainer&&n.collapsed&&n.selectNodeContents(n.startContainer);const o=n.getBoundingClientRect(),s=mQ.documentElement;return o.bottom>=0&&o.right>=0&&o.left<=(window.innerWidth||s.clientWidth||0)&&o.top<=(window.innerHeight||s.clientHeight||0)}renderSnapshot(e,n){n||(n=_R(MR(),new Map)),this.prosemirrorView.dispatch(this._tr.setMeta(pt,{snapshot:e,prevSnapshot:n}))}unrenderSnapshot(){this.mapping.clear(),this.mux(()=>{const e=this.type.toArray().map(r=>su(r,this.prosemirrorView.state.schema,this)).filter(r=>r!==null),n=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new ee(F.from(e),0,0));n.setMeta(pt,{snapshot:null,prevSnapshot:null}),this.prosemirrorView.dispatch(n)})}_forceRerender(){this.mapping.clear(),this.mux(()=>{const e=this.beforeTransactionSelection!==null?null:this.prosemirrorView.state.selection,n=this.type.toArray().map(o=>su(o,this.prosemirrorView.state.schema,this)).filter(o=>o!==null),r=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new ee(F.from(n),0,0));if(e){const o=Ui(ns(e.anchor,0),r.doc.content.size),s=Ui(ns(e.head,0),r.doc.content.size);r.setSelection(pe.create(r.doc,o,s))}this.prosemirrorView.dispatch(r.setMeta(pt,{isChangeOrigin:!0,binding:this}))})}_renderSnapshot(e,n,r){let o=this.doc,s=this.type;if(e||(e=hp(this.doc)),e instanceof Uint8Array||n instanceof Uint8Array)if((!(e instanceof Uint8Array)||!(n instanceof Uint8Array))&&Mn(),o=new ei({gc:!1}),Gm(o,n),n=hp(o),Gm(o,e),e=hp(o),s._item===null){const i=Array.from(this.doc.share.keys()).find(a=>this.doc.share.get(a)===this.type);s=o.getXmlFragment(i)}else{const i=o.store.clients.get(s._item.id.client)??[],a=vr(i,s._item.id.clock);s=i[a].content.type}this.mapping.clear(),this.mux(()=>{o.transact(i=>{const a=r.permanentUserData;a&&a.dss.forEach(d=>{ss(i,d,f=>{})});const l=(d,f)=>{const h=d==="added"?a.getUserByClientId(f.client):a.getUserByDeletedId(f);return{user:h,type:d,color:aee(r.colorMapping,r.colors,h)}},c=zR(s,new Ov(n.ds,e.sv)).map(d=>!d._item.deleted||Td(d._item,e)||Td(d._item,n)?su(d,this.prosemirrorView.state.schema,{mapping:new Map,isOMark:new Map},e,n,l):null).filter(d=>d!==null),u=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new ee(F.from(c),0,0));this.prosemirrorView.dispatch(u.setMeta(pt,{isChangeOrigin:!0}))},pt)})}_typeChanged(e,n){if(this.prosemirrorView==null)return;const r=pt.getState(this.prosemirrorView.state);if(e.length===0||r.snapshot!=null||r.prevSnapshot!=null){this.renderSnapshot(r.snapshot,r.prevSnapshot);return}this.mux(()=>{const o=(a,l)=>this.mapping.delete(l);ss(n,n.deleteSet,a=>{if(a.constructor===nt){const l=a.content.type;l&&this.mapping.delete(l)}}),n.changed.forEach(o),n.changedParentTypes.forEach(o);const s=this.type.toArray().map(a=>iN(a,this.prosemirrorView.state.schema,this)).filter(a=>a!==null);let i=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new ee(F.from(s),0,0));cee(i,this.beforeTransactionSelection,this),i=i.setMeta(pt,{isChangeOrigin:!0,isUndoRedoOperation:n.origin instanceof jR}),this.beforeTransactionSelection!==null&&this._isLocalCursorInView()&&i.scrollIntoView(),this.prosemirrorView.dispatch(i)})}_prosemirrorChanged(e){this.doc.transact(()=>{eg(this.doc,this.type,e,this),this.beforeTransactionSelection=Qm(this,this.prosemirrorView.state)},pt)}initView(e){this.prosemirrorView!=null&&this.destroy(),this.prosemirrorView=e,this.doc.on("beforeAllTransactions",this.beforeAllTransactions),this.doc.on("afterAllTransactions",this.afterAllTransactions),this.type.observeDeep(this._observeFunction)}destroy(){this.prosemirrorView!=null&&(this.prosemirrorView=null,this.type.unobserveDeep(this._observeFunction),this.doc.off("beforeAllTransactions",this.beforeAllTransactions),this.doc.off("afterAllTransactions",this.afterAllTransactions))}}const iN=(t,e,n,r,o,s)=>{const i=n.mapping.get(t);if(i===void 0){if(t instanceof Qt)return su(t,e,n,r,o,s);throw hr()}return i},su=(t,e,n,r,o,s)=>{const i=[],a=l=>{if(l instanceof Qt){const c=iN(l,e,n,r,o,s);c!==null&&i.push(c)}else{const c=l._item.right?.content?.type;c instanceof is&&!c._item.deleted&&c._item.id.client===c.doc.clientID&&(l.applyDelta([{retain:l.length},...c.toDelta()]),c.doc.transact(d=>{c._item.delete(d)}));const u=dee(l,e,n,r,o,s);u!==null&&u.forEach(d=>{d!==null&&i.push(d)})}};r===void 0||o===void 0?t.toArray().forEach(a):zR(t,new Ov(o.ds,r.sv)).forEach(a);try{const l=t.getAttributes(r);r!==void 0&&(Td(t._item,r)?Td(t._item,o)||(l.ychange=s?s("added",t._item.id):{type:"added"}):l.ychange=s?s("removed",t._item.id):{type:"removed"});const c=e.node(t.nodeName,l,i);return n.mapping.set(t,c),c}catch{return t.doc.transact(c=>{t._item.delete(c)},pt),n.mapping.delete(t),null}},dee=(t,e,n,r,o,s)=>{const i=[],a=t.toDelta(r,o,s);try{for(let l=0;l<a.length;l++){const c=a[l];i.push(e.text(c.insert,yee(c.attributes,e)))}}catch{return t.doc.transact(c=>{t._item.delete(c)},pt),null}return i},fee=(t,e)=>{const n=new An,r=t.map(o=>({insert:o.text,attributes:lN(o.marks,e)}));return n.applyDelta(r),e.mapping.set(n,t),n},hee=(t,e)=>{const n=new Qt(t.type.name);for(const r in t.attrs){const o=t.attrs[r];o!==null&&r!=="ychange"&&n.setAttribute(r,o)}return n.insert(0,jf(t).map(r=>Zm(r,e))),e.mapping.set(n,t),n},Zm=(t,e)=>t instanceof Array?fee(t,e):hee(t,e),zE=t=>typeof t=="object"&&t!==null,Pv=(t,e)=>{const n=Object.keys(t).filter(o=>t[o]!==null);let r=n.length===Object.keys(e).filter(o=>e[o]!==null).length;for(let o=0;o<n.length&&r;o++){const s=n[o],i=t[s],a=e[s];r=s==="ychange"||i===a||zE(i)&&zE(a)&&Pv(i,a)}return r},jf=t=>{const e=t.content.content,n=[];for(let r=0;r<e.length;r++){const o=e[r];if(o.isText){const s=[];for(let i=e[r];r<e.length&&i.isText;i=e[++r])s.push(i);r--,n.push(s)}else n.push(o)}return n},aN=(t,e)=>{const n=t.toDelta();return n.length===e.length&&n.every((r,o)=>r.insert===e[o].text&&mR(r.attributes||{}).length===e[o].marks.length&&gR(r.attributes,(s,i)=>{const a=Lv(i),l=e[o].marks;return Pv(s,l.find(c=>c.type.name===a)?.attrs)}))},Cl=(t,e)=>{if(t instanceof Qt&&!(e instanceof Array)&&tg(t,e)){const n=jf(e);return t._length===n.length&&Pv(t.getAttributes(),e.attrs)&&t.toArray().every((r,o)=>Cl(r,n[o]))}return t instanceof An&&e instanceof Array&&aN(t,e)},Cd=(t,e)=>t===e||t instanceof Array&&e instanceof Array&&t.length===e.length&&t.every((n,r)=>e[r]===n),VE=(t,e,n)=>{const r=t.toArray(),o=jf(e),s=o.length,i=r.length,a=Ui(i,s);let l=0,c=0,u=!1;for(;l<a;l++){const d=r[l],f=o[l];if(Cd(n.mapping.get(d),f))u=!0;else if(!Cl(d,f))break}for(;l+c<a;c++){const d=r[i-c-1],f=o[s-c-1];if(Cd(n.mapping.get(d),f))u=!0;else if(!Cl(d,f))break}return{equalityFactor:l+c,foundMappedChild:u}},pee=t=>{let e="",n=t._start;const r={};for(;n!==null;)n.deleted||(n.countable&&n.content instanceof br?e+=n.content.str:n.content instanceof kt&&(r[n.content.key]=null)),n=n.right;return{str:e,nAttrs:r}},mee=(t,e,n)=>{n.mapping.set(t,e);const{nAttrs:r,str:o}=pee(t),s=e.map(c=>({insert:c.text,attributes:Object.assign({},r,lN(c.marks,n))})),{insert:i,remove:a,index:l}=YZ(o,s.map(c=>c.insert).join(""));t.delete(l,a),t.insert(l,i),t.applyDelta(s.map(c=>({retain:c.insert.length,attributes:c.attributes})))},gee=/(.*)(--[a-zA-Z0-9+/=]{8})$/,Lv=t=>gee.exec(t)?.[1]??t,yee=(t,e)=>{const n=[];for(const r in t)n.push(e.mark(Lv(r),t[r]));return n},lN=(t,e)=>{const n={};return t.forEach(r=>{if(r.type.name!=="ychange"){const o=ko(e.isOMark,r.type,()=>!r.type.excludes(r.type));n[o?`${r.type.name}--${see(r.toJSON())}`:r.type.name]=r.attrs}}),n},eg=(t,e,n,r)=>{if(e instanceof Qt&&e.nodeName!==n.type.name)throw new Error("node name mismatch!");if(r.mapping.set(e,n),e instanceof Qt){const d=e.getAttributes(),f=n.attrs;for(const h in f)f[h]!==null?d[h]!==f[h]&&h!=="ychange"&&e.setAttribute(h,f[h]):e.removeAttribute(h);for(const h in d)f[h]===void 0&&e.removeAttribute(h)}const o=jf(n),s=o.length,i=e.toArray(),a=i.length,l=Ui(s,a);let c=0,u=0;for(;c<l;c++){const d=i[c],f=o[c];if(!Cd(r.mapping.get(d),f))if(Cl(d,f))r.mapping.set(d,f);else break}for(;u+c+1<l;u++){const d=i[a-u-1],f=o[s-u-1];if(!Cd(r.mapping.get(d),f))if(Cl(d,f))r.mapping.set(d,f);else break}t.transact(()=>{for(;a-c-u>0&&s-c-u>0;){const f=i[c],h=o[c],p=i[a-u-1],m=o[s-u-1];if(f instanceof An&&h instanceof Array)aN(f,h)||mee(f,h,r),c+=1;else{let y=f instanceof Qt&&tg(f,h),v=p instanceof Qt&&tg(p,m);if(y&&v){const w=VE(f,h,r),E=VE(p,m,r);w.foundMappedChild&&!E.foundMappedChild?v=!1:!w.foundMappedChild&&E.foundMappedChild||w.equalityFactor<E.equalityFactor?y=!1:v=!1}y?(eg(t,f,h,r),c+=1):v?(eg(t,p,m,r),u+=1):(r.mapping.delete(e.get(c)),e.delete(c,1),e.insert(c,[Zm(h,r)]),c+=1)}}const d=a-c-u;if(a===1&&s===0&&i[0]instanceof An?(r.mapping.delete(i[0]),i[0].delete(0,i[0].length)):d>0&&(e.slice(c,c+d).forEach(f=>r.mapping.delete(f)),e.delete(c,d)),c+u<s){const f=[];for(let h=c;h<s-u;h++)f.push(Zm(o[h],r));e.insert(c,f)}},pt)},tg=(t,e)=>!(e instanceof Array)&&t.nodeName===e.type.name,ng=(t,e,n)=>{if(t===0)return fp(e,0,-1);let r=e._first===null?null:e._first.content.type;for(;r!==null&&e!==r;){if(r instanceof An){if(r._length>=t)return fp(r,t,-1);if(t-=r._length,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{do r=r._item===null?null:r._item.parent,t--;while(r!==e&&r!==null&&r._item!==null&&r._item.next===null);r!==null&&r!==e&&(r=r._item===null?null:r._item.next.content.type)}}else{const o=(n.get(r)||{nodeSize:0}).nodeSize;if(r._first!==null&&t<o)r=r._first.content.type,t--;else{if(t===1&&r._length===0&&o>1)return new bd(r._item===null?null:r._item.id,r._item===null?wl(r):null,null);if(t-=o,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{if(t===0)return r=r._item===null?r:r._item.parent,new bd(r._item===null?null:r._item.id,r._item===null?wl(r):null,null);do r=r._item.parent,t--;while(r!==e&&r._item.next===null);r!==e&&(r=r._item.next.content.type)}}}if(r===null)throw Mn();if(t===0&&r.constructor!==An&&r!==e)return vee(r._item.parent,r._item)}return fp(e,e._length,-1)},vee=(t,e)=>{let n=null,r=null;return t._item===null?r=wl(t):n=De(t._item.id.client,t._item.id.clock),new bd(n,r,e.id)},iu=(t,e,n,r)=>{const o=WQ(n,t);if(o===null||o.type!==e&&!El(e,o.type._item))return null;let s=o.type,i=0;if(s.constructor===An)i=o.index;else if(s._item===null||!s._item.deleted){let a=s._first,l=0;for(;l<s._length&&l<o.index&&a!==null;){if(!a.deleted){const c=a.content.type;l++,c instanceof An?i+=c._length:i+=r.get(c).nodeSize}a=a.right}i+=1}for(;s!==e&&s._item!==null;){const a=s._item.parent;if(a._item===null||!a._item.deleted){i+=1;let l=a._first;for(;l!==null;){const c=l.content.type;if(c===s)break;l.deleted||(c instanceof An?i+=c._length:i+=r.get(c).nodeSize),l=l.right}}s=a}return i-1};function bee(t){const e=t.toArray(),n=r=>{let o;if(r instanceof An)o=r.toDelta().map(i=>{const a={type:"text",text:i.insert};return i.attributes&&(a.marks=Object.keys(i.attributes).map(l=>{const c=i.attributes[l],d={type:Lv(l)};return Object.keys(c)&&(d.attrs=c),d})),a});else if(r instanceof Qt){o={type:r.nodeName};const s=r.getAttributes();Object.keys(s).length&&(o.attrs=s);const i=r.toArray();i.length&&(o.content=i.map(n).flat())}else Mn();return o};return{type:"doc",content:e.map(n)}}const xee=t=>{const e=uo.getState(t).undoManager;if(e!=null)return e.undo(),!0},wee=t=>{const e=uo.getState(t).undoManager;if(e!=null)return e.redo(),!0},Eee=new Set(["paragraph"]),See=(t,e)=>!(t instanceof nt)||!(t.content instanceof Sr)||!(t.content.type instanceof is||t.content.type instanceof Qt&&e.has(t.content.type.nodeName))||t.content.type._length===0,kee=({protectedNodes:t=Eee,trackedOrigins:e=[],undoManager:n=null}={})=>new Ue({key:uo,state:{init:(r,o)=>{const s=pt.getState(o),i=n||new jR(s.type,{trackedOrigins:new Set([pt].concat(e)),deleteFilter:a=>See(a,t),captureTransaction:a=>a.meta.get("addToHistory")!==!1});return{undoManager:i,prevSel:null,hasUndoOps:i.undoStack.length>0,hasRedoOps:i.redoStack.length>0}},apply:(r,o,s,i)=>{const a=pt.getState(i).binding,l=o.undoManager,c=l.undoStack.length>0,u=l.redoStack.length>0;return a?{undoManager:l,prevSel:Qm(a,s),hasUndoOps:c,hasRedoOps:u}:c!==o.hasUndoOps||u!==o.hasRedoOps?Object.assign({},o,{hasUndoOps:l.undoStack.length>0,hasRedoOps:l.redoStack.length>0}):o}},view:r=>{const o=pt.getState(r.state),s=uo.getState(r.state).undoManager;return s.on("stack-item-added",({stackItem:i})=>{const a=o.binding;a&&i.meta.set(a,uo.getState(r.state).prevSel)}),s.on("stack-item-popped",({stackItem:i})=>{const a=o.binding;a&&(a.beforeTransactionSelection=i.meta.get(a)||a.beforeTransactionSelection)}),{destroy:()=>{s.destroy()}}}});Qe.create({name:"collaboration",priority:1e3,addOptions(){return{document:null,field:"default",fragment:null,provider:null}},addStorage(){return{isDisabled:!1}},onCreate(){this.editor.extensionManager.extensions.find(t=>t.name==="undoRedo")&&console.warn('[tiptap warn]: "@tiptap/extension-collaboration" comes with its own history support and is not compatible with "@tiptap/extension-undo-redo".')},addCommands(){return{undo:()=>({tr:t,state:e,dispatch:n})=>(t.setMeta("preventDispatch",!0),uo.getState(e).undoManager.undoStack.length===0?!1:n?xee(e):!0),redo:()=>({tr:t,state:e,dispatch:n})=>(t.setMeta("preventDispatch",!0),uo.getState(e).undoManager.redoStack.length===0?!1:n?wee(e):!0)}},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-y":()=>this.editor.commands.redo(),"Shift-Mod-z":()=>this.editor.commands.redo()}},addProseMirrorPlugins(){var t;const e=this.options.fragment?this.options.fragment:this.options.document.getXmlFragment(this.options.field),n=kee(this.options.yUndoOptions),r=n.spec.view;n.spec.view=i=>{const{undoManager:a}=uo.getState(i.state);a.restore&&(a.restore(),a.restore=()=>{});const l=r?r(i):void 0;return{destroy:()=>{const c=a.trackedOrigins.has(a),u=a._observers;a.restore=()=>{c&&a.trackedOrigins.add(a),a.doc.on("afterTransaction",a.afterTransactionHandler),a._observers=u},l?.destroy&&l.destroy()}}};const o={...this.options.ySyncOptions,onFirstRender:this.options.onFirstRender},s=lee(e,o);return this.editor.options.enableContentCheck&&((t=e.doc)==null||t.on("beforeTransaction",()=>{try{const i=bee(e);if(i.content.length===0)return;this.editor.schema.nodeFromJSON(i).check()}catch(i){return this.editor.emit("contentError",{error:i,editor:this.editor,disableCollaboration:()=>{var a;(a=e.doc)==null||a.destroy(),this.storage.isDisabled=!0}}),!1}})),[s,n,this.editor.options.enableContentCheck&&new Ue({key:new We("filterInvalidContent"),filterTransaction:()=>{var i;return this.storage.isDisabled!==!1&&((i=e.doc)==null||i.destroy()),!0}})].filter(Boolean)}});function Tee(t){return!!t.getMeta(pt)}function WE(t){if(!t.length)return et.empty;const e=[],n=t[0].$from.node(0);return t.forEach(r=>{const o=r.$from.pos,s=r.$from.nodeAfter;s&&e.push(Gt.node(o,o+s.nodeSize,{class:"ProseMirror-selectednoderange"}))}),et.create(n,e)}function $f(t,e,n){const r=[],o=t.node(0);typeof n=="number"&&n>=0||(t.sameParent(e)?n=Math.max(0,t.sharedDepth(e.pos)-1):n=t.sharedDepth(e.pos));const s=new Ga(t,e,n),i=s.depth===0?0:o.resolve(s.start).posAtIndex(0);return s.parent.forEach((a,l)=>{const c=i+l,u=c+a.nodeSize;if(c<s.start||c>=s.end)return;const d=new Qk(o.resolve(c),o.resolve(u));r.push(d)}),r}var Cee=class cN{constructor(e,n){this.anchor=e,this.head=n}map(e){return new cN(e.map(this.anchor),e.map(this.head))}resolve(e){const n=e.resolve(this.anchor),r=e.resolve(this.head);return new Vo(n,r)}},Vo=class _o extends Oe{constructor(e,n,r,o=1){const{doc:s}=e,i=e===n,a=e.pos===s.content.size&&n.pos===s.content.size,l=i&&!a?s.resolve(n.pos+(o>0?1:-1)):n,c=i&&a?s.resolve(e.pos-(o>0?1:-1)):e,u=$f(c.min(l),c.max(l),r),d=l.pos>=e.pos?u[0].$from:u[u.length-1].$to,f=l.pos>=e.pos?u[u.length-1].$to:u[0].$from;super(d,f,u),this.depth=r}get $to(){return this.ranges[this.ranges.length-1].$to}eq(e){return e instanceof _o&&e.$from.pos===this.$from.pos&&e.$to.pos===this.$to.pos}map(e,n){const r=e.resolve(n.map(this.anchor)),o=e.resolve(n.map(this.head));return new _o(r,o)}toJSON(){return{type:"nodeRange",anchor:this.anchor,head:this.head}}get isForwards(){return this.head>=this.anchor}get isBackwards(){return!this.isForwards}extendBackwards(){const{doc:e}=this.$from;if(this.isForwards&&this.ranges.length>1){const o=this.ranges.slice(0,-1),s=o[0].$from,i=o[o.length-1].$to;return new _o(s,i,this.depth)}const n=this.ranges[0],r=e.resolve(Math.max(0,n.$from.pos-1));return new _o(this.$anchor,r,this.depth)}extendForwards(){const{doc:e}=this.$from;if(this.isBackwards&&this.ranges.length>1){const o=this.ranges.slice(1),s=o[0].$from,i=o[o.length-1].$to;return new _o(i,s,this.depth)}const n=this.ranges[this.ranges.length-1],r=e.resolve(Math.min(e.content.size,n.$to.pos+1));return new _o(this.$anchor,r,this.depth)}static fromJSON(e,n){return new _o(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r,o,s=1){return new this(e.resolve(n),e.resolve(r),o,s)}getBookmark(){return new Cee(this.anchor,this.head)}};Vo.prototype.visible=!1;function Bc(t){return t instanceof Vo}Qe.create({name:"nodeRange",addOptions(){return{depth:void 0,key:"Mod"}},addKeyboardShortcuts(){return{"Shift-ArrowUp":({editor:t})=>{const{depth:e}=this.options,{view:n,state:r}=t,{doc:o,selection:s,tr:i}=r,{anchor:a,head:l}=s;if(!Bc(s)){const u=Vo.create(o,a,l,e,-1);return i.setSelection(u),n.dispatch(i),!0}const c=s.extendBackwards();return i.setSelection(c),n.dispatch(i),!0},"Shift-ArrowDown":({editor:t})=>{const{depth:e}=this.options,{view:n,state:r}=t,{doc:o,selection:s,tr:i}=r,{anchor:a,head:l}=s;if(!Bc(s)){const u=Vo.create(o,a,l,e);return i.setSelection(u),n.dispatch(i),!0}const c=s.extendForwards();return i.setSelection(c),n.dispatch(i),!0},"Mod-a":({editor:t})=>{const{depth:e}=this.options,{view:n,state:r}=t,{doc:o,tr:s}=r,i=Vo.create(o,0,o.content.size,e);return s.setSelection(i),n.dispatch(s),!0}}},onSelectionUpdate(){const{selection:t}=this.editor.state;Bc(t)&&this.editor.view.dom.classList.add("ProseMirror-noderangeselection")},addProseMirrorPlugins(){let t=!1,e=!1;return[new Ue({key:new We("nodeRange"),props:{attributes:()=>t?{class:"ProseMirror-noderangeselection"}:{class:""},handleDOMEvents:{mousedown:(n,r)=>{const{key:o}=this.options,s=/Mac/.test(navigator.platform),i=!!r.shiftKey,a=!!r.ctrlKey,l=!!r.altKey,c=!!r.metaKey,u=s?c:a;return(o==null||o==="Shift"&&i||o==="Control"&&a||o==="Alt"&&l||o==="Meta"&&c||o==="Mod"&&u)&&(e=!0),e&&document.addEventListener("mouseup",()=>{e=!1;const{state:d}=n,{doc:f,selection:h,tr:p}=d,{$anchor:m,$head:y}=h;if(m.sameParent(y))return;const v=Vo.create(f,m.pos,y.pos,this.options.depth);p.setSelection(v),n.dispatch(p)},{once:!0}),!1}},decorations:n=>{const{selection:r}=n,o=Bc(r);if(t=!1,!e)return o?(t=!0,WE(r.ranges)):null;const{$from:s,$to:i}=r;if(!o&&s.sameParent(i))return null;const a=$f(s,i,this.options.depth);return a.length?(t=!0,WE(a)):null}}})]}});function Aee(t){let e="";const n=getComputedStyle(t);for(let r=0;r<n.length;r+=1)e+=`${n[r]}:${n.getPropertyValue(n[r])};`;return e}function Mee(t){const e=t.cloneNode(!0),n=[t,...Array.from(t.getElementsByTagName("*"))],r=[e,...Array.from(e.getElementsByTagName("*"))];return n.forEach((o,s)=>{r[s].style.cssText=Aee(o)}),e}var uN=t=>{const{x:e,y:n,direction:r="right",editor:o,bandHeight:s=5}=t,i={top:n-s,bottom:n+s,left:r==="right"?e:0,right:r==="right"?window.innerWidth-e:e},l=[...o.view.dom.querySelectorAll("*")].filter(h=>o.view.posAtDOM(h,0)>=0).filter(h=>{const p=h.getBoundingClientRect();return!(p.bottom<i.top||p.top>i.bottom||p.right<i.left||p.left>i.right)});if(!l||l.length===0)return{resultElement:null,resultNode:null,pos:null};const c=l[0],u=o.view.posAtDOM(c,0);if(u===-1)return{resultElement:c,resultNode:null,pos:null};const d=o.state.doc.resolve(u);if(d.nodeAfter){const h=o.view.nodeDOM(d.pos);if(h&&h===c)return{resultElement:c,resultNode:d.nodeAfter,pos:u}}const f=o.state.doc.nodeAt(u-1);return{resultElement:c,resultNode:f,pos:u}};function Fc(t,e){return window.getComputedStyle(t)[e]}function Oee(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function Ree(t,e,n){const r=parseInt(Fc(t.dom,"paddingLeft"),10),o=parseInt(Fc(t.dom,"paddingRight"),10),s=parseInt(Fc(t.dom,"borderLeftWidth"),10),i=parseInt(Fc(t.dom,"borderLeftWidth"),10),a=t.dom.getBoundingClientRect();return{left:Oee(e,a.left+r+s,a.right-o-i),top:n}}function dN(t){var e;(e=t.parentNode)==null||e.removeChild(t)}function Nee(t,e){const{doc:n}=e.view.state,r=uN({editor:e,x:t.clientX,y:t.clientY,direction:"right"});if(!r.resultNode||r.pos===null)return[];const o=t.clientX,s=Ree(e.view,o,t.clientY),i=e.view.posAtCoords(s);if(!i)return[];const{pos:a}=i;if(!n.resolve(a).parent)return[];const c=n.resolve(r.pos),u=n.resolve(r.pos+1);return $f(c,u,0)}function _ee(t,e){const{view:n}=e;if(!t.dataTransfer)return;const{empty:r,$from:o,$to:s}=n.state.selection,i=Nee(t,e),a=$f(o,s,0),l=a.some(y=>i.find(v=>v.$from===y.$from&&v.$to===y.$to)),c=r||!l?i:a;if(!c.length)return;const{tr:u}=n.state,d=document.createElement("div"),f=c[0].$from.pos,h=c[c.length-1].$to.pos,p=Vo.create(n.state.doc,f,h),m=p.content();c.forEach(y=>{const v=n.nodeDOM(y.$from.pos),w=Mee(v);d.append(w)}),d.style.position="absolute",d.style.top="-10000px",document.body.append(d),t.dataTransfer.clearData(),t.dataTransfer.setDragImage(d,0,0),n.dragging={slice:m,move:!0},u.setSelection(p),n.dispatch(u),document.addEventListener("drop",()=>dN(d),{once:!0})}var GE=(t,e)=>{const n=t.resolve(e),{depth:r}=n;return r===0?e:n.pos-n.parentOffset-1},qE=(t,e)=>{const n=t.nodeAt(e),r=t.resolve(e);let{depth:o}=r,s=n;for(;o>0;){const i=r.node(o);o-=1,o===0&&(s=i)}return s},gp=(t,e)=>{const n=pt.getState(t);return n?ng(e,n.type,n.binding.mapping):null},Dee=(t,e)=>{const n=pt.getState(t);return n?iu(n.doc,n.type,e,n.binding.mapping)||0:-1},KE=(t,e)=>{let n=e;for(;n?.parentNode&&n.parentNode!==t.dom;)n=n.parentNode;return n},fN=new We("dragHandle"),hN=({pluginKey:t=fN,element:e,editor:n,computePositionConfig:r,getReferencedVirtualElement:o,onNodeChange:s,onElementDragStart:i,onElementDragEnd:a})=>{const l=document.createElement("div");let c=!1,u=null,d=-1,f,h=null,p=null;function m(){e&&(e.style.visibility="hidden",e.style.pointerEvents="none")}function y(){if(e){if(!n.isEditable){m();return}e.style.visibility="",e.style.pointerEvents="auto"}}function v(x){const T=o?.()||{getBoundingClientRect:()=>x.getBoundingClientRect()};UT(T,e,r).then(S=>{Object.assign(e.style,{position:S.strategy,left:`${S.x}px`,top:`${S.y}px`})})}function w(x){i?.(x),_ee(x,n),setTimeout(()=>{e&&(e.style.pointerEvents="none")},0)}function E(x){a?.(x),m(),e&&(e.style.pointerEvents="auto")}return e.addEventListener("dragstart",w),e.addEventListener("dragend",E),l.appendChild(e),{unbind(){e.removeEventListener("dragstart",w),e.removeEventListener("dragend",E),h&&(cancelAnimationFrame(h),h=null,p=null)},plugin:new Ue({key:typeof t=="string"?new We(t):t,state:{init(){return{locked:!1}},apply(x,T,S,k){const C=x.getMeta("lockDragHandle"),N=x.getMeta("hideDragHandle");if(C!==void 0&&(c=C),N)return m(),c=!1,u=null,d=-1,s?.({editor:n,node:null,pos:-1}),T;if(x.docChanged&&d!==-1&&e)if(Tee(x)){const R=Dee(k,f);R!==d&&(d=R)}else{const R=x.mapping.map(d);R!==d&&(d=R,f=gp(k,d))}return T}},view:x=>{var T;return e.draggable=!0,e.style.pointerEvents="auto",(T=n.view.dom.parentElement)==null||T.appendChild(l),l.style.pointerEvents="none",l.style.position="absolute",l.style.top="0",l.style.left="0",{update(S,k){if(!e)return;if(!n.isEditable){m();return}if(c?e.draggable=!1:e.draggable=!0,x.state.doc.eq(k.doc)||d===-1)return;let C=x.nodeDOM(d);if(C=KE(x,C),C===x.dom||C?.nodeType!==1)return;const N=x.posAtDOM(C,0),R=qE(n.state.doc,N),L=GE(n.state.doc,N);u=R,d=L,f=gp(x.state,d),s?.({editor:n,node:u,pos:d}),v(C)},destroy(){h&&(cancelAnimationFrame(h),h=null,p=null),e&&dN(l)}}},props:{handleDOMEvents:{keydown(x){return!e||c||x.hasFocus()&&(m(),u=null,d=-1,s?.({editor:n,node:null,pos:-1})),!1},mouseleave(x,T){return c||T.target&&!l.contains(T.relatedTarget)&&(m(),u=null,d=-1,s?.({editor:n,node:null,pos:-1})),!1},mousemove(x,T){return!e||c||(p={x:T.clientX,y:T.clientY},h)||(h=requestAnimationFrame(()=>{if(h=null,!p)return;const{x:S,y:k}=p;p=null;const C=uN({x:S,y:k,direction:"right",editor:n});if(!C.resultElement)return;let N=C.resultElement;if(N=KE(x,N),N===x.dom||N?.nodeType!==1)return;const R=x.posAtDOM(N,0),L=qE(n.state.doc,R);if(L!==u){const $=GE(n.state.doc,R);u=L,d=$,f=gp(x.state,d),s?.({editor:n,node:u,pos:d}),v(N),y()}})),!1}}}})}},rg={placement:"left-start",strategy:"absolute"};Qe.create({name:"dragHandle",addOptions(){return{render(){const t=document.createElement("div");return t.classList.add("drag-handle"),t},computePositionConfig:{},locked:!1,onNodeChange:()=>null}},addCommands(){return{lockDragHandle:()=>({editor:t})=>(this.options.locked=!0,t.commands.setMeta("lockDragHandle",this.options.locked)),unlockDragHandle:()=>({editor:t})=>(this.options.locked=!1,t.commands.setMeta("lockDragHandle",this.options.locked)),toggleDragHandle:()=>({editor:t})=>(this.options.locked=!this.options.locked,t.commands.setMeta("lockDragHandle",this.options.locked))}},addProseMirrorPlugins(){const t=this.options.render();return[hN({computePositionConfig:{...rg,...this.options.computePositionConfig},getReferencedVirtualElement:this.options.getReferencedVirtualElement,element:t,editor:this.editor,onNodeChange:this.options.onNodeChange}).plugin]}});var Iee=t=>{const{className:e="drag-handle",children:n,editor:r,pluginKey:o=fN,onNodeChange:s,onElementDragStart:i,onElementDragEnd:a,computePositionConfig:l=rg}=t,[c,u]=M.useState(null),d=M.useRef(null);return M.useEffect(()=>{let f=null;return c?r.isDestroyed?()=>{d.current=null}:(d.current||(f=hN({editor:r,element:c,pluginKey:o,computePositionConfig:{...rg,...l},onElementDragStart:i,onElementDragEnd:a,onNodeChange:s}),d.current=f.plugin,r.registerPlugin(d.current)),()=>{r.unregisterPlugin(o),d.current=null,f&&(f.unbind(),f=null)}):()=>{d.current=null}},[c,r,s,o,l,i,a]),g.jsx("div",{className:e,style:{visibility:"hidden",position:"absolute"},ref:u,children:n})},Pee=Iee;const pN=({editor:t,actions:e,editorTab:n,onSwitchEditor:r,isSubmitting:o,onSubmit:s,className:i})=>g.jsxs("div",{className:re("post-builder-editor bg-background border rounded-md overflow-hidden min-h-60 max-h-[calc(100dvh-7rem)] flex flex-col overflow-y-auto transition-all duration-300 ease-in-out",i),children:[g.jsx(GF,{editorTab:n,onSwitchEditorTab:r}),g.jsx(A9,{editor:t,actions:e,isSubmitting:o,onSubmit:s,editorType:n,children:g.jsxs("div",{className:"flex flex-col grow overflow-y-auto",children:[g.jsx(Pee,{editor:t,className:re(" pr-2",n!==gt.Text&&"hidden size-0 overflow-hidden pointer-events-none"),children:g.jsx(Zn,{variant:"ghost",className:"bg-white cursor-grab py-0.5 px-0 border size-auto",children:g.jsx(xV,{className:"text-muted-foreground"})})}),g.jsx(_F,{className:"grow overflow-y-auto","data-theme":"select-post-builder",editor:t})]})})]}),Lee=({open:t,onOpenChange:e,...n})=>g.jsx(wy,{open:t,onOpenChange:e,children:g.jsx(Ey,{className:"bg-transparent border-0 p-0 lg:max-w-4xl",showCloseButton:!1,children:g.jsx(pN,{...n,className:"bg-white max-h-dvh h-full"})})});function YE(t,[e,n]){return Math.min(n,Math.max(e,t))}var jee=[" ","Enter","ArrowUp","ArrowDown"],$ee=[" ","Enter"],Gs="Select",[Bf,Ff,Bee]=yg(Gs),[ia]=Ln(Gs,[Bee,cs]),Hf=cs(),[Fee,fs]=ia(Gs),[Hee,Uee]=ia(Gs),mN=t=>{const{__scopeSelect:e,children:n,open:r,defaultOpen:o,onOpenChange:s,value:i,defaultValue:a,onValueChange:l,dir:c,name:u,autoComplete:d,disabled:f,required:h,form:p}=t,m=Hf(e),[y,v]=b.useState(null),[w,E]=b.useState(null),[x,T]=b.useState(!1),S=jd(c),[k,C]=po({prop:r,defaultProp:o??!1,onChange:s,caller:Gs}),[N,R]=po({prop:i,defaultProp:a,onChange:l,caller:Gs}),L=b.useRef(null),$=y?p||!!y.closest("form"):!0,[B,U]=b.useState(new Set),j=Array.from(B).map(P=>P.props.value).join(";");return g.jsx(sf,{...m,children:g.jsxs(Fee,{required:h,scope:e,trigger:y,onTriggerChange:v,valueNode:w,onValueNodeChange:E,valueNodeHasChildren:x,onValueNodeHasChildrenChange:T,contentId:Kn(),value:N,onValueChange:R,open:k,onOpenChange:C,dir:S,triggerPointerDownPosRef:L,disabled:f,children:[g.jsx(Bf.Provider,{scope:e,children:g.jsx(Hee,{scope:t.__scopeSelect,onNativeOptionAdd:b.useCallback(P=>{U(H=>new Set(H).add(P))},[]),onNativeOptionRemove:b.useCallback(P=>{U(H=>{const _=new Set(H);return _.delete(P),_})},[]),children:n})}),$?g.jsxs(jN,{"aria-hidden":!0,required:h,tabIndex:-1,name:u,autoComplete:d,value:N,onChange:P=>R(P.target.value),disabled:f,form:p,children:[N===void 0?g.jsx("option",{value:""}):null,Array.from(B)]},j):null]})})};mN.displayName=Gs;var gN="SelectTrigger",yN=b.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...o}=t,s=Hf(n),i=fs(gN,n),a=i.disabled||r,l=Fe(e,i.onTriggerChange),c=Ff(n),u=b.useRef("touch"),[d,f,h]=BN(m=>{const y=c().filter(E=>!E.disabled),v=y.find(E=>E.value===i.value),w=FN(y,m,v);w!==void 0&&i.onValueChange(w.value)}),p=m=>{a||(i.onOpenChange(!0),h()),m&&(i.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})};return g.jsx(Hl,{asChild:!0,...s,children:g.jsx(ge.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":$N(i.value)?"":void 0,...o,ref:l,onClick:ne(o.onClick,m=>{m.currentTarget.focus(),u.current!=="mouse"&&p(m)}),onPointerDown:ne(o.onPointerDown,m=>{u.current=m.pointerType;const y=m.target;y.hasPointerCapture(m.pointerId)&&y.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&m.pointerType==="mouse"&&(p(m),m.preventDefault())}),onKeyDown:ne(o.onKeyDown,m=>{const y=d.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&f(m.key),!(y&&m.key===" ")&&jee.includes(m.key)&&(p(),m.preventDefault())})})})});yN.displayName=gN;var vN="SelectValue",bN=b.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:o,children:s,placeholder:i="",...a}=t,l=fs(vN,n),{onValueNodeHasChildrenChange:c}=l,u=s!==void 0,d=Fe(e,l.onValueNodeChange);return Nt(()=>{c(u)},[c,u]),g.jsx(ge.span,{...a,ref:d,style:{pointerEvents:"none"},children:$N(l.value)?g.jsx(g.Fragment,{children:i}):s})});bN.displayName=vN;var zee="SelectIcon",xN=b.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...o}=t;return g.jsx(ge.span,{"aria-hidden":!0,...o,ref:e,children:r||"▼"})});xN.displayName=zee;var Vee="SelectPortal",wN=t=>g.jsx(ea,{asChild:!0,...t});wN.displayName=Vee;var qs="SelectContent",EN=b.forwardRef((t,e)=>{const n=fs(qs,t.__scopeSelect),[r,o]=b.useState();if(Nt(()=>{o(new DocumentFragment)},[]),!n.open){const s=r;return s?Md.createPortal(g.jsx(SN,{scope:t.__scopeSelect,children:g.jsx(Bf.Slot,{scope:t.__scopeSelect,children:g.jsx("div",{children:t.children})})}),s):null}return g.jsx(kN,{...t,ref:e})});EN.displayName=qs;var ir=10,[SN,hs]=ia(qs),Wee="SelectContentImpl",Gee=Yo("SelectContent.RemoveScroll"),kN=b.forwardRef((t,e)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:s,onPointerDownOutside:i,side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:h,sticky:p,hideWhenDetached:m,avoidCollisions:y,...v}=t,w=fs(qs,n),[E,x]=b.useState(null),[T,S]=b.useState(null),k=Fe(e,z=>x(z)),[C,N]=b.useState(null),[R,L]=b.useState(null),$=Ff(n),[B,U]=b.useState(!1),j=b.useRef(!1);b.useEffect(()=>{if(E)return hf(E)},[E]),df();const P=b.useCallback(z=>{const[Z,...Me]=$().map(Se=>Se.ref.current),[he]=Me.slice(-1),we=document.activeElement;for(const Se of z)if(Se===we||(Se?.scrollIntoView({block:"nearest"}),Se===Z&&T&&(T.scrollTop=0),Se===he&&T&&(T.scrollTop=T.scrollHeight),Se?.focus(),document.activeElement!==we))return},[$,T]),H=b.useCallback(()=>P([C,E]),[P,C,E]);b.useEffect(()=>{B&&H()},[B,H]);const{onOpenChange:_,triggerPointerDownPosRef:V}=w;b.useEffect(()=>{if(E){let z={x:0,y:0};const Z=he=>{z={x:Math.abs(Math.round(he.pageX)-(V.current?.x??0)),y:Math.abs(Math.round(he.pageY)-(V.current?.y??0))}},Me=he=>{z.x<=10&&z.y<=10?he.preventDefault():E.contains(he.target)||_(!1),document.removeEventListener("pointermove",Z),V.current=null};return V.current!==null&&(document.addEventListener("pointermove",Z),document.addEventListener("pointerup",Me,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Z),document.removeEventListener("pointerup",Me,{capture:!0})}}},[E,_,V]),b.useEffect(()=>{const z=()=>_(!1);return window.addEventListener("blur",z),window.addEventListener("resize",z),()=>{window.removeEventListener("blur",z),window.removeEventListener("resize",z)}},[_]);const[ie,te]=BN(z=>{const Z=$().filter(we=>!we.disabled),Me=Z.find(we=>we.ref.current===document.activeElement),he=FN(Z,z,Me);he&&setTimeout(()=>he.ref.current.focus())}),ye=b.useCallback((z,Z,Me)=>{const he=!j.current&&!Me;(w.value!==void 0&&w.value===Z||he)&&(N(z),he&&(j.current=!0))},[w.value]),G=b.useCallback(()=>E?.focus(),[E]),Q=b.useCallback((z,Z,Me)=>{const he=!j.current&&!Me;(w.value!==void 0&&w.value===Z||he)&&L(z)},[w.value]),J=r==="popper"?og:TN,me=J===og?{side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:h,sticky:p,hideWhenDetached:m,avoidCollisions:y}:{};return g.jsx(SN,{scope:n,content:E,viewport:T,onViewportChange:S,itemRefCallback:ye,selectedItem:C,onItemLeave:G,itemTextRefCallback:Q,focusSelectedItem:H,selectedItemText:R,position:r,isPositioned:B,searchRef:ie,children:g.jsx(Vl,{as:Gee,allowPinchZoom:!0,children:g.jsx(zl,{asChild:!0,trapped:w.open,onMountAutoFocus:z=>{z.preventDefault()},onUnmountAutoFocus:ne(o,z=>{w.trigger?.focus({preventScroll:!0}),z.preventDefault()}),children:g.jsx(Xi,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:z=>z.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:g.jsx(J,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:z=>z.preventDefault(),...v,...me,onPlaced:()=>U(!0),ref:k,style:{display:"flex",flexDirection:"column",outline:"none",...v.style},onKeyDown:ne(v.onKeyDown,z=>{const Z=z.ctrlKey||z.altKey||z.metaKey;if(z.key==="Tab"&&z.preventDefault(),!Z&&z.key.length===1&&te(z.key),["ArrowUp","ArrowDown","Home","End"].includes(z.key)){let he=$().filter(we=>!we.disabled).map(we=>we.ref.current);if(["ArrowUp","End"].includes(z.key)&&(he=he.slice().reverse()),["ArrowUp","ArrowDown"].includes(z.key)){const we=z.target,Se=he.indexOf(we);he=he.slice(Se+1)}setTimeout(()=>P(he)),z.preventDefault()}})})})})})})});kN.displayName=Wee;var qee="SelectItemAlignedPosition",TN=b.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...o}=t,s=fs(qs,n),i=hs(qs,n),[a,l]=b.useState(null),[c,u]=b.useState(null),d=Fe(e,k=>u(k)),f=Ff(n),h=b.useRef(!1),p=b.useRef(!0),{viewport:m,selectedItem:y,selectedItemText:v,focusSelectedItem:w}=i,E=b.useCallback(()=>{if(s.trigger&&s.valueNode&&a&&c&&m&&y&&v){const k=s.trigger.getBoundingClientRect(),C=c.getBoundingClientRect(),N=s.valueNode.getBoundingClientRect(),R=v.getBoundingClientRect();if(s.dir!=="rtl"){const we=R.left-C.left,Se=N.left-we,ze=k.left-Se,ut=k.width+ze,dt=Math.max(ut,C.width),Tt=window.innerWidth-ir,ft=YE(Se,[ir,Math.max(ir,Tt-dt)]);a.style.minWidth=ut+"px",a.style.left=ft+"px"}else{const we=C.right-R.right,Se=window.innerWidth-N.right-we,ze=window.innerWidth-k.right-Se,ut=k.width+ze,dt=Math.max(ut,C.width),Tt=window.innerWidth-ir,ft=YE(Se,[ir,Math.max(ir,Tt-dt)]);a.style.minWidth=ut+"px",a.style.right=ft+"px"}const L=f(),$=window.innerHeight-ir*2,B=m.scrollHeight,U=window.getComputedStyle(c),j=parseInt(U.borderTopWidth,10),P=parseInt(U.paddingTop,10),H=parseInt(U.borderBottomWidth,10),_=parseInt(U.paddingBottom,10),V=j+P+B+_+H,ie=Math.min(y.offsetHeight*5,V),te=window.getComputedStyle(m),ye=parseInt(te.paddingTop,10),G=parseInt(te.paddingBottom,10),Q=k.top+k.height/2-ir,J=$-Q,me=y.offsetHeight/2,z=y.offsetTop+me,Z=j+P+z,Me=V-Z;if(Z<=Q){const we=L.length>0&&y===L[L.length-1].ref.current;a.style.bottom="0px";const Se=c.clientHeight-m.offsetTop-m.offsetHeight,ze=Math.max(J,me+(we?G:0)+Se+H),ut=Z+ze;a.style.height=ut+"px"}else{const we=L.length>0&&y===L[0].ref.current;a.style.top="0px";const ze=Math.max(Q,j+m.offsetTop+(we?ye:0)+me)+Me;a.style.height=ze+"px",m.scrollTop=Z-Q+m.offsetTop}a.style.margin=`${ir}px 0`,a.style.minHeight=ie+"px",a.style.maxHeight=$+"px",r?.(),requestAnimationFrame(()=>h.current=!0)}},[f,s.trigger,s.valueNode,a,c,m,y,v,s.dir,r]);Nt(()=>E(),[E]);const[x,T]=b.useState();Nt(()=>{c&&T(window.getComputedStyle(c).zIndex)},[c]);const S=b.useCallback(k=>{k&&p.current===!0&&(E(),w?.(),p.current=!1)},[E,w]);return g.jsx(Yee,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:h,onScrollButtonChange:S,children:g.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:x},children:g.jsx(ge.div,{...o,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});TN.displayName=qee;var Kee="SelectPopperPosition",og=b.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=ir,...s}=t,i=Hf(n);return g.jsx(af,{...i,...s,ref:e,align:r,collisionPadding:o,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});og.displayName=Kee;var[Yee,jv]=ia(qs,{}),sg="SelectViewport",CN=b.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...o}=t,s=hs(sg,n),i=jv(sg,n),a=Fe(e,s.onViewportChange),l=b.useRef(0);return g.jsxs(g.Fragment,{children:[g.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),g.jsx(Bf.Slot,{scope:n,children:g.jsx(ge.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:ne(o.onScroll,c=>{const u=c.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:f}=i;if(f?.current&&d){const h=Math.abs(l.current-u.scrollTop);if(h>0){const p=window.innerHeight-ir*2,m=parseFloat(d.style.minHeight),y=parseFloat(d.style.height),v=Math.max(m,y);if(v<p){const w=v+h,E=Math.min(p,w),x=w-E;d.style.height=E+"px",d.style.bottom==="0px"&&(u.scrollTop=x>0?x:0,d.style.justifyContent="flex-end")}}}l.current=u.scrollTop})})})]})});CN.displayName=sg;var AN="SelectGroup",[Jee,Xee]=ia(AN),Qee=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,o=Kn();return g.jsx(Jee,{scope:n,id:o,children:g.jsx(ge.div,{role:"group","aria-labelledby":o,...r,ref:e})})});Qee.displayName=AN;var MN="SelectLabel",Zee=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,o=Xee(MN,n);return g.jsx(ge.div,{id:o.id,...r,ref:e})});Zee.displayName=MN;var Ad="SelectItem",[ete,ON]=ia(Ad),RN=b.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:s,...i}=t,a=fs(Ad,n),l=hs(Ad,n),c=a.value===r,[u,d]=b.useState(s??""),[f,h]=b.useState(!1),p=Fe(e,w=>l.itemRefCallback?.(w,r,o)),m=Kn(),y=b.useRef("touch"),v=()=>{o||(a.onValueChange(r),a.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return g.jsx(ete,{scope:n,value:r,disabled:o,textId:m,isSelected:c,onItemTextChange:b.useCallback(w=>{d(E=>E||(w?.textContent??"").trim())},[]),children:g.jsx(Bf.ItemSlot,{scope:n,value:r,disabled:o,textValue:u,children:g.jsx(ge.div,{role:"option","aria-labelledby":m,"data-highlighted":f?"":void 0,"aria-selected":c&&f,"data-state":c?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...i,ref:p,onFocus:ne(i.onFocus,()=>h(!0)),onBlur:ne(i.onBlur,()=>h(!1)),onClick:ne(i.onClick,()=>{y.current!=="mouse"&&v()}),onPointerUp:ne(i.onPointerUp,()=>{y.current==="mouse"&&v()}),onPointerDown:ne(i.onPointerDown,w=>{y.current=w.pointerType}),onPointerMove:ne(i.onPointerMove,w=>{y.current=w.pointerType,o?l.onItemLeave?.():y.current==="mouse"&&w.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ne(i.onPointerLeave,w=>{w.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:ne(i.onKeyDown,w=>{l.searchRef?.current!==""&&w.key===" "||($ee.includes(w.key)&&v(),w.key===" "&&w.preventDefault())})})})})});RN.displayName=Ad;var Ca="SelectItemText",NN=b.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:o,...s}=t,i=fs(Ca,n),a=hs(Ca,n),l=ON(Ca,n),c=Uee(Ca,n),[u,d]=b.useState(null),f=Fe(e,v=>d(v),l.onItemTextChange,v=>a.itemTextRefCallback?.(v,l.value,l.disabled)),h=u?.textContent,p=b.useMemo(()=>g.jsx("option",{value:l.value,disabled:l.disabled,children:h},l.value),[l.disabled,l.value,h]),{onNativeOptionAdd:m,onNativeOptionRemove:y}=c;return Nt(()=>(m(p),()=>y(p)),[m,y,p]),g.jsxs(g.Fragment,{children:[g.jsx(ge.span,{id:l.textId,...s,ref:f}),l.isSelected&&i.valueNode&&!i.valueNodeHasChildren?Md.createPortal(s.children,i.valueNode):null]})});NN.displayName=Ca;var _N="SelectItemIndicator",DN=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return ON(_N,n).isSelected?g.jsx(ge.span,{"aria-hidden":!0,...r,ref:e}):null});DN.displayName=_N;var ig="SelectScrollUpButton",IN=b.forwardRef((t,e)=>{const n=hs(ig,t.__scopeSelect),r=jv(ig,t.__scopeSelect),[o,s]=b.useState(!1),i=Fe(e,r.onScrollButtonChange);return Nt(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollTop>0;s(c)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),o?g.jsx(LN,{...t,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});IN.displayName=ig;var ag="SelectScrollDownButton",PN=b.forwardRef((t,e)=>{const n=hs(ag,t.__scopeSelect),r=jv(ag,t.__scopeSelect),[o,s]=b.useState(!1),i=Fe(e,r.onScrollButtonChange);return Nt(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollHeight-l.clientHeight,u=Math.ceil(l.scrollTop)<c;s(u)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),o?g.jsx(LN,{...t,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});PN.displayName=ag;var LN=b.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=t,s=hs("SelectScrollButton",n),i=b.useRef(null),a=Ff(n),l=b.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return b.useEffect(()=>()=>l(),[l]),Nt(()=>{a().find(u=>u.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[a]),g.jsx(ge.div,{"aria-hidden":!0,...o,ref:e,style:{flexShrink:0,...o.style},onPointerDown:ne(o.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(r,50))}),onPointerMove:ne(o.onPointerMove,()=>{s.onItemLeave?.(),i.current===null&&(i.current=window.setInterval(r,50))}),onPointerLeave:ne(o.onPointerLeave,()=>{l()})})}),tte="SelectSeparator",nte=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return g.jsx(ge.div,{"aria-hidden":!0,...r,ref:e})});nte.displayName=tte;var lg="SelectArrow",rte=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,o=Hf(n),s=fs(lg,n),i=hs(lg,n);return s.open&&i.position==="popper"?g.jsx(lf,{...o,...r,ref:e}):null});rte.displayName=lg;var ote="SelectBubbleInput",jN=b.forwardRef(({__scopeSelect:t,value:e,...n},r)=>{const o=b.useRef(null),s=Fe(r,o),i=EM(e);return b.useEffect(()=>{const a=o.current;if(!a)return;const l=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(l,"value").set;if(i!==e&&u){const d=new Event("change",{bubbles:!0});u.call(a,e),a.dispatchEvent(d)}},[i,e]),g.jsx(ge.select,{...n,style:{...tC,...n.style},ref:s,defaultValue:e})});jN.displayName=ote;function $N(t){return t===""||t===void 0}function BN(t){const e=pr(t),n=b.useRef(""),r=b.useRef(0),o=b.useCallback(i=>{const a=n.current+i;e(a),(function l(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>l(""),1e3))})(a)},[e]),s=b.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return b.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,s]}function FN(t,e,n){const o=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,s=n?t.indexOf(n):-1;let i=ste(t,Math.max(s,0));o.length===1&&(i=i.filter(c=>c!==n));const l=i.find(c=>c.textValue.toLowerCase().startsWith(o.toLowerCase()));return l!==n?l:void 0}function ste(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var ite=mN,ate=yN,lte=bN,cte=xN,ute=wN,dte=EN,fte=CN,hte=RN,pte=NN,mte=DN,gte=IN,yte=PN;function vte({...t}){return g.jsx(ite,{"data-slot":"select",...t})}function bte({...t}){return g.jsx(lte,{"data-slot":"select-value",...t})}function xte({className:t,size:e="default",children:n,...r}){return g.jsxs(ate,{"data-slot":"select-trigger","data-size":e,className:re("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...r,children:[n,g.jsx(cte,{asChild:!0,children:g.jsx(zC,{className:"size-4 opacity-50"})})]})}function wte({className:t,children:e,position:n="popper",align:r="center",...o}){return g.jsx(ute,{children:g.jsx("div",{id:"select-wrapper","data-theme":"select-post-builder",children:g.jsxs(dte,{"data-slot":"select-content",className:re("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,align:r,...o,children:[g.jsx(Ste,{}),g.jsx(fte,{className:re("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:e}),g.jsx(kte,{})]})})})}function Ete({className:t,children:e,...n}){return g.jsxs(hte,{"data-slot":"select-item",className:re("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",t),...n,children:[g.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:g.jsx(mte,{children:g.jsx(UC,{className:"size-4"})})}),g.jsx(pte,{children:e})]})}function Ste({className:t,...e}){return g.jsx(gte,{"data-slot":"select-scroll-up-button",className:re("flex cursor-default items-center justify-center py-1",t),...e,children:g.jsx(uV,{className:"size-4"})})}function kte({className:t,...e}){return g.jsx(yte,{"data-slot":"select-scroll-down-button",className:re("flex cursor-default items-center justify-center py-1",t),...e,children:g.jsx(zC,{className:"size-4"})})}function Tte(){return kg.useSyncExternalStore(Cte,()=>!0,()=>!1)}function Cte(){return()=>{}}var $v="Avatar",[Ate]=Ln($v),[Mte,HN]=Ate($v),UN=b.forwardRef((t,e)=>{const{__scopeAvatar:n,...r}=t,[o,s]=b.useState("idle");return g.jsx(Mte,{scope:n,imageLoadingStatus:o,onImageLoadingStatusChange:s,children:g.jsx(ge.span,{...r,ref:e})})});UN.displayName=$v;var zN="AvatarImage",VN=b.forwardRef((t,e)=>{const{__scopeAvatar:n,src:r,onLoadingStatusChange:o=()=>{},...s}=t,i=HN(zN,n),a=Ote(r,s),l=pr(c=>{o(c),i.onImageLoadingStatusChange(c)});return Nt(()=>{a!=="idle"&&l(a)},[a,l]),a==="loaded"?g.jsx(ge.img,{...s,ref:e,src:r}):null});VN.displayName=zN;var WN="AvatarFallback",GN=b.forwardRef((t,e)=>{const{__scopeAvatar:n,delayMs:r,...o}=t,s=HN(WN,n),[i,a]=b.useState(r===void 0);return b.useEffect(()=>{if(r!==void 0){const l=window.setTimeout(()=>a(!0),r);return()=>window.clearTimeout(l)}},[r]),i&&s.imageLoadingStatus!=="loaded"?g.jsx(ge.span,{...o,ref:e}):null});GN.displayName=WN;function JE(t,e){return t?e?(t.src!==e&&(t.src=e),t.complete&&t.naturalWidth>0?"loaded":"loading"):"error":"idle"}function Ote(t,{referrerPolicy:e,crossOrigin:n}){const r=Tte(),o=b.useRef(null),s=r?(o.current||(o.current=new window.Image),o.current):null,[i,a]=b.useState(()=>JE(s,t));return Nt(()=>{a(JE(s,t))},[s,t]),Nt(()=>{const l=d=>()=>{a(d)};if(!s)return;const c=l("loaded"),u=l("error");return s.addEventListener("load",c),s.addEventListener("error",u),e&&(s.referrerPolicy=e),typeof n=="string"&&(s.crossOrigin=n),()=>{s.removeEventListener("load",c),s.removeEventListener("error",u)}},[s,n,e]),i}var Rte=UN,Nte=VN,_te=GN;function XE({className:t,...e}){return g.jsx(Rte,{"data-slot":"avatar",className:re("relative flex size-8 shrink-0 overflow-hidden rounded-full",t),...e})}function QE({className:t,...e}){return g.jsx(Nte,{"data-slot":"avatar-image",className:re("aspect-square size-full",t),...e})}function ZE({className:t,...e}){return g.jsx(_te,{"data-slot":"avatar-fallback",className:re("bg-muted flex size-full items-center justify-center rounded-full",t),...e})}const Dte=({user:t,store:e})=>{const{core:n}=Dl(),[r,o]=M.useState([]),[s,i]=M.useState(!1),a=ho(),[l,c]=M.useState(e.getState());M.useEffect(()=>e.subscribe(()=>{c(e.getState())}),[e]);const{groupId:u,selectedGroupId:d}=l,f=d??u??"",h=!!u;M.useEffect(()=>{let m=!1;return(async()=>{i(!0);try{const v=await n.fetchGroupConversations(999,0);m||o(v.entries??[])}catch(v){m||console.error("Failed to fetch groups:",v)}finally{m||i(!1)}})(),()=>{m=!0}},[n]);const p=m=>{e.getState().selectGroup(m)};return g.jsxs("div",{className:"not-prose flex items-center gap-3",children:[t?.id&&g.jsxs(XE,{children:[g.jsx(QE,{src:t?.avatar??t?.avatarPlaceholder}),g.jsx(ZE,{className:"bg-primary-send text-background",children:t?.name?.charAt(0)})]}),g.jsxs(vte,{value:f,onValueChange:p,disabled:h||s,children:[g.jsx(xte,{size:"sm",id:`group-selector-${f}-${a}`,className:"bg-background","aria-label":"Select group",children:g.jsx(bte,{className:"text-sm",placeholder:s?"Loading groups...":"Select a group…"})}),g.jsx(wte,{align:"start",children:r.map(m=>g.jsxs(Ete,{value:m.group_id,children:[g.jsxs(XE,{className:"size-6",children:[g.jsx(QE,{src:m.group.avatar}),g.jsx(ZE,{children:m?.group?.name?.charAt(0)})]}),g.jsx("span",{className:"text-sm",children:m.group?.name??m.group_id})]},m.group_id))})]})]})};var Ite=(t,e,n,r,o,s,i,a)=>{let l=document.documentElement,c=["light","dark"];function u(h){(Array.isArray(t)?t:[t]).forEach(p=>{let m=p==="class",y=m&&s?o.map(v=>s[v]||v):o;m?(l.classList.remove(...y),l.classList.add(s&&s[h]?s[h]:h)):l.setAttribute(p,h)}),d(h)}function d(h){a&&c.includes(h)&&(l.style.colorScheme=h)}function f(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}if(r)u(r);else try{let h=localStorage.getItem(e)||n,p=i&&h==="system"?f():h;u(p)}catch{}},Pte=b.createContext(void 0),Lte={setTheme:t=>{},themes:[]},jte=()=>{var t;return(t=b.useContext(Pte))!=null?t:Lte};b.memo(({forcedTheme:t,storageKey:e,attribute:n,enableSystem:r,enableColorScheme:o,defaultTheme:s,value:i,themes:a,nonce:l,scriptProps:c})=>{let u=JSON.stringify([n,e,s,t,a,i,r,o]).slice(1,-1);return b.createElement("script",{...c,suppressHydrationWarning:!0,nonce:typeof window>"u"?l:"",dangerouslySetInnerHTML:{__html:`(${Ite.toString()})(${u})`}})});const $te=({...t})=>{const{theme:e="system"}=jte();return g.jsx(mI,{theme:e,className:"toaster group",style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)"},...t})},Uf=t=>({html:t?.getHTML(),json:t?.getJSON(),text:t?.getText()}),zf=()=>({postId:ho(),timestamp:new Date().getTime(),specialType:TS.POST}),Bv=t=>({mentionData:Kl(t,"mention")?.map(r=>q8(X8(r.attrs,B8),["mentionSuggestionChar","label"]))?.filter(r=>Object.keys(r).length>0)}),Bte=t=>({items:Kl(t,"media").map(r=>r.attrs?.payload)}),Fte=t=>({items:Kl(t,"poll")[0].attrs?.choices}),Hte=({editor:t,sendCrossMention:e})=>{const{html:n,json:r}=Uf(t),o=zf(),s=pw(r,"text")?.text?.trim()??"",i=new Array(pw(r,"media")?.attrs?.payload).filter(Boolean),a=n;return{...o,type:_l.NEW_POST_MESSAGE,body:s,items:i,htmlBody:a,sendCrossMention:e,mentionData:[]}},Ute=({editor:t,sendCrossMention:e})=>{const{json:n,text:r}=Uf(t),o=zf(),s=r,{mentionData:i}=Bv(n),{items:a}=Bte(n);return{...o,type:_l.NEW_POST_MEDIA,body:s,items:a,mentionData:i,sendCrossMention:e}},zte=({editor:t,sendCrossMention:e})=>{const{json:n,text:r}=Uf(t),o=zf(),s=r,{mentionData:i}=Bv(n);return{...o,type:_l.NEW_POST_MESSAGE,body:s,items:[],mentionData:i,sendCrossMention:e}},Vte=({editor:t,sendCrossMention:e})=>{const{json:n,text:r}=Uf(t),o=zf(),s=r,{mentionData:i}=Bv(n),{items:a}=Fte(n);return{...o,type:_l.NEW_POST_POLL,body:s,items:a,mentionData:i,sendCrossMention:e}},Wte=(t,e)=>{switch(t){case gt.Text:return Hte(e);case gt.Media:return Ute(e);case gt.Link:return zte(e);case gt.Poll:return Vte(e);default:return null}},Gte=({groupId:t,postId:e,user:n,hideGroupSelector:r=!1,showModal:o=!1,clearOnSuccess:s=!0,isSubmitting:i,onCreatePost:a})=>{const l=M.useRef(null),[c,u]=M.useState(()=>o),[d,f]=M.useState(gt.Text),{editor:h,actions:p,store:m}=cX({editorType:d,groupId:t,postId:e,user:n}),{clearContent:y}=ry(),v=M.useMemo(()=>({editor:h}),[h]),w=E=>{if(!h)return;const x=h?.getHTML(),T=h?.getJSON(),S=h?.getText(),k=Wte(d,{editor:h,sendCrossMention:E});k&&(a?.({payload:k,html:x,json:T,text:S}),s&&(y(),h?.chain()?.focus()?.clearContent()?.run()))};return M.useEffect(()=>{h&&h?.chain()?.focus()?.run()},[h]),M.useEffect(()=>u(o),[o]),h?g.jsxs("div",{className:"max-w-full w-full","data-theme":"select-post-builder",children:[g.jsx("div",{ref:l,className:"flex-1 space-y-3 max-w-full",children:g.jsxs(ty.Provider,{value:v,children:[r&&g.jsx(Dte,{user:n,store:m}),o?g.jsx(Lee,{open:c,onOpenChange:u,editor:h,actions:p,editorTab:d,onSwitchEditor:f,isSubmitting:i,onSubmit:w}):g.jsx(pN,{editor:h,actions:p,editorTab:d,onSwitchEditor:f,isSubmitting:i,onSubmit:w})]})}),g.jsx($te,{position:"top-center"})]}):null};exports.PostBuilderEditor=Gte;exports.PostBuilderProvider=RI;
|