@select-org/select-post-builder 1.0.4 → 1.0.6

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.
@@ -1,586 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const M=require("react"),Ml=require("react-dom");function oS(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=oS(M),Md=oS(Ml);function sS(t,e){return function(){return t.apply(e,arguments)}}const{toString:YN}=Object.prototype,{getPrototypeOf:cg}=Object,{iterator:Od,toStringTag:iS}=Symbol,Rd=(t=>e=>{const n=YN.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 Ol(t){return t!==null&&!Ai(t)&&t.constructor!==null&&!Ai(t.constructor)&&wn(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const aS=xr("ArrayBuffer");function JN(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&aS(t.buffer),e}const XN=Nd("string"),wn=Nd("function"),lS=Nd("number"),Rl=t=>t!==null&&typeof t=="object",QN=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)&&!(iS in t)&&!(Od in t)},ZN=t=>{if(!Rl(t)||Ol(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},e_=xr("Date"),t_=xr("File"),n_=xr("Blob"),r_=xr("FileList"),o_=t=>Rl(t)&&wn(t.pipe),s_=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]"))},i_=xr("URLSearchParams"),[a_,l_,c_,u_]=["ReadableStream","Request","Response","Headers"].map(xr),d_=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Nl(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(Ol(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 cS(t,e){if(Ol(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,uS=t=>!Ai(t)&&t!==bs;function yp(){const{caseless:t,skipUndefined:e}=uS(this)&&this||{},n={},r=(o,s)=>{const i=t&&cS(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]&&Nl(arguments[o],r);return n}const f_=(t,e,n,{allOwnKeys:r}={})=>(Nl(e,(o,s)=>{n&&wn(o)?t[s]=sS(o,n):t[s]=o},{allOwnKeys:r}),t),h_=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),p_=(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)},m_=(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},g_=(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},y_=t=>{if(!t)return null;if(Gi(t))return t;let e=t.length;if(!lS(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},v_=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&cg(Uint8Array)),b_=(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])}},x_=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},w_=xr("HTMLFormElement"),E_=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,o){return r.toUpperCase()+o}),Vv=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),S_=xr("RegExp"),dS=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};Nl(n,(o,s)=>{let i;(i=e(o,s,t))!==!1&&(r[s]=i||o)}),Object.defineProperties(t,r)},k_=t=>{dS(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+"'")})}})},T_=(t,e)=>{const n={},r=o=>{o.forEach(s=>{n[s]=!0})};return Gi(t)?r(t):r(String(t).split(e)),n},C_=()=>{},A_=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function M_(t){return!!(t&&wn(t.append)&&t[iS]==="FormData"&&t[Od])}const O_=t=>{const e=new Array(10),n=(r,o)=>{if(Rl(r)){if(e.indexOf(r)>=0)return;if(Ol(r))return r;if(!("toJSON"in r)){e[o]=r;const s=Gi(r)?[]:{};return Nl(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)},R_=xr("AsyncFunction"),N_=t=>t&&(Rl(t)||wn(t))&&wn(t.then)&&wn(t.catch),fS=((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)),__=typeof queueMicrotask<"u"?queueMicrotask.bind(bs):typeof process<"u"&&process.nextTick||fS,D_=t=>t!=null&&wn(t[Od]),D={isArray:Gi,isArrayBuffer:aS,isBuffer:Ol,isFormData:s_,isArrayBufferView:JN,isString:XN,isNumber:lS,isBoolean:QN,isObject:Rl,isPlainObject:Hc,isEmptyObject:ZN,isReadableStream:a_,isRequest:l_,isResponse:c_,isHeaders:u_,isUndefined:Ai,isDate:e_,isFile:t_,isBlob:n_,isRegExp:S_,isFunction:wn,isStream:o_,isURLSearchParams:i_,isTypedArray:v_,isFileList:r_,forEach:Nl,merge:yp,extend:f_,trim:d_,stripBOM:h_,inherits:p_,toFlatObject:m_,kindOf:Rd,kindOfTest:xr,endsWith:g_,toArray:y_,forEachEntry:b_,matchAll:x_,isHTMLForm:w_,hasOwnProperty:Vv,hasOwnProp:Vv,reduceDescriptors:dS,freezeMethods:k_,toObjectSet:T_,toCamelCase:E_,noop:C_,toFiniteNumber:A_,findKey:cS,global:bs,isContextDefined:uS,isSpecCompliantForm:M_,toJSONObject:O_,isAsyncFn:R_,isThenable:N_,setImmediate:fS,asap:__,isIterable:D_};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 hS=Ce.prototype,pS={};["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=>{pS[t]={value:t}});Object.defineProperties(Ce,pS);Object.defineProperty(hS,"isAxiosError",{value:!0});Ce.from=(t,e,n,r,o,s)=>{const i=Object.create(hS);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 I_=null;function vp(t){return D.isPlainObject(t)||D.isArray(t)}function mS(t){return D.endsWith(t,"[]")?t.slice(0,-2):t}function Wv(t,e,n){return t?t.concat(e).map(function(o,s){return o=mS(o),!n&&s?"["+o+"]":o}).join(n?".":""):e}function P_(t){return D.isArray(t)&&!t.some(vp)}const L_=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)&&P_(p)||(D.isFileList(p)||D.endsWith(m,"[]"))&&(v=D.toArray(p)))return m=mS(m),v.forEach(function(E,x){!(D.isUndefined(E)||E===null)&&e.append(i===!0?Wv([m],x,s):i===null?m:m+"[]",c(E))}),!1}return vp(p)?!0:(e.append(Wv(y,m,s),c(p)),!1)}const d=[],f=Object.assign(L_,{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 Gv(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 gS=ug.prototype;gS.append=function(e,n){this._pairs.push([e,n])};gS.toString=function(e){const n=e?function(r){return e.call(this,r,Gv)}:Gv;return this._pairs.map(function(o){return n(o[0])+"="+n(o[1])},"").join("&")};function j_(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function yS(t,e,n){if(!e)return t;const r=n&&n.encode||j_;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 qv{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 vS={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},$_=typeof URLSearchParams<"u"?URLSearchParams:ug,B_=typeof FormData<"u"?FormData:null,F_=typeof Blob<"u"?Blob:null,H_={isBrowser:!0,classes:{URLSearchParams:$_,FormData:B_,Blob:F_},protocols:["http","https","file","blob","url","data"]},dg=typeof window<"u"&&typeof document<"u",bp=typeof navigator=="object"&&navigator||void 0,U_=dg&&(!bp||["ReactNative","NativeScript","NS"].indexOf(bp.product)<0),z_=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",V_=dg&&window.location.href||"http://localhost",W_=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:dg,hasStandardBrowserEnv:U_,hasStandardBrowserWebWorkerEnv:z_,navigator:bp,origin:V_},Symbol.toStringTag,{value:"Module"})),Jt={...W_,...H_};function G_(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 q_(t){return D.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function K_(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 bS(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]=K_(o[i])),!a)}if(D.isFormData(t)&&D.isFunction(t.entries)){const n={};return D.forEachEntry(t,(r,o)=>{e(q_(r),o,n,0)}),n}return null}function Y_(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 _l={transitional:vS,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(bS(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 G_(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),Y_(e)):e}],transformResponse:[function(e){const n=this.transitional||_l.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=>{_l.headers[t]={}});const J_=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"]),X_=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]&&J_[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},Kv=Symbol("internals");function ca(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 Q_(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 Z_=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 eD(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function tD(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=ca(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())&&!Z_(e))i(X_(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=ca(e),e){const r=D.findKey(this,e);if(r){const o=this[r];if(!n)return o;if(n===!0)return Q_(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=ca(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=ca(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?eD(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[Kv]=this[Kv]={accessors:{}}).accessors,o=this.prototype;function s(i){const a=ca(i);r[a]||(tD(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||_l,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 xS(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 wS(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 nD(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function rD(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 oD(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=rD(50,250);return oD(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)},Yv=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},Jv=t=>(...e)=>D.asap(()=>t(...e)),sD=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,iD=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 aD(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function lD(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function ES(t,e,n){let r=!aD(e);return t&&(r||n==!1)?lD(t,e):e}const Xv=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(Xv(c),Xv(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 SS=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=yS(ES(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&&sD(e.url))){const l=o&&s&&iD.read(s);l&&i.set(o,l)}return e},cD=typeof XMLHttpRequest<"u",uD=cD&&function(t){return new Promise(function(n,r){const o=SS(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()),k={data:!a||a==="text"||a==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:E,config:t,request:y};wS(function(T){n(T),m()},function(T){r(T),m()},k),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 k=x&&x.message?x.message:"Network Error",S=new Ce(k,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 k=o.transitional||vS;o.timeoutErrorMessage&&(x=o.timeoutErrorMessage),r(new Ce(x,k.clarifyTimeoutError?Ce.ETIMEDOUT:Ce.ECONNABORTED,t,y)),y=null},s===void 0&&i.setContentType(null),"setRequestHeader"in y&&D.forEach(i.toJSON(),function(x,k){y.setRequestHeader(k,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=nD(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)})},dD=(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}},fD=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},hD=async function*(t,e){for await(const n of pD(t))yield*fD(n,e)},pD=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()}},Qv=(t,e,n,r)=>{const o=hD(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})},Zv=64*1024,{isFunction:oc}=D,mD=(({Request:t,Response:e})=>({Request:t,Response:e}))(D.global),{ReadableStream:eb,TextEncoder:tb}=D.global,nb=(t,...e)=>{try{return!!t(...e)}catch{return!1}},gD=t=>{t=D.merge.call({skipUndefined:!0},mD,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(eb),l=o&&(typeof tb=="function"?(p=>m=>p.encode(m))(new tb):async p=>new Uint8Array(await new n(p).arrayBuffer())),c=s&&a&&nb(()=>{let p=!1;const m=new n(Jt.origin,{body:new eb,method:"POST",get duplex(){return p=!0,"half"}}).headers.has("Content-Type");return p&&!m}),u=i&&a&&nb(()=>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:k,onUploadProgress:S,responseType:T,headers:C,withCredentials:N="same-origin",fetchOptions:R}=SS(p),L=e||fetch;T=T?(T+"").toLowerCase():"text";let $=dD([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]=Yv(j,au(Jv(S)));v=Qv(te.body,Zv,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&&(T==="stream"||T==="response");if(u&&(k||V&&U)){const te={};["status","statusText","headers"].forEach(J=>{te[J]=_[J]});const ye=D.toFiniteNumber(_.headers.get("content-length")),[G,Q]=k&&Yv(ye,au(Jv(k),!0))||[];_=new r(Qv(_.body,Zv,G,()=>{Q&&Q(),U&&U()}),te)}T=T||"text";let ie=await d[D.findKey(d,T)||"text"](_,p);return!V&&U&&U(),await new Promise((te,ye)=>{wS(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)}}},yD=new Map,kS=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=yD;for(;a--;)l=s[a],c=u.get(l),c===void 0&&u.set(l,c=a?new Map:gD(e)),u=c;return c};kS();const xp={http:I_,xhr:uD,fetch:{get:kS}};D.forEach(xp,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const rb=t=>`- ${t}`,vD=t=>D.isFunction(t)||t===null||t===!1,TS={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,!vD(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(rb).join(`
5
- `):" "+rb(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 ob(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),TS.getAdapter(t.adapter||_l.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 xS(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 CS="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 sb={};Dd.transitional=function(e,n,r){function o(s,i){return"[Axios v"+CS+"] 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&&!sb[i]&&(sb[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 bD(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:bD,validators:Dd},Ar=zc.validators;let ks=class{constructor(e){this.defaults=e||{},this.interceptors={request:new qv,response:new qv}}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=[ob.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=ob.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=ES(e.baseURL,e.url,e.allowAbsoluteUrls);return yS(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 xD=class AS{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 AS(function(o){e=o}),cancel:e}}};function wD(t){return function(n){return t.apply(null,n)}}function ED(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 MS(t){const e=new ks(t),n=sS(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 MS(_s(t,o))},n}const yt=MS(_l);yt.Axios=ks;yt.CanceledError=qi;yt.CancelToken=xD;yt.isCancel=xS;yt.VERSION=CS;yt.toFormData=_d;yt.AxiosError=Ce;yt.Cancel=yt.CanceledError;yt.all=function(e){return Promise.all(e)};yt.spread=wD;yt.isAxiosError=ED;yt.mergeConfig=_s;yt.AxiosHeaders=En;yt.formToJSON=t=>bS(D.isHTMLForm(t)?new FormData(t):t);yt.getAdapter=TS.getAdapter;yt.HttpStatusCode=wp;yt.default=yt;const{Axios:Yte,AxiosError:ib,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||{}),OS=(t=>(t[t.POST=0]="POST",t[t.FEATURED_POST=1]="FEATURED_POST",t))(OS||{}),Ep=(t=>(t.User="mention",t.Group="hashtag",t))(Ep||{}),Dl=(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))(Dl||{}),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 SD=300,kD={[xe.Image]:"img",[xe.Video]:"video",[xe.Audio]:"audio",[xe.File]:"div"},TD={[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"}},CD=20,ab={images:"scrollableDiv-images",gifs:"scrollableDiv-gifs"},AD=300*1e3,Ma=10,MD=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 ib&&!t.isAxiosError)throw t;if(!t)throw new no(e(Nr.http.UNKNOWN_ERROR),0);if(t instanceof ib){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 OD(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,lb;function RD(){if(lb)return Kf;lb=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 ND=RD();const _D=fg(ND),hg="axios-retry";function RS(t){const e=["ERR_CANCELED","ECONNABORTED"];return t.response||!t.code||e.includes(t.code)?!1:_D(t)}const NS=["get","head","options"],DD=NS.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 ID(t){return t.config?.method?pg(t)&&NS.indexOf(t.config.method)!==-1:!1}function _S(t){return t.config?.method?pg(t)&&DD.indexOf(t.config.method)!==-1:!1}function DS(t){return RS(t)||_S(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 PD(t=0,e=void 0){return Math.max(0,mg(e))}function LD(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 jD(t=100){return(e=0,n=void 0)=>{const r=e*t;return Math.max(r,mg(n))}}const $D={retries:3,retryCondition:DS,retryDelay:PD,shouldResetTimeout:!1,onRetry:()=>{},onMaxRetryTimesExceeded:()=>{},validateResponse:null};function BD(t,e){return{...$D,...e,...t[hg]}}function cb(t,e,n=!1){const r=BD(t,e||{});return r.retryCount=r.retryCount||0,(!r.lastRequestTime||n)&&(r.lastRequestTime=Date.now()),t[hg]=r,r}function FD(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 HD(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 UD(t,e,n,r){e.retryCount+=1;const{retryDelay:o,shouldResetTimeout:s,onRetry:i}=e,a=o(e.retryCount,n);if(FD(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 zD(t,e){t.retryCount>=t.retries&&await t.onMaxRetryTimesExceeded(e,t.retryCount)}const fo=(t,e)=>{const n=t.interceptors.request.use(o=>(cb(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=cb(s,e);return o.response&&i.validateResponse?.(o.response)?o.response:await HD(i,o)?UD(t,i,o,s):(await zD(i,o),Promise.reject(o))});return{requestInterceptorId:n,responseInterceptorId:r}};fo.isNetworkError=RS;fo.isSafeRequestError=ID;fo.isIdempotentRequestError=_S;fo.isNetworkOrIdempotentRequestError=DS;fo.exponentialDelay=LD;fo.linearDelay=jD;fo.isRetryableError=pg;function VD(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 WD=t=>{switch(t){case"success":return KD;case"info":return JD;case"warning":return YD;case"error":return XD;default:return null}},GD=Array(12).fill(0),qD=({visible:t,className:e})=>M.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":t},M.createElement("div",{className:"sonner-spinner"},GD.map((n,r)=>M.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),KD=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"})),YD=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"})),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-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"})),XD=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"})),QD=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"})),ZD=()=>{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 eI{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(nI(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 eI,tI=(t,e)=>{const n=e?.id||kp++;return vn.addToast({title:t,...e,id:n}),n},nI=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",rI=tI,oI=()=>vn.toasts,sI=()=>vn.getActiveToasts(),$o=Object.assign(rI,{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:oI,getToasts:sI});VD("[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 iI=3,aI="24px",lI="16px",ub=4e3,cI=356,uI=14,dI=45,fI=200;function Mr(...t){return t.filter(Boolean).join(" ")}function hI(t){const[e,n]=t.split("-"),r=[];return e&&r.push(e),n&&r.push(n),r}const pI=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:k,closeButton:S,style:T,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||$||ub),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]),Bn=M.useMemo(()=>d.duration||$||ub,[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=ZD(),Ie=d.invert||u,ke=it==="loading";On.current=M.useMemo(()=>Dt*U+X,[Dt,X]),M.useEffect(()=>{ft.current=Bn},[Bn]),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)},fI)},[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(qD,{className:Mr(P?.loader,d==null||(ve=d.classNames)==null?void 0:ve.loader),visible:it==="loading"})}const qt=d.icon||H?.[it]||WD(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:k,"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`,...T,...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),Fn=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:Fn,W=Math.abs(A)/Ye;if(Math.abs(A)>=dI||W>.11){ut(On.current),d.onDismiss==null||d.onDismiss.call(d,d),ye(V==="x"?at>0?"right":"left":Fn>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:hI(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:QD):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 db(){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 mI(t,e){const n={};return[t,e].forEach((r,o)=>{const s=o===1,i=s?"--mobile-offset":"--offset",a=s?lI:aI;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 gI=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=iI,toastOptions:v,dir:w=db(),gap:E=uI,icons:x,containerAriaLabel:k="Notifications"}=e,[S,T]=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=>{T(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(()=>{T(Q=>Q.map(J=>J.id===G.id?{...J,delete:!0}:J))});return}setTimeout(()=>{Ml.flushSync(()=>{T(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":`${k} ${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"?db():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":`${cI}px`,"--gap":`${E}px`,...m,...mI(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(pI,{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}))}),yI=18e4,vI="http://localhost:3000/api",IS=()=>"en-US";function gg(t){const{token:e,baseURL:n=vI,timeout:r=yI}=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":IS()}},...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=OD(s);return $o.error(i),Pd(s,t.t,()=>{}),Promise.reject(s)}),o}const fb=new Map,ic=new Map,du=(t,e)=>async()=>{const n=Date.now(),r=fb.get(t);if(r&&n-r.timestamp<AD)return r.data;const o=ic.get(t);if(o)return o.promise;const s=e().then(i=>(fb.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 bI{isAuthorize;url;language;onError;api;token;toI18N;constructor(e,n,r,o){this.isAuthorize=!1,this.url=`${e}v1/`,this.language=o??IS(),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 xI(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 wI=new Uint8Array(16);function EI(){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(wI)}const SI=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),hb={randomUUID:SI};function kI(t,e,n){t=t||{};const r=t.random??t.rng?.()??EI();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,xI(r)}function ho(t,e,n){return hb.randomUUID&&!t?hb.randomUUID():kI(t)}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.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 CI{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 PS=M.createContext(null),AI=()=>{const t=M.useContext(PS);if(!t)throw new Error("usePostBuilder must be used within PostBuilderProvider");return t},Il=()=>{const{api:t}=AI();return t};var ac={exports:{}},ri={};/*
7
- object-assign
8
- (c) Sindre Sorhus
9
- @license MIT
10
- */var Jf,pb;function LS(){if(pb)return Jf;pb=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 mb;function MI(){if(mb)return ri;mb=1,LS();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 gb;function OI(){return gb||(gb=1,(function(t){process.env.NODE_ENV!=="production"&&(function(){var e=M,n=LS(),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,k="@@iterator";function S(A){if(A===null||typeof A!="object")return null;var W=x&&A[x]||A[k];return typeof W=="function"?W:null}var T=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=T.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=T.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(Un){ce=Un}Reflect.construct(A,[],Le)}else{try{Le.call()}catch(Un){ce=Un}A.call(Le.prototype)}}else{try{throw Error()}catch(Un){ce=Un}A()}}catch(Un){if(Un&&ce&&typeof Un.stack=="string"){for(var Pe=Un.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 Hn=`
28
- `+Pe[lt].replace(" at new "," at ");return typeof A=="function"&&he.set(A,Hn),Hn}while(lt>=1&&Ve>=0);break}}}finally{Me=!1,me.current=Te,J(),Error.prepareStackTrace=Re}var qr=A?A.displayName||A.name:"",la=qr?Z(qr):"";return typeof A=="function"&&he.set(A,la),la}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=T.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=T.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 Bn(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&&Bn(Le,Ve),Ot&&kr(Le,Ve)}return On(A,Pe,Ot,Re,ce,At.current,Le)}}var rn=T.ReactCurrentOwner,or=T.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 Hn=W.children;if(Hn!==void 0)if(ce)if(Array.isArray(Hn)){for(var qr=0;qr<Hn.length;qr++)Cr(Hn[qr],A);Object.freeze&&Object.freeze(Hn)}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(Hn,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 Fn=at,Ye=Ee;t.jsx=Fn,t.jsxs=Ye})()})(Xf)),Xf}var yb;function RI(){return yb||(yb=1,process.env.NODE_ENV==="production"?ac.exports=MI():ac.exports=OI()),ac.exports}var g=RI();const NI=({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 bI(e.core,n,r),c=new CI(e.mfs,n,r),u=new TI(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(PS.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 _I(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 jn(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,DI(o,...e)]}function DI(...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 vb(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=vb(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():vb(t[o],null)}}}}function Fe(...t){return b.useCallback(Ld(...t),t)}function Yo(t){const e=PI(t),n=b.forwardRef((r,o)=>{const{children:s,...i}=r,a=b.Children.toArray(s),l=a.find(jI);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 II=Yo("Slot");function PI(t){const e=b.forwardRef((n,r)=>{const{children:o,...s}=n;if(b.isValidElement(o)){const i=BI(o),a=$I(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 jS=Symbol("radix.slottable");function LI(t){const e=({children:n})=>g.jsx(g.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=jS,e}function jI(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===jS}function $I(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 BI(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]=jn(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),k=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:k,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,T)=>E.indexOf(S.ref.current)-E.indexOf(T.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:i,Slot:c,ItemSlot:h},p,r]}var Nt=globalThis?.document?b.useLayoutEffect:()=>{},FI=b[" useId ".trim().toString()]||(()=>{}),HI=0;function Yn(t){const[e,n]=b.useState(FI());return Nt(()=>{n(r=>r??String(HI++))},[t]),e?`radix-${e}`:""}var UI=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ge=UI.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 $S(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 zI=b[" useInsertionEffect ".trim().toString()]||Nt;function po({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[o,s,i]=VI({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=WI(u)?u(t):u;d!==t&&i.current?.(d)}else s(u)},[a,t,s,i]);return[l,c]}function VI({defaultProp:t,onChange:e}){const[n,r]=b.useState(t),o=b.useRef(n),s=b.useRef(e);return zI(()=>{s.current=e},[e]),b.useEffect(()=>{o.current!==n&&(s.current?.(n),o.current=n)},[n,o]),[n,r,s]}function WI(t){return typeof t=="function"}var GI=b.createContext(void 0);function jd(t){const e=b.useContext(GI);return t||e||"ltr"}var Qf="rovingFocusGroup.onEntryFocus",qI={bubbles:!1,cancelable:!0},Pl="RovingFocusGroup",[Tp,BS,KI]=yg(Pl),[YI,$d]=jn(Pl,[KI]),[JI,XI]=YI(Pl),FS=b.forwardRef((t,e)=>g.jsx(Tp.Provider,{scope:t.__scopeRovingFocusGroup,children:g.jsx(Tp.Slot,{scope:t.__scopeRovingFocusGroup,children:g.jsx(QI,{...t,ref:e})})}));FS.displayName=Pl;var QI=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:Pl}),[v,w]=b.useState(!1),E=pr(c),x=BS(n),k=b.useRef(!1),[S,T]=b.useState(0);return b.useEffect(()=>{const C=f.current;if(C)return C.addEventListener(Qf,E),()=>C.removeEventListener(Qf,E)},[E]),g.jsx(JI,{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(()=>T(C=>C+1),[]),onFocusableItemRemove:b.useCallback(()=>T(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,()=>{k.current=!0}),onFocus:ne(t.onFocus,C=>{const N=!k.current;if(C.target===C.currentTarget&&N&&!v){const R=new CustomEvent(Qf,qI);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);zS(j,u)}}k.current=!1}),onBlur:ne(t.onBlur,()=>w(!1))})})}),HS="RovingFocusGroupItem",US=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,children:i,...a}=t,l=Yn(),c=s||l,u=XI(HS,n),d=u.currentTabStopId===c,f=BS(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=tP(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?nP(E,x+1):E.slice(x+1)}setTimeout(()=>zS(E))}}),children:typeof i=="function"?i({isCurrentTabStop:d,hasTabStop:m!=null}):i})})});US.displayName=HS;var ZI={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function eP(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function tP(t,e,n){const r=eP(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return ZI[r]}function zS(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function nP(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var VS=FS,WS=US;function rP(t,e){return b.useReducer((n,r)=>e[n][r]??n,t)}var $n=t=>{const{present:e,children:n}=t,r=oP(e),o=typeof n=="function"?n({present:r.isPresent}):b.Children.only(n),s=Fe(r.ref,sP(o));return typeof n=="function"||r.isPresent?b.cloneElement(o,{ref:s}):null};$n.displayName="Presence";function oP(t){const[e,n]=b.useState(),r=b.useRef(null),o=b.useRef(t),s=b.useRef("none"),i=t?"mounted":"unmounted",[a,l]=rP(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 sP(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",[iP]=jn(Bd,[$d]),GS=$d(),[aP,vg]=iP(Bd),qS=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(aP,{scope:n,baseId:Yn(),value:d,onValueChange:f,orientation:i,dir:u,activationMode:l,children:g.jsx(ge.div,{dir:u,"data-orientation":i,...c,ref:e})})});qS.displayName=Bd;var KS="TabsList",YS=b.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...o}=t,s=vg(KS,n),i=GS(n);return g.jsx(VS,{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})})});YS.displayName=KS;var JS="TabsTrigger",XS=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...s}=t,i=vg(JS,n),a=GS(n),l=ek(i.baseId,r),c=tk(i.baseId,r),u=r===i.value;return g.jsx(WS,{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)})})})});XS.displayName=JS;var QS="TabsContent",ZS=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:o,children:s,...i}=t,a=vg(QS,n),l=ek(a.baseId,r),c=tk(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($n,{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})})});ZS.displayName=QS;function ek(t,e){return`${t}-trigger-${e}`}function tk(t,e){return`${t}-content-${e}`}var lP=qS,cP=YS,uP=XS,dP=ZS;function fP(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 hP(t){return t.replace(/^\n*/,"")}function pP(t){for(var e=t.length;e>0&&t[e-1]===`
33
- `;)e--;return t.substring(0,e)}var mP=["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,mP)}var nk=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function rk(t){return xg(t,nk)}function gP(t){return sk(t,nk)}var ok=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function yP(t){return xg(t,ok)}function vP(t){return sk(t,ok)}function xg(t,e){return e.indexOf(t.nodeName)>=0}function sk(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?"!["+n+"]("+r+s+")":""}};function fu(t){return t?t.replace(/(\n+\s*)+/g,`
80
- `):""}function ik(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])}ik.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(bP(o,e,n))return o}}function bP(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 xP(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=bb(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=bb(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 bb(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 wP(){var t=wg.DOMParser,e=!1;try{new t().parseFromString("","text/html")&&(e=!0)}catch{}return e}function EP(){var t=function(){};return SP()?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 SP(){var t=!1;try{document.implementation.createHTMLDocument("").open()}catch{wg.ActiveXObject&&(t=!0)}return t}var kP=wP()?wg.DOMParser:EP();function TP(t,e){var n;if(typeof t=="string"){var r=CP().parseFromString('<x-turndown id="turndown-root">'+t+"</x-turndown>","text/html");n=r.getElementById("turndown-root")}else n=t.cloneNode(!0);return xP({element:n,isBlock:bg,isVoid:rk,isPre:e.preformattedCode?AP:null}),n}var th;function CP(){return th=th||new kP,th}function AP(t){return t.nodeName==="PRE"||t.nodeName==="CODE"}function MP(t,e){return t.isBlock=bg(t),t.isCode=t.nodeName==="CODE"||t.parentNode.isCode,t.isBlank=OP(t),t.flankingWhitespace=RP(t,e),t}function OP(t){return!rk(t)&&!yP(t)&&/^\s*$/i.test(t.textContent)&&!gP(t)&&!vP(t)}function RP(t,e){if(t.isBlock||e.preformattedCode&&t.isCode)return{leading:"",trailing:""};var n=NP(t.textContent);return n.leadingAscii&&xb("left",t,e)&&(n.leading=n.leadingNonAscii),n.trailingAscii&&xb("right",t,e)&&(n.trailing=n.trailingNonAscii),{leading:n.leading,trailing:n.trailing}}function NP(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 xb(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 _P=Array.prototype.reduce,DP=[[/\\/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=fP({},e,t),this.rules=new ik(this.options)}hu.prototype={turndown:function(t){if(!LP(t))throw new TypeError(t+" is not a string, or an element/document/fragment node.");if(t==="")return"";var e=ak.call(this,new TP(t,this.options));return IP.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 DP.reduce(function(e,n){return e.replace(n[0],n[1])},t)}};function ak(t){var e=this;return _P.call(t.childNodes,function(n,r){r=new MP(r,e.options);var o="";return r.nodeType===3?o=r.isCode?r.nodeValue:e.escape(r.nodeValue):r.nodeType===1&&(o=PP.call(e,r)),lk(n,o)},"")}function IP(t){var e=this;return this.rules.forEach(function(n){typeof n.append=="function"&&(t=lk(t,n.append(e.options)))}),t.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function PP(t){var e=this.rules.forNode(t),n=ak.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 lk(t,e){var n=pP(t),r=hP(e),o=Math.max(t.length-n.length,e.length-r.length),s=`
91
-
92
- `.substring(0,o);return n+s+r}function LP(t){return t!=null&&(typeof t=="string"||t.nodeType&&(t.nodeType===1||t.nodeType===9||t.nodeType===11))}const jP=new hu;jP.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 ck(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=ck(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function uk(){for(var t,e,n=0,r="",o=arguments.length;n<o;n++)(t=arguments[n])&&(e=ck(t))&&(r&&(r+=" "),r+=e);return r}const Eg="-",$P=t=>{const e=FP(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:i=>{const a=i.split(Eg);return a[0]===""&&a.length!==1&&a.shift(),dk(a,e)||BP(i)},getConflictingClassGroupIds:(i,a)=>{const l=n[i]||[];return a&&r[i]?[...l,...r[i]]:l}}},dk=(t,e)=>{if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),o=r?dk(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},wb=/^\[(.+)\]$/,BP=t=>{if(wb.test(t)){const e=wb.exec(t)[1],n=e?.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},FP=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:Eb(e,o);s.classGroupId=n;return}if(typeof o=="function"){if(HP(o)){Ap(o(r),e,n,r);return}e.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([s,i])=>{Ap(i,Eb(e,s),n,r)})})},Eb=(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},HP=t=>t.isThemeGetter,UP=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=":",zP=Op.length,VP=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+zP;continue}if(m==="/"){c=p;continue}}m==="["?i++:m==="]"?i--:m==="("?a++:m===")"&&a--}const u=s.length===0?o:o.substring(l),d=WP(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},WP=t=>t.endsWith(Mp)?t.substring(0,t.length-1):t.startsWith(Mp)?t.substring(1):t,GP=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}},qP=t=>({cache:UP(t.cacheSize),parseClassName:VP(t),sortModifiers:GP(t),...$P(t)}),KP=/\s+/,YP=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:s}=e,i=[],a=t.trim().split(KP);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 k=o(v,y);for(let S=0;S<k.length;++S){const T=k[S];i.push(E+T)}l=u+(l.length>0?" "+l:l)}return l};function JP(){let t=0,e,n,r="";for(;t<arguments.length;)(e=arguments[t++])&&(n=fk(e))&&(r&&(r+=" "),r+=n);return r}const fk=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=fk(t[r]))&&(n&&(n+=" "),n+=e);return n};function XP(t,...e){let n,r,o,s=i;function i(l){const c=e.reduce((u,d)=>d(u),t());return n=qP(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=YP(l,n);return o(l,u),u}return function(){return s(JP.apply(null,arguments))}}const Rt=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},hk=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,pk=/^\((?:(\w[\w-]*):)?(.+)\)$/i,QP=/^\d+\/\d+$/,ZP=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,eL=/\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$/,tL=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,nL=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,rL=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,oi=t=>QP.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=>ZP.test(t),oL=()=>!0,sL=t=>eL.test(t)&&!tL.test(t),mk=()=>!1,iL=t=>nL.test(t),aL=t=>rL.test(t),lL=t=>!oe(t)&&!se(t),cL=t=>Ki(t,vk,mk),oe=t=>hk.test(t),ps=t=>Ki(t,bk,sL),rh=t=>Ki(t,pL,_e),Sb=t=>Ki(t,gk,mk),uL=t=>Ki(t,yk,aL),cc=t=>Ki(t,xk,iL),se=t=>pk.test(t),ua=t=>Yi(t,bk),dL=t=>Yi(t,mL),kb=t=>Yi(t,gk),fL=t=>Yi(t,vk),hL=t=>Yi(t,yk),uc=t=>Yi(t,xk,!0),Ki=(t,e,n)=>{const r=hk.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},Yi=(t,e,n=!1)=>{const r=pk.exec(t);return r?r[1]?e(r[1]):n:!1},gk=t=>t==="position"||t==="percentage",yk=t=>t==="image"||t==="url",vk=t=>t==="length"||t==="size"||t==="bg-size",bk=t=>t==="length",pL=t=>t==="number",mL=t=>t==="family-name",xk=t=>t==="shadow",gL=()=>{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"],k=()=>[...x(),se,oe],S=()=>["auto","hidden","clip","visible","scroll"],T=()=>["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(),kb,Sb,{position:[se,oe]}],ie=()=>["no-repeat",{repeat:["","x","y","space","round"]}],te=()=>["auto","cover","contain",fL,cL,{size:[se,oe]}],ye=()=>[nh,ua,ps],G=()=>["","none","full",c,se,oe],Q=()=>["",_e,ua,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,kb,Sb],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:[oL],container:[Yr],"drop-shadow":[Yr],ease:["in","out","in-out"],font:[lL],"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:k()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],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,ua,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:[dL,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]},hL,uL]}],"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,ua,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":k()}],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:k()}],"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,ua,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"]}},yL=XP(gL);function re(...t){return yL(uk(t))}const wk=t=>Object.entries(t).filter(([e])=>isNaN(Number(e))).map(([e,n])=>({label:e,value:n})),dc=t=>t instanceof File||t instanceof Blob,vL=t=>typeof t=="string"&&(t.startsWith("http://")||t.startsWith("https://")),bL=(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 Ek({className:t,...e}){return g.jsx(lP,{"data-slot":"tabs",className:re("flex flex-col gap-2",t),...e})}function Sk({className:t,...e}){return g.jsx(cP,{"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(uP,{"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 Tb({className:t,...e}){return g.jsx(dP,{"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 Cb;function xL(){if(Cb)return oh;Cb=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 Ab;function wL(){return Ab||(Ab=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 Mb;function Sg(){return Mb||(Mb=1,process.env.NODE_ENV==="production"?fc.exports=xL():fc.exports=wL()),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 kk(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=kk(o.content,s.content,n+1);if(i!=null)return i}n+=o.nodeSize}}function Tk(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=Tk(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 kk(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return Tk(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=Ak(this.content,e+this.openStart,n);return r&&new ee(r,this.openStart,this.openEnd)}removeBetween(e,n){return new ee(Ck(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 Ck(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(Ck(s.content,e-o-1,n-o-1)))}function Ak(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=Ak(i.content,e-s-1,n,i);return a&&t.replaceChild(o,i.copy(a))}function EL(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 Mk(t,e,n,0)}function Mk(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=Mk(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}=SL(n,t);return Cs(s,Rk(t,i,a,e,r))}else return Cs(s,gu(t,e,r))}function Ok(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 Ok(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 Oa(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 Rk(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 Oa(null,t,o,a),s&&i&&e.index(o)==n.index(o)?(Ok(s,i),Ts(Cs(s,Rk(t,e,n,r,o+1)),a)):(s&&Ts(Cs(s,gu(t,e,o+1)),a),Oa(e,n,o,a),i&&Ts(Cs(i,gu(n,r,o+1)),a)),Oa(r,null,o,a),new F(a)}function gu(t,e,n){let r=[];if(Oa(null,t,n,r),t.depth>n){let o=_p(t,e,n+1);Ts(Cs(o,gu(t,e,n+1)),r)}return Oa(e,null,n,r),new F(r)}function SL(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 Ga{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 qa(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 Ga(n,r,s)}static resolveCached(e,n){let r=Ob.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 Ob.set(e,r=new kL);let o=r.elts[r.i]=Ga.resolve(e,n);return r.i=(r.i+1)%TL,o}}class kL{constructor(){this.elts=[],this.i=0}}const TL=12,Ob=new WeakMap;class qa{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 CL=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||CL)&&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 EL(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 Ga.resolveCached(this,e)}resolveNoCache(e){return Ga.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()+")"),Nk(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):Nk(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 Nk(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 AL(e,n);if(r.next==null)return Ds.empty;let o=_k(r);r.next&&r.err("Unexpected trailing text");let s=IL(DL(o));return PL(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 AL{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 _k(t){let e=[];do e.push(ML(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function ML(t){let e=[];do e.push(OL(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function OL(t){let e=_L(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=RL(t,e);else break;return e}function Rb(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function RL(t,e){let n=Rb(t),r=n;return t.eat(",")&&(t.next!="}"?r=Rb(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function NL(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 _L(t){if(t.eat("(")){let e=_k(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=NL(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 DL(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 Dk(t,e){return e-t}function Nb(t,e){let n=[];return r(e),n.sort(Dk);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 IL(t){let e=Object.create(null);return n(Nb(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]);Nb(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(Dk);s.next.push({type:o[i][0],next:e[a.join(",")]||n(a)})}return s}}function PL(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 Ik(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 Pk(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 Lk(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 jk(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new jL(t,r,e[r]);return n}let _b=class $k{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=jk(e,r.attrs),this.defaultAttrs=Ik(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:Pk(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){Lk(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 $k(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 LL(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 jL{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?LL(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=jk(e,o.attrs),this.excluded=null;let s=Ik(this.attrs);this.instance=s?new Xe(this,s):null}create(e=null){return!e&&this.instance?this.instance:new Xe(this,Pk(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){Lk(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Bk{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=_b.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?Db(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==""?[]:Db(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 _b){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 Db(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 $L(t){return t.tag!=null}function BL(t){return t.style!=null}let Ra=class Ip{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(o=>{if($L(o))this.tags.push(o);else if(BL(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 Pb(this,n,!1);return r.addAll(e,Xe.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new Pb(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(UL(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=Lb(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=Lb(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 Fk={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},FL={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Hk={ol:!0,ul:!0},Ka=1,Pp=2,Na=4;function Ib(t,e,n){return e!=null?(e?Ka:0)|(e==="full"?Pp:0):t&&t.whitespace=="pre"?Ka|Pp:n&~Na}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&Na?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&Ka)){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&&!Fk.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Pb{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=Ib(null,n.preserveWhitespace,0)|(r?Na: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&Ka)>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;Hk.hasOwnProperty(i)&&this.parser.normalizeLists&&HL(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:FL.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(Fk.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):jb(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=Ib(e,s,i.options);i.options&Na&&i.content.length==0&&(a|=Na);let l=Xe.none;return r=r.filter(c=>(i.type?i.type.allowsMarkType(c.type):jb(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|=Ka)}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 HL(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Hk.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function UL(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Lb(t){let e={};for(let n in t)e[n]=t[n];return e}function jb(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=$b(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return $b(e.marks)}}function $b(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 Bb=new WeakMap;function zL(t){let e=Bb.get(t);return e===void 0&&Bb.set(t,e=VL(t)),e}function VL(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=zL(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 Uk=65535,zk=Math.pow(2,16);function WL(t,e){return t+e*zk}function Fb(t){return t&Uk}function GL(t){return(t-(t&Uk))/zk}const Vk=1,Wk=2,Wc=4,Gk=8;class Lp{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&Gk)>0}get deletedBefore(){return(this.delInfo&(Vk|Wc))>0}get deletedAfter(){return(this.delInfo&(Wk|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=Fb(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+GL(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:WL(a/3,e-l),m=e==l?Wk:e==d?Vk:Wc;return(n<0?e!=l:e!=d)&&(m|=Gk),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=Fb(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 Ya{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 Ya(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 Ya;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 qL(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 KL(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 YL(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||!YL(o,s,i))break}return null}function JL(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=XL(t,e),s=o&&QL(r,e);return s?o.map(Hb).concat({type:e,attrs:n}).concat(s.map(Hb)):null}function Hb(t){return{type:t,attrs:null}}function XL(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 QL(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 ZL(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 ej(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)&&tj(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&&Kk(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&&qk(t,i,a,s),!1}})}function qk(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 Kk(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 tj(t,e,n){let r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}function nj(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 rj(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 Yk(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function oj(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 Yk(t,e){return!!(t&&e&&!t.isLeaf&&oj(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&&Yk(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 sj(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);Kk(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);qk(t,u.node(),u.before(),t.steps.length)}return t}function ij(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 Jk(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 Xk(o,s,r)?new Lt(e,n,r):new aj(o,s,r).fit()}function Xk(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class aj{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(Ea(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new ee(Ea(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(Qk(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=Sa(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(Ea(i.content,e-1,1),e-1,h<0?i.openEnd:e-1):new ee(Ea(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=Sa(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=Sa(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=Sa(this.placed,this.frontier.length,n))}}function Ea(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Ea(t.firstChild.content,e-1,n)))}function Sa(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Sa(t.lastChild.content,e-1,n)))}function ch(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function Qk(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,Qk(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&&!lj(n,s.content,i)?a:null}function lj(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function cj(t){return t.spec.defining||t.spec.definingForContent}function uj(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let o=t.doc.resolve(e),s=t.doc.resolve(n);if(Xk(o,s,r))return t.step(new Lt(e,n,r));let i=e1(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=cj(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(Zk(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 Zk(t,e,n,r,o){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(Zk(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 dj(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let o=ij(t.doc,e,r.type);o!=null&&(e=n=o)}t.replaceRange(e,n,new ee(F.from(r),0,0))}function fj(t,e,n){let r=t.doc.resolve(e),o=t.doc.resolve(n),s=e1(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 e1(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 Ja 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 Ja(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 Ja(n.attr,n.value)}}tn.jsonID("docAttr",Ja);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 t1{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Ya}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 uj(this,e,n,r),this}replaceRangeWith(e,n,r){return dj(this,e,n,r),this}deleteRange(e,n){return fj(this,e,n),this}lift(e,n){return JL(this,e,n),this}join(e,n=1){return sj(this,e,n),this}wrap(e,n){return ZL(this,e,n),this}setBlockType(e,n=e,r,o=null){return ej(this,e,n,r,o),this}setNodeMarkup(e,n,r=null,o){return nj(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 Ja(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 rj(this,e,n,r),this}addMark(e,n,r){return qL(this,e,n,r),this}removeMark(e,n,r){return KL(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 n1(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&&Vb(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),Vb(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 n1{constructor(e,n){this.$from=e,this.$to=n}}let Ub=!1;function zb(t){!Ub&&!t.parent.inlineContent&&(Ub=!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){zb(e),zb(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 hj}}Oe.jsonID("all",Sn);const hj={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 Vb(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 Wb=1,mc=2,Gb=4;let pj=class extends t1{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|Wb)&~mc,this.storedMarks=null,this}get selectionSet(){return(this.updated&Wb)>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|=Gb,this}get scrolledIntoView(){return(this.updated&Gb)>0}};function qb(t,e){return!e||!t?t:t.bind(e)}class ka{constructor(e,n,r){this.name=e,this.init=qb(n.init,r),this.apply=qb(n.apply,r)}}const mj=[new ka("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new ka("selection",{init(t,e){return t.selection||Oe.atStart(e.doc)},apply(t){return t.selection}}),new ka("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new ka("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=mj.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 ka(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 pj(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 r1(t,e,n){for(let r in t){let o=t[r];o instanceof Function?o=o.bind(e):r=="handleDOMEvents"&&(o=r1(o,e,{})),n[r]=o}return n}class Ue{constructor(e){this.spec=e,this.props={},e.props&&r1(e.props,this,this.props),this.key=e.key?e.key.key:o1("plugin")}getState(e){return e[this.key]}}const hh=Object.create(null);function o1(t){return t in hh?t+"$"+ ++hh[t]:(hh[t]=0,t+"$")}class We{constructor(e="key"){this.key=o1(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 s1(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const i1=(t,e,n)=>{let r=s1(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(m1(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},gj=(t,e,n)=>{let r=s1(t,n);if(!r)return!1;let o=Rg(r);return o?a1(t,o,e):!1},yj=(t,e,n)=>{let r=c1(t,n);if(!r)return!1;let o=Ng(r);return o?a1(t,o,e):!1};function a1(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 l1=(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 c1(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const u1=(t,e,n)=>{let r=c1(t,n);if(!r)return!1;let o=Ng(r);if(!o)return!1;let s=o.nodeAfter;if(m1(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},d1=(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 vj=(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},bj=(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},xj=(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)},f1=(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 wj=(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},h1=(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},p1=(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 Ej(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 Sj=Ej(),kj=(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 Tj(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 m1(t,e,n,r){let o=e.nodeBefore,s=e.nodeAfter,i,a,l=o.type.spec.isolating||s.type.spec.isolating;if(!l&&Tj(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 g1(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 Cj=g1(-1),Aj=g1(1);function Mj(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 Kb(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,i1,l1);Dg(Og,u1,d1);Dg(f1,h1,p1,Sj);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function Oj(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 Rj(a,i,t,e)?(r&&r(a.scrollIntoView()),!0):!1}}function Rj(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 qa(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new qa(e.$from,i.resolve(e.$to.end(e.depth)),e.depth)),o=!0}let a=Ag(s,n,r,e);return a?(t&&Nj(t,e,a,o,n),!0):!1}function Nj(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 _j(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?Dj(e,n,t,s):Ij(e,n,s):!0:!1}}function Dj(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 qa(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 Ij(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 Pj(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},Lj=function(){$p=null},Ps=function(t,e,n,r){return n&&(Yb(t,e,n,r,-1)||Yb(t,e,n,r,1))},jj=/^(img|br|input|textarea|hr)$/i;function Yb(t,e,n,r,o){for(var s;;){if(t==n&&e==r)return!0;if(e==(o<0?0:qn(t))){let i=t.parentNode;if(!i||i.nodeType!=1||Ll(t)||jj.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?qn(t):0}else return!1}}function qn(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function $j(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=qn(t)}else if(t.parentNode&&!Ll(t))e=Vt(t),t=t.parentNode;else return null}}function Bj(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&&!Ll(t))e=Vt(t)+1,t=t.parentNode;else return null}}function Fj(t,e,n){for(let r=e==0,o=e==qn(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==qn(t)}}function Ll(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 Hj(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Uj(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(qn(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(qn(r.startContainer),r.startOffset)}}}const Hr=typeof navigator<"u"?navigator:null,Jb=typeof document<"u"?document:null,ls=Hr&&Hr.userAgent||"",Bp=/Edge\/(\d+)/.exec(ls),y1=/MSIE \d/.exec(ls),Fp=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ls),kn=!!(y1||Fp||Bp),Go=y1?document.documentMode:Fp?+Fp[1]:Bp?+Bp[1]:0,Jn=!kn&&/gecko\/(\d+)/i.test(ls);Jn&&+(/Firefox\/(\d+)/.exec(ls)||[0,0])[1];const Hp=!kn&&/Chrome\/(\d+)/.exec(ls),Xt=!!Hp,v1=Hp?+Hp[1]:0,ln=!kn&&!!Hr&&/Apple Computer/.test(Hr.vendor),Ni=ln&&(/Mobile\/\w+/.test(ls)||!!Hr&&Hr.maxTouchPoints>2),Gn=Ni||(Hr?/Mac/.test(Hr.platform):!1),zj=Hr?/Win/.test(Hr.platform):!1,so=/Android \d/.test(ls),jl=!!Jb&&"webkitFontSmoothing"in Jb.documentElement.style,Vj=jl?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Wj(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 Gj(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 Xb(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?Wj(s):Gj(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 qj(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:b1(t.dom)}}function b1(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 Kj({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;x1(n,r==0?0:r-e)}function x1(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 Yj(t){if(t.setActive)return t.setActive();if(si)return t.focus(si);let e=b1(t);t.focus(si==null?{get preventScroll(){return si={preventScroll:!0},!0}}:void 0),si||(si=!1,x1(e,0))}function w1(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?Jj(n,o):!n||r&&n.nodeType==1?{node:t,offset:s}:w1(n,o)}function Jj(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 Xj(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function Qj(t,e,n){let{node:r,offset:o}=w1(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 Zj(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 E1(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 E1(i,e,c)}}if((s=(s+1)%r)==o)break}return t}function e2(t,e){let n=t.dom.ownerDocument,r,o=0,s=Uj(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=E1(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=Xj(i,e),r){if(Jn&&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;jl&&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=Zj(t,r,o,e))}a==null&&(a=Qj(t,i,e));let l=t.docView.nearestDesc(i,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function Qb(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(Qb(r))return r}return Array.prototype.find.call(n,Qb)||t.getBoundingClientRect()}const t2=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function S1(t,e,n){let{node:r,offset:o,atom:s}=t.docView.domFromPos(e,n<0?-1:1),i=jl||Jn;if(r.nodeType==3)if(i&&(t2.test(r.nodeValue)||(n<0?!o:o==r.nodeValue.length))){let l=Oo(ro(r,o,o),n);if(Jn&&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 da(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++,da(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==qn(r))){let l=r.childNodes[o-1];if(l.nodeType==1)return ph(l.getBoundingClientRect(),!1)}if(s==null&&o<qn(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==qn(r))){let l=r.childNodes[o-1],c=l.nodeType==3?ro(l,qn(l)-(i?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return da(Oo(c,1),!1)}if(s==null&&o<qn(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 da(Oo(c,-1),!0)}return da(Oo(r.nodeType==3?ro(r):r,-n),n>=0)}function da(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 k1(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 n2(t,e,n){let r=e.selection,o=n=="up"?r.$from:r.$to;return k1(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=S1(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 r2=/[\u0590-\u08ac]/;function o2(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?!r2.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?s:i:k1(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 Zb=null,e0=null,t0=!1;function s2(t,e,n){return Zb==e&&e0==n?t0:(Zb=e,e0=n,t0=n=="up"||n=="down"?n2(t,e,n):o2(t,e,n))}const Xn=0,n0=1,xs=2,Ur=3;class $l{constructor(e,n,r,o){this.parent=e,this.children=n,this.dom=r,this.contentDOM=o,this.dirty=Xn,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 C1){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 T1&&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((Jn||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(Jn&&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&&Jn)){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:n0,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:n0;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class T1 extends $l{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==Xn&&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 i2 extends $l{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 $l{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!=Xn){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Xn}}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 $l{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=O1(u,r,n),c?l=new a2(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==Xn&&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 c2(this,i&&i.node,e);f2(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),A1(this.contentDOM,this.children,e),Ni&&h2(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=p2(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 i2(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=Xn}updateOuterDeco(e){if(vu(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=M1(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 r0(t,e,n,r,o){O1(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!=Xn&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Xn||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=Xn,!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 C1 extends $l{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Xn&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class a2 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 A1(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=o0(r),o=!0;r=r.nextSibling}else o=!0,t.insertBefore(a,r);if(i instanceof Ls){let l=r?r.previousSibling:t.lastChild;A1(i.contentDOM,i.children,n),r=l?l.nextSibling:t.firstChild}}for(;r;)r=o0(r),o=!0;o&&n.trackWrites==t&&(n.trackWrites=null)}const _a=function(t){t&&(this.nodeName=t)};_a.prototype=Object.create(null);const ws=[new _a];function Up(t,e,n){if(t.length==0)return ws;let r=n?ws[0]:new _a,o=[r];for(let s=0;s<t.length;s++){let i=t[s].type.attrs;if(i){i.nodeName&&o.push(r=new _a(i.nodeName));for(let a in i){let l=i[a];l!=null&&(n&&o.length==1&&o.push(r=new _a(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 M1(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}l2(o,a||ws[0],i)}return o}function l2(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 O1(t,e,n){return M1(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 o0(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class c2{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=u2(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=Xn,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=Xn),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 T1(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 C1(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 u2(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 d2(t,e){return t.type.side-e.type.side}function f2(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(d2);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 h2(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 p2(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&&Fj(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 R1(t){return t.editable?t.hasFocus():_1(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function lo(t,e=!1){let n=t.state.selection;if(N1(t,n),!!R1(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)g2(t);else{let{anchor:r,head:o}=n,s,i;s0&&!(n instanceof pe)&&(n.$from.parent.inlineContent||(s=i0(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(i=i0(t,n.to))),t.docView.setSelection(r,o,t,e),s0&&(s&&a0(s),i&&a0(i)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&m2(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const s0=ln||Xt&&v1<63;function i0(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 a0(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function m2(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(()=>{(!R1(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function g2(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 N1(t,e){if(e instanceof ue){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(l0(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else l0(t)}function l0(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 c0(t){return t.editable&&!t.hasFocus()?!1:_1(t)}function _1(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 y2(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 u0(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(!(Gn&&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)):jl?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 Da(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?v2(t):b2(t)}function v2(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o,s,i=!1;for(Jn&&n.nodeType==1&&r<bu(n)&&Da(n.childNodes[r],-1)&&(i=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(Da(a,-1))o=n,s=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(D1(n))break;{let a=n.previousSibling;for(;a&&Da(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 b2(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(Da(a,1))s=n,i=++r;else break}else{if(D1(n))break;{let a=n.nextSibling;for(;a&&Da(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 D1(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function x2(t,e){for(;t&&e==t.childNodes.length&&!Ll(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 w2(t,e){for(;t&&!e&&!Ll(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=x2(e,n))?(e=i,n=0):(s=w2(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 d0(t,e){let n=t.state.doc.resolve(e);if(!(Xt||zj)&&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 f0(t,e,n){let r=t.state.selection;if(r instanceof pe&&!r.empty||n.indexOf("s")>-1||Gn&&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 h0(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 p0(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function E2(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;p0(t,r,"true"),setTimeout(()=>p0(t,r,"false"),20)}return!1}function S2(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function k2(t,e){let n=e.keyCode,r=S2(e);if(n==8||Gn&&n==72&&r=="c")return h0(t,-1)||ii(t,-1);if(n==46&&!e.shiftKey||Gn&&n==68&&r=="c")return h0(t,1)||ii(t,1);if(n==13||n==27)return!0;if(n==37||Gn&&n==66&&r=="c"){let o=n==37?d0(t,t.state.selection.from)=="ltr"?-1:1:-1;return u0(t,o,r)||ii(t,o)}else if(n==39||Gn&&n==70&&r=="c"){let o=n==39?d0(t,t.state.selection.from)=="ltr"?1:-1:1;return u0(t,o,r)||ii(t,o)}else{if(n==38||Gn&&n==80&&r=="c")return f0(t,-1,r)||ii(t,-1);if(n==40||Gn&&n==78&&r=="c")return E2(t)||f0(t,1,r)||ii(t,1);if(r==(Gn?"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=B1(),l=a.createElement("div");l.appendChild(i.serializeFragment(r,{document:a}));let c=l.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=$1[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 I1(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=M2(n),jl&&O2(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")||Ra.fromSchema(t.state.schema)).parseSlice(i,{preserveWhitespace:!!(l||u),context:o,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!T2.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)a=R2(m0(a,+u[1],+u[2]),u[4]);else if(a=ee.maxOpen(C2(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=m0(a,d,f)}return t.someProp("transformPasted",d=>{a=d(a,t,l)}),a}const T2=/^(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 C2(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&&L1(l,s,a,i[i.length-1],0))i[i.length-1]=c;else{i.length&&(i[i.length-1]=j1(i[i.length-1],s.length));let u=P1(a,l);i.push(u),o=o.matchType(u.type),s=l}}),i)return F.from(i)}return t}function P1(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,F.from(t));return t}function L1(t,e,n,r,o){if(o<t.length&&o<e.length&&t[o]==e[o]){let s=L1(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(P1(n,t,o+1))))}}function j1(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,j1(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 m0(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 $1={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 g0=null;function B1(){return g0||(g0=document.implementation.createHTMLDocument("title"))}let gh=null;function A2(t){let e=window.trustedTypes;return e?(gh||(gh=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),gh.createHTML(t)):t}function M2(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=B1().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),o;if((o=r&&$1[r[1].toLowerCase()])&&(t=o.map(s=>"<"+s+">").join("")+t+o.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=A2(t),o)for(let s=0;s<o.length;s++)n=n.querySelector(o[s])||n;return n}function O2(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 R2(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={},N2={touchstart:!0,touchmove:!0};class _2{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 D2(t){for(let e in cn){let n=cn[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{P2(t,r)&&!$g(t,r)&&(t.editable||!(r.type in un))&&n(t,r)},N2[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 I2(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 P2(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 L2(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,!H1(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))||k2(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(H1(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Gn&&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 j2(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 $2(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 B2(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 F2(t,e,n,r,o){return Bg(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(o?B2(t,n):$2(t,n))}function H2(t,e,n,r){return Bg(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",o=>o(t,e,r))}function U2(t,e,n,r){return Bg(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",o=>o(t,e,r))||z2(t,n,r)}function z2(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 F1=Gn?"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&&j2(n,t.input.lastClick)&&!n[F1]&&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 V2(t,i,n,!!r)):(s=="doubleClick"?H2:U2)(t,i.pos,i.inside,n)?n.preventDefault():Ho(t,"pointer"))};class V2{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[F1],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&&Jn&&!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"):F2(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 H1(t,e){return t.composing?!0:ln&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const W2=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),Jn&&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}U1(t,W2)};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++,U1(t,20))};function U1(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>xu(t),e))}function z1(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=q2());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function G2(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=$j(e.focusNode,e.focusOffset),r=Bj(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 q2(){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(),z1(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 K2(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 Xa=kn&&Go<15||Ni&&Vj<604;cn.copy=un.cut=(t,e)=>{let n=e,r=t.state.selection,o=n.type=="cut";if(r.empty)return;let s=Xa?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)):K2(t,a),o&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Y2(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function J2(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?Qa(t,r.value,null,o,e):Qa(t,r.textContent,r.innerHTML,o,e)},50)}function Qa(t,e,n,r,o){let s=I1(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=Y2(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 V1(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=Xa?null:n.clipboardData,o=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Qa(t,V1(r),r.getData("text/html"),o,n)?n.preventDefault():J2(t,n)};class W1{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const X2=Gn?"altKey":"ctrlKey";function G1(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[X2]}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||v1>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Xa?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",Xa||n.dataTransfer.setData("text/plain",c),t.dragging=new W1(u,G1(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=I1(t,V1(n.dataTransfer),Xa?null:n.dataTransfer.getData("text/html"),!1,s);let a=!!(r&&G1(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?Jk(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 Za(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&&Za(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&&Za(this.attrs,e.attrs)&&Za(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&&Za(this.attrs,e.attrs)&&Za(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?Q2(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=K1(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=q1(s?Y1(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 Q2(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=Z2(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 q1(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 Z2(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 K1(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 Y1(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=K1(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=q1(s?Y1(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),y0(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),y0(e,o,r.copy(s.from,r.to)));break}}}return e}function y0(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 e$={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},t$=kn&&Go<=11;class n${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 r${constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new n$,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()}),t$&&(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,e$)),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(c0(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)&&c0(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(Jn&&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||i$(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),o$(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 v0=new WeakMap,b0=!1;function o$(t){if(!v0.has(t)&&(v0.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Jn,b0)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."),b0=!0}}function x0(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 s$(t,e){if(e.getComposedRanges){let o=e.getComposedRanges(t.root)[0];if(o)return x0(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?x0(t,n):null}function i$(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 a$(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")||Ra.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:l$,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 l$(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 c$=/^(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 u$(t,e,n,r,o){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let T=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,C=Pg(t,T);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);T=="pointer"?N.setMeta("pointer",!0):T=="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=a$(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=h$(d.content,c.doc.content,c.from,f,h);if(p&&t.input.domChangeCount++,(Ni&&t.input.lastIOSEnter>Date.now()-225||so)&&o.some(T=>T.nodeType==1&&!c$.test(T.nodeName))&&(!p||p.endA>=p.endB)&&t.someProp("handleKeyDown",T=>T(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 T=w0(t,t.state.doc,c.sel);if(T&&!T.eq(t.state.selection)){let C=t.state.tr.setSelection(T);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(T=>T.nodeName=="DIV"||T.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",T=>T(t,gs(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>p.start&&f$(u,p.start,p.endA,m,y)&&t.someProp("handleKeyDown",T=>T(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(T){return T(t,gs(13,"Enter"))})},20));let E=p.start,x=p.endA,k=T=>{let C=T||t.state.tr.replace(E,x,c.doc.slice(p.start-c.from,p.endB-c.from));if(c.sel){let N=w0(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 T=k(t.state.tr.delete(E,x)),C=u.resolve(p.start).marksAcross(u.resolve(p.endA));C&&T.ensureMarks(C),t.dispatch(T)}else if(p.endA==p.endB&&(S=d$(m.parent.content.cut(m.parentOffset,y.parentOffset),v.parent.content.cut(v.parentOffset,p.endA-v.start())))){let T=k(t.state.tr);S.type=="add"?T.addMark(E,x,S.mark):T.removeMark(E,x,S.mark),t.dispatch(T)}else if(m.parent.child(m.index()).isText&&m.index()==y.index()-(y.textOffset?0:1)){let T=m.parent.textBetween(m.parentOffset,y.parentOffset),C=()=>k(t.state.tr.insertText(T,E,x));t.someProp("handleTextInput",N=>N(t,E,x,T,C))||t.dispatch(C())}else t.dispatch(k());else t.dispatch(k())}function w0(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 d$(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 f$(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 h$(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&&E0(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&&E0(t.textBetween(s-1,s+1))&&(s+=l?1:-1),i=s+(i-a),a=s}return{start:s,endA:i,endB:a}}function E0(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 J1{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 _2,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(A0),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=T0(this),k0(this),this.nodeViews=C0(this),this.docView=r0(this.state.doc,S0(this),yh(this),this.dom,this),this.domObserver=new r$(this,(r,o,s,i)=>u$(this,r,o,s,i)),this.domObserver.start(),D2(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(A0),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&&(z1(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=C0(this);m$(h,this.nodeViews)&&(this.nodeViews=h,s=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&qp(this),this.editable=T0(this),k0(this);let l=yh(this),c=S0(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&&qj(this);if(i){this.domObserver.stop();let h=d&&(kn||Xt)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&p$(o.selection,e.selection);if(d){let p=Xt?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=G2(this)),(s||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=r0(e.doc,c,l,this.dom,this)),p&&!this.trackWrites&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&y2(this))?lo(this,h):(N1(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&&Kj(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&&Xb(this,n.getBoundingClientRect(),e)}else Xb(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 W1(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&&Yj(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 e2(this,e)}coordsAtPos(e,n=1){return S1(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 s2(this,n||this.state,e)}pasteHTML(e,n){return Qa(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Qa(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return jg(this,e)}destroy(){this.docView&&(I2(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,Lj())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return L2(this,e)}domSelectionRange(){let e=this.domSelection();return e?ln&&this.root.nodeType===11&&Hj(this.dom.ownerDocument)==this.dom&&s$(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}J1.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function S0(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 k0(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 T0(t){return!t.someProp("editable",e=>e(t.state)===!1)}function p$(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 C0(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 m$(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 A0(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:'"'},g$=typeof navigator<"u"&&/Mac/.test(navigator.platform),y$=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 v$(t){var e=g$&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||y$&&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 b$=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),x$=typeof navigator<"u"&&/Win/.test(navigator.platform);function w$(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))b$?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 E$(t){let e=Object.create(null);for(let n in t)e[w$(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 S$(t){return new Ue({props:{handleKeyDown:X1(t)}})}function X1(t){let e=E$(t);return function(n,r){let o=v$(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)&&!(x$&&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 k$=Object.defineProperty,zg=(t,e)=>{for(var n in e)k$(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}},Q1={};zg(Q1,{blur:()=>T$,clearContent:()=>C$,clearNodes:()=>A$,command:()=>M$,createParagraphNear:()=>O$,cut:()=>R$,deleteCurrentNode:()=>N$,deleteNode:()=>_$,deleteRange:()=>D$,deleteSelection:()=>I$,enter:()=>P$,exitCode:()=>L$,extendMarkRange:()=>j$,first:()=>$$,focus:()=>B$,forEach:()=>F$,insertContent:()=>H$,insertContentAt:()=>V$,joinBackward:()=>q$,joinDown:()=>G$,joinForward:()=>K$,joinItemBackward:()=>Y$,joinItemForward:()=>J$,joinTextblockBackward:()=>X$,joinTextblockForward:()=>Q$,joinUp:()=>W$,keyboardShortcut:()=>eB,lift:()=>tB,liftEmptyBlock:()=>nB,liftListItem:()=>rB,newlineInCode:()=>oB,resetAttributes:()=>sB,scrollIntoView:()=>iB,selectAll:()=>aB,selectNodeBackward:()=>lB,selectNodeForward:()=>cB,selectParentNode:()=>uB,selectTextblockEnd:()=>dB,selectTextblockStart:()=>fB,setContent:()=>hB,setMark:()=>NB,setMeta:()=>_B,setNode:()=>DB,setNodeSelection:()=>IB,setTextSelection:()=>PB,sinkListItem:()=>LB,splitBlock:()=>jB,splitListItem:()=>$B,toggleList:()=>BB,toggleMark:()=>FB,toggleNode:()=>HB,toggleWrap:()=>UB,undoInputRule:()=>zB,unsetAllMarks:()=>VB,unsetMark:()=>WB,updateAttributes:()=>GB,wrapIn:()=>qB,wrapInList:()=>KB});var T$=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())==null||n.removeAllRanges())}),!0),C$=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),A$=()=>({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},M$=t=>e=>t(e),O$=()=>({state:t,dispatch:e})=>h1(t,e),R$=(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},N$=()=>({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 _$=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},D$=t=>({tr:e,dispatch:n})=>{const{from:r,to:o}=t;return n&&e.delete(r,o),!0},I$=()=>({state:t,dispatch:e})=>Og(t,e),P$=()=>({commands:t})=>t.keyboardShortcut("Enter"),L$=()=>({state:t,dispatch:e})=>wj(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 Z1(t,e,n={}){return t.find(r=>r.type===e&&ku(Object.fromEntries(Object.keys(n).map(o=>[o,r.attrs[o]])),n))}function M0(t,e,n={}){return!!Z1(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),!Z1([...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&&M0([...t.parent.child(i-1).marks],e,n);)i-=1,a-=t.parent.child(i).nodeSize;for(;l<t.parent.childCount&&M0([...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 j$=(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},$$=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 eT(t){return t instanceof pe}function Es(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function tT(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 Bl(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var B$=(t=null,e={})=>({editor:n,view:r,tr:o,dispatch:s})=>{e={scrollIntoView:!0,...e};const i=()=>{(Bl()||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&&!eT(n.state.selection))return i(),!0;const a=tT(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},F$=(t,e)=>n=>t.every((r,o)=>e(r,{...n,index:o})),H$=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),nT=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&&nT(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 nT(n)}function el(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),el("",e,n)}if(o){if(n.errorOnInvalidContent){let i=!1,a="";const l=new Bk({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?Ra.fromSchema(l).parseSlice(gc(t),n.parseOptions):Ra.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=Ra.fromSchema(e);return n.slice?s.parseSlice(gc(t),n.parseOptions).content:s.parse(gc(t),n.parseOptions)}return el("",e,n)}function U$(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 z$=t=>!("type"in t),V$=(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{el(e,s.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(y){l(y)}try{a=el(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((z$(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&&U$(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},W$=()=>({state:t,dispatch:e})=>vj(t,e),G$=()=>({state:t,dispatch:e})=>bj(t,e),q$=()=>({state:t,dispatch:e})=>i1(t,e),K$=()=>({state:t,dispatch:e})=>u1(t,e),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,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}},X$=()=>({state:t,dispatch:e})=>gj(t,e),Q$=()=>({state:t,dispatch:e})=>yj(t,e);function rT(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function Z$(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))Bl()||rT()?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 eB=t=>({editor:e,view:n,tr:r,dispatch:o})=>{const s=Z$(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 tB=(t,e={})=>({state:n,dispatch:r})=>{const o=St(t,n.schema);return Xo(n,o,e)?xj(n,r):!1},nB=()=>({state:t,dispatch:e})=>p1(t,e),rB=t=>({state:e,dispatch:n})=>{const r=St(t,e.schema);return _j(r)(e,n)},oB=()=>({state:t,dispatch:e})=>f1(t,e);function Yd(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function O0(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 sB=(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,O0(c.attrs,e)),i&&c.marks.length&&c.marks.forEach(d=>{i===d.type&&n.addMark(u,u+c.nodeSize,i.create(O0(d.attrs,e)))})})}),!0):!1},iB=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),aB=()=>({tr:t,dispatch:e})=>{if(e){const n=new Sn(t.doc);t.setSelection(n)}return!0},lB=()=>({state:t,dispatch:e})=>l1(t,e),cB=()=>({state:t,dispatch:e})=>d1(t,e),uB=()=>({state:t,dispatch:e})=>kj(t,e),dB=()=>({state:t,dispatch:e})=>Aj(t,e),fB=()=>({state:t,dispatch:e})=>Cj(t,e);function Kp(t,e,n={},r={}){return el(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var hB=(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 oT(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 sT(t,e){const n=new t1(t);return e.forEach(r=>{r.steps.forEach(o=>{n.step(o)})}),n}function pB(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 mB(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(o,s)=>{n(o)&&r.push({node:o,pos:s})}),r}function gB(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=>gB(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 iT(t){return typeof t=="function"}function qe(t,e=void 0,...n){return iT(t)?e?t.bind(e)(...n):t(...n):t}function yB(t={}){return Object.keys(t).length===0&&t.constructor===Object}function tl(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 aT(t){const e=[],{nodeExtensions:n,markExtensions:r}=tl(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 nl(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 vB(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function R0(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):vB(n.getAttribute(i.name));return a==null?s:{...s,[i.name]:a}},{});return{...r,...o}}}}function N0(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&yB(n)?!1:n!=null))}function bB(t,e){var n;const r=aT(t),{nodeExtensions:o,markExtensions:s}=tl(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=N0({...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=>R0(v,u)));const m=fe(c,"renderHTML",d);m&&(h.toDOM=v=>m({node:v,HTMLAttributes:nl(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=N0({...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=>R0(y,u)));const m=fe(c,"renderHTML",d);return m&&(h.toDOM=y=>m({mark:y,HTMLAttributes:nl(y,u)})),[c.name,h]}));return new Bk({topNode:i,nodes:a,marks:l})}function xB(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 lT(t){const e=Yg(qg(t)),n=xB(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 cT(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 wB(t,e){const n={from:0,to:t.content.size};return cT(t,n,e)}function uT(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function EB(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 dT(t,e){const n=Yd(typeof e=="string"?e:e.name,t.schema);return n==="node"?EB(t,e):n==="mark"?oT(t,e):{}}function SB(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 kB(t){const e=SB(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 fT(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}})})}),kB(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 TB=(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 CB=(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 AB(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 MB=(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)},OB=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function _0(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function D0(t,e){const{nodeExtensions:n}=tl(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 hT(t){return t instanceof ue}function RB(t,e,n){var r;const{selection:o}=e;let s=null;if(eT(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 NB=(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=oT(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 RB(r,n,l)},_B=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),DB=(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})=>Kb(s,{...i,...e})(n)?!0:a.clearNodes()).command(({state:a})=>Kb(s,{...i,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},IB=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},PB=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},LB=t=>({state:e,dispatch:n})=>{const r=St(t,e.schema);return Pj(r)(e,n)};function I0(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 jB=({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&&I0(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:pB(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&&I0(n,o.extensionManager.splittableMarks),e.scrollIntoView()}return p},$B=(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},k=((i=a.contentMatch.defaultType)==null?void 0:i.createAndFill(x))||void 0;v=v.append(F.from(a.createAndFill(null,k)||void 0));const S=l.before(l.depth-(w-1));n.replace(S,l.after(-E),new ee(v,4-w,0));let T=-1;n.doc.nodesBetween(S,n.doc.content.size,(C,N)=>{if(T>-1)return!1;C.isTextblock&&C.content.size===0&&(T=N+1)}),T>-1&&n.setSelection(pe.near(n.doc.resolve(T))),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 k=x.filter(S=>E.includes(S.type.name));n.ensureMarks(k)}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},BB=(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 k=Jd(S=>D0(S.type.name,d))(m);if(E.depth>=1&&k&&E.depth-k.depth<=1){if(k.node.type===h)return c.liftListItem(p);if(D0(k.node.type.name,d)&&h.validContent(k.node.content)&&a)return l().command(()=>(s.setNodeMarkup(k.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),T=x.filter(C=>f.includes(C.type.name));return s.ensureMarks(T),S?!0:c.clearNodes()}).wrapInList(h,r).command(()=>Eh(s,h)).command(()=>Sh(s,h)).run()},FB=(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)},HB=(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})},UB=(t,e={})=>({state:n,commands:r})=>{const o=St(t,n.schema);return Xo(n,o,e)?r.lift(o):r.wrapIn(o,e)},zB=()=>({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},VB=()=>({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},WB=(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},GB=(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},qB=(t,e={})=>({state:n,dispatch:r})=>{const o=St(t,n.schema);return Mj(o,e)(n,r)},KB=(t,e={})=>({state:n,dispatch:r})=>{const o=St(t,n.schema);return Oj(o,e)(n,r)},YB=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}},JB=(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=CB(c)+s;return i.forEach(f=>{if(u)return;const h=JB(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 XB(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 QB(t){return Object.prototype.toString.call(t).slice(8,-1)}function vc(t){return QB(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function pT(t,e){const n={...t};return vc(t)&&vc(e)&&Object.keys(e).forEach(r=>{vc(e[r])&&vc(t[r])?n[r]=pT(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:()=>pT(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 mT extends Xg{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new mT(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 ZB(t){return typeof t=="number"}var eF=class{constructor(t){this.find=t.find,this.handler=t.handler}},tF=(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 nF(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,k=Math.max(r,p),S=Math.min(o,p+x);if(k>=S)return;const T=h.isText?h.text||"":h.textBetween(k-p,S-p,void 0,"");tF(T,s.find,i).forEach(N=>{if(N.index===void 0)return;const R=k+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,rF=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function oF(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(!(!nF({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:k}=v;typeof k=="string"?k=k:k=Kg(F.from(k),h.schema);const{from:S}=v,T=S+k.length,C=rF(k);return l({rule:u,state:h,from:S,to:{b:T},pasteEvt:C})}const E=f.doc.content.findDiffStart(h.doc.content),x=f.doc.content.findDiffEnd(h.doc.content);if(!(!ZB(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=lT(t),this.schema=bB(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=S$(a);s.push(l);const c=fe(r,"addInputRules",o);if(_0(r,t.options.enableInputRules)&&c){const f=c();if(f&&f.length){const h=XB({editor:t,rules:f}),p=Array.isArray(h)?h:[h];s.push(...p)}}const u=fe(r,"addPasteRules",o);if(_0(r,t.options.enablePasteRules)&&u){const f=u();if(f&&f.length){const h=oF({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 aT(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=tl(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=nl(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}=tl(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=nl(a,r);return s()({mark:a,view:l,inline:c,editor:t,extension:n,HTMLAttributes:u,updateAttributes:d=>{AT(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=lT;Zd.sort=Yg;Zd.flatten=qg;var sF={};zg(sF,{ClipboardTextSerializer:()=>yT,Commands:()=>vT,Delete:()=>bT,Drop:()=>xT,Editable:()=>wT,FocusEvents:()=>ST,Keymap:()=>kT,Paste:()=>TT,Tabindex:()=>CT,focusEventsPluginKey:()=>ET});var Qe=class gT extends Xg{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new gT(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},yT=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=uT(n);return cT(r,{from:i,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),vT=Qe.create({name:"commands",addCommands(){return{...Q1}}}),bT=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=sT(t.before,[t,...e]);fT(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),k=(m=u.doc.nodeAt(v-1))==null?void 0:m.marks.some(T=>T.eq(h.mark)),S=(y=u.doc.nodeAt(w))==null?void 0:y.marks.some(T=>T.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||k),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()}}),xT=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})}}})]}}),wT=Qe.create({name:"editable",addProseMirrorPlugins(){return[new Ue({key:new We("editable"),props:{editable:()=>this.editor.options.editable}})]}}),ET=new We("focusEvents"),ST=Qe.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Ue({key:ET,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}}}})]}}),kT=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 Bl()||rT()?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}})]}}),TT=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})}}})]}}),CT=Qe.create({name:"tabindex",addProseMirrorPlugins(){return[new Ue({key:new We("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),iF=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)}},aF=`.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 lF(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 cF=class extends YB{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=tT(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=lF(aF,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=iT(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?[wT,yT.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),vT,ST,kT,CT,xT,TT,bT].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 J1(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 dT(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return AB(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 wB(this.state.doc,{blockSeparator:e,textSerializers:{...uT(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 iF(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 uF(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 dF(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 fF(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}var hF={};zg(hF,{createAtomBlockMarkdownSpec:()=>pF,createBlockMarkdownSpec:()=>mF,createInlineMarkdownSpec:()=>vF,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 pF(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 mF(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 k=v.length;let S="";const T=/^:::([\w-]*)(\s.*)?/gm,C=d.slice(k);for(T.lastIndex=0;;){const N=T.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,k+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 gF(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 yF(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function vF(t){const{nodeName:e,name:n,getContent:r,parseAttributes:o=gF,serializeAttributes:s=yF,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,k]=y;w=x,v=k||""}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 k=a[u];if(k.trim()===""){const T=a.slice(u+1).findIndex(R=>R.trim()!=="");if(T===-1)break;if((((o=(r=a[u+1+T].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:o.length)||0)>m){v.push(k),c=`${c}${k}
201
- `,u+=1;continue}else break}if((((i=(s=k.match(/^(\s*)/))==null?void 0:s[1])==null?void 0:i.length)||0)>m)v.push(k),c=`${c}${k}
202
- `,u+=1;else break}let w;const E=v.slice(1);if(E.length>0){const k=E.map(S=>S.slice(m+d)).join(`
203
- `);k.trim()&&(e.customNestedParser?w=e.customNestedParser(k):w=n.blockTokens(k))}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 AT(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 bF=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){AT(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"&&(Bl()||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 MT extends Xg{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new MT(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},xF=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,k=(i=t.offsetY)!=null?i:(s=t.nativeEvent)==null?void 0:s.offsetY;d=E.x-w.x+x,f=E.y-w.y+k}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"&&(Bl()||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 eF({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,P0;function wF(){return P0||(P0=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 EF=wF();const SF=fg(EF);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 L0;function kF(){if(L0)return Th;L0=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 T=m.value;if(h(T,S))return x=T}return x=S}if(T=x,r(E,S))return T;var C=f(S);return h!==void 0&&h(T,C)?(E=S,T):(E=S,x=C)}var w=!1,E,x,k=d===void 0?null:d;return[function(){return v(u())},k===null?void 0:function(){return v(k())}]},[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 j0;function TF(){return j0||(j0=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 T=m.value;if(h(T,S))return x=T}return x=S}if(T=x,r(E,S))return T;var C=f(S);return h!==void 0&&h(T,C)?(E=S,T):(E=S,x=C)}var w=!1,E,x,k=d===void 0?null:d;return[function(){return v(u())},k===null?void 0:function(){return v(k())}]},[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 $0;function CF(){return $0||($0=1,process.env.NODE_ENV==="production"?xc.exports=kF():xc.exports=TF()),xc.exports}var AF=CF(),MF=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},OF=({contentComponent:t})=>{const e=kg.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return g.jsx(g.Fragment,{children:Object.values(e)})};function RF(){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]:Ml.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 NF=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=RF(),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:MF(e,this.editorContentRef),...n}),t?.contentComponent&&g.jsx(OF,{contentComponent:t.contentComponent})]})}},_F=M.forwardRef((t,e)=>{const n=M.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return M.createElement(NF,{key:n,innerRef:e,...t})}),DF=M.memo(_F),IF=typeof window<"u"?M.useLayoutEffect:M.useEffect,PF=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 OT(t){var e;const[n]=M.useState(()=>new PF(t.editor)),r=AF.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:SF);return IF(()=>n.watch(t.editor),[t.editor,n]),M.useDebugValue(r),r}var B0=process.env.NODE_ENV!=="production",Qp=typeof window>"u",LF=Qp||!!(typeof window<"u"&&window.next),jF=class RT{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||LF){if(B0)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&&B0)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 cF(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?RT.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 $F(t={},e=[]){const n=M.useRef(t);n.current=t;const[r]=M.useState(()=>new jF(n)),o=kg.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return M.useDebugValue(o),M.useEffect(r.onRender(e)),OT({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),NT=M.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),_T=()=>M.useContext(NT);function F0({as:t="div",...e}){const{nodeViewContentRef:n,nodeViewContentChildren:r}=_T();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}=_T(),r=t.as||"div";return g.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});function H0(t){return!!(typeof t=="function"&&t.prototype&&t.prototype.isReactComponent)}function U0(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.forward_ref)"||t.$$typeof.description==="react.forward_ref"))}function BF(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.memo)"||t.$$typeof.description==="react.memo"))}function FF(t){if(H0(t)||U0(t))return!0;if(BF(t)){const e=t.type;if(e)return H0(e)||U0(e)}return!1}function HF(){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?Ml.flushSync(()=>{this.render()}):queueMicrotask(()=>{this.render()})}render(){var t;const e=this.component,n=this.props,r=this.editor,o=HF(),s=FF(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])})}},DT=M.createContext({markViewContentRef:()=>{}}),UF=t=>{const{as:e="span",...n}=t,{markViewContentRef:r}=M.useContext(DT);return g.jsx(e,{...n,ref:r,"data-mark-view-content":""})},zF=class extends bF{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(DT.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 VF(t,e={}){return n=>new zF(t,n,e)}var WF=class extends xF{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(NT.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=nl(this.node,e);t=this.options.attrs({node:this.node,HTMLAttributes:n})}else t=this.options.attrs;this.renderer.updateAttributes(t)}}};function Fl(t,e){return n=>n.editor.contentComponent?new WF(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:()=>{wk(gt).forEach(s=>localStorage.removeItem(`${s.value}-draft`))}}},GF=wk(gt),qF=({editorTab:t,onSwitchEditorTab:e})=>{const{saveCurrentTabContent:n}=ry(),r=o=>{n(t),e(o)};return g.jsx(Ek,{defaultValue:gt.Text,value:t,onValueChange:r,className:"w-full",children:g.jsx(Sk,{className:"w-full rounded-none border-b",children:GF.map(o=>g.jsx(Rp,{value:o.value.toString(),children:o.label},o.value))})})},z0=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,V0=uk,oy=(t,e)=>n=>{var r;if(e?.variants==null)return V0(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=z0(u)||z0(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 V0(t,i,l,n?.class,n?.className)},KF=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"}}),Pn=b.forwardRef(({className:t,variant:e,size:n,asChild:r=!1,...o},s)=>{const i=r?II:"button";return g.jsx(i,{className:re(KF({variant:e,size:n,className:t})),ref:s,...o})});Pn.displayName="Button";function YF(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 JF="DismissableLayer",Zp="dismissableLayer.update",XF="dismissableLayer.pointerDownOutside",QF="dismissableLayer.focusOutside",W0,IT=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(IT),[u,d]=b.useState(null),f=u?.ownerDocument??globalThis?.document,[,h]=b.useState({}),p=Fe(e,T=>d(T)),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,k=tH(T=>{const C=T.target,N=[...c.branches].some(R=>R.contains(C));!x||N||(o?.(T),i?.(T),T.defaultPrevented||a?.())},f),S=nH(T=>{const C=T.target;[...c.branches].some(R=>R.contains(C))||(s?.(T),i?.(T),T.defaultPrevented||a?.())},f);return YF(T=>{w===c.layers.size-1&&(r?.(T),!T.defaultPrevented&&a&&(T.preventDefault(),a()))},f),b.useEffect(()=>{if(u)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(W0=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),G0(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=W0)}},[u,f,n,c]),b.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),G0())},[u,c]),b.useEffect(()=>{const T=()=>h({});return document.addEventListener(Zp,T),()=>document.removeEventListener(Zp,T)},[]),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,k.onPointerDownCapture)})});Xi.displayName=JF;var ZF="DismissableLayerBranch",eH=b.forwardRef((t,e)=>{const n=b.useContext(IT),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})});eH.displayName=ZF;function tH(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(){PT(XF,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 nH(t,e=globalThis?.document){const n=pr(t),r=b.useRef(!1);return b.useEffect(()=>{const o=s=>{s.target&&!r.current&&PT(QF,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 G0(){const t=new CustomEvent(Zp);document.dispatchEvent(t)}function PT(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?$S(o,s):o.dispatchEvent(s)}const rH=["top","right","bottom","left"],Zo=Math.min,Nn=Math.max,Tu=Math.round,wc=Math.floor,jr=t=>({x:t,y:t}),oH={left:"right",right:"left",bottom:"top",top:"bottom"},sH={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 iH=new Set(["top","bottom"]);function Lr(t){return iH.has(go(t))?"y":"x"}function ay(t){return sy(Lr(t))}function aH(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 lH(t){const e=Cu(t);return[tm(t),e,tm(e)]}function tm(t){return t.replace(/start|end/g,e=>sH[e])}const q0=["left","right"],K0=["right","left"],cH=["top","bottom"],uH=["bottom","top"];function dH(t,e,n){switch(t){case"top":case"bottom":return n?e?K0:q0:e?q0:K0;case"left":case"right":return e?cH:uH;default:return[]}}function fH(t,e,n,r){const o=Qi(t);let s=dH(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=>oH[e])}function hH(t){return{top:0,right:0,bottom:0,left:0,...t}}function LT(t){return typeof t!="number"?hH(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 Y0(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 pH=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}=Y0(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:k}=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}},k&&p<=50&&(p++,typeof k=="object"&&(k.placement&&(f=k.placement),k.rects&&(c=k.rects===!0?await i.getElementRects({reference:t,floating:e,strategy:o}):k.rects),{x:u,y:d}=Y0(c,f,l)),m=-1)}return{x:u,y:d,placement:f,strategy:o,middlewareData:h}};async function rl(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=LT(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},k=Au(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:w,offsetParent:E,strategy:l}):w);return{top:(v.top-k.top+p.top)/x.y,bottom:(k.bottom-v.bottom+p.bottom)/x.y,left:(v.left-k.left+p.left)/x.x,right:(k.right-v.right+p.right)/x.x}}const mH=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=LT(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],k=f[h]-s.reference[h],S=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c));let T=S?S[E]:0;(!T||!await(i.isElement==null?void 0:i.isElement(S)))&&(T=a.floating[E]||s.floating[p]);const C=x/2-k/2,N=T/2-m[p]/2-1,R=Zo(d[v],N),L=Zo(d[w],N),$=R,B=T-m[p]-L,U=T/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}}}),gH=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)),k=f||(E||!m?[Cu(a)]:lH(a)),S=p!=="none";!f&&S&&k.push(...fH(a,m,p,x));const T=[a,...k],C=await rl(e,y),N=[];let R=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&N.push(C[v]),d){const U=aH(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=T[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 J0(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function X0(t){return rH.some(e=>t[e]>=0)}const yH=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 rl(e,{...o,elementContext:"reference"}),i=J0(s,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:X0(i)}}}case"escaped":{const s=await rl(e,{...o,altBoundary:!0}),i=J0(s,n.floating);return{data:{escapedOffsets:i,escaped:X0(i)}}}default:return{}}}}},jT=new Set(["left","top"]);async function vH(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=jT.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 bH=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 vH(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}}}}},xH=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 rl(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}}}}}},wH=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,k=s.reference[f]+s.reference[E]-y.mainAxis;h<x?h=x:h>k&&(h=k)}if(c){var v,w;const E=f==="y"?"width":"height",x=jT.has(go(o)),k=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<k?p=k:p>S&&(p=S)}return{[f]:h,[d]:p}}}},EH=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 rl(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),k=Zo(p-u[v],E),S=!e.middlewareData.shift;let T=x,C=k;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(C=E),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(T=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)):T=m-2*($!==0||B!==0?$+B:Nn(u.top,u.bottom))}await l({...e,availableWidth:C,availableHeight:T});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 $T(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=($T(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function $T(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 Q0(t){return!tf()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof In(t).ShadowRoot}const SH=new Set(["inline","contents"]);function Hl(t){const{overflow:e,overflowX:n,overflowY:r,display:o}=gr(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!SH.has(o)}const kH=new Set(["table","td","th"]);function TH(t){return kH.has(Zi(t))}const CH=[":popover-open",":modal"];function nf(t){return CH.some(e=>{try{return t.matches(e)}catch{return!1}})}const AH=["transform","translate","scale","rotate","perspective"],MH=["transform","translate","scale","rotate","perspective","filter"],OH=["paint","layout","strict","content"];function ly(t){const e=cy(),n=mr(t)?gr(t):t;return AH.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)||MH.some(r=>(n.willChange||"").includes(r))||OH.some(r=>(n.contain||"").includes(r))}function RH(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 NH=new Set(["html","body","#document"]);function Ii(t){return NH.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||Q0(t)&&t.host||Gr(t);return Q0(e)?e.host:e}function BT(t){const e=es(t);return Ii(e)?t.ownerDocument?t.ownerDocument.body:t.body:zr(e)&&Hl(e)?e:BT(e)}function ol(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const o=BT(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||[],Hl(o)?o:[],a&&n?ol(a):[])}return e.concat(o,ol(o,[],n))}function nm(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function FT(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}=FT(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 _H=jr(0);function HT(t){const e=In(t);return!cy()||!e.visualViewport?_H:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function DH(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=DH(s,n,r)?HT(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 UT(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 IH(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"||Hl(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?UT(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 PH(t){return Array.from(t.getClientRects())}function LH(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 Z0=25;function jH(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<=Z0&&(s-=p)}else c<=Z0&&(s+=c);return{width:s,height:i,x:a,y:l}}const $H=new Set(["absolute","fixed"]);function BH(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 ex(t,e,n){let r;if(e==="viewport")r=jH(t,n);else if(e==="document")r=LH(Gr(t));else if(mr(e))r=BH(e,n);else{const o=HT(t);r={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return Au(r)}function zT(t,e){const n=es(t);return n===e||!mr(n)||Ii(n)?!1:gr(n).position==="fixed"||zT(n,e)}function FH(t,e){const n=e.get(t);if(n)return n;let r=ol(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&&$H.has(o.position)||Hl(i)&&!l&&zT(t,i))?r=r.filter(u=>u!==i):o=a,i=es(i)}return e.set(t,r),r}function HH(t){let{element:e,boundary:n,rootBoundary:r,strategy:o}=t;const i=[...n==="clippingAncestors"?nf(e)?[]:FH(e,this._c):[].concat(n),r],a=i[0],l=i.reduce((c,u)=>{const d=ex(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},ex(e,a,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function UH(t){const{width:e,height:n}=FT(t);return{width:e,height:n}}function zH(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"||Hl(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?UT(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 tx(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 VT(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=tx(t,e);for(;r&&TH(r)&&Ah(r);)r=tx(r,e);return r&&Ii(r)&&Ah(r)&&!ly(r)?n:r||RH(t)||n}const VH=async function(t){const e=this.getOffsetParent||VT,n=this.getDimensions,r=await n(t.floating);return{reference:zH(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function WH(t){return gr(t).direction==="rtl"}const GH={convertOffsetParentRelativeRectToViewportRelativeRect:IH,getDocumentElement:Gr,getClippingRect:HH,getOffsetParent:VT,getElementRects:VH,getClientRects:PH,getDimensions:UH,getScale:xi,isElement:mr,isRTL:WH};function WT(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function qH(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 k(S){const T=S[0].intersectionRatio;if(T!==l){if(!x)return i();T?i(!1,T):r=setTimeout(()=>{i(!1,1e-7)},1e3)}T===1&&!WT(c,t.getBoundingClientRect())&&i(),x=!1}try{n=new IntersectionObserver(k,{...E,root:o.ownerDocument})}catch{n=new IntersectionObserver(k,E)}n.observe(t)}return i(!0),s}function KH(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?ol(c):[],...ol(e)]:[];u.forEach(v=>{o&&v.addEventListener("scroll",n,{passive:!0}),s&&v.addEventListener("resize",n)});const d=c&&a?qH(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&&!WT(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 YH=bH,JH=xH,XH=gH,QH=EH,ZH=yH,nx=mH,eU=wH,GT=(t,e,n)=>{const r=new Map,o={platform:GH,...n},s={...o.platform,_c:r};return pH(t,e,{...o,platform:s})};var tU=typeof document<"u",nU=function(){},qc=tU?M.useLayoutEffect:nU;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 qT(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function rx(t,e){const n=qT(t);return Math.round(e*n)/n}function Mh(t){const e=b.useRef(t);return qc(()=>{e.current=t}),e}function rU(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(_=>{_!==T.current&&(T.current=_,v(_))},[]),x=s||p,k=i||y,S=b.useRef(null),T=b.useRef(null),C=b.useRef(u),N=l!=null,R=Mh(l),L=Mh(o),$=Mh(c),B=b.useCallback(()=>{if(!S.current||!T.current)return;const _={placement:e,strategy:n,middleware:f};L.current&&(_.platform=L.current),GT(S.current,T.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),k&&(T.current=k),x&&k){if(R.current)return R.current(x,k,B);B()}},[x,k,B,R,N]);const j=b.useMemo(()=>({reference:S,floating:T,setReference:w,setFloating:E}),[w,E]),P=b.useMemo(()=>({reference:x,floating:k}),[x,k]),H=b.useMemo(()=>{const _={position:n,left:0,top:0};if(!P.floating)return _;const V=rx(P.floating,u.x),ie=rx(P.floating,u.y);return a?{..._,transform:"translate("+V+"px, "+ie+"px)",...qT(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 oU=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?nx({element:r.current,padding:o}).fn(n):{}:r?nx({element:r,padding:o}).fn(n):{}}}},sU=(t,e)=>({...YH(t),options:[t,e]}),iU=(t,e)=>({...JH(t),options:[t,e]}),aU=(t,e)=>({...eU(t),options:[t,e]}),lU=(t,e)=>({...XH(t),options:[t,e]}),cU=(t,e)=>({...QH(t),options:[t,e]}),uU=(t,e)=>({...ZH(t),options:[t,e]}),dU=(t,e)=>({...oU(t),options:[t,e]});var fU="Arrow",KT=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"})})});KT.displayName=fU;var hU=KT;function YT(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",[JT,cs]=jn(dy),[pU,XT]=JT(dy),QT=t=>{const{__scopePopper:e,children:n}=t,[r,o]=b.useState(null);return g.jsx(pU,{scope:e,anchor:r,onAnchorChange:o,children:n})};QT.displayName=dy;var ZT="PopperAnchor",eC=b.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...o}=t,s=XT(ZT,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})});eC.displayName=ZT;var fy="PopperContent",[mU,gU]=JT(fy),tC=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=XT(fy,n),[v,w]=b.useState(null),E=Fe(e,z=>w(z)),[x,k]=b.useState(null),S=YT(x),T=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(vU),altBoundary:$},{refs:U,floatingStyles:j,placement:P,isPositioned:H,middlewareData:_}=rU({strategy:"fixed",placement:N,whileElementsMounted:(...z)=>KH(...z,{animationFrame:h==="always"}),elements:{reference:y.anchor},middleware:[sU({mainAxis:o+C,alignmentAxis:i}),l&&iU({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?aU():void 0,...B}),l&&lU({...B}),cU({...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&&dU({element:x,padding:a}),bU({arrowWidth:T,arrowHeight:C}),f&&uU({strategy:"referenceHidden",...B})]}),[V,ie]=oC(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(mU,{scope:n,placedSide:V,onArrowChange:k,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"}})})})});tC.displayName=fy;var nC="PopperArrow",yU={top:"bottom",right:"left",bottom:"top",left:"right"},rC=b.forwardRef(function(e,n){const{__scopePopper:r,...o}=e,s=gU(nC,r),i=yU[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(hU,{...o,ref:n,style:{...o.style,display:"block"}})})});rC.displayName=nC;function vU(t){return t!==null}var bU=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]=oC(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 oC(t){const[e,n="center"]=t.split("-");return[e,n]}var sf=QT,Ul=eC,af=tC,lf=rC,xU="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?Ml.createPortal(g.jsx(ge.div,{...r,ref:e}),i):null});ea.displayName=xU;var sC=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"}),wU="VisuallyHidden",iC=b.forwardRef((t,e)=>g.jsx(ge.span,{...t,ref:e,style:{...sC,...t.style}}));iC.displayName=wU;var EU=iC,[cf]=jn("Tooltip",[cs]),uf=cs(),aC="TooltipProvider",SU=700,rm="tooltip.open",[kU,hy]=cf(aC),lC=t=>{const{__scopeTooltip:e,delayDuration:n=SU,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(kU,{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})};lC.displayName=aC;var sl="Tooltip",[TU,zl]=cf(sl),cC=t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:o,onOpenChange:s,disableHoverableContent:i,delayDuration:a}=t,l=hy(sl,t.__scopeTooltip),c=uf(e),[u,d]=b.useState(null),f=Yn(),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:T=>{T?(l.onOpen(),document.dispatchEvent(new CustomEvent(rm))):l.onClose(),s?.(T)},caller:sl}),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]),k=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(TU,{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?k():(window.clearTimeout(h.current),h.current=0)},[k,p]),onOpen:x,onClose:k,disableHoverableContent:p,children:n})})};cC.displayName=sl;var om="TooltipTrigger",uC=b.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,o=zl(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(Ul,{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)})})});uC.displayName=om;var py="TooltipPortal",[CU,AU]=cf(py,{forceMount:void 0}),dC=t=>{const{__scopeTooltip:e,forceMount:n,children:r,container:o}=t,s=zl(py,e);return g.jsx(CU,{scope:e,forceMount:n,children:g.jsx($n,{present:n||s.open,children:g.jsx(ea,{asChild:!0,container:o,children:r})})})};dC.displayName=py;var Pi="TooltipContent",fC=b.forwardRef((t,e)=>{const n=AU(Pi,t.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...s}=t,i=zl(Pi,t.__scopeTooltip);return g.jsx($n,{present:r||i.open,children:i.disableHoverableContent?g.jsx(hC,{side:o,...s,ref:e}):g.jsx(MU,{side:o,...s,ref:e})})}),MU=b.forwardRef((t,e)=>{const n=zl(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=_U(v,y.getBoundingClientRect()),E=DU(v,w),x=IU(m.getBoundingClientRect()),k=LU([...E,...x]);a(k),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=!PU(v,i);w?f():E&&(f(),c())};return document.addEventListener("pointermove",p),()=>document.removeEventListener("pointermove",p)}},[l,u,i,c,f]),g.jsx(hC,{...t,ref:s})}),[OU,RU]=cf(sl,{isInside:!1}),NU=LI("TooltipContent"),hC=b.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:s,onPointerDownOutside:i,...a}=t,l=zl(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(NU,{children:r}),g.jsx(OU,{scope:n,isInside:!0,children:g.jsx(EU,{id:l.contentId,role:"tooltip",children:o||r})})]})})});fC.displayName=Pi;var pC="TooltipArrow",mC=b.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,o=uf(n);return RU(pC,n).isInside?null:g.jsx(lf,{...o,...r,ref:e})});mC.displayName=pC;function _U(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 DU(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 IU(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 PU(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 LU(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),jU(e)}function jU(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 $U=lC,BU=cC,FU=uC,HU=dC,UU=fC,zU=mC;function gC({delayDuration:t=0,...e}){return g.jsx($U,{delayDuration:t,...e})}function VU(t){return g.jsx(gC,{children:g.jsx(BU,{...t})})}const yC=b.forwardRef((t,e)=>g.jsx(FU,{ref:e,...t}));yC.displayName="TooltipTrigger";const vC=b.forwardRef(({className:t,sideOffset:e=0,children:n,...r},o)=>g.jsx(HU,{children:g.jsx("div",{"data-theme":"select-post-builder",children:g.jsxs(UU,{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(zU,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}));vC.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(gC,{delayDuration:100,children:g.jsxs(VU,{children:[g.jsx(yC,{asChild:!0,children:g.jsx(Pn,{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(vC,{children:e})]})})});be.displayName="ToolbarButton";var Oh="focusScope.autoFocusOnMount",Rh="focusScope.autoFocusOnUnmount",ox={bubbles:!1,cancelable:!0},WU="FocusScope",Vl=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 k of E)k.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){ix.add(h);const m=document.activeElement;if(!a.contains(m)){const v=new CustomEvent(Oh,ox);a.addEventListener(Oh,c),a.dispatchEvent(v),v.defaultPrevented||(GU(XU(bC(a)),{select:!0}),document.activeElement===m&&Ro(a))}return()=>{a.removeEventListener(Oh,c),setTimeout(()=>{const v=new CustomEvent(Rh,ox);a.addEventListener(Rh,u),a.dispatchEvent(v),v.defaultPrevented||Ro(m??document.body,{select:!0}),a.removeEventListener(Rh,u),ix.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]=qU(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})});Vl.displayName=WU;function GU(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(Ro(r,{select:e}),document.activeElement!==n)return}function qU(t){const e=bC(t),n=sx(e,t),r=sx(e.reverse(),t);return[n,r]}function bC(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 sx(t,e){for(const n of t)if(!KU(n,{upTo:e}))return n}function KU(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 YU(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&&YU(t)&&e&&t.select()}}var ix=JU();function JU(){let t=[];return{add(e){const n=t[0];e!==n&&n?.pause(),t=ax(t,e),t.unshift(e)},remove(e){t=ax(t,e),t[0]?.resume()}}}function ax(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function XU(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]??lx()),document.body.insertAdjacentElement("beforeend",t[1]??lx()),Nh++,()=>{Nh===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Nh--}},[])}function lx(){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 xC(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 QU(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",ZU="with-scroll-bars-hidden",ez="--removed-body-scroll-bar-size";function _h(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function tz(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 nz=typeof window<"u"?b.useLayoutEffect:b.useEffect,cx=new WeakMap;function rz(t,e){var n=tz(null,function(r){return t.forEach(function(o){return _h(o,r)})});return nz(function(){var r=cx.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)})}cx.set(n,t)},[t]),n}function oz(t){return t}function sz(t,e){e===void 0&&(e=oz);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 iz(t){t===void 0&&(t={});var e=sz(null);return e.options=Pr({async:!0,ssr:!1},t),e}var wC=function(t){var e=t.sideCar,n=xC(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))};wC.isSideCarExport=!0;function az(t,e){return t.useMedium(e),wC}var EC=iz(),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=xC(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),k=f,S=rz([n,e]),T=Pr(Pr({},x),o);return b.createElement(b.Fragment,null,u&&b.createElement(k,{sideCar:EC,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({},T),{ref:S})):b.createElement(w,Pr({},T,{className:l,ref:S}),a))});ff.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};ff.classNames={fullWidth:Yc,zeroRight:Kc};var lz=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function cz(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=lz();return e&&t.setAttribute("nonce",e),t}function uz(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function dz(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var fz=function(){var t=0,e=null;return{add:function(n){t==0&&(e=cz())&&(uz(e,n),dz(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},hz=function(){var t=fz();return function(e,n){b.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},SC=function(){var t=hz(),e=function(n){var r=n.styles,o=n.dynamic;return t(r,o),null};return e},pz={left:0,top:0,right:0,gap:0},Ih=function(t){return parseInt(t||"",10)||0},mz=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)]},gz=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return pz;var e=mz(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])}},yz=SC(),wi="data-scroll-locked",vz=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(ZU,` {
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(ez,": ").concat(a,`px;
258
- }
259
- `)},ux=function(){var t=parseInt(document.body.getAttribute(wi)||"0",10);return isFinite(t)?t:0},bz=function(){b.useEffect(function(){return document.body.setAttribute(wi,(ux()+1).toString()),function(){var t=ux()-1;t<=0?document.body.removeAttribute(wi):document.body.setAttribute(wi,t.toString())}},[])},xz=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,o=r===void 0?"margin":r;bz();var s=b.useMemo(function(){return gz(o)},[o]);return b.createElement(yz,{styles:vz(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,wz=function(t){return t.tagName==="TEXTAREA"},kC=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!wz(t)&&n[e]==="visible")},Ez=function(t){return kC(t,"overflowY")},Sz=function(t){return kC(t,"overflowX")},dx=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=TC(t,r);if(o){var s=CC(t,r),i=s[1],a=s[2];if(i>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},kz=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},Tz=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},TC=function(t,e){return t==="v"?Ez(e):Sz(e)},CC=function(t,e){return t==="v"?kz(e):Tz(e)},Cz=function(t,e){return t==="h"&&e==="rtl"?-1:1},Az=function(t,e,n,r,o){var s=Cz(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=CC(t,a),p=h[0],m=h[1],y=h[2],v=m-y-s*p;(p||v)&&TC(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]},fx=function(t){return[t.deltaX,t.deltaY]},hx=function(t){return t&&"current"in t?t.current:t},Mz=function(t,e){return t[0]===e[0]&&t[1]===e[1]},Oz=function(t){return`
260
- .block-interactivity-`.concat(t,` {pointer-events: none;}
261
- .allow-interactivity-`).concat(t,` {pointer-events: all;}
262
- `)},Rz=0,li=[];function Nz(t){var e=b.useRef([]),n=b.useRef([0,0]),r=b.useRef(),o=b.useState(Rz++)[0],s=b.useState(SC)[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=QU([t.lockRef.current],(t.shards||[]).map(hx),!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],k,S=m.target,T=Math.abs(E)>Math.abs(x)?"h":"v";if("touches"in m&&T==="h"&&S.type==="range")return!1;var C=dx(T,S);if(!C)return!0;if(C?k=T:(k=T==="v"?"h":"v",C=dx(T,S)),!C)return!1;if(!r.current&&"changedTouches"in m&&(E||x)&&(r.current=k),!k)return!0;var N=r.current||k;return Az(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?fx(y):Sc(y),w=e.current.filter(function(k){return k.name===y.type&&(k.target===y.target||y.target===k.shadowParent)&&Mz(k.delta,v)})[0];if(w&&w.should){y.cancelable&&y.preventDefault();return}if(!w){var E=(i.current.shards||[]).map(hx).filter(Boolean).filter(function(k){return k.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:_z(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,fx(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:Oz(o)}):null,h?b.createElement(xz,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function _z(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const Dz=az(EC,Nz);var Wl=b.forwardRef(function(t,e){return b.createElement(ff,Pr({},t,{ref:e,sideCar:Dz}))});Wl.classNames=ff.classNames;var Iz=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,AC=function(t){return t&&(t.host||AC(t.parentNode))},Pz=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=AC(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})},Lz=function(t,e,n,r){var o=Pz(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=Iz(t);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),Lz(r,o,n,"aria-hidden")):function(){return null}},pf="Dialog",[MC]=jn(pf),[jz,wr]=MC(pf),OC=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(jz,{scope:e,triggerRef:a,contentRef:l,contentId:Yn(),titleId:Yn(),descriptionId:Yn(),open:c,onOpenChange:u,onOpenToggle:b.useCallback(()=>u(d=>!d),[u]),modal:i,children:n})};OC.displayName=pf;var RC="DialogTrigger",NC=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,o=wr(RC,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)})});NC.displayName=RC;var my="DialogPortal",[$z,_C]=MC(my,{forceMount:void 0}),DC=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:o}=t,s=wr(my,e);return g.jsx($z,{scope:e,forceMount:n,children:b.Children.map(r,i=>g.jsx($n,{present:n||s.open,children:g.jsx(ea,{asChild:!0,container:o,children:i})}))})};DC.displayName=my;var Ou="DialogOverlay",IC=b.forwardRef((t,e)=>{const n=_C(Ou,t.__scopeDialog),{forceMount:r=n.forceMount,...o}=t,s=wr(Ou,t.__scopeDialog);return s.modal?g.jsx($n,{present:r||s.open,children:g.jsx(Fz,{...o,ref:e})}):null});IC.displayName=Ou;var Bz=Yo("DialogOverlay.RemoveScroll"),Fz=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,o=wr(Ou,n);return g.jsx(Wl,{as:Bz,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",PC=b.forwardRef((t,e)=>{const n=_C(Bs,t.__scopeDialog),{forceMount:r=n.forceMount,...o}=t,s=wr(Bs,t.__scopeDialog);return g.jsx($n,{present:r||s.open,children:s.modal?g.jsx(Hz,{...o,ref:e}):g.jsx(Uz,{...o,ref:e})})});PC.displayName=Bs;var Hz=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(LC,{...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())})}),Uz=b.forwardRef((t,e)=>{const n=wr(Bs,t.__scopeDialog),r=b.useRef(!1),o=b.useRef(!1);return g.jsx(LC,{...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()}})}),LC=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(Vl,{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(zz,{titleId:a.titleId}),g.jsx(Wz,{contentRef:l,descriptionId:a.descriptionId})]})]})}),gy="DialogTitle",jC=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,o=wr(gy,n);return g.jsx(ge.h2,{id:o.titleId,...r,ref:e})});jC.displayName=gy;var $C="DialogDescription",BC=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,o=wr($C,n);return g.jsx(ge.p,{id:o.descriptionId,...r,ref:e})});BC.displayName=$C;var FC="DialogClose",HC=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,o=wr(FC,n);return g.jsx(ge.button,{type:"button",...r,ref:e,onClick:ne(t.onClick,()=>o.onOpenChange(!1))})});HC.displayName=FC;function yy(t){return t?"open":"closed"}var UC="DialogTitleWarning",[dne,zC]=_I(UC,{contentName:Bs,titleName:gy,docsSlug:"dialog"}),zz=({titleId:t})=>{const e=zC(UC),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},Vz="DialogDescriptionWarning",Wz=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${zC(Vz).contentName}}.`;return b.useEffect(()=>{const o=t.current?.getAttribute("aria-describedby");e&&o&&(document.getElementById(e)||console.warn(r))},[r,t,e]),null},Gz=OC,qz=NC,Kz=DC,Yz=IC,Jz=PC,Xz=jC,Qz=BC,VC=HC;/**
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 Zz=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),eV=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase()),px=t=>{const e=eV(t);return e.charAt(0).toUpperCase()+e.slice(1)},WC=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim(),tV=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 nV={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 rV=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,...nV,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:WC("lucide",o),...!s&&!tV(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(rV,{ref:s,iconNode:e,className:WC(`lucide-${Zz(px(t))}`,`lucide-${t}`,r),...o}));return n.displayName=px(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 oV=[["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"}]],sV=Ae("bold",oV);/**
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 iV=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],GC=Ae("check",iV);/**
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 aV=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],qC=Ae("chevron-down",aV);/**
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 lV=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],cV=Ae("chevron-right",lV);/**
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 uV=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],dV=Ae("chevron-up",uV);/**
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 fV=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],hV=Ae("circle",fV);/**
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 pV=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],mx=Ae("code",pV);/**
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 mV=[["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"}]],gV=Ae("ellipsis",mV);/**
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 yV=[["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"}]],il=Ae("external-link",yV);/**
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 vV=[["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"}]],gx=Ae("file-code-2",vV);/**
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 bV=[["path",{d:"m15 17 5-5-5-5",key:"nf172w"}],["path",{d:"M4 18v-2a4 4 0 0 1 4-4h12",key:"jmiej9"}]],yx=Ae("forward",bV);/**
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 xV=[["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"}]],wV=Ae("grip-vertical",xV);/**
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 EV=[["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"}]],vx=Ae("heading-1",EV);/**
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 SV=[["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"}]],bx=Ae("heading-2",SV);/**
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 kV=[["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"}]],xx=Ae("heading-3",kV);/**
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 TV=[["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"}]],wx=Ae("heading-4",TV);/**
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 CV=[["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"}]],Ex=Ae("heading-5",CV);/**
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 AV=[["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"}]],Sx=Ae("heading-6",AV);/**
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 MV=[["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"}]],OV=Ae("image-play",MV);/**
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 RV=[["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"}]],KC=Ae("image-plus",RV);/**
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 NV=[["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",NV);/**
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 _V=[["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"}]],kx=Ae("italic",_V);/**
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 DV=[["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",DV);/**
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 IV=[["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"}]],PV=Ae("list-ordered",IV);/**
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 LV=[["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"}]],jV=Ae("list",LV);/**
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 $V=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],BV=Ae("loader-circle",$V);/**
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 FV=[["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",FV);/**
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 HV=[["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"}]],UV=Ae("redo",HV);/**
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 zV=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],YC=Ae("search",zV);/**
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 VV=[["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"}]],WV=Ae("send-horizontal",VV);/**
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 GV=[["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"}]],qV=Ae("square-pen",GV);/**
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 KV=[["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"}]],Tx=Ae("strikethrough",KV);/**
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 YV=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 19H5",key:"vjpgq2"}]],am=Ae("text-align-center",YV);/**
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 JV=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 19H7",key:"4cu937"}]],lm=Ae("text-align-end",JV);/**
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 XV=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 19H3",key:"z6ezky"}]],Nu=Ae("text-align-start",XV);/**
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 QV=[["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",QV);/**
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 ZV=[["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",ZV);/**
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 e3=[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]],t3=Ae("underline",e3);/**
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 n3=[["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"}]],r3=Ae("undo",n3);/**
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 o3=[["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"}]],s3=Ae("unlink",o3);/**
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 i3=[["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",i3);/**
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 a3=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ta=Ae("x",a3);function wy({...t}){return g.jsx(Gz,{"data-slot":"dialog",...t})}const JC=b.forwardRef((t,e)=>g.jsx(qz,{ref:e,"data-slot":"dialog-trigger",...t}));function l3({...t}){return g.jsx(Kz,{"data-slot":"dialog-portal",...t})}const c3=b.forwardRef((t,e)=>g.jsx(VC,{ref:e,"data-slot":"dialog-close",...t})),u3=b.forwardRef(({className:t,...e},n)=>g.jsx(Yz,{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(l3,{children:[g.jsx("div",{"data-theme":"select-post-builder",children:g.jsx(u3,{className:"backdrop-blur-sm"})}),g.jsx("div",{"data-theme":"select-post-builder",children:g.jsxs(Jz,{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(VC,{"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(ta,{}),g.jsx("span",{className:"sr-only",children:"Close"})]})]})})]})),Sy=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})),d3=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})),ky=b.forwardRef((t,e)=>g.jsx(Xz,{ref:e,"data-slot":"dialog-title",className:re("text-lg leading-none font-semibold"),...t}));b.forwardRef(({className:t,...e},n)=>g.jsx(Qz,{ref:n,"data-slot":"dialog-description",className:re("text-muted-foreground text-sm",t),...e}));var f3="Label",XC=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())}}));XC.displayName=f3;var h3=XC;function um({className:t,...e}){return g.jsx(h3,{"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 p3({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 m3({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 g3=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 Cx({className:t,orientation:e="vertical",...n}){return g.jsx("div",{role:"group","data-slot":"field","data-orientation":e,className:re(g3({orientation:e}),t),...n})}function Ax({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 y3({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 Ty({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 Mx({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 v3=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 Ox({className:t,align:e="inline-start",...n}){return g.jsx("div",{role:"group","data-slot":"input-group-addon","data-align":e,className:re(v3({align:e}),t),onClick:r=>{r.target.closest("button")||r.currentTarget.parentElement?.querySelector("input")?.focus()},...n})}function Rx({className:t,...e}){return g.jsx(Ty,{"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(BV,{role:"status","aria-label":"Loading",className:re("h-4 w-4 animate-spin",t),ref:n,...e}));mf.displayName="Spinner";const b3=/^(?:(?:(?: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,QC=/^(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)[\w-]+/gi,x3=/(?:v=|\/)([a-zA-Z0-9_-]{11})(?:[?&].*)?$/,ZC=/^(?:https?:\/\/)?(?:www\.)?open\.spotify\.com\/(track|playlist|album)\/[A-Za-z0-9_-]+/gi,w3=/[\n\r]/g,eA=(t,e,n)=>t.schema.text(e,n),tA=(t,e,n,r)=>t?.schema?.nodes[e]?.create(n,r),E3=(t,e,n,r)=>tA(t,"customLink",{href:e},eA(t,n||e,r)),S3=(t,e,n)=>tA(t,"paragraph",n,e),k3=t=>{const{from:e,to:n}=t.selection;return{from:e,to:n}},nA=t=>{const{from:e,to:n}=k3(t);return t.doc.textBetween(e,n)},T3=t=>!t.selection.empty&&nA(t).length>0,C3=t=>t.type.name,rA=(t,e)=>C3(t)===e,A3=t=>rA(t,"text"),M3=t=>rA(t,"paragraph"),oA=t=>t.text||"",sA=t=>t.content&&t.content.size>0,O3=t=>t.content,R3=t=>t.marks,N3=t=>t.state,iA=t=>F.from(t),aA=(t,e)=>{t.forEach(e)},_3=(t,e=" ")=>t.textBetween(0,t.size,e),D3=(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},al=t=>t?.startsWith("http://")||t?.startsWith("https://")?t:`https://${t}`,ys=t=>b3.test(t),I3=async t=>{try{return(await yt.head(t,{timeout:5e3})).headers["content-type"]}catch{return null}},P3=async t=>{try{const n=await I3(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},L3=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},j3=(t,e)=>{const n=oA(e),r=R3(e),o=L3(n);return o.length===0?[e]:o.map(s=>s.type==="url"?E3(t,s.content,s.content,r):eA(t,s.content,r))},$3=(t,e)=>{if(!sA(e))return e;const n=[],r=O3(e);return aA(r,o=>{if(A3(o)&&oA(o)){const s=j3(t,o);n.push(...s)}else n.push(o)}),S3(t,iA(n),e.attrs)},B3=(t,e)=>{const n=[];return aA(e.content,r=>{M3(r)&&sA(r)?n.push($3(t,r)):n.push(r)}),new ee(iA(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}=Il(),[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=D3(i?.state,"customLink"),$=al(L?.href??"");m(ys($)),v(ys($)),c(L?.uid??null),d(L?.href??""),h(L?.text??L?.href??"")},k=R=>{const L=R.target.value;if(L==="https:/")return;const $=al(L);m(ys($)),d($)},S=R=>h(R.target.value),T=()=>{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(JC,{asChild:!0,children:s}):null,g.jsxs(Ey,{onKeyDown:N,className:"-translate-1/2",children:[g.jsx(Sy,{children:g.jsx(ky,{children:"Add Link"})}),g.jsx(p3,{children:g.jsxs(m3,{className:"gap-3",children:[g.jsxs(Cx,{className:"gap-1.5",children:[g.jsxs(Ax,{children:["Link ",g.jsx("span",{className:"text-destructive",children:"*"})]}),g.jsxs(Mx,{children:[g.jsx(Rx,{value:u,onChange:k,onBlur:T,placeholder:"https://x.com/shadcn"}),g.jsx(Ox,{children:g.jsx(im,{})})]}),!p&&p!==void 0&&g.jsx(y3,{errors:[{message:"Invalid link"}]})]}),!o&&g.jsxs(Cx,{className:"gap-1.5",children:[g.jsx(Ax,{children:"Text to display"}),g.jsxs(Mx,{children:[g.jsx(Rx,{value:f,onChange:S,placeholder:"Text to display"}),g.jsx(Ox,{children:g.jsx(Nu,{})})]})]})]})}),g.jsxs(d3,{children:[g.jsx(Pn,{variant:"secondary",children:"Cancel"}),g.jsxs(Pn,{disabled:!p||w,onClick:()=>C(u,f,l??void 0),children:[w&&g.jsx(mf,{}),y?"Update":"Insert"]})]})]})]})};function F3({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 H3(t,e){fm(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var Ia=function(){return Ia=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},Ia.apply(this,arguments)};function U3(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"},Nx={unit:Ei.Percent,value:.8};function _x(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%"...'),Nx):(console.warn("scrollThreshold should be string or number"),Nx)}var z3=(function(t){H3(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=U3(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?Ia(Ia({},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=_x(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=_x(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=Ia({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 V3(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 Dx(t){const{core:e}=Il(),[n,r]=M.useState([]),[o,s]=M.useState(""),i=V3(),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 lA=typeof global=="object"&&global&&global.Object===Object&&global,W3=typeof self=="object"&&self&&self.Object===Object&&self,Er=lA||W3||Function("return this")(),er=Er.Symbol,cA=Object.prototype,G3=cA.hasOwnProperty,q3=cA.toString,fa=er?er.toStringTag:void 0;function K3(t){var e=G3.call(t,fa),n=t[fa];try{t[fa]=void 0;var r=!0}catch{}var o=q3.call(t);return r&&(e?t[fa]=n:delete t[fa]),o}var Y3=Object.prototype,J3=Y3.toString;function X3(t){return J3.call(t)}var Q3="[object Null]",Z3="[object Undefined]",Ix=er?er.toStringTag:void 0;function Ys(t){return t==null?t===void 0?Z3:Q3:Ix&&Ix in Object(t)?K3(t):X3(t)}function yo(t){return t!=null&&typeof t=="object"}var e5="[object Symbol]";function gf(t){return typeof t=="symbol"||yo(t)&&Ys(t)==e5}function Cy(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,Px=er?er.prototype:void 0,Lx=Px?Px.toString:void 0;function uA(t){if(typeof t=="string")return t;if(yr(t))return Cy(t,uA)+"";if(gf(t))return Lx?Lx.call(t):"";var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}var t5=/\s/;function n5(t){for(var e=t.length;e--&&t5.test(t.charAt(e)););return e}var r5=/^\s+/;function o5(t){return t&&t.slice(0,n5(t)+1).replace(r5,"")}function Vr(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var jx=NaN,s5=/^[-+]0x[0-9a-f]+$/i,i5=/^0b[01]+$/i,a5=/^0o[0-7]+$/i,l5=parseInt;function $x(t){if(typeof t=="number")return t;if(gf(t))return jx;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=o5(t);var n=i5.test(t);return n||a5.test(t)?l5(t.slice(2),n?2:8):s5.test(t)?jx:+t}function dA(t){return t}var c5="[object AsyncFunction]",u5="[object Function]",d5="[object GeneratorFunction]",f5="[object Proxy]";function fA(t){if(!Vr(t))return!1;var e=Ys(t);return e==u5||e==d5||e==c5||e==f5}var Lh=Er["__core-js_shared__"],Bx=(function(){var t=/[^.]+$/.exec(Lh&&Lh.keys&&Lh.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})();function h5(t){return!!Bx&&Bx in t}var p5=Function.prototype,m5=p5.toString;function Js(t){if(t!=null){try{return m5.call(t)}catch{}try{return t+""}catch{}}return""}var g5=/[\\^$.*+?()[\]{}|]/g,y5=/^\[object .+?Constructor\]$/,v5=Function.prototype,b5=Object.prototype,x5=v5.toString,w5=b5.hasOwnProperty,E5=RegExp("^"+x5.call(w5).replace(g5,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function S5(t){if(!Vr(t)||h5(t))return!1;var e=fA(t)?E5:y5;return e.test(Js(t))}function k5(t,e){return t?.[e]}function Xs(t,e){var n=k5(t,e);return S5(n)?n:void 0}var hm=Xs(Er,"WeakMap");function T5(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 C5=800,A5=16,M5=Date.now;function O5(t){var e=0,n=0;return function(){var r=M5(),o=A5-(r-n);if(n=r,o>0){if(++e>=C5)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function R5(t){return function(){return t}}var _u=(function(){try{var t=Xs(Object,"defineProperty");return t({},"",{}),t}catch{}})(),N5=_u?function(t,e){return _u(t,"toString",{configurable:!0,enumerable:!1,value:R5(e),writable:!0})}:dA,_5=O5(N5);function D5(t,e){for(var n=-1,r=t==null?0:t.length;++n<r&&e(t[n],n,t)!==!1;);return t}var I5=9007199254740991,P5=/^(?:0|[1-9]\d*)$/;function Ay(t,e){var n=typeof t;return e=e??I5,!!e&&(n=="number"||n!="symbol"&&P5.test(t))&&t>-1&&t%1==0&&t<e}function hA(t,e,n){e=="__proto__"&&_u?_u(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function My(t,e){return t===e||t!==t&&e!==e}var L5=Object.prototype,j5=L5.hasOwnProperty;function Oy(t,e,n){var r=t[e];(!(j5.call(t,e)&&My(r,n))||n===void 0&&!(e in t))&&hA(t,e,n)}function $5(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?hA(n,a,l):Oy(n,a,l)}return n}var Fx=Math.max;function B5(t,e,n){return e=Fx(e===void 0?t.length-1:e,0),function(){for(var r=arguments,o=-1,s=Fx(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),T5(t,this,a)}}var F5=9007199254740991;function Ry(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=F5}function pA(t){return t!=null&&Ry(t.length)&&!fA(t)}var H5=Object.prototype;function mA(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||H5;return t===n}function U5(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}var z5="[object Arguments]";function Hx(t){return yo(t)&&Ys(t)==z5}var gA=Object.prototype,V5=gA.hasOwnProperty,W5=gA.propertyIsEnumerable,Ny=Hx((function(){return arguments})())?Hx:function(t){return yo(t)&&V5.call(t,"callee")&&!W5.call(t,"callee")};function G5(){return!1}var yA=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ux=yA&&typeof module=="object"&&module&&!module.nodeType&&module,q5=Ux&&Ux.exports===yA,zx=q5?Er.Buffer:void 0,K5=zx?zx.isBuffer:void 0,Du=K5||G5,Y5="[object Arguments]",J5="[object Array]",X5="[object Boolean]",Q5="[object Date]",Z5="[object Error]",e4="[object Function]",t4="[object Map]",n4="[object Number]",r4="[object Object]",o4="[object RegExp]",s4="[object Set]",i4="[object String]",a4="[object WeakMap]",l4="[object ArrayBuffer]",c4="[object DataView]",u4="[object Float32Array]",d4="[object Float64Array]",f4="[object Int8Array]",h4="[object Int16Array]",p4="[object Int32Array]",m4="[object Uint8Array]",g4="[object Uint8ClampedArray]",y4="[object Uint16Array]",v4="[object Uint32Array]",rt={};rt[u4]=rt[d4]=rt[f4]=rt[h4]=rt[p4]=rt[m4]=rt[g4]=rt[y4]=rt[v4]=!0;rt[Y5]=rt[J5]=rt[l4]=rt[X5]=rt[c4]=rt[Q5]=rt[Z5]=rt[e4]=rt[t4]=rt[n4]=rt[r4]=rt[o4]=rt[s4]=rt[i4]=rt[a4]=!1;function b4(t){return yo(t)&&Ry(t.length)&&!!rt[Ys(t)]}function _y(t){return function(e){return t(e)}}var vA=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Pa=vA&&typeof module=="object"&&module&&!module.nodeType&&module,x4=Pa&&Pa.exports===vA,jh=x4&&lA.process,Li=(function(){try{var t=Pa&&Pa.require&&Pa.require("util").types;return t||jh&&jh.binding&&jh.binding("util")}catch{}})(),Vx=Li&&Li.isTypedArray,bA=Vx?_y(Vx):b4,w4=Object.prototype,E4=w4.hasOwnProperty;function xA(t,e){var n=yr(t),r=!n&&Ny(t),o=!n&&!r&&Du(t),s=!n&&!r&&!o&&bA(t),i=n||r||o||s,a=i?U5(t.length,String):[],l=a.length;for(var c in t)(e||E4.call(t,c))&&!(i&&(c=="length"||o&&(c=="offset"||c=="parent")||s&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||Ay(c,l)))&&a.push(c);return a}function wA(t,e){return function(n){return t(e(n))}}var S4=wA(Object.keys,Object),k4=Object.prototype,T4=k4.hasOwnProperty;function C4(t){if(!mA(t))return S4(t);var e=[];for(var n in Object(t))T4.call(t,n)&&n!="constructor"&&e.push(n);return e}function EA(t){return pA(t)?xA(t):C4(t)}function A4(t){var e=[];if(t!=null)for(var n in Object(t))e.push(n);return e}var M4=Object.prototype,O4=M4.hasOwnProperty;function R4(t){if(!Vr(t))return A4(t);var e=mA(t),n=[];for(var r in t)r=="constructor"&&(e||!O4.call(t,r))||n.push(r);return n}function N4(t){return pA(t)?xA(t,!0):R4(t)}var _4=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,D4=/^\w*$/;function Dy(t,e){if(yr(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||gf(t)?!0:D4.test(t)||!_4.test(t)||e!=null&&t in Object(e)}var ll=Xs(Object,"create");function I4(){this.__data__=ll?ll(null):{},this.size=0}function P4(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var L4="__lodash_hash_undefined__",j4=Object.prototype,$4=j4.hasOwnProperty;function B4(t){var e=this.__data__;if(ll){var n=e[t];return n===L4?void 0:n}return $4.call(e,t)?e[t]:void 0}var F4=Object.prototype,H4=F4.hasOwnProperty;function U4(t){var e=this.__data__;return ll?e[t]!==void 0:H4.call(e,t)}var z4="__lodash_hash_undefined__";function V4(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=ll&&e===void 0?z4: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=I4;Fs.prototype.delete=P4;Fs.prototype.get=B4;Fs.prototype.has=U4;Fs.prototype.set=V4;function W4(){this.__data__=[],this.size=0}function yf(t,e){for(var n=t.length;n--;)if(My(t[n][0],e))return n;return-1}var G4=Array.prototype,q4=G4.splice;function K4(t){var e=this.__data__,n=yf(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():q4.call(e,n,1),--this.size,!0}function Y4(t){var e=this.__data__,n=yf(e,t);return n<0?void 0:e[n][1]}function J4(t){return yf(this.__data__,t)>-1}function X4(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=W4;Eo.prototype.delete=K4;Eo.prototype.get=Y4;Eo.prototype.has=J4;Eo.prototype.set=X4;var cl=Xs(Er,"Map");function Q4(){this.size=0,this.__data__={hash:new Fs,map:new(cl||Eo),string:new Fs}}function Z4(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 Z4(e)?n[typeof e=="string"?"string":"hash"]:n.map}function eW(t){var e=vf(this,t).delete(t);return this.size-=e?1:0,e}function tW(t){return vf(this,t).get(t)}function nW(t){return vf(this,t).has(t)}function rW(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=Q4;So.prototype.delete=eW;So.prototype.get=tW;So.prototype.has=nW;So.prototype.set=rW;var oW="Expected a function";function Iy(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(oW);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(Iy.Cache||So),n}Iy.Cache=So;var sW=500;function iW(t){var e=Iy(t,function(r){return n.size===sW&&n.clear(),r}),n=e.cache;return e}var aW=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,lW=/\\(\\)?/g,cW=iW(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(aW,function(n,r,o,s){e.push(o?s.replace(lW,"$1"):r||n)}),e});function uW(t){return t==null?"":uA(t)}function na(t,e){return yr(t)?t:Dy(t,e)?[t]:cW(uW(t))}function ra(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=na(e,t);for(var n=0,r=e.length;t!=null&&n<r;)t=t[ra(e[n++])];return n&&n==r?t:void 0}function dW(t,e,n){var r=t==null?void 0:bf(t,e);return r===void 0?n:r}function Py(t,e){for(var n=-1,r=e.length,o=t.length;++n<r;)t[o+n]=e[n];return t}var Wx=er?er.isConcatSpreadable:void 0;function fW(t){return yr(t)||Ny(t)||!!(Wx&&t&&t[Wx])}function hW(t,e,n,r,o){var s=-1,i=t.length;for(n||(n=fW),o||(o=[]);++s<i;){var a=t[s];n(a)?Py(o,a):o[o.length]=a}return o}function pW(t){var e=t==null?0:t.length;return e?hW(t):[]}function mW(t){return _5(B5(t,void 0,pW),t+"")}var SA=wA(Object.getPrototypeOf,Object),gW="[object Object]",yW=Function.prototype,vW=Object.prototype,kA=yW.toString,bW=vW.hasOwnProperty,xW=kA.call(Object);function wW(t){if(!yo(t)||Ys(t)!=gW)return!1;var e=SA(t);if(e===null)return!0;var n=bW.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&kA.call(n)==xW}function EW(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 SW(){this.__data__=new Eo,this.size=0}function kW(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}function TW(t){return this.__data__.get(t)}function CW(t){return this.__data__.has(t)}var AW=200;function MW(t,e){var n=this.__data__;if(n instanceof Eo){var r=n.__data__;if(!cl||r.length<AW-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=SW;$r.prototype.delete=kW;$r.prototype.get=TW;$r.prototype.has=CW;$r.prototype.set=MW;var TA=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Gx=TA&&typeof module=="object"&&module&&!module.nodeType&&module,OW=Gx&&Gx.exports===TA,qx=OW?Er.Buffer:void 0;qx&&qx.allocUnsafe;function RW(t,e){return t.slice()}function NW(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 CA(){return[]}var _W=Object.prototype,DW=_W.propertyIsEnumerable,Kx=Object.getOwnPropertySymbols,AA=Kx?function(t){return t==null?[]:(t=Object(t),NW(Kx(t),function(e){return DW.call(t,e)}))}:CA,IW=Object.getOwnPropertySymbols,PW=IW?function(t){for(var e=[];t;)Py(e,AA(t)),t=SA(t);return e}:CA;function MA(t,e,n){var r=e(t);return yr(t)?r:Py(r,n(t))}function Yx(t){return MA(t,EA,AA)}function Ly(t){return MA(t,N4,PW)}var pm=Xs(Er,"DataView"),mm=Xs(Er,"Promise"),gm=Xs(Er,"Set"),Jx="[object Map]",LW="[object Object]",Xx="[object Promise]",Qx="[object Set]",Zx="[object WeakMap]",ew="[object DataView]",jW=Js(pm),$W=Js(cl),BW=Js(mm),FW=Js(gm),HW=Js(hm),ar=Ys;(pm&&ar(new pm(new ArrayBuffer(1)))!=ew||cl&&ar(new cl)!=Jx||mm&&ar(mm.resolve())!=Xx||gm&&ar(new gm)!=Qx||hm&&ar(new hm)!=Zx)&&(ar=function(t){var e=Ys(t),n=e==LW?t.constructor:void 0,r=n?Js(n):"";if(r)switch(r){case jW:return ew;case $W:return Jx;case BW:return Xx;case FW:return Qx;case HW:return Zx}return e});var UW=Object.prototype,zW=UW.hasOwnProperty;function VW(t){var e=t.length,n=new t.constructor(e);return e&&typeof t[0]=="string"&&zW.call(t,"index")&&(n.index=t.index,n.input=t.input),n}var Iu=Er.Uint8Array;function jy(t){var e=new t.constructor(t.byteLength);return new Iu(e).set(new Iu(t)),e}function WW(t,e){var n=jy(t.buffer);return new t.constructor(n,t.byteOffset,t.byteLength)}var GW=/\w*$/;function qW(t){var e=new t.constructor(t.source,GW.exec(t));return e.lastIndex=t.lastIndex,e}var tw=er?er.prototype:void 0,nw=tw?tw.valueOf:void 0;function KW(t){return nw?Object(nw.call(t)):{}}function YW(t,e){var n=jy(t.buffer);return new t.constructor(n,t.byteOffset,t.length)}var JW="[object Boolean]",XW="[object Date]",QW="[object Map]",ZW="[object Number]",e6="[object RegExp]",t6="[object Set]",n6="[object String]",r6="[object Symbol]",o6="[object ArrayBuffer]",s6="[object DataView]",i6="[object Float32Array]",a6="[object Float64Array]",l6="[object Int8Array]",c6="[object Int16Array]",u6="[object Int32Array]",d6="[object Uint8Array]",f6="[object Uint8ClampedArray]",h6="[object Uint16Array]",p6="[object Uint32Array]";function m6(t,e,n){var r=t.constructor;switch(e){case o6:return jy(t);case JW:case XW:return new r(+t);case s6:return WW(t);case i6:case a6:case l6:case c6:case u6:case d6:case f6:case h6:case p6:return YW(t);case QW:return new r;case ZW:case n6:return new r(t);case e6:return qW(t);case t6:return new r;case r6:return KW(t)}}var g6="[object Map]";function y6(t){return yo(t)&&ar(t)==g6}var rw=Li&&Li.isMap,v6=rw?_y(rw):y6,b6="[object Set]";function x6(t){return yo(t)&&ar(t)==b6}var ow=Li&&Li.isSet,w6=ow?_y(ow):x6,OA="[object Arguments]",E6="[object Array]",S6="[object Boolean]",k6="[object Date]",T6="[object Error]",RA="[object Function]",C6="[object GeneratorFunction]",A6="[object Map]",M6="[object Number]",NA="[object Object]",O6="[object RegExp]",R6="[object Set]",N6="[object String]",_6="[object Symbol]",D6="[object WeakMap]",I6="[object ArrayBuffer]",P6="[object DataView]",L6="[object Float32Array]",j6="[object Float64Array]",$6="[object Int8Array]",B6="[object Int16Array]",F6="[object Int32Array]",H6="[object Uint8Array]",U6="[object Uint8ClampedArray]",z6="[object Uint16Array]",V6="[object Uint32Array]",Ze={};Ze[OA]=Ze[E6]=Ze[I6]=Ze[P6]=Ze[S6]=Ze[k6]=Ze[L6]=Ze[j6]=Ze[$6]=Ze[B6]=Ze[F6]=Ze[A6]=Ze[M6]=Ze[NA]=Ze[O6]=Ze[R6]=Ze[N6]=Ze[_6]=Ze[H6]=Ze[U6]=Ze[z6]=Ze[V6]=!0;Ze[T6]=Ze[RA]=Ze[D6]=!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=VW(t);else{var l=ar(t),c=l==RA||l==C6;if(Du(t))return RW(t);if(l==NA||l==OA||c&&!o)i={};else{if(!Ze[l])return o?t:{};i=m6(t,l)}}s||(s=new $r);var u=s.get(t);if(u)return u;s.set(t,i),w6(t)?t.forEach(function(h){i.add(Jc(h,e,n,h,t,s))}):v6(t)&&t.forEach(function(h,p){i.set(p,Jc(h,e,n,p,t,s))});var d=Ly,f=a?void 0:d(t);return D5(f||t,function(h,p){f&&(p=h,h=t[p]),Oy(i,p,Jc(h,e,n,p,t,s))}),i}var W6="__lodash_hash_undefined__";function G6(t){return this.__data__.set(t,W6),this}function q6(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=G6;Pu.prototype.has=q6;function K6(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 Y6(t,e){return t.has(e)}var J6=1,X6=2;function _A(t,e,n,r,o,s){var i=n&J6,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&X6?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(!K6(e,function(v,w){if(!Y6(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 Q6(t){var e=-1,n=Array(t.size);return t.forEach(function(r,o){n[++e]=[o,r]}),n}function Z6(t){var e=-1,n=Array(t.size);return t.forEach(function(r){n[++e]=r}),n}var e8=1,t8=2,n8="[object Boolean]",r8="[object Date]",o8="[object Error]",s8="[object Map]",i8="[object Number]",a8="[object RegExp]",l8="[object Set]",c8="[object String]",u8="[object Symbol]",d8="[object ArrayBuffer]",f8="[object DataView]",sw=er?er.prototype:void 0,$h=sw?sw.valueOf:void 0;function h8(t,e,n,r,o,s,i){switch(n){case f8:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case d8:return!(t.byteLength!=e.byteLength||!s(new Iu(t),new Iu(e)));case n8:case r8:case i8:return My(+t,+e);case o8:return t.name==e.name&&t.message==e.message;case a8:case c8:return t==e+"";case s8:var a=Q6;case l8:var l=r&e8;if(a||(a=Z6),t.size!=e.size&&!l)return!1;var c=i.get(t);if(c)return c==e;r|=t8,i.set(t,e);var u=_A(a(t),a(e),r,o,s,i);return i.delete(t),u;case u8:if($h)return $h.call(t)==$h.call(e)}return!1}var p8=1,m8=Object.prototype,g8=m8.hasOwnProperty;function y8(t,e,n,r,o,s){var i=n&p8,a=Yx(t),l=a.length,c=Yx(e),u=c.length;if(l!=u&&!i)return!1;for(var d=l;d--;){var f=a[d];if(!(i?f in e:g8.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,k=e.constructor;x!=k&&"constructor"in t&&"constructor"in e&&!(typeof x=="function"&&x instanceof x&&typeof k=="function"&&k instanceof k)&&(m=!1)}return s.delete(t),s.delete(e),m}var v8=1,iw="[object Arguments]",aw="[object Array]",Cc="[object Object]",b8=Object.prototype,lw=b8.hasOwnProperty;function x8(t,e,n,r,o,s){var i=yr(t),a=yr(e),l=i?aw:ar(t),c=a?aw:ar(e);l=l==iw?Cc:l,c=c==iw?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||bA(t)?_A(t,e,n,r,o,s):h8(t,e,l,n,r,o,s);if(!(n&v8)){var h=u&&lw.call(t,"__wrapped__"),p=d&&lw.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),y8(t,e,n,r,o,s)):!1}function $y(t,e,n,r,o){return t===e?!0:t==null||e==null||!yo(t)&&!yo(e)?t!==t&&e!==e:x8(t,e,n,r,$y,o)}var w8=1,E8=2;function S8(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?$y(c,l,w8|E8,r,u):d))return!1}}return!0}function DA(t){return t===t&&!Vr(t)}function k8(t){for(var e=EA(t),n=e.length;n--;){var r=e[n],o=t[r];e[n]=[r,o,DA(o)]}return e}function IA(t,e){return function(n){return n==null?!1:n[t]===e&&(e!==void 0||t in Object(n))}}function T8(t){var e=k8(t);return e.length==1&&e[0][2]?IA(e[0][0],e[0][1]):function(n){return n===t||S8(n,t,e)}}function C8(t,e){return t!=null&&e in Object(t)}function A8(t,e,n){e=na(e,t);for(var r=-1,o=e.length,s=!1;++r<o;){var i=ra(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&&Ry(o)&&Ay(i,o)&&(yr(t)||Ny(t)))}function M8(t,e){return t!=null&&A8(t,e,C8)}var O8=1,R8=2;function N8(t,e){return Dy(t)&&DA(e)?IA(ra(t),e):function(n){var r=dW(n,t);return r===void 0&&r===e?M8(n,t):$y(e,r,O8|R8)}}function _8(t){return function(e){return e?.[t]}}function D8(t){return function(e){return bf(e,t)}}function I8(t){return Dy(t)?_8(ra(t)):D8(t)}function PA(t){return typeof t=="function"?t:t==null?dA:typeof t=="object"?yr(t)?N8(t[0],t[1]):T8(t):I8(t)}var Bh=function(){return Er.Date.now()},P8="Expected a function",L8=Math.max,j8=Math.min;function $8(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(P8);e=$x(e)||0,Vr(n)&&(u=!!n.leading,d="maxWait"in n,s=d?L8($x(n.maxWait)||0,e):s,f="trailing"in n?!!n.trailing:f);function h(S){var T=r,C=o;return r=o=void 0,c=S,i=t.apply(C,T),i}function p(S){return c=S,a=setTimeout(v,e),u?h(S):i}function m(S){var T=S-l,C=S-c,N=e-T;return d?j8(N,s-C):N}function y(S){var T=S-l,C=S-c;return l===void 0||T>=e||T<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 k(){var S=Bh(),T=y(S);if(r=arguments,o=this,l=S,T){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 k.cancel=E,k.flush=x,k}function B8(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}function F8(t,e){return e.length<2?t:bf(t,EW(e,0,-1))}function H8(t){return t==null}var U8="Expected a function";function z8(t){if(typeof t!="function")throw new TypeError(U8);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 V8(t,e){return e=na(e,t),t=F8(t,e),t==null||delete t[ra(B8(e))]}function W8(t){return wW(t)?void 0:t}var G8=1,q8=2,K8=4,Y8=mW(function(t,e){var n={};if(t==null)return n;var r=!1;e=Cy(e,function(s){return s=na(s,t),r||(r=s.length>1),s}),$5(t,Ly(t),n),r&&(n=Jc(n,G8|q8|K8,W8));for(var o=e.length;o--;)V8(n,e[o]);return n});function J8(t,e,n,r){if(!Vr(t))return t;e=na(e,t);for(var o=-1,s=e.length,i=s-1,a=t;a!=null&&++o<s;){var l=ra(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:Ay(e[o+1])?[]:{})}Oy(a,l,c),a=a[l]}return t}function X8(t,e,n){for(var r=-1,o=e.length,s={};++r<o;){var i=e[r],a=bf(t,i);n(a,i)&&J8(s,na(i,t),a)}return s}function Q8(t,e){if(t==null)return{};var n=Cy(Ly(t),function(r){return[r]});return e=PA(e),X8(t,n,function(r,o){return e(r,o[0])})}function Z8(t,e){return Q8(t,z8(PA(e)))}const Fh={limit:CD,offset:0,query:"",reset:!0};function LA({open:t,onOpenChange:e,onImageSelect:n,children:r}){const[o,s]=b.useState("gifs"),[i,a]=b.useState(""),l=Dx("images"),c=Dx("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(()=>$8(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(JC,{asChild:!0,children:r??g.jsx(Pn,{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(Sy,{className:"p-4 border-b bg-accent",children:g.jsx(ky,{children:"Search Media"})}),g.jsxs(Ek,{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(Sk,{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(eG,{value:i,onChange:h,placeholder:`Search ${o}...`}),g.jsx(Tb,{value:"images",className:"flex-1 grow mt-4 overflow-y-auto",children:g.jsx(cw,{items:l.items,onItemClick:y,hasMore:l.hasMore,loadMore:m,scrollTargetId:ab.images})}),g.jsx(Tb,{value:"gifs",className:"flex-1 grow mt-4 overflow-y-auto",children:g.jsx(cw,{items:c.items,onItemClick:y,hasMore:c.hasMore,loadMore:m,scrollTargetId:ab.gifs})})]})]})]})}function eG({value:t,onChange:e,placeholder:n}){return g.jsx("div",{className:"mt-2 px-4",children:g.jsxs("div",{className:"relative",children:[g.jsx(YC,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),g.jsx(Ty,{type:"text",placeholder:n,value:t,onChange:r=>e(r.target.value),className:"pl-9"})]})})}function cw({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(z3,{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(F3,{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"," "],tG=["ArrowDown","PageUp","Home"],jA=["ArrowUp","PageDown","End"],nG=[...tG,...jA],rG={ltr:[...ym,"ArrowRight"],rtl:[...ym,"ArrowLeft"]},oG={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Gl="Menu",[ul,sG,iG]=yg(Gl),[Qs,$A]=jn(Gl,[iG,cs,$d]),xf=cs(),BA=$d(),[aG,Zs]=Qs(Gl),[lG,ql]=Qs(Gl),FA=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(aG,{scope:e,open:n,onOpenChange:d,content:l,onContentChange:c,children:g.jsx(lG,{scope:e,onClose:b.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:i,children:r})})})};FA.displayName=Gl;var cG="MenuAnchor",By=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,o=xf(n);return g.jsx(Ul,{...o,...r,ref:e})});By.displayName=cG;var Fy="MenuPortal",[uG,HA]=Qs(Fy,{forceMount:void 0}),UA=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:o}=t,s=Zs(Fy,e);return g.jsx(uG,{scope:e,forceMount:n,children:g.jsx($n,{present:n||s.open,children:g.jsx(ea,{asChild:!0,container:o,children:r})})})};UA.displayName=Fy;var Qn="MenuContent",[dG,Hy]=Qs(Qn),zA=b.forwardRef((t,e)=>{const n=HA(Qn,t.__scopeMenu),{forceMount:r=n.forceMount,...o}=t,s=Zs(Qn,t.__scopeMenu),i=ql(Qn,t.__scopeMenu);return g.jsx(ul.Provider,{scope:t.__scopeMenu,children:g.jsx($n,{present:r||s.open,children:g.jsx(ul.Slot,{scope:t.__scopeMenu,children:i.modal?g.jsx(fG,{...o,ref:e}):g.jsx(hG,{...o,ref:e})})})})}),fG=b.forwardRef((t,e)=>{const n=Zs(Qn,t.__scopeMenu),r=b.useRef(null),o=Fe(e,r);return b.useEffect(()=>{const s=r.current;if(s)return hf(s)},[]),g.jsx(Uy,{...t,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:ne(t.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),hG=b.forwardRef((t,e)=>{const n=Zs(Qn,t.__scopeMenu);return g.jsx(Uy,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),pG=Yo("MenuContent.ScrollLock"),Uy=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(Qn,n),v=ql(Qn,n),w=xf(n),E=BA(n),x=sG(n),[k,S]=b.useState(null),T=b.useRef(null),C=Fe(e,T,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?Wl:b.Fragment,P=p?{as:pG,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=CG(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&&MG(V,$.current?.area),[]);return g.jsx(dG,{scope:n,searchRef:R,onItemEnter:b.useCallback(V=>{_(V)&&V.preventDefault()},[_]),onItemLeave:b.useCallback(V=>{_(V)||(T.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(Vl,{asChild:!0,trapped:o,onMountAutoFocus:ne(s,V=>{V.preventDefault(),T.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(VS,{asChild:!0,...E,dir:v.dir,orientation:"vertical",loop:r,currentTabStopId:k,onCurrentTabStopIdChange:S,onEntryFocus:ne(l,V=>{v.isUsingKeyboardRef.current||V.preventDefault()}),preventScrollOnEntryFocus:!0,children:g.jsx(af,{role:"menu","aria-orientation":"vertical","data-state":sM(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=T.current;if(V.target!==Q||!nG.includes(V.key))return;V.preventDefault();const me=x().filter(z=>!z.disabled).map(z=>z.ref.current);jA.includes(V.key)&&me.reverse(),kG(me)}),onBlur:ne(t.onBlur,V=>{V.currentTarget.contains(V.target)||(window.clearTimeout(N.current),R.current="")}),onPointerMove:ne(t.onPointerMove,dl(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}}))})})})})})})});zA.displayName=Qn;var mG="MenuGroup",zy=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return g.jsx(ge.div,{role:"group",...r,ref:e})});zy.displayName=mG;var gG="MenuLabel",VA=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return g.jsx(ge.div,{...r,ref:e})});VA.displayName=gG;var Lu="MenuItem",uw="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=Hy(Lu,t.__scopeMenu),l=Fe(e,s),c=b.useRef(!1),u=()=>{const d=s.current;if(!n&&d){const f=new CustomEvent(uw,{bubbles:!0,cancelable:!0});d.addEventListener(uw,h=>r?.(h),{once:!0}),$S(d,f),f.defaultPrevented?c.current=!1:i.onClose()}};return g.jsx(WA,{...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 WA=b.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...s}=t,i=Hy(Lu,n),a=BA(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(ul.ItemSlot,{scope:n,disabled:r,textValue:o??f,children:g.jsx(WS,{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,dl(p=>{r?i.onItemLeave(p):(i.onItemEnter(p),p.defaultPrevented||p.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ne(t.onPointerLeave,dl(p=>i.onItemLeave(p))),onFocus:ne(t.onFocus,()=>d(!0)),onBlur:ne(t.onBlur,()=>d(!1))})})})}),yG="MenuCheckboxItem",GA=b.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...o}=t;return g.jsx(XA,{scope:t.__scopeMenu,checked:n,children:g.jsx(wf,{role:"menuitemcheckbox","aria-checked":ju(n)?"mixed":n,...o,ref:e,"data-state":Wy(n),onSelect:ne(o.onSelect,()=>r?.(ju(n)?!0:!n),{checkForDefaultPrevented:!1})})})});GA.displayName=yG;var qA="MenuRadioGroup",[vG,bG]=Qs(qA,{value:void 0,onValueChange:()=>{}}),KA=b.forwardRef((t,e)=>{const{value:n,onValueChange:r,...o}=t,s=pr(r);return g.jsx(vG,{scope:t.__scopeMenu,value:n,onValueChange:s,children:g.jsx(zy,{...o,ref:e})})});KA.displayName=qA;var YA="MenuRadioItem",JA=b.forwardRef((t,e)=>{const{value:n,...r}=t,o=bG(YA,t.__scopeMenu),s=n===o.value;return g.jsx(XA,{scope:t.__scopeMenu,checked:s,children:g.jsx(wf,{role:"menuitemradio","aria-checked":s,...r,ref:e,"data-state":Wy(s),onSelect:ne(r.onSelect,()=>o.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});JA.displayName=YA;var Vy="MenuItemIndicator",[XA,xG]=Qs(Vy,{checked:!1}),QA=b.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...o}=t,s=xG(Vy,n);return g.jsx($n,{present:r||ju(s.checked)||s.checked===!0,children:g.jsx(ge.span,{...o,ref:e,"data-state":Wy(s.checked)})})});QA.displayName=Vy;var wG="MenuSeparator",ZA=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return g.jsx(ge.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});ZA.displayName=wG;var EG="MenuArrow",eM=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,o=xf(n);return g.jsx(lf,{...o,...r,ref:e})});eM.displayName=EG;var SG="MenuSub",[fne,tM]=Qs(SG),Ta="MenuSubTrigger",nM=b.forwardRef((t,e)=>{const n=Zs(Ta,t.__scopeMenu),r=ql(Ta,t.__scopeMenu),o=tM(Ta,t.__scopeMenu),s=Hy(Ta,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(By,{asChild:!0,...c,children:g.jsx(WA,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":sM(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,dl(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,dl(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===" "||rG[r.dir].includes(d.key)&&(n.onOpenChange(!0),n.content?.focus(),d.preventDefault())})})})});nM.displayName=Ta;var rM="MenuSubContent",oM=b.forwardRef((t,e)=>{const n=HA(Qn,t.__scopeMenu),{forceMount:r=n.forceMount,...o}=t,s=Zs(Qn,t.__scopeMenu),i=ql(Qn,t.__scopeMenu),a=tM(rM,t.__scopeMenu),l=b.useRef(null),c=Fe(e,l);return g.jsx(ul.Provider,{scope:t.__scopeMenu,children:g.jsx($n,{present:r||s.open,children:g.jsx(ul.Slot,{scope:t.__scopeMenu,children:g.jsx(Uy,{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=oG[i.dir].includes(u.key);d&&f&&(s.onOpenChange(!1),a.trigger?.focus(),u.preventDefault())})})})})})});oM.displayName=rM;function sM(t){return t?"open":"closed"}function ju(t){return t==="indeterminate"}function Wy(t){return ju(t)?"indeterminate":t?"checked":"unchecked"}function kG(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function TG(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function CG(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=TG(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 AG(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 MG(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return AG(n,e)}function dl(t){return e=>e.pointerType==="mouse"?t(e):void 0}var OG=FA,RG=By,NG=UA,_G=zA,DG=zy,IG=VA,PG=wf,LG=GA,jG=KA,$G=JA,BG=QA,FG=ZA,HG=eM,UG=nM,zG=oM,Ef="DropdownMenu",[VG]=jn(Ef,[$A]),hn=$A(),[WG,iM]=VG(Ef),aM=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(WG,{scope:e,triggerId:Yn(),triggerRef:c,contentId:Yn(),open:u,onOpenChange:d,onOpenToggle:b.useCallback(()=>d(f=>!f),[d]),modal:a,children:g.jsx(OG,{...l,open:u,onOpenChange:d,dir:r,modal:a,children:n})})};aM.displayName=Ef;var lM="DropdownMenuTrigger",cM=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=t,s=iM(lM,n),i=hn(n);return g.jsx(RG,{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())})})})});cM.displayName=lM;var GG="DropdownMenuPortal",uM=t=>{const{__scopeDropdownMenu:e,...n}=t,r=hn(e);return g.jsx(NG,{...r,...n})};uM.displayName=GG;var dM="DropdownMenuContent",fM=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=iM(dM,n),s=hn(n),i=b.useRef(!1);return g.jsx(_G,{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)"}})});fM.displayName=dM;var qG="DropdownMenuGroup",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="DropdownMenuLabel",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="DropdownMenuItem",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="DropdownMenuCheckboxItem",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="DropdownMenuRadioGroup",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="DropdownMenuRadioItem",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="DropdownMenuItemIndicator",bM=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=hn(n);return g.jsx(BG,{...o,...r,ref:e})});bM.displayName=ZG;var e9="DropdownMenuSeparator",xM=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=hn(n);return g.jsx(FG,{...o,...r,ref:e})});xM.displayName=e9;var t9="DropdownMenuArrow",n9=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=hn(n);return g.jsx(HG,{...o,...r,ref:e})});n9.displayName=t9;var r9="DropdownMenuSubTrigger",wM=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=hn(n);return g.jsx(UG,{...o,...r,ref:e})});wM.displayName=r9;var o9="DropdownMenuSubContent",EM=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=hn(n);return g.jsx(zG,{...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)"}})});EM.displayName=o9;var s9=aM,i9=cM,a9=uM,l9=fM,c9=hM,u9=pM,d9=mM,f9=gM,h9=yM,p9=vM,SM=bM,m9=xM,g9=wM,y9=EM;function dw(t){return g.jsx(s9,{"data-slot":"dropdown-menu",...t})}const fw=b.forwardRef((t,e)=>g.jsx(i9,{ref:e,"data-slot":"dropdown-menu-trigger",...t})),hw=b.forwardRef(({className:t,sideOffset:e,...n},r)=>g.jsx(a9,{children:g.jsx("div",{"data-theme":"select-post-builder",children:g.jsx(l9,{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(c9,{ref:e,"data-slot":"dropdown-menu-group",...t}));const yn=b.forwardRef(({className:t,inset:e,variant:n="default",...r},o)=>g.jsx(d9,{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(f9,{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(SM,{children:g.jsx(GC,{className:"size-4"})})}),e]}));b.forwardRef((t,e)=>g.jsx(h9,{ref:e,"data-slot":"dropdown-menu-radio-group",...t}));b.forwardRef(({className:t,children:e,...n},r)=>g.jsxs(p9,{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(SM,{children:g.jsx(hV,{className:"size-2 fill-current"})})}),e]}));b.forwardRef(({className:t,inset:e,...n},r)=>g.jsx(u9,{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(m9,{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(g9,{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(cV,{className:"ml-auto size-4"})]}));b.forwardRef(({className:t,...e},n)=>g.jsx(y9,{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 kM(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",[v9]=jn(Sf),[b9,x9]=v9(Sf),TM=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(b9,{scope:n,checked:v,disabled:a,children:[g.jsx(ge.button,{type:"button",role:"switch","aria-checked":v,"aria-required":i,"data-state":OM(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(MM,{control:f,bubbles:!m.current,name:r,value:l,checked:v,required:i,disabled:a,form:u,style:{transform:"translateX(-100%)"}})]})});TM.displayName=Sf;var CM="SwitchThumb",AM=b.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,o=x9(CM,n);return g.jsx(ge.span,{"data-state":OM(o.checked),"data-disabled":o.disabled?"":void 0,...r,ref:e})});AM.displayName=CM;var w9="SwitchBubbleInput",MM=b.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...o},s)=>{const i=b.useRef(null),a=Fe(i,s),l=kM(n),c=YT(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}})});MM.displayName=w9;function OM(t){return t?"checked":"unchecked"}var E9=TM,S9=AM;function pw({className:t,...e}){return g.jsx(E9,{"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(S9,{"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 k9=t=>OT({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}},mw=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},T9=(t,e,n={})=>{const{debounceMs:r=0,checkOnTransaction:o=!0}=n;let s=mw(t),i=null;e(s);const a=()=>{const d=mw(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)}},C9=(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 T9(t,i=>{r(i)},o)},[t,o]),{showCrossMentionIndicator:n}};function A9(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 A9(t,s=>{if(s.type===e&&(r.push(s),!o))return!1},n),r}function gw(t,e,n={}){return Kl(t,e,{...n,findAll:!1})[0]||null}const M9={[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]:{}},O9=({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=k9(p),{showCrossMentionIndicator:y}=C9(p,{debounceMs:150});if(!p)return null;const v=M9[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 ${Ma} files per post. Please remove some files before adding new ones.`),!0):!1},k=()=>{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?Ma: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=""},T=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?vx:R?.isHeading2?bx:R?.isHeading3?xx:R?.isHeading4?wx:R?.isHeading5?Ex:R?.isHeading6?Sx: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:r3,tooltip:"Undo",onClick:t.undo,disabled:!m?.canUndo}),g.jsx(be,{icon:UV,tooltip:"Redo",onClick:t.redo,disabled:!m?.canRedo}),g.jsxs(dw,{children:[g.jsx(fw,{asChild:!0,children:g.jsx(be,{tooltip:"Heading Options",icon:N(m),"aria-label":"More formatting options"})}),g.jsx(hw,{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(vx,{})," 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(bx,{})," 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(xx,{})," 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(wx,{})," 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(Ex,{})," 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(Sx,{})," Heading 6"]})})]})})]}),g.jsx(ui,{}),g.jsx(be,{icon:sV,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:kx,tooltip:"Italic",onClick:t.toggleItalic,active:m?.isItalic,disabled:!m?.canItalic}),g.jsx(be,{icon:Tx,tooltip:"Strikethrough",onClick:t.toggleStrikethrough,active:m?.isStrike,disabled:!m?.canStrike})]}),g.jsx(be,{icon:t3,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:jV,tooltip:"Bullet List",onClick:t.toggleBulletList,active:m?.isBulletList,disabled:!m?.canBulletList}),g.jsx(be,{icon:PV,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:mx,tooltip:"Code",onClick:t.toggleCode,active:m?.isCode,disabled:!m?.canCode}),g.jsx(be,{icon:gx,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(dw,{children:[g.jsx(fw,{asChild:!0,children:g.jsx(be,{tooltip:"More formatting options",icon:gV,"aria-label":"More formatting options"})}),g.jsx(hw,{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:kx,tooltip:"Italic",onClick:t.toggleItalic,active:m?.isItalic,disabled:!m?.canItalic})}),g.jsx(yn,{asChild:!0,children:g.jsx(be,{icon:Tx,tooltip:"Strikethrough",onClick:t.toggleStrikethrough,active:m?.isStrike,disabled:!m?.canStrike})}),g.jsx(yn,{asChild:!0,children:g.jsx(be,{icon:mx,tooltip:"Code",onClick:t.toggleCode,active:m?.isCode,disabled:!m?.canCode})}),g.jsx(yn,{asChild:!0,children:g.jsx(be,{icon:gx,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(pw,{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(yx,{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:TD[i||xe.Image],hidden:!0,onChange:S}),v.showImage&&g.jsx(be,{icon:KC,tooltip:"Insert Image",disabled:!m?.canInsertImage,onMouseOver:()=>a(xe.Image),onClick:k}),v.showVideo&&g.jsx(be,{icon:xy,disabled:!m?.canInsertVideo,tooltip:"Insert Video",onMouseOver:()=>a(xe.Video),onClick:k}),v.showAudio&&g.jsx(be,{icon:Ru,disabled:!m?.canInsertAudio,tooltip:"Insert Audio",onMouseOver:()=>a(xe.Audio),onClick:k}),v.showImageSearch&&g.jsxs(g.Fragment,{children:[g.jsx(ui,{}),g.jsx(LA,{open:u,onOpenChange:d,onImageSelect:C,children:g.jsx(be,{onClick:T,disabled:!m?.canInsertImage,icon:OV,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(pw,{id:"send-cross-mention"}),g.jsxs(um,{htmlFor:"send-cross-mention",children:["Cross-post to groups you #mention? ",g.jsx(yx,{})]})]})]}),g.jsxs(Pn,{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(WV,{})]})]})]})},ui=()=>g.jsx("div",{className:"h-3 w-px bg-border"}),yw=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},R9=(t=>t?yw(t):yw),N9=t=>{const e=t.postId&&t.groupId?"post":t.groupId?"group":"global";return R9((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]},_9=/^\s*>\s$/,D9=_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:_9,type:this.type})]}}),I9=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,P9=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,L9=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,j9=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,$9=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:I9,type:this.type}),_i({find:L9,type:this.type})]},addPasteRules(){return[js({find:P9,type:this.type}),js({find:j9,type:this.type})]}}),B9=/(^|[^`])`([^`]+)`(?!`)$/,F9=/(^|[^`])`([^`]+)`(?!`)/g,H9=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:B9,type:this.type})]},addPasteRules(){return[js({find:F9,type:this.type})]}}),Hh=4,U9=/^```([a-z]+)?[\s\n]$/,z9=/^~~~([a-z]+)?[\s\n]$/,V9=_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:U9,type:this.type,getAttributes:t=>({language:t[1]})}),Jp({find:z9,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}}})]}}),RM=_t.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
535
-
536
- `):""}),W9=RM,NM=_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()}}}),Gy=NM,G9=_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}}))}}),q9=_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(!dF(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,o=t();return hT(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[uF({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),K9=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Y9=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,J9=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,X9=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Q9=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:K9,type:this.type}),_i({find:J9,type:this.type})]},addPasteRules(){return[js({find:Y9,type:this.type}),js({find:X9,type:this.type})]}});const Z9="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",eq="ελ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",La="asciinumeric",Ca="alphanumeric",wm="domain",_M="emoji",tq="scheme",nq="slashscheme",Uh="whitespace";function rq(t,e){return t in e||(e[t]=[]),e[t]}function Ss(t,e,n){e[vm]&&(e[La]=!0,e[Ca]=!0),e[bm]&&(e[La]=!0,e[xm]=!0),e[La]&&(e[Ca]=!0),e[xm]&&(e[Ca]=!0),e[Ca]&&(e[wm]=!0),e[_M]&&(e[wm]=!0);for(const r in e){const o=rq(r,n);o.indexOf(t)<0&&o.push(t)}}function oq(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(oq(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),vw=(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",DM="ASCIINUMERICAL",IM="ALPHANUMERICAL",fl="LOCALHOST",Sm="TLD",km="UTLD",Xc="SCHEME",mi="SLASH_SCHEME",qy="NUM",Tm="WS",Ky="NL",ja="OPENBRACE",$a="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",Yy="COMMA",sd="DOLLAR",_r="DOT",id="EQUALS",Jy="EXCLAMATION",Vn="HYPHEN",Ba="PERCENT",ad="PIPE",ld="PLUS",cd="POUND",Fa="QUERY",Xy="QUOTE",PM="FULLWIDTHMIDDLEDOT",Qy="SEMI",Dr="SLASH",Ha="TILDE",ud="UNDERSCORE",LM="EMOJI",dd="SYM";var jM=Object.freeze({__proto__:null,ALPHANUMERICAL:IM,AMPERSAND:Zu,APOSTROPHE:ed,ASCIINUMERICAL:DM,ASTERISK:td,AT:Io,BACKSLASH:nd,BACKTICK:rd,CARET:od,CLOSEANGLEBRACKET:Vu,CLOSEBRACE:$a,CLOSEBRACKET:Fu,CLOSEPAREN:Uu,COLON:jo,COMMA:Yy,DOLLAR:sd,DOT:_r,EMOJI:LM,EQUALS:id,EXCLAMATION:Jy,FULLWIDTHGREATERTHAN:Qu,FULLWIDTHLEFTPAREN:Wu,FULLWIDTHLESSTHAN:Xu,FULLWIDTHMIDDLEDOT:PM,FULLWIDTHRIGHTPAREN:Gu,HYPHEN:Vn,LEFTCORNERBRACKET:qu,LEFTWHITECORNERBRACKET:Yu,LOCALHOST:fl,NL:Ky,NUM:qy,OPENANGLEBRACKET:zu,OPENBRACE:ja,OPENBRACKET:Bu,OPENPAREN:Hu,PERCENT:Ba,PIPE:ad,PLUS:ld,POUND:cd,QUERY:Fa,QUOTE:Xy,RIGHTCORNERBRACKET:Ku,RIGHTWHITECORNERBRACKET:Ju,SCHEME:Xc,SEMI:Qy,SLASH:Dr,SLASH_SCHEME:mi,SYM:dd,TILDE:Ha,TLD:Sm,UNDERSCORE:ud,UTLD:km,UWORD:Em,WORD:eo,WS:Tm});const Xr=/[a-z]/,ha=new RegExp("\\p{L}","u"),zh=new RegExp("\\p{Emoji}","u"),Qr=/\d/,Vh=/\s/,bw="\r",Wh=`
539
- `,sq="️",iq="‍",Gh="";let Ac=null,Mc=null;function aq(t=[]){const e={};bn.groups=e;const n=new bn;Ac==null&&(Ac=xw(Z9)),Mc==null&&(Mc=xw(eq)),q(n,"'",ed),q(n,"{",ja),q(n,"}",$a),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,",",Yy),q(n,"$",sd),q(n,".",_r),q(n,"=",id),q(n,"!",Jy),q(n,"-",Vn),q(n,"%",Ba),q(n,"|",ad),q(n,"+",ld),q(n,"#",cd),q(n,"?",Fa),q(n,'"',Xy),q(n,"/",Dr),q(n,";",Qy),q(n,"~",Ha),q(n,"_",ud),q(n,"\\",nd),q(n,"・",PM);const r=ht(n,Qr,qy,{[vm]:!0});ht(r,Qr,r);const o=ht(r,Xr,DM,{[La]:!0}),s=ht(r,ha,IM,{[Ca]:!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,ha,Em,{[xm]:!0});ht(a,Xr),ht(a,Qr,s),ht(a,ha,a),ht(s,Qr,s),ht(s,Xr),ht(s,ha,s);const l=q(n,Wh,Ky,{[Uh]:!0}),c=q(n,bw,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,bw),q(u,Wh),ht(u,Vh,u),q(u,Gh,u);const d=ht(n,zh,LM,{[_M]:!0});q(d,"#"),ht(d,zh,d),q(d,sq,d);const f=q(d,iq);q(f,"#"),ht(f,zh,d);const h=[[Xr,i],[Qr,o]],p=[[Xr,null],[ha,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]?{[tq]:!0}:{[nq]:!0};y.indexOf("-")>=0?w[wm]=!0:Xr.test(y)?Qr.test(y)?w[La]=!0:w[bm]=!0:w[vm]=!0,vw(n,y,y,w)}return vw(n,"localhost",fl,{ascii:!0}),n.jd=new bn(dd),{start:n,tokens:Object.assign({groups:e},jM)}}function $M(t,e){const n=lq(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 lq(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 xw(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 hl={defaultProtocol:"http",events:null,format:ww,formatHref:ww,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Zy(t,e=null){let n=Object.assign({},hl);t&&(n=Object.assign(n,t instanceof Zy?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}Zy.prototype={o:hl,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]:hl[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 ww(t){return t}function BM(t,e){this.t="token",this.v=t,this.tk=e}BM.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=hl.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 BM{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 Ew=kf("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Sw=kf("text"),cq=kf("nl"),Oc=kf("url",{isLink:!0,toHref(t=hl.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==fl&&t[1].t===jo}}),zn=t=>new bn(t);function uq({groups:t}){const e=t.domain.concat([Zu,td,Io,nd,rd,od,sd,id,Vn,qy,Ba,ad,ld,cd,Dr,dd,Ha,ud]),n=[ed,jo,Yy,_r,Jy,Ba,Fa,Xy,Qy,zu,Vu,ja,$a,Fu,Bu,Hu,Uu,Wu,Gu,qu,Ku,Yu,Ju,Xu,Qu],r=[Zu,ed,td,nd,rd,od,sd,id,Vn,ja,$a,Ba,ad,ld,cd,Fa,Dr,dd,Ha,ud],o=zn(),s=q(o,Ha);Ne(s,r,s),Ne(s,t.domain,s);const i=zn(),a=zn(),l=zn();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=zn();Ne(c,t.domain,d),Ne(d,t.domain,d);const f=q(d,_r);Ne(f,t.domain,d);const h=zn(Ew);Ne(f,t.tld,h),Ne(f,t.utld,h),q(c,fl,h);const p=q(d,Vn);q(p,Vn,p),Ne(p,t.domain,d),Ne(h,t.domain,d),q(h,_r,f),q(h,Vn,p);const m=q(h,jo);Ne(m,t.numeric,Ew);const y=q(i,Vn),v=q(i,_r);q(y,Vn,y),Ne(y,t.domain,i),Ne(v,r,s),Ne(v,t.domain,i);const w=zn(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,Vn,y),q(w,Io,c);const E=q(w,jo),x=zn(Oc);Ne(E,t.numeric,x);const k=zn(Oc),S=zn();Ne(k,e,k),Ne(k,n,S),Ne(S,e,k),Ne(S,n,S),q(w,Dr,k),q(x,Dr,k);const T=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,Vn,y),Ne(l,t.domain,i),q(l,_r,v),q(l,Vn,y),Ne(T,t.domain,k),q(T,Dr,k),q(T,Fa,k),Ne(R,t.domain,k),Ne(R,e,k),q(R,Dr,k);const L=[[ja,$a],[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(k,B);q(S,B,j),q(j,U,k);const P=zn(Oc);Ne(j,e,P);const H=zn();Ne(j,n),Ne(P,e,P),Ne(P,n,H),Ne(H,e,P),Ne(H,n,H),q(P,U,k),q(H,U,k)}return q(o,fl,w),q(o,Ky,cq),{start:o,tokens:jM}}function dq(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(Sw,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(Sw,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 fq=typeof console<"u"&&console&&console.warn||(()=>{}),hq="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 pq(){return bn.groups={},ot.scanner=null,ot.parser=null,ot.tokenQueue=[],ot.pluginQueue=[],ot.customSchemes=[],ot.initialized=!1,ot}function kw(t,e=!1){if(ot.initialized&&fq(`linkifyjs: already initialized - will not register custom scheme "${t}" ${hq}`),!/^[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 mq(){ot.scanner=aq(ot.customSchemes);for(let t=0;t<ot.tokenQueue.length;t++)ot.tokenQueue[t][1]({scanner:ot.scanner});ot.parser=uq(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 ev(t){return ot.initialized||mq(),dq(ot.parser.start,t,$M(ot.scanner.start,t))}ev.scan=$M;function FM(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 Zy(n),o=ev(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 tv="[\0-   ᠎ -\u2029  ]",gq=new RegExp(tv),yq=new RegExp(`${tv}$`),vq=new RegExp(tv,"g");function bq(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function xq(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=sT(n.doc,[...e]);if(fT(a).forEach(({newRange:c})=>{const u=mB(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(!yq.test(h))return;d=u[0],f=r.doc.textBetween(d.pos,c.to,void 0," ")}if(d&&f){const h=f.split(gq).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=ev(p).map(v=>v.toObject(t.defaultProtocol));if(!bq(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 wq(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=dT(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 Eq(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=FM(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(vq,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var HM=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"){kw(t);return}kw(t.scheme,t.optionalSlashes)})},onDestroy(){pq()},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=FM(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(xq({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(wq({type:this.type,editor:this.editor,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(Eq({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),nv=HM,Sq=Object.defineProperty,kq=(t,e)=>{for(var n in e)Sq(t,n,{get:e[n],enumerable:!0})},Tq="listItem",Tw="textStyle",Cw=/^\s*([-+*])\s$/,UM=_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(Tq,this.editor.getAttributes(Tw)).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:Cw,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Di({find:Cw,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Tw),editor:this.editor})),[t]}}),zM=_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)}}}),Cq={};kq(Cq,{findListItemPos:()=>Yl,getNextListDepth:()=>rv,handleBackspace:()=>Cm,handleDelete:()=>Am,hasListBefore:()=>VM,hasListItemAfter:()=>Aq,hasListItemBefore:()=>WM,listItemHasSubList:()=>GM,nextListIsDeeper:()=>qM,nextListIsHigher:()=>KM});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}},rv=(t,e)=>{const n=Yl(t,e);if(!n)return!1;const[,r]=TB(e,t,n.$pos.pos+4);return r},VM=(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))},WM=(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)},GM=(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)&&VM(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)||!OB(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=GM(e,t.state,s);return WM(e,t.state)&&!i?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},qM=(t,e)=>{const n=rv(t,e),r=Yl(t,e);return!r||!n?!1:n>r.depth},KM=(t,e)=>{const n=rv(t,e),r=Yl(t,e);return!r||!n?!1:n<r.depth},Am=(t,e)=>{if(!Xo(t.state,e)||!MB(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:o}=n;return!n.empty&&r.sameParent(o)?!1:qM(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():KM(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},Aq=(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)},YM=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}}}}),Aw=/^(\s*)(\d+)\.\s+(.*)$/,Mq=/^\s/;function Oq(t){const e=[];let n=0,r=0;for(;n<t.length;){const o=t[n],s=o.match(Aw);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(Aw))break;if(h.trim()==="")f.push(h),u+=`
544
- `,d+=1;else if(h.match(Mq))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 JM(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=JM(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 Rq(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 Nq="listItem",Mw="textStyle",Ow=/^(\d+)\.\s$/,XM=_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?Rq(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]=Oq(o);if(s.length===0)return;const a=JM(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(Nq,this.editor.getAttributes(Mw)).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:Ow,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:Ow,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Mw)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),_q=/^\s*(\[([( |x])?\])\s$/,Dq=_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:_q,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),Iq=_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(UM.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(zM.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(YM.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(XM.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(Dq.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(Iq.configure(this.options.taskList)),t}});var QM=_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()}}}),ov=QM,Pq=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Lq=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,jq=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:Pq,type:this.type})]},addPasteRules(){return[js({find:Lq,type:this.type})]}}),ZM=_t.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),sv=ZM,$q=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 Bq(t={}){return new Ue({view(e){return new Fq(e,t)}})}class Fq{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=Jk(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 iv(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!Hq(e)||!Uq(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 iv{constructor(e){this.pos=e}map(e){return new iv(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return mt.valid(n)?new mt(n):Oe.near(n)}}function eO(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function Hq(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||eO(o.type))return!0;if(o.inlineContent)return!1}}return!0}function Uq(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||eO(o.type))return!0;if(o.inlineContent)return!1}}return!0}function zq(){return new Ue({props:{decorations:qq,createSelectionBetween(t,e,n){return e.pos==n.pos&&mt.valid(n)?new mt(n):null},handleClick:Wq,handleKeyDown:Vq,handleDOMEvents:{beforeinput:Gq}}})}const Vq=X1({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 Wq(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 Gq(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 qq(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 Kq(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 tO(e):$t.empty};var tO=(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 tO([]);var Kq=(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 Yq=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>Xq&&(a=Jq(a,c),i-=c),new lr(a.append(s),i)}remapping(e,n){let r=new Ya;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()>Yq&&(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 Jq(t,e){let n;return t.forEach((r,o)=>{if(r.selection&&e--==0)return n=o,!1}),t.slice(n)}let Mo=class nO{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 nO(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 Xq=20;function Qq(t,e,n,r){let o=n.getMeta(Os),s;if(o)return o.historyState;n.getMeta(tK)&&(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,Rw(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||!Zq(n,t.prevRanges)),c=i?Kh(t.prevRanges,n.mapping):Rw(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 Zq(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 Rw(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 eK(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,Nw=null;function Qc(t){let e=t.plugins;if(Nw!=e){Yh=!1,Nw=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Yh=!0;break}}return Yh}const Os=new We("history"),tK=new We("closeHistory");function nK(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 Qq(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,o=r=="historyUndo"?oO:r=="historyRedo"?sO:null;return o?(n.preventDefault(),o(e.state,e.dispatch)):!1}}}})}function rO(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=eK(o,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const oO=rO(!1,!0),sO=rO(!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 rK=Qe.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Bq(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 oK=Qe.create({name:"gapCursor",addProseMirrorPlugins(){return[zq()]},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}}}),sK=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||hT(n.selection)||t.view.dragging?null:et.create(n.doc,[Gt.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function _w({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}var iK=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!_w({node:i,types:r})},apply:(o,s)=>{if(!o.docChanged)return s;const i=o.doc.lastChild;return!_w({node:i,types:r})}}})]}}),aK=Qe.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>oO(t,e),redo:()=>({state:t,dispatch:e})=>sO(t,e)}},addProseMirrorPlugins(){return[nK(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()}}}),lK=Qe.create({name:"starterKit",addExtensions(){var t,e,n,r;const o=[];return this.options.bold!==!1&&o.push($9.configure(this.options.bold)),this.options.blockquote!==!1&&o.push(D9.configure(this.options.blockquote)),this.options.bulletList!==!1&&o.push(UM.configure(this.options.bulletList)),this.options.code!==!1&&o.push(H9.configure(this.options.code)),this.options.codeBlock!==!1&&o.push(V9.configure(this.options.codeBlock)),this.options.document!==!1&&o.push(RM.configure(this.options.document)),this.options.dropcursor!==!1&&o.push(rK.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&o.push(oK.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&o.push(NM.configure(this.options.hardBreak)),this.options.heading!==!1&&o.push(G9.configure(this.options.heading)),this.options.undoRedo!==!1&&o.push(aK.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&o.push(q9.configure(this.options.horizontalRule)),this.options.italic!==!1&&o.push(Q9.configure(this.options.italic)),this.options.listItem!==!1&&o.push(zM.configure(this.options.listItem)),this.options.listKeymap!==!1&&o.push(YM.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&o.push(HM.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&o.push(XM.configure(this.options.orderedList)),this.options.paragraph!==!1&&o.push(QM.configure(this.options.paragraph)),this.options.strike!==!1&&o.push(jq.configure(this.options.strike)),this.options.text!==!1&&o.push(ZM.configure(this.options.text)),this.options.underline!==!1&&o.push($q.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&o.push(iK.configure((r=this.options)==null?void 0:r.trailingNode)),o}}),cK=lK,uK=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")}}}),dK=uK,fK=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()}}}),hK=fK,pK=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()}}}),mK=pK;const gK=({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,T)=>{S.preventDefault(),p.current=S.clientX,m.current=d,u(T),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)))},k=()=>{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",k),()=>{window.removeEventListener("mousemove",x),window.removeEventListener("mouseup",k)}},[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"})]})},iO=({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 av="Progress",lv=100,[yK]=jn(av),[vK,bK]=yK(av),aO=b.forwardRef((t,e)=>{const{__scopeProgress:n,value:r=null,max:o,getValueLabel:s=xK,...i}=t;(o||o===0)&&!Dw(o)&&console.error(wK(`${o}`,"Progress"));const a=Dw(o)?o:lv;r!==null&&!Iw(r,a)&&console.error(EK(`${r}`,"Progress"));const l=Iw(r,a)?r:null,c=hd(l)?s(l,a):void 0;return g.jsx(vK,{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":uO(l,a),"data-value":l??void 0,"data-max":a,...i,ref:e})})});aO.displayName=av;var lO="ProgressIndicator",cO=b.forwardRef((t,e)=>{const{__scopeProgress:n,...r}=t,o=bK(lO,n);return g.jsx(ge.div,{"data-state":uO(o.value,o.max),"data-value":o.value??void 0,"data-max":o.max,...r,ref:e})});cO.displayName=lO;function xK(t,e){return`${Math.round(t/e*100)}%`}function uO(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function hd(t){return typeof t=="number"}function Dw(t){return hd(t)&&!isNaN(t)&&t>0}function Iw(t,e){return hd(t)&&!isNaN(t)&&t<=e&&t>=0}function wK(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${lv}\`.`}function EK(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 ${lv} if no \`max\` prop is set)
556
- - \`null\` or \`undefined\` if the progress is indeterminate.
557
-
558
- Defaulting to \`null\`.`}var SK=aO,kK=cO;function dO({className:t,value:e,...n}){return g.jsx(SK,{"data-slot":"progress",className:re("bg-primary/20 relative h-2 w-full overflow-hidden rounded-full",t),...n,children:g.jsx(kK,{"data-slot":"progress-indicator",className:"bg-primary h-full w-full flex-1 transition-all",style:{transform:`translateX(-${100-(e||0)}%)`}})})}var TK="AspectRatio",fO=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}})})});fO.displayName=TK;var CK=fO;function AK({...t}){return g.jsx(CK,{"data-slot":"aspect-ratio",...t})}const MK=({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(AK,{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(dO,{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(ta,{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(Pw,{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(Pw,{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(iO,{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"})})},Pw=({open:t,align:e,onAlign:n,onDelete:r,onResize:o,mediaType:s,children:i})=>g.jsxs(gK,{onResize:o,className:re(s===xe.Audio&&"relative p-4 bg-accent/50"),children:[g.jsx(iO,{open:t,align:e,onAlign:n,onDelete:r}),i]}),hO=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},pO=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},OK=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},RK=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:SD,align:tt.LEFT,caption:"",uploading:!1,progress:0},mO=_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=kD[o],c=Be({style:NK(s),"data-media":!0,"data-uid":e,"data-type":o,"data-src":n,"data-caption":a||"","data-align":s}),u=Be({src:n,style:_K(r,o,i)},{controls:o===xe.Audio||o===xe.Video});return["div",c,[l,u]]},addNodeView(){return Fl(MK)},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:pO(this.name),deleteMediaByUid:hO(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}}}}),NK=t=>`width: 100%; display: flex; justify-content: ${DK(t)}; margin:16px 0`,_K=(t,e,n)=>`${t}; max-width: ${e===xe.Audio?"100%":`${n}%`}; ${e!==xe.Audio?"height: auto;":""}`,DK=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},IK=({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(gO,{onRemove:r,index:e}),g.jsx(yO,{number:e+1})]})},PK=({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(gO,{onRemove:r,index:e}),g.jsx(yO,{number:e+1})]}),gO=({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(ta,{className:"h-4 w-4"})}),yO=({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}),LK=({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(Ty,{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(Pn,{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]})]})]})})})},jK=({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(Pn,{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(KC,{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(LA,{open:o,onOpenChange:s,onImageSelect:e,children:g.jsxs(Pn,{disabled:n,className:"cursor-pointer flex-1",children:[g.jsx(YC,{})," Search Images"]})})]})},$K=({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"]})]}),BK=({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"})]})]})},cv=(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}),FK=t=>"text"in t,HK=(t,e)=>({key:ho(),type:cu.POLL_TEXT_ITEM,option_id:ho(),option_color:ts[e%ts.length],text:t.trim()}),Lw=(t,e,n)=>{const o=t?.type?.includes("video")?cu.POLL_MEDIA_ITEM:cu.POLL_IMAGE_ITEM;return{...cv(t,o,n),option_color:ts[e%ts.length],option_id:ho()}},UK=({choices:t,onChange:e})=>{const{fileStore:n}=Il(),[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=HK(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 Lw(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=Lw(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($K,{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)=>FK(f)?g.jsx(IK,{choice:f,index:h,canRemove:a,onRemove:()=>d(h)},f.key):g.jsx(PK,{choice:f,index:h,canRemove:a,onRemove:()=>d(h)},f.key)),Array.from({length:s}).map((f,h)=>g.jsx(BK,{disabled:!i,onDrop:c,slotNumber:t.length+h+1},`empty-${h}`))]}),g.jsxs("div",{className:"space-y-3",children:[g.jsx(LK,{value:r,onChange:o,onSubmit:l,disabled:!i}),g.jsx(jK,{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."})]})]})]})},zK=({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(UK,{choices:n,onChange:r,onRemovePoll:()=>{}})})},vO=_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 Fl(zK)},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",[bO]=jn(Tf,[cs]),Jl=cs(),[VK,us]=bO(Tf),xO=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(VK,{scope:e,contentId:Yn(),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})})};xO.displayName=Tf;var wO="PopoverAnchor",WK=b.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,o=us(wO,n),s=Jl(n),{onCustomAnchorAdd:i,onCustomAnchorRemove:a}=o;return b.useEffect(()=>(i(),()=>a()),[i,a]),g.jsx(Ul,{...s,...r,ref:e})});WK.displayName=wO;var EO="PopoverTrigger",SO=b.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,o=us(EO,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":MO(o.open),...r,ref:i,onClick:ne(t.onClick,o.onOpenToggle)});return o.hasCustomAnchor?a:g.jsx(Ul,{asChild:!0,...s,children:a})});SO.displayName=EO;var uv="PopoverPortal",[GK,qK]=bO(uv,{forceMount:void 0}),kO=t=>{const{__scopePopover:e,forceMount:n,children:r,container:o}=t,s=us(uv,e);return g.jsx(GK,{scope:e,forceMount:n,children:g.jsx($n,{present:n||s.open,children:g.jsx(ea,{asChild:!0,container:o,children:r})})})};kO.displayName=uv;var ji="PopoverContent",TO=b.forwardRef((t,e)=>{const n=qK(ji,t.__scopePopover),{forceMount:r=n.forceMount,...o}=t,s=us(ji,t.__scopePopover);return g.jsx($n,{present:r||s.open,children:s.modal?g.jsx(YK,{...o,ref:e}):g.jsx(JK,{...o,ref:e})})});TO.displayName=ji;var KK=Yo("PopoverContent.RemoveScroll"),YK=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(Wl,{as:KK,allowPinchZoom:!0,children:g.jsx(CO,{...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})})})}),JK=b.forwardRef((t,e)=>{const n=us(ji,t.__scopePopover),r=b.useRef(!1),o=b.useRef(!1);return g.jsx(CO,{...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()}})}),CO=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(Vl,{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":MO(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)"}})})})}),AO="PopoverClose",XK=b.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,o=us(AO,n);return g.jsx(ge.button,{type:"button",...r,ref:e,onClick:ne(t.onClick,()=>o.onOpenChange(!1))})});XK.displayName=AO;var QK="PopoverArrow",ZK=b.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,o=Jl(n);return g.jsx(lf,{...o,...r,ref:e})});ZK.displayName=QK;function MO(t){return t?"open":"closed"}var e7=xO,t7=SO,n7=kO,r7=TO;function o7({...t}){return g.jsx(e7,{"data-slot":"popover",...t})}function s7({...t}){return g.jsx(t7,{"data-slot":"popover-trigger",...t})}function i7({className:t,align:e="center",sideOffset:n=4,children:r,...o}){return g.jsx(n7,{children:g.jsx("div",{"data-theme":"select-post-builder",children:g.jsx(r7,{"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 a7=({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(o7,{open:n,onOpenChange:r,children:[g.jsx(s7,{children:g.jsx(UF,{className:"text-blue-600 underline hover:text-blue-700 cursor-pointer focus-within:outline-0"})}),g.jsxs(i7,{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(il,{})}),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(qV,{})})}),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(s3,{})})]})]})},OO=nv.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=l7(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:RK("customLink"),deleteLinkByUid:OK("customLink")}},addMarkView(){return VF(a7)},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}}}}),l7=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},c7=t=>t.includes("spotify.com/embed/track"),u7=({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",c7(o)?"h-38":"h-96")}),g.jsx(Pn,{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(ta,{})})]},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:RO,setPrototypeOf:jw,isFrozen:d7,getPrototypeOf:f7,getOwnPropertyDescriptor:h7}=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),p7=fn(Array.prototype.lastIndexOf),$w=fn(Array.prototype.pop),pa=fn(Array.prototype.push),m7=fn(Array.prototype.splice),Zc=fn(String.prototype.toLowerCase),Jh=fn(String.prototype.toString),Xh=fn(String.prototype.match),ma=fn(String.prototype.replace),g7=fn(String.prototype.indexOf),y7=fn(String.prototype.trim),sr=fn(Object.prototype.hasOwnProperty),on=fn(RegExp.prototype.test),ga=v7(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 v7(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;jw&&jw(t,null);let r=e.length;for(;r--;){let o=e[r];if(typeof o=="string"){const s=n(o);s!==o&&(d7(e)||(e[r]=s),o=s)}t[o]=!0}return t}function b7(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 RO(t))sr(t,n)&&(Array.isArray(r)?e[n]=b7(r):r&&typeof r=="object"&&r.constructor===Object?e[n]=to(r):e[n]=r);return e}function ya(t,e){for(;t!==null;){const r=h7(t,e);if(r){if(r.get)return fn(r.get);if(typeof r.value=="function")return fn(r.value)}t=f7(t)}function n(){return null}return n}const Bw=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"]),x7=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"]),w7=dn(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Fw=dn(["#text"]),Hw=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"]),Uw=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"]),E7=tr(/\{\{[\w\W]*|[\w\W]*\}\}/gm),S7=tr(/<%[\w\W]*|[\w\W]*%>/gm),k7=tr(/\$\{[\w\W]*/gm),T7=tr(/^data-[\-\w.\u00B7-\uFFFF]+$/),C7=tr(/^aria-[\-\w]+$/),NO=tr(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),A7=tr(/^(?:\w+script|data):/i),M7=tr(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),_O=tr(/^html$/i),O7=tr(/^[a-z][.\w]*(-[.\w]+)+$/i);var zw=Object.freeze({__proto__:null,ARIA_ATTR:C7,ATTR_WHITESPACE:M7,CUSTOM_ELEMENT:O7,DATA_ATTR:T7,DOCTYPE_NAME:_O,ERB_EXPR:S7,IS_ALLOWED_URI:NO,IS_SCRIPT_OR_DATA:A7,MUSTACHE_EXPR:E7,TMPLIT_EXPR:k7});const va={element:1,text:3,progressingInstruction:7,comment:8,document:9},R7=function(){return typeof window>"u"?null:window},N7=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}},Vw=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function DO(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:R7();const e=de=>DO(de);if(e.version="3.3.0",e.removed=[],!t||!t.document||t.document.nodeType!==va.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=ya(p,"cloneNode"),y=ya(p,"remove"),v=ya(p,"nextSibling"),w=ya(p,"childNodes"),E=ya(p,"parentNode");if(typeof i=="function"){const de=n.createElement("template");de.content&&de.content.ownerDocument&&(n=de.content.ownerDocument)}let x,k="";const{implementation:S,createNodeIterator:T,createDocumentFragment:C,getElementsByTagName:N}=n,{importNode:R}=r;let L=Vw();e.isSupported=typeof RO=="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}=zw;let{IS_ALLOWED_URI:ie}=zw,te=null;const ye=je({},[...Bw,...Qh,...Zh,...ep,...Fw]);let G=null;const Q=je({},[...Hw,...tp,...Uw,..._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 Bn=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 Fn=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):Bn,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||NO,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({},Fw),G=[],Dt.html===!0&&(je(te,Bw),je(G,Hw)),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,Uw),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===Bn&&(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 ga('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof O.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ga('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');x=O.TRUSTED_TYPES_POLICY,k=x.createHTML("")}else x===void 0&&(x=N7(h,o)),x!==null&&typeof k=="string"&&(k=x.createHTML(""));dn&&dn(O),at=O}},W=je({},[...Qh,...Zh,...x7]),Y=je({},[...ep,...w7]),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){pa(e.removed,{element:O});try{E(O).removeChild(O)}catch{y(O)}},Te=function(O,K){try{pa(e.removed,{attribute:K.getAttributeNode(O),from:K})}catch{pa(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?k: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 T.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 Hn=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===va.progressingInstruction||ut&&O.nodeType===va.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]&&la(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===va.text&&(K=O.textContent,Nc([$,B,U],ct=>{K=ma(K,ct," ")}),O.textContent!==K&&(pa(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 Fn))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(!(la(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,ma(le,_,""))){if(!((K==="src"||K==="xlink:href"||K==="href")&&O!=="script"&&g7(le,"data:")===0&&kr[O])){if(!(we&&!on(H,ma(le,_,"")))){if(le)return!1}}}}}}}return!0},la=function(O){return O!=="annotation-xml"&&Xh(O,V)},Un=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:y7(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],zv=>{Ht=ma(Ht,zv," ")});const Uv=Ee(O.nodeName);if(!qr(Uv,ni,Ht)){Te(wt,O);continue}if(x&&typeof h=="object"&&typeof h.getAttributeType=="function"&&!gn)switch(h.getAttributeType(Uv,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):$w(e.removed)}catch{Te(wt,O)}}Ve(L.afterSanitizeAttributes,O,null)},KN=function de(O){let K=null;const le=Pe(O);for(Ve(L.beforeSanitizeShadowDOM,O,null);K=le.nextNode();)Ve(L.uponSanitizeShadowNode,K,null),Hn(K),Un(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 ga("dirty is not a string, aborting")}else throw ga("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 ga("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===va.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?k:""}K&&ft&&Re(K.firstChild);const wt=Pe(mn?de:K);for(;ct=wt.nextNode();)Hn(ct),Un(ct),ct.content instanceof s&&KN(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(_O,K.ownerDocument.doctype.name)&&(gn="<!DOCTYPE "+K.ownerDocument.doctype.name+`>
559
- `+gn),ze&&Nc([$,B,U],Kr=>{gn=ma(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"&&pa(L[de],O)},e.removeHook=function(de,O){if(O!==void 0){const K=p7(L[de],O);return K===-1?void 0:m7(L[de],K,1)[0]}return $w(L[de])},e.removeHooks=function(de){L[de]=[]},e.removeAllHooks=function(){L=Vw()},e}var Nm=DO();const _7=["youtube.com","www.youtube.com","youtube-nocookie.com","www.youtube-nocookie.com","open.spotify.com","spotify.com"];function IO(t){try{const e=new URL(t);if(e.protocol!=="https:")return!1;const n=e.hostname.toLowerCase();return _7.some(r=>n===r||n.endsWith(`.${r}`))}catch{return!1}}const D7=()=>{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")||"";IO(o)||(console.warn("🚨 Blocked iframe from non-allowed domain:",o),e.parentNode?.removeChild(e))}}),t};function I7(t){try{const e=D7(),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]||!IO(r[1])?null:r[1]}catch(e){return console.error("🚨 Error sanitizing iframe:",e),null}finally{Nm.removeAllHooks()}}const PO=t=>new RegExp(QC).test(t.trim()),LO=t=>new RegExp(ZC).test(t.trim()),Ww=t=>{const e=t.trim();if(PO(e)){const r=e.match(x3)?.[1];return r?`https://www.youtube.com/embed/${r}`:null}if(LO(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},Gw=t=>PO(t)||LO(t),qw=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},P7=_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 Fl(u7)},addPasteRules(){return[{find:/<iframe.*?src="(.*?)".*?<\/iframe>/gi,handler:({state:t,range:e,match:n})=>{const r=n[0],o=I7(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:qw(QC),handler:({state:t,range:e,match:n})=>{const r=n[0],o=Ww(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:qw(ZC),handler:({state:t,range:e,match:n})=>{const r=n[0],o=Ww(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}}}}),L7=t=>{const e=t.clipboardData;return e&&e.getData("text/plain")||null},j7=(t,e,n,r)=>{n.preventDefault();const o=al(e);return r&&t.commands.insertMediaWithUpload&&P3(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},$7=(t,e,n)=>{const r=N3(t);if(!T3(r))return!1;const o=nA(r),s=al(e);return n.chain().focus().deleteSelection().insertLink({href:s,text:o}).run(),!0},B7=(t,e)=>(n,r)=>{try{const o=L7(r);if(!o||!ys(o))return!1;const s=o.trim();return console.log("[SmartLinkPaste] Valid URL detected:",Gw(s)),Gw(s)&&e?.autoEmbed?(r.preventDefault(),!1):!n.state.selection.empty&&e?.autoLinkSelection?(r.preventDefault(),$7(n,s,t)):j7(t,s,r,e?.autoDetectMedia??!0)}catch(o){return console.error("[SmartLinkPaste] Error:",o),!1}},F7=t=>e=>{const n=_3(e.content);if(ys(n.trim()))return e;try{return console.log("[SmartLinkPaste] Transforming inline URLs in pasted content"),B3(t,e)}catch(r){return console.error("[SmartLinkPaste] Transform error:",r),e}},jO=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:B7(t,e)};return e.enableTransformPasted&&(n.transformPasted=F7(t)),[new Ue({key:new We("smartLinkPaste"),props:n})]}}),H7=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=$O(r,10,90);try{const a=await n.uploadImage(s),l=cv(a,o);return i&&clearInterval(i),r&&r(100),l}catch(a){throw i&&clearInterval(i),a}},U7=async t=>{const e=t?.url,n=t?.api,r=t?.onProgress,o=t?.mediaItemType,s=t?.searchFrom;r&&r(25);const i=$O(r,25,90);try{const a=await n.uploadUrl(e),l=cv(a,o,s);return i&&clearInterval(i),r&&r(100),l}catch(a){throw i&&clearInterval(i),a}};function $O(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 BO=Qe.create({name:"smartMediaUpload",addOptions(){return{api:void 0,maxFileSize:MD,allowedFileTypes:["image/*","video/*","audio/*"],maxConcurrentUploads:Ma,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=bL(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 H7({file:s.source,api:i.api,mediaItemType:n,onProgress:u=>{e.commands.updateMediaProgress(s.uid,u),i.onUploadProgress?.(s.uid,u)}});else if(vL(al(s.source)))a=await U7({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>Ma?($o.error(`You can upload at most ${Ma} 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 z7(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:s,startOfLine:i,$position:a}=t,l=r&&!o,c=fF(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 V7=new We("suggestion");function W7({pluginKey:t=V7,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=z7}){let y;const v=h?.(),w=()=>{const S=e.state.selection.$anchor.pos,T=e.view.coordsAtPos(S),{top:C,right:N,bottom:R,left:L}=T;try{return new DOMRect(L,C,N-L,R-C)}catch{return null}},E=(S,T)=>T?()=>{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,T){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(T,{exit:!0});S.dispatch(N)}const k=new Ue({key:t,view(){return{update:async(S,T)=>{var C,N,R,L,$,B,U;const j=(C=this.key)==null?void 0:C.getState(T),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,T,C,N){const{isEditable:R}=e,{composing:L}=e.view,{selection:$}=S,{empty:B,from:U}=$,j={...T},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<T.range.from||U>T.range.to)&&!L&&!T.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:T.active})?(j.active=!0,j.decorationId=T.decorationId?T.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,T){var C,N,R,L;const{active:$,range:B}=k.getState(S.state);if(!$)return!1;if(T.key==="Escape"||T.key==="Esc"){const j=k.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:T,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:T,range:B}))||!1},decorations(S){const{active:T,range:C,decorationId:N,query:R}=k.getState(S);if(!T)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 k}var Tn="top",nr="bottom",rr="right",Cn="left",dv="auto",Xl=[Tn,nr,rr,Cn],$i="start",pl="end",G7="clippingParents",FO="viewport",ba="popper",q7="reference",Kw=Xl.reduce(function(t,e){return t.concat([e+"-"+$i,e+"-"+pl])},[]),HO=[].concat(Xl,[dv]).reduce(function(t,e){return t.concat([e,e+"-"+$i,e+"-"+pl])},[]),K7="beforeRead",Y7="read",J7="afterRead",X7="beforeMain",Q7="main",Z7="afterMain",eY="beforeWrite",tY="write",nY="afterWrite",rY=[K7,Y7,J7,X7,Q7,Z7,eY,tY,nY];function Wr(t){return t?(t.nodeName||"").toLowerCase():null}function Ln(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=Ln(t).Element;return t instanceof e||t instanceof Element}function Zn(t){var e=Ln(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function fv(t){if(typeof ShadowRoot>"u")return!1;var e=Ln(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function oY(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];!Zn(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 sY(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},{});!Zn(o)||!Wr(o)||(Object.assign(o.style,a),Object.keys(s).forEach(function(l){o.removeAttribute(l)}))})}}const UO={name:"applyStyles",enabled:!0,phase:"write",fn:oY,effect:sY,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 zO(){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&&Zn(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)?Ln(t):window,a=i.visualViewport,l=!zO()&&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 hv(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 VO(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&fv(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 Ln(t).getComputedStyle(t)}function iY(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||(fv(t)?t.host:null)||ds(t)}function Yw(t){return!Zn(t)||vo(t).position==="fixed"?null:t.offsetParent}function aY(t){var e=/firefox/i.test(_m()),n=/Trident/i.test(_m());if(n&&Zn(t)){var r=vo(t);if(r.position==="fixed")return null}var o=Cf(t);for(fv(o)&&(o=o.host);Zn(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=Ln(t),n=Yw(t);n&&iY(n)&&vo(n).position==="static";)n=Yw(n);return n&&(Wr(n)==="html"||Wr(n)==="body"&&vo(n).position==="static")?e:n||aY(t)||e}function pv(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function Ua(t,e,n){return Rs(t,pd(e,n))}function lY(t,e,n){var r=Ua(t,e,n);return r>n?n:r}function WO(){return{top:0,right:0,bottom:0,left:0}}function GO(t){return Object.assign({},WO(),t)}function qO(t,e){return e.reduce(function(n,r){return n[r]=t,n},{})}var cY=function(e,n){return e=typeof e=="function"?e(Object.assign({},n.rects,{placement:n.placement})):e,GO(typeof e!="number"?e:qO(e,Xl))};function uY(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=pv(a),c=[Cn,rr].indexOf(a)>=0,u=c?"height":"width";if(!(!s||!i)){var d=cY(o.padding,n),f=hv(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],k=w-f[u]-d[p],S=w/2-f[u]/2+E,T=Ua(x,S,k),C=l;n.modifiersData[r]=(e={},e[C]=T,e.centerOffset=T-S,e)}}function dY(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)||VO(e.elements.popper,o)&&(e.elements.arrow=o))}const fY={name:"arrow",enabled:!0,phase:"main",fn:uY,effect:dY,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Hi(t){return t.split("-")[1]}var hY={top:"auto",right:"auto",bottom:"auto",left:"auto"};function pY(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 Jw(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,k=window;if(c){var S=Ql(n),T="clientHeight",C="clientWidth";if(S===Ln(n)&&(S=ds(n),vo(S).position!=="static"&&a==="absolute"&&(T="scrollHeight",C="scrollWidth")),S=S,o===Tn||(o===Cn||o===rr)&&s===pl){x=nr;var N=d&&S===k&&k.visualViewport?k.visualViewport.height:S[T];m-=N-r.height,m*=l?1:-1}if(o===Cn||(o===Tn||o===nr)&&s===pl){E=rr;var R=d&&S===k&&k.visualViewport?k.visualViewport.width:S[C];h-=R-r.width,h*=l?1:-1}}var L=Object.assign({position:a},c&&hY),$=u===!0?pY({x:h,y:m},Ln(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=(k.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 mY(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,Jw(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,Jw(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 gY={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:mY,data:{}};var Dc={passive:!0};function yY(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=Ln(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 vY={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:yY,data:{}};var bY={left:"right",right:"left",bottom:"top",top:"bottom"};function eu(t){return t.replace(/left|right|bottom|top/g,function(e){return bY[e]})}var xY={start:"end",end:"start"};function Xw(t){return t.replace(/start|end/g,function(e){return xY[e]})}function mv(t){var e=Ln(t),n=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:n,scrollTop:r}}function gv(t){return Fi(ds(t)).left+mv(t).scrollLeft}function wY(t,e){var n=Ln(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=zO();(c||!c&&e==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}return{width:s,height:i,x:a+gv(t),y:l}}function EY(t){var e,n=ds(t),r=mv(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+gv(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 yv(t){var e=vo(t),n=e.overflow,r=e.overflowX,o=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function KO(t){return["html","body","#document"].indexOf(Wr(t))>=0?t.ownerDocument.body:Zn(t)&&yv(t)?t:KO(Cf(t))}function za(t,e){var n;e===void 0&&(e=[]);var r=KO(t),o=r===((n=t.ownerDocument)==null?void 0:n.body),s=Ln(r),i=o?[s].concat(s.visualViewport||[],yv(r)?r:[]):r,a=e.concat(i);return o?a:a.concat(za(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 SY(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 Qw(t,e,n){return e===FO?Dm(wY(t,n)):Hs(e)?SY(e,n):Dm(EY(ds(t)))}function kY(t){var e=za(Cf(t)),n=["absolute","fixed"].indexOf(vo(t).position)>=0,r=n&&Zn(t)?Ql(t):t;return Hs(r)?e.filter(function(o){return Hs(o)&&VO(o,r)&&Wr(o)!=="body"}):[]}function TY(t,e,n,r){var o=e==="clippingParents"?kY(t):[].concat(e),s=[].concat(o,[n]),i=s[0],a=s.reduce(function(l,c){var u=Qw(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},Qw(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 YO(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?pv(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 pl:l[c]=l[c]+(e[u]/2-n[u]/2);break}}return l}function ml(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?G7:a,c=n.rootBoundary,u=c===void 0?FO:c,d=n.elementContext,f=d===void 0?ba:d,h=n.altBoundary,p=h===void 0?!1:h,m=n.padding,y=m===void 0?0:m,v=GO(typeof y!="number"?y:qO(y,Xl)),w=f===ba?q7:ba,E=t.rects.popper,x=t.elements[p?w:f],k=TY(Hs(x)?x:x.contextElement||ds(t.elements.popper),l,u,i),S=Fi(t.elements.reference),T=YO({reference:S,element:E,placement:o}),C=Dm(Object.assign({},E,T)),N=f===ba?C:S,R={top:k.top-N.top+v.top,bottom:N.bottom-k.bottom+v.bottom,left:k.left-N.left+v.left,right:N.right-k.right+v.right},L=t.modifiersData.offset;if(f===ba&&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 CY(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?HO:l,u=Hi(r),d=u?a?Kw:Kw.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]=ml(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 AY(t){if(Br(t)===dv)return[];var e=eu(t);return[Xw(t),e,Xw(e)]}function MY(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)]:AY(y)),x=[y].concat(E).reduce(function(Q,J){return Q.concat(Br(J)===dv?CY(e,{placement:J,boundary:u,rootBoundary:d,padding:c,flipVariations:p,allowedAutoPlacements:m}):J)},[]),k=e.rects.reference,S=e.rects.popper,T=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=ml(e,{placement:L,boundary:u,rootBoundary:d,altBoundary:f,padding:c}),H=U?B?rr:Cn:B?nr:Tn;k[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}T.set(L,V)}if(C)for(var ie=p?3:1,te=function(J){var me=x.find(function(z){var Z=T.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 OY={name:"flip",enabled:!0,phase:"main",fn:MY,requiresIfExists:["offset"],data:{_skip:!1}};function Zw(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 eE(t){return[Tn,rr,nr,Cn].some(function(e){return t[e]>=0})}function RY(t){var e=t.state,n=t.name,r=e.rects.reference,o=e.rects.popper,s=e.modifiersData.preventOverflow,i=ml(e,{elementContext:"reference"}),a=ml(e,{altBoundary:!0}),l=Zw(i,r),c=Zw(a,o,s),u=eE(l),d=eE(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 NY={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:RY};function _Y(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 DY(t){var e=t.state,n=t.options,r=t.name,o=n.offset,s=o===void 0?[0,0]:o,i=HO.reduce(function(u,d){return u[d]=_Y(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 IY={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:DY};function PY(t){var e=t.state,n=t.name;e.modifiersData[n]=YO({reference:e.rects.reference,element:e.rects.popper,placement:e.placement})}const LY={name:"popperOffsets",enabled:!0,phase:"read",fn:PY,data:{}};function jY(t){return t==="x"?"y":"x"}function $Y(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=ml(e,{boundary:l,rootBoundary:c,padding:d,altBoundary:u}),v=Br(e.placement),w=Hi(e.placement),E=!w,x=pv(v),k=jY(x),S=e.modifiersData.popperOffsets,T=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?T[P]:C[P],ye=w===$i?-C[P]:-T[P],G=e.elements.arrow,Q=h&&G?hv(G):{width:0,height:0},J=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:WO(),me=J[U],z=J[j],Z=Ua(0,T[P],Q[P]),Me=E?T[P]/2-ie-Z-me-R.mainAxis:te-Z-me-R.mainAxis,he=E?-T[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=Ua(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[k],Ft=k==="y"?"height":"width",it=At+y[Ct],Mt=At-y[vt],pn=[Tn,Cn].indexOf(v)!==-1,mn=(ft=L?.[k])!=null?ft:0,Dt=pn?it:At-T[Ft]-C[Ft]-mn+R.altAxis,nn=pn?At+T[Ft]+C[Ft]-mn-R.altAxis:Mt,Bn=h&&pn?lY(Dt,At,nn):Ua(h?Dt:it,At,h?nn:Mt);S[k]=Bn,$[k]=Bn-At}e.modifiersData[r]=$}}const BY={name:"preventOverflow",enabled:!0,phase:"main",fn:$Y,requiresIfExists:["offset"]};function FY(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function HY(t){return t===Ln(t)||!Zn(t)?mv(t):FY(t)}function UY(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 zY(t,e,n){n===void 0&&(n=!1);var r=Zn(e),o=Zn(e)&&UY(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"||yv(s))&&(a=HY(e)),Zn(e)?(l=Fi(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):s&&(l.x=gv(s))),{x:i.left+a.scrollLeft-l.x,y:i.top+a.scrollTop-l.y,width:i.width,height:i.height}}function VY(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 WY(t){var e=VY(t);return rY.reduce(function(n,r){return n.concat(e.filter(function(o){return o.phase===r}))},[])}function GY(t){var e;return function(){return e||(e=new Promise(function(n){Promise.resolve().then(function(){e=void 0,n(t())})})),e}}function qY(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 tE={placement:"bottom",modifiers:[],strategy:"absolute"};function nE(){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 KY(t){t===void 0&&(t={});var e=t,n=e.defaultModifiers,r=n===void 0?[]:n,o=e.defaultOptions,s=o===void 0?tE:o;return function(a,l,c){c===void 0&&(c=s);var u={placement:"bottom",orderedModifiers:[],options:Object.assign({},tE,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)?za(a):a.contextElement?za(a.contextElement):[],popper:za(l)};var E=WY(qY([].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(nE(w,E)){u.rects={reference:zY(w,Ql(E),u.options.strategy==="fixed"),popper:hv(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 k=u.orderedModifiers[x],S=k.fn,T=k.options,C=T===void 0?{}:T,N=k.name;typeof S=="function"&&(u=S({state:u,options:C,name:N,instance:h})||u)}}}},update:GY(function(){return new Promise(function(y){h.forceUpdate(),y(u)})}),destroy:function(){m(),f=!0}};if(!nE(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 k=x({state:u,name:v,instance:h,options:E}),S=function(){};d.push(k||S)}})}function m(){d.forEach(function(y){return y()}),d=[]}return h}}var YY=[vY,LY,gY,UO,IY,OY,BY,fY,NY],JY=KY({defaultModifiers:YY}),XY="tippy-box",JO="tippy-content",QY="tippy-backdrop",XO="tippy-arrow",QO="tippy-svg-arrow",ms={passive:!0,capture:!0},ZO=function(){return document.body};function ZY(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 vv(t,e){var n={}.toString.call(t);return n.indexOf("[object")===0&&n.indexOf(e+"]")>-1}function eR(t,e){return typeof t=="function"?t.apply(void 0,e):t}function rE(t,e){if(e===0)return t;var n;return function(r){clearTimeout(n),n=setTimeout(function(){t(r)},e)}}function eJ(t,e){var n=Object.assign({},t);return e.forEach(function(r){delete n[r]}),n}function tJ(t){return t.split(/\s+/).filter(Boolean)}function gi(t){return[].concat(t)}function oE(t,e){t.indexOf(e)===-1&&t.push(e)}function nJ(t){return t.filter(function(e,n){return t.indexOf(e)===n})}function rJ(t){return t.split("-")[0]}function md(t){return[].slice.call(t)}function sE(t){return Object.keys(t).reduce(function(e,n){return t[n]!==void 0&&(e[n]=t[n]),e},{})}function Va(){return document.createElement("div")}function gl(t){return["Element","Fragment"].some(function(e){return vv(t,e)})}function oJ(t){return vv(t,"NodeList")}function sJ(t){return vv(t,"MouseEvent")}function iJ(t){return!!(t&&t._tippy&&t._tippy.reference===t)}function aJ(t){return gl(t)?[t]:oJ(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 iE(t,e){t.forEach(function(n){n&&n.setAttribute("data-state",e)})}function lJ(t){var e,n=gi(t),r=n[0];return r!=null&&(e=r.ownerDocument)!=null&&e.body?r.ownerDocument:document}function cJ(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=rJ(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 aE(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},lE=0;function uJ(){Ir.isTouch||(Ir.isTouch=!0,window.performance&&document.addEventListener("mousemove",tR))}function tR(){var t=performance.now();t-lE<20&&(Ir.isTouch=!1,document.removeEventListener("mousemove",tR)),lE=t}function dJ(){var t=document.activeElement;if(iJ(t)){var e=t._tippy;t.blur&&!e.state.isVisible&&t.blur()}}function fJ(){document.addEventListener("touchstart",uJ,ms),window.addEventListener("blur",dJ)}var hJ=typeof window<"u"&&typeof document<"u",pJ=hJ?!!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 cE(t){var e=/[ \t]{2,}/g,n=/^[ \t]*/gm;return t.replace(e," ").replace(n,"").trim()}function mJ(t){return cE(`
560
- %ctippy.js
561
-
562
- %c`+cE(t)+`
563
-
564
- %c👷‍ This is a development-only message. It will be removed in production.
565
- `)}function nR(t){return[mJ(t),"color: #00C584; font-size: 1.3em; font-weight: bold;","line-height: 1.5","color: #a6a095;"]}var yl;process.env.NODE_ENV!=="production"&&gJ();function gJ(){yl=new Set}function oo(t,e){if(t&&!yl.has(e)){var n;yl.add(e),(n=console).warn.apply(n,nR(e))}}function Im(t,e){if(t&&!yl.has(e)){var n;yl.add(e),(n=console).error.apply(n,nR(e))}}function yJ(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 rR={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},vJ={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},Dn=Object.assign({appendTo:ZO,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},rR,vJ),bJ=Object.keys(Dn),xJ=function(e){process.env.NODE_ENV!=="production"&&sR(e,[]);var n=Object.keys(e);n.forEach(function(r){Dn[r]=e[r]})};function oR(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 wJ(t,e){var n=e?Object.keys(oR(Object.assign({},Dn,{plugins:e}))):bJ,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 uE(t,e){var n=Object.assign({},e,{content:eR(e.content,[t])},e.ignoreAttributes?{}:wJ(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 sR(t,e){t===void 0&&(t={}),e===void 0&&(e=[]);var n=Object.keys(t);n.forEach(function(r){var o=eJ(Dn,Object.keys(rR)),s=!ZY(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 EJ=function(){return"innerHTML"};function Pm(t,e){t[EJ()]=e}function dE(t){var e=Va();return t===!0?e.className=XO:(e.className=QO,gl(t)?e.appendChild(t):Pm(e,t)),e}function fE(t,e){gl(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(JO)}),arrow:n.find(function(r){return r.classList.contains(XO)||r.classList.contains(QO)}),backdrop:n.find(function(r){return r.classList.contains(QY)})}}function iR(t){var e=Va(),n=Va();n.className=XY,n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var r=Va();r.className=JO,r.setAttribute("data-state","hidden"),fE(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)&&fE(c,t.props),i.arrow?u?s.arrow!==i.arrow&&(l.removeChild(u),l.appendChild(dE(i.arrow))):l.appendChild(dE(i.arrow)):u&&l.removeChild(u)}return{popper:e,onUpdate:o}}iR.$$tippy=!0;var SJ=1,Ic=[],sp=[];function kJ(t,e){var n=uE(t,Object.assign({},Dn,oR(sE(e)))),r,o,s,i=!1,a=!1,l=!1,c=!1,u,d,f,h=[],p=rE(ut,n.interactiveDebounce),m,y=SJ++,v=null,w=nJ(n.plugins),E={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},x={id:y,reference:t,popper:Va(),popperInstance:v,props:n,state:E,plugins:w,clearDelayTimeouts:Dt,setProps:nn,setContent:Bn,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 k=n.render(x),S=k.popper,T=k.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?lJ(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&&aE(S,X))){if(gi(x.props.triggerTarget||t).some(function(ae){return aE(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})),tJ(x.props.trigger).forEach(function(I){if(I!=="manual")switch(he(I,ze),I){case"mouseenter":he("mouseleave",dt);break;case"focus":he(pJ?"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&&sJ(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);cJ(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(),Fn=at.box;["placement","reference-hidden","escaped"].forEach(function(Ye){Ye==="placement"?Fn.setAttribute("data-placement",Ee.placement):Ee.attributes.popper["data-popper-"+Ye]?Fn.setAttribute("data-"+Ye,""):Fn.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=JY(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===ZO||I==="parent"?X=ae.parentNode:X=eR(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=uE(t,Object.assign({},X,sE(I),{ignoreAttributes:!0}));x.props=ae,we(),X.interactiveDebounce!==ae.interactiveDebounce&&(te(),p=rE(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(),T&&T(X,ae),x.popperInstance&&(Ct(),Ft().forEach(function(Ie){requestAnimationFrame(Ie._tippy.popperInstance.forceUpdate)})),_("onAfterUpdate",[x,I])}}function Bn(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),iE([Ke,Ee],"visible")}V(),ie(),oE(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),iE([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),oE(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"&&(yJ(t),sR(e,n)),fJ();var r=Object.assign({},e,{plugins:n}),o=aJ(t);if(process.env.NODE_ENV!=="production"){var s=gl(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&&kJ(c,r);return u&&l.push(u),l},[]);return gl(t)?a[0]:a}Zl.defaultProps=Dn;Zl.setDefaultProps=xJ;Zl.currentInput=Ir;Object.assign({},UO,{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:iR});function TJ({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(w3," ")?.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 aR(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>TJ({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function hE(t,e){const n=aR(t),r=n.find(o=>o.char===e);return r||(n.length?n[0]:null)}const CJ=_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=hE(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:hE(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 aR(this).map(W7)}});var xa={exports:{}},pE;function AJ(){if(pE)return xa.exports;pE=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 xa.exports=s,xa.exports.has=i,xa.exports.remove=s,xa.exports}var MJ=AJ();const OJ=fg(MJ);/**
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},RJ=(t,e)=>String(t.rankedValue).localeCompare(String(e.rankedValue));function jm(t,e,n={}){const{keys:r,threshold:o=sn.MATCHES,baseSort:s=RJ,sorter:i=c=>c.sort((u,d)=>PJ(u,d,s))}=n,a=t.reduce(l,[]);return i(a).map(({item:c})=>c);function l(c,u,d){const f=NJ(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 NJ(t,e,n,r){if(!e){const s=t;return{rankedValue:s,rank:mE(s,n,r),keyIndex:-1,keyThreshold:r.threshold}}return $J(t,e).reduce(({rank:s,rankedValue:i,keyIndex:a,keyThreshold:l},{itemValue:c,attributes:u},d)=>{let f=mE(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*_J(t,e){let n=-1;for(;(n=t.indexOf(e,n+1))>-1;)yield n;return-1}function mE(t,e,n){if(t=gE(t,n),e=gE(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=_J(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:DJ(t).includes(e)?sn.ACRONYM:IJ(t,e)}function DJ(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 IJ(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 PJ(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 gE(t,{keepDiacritics:e}){return t=`${t}`,e||(t=OJ(t)),t}function LJ(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 jJ(e,t);n=null}return n==null?[]:Array.isArray(n)?n:[String(n)]}function jJ(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 $J(t,e){const n=[];for(let r=0,o=e.length;r<o;r++){const s=e[r],i=BJ(s),a=LJ(t,s);for(let l=0,c=a.length;l<c;l++)n.push({itemValue:a[l],attributes:i})}return n}const yE={maxRanking:1/0,minRanking:-1/0};function BJ(t){return typeof t=="string"?yE:{...yE,...t}}const lR=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"})]})]})})]})});lR.displayName="MentionList";const FJ=()=>typeof window<"u"&&window.ReactNativeWebView!==void 0,HJ=(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 vE(t,e){return{char:t,items:async()=>await e(),render:()=>{let n,r;return{onStart:o=>{n=new ny(lR,{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 UJ=(t,e,n)=>{const r=HJ(t,e,n);return CJ.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=FJ(),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:[vE("@",r.fetchMentions),vE("#",r.fetchHashtags)]})};function zJ({className:t,...e}){return g.jsx("div",{"data-slot":"skeleton",className:re("bg-accent animate-pulse rounded-md",t),...e})}const VJ=({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(il,{})]})}),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(il,{className:"h-3 w-3 flex-shrink-0 opacity-50"})]})]})]})})]})},WJ=({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(il,{})]})}),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(il,{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})]})]})})]})},GJ=({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(zJ,{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(VJ,{...t.attrs,selected:n,domain:a,onClickDelete:e}):g.jsx(WJ,{...t.attrs,selected:n,domain:a,onClickDelete:e})}):null},cR=_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 Fl(GJ)},addCommands(){return{setLinkPreview:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t}),updateLinkPreviewByUid:pO(this.name),deleteLinkPreviewByUid:hO(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}}}}),bv=Qe.create({name:"customEnterHardBreak",addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.setHardBreak()}}}),qJ=({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(F0,{})})]}):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(Pn,{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(ta,{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(dO,{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(F0,{})})]})})},KJ=new We("mediaMode"),YJ=()=>{let t=!1;return new Ue({key:KJ,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}}})},JJ=_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 Fl(qJ)},addProseMirrorPlugins(){return this.options.mediaMode?[YJ()]:[]}}),XJ={class:"bg-muted text-foreground border border-border font-mono leading-snug rounded px-0.5 py-px after:content-none before:content-none"},QJ={class:"bg-muted text-foreground border border-border font-mono leading-snug rounded"},xv=t=>W9.extend({content:t}),ZJ=xv("paragraph poll"),eX=xv("paragraph media? mediaGroup?"),tX=xv("paragraph linkPreview?"),nX=({includeLink:t=!1,includeDocument:e=!0})=>({...e?{}:{document:!1},...t?{}:{link:!1},code:{HTMLAttributes:XJ},codeBlock:{HTMLAttributes:QJ}}),Af=t=>sK.configure({placeholder:t,showOnlyWhenEditable:!0}),Mf=(t,e,n)=>UJ(t,e,n),rX=({editorType:t,api:e,store:n,user:r})=>{const s={[gt.Text]:oX,[gt.Media]:iX,[gt.Link]:aX,[gt.Poll]:sX}[t];return s?s({api:e,store:n,user:r}):[]},oX=({api:t,store:e,user:n})=>{const{core:r,mfs:o,fileStore:s}=t;return[cK.configure(nX({includeLink:!1})),Af(`What's on your mind, ${n?.name?n?.name:""}`),hK,mK,dK.configure({types:["heading","paragraph","media"],alignments:[tt.LEFT,tt.CENTER,tt.RIGHT],defaultAlignment:tt.LEFT}),mO,vO,P7,OO.configure({openOnClick:!1,linkOnPaste:!1,api:r}),cR,Mf(r,o,e),BO.configure({api:s}),jO.configure({api:r})]},sX=({api:t,store:e})=>{const{core:n,mfs:r}=t;return[ZJ,ov,sv,nv,Gy,Af("Ask a Question"),bv,vO,Mf(n,r,e)]},iX=({api:t,store:e,user:n})=>{const{core:r,mfs:o,fileStore:s}=t;return[eX,ov,sv,nv,Gy,Af(`What's on your mind, ${n?.name?n?.name:""}`),bv,mO.configure({attrs:{mediaMode:!0}}),JJ.configure({mediaMode:!0}),Mf(r,o,e),BO.configure({api:s})]},aX=({api:t,store:e,user:n})=>{const{core:r,mfs:o}=t;return[tX,ov,sv,Gy,Af(`What's on your mind, ${n?.name?n?.name:""}`),bv,OO.configure({openOnClick:!1,linkOnPaste:!1,api:r,linkMode:!0}),cR.configure({variant:Id.Extended,selectable:!1,draggable:!1}),jO.configure({api:r,autoEmbed:!1,autoLinkSelection:!1}),Mf(r,o,e)]},lX=()=>({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")}}),cX=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()}}),uX=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()},dX=({editorType:t,groupId:e,postId:n,user:r})=>{const[,o]=M.useState(0),s=Il(),i=M.useMemo(()=>N9({groupId:e,postId:n}),[e,n]),{getTabContent:a}=ry();M.useEffect(()=>{o(u=>u+1)},[]);const l=$F({extensions:rX({editorType:t,api:s,store:i,user:r}),content:"",editorProps:lX(),onCreate:({editor:u})=>{i.getState().setEditor(u),t===gt.Poll&&uX(u)},immediatelyRender:!1},[t]);M.useEffect(()=>{const u=a(t);u&&l?.isEditable&&l.commands.setContent(u)},[l,t,a]);const c=cX(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},fX=(t,e)=>{const n=[];for(const[r,o]of t)n.push(e(o,r));return n},hX=(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],pX=(t,e)=>{for(let n=0;n<e.length;n++)t.push(e[n])},zs=Array.from,mX=(t,e)=>{for(let n=0;n<t.length;n++)if(e(t[n],n,t))return!0;return!1},Bm=Array.isArray;class uR{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,dR=t=>t!==0?t<0:1/t<0,bE=1,xE=2,ap=4,lp=8,vl=32,co=64,an=128,gX=1<<29,Of=31,Fm=63,Ns=127,yX=2147483647,fR=Number.MAX_SAFE_INTEGER,vX=Number.isInteger||(t=>typeof t=="number"&&isFinite(t)&&bo(t)===t),bX=String.fromCharCode,xX=t=>t.toLowerCase(),wX=/^\s*/g,EX=t=>t.replace(wX,""),SX=/([A-Z])/g,wE=(t,e)=>EX(t.replace(SX,n=>`${e}${xX(n)}`)),kX=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},bl=typeof TextEncoder<"u"?new TextEncoder:null,TX=t=>bl.encode(t),CX=bl?TX:kX;let Wa=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Wa&&Wa.decode(new Uint8Array).length===1&&(Wa=null);class ec{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const tc=()=>new ec,AX=t=>{const e=tc();return t(e),dr(e)},MX=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(MX(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},OX=(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)},wv=(t,e)=>{const n=dR(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),RX=Um.length/3,NX=(t,e)=>{if(e.length<RX){const n=bl.encodeInto(e,Um).written||0;$e(t,n);for(let r=0;r<n;r++)Pt(t,Um[r])}else Rn(t,CX(e))},_X=(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=bl&&bl.encodeInto?NX:_X,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)},Ev=(t,e)=>{OX(t,e);const n=new DataView(t.cbuf.buffer,t.cpos,e);return t.cpos+=e,n},DX=(t,e)=>Ev(t,4).setFloat32(0,e,!1),IX=(t,e)=>Ev(t,8).setFloat64(0,e,!1),PX=(t,e)=>Ev(t,8).setBigInt64(0,e,!1),EE=new DataView(new ArrayBuffer(4)),LX=t=>(EE.setFloat32(0,t),EE.getFloat32(0)===t),zi=(t,e)=>{switch(typeof e){case"string":Pt(t,119),Si(t,e);break;case"number":vX(e)&&tu(e)<=yX?(Pt(t,125),wv(t,e)):LX(e)?(Pt(t,124),DX(t,e)):(Pt(t,123),IX(t,e));break;case"bigint":Pt(t,122),PX(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 SE 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 kE=t=>{t.count>0&&(wv(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++:(kE(this),this.count=1,this.s=e)}toUint8Array(){return kE(this),dr(this.encoder)}}const TE=t=>{if(t.count>0){const e=t.diff*2+(t.count===1?0:1);wv(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++):(TE(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return TE(this),dr(this.encoder)}}class jX{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")},hR=rs("Unexpected end of array"),pR=rs("Integer out of Range");class Nf{constructor(e){this.arr=e,this.pos=0}}const Sv=t=>new Nf(t),$X=t=>t.pos!==t.arr.length,BX=(t,e)=>{const n=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,n},Wn=t=>BX(t,st(t)),xl=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>fR)throw pR}throw hR},kv=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>fR)throw pR}throw hR},FX=t=>{let e=st(t);if(e===0)return"";{let n=String.fromCodePoint(xl(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(xl(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))}},HX=t=>Wa.decode(Wn(t)),zm=Wa?HX:FX,Tv=(t,e)=>{const n=new DataView(t.arr.buffer,t.arr.byteOffset+t.pos,e);return t.pos+=e,n},UX=t=>Tv(t,4).getFloat32(0,!1),zX=t=>Tv(t,8).getFloat64(0,!1),VX=t=>Tv(t,8).getBigInt64(0,!1),WX=[t=>{},t=>null,kv,UX,zX,VX,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},Wn],gd=t=>WX[127-xl(t)](t);class CE 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),$X(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=kv(this);const e=dR(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=kv(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 GX{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 qX=crypto.getRandomValues.bind(crypto),KX=Math.random,mR=()=>qX(new Uint32Array(1))[0],YX=t=>t[bo(KX()*t.length)],JX="10000000-1000-4000-8000"+-1e11,XX=()=>JX.replace(/[018]/g,t=>(t^mR()&15>>t/4).toString(16)),QX=Date.now,AE=t=>new Promise(t);Promise.all.bind(Promise);const ME=t=>t===void 0?null:t;class ZX{constructor(){this.map=new Map}setItem(e,n){this.map.set(e,n)}getItem(e){return this.map.get(e)}}let gR=new ZX,eQ=!0;try{typeof localStorage<"u"&&localStorage&&(gR=localStorage,eQ=!1)}catch{}const tQ=gR,nQ=Object.assign,yR=Object.keys,rQ=(t,e)=>{for(const n in t)e(t[n],n)},OE=t=>yR(t).length,oQ=t=>{for(const e in t)return!1;return!0},vR=(t,e)=>{for(const n in t)if(!e(t[n],n))return!1;return!0},sQ=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),iQ=(t,e)=>t===e||OE(t)===OE(e)&&vR(t,(n,r)=>(n!==void 0||sQ(e,r))&&e[r]===n),aQ=Object.freeze,bR=t=>{for(const e in t){const n=t[e];(typeof n=="object"||typeof n=="function")&&bR(t[e])}return aQ(t)},Cv=(t,e,n=0)=>{try{for(;n<t.length;n++)t[n](...e)}finally{n<t.length&&Cv(t,e,n+1)}},lQ=(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]",xR=typeof window<"u"&&typeof document<"u"&&!Vi;let Rr;const cQ=()=>{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(`--${wE(e,"-")}`,n),Rr.set(`-${wE(e,"-")}`,n)}})):Rr=fr();return Rr},Vm=t=>cQ().has(t),yd=t=>ME(Vi?process.env[t.toUpperCase().replaceAll("-","_")]:tQ.getItem(t)),wR=t=>Vm("--"+t)||yd(t)!==null;wR("production");const uQ=Vi&&lQ(process.env.FORCE_COLOR,["true","1","2"]),dQ=uQ||!Vm("--no-colors")&&!wR("no-color")&&(!Vi||process.stdout.isTTY)&&(!Vi||Vm("--color")||yd("COLORTERM")!==null||(yd("TERM")||"").includes("color")),fQ=t=>{let e="";for(let n=0;n<t.byteLength;n++)e+=bX(t[n]);return btoa(e)},hQ=t=>Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("base64"),pQ=xR?fQ:hQ,mQ=t=>AX(e=>zi(e,t));class gQ{constructor(e,n){this.left=e,this.right=n}}const Zr=(t,e)=>new gQ(t,e),yQ=typeof document<"u"?document:{};typeof DOMParser<"u"&&new DOMParser;const vQ=t=>fX(t,(e,n)=>`${n}:${e};`).join(""),bQ=t=>class{constructor(n){this._=n}destroy(){t(this._)}},xQ=bQ(clearTimeout),ER=(t,e)=>new xQ(setTimeout(e,t)),To=Symbol,SR=To(),kR=To(),wQ=To(),EQ=To(),SQ=To(),TR=To(),kQ=To(),Av=To(),TQ=To(),CQ=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},AQ={[SR]:Zr("font-weight","bold"),[kR]:Zr("font-weight","normal"),[wQ]:Zr("color","blue"),[SQ]:Zr("color","green"),[EQ]:Zr("color","grey"),[TR]:Zr("color","red"),[kQ]:Zr("color","purple"),[Av]:Zr("color","orange"),[TQ]:Zr("color","black")},MQ=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=AQ[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=vQ(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},CR=dQ?MQ:CQ,OQ=(...t)=>{console.log(...CR(t)),MR.forEach(e=>e.print(t))},AR=(...t)=>{console.warn(...CR(t)),t.unshift(Av),MR.forEach(e=>e.print(t))},MR=Us(),OR=t=>({[Symbol.iterator](){return this},next:t}),RQ=(t,e)=>OR(()=>{let n;do n=t.next();while(!n.done&&!e(n.value));return n}),dp=(t,e)=>OR(()=>{const{done:n,value:r}=t.next();return{done:n,value:n?void 0:e(r)}});class Mv{constructor(e,n){this.clock=e,this.len=n}}class oa{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])jR(t,s,c.clock,c.len,n)}}),NQ=(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},sa=(t,e)=>{const n=t.clients.get(e.client);return n!==void 0&&NQ(n,e.clock)!==null},Ov=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 oa;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++)pX(s,t[i].clients.get(o)||[]);e.clients.set(o,s)}});return Ov(e),e},wl=(t,e,n,r)=>{ko(t.clients,e,()=>[]).push(new Mv(n,r))},RR=()=>new oa,_Q=t=>{const e=RR();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 Mv(a,l))}}o.length>0&&e.clients.set(r,o)}),e},Rv=(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)}})},DQ=t=>{const e=new oa,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 Mv(t.readDsClock(),t.readDsLen()))}}return e},RE=(t,e,n)=>{const r=new oa,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&&wl(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 wl(r,i,d,f-d)}}if(r.clients.size>0){const s=new _f;return $e(s.restEncoder,0),Rv(s,r),s.toUint8Array()}return null},NR=mR;class ei extends uR{constructor({guid:e=XX(),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=NR(),this.guid=e,this.collectionid=n,this.share=new Map,this.store=new PR,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=AE(c=>{this.on("load",()=>{this.isLoaded=!0,c(this)})});const l=()=>AE(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 IQ{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 IQ{constructor(e){super(e),this.keys=[],st(e),this.keyClockDecoder=new up(Wn(e)),this.clientDecoder=new ru(Wn(e)),this.leftClockDecoder=new up(Wn(e)),this.rightClockDecoder=new up(Wn(e)),this.infoDecoder=new CE(Wn(e),xl),this.stringDecoder=new GX(Wn(e)),this.parentInfoDecoder=new CE(Wn(e),xl),this.typeRefDecoder=new ru(Wn(e)),this.lenDecoder=new ru(Wn(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 Wn(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 PQ{constructor(){this.restEncoder=tc()}toUint8Array(){return dr(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){$e(this.restEncoder,e)}writeDsLen(e){$e(this.restEncoder,e)}}class LQ extends PQ{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 jQ{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 jQ{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 SE(Hm),this.stringEncoder=new jX,this.parentInfoEncoder=new SE(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 $Q=(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)},_R=(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])=>{$Q(t,e.clients.get(o),o,s)})},BQ=(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 Kn(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&vl)===vl?t.readString():null,sN(t,u));i[c]=f,l+=f.length}}}}return n},FQ=(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 PR,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 _R(h,a,new Map),$e(h.restEncoder,0),{missing:l,update:h.toUint8Array()}}return null},HQ=(t,e)=>_R(t,e.doc.store,e.beforeState),UQ=(t,e,n,r=new vd(t))=>Je(e,o=>{o.local=!1;let s=!1;const i=o.doc,a=i.store,l=BQ(r,i),c=FQ(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=BE([u.update,c.update])}}else a.pendingStructs=c;const d=RE(r,o,a);if(a.pendingDs){const f=new vd(Sv(a.pendingDs));st(f.restDecoder);const h=RE(f,o,a);d&&h?a.pendingDs=BE([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=Sv(e);UQ(o,t,n,new r(o))};class zQ{constructor(){this.l=[]}}const NE=()=>new zQ,_E=(t,e)=>t.l.push(e),DE=(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.")},DR=(t,e,n)=>Cv(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),El=t=>{for(const[e,n]of t.doc.share.entries())if(n===t)return e;throw Mn()},Sl=(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 VQ{constructor(e,n,r=0){this.type=e,this.index=n,this.assoc=r}}const WQ=(t,e,n=0)=>new VQ(t,e,n),Lc=(t,e,n)=>{let r=null,o=null;return t._item===null?o=El(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)},GQ=(t,e)=>{const n=Ti(t,e),r=e.clock-n.id.clock;return{item:n,diff:r}},qQ=(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):GQ(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 WQ(l,c,t.assoc)};class Nv{constructor(e,n){this.ds=e,this.sv=n}}const IR=(t,e)=>new Nv(t,e),hp=t=>IR(_Q(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&&!sa(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 PR{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},LR=(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()},KQ=(t,e)=>{const n=t.clients.get(e.client);return n[vr(n,e.clock)]},Ti=KQ,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)]},IE=(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!==Kn&&r.splice(o+1,0,kd(t,s,n.clock-s.id.clock+1)),s},YQ=(t,e,n)=>{const r=t.clients.get(e.id.client);r[vr(r,e.id.clock)]=n},jR=(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 JQ{constructor(e,n,r){this.doc=e,this.deleteSet=new oa,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 PE=(t,e)=>e.deleteSet.clients.size===0&&!hX(e.afterState,(n,r)=>e.beforeState.get(r)!==n)?!1:(Ov(e.deleteSet),HQ(t,e),Rv(t,e.deleteSet),!0),LE=(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},XQ=(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)}}}},QQ=(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)}})},$R=(t,e)=>{if(e<t.length){const n=t[e],r=n.doc,o=r.store,s=n.deleteSet,i=n._mergeStructs;try{Ov(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),DR(c._dEH,l,n))})}),a.push(()=>r.emit("afterTransaction",[n,r])),Cv(a,[]),n._needFormattingCleanup&&vZ(n)}finally{r.gc&&XQ(s,o,r.gcFilter),QQ(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)&&(OQ(Av,SR,"[yjs] ",kR,TR,"Changed the client-id because another client seems to be using it."),r.clientID=NR()),r.emit("afterTransactionCleanup",[n,r]),r._observers.has("update")){const u=new LQ;PE(u,n)&&r.emit("update",[u.toUint8Array(),n.origin,r,n])}if(r._observers.has("updateV2")){const u=new _f;PE(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])):$R(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 JQ(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&&$R(o,0)}}return i};class ZQ{constructor(e,n){this.insertions=n,this.deletions=e,this.meta=new Map}}const jE=(t,e,n)=>{ss(t,n.deletions,r=>{r instanceof nt&&e.scope.some(o=>o===t.doc||Sl(o,r))&&Lv(r,!1)})},$E=(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||Sl(p,h))&&d.push(h)}}),ss(a,c.deletions,h=>{h instanceof nt&&s.some(p=>p===a.doc||Sl(p,h))&&!sa(c.insertions,h.id)&&u.add(h)}),u.forEach(h=>{f=oN(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 BR extends uR{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 oa;l.afterState.forEach((y,v)=>{const w=l.beforeState.get(v)||0,E=y-w;E>0&&wl(f,v,w,E)});const h=QX();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 ZQ(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||Sl(v,y))&&Lv(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)&&AR("[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=>jE(r,this,o)),this.undoStack=[]),n&&(this.redoStack.forEach(o=>jE(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=$E(this,this.undoStack,"undo")}finally{this.undoing=!1}return e}redo(){this.redoing=!0;let e;try{e=$E(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*eZ(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&vl)===vl?t.readString():null,sN(t,a));yield c,s+=c.length}else{const l=t.readLen();yield new Kn(De(o,s),l),s+=l}}}}class tZ{constructor(e,n){this.gen=eZ(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 nZ{constructor(e){this.currClient=0,this.startClock=0,this.written=0,this.encoder=e,this.clientStructs=[]}}const rZ=(t,e)=>{if(t.constructor===Kn){const{client:n,clock:r}=t.id;return new Kn(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))}},BE=(t,e=vd,n=_f)=>{if(t.length===1)return t[0];const r=t.map(u=>new e(Sv(u)));let o=r.map(u=>new tZ(u,!0)),s=null;const i=new n,a=new nZ(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)wa(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{wa(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=rZ(f,p)),s.struct.mergeWith(f)||(wa(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())wa(a,s.struct,s.offset),s={struct:f,offset:0}}s!==null&&(wa(a,s.struct,s.offset),s=null),oZ(a);const l=r.map(u=>DQ(u)),c=Wm(l);return Rv(i,c),i.toUint8Array()},FR=t=>{t.written>0&&(t.clientStructs.push({written:t.written,restEncoder:dr(t.encoder.restEncoder)}),t.encoder.restEncoder=tc(),t.written=0)},wa=(t,e,n)=>{t.written>0&&t.currClient!==e.id.client&&FR(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++},oZ=t=>{FR(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)}},FE="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=sZ(this.currentTarget,this.target))}deletes(e){return sa(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw rs(FE);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(FE);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 sZ=(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=()=>{AR("Invalid access: Add Yjs type to a document before reading data.")},HR=80;let _v=0;class iZ{constructor(e,n){e.marker=!0,this.p=e,this.index=n,this.timestamp=_v++}}const aZ=t=>{t.timestamp=_v++},UR=(t,e,n)=>{t.p.marker=!1,t.p=e,e.marker=!0,t.index=n,t.timestamp=_v++},lZ=(t,e,n)=>{if(t.length>=HR){const r=t.reduce((o,s)=>o.timestamp<s.timestamp?o:s);return UR(r,e,n),r}else{const r=new iZ(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,aZ(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/HR?(UR(n,r,o),n):lZ(t._searchMarker,r,o)},kl=(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;DR(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=NE(),this._dEH=NE(),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){_E(this._eH,e)}observeDeep(e){_E(this._dEH,e)}unobserve(e){DE(this._eH,e)}unobserveDeep(e){DE(this._dEH,e)}toJSON(){}}const zR=(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},VR=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},WR=(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},Tl=(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}},GR=(t,e)=>{const n=[];return Tl(t,(r,o)=>{n.push(e(r,o,t))}),n},cZ=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}}}},qR=(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()},KR=()=>rs("Length exceeded!"),YR=(t,e,n,r)=>{if(n>e._length)throw KR();if(n===0)return e._searchMarker&&kl(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&&kl(e._searchMarker,o,r.length),xd(t,e,i,r)},uZ=(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)},JR=(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 KR();e._searchMarker&&kl(e._searchMarker,o,-s+r)},wd=(t,e,n)=>{const r=e._map.get(n);r!==void 0&&r.delete(t)},Dv=(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)},Iv=(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},XR=t=>{const e={};return t.doc??Zt(),t._map.forEach((n,r)=>{n.deleted||(e[r]=n.content.getContent()[n.length-1])}),e},QR=(t,e)=>{t.doc??Zt();const n=t._map.get(e);return n!==void 0&&!n.deleted},dZ=(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(),RQ(t._map.entries(),e=>!e[1].deleted));class fZ 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 fZ(this,e))}insert(e,n){this.doc!==null?Je(this.doc,r=>{YR(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}push(e){this.doc!==null?Je(this.doc,n=>{uZ(n,this,e)}):this._prelimContent.push(...e)}unshift(e){this.insert(0,e)}delete(e,n=1){this.doc!==null?Je(this.doc,r=>{JR(r,this,e,n)}):this._prelimContent.splice(e,n)}get(e){return qR(this,e)}toArray(){return VR(this)}slice(e=0,n=this.length){return zR(this,e,n)}toJSON(){return this.map(e=>e instanceof Bt?e.toJSON():e)}map(e){return GR(this,e)}forEach(e){Tl(this,e)}[Symbol.iterator](){return cZ(this)}_write(e){e.writeTypeRef(jZ)}}const hZ=t=>new Ci;class pZ 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 pZ(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=>{Dv(r,this,e,n)}):this._prelimContent.set(e,n),n}get(e){return Iv(this,e)}has(e){return QR(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($Z)}}const mZ=t=>new Wi,zo=(t,e)=>t===e||typeof t=="object"&&typeof e=="object"&&t&&e&&iQ(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||ia(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 HE=(t,e,n)=>{for(;e.right!==null&&n>0;){switch(e.right.content.constructor){case kt:e.right.deleted||ia(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 HE(t,i,n-s.index)}else{const i=new Ym(null,e._start,0,o);return HE(t,i,n)}},ZR=(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()})},ia=(t,e)=>{const{key:n,value:r}=e;r===null?t.delete(n):t.set(n,r)},eN=(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()}},tN=(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;eN(n,o);const a=tN(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&&kl(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(),ZR(t,e,n,a)},UE=(t,e,n,r,o)=>{const s=t.doc,i=s.clientID;eN(n,o);const a=tN(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()}ZR(t,e,n,a)},nN=(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&&ia(o,c);break}}}e=e.right}return a},gZ=(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}},yZ=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:ia(i,o.content);break;default:e+=nN(n,r,o,s,i),s=$m(i),r=o;break}o=o.right}}),e},vZ=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&&jR(t,n.store.clients.get(r),s,o,i=>{!i.deleted&&i.content.constructor===kt&&i.constructor!==Kn&&e.add(i.parent)})}Je(n,r=>{ss(t,t.deleteSet,o=>{if(o instanceof Kn||!o.parent._hasFormatting||e.has(o.parent))return;const s=o.parent;o.content.constructor===kt?e.add(s):gZ(r,o)});for(const o of e)yZ(o)})},zE=(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&&nN(t,s,e.right,o,e.currentAttributes);const i=(e.left||e.right).parent;return i._searchMarker&&kl(i._searchMarker,e.index,-r+n),e};class bZ 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},oQ(l)||(h.attributes=nQ({},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(),ia(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 bZ(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?UE(r,this,o,i.retain,i.attributes||{}):i.delete!==void 0&&zE(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(),ia(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=>{zE(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&&UE(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=>{Dv(r,this,e,n)}):this._pending.push(()=>this.setAttribute(e,n))}getAttribute(e){return Iv(this,e)}getAttributes(){return XR(this)}_write(e){e.writeTypeRef(BZ)}}const xZ=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 SZ(this,n,e))}toString(){return GR(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),Tl(this,s=>{o.insertBefore(s.toDOM(e,n,r),null)}),o}insert(e,n){this.doc!==null?Je(this.doc,r=>{YR(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=>{JR(r,this,e,n)}):this._prelimContent.splice(e,n)}toArray(){return VR(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return qR(this,e)}slice(e=0,n=this.length){return zR(this,e,n)}forEach(e){Tl(this,e)}_write(e){e.writeTypeRef(HZ)}}const wZ=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 rQ(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=>{Dv(r,this,e,n)}):this._prelimAttrs.set(e,n)}getAttribute(e){return Iv(this,e)}hasAttribute(e){return QR(this,e)}getAttributes(e){return e?dZ(this,e):XR(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 Tl(this,i=>{o.appendChild(i.toDOM(e,n,r))}),r!==void 0&&r._createAssociation(o,this),o}_write(e){e.writeTypeRef(FZ),e.writeKey(this.nodeName)}}const EZ=t=>new Qt(t.readKey());class SZ 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(UZ),e.writeKey(this.hookName)}}const kZ=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(zZ)}}const TZ=t=>new An;class Pv{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 CZ=0;class Kn extends Pv{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),LR(e.doc.store,this)}write(e,n){e.writeInfo(CZ),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 AZ=t=>new nc(t.readBuf());class Cl{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new Cl(this.len)}splice(e){const n=new Cl(this.len-e);return this.len=e,n}mergeWith(e){return this.len+=e.len,!0}integrate(e,n){wl(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 MZ=t=>new Cl(t.readLen()),rN=(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(rN(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 OZ=t=>new rc(rN(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 RZ=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 NZ=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 _Z=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)},DZ=yd("node_env")==="development";class Ws{constructor(e){this.arr=e,DZ&&bR(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 IZ=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 PZ=t=>new br(t.readString()),LZ=[hZ,mZ,xZ,EZ,wZ,kZ,TZ],jZ=0,$Z=1,BZ=2,FZ=3,HZ=4,UZ=5,zZ=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 VZ=t=>new Sr(LZ[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}},Lv=(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},VE=(t,e)=>mX(t,n=>sa(n.deletions,e)),oN=(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)||oN(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||sa(r,d.right.id)||VE(s.undoStack,d.right.id)||VE(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,Lv(y,!0),y.integrate(t,0),y};let nt=class Xm extends Pv{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()?xE:0}set marker(e){(this.info&lp)>0!==e&&(this.info^=lp)}get marker(){return(this.info&lp)>0}get keep(){return(this.info&bE)>0}set keep(e){this.keep!==e&&(this.info^=bE)}get countable(){return(this.info&xE)>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=IE(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===Kn||this.right&&this.right.constructor===Kn)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===Kn?this.parent=null:this.parent=r.content.type}return null}integrate(e,n){if(n>0&&(this.id.clock+=n,this.left=IE(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),LR(e.doc.store,this),this.content.integrate(e,this),LE(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new Kn(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(),wl(e.deleteSet,this.id.client,this.id.clock,this.length),LE(e,n,this.parentSub),this.content.delete(e)}}gc(e,n){if(!this.deleted)throw Mn();this.content.gc(e),n?YQ(e,this,new Kn(this.id,this.length)):this.content=new Cl(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:vl);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=El(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 sN=(t,e)=>WZ[e&Of](t),WZ=[()=>{Mn()},MZ,_Z,AZ,PZ,RZ,NZ,VZ,IZ,OZ,()=>{Mn()}],GZ=10;class cr extends Pv{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(GZ),$e(e.restEncoder,this.length-n)}getMissing(e,n){return null}}const iN=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},aN="__ $YJS$ __";iN[aN]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");iN[aN]=!0;const qZ=()=>{let t=!0;return(e,n)=>{if(t){t=!1;try{e()}finally{t=!0}}else n!==void 0&&n()}},KZ=/[\uD800-\uDBFF]/,YZ=/[\uDC00-\uDFFF]/,JZ=(t,e)=>{let n=0,r=0;for(;n<t.length&&n<e.length&&t[n]===e[n];)n++;for(n>0&&KZ.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&&YZ.test(t[t.length-r])&&r--,{index:n,remove:t.length-n-r,insert:e.slice(n,e.length-r)}},XZ=JZ,Fr=(t,e)=>t>>>e|t<<32-e,QZ=t=>Fr(t,2)^Fr(t,13)^Fr(t,22),ZZ=t=>Fr(t,6)^Fr(t,11)^Fr(t,25),eee=t=>Fr(t,7)^Fr(t,18)^t>>>3,tee=t=>Fr(t,17)^Fr(t,19)^t>>>10,nee=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]),ree=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);class oee{constructor(){const e=new ArrayBuffer(320);this._H=new Uint32Array(e,0,8),this._H.set(ree),this._W=new Uint32Array(e,64,64)}_updateHash(){const e=this._H,n=this._W;for(let d=16;d<64;d++)n[d]=tee(n[d-2])+n[d-7]+eee(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+ZZ(a)+(a&l^~a&c)+nee[d]+n[d]>>>0,h=QZ(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/gX,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 see=t=>new oee().digest(t),pt=new We("y-sync"),uo=new We("y-undo");new We("yjs-cursor");const iee=t=>{for(let n=6;n<t.length;n++)t[n%6]=t[n%6]^t[n];return t.slice(0,6)},aee=t=>pQ(iee(see(mQ(t)))),Td=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&e.sv.get(t.id.client)>t.id.clock&&!sa(e.ds,t.id),lee=[{light:"#ecd44433",dark:"#ecd444"}],cee=(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,YX(e))}return t.get(n)},uee=(t,{colors:e=lee,colorMapping:n=new Map,permanentUserData:r=null,onFirstRender:o=()=>{},mapping:s}={})=>{let i=!1;const a=new fee(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)&&ER(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},dee=(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 fee{constructor(e,n=new Map){this.type=e,this.prosemirrorView=null,this.mux=qZ(),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()?(xR&&this._domSelectionInView===null&&(ER(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=yQ.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=IR(RR(),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:cee(r.colorMapping,r.colors,h)}},c=WR(s,new Nv(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=>lN(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));dee(i,this.beforeTransactionSelection,this),i=i.setMeta(pt,{isChangeOrigin:!0,isUndoRedoOperation:n.origin instanceof BR}),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 lN=(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=lN(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=hee(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):WR(t,new Nv(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}},hee=(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,bee(c.attributes,e)))}}catch{return t.doc.transact(c=>{t._item.delete(c)},pt),null}return i},pee=(t,e)=>{const n=new An,r=t.map(o=>({insert:o.text,attributes:uN(o.marks,e)}));return n.applyDelta(r),e.mapping.set(n,t),n},mee=(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?pee(t,e):mee(t,e),WE=t=>typeof t=="object"&&t!==null,jv=(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||WE(i)&&WE(a)&&jv(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},cN=(t,e)=>{const n=t.toDelta();return n.length===e.length&&n.every((r,o)=>r.insert===e[o].text&&yR(r.attributes||{}).length===e[o].marks.length&&vR(r.attributes,(s,i)=>{const a=$v(i),l=e[o].marks;return jv(s,l.find(c=>c.type.name===a)?.attrs)}))},Al=(t,e)=>{if(t instanceof Qt&&!(e instanceof Array)&&tg(t,e)){const n=jf(e);return t._length===n.length&&jv(t.getAttributes(),e.attrs)&&t.toArray().every((r,o)=>Al(r,n[o]))}return t instanceof An&&e instanceof Array&&cN(t,e)},Cd=(t,e)=>t===e||t instanceof Array&&e instanceof Array&&t.length===e.length&&t.every((n,r)=>e[r]===n),GE=(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(!Al(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(!Al(d,f))break}return{equalityFactor:l+c,foundMappedChild:u}},gee=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}},yee=(t,e,n)=>{n.mapping.set(t,e);const{nAttrs:r,str:o}=gee(t),s=e.map(c=>({insert:c.text,attributes:Object.assign({},r,uN(c.marks,n))})),{insert:i,remove:a,index:l}=XZ(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})))},vee=/(.*)(--[a-zA-Z0-9+/=]{8})$/,$v=t=>vee.exec(t)?.[1]??t,bee=(t,e)=>{const n=[];for(const r in t)n.push(e.mark($v(r),t[r]));return n},uN=(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}--${aee(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(Al(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(Al(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)cN(f,h)||yee(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=GE(f,h,r),E=GE(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?El(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?El(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 xee(r._item.parent,r._item)}return fp(e,e._length,-1)},xee=(t,e)=>{let n=null,r=null;return t._item===null?r=El(t):n=De(t._item.id.client,t._item.id.clock),new bd(n,r,e.id)},iu=(t,e,n,r)=>{const o=qQ(n,t);if(o===null||o.type!==e&&!Sl(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 wee(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:$v(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 Eee=t=>{const e=uo.getState(t).undoManager;if(e!=null)return e.undo(),!0},See=t=>{const e=uo.getState(t).undoManager;if(e!=null)return e.redo(),!0},kee=new Set(["paragraph"]),Tee=(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,Cee=({protectedNodes:t=kee,trackedOrigins:e=[],undoManager:n=null}={})=>new Ue({key:uo,state:{init:(r,o)=>{const s=pt.getState(o),i=n||new BR(s.type,{trackedOrigins:new Set([pt].concat(e)),deleteFilter:a=>Tee(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?Eee(e):!0),redo:()=>({tr:t,state:e,dispatch:n})=>(t.setMeta("preventDispatch",!0),uo.getState(e).undoManager.redoStack.length===0?!1:n?See(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=Cee(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=uee(e,o);return this.editor.options.enableContentCheck&&((t=e.doc)==null||t.on("beforeTransaction",()=>{try{const i=wee(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 Aee(t){return!!t.getMeta(pt)}function qE(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 qa(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 n1(o.resolve(c),o.resolve(u));r.push(d)}),r}var Mee=class dN{constructor(e,n){this.anchor=e,this.head=n}map(e){return new dN(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 Mee(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,qE(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,qE(a)):null}}})]}});function Oee(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 Ree(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=Oee(o)}),e}var fN=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 Nee(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function _ee(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:Nee(e,a.left+r+s,a.right-o-i),top:n}}function hN(t){var e;(e=t.parentNode)==null||e.removeChild(t)}function Dee(t,e){const{doc:n}=e.view.state,r=fN({editor:e,x:t.clientX,y:t.clientY,direction:"right"});if(!r.resultNode||r.pos===null)return[];const o=t.clientX,s=_ee(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 Iee(t,e){const{view:n}=e;if(!t.dataTransfer)return;const{empty:r,$from:o,$to:s}=n.state.selection,i=Dee(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=Ree(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",()=>hN(d),{once:!0})}var KE=(t,e)=>{const n=t.resolve(e),{depth:r}=n;return r===0?e:n.pos-n.parentOffset-1},YE=(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},Pee=(t,e)=>{const n=pt.getState(t);return n?iu(n.doc,n.type,e,n.binding.mapping)||0:-1},JE=(t,e)=>{let n=e;for(;n?.parentNode&&n.parentNode!==t.dom;)n=n.parentNode;return n},pN=new We("dragHandle"),mN=({pluginKey:t=pN,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 k=o?.()||{getBoundingClientRect:()=>x.getBoundingClientRect()};GT(k,e,r).then(S=>{Object.assign(e.style,{position:S.strategy,left:`${S.x}px`,top:`${S.y}px`})})}function w(x){i?.(x),Iee(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,k,S,T){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}),k;if(x.docChanged&&d!==-1&&e)if(Aee(x)){const R=Pee(T,f);R!==d&&(d=R)}else{const R=x.mapping.map(d);R!==d&&(d=R,f=gp(T,d))}return k}},view:x=>{var k;return e.draggable=!0,e.style.pointerEvents="auto",(k=n.view.dom.parentElement)==null||k.appendChild(l),l.style.pointerEvents="none",l.style.position="absolute",l.style.top="0",l.style.left="0",{update(S,T){if(!e)return;if(!n.isEditable){m();return}if(c?e.draggable=!1:e.draggable=!0,x.state.doc.eq(T.doc)||d===-1)return;let C=x.nodeDOM(d);if(C=JE(x,C),C===x.dom||C?.nodeType!==1)return;const N=x.posAtDOM(C,0),R=YE(n.state.doc,N),L=KE(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&&hN(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,k){return c||k.target&&!l.contains(k.relatedTarget)&&(m(),u=null,d=-1,s?.({editor:n,node:null,pos:-1})),!1},mousemove(x,k){return!e||c||(p={x:k.clientX,y:k.clientY},h)||(h=requestAnimationFrame(()=>{if(h=null,!p)return;const{x:S,y:T}=p;p=null;const C=fN({x:S,y:T,direction:"right",editor:n});if(!C.resultElement)return;let N=C.resultElement;if(N=JE(x,N),N===x.dom||N?.nodeType!==1)return;const R=x.posAtDOM(N,0),L=YE(n.state.doc,R);if(L!==u){const $=KE(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[mN({computePositionConfig:{...rg,...this.options.computePositionConfig},getReferencedVirtualElement:this.options.getReferencedVirtualElement,element:t,editor:this.editor,onNodeChange:this.options.onNodeChange}).plugin]}});var Lee=t=>{const{className:e="drag-handle",children:n,editor:r,pluginKey:o=pN,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=mN({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})},jee=Lee;const XE=({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-full grow flex flex-col overflow-y-auto transition-all duration-300 ease-in-out",i),children:[g.jsx(qF,{editorTab:n,onSwitchEditorTab:r}),g.jsx(O9,{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(jee,{editor:t,className:re(" pr-2",n!==gt.Text&&"hidden size-0 overflow-hidden pointer-events-none"),children:g.jsx(Pn,{variant:"ghost",className:"bg-white cursor-grab py-0.5 px-0 border size-auto",children:g.jsx(wV,{className:"text-muted-foreground"})})}),g.jsx(DF,{className:"grow overflow-y-auto","data-theme":"select-post-builder",editor:t})]})})]});function QE(t,[e,n]){return Math.min(n,Math.max(e,t))}var $ee=[" ","Enter","ArrowUp","ArrowDown"],Bee=[" ","Enter"],Gs="Select",[Bf,Ff,Fee]=yg(Gs),[aa]=jn(Gs,[Fee,cs]),Hf=cs(),[Hee,fs]=aa(Gs),[Uee,zee]=aa(Gs),gN=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,k]=b.useState(!1),S=jd(c),[T,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(Hee,{required:h,scope:e,trigger:y,onTriggerChange:v,valueNode:w,onValueNodeChange:E,valueNodeHasChildren:x,onValueNodeHasChildrenChange:k,contentId:Yn(),value:N,onValueChange:R,open:T,onOpenChange:C,dir:S,triggerPointerDownPosRef:L,disabled:f,children:[g.jsx(Bf.Provider,{scope:e,children:g.jsx(Uee,{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($N,{"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]})})};gN.displayName=Gs;var yN="SelectTrigger",vN=b.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...o}=t,s=Hf(n),i=fs(yN,n),a=i.disabled||r,l=Fe(e,i.onTriggerChange),c=Ff(n),u=b.useRef("touch"),[d,f,h]=FN(m=>{const y=c().filter(E=>!E.disabled),v=y.find(E=>E.value===i.value),w=HN(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(Ul,{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":BN(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===" ")&&$ee.includes(m.key)&&(p(),m.preventDefault())})})})});vN.displayName=yN;var bN="SelectValue",xN=b.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:o,children:s,placeholder:i="",...a}=t,l=fs(bN,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:BN(l.value)?g.jsx(g.Fragment,{children:i}):s})});xN.displayName=bN;var Vee="SelectIcon",wN=b.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...o}=t;return g.jsx(ge.span,{"aria-hidden":!0,...o,ref:e,children:r||"▼"})});wN.displayName=Vee;var Wee="SelectPortal",EN=t=>g.jsx(ea,{asChild:!0,...t});EN.displayName=Wee;var qs="SelectContent",SN=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(kN,{scope:t.__scopeSelect,children:g.jsx(Bf.Slot,{scope:t.__scopeSelect,children:g.jsx("div",{children:t.children})})}),s):null}return g.jsx(TN,{...t,ref:e})});SN.displayName=qs;var ir=10,[kN,hs]=aa(qs),Gee="SelectContentImpl",qee=Yo("SelectContent.RemoveScroll"),TN=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),[k,S]=b.useState(null),T=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&&k&&(k.scrollTop=0),Se===he&&k&&(k.scrollTop=k.scrollHeight),Se?.focus(),document.activeElement!==we))return},[$,k]),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]=FN(z=>{const Z=$().filter(we=>!we.disabled),Me=Z.find(we=>we.ref.current===document.activeElement),he=HN(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:CN,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(kN,{scope:n,content:E,viewport:k,onViewportChange:S,itemRefCallback:ye,selectedItem:C,onItemLeave:G,itemTextRefCallback:Q,focusSelectedItem:H,selectedItemText:R,position:r,isPositioned:B,searchRef:ie,children:g.jsx(Wl,{as:qee,allowPinchZoom:!0,children:g.jsx(Vl,{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:T,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()}})})})})})})});TN.displayName=Gee;var Kee="SelectItemAlignedPosition",CN=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,T=>u(T)),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 T=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=T.left-Se,ut=T.width+ze,dt=Math.max(ut,C.width),Tt=window.innerWidth-ir,ft=QE(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-T.right-Se,ut=T.width+ze,dt=Math.max(ut,C.width),Tt=window.innerWidth-ir,ft=QE(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=T.top+T.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,k]=b.useState();Nt(()=>{c&&k(window.getComputedStyle(c).zIndex)},[c]);const S=b.useCallback(T=>{T&&p.current===!0&&(E(),w?.(),p.current=!1)},[E,w]);return g.jsx(Jee,{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}})})})});CN.displayName=Kee;var Yee="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=Yee;var[Jee,Bv]=aa(qs,{}),sg="SelectViewport",AN=b.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...o}=t,s=hs(sg,n),i=Bv(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})})})]})});AN.displayName=sg;var MN="SelectGroup",[Xee,Qee]=aa(MN),Zee=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,o=Yn();return g.jsx(Xee,{scope:n,id:o,children:g.jsx(ge.div,{role:"group","aria-labelledby":o,...r,ref:e})})});Zee.displayName=MN;var ON="SelectLabel",ete=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,o=Qee(ON,n);return g.jsx(ge.div,{id:o.id,...r,ref:e})});ete.displayName=ON;var Ad="SelectItem",[tte,RN]=aa(Ad),NN=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=Yn(),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(tte,{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===" "||(Bee.includes(w.key)&&v(),w.key===" "&&w.preventDefault())})})})})});NN.displayName=Ad;var Aa="SelectItemText",_N=b.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:o,...s}=t,i=fs(Aa,n),a=hs(Aa,n),l=RN(Aa,n),c=zee(Aa,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]})});_N.displayName=Aa;var DN="SelectItemIndicator",IN=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return RN(DN,n).isSelected?g.jsx(ge.span,{"aria-hidden":!0,...r,ref:e}):null});IN.displayName=DN;var ig="SelectScrollUpButton",PN=b.forwardRef((t,e)=>{const n=hs(ig,t.__scopeSelect),r=Bv(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(jN,{...t,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});PN.displayName=ig;var ag="SelectScrollDownButton",LN=b.forwardRef((t,e)=>{const n=hs(ag,t.__scopeSelect),r=Bv(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(jN,{...t,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});LN.displayName=ag;var jN=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()})})}),nte="SelectSeparator",rte=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return g.jsx(ge.div,{"aria-hidden":!0,...r,ref:e})});rte.displayName=nte;var lg="SelectArrow",ote=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});ote.displayName=lg;var ste="SelectBubbleInput",$N=b.forwardRef(({__scopeSelect:t,value:e,...n},r)=>{const o=b.useRef(null),s=Fe(r,o),i=kM(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:{...sC,...n.style},ref:s,defaultValue:e})});$N.displayName=ste;function BN(t){return t===""||t===void 0}function FN(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 HN(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=ite(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 ite(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var ate=gN,lte=vN,cte=xN,ute=wN,dte=EN,fte=SN,hte=AN,pte=NN,mte=_N,gte=IN,yte=PN,vte=LN;function bte({...t}){return g.jsx(ate,{"data-slot":"select",...t})}function xte({...t}){return g.jsx(cte,{"data-slot":"select-value",...t})}function wte({className:t,size:e="default",children:n,...r}){return g.jsxs(lte,{"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(ute,{asChild:!0,children:g.jsx(qC,{className:"size-4 opacity-50"})})]})}function Ete({className:t,children:e,position:n="popper",align:r="center",...o}){return g.jsx(dte,{children:g.jsx("div",{id:"select-wrapper","data-theme":"select-post-builder",children:g.jsxs(fte,{"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(kte,{}),g.jsx(hte,{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(Tte,{})]})})})}function Ste({className:t,children:e,...n}){return g.jsxs(pte,{"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(gte,{children:g.jsx(GC,{className:"size-4"})})}),g.jsx(mte,{children:e})]})}function kte({className:t,...e}){return g.jsx(yte,{"data-slot":"select-scroll-up-button",className:re("flex cursor-default items-center justify-center py-1",t),...e,children:g.jsx(dV,{className:"size-4"})})}function Tte({className:t,...e}){return g.jsx(vte,{"data-slot":"select-scroll-down-button",className:re("flex cursor-default items-center justify-center py-1",t),...e,children:g.jsx(qC,{className:"size-4"})})}function Cte(){return kg.useSyncExternalStore(Ate,()=>!0,()=>!1)}function Ate(){return()=>{}}var Fv="Avatar",[Mte]=jn(Fv),[Ote,UN]=Mte(Fv),zN=b.forwardRef((t,e)=>{const{__scopeAvatar:n,...r}=t,[o,s]=b.useState("idle");return g.jsx(Ote,{scope:n,imageLoadingStatus:o,onImageLoadingStatusChange:s,children:g.jsx(ge.span,{...r,ref:e})})});zN.displayName=Fv;var VN="AvatarImage",WN=b.forwardRef((t,e)=>{const{__scopeAvatar:n,src:r,onLoadingStatusChange:o=()=>{},...s}=t,i=UN(VN,n),a=Rte(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});WN.displayName=VN;var GN="AvatarFallback",qN=b.forwardRef((t,e)=>{const{__scopeAvatar:n,delayMs:r,...o}=t,s=UN(GN,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});qN.displayName=GN;function ZE(t,e){return t?e?(t.src!==e&&(t.src=e),t.complete&&t.naturalWidth>0?"loaded":"loading"):"error":"idle"}function Rte(t,{referrerPolicy:e,crossOrigin:n}){const r=Cte(),o=b.useRef(null),s=r?(o.current||(o.current=new window.Image),o.current):null,[i,a]=b.useState(()=>ZE(s,t));return Nt(()=>{a(ZE(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 Nte=zN,_te=WN,Dte=qN;function eS({className:t,...e}){return g.jsx(Nte,{"data-slot":"avatar",className:re("relative flex size-8 shrink-0 overflow-hidden rounded-full",t),...e})}function tS({className:t,...e}){return g.jsx(_te,{"data-slot":"avatar-image",className:re("aspect-square size-full",t),...e})}function nS({className:t,...e}){return g.jsx(Dte,{"data-slot":"avatar-fallback",className:re("bg-muted flex size-full items-center justify-center rounded-full",t),...e})}const rS=({user:t,store:e})=>{const{core:n}=Il(),[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(eS,{children:[g.jsx(tS,{src:t?.avatar??t?.avatarPlaceholder}),g.jsx(nS,{className:"bg-primary-send text-background",children:t?.name?.charAt(0)?.toUpperCase()})]}),g.jsxs(bte,{value:f,onValueChange:p,disabled:h||s,children:[g.jsx(wte,{size:"sm",id:`group-selector-${f}-${a}`,className:"bg-background","aria-label":"Select group",children:g.jsx(xte,{className:"text-sm",placeholder:s?"Loading groups...":"Select a group…"})}),g.jsx(Ete,{align:"start",children:r.map(m=>g.jsxs(Ste,{value:m.group_id,children:[g.jsxs(eS,{className:"size-6",children:[g.jsx(tS,{src:m.group.avatar}),g.jsx(nS,{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(gI,{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:OS.POST}),Hv=t=>({mentionData:Kl(t,"mention")?.map(r=>Y8(Z8(r.attrs,H8),["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=gw(r,"text")?.text?.trim()??"",i=new Array(gw(r,"media")?.attrs?.payload).filter(Boolean),a=n;return{...o,type:Dl.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}=Hv(n),{items:a}=Bte(n);return{...o,type:Dl.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}=Hv(n);return{...o,type:Dl.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}=Hv(n),{items:a}=Fte(n);return{...o,type:Dl.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,clearOnSuccess:o=!0,openModal:s,onModalOpenChange:i,isSubmitting:a,onCreatePost:l})=>{const[c,u]=M.useState(gt.Text),{editor:d,actions:f,store:h}=dX({editorType:c,groupId:t,postId:e,user:n}),{clearContent:p}=ry(),m=M.useMemo(()=>({editor:d}),[d]),y=v=>{if(!d)return;const w=d?.getHTML(),E=d?.getJSON(),x=d?.getText(),k=Wte(c,{editor:d,sendCrossMention:v});k&&(l?.({payload:k,html:w,json:E,text:x}),o&&(p(),d?.chain()?.focus()?.clearContent()?.run()))};return M.useEffect(()=>{d&&d?.chain()?.focus()?.run()},[d]),d?g.jsxs("div",{className:"max-w-full w-full","data-theme":"select-post-builder",children:[g.jsx(ty.Provider,{value:m,children:s?g.jsx(wy,{open:s,onOpenChange:i,children:g.jsxs(Ey,{className:"bg-transparent shadow-none border-0 p-3 lg:max-w-4xl shrink-0 !max-h-[calc(100dvh-7rem)] flex flex-col overflow-y-auto -translate-1/2",showCloseButton:!1,children:[g.jsxs(Sy,{children:[g.jsx(ky,{className:"sr-only",children:"Post Builder Modal"}),!r&&g.jsxs("div",{className:"flex items-center justify-between gap-3",children:[g.jsx(rS,{user:n,store:h}),g.jsx(c3,{asChild:!0,children:g.jsx(Pn,{variant:"outline",size:"icon",children:g.jsx(ta,{})})})]})]}),g.jsx(XE,{editor:d,actions:f,editorTab:c,onSwitchEditor:u,isSubmitting:a,onSubmit:y})]})}):g.jsxs("div",{className:"flex-1 flex flex-col space-y-3 max-w-full max-h-[calc(100dvh-7rem)]",children:[!r&&g.jsx(rS,{user:n,store:h}),g.jsx(XE,{editor:d,actions:f,editorTab:c,onSwitchEditor:u,isSubmitting:a,onSubmit:y})]})}),g.jsx($te,{position:"top-center"})]}):null};exports.PostBuilderEditor=Gte;exports.PostBuilderProvider=NI;