@inkeep/open-knowledge 0.20.0-beta.6 → 0.20.0-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/skills/discovery/SKILL.md +1 -1
- package/dist/assets/skills/project/SKILL.md +1 -1
- package/dist/cli.mjs +9 -9
- package/dist/constants-guHl6645.mjs +2 -0
- package/dist/{dist-4Ump46HS.mjs → dist-CX2NKvL3.mjs} +3 -3
- package/dist/{dist-DWj46ioV.mjs → dist-n9uYOrGl.mjs} +1 -1
- package/dist/{gh-detect-BDIdc7oG.mjs → gh-detect-D4j_2KZA.mjs} +2 -2
- package/dist/index.mjs +1 -1
- package/dist/{init-CTWS3YAh.mjs → init-CMfDQGkl.mjs} +4 -4
- package/dist/init-xPihugg8.mjs +1 -0
- package/dist/loader-C8nqTo1Q.mjs +1 -0
- package/dist/{loader-DfAj3I6y.mjs → loader-C9FLjkmp.mjs} +2 -2
- package/dist/{preview-BqvkYsAn.mjs → preview-D2CQ6yHX.mjs} +2 -2
- package/dist/preview-DVTHD8sU.mjs +1 -0
- package/dist/public/assets/{ActivityModeContent-Bw1oRtQH.js → ActivityModeContent-DbFWb8AO.js} +1 -1
- package/dist/public/assets/{DocumentContext-o-LUu0wz.js → DocumentContext-B2qgy31k.js} +2 -2
- package/dist/public/assets/{GraphPanel-BVt0SfrM.js → GraphPanel-sDi-_TRH.js} +1 -1
- package/dist/public/assets/{ManagedArtifactProperties-D-xwymUR.js → ManagedArtifactProperties-D40g_fzP.js} +1 -1
- package/dist/public/assets/{PropertyPanel-CeeQNbcR.js → PropertyPanel-Ca0E5GKl.js} +1 -1
- package/dist/public/assets/{SettingsDialogBody-wC0Rm8N5.js → SettingsDialogBody-DAgimxsR.js} +2 -2
- package/dist/public/assets/{SkillEditorActions-Y_e1zC_b.js → SkillEditorActions-DKVNhzBj.js} +1 -1
- package/dist/public/assets/{SourceEditor-4ljQqBHw.js → SourceEditor-DxmNPlc5.js} +2 -2
- package/dist/public/assets/{TerminalPanel-C9rmhBG2.js → TerminalPanel-DIRUaDNy.js} +1 -1
- package/dist/public/assets/{config-validation-events-mtT7Nmop.js → config-validation-events-Ct_n4YVx.js} +4 -4
- package/dist/public/assets/dist-BrFh1X3E.js +524 -0
- package/dist/public/assets/{documents-events-DMS5a4By.js → documents-events-keB3Tua2.js} +1 -1
- package/dist/public/assets/index-JZXtAkn1.js +2004 -0
- package/dist/public/assets/{keyboard-shortcuts-DGu1nhPQ.js → keyboard-shortcuts-DWO3dbNP.js} +1 -1
- package/dist/public/assets/{open-managed-artifact-tab-Bvt3X7yV.js → open-managed-artifact-tab-BpWVbrq3.js} +1 -1
- package/dist/public/assets/{prop-types-Cf7ylXsu.js → prop-types-DAdpyyQb.js} +1 -1
- package/dist/public/assets/{selection-context-CFA_dZau.js → selection-context-CvCY4HqN.js} +1 -1
- package/dist/public/assets/{skill-actions-CQ-n4sOB.js → skill-actions-IJVLen8G.js} +1 -1
- package/dist/public/assets/{skills-api-q4V5pwth.js → skills-api-BNk9GDF4.js} +1 -1
- package/dist/public/assets/{target-navigation-intent-CCRb_XMp.js → target-navigation-intent-UQ8it6hJ.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-BfS-xBMY.js → typing-burst-detector-DunF9z9v.js} +2 -2
- package/dist/public/index.html +14 -14
- package/dist/{repair-launch-json-CB3RaqvZ.mjs → repair-launch-json-C9KJ4bPN.mjs} +2 -2
- package/dist/{repair-mcp-configs-ChsIYMUP.mjs → repair-mcp-configs-BtoZ6M_S.mjs} +2 -2
- package/dist/{repair-skills-CiDVwcih.mjs → repair-skills-B98v58k0.mjs} +2 -2
- package/dist/repair-skills-BnIHtXhN.mjs +1 -0
- package/dist/server-lock-8Lv6A-Xa-Cwb8QI-d.mjs +1 -0
- package/dist/{server-lock-CN2YHwpP-COM23IWb.mjs → server-lock-CN2YHwpP-BhBKViGp.mjs} +114 -114
- package/dist/{src-65pJ6529.mjs → src-CThY_5pJ.mjs} +2 -2
- package/dist/{start-DP8kaNsQ.mjs → start-Bc4ER1Ku.mjs} +2 -2
- package/dist/start-D8Ns1Flr.mjs +1 -0
- package/dist/{write-project-skill-jB0r_q3O.mjs → write-project-skill-C4u_YHBP.mjs} +2 -2
- package/package.json +1 -1
- package/dist/constants-GNu6fJQT.mjs +0 -2
- package/dist/init-BbqHeUlA.mjs +0 -1
- package/dist/loader-C7xkHjNn.mjs +0 -1
- package/dist/preview-IS_QJ2xL.mjs +0 -1
- package/dist/public/assets/dist-Dst_hB5H.js +0 -524
- package/dist/public/assets/index-BZo7KSQC.js +0 -2004
- package/dist/repair-skills-BBBQJfX6.mjs +0 -1
- package/dist/server-lock-8Lv6A-Xa-iDqi_bbE.mjs +0 -1
- package/dist/start-DJl3ovqu.mjs +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./mermaid.core-D8RYCLKc.js","./preload-helper-2ej06EnG.js","./chunk-U2HBQHQK-DS1rSLlZ.js","./src-B6QNK1mg.js","./chunk-CFjPhJqf.js","./src-BqsPAyWV.js","./chunk-5PVQY5BW-DQpmr1mr.js","./dist-DkLHggFN.js","./chunk-ICPOFSXX-DarRce4R.js","./_baseFor-D_g0Vaw_.js","./isObjectLike-CXTdSPmv.js","./isEmpty-DrXavX4s.js","./chunk-336JU56O-TcDWBc_l.js","./chunk-5FUZZQ4R-CShfms8C.js","./chunk-X2U36JSP-Cl4q5XGv.js","./chunk-ZZ45TVLE-CPn1i1Ng.js","./rough.esm-BBvhatCN.js","./chunk-ENJZ2VHE-CssVQlYq.js","./line-yhTleQFD.js","./path-BFMmafCM.js","./array-DWz6cUQe.js","./chunk-BSJP7CBP-BH_VceX8.js","./chunk-426QAEUC-BHMnxPdS.js","./chunk-XPW4576I-jdZVABI6.js","./pdf-BodNBvC9.js","./dist-Bzfgenqd2.js","./dist-BXTYSiRS.js","./w3c-keyname-CO1Sq6Ug.js","./dist-Dkd2NyD9.js","./dist-DisLVkiU.js","./dist-HRxi3YvV2.js","./dist-Diq9mvyh.js","./dist-ChteXkW7.js","./stex-h1E98Bzt.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{o as e,t}from"./chunk-CFjPhJqf.js";import{t as n}from"./preload-helper-2ej06EnG.js";import{n as r,r as i,t as a}from"./compiler-runtime-CVnuRdak.js";import{n as o,r as s}from"./dist-CQw2y-s3.js";import{$ as c,$r as l,$t as u,Ar as d,Bn as f,Ci as p,Cn as m,Cr as h,Di as g,Dr as _,Ei as v,En as y,Er as b,F as x,Fi as S,Fn as C,Ft as w,G as T,Gn as E,Gr as D,Hn as O,Ht as k,Ii as A,In as j,It as M,J as N,Jn as P,Jr as F,K as I,Kr as L,Ln as R,Lt as z,Mn as B,Nn as V,Oi as H,P as ee,Pi as U,Pr as W,Pt as te,Q as G,Qn as ne,Qr as re,Ri as ie,Rn as ae,Rt as oe,S as se,Si as K,Sn as ce,Ti as le,Tn as ue,U as de,Un as fe,Ur as pe,V as me,Vn as he,Vt as ge,W as _e,Wn as ve,Wr as ye,Wt as be,X as xe,Yr as Se,Yt as Ce,Z as we,Zn as Te,Zr as Ee,Zt as De,_ as Oe,_i as ke,_n as Ae,_t as je,a as Me,ai as Ne,ar as Pe,bi as q,bt as Fe,c as Ie,cr as Le,ct as Re,d as ze,di as Be,dr as Ve,ei as He,en as Ue,er as We,f as Ge,fi as Ke,fr as qe,g as Je,gn as Ye,gr as Xe,gt as Ze,hi as Qe,ht as $e,in as et,it as tt,jn as nt,jr as rt,jt as it,kn as at,l as ot,li as st,lr as ct,lt,m as ut,mi as dt,mr as ft,ni as pt,nn as mt,oi as ht,or as gt,ot as _t,p as vt,pt as yt,q as bt,qr as xt,rr as St,rt as Ct,sr as wt,st as Tt,ti as Et,tn as Dt,tr as Ot,u as kt,ui as At,ur as jt,v as Mt,vi as Nt,vn as Pt,w as Ft,wi as It,wr as Lt,x as Rt,xi as zt,xn as Bt,y as Vt,yi as Ht,yr as Ut,yt as Wt,z as Gt,zn as Kt}from"./dist-Dst_hB5H.js";import{t as qt}from"./react-dom-C-oc-P2K.js";import{c as Jt,i as Yt,l as Xt,o as Zt,r as Qt,s as $t,t as en,u as J}from"./button-DGf25ccp.js";import{_ as tn,a as nn,c as rn,d as an,f as on,g as sn,h as cn,i as ln,l as un,m as dn,n as fn,o as pn,p as mn,r as hn,s as gn,t as _n,u as vn}from"./dialog-Bt8vN5IM.js";import{t as yn}from"./chevron-down-BaPMAfbX.js";import{t as bn}from"./chevron-right-jyIhGBkw.js";import{A as xn,C as Sn,D as Cn,F as wn,I as Tn,N as En,O as Dn,P as On,a as kn,c as An,f as jn,i as Mn,k as Nn,m as Pn,p as Fn,r as In,u as Ln,w as Rn}from"./prop-types-Cf7ylXsu.js";import{d as zn,f as Bn,i as Vn,l as Hn,m as Un,n as Wn,p as Gn,t as Kn,u as qn}from"./config-context-DhhN0rlf.js";import{i as Jn,n as Yn,r as Xn,t as Zn}from"./collapsible-B9pRLq8V.js";import{n as Qn,r as $n}from"./dist-BLu8fLv5.js";import{l as er,n as tr,t as nr,u as rr}from"./documents-events-DMS5a4By.js";import{t as ir}from"./trace-api-D2bW5RZv.js";import{n as ar,t as or}from"./propagation-api-Dhdns5D6.js";import{a as sr,c as cr,d as lr,f as ur,i as dr,l as fr,n as pr,o as mr,r as hr,s as gr,t as _r}from"./dist-CPXhSDT0.js";import{a as vr,i as yr,n as br,t as xr}from"./tooltip-D-omjYEX.js";import{_ as Sr,a as Cr,c as wr,g as Tr,h as Er,i as Dr,l as Or,m as kr,n as Ar,p as jr,r as Mr,t as Nr,u as Pr}from"./dist-DEyMVsLW.js";import{t as Fr}from"./dist-KER3mSN7.js";import{t as Ir}from"./input-CFm7DcvJ.js";import{Bt as Lr,C as Rr,Ct as zr,D as Br,Dt as Vr,E as Hr,Et as Ur,F as Wr,Ft as Gr,Ht as Kr,It as qr,J as Jr,L as Yr,Lt as Xr,Mt as Zr,N as Qr,O as $r,Ot as ei,P as ti,Pt as ni,Q as ri,R as Y,S as ii,St as ai,Tt as oi,V as si,Vt as ci,X as li,Y as ui,a as di,c as fi,dt as pi,f as mi,j as hi,l as gi,n as _i,o as vi,q as yi,r as bi,t as xi,ut as Si,xt as Ci}from"./dist-BXTYSiRS.js";import{n as wi,r as Ti,t as Ei}from"./dist-Dkd2NyD9.js";import{t as Di}from"./dist-C_ATH0cs.js";import{n as Oi}from"./dist-wA9FGceo.js";import{n as ki}from"./dist-BKvCaeVU.js";import{n as Ai}from"./dist-Bzfgenqd2.js";import{i as ji,n as Mi,r as Ni}from"./dist-hRhcPaZU.js";import{n as Pi}from"./dist-DisLVkiU.js";import{t as Fi}from"./stex-h1E98Bzt.js";var X=i();(function(){var e=[`user-blocking`,`user-visible`,`background`];class t{constructor(){this.t=new MessageChannel,this.i=this.t.port2,this.l={},this.o=1,this.t.port1.onmessage=e=>this.h(e)}u(e){var t=this.o++;return this.l[t]=e,this.i.postMessage(t),t}p(e){delete this.l[e]}h(e){var t=e.data;if(t in this.l){var n=this.l[t];delete this.l[t],n()}}}function n(){return n.v||=new t,n.v}class r{constructor(e,t,n){n===void 0&&(n=0),this.k=e,this.T=null,this.C=null,this.m=!1,this._(t,n)}isIdleCallback(){return this.T===0}I(){return this.T===2}cancel(){if(!this.m)switch(this.m=!0,this.T){case 0:cancelIdleCallback(this.C);break;case 1:clearTimeout(this.C);break;case 2:n().p(this.C);break;default:throw TypeError(`Unknown CallbackType`)}}_(t,r){if(r&&r>0)return this.T=1,void(this.C=setTimeout(()=>{this.P()},r));if(!e.includes(t))throw TypeError(`Invalid task priority : `+t);t===`background`&&typeof requestIdleCallback==`function`?(this.T=0,this.C=requestIdleCallback(()=>{this.P()})):typeof MessageChannel==`function`?(this.T=2,this.C=n().u(()=>{this.P()})):(this.T=1,this.C=setTimeout(()=>{this.P()}))}P(){this.m||this.k()}}var i=0;class a{constructor(){this.j=null,this.M=null}isEmpty(){return this.j==null}push(e){if(typeof e!=`object`)throw TypeError(`Task must be an Object`);e.A=i++,this.isEmpty()?(e.N=null,this.j=e):(e.N=this.M,this.M.O=e),e.O=null,this.M=e}takeNextTask(){if(this.isEmpty())return null;var e=this.j;return this.q(e),e}merge(e,t){if(typeof t!=`function`)throw TypeError(`Must provide a selector function.`);if(e==null)throw Error(`sourceQueue cannot be null`);for(var n=this.j,r=null,i=e.j;i;){var a=i;if(i=i.O,t(a)){for(e.q(a);n&&n.A<a.A;)r=n,n=n.O;this.D(a,r),r=a}}}D(e,t){if(t!=this.M){var n=t?t.O:this.j;e.O=n,n.N=e,e.N=t,t==null?this.j=e:t.O=e}else this.push(e)}q(e){if(e==null)throw Error(`Expected task to be non-null`);e===this.j&&(this.j=e.O),e===this.M&&(this.M=this.M.N),e.O&&(e.O.N=e.N),e.N&&(e.N.O=e.O)}}class o extends Event{constructor(t,n){if(!n||!e.includes(n.previousPriority))throw TypeError(`Invalid task priority: '`+n.previousPriority+`'`);super(t),this.previousPriority=n.previousPriority}}class s extends AbortController{constructor(t){if(t===void 0&&(t={}),super(),t??={},typeof t!=`object`)throw TypeError(`'init' is not an object`);var n,r,i=t.priority===void 0?`user-visible`:t.priority;if(!e.includes(i))throw TypeError(`Invalid task priority: '`+i+`'`);this.H=i,this.R=!1,r=(n=this).signal,Object.defineProperties(r,{priority:{get:function(){return n.H},enumerable:!0},onprioritychange:{value:null,writable:!0,enumerable:!0}}),r.addEventListener(`prioritychange`,e=>{r.onprioritychange&&r.onprioritychange(e)})}setPriority(t){if(!e.includes(t))throw TypeError(`Invalid task priority: `+t);if(this.R)throw new DOMException(``,`NotAllowedError`);if(this.signal.priority!==t){this.R=!0;var n=this.H;this.H=t;var r=new o(`prioritychange`,{previousPriority:n});this.signal.dispatchEvent(r),this.R=!1}}}self.scheduler===void 0?(self.scheduler=new class{constructor(){this.S={},e.forEach(e=>{this.S[e]=[new a,new a]}),this.U=null,this.W=new WeakMap}yield(){return this.B(()=>{},{priority:`user-visible`},!0)}postTask(e,t){return this.B(e,t,!1)}B(t,n,r){if((n=Object.assign({},n)).signal!==void 0){if(n.signal===null||!(`aborted`in n.signal)||typeof n.signal.addEventListener!=`function`)return Promise.reject(TypeError(`'signal' is not a valid 'AbortSignal'`));if(n.signal&&n.signal.priority&&!e.includes(n.signal.priority))return Promise.reject(TypeError(`Invalid task priority: '`+n.signal.priority+`'`))}if(n.priority!==void 0&&(n.priority===null||!e.includes(n.priority)))return Promise.reject(TypeError(`Invalid task priority: '`+n.priority+`'`));if(n.delay===void 0&&(n.delay=0),n.delay=Number(n.delay),n.delay<0)return Promise.reject(TypeError(`'delay' must be a positive number.`));var i={callback:t,options:n,resolve:null,reject:null,hostCallback:null,abortCallback:null,onTaskCompleted:function(){this.options.signal&&this.abortCallback&&(this.options.signal.removeEventListener(`abort`,this.abortCallback),this.abortCallback=null)},onTaskAborted:function(){this.hostCallback&&=(this.hostCallback.cancel(),null),this.options.signal.removeEventListener(`abort`,this.abortCallback),this.abortCallback=null,this.reject(this.options.signal.reason)},isAborted:function(){return this.options.signal&&this.options.signal.aborted},isContinuation:r},a=new Promise((e,t)=>{i.resolve=e,i.reject=t});return this._(i),a}_(e){var t=e.options.signal;if(t){if(t.aborted)return void e.reject(t.reason);e.abortCallback=()=>{e.onTaskAborted()},t.addEventListener(`abort`,e.abortCallback)}e.options.delay>0?e.hostCallback=new r(()=>{e.hostCallback=null,this.F(e)},null,e.options.delay):(this.G(e),this.J())}F(e){this.G(e),this.U&&=(this.U.cancel(),null),this.K()}L(e){var t=this.W.get(e);if(t===void 0)throw Error(`Attempting to change priority on an unregistered signal`);if(t!==e.priority){for(var n=0;n<2;n++)this.S[e.priority][n].merge(this.S[t][n],t=>t.options.signal===e);this.W.set(e,e.priority)}}K(){this.U=null,this.V(),this.J()}J(){var{priority:e}=this.X();e!=null&&(e!==`background`&&this.U&&this.U.isIdleCallback()&&(this.U.cancel(),this.U=null),this.U||=new r(()=>{this.K()},e,0))}G(t){var n;if(!e.includes(n=t.options.priority?t.options.priority:t.options.signal&&t.options.signal.priority?t.options.signal.priority:`user-visible`))throw TypeError(`Invalid task priority: `+n);if(t.options.signal&&t.options.signal.priority){var r=t.options.signal;this.W.has(r)||(r.addEventListener(`prioritychange`,()=>{this.L(r)}),this.W.set(r,r.priority))}this.S[n][+!t.isContinuation].push(t)}V(){var e=null;do{var{priority:t,type:n}=this.X();if(t==null)return;e=this.S[t][n].takeNextTask()}while(e.isAborted());try{var r=e.callback();e.resolve(r)}catch(t){e.reject(t)}finally{e.onTaskCompleted()}}X(){for(var t=0;t<e.length;t++)for(var n=e[t],r=0;r<2;r++)if(!this.S[n][r].isEmpty())return{priority:n,type:r};return{priority:null,type:0}}},self.TaskController=s,self.TaskPriorityChangeEvent=o):self.scheduler.yield||(self.scheduler.yield=function(){return self.scheduler.postTask(()=>{},{priority:`user-blocking`})})})();var Ii=J(`app-window`,[[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}],[`path`,{d:`M10 4v4`,key:`pp8u80`}],[`path`,{d:`M2 8h20`,key:`d11cs7`}],[`path`,{d:`M6 4v4`,key:`1svtjw`}]]),Li=J(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),Ri=J(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),zi=J(`book-open`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),Bi=J(`box`,[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]),Vi=J(`bug`,[[`path`,{d:`M12 20v-9`,key:`1qisl0`}],[`path`,{d:`M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z`,key:`uouzyp`}],[`path`,{d:`M14.12 3.88 16 2`,key:`qol33r`}],[`path`,{d:`M21 21a4 4 0 0 0-3.81-4`,key:`1b0z45`}],[`path`,{d:`M21 5a4 4 0 0 1-3.55 3.97`,key:`5cxbf6`}],[`path`,{d:`M22 13h-4`,key:`1jl80f`}],[`path`,{d:`M3 21a4 4 0 0 1 3.81-4`,key:`1fjd4g`}],[`path`,{d:`M3 5a4 4 0 0 0 3.55 3.97`,key:`1d7oge`}],[`path`,{d:`M6 13H2`,key:`82j7cp`}],[`path`,{d:`m8 2 1.88 1.88`,key:`fmnt4t`}],[`path`,{d:`M9 7.13V6a3 3 0 1 1 6 0v1.13`,key:`1vgav8`}]]),Hi=J(`chart-column`,[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]]),Ui=J(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Wi=J(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),Gi=J(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Ki=J(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),qi=J(`clipboard-list`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`M12 11h4`,key:`1jrz19`}],[`path`,{d:`M12 16h4`,key:`n85exb`}],[`path`,{d:`M8 11h.01`,key:`1dfujw`}],[`path`,{d:`M8 16h.01`,key:`18s6g9`}]]),Ji=J(`code-xml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]),Yi=J(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),Xi=J(`eraser`,[[`path`,{d:`M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21`,key:`g5wo59`}],[`path`,{d:`m5.082 11.09 8.828 8.828`,key:`1wx5vj`}]]),Zi=J(`external-link`,[[`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`}]]),Qi=J(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),$i=J(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),ea=J(`file-image`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`circle`,{cx:`10`,cy:`12`,r:`2`,key:`737tya`}],[`path`,{d:`m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22`,key:`wt3hpn`}]]),ta=J(`file-plus-corner`,[[`path`,{d:`M11.35 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5.35`,key:`17jvcc`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M14 19h6`,key:`bvotb8`}],[`path`,{d:`M17 16v6`,key:`18yu1i`}]]),na=J(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),ra=J(`file-up`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M12 12v6`,key:`3ahymv`}],[`path`,{d:`m15 15-3-3-3 3`,key:`15xj92`}]]),ia=J(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),aa=J(`film`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M7 3v18`,key:`bbkbws`}],[`path`,{d:`M3 7.5h4`,key:`zfgn84`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`path`,{d:`M3 16.5h4`,key:`1230mu`}],[`path`,{d:`M17 3v18`,key:`in4fa5`}],[`path`,{d:`M17 7.5h4`,key:`myr1c1`}],[`path`,{d:`M17 16.5h4`,key:`go4c1d`}]]),oa=J(`flask-conical`,[[`path`,{d:`M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2`,key:`18mbvz`}],[`path`,{d:`M6.453 15h11.094`,key:`3shlmq`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}]]),sa=J(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),ca=J(`hash`,[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]),la=J(`heading-1`,[[`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`}]]),ua=J(`heading-2`,[[`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`}]]),da=J(`heading-3`,[[`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`}]]),fa=J(`image`,[[`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`}]]),pa=J(`layout-grid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),ma=J(`layout-panel-top`,[[`rect`,{width:`18`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`f1a2em`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}]]),ha=J(`lightbulb`,[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]),ga=J(`link-2-off`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7`,key:`10o201`}],[`path`,{d:`M15 7h2a5 5 0 0 1 4 8`,key:`1d3206`}],[`line`,{x1:`8`,x2:`12`,y1:`12`,y2:`12`,key:`rvw6j4`}],[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}]]),_a=[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]],va=J(`link-2`,_a),ya=J(`list-ordered`,[[`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`}]]),ba=J(`list-todo`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`,key:`cif1o7`}]]),xa=J(`list`,[[`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`}]]),Sa=J(`message-square-warning`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M12 15h.01`,key:`q59x07`}],[`path`,{d:`M12 7v4`,key:`xawao1`}]]),Ca=J(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),wa=J(`octagon-alert`,[[`path`,{d:`M12 16h.01`,key:`1drbdi`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z`,key:`1fd625`}]]),Ta=J(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),Ea=J(`panel-top`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}]]),Da=J(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),Oa=J(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),ka=J(`quote`,[[`path`,{d:`M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`,key:`rib7q0`}],[`path`,{d:`M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`,key:`1ymkrd`}]]),Aa=J(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),ja=J(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),Ma=J(`shapes`,[[`path`,{d:`M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z`,key:`1bo67w`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}],[`circle`,{cx:`17.5`,cy:`17.5`,r:`3.5`,key:`w3z12y`}]]),Na=J(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),Pa=J(`sigma`,[[`path`,{d:`M18 7V5a1 1 0 0 0-1-1H6.5a.5.5 0 0 0-.4.8l4.5 6a2 2 0 0 1 0 2.4l-4.5 6a.5.5 0 0 0 .4.8H17a1 1 0 0 0 1-1v-2`,key:`wuwx1p`}]]),Fa=J(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),Ia=J(`square-play`,[[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}],[`path`,{d:`M9 9.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 9 14.996z`,key:`kmsa83`}]]),La=J(`superscript`,[[`path`,{d:`m4 19 8-8`,key:`hr47gm`}],[`path`,{d:`m12 19-8-8`,key:`1dhhmo`}],[`path`,{d:`M20 12h-4c0-1.5.442-2 1.5-2.5S20 8.334 20 7.002c0-.472-.17-.93-.484-1.29a2.105 2.105 0 0 0-2.617-.436c-.42.239-.738.614-.899 1.06`,key:`1dfcux`}]]),Ra=J(`table-2`,[[`path`,{d:`M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18`,key:`gugj83`}]]),za=J(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),Ba=J(`volume-2`,[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`,key:`1q6k2b`}],[`path`,{d:`M19.364 18.364a9 9 0 0 0 0-12.728`,key:`ijwkga`}]]),Va=J(`workflow`,[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]),Ha=J(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),Ua=J(`zoom-in`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`11`,x2:`11`,y1:`8`,y2:`14`,key:`1vmskp`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),Wa=J(`zoom-out`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),Ga=e(qt(),1),Z=a(),Q=e(r(),1);function Ka(e,t){let n=(0,Z.c)(7),r,i;n[0]!==e||n[1]!==t?(r=()=>{if(t!==`light`&&t!==`dark`&&t!==`system`||!e)return;let n=!1;return e.setThemeSource(t).catch(e=>{console.warn(JSON.stringify({event:`theme-source-set-failed`,themeValue:t,error:e instanceof Error?e.message:String(e)}))}).finally(()=>{if(n)return;let t=window.matchMedia(`(prefers-reduced-transparency: reduce)`).matches;e.signalThemeApplied({reducedTransparency:t})}),()=>{n=!0}},i=[e,t],n[0]=e,n[1]=t,n[2]=r,n[3]=i):(r=n[2],i=n[3]),(0,Q.useEffect)(r,i);let a,o;n[4]===e?(a=n[5],o=n[6]):(a=()=>{if(!e)return;let t=window.matchMedia(`(prefers-reduced-transparency: reduce)`),n=t=>{e.signalThemeApplied({reducedTransparency:t.matches})};return t.addEventListener(`change`,n),()=>{t.removeEventListener(`change`,n)}},o=[e],n[4]=e,n[5]=a,n[6]=o),(0,Q.useEffect)(a,o)}var qa=t((e=>{var t=r();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:n,a=t.useState,o=t.useEffect,s=t.useLayoutEffect,c=t.useDebugValue;function l(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,l=r[1];return s(function(){i.value=n,i.getSnapshot=t,u(i)&&l({inst:i})},[e,n,t]),o(function(){return u(i)&&l({inst:i}),e(function(){u(i)&&l({inst:i})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),Ja=t(((e,t)=>{t.exports=qa()}));function Ya(e,[t,n]){return Math.min(n,Math.max(t,e))}var Xa=`Popover`,[Za,Qa]=lr(Xa,[Cr]),$a=Cr(),[eo,to]=Za(Xa),no=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=$a(t),c=Q.useRef(null),[l,u]=Q.useState(!1),[d,f]=gr({prop:r,defaultProp:i??!1,onChange:a,caller:Xa});return(0,X.jsx)(Dr,{...s,children:(0,X.jsx)(eo,{scope:t,contentId:sr(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:Q.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:Q.useCallback(()=>u(!0),[]),onCustomAnchorRemove:Q.useCallback(()=>u(!1),[]),modal:o,children:n})})};no.displayName=Xa;var ro=`PopoverAnchor`,io=Q.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=to(ro,n),a=$a(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return Q.useEffect(()=>(o(),()=>s()),[o,s]),(0,X.jsx)(Nr,{...a,...r,ref:t})});io.displayName=ro;var ao=`PopoverTrigger`,oo=Q.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=to(ao,n),a=$a(n),o=$t(t,i.triggerRef),s=(0,X.jsx)(ur.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":So(i.open),...r,ref:o,onClick:fr(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,X.jsx)(Nr,{asChild:!0,...a,children:s})});oo.displayName=ao;var so=`PopoverPortal`,[co,lo]=Za(so,{forceMount:void 0}),uo=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=to(so,t);return(0,X.jsx)(co,{scope:t,forceMount:n,children:(0,X.jsx)(mr,{present:n||a.open,children:(0,X.jsx)(pr,{asChild:!0,container:i,children:r})})})};uo.displayName=so;var fo=`PopoverContent`,po=Q.forwardRef((e,t)=>{let n=lo(fo,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=to(fo,e.__scopePopover);return(0,X.jsx)(mr,{present:r||a.open,children:a.modal?(0,X.jsx)(ho,{...i,ref:t}):(0,X.jsx)(go,{...i,ref:t})})});po.displayName=fo;var mo=Yt(`PopoverContent.RemoveScroll`),ho=Q.forwardRef((e,t)=>{let n=to(fo,e.__scopePopover),r=Q.useRef(null),i=$t(t,r),a=Q.useRef(!1);return Q.useEffect(()=>{let e=r.current;if(e)return mn(e)},[]),(0,X.jsx)(dn,{as:mo,allowPinchZoom:!0,children:(0,X.jsx)(_o,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:fr(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:fr(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:fr(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),go=Q.forwardRef((e,t)=>{let n=to(fo,e.__scopePopover),r=Q.useRef(!1),i=Q.useRef(!1);return(0,X.jsx)(_o,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),_o=Q.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=to(fo,n),p=$a(n);return cn(),(0,X.jsx)(sn,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,X.jsx)(hr,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,X.jsx)(Mr,{"data-state":So(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,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)`}})})})}),vo=`PopoverClose`,yo=Q.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=to(vo,n);return(0,X.jsx)(ur.button,{type:`button`,...r,ref:t,onClick:fr(e.onClick,()=>i.onOpenChange(!1))})});yo.displayName=vo;var bo=`PopoverArrow`,xo=Q.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=$a(n);return(0,X.jsx)(Ar,{...i,...r,ref:t})});xo.displayName=bo;function So(e){return e?`open`:`closed`}var Co=no,wo=io,To=oo,Eo=uo,Do=po,Oo=[` `,`Enter`,`ArrowUp`,`ArrowDown`],ko=[` `,`Enter`],Ao=`Select`,[jo,Mo,No]=Sr(Ao),[Po,Fo]=lr(Ao,[No,Cr]),Io=Cr(),[Lo,Ro]=Po(Ao),[zo,Bo]=Po(Ao),Vo=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m}=e,h=Io(t),[g,_]=Q.useState(null),[v,y]=Q.useState(null),[b,x]=Q.useState(!1),S=Tr(l),[C,w]=gr({prop:r,defaultProp:i??!1,onChange:a,caller:Ao}),[T,E]=gr({prop:o,defaultProp:s,onChange:c,caller:Ao}),D=Q.useRef(null),O=g?m||!!g.closest(`form`):!0,[k,A]=Q.useState(new Set),j=Array.from(k).map(e=>e.props.value).join(`;`);return(0,X.jsx)(Dr,{...h,children:(0,X.jsxs)(Lo,{required:p,scope:t,trigger:g,onTriggerChange:_,valueNode:v,onValueNodeChange:y,valueNodeHasChildren:b,onValueNodeHasChildrenChange:x,contentId:sr(),value:T,onValueChange:E,open:C,onOpenChange:w,dir:S,triggerPointerDownPosRef:D,disabled:f,children:[(0,X.jsx)(jo.Provider,{scope:t,children:(0,X.jsx)(zo,{scope:e.__scopeSelect,onNativeOptionAdd:Q.useCallback(e=>{A(t=>new Set(t).add(e))},[]),onNativeOptionRemove:Q.useCallback(e=>{A(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),O?(0,X.jsxs)(Is,{"aria-hidden":!0,required:p,tabIndex:-1,name:u,autoComplete:d,value:T,onChange:e=>E(e.target.value),disabled:f,form:m,children:[T===void 0?(0,X.jsx)(`option`,{value:``}):null,Array.from(k)]},j):null]})})};Vo.displayName=Ao;var Ho=`SelectTrigger`,Uo=Q.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=Io(n),o=Ro(Ho,n),s=o.disabled||r,c=$t(t,o.onTriggerChange),l=Mo(n),u=Q.useRef(`touch`),[d,f,p]=Rs(e=>{let t=l().filter(e=>!e.disabled),n=zs(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,X.jsx)(Nr,{asChild:!0,...a,children:(0,X.jsx)(ur.button,{type:`button`,role:`combobox`,"aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":Ls(o.value)?``:void 0,...i,ref:c,onClick:fr(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:fr(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:fr(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&Oo.includes(e.key)&&(m(),e.preventDefault())})})})});Uo.displayName=Ho;var Wo=`SelectValue`,Go=Q.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=Ro(Wo,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=$t(t,c.onValueNodeChange);return cr(()=>{l(u)},[l,u]),(0,X.jsx)(ur.span,{...s,ref:d,style:{pointerEvents:`none`},children:Ls(c.value)?(0,X.jsx)(X.Fragment,{children:o}):a})});Go.displayName=Wo;var Ko=`SelectIcon`,qo=Q.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,X.jsx)(ur.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});qo.displayName=Ko;var Jo=`SelectPortal`,Yo=e=>(0,X.jsx)(pr,{asChild:!0,...e});Yo.displayName=Jo;var Xo=`SelectContent`,Zo=Q.forwardRef((e,t)=>{let n=Ro(Xo,e.__scopeSelect),[r,i]=Q.useState();if(cr(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?Ga.createPortal((0,X.jsx)($o,{scope:e.__scopeSelect,children:(0,X.jsx)(jo.Slot,{scope:e.__scopeSelect,children:(0,X.jsx)(`div`,{children:e.children})})}),t):null}return(0,X.jsx)(rs,{...e,ref:t})});Zo.displayName=Xo;var Qo=10,[$o,es]=Po(Xo),ts=`SelectContentImpl`,ns=Yt(`SelectContent.RemoveScroll`),rs=Q.forwardRef((e,t)=>{let{__scopeSelect:n,position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,..._}=e,v=Ro(Xo,n),[y,b]=Q.useState(null),[x,S]=Q.useState(null),C=$t(t,e=>b(e)),[w,T]=Q.useState(null),[E,D]=Q.useState(null),O=Mo(n),[k,A]=Q.useState(!1),j=Q.useRef(!1);Q.useEffect(()=>{if(y)return mn(y)},[y]),cn();let M=Q.useCallback(e=>{let[t,...n]=O().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&x&&(x.scrollTop=0),n===r&&x&&(x.scrollTop=x.scrollHeight),n?.focus(),document.activeElement!==i))return},[O,x]),N=Q.useCallback(()=>M([w,y]),[M,w,y]);Q.useEffect(()=>{k&&N()},[k,N]);let{onOpenChange:P,triggerPointerDownPosRef:F}=v;Q.useEffect(()=>{if(y){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(F.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(F.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():y.contains(n.target)||P(!1),document.removeEventListener(`pointermove`,t),F.current=null};return F.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[y,P,F]),Q.useEffect(()=>{let e=()=>P(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[P]);let[I,L]=Rs(e=>{let t=O().filter(e=>!e.disabled),n=zs(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),R=Q.useCallback((e,t,n)=>{let r=!j.current&&!n;(v.value!==void 0&&v.value===t||r)&&(T(e),r&&(j.current=!0))},[v.value]),z=Q.useCallback(()=>y?.focus(),[y]),B=Q.useCallback((e,t,n)=>{let r=!j.current&&!n;(v.value!==void 0&&v.value===t||r)&&D(e)},[v.value]),V=r===`popper`?ss:as,H=V===ss?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,X.jsx)($o,{scope:n,content:y,viewport:x,onViewportChange:S,itemRefCallback:R,selectedItem:w,onItemLeave:z,itemTextRefCallback:B,focusSelectedItem:N,selectedItemText:E,position:r,isPositioned:k,searchRef:I,children:(0,X.jsx)(dn,{as:ns,allowPinchZoom:!0,children:(0,X.jsx)(sn,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:fr(i,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,X.jsx)(hr,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:(0,X.jsx)(V,{role:`listbox`,id:v.contentId,"data-state":v.open?`open`:`closed`,dir:v.dir,onContextMenu:e=>e.preventDefault(),..._,...H,onPlaced:()=>A(!0),ref:C,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:fr(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&L(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=O().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>M(t)),e.preventDefault()}})})})})})})});rs.displayName=ts;var is=`SelectItemAlignedPosition`,as=Q.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=Ro(Xo,n),o=es(Xo,n),[s,c]=Q.useState(null),[l,u]=Q.useState(null),d=$t(t,e=>u(e)),f=Mo(n),p=Q.useRef(!1),m=Q.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:v}=o,y=Q.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&_){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=_.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Qo,d=Ya(a,[Qo,Math.max(Qo,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Qo,d=Ya(a,[Qo,Math.max(Qo,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-Qo*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),v=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+v+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-Qo,D=c-E,O=g.offsetHeight/2,k=g.offsetTop+O,A=m+v+k,j=x-A;if(A<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+j;s.style.height=t+`px`,h.scrollTop=A-E+h.offsetTop}s.style.margin=`${Qo}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,_,a.dir,r]);cr(()=>y(),[y]);let[b,x]=Q.useState();return cr(()=>{l&&x(window.getComputedStyle(l).zIndex)},[l]),(0,X.jsx)(cs,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:Q.useCallback(e=>{e&&m.current===!0&&(y(),v?.(),m.current=!1)},[y,v]),children:(0,X.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:b},children:(0,X.jsx)(ur.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});as.displayName=is;var os=`SelectPopperPosition`,ss=Q.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Qo,...a}=e,o=Io(n);return(0,X.jsx)(Mr,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.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)`}})});ss.displayName=os;var[cs,ls]=Po(Xo,{}),us=`SelectViewport`,ds=Q.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=es(us,n),o=ls(us,n),s=$t(t,a.onViewportChange),c=Q.useRef(0);return(0,X.jsxs)(X.Fragment,{children:[(0,X.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}),(0,X.jsx)(jo.Slot,{scope:n,children:(0,X.jsx)(ur.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:fr(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-Qo*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});ds.displayName=us;var fs=`SelectGroup`,[ps,ms]=Po(fs),hs=Q.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=sr();return(0,X.jsx)(ps,{scope:n,id:i,children:(0,X.jsx)(ur.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});hs.displayName=fs;var gs=`SelectLabel`,_s=Q.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=ms(gs,n);return(0,X.jsx)(ur.div,{id:i.id,...r,ref:t})});_s.displayName=gs;var vs=`SelectItem`,[ys,bs]=Po(vs),xs=Q.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=Ro(vs,n),c=es(vs,n),l=s.value===r,[u,d]=Q.useState(a??``),[f,p]=Q.useState(!1),m=$t(t,e=>c.itemRefCallback?.(e,r,i)),h=sr(),g=Q.useRef(`touch`),_=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};if(r===``)throw 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(0,X.jsx)(ys,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:Q.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,X.jsx)(jo.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,X.jsx)(ur.div,{role:`option`,"aria-labelledby":h,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:fr(o.onFocus,()=>p(!0)),onBlur:fr(o.onBlur,()=>p(!1)),onClick:fr(o.onClick,()=>{g.current!==`mouse`&&_()}),onPointerUp:fr(o.onPointerUp,()=>{g.current===`mouse`&&_()}),onPointerDown:fr(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:fr(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:fr(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:fr(o.onKeyDown,e=>{c.searchRef?.current!==``&&e.key===` `||(ko.includes(e.key)&&_(),e.key===` `&&e.preventDefault())})})})})});xs.displayName=vs;var Ss=`SelectItemText`,Cs=Q.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=Ro(Ss,n),s=es(Ss,n),c=bs(Ss,n),l=Bo(Ss,n),[u,d]=Q.useState(null),f=$t(t,e=>d(e),c.onItemTextChange,e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=u?.textContent,m=Q.useMemo(()=>(0,X.jsx)(`option`,{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:g}=l;return cr(()=>(h(m),()=>g(m)),[h,g,m]),(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ur.span,{id:c.textId,...a,ref:f}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Ga.createPortal(a.children,o.valueNode):null]})});Cs.displayName=Ss;var ws=`SelectItemIndicator`,Ts=Q.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return bs(ws,n).isSelected?(0,X.jsx)(ur.span,{"aria-hidden":!0,...r,ref:t}):null});Ts.displayName=ws;var Es=`SelectScrollUpButton`,Ds=Q.forwardRef((e,t)=>{let n=es(Es,e.__scopeSelect),r=ls(Es,e.__scopeSelect),[i,a]=Q.useState(!1),o=$t(t,r.onScrollButtonChange);return cr(()=>{if(n.viewport&&n.isPositioned){let e=function(){a(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,X.jsx)(As,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});Ds.displayName=Es;var Os=`SelectScrollDownButton`,ks=Q.forwardRef((e,t)=>{let n=es(Os,e.__scopeSelect),r=ls(Os,e.__scopeSelect),[i,a]=Q.useState(!1),o=$t(t,r.onScrollButtonChange);return cr(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,X.jsx)(As,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});ks.displayName=Os;var As=Q.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=es(`SelectScrollButton`,n),o=Q.useRef(null),s=Mo(n),c=Q.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return Q.useEffect(()=>()=>c(),[c]),cr(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,X.jsx)(ur.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:fr(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:fr(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:fr(i.onPointerLeave,()=>{c()})})}),js=`SelectSeparator`,Ms=Q.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,X.jsx)(ur.div,{"aria-hidden":!0,...r,ref:t})});Ms.displayName=js;var Ns=`SelectArrow`,Ps=Q.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Io(n),a=Ro(Ns,n),o=es(Ns,n);return a.open&&o.position===`popper`?(0,X.jsx)(Ar,{...i,...r,ref:t}):null});Ps.displayName=Ns;var Fs=`SelectBubbleInput`,Is=Q.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=Q.useRef(null),a=$t(r,i),o=Fr(t);return Q.useEffect(()=>{let e=i.current;if(!e)return;let n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(o!==t&&r){let n=new Event(`change`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[o,t]),(0,X.jsx)(ur.select,{...n,style:{...vr,...n.style},ref:a,defaultValue:t})});Is.displayName=Fs;function Ls(e){return e===``||e===void 0}function Rs(e){let t=dr(e),n=Q.useRef(``),r=Q.useRef(0),i=Q.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=Q.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return Q.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function zs(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Bs(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function Bs(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Vs=Vo,Hs=Uo,Us=Go,Ws=qo,Gs=Yo,Ks=Zo,qs=ds,Js=xs,Ys=Cs,Xs=Ts,Zs=Ds,Qs=ks,$s=`Switch`,[ec,tc]=lr($s),[nc,rc]=ec($s),ic=Q.forwardRef((e,t)=>{let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c=`on`,onCheckedChange:l,form:u,...d}=e,[f,p]=Q.useState(null),m=$t(t,e=>p(e)),h=Q.useRef(!1),g=f?u||!!f.closest(`form`):!0,[_,v]=gr({prop:i,defaultProp:a??!1,onChange:l,caller:$s});return(0,X.jsxs)(nc,{scope:n,checked:_,disabled:s,children:[(0,X.jsx)(ur.button,{type:`button`,role:`switch`,"aria-checked":_,"aria-required":o,"data-state":lc(_),"data-disabled":s?``:void 0,disabled:s,value:c,...d,ref:m,onClick:fr(e.onClick,e=>{v(e=>!e),g&&(h.current=e.isPropagationStopped(),h.current||e.stopPropagation())})}),g&&(0,X.jsx)(cc,{control:f,bubbles:!h.current,name:r,value:c,checked:_,required:o,disabled:s,form:u,style:{transform:`translateX(-100%)`}})]})});ic.displayName=$s;var ac=`SwitchThumb`,oc=Q.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=rc(ac,n);return(0,X.jsx)(ur.span,{"data-state":lc(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});oc.displayName=ac;var sc=`SwitchBubbleInput`,cc=Q.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=Q.useRef(null),s=$t(o,a),c=Fr(n),l=_r(t);return Q.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(t,`checked`).set;if(c!==n&&i){let t=new Event(`click`,{bubbles:r});i.call(e,n),e.dispatchEvent(t)}},[c,n,r]),(0,X.jsx)(`input`,{type:`checkbox`,"aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:s,style:{...i.style,...l,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0}})});cc.displayName=sc;function lc(e){return e?`checked`:`unchecked`}var uc=ic,dc=oc,fc=Ja(),pc=Jt(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3! font-mono uppercase`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,warning:`bg-yellow-500/10 text-yellow-600 [a]:hover:bg-yellow-500/20`,destructive:`bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`,dashed:`border-dashed border-border text-muted-foreground rounded-sm`,primary:`border border-primary/50 text-primary bg-primary/5 rounded-sm p-0.5 px-1.5 font-mono`,gray:`border border-border text-muted-foreground bg-muted rounded-sm p-0.5 px-1.5 font-mono`}},defaultVariants:{variant:`default`}});function mc(e){let t=(0,Z.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,variant:i,asChild:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`default`:i,s=a!==void 0&&a?Qt:`span`,c;t[5]!==n||t[6]!==o?(c=Xt(pc({variant:o}),n),t[5]=n,t[6]=o,t[7]=c):c=t[7];let l;return t[8]!==s||t[9]!==r||t[10]!==c||t[11]!==o?(l=(0,X.jsx)(s,{"data-slot":`badge`,"data-variant":o,className:c,...r}),t[8]=s,t[9]=r,t[10]=c,t[11]=o,t[12]=l):l=t[12],l}function hc(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(Co,{"data-slot":`popover`,...n}),t[2]=n,t[3]=r),r}function gc(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(To,{"data-slot":`popover-trigger`,...n}),t[2]=n,t[3]=r),r}function _c(e){let t=(0,Z.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,align:i,sideOffset:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`center`:i,s=a===void 0?4:a,c;t[5]===n?c=t[6]:(c=Xt(`z-50 w-72 rounded-lg border bg-popover p-4 text-popover-foreground shadow-md outline-hidden origin-(--radix-popover-content-transform-origin) duration-100 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 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0`,n),t[5]=n,t[6]=c);let l;return t[7]!==o||t[8]!==r||t[9]!==s||t[10]!==c?(l=(0,X.jsx)(Eo,{children:(0,X.jsx)(Do,{"data-slot":`popover-content`,align:o,sideOffset:s,className:c,...r})}),t[7]=o,t[8]=r,t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function vc(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(wo,{"data-slot":`popover-anchor`,...n}),t[2]=n,t[3]=r),r}var yc={BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.19.2`}?.VITE_APP_VERSION??`0.0.0-unknown`;function bc(){return Dt({kind:`web`,runtimeVersion:yc})}function xc(){return mt({kind:`web`,runtimeVersion:yc})}function Sc(e,t){return t}function Cc(e){let t=e.split(`/`);return t.length<2?`ok`:`${t[0]}/${t[1]}`}function wc(e){if(!e)return;let t=Object.entries(e);if(t.length!==0)return t.map(([e,t])=>{if(t==null)return[e,String(t)];if(typeof t==`string`)return[e,t];if(typeof t==`number`||typeof t==`boolean`)return[e,String(t)];try{return[e,JSON.stringify(t)]}catch{return[e,`[unserializable]`]}})}function Tc(e,t,n){if(typeof performance>`u`||!performance.measure)return;let r=Cc(e),i=wc(t),a={devtools:{dataType:`track-entry`,track:r,...i?{properties:i}:{},...n?.tooltipText?{tooltipText:n.tooltipText}:{}}},o=performance.now(),s=n?.startTime??o,c=n?.duration??Math.max(0,o-s);try{performance.measure(e,{start:s,duration:c,detail:a})}catch{}({...t?{properties:t}:{}})}function Ec(e,t){}function Dc(e,t,n){Tc(e,{...t,durationMs:n},{duration:n})}var $=Object.assign(Tc,{count:Ec,histogram:Dc});function Oc(e){let t=(0,Z.c)(3),{name:n,children:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,X.jsx)(Q.Profiler,{id:n,onRender:kc,children:r}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}var kc=(e,t,n,r,i,a)=>{$(`ok/render/${e}`,{phase:t,actualDuration:Math.round(n*1e3)/1e3,baseDuration:Math.round(r*1e3)/1e3},{startTime:i,duration:Math.max(0,a-i)})},{getOwnPropertyNames:Ac,getOwnPropertySymbols:jc}=Object,{hasOwnProperty:Mc}=Object.prototype;function Nc(e,t){return function(n,r,i){return e(n,r,i)&&t(n,r,i)}}function Pc(e){return function(t,n,r){if(!t||!n||typeof t!=`object`||typeof n!=`object`)return e(t,n,r);let{cache:i}=r,a=i.get(t),o=i.get(n);if(a&&o)return a===n&&o===t;i.set(t,n),i.set(n,t);let s=e(t,n,r);return i.delete(t),i.delete(n),s}}function Fc(e){return e?.[Symbol.toStringTag]}function Ic(e){return Ac(e).concat(jc(e))}var Lc=Object.hasOwn||((e,t)=>Mc.call(e,t));function Rc(e,t){return e===t||!e&&!t&&e!==e&&t!==t}var zc=`__v`,Bc=`__o`,Vc=`_owner`,{getOwnPropertyDescriptor:Hc,keys:Uc}=Object;function Wc(e,t){return e.byteLength===t.byteLength&&rl(new Uint8Array(e),new Uint8Array(t))}function Gc(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function Kc(e,t){return e.byteLength===t.byteLength&&rl(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function qc(e,t){return Rc(e.getTime(),t.getTime())}function Jc(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function Yc(e,t){return e===t}function Xc(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.entries(),o,s,c=0;for(;(o=a.next())&&!o.done;){let r=t.entries(),a=!1,l=0;for(;(s=r.next())&&!s.done;){if(i[l]){l++;continue}let r=o.value,u=s.value;if(n.equals(r[0],u[0],c,l,e,t,n)&&n.equals(r[1],u[1],r[0],u[0],e,t,n)){a=i[l]=!0;break}l++}if(!a)return!1;c++}return!0}var Zc=Rc;function Qc(e,t,n){let r=Uc(e),i=r.length;if(Uc(t).length!==i)return!1;for(;i-- >0;)if(!al(e,t,n,r[i]))return!1;return!0}function $c(e,t,n){let r=Ic(e),i=r.length;if(Ic(t).length!==i)return!1;let a,o,s;for(;i-- >0;)if(a=r[i],!al(e,t,n,a)||(o=Hc(e,a),s=Hc(t,a),(o||s)&&(!o||!s||o.configurable!==s.configurable||o.enumerable!==s.enumerable||o.writable!==s.writable)))return!1;return!0}function el(e,t){return Rc(e.valueOf(),t.valueOf())}function tl(e,t){return e.source===t.source&&e.flags===t.flags}function nl(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.values(),o,s;for(;(o=a.next())&&!o.done;){let r=t.values(),a=!1,c=0;for(;(s=r.next())&&!s.done;){if(!i[c]&&n.equals(o.value,s.value,o.value,s.value,e,t,n)){a=i[c]=!0;break}c++}if(!a)return!1}return!0}function rl(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function il(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function al(e,t,n,r){return(r===Vc||r===Bc||r===zc)&&(e.$$typeof||t.$$typeof)?!0:Lc(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}var ol=`[object ArrayBuffer]`,sl=`[object Arguments]`,cl=`[object Boolean]`,ll=`[object DataView]`,ul=`[object Date]`,dl=`[object Error]`,fl=`[object Map]`,pl=`[object Number]`,ml=`[object Object]`,hl=`[object RegExp]`,gl=`[object Set]`,_l=`[object String]`,vl={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},yl=`[object URL]`,bl=Object.prototype.toString;function xl({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:a,areMapsEqual:o,areNumbersEqual:s,areObjectsEqual:c,arePrimitiveWrappersEqual:l,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:p,unknownTagComparators:m}){return function(h,g,_){if(h===g)return!0;if(h==null||g==null)return!1;let v=typeof h;if(v!==typeof g)return!1;if(v!==`object`)return v===`number`?s(h,g,_):v===`function`?a(h,g,_):!1;let y=h.constructor;if(y!==g.constructor)return!1;if(y===Object)return c(h,g,_);if(Array.isArray(h))return t(h,g,_);if(y===Date)return r(h,g,_);if(y===RegExp)return u(h,g,_);if(y===Map)return o(h,g,_);if(y===Set)return d(h,g,_);let b=bl.call(h);if(b===ul)return r(h,g,_);if(b===hl)return u(h,g,_);if(b===fl)return o(h,g,_);if(b===gl)return d(h,g,_);if(b===ml)return typeof h.then!=`function`&&typeof g.then!=`function`&&c(h,g,_);if(b===yl)return p(h,g,_);if(b===dl)return i(h,g,_);if(b===sl)return c(h,g,_);if(vl[b])return f(h,g,_);if(b===ol)return e(h,g,_);if(b===ll)return n(h,g,_);if(b===cl||b===pl||b===_l)return l(h,g,_);if(m){let e=m[b];if(!e){let t=Fc(h);t&&(e=m[t])}if(e)return e(h,g,_)}return!1}}function Sl({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:Wc,areArraysEqual:n?$c:Gc,areDataViewsEqual:Kc,areDatesEqual:qc,areErrorsEqual:Jc,areFunctionsEqual:Yc,areMapsEqual:n?Nc(Xc,$c):Xc,areNumbersEqual:Zc,areObjectsEqual:n?$c:Qc,arePrimitiveWrappersEqual:el,areRegExpsEqual:tl,areSetsEqual:n?Nc(nl,$c):nl,areTypedArraysEqual:n?Nc(rl,$c):rl,areUrlsEqual:il,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){let e=Pc(r.areArraysEqual),t=Pc(r.areMapsEqual),n=Pc(r.areObjectsEqual),i=Pc(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:n,areSetsEqual:i})}return r}function Cl(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function wl({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function(a,o){let{cache:s=e?new WeakMap:void 0,meta:c}=n();return t(a,o,{cache:s,equals:r,meta:c,strict:i})};if(e)return function(e,n){return t(e,n,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};let a={cache:void 0,equals:r,meta:void 0,strict:i};return function(e,n){return t(e,n,a)}}var Tl=El();El({strict:!0}),El({circular:!0}),El({circular:!0,strict:!0}),El({createInternalComparator:()=>Rc}),El({strict:!0,createInternalComparator:()=>Rc}),El({circular:!0,createInternalComparator:()=>Rc}),El({circular:!0,createInternalComparator:()=>Rc,strict:!0});function El(e={}){let{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,a=xl(Sl(e));return wl({circular:t,comparator:a,createState:r,equals:n?n(a):Cl(a),strict:i})}var Dl=t((e=>{var t=r(),n=Ja();function i(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var a=typeof Object.is==`function`?Object.is:i,o=n.useSyncExternalStore,s=t.useRef,c=t.useEffect,l=t.useMemo,u=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var d=s(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=l(function(){function e(e){if(!o){if(o=!0,s=e,e=r(e),i!==void 0&&f.hasValue){var t=f.value;if(i(t,e))return c=t}return c=e}if(t=c,a(s,e))return t;var n=r(e);return i!==void 0&&i(t,n)?(s=e,t):(s=e,c=n)}var o=!1,s,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,i]);var p=o(e,d[0],d[1]);return c(function(){f.hasValue=!0,f.value=p},[p]),u(p),p}})),Ol=t(((e,t)=>{t.exports=Dl()}))(),kl=(...e)=>t=>{e.forEach(e=>{typeof e==`function`?e(t):e&&(e.current=t)})},Al=({contentComponent:e})=>{let t=(0,fc.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getServerSnapshot);return(0,X.jsx)(X.Fragment,{children:Object.values(t)})};function jl(){let e=new Set,t={};return{subscribe(t){return e.add(t),()=>{e.delete(t)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(n,r){t={...t,[n]:Ga.createPortal(r.reactElement,r.element,n)},e.forEach(e=>e())},removeRenderer(n){let r={...t};delete r[n],t=r,e.forEach(e=>e())}}}var Ml=class extends Q.Component{constructor(e){super(e),this.editorContentRef=Q.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){let e=this.props.editor;if(e&&!e.isDestroyed&&e.view.dom?.parentNode){if(e.contentComponent)return;let t=this.editorContentRef.current;t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t}),e.contentComponent=jl(),e.createNodeViews(),e.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){let e=this.props.editor;if(e){e.isEditorContentInitialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),e.contentComponent=null;try{if(!e.view.dom?.parentNode)return;let t=document.createElement(`div`);t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t})}catch{}}}render(){let{editor:e,innerRef:t,...n}=this.props;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{ref:kl(t,this.editorContentRef),...n}),e?.contentComponent&&(0,X.jsx)(Al,{contentComponent:e.contentComponent})]})}},Nl=(0,Q.forwardRef)((e,t)=>{let n=Q.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[e.editor]);return Q.createElement(Ml,{key:n,innerRef:t,...e})}),Pl=Q.memo(Nl),Fl=typeof window<`u`?Q.useLayoutEffect:Q.useEffect,Il=class{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,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(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){let e=()=>{this.transactionNumber+=1,this.subscribers.forEach(e=>e())},t=this.editor;return t.on(`transaction`,e),()=>{t.off(`transaction`,e)}}}};function Ll(e){let[t]=(0,Q.useState)(()=>new Il(e.editor)),n=(0,Ol.useSyncExternalStoreWithSelector)(t.subscribe,t.getSnapshot,t.getServerSnapshot,e.selector,e.equalityFn??Tl);return Fl(()=>t.watch(e.editor),[e.editor,t]),(0,Q.useDebugValue)(n),n}var Rl=!1,zl=typeof window>`u`,Bl=zl||!!(typeof window<`u`&&window.next),Vl=class e{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(e=>e())}getInitialEditor(){if(this.options.current.immediatelyRender===void 0){if(zl||Bl){if(Rl)throw 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&&zl&&Rl)throw 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(){return new xt({...this.options.current,onBeforeCreate:(...e)=>{var t;return(t=this.options.current).onBeforeCreate?.call(t,...e)},onBlur:(...e)=>{var t;return(t=this.options.current).onBlur?.call(t,...e)},onCreate:(...e)=>{var t;return(t=this.options.current).onCreate?.call(t,...e)},onDestroy:(...e)=>{var t;return(t=this.options.current).onDestroy?.call(t,...e)},onFocus:(...e)=>{var t;return(t=this.options.current).onFocus?.call(t,...e)},onSelectionUpdate:(...e)=>{var t;return(t=this.options.current).onSelectionUpdate?.call(t,...e)},onTransaction:(...e)=>{var t;return(t=this.options.current).onTransaction?.call(t,...e)},onUpdate:(...e)=>{var t;return(t=this.options.current).onUpdate?.call(t,...e)},onContentError:(...e)=>{var t;return(t=this.options.current).onContentError?.call(t,...e)},onDrop:(...e)=>{var t;return(t=this.options.current).onDrop?.call(t,...e)},onPaste:(...e)=>{var t;return(t=this.options.current).onPaste?.call(t,...e)},onDelete:(...e)=>{var t;return(t=this.options.current).onDelete?.call(t,...e)}})}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(n=>[`onCreate`,`onBeforeCreate`,`onDestroy`,`onUpdate`,`onTransaction`,`onFocus`,`onBlur`,`onSelectionUpdate`,`onContentError`,`onDrop`,`onPaste`].includes(n)?!0:n===`extensions`&&e.extensions&&t.extensions?e.extensions.length===t.extensions.length?e.extensions.every((e,n)=>e===t.extensions?.[n]):!1:e[n]===t[n])}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&t.length===0?e.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{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((t,n)=>t===e[n]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){let e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){t&&t.setOptions(this.options.current);return}t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function Hl(e={},t=[]){let n=(0,Q.useRef)(e);n.current=e;let[r]=(0,Q.useState)(()=>new Vl(n)),i=(0,fc.useSyncExternalStore)(r.subscribe,r.getEditor,r.getServerSnapshot);return(0,Q.useDebugValue)(i),(0,Q.useEffect)(r.onRender(t)),Ll({editor:i,selector:({transactionNumber:t})=>e.shouldRerenderOnTransaction===!1||e.shouldRerenderOnTransaction===void 0?null:e.immediatelyRender&&t===0?0:t+1}),i}var Ul=(0,Q.createContext)({editor:null});Ul.Consumer;var Wl=()=>(0,Q.useContext)(Ul),Gl=(0,Q.createContext)({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),Kl=()=>(0,Q.useContext)(Gl);function ql({as:e=`div`,...t}){let{nodeViewContentRef:n,nodeViewContentChildren:r}=Kl();return(0,X.jsx)(e,{...t,ref:n,"data-node-view-content":``,style:{whiteSpace:`pre-wrap`,...t.style},children:r})}var Jl=Q.forwardRef((e,t)=>{let{onDragStart:n}=Kl();return(0,X.jsx)(e.as||`div`,{...e,ref:t,"data-node-view-wrapper":``,onDragStart:n,style:{whiteSpace:`normal`,...e.style}})});function Yl(e){return!!(typeof e==`function`&&e.prototype&&e.prototype.isReactComponent)}function Xl(e){return!!(typeof e==`object`&&e.$$typeof&&(e.$$typeof.toString()===`Symbol(react.forward_ref)`||e.$$typeof.description===`react.forward_ref`))}function Zl(e){return!!(typeof e==`object`&&e.$$typeof&&(e.$$typeof.toString()===`Symbol(react.memo)`||e.$$typeof.description===`react.memo`))}function Ql(e){if(Yl(e)||Xl(e))return!0;if(Zl(e)){let t=e.type;if(t)return Yl(t)||Xl(t)}return!1}function $l(){try{if(Q.version)return parseInt(Q.version.split(`.`)[0],10)>=19}catch{}return!1}var eu=class{constructor(e,{editor:t,props:n={},as:r=`div`,className:i=``}){this.ref=null,this.destroyed=!1,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=e,this.editor=t,this.props=n,this.element=document.createElement(r),this.element.classList.add(`react-renderer`),i&&this.element.classList.add(...i.split(` `)),this.editor.isEditorContentInitialized?(0,Ga.flushSync)(()=>{this.render()}):queueMicrotask(()=>{this.destroyed||this.render()})}render(){var e;if(this.destroyed)return;let t=this.component,n=this.props,r=this.editor,i=$l(),a=Ql(t),o={...n};o.ref&&!(i||a)&&delete o.ref,!o.ref&&(i||a)&&(o.ref=e=>{this.ref=e}),this.reactElement=(0,X.jsx)(t,{...o}),(e=r?.contentComponent)==null||e.setRenderer(this.id,this)}updateProps(e={}){this.destroyed||(this.props={...this.props,...e},this.render())}destroy(){var e;this.destroyed=!0,(e=this.editor?.contentComponent)==null||e.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(e){Object.keys(e).forEach(t=>{this.element.setAttribute(t,e[t])})}};Q.createContext({markViewContentRef:()=>{}});var tu=class extends Ee{constructor(e,t,n){if(super(e,t,n),this.selectionRafId=null,this.positionCheckCallback=null,this.cachedExtensionWithSyncedStorage=null,!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?`span`:`div`),this.contentDOMElement.dataset.nodeViewContentReact=``,this.contentDOMElement.dataset.nodeViewWrapper=``,this.contentDOMElement.style.whiteSpace=`inherit`;let e=this.dom.querySelector(`[data-node-view-content]`);if(!e)return;e.appendChild(this.contentDOMElement)}}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){let e=this.editor,t=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(t,{get(n,r,i){return r===`storage`?e.storage[t.name]??{}:Reflect.get(n,r,i)}})}return this.cachedExtensionWithSyncedStorage}mount(){let e={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extensionWithSyncedStorage,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(e={})=>this.updateAttributes(e),deleteNode:()=>this.deleteNode(),ref:(0,Q.createRef)()};if(!this.component.displayName){let e=e=>e.charAt(0).toUpperCase()+e.substring(1);this.component.displayName=e(this.extension.name)}let t={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:e=>{e&&this.contentDOMElement&&e.firstChild!==this.contentDOMElement&&(e.hasAttribute(`data-node-view-wrapper`)&&e.removeAttribute(`data-node-view-wrapper`),e.appendChild(this.contentDOMElement))}},n=this.component,r=(0,Q.memo)(e=>(0,X.jsx)(Gl.Provider,{value:t,children:(0,Q.createElement)(n,e)}));r.displayName=`ReactNodeView`;let i=this.node.isInline?`span`:`div`;this.options.as&&(i=this.options.as);let{className:a=``}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new eu(r,{editor:this.editor,props:e,as:i,className:`node-${this.node.type.name} ${a}`.trim()}),this.editor.on(`selectionUpdate`,this.handleSelectionUpdate),this.updateElementAttributes(),this.currentPos=this.getPos(),this.positionCheckCallback=()=>{let e=this.getPos();typeof e!=`number`||e===this.currentPos||(this.currentPos=e,this.renderer.updateProps({getPos:()=>this.getPos()}),typeof this.options.attrs==`function`&&this.updateElementAttributes())},Be(this.editor,this.positionCheckCallback)}get dom(){if(this.renderer.element.firstElementChild&&!this.renderer.element.firstElementChild?.hasAttribute(`data-node-view-wrapper`))throw Error(`Please use the NodeViewWrapper component for your node view.`);return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){this.selectionRafId&&=(cancelAnimationFrame(this.selectionRafId),null),this.selectionRafId=requestAnimationFrame(()=>{this.selectionRafId=null;let{from:e,to:t}=this.editor.state.selection,n=this.currentPos;if(typeof n==`number`)if(e<=n&&t>=n+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}})}update(e,t,n){let r=e=>{this.renderer.updateProps(e),typeof this.options.attrs==`function`&&this.updateElementAttributes()};if(e.type!==this.node.type)return!1;if(typeof this.options.update==`function`){let i=this.node,a=this.decorations,o=this.innerDecorations;return this.node=e,this.decorations=t,this.innerDecorations=n,this.currentPos=this.getPos(),this.options.update({oldNode:i,oldDecorations:a,newNode:e,newDecorations:t,oldInnerDecorations:o,innerDecorations:n,updateProps:()=>r({node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage})})}let i=this.getPos();return e===this.node&&this.decorations===t&&this.innerDecorations===n?i===this.currentPos?!0:(this.currentPos=i,r({node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage,getPos:()=>this.getPos()}),!0):(this.node=e,this.decorations=t,this.innerDecorations=n,this.currentPos=i,r({node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage}),!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.positionCheckCallback&&=(re(this.editor,this.positionCheckCallback),null),this.contentDOMElement=null,this.selectionRafId&&=(cancelAnimationFrame(this.selectionRafId),null)}updateElementAttributes(){if(this.options.attrs){let e={};if(typeof this.options.attrs==`function`){let t=this.editor.extensionManager.attributes,n=Et(this.node,t);e=this.options.attrs({node:this.node,HTMLAttributes:n})}else e=this.options.attrs;this.renderer.updateAttributes(e)}}};function nu(e,t){return n=>n.editor.contentComponent?new tu(e,n,t):{}}var ru=(0,Q.createContext)({get editor(){throw Error(`useTiptap must be used within a <Tiptap> provider`)}});ru.displayName=`TiptapContext`;var iu=()=>(0,Q.useContext)(ru);function au({editor:e,instance:t,children:n}){let r=e??t;if(!r)throw Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");let i=(0,Q.useMemo)(()=>({editor:r}),[r]),a=(0,Q.useMemo)(()=>({editor:r}),[r]);return(0,X.jsx)(Ul.Provider,{value:a,children:(0,X.jsx)(ru.Provider,{value:i,children:n})})}au.displayName=`Tiptap`;function ou({...e}){let{editor:t}=iu();return(0,X.jsx)(Pl,{editor:t,...e})}ou.displayName=`Tiptap.Content`,Object.assign(au,{Content:ou});var su=()=>new Map,cu=e=>{let t=su();return e.forEach((e,n)=>{t.set(n,e)}),t},lu=(e,t,n)=>{let r=e.get(t);return r===void 0&&e.set(t,r=n()),r},uu=(e,t)=>{let n=[];for(let[r,i]of e)n.push(t(i,r));return n},du=(e,t)=>{for(let[n,r]of e)if(t(r,n))return!0;return!1},fu=()=>new Set,pu=e=>e[e.length-1],mu=(e,t)=>{for(let n=0;n<t.length;n++)e.push(t[n])},hu=Array.from,gu=(e,t)=>{for(let n=0;n<e.length;n++)if(!t(e[n],n,e))return!1;return!0},_u=(e,t)=>{for(let n=0;n<e.length;n++)if(t(e[n],n,e))return!0;return!1},vu=(e,t)=>{let n=Array(e);for(let r=0;r<e;r++)n[r]=t(r,n);return n},yu=Array.isArray,bu=class{constructor(){this._observers=su()}on(e,t){return lu(this._observers,e,fu).add(t),t}once(e,t){let n=(...r)=>{this.off(e,n),t(...r)};this.on(e,n)}off(e,t){let n=this._observers.get(e);n!==void 0&&(n.delete(t),n.size===0&&this._observers.delete(e))}emit(e,t){return hu((this._observers.get(e)||su()).values()).forEach(e=>e(...t))}destroy(){this._observers=su()}},xu=class{constructor(){this._observers=su()}on(e,t){lu(this._observers,e,fu).add(t)}once(e,t){let n=(...r)=>{this.off(e,n),t(...r)};this.on(e,n)}off(e,t){let n=this._observers.get(e);n!==void 0&&(n.delete(t),n.size===0&&this._observers.delete(e))}emit(e,t){return hu((this._observers.get(e)||su()).values()).forEach(e=>e(...t))}destroy(){this._observers=su()}},Su=Math.floor,Cu=Math.abs,wu=(e,t)=>e<t?e:t,Tu=(e,t)=>e>t?e:t;Number.isNaN;var Eu=e=>e===0?1/e<0:e<0,Du=1<<17,Ou=1<<18,ku=1<<19,Au=1<<20,ju=1<<21,Mu=1<<22,Nu=1<<23,Pu=1<<24,Fu=1<<25,Iu=1<<26,Lu=1<<27,Ru=1<<28,zu=1<<29;Du-1,Ou-1,ku-1,Au-1,ju-1,Mu-1,Nu-1,Pu-1,Fu-1,Iu-1,Lu-1,Ru-1,zu-1;var Bu=2**53-1,Vu=-(2**53-1),Hu=Number.isInteger||(e=>typeof e==`number`&&isFinite(e)&&Su(e)===e);Number.isNaN,Number.parseInt;var Uu=String.fromCharCode;String.fromCodePoint,Uu(65535);var Wu=e=>e.toLowerCase(),Gu=/^\s*/g,Ku=e=>e.replace(Gu,``),qu=/([A-Z])/g,Ju=(e,t)=>Ku(e.replace(qu,e=>`${t}${Wu(e)}`)),Yu=e=>{let t=unescape(encodeURIComponent(e)),n=t.length,r=new Uint8Array(n);for(let e=0;e<n;e++)r[e]=t.codePointAt(e);return r},Xu=typeof TextEncoder<`u`?new TextEncoder:null,Zu=Xu?e=>Xu.encode(e):Yu,Qu=typeof TextDecoder>`u`?null:new TextDecoder(`utf-8`,{fatal:!0,ignoreBOM:!0});Qu&&Qu.decode(new Uint8Array).length===1&&(Qu=null);var $u=(e,t)=>vu(t,()=>e).join(``),ed=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}},td=()=>new ed,nd=e=>{let t=td();return e(t),id(t)},rd=e=>{let t=e.cpos;for(let n=0;n<e.bufs.length;n++)t+=e.bufs[n].length;return t},id=e=>{let t=new Uint8Array(rd(e)),n=0;for(let r=0;r<e.bufs.length;r++){let i=e.bufs[r];t.set(i,n),n+=i.length}return t.set(new Uint8Array(e.cbuf.buffer,0,e.cpos),n),t},ad=(e,t)=>{let n=e.cbuf.length;n-e.cpos<t&&(e.bufs.push(new Uint8Array(e.cbuf.buffer,0,e.cpos)),e.cbuf=new Uint8Array(Tu(n,t)*2),e.cpos=0)},od=(e,t)=>{let n=e.cbuf.length;e.cpos===n&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(n*2),e.cpos=0),e.cbuf[e.cpos++]=t},sd=od,cd=(e,t)=>{for(;t>127;)od(e,128|127&t),t=Su(t/128);od(e,127&t)},ld=(e,t)=>{let n=Eu(t);for(n&&(t=-t),od(e,(t>63?128:0)|(n?64:0)|63&t),t=Su(t/64);t>0;)od(e,(t>127?128:0)|127&t),t=Su(t/128)},ud=new Uint8Array(3e4),dd=ud.length/3,fd=Xu&&Xu.encodeInto?(e,t)=>{if(t.length<dd){let n=Xu.encodeInto(t,ud).written||0;cd(e,n);for(let t=0;t<n;t++)od(e,ud[t])}else md(e,Zu(t))}:(e,t)=>{let n=unescape(encodeURIComponent(t)),r=n.length;cd(e,r);for(let t=0;t<r;t++)od(e,n.codePointAt(t))},pd=(e,t)=>{let n=e.cbuf.length,r=e.cpos,i=wu(n-r,t.length),a=t.length-i;e.cbuf.set(t.subarray(0,i),r),e.cpos+=i,a>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(Tu(n*2,a)),e.cbuf.set(t.subarray(i)),e.cpos=a)},md=(e,t)=>{cd(e,t.byteLength),pd(e,t)},hd=(e,t)=>{ad(e,t);let n=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,n},gd=(e,t)=>hd(e,4).setFloat32(0,t,!1),_d=(e,t)=>hd(e,8).setFloat64(0,t,!1),vd=(e,t)=>hd(e,8).setBigInt64(0,t,!1),yd=new DataView(new ArrayBuffer(4)),bd=e=>(yd.setFloat32(0,e),yd.getFloat32(0)===e),xd=(e,t)=>{switch(typeof t){case`string`:od(e,119),fd(e,t);break;case`number`:Hu(t)&&Cu(t)<=2147483647?(od(e,125),ld(e,t)):bd(t)?(od(e,124),gd(e,t)):(od(e,123),_d(e,t));break;case`bigint`:od(e,122),vd(e,t);break;case`object`:if(t===null)od(e,126);else if(yu(t)){od(e,117),cd(e,t.length);for(let n=0;n<t.length;n++)xd(e,t[n])}else if(t instanceof Uint8Array)od(e,116),md(e,t);else{od(e,118);let n=Object.keys(t);cd(e,n.length);for(let r=0;r<n.length;r++){let i=n[r];fd(e,i),xd(e,t[i])}}break;case`boolean`:od(e,t?120:121);break;default:od(e,127)}},Sd=class extends ed{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&cd(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}},Cd=e=>{e.count>0&&(ld(e.encoder,e.count===1?e.s:-e.s),e.count>1&&cd(e.encoder,e.count-2))},wd=class{constructor(){this.encoder=new ed,this.s=0,this.count=0}write(e){this.s===e?this.count++:(Cd(this),this.count=1,this.s=e)}toUint8Array(){return Cd(this),id(this.encoder)}},Td=e=>{if(e.count>0){let t=e.diff*2+(e.count===1?0:1);ld(e.encoder,t),e.count>1&&cd(e.encoder,e.count-2)}},Ed=class{constructor(){this.encoder=new ed,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(Td(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return Td(this),id(this.encoder)}},Dd=class{constructor(){this.sarr=[],this.s=``,this.lensE=new wd}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=``),this.lensE.write(e.length)}toUint8Array(){let e=new ed;return this.sarr.push(this.s),this.s=``,fd(e,this.sarr.join(``)),pd(e,this.lensE.toUint8Array()),id(e)}},Od=e=>Error(e),kd=()=>{throw Od(`Method unimplemented`)},Ad=()=>{throw Od(`Unexpected case`)},jd=Od(`Unexpected end of array`),Md=Od(`Integer out of Range`),Nd=class{constructor(e){this.arr=e,this.pos=0}},Pd=e=>new Nd(e),Fd=e=>e.pos!==e.arr.length,Id=(e,t)=>{let n=new Uint8Array(e.arr.buffer,e.pos+e.arr.byteOffset,t);return e.pos+=t,n},Ld=e=>Id(e,zd(e)),Rd=e=>e.arr[e.pos++],zd=e=>{let t=0,n=1,r=e.arr.length;for(;e.pos<r;){let r=e.arr[e.pos++];if(t+=(r&127)*n,n*=128,r<128)return t;if(t>Bu)throw Md}throw jd},Bd=e=>{let t=e.arr[e.pos++],n=t&63,r=64,i=(t&64)>0?-1:1;if(!(t&128))return i*n;let a=e.arr.length;for(;e.pos<a;){if(t=e.arr[e.pos++],n+=(t&127)*r,r*=128,t<128)return i*n;if(n>Bu)throw Md}throw jd},Vd=Qu?e=>Qu.decode(Ld(e)):e=>{let t=zd(e);if(t===0)return``;{let n=String.fromCodePoint(Rd(e));if(--t<100)for(;t--;)n+=String.fromCodePoint(Rd(e));else for(;t>0;){let r=t<1e4?t:1e4,i=e.arr.subarray(e.pos,e.pos+r);e.pos+=r,n+=String.fromCodePoint.apply(null,i),t-=r}return decodeURIComponent(escape(n))}},Hd=(e,t)=>{let n=new DataView(e.arr.buffer,e.arr.byteOffset+e.pos,t);return e.pos+=t,n},Ud=[e=>void 0,e=>null,Bd,e=>Hd(e,4).getFloat32(0,!1),e=>Hd(e,8).getFloat64(0,!1),e=>Hd(e,8).getBigInt64(0,!1),e=>!1,e=>!0,Vd,e=>{let t=zd(e),n={};for(let r=0;r<t;r++){let t=Vd(e);n[t]=Wd(e)}return n},e=>{let t=zd(e),n=[];for(let r=0;r<t;r++)n.push(Wd(e));return n},Ld],Wd=e=>Ud[127-Rd(e)](e),Gd=class extends Nd{constructor(e,t){super(e),this.reader=t,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),Fd(this)?this.count=zd(this)+1:this.count=-1),this.count--,this.s}},Kd=class extends Nd{constructor(e){super(e),this.s=0,this.count=0}read(){if(this.count===0){this.s=Bd(this);let e=Eu(this.s);this.count=1,e&&(this.s=-this.s,this.count=zd(this)+2)}return this.count--,this.s}},qd=class extends Nd{constructor(e){super(e),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){let e=Bd(this),t=e&1;this.diff=Su(e/2),this.count=1,t&&(this.count=zd(this)+2)}return this.s+=this.diff,this.count--,this.s}},Jd=class{constructor(e){this.decoder=new Kd(e),this.str=Vd(this.decoder),this.spos=0}read(){let e=this.spos+this.decoder.read(),t=this.str.slice(this.spos,e);return this.spos=e,t}};crypto.subtle;var Yd=crypto.getRandomValues.bind(crypto),Xd=Math.random,Zd=()=>Yd(new Uint32Array(1))[0],Qd=e=>e[Su(Xd()*e.length)],$d=`10000000-1000-4000-8000-100000000000`,ef=()=>$d.replace(/[018]/g,e=>(e^Zd()&15>>e/4).toString(16)),tf=Date.now,nf=e=>new Promise(e);Promise.all.bind(Promise);var rf=e=>e===void 0?null:e,af=new class{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}};try{typeof localStorage<`u`&&localStorage&&(af=localStorage)}catch{}var of=af,sf=Symbol(`Equality`),cf=(e,t)=>e===t||!!e?.[sf]?.(t)||!1,lf=e=>typeof e==`object`,uf=Object.assign,df=Object.keys,ff=(e,t)=>{for(let n in e)t(e[n],n)},pf=e=>df(e).length,mf=e=>{for(let t in e)return!1;return!0},hf=(e,t)=>{for(let n in e)if(!t(e[n],n))return!1;return!0},gf=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),_f=(e,t)=>e===t||pf(e)===pf(t)&&hf(e,(e,n)=>(e!==void 0||gf(t,n))&&cf(t[n],e)),vf=Object.freeze,yf=e=>{for(let t in e){let n=e[t];(typeof n==`object`||typeof n==`function`)&&yf(e[t])}return vf(e)},bf=(e,t,n=0)=>{try{for(;n<e.length;n++)e[n](...t)}finally{n<e.length&&bf(e,t,n+1)}},xf=e=>e,Sf=(e,t)=>{if(e===t)return!0;if(e==null||t==null||e.constructor!==t.constructor&&(e.constructor||Object)!==(t.constructor||Object))return!1;if(e[sf]!=null)return e[sf](t);switch(e.constructor){case ArrayBuffer:e=new Uint8Array(e),t=new Uint8Array(t);case Uint8Array:if(e.byteLength!==t.byteLength)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;break;case Set:if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;break;case Map:if(e.size!==t.size)return!1;for(let n of e.keys())if(!t.has(n)||!Sf(e.get(n),t.get(n)))return!1;break;case void 0:case Object:if(pf(e)!==pf(t))return!1;for(let n in e)if(!gf(e,n)||!Sf(e[n],t[n]))return!1;break;case Array:if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Sf(e[n],t[n]))return!1;break;default:return!1}return!0},Cf=(e,t)=>t.includes(e),wf=typeof process<`u`&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<`u`?process:0)===`[object process]`,Tf=typeof window<`u`&&typeof document<`u`&&!wf;typeof navigator<`u`&&/Mac/.test(navigator.platform);var Ef,Df=[],Of=()=>{if(Ef===void 0)if(wf){Ef=su();let e=process.argv,t=null;for(let n=0;n<e.length;n++){let r=e[n];r[0]===`-`?(t!==null&&Ef.set(t,``),t=r):t===null?Df.push(r):(Ef.set(t,r),t=null)}t!==null&&Ef.set(t,``)}else typeof location==`object`?(Ef=su(),(location.search||`?`).slice(1).split(`&`).forEach(e=>{if(e.length!==0){let[t,n]=e.split(`=`);Ef.set(`--${Ju(t,`-`)}`,n),Ef.set(`-${Ju(t,`-`)}`,n)}})):Ef=su();return Ef},kf=e=>Of().has(e),Af=e=>rf(wf?{}[e.toUpperCase().replaceAll(`-`,`_`)]:of.getItem(e)),jf=e=>kf(`--`+e)||Af(e)!==null,Mf=jf(`production`),Nf=wf&&Cf({}.FORCE_COLOR,[`true`,`1`,`2`])||!kf(`--no-colors`)&&!jf(`no-color`)&&(!wf||process.stdout.isTTY)&&(!wf||kf(`--color`)||Af(`COLORTERM`)!==null||(Af(`TERM`)||``).includes(`color`)),Pf=e=>new Uint8Array(e),Ff=Tf?e=>{let t=``;for(let n=0;n<e.byteLength;n++)t+=Uu(e[n]);return btoa(t)}:e=>Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString(`base64`),If=e=>{let t=Pf(e.byteLength);return t.set(e),t},Lf=e=>nd(t=>xd(t,e)),Rf=class{constructor(e,t){this.left=e,this.right=t}},zf=(e,t)=>new Rf(e,t),Bf=(e,t)=>e.forEach(e=>t(e.left,e.right)),Vf=e=>e.next()>=.5,Hf=(e,t,n)=>Su(e.next()*(n+1-t)+t),Uf=(e,t,n)=>Su(e.next()*(n+1-t)+t),Wf=(e,t,n)=>Uf(e,t,n),Gf=e=>Uu(Wf(e,97,122)),Kf=(e,t=0,n=20)=>{let r=Wf(e,t,n),i=``;for(let t=0;t<r;t++)i+=Gf(e);return i},qf=(e,t)=>t[Wf(e,0,t.length-1)],Jf=Symbol(`0schema`),Yf=class{constructor(){this._rerrs=[]}extend(e,t,n,r=null){this._rerrs.push({path:e,expected:t,has:n,message:r})}toString(){let e=[];for(let t=this._rerrs.length-1;t>0;t--){let n=this._rerrs[t];e.push($u(` `,(this._rerrs.length-t)*2)+`${n.path==null?``:`[${n.path}] `}${n.has} doesn't match ${n.expected}. ${n.message}`)}return e.join(`
|
|
2
|
+
import{o as e,t}from"./chunk-CFjPhJqf.js";import{t as n}from"./preload-helper-2ej06EnG.js";import{n as r,r as i,t as a}from"./compiler-runtime-CVnuRdak.js";import{n as o,r as s}from"./dist-CQw2y-s3.js";import{$ as c,$r as l,$t as u,Ar as d,Bn as f,Ci as p,Cn as m,Cr as h,Di as g,Dr as _,Ei as v,En as y,Er as b,F as x,Fi as S,Fn as C,Ft as w,G as T,Gn as E,Gr as D,Hn as O,Ht as k,Ii as A,In as j,It as M,J as N,Jn as P,Jr as F,K as I,Kr as L,Ln as R,Lt as z,Mn as B,Nn as V,Oi as H,P as ee,Pi as U,Pr as W,Pt as te,Q as G,Qn as ne,Qr as re,Ri as ie,Rn as ae,Rt as oe,S as se,Si as K,Sn as ce,Ti as le,Tn as ue,U as de,Un as fe,Ur as pe,V as me,Vn as he,Vt as ge,W as _e,Wn as ve,Wr as ye,Wt as be,X as xe,Yr as Se,Yt as Ce,Z as we,Zn as Te,Zr as Ee,Zt as De,_ as Oe,_i as ke,_n as Ae,_t as je,a as Me,ai as Ne,ar as Pe,bi as q,bt as Fe,c as Ie,cr as Le,ct as Re,d as ze,di as Be,dr as Ve,ei as He,en as Ue,er as We,f as Ge,fi as Ke,fr as qe,g as Je,gn as Ye,gr as Xe,gt as Ze,hi as Qe,ht as $e,in as et,it as tt,jn as nt,jr as rt,jt as it,kn as at,l as ot,li as st,lr as ct,lt,m as ut,mi as dt,mr as ft,ni as pt,nn as mt,oi as ht,or as gt,ot as _t,p as vt,pt as yt,q as bt,qr as xt,rr as St,rt as Ct,sr as wt,st as Tt,ti as Et,tn as Dt,tr as Ot,u as kt,ui as At,ur as jt,v as Mt,vi as Nt,vn as Pt,w as Ft,wi as It,wr as Lt,x as Rt,xi as zt,xn as Bt,y as Vt,yi as Ht,yr as Ut,yt as Wt,z as Gt,zn as Kt}from"./dist-BrFh1X3E.js";import{t as qt}from"./react-dom-C-oc-P2K.js";import{c as Jt,i as Yt,l as Xt,o as Zt,r as Qt,s as $t,t as en,u as J}from"./button-DGf25ccp.js";import{_ as tn,a as nn,c as rn,d as an,f as on,g as sn,h as cn,i as ln,l as un,m as dn,n as fn,o as pn,p as mn,r as hn,s as gn,t as _n,u as vn}from"./dialog-Bt8vN5IM.js";import{t as yn}from"./chevron-down-BaPMAfbX.js";import{t as bn}from"./chevron-right-jyIhGBkw.js";import{A as xn,C as Sn,D as Cn,F as wn,I as Tn,N as En,O as Dn,P as On,a as kn,c as An,f as jn,i as Mn,k as Nn,m as Pn,p as Fn,r as In,u as Ln,w as Rn}from"./prop-types-DAdpyyQb.js";import{d as zn,f as Bn,i as Vn,l as Hn,m as Un,n as Wn,p as Gn,t as Kn,u as qn}from"./config-context-DhhN0rlf.js";import{i as Jn,n as Yn,r as Xn,t as Zn}from"./collapsible-B9pRLq8V.js";import{n as Qn,r as $n}from"./dist-BLu8fLv5.js";import{l as er,n as tr,t as nr,u as rr}from"./documents-events-keB3Tua2.js";import{t as ir}from"./trace-api-D2bW5RZv.js";import{n as ar,t as or}from"./propagation-api-Dhdns5D6.js";import{a as sr,c as cr,d as lr,f as ur,i as dr,l as fr,n as pr,o as mr,r as hr,s as gr,t as _r}from"./dist-CPXhSDT0.js";import{a as vr,i as yr,n as br,t as xr}from"./tooltip-D-omjYEX.js";import{_ as Sr,a as Cr,c as wr,g as Tr,h as Er,i as Dr,l as Or,m as kr,n as Ar,p as jr,r as Mr,t as Nr,u as Pr}from"./dist-DEyMVsLW.js";import{t as Fr}from"./dist-KER3mSN7.js";import{t as Ir}from"./input-CFm7DcvJ.js";import{Bt as Lr,C as Rr,Ct as zr,D as Br,Dt as Vr,E as Hr,Et as Ur,F as Wr,Ft as Gr,Ht as Kr,It as qr,J as Jr,L as Yr,Lt as Xr,Mt as Zr,N as Qr,O as $r,Ot as ei,P as ti,Pt as ni,Q as ri,R as Y,S as ii,St as ai,Tt as oi,V as si,Vt as ci,X as li,Y as ui,a as di,c as fi,dt as pi,f as mi,j as hi,l as gi,n as _i,o as vi,q as yi,r as bi,t as xi,ut as Si,xt as Ci}from"./dist-BXTYSiRS.js";import{n as wi,r as Ti,t as Ei}from"./dist-Dkd2NyD9.js";import{t as Di}from"./dist-C_ATH0cs.js";import{n as Oi}from"./dist-wA9FGceo.js";import{n as ki}from"./dist-BKvCaeVU.js";import{n as Ai}from"./dist-Bzfgenqd2.js";import{i as ji,n as Mi,r as Ni}from"./dist-hRhcPaZU.js";import{n as Pi}from"./dist-DisLVkiU.js";import{t as Fi}from"./stex-h1E98Bzt.js";var X=i();(function(){var e=[`user-blocking`,`user-visible`,`background`];class t{constructor(){this.t=new MessageChannel,this.i=this.t.port2,this.l={},this.o=1,this.t.port1.onmessage=e=>this.h(e)}u(e){var t=this.o++;return this.l[t]=e,this.i.postMessage(t),t}p(e){delete this.l[e]}h(e){var t=e.data;if(t in this.l){var n=this.l[t];delete this.l[t],n()}}}function n(){return n.v||=new t,n.v}class r{constructor(e,t,n){n===void 0&&(n=0),this.k=e,this.T=null,this.C=null,this.m=!1,this._(t,n)}isIdleCallback(){return this.T===0}I(){return this.T===2}cancel(){if(!this.m)switch(this.m=!0,this.T){case 0:cancelIdleCallback(this.C);break;case 1:clearTimeout(this.C);break;case 2:n().p(this.C);break;default:throw TypeError(`Unknown CallbackType`)}}_(t,r){if(r&&r>0)return this.T=1,void(this.C=setTimeout(()=>{this.P()},r));if(!e.includes(t))throw TypeError(`Invalid task priority : `+t);t===`background`&&typeof requestIdleCallback==`function`?(this.T=0,this.C=requestIdleCallback(()=>{this.P()})):typeof MessageChannel==`function`?(this.T=2,this.C=n().u(()=>{this.P()})):(this.T=1,this.C=setTimeout(()=>{this.P()}))}P(){this.m||this.k()}}var i=0;class a{constructor(){this.j=null,this.M=null}isEmpty(){return this.j==null}push(e){if(typeof e!=`object`)throw TypeError(`Task must be an Object`);e.A=i++,this.isEmpty()?(e.N=null,this.j=e):(e.N=this.M,this.M.O=e),e.O=null,this.M=e}takeNextTask(){if(this.isEmpty())return null;var e=this.j;return this.q(e),e}merge(e,t){if(typeof t!=`function`)throw TypeError(`Must provide a selector function.`);if(e==null)throw Error(`sourceQueue cannot be null`);for(var n=this.j,r=null,i=e.j;i;){var a=i;if(i=i.O,t(a)){for(e.q(a);n&&n.A<a.A;)r=n,n=n.O;this.D(a,r),r=a}}}D(e,t){if(t!=this.M){var n=t?t.O:this.j;e.O=n,n.N=e,e.N=t,t==null?this.j=e:t.O=e}else this.push(e)}q(e){if(e==null)throw Error(`Expected task to be non-null`);e===this.j&&(this.j=e.O),e===this.M&&(this.M=this.M.N),e.O&&(e.O.N=e.N),e.N&&(e.N.O=e.O)}}class o extends Event{constructor(t,n){if(!n||!e.includes(n.previousPriority))throw TypeError(`Invalid task priority: '`+n.previousPriority+`'`);super(t),this.previousPriority=n.previousPriority}}class s extends AbortController{constructor(t){if(t===void 0&&(t={}),super(),t??={},typeof t!=`object`)throw TypeError(`'init' is not an object`);var n,r,i=t.priority===void 0?`user-visible`:t.priority;if(!e.includes(i))throw TypeError(`Invalid task priority: '`+i+`'`);this.H=i,this.R=!1,r=(n=this).signal,Object.defineProperties(r,{priority:{get:function(){return n.H},enumerable:!0},onprioritychange:{value:null,writable:!0,enumerable:!0}}),r.addEventListener(`prioritychange`,e=>{r.onprioritychange&&r.onprioritychange(e)})}setPriority(t){if(!e.includes(t))throw TypeError(`Invalid task priority: `+t);if(this.R)throw new DOMException(``,`NotAllowedError`);if(this.signal.priority!==t){this.R=!0;var n=this.H;this.H=t;var r=new o(`prioritychange`,{previousPriority:n});this.signal.dispatchEvent(r),this.R=!1}}}self.scheduler===void 0?(self.scheduler=new class{constructor(){this.S={},e.forEach(e=>{this.S[e]=[new a,new a]}),this.U=null,this.W=new WeakMap}yield(){return this.B(()=>{},{priority:`user-visible`},!0)}postTask(e,t){return this.B(e,t,!1)}B(t,n,r){if((n=Object.assign({},n)).signal!==void 0){if(n.signal===null||!(`aborted`in n.signal)||typeof n.signal.addEventListener!=`function`)return Promise.reject(TypeError(`'signal' is not a valid 'AbortSignal'`));if(n.signal&&n.signal.priority&&!e.includes(n.signal.priority))return Promise.reject(TypeError(`Invalid task priority: '`+n.signal.priority+`'`))}if(n.priority!==void 0&&(n.priority===null||!e.includes(n.priority)))return Promise.reject(TypeError(`Invalid task priority: '`+n.priority+`'`));if(n.delay===void 0&&(n.delay=0),n.delay=Number(n.delay),n.delay<0)return Promise.reject(TypeError(`'delay' must be a positive number.`));var i={callback:t,options:n,resolve:null,reject:null,hostCallback:null,abortCallback:null,onTaskCompleted:function(){this.options.signal&&this.abortCallback&&(this.options.signal.removeEventListener(`abort`,this.abortCallback),this.abortCallback=null)},onTaskAborted:function(){this.hostCallback&&=(this.hostCallback.cancel(),null),this.options.signal.removeEventListener(`abort`,this.abortCallback),this.abortCallback=null,this.reject(this.options.signal.reason)},isAborted:function(){return this.options.signal&&this.options.signal.aborted},isContinuation:r},a=new Promise((e,t)=>{i.resolve=e,i.reject=t});return this._(i),a}_(e){var t=e.options.signal;if(t){if(t.aborted)return void e.reject(t.reason);e.abortCallback=()=>{e.onTaskAborted()},t.addEventListener(`abort`,e.abortCallback)}e.options.delay>0?e.hostCallback=new r(()=>{e.hostCallback=null,this.F(e)},null,e.options.delay):(this.G(e),this.J())}F(e){this.G(e),this.U&&=(this.U.cancel(),null),this.K()}L(e){var t=this.W.get(e);if(t===void 0)throw Error(`Attempting to change priority on an unregistered signal`);if(t!==e.priority){for(var n=0;n<2;n++)this.S[e.priority][n].merge(this.S[t][n],t=>t.options.signal===e);this.W.set(e,e.priority)}}K(){this.U=null,this.V(),this.J()}J(){var{priority:e}=this.X();e!=null&&(e!==`background`&&this.U&&this.U.isIdleCallback()&&(this.U.cancel(),this.U=null),this.U||=new r(()=>{this.K()},e,0))}G(t){var n;if(!e.includes(n=t.options.priority?t.options.priority:t.options.signal&&t.options.signal.priority?t.options.signal.priority:`user-visible`))throw TypeError(`Invalid task priority: `+n);if(t.options.signal&&t.options.signal.priority){var r=t.options.signal;this.W.has(r)||(r.addEventListener(`prioritychange`,()=>{this.L(r)}),this.W.set(r,r.priority))}this.S[n][+!t.isContinuation].push(t)}V(){var e=null;do{var{priority:t,type:n}=this.X();if(t==null)return;e=this.S[t][n].takeNextTask()}while(e.isAborted());try{var r=e.callback();e.resolve(r)}catch(t){e.reject(t)}finally{e.onTaskCompleted()}}X(){for(var t=0;t<e.length;t++)for(var n=e[t],r=0;r<2;r++)if(!this.S[n][r].isEmpty())return{priority:n,type:r};return{priority:null,type:0}}},self.TaskController=s,self.TaskPriorityChangeEvent=o):self.scheduler.yield||(self.scheduler.yield=function(){return self.scheduler.postTask(()=>{},{priority:`user-blocking`})})})();var Ii=J(`app-window`,[[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}],[`path`,{d:`M10 4v4`,key:`pp8u80`}],[`path`,{d:`M2 8h20`,key:`d11cs7`}],[`path`,{d:`M6 4v4`,key:`1svtjw`}]]),Li=J(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),Ri=J(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),zi=J(`book-open`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),Bi=J(`box`,[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]),Vi=J(`bug`,[[`path`,{d:`M12 20v-9`,key:`1qisl0`}],[`path`,{d:`M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z`,key:`uouzyp`}],[`path`,{d:`M14.12 3.88 16 2`,key:`qol33r`}],[`path`,{d:`M21 21a4 4 0 0 0-3.81-4`,key:`1b0z45`}],[`path`,{d:`M21 5a4 4 0 0 1-3.55 3.97`,key:`5cxbf6`}],[`path`,{d:`M22 13h-4`,key:`1jl80f`}],[`path`,{d:`M3 21a4 4 0 0 1 3.81-4`,key:`1fjd4g`}],[`path`,{d:`M3 5a4 4 0 0 0 3.55 3.97`,key:`1d7oge`}],[`path`,{d:`M6 13H2`,key:`82j7cp`}],[`path`,{d:`m8 2 1.88 1.88`,key:`fmnt4t`}],[`path`,{d:`M9 7.13V6a3 3 0 1 1 6 0v1.13`,key:`1vgav8`}]]),Hi=J(`chart-column`,[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]]),Ui=J(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Wi=J(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),Gi=J(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Ki=J(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),qi=J(`clipboard-list`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`M12 11h4`,key:`1jrz19`}],[`path`,{d:`M12 16h4`,key:`n85exb`}],[`path`,{d:`M8 11h.01`,key:`1dfujw`}],[`path`,{d:`M8 16h.01`,key:`18s6g9`}]]),Ji=J(`code-xml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]),Yi=J(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),Xi=J(`eraser`,[[`path`,{d:`M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21`,key:`g5wo59`}],[`path`,{d:`m5.082 11.09 8.828 8.828`,key:`1wx5vj`}]]),Zi=J(`external-link`,[[`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`}]]),Qi=J(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),$i=J(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),ea=J(`file-image`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`circle`,{cx:`10`,cy:`12`,r:`2`,key:`737tya`}],[`path`,{d:`m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22`,key:`wt3hpn`}]]),ta=J(`file-plus-corner`,[[`path`,{d:`M11.35 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5.35`,key:`17jvcc`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M14 19h6`,key:`bvotb8`}],[`path`,{d:`M17 16v6`,key:`18yu1i`}]]),na=J(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),ra=J(`file-up`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M12 12v6`,key:`3ahymv`}],[`path`,{d:`m15 15-3-3-3 3`,key:`15xj92`}]]),ia=J(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),aa=J(`film`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M7 3v18`,key:`bbkbws`}],[`path`,{d:`M3 7.5h4`,key:`zfgn84`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`path`,{d:`M3 16.5h4`,key:`1230mu`}],[`path`,{d:`M17 3v18`,key:`in4fa5`}],[`path`,{d:`M17 7.5h4`,key:`myr1c1`}],[`path`,{d:`M17 16.5h4`,key:`go4c1d`}]]),oa=J(`flask-conical`,[[`path`,{d:`M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2`,key:`18mbvz`}],[`path`,{d:`M6.453 15h11.094`,key:`3shlmq`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}]]),sa=J(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),ca=J(`hash`,[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]),la=J(`heading-1`,[[`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`}]]),ua=J(`heading-2`,[[`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`}]]),da=J(`heading-3`,[[`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`}]]),fa=J(`image`,[[`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`}]]),pa=J(`layout-grid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),ma=J(`layout-panel-top`,[[`rect`,{width:`18`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`f1a2em`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}]]),ha=J(`lightbulb`,[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]),ga=J(`link-2-off`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7`,key:`10o201`}],[`path`,{d:`M15 7h2a5 5 0 0 1 4 8`,key:`1d3206`}],[`line`,{x1:`8`,x2:`12`,y1:`12`,y2:`12`,key:`rvw6j4`}],[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}]]),_a=[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]],va=J(`link-2`,_a),ya=J(`list-ordered`,[[`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`}]]),ba=J(`list-todo`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`,key:`cif1o7`}]]),xa=J(`list`,[[`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`}]]),Sa=J(`message-square-warning`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M12 15h.01`,key:`q59x07`}],[`path`,{d:`M12 7v4`,key:`xawao1`}]]),Ca=J(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),wa=J(`octagon-alert`,[[`path`,{d:`M12 16h.01`,key:`1drbdi`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z`,key:`1fd625`}]]),Ta=J(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),Ea=J(`panel-top`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}]]),Da=J(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),Oa=J(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),ka=J(`quote`,[[`path`,{d:`M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`,key:`rib7q0`}],[`path`,{d:`M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`,key:`1ymkrd`}]]),Aa=J(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),ja=J(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),Ma=J(`shapes`,[[`path`,{d:`M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z`,key:`1bo67w`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}],[`circle`,{cx:`17.5`,cy:`17.5`,r:`3.5`,key:`w3z12y`}]]),Na=J(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),Pa=J(`sigma`,[[`path`,{d:`M18 7V5a1 1 0 0 0-1-1H6.5a.5.5 0 0 0-.4.8l4.5 6a2 2 0 0 1 0 2.4l-4.5 6a.5.5 0 0 0 .4.8H17a1 1 0 0 0 1-1v-2`,key:`wuwx1p`}]]),Fa=J(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),Ia=J(`square-play`,[[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}],[`path`,{d:`M9 9.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 9 14.996z`,key:`kmsa83`}]]),La=J(`superscript`,[[`path`,{d:`m4 19 8-8`,key:`hr47gm`}],[`path`,{d:`m12 19-8-8`,key:`1dhhmo`}],[`path`,{d:`M20 12h-4c0-1.5.442-2 1.5-2.5S20 8.334 20 7.002c0-.472-.17-.93-.484-1.29a2.105 2.105 0 0 0-2.617-.436c-.42.239-.738.614-.899 1.06`,key:`1dfcux`}]]),Ra=J(`table-2`,[[`path`,{d:`M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18`,key:`gugj83`}]]),za=J(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),Ba=J(`volume-2`,[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`,key:`1q6k2b`}],[`path`,{d:`M19.364 18.364a9 9 0 0 0 0-12.728`,key:`ijwkga`}]]),Va=J(`workflow`,[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]),Ha=J(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),Ua=J(`zoom-in`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`11`,x2:`11`,y1:`8`,y2:`14`,key:`1vmskp`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),Wa=J(`zoom-out`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),Ga=e(qt(),1),Z=a(),Q=e(r(),1);function Ka(e,t){let n=(0,Z.c)(7),r,i;n[0]!==e||n[1]!==t?(r=()=>{if(t!==`light`&&t!==`dark`&&t!==`system`||!e)return;let n=!1;return e.setThemeSource(t).catch(e=>{console.warn(JSON.stringify({event:`theme-source-set-failed`,themeValue:t,error:e instanceof Error?e.message:String(e)}))}).finally(()=>{if(n)return;let t=window.matchMedia(`(prefers-reduced-transparency: reduce)`).matches;e.signalThemeApplied({reducedTransparency:t})}),()=>{n=!0}},i=[e,t],n[0]=e,n[1]=t,n[2]=r,n[3]=i):(r=n[2],i=n[3]),(0,Q.useEffect)(r,i);let a,o;n[4]===e?(a=n[5],o=n[6]):(a=()=>{if(!e)return;let t=window.matchMedia(`(prefers-reduced-transparency: reduce)`),n=t=>{e.signalThemeApplied({reducedTransparency:t.matches})};return t.addEventListener(`change`,n),()=>{t.removeEventListener(`change`,n)}},o=[e],n[4]=e,n[5]=a,n[6]=o),(0,Q.useEffect)(a,o)}var qa=t((e=>{var t=r();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:n,a=t.useState,o=t.useEffect,s=t.useLayoutEffect,c=t.useDebugValue;function l(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,l=r[1];return s(function(){i.value=n,i.getSnapshot=t,u(i)&&l({inst:i})},[e,n,t]),o(function(){return u(i)&&l({inst:i}),e(function(){u(i)&&l({inst:i})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),Ja=t(((e,t)=>{t.exports=qa()}));function Ya(e,[t,n]){return Math.min(n,Math.max(t,e))}var Xa=`Popover`,[Za,Qa]=lr(Xa,[Cr]),$a=Cr(),[eo,to]=Za(Xa),no=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=$a(t),c=Q.useRef(null),[l,u]=Q.useState(!1),[d,f]=gr({prop:r,defaultProp:i??!1,onChange:a,caller:Xa});return(0,X.jsx)(Dr,{...s,children:(0,X.jsx)(eo,{scope:t,contentId:sr(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:Q.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:Q.useCallback(()=>u(!0),[]),onCustomAnchorRemove:Q.useCallback(()=>u(!1),[]),modal:o,children:n})})};no.displayName=Xa;var ro=`PopoverAnchor`,io=Q.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=to(ro,n),a=$a(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return Q.useEffect(()=>(o(),()=>s()),[o,s]),(0,X.jsx)(Nr,{...a,...r,ref:t})});io.displayName=ro;var ao=`PopoverTrigger`,oo=Q.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=to(ao,n),a=$a(n),o=$t(t,i.triggerRef),s=(0,X.jsx)(ur.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":So(i.open),...r,ref:o,onClick:fr(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,X.jsx)(Nr,{asChild:!0,...a,children:s})});oo.displayName=ao;var so=`PopoverPortal`,[co,lo]=Za(so,{forceMount:void 0}),uo=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=to(so,t);return(0,X.jsx)(co,{scope:t,forceMount:n,children:(0,X.jsx)(mr,{present:n||a.open,children:(0,X.jsx)(pr,{asChild:!0,container:i,children:r})})})};uo.displayName=so;var fo=`PopoverContent`,po=Q.forwardRef((e,t)=>{let n=lo(fo,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=to(fo,e.__scopePopover);return(0,X.jsx)(mr,{present:r||a.open,children:a.modal?(0,X.jsx)(ho,{...i,ref:t}):(0,X.jsx)(go,{...i,ref:t})})});po.displayName=fo;var mo=Yt(`PopoverContent.RemoveScroll`),ho=Q.forwardRef((e,t)=>{let n=to(fo,e.__scopePopover),r=Q.useRef(null),i=$t(t,r),a=Q.useRef(!1);return Q.useEffect(()=>{let e=r.current;if(e)return mn(e)},[]),(0,X.jsx)(dn,{as:mo,allowPinchZoom:!0,children:(0,X.jsx)(_o,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:fr(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:fr(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:fr(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),go=Q.forwardRef((e,t)=>{let n=to(fo,e.__scopePopover),r=Q.useRef(!1),i=Q.useRef(!1);return(0,X.jsx)(_o,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),_o=Q.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=to(fo,n),p=$a(n);return cn(),(0,X.jsx)(sn,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,X.jsx)(hr,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,X.jsx)(Mr,{"data-state":So(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,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)`}})})})}),vo=`PopoverClose`,yo=Q.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=to(vo,n);return(0,X.jsx)(ur.button,{type:`button`,...r,ref:t,onClick:fr(e.onClick,()=>i.onOpenChange(!1))})});yo.displayName=vo;var bo=`PopoverArrow`,xo=Q.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=$a(n);return(0,X.jsx)(Ar,{...i,...r,ref:t})});xo.displayName=bo;function So(e){return e?`open`:`closed`}var Co=no,wo=io,To=oo,Eo=uo,Do=po,Oo=[` `,`Enter`,`ArrowUp`,`ArrowDown`],ko=[` `,`Enter`],Ao=`Select`,[jo,Mo,No]=Sr(Ao),[Po,Fo]=lr(Ao,[No,Cr]),Io=Cr(),[Lo,Ro]=Po(Ao),[zo,Bo]=Po(Ao),Vo=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m}=e,h=Io(t),[g,_]=Q.useState(null),[v,y]=Q.useState(null),[b,x]=Q.useState(!1),S=Tr(l),[C,w]=gr({prop:r,defaultProp:i??!1,onChange:a,caller:Ao}),[T,E]=gr({prop:o,defaultProp:s,onChange:c,caller:Ao}),D=Q.useRef(null),O=g?m||!!g.closest(`form`):!0,[k,A]=Q.useState(new Set),j=Array.from(k).map(e=>e.props.value).join(`;`);return(0,X.jsx)(Dr,{...h,children:(0,X.jsxs)(Lo,{required:p,scope:t,trigger:g,onTriggerChange:_,valueNode:v,onValueNodeChange:y,valueNodeHasChildren:b,onValueNodeHasChildrenChange:x,contentId:sr(),value:T,onValueChange:E,open:C,onOpenChange:w,dir:S,triggerPointerDownPosRef:D,disabled:f,children:[(0,X.jsx)(jo.Provider,{scope:t,children:(0,X.jsx)(zo,{scope:e.__scopeSelect,onNativeOptionAdd:Q.useCallback(e=>{A(t=>new Set(t).add(e))},[]),onNativeOptionRemove:Q.useCallback(e=>{A(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),O?(0,X.jsxs)(Is,{"aria-hidden":!0,required:p,tabIndex:-1,name:u,autoComplete:d,value:T,onChange:e=>E(e.target.value),disabled:f,form:m,children:[T===void 0?(0,X.jsx)(`option`,{value:``}):null,Array.from(k)]},j):null]})})};Vo.displayName=Ao;var Ho=`SelectTrigger`,Uo=Q.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=Io(n),o=Ro(Ho,n),s=o.disabled||r,c=$t(t,o.onTriggerChange),l=Mo(n),u=Q.useRef(`touch`),[d,f,p]=Rs(e=>{let t=l().filter(e=>!e.disabled),n=zs(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,X.jsx)(Nr,{asChild:!0,...a,children:(0,X.jsx)(ur.button,{type:`button`,role:`combobox`,"aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":Ls(o.value)?``:void 0,...i,ref:c,onClick:fr(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:fr(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:fr(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&Oo.includes(e.key)&&(m(),e.preventDefault())})})})});Uo.displayName=Ho;var Wo=`SelectValue`,Go=Q.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=Ro(Wo,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=$t(t,c.onValueNodeChange);return cr(()=>{l(u)},[l,u]),(0,X.jsx)(ur.span,{...s,ref:d,style:{pointerEvents:`none`},children:Ls(c.value)?(0,X.jsx)(X.Fragment,{children:o}):a})});Go.displayName=Wo;var Ko=`SelectIcon`,qo=Q.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,X.jsx)(ur.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});qo.displayName=Ko;var Jo=`SelectPortal`,Yo=e=>(0,X.jsx)(pr,{asChild:!0,...e});Yo.displayName=Jo;var Xo=`SelectContent`,Zo=Q.forwardRef((e,t)=>{let n=Ro(Xo,e.__scopeSelect),[r,i]=Q.useState();if(cr(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?Ga.createPortal((0,X.jsx)($o,{scope:e.__scopeSelect,children:(0,X.jsx)(jo.Slot,{scope:e.__scopeSelect,children:(0,X.jsx)(`div`,{children:e.children})})}),t):null}return(0,X.jsx)(rs,{...e,ref:t})});Zo.displayName=Xo;var Qo=10,[$o,es]=Po(Xo),ts=`SelectContentImpl`,ns=Yt(`SelectContent.RemoveScroll`),rs=Q.forwardRef((e,t)=>{let{__scopeSelect:n,position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,..._}=e,v=Ro(Xo,n),[y,b]=Q.useState(null),[x,S]=Q.useState(null),C=$t(t,e=>b(e)),[w,T]=Q.useState(null),[E,D]=Q.useState(null),O=Mo(n),[k,A]=Q.useState(!1),j=Q.useRef(!1);Q.useEffect(()=>{if(y)return mn(y)},[y]),cn();let M=Q.useCallback(e=>{let[t,...n]=O().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&x&&(x.scrollTop=0),n===r&&x&&(x.scrollTop=x.scrollHeight),n?.focus(),document.activeElement!==i))return},[O,x]),N=Q.useCallback(()=>M([w,y]),[M,w,y]);Q.useEffect(()=>{k&&N()},[k,N]);let{onOpenChange:P,triggerPointerDownPosRef:F}=v;Q.useEffect(()=>{if(y){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(F.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(F.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():y.contains(n.target)||P(!1),document.removeEventListener(`pointermove`,t),F.current=null};return F.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[y,P,F]),Q.useEffect(()=>{let e=()=>P(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[P]);let[I,L]=Rs(e=>{let t=O().filter(e=>!e.disabled),n=zs(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),R=Q.useCallback((e,t,n)=>{let r=!j.current&&!n;(v.value!==void 0&&v.value===t||r)&&(T(e),r&&(j.current=!0))},[v.value]),z=Q.useCallback(()=>y?.focus(),[y]),B=Q.useCallback((e,t,n)=>{let r=!j.current&&!n;(v.value!==void 0&&v.value===t||r)&&D(e)},[v.value]),V=r===`popper`?ss:as,H=V===ss?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,X.jsx)($o,{scope:n,content:y,viewport:x,onViewportChange:S,itemRefCallback:R,selectedItem:w,onItemLeave:z,itemTextRefCallback:B,focusSelectedItem:N,selectedItemText:E,position:r,isPositioned:k,searchRef:I,children:(0,X.jsx)(dn,{as:ns,allowPinchZoom:!0,children:(0,X.jsx)(sn,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:fr(i,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,X.jsx)(hr,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:(0,X.jsx)(V,{role:`listbox`,id:v.contentId,"data-state":v.open?`open`:`closed`,dir:v.dir,onContextMenu:e=>e.preventDefault(),..._,...H,onPlaced:()=>A(!0),ref:C,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:fr(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&L(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=O().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>M(t)),e.preventDefault()}})})})})})})});rs.displayName=ts;var is=`SelectItemAlignedPosition`,as=Q.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=Ro(Xo,n),o=es(Xo,n),[s,c]=Q.useState(null),[l,u]=Q.useState(null),d=$t(t,e=>u(e)),f=Mo(n),p=Q.useRef(!1),m=Q.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:v}=o,y=Q.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&_){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=_.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Qo,d=Ya(a,[Qo,Math.max(Qo,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Qo,d=Ya(a,[Qo,Math.max(Qo,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-Qo*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),v=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+v+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-Qo,D=c-E,O=g.offsetHeight/2,k=g.offsetTop+O,A=m+v+k,j=x-A;if(A<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+j;s.style.height=t+`px`,h.scrollTop=A-E+h.offsetTop}s.style.margin=`${Qo}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,_,a.dir,r]);cr(()=>y(),[y]);let[b,x]=Q.useState();return cr(()=>{l&&x(window.getComputedStyle(l).zIndex)},[l]),(0,X.jsx)(cs,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:Q.useCallback(e=>{e&&m.current===!0&&(y(),v?.(),m.current=!1)},[y,v]),children:(0,X.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:b},children:(0,X.jsx)(ur.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});as.displayName=is;var os=`SelectPopperPosition`,ss=Q.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Qo,...a}=e,o=Io(n);return(0,X.jsx)(Mr,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.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)`}})});ss.displayName=os;var[cs,ls]=Po(Xo,{}),us=`SelectViewport`,ds=Q.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=es(us,n),o=ls(us,n),s=$t(t,a.onViewportChange),c=Q.useRef(0);return(0,X.jsxs)(X.Fragment,{children:[(0,X.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}),(0,X.jsx)(jo.Slot,{scope:n,children:(0,X.jsx)(ur.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:fr(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-Qo*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});ds.displayName=us;var fs=`SelectGroup`,[ps,ms]=Po(fs),hs=Q.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=sr();return(0,X.jsx)(ps,{scope:n,id:i,children:(0,X.jsx)(ur.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});hs.displayName=fs;var gs=`SelectLabel`,_s=Q.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=ms(gs,n);return(0,X.jsx)(ur.div,{id:i.id,...r,ref:t})});_s.displayName=gs;var vs=`SelectItem`,[ys,bs]=Po(vs),xs=Q.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=Ro(vs,n),c=es(vs,n),l=s.value===r,[u,d]=Q.useState(a??``),[f,p]=Q.useState(!1),m=$t(t,e=>c.itemRefCallback?.(e,r,i)),h=sr(),g=Q.useRef(`touch`),_=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};if(r===``)throw 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(0,X.jsx)(ys,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:Q.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,X.jsx)(jo.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,X.jsx)(ur.div,{role:`option`,"aria-labelledby":h,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:fr(o.onFocus,()=>p(!0)),onBlur:fr(o.onBlur,()=>p(!1)),onClick:fr(o.onClick,()=>{g.current!==`mouse`&&_()}),onPointerUp:fr(o.onPointerUp,()=>{g.current===`mouse`&&_()}),onPointerDown:fr(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:fr(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:fr(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:fr(o.onKeyDown,e=>{c.searchRef?.current!==``&&e.key===` `||(ko.includes(e.key)&&_(),e.key===` `&&e.preventDefault())})})})})});xs.displayName=vs;var Ss=`SelectItemText`,Cs=Q.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=Ro(Ss,n),s=es(Ss,n),c=bs(Ss,n),l=Bo(Ss,n),[u,d]=Q.useState(null),f=$t(t,e=>d(e),c.onItemTextChange,e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=u?.textContent,m=Q.useMemo(()=>(0,X.jsx)(`option`,{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:g}=l;return cr(()=>(h(m),()=>g(m)),[h,g,m]),(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ur.span,{id:c.textId,...a,ref:f}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Ga.createPortal(a.children,o.valueNode):null]})});Cs.displayName=Ss;var ws=`SelectItemIndicator`,Ts=Q.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return bs(ws,n).isSelected?(0,X.jsx)(ur.span,{"aria-hidden":!0,...r,ref:t}):null});Ts.displayName=ws;var Es=`SelectScrollUpButton`,Ds=Q.forwardRef((e,t)=>{let n=es(Es,e.__scopeSelect),r=ls(Es,e.__scopeSelect),[i,a]=Q.useState(!1),o=$t(t,r.onScrollButtonChange);return cr(()=>{if(n.viewport&&n.isPositioned){let e=function(){a(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,X.jsx)(As,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});Ds.displayName=Es;var Os=`SelectScrollDownButton`,ks=Q.forwardRef((e,t)=>{let n=es(Os,e.__scopeSelect),r=ls(Os,e.__scopeSelect),[i,a]=Q.useState(!1),o=$t(t,r.onScrollButtonChange);return cr(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,X.jsx)(As,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});ks.displayName=Os;var As=Q.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=es(`SelectScrollButton`,n),o=Q.useRef(null),s=Mo(n),c=Q.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return Q.useEffect(()=>()=>c(),[c]),cr(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,X.jsx)(ur.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:fr(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:fr(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:fr(i.onPointerLeave,()=>{c()})})}),js=`SelectSeparator`,Ms=Q.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,X.jsx)(ur.div,{"aria-hidden":!0,...r,ref:t})});Ms.displayName=js;var Ns=`SelectArrow`,Ps=Q.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Io(n),a=Ro(Ns,n),o=es(Ns,n);return a.open&&o.position===`popper`?(0,X.jsx)(Ar,{...i,...r,ref:t}):null});Ps.displayName=Ns;var Fs=`SelectBubbleInput`,Is=Q.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=Q.useRef(null),a=$t(r,i),o=Fr(t);return Q.useEffect(()=>{let e=i.current;if(!e)return;let n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(o!==t&&r){let n=new Event(`change`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[o,t]),(0,X.jsx)(ur.select,{...n,style:{...vr,...n.style},ref:a,defaultValue:t})});Is.displayName=Fs;function Ls(e){return e===``||e===void 0}function Rs(e){let t=dr(e),n=Q.useRef(``),r=Q.useRef(0),i=Q.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=Q.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return Q.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function zs(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Bs(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function Bs(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Vs=Vo,Hs=Uo,Us=Go,Ws=qo,Gs=Yo,Ks=Zo,qs=ds,Js=xs,Ys=Cs,Xs=Ts,Zs=Ds,Qs=ks,$s=`Switch`,[ec,tc]=lr($s),[nc,rc]=ec($s),ic=Q.forwardRef((e,t)=>{let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c=`on`,onCheckedChange:l,form:u,...d}=e,[f,p]=Q.useState(null),m=$t(t,e=>p(e)),h=Q.useRef(!1),g=f?u||!!f.closest(`form`):!0,[_,v]=gr({prop:i,defaultProp:a??!1,onChange:l,caller:$s});return(0,X.jsxs)(nc,{scope:n,checked:_,disabled:s,children:[(0,X.jsx)(ur.button,{type:`button`,role:`switch`,"aria-checked":_,"aria-required":o,"data-state":lc(_),"data-disabled":s?``:void 0,disabled:s,value:c,...d,ref:m,onClick:fr(e.onClick,e=>{v(e=>!e),g&&(h.current=e.isPropagationStopped(),h.current||e.stopPropagation())})}),g&&(0,X.jsx)(cc,{control:f,bubbles:!h.current,name:r,value:c,checked:_,required:o,disabled:s,form:u,style:{transform:`translateX(-100%)`}})]})});ic.displayName=$s;var ac=`SwitchThumb`,oc=Q.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=rc(ac,n);return(0,X.jsx)(ur.span,{"data-state":lc(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});oc.displayName=ac;var sc=`SwitchBubbleInput`,cc=Q.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=Q.useRef(null),s=$t(o,a),c=Fr(n),l=_r(t);return Q.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(t,`checked`).set;if(c!==n&&i){let t=new Event(`click`,{bubbles:r});i.call(e,n),e.dispatchEvent(t)}},[c,n,r]),(0,X.jsx)(`input`,{type:`checkbox`,"aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:s,style:{...i.style,...l,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0}})});cc.displayName=sc;function lc(e){return e?`checked`:`unchecked`}var uc=ic,dc=oc,fc=Ja(),pc=Jt(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3! font-mono uppercase`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,warning:`bg-yellow-500/10 text-yellow-600 [a]:hover:bg-yellow-500/20`,destructive:`bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`,dashed:`border-dashed border-border text-muted-foreground rounded-sm`,primary:`border border-primary/50 text-primary bg-primary/5 rounded-sm p-0.5 px-1.5 font-mono`,gray:`border border-border text-muted-foreground bg-muted rounded-sm p-0.5 px-1.5 font-mono`}},defaultVariants:{variant:`default`}});function mc(e){let t=(0,Z.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,variant:i,asChild:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`default`:i,s=a!==void 0&&a?Qt:`span`,c;t[5]!==n||t[6]!==o?(c=Xt(pc({variant:o}),n),t[5]=n,t[6]=o,t[7]=c):c=t[7];let l;return t[8]!==s||t[9]!==r||t[10]!==c||t[11]!==o?(l=(0,X.jsx)(s,{"data-slot":`badge`,"data-variant":o,className:c,...r}),t[8]=s,t[9]=r,t[10]=c,t[11]=o,t[12]=l):l=t[12],l}function hc(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(Co,{"data-slot":`popover`,...n}),t[2]=n,t[3]=r),r}function gc(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(To,{"data-slot":`popover-trigger`,...n}),t[2]=n,t[3]=r),r}function _c(e){let t=(0,Z.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,align:i,sideOffset:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`center`:i,s=a===void 0?4:a,c;t[5]===n?c=t[6]:(c=Xt(`z-50 w-72 rounded-lg border bg-popover p-4 text-popover-foreground shadow-md outline-hidden origin-(--radix-popover-content-transform-origin) duration-100 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 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0`,n),t[5]=n,t[6]=c);let l;return t[7]!==o||t[8]!==r||t[9]!==s||t[10]!==c?(l=(0,X.jsx)(Eo,{children:(0,X.jsx)(Do,{"data-slot":`popover-content`,align:o,sideOffset:s,className:c,...r})}),t[7]=o,t[8]=r,t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function vc(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(wo,{"data-slot":`popover-anchor`,...n}),t[2]=n,t[3]=r),r}var yc={BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.19.2`}?.VITE_APP_VERSION??`0.0.0-unknown`;function bc(){return Dt({kind:`web`,runtimeVersion:yc})}function xc(){return mt({kind:`web`,runtimeVersion:yc})}function Sc(e,t){return t}function Cc(e){let t=e.split(`/`);return t.length<2?`ok`:`${t[0]}/${t[1]}`}function wc(e){if(!e)return;let t=Object.entries(e);if(t.length!==0)return t.map(([e,t])=>{if(t==null)return[e,String(t)];if(typeof t==`string`)return[e,t];if(typeof t==`number`||typeof t==`boolean`)return[e,String(t)];try{return[e,JSON.stringify(t)]}catch{return[e,`[unserializable]`]}})}function Tc(e,t,n){if(typeof performance>`u`||!performance.measure)return;let r=Cc(e),i=wc(t),a={devtools:{dataType:`track-entry`,track:r,...i?{properties:i}:{},...n?.tooltipText?{tooltipText:n.tooltipText}:{}}},o=performance.now(),s=n?.startTime??o,c=n?.duration??Math.max(0,o-s);try{performance.measure(e,{start:s,duration:c,detail:a})}catch{}({...t?{properties:t}:{}})}function Ec(e,t){}function Dc(e,t,n){Tc(e,{...t,durationMs:n},{duration:n})}var $=Object.assign(Tc,{count:Ec,histogram:Dc});function Oc(e){let t=(0,Z.c)(3),{name:n,children:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,X.jsx)(Q.Profiler,{id:n,onRender:kc,children:r}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}var kc=(e,t,n,r,i,a)=>{$(`ok/render/${e}`,{phase:t,actualDuration:Math.round(n*1e3)/1e3,baseDuration:Math.round(r*1e3)/1e3},{startTime:i,duration:Math.max(0,a-i)})},{getOwnPropertyNames:Ac,getOwnPropertySymbols:jc}=Object,{hasOwnProperty:Mc}=Object.prototype;function Nc(e,t){return function(n,r,i){return e(n,r,i)&&t(n,r,i)}}function Pc(e){return function(t,n,r){if(!t||!n||typeof t!=`object`||typeof n!=`object`)return e(t,n,r);let{cache:i}=r,a=i.get(t),o=i.get(n);if(a&&o)return a===n&&o===t;i.set(t,n),i.set(n,t);let s=e(t,n,r);return i.delete(t),i.delete(n),s}}function Fc(e){return e?.[Symbol.toStringTag]}function Ic(e){return Ac(e).concat(jc(e))}var Lc=Object.hasOwn||((e,t)=>Mc.call(e,t));function Rc(e,t){return e===t||!e&&!t&&e!==e&&t!==t}var zc=`__v`,Bc=`__o`,Vc=`_owner`,{getOwnPropertyDescriptor:Hc,keys:Uc}=Object;function Wc(e,t){return e.byteLength===t.byteLength&&rl(new Uint8Array(e),new Uint8Array(t))}function Gc(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function Kc(e,t){return e.byteLength===t.byteLength&&rl(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function qc(e,t){return Rc(e.getTime(),t.getTime())}function Jc(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function Yc(e,t){return e===t}function Xc(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.entries(),o,s,c=0;for(;(o=a.next())&&!o.done;){let r=t.entries(),a=!1,l=0;for(;(s=r.next())&&!s.done;){if(i[l]){l++;continue}let r=o.value,u=s.value;if(n.equals(r[0],u[0],c,l,e,t,n)&&n.equals(r[1],u[1],r[0],u[0],e,t,n)){a=i[l]=!0;break}l++}if(!a)return!1;c++}return!0}var Zc=Rc;function Qc(e,t,n){let r=Uc(e),i=r.length;if(Uc(t).length!==i)return!1;for(;i-- >0;)if(!al(e,t,n,r[i]))return!1;return!0}function $c(e,t,n){let r=Ic(e),i=r.length;if(Ic(t).length!==i)return!1;let a,o,s;for(;i-- >0;)if(a=r[i],!al(e,t,n,a)||(o=Hc(e,a),s=Hc(t,a),(o||s)&&(!o||!s||o.configurable!==s.configurable||o.enumerable!==s.enumerable||o.writable!==s.writable)))return!1;return!0}function el(e,t){return Rc(e.valueOf(),t.valueOf())}function tl(e,t){return e.source===t.source&&e.flags===t.flags}function nl(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.values(),o,s;for(;(o=a.next())&&!o.done;){let r=t.values(),a=!1,c=0;for(;(s=r.next())&&!s.done;){if(!i[c]&&n.equals(o.value,s.value,o.value,s.value,e,t,n)){a=i[c]=!0;break}c++}if(!a)return!1}return!0}function rl(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function il(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function al(e,t,n,r){return(r===Vc||r===Bc||r===zc)&&(e.$$typeof||t.$$typeof)?!0:Lc(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}var ol=`[object ArrayBuffer]`,sl=`[object Arguments]`,cl=`[object Boolean]`,ll=`[object DataView]`,ul=`[object Date]`,dl=`[object Error]`,fl=`[object Map]`,pl=`[object Number]`,ml=`[object Object]`,hl=`[object RegExp]`,gl=`[object Set]`,_l=`[object String]`,vl={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},yl=`[object URL]`,bl=Object.prototype.toString;function xl({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:a,areMapsEqual:o,areNumbersEqual:s,areObjectsEqual:c,arePrimitiveWrappersEqual:l,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:p,unknownTagComparators:m}){return function(h,g,_){if(h===g)return!0;if(h==null||g==null)return!1;let v=typeof h;if(v!==typeof g)return!1;if(v!==`object`)return v===`number`?s(h,g,_):v===`function`?a(h,g,_):!1;let y=h.constructor;if(y!==g.constructor)return!1;if(y===Object)return c(h,g,_);if(Array.isArray(h))return t(h,g,_);if(y===Date)return r(h,g,_);if(y===RegExp)return u(h,g,_);if(y===Map)return o(h,g,_);if(y===Set)return d(h,g,_);let b=bl.call(h);if(b===ul)return r(h,g,_);if(b===hl)return u(h,g,_);if(b===fl)return o(h,g,_);if(b===gl)return d(h,g,_);if(b===ml)return typeof h.then!=`function`&&typeof g.then!=`function`&&c(h,g,_);if(b===yl)return p(h,g,_);if(b===dl)return i(h,g,_);if(b===sl)return c(h,g,_);if(vl[b])return f(h,g,_);if(b===ol)return e(h,g,_);if(b===ll)return n(h,g,_);if(b===cl||b===pl||b===_l)return l(h,g,_);if(m){let e=m[b];if(!e){let t=Fc(h);t&&(e=m[t])}if(e)return e(h,g,_)}return!1}}function Sl({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:Wc,areArraysEqual:n?$c:Gc,areDataViewsEqual:Kc,areDatesEqual:qc,areErrorsEqual:Jc,areFunctionsEqual:Yc,areMapsEqual:n?Nc(Xc,$c):Xc,areNumbersEqual:Zc,areObjectsEqual:n?$c:Qc,arePrimitiveWrappersEqual:el,areRegExpsEqual:tl,areSetsEqual:n?Nc(nl,$c):nl,areTypedArraysEqual:n?Nc(rl,$c):rl,areUrlsEqual:il,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){let e=Pc(r.areArraysEqual),t=Pc(r.areMapsEqual),n=Pc(r.areObjectsEqual),i=Pc(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:n,areSetsEqual:i})}return r}function Cl(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function wl({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function(a,o){let{cache:s=e?new WeakMap:void 0,meta:c}=n();return t(a,o,{cache:s,equals:r,meta:c,strict:i})};if(e)return function(e,n){return t(e,n,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};let a={cache:void 0,equals:r,meta:void 0,strict:i};return function(e,n){return t(e,n,a)}}var Tl=El();El({strict:!0}),El({circular:!0}),El({circular:!0,strict:!0}),El({createInternalComparator:()=>Rc}),El({strict:!0,createInternalComparator:()=>Rc}),El({circular:!0,createInternalComparator:()=>Rc}),El({circular:!0,createInternalComparator:()=>Rc,strict:!0});function El(e={}){let{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,a=xl(Sl(e));return wl({circular:t,comparator:a,createState:r,equals:n?n(a):Cl(a),strict:i})}var Dl=t((e=>{var t=r(),n=Ja();function i(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var a=typeof Object.is==`function`?Object.is:i,o=n.useSyncExternalStore,s=t.useRef,c=t.useEffect,l=t.useMemo,u=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var d=s(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=l(function(){function e(e){if(!o){if(o=!0,s=e,e=r(e),i!==void 0&&f.hasValue){var t=f.value;if(i(t,e))return c=t}return c=e}if(t=c,a(s,e))return t;var n=r(e);return i!==void 0&&i(t,n)?(s=e,t):(s=e,c=n)}var o=!1,s,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,i]);var p=o(e,d[0],d[1]);return c(function(){f.hasValue=!0,f.value=p},[p]),u(p),p}})),Ol=t(((e,t)=>{t.exports=Dl()}))(),kl=(...e)=>t=>{e.forEach(e=>{typeof e==`function`?e(t):e&&(e.current=t)})},Al=({contentComponent:e})=>{let t=(0,fc.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getServerSnapshot);return(0,X.jsx)(X.Fragment,{children:Object.values(t)})};function jl(){let e=new Set,t={};return{subscribe(t){return e.add(t),()=>{e.delete(t)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(n,r){t={...t,[n]:Ga.createPortal(r.reactElement,r.element,n)},e.forEach(e=>e())},removeRenderer(n){let r={...t};delete r[n],t=r,e.forEach(e=>e())}}}var Ml=class extends Q.Component{constructor(e){super(e),this.editorContentRef=Q.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){let e=this.props.editor;if(e&&!e.isDestroyed&&e.view.dom?.parentNode){if(e.contentComponent)return;let t=this.editorContentRef.current;t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t}),e.contentComponent=jl(),e.createNodeViews(),e.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){let e=this.props.editor;if(e){e.isEditorContentInitialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),e.contentComponent=null;try{if(!e.view.dom?.parentNode)return;let t=document.createElement(`div`);t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t})}catch{}}}render(){let{editor:e,innerRef:t,...n}=this.props;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{ref:kl(t,this.editorContentRef),...n}),e?.contentComponent&&(0,X.jsx)(Al,{contentComponent:e.contentComponent})]})}},Nl=(0,Q.forwardRef)((e,t)=>{let n=Q.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[e.editor]);return Q.createElement(Ml,{key:n,innerRef:t,...e})}),Pl=Q.memo(Nl),Fl=typeof window<`u`?Q.useLayoutEffect:Q.useEffect,Il=class{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,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(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){let e=()=>{this.transactionNumber+=1,this.subscribers.forEach(e=>e())},t=this.editor;return t.on(`transaction`,e),()=>{t.off(`transaction`,e)}}}};function Ll(e){let[t]=(0,Q.useState)(()=>new Il(e.editor)),n=(0,Ol.useSyncExternalStoreWithSelector)(t.subscribe,t.getSnapshot,t.getServerSnapshot,e.selector,e.equalityFn??Tl);return Fl(()=>t.watch(e.editor),[e.editor,t]),(0,Q.useDebugValue)(n),n}var Rl=!1,zl=typeof window>`u`,Bl=zl||!!(typeof window<`u`&&window.next),Vl=class e{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(e=>e())}getInitialEditor(){if(this.options.current.immediatelyRender===void 0){if(zl||Bl){if(Rl)throw 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&&zl&&Rl)throw 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(){return new xt({...this.options.current,onBeforeCreate:(...e)=>{var t;return(t=this.options.current).onBeforeCreate?.call(t,...e)},onBlur:(...e)=>{var t;return(t=this.options.current).onBlur?.call(t,...e)},onCreate:(...e)=>{var t;return(t=this.options.current).onCreate?.call(t,...e)},onDestroy:(...e)=>{var t;return(t=this.options.current).onDestroy?.call(t,...e)},onFocus:(...e)=>{var t;return(t=this.options.current).onFocus?.call(t,...e)},onSelectionUpdate:(...e)=>{var t;return(t=this.options.current).onSelectionUpdate?.call(t,...e)},onTransaction:(...e)=>{var t;return(t=this.options.current).onTransaction?.call(t,...e)},onUpdate:(...e)=>{var t;return(t=this.options.current).onUpdate?.call(t,...e)},onContentError:(...e)=>{var t;return(t=this.options.current).onContentError?.call(t,...e)},onDrop:(...e)=>{var t;return(t=this.options.current).onDrop?.call(t,...e)},onPaste:(...e)=>{var t;return(t=this.options.current).onPaste?.call(t,...e)},onDelete:(...e)=>{var t;return(t=this.options.current).onDelete?.call(t,...e)}})}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(n=>[`onCreate`,`onBeforeCreate`,`onDestroy`,`onUpdate`,`onTransaction`,`onFocus`,`onBlur`,`onSelectionUpdate`,`onContentError`,`onDrop`,`onPaste`].includes(n)?!0:n===`extensions`&&e.extensions&&t.extensions?e.extensions.length===t.extensions.length?e.extensions.every((e,n)=>e===t.extensions?.[n]):!1:e[n]===t[n])}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&t.length===0?e.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{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((t,n)=>t===e[n]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){let e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){t&&t.setOptions(this.options.current);return}t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function Hl(e={},t=[]){let n=(0,Q.useRef)(e);n.current=e;let[r]=(0,Q.useState)(()=>new Vl(n)),i=(0,fc.useSyncExternalStore)(r.subscribe,r.getEditor,r.getServerSnapshot);return(0,Q.useDebugValue)(i),(0,Q.useEffect)(r.onRender(t)),Ll({editor:i,selector:({transactionNumber:t})=>e.shouldRerenderOnTransaction===!1||e.shouldRerenderOnTransaction===void 0?null:e.immediatelyRender&&t===0?0:t+1}),i}var Ul=(0,Q.createContext)({editor:null});Ul.Consumer;var Wl=()=>(0,Q.useContext)(Ul),Gl=(0,Q.createContext)({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),Kl=()=>(0,Q.useContext)(Gl);function ql({as:e=`div`,...t}){let{nodeViewContentRef:n,nodeViewContentChildren:r}=Kl();return(0,X.jsx)(e,{...t,ref:n,"data-node-view-content":``,style:{whiteSpace:`pre-wrap`,...t.style},children:r})}var Jl=Q.forwardRef((e,t)=>{let{onDragStart:n}=Kl();return(0,X.jsx)(e.as||`div`,{...e,ref:t,"data-node-view-wrapper":``,onDragStart:n,style:{whiteSpace:`normal`,...e.style}})});function Yl(e){return!!(typeof e==`function`&&e.prototype&&e.prototype.isReactComponent)}function Xl(e){return!!(typeof e==`object`&&e.$$typeof&&(e.$$typeof.toString()===`Symbol(react.forward_ref)`||e.$$typeof.description===`react.forward_ref`))}function Zl(e){return!!(typeof e==`object`&&e.$$typeof&&(e.$$typeof.toString()===`Symbol(react.memo)`||e.$$typeof.description===`react.memo`))}function Ql(e){if(Yl(e)||Xl(e))return!0;if(Zl(e)){let t=e.type;if(t)return Yl(t)||Xl(t)}return!1}function $l(){try{if(Q.version)return parseInt(Q.version.split(`.`)[0],10)>=19}catch{}return!1}var eu=class{constructor(e,{editor:t,props:n={},as:r=`div`,className:i=``}){this.ref=null,this.destroyed=!1,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=e,this.editor=t,this.props=n,this.element=document.createElement(r),this.element.classList.add(`react-renderer`),i&&this.element.classList.add(...i.split(` `)),this.editor.isEditorContentInitialized?(0,Ga.flushSync)(()=>{this.render()}):queueMicrotask(()=>{this.destroyed||this.render()})}render(){var e;if(this.destroyed)return;let t=this.component,n=this.props,r=this.editor,i=$l(),a=Ql(t),o={...n};o.ref&&!(i||a)&&delete o.ref,!o.ref&&(i||a)&&(o.ref=e=>{this.ref=e}),this.reactElement=(0,X.jsx)(t,{...o}),(e=r?.contentComponent)==null||e.setRenderer(this.id,this)}updateProps(e={}){this.destroyed||(this.props={...this.props,...e},this.render())}destroy(){var e;this.destroyed=!0,(e=this.editor?.contentComponent)==null||e.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(e){Object.keys(e).forEach(t=>{this.element.setAttribute(t,e[t])})}};Q.createContext({markViewContentRef:()=>{}});var tu=class extends Ee{constructor(e,t,n){if(super(e,t,n),this.selectionRafId=null,this.positionCheckCallback=null,this.cachedExtensionWithSyncedStorage=null,!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?`span`:`div`),this.contentDOMElement.dataset.nodeViewContentReact=``,this.contentDOMElement.dataset.nodeViewWrapper=``,this.contentDOMElement.style.whiteSpace=`inherit`;let e=this.dom.querySelector(`[data-node-view-content]`);if(!e)return;e.appendChild(this.contentDOMElement)}}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){let e=this.editor,t=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(t,{get(n,r,i){return r===`storage`?e.storage[t.name]??{}:Reflect.get(n,r,i)}})}return this.cachedExtensionWithSyncedStorage}mount(){let e={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extensionWithSyncedStorage,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(e={})=>this.updateAttributes(e),deleteNode:()=>this.deleteNode(),ref:(0,Q.createRef)()};if(!this.component.displayName){let e=e=>e.charAt(0).toUpperCase()+e.substring(1);this.component.displayName=e(this.extension.name)}let t={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:e=>{e&&this.contentDOMElement&&e.firstChild!==this.contentDOMElement&&(e.hasAttribute(`data-node-view-wrapper`)&&e.removeAttribute(`data-node-view-wrapper`),e.appendChild(this.contentDOMElement))}},n=this.component,r=(0,Q.memo)(e=>(0,X.jsx)(Gl.Provider,{value:t,children:(0,Q.createElement)(n,e)}));r.displayName=`ReactNodeView`;let i=this.node.isInline?`span`:`div`;this.options.as&&(i=this.options.as);let{className:a=``}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new eu(r,{editor:this.editor,props:e,as:i,className:`node-${this.node.type.name} ${a}`.trim()}),this.editor.on(`selectionUpdate`,this.handleSelectionUpdate),this.updateElementAttributes(),this.currentPos=this.getPos(),this.positionCheckCallback=()=>{let e=this.getPos();typeof e!=`number`||e===this.currentPos||(this.currentPos=e,this.renderer.updateProps({getPos:()=>this.getPos()}),typeof this.options.attrs==`function`&&this.updateElementAttributes())},Be(this.editor,this.positionCheckCallback)}get dom(){if(this.renderer.element.firstElementChild&&!this.renderer.element.firstElementChild?.hasAttribute(`data-node-view-wrapper`))throw Error(`Please use the NodeViewWrapper component for your node view.`);return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){this.selectionRafId&&=(cancelAnimationFrame(this.selectionRafId),null),this.selectionRafId=requestAnimationFrame(()=>{this.selectionRafId=null;let{from:e,to:t}=this.editor.state.selection,n=this.currentPos;if(typeof n==`number`)if(e<=n&&t>=n+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}})}update(e,t,n){let r=e=>{this.renderer.updateProps(e),typeof this.options.attrs==`function`&&this.updateElementAttributes()};if(e.type!==this.node.type)return!1;if(typeof this.options.update==`function`){let i=this.node,a=this.decorations,o=this.innerDecorations;return this.node=e,this.decorations=t,this.innerDecorations=n,this.currentPos=this.getPos(),this.options.update({oldNode:i,oldDecorations:a,newNode:e,newDecorations:t,oldInnerDecorations:o,innerDecorations:n,updateProps:()=>r({node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage})})}let i=this.getPos();return e===this.node&&this.decorations===t&&this.innerDecorations===n?i===this.currentPos?!0:(this.currentPos=i,r({node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage,getPos:()=>this.getPos()}),!0):(this.node=e,this.decorations=t,this.innerDecorations=n,this.currentPos=i,r({node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage}),!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.positionCheckCallback&&=(re(this.editor,this.positionCheckCallback),null),this.contentDOMElement=null,this.selectionRafId&&=(cancelAnimationFrame(this.selectionRafId),null)}updateElementAttributes(){if(this.options.attrs){let e={};if(typeof this.options.attrs==`function`){let t=this.editor.extensionManager.attributes,n=Et(this.node,t);e=this.options.attrs({node:this.node,HTMLAttributes:n})}else e=this.options.attrs;this.renderer.updateAttributes(e)}}};function nu(e,t){return n=>n.editor.contentComponent?new tu(e,n,t):{}}var ru=(0,Q.createContext)({get editor(){throw Error(`useTiptap must be used within a <Tiptap> provider`)}});ru.displayName=`TiptapContext`;var iu=()=>(0,Q.useContext)(ru);function au({editor:e,instance:t,children:n}){let r=e??t;if(!r)throw Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");let i=(0,Q.useMemo)(()=>({editor:r}),[r]),a=(0,Q.useMemo)(()=>({editor:r}),[r]);return(0,X.jsx)(Ul.Provider,{value:a,children:(0,X.jsx)(ru.Provider,{value:i,children:n})})}au.displayName=`Tiptap`;function ou({...e}){let{editor:t}=iu();return(0,X.jsx)(Pl,{editor:t,...e})}ou.displayName=`Tiptap.Content`,Object.assign(au,{Content:ou});var su=()=>new Map,cu=e=>{let t=su();return e.forEach((e,n)=>{t.set(n,e)}),t},lu=(e,t,n)=>{let r=e.get(t);return r===void 0&&e.set(t,r=n()),r},uu=(e,t)=>{let n=[];for(let[r,i]of e)n.push(t(i,r));return n},du=(e,t)=>{for(let[n,r]of e)if(t(r,n))return!0;return!1},fu=()=>new Set,pu=e=>e[e.length-1],mu=(e,t)=>{for(let n=0;n<t.length;n++)e.push(t[n])},hu=Array.from,gu=(e,t)=>{for(let n=0;n<e.length;n++)if(!t(e[n],n,e))return!1;return!0},_u=(e,t)=>{for(let n=0;n<e.length;n++)if(t(e[n],n,e))return!0;return!1},vu=(e,t)=>{let n=Array(e);for(let r=0;r<e;r++)n[r]=t(r,n);return n},yu=Array.isArray,bu=class{constructor(){this._observers=su()}on(e,t){return lu(this._observers,e,fu).add(t),t}once(e,t){let n=(...r)=>{this.off(e,n),t(...r)};this.on(e,n)}off(e,t){let n=this._observers.get(e);n!==void 0&&(n.delete(t),n.size===0&&this._observers.delete(e))}emit(e,t){return hu((this._observers.get(e)||su()).values()).forEach(e=>e(...t))}destroy(){this._observers=su()}},xu=class{constructor(){this._observers=su()}on(e,t){lu(this._observers,e,fu).add(t)}once(e,t){let n=(...r)=>{this.off(e,n),t(...r)};this.on(e,n)}off(e,t){let n=this._observers.get(e);n!==void 0&&(n.delete(t),n.size===0&&this._observers.delete(e))}emit(e,t){return hu((this._observers.get(e)||su()).values()).forEach(e=>e(...t))}destroy(){this._observers=su()}},Su=Math.floor,Cu=Math.abs,wu=(e,t)=>e<t?e:t,Tu=(e,t)=>e>t?e:t;Number.isNaN;var Eu=e=>e===0?1/e<0:e<0,Du=1<<17,Ou=1<<18,ku=1<<19,Au=1<<20,ju=1<<21,Mu=1<<22,Nu=1<<23,Pu=1<<24,Fu=1<<25,Iu=1<<26,Lu=1<<27,Ru=1<<28,zu=1<<29;Du-1,Ou-1,ku-1,Au-1,ju-1,Mu-1,Nu-1,Pu-1,Fu-1,Iu-1,Lu-1,Ru-1,zu-1;var Bu=2**53-1,Vu=-(2**53-1),Hu=Number.isInteger||(e=>typeof e==`number`&&isFinite(e)&&Su(e)===e);Number.isNaN,Number.parseInt;var Uu=String.fromCharCode;String.fromCodePoint,Uu(65535);var Wu=e=>e.toLowerCase(),Gu=/^\s*/g,Ku=e=>e.replace(Gu,``),qu=/([A-Z])/g,Ju=(e,t)=>Ku(e.replace(qu,e=>`${t}${Wu(e)}`)),Yu=e=>{let t=unescape(encodeURIComponent(e)),n=t.length,r=new Uint8Array(n);for(let e=0;e<n;e++)r[e]=t.codePointAt(e);return r},Xu=typeof TextEncoder<`u`?new TextEncoder:null,Zu=Xu?e=>Xu.encode(e):Yu,Qu=typeof TextDecoder>`u`?null:new TextDecoder(`utf-8`,{fatal:!0,ignoreBOM:!0});Qu&&Qu.decode(new Uint8Array).length===1&&(Qu=null);var $u=(e,t)=>vu(t,()=>e).join(``),ed=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}},td=()=>new ed,nd=e=>{let t=td();return e(t),id(t)},rd=e=>{let t=e.cpos;for(let n=0;n<e.bufs.length;n++)t+=e.bufs[n].length;return t},id=e=>{let t=new Uint8Array(rd(e)),n=0;for(let r=0;r<e.bufs.length;r++){let i=e.bufs[r];t.set(i,n),n+=i.length}return t.set(new Uint8Array(e.cbuf.buffer,0,e.cpos),n),t},ad=(e,t)=>{let n=e.cbuf.length;n-e.cpos<t&&(e.bufs.push(new Uint8Array(e.cbuf.buffer,0,e.cpos)),e.cbuf=new Uint8Array(Tu(n,t)*2),e.cpos=0)},od=(e,t)=>{let n=e.cbuf.length;e.cpos===n&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(n*2),e.cpos=0),e.cbuf[e.cpos++]=t},sd=od,cd=(e,t)=>{for(;t>127;)od(e,128|127&t),t=Su(t/128);od(e,127&t)},ld=(e,t)=>{let n=Eu(t);for(n&&(t=-t),od(e,(t>63?128:0)|(n?64:0)|63&t),t=Su(t/64);t>0;)od(e,(t>127?128:0)|127&t),t=Su(t/128)},ud=new Uint8Array(3e4),dd=ud.length/3,fd=Xu&&Xu.encodeInto?(e,t)=>{if(t.length<dd){let n=Xu.encodeInto(t,ud).written||0;cd(e,n);for(let t=0;t<n;t++)od(e,ud[t])}else md(e,Zu(t))}:(e,t)=>{let n=unescape(encodeURIComponent(t)),r=n.length;cd(e,r);for(let t=0;t<r;t++)od(e,n.codePointAt(t))},pd=(e,t)=>{let n=e.cbuf.length,r=e.cpos,i=wu(n-r,t.length),a=t.length-i;e.cbuf.set(t.subarray(0,i),r),e.cpos+=i,a>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(Tu(n*2,a)),e.cbuf.set(t.subarray(i)),e.cpos=a)},md=(e,t)=>{cd(e,t.byteLength),pd(e,t)},hd=(e,t)=>{ad(e,t);let n=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,n},gd=(e,t)=>hd(e,4).setFloat32(0,t,!1),_d=(e,t)=>hd(e,8).setFloat64(0,t,!1),vd=(e,t)=>hd(e,8).setBigInt64(0,t,!1),yd=new DataView(new ArrayBuffer(4)),bd=e=>(yd.setFloat32(0,e),yd.getFloat32(0)===e),xd=(e,t)=>{switch(typeof t){case`string`:od(e,119),fd(e,t);break;case`number`:Hu(t)&&Cu(t)<=2147483647?(od(e,125),ld(e,t)):bd(t)?(od(e,124),gd(e,t)):(od(e,123),_d(e,t));break;case`bigint`:od(e,122),vd(e,t);break;case`object`:if(t===null)od(e,126);else if(yu(t)){od(e,117),cd(e,t.length);for(let n=0;n<t.length;n++)xd(e,t[n])}else if(t instanceof Uint8Array)od(e,116),md(e,t);else{od(e,118);let n=Object.keys(t);cd(e,n.length);for(let r=0;r<n.length;r++){let i=n[r];fd(e,i),xd(e,t[i])}}break;case`boolean`:od(e,t?120:121);break;default:od(e,127)}},Sd=class extends ed{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&cd(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}},Cd=e=>{e.count>0&&(ld(e.encoder,e.count===1?e.s:-e.s),e.count>1&&cd(e.encoder,e.count-2))},wd=class{constructor(){this.encoder=new ed,this.s=0,this.count=0}write(e){this.s===e?this.count++:(Cd(this),this.count=1,this.s=e)}toUint8Array(){return Cd(this),id(this.encoder)}},Td=e=>{if(e.count>0){let t=e.diff*2+(e.count===1?0:1);ld(e.encoder,t),e.count>1&&cd(e.encoder,e.count-2)}},Ed=class{constructor(){this.encoder=new ed,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(Td(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return Td(this),id(this.encoder)}},Dd=class{constructor(){this.sarr=[],this.s=``,this.lensE=new wd}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=``),this.lensE.write(e.length)}toUint8Array(){let e=new ed;return this.sarr.push(this.s),this.s=``,fd(e,this.sarr.join(``)),pd(e,this.lensE.toUint8Array()),id(e)}},Od=e=>Error(e),kd=()=>{throw Od(`Method unimplemented`)},Ad=()=>{throw Od(`Unexpected case`)},jd=Od(`Unexpected end of array`),Md=Od(`Integer out of Range`),Nd=class{constructor(e){this.arr=e,this.pos=0}},Pd=e=>new Nd(e),Fd=e=>e.pos!==e.arr.length,Id=(e,t)=>{let n=new Uint8Array(e.arr.buffer,e.pos+e.arr.byteOffset,t);return e.pos+=t,n},Ld=e=>Id(e,zd(e)),Rd=e=>e.arr[e.pos++],zd=e=>{let t=0,n=1,r=e.arr.length;for(;e.pos<r;){let r=e.arr[e.pos++];if(t+=(r&127)*n,n*=128,r<128)return t;if(t>Bu)throw Md}throw jd},Bd=e=>{let t=e.arr[e.pos++],n=t&63,r=64,i=(t&64)>0?-1:1;if(!(t&128))return i*n;let a=e.arr.length;for(;e.pos<a;){if(t=e.arr[e.pos++],n+=(t&127)*r,r*=128,t<128)return i*n;if(n>Bu)throw Md}throw jd},Vd=Qu?e=>Qu.decode(Ld(e)):e=>{let t=zd(e);if(t===0)return``;{let n=String.fromCodePoint(Rd(e));if(--t<100)for(;t--;)n+=String.fromCodePoint(Rd(e));else for(;t>0;){let r=t<1e4?t:1e4,i=e.arr.subarray(e.pos,e.pos+r);e.pos+=r,n+=String.fromCodePoint.apply(null,i),t-=r}return decodeURIComponent(escape(n))}},Hd=(e,t)=>{let n=new DataView(e.arr.buffer,e.arr.byteOffset+e.pos,t);return e.pos+=t,n},Ud=[e=>void 0,e=>null,Bd,e=>Hd(e,4).getFloat32(0,!1),e=>Hd(e,8).getFloat64(0,!1),e=>Hd(e,8).getBigInt64(0,!1),e=>!1,e=>!0,Vd,e=>{let t=zd(e),n={};for(let r=0;r<t;r++){let t=Vd(e);n[t]=Wd(e)}return n},e=>{let t=zd(e),n=[];for(let r=0;r<t;r++)n.push(Wd(e));return n},Ld],Wd=e=>Ud[127-Rd(e)](e),Gd=class extends Nd{constructor(e,t){super(e),this.reader=t,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),Fd(this)?this.count=zd(this)+1:this.count=-1),this.count--,this.s}},Kd=class extends Nd{constructor(e){super(e),this.s=0,this.count=0}read(){if(this.count===0){this.s=Bd(this);let e=Eu(this.s);this.count=1,e&&(this.s=-this.s,this.count=zd(this)+2)}return this.count--,this.s}},qd=class extends Nd{constructor(e){super(e),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){let e=Bd(this),t=e&1;this.diff=Su(e/2),this.count=1,t&&(this.count=zd(this)+2)}return this.s+=this.diff,this.count--,this.s}},Jd=class{constructor(e){this.decoder=new Kd(e),this.str=Vd(this.decoder),this.spos=0}read(){let e=this.spos+this.decoder.read(),t=this.str.slice(this.spos,e);return this.spos=e,t}};crypto.subtle;var Yd=crypto.getRandomValues.bind(crypto),Xd=Math.random,Zd=()=>Yd(new Uint32Array(1))[0],Qd=e=>e[Su(Xd()*e.length)],$d=`10000000-1000-4000-8000-100000000000`,ef=()=>$d.replace(/[018]/g,e=>(e^Zd()&15>>e/4).toString(16)),tf=Date.now,nf=e=>new Promise(e);Promise.all.bind(Promise);var rf=e=>e===void 0?null:e,af=new class{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}};try{typeof localStorage<`u`&&localStorage&&(af=localStorage)}catch{}var of=af,sf=Symbol(`Equality`),cf=(e,t)=>e===t||!!e?.[sf]?.(t)||!1,lf=e=>typeof e==`object`,uf=Object.assign,df=Object.keys,ff=(e,t)=>{for(let n in e)t(e[n],n)},pf=e=>df(e).length,mf=e=>{for(let t in e)return!1;return!0},hf=(e,t)=>{for(let n in e)if(!t(e[n],n))return!1;return!0},gf=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),_f=(e,t)=>e===t||pf(e)===pf(t)&&hf(e,(e,n)=>(e!==void 0||gf(t,n))&&cf(t[n],e)),vf=Object.freeze,yf=e=>{for(let t in e){let n=e[t];(typeof n==`object`||typeof n==`function`)&&yf(e[t])}return vf(e)},bf=(e,t,n=0)=>{try{for(;n<e.length;n++)e[n](...t)}finally{n<e.length&&bf(e,t,n+1)}},xf=e=>e,Sf=(e,t)=>{if(e===t)return!0;if(e==null||t==null||e.constructor!==t.constructor&&(e.constructor||Object)!==(t.constructor||Object))return!1;if(e[sf]!=null)return e[sf](t);switch(e.constructor){case ArrayBuffer:e=new Uint8Array(e),t=new Uint8Array(t);case Uint8Array:if(e.byteLength!==t.byteLength)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;break;case Set:if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;break;case Map:if(e.size!==t.size)return!1;for(let n of e.keys())if(!t.has(n)||!Sf(e.get(n),t.get(n)))return!1;break;case void 0:case Object:if(pf(e)!==pf(t))return!1;for(let n in e)if(!gf(e,n)||!Sf(e[n],t[n]))return!1;break;case Array:if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Sf(e[n],t[n]))return!1;break;default:return!1}return!0},Cf=(e,t)=>t.includes(e),wf=typeof process<`u`&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<`u`?process:0)===`[object process]`,Tf=typeof window<`u`&&typeof document<`u`&&!wf;typeof navigator<`u`&&/Mac/.test(navigator.platform);var Ef,Df=[],Of=()=>{if(Ef===void 0)if(wf){Ef=su();let e=process.argv,t=null;for(let n=0;n<e.length;n++){let r=e[n];r[0]===`-`?(t!==null&&Ef.set(t,``),t=r):t===null?Df.push(r):(Ef.set(t,r),t=null)}t!==null&&Ef.set(t,``)}else typeof location==`object`?(Ef=su(),(location.search||`?`).slice(1).split(`&`).forEach(e=>{if(e.length!==0){let[t,n]=e.split(`=`);Ef.set(`--${Ju(t,`-`)}`,n),Ef.set(`-${Ju(t,`-`)}`,n)}})):Ef=su();return Ef},kf=e=>Of().has(e),Af=e=>rf(wf?{}[e.toUpperCase().replaceAll(`-`,`_`)]:of.getItem(e)),jf=e=>kf(`--`+e)||Af(e)!==null,Mf=jf(`production`),Nf=wf&&Cf({}.FORCE_COLOR,[`true`,`1`,`2`])||!kf(`--no-colors`)&&!jf(`no-color`)&&(!wf||process.stdout.isTTY)&&(!wf||kf(`--color`)||Af(`COLORTERM`)!==null||(Af(`TERM`)||``).includes(`color`)),Pf=e=>new Uint8Array(e),Ff=Tf?e=>{let t=``;for(let n=0;n<e.byteLength;n++)t+=Uu(e[n]);return btoa(t)}:e=>Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString(`base64`),If=e=>{let t=Pf(e.byteLength);return t.set(e),t},Lf=e=>nd(t=>xd(t,e)),Rf=class{constructor(e,t){this.left=e,this.right=t}},zf=(e,t)=>new Rf(e,t),Bf=(e,t)=>e.forEach(e=>t(e.left,e.right)),Vf=e=>e.next()>=.5,Hf=(e,t,n)=>Su(e.next()*(n+1-t)+t),Uf=(e,t,n)=>Su(e.next()*(n+1-t)+t),Wf=(e,t,n)=>Uf(e,t,n),Gf=e=>Uu(Wf(e,97,122)),Kf=(e,t=0,n=20)=>{let r=Wf(e,t,n),i=``;for(let t=0;t<r;t++)i+=Gf(e);return i},qf=(e,t)=>t[Wf(e,0,t.length-1)],Jf=Symbol(`0schema`),Yf=class{constructor(){this._rerrs=[]}extend(e,t,n,r=null){this._rerrs.push({path:e,expected:t,has:n,message:r})}toString(){let e=[];for(let t=this._rerrs.length-1;t>0;t--){let n=this._rerrs[t];e.push($u(` `,(this._rerrs.length-t)*2)+`${n.path==null?``:`[${n.path}] `}${n.has} doesn't match ${n.expected}. ${n.message}`)}return e.join(`
|
|
3
3
|
`)}},Xf=(e,t)=>e===t?!0:e==null||t==null||e.constructor!==t.constructor?!1:e[sf]?cf(e,t):yu(e)?gu(e,e=>_u(t,t=>Xf(e,t))):lf(e)?hf(e,(e,n)=>Xf(e,t[n])):!1,Zf=class{static _dilutes=!1;extends(e){let[t,n]=[this.shape,e.shape];return this.constructor._dilutes&&([n,t]=[t,n]),Xf(t,n)}equals(e){return this.constructor===e.constructor&&Sf(this.shape,e.shape)}[Jf](){return!0}[sf](e){return this.equals(e)}validate(e){return this.check(e)}check(e,t){kd()}get nullable(){return Ap(this,Gp)}get optional(){return new cp(this)}cast(e){return Yp(e,this),e}expect(e){return Yp(e,this),e}},Qf=class extends Zf{constructor(e,t){super(),this.shape=e,this._c=t}check(e,t=void 0){let n=e?.constructor===this.shape&&(this._c==null||this._c(e));return!n&&t?.extend(null,this.shape.name,e?.constructor.name,e?.constructor===this.shape?`Check failed`:`Constructor match failed`),n}},$f=(e,t=null)=>new Qf(e,t);$f(Qf);var ep=class extends Zf{constructor(e){super(),this.shape=e}check(e,t){let n=this.shape(e);return!n&&t?.extend(null,`custom prop`,e?.constructor.name,`failed to check custom prop`),n}},tp=e=>new ep(e);$f(ep);var np=class extends Zf{constructor(e){super(),this.shape=e}check(e,t){let n=this.shape.some(t=>t===e);return!n&&t?.extend(null,this.shape.join(` | `),e.toString()),n}},rp=(...e)=>new np(e),ip=$f(np),ap=RegExp.escape||(e=>e.replace(/[().|&,$^[\]]/g,e=>`\\`+e)),op=e=>{if(Bp.check(e))return[ap(e)];if(ip.check(e))return e.shape.map(e=>e+``);if(zp.check(e))return[`[+-]?\\d+.?\\d*`];if(Vp.check(e))return[`.*`];if(jp.check(e))return e.shape.map(op).flat(1);Ad()};$f(class extends Zf{constructor(e){super(),this.shape=e,this._r=RegExp(`^`+e.map(op).map(e=>`(${e.join(`|`)})`).join(``)+`$`)}check(e,t){let n=this._r.exec(e)!=null;return!n&&t?.extend(null,this._r.toString(),e.toString(),`String doesn't match string template.`),n}});var sp=Symbol(`optional`),cp=class extends Zf{constructor(e){super(),this.shape=e}check(e,t){let n=e===void 0||this.shape.check(e);return!n&&t?.extend(null,`undefined (optional)`,`()`),n}get[sp](){return!0}},lp=$f(cp),up=class extends Zf{check(e,t){return t?.extend(null,`never`,typeof e),!1}};new up,$f(up);var dp=class e extends Zf{constructor(e,t=!1){super(),this.shape=e,this._isPartial=t}static _dilutes=!0;get partial(){return new e(this.shape,!0)}check(e,t){return e==null?(t?.extend(null,`object`,`null`),!1):hf(this.shape,(n,r)=>{let i=this._isPartial&&!gf(e,r)||n.check(e[r],t);return!i&&t?.extend(r.toString(),n.toString(),typeof e[r],`Object property does not match`),i})}},fp=e=>new dp(e),pp=$f(dp),mp=tp(e=>e!=null&&(e.constructor===Object||e.constructor==null)),hp=class extends Zf{constructor(e,t){super(),this.shape={keys:e,values:t}}check(e,t){return e!=null&&hf(e,(n,r)=>{let i=this.shape.keys.check(r,t);return!i&&t?.extend(r+``,`Record`,typeof e,i?`Key doesn't match schema`:`Value doesn't match value`),i&&this.shape.values.check(n,t)})}},gp=(e,t)=>new hp(e,t),_p=$f(hp),vp=class extends Zf{constructor(e){super(),this.shape=e}check(e,t){return e!=null&&hf(this.shape,(n,r)=>{let i=n.check(e[r],t);return!i&&t?.extend(r.toString(),`Tuple`,typeof n),i})}},yp=(...e)=>new vp(e);$f(vp);var bp=class extends Zf{constructor(e){super(),this.shape=e.length===1?e[0]:new kp(e)}check(e,t){let n=yu(e)&&gu(e,e=>this.shape.check(e));return!n&&t?.extend(null,`Array`,``),n}},xp=(...e)=>new bp(e),Sp=$f(bp),Cp=tp(e=>yu(e)),wp=class extends Zf{constructor(e,t){super(),this.shape=e,this._c=t}check(e,t){let n=e instanceof this.shape&&(this._c==null||this._c(e));return!n&&t?.extend(null,this.shape.name,e?.constructor.name),n}},Tp=(e,t=null)=>new wp(e,t);$f(wp);var Ep=Tp(Zf),Dp=$f(class extends Zf{constructor(e){super(),this.len=e.length-1,this.args=yp(...e.slice(-1)),this.res=e[this.len]}check(e,t){let n=e.constructor===Function&&e.length<=this.len;return!n&&t?.extend(null,`function`,typeof e),n}}),Op=tp(e=>typeof e==`function`);$f(class extends Zf{constructor(e){super(),this.shape=e}check(e,t){let n=gu(this.shape,n=>n.check(e,t));return!n&&t?.extend(null,`Intersectinon`,typeof e),n}},e=>e.shape.length>0);var kp=class extends Zf{static _dilutes=!0;constructor(e){super(),this.shape=e}check(e,t){let n=_u(this.shape,n=>n.check(e,t));return t?.extend(null,`Union`,typeof e),n}},Ap=(...e)=>e.findIndex(e=>jp.check(e))>=0?Ap(...e.map(e=>Jp(e)).map(e=>jp.check(e)?e.shape:[e]).flat(1)):e.length===1?e[0]:new kp(e),jp=$f(kp),Mp=()=>!0,Np=tp(Mp),Pp=$f(ep,e=>e.shape===Mp),Fp=tp(e=>typeof e==`bigint`),Ip=tp(e=>e===Fp),Lp=tp(e=>typeof e==`symbol`);tp(e=>e===Lp);var Rp=tp(e=>typeof e==`number`),zp=tp(e=>e===Rp),Bp=tp(e=>typeof e==`string`),Vp=tp(e=>e===Bp),Hp=tp(e=>typeof e==`boolean`),Up=tp(e=>e===Hp),Wp=rp(void 0);$f(np,e=>e.shape.length===1&&e.shape[0]===void 0),rp(void 0);var Gp=rp(null),Kp=$f(np,e=>e.shape.length===1&&e.shape[0]===null);$f(Uint8Array),$f(Qf,e=>e.shape===Uint8Array);var qp=Ap(Rp,Bp,Gp,Wp,Fp,Hp,Lp);(()=>{let e=xp(Np),t=gp(Bp,Np),n=Ap(Rp,Bp,Gp,Hp,e,t);return e.shape=n,t.shape.values=n,n})();var Jp=e=>{if(Ep.check(e))return e;if(mp.check(e)){let t={};for(let n in e)t[n]=Jp(e[n]);return fp(t)}else if(Cp.check(e))return Ap(...e.map(Jp));else if(qp.check(e))return rp(e);else if(Op.check(e))return $f(e);Ad()},Yp=Mf?()=>{}:(e,t)=>{let n=new Yf;if(!t.check(e,n))throw Od(`Expected value to be of type ${t.constructor.name}.\n${n.toString()}`)},Xp=class{constructor(e){this.patterns=[],this.$state=e}if(e,t){return this.patterns.push({if:Jp(e),h:t}),this}else(e){return this.if(Np,e)}done(){return(e,t)=>{for(let n=0;n<this.patterns.length;n++){let r=this.patterns[n];if(r.if.check(e))return r.h(e,t)}throw Od(`Unhandled pattern`)}}},Zp=(e=>new Xp(e))(Np).if(zp,(e,t)=>Hf(t,Vu,Bu)).if(Vp,(e,t)=>Kf(t)).if(Up,(e,t)=>Vf(t)).if(Ip,(e,t)=>BigInt(Hf(t,Vu,Bu))).if(jp,(e,t)=>Qp(t,qf(t,e.shape))).if(pp,(e,t)=>{let n={};for(let r in e.shape){let i=e.shape[r];if(lp.check(i)){if(Vf(t))continue;i=i.shape}n[r]=Zp(i,t)}return n}).if(Sp,(e,t)=>{let n=[],r=Uf(t,0,42);for(let i=0;i<r;i++)n.push(Qp(t,e.shape));return n}).if(ip,(e,t)=>qf(t,e.shape)).if(Kp,(e,t)=>null).if(Dp,(e,t)=>{let n=Qp(t,e.res);return()=>n}).if(Pp,(e,t)=>Qp(t,qf(t,[Rp,Bp,Gp,Wp,Fp,Hp,xp(Rp),gp(Ap(`a`,`b`,`c`),Rp)]))).if(_p,(e,t)=>{let n={},r=Hf(t,0,3);for(let i=0;i<r;i++){let r=Qp(t,e.shape.keys);n[r]=Qp(t,e.shape.values)}return n}).done(),Qp=(e,t)=>Zp(Jp(t),e),$p=typeof document<`u`?document:{},em=e=>$p.createElement(e),tm=()=>$p.createDocumentFragment();tp(e=>e.nodeType===pm);var nm=e=>$p.createTextNode(e);typeof DOMParser<`u`&&new DOMParser;var rm=(e,t)=>(Bf(t,(t,n)=>{n===!1?e.removeAttribute(t):n===!0?e.setAttribute(t,``):e.setAttribute(t,n)}),e),im=e=>{let t=tm();for(let n=0;n<e.length;n++)lm(t,e[n]);return t},am=(e,t)=>(lm(e,im(t)),e),om=(e,t=[],n=[])=>am(rm(em(e),t),n);tp(e=>e.nodeType===um);var sm=nm;tp(e=>e.nodeType===dm);var cm=e=>uu(e,(e,t)=>`${t}:${e};`).join(``),lm=(e,t)=>e.appendChild(t),um=$p.ELEMENT_NODE,dm=$p.TEXT_NODE;$p.CDATA_SECTION_NODE,$p.COMMENT_NODE;var fm=$p.DOCUMENT_NODE;$p.DOCUMENT_TYPE_NODE;var pm=$p.DOCUMENT_FRAGMENT_NODE;tp(e=>e.nodeType===fm);var mm=(e=>class{constructor(e){this._=e}destroy(){e(this._)}})(clearTimeout),hm=(e,t)=>new mm(setTimeout(t,e)),gm=Symbol,_m=gm(),vm=gm(),ym=gm(),bm=gm(),xm=gm(),Sm=gm(),Cm=gm(),wm=gm(),Tm=gm(),Em=e=>{e.length===1&&e[0]?.constructor===Function&&(e=e[0]());let t=[],n=[],r=0;for(;r<e.length;r++){let n=e[r];if(n===void 0)break;if(n.constructor===String||n.constructor===Number)t.push(n);else if(n.constructor===Object)break}for(r>0&&n.push(t.join(``));r<e.length;r++){let t=e[r];t instanceof Symbol||n.push(t)}return n};tf();var Dm={[_m]:zf(`font-weight`,`bold`),[vm]:zf(`font-weight`,`normal`),[ym]:zf(`color`,`blue`),[xm]:zf(`color`,`green`),[bm]:zf(`color`,`grey`),[Sm]:zf(`color`,`red`),[Cm]:zf(`color`,`purple`),[wm]:zf(`color`,`orange`),[Tm]:zf(`color`,`black`)},Om=Nf?e=>{e.length===1&&e[0]?.constructor===Function&&(e=e[0]());let t=[],n=[],r=su(),i=[],a=0;for(;a<e.length;a++){let i=e[a],o=Dm[i];if(o!==void 0)r.set(o.left,o.right);else{if(i===void 0)break;if(i.constructor===String||i.constructor===Number){let e=cm(r);a>0||e.length>0?(t.push(`%c`+i),n.push(e)):t.push(i)}else break}}for(a>0&&(i=n,i.unshift(t.join(``)));a<e.length;a++){let t=e[a];t instanceof Symbol||i.push(t)}return i}:Em,km=(...e)=>{console.log(...Om(e)),jm.forEach(t=>t.print(e))},Am=(...e)=>{console.warn(...Om(e)),e.unshift(wm),jm.forEach(t=>t.print(e))},jm=fu(),Mm=e=>({[Symbol.iterator](){return this},next:e}),Nm=(e,t)=>Mm(()=>{let n;do n=e.next();while(!n.done&&!t(n.value));return n}),Pm=(e,t)=>Mm(()=>{let{done:n,value:r}=e.next();return{done:n,value:n?void 0:t(r)}}),Fm=class{constructor(e,t){this.clock=e,this.len=t}},Im=class{constructor(){this.clients=new Map}},Lm=(e,t,n)=>t.clients.forEach((t,r)=>{let i=e.doc.store.clients.get(r);if(i!=null){let r=i[i.length-1],a=r.id.clock+r.length;for(let r=0,o=t[r];r<t.length&&o.clock<a;o=t[++r])ng(e,i,o.clock,o.len,n)}}),Rm=(e,t)=>{let n=0,r=e.length-1;for(;n<=r;){let i=Su((n+r)/2),a=e[i],o=a.clock;if(o<=t){if(t<o+a.len)return i;n=i+1}else r=i-1}return null},zm=(e,t)=>{let n=e.clients.get(t.client);return n!==void 0&&Rm(n,t.clock)!==null},Bm=e=>{e.clients.forEach(e=>{e.sort((e,t)=>e.clock-t.clock);let t,n;for(t=1,n=1;t<e.length;t++){let r=e[n-1],i=e[t];r.clock+r.len>=i.clock?e[n-1]=new Fm(r.clock,Tu(r.len,i.clock+i.len-r.clock)):(n<t&&(e[n]=i),n++)}e.length=n})},Vm=e=>{let t=new Im;for(let n=0;n<e.length;n++)e[n].clients.forEach((r,i)=>{if(!t.clients.has(i)){let a=r.slice();for(let t=n+1;t<e.length;t++)mu(a,e[t].clients.get(i)||[]);t.clients.set(i,a)}});return Bm(t),t},Hm=(e,t,n,r)=>{lu(e.clients,t,()=>[]).push(new Fm(n,r))},Um=()=>new Im,Wm=e=>{let t=Um();return e.clients.forEach((e,n)=>{let r=[];for(let t=0;t<e.length;t++){let n=e[t];if(n.deleted){let i=n.id.clock,a=n.length;if(t+1<e.length)for(let n=e[t+1];t+1<e.length&&n.deleted;n=e[++t+1])a+=n.length;r.push(new Fm(i,a))}}r.length>0&&t.clients.set(n,r)}),t},Gm=(e,t)=>{cd(e.restEncoder,t.clients.size),hu(t.clients.entries()).sort((e,t)=>t[0]-e[0]).forEach(([t,n])=>{e.resetDsCurVal(),cd(e.restEncoder,t);let r=n.length;cd(e.restEncoder,r);for(let t=0;t<r;t++){let r=n[t];e.writeDsClock(r.clock),e.writeDsLen(r.len)}})},Km=e=>{let t=new Im,n=zd(e.restDecoder);for(let r=0;r<n;r++){e.resetDsCurVal();let n=zd(e.restDecoder),r=zd(e.restDecoder);if(r>0){let i=lu(t.clients,n,()=>[]);for(let t=0;t<r;t++)i.push(new Fm(e.readDsClock(),e.readDsLen()))}}return t},qm=(e,t,n)=>{let r=new Im,i=zd(e.restDecoder);for(let a=0;a<i;a++){e.resetDsCurVal();let i=zd(e.restDecoder),a=zd(e.restDecoder),o=n.clients.get(i)||[],s=Jh(n,i);for(let n=0;n<a;n++){let n=e.readDsClock(),a=n+e.readDsLen();if(n<s){s<a&&Hm(r,i,s,a-s);let e=Xh(o,n),c=o[e];for(!c.deleted&&c.id.clock<n&&(o.splice(e+1,0,yv(t,c,n-c.id.clock)),e++);e<o.length&&(c=o[e++],c.id.clock<a);)c.deleted||(a<c.id.clock+c.length&&o.splice(e,0,yv(t,c,a-c.id.clock)),c.delete(t))}else Hm(r,i,n,a-n)}}if(r.clients.size>0){let e=new rh;return cd(e.restEncoder,0),Gm(e,r),e.toUint8Array()}return null},Jm=Zd,Ym=class e extends bu{constructor({guid:e=ef(),collectionid:t=null,gc:n=!0,gcFilter:r=()=>!0,meta:i=null,autoLoad:a=!1,shouldLoad:o=!0}={}){super(),this.gc=n,this.gcFilter=r,this.clientID=Jm(),this.guid=e,this.collectionid=t,this.share=new Map,this.store=new Kh,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=o,this.autoLoad=a,this.meta=i,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=nf(e=>{this.on(`load`,()=>{this.isLoaded=!0,e(this)})});let s=()=>nf(e=>{let t=n=>{(n===void 0||n===!0)&&(this.off(`sync`,t),e())};this.on(`sync`,t)});this.on(`sync`,e=>{e===!1&&this.isSynced&&(this.whenSynced=s()),this.isSynced=e===void 0||e===!0,this.isSynced&&!this.isLoaded&&this.emit(`load`,[this])}),this.whenSynced=s()}load(){let e=this._item;e!==null&&!this.shouldLoad&&ug(e.parent.doc,e=>{e.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(hu(this.subdocs).map(e=>e.guid))}transact(e,t=null){return ug(this,e,t)}get(e,t=Bg){let n=lu(this.share,e,()=>{let e=new t;return e._integrate(this,null),e}),r=n.constructor;if(t!==Bg&&r!==t)if(r===Bg){let r=new t;r._map=n._map,n._map.forEach(e=>{for(;e!==null;e=e.left)e.parent=r}),r._start=n._start;for(let e=r._start;e!==null;e=e.right)e.parent=r;return r._length=n._length,this.share.set(e,r),r._integrate(this,null),r}else throw Error(`Type with the name ${e} has already been defined with a different constructor`);return n}getArray(e=``){return this.get(e,s_)}getText(e=``){return this.get(e,O_)}getMap(e=``){return this.get(e,u_)}getXmlElement(e=``){return this.get(e,N_)}getXmlFragment(e=``){return this.get(e,j_)}toJSON(){let e={};return this.share.forEach((t,n)=>{e[n]=t.toJSON()}),e}destroy(){this.isDestroyed=!0,hu(this.subdocs).forEach(e=>e.destroy());let t=this._item;if(t!==null){this._item=null;let n=t.content;n.doc=new e({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=t,ug(t.parent.doc,e=>{let r=n.doc;t.deleted||e.subdocsAdded.add(r),e.subdocsRemoved.add(this)},null,!0)}this.emit(`destroyed`,[!0]),this.emit(`destroy`,[this]),super.destroy()}},Xm=class{constructor(e){this.restDecoder=e}resetDsCurVal(){}readDsClock(){return zd(this.restDecoder)}readDsLen(){return zd(this.restDecoder)}},Zm=class extends Xm{readLeftID(){return Oh(zd(this.restDecoder),zd(this.restDecoder))}readRightID(){return Oh(zd(this.restDecoder),zd(this.restDecoder))}readClient(){return zd(this.restDecoder)}readInfo(){return Rd(this.restDecoder)}readString(){return Vd(this.restDecoder)}readParentInfo(){return zd(this.restDecoder)===1}readTypeRef(){return zd(this.restDecoder)}readLen(){return zd(this.restDecoder)}readAny(){return Wd(this.restDecoder)}readBuf(){return If(Ld(this.restDecoder))}readJSON(){return JSON.parse(Vd(this.restDecoder))}readKey(){return Vd(this.restDecoder)}},Qm=class{constructor(e){this.dsCurrVal=0,this.restDecoder=e}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=zd(this.restDecoder),this.dsCurrVal}readDsLen(){let e=zd(this.restDecoder)+1;return this.dsCurrVal+=e,e}},$m=class extends Qm{constructor(e){super(e),this.keys=[],zd(e),this.keyClockDecoder=new qd(Ld(e)),this.clientDecoder=new Kd(Ld(e)),this.leftClockDecoder=new qd(Ld(e)),this.rightClockDecoder=new qd(Ld(e)),this.infoDecoder=new Gd(Ld(e),Rd),this.stringDecoder=new Jd(Ld(e)),this.parentInfoDecoder=new Gd(Ld(e),Rd),this.typeRefDecoder=new Kd(Ld(e)),this.lenDecoder=new Kd(Ld(e))}readLeftID(){return new Eh(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new Eh(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 Wd(this.restDecoder)}readBuf(){return Ld(this.restDecoder)}readJSON(){return Wd(this.restDecoder)}readKey(){let e=this.keyClockDecoder.read();if(e<this.keys.length)return this.keys[e];{let e=this.stringDecoder.read();return this.keys.push(e),e}}},eh=class{constructor(){this.restEncoder=td()}toUint8Array(){return id(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){cd(this.restEncoder,e)}writeDsLen(e){cd(this.restEncoder,e)}},th=class extends eh{writeLeftID(e){cd(this.restEncoder,e.client),cd(this.restEncoder,e.clock)}writeRightID(e){cd(this.restEncoder,e.client),cd(this.restEncoder,e.clock)}writeClient(e){cd(this.restEncoder,e)}writeInfo(e){sd(this.restEncoder,e)}writeString(e){fd(this.restEncoder,e)}writeParentInfo(e){cd(this.restEncoder,+!!e)}writeTypeRef(e){cd(this.restEncoder,e)}writeLen(e){cd(this.restEncoder,e)}writeAny(e){xd(this.restEncoder,e)}writeBuf(e){md(this.restEncoder,e)}writeJSON(e){fd(this.restEncoder,JSON.stringify(e))}writeKey(e){fd(this.restEncoder,e)}},nh=class{constructor(){this.restEncoder=td(),this.dsCurrVal=0}toUint8Array(){return id(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){let t=e-this.dsCurrVal;this.dsCurrVal=e,cd(this.restEncoder,t)}writeDsLen(e){e===0&&Ad(),cd(this.restEncoder,e-1),this.dsCurrVal+=e}},rh=class extends nh{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new Ed,this.clientEncoder=new wd,this.leftClockEncoder=new Ed,this.rightClockEncoder=new Ed,this.infoEncoder=new Sd(sd),this.stringEncoder=new Dd,this.parentInfoEncoder=new Sd(sd),this.typeRefEncoder=new wd,this.lenEncoder=new wd}toUint8Array(){let e=td();return cd(e,0),md(e,this.keyClockEncoder.toUint8Array()),md(e,this.clientEncoder.toUint8Array()),md(e,this.leftClockEncoder.toUint8Array()),md(e,this.rightClockEncoder.toUint8Array()),md(e,id(this.infoEncoder)),md(e,this.stringEncoder.toUint8Array()),md(e,id(this.parentInfoEncoder)),md(e,this.typeRefEncoder.toUint8Array()),md(e,this.lenEncoder.toUint8Array()),pd(e,id(this.restEncoder)),id(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)}writeTypeRef(e){this.typeRefEncoder.write(e)}writeLen(e){this.lenEncoder.write(e)}writeAny(e){xd(this.restEncoder,e)}writeBuf(e){md(this.restEncoder,e)}writeJSON(e){xd(this.restEncoder,e)}writeKey(e){let t=this.keyMap.get(e);t===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e)):this.keyClockEncoder.write(t)}},ih=(e,t,n,r)=>{r=Tu(r,t[0].id.clock);let i=Xh(t,r);cd(e.restEncoder,t.length-i),e.writeClient(n),cd(e.restEncoder,r);let a=t[i];a.write(e,r-a.id.clock);for(let n=i+1;n<t.length;n++)t[n].write(e,0)},ah=(e,t,n)=>{let r=new Map;n.forEach((e,n)=>{Jh(t,n)>e&&r.set(n,e)}),qh(t).forEach((e,t)=>{n.has(t)||r.set(t,0)}),cd(e.restEncoder,r.size),hu(r.entries()).sort((e,t)=>t[0]-e[0]).forEach(([n,r])=>{ih(e,t.clients.get(n),n,r)})},oh=(e,t)=>{let n=su(),r=zd(e.restDecoder);for(let i=0;i<r;i++){let r=zd(e.restDecoder),i=Array(r),a=e.readClient(),o=zd(e.restDecoder);n.set(a,{i:0,refs:i});for(let n=0;n<r;n++){let r=e.readInfo();switch(31&r){case 0:{let t=e.readLen();i[n]=new H_(Oh(a,o),t),o+=t;break}case 10:{let t=zd(e.restDecoder);i[n]=new Ev(Oh(a,o),t),o+=t;break}default:{let s=(r&192)==0,c=new Sv(Oh(a,o),null,(r&128)==128?e.readLeftID():null,null,(r&64)==64?e.readRightID():null,s?e.readParentInfo()?t.get(e.readString()):e.readLeftID():null,s&&(r&32)==32?e.readString():null,Cv(e,r));i[n]=c,o+=c.length}}}}return n},sh=(e,t,n)=>{let r=[],i=hu(n.keys()).sort((e,t)=>e-t);if(i.length===0)return null;let a=()=>{if(i.length===0)return null;let e=n.get(i[i.length-1]);for(;e.refs.length===e.i;)if(i.pop(),i.length>0)e=n.get(i[i.length-1]);else return null;return e},o=a();if(o===null)return null;let s=new Kh,c=new Map,l=(e,t)=>{let n=c.get(e);(n==null||n>t)&&c.set(e,t)},u=o.refs[o.i++],d=new Map,f=()=>{for(let e of r){let t=e.id.client,r=n.get(t);r?(r.i--,s.clients.set(t,r.refs.slice(r.i)),n.delete(t),r.i=0,r.refs=[]):s.clients.set(t,[e]),i=i.filter(e=>e!==t)}r.length=0};for(;;){if(u.constructor!==Ev){let i=lu(d,u.id.client,()=>Jh(t,u.id.client))-u.id.clock;if(i<0)r.push(u),l(u.id.client,u.id.clock-1),f();else{let a=u.getMissing(e,t);if(a!==null){r.push(u);let e=n.get(a)||{refs:[],i:0};if(e.refs.length===e.i)l(a,Jh(t,a)),f();else{u=e.refs[e.i++];continue}}else (i===0||i<u.length)&&(u.integrate(e,i),d.set(u.id.client,u.id.clock+u.length))}}if(r.length>0)u=r.pop();else if(o!==null&&o.i<o.refs.length)u=o.refs[o.i++];else{if(o=a(),o===null)break;u=o.refs[o.i++]}}if(s.clients.size>0){let e=new rh;return ah(e,s,new Map),cd(e.restEncoder,0),{missing:c,update:e.toUint8Array()}}return null},ch=(e,t)=>ah(e,t.doc.store,t.beforeState),lh=(e,t,n,r=new $m(e))=>ug(t,e=>{e.local=!1;let t=!1,n=e.doc,i=n.store,a=sh(e,i,oh(r,n)),o=i.pendingStructs;if(o){for(let[e,n]of o.missing)if(n<Jh(i,e)){t=!0;break}if(a){for(let[e,t]of a.missing){let n=o.missing.get(e);(n==null||n>t)&&o.missing.set(e,t)}o.update=bg([o.update,a.update])}}else i.pendingStructs=a;let s=qm(r,e,i);if(i.pendingDs){let t=new $m(Pd(i.pendingDs));zd(t.restDecoder);let n=qm(t,e,i);s&&n?i.pendingDs=bg([s,n]):i.pendingDs=s||n}else i.pendingDs=s;if(t){let t=i.pendingStructs.update;i.pendingStructs=null,uh(e.doc,t)}},n,!1),uh=(e,t,n,r=$m)=>{let i=Pd(t);lh(i,e,n,new r(i))},dh=(e,t,n)=>uh(e,t,n,Zm),fh=(e,t,n=new Map)=>{ah(e,t.store,n),Gm(e,Wm(t.store))},ph=(e,t=new Uint8Array([0]),n=new rh)=>{fh(n,e,gh(t));let r=[n.toUint8Array()];if(e.store.pendingDs&&r.push(e.store.pendingDs),e.store.pendingStructs&&r.push(xg(e.store.pendingStructs.update,t)),r.length>1){if(n.constructor===th)return vg(r.map((e,t)=>t===0?e:Eg(e)));if(n.constructor===rh)return bg(r)}return r[0]},mh=(e,t)=>ph(e,t,new th),hh=e=>{let t=new Map,n=zd(e.restDecoder);for(let r=0;r<n;r++){let n=zd(e.restDecoder),r=zd(e.restDecoder);t.set(n,r)}return t},gh=e=>hh(new Xm(Pd(e))),_h=(e,t)=>(cd(e.restEncoder,t.size),hu(t.entries()).sort((e,t)=>t[0]-e[0]).forEach(([t,n])=>{cd(e.restEncoder,t),cd(e.restEncoder,n)}),e),vh=(e,t)=>_h(e,qh(t.store)),yh=(e,t=new nh)=>(e instanceof Map?_h(t,e):vh(t,e),t.toUint8Array()),bh=e=>yh(e,new eh),xh=class{constructor(){this.l=[]}},Sh=()=>new xh,Ch=(e,t)=>e.l.push(t),wh=(e,t)=>{let n=e.l,r=n.length;e.l=n.filter(e=>t!==e),r===e.l.length&&console.error(`[yjs] Tried to remove event handler that doesn't exist.`)},Th=(e,t,n)=>bf(e.l,[t,n]),Eh=class{constructor(e,t){this.client=e,this.clock=t}},Dh=(e,t)=>e===t||e!==null&&t!==null&&e.client===t.client&&e.clock===t.clock,Oh=(e,t)=>new Eh(e,t),kh=e=>{for(let[t,n]of e.doc.share.entries())if(n===e)return t;throw Ad()},Ah=(e,t)=>{for(;t!==null;){if(t.parent===e)return!0;t=t.parent._item}return!1},jh=class{constructor(e,t,n,r=0){this.type=e,this.tname=t,this.item=n,this.assoc=r}},Mh=e=>{let t={};return e.type&&(t.type=e.type),e.tname&&(t.tname=e.tname),e.item&&(t.item=e.item),e.assoc!=null&&(t.assoc=e.assoc),t},Nh=e=>new jh(e.type==null?null:Oh(e.type.client,e.type.clock),e.tname??null,e.item==null?null:Oh(e.item.client,e.item.clock),e.assoc==null?0:e.assoc),Ph=class{constructor(e,t,n=0){this.type=e,this.index=t,this.assoc=n}},Fh=(e,t,n=0)=>new Ph(e,t,n),Ih=(e,t,n)=>{let r=null,i=null;return e._item===null?i=kh(e):r=Oh(e._item.id.client,e._item.id.clock),new jh(r,i,t,n)},Lh=(e,t,n=0)=>{let r=e._start;if(n<0){if(t===0)return Ih(e,null,n);t--}for(;r!==null;){if(!r.deleted&&r.countable){if(r.length>t)return Ih(e,Oh(r.id.client,r.id.clock+t),n);t-=r.length}if(r.right===null&&n<0)return Ih(e,r.lastId,n);r=r.right}return Ih(e,null,n)},Rh=(e,t)=>{let n=Zh(e,t);return{item:n,diff:t.clock-n.id.clock}},zh=(e,t,n=!0)=>{let r=t.store,i=e.item,a=e.type,o=e.tname,s=e.assoc,c=null,l=0;if(i!==null){if(Jh(r,i.client)<=i.clock)return null;let e=n?_v(r,i):Rh(r,i),t=e.item;if(!(t instanceof Sv))return null;if(c=t.parent,c._item===null||!c._item.deleted){l=t.deleted||!t.countable?0:e.diff+(s>=0?0:1);let n=t.left;for(;n!==null;)!n.deleted&&n.countable&&(l+=n.length),n=n.left}}else{if(o!==null)c=t.get(o);else if(a!==null){if(Jh(r,a.client)<=a.clock)return null;let{item:e}=n?_v(r,a):{item:Zh(r,a)};if(e instanceof Sv&&e.content instanceof hv)c=e.content.type;else return null}else throw Ad();l=s>=0?c._length:0}return Fh(c,l,e.assoc)},Bh=(e,t)=>e===t||e!==null&&t!==null&&e.tname===t.tname&&Dh(e.item,t.item)&&Dh(e.type,t.type)&&e.assoc===t.assoc,Vh=class{constructor(e,t){this.ds=e,this.sv=t}},Hh=(e,t)=>new Vh(e,t);Hh(Um(),new Map);var Uh=e=>Hh(Wm(e.store),qh(e.store)),Wh=(e,t)=>t===void 0?!e.deleted:t.sv.has(e.id.client)&&(t.sv.get(e.id.client)||0)>e.id.clock&&!zm(t.ds,e.id),Gh=(e,t)=>{let n=lu(e.meta,Gh,fu),r=e.doc.store;n.has(t)||(t.sv.forEach((t,n)=>{t<Jh(r,n)&&$h(e,Oh(n,t))}),Lm(e,t.ds,e=>{}),n.add(t))},Kh=class{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}},qh=e=>{let t=new Map;return e.clients.forEach((e,n)=>{let r=e[e.length-1];t.set(n,r.id.clock+r.length)}),t},Jh=(e,t)=>{let n=e.clients.get(t);if(n===void 0)return 0;let r=n[n.length-1];return r.id.clock+r.length},Yh=(e,t)=>{let n=e.clients.get(t.id.client);if(n===void 0)n=[],e.clients.set(t.id.client,n);else{let e=n[n.length-1];if(e.id.clock+e.length!==t.id.clock)throw Ad()}n.push(t)},Xh=(e,t)=>{let n=0,r=e.length-1,i=e[r],a=i.id.clock;if(a===t)return r;let o=Su(t/(a+i.length-1)*r);for(;n<=r;){if(i=e[o],a=i.id.clock,a<=t){if(t<a+i.length)return o;n=o+1}else r=o-1;o=Su((n+r)/2)}throw Ad()},Zh=(e,t)=>{let n=e.clients.get(t.client);return n[Xh(n,t.clock)]},Qh=(e,t,n)=>{let r=Xh(t,n),i=t[r];return i.id.clock<n&&i instanceof Sv?(t.splice(r+1,0,yv(e,i,n-i.id.clock)),r+1):r},$h=(e,t)=>{let n=e.doc.store.clients.get(t.client);return n[Qh(e,n,t.clock)]},eg=(e,t,n)=>{let r=t.clients.get(n.client),i=Xh(r,n.clock),a=r[i];return n.clock!==a.id.clock+a.length-1&&a.constructor!==H_&&r.splice(i+1,0,yv(e,a,n.clock-a.id.clock+1)),a},tg=(e,t,n)=>{let r=e.clients.get(t.id.client);r[Xh(r,t.id.clock)]=n},ng=(e,t,n,r,i)=>{if(r===0)return;let a=n+r,o=Qh(e,t,n),s;do s=t[o++],a<s.id.clock+s.length&&Qh(e,t,a),i(s);while(o<t.length&&t[o].id.clock<a)},rg=class{constructor(e,t,n){this.doc=e,this.deleteSet=new Im,this.beforeState=qh(e.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=t,this.meta=new Map,this.local=n,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}},ig=(e,t)=>t.deleteSet.clients.size===0&&!du(t.afterState,(e,n)=>t.beforeState.get(n)!==e)?!1:(Bm(t.deleteSet),ch(e,t),Gm(e,t.deleteSet),!0),ag=(e,t,n)=>{let r=t._item;(r===null||r.id.clock<(e.beforeState.get(r.id.client)||0)&&!r.deleted)&&lu(e.changed,t,fu).add(n)},og=(e,t)=>{let n=e[t],r=e[t-1],i=t;for(;i>0;n=r,r=e[--i-1]){if(r.deleted===n.deleted&&r.constructor===n.constructor&&r.mergeWith(n)){n instanceof Sv&&n.parentSub!==null&&n.parent._map.get(n.parentSub)===n&&n.parent._map.set(n.parentSub,r);continue}break}let a=t-i;return a&&e.splice(t+1-a,a),a},sg=(e,t,n)=>{for(let[r,i]of e.clients.entries()){let e=t.clients.get(r);for(let r=i.length-1;r>=0;r--){let a=i[r],o=a.clock+a.len;for(let r=Xh(e,a.clock),i=e[r];r<e.length&&i.id.clock<o;i=e[++r]){let i=e[r];if(a.clock+a.len<=i.id.clock)break;i instanceof Sv&&i.deleted&&!i.keep&&n(i)&&i.gc(t,!1)}}}},cg=(e,t)=>{e.clients.forEach((e,n)=>{let r=t.clients.get(n);for(let t=e.length-1;t>=0;t--){let n=e[t],i=wu(r.length-1,1+Xh(r,n.clock+n.len-1));for(let e=i,t=r[e];e>0&&t.id.clock>=n.clock;t=r[e])e-=1+og(r,e)}})},lg=(e,t)=>{if(t<e.length){let n=e[t],r=n.doc,i=r.store,a=n.deleteSet,o=n._mergeStructs;try{Bm(a),n.afterState=qh(n.doc.store),r.emit(`beforeObserverCalls`,[n,r]);let e=[];n.changed.forEach((t,r)=>e.push(()=>{(r._item===null||!r._item.deleted)&&r._callObserver(n,t)})),e.push(()=>{n.changedParentTypes.forEach((t,r)=>{r._dEH.l.length>0&&(r._item===null||!r._item.deleted)&&(t=t.filter(e=>e.target._item===null||!e.target._item.deleted),t.forEach(e=>{e.currentTarget=r,e._path=null}),t.sort((e,t)=>e.path.length-t.path.length),e.push(()=>{Th(r._dEH,t,n)}))}),e.push(()=>r.emit(`afterTransaction`,[n,r])),e.push(()=>{n._needFormattingCleanup&&T_(n)})}),bf(e,[])}finally{r.gc&&sg(a,i,r.gcFilter),cg(a,i),n.afterState.forEach((e,t)=>{let r=n.beforeState.get(t)||0;if(r!==e){let e=i.clients.get(t),n=Tu(Xh(e,r),1);for(let t=e.length-1;t>=n;)t-=1+og(e,t)}});for(let e=o.length-1;e>=0;e--){let{client:t,clock:n}=o[e].id,r=i.clients.get(t),a=Xh(r,n);a+1<r.length&&og(r,a+1)>1||a>0&&og(r,a)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID)&&(km(wm,_m,`[yjs] `,vm,Sm,`Changed the client-id because another client seems to be using it.`),r.clientID=Jm()),r.emit(`afterTransactionCleanup`,[n,r]),r._observers.has(`update`)){let e=new th;ig(e,n)&&r.emit(`update`,[e.toUint8Array(),n.origin,r,n])}if(r._observers.has(`updateV2`)){let e=new rh;ig(e,n)&&r.emit(`updateV2`,[e.toUint8Array(),n.origin,r,n])}let{subdocsAdded:s,subdocsLoaded:c,subdocsRemoved:l}=n;(s.size>0||l.size>0||c.size>0)&&(s.forEach(e=>{e.clientID=r.clientID,e.collectionid??=r.collectionid,r.subdocs.add(e)}),l.forEach(e=>r.subdocs.delete(e)),r.emit(`subdocs`,[{loaded:c,added:s,removed:l},r,n]),l.forEach(e=>e.destroy())),e.length<=t+1?(r._transactionCleanups=[],r.emit(`afterAllTransactions`,[r,e])):lg(e,t+1)}}},ug=(e,t,n=null,r=!0)=>{let i=e._transactionCleanups,a=!1,o=null;e._transaction===null&&(a=!0,e._transaction=new rg(e,n,r),i.push(e._transaction),i.length===1&&e.emit(`beforeAllTransactions`,[e]),e.emit(`beforeTransaction`,[e._transaction,e]));try{o=t(e._transaction)}finally{if(a){let t=e._transaction===i[0];e._transaction=null,t&&lg(i,0)}}return o},dg=class{constructor(e,t){this.insertions=t,this.deletions=e,this.meta=new Map}},fg=(e,t,n)=>{Lm(e,n.deletions,n=>{n instanceof Sv&&t.scope.some(t=>t===e.doc||Ah(t,n))&&vv(n,!1)})},pg=(e,t,n)=>{let r=null,i=e.doc,a=e.scope;ug(i,n=>{for(;t.length>0&&e.currStackItem===null;){let r=i.store,o=t.pop(),s=new Set,c=[],l=!1;Lm(n,o.insertions,e=>{if(e instanceof Sv){if(e.redone!==null){let{item:t,diff:i}=_v(r,e.id);i>0&&(t=$h(n,Oh(t.id.client,t.id.clock+i))),e=t}!e.deleted&&a.some(t=>t===n.doc||Ah(t,e))&&c.push(e)}}),Lm(n,o.deletions,e=>{e instanceof Sv&&a.some(t=>t===n.doc||Ah(t,e))&&!zm(o.insertions,e.id)&&s.add(e)}),s.forEach(t=>{l=xv(n,t,s,o.insertions,e.ignoreRemoteMapChanges,e)!==null||l});for(let t=c.length-1;t>=0;t--){let r=c[t];e.deleteFilter(r)&&(r.delete(n),l=!0)}e.currStackItem=l?o:null}n.changed.forEach((e,t)=>{e.has(null)&&t._searchMarker&&(t._searchMarker.length=0)}),r=n},e);let o=e.currStackItem;if(o!=null){let t=r.changedParentTypes;e.emit(`stack-item-popped`,[{stackItem:o,type:n,changedParentTypes:t,origin:e},e]),e.currStackItem=null}return o},mg=class extends bu{constructor(e,{captureTimeout:t=500,captureTransaction:n=e=>!0,deleteFilter:r=()=>!0,trackedOrigins:i=new Set([null]),ignoreRemoteMapChanges:a=!1,doc:o=yu(e)?e[0].doc:e instanceof Ym?e:e.doc}={}){super(),this.scope=[],this.doc=o,this.addToScope(e),this.deleteFilter=r,i.add(this),this.trackedOrigins=i,this.captureTransaction=n,this.undoStack=[],this.redoStack=[],this.undoing=!1,this.redoing=!1,this.currStackItem=null,this.lastChange=0,this.ignoreRemoteMapChanges=a,this.captureTimeout=t,this.afterTransactionHandler=e=>{if(!this.captureTransaction(e)||!this.scope.some(t=>e.changedParentTypes.has(t)||t===this.doc)||!this.trackedOrigins.has(e.origin)&&(!e.origin||!this.trackedOrigins.has(e.origin.constructor)))return;let t=this.undoing,n=this.redoing,r=t?this.redoStack:this.undoStack;t?this.stopCapturing():n||this.clear(!1,!0);let i=new Im;e.afterState.forEach((t,n)=>{let r=e.beforeState.get(n)||0,a=t-r;a>0&&Hm(i,n,r,a)});let a=tf(),o=!1;if(this.lastChange>0&&a-this.lastChange<this.captureTimeout&&r.length>0&&!t&&!n){let t=r[r.length-1];t.deletions=Vm([t.deletions,e.deleteSet]),t.insertions=Vm([t.insertions,i])}else r.push(new dg(e.deleteSet,i)),o=!0;!t&&!n&&(this.lastChange=a),Lm(e,e.deleteSet,t=>{t instanceof Sv&&this.scope.some(n=>n===e.doc||Ah(n,t))&&vv(t,!0)});let s=[{stackItem:r[r.length-1],origin:e.origin,type:t?`redo`:`undo`,changedParentTypes:e.changedParentTypes},this];o?this.emit(`stack-item-added`,s):this.emit(`stack-item-updated`,s)},this.doc.on(`afterTransaction`,this.afterTransactionHandler),this.doc.on(`destroy`,()=>{this.destroy()})}addToScope(e){let t=new Set(this.scope);e=yu(e)?e:[e],e.forEach(e=>{t.has(e)||(t.add(e),(e instanceof Bg?e.doc!==this.doc:e!==this.doc)&&Am(`[yjs#509] Not same Y.Doc`),this.scope.push(e))})}addTrackedOrigin(e){this.trackedOrigins.add(e)}removeTrackedOrigin(e){this.trackedOrigins.delete(e)}clear(e=!0,t=!0){(e&&this.canUndo()||t&&this.canRedo())&&this.doc.transact(n=>{e&&(this.undoStack.forEach(e=>fg(n,this,e)),this.undoStack=[]),t&&(this.redoStack.forEach(e=>fg(n,this,e)),this.redoStack=[]),this.emit(`stack-cleared`,[{undoStackCleared:e,redoStackCleared:t}])})}stopCapturing(){this.lastChange=0}undo(){this.undoing=!0;let e;try{e=pg(this,this.undoStack,`undo`)}finally{this.undoing=!1}return e}redo(){this.redoing=!0;let e;try{e=pg(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*hg(e){let t=zd(e.restDecoder);for(let n=0;n<t;n++){let t=zd(e.restDecoder),n=e.readClient(),r=zd(e.restDecoder);for(let i=0;i<t;i++){let t=e.readInfo();if(t===10){let t=zd(e.restDecoder);yield new Ev(Oh(n,r),t),r+=t}else if(31&t){let i=(t&192)==0,a=new Sv(Oh(n,r),null,(t&128)==128?e.readLeftID():null,null,(t&64)==64?e.readRightID():null,i?e.readParentInfo()?e.readString():e.readLeftID():null,i&&(t&32)==32?e.readString():null,Cv(e,t));yield a,r+=a.length}else{let t=e.readLen();yield new H_(Oh(n,r),t),r+=t}}}}var gg=class{constructor(e,t){this.gen=hg(e),this.curr=null,this.done=!1,this.filterSkips=t,this.next()}next(){do this.curr=this.gen.next().value||null;while(this.filterSkips&&this.curr!==null&&this.curr.constructor===Ev);return this.curr}},_g=class{constructor(e){this.currClient=0,this.startClock=0,this.written=0,this.encoder=e,this.clientStructs=[]}},vg=e=>bg(e,Zm,th),yg=(e,t)=>{if(e.constructor===H_){let{client:n,clock:r}=e.id;return new H_(Oh(n,r+t),e.length-t)}else if(e.constructor===Ev){let{client:n,clock:r}=e.id;return new Ev(Oh(n,r+t),e.length-t)}else{let n=e,{client:r,clock:i}=n.id;return new Sv(Oh(r,i+t),null,Oh(r,i+t-1),null,n.rightOrigin,n.parent,n.parentSub,n.content.splice(t))}},bg=(e,t=$m,n=rh)=>{if(e.length===1)return e[0];let r=e.map(e=>new t(Pd(e))),i=r.map(e=>new gg(e,!0)),a=null,o=new n,s=new _g(o);for(;i=i.filter(e=>e.curr!==null),i.sort((e,t)=>{if(e.curr.id.client===t.curr.id.client){let n=e.curr.id.clock-t.curr.id.clock;return n===0?e.curr.constructor===t.curr.constructor?0:e.curr.constructor===Ev?1:-1:n}else return t.curr.id.client-e.curr.id.client}),i.length!==0;){let e=i[0],t=e.curr.id.client;if(a!==null){let n=e.curr,r=!1;for(;n!==null&&n.id.clock+n.length<=a.struct.id.clock+a.struct.length&&n.id.client>=a.struct.id.client;)n=e.next(),r=!0;if(n===null||n.id.client!==t||r&&n.id.clock>a.struct.id.clock+a.struct.length)continue;if(t!==a.struct.id.client)Cg(s,a.struct,a.offset),a={struct:n,offset:0},e.next();else if(a.struct.id.clock+a.struct.length<n.id.clock)if(a.struct.constructor===Ev)a.struct.length=n.id.clock+n.length-a.struct.id.clock;else{Cg(s,a.struct,a.offset);let e=n.id.clock-a.struct.id.clock-a.struct.length;a={struct:new Ev(Oh(t,a.struct.id.clock+a.struct.length),e),offset:0}}else{let t=a.struct.id.clock+a.struct.length-n.id.clock;t>0&&(a.struct.constructor===Ev?a.struct.length-=t:n=yg(n,t)),a.struct.mergeWith(n)||(Cg(s,a.struct,a.offset),a={struct:n,offset:0},e.next())}}else a={struct:e.curr,offset:0},e.next();for(let n=e.curr;n!==null&&n.id.client===t&&n.id.clock===a.struct.id.clock+a.struct.length&&n.constructor!==Ev;n=e.next())Cg(s,a.struct,a.offset),a={struct:n,offset:0}}return a!==null&&(Cg(s,a.struct,a.offset),a=null),wg(s),Gm(o,Vm(r.map(e=>Km(e)))),o.toUint8Array()},xg=(e,t,n=$m,r=rh)=>{let i=gh(t),a=new r,o=new _g(a),s=new n(Pd(e)),c=new gg(s,!1);for(;c.curr;){let e=c.curr,t=e.id.client,n=i.get(t)||0;if(c.curr.constructor===Ev){c.next();continue}if(e.id.clock+e.length>n)for(Cg(o,e,Tu(n-e.id.clock,0)),c.next();c.curr&&c.curr.id.client===t;)Cg(o,c.curr,0),c.next();else for(;c.curr&&c.curr.id.client===t&&c.curr.id.clock+c.curr.length<=n;)c.next()}return wg(o),Gm(a,Km(s)),a.toUint8Array()},Sg=e=>{e.written>0&&(e.clientStructs.push({written:e.written,restEncoder:id(e.encoder.restEncoder)}),e.encoder.restEncoder=td(),e.written=0)},Cg=(e,t,n)=>{e.written>0&&e.currClient!==t.id.client&&Sg(e),e.written===0&&(e.currClient=t.id.client,e.encoder.writeClient(t.id.client),cd(e.encoder.restEncoder,t.id.clock+n)),t.write(e.encoder,n),e.written++},wg=e=>{Sg(e);let t=e.encoder.restEncoder;cd(t,e.clientStructs.length);for(let n=0;n<e.clientStructs.length;n++){let r=e.clientStructs[n];cd(t,r.written),pd(t,r.restEncoder)}},Tg=(e,t,n,r)=>{let i=new n(Pd(e)),a=new gg(i,!1),o=new r,s=new _g(o);for(let e=a.curr;e!==null;e=a.next())Cg(s,t(e),0);return wg(s),Gm(o,Km(i)),o.toUint8Array()},Eg=e=>Tg(e,xf,$m,th),Dg=`You must not compute changes after the event-handler fired.`,Og=class{constructor(e,t){this.target=e,this.currentTarget=e,this.transaction=t,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||=kg(this.currentTarget,this.target)}deletes(e){return zm(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw Od(Dg);let e=new Map,t=this.target;this.transaction.changed.get(t).forEach(n=>{if(n!==null){let r=t._map.get(n),i,a;if(this.adds(r)){let e=r.left;for(;e!==null&&this.adds(e);)e=e.left;if(this.deletes(r))if(e!==null&&this.deletes(e))i=`delete`,a=pu(e.content.getContent());else return;else e!==null&&this.deletes(e)?(i=`update`,a=pu(e.content.getContent())):(i=`add`,a=void 0)}else if(this.deletes(r))i=`delete`,a=pu(r.content.getContent());else return;e.set(n,{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 Od(Dg);let t=this.target,n=fu(),r=fu(),i=[];if(e={added:n,deleted:r,delta:i,keys:this.keys},this.transaction.changed.get(t).has(null)){let e=null,a=()=>{e&&i.push(e)};for(let i=t._start;i!==null;i=i.right)i.deleted?this.deletes(i)&&!this.adds(i)&&((e===null||e.delete===void 0)&&(a(),e={delete:0}),e.delete+=i.length,r.add(i)):this.adds(i)?((e===null||e.insert===void 0)&&(a(),e={insert:[]}),e.insert=e.insert.concat(i.content.getContent()),n.add(i)):((e===null||e.retain===void 0)&&(a(),e={retain:0}),e.retain+=i.length);e!==null&&e.retain===void 0&&a()}this._changes=e}return e}},kg=(e,t)=>{let n=[];for(;t._item!==null&&t!==e;){if(t._item.parentSub!==null)n.unshift(t._item.parentSub);else{let e=0,r=t._item.parent._start;for(;r!==t._item&&r!==null;)!r.deleted&&r.countable&&(e+=r.length),r=r.right;n.unshift(e)}t=t._item.parent}return n},Ag=()=>{Am(`Invalid access: Add Yjs type to a document before reading data.`)},jg=80,Mg=0,Ng=class{constructor(e,t){e.marker=!0,this.p=e,this.index=t,this.timestamp=Mg++}},Pg=e=>{e.timestamp=Mg++},Fg=(e,t,n)=>{e.p.marker=!1,e.p=t,t.marker=!0,e.index=n,e.timestamp=Mg++},Ig=(e,t,n)=>{if(e.length>=jg){let r=e.reduce((e,t)=>e.timestamp<t.timestamp?e:t);return Fg(r,t,n),r}else{let r=new Ng(t,n);return e.push(r),r}},Lg=(e,t)=>{if(e._start===null||t===0||e._searchMarker===null)return null;let n=e._searchMarker.length===0?null:e._searchMarker.reduce((e,n)=>Cu(t-e.index)<Cu(t-n.index)?e:n),r=e._start,i=0;for(n!==null&&(r=n.p,i=n.index,Pg(n));r.right!==null&&i<t;){if(!r.deleted&&r.countable){if(t<i+r.length)break;i+=r.length}r=r.right}for(;r.left!==null&&i>t;)r=r.left,!r.deleted&&r.countable&&(i-=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&&(i-=r.length);return n!==null&&Cu(n.index-i)<r.parent.length/jg?(Fg(n,r,i),n):Ig(e._searchMarker,r,i)},Rg=(e,t,n)=>{for(let r=e.length-1;r>=0;r--){let i=e[r];if(n>0){let t=i.p;for(t.marker=!1;t&&(t.deleted||!t.countable);)t=t.left,t&&!t.deleted&&t.countable&&(i.index-=t.length);if(t===null||t.marker===!0){e.splice(r,1);continue}i.p=t,t.marker=!0}(t<i.index||n>0&&t===i.index)&&(i.index=Tu(t,i.index+n))}},zg=(e,t,n)=>{let r=e,i=t.changedParentTypes;for(;lu(i,e,()=>[]).push(n),e._item!==null;)e=e._item.parent;Th(r._eH,n,t)},Bg=class{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=Sh(),this._dEH=Sh(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,t){this.doc=e,this._item=t}_copy(){throw kd()}clone(){throw kd()}_write(e){}get _first(){let e=this._start;for(;e!==null&&e.deleted;)e=e.right;return e}_callObserver(e,t){!e.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(e){Ch(this._eH,e)}observeDeep(e){Ch(this._dEH,e)}unobserve(e){wh(this._eH,e)}unobserveDeep(e){wh(this._dEH,e)}toJSON(){}},Vg=(e,t,n)=>{e.doc??Ag(),t<0&&(t=e._length+t),n<0&&(n=e._length+n);let r=n-t,i=[],a=e._start;for(;a!==null&&r>0;){if(a.countable&&!a.deleted){let e=a.content.getContent();if(e.length<=t)t-=e.length;else{for(let n=t;n<e.length&&r>0;n++)i.push(e[n]),r--;t=0}}a=a.right}return i},Hg=e=>{e.doc??Ag();let t=[],n=e._start;for(;n!==null;){if(n.countable&&!n.deleted){let e=n.content.getContent();for(let n=0;n<e.length;n++)t.push(e[n])}n=n.right}return t},Ug=(e,t)=>{let n=[],r=e._start;for(;r!==null;){if(r.countable&&Wh(r,t)){let e=r.content.getContent();for(let t=0;t<e.length;t++)n.push(e[t])}r=r.right}return n},Wg=(e,t)=>{let n=0,r=e._start;for(e.doc??Ag();r!==null;){if(r.countable&&!r.deleted){let i=r.content.getContent();for(let r=0;r<i.length;r++)t(i[r],n++,e)}r=r.right}},Gg=(e,t)=>{let n=[];return Wg(e,(r,i)=>{n.push(t(r,i,e))}),n},Kg=e=>{let t=e._start,n=null,r=0;return{[Symbol.iterator](){return this},next:()=>{if(n===null){for(;t!==null&&t.deleted;)t=t.right;if(t===null)return{done:!0,value:void 0};n=t.content.getContent(),r=0,t=t.right}let e=n[r++];return n.length<=r&&(n=null),{done:!1,value:e}}}},qg=(e,t)=>{e.doc??Ag();let n=Lg(e,t),r=e._start;for(n!==null&&(r=n.p,t-=n.index);r!==null;r=r.right)if(!r.deleted&&r.countable){if(t<r.length)return r.content.getContent()[t];t-=r.length}},Jg=(e,t,n,r)=>{let i=n,a=e.doc,o=a.clientID,s=a.store,c=n===null?t._start:n.right,l=[],u=()=>{l.length>0&&(i=new Sv(Oh(o,Jh(s,o)),i,i&&i.lastId,c,c&&c.id,t,null,new rv(l)),i.integrate(e,0),l=[])};r.forEach(n=>{if(n===null)l.push(n);else switch(n.constructor){case Number:case Object:case Boolean:case Array:case String:l.push(n);break;default:switch(u(),n.constructor){case Uint8Array:case ArrayBuffer:i=new Sv(Oh(o,Jh(s,o)),i,i&&i.lastId,c,c&&c.id,t,null,new U_(new Uint8Array(n))),i.integrate(e,0);break;case Ym:i=new Sv(Oh(o,Jh(s,o)),i,i&&i.lastId,c,c&&c.id,t,null,new J_(n)),i.integrate(e,0);break;default:if(n instanceof Bg)i=new Sv(Oh(o,Jh(s,o)),i,i&&i.lastId,c,c&&c.id,t,null,new hv(n)),i.integrate(e,0);else throw Error(`Unexpected content type in insert operation`)}}}),u()},Yg=()=>Od(`Length exceeded!`),Xg=(e,t,n,r)=>{if(n>t._length)throw Yg();if(n===0)return t._searchMarker&&Rg(t._searchMarker,n,r.length),Jg(e,t,null,r);let i=n,a=Lg(t,n),o=t._start;for(a!==null&&(o=a.p,n-=a.index,n===0&&(o=o.prev,n+=o&&o.countable&&!o.deleted?o.length:0));o!==null;o=o.right)if(!o.deleted&&o.countable){if(n<=o.length){n<o.length&&$h(e,Oh(o.id.client,o.id.clock+n));break}n-=o.length}return t._searchMarker&&Rg(t._searchMarker,i,r.length),Jg(e,t,o,r)},Zg=(e,t,n)=>{let r=(t._searchMarker||[]).reduce((e,t)=>t.index>e.index?t:e,{index:0,p:t._start}).p;if(r)for(;r.right;)r=r.right;return Jg(e,t,r,n)},Qg=(e,t,n,r)=>{if(r===0)return;let i=n,a=r,o=Lg(t,n),s=t._start;for(o!==null&&(s=o.p,n-=o.index);s!==null&&n>0;s=s.right)!s.deleted&&s.countable&&(n<s.length&&$h(e,Oh(s.id.client,s.id.clock+n)),n-=s.length);for(;r>0&&s!==null;)s.deleted||(r<s.length&&$h(e,Oh(s.id.client,s.id.clock+r)),s.delete(e),r-=s.length),s=s.right;if(r>0)throw Yg();t._searchMarker&&Rg(t._searchMarker,i,-a+r)},$g=(e,t,n)=>{let r=t._map.get(n);r!==void 0&&r.delete(e)},e_=(e,t,n,r)=>{let i=t._map.get(n)||null,a=e.doc,o=a.clientID,s;if(r==null)s=new rv([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:s=new rv([r]);break;case Uint8Array:s=new U_(r);break;case Ym:s=new J_(r);break;default:if(r instanceof Bg)s=new hv(r);else throw Error(`Unexpected content type`)}new Sv(Oh(o,Jh(a.store,o)),i,i&&i.lastId,null,null,t,n,s).integrate(e,0)},t_=(e,t)=>{e.doc??Ag();let n=e._map.get(t);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},n_=e=>{let t={};return e.doc??Ag(),e._map.forEach((e,n)=>{e.deleted||(t[n]=e.content.getContent()[e.length-1])}),t},r_=(e,t)=>{e.doc??Ag();let n=e._map.get(t);return n!==void 0&&!n.deleted},i_=(e,t)=>{let n={};return e._map.forEach((e,r)=>{let i=e;for(;i!==null&&(!t.sv.has(i.id.client)||i.id.clock>=(t.sv.get(i.id.client)||0));)i=i.left;i!==null&&Wh(i,t)&&(n[r]=i.content.getContent()[i.length-1])}),n},a_=e=>(e.doc??Ag(),Nm(e._map.entries(),e=>!e[1].deleted)),o_=class extends Og{},s_=class e extends Bg{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(t){let n=new e;return n.push(t),n}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new e}clone(){let t=new e;return t.insert(0,this.toArray().map(e=>e instanceof Bg?e.clone():e)),t}get length(){return this.doc??Ag(),this._length}_callObserver(e,t){super._callObserver(e,t),zg(this,e,new o_(this,e))}insert(e,t){this.doc===null?this._prelimContent.splice(e,0,...t):ug(this.doc,n=>{Xg(n,this,e,t)})}push(e){this.doc===null?this._prelimContent.push(...e):ug(this.doc,t=>{Zg(t,this,e)})}unshift(e){this.insert(0,e)}delete(e,t=1){this.doc===null?this._prelimContent.splice(e,t):ug(this.doc,n=>{Qg(n,this,e,t)})}get(e){return qg(this,e)}toArray(){return Hg(this)}slice(e=0,t=this.length){return Vg(this,e,t)}toJSON(){return this.map(e=>e instanceof Bg?e.toJSON():e)}map(e){return Gg(this,e)}forEach(e){Wg(this,e)}[Symbol.iterator](){return Kg(this)}_write(e){e.writeTypeRef(cv)}},c_=e=>new s_,l_=class extends Og{constructor(e,t,n){super(e,t),this.keysChanged=n}},u_=class e extends Bg{constructor(e){super(),this._prelimContent=null,e===void 0?this._prelimContent=new Map:this._prelimContent=new Map(e)}_integrate(e,t){super._integrate(e,t),this._prelimContent.forEach((e,t)=>{this.set(t,e)}),this._prelimContent=null}_copy(){return new e}clone(){let t=new e;return this.forEach((e,n)=>{t.set(n,e instanceof Bg?e.clone():e)}),t}_callObserver(e,t){zg(this,e,new l_(this,e,t))}toJSON(){this.doc??Ag();let e={};return this._map.forEach((t,n)=>{if(!t.deleted){let r=t.content.getContent()[t.length-1];e[n]=r instanceof Bg?r.toJSON():r}}),e}get size(){return[...a_(this)].length}keys(){return Pm(a_(this),e=>e[0])}values(){return Pm(a_(this),e=>e[1].content.getContent()[e[1].length-1])}entries(){return Pm(a_(this),e=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this.doc??Ag(),this._map.forEach((t,n)=>{t.deleted||e(t.content.getContent()[t.length-1],n,this)})}[Symbol.iterator](){return this.entries()}delete(e){this.doc===null?this._prelimContent.delete(e):ug(this.doc,t=>{$g(t,this,e)})}set(e,t){return this.doc===null?this._prelimContent.set(e,t):ug(this.doc,n=>{e_(n,this,e,t)}),t}get(e){return t_(this,e)}has(e){return r_(this,e)}clear(){this.doc===null?this._prelimContent.clear():ug(this.doc,e=>{this.forEach(function(t,n,r){$g(e,r,n)})})}_write(e){e.writeTypeRef(lv)}},d_=e=>new u_,f_=(e,t)=>e===t||typeof e==`object`&&typeof t==`object`&&e&&t&&_f(e,t),p_=class{constructor(e,t,n,r){this.left=e,this.right=t,this.index=n,this.currentAttributes=r}forward(){switch(this.right===null&&Ad(),this.right.content.constructor){case Q_:this.right.deleted||__(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}},m_=(e,t,n)=>{for(;t.right!==null&&n>0;){switch(t.right.content.constructor){case Q_:t.right.deleted||__(t.currentAttributes,t.right.content);break;default:t.right.deleted||(n<t.right.length&&$h(e,Oh(t.right.id.client,t.right.id.clock+n)),t.index+=t.right.length,n-=t.right.length);break}t.left=t.right,t.right=t.right.right}return t},h_=(e,t,n,r)=>{let i=new Map,a=r?Lg(t,n):null;return a?m_(e,new p_(a.p.left,a.p,a.index,i),n-a.index):m_(e,new p_(null,t._start,0,i),n)},g_=(e,t,n,r)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===Q_&&f_(r.get(n.right.content.key),n.right.content.value));)n.right.deleted||r.delete(n.right.content.key),n.forward();let i=e.doc,a=i.clientID;r.forEach((r,o)=>{let s=n.left,c=n.right,l=new Sv(Oh(a,Jh(i.store,a)),s,s&&s.lastId,c,c&&c.id,t,null,new Q_(o,r));l.integrate(e,0),n.right=l,n.forward()})},__=(e,t)=>{let{key:n,value:r}=t;r===null?e.delete(n):e.set(n,r)},v_=(e,t)=>{for(;e.right!==null&&(e.right.deleted||e.right.content.constructor===Q_&&f_(t[e.right.content.key]??null,e.right.content.value));)e.forward()},y_=(e,t,n,r)=>{let i=e.doc,a=i.clientID,o=new Map;for(let s in r){let c=r[s],l=n.currentAttributes.get(s)??null;if(!f_(l,c)){o.set(s,l);let{left:r,right:u}=n;n.right=new Sv(Oh(a,Jh(i.store,a)),r,r&&r.lastId,u,u&&u.id,t,null,new Q_(s,c)),n.right.integrate(e,0),n.forward()}}return o},b_=(e,t,n,r,i)=>{n.currentAttributes.forEach((e,t)=>{i[t]===void 0&&(i[t]=null)});let a=e.doc,o=a.clientID;v_(n,i);let s=y_(e,t,n,i),c=r.constructor===String?new av(r):r instanceof Bg?new hv(r):new X_(r),{left:l,right:u,index:d}=n;t._searchMarker&&Rg(t._searchMarker,n.index,c.getLength()),u=new Sv(Oh(o,Jh(a.store,o)),l,l&&l.lastId,u,u&&u.id,t,null,c),u.integrate(e,0),n.right=u,n.index=d,n.forward(),g_(e,t,n,s)},x_=(e,t,n,r,i)=>{let a=e.doc,o=a.clientID;v_(n,i);let s=y_(e,t,n,i);iterationLoop:for(;n.right!==null&&(r>0||s.size>0&&(n.right.deleted||n.right.content.constructor===Q_));){if(!n.right.deleted)switch(n.right.content.constructor){case Q_:{let{key:t,value:a}=n.right.content,o=i[t];if(o!==void 0){if(f_(o,a))s.delete(t);else{if(r===0)break iterationLoop;s.set(t,a)}n.right.delete(e)}else n.currentAttributes.set(t,a);break}default:r<n.right.length&&$h(e,Oh(n.right.id.client,n.right.id.clock+r)),r-=n.right.length;break}n.forward()}if(r>0){let i=``;for(;r>0;r--)i+=`
|
|
4
4
|
`;n.right=new Sv(Oh(o,Jh(a.store,o)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,t,null,new av(i)),n.right.integrate(e,0),n.forward()}g_(e,t,n,s)},S_=(e,t,n,r,i)=>{let a=t,o=su();for(;a&&(!a.countable||a.deleted);){if(!a.deleted&&a.content.constructor===Q_){let e=a.content;o.set(e.key,e)}a=a.right}let s=0,c=!1;for(;t!==a;){if(n===t&&(c=!0),!t.deleted){let n=t.content;switch(n.constructor){case Q_:{let{key:a,value:l}=n,u=r.get(a)??null;(o.get(a)!==n||u===l)&&(t.delete(e),s++,!c&&(i.get(a)??null)===l&&u!==l&&(u===null?i.delete(a):i.set(a,u))),!c&&!t.deleted&&__(i,n);break}}}t=t.right}return s},C_=(e,t)=>{for(;t&&t.right&&(t.right.deleted||!t.right.countable);)t=t.right;let n=new Set;for(;t&&(t.deleted||!t.countable);){if(!t.deleted&&t.content.constructor===Q_){let r=t.content.key;n.has(r)?t.delete(e):n.add(r)}t=t.left}},w_=e=>{let t=0;return ug(e.doc,n=>{let r=e._start,i=e._start,a=su(),o=cu(a);for(;i;){if(i.deleted===!1)switch(i.content.constructor){case Q_:__(o,i.content);break;default:t+=S_(n,r,i,a,o),a=cu(o),r=i;break}i=i.right}}),t},T_=e=>{let t=new Set,n=e.doc;for(let[r,i]of e.afterState.entries()){let a=e.beforeState.get(r)||0;i!==a&&ng(e,n.store.clients.get(r),a,i,e=>{!e.deleted&&e.content.constructor===Q_&&e.constructor!==H_&&t.add(e.parent)})}ug(n,n=>{Lm(e,e.deleteSet,e=>{if(e instanceof H_||!e.parent._hasFormatting||t.has(e.parent))return;let r=e.parent;e.content.constructor===Q_?t.add(r):C_(n,e)});for(let e of t)w_(e)})},E_=(e,t,n)=>{let r=n,i=cu(t.currentAttributes),a=t.right;for(;n>0&&t.right!==null;){if(t.right.deleted===!1)switch(t.right.content.constructor){case hv:case X_:case av:n<t.right.length&&$h(e,Oh(t.right.id.client,t.right.id.clock+n)),n-=t.right.length,t.right.delete(e);break}t.forward()}a&&S_(e,a,t.right,i,t.currentAttributes);let o=(t.left||t.right).parent;return o._searchMarker&&Rg(o._searchMarker,t.index,-r+n),t},D_=class extends Og{constructor(e,t,n){super(e,t),this.childListChanged=!1,this.keysChanged=new Set,n.forEach(e=>{e===null?this.childListChanged=!0:this.keysChanged.add(e)})}get changes(){return this._changes===null&&(this._changes={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set}),this._changes}get delta(){if(this._delta===null){let e=this.target.doc,t=[];ug(e,e=>{let n=new Map,r=new Map,i=this.target._start,a=null,o={},s=``,c=0,l=0,u=()=>{if(a!==null){let e=null;switch(a){case`delete`:l>0&&(e={delete:l}),l=0;break;case`insert`:(typeof s==`object`||s.length>0)&&(e={insert:s},n.size>0&&(e.attributes={},n.forEach((t,n)=>{t!==null&&(e.attributes[n]=t)}))),s=``;break;case`retain`:c>0&&(e={retain:c},mf(o)||(e.attributes=uf({},o))),c=0;break}e&&t.push(e),a=null}};for(;i!==null;){switch(i.content.constructor){case hv:case X_:this.adds(i)?this.deletes(i)||(u(),a=`insert`,s=i.content.getContent()[0],u()):this.deletes(i)?(a!==`delete`&&(u(),a=`delete`),l+=1):i.deleted||(a!==`retain`&&(u(),a=`retain`),c+=1);break;case av:this.adds(i)?this.deletes(i)||(a!==`insert`&&(u(),a=`insert`),s+=i.content.str):this.deletes(i)?(a!==`delete`&&(u(),a=`delete`),l+=i.length):i.deleted||(a!==`retain`&&(u(),a=`retain`),c+=i.length);break;case Q_:{let{key:t,value:s}=i.content;if(this.adds(i))this.deletes(i)||(f_(n.get(t)??null,s)?s!==null&&i.delete(e):(a===`retain`&&u(),f_(s,r.get(t)??null)?delete o[t]:o[t]=s));else if(this.deletes(i)){r.set(t,s);let e=n.get(t)??null;f_(e,s)||(a===`retain`&&u(),o[t]=e)}else if(!i.deleted){r.set(t,s);let n=o[t];n!==void 0&&(f_(n,s)?n!==null&&i.delete(e):(a===`retain`&&u(),s===null?delete o[t]:o[t]=s))}i.deleted||(a===`insert`&&u(),__(n,i.content));break}}i=i.right}for(u();t.length>0;){let e=t[t.length-1];if(e.retain!==void 0&&e.attributes===void 0)t.pop();else break}}),this._delta=t}return this._delta}},O_=class e extends Bg{constructor(e){super(),this._pending=e===void 0?[]:[()=>this.insert(0,e)],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??Ag(),this._length}_integrate(e,t){super._integrate(e,t);try{this._pending.forEach(e=>e())}catch(e){console.error(e)}this._pending=null}_copy(){return new e}clone(){let t=new e;return t.applyDelta(this.toDelta()),t}_callObserver(e,t){super._callObserver(e,t);let n=new D_(this,e,t);zg(this,e,n),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=!0)}toString(){this.doc??Ag();let e=``,t=this._start;for(;t!==null;)!t.deleted&&t.countable&&t.content.constructor===av&&(e+=t.content.str),t=t.right;return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:t=!0}={}){this.doc===null?this._pending.push(()=>this.applyDelta(e)):ug(this.doc,n=>{let r=new p_(null,this._start,0,new Map);for(let i=0;i<e.length;i++){let a=e[i];if(a.insert!==void 0){let o=!t&&typeof a.insert==`string`&&i===e.length-1&&r.right===null&&a.insert.slice(-1)===`
|
|
5
5
|
`?a.insert.slice(0,-1):a.insert;(typeof o!=`string`||o.length>0)&&b_(n,this,r,o,a.attributes||{})}else a.retain===void 0?a.delete!==void 0&&E_(n,r,a.delete):x_(n,this,r,a.retain,a.attributes||{})}})}toDelta(e,t,n){this.doc??Ag();let r=[],i=new Map,a=this.doc,o=``,s=this._start;function c(){if(o.length>0){let e={},t=!1;i.forEach((n,r)=>{t=!0,e[r]=n});let n={insert:o};t&&(n.attributes=e),r.push(n),o=``}}let l=()=>{for(;s!==null;){if(Wh(s,e)||t!==void 0&&Wh(s,t))switch(s.content.constructor){case av:{let r=i.get(`ychange`);e!==void 0&&!Wh(s,e)?(r===void 0||r.user!==s.id.client||r.type!==`removed`)&&(c(),i.set(`ychange`,n?n(`removed`,s.id):{type:`removed`})):t!==void 0&&!Wh(s,t)?(r===void 0||r.user!==s.id.client||r.type!==`added`)&&(c(),i.set(`ychange`,n?n(`added`,s.id):{type:`added`})):r!==void 0&&(c(),i.delete(`ychange`)),o+=s.content.str;break}case hv:case X_:{c();let e={insert:s.content.getContent()[0]};if(i.size>0){let t={};e.attributes=t,i.forEach((e,n)=>{t[n]=e})}r.push(e);break}case Q_:Wh(s,e)&&(c(),__(i,s.content));break}s=s.right}c()};return e||t?ug(a,n=>{e&&Gh(n,e),t&&Gh(n,t),l()},`cleanup`):l(),r}insert(e,t,n){if(t.length<=0)return;let r=this.doc;r===null?this._pending.push(()=>this.insert(e,t,n)):ug(r,r=>{let i=h_(r,this,e,!n);n||(n={},i.currentAttributes.forEach((e,t)=>{n[t]=e})),b_(r,this,i,t,n)})}insertEmbed(e,t,n){let r=this.doc;r===null?this._pending.push(()=>this.insertEmbed(e,t,n||{})):ug(r,r=>{let i=h_(r,this,e,!n);b_(r,this,i,t,n||{})})}delete(e,t){if(t===0)return;let n=this.doc;n===null?this._pending.push(()=>this.delete(e,t)):ug(n,n=>{E_(n,h_(n,this,e,!0),t)})}format(e,t,n){if(t===0)return;let r=this.doc;r===null?this._pending.push(()=>this.format(e,t,n)):ug(r,r=>{let i=h_(r,this,e,!1);i.right!==null&&x_(r,this,i,t,n)})}removeAttribute(e){this.doc===null?this._pending.push(()=>this.removeAttribute(e)):ug(this.doc,t=>{$g(t,this,e)})}setAttribute(e,t){this.doc===null?this._pending.push(()=>this.setAttribute(e,t)):ug(this.doc,n=>{e_(n,this,e,t)})}getAttribute(e){return t_(this,e)}getAttributes(){return n_(this)}_write(e){e.writeTypeRef(uv)}},k_=e=>new O_,A_=class{constructor(e,t=()=>!0){this._filter=t,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??Ag()}[Symbol.iterator](){return this}next(){let e=this._currentNode,t=e&&e.content&&e.content.type;if(e!==null&&(!this._firstCall||e.deleted||!this._filter(t)))do if(t=e.content.type,!e.deleted&&(t.constructor===N_||t.constructor===j_)&&t._start!==null)e=t._start;else for(;e!==null;){let t=e.next;if(t!==null){e=t;break}else e=e.parent===this._root?null: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})}},j_=class e extends Bg{constructor(){super(),this._prelimContent=[]}get firstChild(){let e=this._first;return e?e.content.getContent()[0]:null}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new e}clone(){let t=new e;return t.insert(0,this.toArray().map(e=>e instanceof Bg?e.clone():e)),t}get length(){return this.doc??Ag(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new A_(this,e)}querySelector(e){e=e.toUpperCase();let t=new A_(this,t=>t.nodeName&&t.nodeName.toUpperCase()===e).next();return t.done?null:t.value}querySelectorAll(e){return e=e.toUpperCase(),hu(new A_(this,t=>t.nodeName&&t.nodeName.toUpperCase()===e))}_callObserver(e,t){zg(this,e,new F_(this,t,e))}toString(){return Gg(this,e=>e.toString()).join(``)}toJSON(){return this.toString()}toDOM(e=document,t={},n){let r=e.createDocumentFragment();return n!==void 0&&n._createAssociation(r,this),Wg(this,i=>{r.insertBefore(i.toDOM(e,t,n),null)}),r}insert(e,t){this.doc===null?this._prelimContent.splice(e,0,...t):ug(this.doc,n=>{Xg(n,this,e,t)})}insertAfter(e,t){if(this.doc!==null)ug(this.doc,n=>{let r=e&&e instanceof Bg?e._item:e;Jg(n,this,r,t)});else{let n=this._prelimContent,r=e===null?0:n.findIndex(t=>t===e)+1;if(r===0&&e!==null)throw Od(`Reference item not found`);n.splice(r,0,...t)}}delete(e,t=1){this.doc===null?this._prelimContent.splice(e,t):ug(this.doc,n=>{Qg(n,this,e,t)})}toArray(){return Hg(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return qg(this,e)}slice(e=0,t=this.length){return Vg(this,e,t)}forEach(e){Wg(this,e)}_write(e){e.writeTypeRef(fv)}},M_=e=>new j_,N_=class e extends j_{constructor(e=`UNDEFINED`){super(),this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){let e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){let e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,t){super._integrate(e,t),this._prelimAttrs.forEach((e,t)=>{this.setAttribute(t,e)}),this._prelimAttrs=null}_copy(){return new e(this.nodeName)}clone(){let t=new e(this.nodeName);return ff(this.getAttributes(),(e,n)=>{t.setAttribute(n,e)}),t.insert(0,this.toArray().map(e=>e instanceof Bg?e.clone():e)),t}toString(){let e=this.getAttributes(),t=[],n=[];for(let t in e)n.push(t);n.sort();let r=n.length;for(let i=0;i<r;i++){let r=n[i];t.push(r+`="`+e[r]+`"`)}let i=this.nodeName.toLocaleLowerCase();return`<${i}${t.length>0?` `+t.join(` `):``}>${super.toString()}</${i}>`}removeAttribute(e){this.doc===null?this._prelimAttrs.delete(e):ug(this.doc,t=>{$g(t,this,e)})}setAttribute(e,t){this.doc===null?this._prelimAttrs.set(e,t):ug(this.doc,n=>{e_(n,this,e,t)})}getAttribute(e){return t_(this,e)}hasAttribute(e){return r_(this,e)}getAttributes(e){return e?i_(this,e):n_(this)}toDOM(e=document,t={},n){let r=e.createElement(this.nodeName),i=this.getAttributes();for(let e in i){let t=i[e];typeof t==`string`&&r.setAttribute(e,t)}return Wg(this,i=>{r.appendChild(i.toDOM(e,t,n))}),n!==void 0&&n._createAssociation(r,this),r}_write(e){e.writeTypeRef(dv),e.writeKey(this.nodeName)}},P_=e=>new N_(e.readKey()),F_=class extends Og{constructor(e,t,n){super(e,n),this.childListChanged=!1,this.attributesChanged=new Set,t.forEach(e=>{e===null?this.childListChanged=!0:this.attributesChanged.add(e)})}},I_=class e extends u_{constructor(e){super(),this.hookName=e}_copy(){return new e(this.hookName)}clone(){let t=new e(this.hookName);return this.forEach((e,n)=>{t.set(n,e)}),t}toDOM(e=document,t={},n){let r=t[this.hookName],i;return i=r===void 0?document.createElement(this.hookName):r.createDom(this),i.setAttribute(`data-yjs-hook`,this.hookName),n!==void 0&&n._createAssociation(i,this),i}_write(e){e.writeTypeRef(pv),e.writeKey(this.hookName)}},L_=e=>new I_(e.readKey()),R_=class e extends O_{get nextSibling(){let e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){let e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new e}clone(){let t=new e;return t.applyDelta(this.toDelta()),t}toDOM(e=document,t,n){let r=e.createTextNode(this.toString());return n!==void 0&&n._createAssociation(r,this),r}toString(){return this.toDelta().map(e=>{let t=[];for(let n in e.attributes){let r=[];for(let t in e.attributes[n])r.push({key:t,value:e.attributes[n][t]});r.sort((e,t)=>e.key<t.key?-1:1),t.push({nodeName:n,attrs:r})}t.sort((e,t)=>e.nodeName<t.nodeName?-1:1);let n=``;for(let e=0;e<t.length;e++){let r=t[e];n+=`<${r.nodeName}`;for(let e=0;e<r.attrs.length;e++){let t=r.attrs[e];n+=` ${t.key}="${t.value}"`}n+=`>`}n+=e.insert;for(let e=t.length-1;e>=0;e--)n+=`</${t[e].nodeName}>`;return n}).join(``)}toJSON(){return this.toString()}_write(e){e.writeTypeRef(mv)}},z_=e=>new R_,B_=class{constructor(e,t){this.id=e,this.length=t}get deleted(){throw kd()}mergeWith(e){return!1}write(e,t,n){throw kd()}integrate(e,t){throw kd()}},V_=0,H_=class extends B_{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor===e.constructor?(this.length+=e.length,!0):!1}integrate(e,t){t>0&&(this.id.clock+=t,this.length-=t),Yh(e.doc.store,this)}write(e,t){e.writeInfo(V_),e.writeLen(this.length-t)}getMissing(e,t){return null}},U_=class e{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new e(this.content)}splice(e){throw kd()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeBuf(this.content)}getRef(){return 3}},W_=e=>new U_(e.readBuf()),G_=class e{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new e(this.len)}splice(t){let n=new e(this.len-t);return this.len=t,n}mergeWith(e){return this.len+=e.len,!0}integrate(e,t){Hm(e.deleteSet,t.id.client,t.id.clock,this.len),t.markDeleted()}delete(e){}gc(e){}write(e,t){e.writeLen(this.len-t)}getRef(){return 1}},K_=e=>new G_(e.readLen()),q_=(e,t)=>new Ym({guid:e,...t,shouldLoad:t.shouldLoad||t.autoLoad||!1}),J_=class e{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;let t={};this.opts=t,e.gc||(t.gc=!1),e.autoLoad&&(t.autoLoad=!0),e.meta!==null&&(t.meta=e.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new e(q_(this.doc.guid,this.opts))}splice(e){throw kd()}mergeWith(e){return!1}integrate(e,t){this.doc._item=t,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,t){e.writeString(this.doc.guid),e.writeAny(this.opts)}getRef(){return 9}},Y_=e=>new J_(q_(e.readString(),e.readAny())),X_=class e{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new e(this.embed)}splice(e){throw kd()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeJSON(this.embed)}getRef(){return 5}},Z_=e=>new X_(e.readJSON()),Q_=class e{constructor(e,t){this.key=e,this.value=t}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new e(this.key,this.value)}splice(e){throw kd()}mergeWith(e){return!1}integrate(e,t){let n=t.parent;n._searchMarker=null,n._hasFormatting=!0}delete(e){}gc(e){}write(e,t){e.writeKey(this.key),e.writeJSON(this.value)}getRef(){return 6}},$_=e=>new Q_(e.readKey(),e.readJSON()),ev=class e{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new e(this.arr)}splice(t){let n=new e(this.arr.slice(t));return this.arr=this.arr.slice(0,t),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){let n=this.arr.length;e.writeLen(n-t);for(let r=t;r<n;r++){let t=this.arr[r];e.writeString(t===void 0?`undefined`:JSON.stringify(t))}}getRef(){return 2}},tv=e=>{let t=e.readLen(),n=[];for(let r=0;r<t;r++){let t=e.readString();t===`undefined`?n.push(void 0):n.push(JSON.parse(t))}return new ev(n)},nv=Af(`node_env`)===`development`,rv=class e{constructor(e){this.arr=e,nv&&yf(e)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new e(this.arr)}splice(t){let n=new e(this.arr.slice(t));return this.arr=this.arr.slice(0,t),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){let n=this.arr.length;e.writeLen(n-t);for(let r=t;r<n;r++){let t=this.arr[r];e.writeAny(t)}}getRef(){return 8}},iv=e=>{let t=e.readLen(),n=[];for(let r=0;r<t;r++)n.push(e.readAny());return new rv(n)},av=class e{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split(``)}isCountable(){return!0}copy(){return new e(this.str)}splice(t){let n=new e(this.str.slice(t));this.str=this.str.slice(0,t);let r=this.str.charCodeAt(t-1);return r>=55296&&r<=56319&&(this.str=this.str.slice(0,t-1)+`�`,n.str=`�`+n.str.slice(1)),n}mergeWith(e){return this.str+=e.str,!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeString(t===0?this.str:this.str.slice(t))}getRef(){return 4}},ov=e=>new av(e.readString()),sv=[c_,d_,k_,P_,M_,L_,z_],cv=0,lv=1,uv=2,dv=3,fv=4,pv=5,mv=6,hv=class e{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new e(this.type._copy())}splice(e){throw kd()}mergeWith(e){return!1}integrate(e,t){this.type._integrate(e.doc,t)}delete(e){let t=this.type._start;for(;t!==null;)t.deleted?t.id.clock<(e.beforeState.get(t.id.client)||0)&&e._mergeStructs.push(t):t.delete(e),t=t.right;this.type._map.forEach(t=>{t.deleted?t.id.clock<(e.beforeState.get(t.id.client)||0)&&e._mergeStructs.push(t):t.delete(e)}),e.changed.delete(this.type)}gc(e){let t=this.type._start;for(;t!==null;)t.gc(e,!0),t=t.right;this.type._start=null,this.type._map.forEach(t=>{for(;t!==null;)t.gc(e,!0),t=t.left}),this.type._map=new Map}write(e,t){this.type._write(e)}getRef(){return 7}},gv=e=>new hv(sv[e.readTypeRef()](e)),_v=(e,t)=>{let n=t,r=0,i;do r>0&&(n=Oh(n.client,n.clock+r)),i=Zh(e,n),r=n.clock-i.id.clock,n=i.redone;while(n!==null&&i instanceof Sv);return{item:i,diff:r}},vv=(e,t)=>{for(;e!==null&&e.keep!==t;)e.keep=t,e=e.parent._item},yv=(e,t,n)=>{let{client:r,clock:i}=t.id,a=new Sv(Oh(r,i+n),t,Oh(r,i+n-1),t.right,t.rightOrigin,t.parent,t.parentSub,t.content.splice(n));return t.deleted&&a.markDeleted(),t.keep&&(a.keep=!0),t.redone!==null&&(a.redone=Oh(t.redone.client,t.redone.clock+n)),t.right=a,a.right!==null&&(a.right.left=a),e._mergeStructs.push(a),a.parentSub!==null&&a.right===null&&a.parent._map.set(a.parentSub,a),t.length=n,a},bv=(e,t)=>_u(e,e=>zm(e.deletions,t)),xv=(e,t,n,r,i,a)=>{let o=e.doc,s=o.store,c=o.clientID,l=t.redone;if(l!==null)return $h(e,l);let u=t.parent._item,d=null,f;if(u!==null&&u.deleted===!0){if(u.redone===null&&(!n.has(u)||xv(e,u,n,r,i,a)===null))return null;for(;u.redone!==null;)u=$h(e,u.redone)}let p=u===null?t.parent:u.content.type;if(t.parentSub===null){for(d=t.left,f=t;d!==null;){let t=d;for(;t!==null&&t.parent._item!==u;)t=t.redone===null?null:$h(e,t.redone);if(t!==null&&t.parent._item===u){d=t;break}d=d.left}for(;f!==null;){let t=f;for(;t!==null&&t.parent._item!==u;)t=t.redone===null?null:$h(e,t.redone);if(t!==null&&t.parent._item===u){f=t;break}f=f.right}}else if(f=null,t.right&&!i){for(d=t;d!==null&&d.right!==null&&(d.right.redone||zm(r,d.right.id)||bv(a.undoStack,d.right.id)||bv(a.redoStack,d.right.id));)for(d=d.right;d.redone;)d=$h(e,d.redone);if(d&&d.right!==null)return null}else d=p._map.get(t.parentSub)||null;let m=Oh(c,Jh(s,c)),h=new Sv(m,d,d&&d.lastId,f,f&&f.id,p,t.parentSub,t.content.copy());return t.redone=m,vv(h,!0),h.integrate(e,0),h},Sv=class e extends B_{constructor(e,t,n,r,i,a,o,s){super(e,s.getLength()),this.origin=n,this.left=t,this.right=r,this.rightOrigin=i,this.parent=a,this.parentSub=o,this.redone=null,this.content=s,this.info=this.content.isCountable()?2:0}set marker(e){(this.info&8)>0!==e&&(this.info^=8)}get marker(){return(this.info&8)>0}get keep(){return(this.info&1)>0}set keep(e){this.keep!==e&&(this.info^=1)}get countable(){return(this.info&2)>0}get deleted(){return(this.info&4)>0}set deleted(e){this.deleted!==e&&(this.info^=4)}markDeleted(){this.info|=4}getMissing(t,n){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=Jh(n,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=Jh(n,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===Eh&&this.id.client!==this.parent.client&&this.parent.clock>=Jh(n,this.parent.client))return this.parent.client;if(this.origin&&=(this.left=eg(t,n,this.origin),this.left.lastId),this.rightOrigin&&=(this.right=$h(t,this.rightOrigin),this.right.id),this.left&&this.left.constructor===H_||this.right&&this.right.constructor===H_)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===e?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===e&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===Eh){let e=Zh(n,this.parent);e.constructor===H_?this.parent=null:this.parent=e.content.type}return null}integrate(e,t){if(t>0&&(this.id.clock+=t,this.left=eg(e,e.doc.store,Oh(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(t),this.length-=t),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let t=this.left,n;if(t!==null)n=t.right;else if(this.parentSub!==null)for(n=this.parent._map.get(this.parentSub)||null;n!==null&&n.left!==null;)n=n.left;else n=this.parent._start;let r=new Set,i=new Set;for(;n!==null&&n!==this.right;){if(i.add(n),r.add(n),Dh(this.origin,n.origin)){if(n.id.client<this.id.client)t=n,r.clear();else if(Dh(this.rightOrigin,n.rightOrigin))break}else if(n.origin!==null&&i.has(Zh(e.doc.store,n.origin)))r.has(Zh(e.doc.store,n.origin))||(t=n,r.clear());else break;n=n.right}this.left=t}if(this.left!==null)this.right=this.left.right,this.left.right=this;else{let e;if(this.parentSub!==null)for(e=this.parent._map.get(this.parentSub)||null;e!==null&&e.left!==null;)e=e.left;else e=this.parent._start,this.parent._start=this;this.right=e}this.right===null?this.parentSub!==null&&(this.parent._map.set(this.parentSub,this),this.left!==null&&this.left.delete(e)):this.right.left=this,this.parentSub===null&&this.countable&&!this.deleted&&(this.parent._length+=this.length),Yh(e.doc.store,this),this.content.integrate(e,this),ag(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new H_(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:Oh(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&Dh(e.origin,this.lastId)&&this.right===e&&Dh(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)){let t=this.parent._searchMarker;return t&&t.forEach(t=>{t.p===e&&(t.p=this,!this.deleted&&this.countable&&(t.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){let t=this.parent;this.countable&&this.parentSub===null&&(t._length-=this.length),this.markDeleted(),Hm(e.deleteSet,this.id.client,this.id.clock,this.length),ag(e,t,this.parentSub),this.content.delete(e)}}gc(e,t){if(!this.deleted)throw Ad();this.content.gc(e),t?tg(e,this,new H_(this.id,this.length)):this.content=new G_(this.length)}write(e,t){let n=t>0?Oh(this.id.client,this.id.clock+t-1):this.origin,r=this.rightOrigin,i=this.parentSub,a=this.content.getRef()&31|(n===null?0:128)|(r===null?0:64)|(i===null?0:32);if(e.writeInfo(a),n!==null&&e.writeLeftID(n),r!==null&&e.writeRightID(r),n===null&&r===null){let t=this.parent;if(t._item!==void 0){let n=t._item;if(n===null){let n=kh(t);e.writeParentInfo(!0),e.writeString(n)}else e.writeParentInfo(!1),e.writeLeftID(n.id)}else t.constructor===String?(e.writeParentInfo(!0),e.writeString(t)):t.constructor===Eh?(e.writeParentInfo(!1),e.writeLeftID(t)):Ad();i!==null&&e.writeString(i)}this.content.write(e,t)}},Cv=(e,t)=>wv[t&31](e),wv=[()=>{Ad()},K_,tv,W_,ov,Z_,$_,gv,iv,Y_,()=>{Ad()}],Tv=10,Ev=class extends B_{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor===e.constructor?(this.length+=e.length,!0):!1}integrate(e,t){Ad()}write(e,t){e.writeInfo(Tv),cd(e.restEncoder,this.length-t)}getMissing(e,t){return null}},Dv=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:{},Ov=`__ $YJS$ __`;Dv[Ov]===!0&&console.error(`Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438`),Dv[Ov]=!0;var kv=()=>{let e=!0;return(t,n)=>{if(e){e=!1;try{t()}finally{e=!0}}else n!==void 0&&n()}},Av=/[\uD800-\uDBFF]/,jv=/[\uDC00-\uDFFF]/,Mv=(e,t)=>{let n=0,r=0;for(;n<e.length&&n<t.length&&e[n]===t[n];)n++;for(n>0&&Av.test(e[n-1])&&n--;r+n<e.length&&r+n<t.length&&e[e.length-r-1]===t[t.length-r-1];)r++;return r>0&&jv.test(e[e.length-r])&&r--,{index:n,remove:e.length-n-r,insert:t.slice(n,t.length-r)}},Nv=(e,t)=>e>>>t|e<<32-t,Pv=e=>Nv(e,2)^Nv(e,13)^Nv(e,22),Fv=e=>Nv(e,6)^Nv(e,11)^Nv(e,25),Iv=e=>Nv(e,7)^Nv(e,18)^e>>>3,Lv=e=>Nv(e,17)^Nv(e,19)^e>>>10,Rv=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]),zv=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Bv=class{constructor(){let e=new ArrayBuffer(320);this._H=new Uint32Array(e,0,8),this._H.set(zv),this._W=new Uint32Array(e,64,64)}_updateHash(){let e=this._H,t=this._W;for(let e=16;e<64;e++)t[e]=Lv(t[e-2])+t[e-7]+Iv(t[e-15])+t[e-16];let n=e[0],r=e[1],i=e[2],a=e[3],o=e[4],s=e[5],c=e[6],l=e[7];for(let e=0,u,d;e<64;e++)u=l+Fv(o)+(o&s^~o&c)+Rv[e]+t[e]>>>0,d=Pv(n)+(n&r^n&i^r&i)>>>0,l=c,c=s,s=o,o=a+u>>>0,a=i,i=r,r=n,n=u+d>>>0;e[0]+=n,e[1]+=r,e[2]+=i,e[3]+=a,e[4]+=o,e[5]+=s,e[6]+=c,e[7]+=l}digest(e){let t=0;for(;t+56<=e.length;){let n=0;for(;n<16&&t+3<e.length;n++)this._W[n]=e[t++]<<24|e[t++]<<16|e[t++]<<8|e[t++];if(t%64!=0){for(this._W.fill(0,n,16);t<e.length;)this._W[n]|=e[t]<<(3-t%4)*8,t++;this._W[n]|=128<<(3-t%4)*8}this._updateHash()}let n=t%64!=0;this._W.fill(0,0,16);let r=0;for(;t<e.length;r++)for(let n=3;n>=0&&t<e.length;n--)this._W[r]|=e[t++]<<n*8;n||(this._W[r-(t%4==0?0:1)]|=128<<(3-t%4)*8),this._W[14]=e.byteLength/zu,this._W[15]=e.byteLength*8,this._updateHash();let i=new Uint8Array(32);for(let e=0;e<this._H.length;e++)for(let t=0;t<4;t++)i[e*4+t]=this._H[e]>>>(3-t)*8;return i}},Vv=e=>new Bv().digest(e),Hv=new q(`y-sync`),Uv=new q(`y-undo`),Wv=new q(`yjs-cursor`),Gv=e=>{for(let t=6;t<e.length;t++)e[t%6]=e[t%6]^e[t];return e.slice(0,6)},Kv=e=>Ff(Gv(Vv(Lf(e)))),qv=()=>({mapping:new Map,isOMark:new Map}),Jv=(e,t)=>t===void 0?!e.deleted:t.sv.has(e.id.client)&&t.sv.get(e.id.client)>e.id.clock&&!zm(t.ds,e.id),Yv=[{light:`#ecd44433`,dark:`#ecd444`}],Xv=(e,t,n)=>{if(!e.has(n)){if(e.size<t.length){let n=fu();e.forEach(e=>n.add(e)),t=t.filter(e=>!n.has(e))}e.set(n,Qd(t))}return e.get(n)},Zv=(e,{colors:t=Yv,colorMapping:n=new Map,permanentUserData:r=null,onFirstRender:i=()=>{},mapping:a}={})=>{let o=!1,s=new ty(e,a),c=new Ht({props:{editable:e=>{let t=Hv.getState(e);return t.snapshot==null&&t.prevSnapshot==null}},key:Hv,state:{init:(i,a)=>({type:e,doc:e.doc,binding:s,snapshot:null,prevSnapshot:null,isChangeOrigin:!1,isUndoRedoOperation:!1,addToHistory:!0,colors:t,colorMapping:n,permanentUserData:r}),apply:(e,t)=>{let n=e.getMeta(Hv);if(n!==void 0){t=Object.assign({},t);for(let e in n)t[e]=n[e]}return t.addToHistory=e.getMeta(`addToHistory`)!==!1,t.isChangeOrigin=n!==void 0&&!!n.isChangeOrigin,t.isUndoRedoOperation=n!==void 0&&!!n.isChangeOrigin&&!!n.isUndoRedoOperation,s.prosemirrorView!==null&&n!==void 0&&(n.snapshot!=null||n.prevSnapshot!=null)&&hm(0,()=>{s.prosemirrorView!=null&&(n.restore==null?s._renderSnapshot(n.snapshot,n.prevSnapshot,t):(s._renderSnapshot(n.snapshot,n.snapshot,t),delete t.restore,delete t.snapshot,delete t.prevSnapshot,s.mux(()=>{s._prosemirrorChanged(s.prosemirrorView.state.doc)})))}),t}},view:e=>(s.initView(e),a??s._forceRerender(),i(),{update:()=>{let t=c.getState(e.state);if(t.snapshot==null&&t.prevSnapshot==null&&(o||e.state.doc.content.findDiffStart(e.state.doc.type.createAndFill().content)!==null)){if(o=!0,t.addToHistory===!1&&!t.isChangeOrigin){let t=Uv.getState(e.state),n=t&&t.undoManager;n&&n.stopCapturing()}s.mux(()=>{t.doc.transact(n=>{n.meta.set(`addToHistory`,t.addToHistory),s._prosemirrorChanged(e.state.doc)},Hv)})}},destroy:()=>{s.destroy()}})});return c},Qv=(e,t,n)=>{if(t!==null&&t.anchor!==null&&t.head!==null)if(t.type===`all`)e.setSelection(new ke(e.doc));else if(t.type===`node`){let r=Ay(n.doc,n.type,t.anchor,n.mapping);e.setSelection($v(e,r))}else{let r=Ay(n.doc,n.type,t.anchor,n.mapping),i=Ay(n.doc,n.type,t.head,n.mapping);r!==null&&i!==null&&e.setSelection(p.between(e.doc.resolve(r),e.doc.resolve(i)))}},$v=(e,t)=>{let n=e.doc.resolve(t);return n.nodeAfter?Nt.create(e.doc,t):p.near(n)},ey=(e,t)=>({type:t.selection.jsonID,anchor:Oy(t.selection.anchor,e.type,e.mapping),head:Oy(t.selection.head,e.type,e.mapping)}),ty=class{constructor(e,t=new Map){this.type=e,this.prosemirrorView=null,this.mux=kv(),this.mapping=t,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=ey(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()?(Tf&&this._domSelectionInView===null&&(hm(0,()=>{this._domSelectionInView=null}),this._domSelectionInView=this._isDomSelectionInView()),this._domSelectionInView):!1}_isDomSelectionInView(){let e=this.prosemirrorView._root.getSelection();if(e==null||e.anchorNode==null)return!1;let t=this.prosemirrorView._root.createRange();t.setStart(e.anchorNode,e.anchorOffset),t.setEnd(e.focusNode,e.focusOffset),t.getClientRects().length===0&&t.startContainer&&t.collapsed&&t.selectNodeContents(t.startContainer);let n=t.getBoundingClientRect(),r=$p.documentElement;return n.bottom>=0&&n.right>=0&&n.left<=(window.innerWidth||r.clientWidth||0)&&n.top<=(window.innerHeight||r.clientHeight||0)}renderSnapshot(e,t){t||=Hh(Um(),new Map),this.prosemirrorView.dispatch(this._tr.setMeta(Hv,{snapshot:e,prevSnapshot:t}))}unrenderSnapshot(){this.mapping.clear(),this.mux(()=>{let e=this.type.toArray().map(e=>ry(e,this.prosemirrorView.state.schema,this)).filter(e=>e!==null),t=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new H(v.from(e),0,0));t.setMeta(Hv,{snapshot:null,prevSnapshot:null}),this.prosemirrorView.dispatch(t)})}_forceRerender(){this.mapping.clear(),this.mux(()=>{let e=this.beforeTransactionSelection===null?this.prosemirrorView.state.selection:null,t=this.type.toArray().map(e=>ry(e,this.prosemirrorView.state.schema,this)).filter(e=>e!==null),n=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new H(v.from(t),0,0));if(e){let t=wu(Tu(e.anchor,0),n.doc.content.size),r=wu(Tu(e.head,0),n.doc.content.size);n.setSelection(p.create(n.doc,t,r))}this.prosemirrorView.dispatch(n.setMeta(Hv,{isChangeOrigin:!0,binding:this}))})}_renderSnapshot(e,t,n){let r=this.doc,i=this.type;if(e||=Uh(this.doc),e instanceof Uint8Array||t instanceof Uint8Array)if((!(e instanceof Uint8Array)||!(t instanceof Uint8Array))&&Ad(),r=new Ym({gc:!1}),uh(r,t),t=Uh(r),uh(r,e),e=Uh(r),i._item===null){let e=Array.from(this.doc.share.keys()).find(e=>this.doc.share.get(e)===this.type);i=r.getXmlFragment(e)}else{let e=r.store.clients.get(i._item.id.client)??[];i=e[Xh(e,i._item.id.clock)].content.type}this.mapping.clear(),this.mux(()=>{r.transact(r=>{let a=n.permanentUserData;a&&a.dss.forEach(e=>{Lm(r,e,e=>{})});let o=(e,t)=>{let r=e===`added`?a.getUserByClientId(t.client):a.getUserByDeletedId(t);return{user:r,type:e,color:Xv(n.colorMapping,n.colors,r)}},s=Ug(i,new Vh(t.ds,e.sv)).map(n=>!n._item.deleted||Jv(n._item,e)||Jv(n._item,t)?ry(n,this.prosemirrorView.state.schema,{mapping:new Map,isOMark:new Map},e,t,o):null).filter(e=>e!==null),c=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new H(v.from(s),0,0));this.prosemirrorView.dispatch(c.setMeta(Hv,{isChangeOrigin:!0}))},Hv)})}_typeChanged(e,t){if(this.prosemirrorView==null)return;let n=Hv.getState(this.prosemirrorView.state);if(e.length===0||n.snapshot!=null||n.prevSnapshot!=null){this.renderSnapshot(n.snapshot,n.prevSnapshot);return}this.mux(()=>{let e=(e,t)=>this.mapping.delete(t);Lm(t,t.deleteSet,e=>{if(e.constructor===Sv){let t=e.content.type;t&&this.mapping.delete(t)}}),t.changed.forEach(e),t.changedParentTypes.forEach(e);let n=this.type.toArray().map(e=>ny(e,this.prosemirrorView.state.schema,this)).filter(e=>e!==null),r=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new H(v.from(n),0,0));Qv(r,this.beforeTransactionSelection,this),r=r.setMeta(Hv,{isChangeOrigin:!0,isUndoRedoOperation:t.origin instanceof mg}),this.beforeTransactionSelection!==null&&this._isLocalCursorInView()&&r.scrollIntoView(),this.prosemirrorView.dispatch(r)})}_prosemirrorChanged(e){this.doc.transact(()=>{xy(this.doc,this.type,e,this),this.beforeTransactionSelection=ey(this,this.prosemirrorView.state)},Hv)}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))}},ny=(e,t,n,r,i,a)=>{let o=n.mapping.get(e);if(o===void 0){if(e instanceof N_)return ry(e,t,n,r,i,a);throw kd()}return o},ry=(e,t,n,r,i,a)=>{let o=[],s=e=>{if(e instanceof N_){let s=ny(e,t,n,r,i,a);s!==null&&o.push(s)}else{let s=e._item.right?.content?.type;s instanceof O_&&!s._item.deleted&&s._item.id.client===s.doc.clientID&&(e.applyDelta([{retain:e.length},...s.toDelta()]),s.doc.transact(e=>{s._item.delete(e)}));let c=iy(e,t,n,r,i,a);c!==null&&c.forEach(e=>{e!==null&&o.push(e)})}};r===void 0||i===void 0?e.toArray().forEach(s):Ug(e,new Vh(i.ds,r.sv)).forEach(s);try{let s=e.getAttributes(r);r!==void 0&&(Jv(e._item,r)?Jv(e._item,i)||(s.ychange=a?a(`added`,e._item.id):{type:`added`}):s.ychange=a?a(`removed`,e._item.id):{type:`removed`});let c=t.node(e.nodeName,s,o);return n.mapping.set(e,c),c}catch(r){console.warn(`[y-prosemirror] schema.node(`+e.nodeName+`) threw:`,String(r&&r.message||r));let i=globalThis.__okYpsCounters=globalThis.__okYpsCounters||{block:0,inline:0};if(t.nodes[e.nodeName]&&t.nodes[e.nodeName].spec&&t.nodes[e.nodeName].spec.inline)i.inline++;else if(i.block++,t.nodes.rawMdxFallback)try{let i=t.node(`rawMdxFallback`,{reason:String(r&&r.message||r)},[t.text(e.nodeName)]);return n.mapping.set(e,i),i}catch(e){console.warn(`[y-prosemirror] rawMdxFallback substitution also failed:`,String(e&&e.message||e))}return n.mapping.delete(e),null}},iy=(e,t,n,r,i,a)=>{let o=[],s=e.toDelta(r,i,a);try{for(let e=0;e<s.length;e++){let n=s[e];o.push(t.text(n.insert,yy(n.attributes,t)))}}catch(e){console.warn(`[y-prosemirror] schema.text() threw:`,String(e&&e.message||e));let t=globalThis.__okYpsCounters=globalThis.__okYpsCounters||{block:0,inline:0};return t.inline++,null}return o},ay=(e,t)=>{let n=new R_,r=e.map(e=>({insert:e.text,attributes:by(e.marks,t)}));return n.applyDelta(r),t.mapping.set(n,e),n},oy=(e,t)=>{let n=new N_(e.type.name);for(let t in e.attrs){let r=e.attrs[t];r!==null&&t!==`ychange`&&n.setAttribute(t,r)}return n.insert(0,uy(e).map(e=>sy(e,t))),t.mapping.set(n,e),n},sy=(e,t)=>e instanceof Array?ay(e,t):oy(e,t),cy=e=>typeof e==`object`&&!!e,ly=(e,t)=>{let n=Object.keys(e).filter(t=>e[t]!==null),r=n.length===Object.keys(t).filter(e=>t[e]!==null).length;for(let i=0;i<n.length&&r;i++){let a=n[i],o=e[a],s=t[a];r=a===`ychange`||o===s||cy(o)&&cy(s)&&ly(o,s)}return r},uy=e=>{let t=e.content.content,n=[];for(let e=0;e<t.length;e++){let r=t[e];if(r.isText){let r=[];for(let n=t[e];e<t.length&&n.isText;n=t[++e])r.push(n);e--,n.push(r)}else n.push(r)}return n},dy=(e,t)=>{let n=e.toDelta();return n.length===t.length&&n.every((e,n)=>e.insert===t[n].text&&df(e.attributes||{}).length===t[n].marks.length&&hf(e.attributes,(e,r)=>{let i=vy(r),a=t[n].marks;return a.find(e=>e.type.name===i)?ly(e,a.find(e=>e.type.name===i)?.attrs):!1}))},fy=(e,t)=>{if(e instanceof N_&&!(t instanceof Array)&&Sy(e,t)){let n=uy(t);return e._length===n.length&&ly(e.getAttributes(),t.attrs)&&e.toArray().every((e,t)=>fy(e,n[t]))}return e instanceof R_&&t instanceof Array&&dy(e,t)},py=(e,t)=>e===t||e instanceof Array&&t instanceof Array&&e.length===t.length&&e.every((e,n)=>t[n]===e),my=(e,t,n)=>{let r=e.toArray(),i=uy(t),a=i.length,o=r.length,s=wu(o,a),c=0,l=0,u=!1;for(;c<s;c++){let e=r[c],t=i[c];if(py(n.mapping.get(e),t))u=!0;else if(!fy(e,t))break}for(;c+l<s;l++){let e=r[o-l-1],t=i[a-l-1];if(py(n.mapping.get(e),t))u=!0;else if(!fy(e,t))break}return{equalityFactor:c+l,foundMappedChild:u}},hy=e=>{let t=``,n=e._start,r={};for(;n!==null;)n.deleted||(n.countable&&n.content instanceof av?t+=n.content.str:n.content instanceof Q_&&(r[n.content.key]=null)),n=n.right;return{str:t,nAttrs:r}},gy=(e,t,n)=>{n.mapping.set(e,t);let{nAttrs:r,str:i}=hy(e),a=t.map(e=>({insert:e.text,attributes:Object.assign({},r,by(e.marks,n))})),{insert:o,remove:s,index:c}=Mv(i,a.map(e=>e.insert).join(``));e.delete(c,s),e.insert(c,o),e.applyDelta(a.map(e=>({retain:e.insert.length,attributes:e.attributes})))},_y=/(.*)(--[a-zA-Z0-9+/=]{8})$/,vy=e=>_y.exec(e)?.[1]??e,yy=(e,t)=>{let n=[];for(let r in e)n.push(t.mark(vy(r),e[r]));return n},by=(e,t)=>{let n={};return e.forEach(e=>{if(e.type.name!==`ychange`){let r=lu(t.isOMark,e.type,()=>!e.type.excludes(e.type));n[r?`${e.type.name}--${Kv(e.toJSON())}`:e.type.name]=e.attrs}}),n},xy=(e,t,n,r)=>{if(t instanceof N_&&t.nodeName!==n.type.name)throw Error(`node name mismatch!`);if(r.mapping.set(t,n),t instanceof N_){let e=t.getAttributes(),r=n.attrs;for(let n in r)r[n]===null?t.removeAttribute(n):e[n]!==r[n]&&n!==`ychange`&&t.setAttribute(n,r[n]);for(let n in e)r[n]===void 0&&t.removeAttribute(n)}let i=uy(n),a=i.length,o=t.toArray(),s=o.length,c=wu(a,s),l=0,u=0;for(;l<c;l++){let e=o[l],t=i[l];if(!py(r.mapping.get(e),t))if(fy(e,t))r.mapping.set(e,t);else break}for(;u+l+1<c;u++){let e=o[s-u-1],t=i[a-u-1];if(!py(r.mapping.get(e),t))if(fy(e,t))r.mapping.set(e,t);else break}e.transact(()=>{for(;s-l-u>0&&a-l-u>0;){let n=o[l],c=i[l],d=o[s-u-1],f=i[a-u-1];if(n instanceof R_&&c instanceof Array)dy(n,c)||gy(n,c,r),l+=1;else{let i=n instanceof N_&&Sy(n,c),a=d instanceof N_&&Sy(d,f);if(i&&a){let e=my(n,c,r),t=my(d,f,r);e.foundMappedChild&&!t.foundMappedChild?a=!1:!e.foundMappedChild&&t.foundMappedChild||e.equalityFactor<t.equalityFactor?i=!1:a=!1}i?(xy(e,n,c,r),l+=1):a?(xy(e,d,f,r),u+=1):(r.mapping.delete(t.get(l)),t.delete(l,1),t.insert(l,[sy(c,r)]),l+=1)}}let n=s-l-u;if(s===1&&a===0&&o[0]instanceof R_?(r.mapping.delete(o[0]),o[0].delete(0,o[0].length)):n>0&&(t.slice(l,l+n).forEach(e=>r.mapping.delete(e)),t.delete(l,n)),l+u<a){let e=[];for(let t=l;t<a-u;t++)e.push(sy(i[t],r));t.insert(l,e)}},Hv)},Sy=(e,t)=>!(t instanceof Array)&&e.nodeName===t.type.name,Cy=null,wy=class{constructor(e,t,n){this.view=e,this.key=t,this.value=n}apply(){let e=Hv.getState(this.view.state);if(e&&e.binding&&!e.binding.isDestroyed){let e=this.view.state.tr;e.setMeta(this.key,this.value),this.view.dispatch(e)}}},Ty=class e{constructor(e=[]){this.entries=e}getFirst(){return this.entries[0]}dequeueFirst(){return this.entries.shift()}isEmpty(){return this.entries.length===0}static fromViewsToUpdate(){let t=Cy;Cy=null;let n=[];return t.forEach((e,t)=>{e.forEach((e,r)=>{n.push(new wy(t,r,e))})}),new e(n)}},Ey=(e=Ty.fromViewsToUpdate(),t=!1)=>{let n=!0;for(;!e.isEmpty();){let r=e.getFirst();try{r.apply()}catch(r){if(r instanceof RangeError){t&&n&&e.dequeueFirst(),e.isEmpty()||hm(0,()=>Ey(e,!0));return}throw r}n=!1,e.dequeueFirst()}},Dy=(e,t,n)=>{Cy||(Cy=new Map,hm(0,Ey)),lu(Cy,e,su).set(t,n)},Oy=(e,t,n)=>{if(e===0)return Lh(t,0,-1);let r=t._first===null?null:t._first.content.type;for(;r!==null&&t!==r;){if(r instanceof R_){if(r._length>=e)return Lh(r,e,-1);if(e-=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,e--;while(r!==t&&r!==null&&r._item!==null&&r._item.next===null);r!==null&&r!==t&&(r=r._item===null?null:r._item.next.content.type)}}else{let i=(n.get(r)||{nodeSize:0}).nodeSize;if(r._first!==null&&e<i)r=r._first.content.type,e--;else{if(e===1&&r._length===0&&i>1)return new jh(r._item===null?null:r._item.id,r._item===null?kh(r):null,null);if(e-=i,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{if(e===0)return r=r._item===null?r:r._item.parent,new jh(r._item===null?null:r._item.id,r._item===null?kh(r):null,null);do r=r._item.parent,e--;while(r!==t&&r._item.next===null);r!==t&&(r=r._item.next.content.type)}}}if(r===null)throw Ad();if(e===0&&r.constructor!==R_&&r!==t)return ky(r._item.parent,r._item)}return Lh(t,t._length,-1)},ky=(e,t)=>{let n=null,r=null;return e._item===null?r=kh(e):n=Oh(e._item.id.client,e._item.id.clock),new jh(n,r,t.id)},Ay=(e,t,n,r)=>{let i=zh(n,e);if(i===null||i.type!==t&&!Ah(t,i.type._item))return null;let a=i.type,o=0;if(a.constructor===R_)o=i.index;else if(a._item===null||!a._item.deleted){let e=a._first,t=0;for(;t<a._length&&t<i.index&&e!==null;){if(!e.deleted){let n=e.content.type;t++,n instanceof R_?o+=n._length:o+=r.get(n).nodeSize}e=e.right}o+=1}for(;a!==t&&a._item!==null;){let e=a._item.parent;if(e._item===null||!e._item.deleted){o+=1;let t=e._first;for(;t!==null;){let e=t.content.type;if(e===a)break;t.deleted||(e instanceof R_?o+=e._length:o+=r.get(e).nodeSize),t=t.right}}a=e}return o-1},jy=(e,t)=>{let n=qv(),r=e.toArray().map(e=>ry(e,t,n)).filter(e=>e!==null);return{doc:t.topNodeType.create(null,v.fromArray(r)),meta:n,mapping:n.mapping}},My=(e,t,n)=>e!==t,Ny=e=>{let t=document.createElement(`span`);t.classList.add(`ProseMirror-yjs-cursor`),t.setAttribute(`style`,`border-color: ${e.color}`);let n=document.createElement(`div`);n.setAttribute(`style`,`background-color: ${e.color}`),n.insertBefore(document.createTextNode(e.name),null);let r=document.createTextNode(``),i=document.createTextNode(``);return t.insertBefore(r,null),t.insertBefore(n,null),t.insertBefore(i,null),t},Py=e=>({style:`background-color: ${e.color}70`,class:`ProseMirror-yjs-selection`}),Fy=/^#[0-9a-fA-F]{6}$/,Iy=(e,t,n,r,i)=>{let a=Hv.getState(e);if(a==null||a.doc==null||a.binding==null)return Qe.create(e.doc,[]);let o=a.doc,s=[];return a.snapshot!=null||a.prevSnapshot!=null||a.binding.mapping.size===0?Qe.create(e.doc,[]):(t.getStates().forEach((t,c)=>{if(n(o.clientID,c,t)&&t.cursor!=null){let n=t.user||{};n.color==null?n.color=`#ffa500`:Fy.test(n.color)||console.warn(`A user uses an unsupported color format`,n),n.name??=`User: ${c}`;let l=Ay(o,a.type,Nh(t.cursor.anchor),a.binding.mapping),u=Ay(o,a.type,Nh(t.cursor.head),a.binding.mapping);if(l!==null&&u!==null){let t=Tu(e.doc.content.size-1,0);l=wu(l,t),u=wu(u,t),s.push(dt.widget(u,()=>r(n,c),{key:c+``,side:10}));let a=wu(l,u),o=Tu(l,u);s.push(dt.inline(a,o,i(n,c),{inclusiveEnd:!0,inclusiveStart:!1}))}}}),Qe.create(e.doc,s))},Ly=(e,{awarenessStateFilter:t=My,cursorBuilder:n=Ny,selectionBuilder:r=Py,getSelection:i=e=>e.selection}={},a=`cursor`)=>new Ht({key:Wv,state:{init(i,a){return Iy(a,e,t,n,r)},apply(i,a,o,s){let c=Hv.getState(s),l=i.getMeta(Wv);return c&&c.isChangeOrigin||l&&l.awarenessUpdated?Iy(s,e,t,n,r):a.map(i.mapping,i.doc)}},props:{decorations:e=>Wv.getState(e)},view:t=>{let n=()=>{t.docView&&Dy(t,Wv,{awarenessUpdated:!0})},r=()=>{let n=Hv.getState(t.state),r=e.getLocalState()||{};if(t.hasFocus()){let o=i(t.state),s=Oy(o.anchor,n.type,n.binding.mapping),c=Oy(o.head,n.type,n.binding.mapping);(r.cursor==null||!Bh(Nh(r.cursor.anchor),s)||!Bh(Nh(r.cursor.head),c))&&e.setLocalStateField(a,{anchor:s,head:c})}else r.cursor!=null&&Ay(n.doc,n.type,Nh(r.cursor.anchor),n.binding.mapping)!==null&&e.setLocalStateField(a,null)};return e.on(`change`,n),t.dom.addEventListener(`focusin`,r),t.dom.addEventListener(`focusout`,r),{update:r,destroy:()=>{t.dom.removeEventListener(`focusin`,r),t.dom.removeEventListener(`focusout`,r),e.off(`change`,n),e.setLocalStateField(a,null)}}}}),Ry=e=>{let t=Uv.getState(e).undoManager;if(t!=null)return t.undo(),!0},zy=e=>{let t=Uv.getState(e).undoManager;if(t!=null)return t.redo(),!0},By=new Set([`paragraph`]),Vy=(e,t)=>!(e instanceof Sv)||!(e.content instanceof hv)||!(e.content.type instanceof O_||e.content.type instanceof N_&&t.has(e.content.type.nodeName))||e.content.type._length===0,Hy=({protectedNodes:e=By,trackedOrigins:t=[],undoManager:n=null}={})=>new Ht({key:Uv,state:{init:(r,i)=>{let a=Hv.getState(i),o=n||new mg(a.type,{trackedOrigins:new Set([Hv].concat(t)),deleteFilter:t=>Vy(t,e),captureTransaction:e=>e.meta.get(`addToHistory`)!==!1});return{undoManager:o,prevSel:null,hasUndoOps:o.undoStack.length>0,hasRedoOps:o.redoStack.length>0}},apply:(e,t,n,r)=>{let i=Hv.getState(r).binding,a=t.undoManager,o=a.undoStack.length>0,s=a.redoStack.length>0;return i?{undoManager:a,prevSel:ey(i,n),hasUndoOps:o,hasRedoOps:s}:o!==t.hasUndoOps||s!==t.hasRedoOps?Object.assign({},t,{hasUndoOps:a.undoStack.length>0,hasRedoOps:a.redoStack.length>0}):t}},view:e=>{let t=Hv.getState(e.state),n=Uv.getState(e.state).undoManager;return n.on(`stack-item-added`,({stackItem:n})=>{let r=t.binding;r&&n.meta.set(r,Uv.getState(e.state).prevSel)}),n.on(`stack-item-popped`,({stackItem:e})=>{let n=t.binding;n&&(n.beforeTransactionSelection=e.meta.get(n)||n.beforeTransactionSelection)}),{destroy:()=>{n.destroy()}}}});function Uy(e){let{char:t,allowSpaces:n,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:a,$position:o}=e,s=n&&!r,c=l(t),u=RegExp(`\\s${c}$`),d=a?`^`:``,f=r?``:c,p=RegExp(s?`${d}${c}.*?(?=\\s${f}|$)`:`${d}(?:^)?${c}[^\\s${f}]*`,`gm`),m=o.nodeBefore?.isText&&o.nodeBefore.text;if(!m)return null;let h=o.pos-m.length,g=Array.from(m.matchAll(p)).pop();if(!g||g.input===void 0||g.index===void 0)return null;let _=g.input.slice(Math.max(0,g.index-1),g.index),v=RegExp(`^[${i?.join(``)}\0]?$`).test(_);if(i!==null&&!v)return null;let y=h+g.index,b=y+g[0].length;return s&&u.test(m.slice(b-1,b+1))&&(g[0]+=` `,b+=1),y<o.pos&&b>=o.pos?{range:{from:y,to:b},query:g[0].slice(t.length),text:g[0]}:null}function Wy(e){return e.docChanged?e.steps.some(e=>{let t=e.slice;if(!t?.content)return!1;let n=t.content.textBetween(0,t.content.size,`
|
|
@@ -31,4 +31,4 @@ body{background:var(--background);color:var(--foreground)}
|
|
|
31
31
|
</style>`}function ZK(e){return`<script>(function(){var d=document.documentElement;${e===`dark`?`d.classList.add('dark');`:``}addEventListener('message',function(e){if(e.source!==parent)return;var t=e&&e.data&&e.data.${HK};if(t==='dark'){d.classList.add('dark');}else if(t==='light'){d.classList.remove('dark');}});var raf;function report(){var b=document.body;if(!b)return;var r=b.getBoundingClientRect();var mb=parseFloat(getComputedStyle(b).marginBottom)||0;parent.postMessage({${WK}:Math.ceil(r.bottom+mb)},'*');}function schedule(){if(raf){cancelAnimationFrame(raf);}raf=requestAnimationFrame(report);}function init(){schedule();addEventListener('load',schedule);if(window.ResizeObserver){try{new ResizeObserver(schedule).observe(document.body);}catch(_e){}}}if(document.readyState==='loading'){document.addEventListener('DOMContentLoaded',init);}else{init();}var cspSeen=new Set();var cspList=[];var cspTrunc=false;var cspTimer;function cspFlush(){parent.postMessage({${KK}:{blocked:cspList.slice(),truncated:cspTrunc}},'*');}addEventListener('securitypolicyviolation',function(e){if(cspTrunc)return;var dir=(e&&(e.effectiveDirective||e.violatedDirective))||'';var uri=(e&&e.blockedURI)||'';var k=dir+' '+uri;if(cspSeen.has(k))return;cspSeen.add(k);if(cspList.length<20){cspList.push({directive:dir,uri:uri});}else{cspTrunc=true;}if(cspTimer){clearTimeout(cspTimer);}cspTimer=setTimeout(cspFlush,250);});})();<\/script>`}var QK=`default-src 'none'; script-src 'unsafe-inline' https:; style-src 'unsafe-inline' https: data:; img-src https: data: blob:; font-src https: data:; connect-src https: wss: data: blob:; media-src https: data: blob:; frame-src https:; child-src https:; form-action 'none'; base-uri 'none';`;function $K(e){return`<meta http-equiv="Content-Security-Policy" content="${QK}">
|
|
32
32
|
${XK()}
|
|
33
33
|
${JK}
|
|
34
|
-
${ZK(e)}`}var eq=`plaintext`;function tq(){return typeof document<`u`&&document.documentElement.classList.contains(`dark`)?`dark`:`light`}function nq(e,t){let n=(0,Z.c)(4),[r,i]=(0,Q.useState)(!1),a,o;return n[0]!==e||n[1]!==t?(a=()=>{let n=()=>{let n=typeof t==`function`?t():void 0;if(typeof n!=`number`)return;let r=e.state.doc.nodeAt(n);if(!r)return;let{from:a,to:o}=e.state.selection,s=n,c=a<n+r.nodeSize&&o>s;i(e=>e===c?e:c)};return n(),e.on(`selectionUpdate`,n),()=>{e.isDestroyed||e.off(`selectionUpdate`,n)}},o=[e,t],n[0]=e,n[1]=t,n[2]=a,n[3]=o):(a=n[2],o=n[3]),(0,Q.useEffect)(a,o),r}function rq(e){let t=(0,Z.c)(174),{node:n,updateAttributes:r,editor:i,getPos:a,selected:c}=e,{_:l}=s(),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(!1),m=(0,Q.useRef)(null),h=(0,Q.useRef)(null),g=(0,Q.useRef)(null),[_,v]=(0,Q.useState)(null),[y,b]=(0,Q.useState)(null),{resolvedTheme:x}=ie(),S;t[0]===x?S=t[1]:(S=x===`dark`||x===`light`?x:tq(),t[0]=x,t[1]=S);let C=S,[w]=(0,Q.useState)(tq),T=n.attrs.language??null,E=n.attrs.meta??null,D;t[2]===E?D=t[3]:(D=zK(E),t[2]=E,t[3]=D);let O=D,[k,A]=(0,Q.useState)(!1),[j,M]=(0,Q.useState)(!1),N=(0,Q.useId)(),P=`${N}-title-input`,F=`${N}-title-help`,I=(0,Q.useRef)(E),L,R;t[4]===E?(L=t[5],R=t[6]):(L=()=>{I.current=E},R=[E],t[4]=E,t[5]=L,t[6]=R),(0,Q.useEffect)(L,R);let z,B,V,H,ee;if(t[7]!==l||t[8]!==T||t[9]!==E){B=SK(T),z=T?bK.find(e=>e.value===B)?.label??T:l({id:`LpB85N`});let e;t[15]===E?e=t[16]:(e=EK(E,`preview`),t[15]=E,t[16]=e),H=e,V=B?kK.has(B):!1,ee=AK(B,E),t[7]=l,t[8]=T,t[9]=E,t[10]=z,t[11]=B,t[12]=V,t[13]=H,t[14]=ee}else z=t[10],B=t[11],V=t[12],H=t[13],ee=t[14];let U=ee,W;t[17]!==U||t[18]!==E?(W=U?FK(E):null,t[17]=U,t[18]=E,t[19]=W):W=t[19];let te=W,G;t[20]!==U||t[21]!==E?(G=U?IK(E):null,t[20]=U,t[21]=E,t[22]=G):G=t[22];let ne=G,re=te??(_===null?void 0:`${_}px`),ae=!U,oe,se;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(oe=()=>()=>{m.current!==null&&window.clearTimeout(m.current)},se=[],t[23]=oe,t[24]=se):(oe=t[23],se=t[24]),(0,Q.useEffect)(oe,se);let K=i.isEditable,ce=nq(i,a),le,ue;t[25]===C?(le=t[26],ue=t[27]):(le=()=>{g.current?.contentWindow?.postMessage(UK(C),`*`)},ue=[C],t[25]=C,t[26]=le,t[27]=ue),(0,Q.useEffect)(le,ue);let de,fe;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(de=()=>{let e=function(e){if(e.source!==g.current?.contentWindow)return;let t=GK(e.data);if(t!==null){v(e=>e!==null&&Math.abs(e-t)<=2?e:t);return}let n=qK(e.data);n!==null&&b(n)};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},fe=[],t[28]=de,t[29]=fe):(de=t[28],fe=t[29]),(0,Q.useEffect)(de,fe);let pe;t[30]===n.textContent?pe=t[31]:(pe=()=>{let e=n.textContent,t=()=>{p(!0),m.current!==null&&window.clearTimeout(m.current),m.current=window.setTimeout(()=>p(!1),1200)};try{typeof navigator<`u`&&navigator.clipboard?.writeText&&navigator.clipboard.writeText(e).then(t,sq)}catch{}},t[30]=n.textContent,t[31]=pe);let me=pe,he;t[32]!==i||t[33]!==a?(he=()=>{let e=typeof a==`function`?a():void 0;if(typeof e==`number`)try{i.chain().focus().setNodeSelection(e).deleteSelection().run()}catch(e){let t=e;if(!(t instanceof RangeError))throw t;console.warn(`[CodeBlockView] delete failed — position race`,t)}},t[32]=i,t[33]=a,t[34]=he):he=t[34];let ge=he,_e;t[35]!==H||t[36]!==E||t[37]!==r?(_e=()=>{r({meta:H?OK(E,`preview`):DK(E,`preview`)})},t[35]=H,t[36]=E,t[37]=r,t[38]=_e):_e=t[38];let ve=_e,ye;t[39]!==E||t[40]!==r?(ye=e=>{let t=BK(E,e.length>0?e:null);t!==E&&r({meta:t})},t[39]=E,t[40]=r,t[41]=ye):ye=t[41];let be=ye,xe;t[42]!==i.state||t[43]!==i.view||t[44]!==a||t[45]!==n.attrs||t[46]!==n.nodeSize||t[47]!==n.type?(xe=e=>{let t=typeof a==`function`?a():void 0;if(typeof t==`number`)try{let{schema:r,tr:a}=i.state,o=n.type.create(n.attrs,e.length>0?r.text(e):null);a.replaceWith(t,t+n.nodeSize,o),i.view.dispatch(a)}catch(e){let t=e;if(!(t instanceof RangeError))throw t;console.warn(`[CodeBlockView] edit-save failed — position race`,t)}},t[42]=i.state,t[43]=i.view,t[44]=a,t[45]=n.attrs,t[46]=n.nodeSize,t[47]=n.type,t[48]=xe):xe=t[48];let Se=xe,Ce;t[49]===r?Ce=t[50]:(Ce=e=>{let t=`${Math.round(e.width)}px`,n=`${Math.round(e.height)}px`;r({meta:PK(PK(I.current,`h`,n),`w`,t)})},t[49]=r,t[50]=Ce);let we=Ce,Te=T??void 0,Ee=ce?`true`:void 0,De=c?`true`:void 0,Oe=U?`true`:void 0,ke=ae?`true`:`false`,Ae;t[51]!==l||t[52]!==C||t[53]!==w||t[54]!==ae||t[55]!==re||t[56]!==we||t[57]!==n.textContent||t[58]!==U||t[59]!==ne?(Ae=U?(0,X.jsxs)(`div`,{ref:h,className:Xt(`ok-codeblock-preview`,ae?`ok-codeblock-preview--with-code`:`ok-codeblock-preview--solo`),contentEditable:!1,style:{...re?{height:re}:{},...ne?{width:ne}:{}},onMouseDown:oq,children:[(0,X.jsx)(`iframe`,{title:l({id:`G7cMuO`}),ref:g,sandbox:`allow-scripts`,referrerPolicy:`no-referrer`,srcDoc:$K(w)+n.textContent,className:`ok-codeblock-preview-frame`,onLoad:()=>{b(null),g.current?.contentWindow?.postMessage(UK(C),`*`)}}),(0,X.jsx)(jk,{targetRef:h,bounds:{minWidth:192,maxWidth:Math.round(window.innerWidth*.9),minHeight:128,maxHeight:Math.round(window.innerHeight*.9)},onResize:e=>{let t=h.current;t&&(t.style.width=`${e.width}px`,t.style.height=`${e.height}px`)},onResizeEnd:we})]}):null,t[51]=l,t[52]=C,t[53]=w,t[54]=ae,t[55]=re,t[56]=we,t[57]=n.textContent,t[58]=U,t[59]=ne,t[60]=Ae):Ae=t[60];let je;t[61]!==y||t[62]!==U?(je=U&&y?(0,X.jsx)(yK,{blocked:y.blocked,truncated:y.truncated,onDismiss:()=>b(null)}):null,t[61]=y,t[62]=U,t[63]=je):je=t[63];let Me;t[64]===O?Me=t[65]:(Me=O?(0,X.jsx)(`div`,{className:`ok-codeblock-title`,contentEditable:!1,"data-testid":`ok-codeblock-title`,title:O,children:(0,X.jsx)(`span`,{className:`ok-codeblock-title-text`,children:O})}):null,t[64]=O,t[65]=Me);let Ne=U&&ae?`rounded-b-lg`:null,Pe=U?null:`rounded-lg`,q;t[66]!==Ne||t[67]!==Pe?(q=Xt(`ok-codeblock-pre m-0 overflow-x-auto px-5 py-4 font-mono text-sm leading-relaxed`,Ne,Pe),t[66]=Ne,t[67]=Pe,t[68]=q):q=t[68];let Fe=!ae||void 0,Ie=T?`language-${T}`:void 0,Le;t[69]===Ie?Le=t[70]:(Le=Xt(`hljs block whitespace-pre bg-transparent p-0`,Ie),t[69]=Ie,t[70]=Le);let Re;t[71]===Le?Re=t[72]:(Re=(0,X.jsx)(ql,{as:`code`,className:Le}),t[71]=Le,t[72]=Re);let ze;t[73]!==q||t[74]!==Fe||t[75]!==Re?(ze=(0,X.jsx)(`pre`,{className:q,"aria-hidden":Fe,children:Re}),t[73]=q,t[74]=Fe,t[75]=Re,t[76]=ze):ze=t[76];let Be;t[77]===Symbol.for(`react.memo_cache_sentinel`)?(Be={[MF]:`true`},t[77]=Be):Be=t[77];let Ve=!K,He;t[78]!==l||t[79]!==z?(He=l({id:`c5f7sm`,values:{currentLabel:z}}),t[78]=l,t[79]=z,t[80]=He):He=t[80];let Ue;t[81]===z?Ue=t[82]:(Ue=(0,X.jsx)(`span`,{children:z}),t[81]=z,t[82]=Ue);let We;t[83]===K?We=t[84]:(We=K?(0,X.jsx)(yn,{className:`size-3 opacity-60`,"aria-hidden":`true`}):null,t[83]=K,t[84]=We);let Ge;t[85]!==Ve||t[86]!==He||t[87]!==Ue||t[88]!==We?(Ge=(0,X.jsx)(gc,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,disabled:Ve,className:`ok-codeblock-chrome-btn ok-codeblock-chrome-lang`,"aria-label":He,children:[Ue,We]})}),t[85]=Ve,t[86]=He,t[87]=Ue,t[88]=We,t[89]=Ge):Ge=t[89];let Ke;t[90]===l?Ke=t[91]:(Ke=l({id:`G_mWXb`}),t[90]=l,t[91]=Ke);let qe;t[92]===Ke?qe=t[93]:(qe=(0,X.jsx)(Tx,{placeholder:Ke}),t[92]=Ke,t[93]=qe);let Je;t[94]===l?Je=t[95]:(Je=l({id:`ETyvvg`}),t[94]=l,t[95]=Je);let Ye;t[96]===Je?Ye=t[97]:(Ye=(0,X.jsx)(Dx,{children:Je}),t[96]=Je,t[97]=Ye);let Xe;t[98]!==i.commands||t[99]!==B||t[100]!==T||t[101]!==r?(Xe=bK.map(e=>{let t=e.value===eq?!T||B===eq:B===e.value;return(0,X.jsxs)(kx,{value:`${e.label} ${e.value} ${e.aliases?.join(` `)??``}`,onSelect:()=>{r({language:e.value===eq?null:e.value}),d(!1),i.commands.focus()},children:[(0,X.jsx)(`span`,{className:`flex-1`,children:e.label}),t?(0,X.jsx)(tn,{className:`size-3.5`,"aria-hidden":`true`}):null]},e.value)}),t[98]=i.commands,t[99]=B,t[100]=T,t[101]=r,t[102]=Xe):Xe=t[102];let Ze;t[103]===Xe?Ze=t[104]:(Ze=(0,X.jsx)(Ox,{children:Xe}),t[103]=Xe,t[104]=Ze);let Qe;t[105]!==Ye||t[106]!==Ze?(Qe=(0,X.jsxs)(Ex,{children:[Ye,Ze]}),t[105]=Ye,t[106]=Ze,t[107]=Qe):Qe=t[107];let $e;t[108]!==qe||t[109]!==Qe?($e=(0,X.jsx)(_c,{align:`end`,sideOffset:6,className:`w-56 p-0`,children:(0,X.jsxs)(Cx,{filter:iq,children:[qe,Qe]})}),t[108]=qe,t[109]=Qe,t[110]=$e):$e=t[110];let et;t[111]!==u||t[112]!==Ge||t[113]!==$e?(et=(0,X.jsxs)(hc,{open:u,onOpenChange:d,children:[Ge,$e]}),t[111]=u,t[112]=Ge,t[113]=$e,t[114]=et):et=t[114];let tt;t[115]!==l||t[116]!==K||t[117]!==U?(tt=K&&U?(0,X.jsx)(`button`,{type:`button`,className:`ok-codeblock-chrome-btn`,"aria-label":l({id:`R3y75Z`}),"data-testid":`ok-codeblock-edit-btn`,onClick:()=>M(!0),children:(0,X.jsx)(qn,{className:`size-3.5`,"aria-hidden":`true`})}):null,t[115]=l,t[116]=K,t[117]=U,t[118]=tt):tt=t[118];let nt;t[119]!==l||t[120]!==K||t[121]!==ve||t[122]!==V||t[123]!==H?(nt=K&&V?(0,X.jsx)(`button`,{type:`button`,className:`ok-codeblock-chrome-btn`,"data-active":H?`true`:void 0,"aria-pressed":H,"aria-label":l(H?{id:`xHGM4U`}:{id:`7OwvEL`}),onClick:ve,children:H?(0,X.jsx)(Qi,{className:`size-3.5`}):(0,X.jsx)($i,{className:`size-3.5`})}):null,t[119]=l,t[120]=K,t[121]=ve,t[122]=V,t[123]=H,t[124]=nt):nt=t[124];let rt;t[125]!==l||t[126]!==K||t[127]!==be||t[128]!==k||t[129]!==O||t[130]!==F||t[131]!==P?(rt=K?(0,X.jsxs)(hc,{open:k,onOpenChange:A,children:[(0,X.jsx)(gc,{asChild:!0,children:(0,X.jsx)(`button`,{type:`button`,className:`ok-codeblock-chrome-btn`,"data-active":O?`true`:void 0,"aria-label":l({id:`DDTdLl`}),children:(0,X.jsx)(ja,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,X.jsx)(_c,{align:`end`,sideOffset:6,className:`w-64 p-3`,children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsx)(`label`,{htmlFor:P,className:`text-2xs font-mono uppercase tracking-wide text-muted-foreground`,children:(0,X.jsx)(o,{id:`MHrjPM`})}),(0,X.jsx)(Ir,{id:P,type:`text`,value:O??``,placeholder:l({id:`mk2poV`}),"data-testid":`ok-codeblock-title-input`,"aria-describedby":F,onChange:e=>be(e.target.value),onKeyDown:e=>{(e.key===`Enter`||e.key===`Escape`)&&(e.preventDefault(),A(!1))},className:`h-8`}),(0,X.jsx)(`p`,{id:F,className:`text-2xs text-muted-foreground`,children:(0,X.jsx)(o,{id:`lond3p`})})]})})]}):null,t[125]=l,t[126]=K,t[127]=be,t[128]=k,t[129]=O,t[130]=F,t[131]=P,t[132]=rt):rt=t[132];let it;t[133]!==l||t[134]!==f?(it=l(f?{id:`6V3Ea3`}:{id:`NmPNJJ`}),t[133]=l,t[134]=f,t[135]=it):it=t[135];let at;t[136]===f?at=t[137]:(at=f?(0,X.jsx)(tn,{className:`size-3.5`,"aria-hidden":`true`}):(0,X.jsx)(Gn,{className:`size-3.5`,"aria-hidden":`true`}),t[136]=f,t[137]=at);let ot;t[138]!==me||t[139]!==it||t[140]!==at?(ot=(0,X.jsx)(`button`,{type:`button`,className:`ok-codeblock-chrome-btn`,"aria-label":it,onClick:me,children:at}),t[138]=me,t[139]=it,t[140]=at,t[141]=ot):ot=t[141];let st;t[142]!==l||t[143]!==K||t[144]!==ge?(st=K?(0,X.jsx)(`button`,{type:`button`,className:`ok-codeblock-chrome-btn ok-codeblock-chrome-btn--delete`,"aria-label":l({id:`oBXkm2`}),onClick:ge,children:(0,X.jsx)(Hn,{className:`size-3.5`,"aria-hidden":`true`})}):null,t[142]=l,t[143]=K,t[144]=ge,t[145]=st):st=t[145];let ct;t[146]!==et||t[147]!==tt||t[148]!==nt||t[149]!==rt||t[150]!==ot||t[151]!==st?(ct=(0,X.jsxs)(`div`,{className:`ok-codeblock-chrome`,contentEditable:!1,onMouseDown:aq,...Be,children:[et,tt,nt,rt,ot,st]}),t[146]=et,t[147]=tt,t[148]=nt,t[149]=rt,t[150]=ot,t[151]=st,t[152]=ct):ct=t[152];let lt;t[153]!==l||t[154]!==w||t[155]!==j||t[156]!==K||t[157]!==Se||t[158]!==n.textContent||t[159]!==B||t[160]!==U?(lt=K&&U?(0,X.jsx)(_K,{open:j,onOpenChange:M,initialValue:n.textContent,language:B===`xml`?`html`:`plain`,title:l({id:`R3y75Z`}),renderPreview:e=>(0,X.jsx)(`iframe`,{title:l({id:`G7cMuO`}),sandbox:`allow-scripts`,className:`size-full border-0`,srcDoc:$K(w)+e}),onSave:Se}):null,t[153]=l,t[154]=w,t[155]=j,t[156]=K,t[157]=Se,t[158]=n.textContent,t[159]=B,t[160]=U,t[161]=lt):lt=t[161];let ut;return t[162]!==Te||t[163]!==Ee||t[164]!==De||t[165]!==Oe||t[166]!==ke||t[167]!==Ae||t[168]!==je||t[169]!==Me||t[170]!==ze||t[171]!==ct||t[172]!==lt?(ut=(0,X.jsxs)(Jl,{className:`ok-codeblock relative my-3`,"data-language":Te,"data-cursor-inside":Ee,"data-selected":De,"data-preview":Oe,"data-code-visible":ke,children:[Ae,je,Me,ze,ct,lt]}),t[162]=Te,t[163]=Ee,t[164]=De,t[165]=Oe,t[166]=ke,t[167]=Ae,t[168]=je,t[169]=Me,t[170]=ze,t[171]=ct,t[172]=lt,t[173]=ut):ut=t[173],ut}function iq(e,t){return t?+!!e.toLowerCase().includes(t.toLowerCase()):1}function aq(e){return e.stopPropagation()}function oq(e){return e.stopPropagation()}function sq(){}function cq(e,t=[]){return e.flatMap(e=>{if(e.type===`text`)return[{text:e.value,classes:t}];let n=[...t,...e.properties?.className??[]];return cq(e.children,n)})}function lq(e){let{doc:t,name:n,lowlight:r,defaultLanguage:i}=e,a=[],o=r.listLanguages();return He(t,e=>e.type.name===n).forEach(e=>{let t=e.pos+1,n=e.node.attrs.language||i;if(!n||!(o.includes(n)||(r.registered?.(n)??!1)))return;let s;try{s=r.highlight(n,e.node.textContent)}catch{return}let c=s.children??[];for(let e of cq(c)){let n=t+e.text.length;e.classes.length>0&&a.push(dt.inline(t,n,{class:e.classes.join(` `)})),t=n}}),Qe.create(t,a)}function uq(e){let{name:t,lowlight:n,defaultLanguage:r}=e,i=new Ht({key:new q(`codeBlockLowlight`),state:{init:(e,{doc:i})=>lq({doc:i,name:t,lowlight:n,defaultLanguage:r}),apply:(e,i,a,o)=>{if(!e.docChanged)return i.map(e.mapping,e.doc);let s=a.selection.$head.parent.type.name,c=o.selection.$head.parent.type.name,l=He(a.doc,e=>e.type.name===t),u=He(o.doc,e=>e.type.name===t);return[s,c].includes(t)||u.length!==l.length||e.steps.some(e=>{let t=e;return t.from===void 0||t.to===void 0?!1:l.some(e=>t.from<e.pos+e.node.nodeSize&&t.to>e.pos)})?lq({doc:e.doc,name:t,lowlight:n,defaultLanguage:r}):i.map(e.mapping,e.doc)}},props:{decorations(e){return i.getState(e)}}});return i}var dq=CF(yF),fq=se.extend({addOptions(){return{...this.parent?.(),enableTabIndentation:!0,tabSize:2}},addNodeView(){return nu(rq)},addProseMirrorPlugins(){return[...this.parent?.()??[],uq({name:this.name,lowlight:dq,defaultLanguage:null})]},addInputRules(){return[...this.parent?.()??[],Ke({find:/^```$/,type:this.type,getAttributes:()=>({language:`js`})})]}});function pq(e){return!!e.getMeta(Hv)}function mq(e,t){let n=Hv.getState(e);return Ay(n.doc,n.type,t,n.binding.mapping)||0}function hq(e,t){let n=Hv.getState(e);return Oy(t,n.type,n.binding.mapping)}var gq=class e extends Se{constructor(e,t){super(e),this.yRelativePosition=t}static fromJSON(t){return new e(t.position,t.yRelativePosition)}toJSON(){return{position:this.position,yRelativePosition:this.yRelativePosition}}};function _q(e,t){return new gq(e,hq(t,e))}function vq(e,t,n){let r=e instanceof gq?e.yRelativePosition:null;if(pq(t)&&r)return{position:new gq(mq(n,r),r),mapResult:null};let i=Ne(e,t),a=i.position.position;return{position:new gq(a,r??hq(n,a)),mapResult:i.mapResult}}var yq=F.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(e=>e.name===`undoRedo`)&&console.warn(`[tiptap warn]: "@tiptap/extension-collaboration" comes with its own history support and is not compatible with "@tiptap/extension-undo-redo".`)},onBeforeCreate(){this.editor.utils.getUpdatedPosition=(e,t)=>vq(e,t,this.editor.state),this.editor.utils.createMappablePosition=e=>_q(e,this.editor.state)},addCommands(){return{undo:()=>({tr:e,state:t,dispatch:n})=>(e.setMeta(`preventDispatch`,!0),Uv.getState(t).undoManager.undoStack.length===0?!1:n?Ry(t):!0),redo:()=>({tr:e,state:t,dispatch:n})=>(e.setMeta(`preventDispatch`,!0),Uv.getState(t).undoManager.redoStack.length===0?!1:n?zy(t):!0)}},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-y":()=>this.editor.commands.redo(),"Shift-Mod-z":()=>this.editor.commands.redo()}},addProseMirrorPlugins(){let e=this.options.fragment?this.options.fragment:this.options.document.getXmlFragment(this.options.field),t=Hy(this.options.yUndoOptions),n=t.spec.view;return t.spec.view=e=>{let{undoManager:t}=Uv.getState(e.state);t.restore&&=(t.restore(),()=>{});let r=n?n(e):void 0;return{destroy:()=>{let e=t.trackedOrigins.has(t),n=t._observers;t.restore=()=>{e&&t.trackedOrigins.add(t),t.doc.on(`afterTransaction`,t.afterTransactionHandler),t._observers=n},r?.destroy&&r.destroy()}}},[Zv(e,{...this.options.ySyncOptions,onFirstRender:this.options.onFirstRender}),t,this.editor.options.enableContentCheck&&new Ht({key:new q(`filterInvalidContent`),filterTransaction:t=>{if(!pq(t))return!0;if(this.storage.isDisabled)return!1;if(!t.docChanged)return!0;try{return t.doc.check(),!0}catch(t){return this.storage.isDisabled=!0,this.editor.emit(`contentError`,{error:t,editor:this.editor,disableCollaboration:()=>{var t;(t=e.doc)==null||t.destroy()}}),!1}}})].filter(Boolean)}});function bq(e){if(!e.length)return Qe.empty;let t=[],n=e[0].$from.node(0);return e.forEach(e=>{let n=e.$from.pos,r=e.$from.nodeAfter;r&&t.push(dt.node(n,n+r.nodeSize,{class:`ProseMirror-selectednoderange`}))}),Qe.create(n,t)}function xq(e,t,n){let r=n.isText||n.isAtom?0:1;return{start:e+r,end:e+t-r}}function Sq(e,t,n,r={}){let i=[],a=e.node(0),{extendOnBoundaryOverlap:o=!0}=r;typeof n==`number`&&n>=0||(n=e.sameParent(t)?Math.max(0,e.sharedDepth(t.pos)-1):e.sharedDepth(t.pos));let s=new g(e,t,n),c=s.depth===0?0:a.resolve(s.start).posAtIndex(0);return s.parent.forEach((n,r)=>{let l=c+r,u=l+n.nodeSize,d=xq(l,n.nodeSize,n),f=o?t.pos>=d.start&&e.pos<=d.end:t.pos>d.start&&e.pos<d.end;if(l<s.start||l>=s.end||!f)return;let p=new K(a.resolve(l),a.resolve(u));i.push(p)}),i}var Cq=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){return new wq(e.resolve(this.anchor),e.resolve(this.head))}},wq=class e extends zt{constructor(e,t,n,r=1){let{doc:i}=e,a=e===t,o=e.pos===i.content.size&&t.pos===i.content.size,s=a&&!o?i.resolve(t.pos+(r>0?1:-1)):t,c=a&&o?i.resolve(e.pos-(r>0?1:-1)):e,l=Sq(c.min(s),c.max(s),n),u=s.pos>=e.pos?l[0].$from:l[l.length-1].$to,d=s.pos>=e.pos?l[l.length-1].$to:l[0].$from;super(u,d,l),this.depth=n}get $to(){return this.ranges[this.ranges.length-1].$to}eq(t){return t instanceof e&&t.$from.pos===this.$from.pos&&t.$to.pos===this.$to.pos}map(t,n){return new e(t.resolve(n.map(this.anchor)),t.resolve(n.map(this.head)))}toJSON(){return{type:`nodeRange`,anchor:this.anchor,head:this.head}}get isForwards(){return this.head>=this.anchor}get isBackwards(){return!this.isForwards}extendBackwards(){let{doc:t}=this.$from;if(this.isForwards&&this.ranges.length>1){let t=this.ranges.slice(0,-1),n=t[0].$from,r=t[t.length-1].$to;return new e(n,r,this.depth)}let n=this.ranges[0],r=t.resolve(Math.max(0,n.$from.pos-1));return new e(this.$anchor,r,this.depth)}extendForwards(){let{doc:t}=this.$from;if(this.isBackwards&&this.ranges.length>1){let t=this.ranges.slice(1),n=t[0].$from,r=t[t.length-1].$to;return new e(r,n,this.depth)}let n=this.ranges[this.ranges.length-1],r=t.resolve(Math.min(t.content.size,n.$to.pos+1));return new e(this.$anchor,r,this.depth)}static fromJSON(t,n){return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(e,t,n,r,i=1){return new this(e.resolve(t),e.resolve(n),r,i)}getBookmark(){return new Cq(this.anchor,this.head)}};wq.prototype.visible=!1;function Tq(e){return e instanceof wq}F.create({name:`nodeRange`,addOptions(){return{depth:void 0,key:`Mod`}},addKeyboardShortcuts(){return{"Shift-ArrowUp":({editor:e})=>{let{depth:t}=this.options,{view:n,state:r}=e,{doc:i,selection:a,tr:o}=r,{anchor:s,head:c}=a;if(!Tq(a)){let e=wq.create(i,s,c,t,-1);return o.setSelection(e),n.dispatch(o),!0}let l=a.extendBackwards();return o.setSelection(l),n.dispatch(o),!0},"Shift-ArrowDown":({editor:e})=>{let{depth:t}=this.options,{view:n,state:r}=e,{doc:i,selection:a,tr:o}=r,{anchor:s,head:c}=a;if(!Tq(a)){let e=wq.create(i,s,c,t);return o.setSelection(e),n.dispatch(o),!0}let l=a.extendForwards();return o.setSelection(l),n.dispatch(o),!0},"Mod-a":({editor:e})=>{let{depth:t}=this.options,{view:n,state:r}=e,{doc:i,tr:a}=r,o=wq.create(i,0,i.content.size,t);return a.setSelection(o),n.dispatch(a),!0}}},onSelectionUpdate(){let{selection:e}=this.editor.state;Tq(e)&&this.editor.view.dom.classList.add(`ProseMirror-noderangeselection`)},addProseMirrorPlugins(){let e=!1,t=!1;return[new Ht({key:new q(`nodeRange`),props:{attributes:()=>e?{class:`ProseMirror-noderangeselection`}:{class:``},handleDOMEvents:{mousedown:(e,n)=>{let{key:r}=this.options,i=/Mac/.test(navigator.platform),a=!!n.shiftKey,o=!!n.ctrlKey,s=!!n.altKey,c=!!n.metaKey;return(r==null||r===`Shift`&&a||r===`Control`&&o||r===`Alt`&&s||r===`Meta`&&c||r===`Mod`&&(i?c:o))&&(t=!0),t&&document.addEventListener(`mouseup`,()=>{t=!1;let{state:n}=e,{doc:r,selection:i,tr:a}=n,{$anchor:o,$head:s}=i;if(o.sameParent(s))return;let c=wq.create(r,o.pos,s.pos,this.options.depth);a.setSelection(c),e.dispatch(a)},{once:!0}),!1}},decorations:n=>{let{selection:r}=n,i=Tq(r);if(e=!1,!t)return i?(e=!0,bq(r.ranges)):null;let{$from:a,$to:o}=r;if(!i&&a.sameParent(o))return null;let s=Sq(a,o,this.options.depth);return s.length?(e=!0,bq(s)):null}}})]}});function Eq(e){let t=``,n=getComputedStyle(e);for(let e=0;e<n.length;e+=1)t+=`${n[e]}:${n.getPropertyValue(n[e])};`;return t}function Dq(e){let t=e.cloneNode(!0),n=[e,...Array.from(e.getElementsByTagName(`*`))],r=[t,...Array.from(t.getElementsByTagName(`*`))];return n.forEach((e,t)=>{r[t].style.cssText=Eq(e)}),t}var Oq=[{id:`listItemFirstChild`,evaluate:({parent:e,isFirst:t})=>t&&e&&[`listItem`,`taskItem`].includes(e.type.name)?1e3:0},{id:`listWrapperDeprioritize`,evaluate:({node:e})=>{let t=[`listItem`,`taskItem`],n=e.firstChild;return n&&t.includes(n.type.name)?1e3:0}},{id:`tableStructure`,evaluate:({node:e,parent:t})=>[`tableRow`,`tableCell`,`tableHeader`].includes(e.type.name)||t&&t.type.name===`tableHeader`?1e3:0},{id:`inlineContent`,evaluate:({node:e})=>e.isInline||e.isText?1e3:0}],kq={edges:[`left`,`top`],threshold:12,strength:500};function Aq(e){return e===void 0||e===`left`?{...kq}:e===`right`?{edges:[`right`,`top`],threshold:12,strength:500}:e===`both`?{edges:[`left`,`right`,`top`],threshold:12,strength:500}:e===`none`?{edges:[],threshold:0,strength:0}:{...kq,...e}}function jq(e,t,n){if(n.edges.length===0)return!1;let r=t.getBoundingClientRect(),{threshold:i,edges:a}=n;return a.some(t=>t===`left`?e.x-r.left<i:t===`right`?r.right-e.x<i:t===`top`?e.y-r.top<i:t===`bottom`?r.bottom-e.y<i:!1)}function Mq(e,t,n,r){return!t||n.edges.length===0?0:jq(e,t,n)?n.strength*r:0}var Nq=1e3;function Pq(e,t,n,r){let i=Nq,a=!1;if(t.every(t=>{let n=t.evaluate(e);return i-=n,i<=0?(a=!0,!1):!0}),a)return-1;let o=e.view.nodeDOM(e.pos);return i-=Mq(r,o,n,e.depth),i<=0?-1:i}function Fq(e,t,n){return Array.from({length:t},(e,n)=>t-1-n).some(t=>n.includes(e.node(t).type.name))}function Iq(e,t,n){if(!Number.isFinite(t.x)||!Number.isFinite(t.y))return null;let r=e.posAtCoords({left:t.x,top:t.y});if(!r)return null;let{doc:i}=e.state,a=i.resolve(r.pos),o=[];n.defaultRules&&o.push(...Oq),o.push(...n.rules);let s=Array.from({length:a.depth},(e,t)=>a.depth-t).map(r=>{let i=a.node(r),s=a.before(r);if(n.allowedContainers&&r>0&&!Fq(a,r,n.allowedContainers))return null;let c=r>0?a.node(r-1):null,l=r>0?a.index(r-1):0,u=c?c.childCount:1,d=Pq({node:i,pos:s,depth:r,parent:c,index:l,isFirst:l===0,isLast:l===u-1,$pos:a,view:e},o,n.edgeDetection,t);return d<0?null:{node:i,pos:s,depth:r,score:d,dom:e.nodeDOM(s)}}).filter(e=>e!==null),c=a.nodeAfter;if(c&&c.isAtom&&!c.isInline){let i=r.pos,l=a.depth+1,u=a.parent,d=a.index(),f=u.childCount,p=!0;if(n.allowedContainers&&(p=Fq(a,l,n.allowedContainers)),p){let r=Pq({node:c,pos:i,depth:l,parent:u,index:d,isFirst:d===0,isLast:d===f-1,$pos:a,view:e},o,n.edgeDetection,t);if(r>=0){let t=e.nodeDOM(i);t&&s.push({node:c,pos:i,depth:l,score:r,dom:t})}}}if(s.length===0)return null;s.sort((e,t)=>t.score===e.score?t.depth-e.depth:t.score-e.score);let l=s[0];return l.dom?{node:l.node,pos:l.pos,dom:l.dom}:null}function Lq(e,t){let n=e;for(;n?.parentElement&&n.parentElement!==t.dom;)n=n.parentElement;return n?.parentElement===t.dom?n:void 0}function Rq(e){return Number.isFinite(e.top)&&Number.isFinite(e.bottom)&&Number.isFinite(e.left)&&Number.isFinite(e.right)&&e.width>0&&e.height>0}function zq(e,t,n,r=5){if(!Number.isFinite(t)||!Number.isFinite(n))return null;let i=e.dom,a=i.firstElementChild,o=i.lastElementChild;if(!a||!o)return null;let s=a.getBoundingClientRect(),c=o.getBoundingClientRect();if(!Rq(s)||!Rq(c))return null;let l=Math.min(Math.max(s.top+r,n),c.bottom-r),u=.5,d=Math.abs(s.left-c.left)<u,f=Math.abs(s.right-c.right)<u,p=s;d&&f&&(p=s);let m=Math.min(Math.max(p.left+r,t),p.right-r);return!Number.isFinite(m)||!Number.isFinite(l)?null:{x:m,y:l}}var Bq=e=>{let{x:t,y:n,editor:r,nestedOptions:i}=e,{view:a,state:o}=r,s=zq(a,t,n,5);if(!s)return{resultElement:null,resultNode:null,pos:null};let{x:c,y:l}=s;if(i?.enabled){let e=Iq(a,{x:c,y:l},i);return e?{resultElement:e.dom,resultNode:e.node,pos:e.pos}:{resultElement:null,resultNode:null,pos:null}}let u=a.root.elementsFromPoint(c,l),d;if(Array.prototype.some.call(u,e=>{if(!a.dom.contains(e))return!1;let t=Lq(e,a);return t?(d=t,!0):!1}),!d){let e=a.posAtCoords({left:c,top:l});if(e){let t=o.doc.resolve(e.pos),n=Math.min(t.depth,1),r=n>0?t.before(n):t.pos,i=o.doc.nodeAt(r);if(i){let e=a.nodeDOM(r);return{resultElement:e instanceof HTMLElement?e:null,resultNode:i,pos:r}}}return{resultElement:null,resultNode:null,pos:null}}let f;try{f=a.posAtDOM(d,0)}catch{return{resultElement:null,resultNode:null,pos:null}}let p=o.doc.nodeAt(f);if(!p){let e=o.doc.resolve(f),t=e.parent;return{resultElement:d,resultNode:t,pos:e.start()}}return{resultElement:d,resultNode:p,pos:f}};function Vq(e,t){let n=null,r=e.nodeDOM(t);if(r instanceof Element)n=r;else{let{node:r,offset:i}=e.domAtPos(t),a=r.childNodes[i];a instanceof Element?n=a:r instanceof Element?n=r:r.nodeType===Node.TEXT_NODE&&r.parentElement&&(n=r.parentElement)}return(n?getComputedStyle(n).direction:getComputedStyle(e.dom).direction)||`ltr`}function Hq(e){var t;(t=e.parentNode)==null||t.removeChild(e)}function Uq(e,t,n,r){let{doc:i}=t.view.state;if(n?.enabled&&r?.node&&r.pos>=0){let e=r.pos,t=r.pos+r.node.nodeSize;return[{$from:i.resolve(e),$to:i.resolve(t)}]}let a=Bq({editor:t,x:e.clientX,y:e.clientY,direction:`right`,nestedOptions:n});if(!a.resultNode||a.pos===null)return[];let o=a.resultNode.isText||a.resultNode.isAtom?0:-1;return Sq(i.resolve(a.pos),i.resolve(a.pos+a.resultNode.nodeSize+o),0,{extendOnBoundaryOverlap:!1})}function Wq(e,t,n,r){let{view:i}=t;if(!e.dataTransfer)return;let{empty:a,$from:o,$to:s}=i.state.selection,c=Uq(e,t,n,r),l=Sq(o,s,0,{extendOnBoundaryOverlap:!1}),u=l.some(e=>c.find(t=>t.$from===e.$from&&t.$to===e.$to)),d=a||!u?c:l;if(!d.length)return;let{tr:f}=i.state,p=document.createElement(`div`),m=d[0].$from.pos,h=d[d.length-1].$to.pos;p.setAttribute(`dir`,Vq(i,m));let g=n?.enabled&&r?.node,_,v;g?(_=i.state.doc.slice(m,h),v=Nt.create(i.state.doc,m)):(v=wq.create(i.state.doc,m,h),_=v.content()),d.forEach(e=>{let t=Dq(i.nodeDOM(e.$from.pos));p.append(t)}),p.style.position=`absolute`,p.style.top=`-10000px`,p.style.contentVisibility=`visible`,document.body.append(p);for(let e of p.querySelectorAll(`*`))e.style&&e.style.contentVisibility===`auto`&&(e.style.contentVisibility=`visible`);e.dataTransfer.clearData();let y=p.getBoundingClientRect(),b=i.nodeDOM(m),x=b&&b.nodeType===1?b.getBoundingClientRect():null,S=x?Math.min(e.clientX-x.left,y.width):Math.max(0,Math.min(e.clientX-y.left,y.width)),C=x?Math.min(Math.max(e.clientY-x.top,0),y.height):0;e.dataTransfer.setDragImage(p,S,C);let w=!1,T=()=>{w||(w=!0,Hq(p),document.removeEventListener(`drop`,T),document.removeEventListener(`dragend`,T))},E=v instanceof Nt?v:void 0;i.dragging={slice:_,move:!0,node:E},f.setSelection(v),i.dispatch(f),document.addEventListener(`drop`,T),document.addEventListener(`dragend`,T)}var Gq=(e,t)=>{let n=e.resolve(t),{depth:r}=n;return r===0?t:n.pos-n.parentOffset-1},Kq=(e,t)=>{let n=e.nodeAt(t),r=e.resolve(t),{depth:i}=r,a=n;for(;i>0;){let e=r.node(i);--i,i===0&&(a=e)}return a},qq=(e,t)=>{let n=Hv.getState(e);return n?Oy(t,n.type,n.binding.mapping):null},Jq=(e,t)=>{let n=Hv.getState(e);return n?Ay(n.doc,n.type,t,n.binding.mapping)||0:-1},Yq=(e,t)=>{let n=t;for(;n?.parentNode&&n.parentNode!==e.dom;)n=n.parentNode;return n},Xq=new q(`dragHandle`),Zq=({pluginKey:e=Xq,element:t,editor:n,computePositionConfig:r,getReferencedVirtualElement:i,onNodeChange:a,onElementDragStart:o,onElementDragEnd:s,nestedOptions:c})=>{let l=document.createElement(`div`),u=!1,d=null,f=-1,p,m=null,h=null;function g(){t&&(t.style.visibility=`hidden`,t.style.pointerEvents=`none`)}function _(){if(t){if(!n.isEditable){g();return}t.style.visibility=``,t.style.pointerEvents=`auto`}}function v(e){Or(i?.()||{getBoundingClientRect:()=>e.getBoundingClientRect()},t,r).then(e=>{Object.assign(t.style,{position:e.strategy,left:`${e.x}px`,top:`${e.y}px`})})}function y(e){o?.(e),Wq(e,n,c,{node:d,pos:f}),t&&(t.dataset.dragging=`true`),setTimeout(()=>{t&&(t.style.pointerEvents=`none`)},0)}function b(e){s?.(e),g(),t&&(t.style.pointerEvents=`auto`,t.dataset.dragging=`false`)}function x(){if(ht()){let e=n.view.dom;requestAnimationFrame(()=>{e.isContentEditable&&(e.contentEditable=`false`,e.contentEditable=`true`)})}}return l.appendChild(t),{unbind(){t.removeEventListener(`dragstart`,y),t.removeEventListener(`dragend`,b),document.removeEventListener(`drop`,x),m&&(cancelAnimationFrame(m),m=null,h=null)},plugin:new Ht({key:typeof e==`string`?new q(e):e,state:{init(){return{locked:!1}},apply(e,r,i,o){let s=e.getMeta(`lockDragHandle`),c=e.getMeta(`hideDragHandle`);if(s!==void 0&&(u=s),c)return g(),u=!1,d=null,f=-1,a?.({editor:n,node:null,pos:-1}),r;if(e.docChanged&&f!==-1&&t)if(pq(e)){let e=Jq(o,p);e!==f&&(f=e)}else{let t=e.mapping.map(f);t!==f&&(f=t,p=qq(o,f))}return r}},view:e=>{var r;return t.draggable=!0,t.style.pointerEvents=`auto`,t.dataset.dragging=`false`,(r=n.view.dom.parentElement)==null||r.appendChild(l),l.style.pointerEvents=`none`,l.style.position=`absolute`,l.style.top=`0`,l.style.left=`0`,t.addEventListener(`dragstart`,y),t.addEventListener(`dragend`,b),document.addEventListener(`drop`,x),{update(r,i){if(!t)return;if(!n.isEditable){g();return}if(u?t.draggable=!1:t.draggable=!0,e.state.doc.eq(i.doc)||f===-1)return;let o=e.nodeDOM(f);if(o=Yq(e,o),o===e.dom||o?.nodeType!==1)return;let s=e.posAtDOM(o,0),c=Kq(n.state.doc,s),l=Gq(n.state.doc,s);d=c,f=l,p=qq(e.state,f),a?.({editor:n,node:d,pos:f}),v(o)},destroy(){t.removeEventListener(`dragstart`,y),t.removeEventListener(`dragend`,b),document.removeEventListener(`drop`,x),m&&(cancelAnimationFrame(m),m=null,h=null),t&&Hq(l)}}},props:{handleDOMEvents:{keydown(e){return!t||u?!1:e.hasFocus()?(g(),d=null,f=-1,a?.({editor:n,node:null,pos:-1}),!1):!1},mouseleave(e,t){return u||t.target&&!l.contains(t.relatedTarget)&&(g(),d=null,f=-1,a?.({editor:n,node:null,pos:-1})),!1},mousemove(e,r){return!t||u||(h={x:r.clientX,y:r.clientY},m)||(m=requestAnimationFrame(()=>{if(m=null,!h)return;let{x:t,y:r}=h;h=null;let i=Bq({x:t,y:r,direction:`right`,editor:n,nestedOptions:c});if(!i.resultElement)return;let o=i.resultElement,s=i.resultNode,l=i.pos;if(!c?.enabled){if(o=Yq(e,o),o===e.dom||o?.nodeType!==1)return;let t=e.posAtDOM(o,0);s=Kq(n.state.doc,t),l=Gq(n.state.doc,t)}s!==d&&(d=s,f=l??-1,p=qq(e.state,f),a?.({editor:n,node:d,pos:f}),v(o),_())})),!1}}}})}};function Qq(e){return e===!1||e===void 0?{enabled:!1,rules:[],defaultRules:!0,allowedContainers:void 0,edgeDetection:Aq(`none`)}:e===!0?{enabled:!0,rules:[],defaultRules:!0,allowedContainers:void 0,edgeDetection:Aq(`left`)}:{enabled:!0,rules:e.rules??[],defaultRules:e.defaultRules??!0,allowedContainers:e.allowedContainers,edgeDetection:Aq(e.edgeDetection)}}var $q={placement:`left-start`,strategy:`absolute`};F.create({name:`dragHandle`,addOptions(){return{render(){let e=document.createElement(`div`);return e.classList.add(`drag-handle`),e},computePositionConfig:{},locked:!1,onNodeChange:()=>null,onElementDragStart:void 0,onElementDragEnd:void 0,nested:!1}},addCommands(){return{lockDragHandle:()=>({editor:e})=>(this.options.locked=!0,e.commands.setMeta(`lockDragHandle`,this.options.locked)),unlockDragHandle:()=>({editor:e})=>(this.options.locked=!1,e.commands.setMeta(`lockDragHandle`,this.options.locked)),toggleDragHandle:()=>({editor:e})=>(this.options.locked=!this.options.locked,e.commands.setMeta(`lockDragHandle`,this.options.locked))}},addProseMirrorPlugins(){let e=this.options.render(),t=Qq(this.options.nested);return[Zq({computePositionConfig:{...$q,...this.options.computePositionConfig},getReferencedVirtualElement:this.options.getReferencedVirtualElement,element:e,editor:this.editor,onNodeChange:this.options.onNodeChange,onElementDragStart:this.options.onElementDragStart,onElementDragEnd:this.options.onElementDragEnd,nestedOptions:t}).plugin]}});var eJ=20,tJ=44,nJ=28;function rJ(e){if(!e)return`Select block`;if(e.type.name===`jsxComponent`){let t=e.attrs.componentName??``;if(t){let e=kM(t),n=e.name===`*`?t:e.displayName??e.name;if(n)return`Select ${n}`}}return`Select ${e.type.name}`}function iJ(){let e=document.createElement(`div`);e.className=`ok-block-controls`,e.setAttribute(MF,`true`),e.style.visibility=`hidden`;let t=document.createElement(`button`);t.className=`ok-add-block-btn`,t.setAttribute(`aria-label`,`Add block below`),t.setAttribute(`type`,`button`),t.innerHTML=`<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-plus"><path d="M5 12h14"/><path d="M12 5v14"/></svg>`,t.addEventListener(`mousedown`,e=>{e.preventDefault(),e.stopPropagation()});let n=document.createElement(`button`);return n.className=`ok-drag-grip`,n.setAttribute(`type`,`button`),n.setAttribute(`aria-label`,`Select block`),n.setAttribute(`tabindex`,`-1`),n.innerHTML=`<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-grip-vertical-icon lucide-grip-vertical"><circle cx="9" cy="12" r="1"/><circle cx="9" cy="5" r="1"/><circle cx="9" cy="19" r="1"/><circle cx="15" cy="12" r="1"/><circle cx="15" cy="5" r="1"/><circle cx="15" cy="19" r="1"/></svg>`,e.appendChild(t),e.appendChild(n),{container:e,addBtn:t,grip:n}}function aJ(e,t,n){let{state:r,view:i}=e;if(n.type.name===`jsxComponent`){let i=n.attrs.componentName??``;if(i){let a=kM(i);if(a.emptyChildName){let i=t+1+n.content.size;if(i>r.doc.content.size)return;let o=a.emptyChildName;e.chain().focus().insertContentAt(i,FM(o)).run(),zM(e,i,kM(o));return}}}let a=t+n.nodeSize;if(a>r.doc.content.size)return;let{tr:o}=r,s=r.schema.nodes.paragraph?.create();if(!s)return;o.insert(a,s);let c=p.near(o.doc.resolve(a+1));o.setSelection(c).scrollIntoView(),i.dispatch(o),i.focus(),e.commands.insertContent(`/`)}var oJ=F.create({name:`blockDragHandle`,addProseMirrorPlugins(){let e=this.editor,t=null,n=-1,{container:r,addBtn:i,grip:a}=iJ();return i.addEventListener(`click`,()=>{t&&n>=0&&aJ(e,n,t)}),a.addEventListener(`click`,()=>{if(n<0)return;let r=t,i=r?.type.name??`unknown`;try{e.chain().focus().setNodeSelection(n).run()||(C(i),console.warn(JSON.stringify({event:`block-grip-click-select-failed`,nodeType:i,componentName:String(r?.attrs.componentName??``).slice(0,200),reason:`chain-dispatch-returned-false`})))}catch(e){if(!(e instanceof RangeError))throw e;C(i),console.warn(JSON.stringify({event:`block-grip-click-select-failed`,nodeType:i,componentName:String(r?.attrs.componentName??``).slice(0,200),reason:e.message.slice(0,500)}))}}),[Zq({element:r,editor:e,onNodeChange({node:e,pos:r}){t=e,n=r??-1,a.setAttribute(`aria-label`,rJ(e))},computePositionConfig:{placement:`left-start`,strategy:`absolute`,middleware:[jr(({rects:e})=>({mainAxis:10,crossAxis:((e.reference.height<=tJ?e.reference.height:nJ)-eJ)/2}))]},nestedOptions:Qq(!1)}).plugin]}}),sJ=/^#fn(?:ref)?-/,cJ=F.create({name:`footnoteAnchorScroll`,addProseMirrorPlugins(){return[new Ht({props:{handleDOMEvents:{click(e,t){let n=t.target;if(!(n instanceof Element))return!1;let r=n.closest(`a[href^="#fn"]`);if(!(r instanceof HTMLAnchorElement))return!1;let i=r.getAttribute(`href`)??``;if(!sJ.test(i))return!1;let a=i.slice(1);t.preventDefault();let o=e.dom.ownerDocument.getElementById(a);return o&&o.scrollIntoView({behavior:`smooth`,block:`start`}),!0}}}})]}}),lJ=F.create({name:`formattingShortcuts`,addKeyboardShortcuts(){return{"Mod-Shift-x":()=>this.editor.commands.toggleStrike()}}}),uJ=F.create({name:`headingAnchors`,addProseMirrorPlugins(){return[new Ht({props:{decorations(e){let t=[],n=new Map;return e.doc.descendants((e,r)=>{if(e.type.name===`heading`){let i=at(e.textContent,n);if(!i)return;t.push(dt.node(r,r+e.nodeSize,{id:i}))}}),Qe.create(e.doc,t)}}})]}});function dJ(e){let t=(0,Z.c)(8),{node:n,editor:r}=e,i=n.attrs.src,a=n.attrs.alt,o=n.attrs.title,s;if(t[0]!==r||t[1]!==i){let e=r?vO(r)??void 0:void 0;s=typeof i==`string`?d(Ve(i,e)):void 0,t[0]=r,t[1]=i,t[2]=s}else s=t[2];let c=s,l=typeof a==`string`?a:``,u=typeof o==`string`?o:void 0,f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f={sizes:void 0},t[3]=f):f=t[3];let p;return t[4]!==l||t[5]!==c||t[6]!==u?(p=(0,X.jsx)(Jl,{as:`span`,"data-image-inline-zoom":!0,"data-clipboard-inline-leaf":`image`,children:(0,X.jsx)(hA,{wrapElement:`span`,zoomMargin:20,zoomImg:f,children:(0,X.jsx)(`img`,{src:c,alt:l,title:u})})}),t[4]=l,t[5]=c,t[6]=u,t[7]=p):p=t[7],p}var fJ=T.extend({addNodeView(){return nu(dJ)}});function pJ(e,t){let n=e;for(;n&&typeof n.hasAttribute==`function`;){if(n.hasAttribute(`data-wiki-embed`)){let e=n.getAttribute(`data-target`)??``;if(!e)return null;let r=h(e,t);return r?{kind:n.tagName===`IMG`?`image`:`asset`,relPath:r,title:r.split(`/`).pop()??e}:null}if(n.hasAttribute(`data-wiki-link`)){let e=n.getAttribute(`data-target`)??``;return e?{kind:`wiki-link`,relPath:`${e}.md`,title:e}:null}if(n.tagName===`A`&&n.hasAttribute(`href`)){let e=u(n.getAttribute(`href`)??``,t);if(e?.kind===`asset`){let n=h(e.url,t);return n?{kind:`asset`,relPath:n,title:n.split(`/`).pop()??e.url}:null}}if(n.tagName===`IMG`){let e=n.getAttribute(`src`)??``;if(e){let n=u(e,t);if(n?.kind===`asset`){let e=h(n.url,t);return e?{kind:`image`,relPath:e,title:e.split(`/`).pop()??n.url}:null}}}n=n.parentElement}return null}var mJ=new q(`asset-context-menu`);function hJ(e){return new Ht({key:mJ,view(t){let n=e.showAssetMenu??(e=>{let t=globalThis.window?.okDesktop;return t?t.shell.showAssetMenu({relPath:e.relPath,title:e.title,kind:e.kind}):Promise.resolve()}),r=t=>{if(!(t.target instanceof Element))return;let r=pJ(t.target,e.sourceDocName);r&&(t.preventDefault(),n(r))};return t.dom.addEventListener(`contextmenu`,r),{destroy(){t.dom.removeEventListener(`contextmenu`,r)}}}})}var gJ=e=>{let t=(0,Z.c)(18),{kind:n,ariaLabel:r,onDeactivate:i,children:a,triggerReference:o,layout:s,className:c,"data-slot":l}=e,u=s===void 0?`standard`:s,d=(0,Q.useRef)(null),f,p;t[0]===o?(f=t[1],p=t[2]):(f=()=>{let e=d.current;if(e)return wr(o,e,()=>{let t=o.getBoundingClientRect();e.isConnected&&(e.style.left=`${t.left}px`,e.style.top=`${t.top}px`,e.style.width=`${t.width}px`,e.style.height=`${t.height}px`)})},p=[o],t[0]=o,t[1]=f,t[2]=p),(0,Q.useLayoutEffect)(f,p);let m;t[3]===i?m=t[4]:(m=e=>{e||i()},t[3]=i,t[4]=m);let h;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,X.jsx)(vc,{asChild:!0,children:(0,X.jsx)(`span`,{ref:d,"aria-hidden":`true`,style:{position:`fixed`,pointerEvents:`none`,left:`-9999px`,top:`-9999px`,width:0,height:0}})}),t[5]=h):h=t[5];let g=u===`wide`?`w-[min(720px,calc(100%-1rem))]`:`w-80`,_;t[6]!==c||t[7]!==g?(_=Xt(`ok-interaction-prop-panel pointer-events-auto p-3`,g,c),t[6]=c,t[7]=g,t[8]=_):_=t[8];let v;t[9]!==r||t[10]!==a||t[11]!==l||t[12]!==n||t[13]!==_?(v=(0,X.jsx)(_c,{side:`bottom`,align:`start`,sideOffset:8,collisionPadding:8,"aria-label":r,"data-ok-prop-panel":n,"data-slot":l,onOpenAutoFocus:_J,onCloseAutoFocus:vJ,onPointerDownOutside:yJ,onFocusOutside:bJ,onInteractOutside:xJ,className:_,children:a}),t[9]=r,t[10]=a,t[11]=l,t[12]=n,t[13]=_,t[14]=v):v=t[14];let y;return t[15]!==m||t[16]!==v?(y=(0,X.jsxs)(hc,{open:!0,onOpenChange:m,children:[h,v]}),t[15]=m,t[16]=v,t[17]=y):y=t[17],y};function _J(e){return e.preventDefault()}function vJ(e){return e.preventDefault()}function yJ(e){e.target?.closest(`[data-ok-layer-spawned]`)&&e.preventDefault()}function bJ(e){e.target?.closest(`[data-ok-layer-spawned]`)&&e.preventDefault()}function xJ(e){e.target?.closest(`[data-ok-layer-spawned]`)&&e.preventDefault()}function SJ(e){let t=e.trim();return/\.(md|mdx)$/i.test(t)?t:`${t}.md`}function CJ(e){let t=e.initialDir.trim().replace(/^\/+|\/+$/g,``),n=SJ(e.suggestedName);return t?`${t}/${n}`:n}async function wJ(e){let t=await jx(await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),`Failed to create page`);if(!t.ok)throw Error(t.title);let n=e.replace(/\.(mdx|md)$/i,``);return{docName:Mx(Ft,t.body,`create-page`,{docName:n}).docName}}async function TJ(e){return wJ(CJ(e))}async function EJ(e,t){let{docName:n}=await TJ(e);return t.addPage(n),tr([`files`,`backlinks`,`graph`]),t.onCreated?.(n),{docName:n}}var DJ=8;function OJ(e){return e.trim().replace(/^\/+/,``).replace(/\.mdx?$/i,``).replace(/\/+$/g,``)}function kJ(e){return AJ(e)?OJ(e.slice(1)).toLowerCase():null}function AJ(e){return e.startsWith(`/`)&&!e.startsWith(`//`)}function jJ(e){return e.split(`/`).at(-1)??e}function MJ(e,t){if(!t)return 0;let n=e.toLowerCase(),r=jJ(e).toLowerCase();return n===t?0:r===t?1:n.startsWith(t)?2:r.startsWith(t)?3:r.includes(t)?4:n.includes(t)?5:null}function NJ(e){switch(e){case`page`:return 0;case`folder`:return 1;case`asset`:return 2}}function PJ(e){let t=[],n=new Set;function r(e,r){let i=OJ(r);if(!i)return;let a=`${e}:${i.toLowerCase()}`;n.has(a)||(n.add(a),t.push({kind:e,path:i}))}for(let t of e.pages)r(`page`,t);for(let t of e.folderPaths??[])r(`folder`,t);if(e.includeAssets)for(let t of e.assetPaths??[])r(`asset`,t);return t}function FJ(e){let t=kJ(e.value);if(t===null)return[];let n=[];for(let r of PJ(e)){let e=MJ(r.path,t);e!==null&&n.push({suggestion:r,score:e})}return n.sort((e,t)=>{if(e.score!==t.score)return e.score-t.score;let n=NJ(e.suggestion.kind)-NJ(t.suggestion.kind);return n===0?e.suggestion.path.localeCompare(t.suggestion.path):n}),n.slice(0,e.limit??DJ).map(e=>e.suggestion)}var IJ=`[data-ok-link-path-suggestion-panel]`;function LJ(e){return e instanceof Element&&e.closest(IJ)!==null}function RJ(e){LJ(e.target)&&e.preventDefault()}function zJ(e){switch(e.kind){case`page`:return(0,X.jsx)(Db,{className:`size-3.5`,docExt:`.md`,kind:`file`,path:e.path});case`folder`:return(0,X.jsx)(Db,{className:`size-3.5`,kind:`folder`,path:e.path});case`asset`:return(0,X.jsx)(Db,{bodyIndexed:!1,className:`size-3.5`,kind:`file`,path:e.path})}}function BJ(e,t){if(e){if(typeof e==`function`){e(t);return}e.current=t}}function VJ(e){let t=(0,Z.c)(54),n,r,i,a,o,c,l,u,d,f,p,m,h,g;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13],g=t[14]):({value:g,pages:f,folderPaths:i,assetPaths:n,includeAssets:m,loading:h,onValueChange:d,onKeyDown:l,onSuggestionSelect:u,onFocus:c,onBlur:o,className:r,ref:p,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m,t[13]=h,t[14]=g);let _=m===void 0?!1:m,v=h===void 0?!1:h,{_:y}=s(),[b,x]=(0,Q.useState)(!1),[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(0),E=(0,Q.useRef)(null),D=(0,Q.useRef)(null),O=(0,Q.useId)(),k;t[15]===g?k=t[16]:(k=g.trim(),t[15]=g,t[16]=k);let A=k===``,j=FJ({value:A?`/`:g,pages:f,folderPaths:i,assetPaths:n,includeAssets:_}),M=j.map(KJ).join(`\0`),N;t[17]===g?N=t[18]:(N=AJ(g),t[17]=g,t[18]=N);let P=A||N,F=j.length>0,I=b&&!S&&P&&(F||v)||b&&!S&&P&&!v&&!F,L=Math.min(w,Math.max(j.length-1,0)),R=F?`${O}-option-${L}`:void 0,z;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(z=()=>{T(0)},t[19]=z):z=t[19],(0,Q.useEffect)(z,[M]);let B,V;t[20]!==R||t[21]!==I?(B=()=>{!I||!R||document.getElementById(R)?.scrollIntoView?.({block:`nearest`})},V=[R,I],t[20]=R,t[21]=I,t[22]=B,t[23]=V):(B=t[22],V=t[23]),(0,Q.useEffect)(B,V);let H,ee;t[24]===I?(H=t[25],ee=t[26]):(H=()=>{if(!I)return;let e=E.current,t=D.current;if(!e||!t)return;let n=e,r=t,i=function(){Or(n,r,{placement:`bottom-start`,strategy:`fixed`,middleware:[jr(4),Pr({padding:8}),kr({padding:8}),Er({padding:8,apply(e){let{availableHeight:t,availableWidth:n,elements:r}=e;Object.assign(r.floating.style,{width:`${Math.min(480,n)}px`,maxHeight:`${Math.min(208,Math.max(96,t))}px`})}})]}).then(e=>{let{x:t,y:n}=e;r.isConnected&&Object.assign(r.style,{left:`${t}px`,top:`${n}px`})}).catch(e=>{r.isConnected&&console.warn(`[LinkPathSuggestionInput] computePosition failed`,e)})},a=wr(n,r,i);return i(),a},ee=[I],t[24]=I,t[25]=H,t[26]=ee),(0,Q.useLayoutEffect)(H,ee);let U;t[27]===p?U=t[28]:(U=function(e){E.current=e,BJ(p,e)},t[27]=p,t[28]=U);let W=U,te=function(e){u?u(e):d(e.path),C(!0),requestAnimationFrame(()=>E.current?.focus())},G=function(e){if(F){if(e.key===`ArrowDown`){e.preventDefault(),T(e=>Math.min(e+1,j.length-1));return}if(e.key===`ArrowUp`){e.preventDefault(),T(GJ);return}if(e.key===`Enter`){e.preventDefault();let t=j[L];t&&te(t);return}if(e.key===`Escape`){e.preventDefault(),C(!0);return}}if(I&&e.key===`Escape`){e.preventDefault(),C(!0);return}l?.(e)},ne;t[29]===y?ne=t[30]:(ne=function(e){switch(e){case`page`:return y({id:`6WdDG7`});case`folder`:return y({id:`kNqMMd`});case`asset`:return y({id:`bUUVED`})}},t[29]=y,t[30]=ne);let re=ne,ie=I?(0,X.jsx)(`div`,{ref:D,id:O,role:`listbox`,"aria-label":y({id:`mBltnd`}),"data-ok-layer-spawned":``,"data-ok-link-path-suggestion-panel":``,className:`fixed z-70 max-h-52 overflow-y-auto overscroll-y-contain rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-md subtle-scrollbar pointer-events-auto`,onWheel:WJ,onTouchMove:UJ,children:F?j.map((e,t)=>{let n=t===L,r=re(e.kind);return(0,X.jsxs)(en,{id:`${O}-option-${t}`,type:`button`,role:`option`,"aria-label":`/${e.path} ${r}`,"aria-selected":n,variant:`ghost`,className:Xt(`h-auto w-full justify-start gap-2 rounded-sm px-2 py-1.5 text-left font-normal`,n&&`bg-accent text-accent-foreground`),onMouseDown:HJ,onClick:()=>te(e),children:[zJ(e),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[`/`,e.path]}),(0,X.jsx)(`span`,{className:`shrink-0 text-muted-foreground text-xs`,children:r})]},`${e.kind}:${e.path}`)}):(0,X.jsx)(`div`,{role:`status`,className:`px-2 py-1.5 text-muted-foreground text-sm`,children:y(v?{id:`sxTdZI`}:{id:`_QwkMu`})})}):null,ae;t[31]===d?ae=t[32]:(ae=e=>{C(!1),d(e.target.value)},t[31]=d,t[32]=ae);let oe;t[33]===c?oe=t[34]:(oe=e=>{x(!0),c?.(e)},t[33]=c,t[34]=oe);let se;t[35]===o?se=t[36]:(se=e=>{x(!1),o?.(e)},t[35]=o,t[36]=se);let K=I?O:void 0,ce;t[37]!==R||t[38]!==r||t[39]!==G||t[40]!==a||t[41]!==W||t[42]!==I||t[43]!==ae||t[44]!==oe||t[45]!==se||t[46]!==K||t[47]!==g?(ce=(0,X.jsx)(Ir,{...a,ref:W,value:g,onChange:ae,onFocus:oe,onBlur:se,onKeyDown:G,role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":I,"aria-controls":K,"aria-activedescendant":R,autoComplete:`off`,className:r}),t[37]=R,t[38]=r,t[39]=G,t[40]=a,t[41]=W,t[42]=I,t[43]=ae,t[44]=oe,t[45]=se,t[46]=K,t[47]=g,t[48]=ce):ce=t[48];let le;t[49]===ie?le=t[50]:(le=ie&&(0,Ga.createPortal)(ie,document.body),t[49]=ie,t[50]=le);let ue;return t[51]!==ce||t[52]!==le?(ue=(0,X.jsxs)(`div`,{className:`relative`,children:[ce,le]}),t[51]=ce,t[52]=le,t[53]=ue):ue=t[53],ue}function HJ(e){return e.preventDefault()}function UJ(e){e.stopPropagation()}function WJ(e){e.stopPropagation()}function GJ(e){return Math.max(e-1,0)}function KJ(e){return`${e.kind}:${e.path}`}var qJ=1500;async function JJ(e){if(typeof navigator>`u`||!navigator.clipboard?.writeText)throw Error(`clipboard unavailable`);await navigator.clipboard.writeText(e)}function YJ(e){let t=(0,Z.c)(20),{copyContent:n,clipboardWrite:r,initialCopied:i}=e,a=r===void 0?JJ:r,o=i===void 0?!1:i,{_:c}=s(),[l,u]=(0,Q.useState)(+!!o),d=l>0,f,p;t[0]===l?(f=t[1],p=t[2]):(f=()=>{if(l===0)return;let e=setTimeout(()=>u(0),qJ);return()=>clearTimeout(e)},p=[l],t[0]=l,t[1]=f,t[2]=p),(0,Q.useEffect)(f,p);let m;t[3]!==a||t[4]!==n?(m=()=>{Promise.resolve().then(()=>a(n)).then(()=>u(ZJ),XJ)},t[3]=a,t[4]=n,t[5]=m):m=t[5];let h=m,g;t[6]!==c||t[7]!==d?(g=c(d?{id:`PiH3UR`}:{id:`he3ygx`}),t[6]=c,t[7]=d,t[8]=g):g=t[8];let _=g,v;t[9]===d?v=t[10]:(v=d?(0,X.jsx)(tn,{className:`size-3.5`,"aria-hidden":`true`}):(0,X.jsx)(Gn,{className:`size-3.5`,"aria-hidden":`true`}),t[9]=d,t[10]=v);let y;t[11]!==h||t[12]!==_||t[13]!==v?(y=(0,X.jsx)(yr,{asChild:!0,children:(0,X.jsx)(en,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":_,onClick:h,children:v})}),t[11]=h,t[12]=_,t[13]=v,t[14]=y):y=t[14];let b;t[15]===_?b=t[16]:(b=(0,X.jsx)(br,{children:_}),t[15]=_,t[16]=b);let x;return t[17]!==y||t[18]!==b?(x=(0,X.jsxs)(xr,{children:[y,b]}),t[17]=y,t[18]=b,t[19]=x):x=t[19],x}function XJ(){}function ZJ(e){return e+1}function QJ(e,t){return JO.getState(e)?.byId.get(t)??null}function $J(e){let{editor:t,layer:n,renderPropPanel:r,handlePrimary:i}=e;return{onRegister:e=>{n.register({type:e.markType,nodeId:e.id,controls:{propPanel:e=>r({editor:t,nodeId:e.nodeId,deactivate:e.deactivate})},handlePrimary:i?e=>i({editor:t,nodeId:e.nodeId,newTab:e.newTab}):void 0})},onDeregister:e=>{n.deregister(e)}}}function eY(e){let{editor:t,layer:n,markTypes:r,predicate:i,renderPropPanel:a,handlePrimary:o}=e,s=$J({editor:t,layer:n,renderPropPanel:a,handlePrimary:o});return $O({markTypes:[...r],predicate:i,onRegister:s.onRegister,onDeregister:s.onDeregister})}function tY(e){let t=pk(e.editor);return eY({...e,layer:t})}function nY(e,t){let n=(0,Z.c)(4),[r,i]=(0,Q.useState)(null),a,o;return n[0]!==e||n[1]!==t?(a=()=>{if(!t||!e){i(null);return}let n=!1;return i(null),OG(e).then(e=>{n||i(e)}).catch(()=>{n||i([])}),()=>{n=!0}},o=[e,t],n[0]=e,n[1]=t,n[2]=a,n[3]=o):(a=n[2],o=n[3]),(0,Q.useEffect)(a,o),r}function rY(e,t){let n=e.trim();return n?n.startsWith(`#`)?`anchor`:P(n)?`external`:`doc`:t}function iY(e){return e?.kind===`doc`?`doc`:e?.kind===`anchor`?`anchor`:`external`}function aY(e){let t=(0,Z.c)(84),{open:n,href:r,text:i,pages:a,folderPaths:c,loading:l,onOpenChange:u,onSave:d}=e,[f,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(``),[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(`doc`),b=(0,Q.useId)(),x=(0,Q.useId)(),S=(0,Q.useId)(),C=(0,Q.useId)(),{_:w}=s(),T=(0,Q.useRef)(!1),E=(0,Q.useRef)(``),D,O;t[0]!==r||t[1]!==n||t[2]!==i?(D=()=>{if(!n){T.current=!1;return}if(T.current)return;T.current=!0,E.current=i,_(i);let e=TW(r);if(y(iY(e)),e?.kind===`doc`){p(e.docName),h(e.anchor??``);return}if(e?.kind===`anchor`){p(`#${e.anchor}`),h(``);return}p(e?.kind===`external`?e.url:r),h(``)},O=[n,r,i],t[0]=r,t[1]=n,t[2]=i,t[3]=D,t[4]=O):(D=t[3],O=t[4]),(0,Q.useEffect)(D,O);let k,A,j;t[5]!==v||t[6]!==f||t[7]!==a?(k=jn(f),A=v===`doc`,j=A&&jO(k,a),t[5]=v,t[6]=f,t[7]=a,t[8]=k,t[9]=A,t[10]=j):(k=t[8],A=t[9],j=t[10]);let M=nY(k,j&&n),N=!!M?.length,P;t[11]!==k||t[12]!==A||t[13]!==m||t[14]!==g||t[15]!==f||t[16]!==u||t[17]!==d?(P=function(){let e=f.trim();e&&(d(A?IW(k,m.trim()||null):e,g,g.trim()!==E.current.trim()),u(!1))},t[11]=k,t[12]=A,t[13]=m,t[14]=g,t[15]=f,t[16]=u,t[17]=d,t[18]=P):P=t[18];let F=P,I;t[19]===F?I=t[20]:(I=function(e){e.key===`Enter`&&(e.preventDefault(),F())},t[19]=F,t[20]=I);let L=I,R;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(R=function(e){p(e.path),y(`doc`),h(``)},t[21]=R):R=t[21];let z=R,B;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,X.jsx)(rn,{children:(0,X.jsx)(o,{id:`B11p-O`})}),t[22]=B):B=t[22];let V;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,X.jsxs)(gn,{children:[B,(0,X.jsx)(nn,{children:(0,X.jsx)(o,{id:`RobAKV`})})]}),t[23]=V):V=t[23];let H;t[24]===A?H=t[25]:(H=A?(0,X.jsx)(o,{id:`6WdDG7`}):(0,X.jsx)(o,{id:`6vEr3W`}),t[24]=A,t[25]=H);let ee;t[26]!==H||t[27]!==b?(ee=(0,X.jsx)(`label`,{className:`mb-1.5 inline-block text-sm font-medium`,htmlFor:b,children:H}),t[26]=H,t[27]=b,t[28]=ee):ee=t[28];let U;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(U=e=>{p(e),y(t=>rY(e,t))},t[29]=U):U=t[29];let W;t[30]===w?W=t[31]:(W=w({id:`Xl-UUg`}),t[30]=w,t[31]=W);let te;t[32]!==f||t[33]!==c||t[34]!==L||t[35]!==l||t[36]!==a||t[37]!==W||t[38]!==b?(te=(0,X.jsx)(VJ,{id:b,value:f,pages:a,folderPaths:c,loading:l,onValueChange:U,onSuggestionSelect:z,placeholder:W,autoFocus:!0,onKeyDown:L}),t[32]=f,t[33]=c,t[34]=L,t[35]=l,t[36]=a,t[37]=W,t[38]=b,t[39]=te):te=t[39];let G;t[40]!==ee||t[41]!==te?(G=(0,X.jsxs)(`div`,{children:[ee,te]}),t[40]=ee,t[41]=te,t[42]=G):G=t[42];let ne;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,X.jsx)(o,{id:`QqBQu1`,components:{0:(0,X.jsx)(`span`,{className:`font-normal text-muted-foreground`})}}),t[43]=ne):ne=t[43];let re;t[44]===S?re=t[45]:(re=(0,X.jsx)(`label`,{className:`mb-1.5 inline-block text-sm font-medium`,htmlFor:S,children:ne}),t[44]=S,t[45]=re);let ie;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(ie=e=>_(e.target.value),t[46]=ie):ie=t[46];let ae;t[47]===w?ae=t[48]:(ae=w({id:`yYR6za`}),t[47]=w,t[48]=ae);let oe;t[49]!==g||t[50]!==L||t[51]!==S||t[52]!==ae?(oe=(0,X.jsx)(Ir,{id:S,value:g,onChange:ie,placeholder:ae,onKeyDown:L}),t[49]=g,t[50]=L,t[51]=S,t[52]=ae,t[53]=oe):oe=t[53];let se;t[54]!==re||t[55]!==oe?(se=(0,X.jsxs)(`div`,{children:[re,oe]}),t[54]=re,t[55]=oe,t[56]=se):se=t[56];let K;t[57]!==w||t[58]!==x||t[59]!==A||t[60]!==m||t[61]!==L||t[62]!==C||t[63]!==M||t[64]!==N?(K=A?(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`label`,{className:`mb-1.5 inline-block text-sm font-medium`,htmlFor:x,children:(0,X.jsx)(o,{id:`Tjc1pH`,components:{0:(0,X.jsx)(`span`,{className:`font-normal text-muted-foreground`})}})}),(0,X.jsx)(Ir,{id:x,value:m,onChange:e=>h(e.target.value),placeholder:w({id:`W-ntoW`}),onKeyDown:L}),N?(0,X.jsx)(`div`,{id:C,className:`mt-1.5 max-h-36 overflow-y-auto subtle-scrollbar rounded-md border border-border bg-muted/30`,children:M.map(e=>(0,X.jsxs)(`button`,{type:`button`,"aria-pressed":m===e.slug,className:Xt(`flex w-full items-center gap-2 px-2 py-1 text-left text-sm hover:bg-accent hover:text-accent-foreground`,m===e.slug&&`bg-accent text-accent-foreground`),style:{paddingLeft:`${(e.level-1)*12+8}px`},onClick:()=>h(m===e.slug?``:e.slug),children:[(0,X.jsxs)(`span`,{className:`w-7 shrink-0 font-mono text-[10px] text-muted-foreground`,children:[`H`,e.level]}),(0,X.jsx)(`span`,{className:`truncate`,children:e.text})]},`${e.slug}-${e.level}-${e.text}`))}):null]}):null,t[57]=w,t[58]=x,t[59]=A,t[60]=m,t[61]=L,t[62]=C,t[63]=M,t[64]=N,t[65]=K):K=t[65];let ce;t[66]!==G||t[67]!==se||t[68]!==K?(ce=(0,X.jsxs)(fn,{className:`space-y-6 pb-1`,children:[G,se,K]}),t[66]=G,t[67]=se,t[68]=K,t[69]=ce):ce=t[69];let le;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,X.jsx)(hn,{asChild:!0,children:(0,X.jsx)(en,{variant:`outline`,children:(0,X.jsx)(o,{id:`dEgA5A`})})}),t[70]=le):le=t[70];let ue;t[71]===f?ue=t[72]:(ue=f.trim(),t[71]=f,t[72]=ue);let de=!ue,fe;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,X.jsx)(o,{id:`tfDRzk`}),t[73]=fe):fe=t[73];let pe;t[74]!==F||t[75]!==de?(pe=(0,X.jsxs)(pn,{children:[le,(0,X.jsx)(en,{onClick:F,disabled:de,children:fe})]}),t[74]=F,t[75]=de,t[76]=pe):pe=t[76];let me;t[77]!==ce||t[78]!==pe?(me=(0,X.jsxs)(ln,{className:`sm:max-w-xl`,"data-ok-layer-spawned":``,onPointerDownOutside:RJ,onFocusOutside:RJ,onInteractOutside:RJ,children:[V,ce,pe]}),t[77]=ce,t[78]=pe,t[79]=me):me=t[79];let he;return t[80]!==u||t[81]!==n||t[82]!==me?(he=(0,X.jsx)(_n,{open:n,onOpenChange:u,children:me}),t[80]=u,t[81]=n,t[82]=me,t[83]=he):he=t[83],he}function oY(e){let t=(0,Z.c)(99),{editor:n,nodeId:r,sourceDocName:i,onClose:a,onNavigate:c}=e,l=QJ(n.state,r),d=l?.attrs?.href??``,[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(!1),g;t[0]!==r||t[1]!==p?(g=()=>{qO(r)&&p(!0)},t[0]=r,t[1]=p,t[2]=g):g=t[2];let _;t[3]===r?_=t[4]:(_=[r],t[3]=r,t[4]=_),(0,Q.useEffect)(g,_);let{addPage:v,folderPaths:y,pages:b,loading:x}=Mn(),{_:S}=s();if(!l)return null;let C=n.state.doc.textBetween(l.from,l.to),w=d?u(d,i):null,T;t[5]!==n||t[6]!==r?(T=function(e,t,i){let a=QJ(n.state,r);if(!a)return;let o=t.trim();if(!i||!o){n.chain().setTextSelection({from:a.from,to:a.to}).extendMarkRange(`link`).updateAttributes(`link`,{href:e}).run();return}let s=n.schema.marks.link;if(!s)return;let c=s.create({href:e}),l=n.schema.text(o,[c]);n.view.dispatch(n.state.tr.replaceWith(a.from,a.to,l))},t[5]=n,t[6]=r,t[7]=T):T=t[7];let E=T,D;t[8]!==n||t[9]!==r||t[10]!==a?(D=function(){let e=QJ(n.state,r);e&&(n.chain().focus().setTextSelection({from:e.from,to:e.to}).extendMarkRange(`link`).unsetLink().run(),a())},t[8]=n,t[9]=r,t[10]=a,t[11]=D):D=t[11];let O=D,k;t[12]!==n||t[13]!==r||t[14]!==a||t[15]!==p?(k=function(e){if(e){p(!0);return}let t=QJ(n.state,r);if(t?.attrs?.href??``){p(!1);return}t&&n.chain().focus().deleteRange({from:t.from,to:t.to}).run(),a()},t[12]=n,t[13]=r,t[14]=a,t[15]=p,t[16]=k):k=t[16];let A=(0,X.jsx)(aY,{open:f,href:d,text:C,pages:b,folderPaths:y,loading:x,onOpenChange:d?p:k,onSave:E});if(!d)return(0,X.jsx)(X.Fragment,{children:A});let j=w?.kind===`doc`?`${w.docName}${w.anchor?`#${w.anchor}`:``}`:w?.kind===`anchor`?`#${w.anchor}`:w?.kind===`external`?w.url:d,M=function(e){let t=QJ(n.state,r);t&&n.chain().setTextSelection({from:t.from,to:t.to}).extendMarkRange(`link`).updateAttributes(`link`,{href:IW(e,w?.kind===`doc`?w.anchor??null:null)}).run()},N,P=!1,F=!1,I=null;if(x){let e;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(zn,{className:`size-3.5 shrink-0 animate-spin`,"aria-hidden":`true`}),t[17]=e):e=t[17],N={icon:e,text:S({id:`yQE2r9`}),className:`text-muted-foreground/80`}}else if(w?.kind===`asset`){let e;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(ia,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),t[18]=e):e=t[18],N={icon:e,text:S({id:`yWWThY`}),className:`text-muted-foreground`}}else if(w?.kind===`external`){let e;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(wn,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),t[19]=e):e=t[19],N={icon:e,text:S({id:`zgSFyG`}),className:`text-muted-foreground`}}else if(w?.kind===`anchor`){let e;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(ia,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),t[20]=e):e=t[20],N={icon:e,text:S({id:`dprWmL`}),className:`text-muted-foreground`}}else if(w?.kind===`doc`){let e=pW(w.docName,{pages:b,folderPaths:y});if(F=e.kind===`navigate`&&e.displayState===`folder`,P=e.kind===`create`,I=e.kind===`create`?{initialDir:e.initialDir,suggestedName:e.suggestedName}:null,F){let e;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(Bn,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),t[21]=e):e=t[21],N={icon:e,text:S({id:`kNqMMd`}),className:`text-muted-foreground`}}else if(P){let e;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(Wi,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),t[22]=e):e=t[22],N={icon:e,text:S({id:`8F1i42`}),className:`text-red-700 dark:text-red-300`}}else{let e;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(ia,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),t[23]=e):e=t[23],N={icon:e,text:S({id:`JtD-Br`}),className:`text-muted-foreground`}}}else{let e;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(Wi,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),t[24]=e):e=t[24],N={icon:e,text:S({id:`-g6KIS`}),className:`text-muted-foreground/80`}}let L=w?.kind===`external`,R=w?.kind===`doc`?EW({docName:w.docName,anchor:w.anchor}):w?.kind===`anchor`?EW({docName:i,anchor:w.anchor}):w?.kind===`external`&&CW(w.url)?w.url:null,z=!x&&R!==null&&(w?.kind===`anchor`||w?.kind===`external`||w?.kind===`doc`&&!P&&!F),B;t[25]!==n.state||t[26]!==n.view||t[27]!==r?(B=()=>{let e=QJ(n.state,r);if(!e)return new DOMRect;try{return At(n.view,e.from,e.to)}catch{return new DOMRect}},t[25]=n.state,t[26]=n.view,t[27]=r,t[28]=B):B=t[28];let V;t[29]!==n.view.dom||t[30]!==B?(V={getBoundingClientRect:B,contextElement:n.view.dom},t[29]=n.view.dom,t[30]=B,t[31]=V):V=t[31];let H=V,ee;t[32]!==S||t[33]!==v||t[34]!==m||t[35]!==I||t[36]!==a||t[37]!==M?(ee=async function(){if(!(!I||m)){h(!0);try{await EJ(I,{addPage:v,onCreated(e){M(e),window.location.hash=`#/${e}`,a()}}),h(!1)}catch(e){let t=e;Qn.error(t instanceof Error?t.message:S({id:`tfi40B`})),h(!1)}}},t[32]=S,t[33]=v,t[34]=m,t[35]=I,t[36]=a,t[37]=M,t[38]=ee):ee=t[38];let U=ee,W=Xt(`flex shrink-0`,N.className),te;t[39]!==N.icon||t[40]!==W?(te=(0,X.jsx)(`span`,{className:W,children:N.icon}),t[39]=N.icon,t[40]=W,t[41]=te):te=t[41];let G=te,ne;t[42]!==G||t[43]!==P||t[44]!==N.text?(ne=P?(0,X.jsxs)(xr,{children:[(0,X.jsx)(yr,{asChild:!0,children:(0,X.jsx)(`span`,{className:`flex shrink-0`,"data-slot":`internal-link-prop-panel-icon-trigger`,children:G})}),(0,X.jsx)(br,{children:N.text})]}):G,t[42]=G,t[43]=P,t[44]=N.text,t[45]=ne):ne=t[45];let re=ne,ie=`${N.text}: ${j}`,ae;t[46]!==j||t[47]!==L||t[48]!==P||t[49]!==R||t[50]!==z||t[51]!==a||t[52]!==c?(ae=(0,X.jsx)(yr,{asChild:!0,children:z?(0,X.jsx)(`a`,{href:R??void 0,...L?{target:`_blank`,rel:`noopener noreferrer`}:{},onClick:e=>NW(e,c,a),"data-slot":`internal-link-prop-panel-text`,className:`block truncate text-sm font-medium text-foreground underline-offset-2 hover:underline focus-visible:underline`,children:j}):(0,X.jsx)(`span`,{"data-slot":`internal-link-prop-panel-text`,className:Xt(`block truncate text-sm font-medium`,P?`text-muted-foreground`:`text-foreground`),children:j})}),t[46]=j,t[47]=L,t[48]=P,t[49]=R,t[50]=z,t[51]=a,t[52]=c,t[53]=ae):ae=t[53];let oe;t[54]===j?oe=t[55]:(oe=(0,X.jsx)(br,{className:`max-w-80 break-all`,children:j}),t[54]=j,t[55]=oe);let se;t[56]!==ae||t[57]!==oe?(se=(0,X.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,X.jsxs)(xr,{children:[ae,oe]})}),t[56]=ae,t[57]=oe,t[58]=se):se=t[58];let K;t[59]!==U||t[60]!==m||t[61]!==P?(K=P?(0,X.jsxs)(en,{type:`button`,size:`sm`,variant:`link`,disabled:m,onClick:()=>void U(),"data-slot":`internal-link-prop-panel-create`,className:`flex items-center text-foreground`,children:[(0,X.jsx)(Oa,{className:`size-3.5`,"aria-hidden":`true`}),m?(0,X.jsx)(o,{id:`HM56Bx`}):(0,X.jsx)(o,{id:`XRuL0i`})]}):null,t[59]=U,t[60]=m,t[61]=P,t[62]=K):K=t[62];let ce;t[63]===S?ce=t[64]:(ce=S({id:`ePK91l`}),t[63]=S,t[64]=ce);let le;t[65]===p?le=t[66]:(le=()=>p(!0),t[65]=p,t[66]=le);let ue;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,X.jsx)(qn,{className:`size-3.5`,"aria-hidden":`true`}),t[67]=ue):ue=t[67];let de;t[68]!==ce||t[69]!==le?(de=(0,X.jsx)(yr,{asChild:!0,children:(0,X.jsx)(en,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":ce,onClick:le,"data-slot":`internal-link-prop-panel-edit`,children:ue})}),t[68]=ce,t[69]=le,t[70]=de):de=t[70];let fe;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,X.jsx)(br,{children:(0,X.jsx)(o,{id:`ePK91l`})}),t[71]=fe):fe=t[71];let pe;t[72]===de?pe=t[73]:(pe=(0,X.jsxs)(xr,{children:[de,fe]}),t[72]=de,t[73]=pe);let me;t[74]===d?me=t[75]:(me=(0,X.jsx)(YJ,{copyContent:d}),t[74]=d,t[75]=me);let he;t[76]===S?he=t[77]:(he=S({id:`t_YqKh`}),t[76]=S,t[77]=he);let ge;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,X.jsx)(Hn,{className:`size-3.5`,"aria-hidden":`true`}),t[78]=ge):ge=t[78];let _e;t[79]!==O||t[80]!==he?(_e=(0,X.jsx)(yr,{asChild:!0,children:(0,X.jsx)(en,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":he,onClick:O,"data-slot":`internal-link-prop-panel-remove`,children:ge})}),t[79]=O,t[80]=he,t[81]=_e):_e=t[81];let ve;t[82]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,X.jsx)(br,{children:(0,X.jsx)(o,{id:`t_YqKh`})}),t[82]=ve):ve=t[82];let ye;t[83]===_e?ye=t[84]:(ye=(0,X.jsxs)(xr,{children:[_e,ve]}),t[83]=_e,t[84]=ye);let be;t[85]!==K||t[86]!==pe||t[87]!==me||t[88]!==ye?(be=(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[K,pe,me,ye]}),t[85]=K,t[86]=pe,t[87]=me,t[88]=ye,t[89]=be):be=t[89];let xe;t[90]!==re||t[91]!==se||t[92]!==be?(xe=(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[re,se,be]}),t[90]=re,t[91]=se,t[92]=be,t[93]=xe):xe=t[93];let Se;return t[94]!==a||t[95]!==ie||t[96]!==xe||t[97]!==H?(Se=(0,X.jsx)(gJ,{kind:`internal-link`,ariaLabel:ie,onDeactivate:a,triggerReference:H,className:`w-96`,children:xe}),t[94]=a,t[95]=ie,t[96]=xe,t[97]=H,t[98]=Se):Se=t[98],(0,X.jsxs)(X.Fragment,{children:[A,Se]})}new q(`markIdentityDecoration`);var sY=`data-mark-id`,cY=new q(`linkResolutionDecoration`);function lY(e,t,n,r,i){if(t.size===0)return null;let a=[];for(let e of t.values()){if(!n.has(e.markType))continue;let t=r(e,i),o={[sY]:e.id};t!==null&&Object.assign(o,t),a.push(dt.inline(e.from,e.to,o))}return a.length===0?null:Qe.create(e,a)}function uY(e){let t=new Set(e.markTypes),{computeAttrs:n}=e;return new Ht({key:cY,state:{init:()=>({version:0}),apply(e,t){let n=e.getMeta(cY);return n&&typeof n==`object`&&n.refresh?{version:t.version+1}:t}},props:{decorations(e){let r=JO.getState(e);if(!r)return null;let i=Fn();return lY(e.doc,r.byId,t,n,i)}},view(e){$(`ok/render/decoration-merge`,{markTypes:Array.from(t).join(`,`)},{startTime:performance.now(),duration:0});let n=Pn(()=>{e.dispatch(e.state.tr.setMeta(cY,{refresh:!0}))});return{destroy(){n()}}}})}var dY=N.extend({addOptions(){return{...this.parent?.(),docName:``}},renderHTML({HTMLAttributes:e}){let t=typeof e.href==`string`?e.href:``;return[`span`,st(e,{"data-link":``,role:`link`,tabindex:`0`,"aria-label":t?`Link: ${t}`:`Link`,style:`touch-action: manipulation;`}),0]},addProseMirrorPlugins(){let e=this.options.docName??``,t=({editor:t,nodeId:n,newTab:r})=>{let i=QJ(t.state,n),a=i?.attrs?.href;if(typeof a!=`string`||!a)return!1;let o=i?.attrs?.sourceForm,s=u(a,e),c=m(a);if(s?.kind===`asset`||o===`wikiembed`&&c!==null){let t=s?.kind===`asset`?s.url:a,n=s?.kind===`asset`?s.ext:c??``,i=h(t,e);if(!i)return!1;let o=Fn();return o===null||(o.assetPaths!==void 0||o.filePaths!==void 0)&&!hW(t,e,o.assetPaths,o.filePaths)?!1:(jW({url:t,projectRelPath:i,ext:n,title:i.split(`/`).pop()??t,newTab:r}),!0)}if(!s)return!1;switch(s.kind){case`doc`:{let e=Fn(),t=pW(s.docName,{pages:e?.pages??new Set,folderPaths:e?.folderPaths??new Set});return t.kind===`create`||t.kind===`navigate`&&t.displayState===`folder`?!1:(r?kW({docName:s.docName,anchor:s.anchor}):window.location.assign(EW({docName:s.docName,anchor:s.anchor})),!0)}case`anchor`:return r?kW({docName:e,anchor:s.anchor}):window.location.assign(EW({docName:e,anchor:s.anchor})),!0;case`external`:return CW(s.url)?(DW(s.url),!0):!1;default:return ge(s)}};return[tY({editor:this.editor,markTypes:[`link`],renderPropPanel:({editor:n,nodeId:r,deactivate:i})=>(0,Q.createElement)(oY,{editor:n,nodeId:r,sourceDocName:e,onClose:i,onNavigate:e=>t({editor:n,nodeId:r,newTab:e})}),handlePrimary:t}),uY({markTypes:[`link`],computeAttrs:vW(e)}),hJ({sourceDocName:e})]}}),fY=(0,Q.createContext)(null),pY={didCatch:!1,error:null},mY=class extends Q.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=pY}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(...e){let{error:t}=this.state;t!==null&&(this.props.onReset?.({args:e,reason:`imperative-api`}),this.setState(pY))}componentDidCatch(e,t){this.props.onError?.(e,t)}componentDidUpdate(e,t){let{didCatch:n}=this.state,{resetKeys:r}=this.props;n&&t.error!==null&&hY(e.resetKeys,r)&&(this.props.onReset?.({next:r,prev:e.resetKeys,reason:`keys`}),this.setState(pY))}render(){let{children:e,fallbackRender:t,FallbackComponent:n,fallback:r}=this.props,{didCatch:i,error:a}=this.state,o=e;if(i){let e={error:a,resetErrorBoundary:this.resetErrorBoundary};if(typeof t==`function`)o=t(e);else if(n)o=(0,Q.createElement)(n,e);else if(r!==void 0)o=r;else throw a}return(0,Q.createElement)(fY.Provider,{value:{didCatch:i,error:a,resetErrorBoundary:this.resetErrorBoundary}},o)}};function hY(e=[],t=[]){return e.length!==t.length||e.some((e,n)=>!Object.is(e,t[n]))}function gY(e){let t=(0,Z.c)(23),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({label:i,Icon:n,onClick:a,selected:s,className:r,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let c=s?`true`:void 0,l;t[7]===a?l=t[8]:(l=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),a())},t[7]=a,t[8]=l);let u;t[9]===r?u=t[10]:(u=Xt(`flex w-full items-center justify-center gap-2 rounded-md border border-dashed border-border bg-transparent px-3 py-2 text-center text-sm text-muted-foreground transition-colors hover:bg-muted/50 cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,r),t[9]=r,t[10]=u);let d;t[11]===n?d=t[12]:(d=(0,X.jsx)(n,{size:16,"aria-hidden":`true`}),t[11]=n,t[12]=d);let f;t[13]===i?f=t[14]:(f=(0,X.jsx)(`span`,{children:i}),t[13]=i,t[14]=f);let p;return t[15]!==a||t[16]!==o||t[17]!==c||t[18]!==l||t[19]!==u||t[20]!==d||t[21]!==f?(p=(0,X.jsxs)(`div`,{...o,role:`button`,tabIndex:-1,contentEditable:!1,"data-descriptor-placeholder":``,"data-selected":c,onClick:a,onMouseDown:_Y,onKeyDown:l,className:u,children:[d,f]}),t[15]=a,t[16]=o,t[17]=c,t[18]=l,t[19]=u,t[20]=d,t[21]=f,t[22]=p):p=t[22],p}function _Y(e){e.preventDefault(),e.stopPropagation()}function vY(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(Vs,{"data-slot":`select`,...n}),t[2]=n,t[3]=r),r}function yY(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(Us,{"data-slot":`select-value`,...n}),t[2]=n,t[3]=r),r}function bY(e){let t=(0,Z.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,size:a,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`default`:a,s;t[5]===r?s=t[6]:(s=Xt(`flex w-full items-center justify-between gap-2 rounded-lg border border-input bg-background text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=default]:px-2.5 data-[size=sm]:px-2 data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,r),t[5]=r,t[6]=s);let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,X.jsx)(Ws,{asChild:!0,children:(0,X.jsx)(yn,{className:`size-4 opacity-50`})}),t[7]=c):c=t[7];let l;return t[8]!==n||t[9]!==i||t[10]!==o||t[11]!==s?(l=(0,X.jsxs)(Hs,{"data-slot":`select-trigger`,"data-size":o,className:s,...i,children:[n,c]}),t[8]=n,t[9]=i,t[10]=o,t[11]=s,t[12]=l):l=t[12],l}function xY(e){let t=(0,Z.c)(20),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,position:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`popper`:a,s=o===`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`,c;t[5]!==r||t[6]!==s?(c=Xt(`relative z-50 max-h-(--radix-select-content-available-height) min-w-32 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border bg-popover text-popover-foreground shadow-md outline-hidden duration-100 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-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 data-[align-trigger=true]:animate-none motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0`,s,r),t[5]=r,t[6]=s,t[7]=c):c=t[7];let l;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,X.jsx)(CY,{}),t[8]=l):l=t[8];let u=o===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1`,d;t[9]===u?d=t[10]:(d=Xt(`p-1`,u),t[9]=u,t[10]=d);let f;t[11]!==n||t[12]!==d?(f=(0,X.jsx)(qs,{className:d,children:n}),t[11]=n,t[12]=d,t[13]=f):f=t[13];let p;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,X.jsx)(wY,{}),t[14]=p):p=t[14];let m;return t[15]!==o||t[16]!==i||t[17]!==c||t[18]!==f?(m=(0,X.jsx)(Gs,{children:(0,X.jsxs)(Ks,{"data-slot":`select-content`,"data-ok-layer-spawned":``,position:o,className:c,...i,children:[l,f,p]})}),t[15]=o,t[16]=i,t[17]=c,t[18]=f,t[19]=m):m=t[19],m}function SY(e){let t=(0,Z.c)(13),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=Xt(`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 focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,r),t[4]=r,t[5]=a);let o;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,X.jsx)(`span`,{className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,X.jsx)(Xs,{children:(0,X.jsx)(tn,{className:`size-4`})})}),t[6]=o):o=t[6];let s;t[7]===n?s=t[8]:(s=(0,X.jsx)(Ys,{children:n}),t[7]=n,t[8]=s);let c;return t[9]!==i||t[10]!==a||t[11]!==s?(c=(0,X.jsxs)(Js,{"data-slot":`select-item`,className:a,...i,children:[o,s]}),t[9]=i,t[10]=a,t[11]=s,t[12]=c):c=t[12],c}function CY(e){let t=(0,Z.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Xt(`flex cursor-default items-center justify-center py-1`,n),t[3]=n,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(Ui,{className:`size-4`}),t[5]=a):a=t[5];let o;return t[6]!==r||t[7]!==i?(o=(0,X.jsx)(Zs,{"data-slot":`select-scroll-up-button`,className:i,...r,children:a}),t[6]=r,t[7]=i,t[8]=o):o=t[8],o}function wY(e){let t=(0,Z.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Xt(`flex cursor-default items-center justify-center py-1`,n),t[3]=n,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(yn,{className:`size-4`}),t[5]=a):a=t[5];let o;return t[6]!==r||t[7]!==i?(o=(0,X.jsx)(Qs,{"data-slot":`select-scroll-down-button`,className:i,...r,children:a}),t[6]=r,t[7]=i,t[8]=o):o=t[8],o}function TY(e){let t=(0,Z.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,size:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`default`:i,o;t[4]===n?o=t[5]:(o=Xt(`peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50`,n),t[4]=n,t[5]=o);let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsx)(dc,{"data-slot":`switch-thumb`,className:`pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground`}),t[6]=s):s=t[6];let c;return t[7]!==r||t[8]!==a||t[9]!==o?(c=(0,X.jsx)(uc,{"data-slot":`switch`,"data-size":a,className:o,...r,children:s}),t[7]=r,t[8]=a,t[9]=o,t[10]=c):c=t[10],c}function EY(e){let t=e.trim();if(/^#[0-9a-fA-F]{6}$/.test(t))return t.toLowerCase();if(/^#[0-9a-fA-F]{3}$/.test(t)){let[,e,n,r]=t.match(/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/)??[];return`#${e}${e}${n}${n}${r}${r}`.toLowerCase()}return`#000000`}function DY(e){let t=(0,Z.c)(36),{id:n,value:r,onChange:i,autoFocus:a}=e,o=(0,Q.useRef)(null),s;t[0]===i?s=t[1]:(s=e=>i(e.target.value),t[0]=i,t[1]=s);let c=a?``:void 0,l=r?`pl-7`:void 0,u;t[2]===l?u=t[3]:(u=Xt(`h-7 text-sm`,l),t[2]=l,t[3]=u);let d;t[4]!==a||t[5]!==n||t[6]!==s||t[7]!==c||t[8]!==u||t[9]!==r?(d=(0,X.jsx)(Ir,{id:n,type:`text`,value:r,placeholder:`#F05032 or rgb(240,80,50)`,onChange:s,autoFocus:a,"data-prop-autofocus":c,className:u,"data-color-picker-input":``}),t[4]=a,t[5]=n,t[6]=s,t[7]=c,t[8]=u,t[9]=r,t[10]=d):d=t[10];let f;t[11]===r?f=t[12]:(f=r&&(0,X.jsx)(`span`,{style:{backgroundColor:r},className:`pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 rounded-sm border border-border`,"aria-hidden":`true`,"data-color-picker-swatch":``}),t[11]=r,t[12]=f);let p;t[13]!==d||t[14]!==f?(p=(0,X.jsxs)(`div`,{className:`relative flex-1`,children:[d,f]}),t[13]=d,t[14]=f,t[15]=p):p=t[15];let m;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>o.current?.click(),t[16]=m):m=t[16];let h=r||`transparent`,g;t[17]===h?g=t[18]:(g=(0,X.jsx)(en,{type:`button`,variant:`outline`,size:`xs`,"aria-label":`Choose color`,"data-color-picker-trigger":``,className:`h-7 gap-1 px-2`,onClick:m,children:(0,X.jsx)(`span`,{style:{backgroundColor:h},className:`size-3.5 rounded-sm border border-border`,"aria-hidden":`true`})}),t[17]=h,t[18]=g);let _;t[19]===r?_=t[20]:(_=EY(r),t[19]=r,t[20]=_);let v;t[21]===i?v=t[22]:(v=e=>i(e.target.value),t[21]=i,t[22]=v);let y;t[23]!==_||t[24]!==v?(y=(0,X.jsx)(`input`,{ref:o,type:`color`,value:_,onChange:v,tabIndex:-1,"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 size-7 opacity-0`,"data-color-picker-native":``}),t[23]=_,t[24]=v,t[25]=y):y=t[25];let b;t[26]!==g||t[27]!==y?(b=(0,X.jsxs)(`div`,{className:`relative`,children:[g,y]}),t[26]=g,t[27]=y,t[28]=b):b=t[28];let x;t[29]!==i||t[30]!==r?(x=r&&(0,X.jsx)(en,{type:`button`,variant:`ghost`,size:`xs`,"aria-label":`Clear color`,"data-color-picker-clear":``,className:`h-7 px-1.5`,onClick:()=>i(``),children:(0,X.jsx)(Xi,{className:`size-3`,"aria-hidden":`true`})}),t[29]=i,t[30]=r,t[31]=x):x=t[31];let S;return t[32]!==b||t[33]!==x||t[34]!==p?(S=(0,X.jsxs)(`div`,{className:`flex gap-1`,children:[p,b,x]}),t[32]=b,t[33]=x,t[34]=p,t[35]=S):S=t[35],S}function OY(e){let t=(0,Z.c)(43),{id:n,value:r,onChange:i,autoFocus:a}=e,[o,s]=(0,Q.useState)(!1),c;t[0]===r?c=t[1]:(c=vk(r),t[0]=r,t[1]=c);let l=c,u;t[2]===r?u=t[3]:(u=r.startsWith(`lucide:`)?r.slice(7):null,t[2]=r,t[3]=u);let d=u,f;t[4]===i?f=t[5]:(f=e=>i(e.target.value),t[4]=i,t[5]=f);let p=a?``:void 0,m=l?`pl-7`:void 0,h;t[6]===m?h=t[7]:(h=Xt(`h-7 text-sm`,m),t[6]=m,t[7]=h);let g;t[8]!==a||t[9]!==n||t[10]!==f||t[11]!==p||t[12]!==h||t[13]!==r?(g=(0,X.jsx)(Ir,{id:n,type:`text`,value:r,placeholder:`lucide:Lightbulb or 📘`,onChange:f,autoFocus:a,"data-prop-autofocus":p,className:h,"data-icon-picker-input":``}),t[8]=a,t[9]=n,t[10]=f,t[11]=p,t[12]=h,t[13]=r,t[14]=g):g=t[14];let _;t[15]===l?_=t[16]:(_=l&&(0,X.jsx)(l,{className:`pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground`,"aria-hidden":`true`}),t[15]=l,t[16]=_);let v;t[17]!==g||t[18]!==_?(v=(0,X.jsxs)(`div`,{className:`relative flex-1`,children:[g,_]}),t[17]=g,t[18]=_,t[19]=v):v=t[19];let y;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,X.jsx)(yn,{className:`size-3`,"aria-hidden":`true`}),t[20]=y):y=t[20];let b;t[21]===o?b=t[22]:(b=(0,X.jsx)(gc,{asChild:!0,children:(0,X.jsx)(en,{type:`button`,variant:`outline`,size:`xs`,"aria-label":`Choose icon`,"aria-haspopup":`listbox`,"aria-expanded":o,"data-icon-picker-trigger":``,className:`h-7 gap-1 px-2`,children:y})}),t[21]=o,t[22]=b);let x;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,X.jsx)(Tx,{placeholder:`Search icons...`,className:`h-8 text-sm`}),t[23]=x):x=t[23];let S;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,X.jsx)(Dx,{children:`No icons match.`}),t[24]=S):S=t[24];let C;t[25]!==i||t[26]!==r.length?(C=r.length>0&&(0,X.jsx)(Ox,{children:(0,X.jsxs)(kx,{value:`__clear__`,onSelect:()=>{i(``),s(!1)},className:`gap-2 text-muted-foreground`,"data-icon-picker-clear":``,children:[(0,X.jsx)($n,{className:`size-3.5`,"aria-hidden":`true`}),`Clear icon`]})}),t[25]=i,t[26]=r.length,t[27]=C):C=t[27];let w;t[28]!==i||t[29]!==d?(w=_k.map(e=>{let[t,n]=e,r=t===d;return(0,X.jsx)(kx,{value:t,onSelect:()=>{i(`lucide:${t}`),s(!1)},title:t,"aria-label":t,"data-icon-picker-item":t,"data-icon-picker-selected":r?``:void 0,className:Xt(`flex aspect-square items-center justify-center rounded-md p-0`,r?`bg-foreground/10 text-foreground ring-1 ring-foreground/30`:`text-muted-foreground hover:bg-muted`),children:(0,X.jsx)(n,{className:`size-4`,"aria-hidden":`true`})},t)}),t[28]=i,t[29]=d,t[30]=w):w=t[30];let T;t[31]===w?T=t[32]:(T=(0,X.jsx)(Ox,{heading:`Lucide`,children:(0,X.jsx)(dx.Group,{className:`[&_[cmdk-group-items]]:grid [&_[cmdk-group-items]]:grid-cols-6 [&_[cmdk-group-items]]:gap-1 [&_[cmdk-group-items]]:p-1`,children:w})}),t[31]=w,t[32]=T);let E;t[33]!==C||t[34]!==T?(E=(0,X.jsx)(_c,{align:`end`,className:`z-70 w-72 p-0`,onOpenAutoFocus:kY,children:(0,X.jsxs)(Cx,{label:`Icon picker`,children:[x,(0,X.jsxs)(Ex,{className:`max-h-64`,children:[S,C,T]})]})}),t[33]=C,t[34]=T,t[35]=E):E=t[35];let D;t[36]!==o||t[37]!==b||t[38]!==E?(D=(0,X.jsxs)(hc,{open:o,onOpenChange:s,children:[b,E]}),t[36]=o,t[37]=b,t[38]=E,t[39]=D):D=t[39];let O;return t[40]!==D||t[41]!==v?(O=(0,X.jsxs)(`div`,{className:`flex gap-1`,children:[v,D]}),t[40]=D,t[41]=v,t[42]=O):O=t[42],O}function kY(e){return e.preventDefault()}function AY(e){let[t]=e.split(`/`);switch(t){case`image`:return`image`;case`video`:return`video`;case`audio`:return`audio`;case`application`:return e===`application/pdf`?`pdf`:null;case`text`:return`text`;default:return null}}function jY(e){if(e.length===1&&e[0]===`*/*`)return`all`;let t=new Set;for(let n of e){if(n===`*/*`)return`all`;let e=AY(n);e&&t.add(e)}return t}function MY(e){let t=e.lastIndexOf(`.`);return t<0||t<e.lastIndexOf(`/`)?``:e.slice(t+1).toLowerCase()}function NY(e,t){let n=jY(t),r=[];for(let t of e){if(n===`all`){r.push(t);continue}let e=Le(MY(t));e&&n.has(e)&&r.push(t)}return r}var PY=8,FY=new Set,IY=null;function LY(e){return{path:e,basename:e.split(`/`).pop()??e}}function RY(e){let t=e.map(e=>e.path).join(``);return IY?.fingerprint===t||(IY={fingerprint:t,byPath:new Map(e.map(e=>[e.path,e])),itemsInOrder:e,corpus:Ae(e.map(e=>Pt({kind:`page`,path:e.path,title:e.basename})))}),IY}function zY(e){let t=e.trim();return t.startsWith(`/`)?t.slice(1):t}function BY(e,t){let n=zY(t);return n?b(e.corpus,n,{intent:`autocomplete`,limit:PY}).map(t=>e.byPath.get(t.document.path)).filter(e=>!!e):e.itemsInOrder.slice(0,PY)}function VY(e){let t=(0,Z.c)(52),{value:n,onChange:r,accept:i,id:a,placeholder:o,autoFocus:s,ariaInvalid:c,ariaDescribedBy:l,dataPropAutofocus:u,className:d,onSubmit:f}=e,p=In()?.assetPaths??FY,m;t[0]!==i||t[1]!==p||t[2]!==n?(m=BY(RY(NY(p,i).map(LY)),n),t[0]=i,t[1]=p,t[2]=n,t[3]=m):m=t[3];let h=m,[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(0),b,x;t[4]!==v||t[5]!==h.length?(b=()=>{v>=h.length&&y(0)},x=[v,h.length],t[4]=v,t[5]=h.length,t[6]=b,t[7]=x):(b=t[6],x=t[7]),(0,Q.useEffect)(b,x);let S=(0,Q.useId)(),C=(0,Q.useRef)(null),w=g&&h.length>0,T;t[8]===r?T=t[9]:(T=e=>{r(`/${e.path}`),_(!1),y(0),C.current?.focus()},t[8]=r,t[9]=T);let E=T,D;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>_(e),t[10]=D):D=t[10];let O=w?S:void 0,k=w&&h[v]?`${S}-opt-${v}`:void 0,A;t[11]===r?A=t[12]:(A=e=>{r(e.target.value),_(!0),y(0)},t[11]=r,t[12]=A);let j,M;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(M=()=>{_(!0)},j=()=>{_(!0)},t[13]=j,t[14]=M):(j=t[13],M=t[14]);let N;t[15]!==v||t[16]!==f||t[17]!==E||t[18]!==h||t[19]!==w?(N=e=>{if(e.key===`ArrowDown`){if(h.length===0)return;e.preventDefault(),_(!0),y(e=>(e+1)%h.length);return}if(e.key===`ArrowUp`){if(h.length===0)return;e.preventDefault(),_(!0),y(e=>(e-1+h.length)%h.length);return}if(e.key===`Enter`){if(w){let t=h[v];if(t){e.preventDefault(),E(t);return}}f&&(e.preventDefault(),f());return}if(e.key===`Escape`){if(!w)return;e.preventDefault(),e.stopPropagation(),_(!1);return}e.key===`Tab`&&_(!1)},t[15]=v,t[16]=f,t[17]=E,t[18]=h,t[19]=w,t[20]=N):N=t[20];let P;t[21]!==l||t[22]!==c||t[23]!==s||t[24]!==d||t[25]!==u||t[26]!==a||t[27]!==o||t[28]!==N||t[29]!==O||t[30]!==k||t[31]!==A||t[32]!==n||t[33]!==w?(P=(0,X.jsx)(vc,{asChild:!0,children:(0,X.jsx)(Ir,{ref:C,id:a,type:`text`,value:n,placeholder:o,autoFocus:s,"data-prop-autofocus":u,"aria-invalid":c,"aria-describedby":l,role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":w,"aria-controls":O,"aria-activedescendant":k,className:d,onChange:A,onFocus:M,onClick:j,onKeyDown:N})}),t[21]=l,t[22]=c,t[23]=s,t[24]=d,t[25]=u,t[26]=a,t[27]=o,t[28]=N,t[29]=O,t[30]=k,t[31]=A,t[32]=n,t[33]=w,t[34]=P):P=t[34];let F;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(F=e=>{let t=e.target;t instanceof Node&&C.current?.contains(t)&&e.preventDefault()},t[35]=F):F=t[35];let I;if(t[36]!==v||t[37]!==S||t[38]!==E||t[39]!==h){let e;t[41]!==v||t[42]!==S||t[43]!==E?(e=(e,t)=>{let n=`${S}-opt-${t}`,r=t===v;return(0,X.jsxs)(`button`,{id:n,type:`button`,role:`option`,"aria-selected":r,"data-testid":`src-autocomplete-option`,"data-highlighted":r?``:void 0,className:Xt(`flex w-full flex-col items-start gap-0.5 rounded-sm px-2 py-1 text-left text-xs`,`transition-colors`,r?`bg-accent text-accent-foreground`:`hover:bg-accent/50`),onMouseEnter:()=>y(t),onMouseDown:t=>{t.preventDefault(),E(e)},children:[(0,X.jsx)(`span`,{className:`font-medium`,children:e.basename}),e.basename!==e.path&&(0,X.jsx)(`span`,{className:`text-muted-foreground/70`,children:e.path})]},e.path)},t[41]=v,t[42]=S,t[43]=E,t[44]=e):e=t[44],I=h.map(e),t[36]=v,t[37]=S,t[38]=E,t[39]=h,t[40]=I}else I=t[40];let L;t[45]!==S||t[46]!==I?(L=(0,X.jsx)(_c,{align:`start`,sideOffset:4,className:`z-70 w-(--radix-popover-trigger-width) p-1`,onOpenAutoFocus:UY,onCloseAutoFocus:HY,onInteractOutside:F,children:(0,X.jsx)(`div`,{id:S,role:`listbox`,"aria-label":`Asset suggestions`,className:`flex flex-col gap-px`,children:I})}),t[45]=S,t[46]=I,t[47]=L):L=t[47];let R;return t[48]!==P||t[49]!==L||t[50]!==w?(R=(0,X.jsxs)(hc,{open:w,onOpenChange:D,children:[P,L]}),t[48]=P,t[49]=L,t[50]=w,t[51]=R):R=t[51],R}function HY(e){e.preventDefault()}function UY(e){e.preventDefault()}function WY(){if(typeof window>`u`)return null;let e=window.location.hash.match(/^#\/([^?#]+)/);return e?decodeURIComponent(e[1]):null}var GY=`/api/upload`;async function KY(e,t,n={}){let r=n.fetch??globalThis.fetch,i=n.docName===void 0?WY():n.docName;if(!i)throw Error(`No document is open`);let a=new FormData;a.append(`file`,e),a.append(`parentDocName`,i);let o;try{o=await r(GY,{method:`POST`,body:a})}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`Upload failed: ${t}`)}let s;try{s=await o.json()}catch(e){throw new MO(`Upload response is not JSON.`,{cause:e,status:o.status})}if(!o.ok){let e=lt.safeParse(s);throw e.success?Error(e.data.title):new MO(`Upload error response did not match ProblemDetails.`,{cause:e.error,status:o.status})}let c=te.safeParse(s);if(!c.success)throw new MO(`Upload success response did not match UploadAssetSuccess.`,{cause:c.error,status:o.status});let l=c.data.path??c.data.src;return{url:l.startsWith(`/`)?l:`/${l}`}}var qY=new Intl.PluralRules(`en-US`);function JY(e,t,n){return n<=0?`${e} (empty)`:`${e} with ${n} ${qY.select(n)===`one`?`item`:`items`}`}function YY(e){for(let t of e)if(t.type===`string`&&t.hidden!==!0&&t.advanced!==!0&&t.autoFocus===!0)return t.name;return null}function XY(e){if(!e)return e;let t=e.replace(/[_-]+/g,` `).replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/([A-Z]+)([A-Z][a-z])/g,`$1 $2`);return t.charAt(0).toUpperCase()+t.slice(1)}var ZY=new Set([`auto`,`inherit`,`initial`,`unset`]),QY=new Set([`px`,`%`,`rem`,`em`,`vh`,`vw`,`ch`,`ex`,`fr`]),$Y=/^(-?\d+(?:\.\d+)?)([a-z%]*)$/i;function eX(e){let t=e.trim();if(!t)return{valid:!1,reason:`empty`};if(ZY.has(t.toLowerCase()))return{valid:!0};let n=t.match($Y);if(!n)return{valid:!1,reason:`malformed-syntax`};let r=(n[2]??``).toLowerCase();return r===``||QY.has(r)?{valid:!0}:{valid:!1,reason:`unknown-unit`}}function tX(e){if(e.valid)return null;switch(e.reason){case`empty`:return null;case`malformed-syntax`:return`Enter a number (e.g. 100), a number with a CSS unit (e.g. 100px, 50%, 26rem), or one of: auto, inherit, initial, unset.`;case`unknown-unit`:return`Unknown CSS unit. Use px, %, rem, em, vh, vw, ch, ex, or fr.`}}var nX={video:w,audio:Me,image:de},rX={youtube:[`youtube.com`,`youtu.be`,`youtube-nocookie.com`],vimeo:[`vimeo.com`],loom:[`loom.com`]};function iX(e){let t=e.toLowerCase();for(let e of Object.keys(rX)){let n=rX[e];for(let r of n)if(t===r||t.endsWith(`.${r}`))return e}return null}function aX(e){let t=e.lastIndexOf(`/`),n=t>=0?e.slice(t+1):e,r=n.lastIndexOf(`.`);return r>0?n.slice(r+1).toLowerCase():``}var oX=`https://placeholder.invalid`;function sX(e,t){let n=e.trim();if(n.length===0)return{valid:!0};let r,i=!0;try{r=new URL(n)}catch{try{r=new URL(n,oX),i=!1}catch{return{valid:!1,reason:`invalid-url`}}}if(t===`video`&&Ut(n)!==null||t===`video`&&St(n)||t===`video`&&Te(n))return{valid:!0};let a=i?iX(r.hostname):null;if(a!==null)return{valid:!1,reason:`embed-provider`,provider:a};if(r.protocol===`data:`)return{valid:!1,reason:`data-uri`};let o=aX(r.pathname),s=nX[t];return o===``?i?{valid:!0}:{valid:!1,reason:`wrong-extension`,extension:``}:s.has(o)?{valid:!0}:{valid:!1,reason:`wrong-extension`,extension:o}}function cX(e){if(e.length===0)return;let t=e[0]?.toLowerCase()??``;if(t.startsWith(`video/`))return`video`;if(t.startsWith(`audio/`))return`audio`;if(t.startsWith(`image/`))return`image`}function lX(e){return`Direct ${e} file URL — ${Array.from(nX[e]).map(e=>`.${e}`).join(`, `)}`}var uX={youtube:`YouTube`,vimeo:`Vimeo`,loom:`Loom`};function dX(e,t){if(e.valid)return``;if(e.reason===`invalid-url`)return`Not a valid URL.`;if(e.reason===`data-uri`)return`Data URIs are not supported for media fields. Use a hosted file URL.`;if(e.reason===`embed-provider`){let n=uX[e.provider];return t===`video`?`Unrecognized ${n} URL. Paste a valid ${n} share or embed link, or a direct ${t} file URL.`:`${n} URLs are not direct ${t} files. Paste a direct ${t} file URL.`}let n=Array.from(nX[t]).map(e=>`.${e}`).join(`, `);return e.extension===``?`Missing file extension. Accepts: ${n}.`:`Unsupported extension .${e.extension}. Accepts: ${n}.`}function fX(e){return`ok.propPanel.advanced.${e}`}function pX(e){try{return typeof localStorage>`u`?!1:localStorage.getItem(fX(e))===`true`}catch{return!1}}function mX(e,t){try{if(typeof localStorage>`u`)return;localStorage.setItem(fX(e),t?`true`:`false`)}catch{}}function hX(e,t){let n=0;for(let r of e){let e=t[r.name],i=`defaultValue`in r?r.defaultValue:void 0;e!==void 0&&e!==i&&(n+=1)}return n}async function gX(e,t,n){try{let{url:r}=await KY(e,t);n(r)}catch(e){let t=e instanceof Error?e.message:String(e);Qn.error(rr._({id:`02P3hL`,values:{message:t}}))}}function _X(e){let t=(0,Z.c)(14),{descriptor:n,values:r,onChange:i,onDismiss:a}=e,s;t[0]===r?s=t[1]:(s=e=>!(`hidden`in e&&e.hidden)&&e.hideWhen?.(r)!==!0&&e.type!==`reactnode`,t[0]=r,t[1]=s);let c=n.props.filter(s),l=c.filter(yX),u=c.filter(vX),d=hX(u,r),f;t[2]===n.props?f=t[3]:(f=YY(n.props),t[2]=n.props,t[3]=f);let p=f,m;t[4]===n.name?m=t[5]:(m=()=>pX(n.name),t[4]=n.name,t[5]=m);let[h,g]=(0,Q.useState)(m);if(c.length===0)return null;let _;t[6]!==p||t[7]!==i||t[8]!==a||t[9]!==r?(_=e=>(0,X.jsx)(xX,{propDef:e,value:r[e.name],onChange:t=>i(e.name,t),onDismiss:a,isAutoFocused:e.name===p},e.name),t[6]=p,t[7]=i,t[8]=a,t[9]=r,t[10]=_):_=t[10];let v=l.map(_),y=u.length>0&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`my-1 border-t border-border`}),(0,X.jsxs)(Zn,{open:h,onOpenChange:e=>{g(e),mX(n.name,e)},children:[(0,X.jsxs)(Xn,{"data-prop-panel-advanced-trigger":``,className:`group flex w-full items-center justify-between rounded px-1 py-1 text-xs text-muted-foreground hover:bg-muted hover:text-foreground uppercase font-mono`,children:[(0,X.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(yn,{className:`size-3 transition-transform group-data-[state=closed]:-rotate-90`}),(0,X.jsx)(o,{id:`sxkWRg`})]}),d>0&&(0,X.jsx)(mc,{variant:`secondary`,"data-prop-panel-advanced-count":``,children:d})]}),(0,X.jsx)(Yn,{className:`flex flex-col gap-4 pt-2`,children:u.map(e=>(0,X.jsx)(xX,{propDef:e,value:r[e.name],onChange:t=>i(e.name,t),onDismiss:a,isAutoFocused:e.name===p},e.name))})]})]}),b;return t[11]!==v||t[12]!==y?(b=(0,X.jsxs)(`div`,{"data-prop-panel":``,className:`flex flex-col gap-4 py-2 text-sm`,children:[v,y]}),t[11]=v,t[12]=y,t[13]=b):b=t[13],b}function vX(e){return`advanced`in e&&e.advanced}function yX(e){return!(`advanced`in e&&e.advanced)}function bX(e){throw Error(`PropPanel: unhandled PropDef type ${JSON.stringify(e)}`)}function xX(e){let t=(0,Z.c)(165),{propDef:n,value:r,onChange:i,onDismiss:a,isAutoFocused:o}=e,s;t[0]===a?s=t[1]:(s=a?e=>{e.key===`Enter`&&(e.preventDefault(),a())}:void 0,t[0]=a,t[1]=s);let c=s;switch(n.type){case`reactnode`:return null;case`string`:{let e=`prop-${n.name}`,s=n.accept,l=s!==void 0&&s.length>0,u=!n.required&&n.defaultValue===void 0;if(n.language){let a=`${e}-label`,s;t[2]===n.name?s=t[3]:(s=XY(n.name),t[2]=n.name,t[3]=s);let c;t[4]!==a||t[5]!==e||t[6]!==s?(c=(0,X.jsx)(`label`,{id:a,htmlFor:e,className:`text-xs text-muted-foreground`,children:s}),t[4]=a,t[5]=e,t[6]=s,t[7]=c):c=t[7];let l=r??``,d;t[8]!==i||t[9]!==u?(d=e=>{if(e===``&&u){i(void 0);return}i(e)},t[8]=i,t[9]=u,t[10]=d):d=t[10];let f;t[11]!==o||t[12]!==a||t[13]!==n.language||t[14]!==e||t[15]!==l||t[16]!==d?(f=(0,X.jsx)(hK,{id:e,ariaLabelledBy:a,value:l,language:n.language,onChange:d,autoFocus:o}),t[11]=o,t[12]=a,t[13]=n.language,t[14]=e,t[15]=l,t[16]=d,t[17]=f):f=t[17];let p;return t[18]!==c||t[19]!==f?(p=(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[c,f]}),t[18]=c,t[19]=f,t[20]=p):p=t[20],p}if(n.iconPicker){let a=r??``,s;t[21]===n.name?s=t[22]:(s=XY(n.name),t[21]=n.name,t[22]=s);let c;t[23]!==e||t[24]!==s?(c=(0,X.jsx)(`label`,{htmlFor:e,className:`text-xs text-muted-foreground`,children:s}),t[23]=e,t[24]=s,t[25]=c):c=t[25];let l;t[26]!==i||t[27]!==u?(l=e=>{if(e===``&&u){i(void 0);return}i(e)},t[26]=i,t[27]=u,t[28]=l):l=t[28];let d;t[29]!==a||t[30]!==o||t[31]!==e||t[32]!==l?(d=(0,X.jsx)(OY,{id:e,value:a,onChange:l,autoFocus:o}),t[29]=a,t[30]=o,t[31]=e,t[32]=l,t[33]=d):d=t[33];let f;return t[34]!==c||t[35]!==d?(f=(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[c,d]}),t[34]=c,t[35]=d,t[36]=f):f=t[36],f}if(n.colorPicker){let a=r??``,s;t[37]===n.name?s=t[38]:(s=XY(n.name),t[37]=n.name,t[38]=s);let c;t[39]!==e||t[40]!==s?(c=(0,X.jsx)(`label`,{htmlFor:e,className:`text-xs text-muted-foreground`,children:s}),t[39]=e,t[40]=s,t[41]=c):c=t[41];let l;t[42]!==i||t[43]!==u?(l=e=>{if(e===``&&u){i(void 0);return}i(e)},t[42]=i,t[43]=u,t[44]=l):l=t[44];let d;t[45]!==a||t[46]!==o||t[47]!==e||t[48]!==l?(d=(0,X.jsx)(DY,{id:e,value:a,onChange:l,autoFocus:o}),t[45]=a,t[46]=o,t[47]=e,t[48]=l,t[49]=d):d=t[49];let f;return t[50]!==c||t[51]!==d?(f=(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[c,d]}),t[50]=c,t[51]=d,t[52]=f):f=t[52],f}if(n.cssLengthInput){let a=r??``,s;if(t[53]!==a){let e=eX(a);s=e.valid?null:tX(e),t[53]=a,t[54]=s}else s=t[54];let l=s,d;t[55]===n.name?d=t[56]:(d=XY(n.name),t[55]=n.name,t[56]=d);let f;t[57]!==e||t[58]!==d?(f=(0,X.jsx)(`label`,{htmlFor:e,className:`text-xs text-muted-foreground`,children:d}),t[57]=e,t[58]=d,t[59]=f):f=t[59];let p;t[60]!==i||t[61]!==u?(p=e=>{let t=e.target.value;if(t===``&&u){i(void 0);return}i(t)},t[60]=i,t[61]=u,t[62]=p):p=t[62];let m=o?``:void 0,h=l===null?void 0:!0,g=l===null?void 0:`${e}-error`,_;t[63]!==a||t[64]!==c||t[65]!==o||t[66]!==e||t[67]!==p||t[68]!==m||t[69]!==h||t[70]!==g?(_=(0,X.jsx)(Ir,{id:e,type:`text`,value:a,placeholder:`100px, 50%, 26rem, auto`,onChange:p,onKeyDown:c,autoFocus:o,"data-prop-autofocus":m,"aria-invalid":h,"aria-describedby":g,className:`h-7 text-sm`,"data-prop-css-length-input":``}),t[63]=a,t[64]=c,t[65]=o,t[66]=e,t[67]=p,t[68]=m,t[69]=h,t[70]=g,t[71]=_):_=t[71];let v;t[72]!==l||t[73]!==e?(v=l!==null&&(0,X.jsx)(`p`,{id:`${e}-error`,"data-prop-css-length-error":``,className:`text-xs text-destructive`,"aria-live":`polite`,children:l}),t[72]=l,t[73]=e,t[74]=v):v=t[74];let y;return t[75]!==v||t[76]!==f||t[77]!==_?(y=(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[f,_,v]}),t[75]=v,t[76]=f,t[77]=_,t[78]=y):y=t[78],y}let d,f,p;if(t[79]!==s||t[80]!==r){let e=s===void 0?void 0:cX(s);d=r??``;let n=e===void 0?null:sX(d,e);f=n!==null&&!n.valid&&e!==void 0&&d.trim().length>0?dX(n,e):null,p=e===void 0?void 0:lX(e),t[79]=s,t[80]=r,t[81]=d,t[82]=f,t[83]=p}else d=t[81],f=t[82],p=t[83];let m=p,h;t[84]===n.name?h=t[85]:(h=XY(n.name),t[84]=n.name,t[85]=h);let g;t[86]!==e||t[87]!==h?(g=(0,X.jsx)(`label`,{htmlFor:e,className:`text-xs text-muted-foreground`,children:h}),t[86]=e,t[87]=h,t[88]=g):g=t[88];let _;t[89]!==s||t[90]!==d||t[91]!==c||t[92]!==o||t[93]!==f||t[94]!==m||t[95]!==i||t[96]!==a||t[97]!==e||t[98]!==u?(_=s===void 0?(0,X.jsx)(Ir,{id:e,type:`text`,value:d,placeholder:m,onChange:e=>{let t=e.target.value;if(t===``&&u){i(void 0);return}i(t)},onKeyDown:c,autoFocus:o,"data-prop-autofocus":o?``:void 0,"aria-invalid":f===null?void 0:!0,"aria-describedby":f===null?void 0:`${e}-error`,className:`h-7 text-sm`}):(0,X.jsx)(VY,{id:e,value:d,onChange:e=>{if(e===``&&u){i(void 0);return}i(e)},onSubmit:a,accept:s,placeholder:m,autoFocus:o,dataPropAutofocus:o?``:void 0,ariaInvalid:f===null?void 0:!0,ariaDescribedBy:f===null?void 0:`${e}-error`,className:`h-7 text-sm`}),t[89]=s,t[90]=d,t[91]=c,t[92]=o,t[93]=f,t[94]=m,t[95]=i,t[96]=a,t[97]=e,t[98]=u,t[99]=_):_=t[99];let v;t[100]!==s||t[101]!==i||t[102]!==l?(v=l&&(0,X.jsx)(CX,{accept:s,onUploaded:e=>i(e)}),t[100]=s,t[101]=i,t[102]=l,t[103]=v):v=t[103];let y;t[104]!==_||t[105]!==v?(y=(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[_,v]}),t[104]=_,t[105]=v,t[106]=y):y=t[106];let b;t[107]!==f||t[108]!==e?(b=f!==null&&(0,X.jsx)(`p`,{id:`${e}-error`,"data-prop-media-error":``,className:`text-xs text-destructive`,"aria-live":`polite`,children:f}),t[107]=f,t[108]=e,t[109]=b):b=t[109];let x;return t[110]!==g||t[111]!==y||t[112]!==b?(x=(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[g,y,b]}),t[110]=g,t[111]=y,t[112]=b,t[113]=x):x=t[113],x}case`boolean`:{let e=`prop-${n.name}`,a;t[114]===n.name?a=t[115]:(a=XY(n.name),t[114]=n.name,t[115]=a);let o=a,s;t[116]!==e||t[117]!==o?(s=(0,X.jsx)(`label`,{htmlFor:e,className:`text-xs text-muted-foreground`,children:o}),t[116]=e,t[117]=o,t[118]=s):s=t[118];let c=!!r,l;t[119]===i?l=t[120]:(l=e=>i(e),t[119]=i,t[120]=l);let u;t[121]!==e||t[122]!==c||t[123]!==l?(u=(0,X.jsx)(TY,{id:e,checked:c,onCheckedChange:l}),t[121]=e,t[122]=c,t[123]=l,t[124]=u):u=t[124];let d;return t[125]!==s||t[126]!==u?(d=(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[s,u]}),t[125]=s,t[126]=u,t[127]=d):d=t[127],d}case`enum`:{let e=`prop-${n.name}`,a=r??n.enumValues[0]??``,o;t[128]===n.name?o=t[129]:(o=XY(n.name),t[128]=n.name,t[129]=o);let s;t[130]!==e||t[131]!==o?(s=(0,X.jsx)(`label`,{htmlFor:e,className:`text-xs text-muted-foreground`,children:o}),t[130]=e,t[131]=o,t[132]=s):s=t[132];let c;t[133]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,X.jsx)(yY,{}),t[133]=c):c=t[133];let l;t[134]===e?l=t[135]:(l=(0,X.jsx)(bY,{id:e,size:`sm`,children:c}),t[134]=e,t[135]=l);let u;t[136]===n.enumValues?u=t[137]:(u=n.enumValues.map(SX),t[136]=n.enumValues,t[137]=u);let d;t[138]===u?d=t[139]:(d=(0,X.jsx)(xY,{className:`z-70`,children:u}),t[138]=u,t[139]=d);let f;t[140]!==a||t[141]!==i||t[142]!==l||t[143]!==d?(f=(0,X.jsxs)(vY,{value:a,onValueChange:i,children:[l,d]}),t[140]=a,t[141]=i,t[142]=l,t[143]=d,t[144]=f):f=t[144];let p;return t[145]!==s||t[146]!==f?(p=(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[s,f]}),t[145]=s,t[146]=f,t[147]=p):p=t[147],p}case`number`:{let e=`prop-${n.name}`,a;t[148]===n.name?a=t[149]:(a=XY(n.name),t[148]=n.name,t[149]=a);let o;t[150]!==e||t[151]!==a?(o=(0,X.jsx)(`label`,{htmlFor:e,className:`text-xs text-muted-foreground`,children:a}),t[150]=e,t[151]=a,t[152]=o):o=t[152];let s=r==null?``:String(r),l;t[153]===i?l=t[154]:(l=e=>{let t=e.target.value;if(t===``){i(void 0);return}if(t===`-`)return;let n=Number(t);Number.isNaN(n)||i(n)},t[153]=i,t[154]=l);let u;t[155]!==c||t[156]!==e||t[157]!==s||t[158]!==l?(u=(0,X.jsx)(Ir,{id:e,type:`number`,inputMode:`numeric`,value:s,onChange:l,onKeyDown:c,className:`h-7 text-sm`}),t[155]=c,t[156]=e,t[157]=s,t[158]=l,t[159]=u):u=t[159];let d;return t[160]!==o||t[161]!==u?(d=(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[o,u]}),t[160]=o,t[161]=u,t[162]=d):d=t[162],d}default:{let e;return t[163]===n?e=t[164]:(e=bX(n),t[163]=n,t[164]=e),e}}}function SX(e){return(0,X.jsx)(SY,{value:e,children:e},e)}function CX(e){let t=(0,Z.c)(17),{accept:n,onUploaded:r}=e,[i,a]=(0,Q.useState)(!1),s=(0,Q.useRef)(null),c;t[0]===n?c=t[1]:(c=n.join(`,`),t[0]=n,t[1]=c);let l;t[2]!==n||t[3]!==r?(l=async e=>{let t=e.target.files?.[0];if(t){a(!0);try{await gX(t,n,r)}catch{}a(!1),s.current&&(s.current.value=``)}},t[2]=n,t[3]=r,t[4]=l):l=t[4];let u;t[5]!==c||t[6]!==l?(u=(0,X.jsx)(`input`,{ref:s,type:`file`,accept:c,className:`hidden`,"data-prop-upload-input":``,onChange:l}),t[5]=c,t[6]=l,t[7]=u):u=t[7];let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>s.current?.click(),t[8]=d):d=t[8];let f;t[9]===i?f=t[10]:(f=i?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(zn,{className:`size-3.5 animate-spin`,"aria-hidden":`true`}),(0,X.jsx)(o,{id:`_eguJc`})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(za,{className:`size-3.5`,"aria-hidden":`true`}),(0,X.jsx)(o,{id:`eJitUk`})]}),t[9]=i,t[10]=f);let p;t[11]!==f||t[12]!==i?(p=(0,X.jsx)(en,{type:`button`,variant:`outline`,size:`sm`,disabled:i,"data-prop-upload-trigger":``,className:`h-7 w-full justify-center gap-1.5 px-2 text-xs`,onClick:d,children:f}),t[11]=f,t[12]=i,t[13]=p):p=t[13];let m;return t[14]!==u||t[15]!==p?(m=(0,X.jsxs)(X.Fragment,{children:[u,p]}),t[14]=u,t[15]=p,t[16]=m):m=t[16],m}var wX=new Set([`img`,`CommonMarkImage`,`video`,`audio`,`Pdf`,`File`]);function TX(e,t,n){if(!wX.has(e)||!n)return t;let r=t.src;if(typeof r!=`string`)return t;let i=Ve(r,n);return i===r?t:{...t,src:i}}var EX=`selectionStatePlugin/origin`,DX=`selectionStatePlugin/refresh`,OX=new q(`selectionState`),kX=new Set,AX={selectedBlockId:null,ancestorChain:[],selectionOrigin:`programmatic`,isDragging:!1,rangeEncompassedBlockIds:kX};function jX(e){return OX.getState(e.state)??AX}function MX(e,t){let n=[],{$from:r}=t;for(let t=1;t<=r.depth;t++){let i=r.node(t);if(i.type.name!==`jsxComponent`)continue;let a=r.before(t);n.push(NX(e,i,a))}if(t instanceof Nt){let r=t.node;r.type.name===`jsxComponent`&&n.push(NX(e,r,t.from))}return n}function NX(e,t,n){let r=t.attrs.componentName??`unknown`;return{bridgeId:PX(e,n),componentName:r,pos:n}}function PX(e,t){return iN.getState(e)?.posToId.get(t)??`pos-${t}`}function FX(e,t){if(t instanceof Nt)return kX;let{from:n,to:r}=t;if(n>=r)return kX;let i=iN.getState(e)?.posToId;if(!i)return kX;let a=null;for(let[t,o]of i){if(t<n)continue;let i=e.doc.nodeAt(t);i&&(t+i.nodeSize>r||(a||=new Set,a.add(o)))}return a??kX}function IX(e,t,n={}){let r=MX(e,e.selection),i=r[r.length-1],a=FX(e,e.selection),o={selectedBlockId:i?.bridgeId??null,ancestorChain:r,selectionOrigin:n.origin??t.selectionOrigin,isDragging:n.isDragging??t.isDragging,rangeEncompassedBlockIds:a};return LX(t,o)?t:o}function LX(e,t){if(e===t)return!0;if(e.selectedBlockId!==t.selectedBlockId||e.selectionOrigin!==t.selectionOrigin||e.isDragging!==t.isDragging||e.ancestorChain.length!==t.ancestorChain.length)return!1;for(let n=0;n<e.ancestorChain.length;n++){let r=e.ancestorChain[n],i=t.ancestorChain[n];if(r.bridgeId!==i.bridgeId||r.componentName!==i.componentName||r.pos!==i.pos)return!1}if(e.rangeEncompassedBlockIds.size!==t.rangeEncompassedBlockIds.size)return!1;for(let n of e.rangeEncompassedBlockIds)if(!t.rangeEncompassedBlockIds.has(n))return!1;return!0}var RX=new WeakMap;function zX(e,t,n,r){let i=r?.isDragging??t.isDragging,a=!!e.getMeta(DX),o=e.selectionSet&&!a,s=e.getMeta(EX),c=o?r?.pendingOrigin??null:null,l=s??c??t.selectionOrigin;return o&&r&&(r.pendingOrigin=null),IX(n,t,{origin:l,isDragging:i})}var BX=F.create({name:`selectionStatePlugin`,addProseMirrorPlugins(){let e=this.editor,t=new Ht({key:OX,state:{init(e,t){return IX(t,AX)},apply(e,n,r,i){return zX(e,n,i,RX.get(t))}},props:{handleDOMEvents:{mousedown:()=>{let e=RX.get(t);return e&&(e.pendingOrigin=`pointer`),!1},pointerdown:()=>{let e=RX.get(t);return e&&(e.pendingOrigin=`pointer`),!1}},handleKeyDown:(e,n)=>{if(VX(n.key)){let e=RX.get(t);e&&(e.pendingOrigin=`keyboard`)}return!1}},view(n){RX.set(t,{pendingOrigin:null,isDragging:!1});let r=n.dom.parentElement??n.dom,i=()=>{let n=RX.get(t);n&&(n.isDragging=!0,HX(e))},a=()=>{let n=RX.get(t);n&&(n.isDragging=!1,HX(e))};return r.addEventListener(`dragstart`,i,!0),r.addEventListener(`dragend`,a,!0),r.addEventListener(`drop`,a,!0),{destroy:()=>{r.removeEventListener(`dragstart`,i,!0),r.removeEventListener(`dragend`,a,!0),r.removeEventListener(`drop`,a,!0),RX.delete(t)}}}});return[t]}});function VX(e){return e===`ArrowUp`||e===`ArrowDown`||e===`ArrowLeft`||e===`ArrowRight`||e===`Tab`||e===`Escape`||e===`Enter`||e===`Home`||e===`End`||e===`PageUp`||e===`PageDown`}function HX(e){queueMicrotask(()=>{if(!e.isDestroyed)try{let t=e.state.tr.setMeta(DX,!0);e.view.dispatch(t)}catch{}})}function UX(e){let t=(0,Z.c)(5),n;t[0]===e?n=t[1]:(n=()=>e?jX(e):null,t[0]=e,t[1]=n);let[r,i]=(0,Q.useState)(n),a,o;return t[2]===e?(a=t[3],o=t[4]):(a=()=>{if(!e){i(null);return}i(jX(e));let t=()=>{i(jX(e))};return e.on(`transaction`,t),e.on(`selectionUpdate`,t),()=>{e.off(`transaction`,t),e.off(`selectionUpdate`,t)}},o=[e],t[2]=e,t[3]=a,t[4]=o),(0,Q.useEffect)(a,o),r}function WX(e,t){if(e.hasChildren)return!1;let n=YY(e.props);return n===null?!1:t[n]===``}function GX(e){let t=e.placeholder?.label,n=`Add ${(e.displayName??e.name).toLowerCase()}`;return{label:t??n,Icon:hk(e.placeholder?.icon??e.icon)}}var KX=new Set([`img`,`CommonMarkImage`,`Embed`,`video`]);function qX(e){if(!e.attrs.sourceDirty&&e.attrs.sourceRaw)return e.attrs.sourceRaw;let t=jA(),n=e.type.schema.node(`doc`,null,[e]);return t.serialize(n.toJSON()).trim()}var JX=new Set($e.map(e=>`${e}:`)),YX=6e4,XX=10,ZX=new Map;function QX(e,t){let n=t.toLowerCase();O(n);let r=Date.now(),i=ZX.get(n);if(!i||r-i.windowStart>=YX)ZX.set(n,{windowStart:r,count:1});else if(i.count+=1,i.count>XX)return;typeof console<`u`&&typeof console.warn==`function`&&console.warn(JSON.stringify({event:`jsx-prop-dropped`,reason:e,prop:t}))}var $X=new Set([`href`,`src`,`action`,`formaction`,`poster`,`cite`,`data`,`manifest`,`background`,`ping`,`xlinkhref`,`xlinkactuate`,`xlinkrole`,`xlinkarcrole`,`xlinkshow`,`url`,`link`]),eZ=new Set([`dangerouslysetinnerhtml`,`ref`,`key`,`defaultvalue`,`defaultchecked`,`__proto__`,`constructor`,`prototype`]),tZ=1e4;function nZ(e){let t=e.toLowerCase();return!!(eZ.has(t)||t.length>=3&&t.startsWith(`on`))}function rZ(e){return $X.has(e.toLowerCase())}function iZ(e){if(typeof e!=`string`)return e;let t=e.trim();if(!t||t.startsWith(`#`)||t.startsWith(`//`)||We(t))return e;let n=t.indexOf(`:`),r=t.slice(0,n+1).toLowerCase();return JX.has(r)?e:`#`}function aZ(e){if(e.length>tZ)return``;let t=e.toLowerCase();return/url\s*\(\s*['"]?\s*(?:javascript|vbscript|data)\s*:/.test(t)||/\bexpression\s*\(/.test(t)?``:e}function oZ(e){if(e==null)return e;if(Array.isArray(e)){let t=!1,n=Array(e.length);for(let r=0;r<e.length;r++){let i=oZ(e[r]);n[r]=i,i!==e[r]&&(t=!0)}return t?n:e}if(typeof e!=`object`)return e;let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)return e;let n=e,r=!1,i={};for(let[e,t]of Object.entries(n)){if(nZ(e)){QX(`dangerous-prop-name-nested`,e),r=!0;continue}if(rZ(e)&&typeof t==`string`){let n=iZ(t);n!==t&&(r=!0),i[e]=n}else{let n=oZ(t);n!==t&&(r=!0),i[e]=n}}return r?i:e}function sZ(e){let t=!1,n={};for(let[r,i]of Object.entries(e)){if(nZ(r)){QX(`dangerous-prop-name`,r),t=!0;continue}if(rZ(r)){let e=iZ(i);e!==i&&(t=!0),n[r]=e;continue}if(r===`style`){if(typeof i==`string`){let e=aZ(i);e!==i&&(t=!0),n[r]=e}else t=!0;continue}let e=oZ(i);e!==i&&(t=!0),n[r]=e}return t?n:e}function cZ(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,X.jsx)(`div`,{className:`jsx-component-error-fallback`,children:n}),t[0]=n,t[1]=r),r}function lZ(e){let t=(0,Z.c)(13),{children:n,resetKey:r,onError:i,descriptorName:a,rawComponentName:o}=e,s;t[0]===r?s=t[1]:(s=[r],t[0]=r,t[1]=s);let c;t[2]!==a||t[3]!==i||t[4]!==o?(c=(e,t)=>{let n=e instanceof Error?e:Error(String(e));console.warn(JSON.stringify({event:`jsx-render-failure`,component:a,rawComponentName:String(o??``).slice(0,200),error:String(n),stack:t.componentStack})),fe(a),i(n)},t[2]=a,t[3]=i,t[4]=o,t[5]=c):c=t[5];let l;t[6]===n?l=t[7]:(l=e=>(0,X.jsx)(cZ,{...e,children:n}),t[6]=n,t[7]=l);let u;return t[8]!==n||t[9]!==s||t[10]!==c||t[11]!==l?(u=(0,X.jsx)(mY,{resetKeys:s,onError:c,fallbackRender:l,children:n}),t[8]=n,t[9]=s,t[10]=c,t[11]=l,t[12]=u):u=t[12],u}function uZ(e){if(typeof e!=`object`||!e)return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(uZ).join(`,`)}]`;let t=Object.entries(e);return t.sort(([e],[t])=>e<t?-1:+(e>t)),`{${t.map(([e,t])=>`${JSON.stringify(e)}:${uZ(t)}`).join(`,`)}}`}function dZ(e,t){let n=e.props??{},r={};for(let[e,i]of Object.entries(n))t.has(e)||(r[e]=i);return sZ(r)}function fZ(e){return e.kind===`element`?e:null}var pZ=3;function mZ(e){let t=(0,Z.c)(162),{node:n,editor:r,extension:i,getPos:a,selected:c}=e,{_:l}=s(),u=kM(n.attrs.componentName),[d,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(!1),_=(0,Q.useRef)(!1),v=typeof a==`function`?a():void 0,y=!1,b=0,x=1;try{if(v!==void 0){let e=r.state.doc.resolve(v);e.depth>0&&e.parent.type.name===`jsxComponent`&&(y=!0,b=e.index(e.depth),x=e.parent.childCount)}}catch(e){let t=e;if(!(t instanceof RangeError))throw t}let S=y&&b>0,C=y&&b<x-1,w=UX(r),T=typeof v==`number`?PX(r.state,v):null,D=T!==null&&(w?.rangeEncompassedBlockIds.has(T)??!1),O;t[0]===w?.ancestorChain?O=t[1]:(O=w?.ancestorChain.at(-1)?.bridgeId??null,t[0]=w?.ancestorChain,t[1]=O);let k=T!==null&&O===T,A=c&&!D&&k,j=T!==null&&!k&&(w?.ancestorChain.some(e=>e.bridgeId===T)??!1),M=A&&w?w.selectionOrigin:void 0,N=A&&(w?.isDragging??!1),P=u.props.some(bZ),F=n.attrs.props??{},I=P&&u.props.some(e=>e.type!==`string`||!e.required||`hidden`in e&&e.hidden?!1:!Object.hasOwn(F,e.name)),L=WX(u,F),z=L?GX(u):null,B=!u.hasChildren||!!u.isSelfClosing,V=KX.has(u.name),H=u.name===`MermaidFence`?{propName:`chart`,language:`mermaid`}:u.name===`Math`||u.name===`DollarMath`||u.name===`MathFence`?{propName:`formula`,language:`latex`}:null,[ee,U]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{c&&!_.current&&P&&RM(v)&&g(!0),_.current=c},[c,P,v]);let W=dZ(n.attrs,u.reactNodePropNames),te=u.surface===`compat`?u.translateProps(W):W,G=i.options.docName,ne=typeof G==`string`&&G?G:vO(r),re=TX(u.name,te,ne),ie=`${u.name}::${uZ(W)}`,oe;t[2]!==a||t[3]!==n.content.size?(oe=()=>(typeof a==`function`?a()??0:0)+1+n.content.size,t[2]=a,t[3]=n.content.size,t[4]=oe):oe=t[4];let se=oe,K=u.name===`*`||d!==null,ce=(0,Q.useRef)(!1),le=(0,Q.useRef)(0),[ue,de]=(0,Q.useState)(!1);if((0,Q.useEffect)(()=>{if(!K||ce.current||ue)return;let e=typeof a==`function`?a():void 0;if(typeof e!=`number`)return;let t=qX(n),i=u.name===`*`?`Unregistered component: ${n.attrs.componentName}`:`Render error in <${u.displayName??u.name}>: ${d?.message??`unknown`}`,o=n.type.schema.nodes.rawMdxFallback.create({reason:i},n.type.schema.text(t)),s=!1,c,l=()=>{if(!s)try{r.view.dispatch(r.state.tr.replaceWith(e,e+n.nodeSize,o)),ce.current=!0,ae(u.name===`*`?`wildcard`:u.name)}catch(e){let t=e,r=u.name===`*`?`wildcard`:u.name;if(console.warn(JSON.stringify({event:`jsx-component-auto-convert-failed`,component:r,rawComponentName:String(n.attrs.componentName??``).slice(0,200),reason:t instanceof Error?t.message.slice(0,500):String(t).slice(0,500),retry:le.current})),R(r),le.current+=1,le.current<pZ){let e=50*(2**le.current-1);c=setTimeout(()=>{s||l()},e)}else s||de(!0)}},f=requestAnimationFrame(l);return()=>{s=!0,cancelAnimationFrame(f),c!==void 0&&clearTimeout(c)}},[K,n,r,a,u,d,ue]),ue){let e=n.attrs.componentName,i=u.displayName??u.name,o=u.name===`*`?l({id:`Kh1n4a`,values:{componentName:e}}):l({id:`g58Kwy`,values:{descriptorLabel:i}}),s=()=>{try{let e=qX(n);typeof navigator<`u`&&navigator.clipboard?.writeText&&navigator.clipboard.writeText(e)}catch(e){let t=e;ve(u.name),console.warn(JSON.stringify({event:`jsx-component-stuck-copy-failed`,component:u.name,rawComponentName:String(n.attrs.componentName??``).slice(0,200),reason:t instanceof Error?t.message.slice(0,500):String(t).slice(0,500)}))}},c=()=>{let e=typeof a==`function`?a():void 0;if(typeof e==`number`)try{r.chain().focus().setNodeSelection(e).deleteSelection().run()}catch(e){let t=e;if(!(t instanceof RangeError))throw t;E(u.name),console.warn(JSON.stringify({event:`jsx-component-stuck-delete-failed`,component:u.name,rawComponentName:String(n.attrs.componentName??``).slice(0,200),reason:t.message.slice(0,500)}))}},d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d={[MF]:`true`},t[5]=d):d=t[5];let f;t[6]===o?f=t[7]:(f=(0,X.jsx)(`span`,{className:`flex-1`,children:o}),t[6]=o,t[7]=f);let p;t[8]===l?p=t[9]:(p=l({id:`E2Mv-X`}),t[8]=l,t[9]=p);let m;t[10]!==s||t[11]!==p?(m=(0,X.jsx)(`button`,{type:`button`,className:`text-xs underline hover:no-underline`,onClick:s,children:p}),t[10]=s,t[11]=p,t[12]=m):m=t[12];let h;t[13]===l?h=t[14]:(h=l({id:`cnGeoo`}),t[13]=l,t[14]=h);let g;t[15]!==c||t[16]!==h?(g=(0,X.jsx)(`button`,{type:`button`,className:`text-xs underline hover:no-underline`,onClick:c,children:h}),t[15]=c,t[16]=h,t[17]=g):g=t[17];let _;t[18]!==m||t[19]!==g||t[20]!==f?(_=(0,X.jsxs)(`div`,{className:`text-xs font-mono text-muted-foreground px-2 py-2 border border-destructive/40 rounded bg-destructive/5 flex items-center gap-2`,contentEditable:!1,...d,children:[f,m,g]}),t[18]=m,t[19]=g,t[20]=f,t[21]=_):_=t[21];let v;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,X.jsx)(ql,{className:`component-children`}),t[22]=v):v=t[22];let y;return t[23]===_?y=t[24]:(y=(0,X.jsxs)(Jl,{className:`jsx-component-wrapper my-2`,children:[_,v]}),t[23]=_,t[24]=y),y}if(K){let e=n.attrs.componentName,r=u.displayName??u.name,i=u.name===`*`?l({id:`oJl7eO`,values:{componentName:e}}):l({id:`bcDHUM`,values:{descriptorLabel:r}}),a;t[25]===i?a=t[26]:(a=(0,X.jsx)(`div`,{className:`text-xs font-mono text-muted-foreground px-2 py-1`,contentEditable:!1,children:i}),t[25]=i,t[26]=a);let o;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,X.jsx)(ql,{className:`component-children`}),t[27]=o):o=t[27];let s;return t[28]===a?s=t[29]:(s=(0,X.jsxs)(Jl,{className:`jsx-component-wrapper my-2`,children:[a,o]}),t[28]=a,t[29]=s),s}let fe=u.Component,pe=u.displayName??u.name,me=u.displayName??u.name,ge=u.displayName??u.name,_e=e=>{if(L||!B)return;let t=e.target;if(!e.currentTarget.contains(t)||t.closest(`.jsx-component-chrome`)||t.closest(`.jsx-add-child-pill, .jsx-empty-child-placeholder`)||t.closest(`a[href]`)||typeof v!=`number`)return;let n=r.state.doc.nodeAt(v);if(!n)return;let i=v+n.nodeSize,a=r.state.selection.from;a<v||a>=i||r.chain().focus().setNodeSelection(v).run()},ye;t[30]!==r||t[31]!==a||t[32]!==g?(ye=()=>{let e=typeof a==`function`?a():void 0;typeof e==`number`&&(r.chain().focus().setNodeSelection(e).run(),g(!0))},t[30]=r,t[31]=a,t[32]=g,t[33]=ye):ye=t[33];let be=ye,xe=u.displayName??u.name,Se=!!u.emptyChildName,Ce=Se?JY(xe,u.emptyChildName,n.childCount):void 0,we=e=>{let t=e.target;if(e.key===`Backspace`||e.key===`Delete`){if(!A||!e.currentTarget.contains(t)||t.matches(`input, textarea`))return;let i=typeof a==`function`?a():void 0;if(typeof i!=`number`)return;e.preventDefault();try{r.chain().focus().setNodeSelection(i).deleteSelection().run()||(Kt(u.name),console.warn(JSON.stringify({event:`jsx-component-keyboard-delete-failed`,component:u.name,rawComponentName:String(n.attrs.componentName??``).slice(0,200),reason:`chain-dispatch-returned-false`})))}catch(e){let t=e;if(!(t instanceof RangeError))throw t;Kt(u.name),console.warn(JSON.stringify({event:`jsx-component-keyboard-delete-failed`,component:u.name,rawComponentName:String(n.attrs.componentName??``).slice(0,200),reason:t.message.slice(0,500)}))}return}e.key!==`Enter`&&e.key!==` `||c&&P&&(t.closest(`.jsx-component-chrome`)||t.closest(`input, textarea, select, button`)||(e.preventDefault(),g(!0)))},Te=e=>{g(e),!e&&requestAnimationFrame(()=>{let e=typeof a==`function`?a():void 0;if(typeof e==`number`)try{let t=r.state.doc.nodeAt(e);if(!t)return;let n=e+t.nodeSize,i=r.state.selection.from;if(i<e||i>=n)return;if(B){let e=r.state.doc.resolve(Math.min(n,r.state.doc.content.size)),t=p.near(e,1);r.view.dispatch(r.state.tr.setSelection(t).scrollIntoView())}else r.chain().setNodeSelection(e).run()}catch(e){let t=e;if(!(t instanceof RangeError))throw t;he(u.name),console.warn(JSON.stringify({event:`jsx-component-popover-close-restore-failed`,component:u.name,rawComponentName:String(n.attrs.componentName??``).slice(0,200),reason:t.message.slice(0,500)}))}})},Ee=hc,De=Jl,Oe;t[34]===u.name?Oe=t[35]:(Oe=u.name.toLowerCase(),t[34]=u.name,t[35]=Oe);let ke;bb0:{let e=F.align;if(e===`left`||e===`right`||e===`center`){ke=e;break bb0}if(V){ke=`center`;break bb0}ke=void 0}let Ae=A?`true`:void 0,je=j?`true`:void 0,Me=D?`true`:void 0,Ne=N?`true`:void 0,Pe=I?`true`:void 0,q=Se?`group`:void 0,Fe=A?0:-1,Ie;t[36]===y?Ie=t[37]:(Ie=y?{draggable:`false`,onDragStart:yZ}:{"data-drag-handle":``,draggable:`true`},t[36]=y,t[37]=Ie);let Le=u.name,Re=vZ,ze;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(ze={[MF]:`true`},t[38]=ze):ze=t[38];let Be=u.name===`Embed`&&typeof W.src==`string`&&/^https?:\/\//i.test(W.src)&&(0,X.jsx)(`a`,{href:W.src,target:`_blank`,rel:`noopener noreferrer`,className:`jsx-chrome-btn`,"aria-label":l({id:`iOHg1t`}),onMouseDown:_Z,children:(0,X.jsx)(Zi,{size:12,"aria-hidden":`true`})}),Ve=u.name===`Mirror`&&typeof W.src==`string`&&W.src.length>0&&(()=>{let e=W.src;return(0,X.jsx)(`a`,{href:Dn(e,typeof W.anchor==`string`&&W.anchor.length>0?W.anchor:null),className:`jsx-chrome-btn`,"aria-label":l({id:`3a_Bd7`,values:{mirrorSrc:e}}),title:l({id:`0kTAXe`,values:{mirrorSrc:e}}),onMouseDown:gZ,children:(0,X.jsx)(Zi,{size:12,"aria-hidden":`true`})})})(),He;t[39]!==l||t[40]!==S||t[41]!==u.name||t[42]!==r||t[43]!==n.attrs.componentName||t[44]!==n.nodeSize||t[45]!==v?(He=S&&(0,X.jsx)(`button`,{type:`button`,className:`jsx-chrome-btn`,"aria-label":l({id:`QyioBP`}),onClick:()=>{try{if(typeof v!=`number`)return;let e=r.state.doc.resolve(v),t=e.index(e.depth);if(t===0)return;let i=v-e.node(e.depth).child(t-1).nodeSize,a=v+n.nodeSize,o=r.state.tr,s=r.state.doc.slice(v,v+n.nodeSize),c=r.state.doc.slice(i,v);o.replaceWith(i,a,s.content.append(c.content)),r.view.dispatch(o.scrollIntoView())}catch(e){let t=e;if(!(t instanceof RangeError))throw t;f(`up`),console.warn(JSON.stringify({event:`jsx-component-move-failed`,direction:`up`,component:u.name,rawComponentName:String(n.attrs.componentName??``).slice(0,200),reason:t.message.slice(0,500)}))}},children:(0,X.jsx)(Ri,{size:12,"aria-hidden":`true`})}),t[39]=l,t[40]=S,t[41]=u.name,t[42]=r,t[43]=n.attrs.componentName,t[44]=n.nodeSize,t[45]=v,t[46]=He):He=t[46];let Ue;t[47]!==l||t[48]!==C||t[49]!==u.name||t[50]!==r||t[51]!==n.attrs.componentName||t[52]!==n.nodeSize||t[53]!==v?(Ue=C&&(0,X.jsx)(`button`,{type:`button`,className:`jsx-chrome-btn`,"aria-label":l({id:`3Ib6FN`}),onClick:()=>{try{if(typeof v!=`number`)return;let e=r.state.doc.resolve(v),t=e.index(e.depth),i=e.node(e.depth);if(t>=i.childCount-1)return;let a=i.child(t+1),o=v,s=v+n.nodeSize+a.nodeSize,c=r.state.tr,l=r.state.doc.slice(v,v+n.nodeSize),u=r.state.doc.slice(v+n.nodeSize,s);c.replaceWith(o,s,u.content.append(l.content)),r.view.dispatch(c.scrollIntoView())}catch(e){let t=e;if(!(t instanceof RangeError))throw t;f(`down`),console.warn(JSON.stringify({event:`jsx-component-move-failed`,direction:`down`,component:u.name,rawComponentName:String(n.attrs.componentName??``).slice(0,200),reason:t.message.slice(0,500)}))}},children:(0,X.jsx)(Li,{size:12,"aria-hidden":`true`})}),t[47]=l,t[48]=C,t[49]=u.name,t[50]=r,t[51]=n.attrs.componentName,t[52]=n.nodeSize,t[53]=v,t[54]=Ue):Ue=t[54];let We;t[55]!==l||t[56]!==u.displayName||t[57]!==u.name||t[58]!==H||t[59]!==v||t[60]!==U?(We=H&&typeof v==`number`?(0,X.jsx)(`button`,{type:`button`,className:`jsx-chrome-btn`,"aria-label":l({id:`ky9Tuc`,values:{0:u.displayName??u.name}}),"data-testid":`jsx-component-edit-btn`,onClick:()=>U(!0),children:(0,X.jsx)(qn,{size:12,"aria-hidden":`true`})}):null,t[55]=l,t[56]=u.displayName,t[57]=u.name,t[58]=H,t[59]=v,t[60]=U,t[61]=We):We=t[61];let Ge;t[62]!==l||t[63]!==pe?(Ge=l({id:`MCjC9A`,values:{deleteDescriptorLabel:pe}}),t[62]=l,t[63]=pe,t[64]=Ge):Ge=t[64];let Ke;t[65]!==u.name||t[66]!==r||t[67]!==n.attrs.componentName||t[68]!==v?(Ke=()=>{if(typeof v==`number`)try{r.chain().focus().setNodeSelection(v).deleteSelection().run()||(Kt(u.name),console.warn(JSON.stringify({event:`jsx-component-chrome-delete-failed`,component:u.name,rawComponentName:String(n.attrs.componentName??``).slice(0,200),reason:`chain-dispatch-returned-false`})))}catch(e){let t=e;if(!(t instanceof RangeError))throw t;Kt(u.name),console.warn(JSON.stringify({event:`jsx-component-chrome-delete-failed`,component:u.name,rawComponentName:String(n.attrs.componentName??``).slice(0,200),reason:t.message.slice(0,500)}))}},t[65]=u.name,t[66]=r,t[67]=n.attrs.componentName,t[68]=v,t[69]=Ke):Ke=t[69];let qe;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(qe=(0,X.jsx)(Hn,{size:12,"aria-hidden":`true`}),t[70]=qe):qe=t[70];let Je;t[71]!==Ge||t[72]!==Ke?(Je=(0,X.jsx)(`button`,{type:`button`,className:`jsx-chrome-btn jsx-chrome-btn--delete`,"aria-label":Ge,onClick:Ke,children:qe}),t[71]=Ge,t[72]=Ke,t[73]=Je):Je=t[73];let Ye;t[74]!==l||t[75]!==P||t[76]!==me?(Ye=P&&(0,X.jsx)(gc,{asChild:!0,children:(0,X.jsx)(`button`,{type:`button`,className:`jsx-chrome-btn`,"data-jsx-gear":``,"aria-label":l({id:`XPJ0sN`,values:{settingsDescriptorLabel:me}}),children:(0,X.jsx)(ja,{size:12,"aria-hidden":`true`})})}),t[74]=l,t[75]=P,t[76]=me,t[77]=Ye):Ye=t[77];let Xe;t[78]!==Re||t[79]!==ze||t[80]!==Be||t[81]!==Ve||t[82]!==He||t[83]!==Ue||t[84]!==We||t[85]!==Je||t[86]!==Ye?(Xe=(0,X.jsxs)(`div`,{className:`jsx-component-chrome`,contentEditable:!1,onMouseDown:Re,...ze,children:[Be,Ve,He,Ue,We,Je,Ye]}),t[78]=Re,t[79]=ze,t[80]=Be,t[81]=Ve,t[82]=He,t[83]=Ue,t[84]=We,t[85]=Je,t[86]=Ye,t[87]=Xe):Xe=t[87];let Ze;t[88]!==fe||t[89]!==u.emptyChildName||t[90]!==u.hasChildren||t[91]!==u.isSelfClosing||t[92]!==u.name||t[93]!==r||t[94]!==a||t[95]!==se||t[96]!==A||t[97]!==n.attrs.componentName||t[98]!==n.childCount||t[99]!==be||t[100]!==re||t[101]!==ie||t[102]!==z||t[103]!==m||t[104]!==L?(Ze=L&&z?(0,X.jsx)(vc,{asChild:!0,children:(0,X.jsx)(gY,{label:z.label,Icon:z.Icon,onClick:be,selected:A})}):(0,X.jsx)(lZ,{resetKey:ie,onError:m,descriptorName:u.name===`*`?`wildcard`:u.name,rawComponentName:n.attrs.componentName??``,children:(0,X.jsx)(Ok,{value:typeof a==`function`?{editor:r,getPos:()=>{let e=a();return typeof e==`number`?e:void 0},addChild:u.emptyChildName?()=>{let e=u.emptyChildName,t=FM(e),n=se();r.chain().focus().insertContentAt(n,t).run(),zM(r,n,kM(e))}:null}:null,children:(0,X.jsx)(fe,{...re,children:(0,X.jsx)(ql,{className:`component-children ${!u.hasChildren&&n.childCount===0?`min-h-0 m-0 p-0`:``}`,...!u.hasChildren||u.isSelfClosing?{contentEditable:!1}:{}})})})}),t[88]=fe,t[89]=u.emptyChildName,t[90]=u.hasChildren,t[91]=u.isSelfClosing,t[92]=u.name,t[93]=r,t[94]=a,t[95]=se,t[96]=A,t[97]=n.attrs.componentName,t[98]=n.childCount,t[99]=be,t[100]=re,t[101]=ie,t[102]=z,t[103]=m,t[104]=L,t[105]=Ze):Ze=t[105];let Qe;t[106]!==u.emptyChildName||t[107]!==u.name||t[108]!==r||t[109]!==se||t[110]!==n.childCount?(Qe=u.emptyChildName&&!(u.name===`Tabs`&&n.childCount>0)&&(()=>{let e=u.emptyChildName;return(0,X.jsx)(`button`,{type:`button`,contentEditable:!1,className:n.childCount===0?`jsx-empty-child-placeholder`:`jsx-add-child-pill`,onMouseDown:hZ,onClick:()=>{let e=u.emptyChildName,t=FM(e),n=se();r.chain().focus().insertContentAt(n,t).run(),zM(r,n,kM(e))},"data-clipboard-omit":`true`,children:(0,X.jsx)(`span`,{children:(0,X.jsx)(o,{id:`7Fkcej`,values:{addChildName:e}})})})})(),t[106]=u.emptyChildName,t[107]=u.name,t[108]=r,t[109]=se,t[110]=n.childCount,t[111]=Qe):Qe=t[111];let $e;t[112]!==De||t[113]!==u.name||t[114]!==Ce||t[115]!==_e||t[116]!==we||t[117]!==M||t[118]!==Oe||t[119]!==ke||t[120]!==Ae||t[121]!==je||t[122]!==Me||t[123]!==Ne||t[124]!==Pe||t[125]!==q||t[126]!==Fe||t[127]!==Ie||t[128]!==Xe||t[129]!==Ze||t[130]!==Qe?($e=(0,X.jsxs)(De,{className:`jsx-component-wrapper my-2`,"data-jsx-component":``,"data-component-type":Oe,"data-align":ke,"data-selected":Ae,"data-has-child-selected":je,"data-range-selected":Me,"data-selection-origin":M,"data-dragging":Ne,"data-needs-config":Pe,role:q,"aria-label":Ce,tabIndex:Fe,...Ie,"data-component-name":Le,onClick:_e,onKeyDown:we,children:[Xe,Ze,Qe]}),t[112]=De,t[113]=u.name,t[114]=Ce,t[115]=_e,t[116]=we,t[117]=M,t[118]=Oe,t[119]=ke,t[120]=Ae,t[121]=je,t[122]=Me,t[123]=Ne,t[124]=Pe,t[125]=q,t[126]=Fe,t[127]=Ie,t[128]=Xe,t[129]=Ze,t[130]=Qe,t[131]=$e):$e=t[131];let et;t[132]!==l||t[133]!==F||t[134]!==u.Component||t[135]!==u.displayName||t[136]!==u.name||t[137]!==ee||t[138]!==H||t[139]!==r||t[140]!==a||t[141]!==v||t[142]!==re||t[143]!==U?(et=H&&typeof v==`number`?(0,X.jsx)(_K,{open:ee,onOpenChange:U,initialValue:typeof F[H.propName]==`string`?F[H.propName]:``,language:H.language,title:l({id:`ky9Tuc`,values:{0:u.displayName??u.name}}),renderPreview:e=>{let t=u.Component;return(0,X.jsx)(`div`,{className:`flex h-full w-full items-center justify-center p-4`,children:(0,X.jsx)(t,{...re,[H.propName]:e})})},onSave:e=>{let t=typeof a==`function`?a():void 0;if(typeof t!=`number`)return;let n=r.state.doc.nodeAt(t);if(!n)return;let i=fZ(n.attrs);if(i)try{let n={...i.props,[H.propName]:e},a={...i,props:n,sourceDirty:!0};r.view.dispatch(r.state.tr.setNodeMarkup(t,null,a))}catch(e){let t=e;if(!(t instanceof RangeError))throw t;console.warn(`[JsxComponentView] edit-save failed — position race`,t)}}}):null,t[132]=l,t[133]=F,t[134]=u.Component,t[135]=u.displayName,t[136]=u.name,t[137]=ee,t[138]=H,t[139]=r,t[140]=a,t[141]=v,t[142]=re,t[143]=U,t[144]=et):et=t[144];let tt;t[145]!==u||t[146]!==r||t[147]!==a||t[148]!==P||t[149]!==B||t[150]!==W||t[151]!==ge||t[152]!==g||t[153]!==L?(tt=P&&(0,X.jsxs)(_c,{side:L?`bottom`:`right`,align:L?`center`:`start`,sideOffset:L?-4:8,className:`w-64 p-3 z-[60] overflow-y-auto subtle-scrollbar max-h-[var(--radix-popper-available-height)] overscroll-contain`,onCloseAutoFocus:B?e=>{e.preventDefault(),r.view.focus()}:void 0,children:[(0,X.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground mb-2`,children:(0,X.jsx)(o,{id:`Mnavhe`,values:{propPanelDescriptorLabel:ge}})}),(0,X.jsx)(_X,{descriptor:u,values:W,onDismiss:()=>g(!1),onChange:(e,t)=>{let n=typeof a==`function`?a():void 0;if(typeof n!=`number`)return;let i=r.state.doc.nodeAt(n);if(!i)return;let o=fZ(i.attrs);if(!o)return;let s={...o.props},c=Array.isArray(i.attrs.attributes)?i.attrs.attributes:[],l=c;t===void 0?(delete s[e],l=c.filter(t=>!(typeof t==`object`&&t&&t.type===`mdxJsxAttribute`&&t.name===e))):s[e]=t,r.view.dispatch(r.state.tr.setNodeMarkup(n,null,{...o,attributes:l,props:s,sourceDirty:!0}))}}),(0,X.jsx)(`div`,{className:`mt-3 flex justify-end border-t border-border pt-2`,children:(0,X.jsx)(en,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>g(!1),className:`h-7 px-3 text-xs`,children:(0,X.jsx)(o,{id:`DPfwMq`})})})]}),t[145]=u,t[146]=r,t[147]=a,t[148]=P,t[149]=B,t[150]=W,t[151]=ge,t[152]=g,t[153]=L,t[154]=tt):tt=t[154];let nt;return t[155]!==Ee||t[156]!==Te||t[157]!==h||t[158]!==$e||t[159]!==et||t[160]!==tt?(nt=(0,X.jsxs)(Ee,{open:h,onOpenChange:Te,children:[$e,et,tt]}),t[155]=Ee,t[156]=Te,t[157]=h,t[158]=$e,t[159]=et,t[160]=tt,t[161]=nt):nt=t[161],nt}function hZ(e){return e.stopPropagation()}function gZ(e){return e.stopPropagation()}function _Z(e){return e.stopPropagation()}function vZ(e){return e.stopPropagation()}function yZ(e){return e.preventDefault()}function bZ(e){return!(`hidden`in e&&e.hidden)&&e.type!==`reactnode`}var xZ=I.extend({addOptions(){return{...this.parent?.(),docName:``}},addNodeView(){return nu(mZ)}}),SZ={name:`InlineMath`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,category:`content`,description:`Inline math`,props:[{name:`formula`,type:`string`,required:!0,autoFocus:!0,description:`LaTeX inline math source`}]},CZ=(0,Q.lazy)(async()=>{let{default:e}=await n(async()=>{let{default:e}=await import(`./katex-zjckjCBG.js`);return{default:e}},[],import.meta.url);function t(t){let n=(0,Z.c)(4),r;n[0]===t.formula?r=n[1]:(r=e.renderToString(t.formula,{displayMode:!1,throwOnError:!1,strict:`ignore`,trust:!1}),n[0]=t.formula,n[1]=r);let i=r,a;return n[2]===i?a=n[3]:(a=(0,X.jsx)(`span`,{className:`math math-inline`,dangerouslySetInnerHTML:{__html:i}}),n[2]=i,n[3]=a),a}return{default:t}});function wZ(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(`span`,{className:`math math-inline math-placeholder math-placeholder-empty inline-flex items-center gap-1 rounded-sm border border-dashed border-muted-foreground/40 bg-muted/30 px-1.5 py-0.5 text-xs italic text-muted-foreground hover:bg-muted/60 cursor-pointer`,"data-component-type":`math-inline`,children:`f(x)`}),e[0]=t):t=e[0],t}function TZ(e){let t=(0,Z.c)(2),n;return t[0]===e.formula?n=t[1]:(n=(0,X.jsx)(`span`,{className:`math math-inline math-placeholder`,"data-component-type":`math-inline`,children:e.formula}),t[0]=e.formula,t[1]=n),n}function EZ(e){let t=(0,Z.c)(38),{node:n,selected:r,getPos:i,editor:a}=e,s=typeof n.attrs.formula==`string`?n.attrs.formula:``,c=typeof n.attrs.id==`string`?n.attrs.id:void 0,[l,u]=(0,Q.useState)(!1),d=(0,Q.useRef)(!1),f;t[0]!==a.state||t[1]!==i||t[2]!==r?(f=()=>{let e=r&&a.state.selection instanceof Nt;e&&!d.current?(RM(typeof i==`function`?i()??0:0),u(!0)):!e&&d.current&&u(!1),d.current=e},t[0]=a.state,t[1]=i,t[2]=r,t[3]=f):f=t[3];let p;t[4]!==a||t[5]!==i||t[6]!==r?(p=[r,i,a],t[4]=a,t[5]=i,t[6]=r,t[7]=p):p=t[7],(0,Q.useEffect)(f,p);let m=r?`math-inline-selected`:void 0,h;t[8]===c?h=t[9]:(h=c?{id:c}:{},t[8]=c,t[9]=h);let g;t[10]===s?g=t[11]:(g=s?(0,X.jsx)(mY,{resetKeys:[s],onError:OZ,fallbackRender:()=>(0,X.jsx)(`span`,{className:`math math-inline math-error`,children:s}),children:(0,X.jsx)(Q.Suspense,{fallback:(0,X.jsx)(TZ,{formula:s}),children:(0,X.jsx)(CZ,{formula:s})})}):(0,X.jsx)(wZ,{}),t[10]=s,t[11]=g);let _;t[12]!==s||t[13]!==h||t[14]!==g?(_=(0,X.jsx)(gc,{asChild:!0,children:(0,X.jsx)(`span`,{className:`math-inline-trigger`,"data-component-type":`math-inline`,"data-formula":s,...h,children:g})}),t[12]=s,t[13]=h,t[14]=g,t[15]=_):_=t[15];let v;t[16]===a.view?v=t[17]:(v=e=>{e.preventDefault(),a.view.focus()},t[16]=a.view,t[17]=v);let y;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,X.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground px-3 pt-2`,children:(0,X.jsx)(o,{id:`EOjU5V`})}),t[18]=y):y=t[18];let b;t[19]===s?b=t[20]:(b={formula:s},t[19]=s,t[20]=b);let x;t[21]!==a.state||t[22]!==a.view||t[23]!==i?(x=(e,t)=>{let n=typeof i==`function`?i():void 0;if(typeof n!=`number`)return;let r=a.state.doc.nodeAt(n);if(!r||r.type.name!==`mathInline`)return;let o=a.state.tr.setNodeMarkup(n,null,{...r.attrs,[e]:t??``});o.setSelection(Nt.create(o.doc,n)),a.view.dispatch(o)},t[21]=a.state,t[22]=a.view,t[23]=i,t[24]=x):x=t[24];let S;t[25]!==x||t[26]!==b?(S=(0,X.jsx)(_X,{descriptor:SZ,values:b,onChange:x}),t[25]=x,t[26]=b,t[27]=S):S=t[27];let C;t[28]!==S||t[29]!==v?(C=(0,X.jsxs)(_c,{className:`z-[60] w-72 p-0`,side:`bottom`,align:`start`,onOpenAutoFocus:DZ,onCloseAutoFocus:v,children:[y,S]}),t[28]=S,t[29]=v,t[30]=C):C=t[30];let w;t[31]!==l||t[32]!==C||t[33]!==_?(w=(0,X.jsxs)(hc,{open:l,onOpenChange:u,children:[_,C]}),t[31]=l,t[32]=C,t[33]=_,t[34]=w):w=t[34];let T;return t[35]!==w||t[36]!==m?(T=(0,X.jsx)(Jl,{as:`span`,className:m,children:w}),t[35]=w,t[36]=m,t[37]=T):T=t[37],T}function DZ(e){e.preventDefault()}function OZ(e,t){let n=e instanceof Error?e:Error(String(e));console.warn(JSON.stringify({event:`jsx-render-failure`,component:`mathInline`,rawComponentName:`mathInline`,error:String(n),stack:t.componentStack})),fe(`mathInline`)}var kZ=c.extend({addNodeView(){return nu(EZ)}});function AZ(e,t){if(!e.selection.empty)return null;let n=t===`up`||t===`left`?-1:1,r=e.selection.$head,i=n>0?r.after():r.before();if(typeof i!=`number`)return null;let a=zt.near(e.doc.resolve(i),n);return a.$head?.parent.type.name===`rawMdxFallback`?a:null}function jZ(e,t){let{state:n,view:r}=e;if(!r.endOfTextblock(t))return!1;let i=AZ(n,t);return i?(r.dispatch(n.tr.setSelection(i)),!0):!1}var MZ=yt.extend({addKeyboardShortcuts(){return{ArrowLeft:({editor:e})=>jZ(e,`left`),ArrowRight:({editor:e})=>jZ(e,`right`),ArrowUp:({editor:e})=>jZ(e,`up`),ArrowDown:({editor:e})=>jZ(e,`down`)}},addNodeView(){return nu(uK,{stopEvent:()=>!0,ignoreMutation:()=>!0})}});function NZ(e){let t=(0,Z.c)(51),{items:n,selectedIndex:r,categoryLabels:i,onSelect:a,onHoverIndex:c}=e,l=(0,Q.useRef)(null),u=(0,Q.useId)(),{_:d}=s(),f=r>=0&&r<n.length?`${u}-option-${r}`:void 0,p=FZ,m,h;if(t[0]===r?(m=t[1],h=t[2]):(m=()=>{let e=l.current;if(!e)return;let t=e.querySelectorAll(`[role="option"]`).item(r);t&&t.scrollIntoView({block:`nearest`})},h=[r],t[0]=r,t[1]=m,t[2]=h),(0,Q.useEffect)(m,h),n.length===0){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e={maxHeight:`var(--suggestion-menu-max-height, 40vh)`},t[3]=e):e=t[3];let n;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,X.jsx)(`div`,{ref:l,role:`status`,"aria-live":`polite`,className:`w-56 rounded-lg border bg-popover p-2 shadow-md text-sm text-muted-foreground`,style:e,onMouseDown:p,children:(0,X.jsx)(o,{id:`Ev2r9A`})}),t[4]=n):n=t[4],n}let g,_,v,y,b,x,S,C,w,T,E,D,O;if(t[5]!==d||t[6]!==f||t[7]!==i||t[8]!==n||t[9]!==u||t[10]!==c||t[11]!==a||t[12]!==r){let e=[],o=0,s=new Map;for(let t of n){s.set(t,o++);let n=e.find(e=>e.key===t.category);n?n.items.push(t):e.push({key:t.category,items:[t]})}_=r>=0&&r<n.length?n[r]:null;let m;t[26]===n?m=t[27]:(m=n.some(PZ),t[26]=n,t[27]=m),g=m,x=`flex items-start gap-2`,S=l,C=`listbox`,t[28]===d?w=t[29]:(w=d({id:`RlCInP`}),t[28]=d,t[29]=w),T=f,E=-1,D=p,O=`w-56 overflow-y-auto subtle-scrollbar rounded-lg border bg-popover p-1 shadow-md`,t[30]===Symbol.for(`react.memo_cache_sentinel`)?(v={maxHeight:`var(--suggestion-menu-max-height, 40vh)`},t[30]=v):v=t[30];let h=_?`${_.label}${_.preview?`. ${_.preview.description}`:``}`:``;t[31]===h?y=t[32]:(y=(0,X.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,"aria-atomic":`true`,children:h}),t[31]=h,t[32]=y),b=e.map(e=>(0,X.jsxs)(`div`,{role:`group`,"aria-labelledby":`${u}-group-${e.key}`,children:[(0,X.jsx)(`div`,{id:`${u}-group-${e.key}`,className:`px-2 py-1.5 text-xs font-semibold text-muted-foreground`,children:i[e.key]??e.key}),e.items.map(e=>{let t=s.get(e)??0,n=t===r,i=e.icon;return(0,X.jsxs)(`button`,{id:`${u}-option-${t}`,type:`button`,role:`option`,"aria-selected":n,"data-selected":n,className:`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm text-left ${n?`bg-accent text-accent-foreground`:``}`,onMouseEnter:()=>c?.(t),onMouseDown:t=>{t.preventDefault(),a(e)},children:[(0,X.jsx)(i,{className:`size-4 shrink-0 text-muted-foreground`}),(0,X.jsx)(`div`,{className:`flex flex-col min-w-0`,children:(0,X.jsx)(`span`,{className:`truncate`,children:e.label})})]},e.name)})]},e.key)),t[5]=d,t[6]=f,t[7]=i,t[8]=n,t[9]=u,t[10]=c,t[11]=a,t[12]=r,t[13]=g,t[14]=_,t[15]=v,t[16]=y,t[17]=b,t[18]=x,t[19]=S,t[20]=C,t[21]=w,t[22]=T,t[23]=E,t[24]=D,t[25]=O}else g=t[13],_=t[14],v=t[15],y=t[16],b=t[17],x=t[18],S=t[19],C=t[20],w=t[21],T=t[22],E=t[23],D=t[24],O=t[25];let k;t[33]!==v||t[34]!==y||t[35]!==b||t[36]!==S||t[37]!==C||t[38]!==w||t[39]!==T||t[40]!==E||t[41]!==D||t[42]!==O?(k=(0,X.jsxs)(`div`,{ref:S,role:C,"aria-label":w,"aria-activedescendant":T,tabIndex:E,onMouseDown:D,className:O,style:v,children:[y,b]}),t[33]=v,t[34]=y,t[35]=b,t[36]=S,t[37]=C,t[38]=w,t[39]=T,t[40]=E,t[41]=D,t[42]=O,t[43]=k):k=t[43];let A;t[44]!==g||t[45]!==_?(A=g?(0,X.jsx)(`aside`,{"aria-hidden":`true`,onMouseDown:p,className:`w-64 rounded-lg border bg-popover p-2 shadow-md ${_?.preview?``:`invisible`}`,children:_?.preview?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`mb-2 flex aspect-5/3 items-center justify-center overflow-hidden rounded-md bg-muted/40 p-3 *:max-h-full *:max-w-full [&_img]:size-full [&_img]:rounded-md [&_img]:object-contain`,children:_.preview.render()}),(0,X.jsx)(`p`,{className:`px-1 pb-1 text-xs text-muted-foreground`,children:_.preview.description})]}):null}):null,t[44]=g,t[45]=_,t[46]=A):A=t[46];let j;return t[47]!==x||t[48]!==k||t[49]!==A?(j=(0,X.jsxs)(`div`,{className:x,children:[k,A]}),t[47]=x,t[48]=k,t[49]=A,t[50]=j):j=t[50],j}function PZ(e){return e.preview}function FZ(e){return e.preventDefault()}var IZ=new q(`slashCommand`),LZ=F.create({name:`slashCommand`,addOptions(){return{itemsSources:[QM],categoryLabels:{basic:`Basic blocks`,insert:`Insert`}}},addProseMirrorPlugins(){let e=this;return[qy({editor:this.editor,pluginKey:IZ,char:`/`,startOfLine:!1,allow:({editor:e})=>!eb(e),items:({query:t})=>{let n=e.options.itemsSources.flatMap(e=>{try{return e()}catch(e){return console.error(`[slash-command] item source threw an error`,e),[]}}),r=Object.keys(e.options.categoryLabels),i=e=>{let t=r.indexOf(e);return t===-1?1/0:t};return $M(n.map((e,t)=>({item:e,i:t})).sort((e,t)=>{let n=i(e.item.category)-i(t.item.category);return n===0?e.i-t.i:n}).map(e=>e.item),t)},command:({editor:e,range:t,props:n})=>{try{e.chain().focus().deleteRange(t).run()}catch(e){console.error(`[slash-command] deleteRange failed for "${n.name}"`,e);return}try{n.command(e)}catch(e){console.error(`[slash-command] command "${n.name}" threw an error`,e)}},render:()=>{let t=null,n=null,r=0,i={popup:null,stopAutoUpdate:null},a=null,o=e=>{e!==r&&(r=e,s())},s=()=>{!t||!n||t.updateProps({items:n.items,selectedIndex:r,categoryLabels:e.options.categoryLabels,onSelect:n.command,onHoverIndex:o})};return{onStart(s){n=s,r=0;let c=tb(()=>n,`slash-command`);i.popup=c.popup,a=c.doPosition,t=new eu(NZ,{props:{items:s.items,selectedIndex:r,categoryLabels:e.options.categoryLabels,onSelect:s.command,onHoverIndex:o},editor:s.editor}),c.popup.appendChild(t.element),i.stopAutoUpdate=c.startAutoUpdate(),c.reveal()},onUpdate(e){n=e,r=Math.min(r,Math.max(0,e.items.length-1)),s(),a?.()},onKeyDown({event:e}){if(!n||n.items.length===0)return!1;let t=n.items;if(e.key===`ArrowDown`)return r=(r+1)%t.length,s(),!0;if(e.key===`ArrowUp`)return r=(r-1+t.length)%t.length,s(),!0;if(e.key===`Enter`||e.key===`Tab`){let e=t[r];return e&&n.command(e),!0}return e.key,!1},onExit(){nb(i),a=null,t?.destroy(),t=null,n=null,r=0}}}})]}}),RZ=new q(`sourceDirty`),zZ=F.create({name:`sourceDirtyObserver`,addProseMirrorPlugins(){return[new Ht({key:RZ,appendTransaction(e,t,n){if(!e.some(e=>!e.getMeta(Hv))||!e.some(e=>e.docChanged))return null;let r=new It;for(let t of e)r.appendMapping(t.mapping);let i=r.invert(),a=[];if(n.doc.descendants((e,n)=>{if(e.type.name!==`jsxComponent`||e.attrs.sourceDirty)return;let r=i.map(n),o=t.doc.nodeAt(r),s=!o||o.type.name!==`jsxComponent`,c=typeof e.attrs.sourceRaw==`string`&&e.attrs.sourceRaw.length>0;if(s&&c)return;if(!o){(e.content.size>0||Object.keys(e.attrs.props??{}).length>0)&&a.push({pos:n});return}if(o.type.name!==`jsxComponent`){a.push({pos:n});return}let l=!BZ(o.attrs.props,e.attrs.props),u=!o.content.eq(e.content);(l||u)&&a.push({pos:n})}),a.length===0)return null;let o=n.tr;for(let{pos:e}of a)o.setNodeAttribute(e,`sourceDirty`,!0);return o}})]}});function BZ(e,t){if(Object.is(e,t))return!0;if(e==null||t==null||typeof e!=typeof t||typeof e!=`object`)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!BZ(e[n],t[n]))return!1;return!0}let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!BZ(e[r],t[r]))return!1;return!0}var VZ=F.create({name:`tabFocusTrap`,priority:1,addKeyboardShortcuts(){return{Tab:()=>!0,"Shift-Tab":()=>!0}}});function HZ(e,t){let n=e.doc.nodeAt(t);if(!n||n.type.name!==`table`)return null;let r=pe.get(n);return{map:r,tableStart:t+1,table:n,left:0,top:0,right:r.width,bottom:r.height}}function UZ(e,t){let n=HZ(e,t);return n?ye(e.tr,n,n.map.width):null}function WZ(e,t){let n=HZ(e,t);return n?D(e.tr,n,n.map.height):null}function GZ(e,t){if(!e.dom.contains(t))return null;let n;try{n=e.posAtDOM(t,0)}catch{return null}return n<0?null:L(e.state.doc.resolve(n))?.pos??null}var KZ=`<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12h14"/><path d="M12 5v14"/></svg>`;function qZ(e,t){let n=document.createElement(`button`);return n.type=`button`,n.className=`ok-table-insert-bar ok-table-insert-${e}`,n.setAttribute(`aria-label`,t),n.tabIndex=-1,n.setAttribute(MF,`true`),n.innerHTML=KZ,n.addEventListener(`mousedown`,e=>{e.preventDefault(),e.stopPropagation()}),n}var JZ=class{overlays=new Map;mount;lastEditable;constructor(e,t){this.view=e,this.editor=t,this.mount=e.dom.parentElement??e.dom,this.lastEditable=t.isEditable,this.reconcile()}update(e,t){let n=this.editor.isEditable!==this.lastEditable;this.lastEditable=this.editor.isEditable,!(!n&&t.doc.eq(this.view.state.doc))&&this.reconcile()}destroy(){for(let e of this.overlays.keys())this.removeOverlay(e)}reconcile(){if(!this.editor.isEditable){this.destroy();return}let e=new Set(this.view.dom.querySelectorAll(`.tableWrapper`));for(let t of this.overlays.keys())e.has(t)||this.removeOverlay(t);for(let t of e)this.overlays.has(t)||this.addOverlay(t)}addOverlay(e){let t=document.createElement(`div`);t.className=`ok-table-insert-controls`,t.setAttribute(MF,`true`);let n=qZ(`column`,`Add column`),r=qZ(`row`,`Add row`);n.addEventListener(`click`,()=>this.insert(e,UZ)),r.addEventListener(`click`,()=>this.insert(e,WZ)),t.append(n,r),this.mount.appendChild(t);let i=wr(e,t,()=>{let{width:t,height:i}=e.getBoundingClientRect();Or(e,n,{strategy:`absolute`,placement:`right-start`}).then(({x:e,y:t})=>{n.style.left=`${e}px`,n.style.top=`${t}px`,n.style.height=`${i}px`}).catch(()=>{}),Or(e,r,{strategy:`absolute`,placement:`bottom-start`}).then(({x:e,y:n})=>{r.style.left=`${e}px`,r.style.top=`${n}px`,r.style.width=`${t}px`}).catch(()=>{})}),a=e=>{let t=e.target instanceof Element?e.target.closest(`td, th`):null,i=t?.parentElement;n.classList.toggle(`is-active`,!!t&&t===i?.lastElementChild),r.classList.toggle(`is-active`,!!i&&i===i.parentElement?.lastElementChild)},o=()=>{n.classList.remove(`is-active`),r.classList.remove(`is-active`)};e.addEventListener(`pointerover`,a),e.addEventListener(`pointerleave`,o),this.overlays.set(e,{container:t,cleanup:()=>{i(),e.removeEventListener(`pointerover`,a),e.removeEventListener(`pointerleave`,o),t.remove()}})}removeOverlay(e){let t=this.overlays.get(e);t&&(t.cleanup(),this.overlays.delete(e))}insert(e,t){let n=e.querySelector(`table`);if(!n)return;let r=GZ(this.view,n);if(r===null)return;let i=t(this.view.state,r);i&&(this.view.dispatch(i),this.view.focus())}},YZ=F.create({name:`tableInsertControls`,addProseMirrorPlugins(){let e=this.editor;return[new Ht({key:new q(`tableInsertControls`),view:t=>new JZ(t,e)})]}}),XZ=`ok:tag-click`;function ZZ(e){if(typeof document>`u`)return;let t={value:e};document.dispatchEvent(new CustomEvent(XZ,{detail:t}))}function QZ(e){return e instanceof Element?e.closest(`a[data-tag]`):null}var $Z=F.create({name:`tagClick`,addProseMirrorPlugins(){return[new Ht({props:{handleDOMEvents:{click(e,t){let n=QZ(t.target);if(!n)return!1;let r=n.getAttribute(`data-tag`);return r?(t.preventDefault(),t.stopPropagation(),ZZ(r),!0):!1}}}})]}});function eQ(e,t,n){if(typeof t!=`number`||!n||!_e.test(n))return!1;let{state:r,view:i}=e,a=r.doc.nodeAt(t);if(!a||a.type.name!==`tag`)return!1;let o=r.tr.setNodeMarkup(t,null,{...a.attrs,value:n}),s=t+a.nodeSize;return o.insertText(` `,s),o.setSelection(p.create(o.doc,s+1)),i.dispatch(o),i.focus(),!0}function tQ(e,t){if(typeof t!=`number`)return;let{state:n,view:r}=e,i=n.doc.nodeAt(t);if(!i||i.type.name!==`tag`)return;let a=n.tr.delete(t,t+i.nodeSize);r.dispatch(a),r.focus()}function nQ(e){let t=(0,Z.c)(3),{value:n}=e,r=`#tag/${n}`,i;return t[0]!==r||t[1]!==n?(i=(0,X.jsxs)(`a`,{className:`tag`,"data-tag":n,href:r,children:[`#`,n]}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function rQ(e){let t=(0,Z.c)(20),{initialDraft:n,onCommit:r,onCancel:i}=e,{_:a}=s(),o=(0,Q.useRef)(null),[c,l]=(0,Q.useState)(n),u=(0,Q.useRef)(!1),d,f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>{let e=requestAnimationFrame(()=>{o.current?.focus()});return()=>cancelAnimationFrame(e)},f=[],t[0]=d,t[1]=f):(d=t[0],f=t[1]),(0,Q.useEffect)(d,f);let p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`font-mono`,children:`#`}),t[2]=p):p=t[2];let m=Math.max(c.length,8),h;t[3]===a?h=t[4]:(h=a({id:`U2pMtf`}),t[3]=a,t[4]=h);let g;t[5]===a?g=t[6]:(g=a({id:`knjOzA`}),t[5]=a,t[6]=g);let _;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>{let t=e.target.value;(t===``||_e.test(t))&&l(t)},t[7]=_):_=t[7];let v,y;t[8]!==c||t[9]!==i||t[10]!==r?(v=e=>{e.key===`Enter`||e.key===` `?(e.preventDefault(),u.current=!0,r(c)||(u.current=!1,i())):(e.key===`Escape`||e.key===`Backspace`&&c===``)&&(e.preventDefault(),i())},y=()=>{if(!u.current){if(c===``){i();return}_e.test(c)?r(c):i()}},t[8]=c,t[9]=i,t[10]=r,t[11]=v,t[12]=y):(v=t[11],y=t[12]);let b;return t[13]!==c||t[14]!==m||t[15]!==h||t[16]!==g||t[17]!==v||t[18]!==y?(b=(0,X.jsxs)(`span`,{className:`tag tag-placeholder inline-flex items-center rounded-sm border border-dashed border-muted-foreground/40 bg-muted/30 px-1.5 py-0.5 text-xs text-muted-foreground`,"data-component-type":`tag-placeholder`,children:[p,(0,X.jsx)(`input`,{ref:o,type:`text`,value:c,size:m,placeholder:h,"aria-label":g,spellCheck:!1,autoCorrect:`off`,autoCapitalize:`off`,className:`bg-transparent border-0 p-0 outline-none focus:outline-none focus:ring-0 text-inherit font-inherit`,onChange:_,onKeyDown:v,onBlur:y})]}),t[13]=c,t[14]=m,t[15]=h,t[16]=g,t[17]=v,t[18]=y,t[19]=b):b=t[19],b}function iQ(e){let t=(0,Z.c)(5),{node:n,getPos:r,editor:i}=e,a=typeof n.attrs.value==`string`?n.attrs.value:``;if(a===``){let e;return t[0]!==i||t[1]!==r?(e=(0,X.jsx)(Jl,{as:`span`,children:(0,X.jsx)(rQ,{initialDraft:``,onCommit:e=>eQ(i,typeof r==`function`?r():void 0,e),onCancel:()=>tQ(i,typeof r==`function`?r():void 0)})}),t[0]=i,t[1]=r,t[2]=e):e=t[2],e}let o;return t[3]===a?o=t[4]:(o=(0,X.jsx)(Jl,{as:`span`,children:(0,X.jsx)(nQ,{value:a})}),t[3]=a,t[4]=o),o}var aQ=it.extend({priority:200,addNodeView(){return nu(iQ)},addKeyboardShortcuts(){return{Backspace:()=>{if(rb.getState(this.editor.state)?.active)return!1;let{selection:e}=this.editor.state;if(!e.empty)return!1;let t=e.$from.nodeBefore;if(t?.type.name===`tag`){let{state:n,view:r}=this.editor;return r.dispatch(n.tr.delete(e.from-t.nodeSize,e.from)),!0}return!1},Delete:()=>{if(rb.getState(this.editor.state)?.active)return!1;let{selection:e}=this.editor.state;if(!e.empty)return!1;let t=e.$from.nodeAfter;if(t?.type.name===`tag`){let{state:n,view:r}=this.editor;return r.dispatch(n.tr.delete(e.from,e.from+t.nodeSize)),!0}return!1}}},addProseMirrorPlugins(){return[ub(this.editor)]}}),oQ=2048,sQ=24;function cQ(e){if(typeof e!=`string`)return{kind:`unsupported`,value:``};let t=e.trim();if(t===``||t.length>oQ)return{kind:`unsupported`,value:``};if(dQ(t))return{kind:`emoji`,value:t};let n=fQ(t);return n===`url`?{kind:`url`,value:t}:n===`path`?{kind:`path`,value:d(`/api/asset?path=${encodeURIComponent(uQ(t))}`)}:{kind:`unsupported`,value:``}}function lQ(e){if(typeof e!=`string`)return{kind:`unsupported`,value:``};let t=e.trim();if(t===``||t.length>oQ)return{kind:`unsupported`,value:``};let n=fQ(t);return n===`url`?{kind:`url`,value:t}:n===`path`?{kind:`path`,value:d(`/api/asset?path=${encodeURIComponent(uQ(t))}`)}:{kind:`unsupported`,value:``}}function uQ(e){return e.startsWith(`/`)?e.slice(1):e}function dQ(e){if(/\p{L}/u.test(e)||e.includes(`/`))return!1;let t=0;for(let n of e)t++;if(t>sQ)return!1;let n=e.lastIndexOf(`.`);if(n>-1){let t=e.slice(n+1).toLowerCase();if(de.has(t))return!1}return!0}function fQ(e){let t=pQ(e);if(!t||!de.has(t))return`unsupported`;let n=e.indexOf(`:`),r=e.indexOf(`/`);return n>-1&&(r===-1||n<r)?Ot(e)?`url`:`unsupported`:e.startsWith(`//`)||e.includes(`?`)||e.includes(`#`)||e.startsWith(`../`)||e.includes(`/../`)?`unsupported`:`path`}function pQ(e){let t=e.lastIndexOf(`/`),n=t>-1?e.slice(t+1):e,r=n.search(/[?#]/),i=r>-1?n.slice(0,r):n,a=i.lastIndexOf(`.`);return a<=0||a===i.length-1?null:i.slice(a+1).toLowerCase()}function mQ(e){let t=(0,Z.c)(133),{open:n,target:r,alias:i,anchor:a,pages:c,assetPaths:l,filePaths:u,loading:d,onOpenChange:f,onSave:p}=e,[m,h]=(0,Q.useState)(r),[g,_]=(0,Q.useState)(i??``),[v,y]=(0,Q.useState)(a??``),b=(0,Q.useId)(),x=(0,Q.useId)(),S=(0,Q.useId)(),C=(0,Q.useId)(),{_:w}=s(),T;t[0]!==l||t[1]!==m||t[2]!==u?(T=AO(m,l,u),t[0]=l,t[1]=m,t[2]=u,t[3]=T):T=t[3];let E=T,D;t[4]!==l||t[5]!==m||t[6]!==u||t[7]!==c?(D=jO(m,c,l,u),t[4]=l,t[5]=m,t[6]=u,t[7]=c,t[8]=D):D=t[8];let O=nY(m,D&&!E&&n),k=(0,Q.useRef)(!1),A,j;t[9]!==i||t[10]!==a||t[11]!==n||t[12]!==r?(A=()=>{if(!n){k.current=!1;return}k.current||(k.current=!0,h(r),_(i??``),y(a??``))},j=[n,r,i,a],t[9]=i,t[10]=a,t[11]=n,t[12]=r,t[13]=A,t[14]=j):(A=t[13],j=t[14]),(0,Q.useEffect)(A,j);let M;t[15]!==g||t[16]!==v||t[17]!==m||t[18]!==f||t[19]!==p?(M=function(){let e=m.trim();e&&(p(e,g.trim()||null,v.trim()||null),f(!1))},t[15]=g,t[16]=v,t[17]=m,t[18]=f,t[19]=p,t[20]=M):M=t[20];let N=M,P;t[21]===N?P=t[22]:(P=function(e){e.key===`Enter`&&(e.preventDefault(),N())},t[21]=N,t[22]=P);let F=P,I;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(I=function(e){h(e.path),y(``)},t[23]=I):I=t[23];let L=I,R,z,B,V,H,ee,U,W,te,G,ne,re,ie,ae,oe,se,K;if(t[24]!==w||t[25]!==S||t[26]!==x||t[27]!==l||t[28]!==g||t[29]!==v||t[30]!==m||t[31]!==F||t[32]!==C||t[33]!==O||t[34]!==d||t[35]!==f||t[36]!==n||t[37]!==c||t[38]!==b){let e=new Map,r=O?.map(t=>{let n=e.get(t.slug)??0;e.set(t.slug,n+1);let r=n===0?t.slug:`${t.slug}-${n}`;return{...t,reactKey:r}}),i=!!r?.length;B=_n,ae=n,oe=f,z=ln,W=`sm:max-w-xl`,te=``,G=RJ,ne=RJ,re=RJ;let a;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(rn,{children:(0,X.jsx)(o,{id:`xzktOa`})}),t[56]=a):a=t[56],t[57]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,X.jsxs)(gn,{children:[a,(0,X.jsx)(nn,{children:(0,X.jsx)(o,{id:`Jhj_lh`})})]}),t[57]=ie):ie=t[57],R=fn,H=`space-y-6`;let s;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsx)(o,{id:`lGs_bQ`,components:{0:(0,X.jsx)(`span`,{className:`text-red-500`})}}),t[58]=s):s=t[58];let u;t[59]===b?u=t[60]:(u=(0,X.jsx)(`label`,{className:`mb-1.5 block text-sm font-medium`,htmlFor:b,children:s}),t[59]=b,t[60]=u);let p;t[61]===w?p=t[62]:(p=w({id:`aM23Wr`}),t[61]=w,t[62]=p);let T;t[63]!==l||t[64]!==m||t[65]!==F||t[66]!==d||t[67]!==c||t[68]!==p||t[69]!==b?(T=(0,X.jsx)(VJ,{id:b,value:m,pages:c,assetPaths:l,includeAssets:!0,loading:d,onValueChange:h,onSuggestionSelect:L,placeholder:p,autoFocus:!0,"aria-required":`true`,onKeyDown:F}),t[63]=l,t[64]=m,t[65]=F,t[66]=d,t[67]=c,t[68]=p,t[69]=b,t[70]=T):T=t[70],t[71]!==u||t[72]!==T?(ee=(0,X.jsxs)(`div`,{children:[u,T]}),t[71]=u,t[72]=T,t[73]=ee):ee=t[73];let E;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,X.jsx)(o,{id:`OTF92M`,components:{0:(0,X.jsx)(`span`,{className:`font-normal text-muted-foreground`})}}),t[74]=E):E=t[74];let D;t[75]===S?D=t[76]:(D=(0,X.jsx)(`label`,{className:`mb-1.5 block text-sm font-medium`,htmlFor:S,children:E}),t[75]=S,t[76]=D);let k;t[77]===Symbol.for(`react.memo_cache_sentinel`)?(k=e=>_(e.target.value),t[77]=k):k=t[77];let A;t[78]===w?A=t[79]:(A=w({id:`BH56dn`}),t[78]=w,t[79]=A);let j;t[80]!==S||t[81]!==g||t[82]!==F||t[83]!==A?(j=(0,X.jsx)(Ir,{id:S,value:g,onChange:k,placeholder:A,onKeyDown:F}),t[80]=S,t[81]=g,t[82]=F,t[83]=A,t[84]=j):j=t[84],t[85]!==D||t[86]!==j?(U=(0,X.jsxs)(`div`,{children:[D,j]}),t[85]=D,t[86]=j,t[87]=U):U=t[87];let M;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,X.jsx)(o,{id:`Tjc1pH`,components:{0:(0,X.jsx)(`span`,{className:`font-normal text-muted-foreground`})}}),t[88]=M):M=t[88],t[89]===x?se=t[90]:(se=(0,X.jsx)(`label`,{className:`mb-1.5 block text-sm font-medium`,htmlFor:x,children:M}),t[89]=x,t[90]=se);let N;t[91]===Symbol.for(`react.memo_cache_sentinel`)?(N=e=>y(e.target.value),t[91]=N):N=t[91];let P;t[92]===w?P=t[93]:(P=w({id:`W-ntoW`}),t[92]=w,t[93]=P),t[94]!==x||t[95]!==v||t[96]!==F||t[97]!==P?(K=(0,X.jsx)(Ir,{id:x,value:v,onChange:N,placeholder:P,onKeyDown:F}),t[94]=x,t[95]=v,t[96]=F,t[97]=P,t[98]=K):K=t[98],V=i&&(0,X.jsx)(`div`,{id:C,className:`mt-1.5 max-h-36 overflow-y-auto subtle-scrollbar rounded-md border border-border bg-muted/30`,children:r.map(e=>(0,X.jsxs)(`button`,{type:`button`,"aria-pressed":v===e.slug,className:Xt(`flex w-full items-center gap-2 px-2 py-1 text-left text-sm hover:bg-accent hover:text-accent-foreground`,v===e.slug&&`bg-accent text-accent-foreground`),style:{paddingLeft:`${(e.level-1)*12+8}px`},onClick:()=>y(v===e.slug?``:e.slug),children:[(0,X.jsxs)(`span`,{className:`w-7 shrink-0 font-mono text-[10px] text-muted-foreground`,children:[`H`,e.level]}),(0,X.jsx)(`span`,{className:`truncate`,children:e.text})]},e.reactKey))}),t[24]=w,t[25]=S,t[26]=x,t[27]=l,t[28]=g,t[29]=v,t[30]=m,t[31]=F,t[32]=C,t[33]=O,t[34]=d,t[35]=f,t[36]=n,t[37]=c,t[38]=b,t[39]=R,t[40]=z,t[41]=B,t[42]=V,t[43]=H,t[44]=ee,t[45]=U,t[46]=W,t[47]=te,t[48]=G,t[49]=ne,t[50]=re,t[51]=ie,t[52]=ae,t[53]=oe,t[54]=se,t[55]=K}else R=t[39],z=t[40],B=t[41],V=t[42],H=t[43],ee=t[44],U=t[45],W=t[46],te=t[47],G=t[48],ne=t[49],re=t[50],ie=t[51],ae=t[52],oe=t[53],se=t[54],K=t[55];let ce;t[99]!==V||t[100]!==se||t[101]!==K?(ce=(0,X.jsxs)(`div`,{children:[se,K,V]}),t[99]=V,t[100]=se,t[101]=K,t[102]=ce):ce=t[102];let le;t[103]!==H||t[104]!==ee||t[105]!==U||t[106]!==ce?(le=(0,X.jsxs)(`div`,{className:H,children:[ee,U,ce]}),t[103]=H,t[104]=ee,t[105]=U,t[106]=ce,t[107]=le):le=t[107];let ue;t[108]!==R||t[109]!==le?(ue=(0,X.jsx)(R,{children:le}),t[108]=R,t[109]=le,t[110]=ue):ue=t[110];let de;t[111]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,X.jsx)(hn,{asChild:!0,children:(0,X.jsx)(en,{variant:`outline`,children:(0,X.jsx)(o,{id:`dEgA5A`})})}),t[111]=de):de=t[111];let fe;t[112]===m?fe=t[113]:(fe=m.trim(),t[112]=m,t[113]=fe);let pe=!fe,me;t[114]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,X.jsx)(o,{id:`tfDRzk`}),t[114]=me):me=t[114];let he;t[115]!==N||t[116]!==pe?(he=(0,X.jsxs)(pn,{children:[de,(0,X.jsx)(en,{onClick:N,disabled:pe,children:me})]}),t[115]=N,t[116]=pe,t[117]=he):he=t[117];let ge;t[118]!==z||t[119]!==W||t[120]!==te||t[121]!==G||t[122]!==ne||t[123]!==re||t[124]!==ie||t[125]!==ue||t[126]!==he?(ge=(0,X.jsxs)(z,{className:W,"data-ok-layer-spawned":te,onPointerDownOutside:G,onFocusOutside:ne,onInteractOutside:re,children:[ie,ue,he]}),t[118]=z,t[119]=W,t[120]=te,t[121]=G,t[122]=ne,t[123]=re,t[124]=ie,t[125]=ue,t[126]=he,t[127]=ge):ge=t[127];let _e;return t[128]!==B||t[129]!==ae||t[130]!==oe||t[131]!==ge?(_e=(0,X.jsx)(B,{open:ae,onOpenChange:oe,children:ge}),t[128]=B,t[129]=ae,t[130]=oe,t[131]=ge,t[132]=_e):_e=t[132],_e}function hQ(e){let t=(0,Z.c)(116),{editor:n,getPos:r,onClose:i,onNavigate:a}=e,c=r(),l=c==null?null:n.state.doc.nodeAt(c),u=String(l?.attrs.target??``),d=qe(l?.attrs.alias),f=qe(l?.attrs.anchor),p=nt({target:u,alias:d,anchor:f}),{addPage:m,assetPaths:h,filePaths:g,folderPaths:_,pages:v,pagesBySlug:y,pagesByBasename:b,loading:x}=Mn(),S=Ue(u,f),C=S?.kind===`external`?S:null,w=S?.kind===`asset`?AO(S.url,h,g)??S.url.replace(/^\//,``):null,T=w?null:pW(u,{pages:v,folderPaths:_,pagesBySlug:y,pagesByBasename:b,fallbackTargets:EO(u)}),[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(!1),{_:A}=s();if(!l)return null;let j;t[0]!==n.state||t[1]!==n.view||t[2]!==r?(j=function(e,t,i){let a=r();a!=null&&n.view.dispatch(n.state.tr.setNodeMarkup(a,void 0,{...n.state.doc.nodeAt(a)?.attrs,target:e,alias:t,anchor:i}))},t[0]=n.state,t[1]=n.view,t[2]=r,t[3]=j):j=t[3];let M=j,N;t[4]!==n.state||t[5]!==n.view||t[6]!==r||t[7]!==i?(N=function(){let e=r();if(e==null)return;let t=n.state.doc.nodeAt(e);t&&(n.view.dispatch(n.state.tr.delete(e,e+t.nodeSize)),i())},t[4]=n.state,t[5]=n.view,t[6]=r,t[7]=i,t[8]=N):N=t[8];let P=N,F=function(e){if(e!==u){let t=r();if(t==null)return;n.view.dispatch(n.state.tr.setNodeMarkup(t,void 0,{...n.state.doc.nodeAt(t)?.attrs,target:e,alias:d??p}))}},I=function(){return T?.kind===`create`?{initialDir:T.initialDir,suggestedName:T.suggestedName}:null},L=async function(){let e=I();if(!(!e||O)){k(!0);try{await EJ(e,{addPage:m,onCreated(e){F(e),window.location.hash=`#/${e}`,i()}}),k(!1)}catch(e){let t=e;Qn.error(t instanceof Error?t.message:A({id:`tfi40B`})),k(!1)}}},R=!C&&!x&&w!==null,z=!C&&!x&&T?.kind===`navigate`&&T.displayState===`resolved`,B=!C&&!x&&T?.kind===`navigate`&&T.displayState===`folder`,V=!C&&!x&&!w&&T?.kind===`create`,H=!!C,ee=C?CW(C.url)?C.url:null:R&&w?Cn(w):z&&T?.kind===`navigate`?EW({docName:T.hashDocName,anchor:f}):null,U=!x&&ee!==null&&(H||R||z),W,te,G,ne,re;if(t[9]!==A||t[10]!==d||t[11]!==f||t[12]!==w||t[13]!==n.state||t[14]!==n.view||t[15]!==C||t[16]!==r||t[17]!==R||t[18]!==B||t[19]!==z||t[20]!==V||t[21]!==x||t[22]!==u){if(x){let e;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(zn,{className:`size-3.5 shrink-0 animate-spin`,"aria-hidden":`true`}),t[28]=e):e=t[28],G={icon:e,text:A({id:`yQE2r9`}),className:`text-muted-foreground/80`}}else if(C){let e;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(wn,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),t[29]=e):e=t[29],G={icon:e,text:A({id:`hpDtUm`}),className:`text-muted-foreground`}}else if(R){let e;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(ea,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),t[30]=e):e=t[30],G={icon:e,text:A({id:`bUUVED`}),className:`text-muted-foreground`}}else if(B){let e;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(Bn,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),t[31]=e):e=t[31],G={icon:e,text:A({id:`kNqMMd`}),className:`text-muted-foreground`}}else if(V){let e;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(Wi,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),t[32]=e):e=t[32],G={icon:e,text:A({id:`8F1i42`}),className:`text-red-700 dark:text-red-300`}}else if(z){let e;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(ia,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),t[33]=e):e=t[33],G={icon:e,text:A({id:`Hrz9NY`}),className:`text-muted-foreground`}}else{let e;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(Wi,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),t[34]=e):e=t[34],G={icon:e,text:A({id:`DeDYLr`}),className:`text-muted-foreground/80`}}let e;t[35]!==n.state||t[36]!==n.view||t[37]!==r?(e=()=>{let e=r();if(typeof e!=`number`)return new DOMRect;let t=n.state.doc.nodeAt(e);if(!t)return new DOMRect;try{return At(n.view,e,e+t.nodeSize)}catch{return new DOMRect}},t[35]=n.state,t[36]=n.view,t[37]=r,t[38]=e):e=t[38];let i;t[39]!==n.view.dom||t[40]!==e?(i={getBoundingClientRect:e,contextElement:n.view.dom},t[39]=n.view.dom,t[40]=e,t[41]=i):i=t[41],re=i,te=w??(C?C.url:`${u}${f?`#${f}`:``}`);let a=f?`${u}#${f}`:u;W=d?`[[${a}|${d}]]`:`[[${a}]]`,ne=Xt(`flex shrink-0`,G.className),t[9]=A,t[10]=d,t[11]=f,t[12]=w,t[13]=n.state,t[14]=n.view,t[15]=C,t[16]=r,t[17]=R,t[18]=B,t[19]=z,t[20]=V,t[21]=x,t[22]=u,t[23]=W,t[24]=te,t[25]=G,t[26]=ne,t[27]=re}else W=t[23],te=t[24],G=t[25],ne=t[26],re=t[27];let ie;t[42]!==G.icon||t[43]!==ne?(ie=(0,X.jsx)(`span`,{className:ne,children:G.icon}),t[42]=G.icon,t[43]=ne,t[44]=ie):ie=t[44];let ae=ie,oe;t[45]!==ae||t[46]!==V||t[47]!==G.text?(oe=V?(0,X.jsxs)(xr,{children:[(0,X.jsx)(yr,{asChild:!0,children:(0,X.jsx)(`span`,{className:`flex shrink-0`,"data-slot":`wiki-link-prop-panel-icon-trigger`,children:ae})}),(0,X.jsx)(br,{children:G.text})]}):ae,t[45]=ae,t[46]=V,t[47]=G.text,t[48]=oe):oe=t[48];let se=oe,K=`${G.text}: ${te}`,ce;t[49]!==te||t[50]!==H||t[51]!==V||t[52]!==ee||t[53]!==U||t[54]!==i||t[55]!==a?(ce=(0,X.jsx)(yr,{asChild:!0,children:U?(0,X.jsx)(`a`,{href:ee??void 0,...H?{target:`_blank`,rel:`noopener noreferrer`}:{},onClick:e=>NW(e,a,i),"data-slot":`wiki-link-prop-panel-text`,className:`block truncate text-sm font-medium text-foreground underline-offset-2 hover:underline focus-visible:underline`,children:te}):(0,X.jsx)(`span`,{"data-slot":`wiki-link-prop-panel-text`,className:Xt(`block truncate text-sm font-medium`,V?`text-muted-foreground`:`text-foreground`),children:te})}),t[49]=te,t[50]=H,t[51]=V,t[52]=ee,t[53]=U,t[54]=i,t[55]=a,t[56]=ce):ce=t[56];let le;t[57]===te?le=t[58]:(le=(0,X.jsx)(br,{className:`max-w-80 break-all`,children:te}),t[57]=te,t[58]=le);let ue;t[59]!==ce||t[60]!==le?(ue=(0,X.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,X.jsxs)(xr,{children:[ce,le]})}),t[59]=ce,t[60]=le,t[61]=ue):ue=t[61];let de;t[62]!==L||t[63]!==O||t[64]!==V?(de=V?(0,X.jsxs)(en,{type:`button`,size:`sm`,variant:`link`,disabled:O,onClick:()=>void L(),"data-slot":`wiki-link-prop-panel-create`,className:`flex items-center text-foreground`,children:[(0,X.jsx)(Oa,{className:`size-3.5`,"aria-hidden":`true`}),O?(0,X.jsx)(o,{id:`HM56Bx`}):(0,X.jsx)(o,{id:`XRuL0i`})]}):null,t[62]=L,t[63]=O,t[64]=V,t[65]=de):de=t[65];let fe;t[66]===A?fe=t[67]:(fe=A({id:`ePK91l`}),t[66]=A,t[67]=fe);let pe;t[68]===D?pe=t[69]:(pe=()=>D(!0),t[68]=D,t[69]=pe);let me;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,X.jsx)(qn,{className:`size-3.5`,"aria-hidden":`true`}),t[70]=me):me=t[70];let he;t[71]!==fe||t[72]!==pe?(he=(0,X.jsx)(yr,{asChild:!0,children:(0,X.jsx)(en,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":fe,onClick:pe,"data-slot":`wiki-link-prop-panel-edit`,children:me})}),t[71]=fe,t[72]=pe,t[73]=he):he=t[73];let ge;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,X.jsx)(br,{children:(0,X.jsx)(o,{id:`ePK91l`})}),t[74]=ge):ge=t[74];let _e;t[75]===he?_e=t[76]:(_e=(0,X.jsxs)(xr,{children:[he,ge]}),t[75]=he,t[76]=_e);let ve;t[77]===W?ve=t[78]:(ve=(0,X.jsx)(YJ,{copyContent:W}),t[77]=W,t[78]=ve);let ye;t[79]===A?ye=t[80]:(ye=A({id:`t_YqKh`}),t[79]=A,t[80]=ye);let be;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,X.jsx)(Hn,{className:`size-3.5`,"aria-hidden":`true`}),t[81]=be):be=t[81];let xe;t[82]!==P||t[83]!==ye?(xe=(0,X.jsx)(yr,{asChild:!0,children:(0,X.jsx)(en,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":ye,onClick:P,"data-slot":`wiki-link-prop-panel-remove`,children:be})}),t[82]=P,t[83]=ye,t[84]=xe):xe=t[84];let Se;t[85]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,X.jsx)(br,{children:(0,X.jsx)(o,{id:`t_YqKh`})}),t[85]=Se):Se=t[85];let Ce;t[86]===xe?Ce=t[87]:(Ce=(0,X.jsxs)(xr,{children:[xe,Se]}),t[86]=xe,t[87]=Ce);let we;t[88]!==de||t[89]!==_e||t[90]!==ve||t[91]!==Ce?(we=(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[de,_e,ve,Ce]}),t[88]=de,t[89]=_e,t[90]=ve,t[91]=Ce,t[92]=we):we=t[92];let Te;t[93]!==se||t[94]!==ue||t[95]!==we?(Te=(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[se,ue,we]}),t[93]=se,t[94]=ue,t[95]=we,t[96]=Te):Te=t[96];let Ee;t[97]!==i||t[98]!==Te||t[99]!==K||t[100]!==re?(Ee=(0,X.jsx)(gJ,{kind:`wiki-link`,ariaLabel:K,onDeactivate:i,triggerReference:re,className:`w-96`,children:Te}),t[97]=i,t[98]=Te,t[99]=K,t[100]=re,t[101]=Ee):Ee=t[101];let De;t[102]!==d||t[103]!==f||t[104]!==h||t[105]!==E||t[106]!==g||t[107]!==M||t[108]!==x||t[109]!==v||t[110]!==D||t[111]!==u?(De=(0,X.jsx)(mQ,{open:E,target:u,alias:d,anchor:f,pages:v,assetPaths:h,filePaths:g,loading:x,onOpenChange:D,onSave:M}),t[102]=d,t[103]=f,t[104]=h,t[105]=E,t[106]=g,t[107]=M,t[108]=x,t[109]=v,t[110]=D,t[111]=u,t[112]=De):De=t[112];let Oe;return t[113]!==Ee||t[114]!==De?(Oe=(0,X.jsxs)(X.Fragment,{children:[Ee,De]}),t[113]=Ee,t[114]=De,t[115]=Oe):Oe=t[115],Oe}var gQ=0;function _Q(){return`wiki-link-${++gQ}`}function vQ(e){let t=e.doc??(typeof document<`u`?document:{createElement:null,createTextNode:null}),n=t.createElement(`span`);n.setAttribute(`data-wiki-link`,``),n.setAttribute(`data-node-id`,e.nodeId),n.setAttribute(`data-target`,e.target),n.setAttribute(`data-alias`,e.alias??``),n.setAttribute(`data-anchor`,e.anchor??``),n.setAttribute(`contenteditable`,`false`),n.setAttribute(`role`,`button`),n.setAttribute(`tabindex`,`0`),n.setAttribute(`aria-label`,`Wiki link: ${e.target}${e.anchor?`#${e.anchor}`:``}`),n.classList.add(`wiki-link-chip`),n.style.touchAction=`manipulation`;let r=t.createElement(`span`);r.setAttribute(`data-wiki-link-icon`,``),r.setAttribute(`aria-hidden`,`true`),n.appendChild(r);let i=e.alias??`${e.target}${e.anchor?`#${e.anchor}`:``}`,a=t.createTextNode(i);return n.appendChild(a),{dom:n,iconSpan:r}}function yQ(e,t){if(!t||!e)return null;let n=DO(e,t);if(!n)return null;let r=t.pageIcons?.get(n);if(!r)return null;let i=cQ(r);return i.kind===`unsupported`?null:i}function bQ(e,t,n=document){let r=t?.kind??``,i=t?.value??``;if(e.getAttribute(`data-kind`)===r&&e.getAttribute(`data-value`)===i)return;for(e.setAttribute(`data-kind`,r),e.setAttribute(`data-value`,i);e.firstChild;)e.removeChild(e.firstChild);if(!t)return;if(t.kind===`emoji`){e.appendChild(n.createTextNode(t.value));return}let a=n.createElement(`img`);a.setAttribute(`src`,t.value),a.setAttribute(`alt`,``),a.setAttribute(`draggable`,`false`),a.setAttribute(`referrerpolicy`,`no-referrer`),e.appendChild(a)}var xQ=z.extend({priority:200,addOptions(){return{...this.parent?.(),docName:``}},addNodeView(){return({editor:e,node:t,getPos:n})=>{let r=_Q(),{dom:i,iconSpan:a}=vQ({nodeId:r,target:String(t.attrs.target??``),alias:t.attrs.alias==null?null:String(t.attrs.alias),anchor:t.attrs.anchor==null?null:String(t.attrs.anchor)}),o=t,s=()=>{bQ(a,yQ(String(o.attrs.target??``),Fn()))};s();let c=Pn(s),l=()=>{let e=n();return typeof e==`number`?e:void 0},u=pk(e),d=({newTab:e})=>{let t=o.attrs,n=typeof t.target==`string`?t.target:``;if(!n)return!1;let r=Ue(n,typeof t.anchor==`string`?t.anchor:null);if(!r)return!1;if(r.kind===`doc`){let t=Fn(),i=pW(n,{pages:t?.pages??new Set,folderPaths:t?.folderPaths??new Set,pagesBySlug:t?.pagesBySlug,pagesByBasename:t?.pagesByBasename,fallbackTargets:EO(n)});if(i.kind===`create`||i.kind===`navigate`&&i.displayState===`folder`)return!1;let a=i.kind===`navigate`?i.hashDocName:r.docName;return e?kW({docName:a,anchor:r.anchor}):window.location.assign(EW({docName:a,anchor:r.anchor})),!0}if(r.kind===`asset`){let t=Fn(),n=AO(r.url,t?.assetPaths??new Set,t?.filePaths)??r.url.replace(/^\//,``);return e?DW(Cn(n)):window.location.hash=Cn(n),!0}return CW(r.url)?(DW(r.url),!0):!1};return u.register({type:`wikiLink`,nodeId:r,getPos:l,controls:{propPanel:t=>(0,Q.createElement)(hQ,{editor:e,getPos:l,onClose:t.deactivate,onNavigate:e=>d({newTab:e})})},handlePrimary:d}),{dom:i,ignoreMutation:()=>!0,update:e=>{if(e.type.name!==`wikiLink`)return!1;o=e;let t=String(e.attrs.target??``),n=e.attrs.alias==null?null:String(e.attrs.alias),r=e.attrs.anchor==null?null:String(e.attrs.anchor);i.setAttribute(`data-target`,t),i.setAttribute(`data-alias`,n??``),i.setAttribute(`data-anchor`,r??``),i.setAttribute(`aria-label`,`Wiki link: ${t}${r?`#${r}`:``}`);let a=n??`${t}${r?`#${r}`:``}`,c=i.lastChild;return c&&c.nodeType===3?c.nodeValue=a:i.appendChild(i.ownerDocument.createTextNode(a)),s(),!0},destroy:()=>{u.deregister(r),c()}}}},addKeyboardShortcuts(){return{Backspace:()=>{if(sG.getState(this.editor.state)?.active)return!1;let{selection:e}=this.editor.state;if(!e.empty)return!1;let t=e.$from.nodeBefore;if(t?.type.name===`wikiLink`){let{state:n,view:r}=this.editor;return r.dispatch(n.tr.delete(e.from-t.nodeSize,e.from)),!0}return!1},Delete:()=>{if(sG.getState(this.editor.state)?.active)return!1;let{selection:e}=this.editor.state;if(!e.empty)return!1;let t=e.$from.nodeAfter;if(t?.type.name===`wikiLink`){let{state:n,view:r}=this.editor;return r.dispatch(n.tr.delete(e.from,e.from+t.nodeSize)),!0}return!1}}},addProseMirrorPlugins(){return[MG(this.editor)]}}),SQ=0;function CQ(){return`wiki-link-embed-${++SQ}`}function wQ(e){let t=e.doc??(typeof document<`u`?document:{createElement:null,createTextNode:null}),n=t.createElement(`a`);n.setAttribute(`data-wiki-embed`,``),n.setAttribute(`data-node-id`,e.nodeId),n.setAttribute(`data-target`,e.target),n.setAttribute(`data-alias`,e.alias??``),n.setAttribute(`data-anchor`,e.anchor??``),n.setAttribute(`href`,e.href),n.setAttribute(`target`,`_blank`),n.setAttribute(`rel`,`noopener noreferrer`),n.setAttribute(`contenteditable`,`false`),n.setAttribute(`role`,`button`),n.setAttribute(`tabindex`,`0`),n.setAttribute(`aria-label`,`Embed: ${e.target}${e.anchor?`#${e.anchor}`:``}`),n.classList.add(`wiki-link-embed-chip`),n.style.touchAction=`manipulation`;let r=e.alias??`${e.target}${e.anchor?`#${e.anchor}`:``}`,i=t.createTextNode(r);return n.appendChild(i),{dom:n}}function TQ(e){let t=(e.doc??(typeof document<`u`?document:{createElement:null})).createElement(`img`);return t.setAttribute(`data-wiki-embed`,``),t.setAttribute(`data-node-id`,e.nodeId),t.setAttribute(`data-target`,e.target),t.setAttribute(`data-alias`,e.alias??``),t.setAttribute(`src`,d(e.src)),t.setAttribute(`alt`,e.alias??e.target),{dom:t}}function EQ(e){let t=m(e);return t!==null&&de.has(t)}var DQ=oe.extend({addNodeView(){return({editor:e,node:t,getPos:n})=>{let r=CQ(),i=t,a=String(t.attrs.target??``),o=t.attrs.alias==null?null:String(t.attrs.alias),s=t.attrs.anchor==null?null:String(t.attrs.anchor),c=t.attrs.resolvedSrc==null?null:String(t.attrs.resolvedSrc);if(EQ(a)){let{dom:e}=TQ({nodeId:r,target:a,alias:o,src:c??a});return{dom:e,ignoreMutation:()=>!0,update:t=>{if(t.type.name!==`wikiLinkEmbed`)return!1;i=t;let n=String(t.attrs.target??``),r=t.attrs.alias==null?null:String(t.attrs.alias),a=t.attrs.resolvedSrc==null?null:String(t.attrs.resolvedSrc);if(!EQ(n))return!1;let o=a??n;return e.setAttribute(`data-target`,n),e.setAttribute(`data-alias`,r??``),e.setAttribute(`src`,d(o)),e.setAttribute(`alt`,r??n),!0}}}let{dom:l}=wQ({nodeId:r,target:a,alias:o,anchor:s,href:c??a});l.addEventListener(`click`,e=>{e.preventDefault()});let u=()=>{let e=n();return typeof e==`number`?e:void 0},f=pk(e);return f.register({type:`wikiLinkEmbed`,nodeId:r,getPos:u,controls:{},handlePrimary:({newTab:e})=>{let t=i.attrs,n=typeof t.target==`string`?t.target:``;if(!n)return!1;let r=(typeof t.resolvedSrc==`string`&&t.resolvedSrc.length>0?t.resolvedSrc:null)??n,a=m(n);if(a===null)return!1;let o=h(r,``)??n;return jW({url:r,projectRelPath:o,ext:a,title:o.split(`/`).pop()??r,newTab:e}),!0}}),{dom:l,ignoreMutation:()=>!0,update:e=>{if(e.type.name!==`wikiLinkEmbed`)return!1;i=e;let t=String(e.attrs.target??``);if(EQ(t))return!1;let n=e.attrs.alias==null?null:String(e.attrs.alias),r=e.attrs.anchor==null?null:String(e.attrs.anchor),a=(e.attrs.resolvedSrc==null?null:String(e.attrs.resolvedSrc))??t;return l.setAttribute(`data-target`,t),l.setAttribute(`data-alias`,n??``),l.setAttribute(`data-anchor`,r??``),l.setAttribute(`href`,a),l.setAttribute(`aria-label`,`Embed: ${t}${r?`#${r}`:``}`),l.textContent=n??`${t}${r?`#${r}`:``}`,!0},destroy:()=>{f.deregister(r)}}}}}),OQ=[..._.map(e=>{if(e.name===`jsxComponent`)return xZ;if(e.name===`image`){let t=e.options??{};return fJ.configure({...t,inline:!0})}return e.name===`rawMdxFallback`?MZ:e.name===`wikiLink`?xQ:e.name===`wikiLinkEmbed`?DQ:e.name===`link`?dY:e.name===`mathInline`?kZ:e.name===`tag`?aQ:e.name===`codeBlock`?fq:e}),LZ.configure({itemsSources:[QM,UM,ZM,KM],categoryLabels:{content:`Components`,layout:`Layout`,media:`Media`,data:`Data`,embed:`Embeds`}}),lJ,VZ,YD.configure({onDrop(e,t,n){for(let r of t)UO(r,e,n)},onPaste(e,t,n){for(let n of t)UO(n,e,e.state.selection.from)}}),uJ,hO,$Z,cJ,oJ,rN,YZ,zZ,$D,cN,BX,F.create({name:`chunkWrapperDecoration`,addProseMirrorPlugins(){return[mN()]}})];function kQ(e){return e===Wt}function AQ(){return Sc(`SYNC_TIMEOUT_MS`,3e4)}var jQ=class extends Error{docName;elapsedMs;constructor(e,t){super(`Sync timed out for "${e}" after ${t}ms`),this.name=`SyncTimeoutError`,this.docName=e,this.elapsedMs=t}},MQ=class extends Error{docName;constructor(e){super(`Provider disconnected before sync for "${e}"`),this.name=`PreSyncDisconnectError`,this.docName=e}},NQ=class extends Error{docName;constructor(e){super(`Document not found: "${e}"`),this.name=`DocumentNotFoundError`,this.docName=e}},PQ=class extends Error{docName;cause;constructor(e,t){let n=t instanceof Error?t.message:String(t??`unknown`);super(`Bridge setup failed for "${e}": ${n}`),this.name=`BridgeSetupError`,this.docName=e,this.cause=t}},FQ=class extends Error{docName;missingCapability;constructor(e,t){super(`Server is missing capability "${t}" required to open "${e}".`),this.name=`ServerCapabilityMismatchError`,this.docName=e,this.missingCapability=t}},IQ=new Map,LQ=!1;function RQ(){for(let e of IQ.values())if(!e.settled)return!0;return!1}function zQ(){typeof document>`u`||document.visibilityState===`visible`&&BQ(Date.now())}function BQ(e){let t=[];for(let[n,r]of IQ){if(r.settled)continue;let i=e-r.createdAt;if(i<AQ())continue;r.settled=!0;let a=new jQ(n,i);WQ(r),r.reject(a);let o=TS(n);o!==void 0&&IS(o),t.push({docName:n,elapsedMs:i})}if(t.length>0){let e=t.map(e=>`${e.docName} (${e.elapsedMs}ms)`).join(`, `);console.warn(`[syncPromise] reaped ${t.length} timed-out ${t.length===1?`entry`:`entries`} on visibility restore (tab-sleep recovered): ${e}`)}return RQ()||HQ(),t.length}function VQ(){LQ||typeof document>`u`||(document.addEventListener(`visibilitychange`,zQ),LQ=!0)}function HQ(){LQ&&(typeof document>`u`||(document.removeEventListener(`visibilitychange`,zQ),LQ=!1))}var UQ=new Map;function WQ(e){e.detached||(e.detached=!0,e.timeoutHandle!==null&&clearTimeout(e.timeoutHandle),e.provider.off(`synced`,e.onSynced),e.provider.off(`close`,e.onClose))}function GQ(e,t){let n=IQ.get(e);if(n)return n.promise;let r=UQ.get(e);if(r!==void 0){UQ.delete(e);let n=r===`timeout`?new jQ(e,0):new MQ(e);console.warn(`[syncPromise] ${e} rejected on creation (test hook, armed ${r}): ${n.message}`),$(`ok/sync/create`,{docName:e,mountId:TS(e),warm:!1,armed:r}),$(`ok/sync/reject`,{docName:e,mountId:TS(e),reason:`armed-${r}`});let i=qQ(n);return IQ.set(e,JQ(i,t)),i}if(t.synced){console.log(`[syncPromise] ${e} resolved synchronously (warm provider)`);let n=TS(e);$(`ok/sync/create`,{docName:e,mountId:n,warm:!0}),$(`ok/sync/resolve`,{docName:e,mountId:n,elapsedMs:0,warm:!0}),$.histogram(`ok/sync/resolve-elapsed-ms`,n===void 0?{docName:e,warm:!0}:{docName:e,mountId:n,warm:!0},0);let r=Promise.resolve();return IQ.set(e,KQ(r,t)),r}let i=Date.now(),a=()=>{},o=()=>{},s=new Promise((e,t)=>{a=e,o=t}),c=()=>{let t=IQ.get(e);if(!t||t.settled)return;t.settled=!0,t.resolved=!0;let n=Date.now()-t.createdAt;console.log(`[syncPromise] ${e} resolved in ${n}ms`);let r=TS(e);if($(`ok/sync/resolve`,{docName:e,mountId:r,elapsedMs:n,warm:!1}),$.histogram(`ok/sync/resolve-elapsed-ms`,r===void 0?{docName:e}:{docName:e,mountId:r},n),WQ(t),RQ()||HQ(),t.resolve(),r!==void 0){let i=Date.now();FS(r,`ok.sync-promise`,{"doc.name":e,elapsed_ms:n},t.createdAt,i),IS(r,i)}},l=t=>{let n=IQ.get(e);if(!n||n.settled)return;n.settled=!0;let r=new MQ(e);console.warn(`[syncPromise] ${e} rejected: ${r.message}`);let i=TS(e);$(`ok/sync/reject`,{docName:e,mountId:i,reason:`pre-sync-disconnect`}),WQ(n),RQ()||HQ(),n.reject(r),i!==void 0&&IS(i)},u=setTimeout(()=>{let t=IQ.get(e);if(!t||t.settled)return;t.settled=!0;let n=Date.now()-t.createdAt,r=new jQ(e,n);console.warn(`[syncPromise] ${e} rejected: ${r.message}`);let i=TS(e);$(`ok/sync/reject`,{docName:e,mountId:i,reason:`timeout`,elapsedMs:n}),WQ(t),RQ()||HQ(),t.reject(r),i!==void 0&&IS(i)},AQ()),d={promise:s,resolve:a,reject:o,createdAt:i,timeoutHandle:u,provider:t,onSynced:c,onClose:l,settled:!1,resolved:!1,detached:!1};return IQ.set(e,d),t.on(`synced`,c),t.on(`close`,l),VQ(),$(`ok/sync/create`,{docName:e,mountId:TS(e),warm:!1}),s}function KQ(e,t){return{promise:e,resolve:()=>{},reject:()=>{},createdAt:Date.now(),timeoutHandle:null,provider:t,onSynced:()=>{},onClose:()=>{},settled:!0,resolved:!0,detached:!0}}function qQ(e){let t=Promise.reject(e);t.catch(()=>{});let n=t;return n.status=`rejected`,n.reason=e,n}function JQ(e,t){return{promise:e,resolve:()=>{},reject:()=>{},createdAt:Date.now(),timeoutHandle:null,provider:t,onSynced:()=>{},onClose:()=>{},settled:!0,resolved:!1,detached:!0}}function YQ(e){return IQ.get(e)?.resolved===!0}function XQ(e){let t=IQ.get(e);t&&(t.settled=!0,WQ(t),IQ.delete(e),RQ()||HQ())}function ZQ(e,t){let n=IQ.get(e);if(!n||n.settled)return!1;n.settled=!0,console.warn(`[syncPromise] ${e} rejected: ${t.message}`),WQ(n),RQ()||HQ(),n.reject(t);let r=TS(e);return r!==void 0&&IS(r),!0}var QQ=Object.freeze({kind:`tab-replay`}),$Q=Object.freeze({kind:`idle`});function e$(e,t){return()=>{}}var t$=null;function n$(){return t$??=pt(OQ),t$}var r$=4e3,i$=1e4,a$=class extends Error{constructor(e,t){super(`client persistence clearData timed out for ${e} after ${t}ms`),this.docName=e,this.timeoutMs=t,this.name=`ClientPersistenceClearTimeoutError`}},o$=class extends Error{constructor(e,t){super(`stored-state epoch peek timed out for ${e} after ${t}ms`),this.docName=e,this.timeoutMs=t,this.name=`StoredEpochPeekTimeoutError`}},s$=`ok-last-observed-branch`,c$=`ok-doc-lineage-epochs`,l$=5e3,u$=Sc(`MAX_BUFFER_BYTES`,1*1024*1024),d$=Sc(`MAX_POOL`,10),f$=class{_entries=new Map;get entries(){return this._entries}lruOrder=[];activeDocName=null;maxSize;wsUrl;recycleDebounceMs;clearDataTimeoutMs;onChange=null;tabIdentity=null;serverRestartRecoveryState=$Q;cachedServerInstanceId=null;pendingServerInstanceKnown=null;recoveryMismatchStaleClaim;bufferedUpdates=new Map;pendingClears=new Map;clearFailures=new Set;persistenceFactory;peekStoredEpoch;storage;constructor(e,t,n){this.maxSize=e,this.wsUrl=t,this.recycleDebounceMs=n?.recycleDebounceMs??r$,this.clearDataTimeoutMs=n?.clearDataTimeoutMs??i$,this.persistenceFactory=n?.persistenceFactory??HD,this.peekStoredEpoch=n?.peekStoredLineageEpoch??UD,n?.storage===void 0?this.storage=globalThis.localStorage===void 0?null:globalThis.localStorage:this.storage=n.storage}setTabIdentity(e){this.tabIdentity=e}setExpectedServerInstanceId(e){if(this.cachedServerInstanceId=e,!(e===null||e.length===0)){if(this.pendingServerInstanceKnown!==null){let t=this.pendingServerInstanceKnown;this.pendingServerInstanceKnown=null,t.resolve(e)}this.attachDeferredPersistence(e)}}whenServerInstanceKnown(){if(this.cachedServerInstanceId!==null&&this.cachedServerInstanceId.length>0)return Promise.resolve(this.cachedServerInstanceId);if(this.pendingServerInstanceKnown!==null)return this.pendingServerInstanceKnown.promise;let e,t=new Promise(t=>{e=t});return this.pendingServerInstanceKnown={promise:t,resolve:e},t}buildPersistence(e,t,n){return this.persistenceFactory({branch:this.normalizedObservedBranch(),serverInstanceId:e,docName:t,doc:n})}async validateStoredStateThenAttach(e,t){if(e.persistenceAttachOwned)return;e.persistenceAttachOwned=!0;let n=e.docName,r=()=>this._entries.get(n)===e&&e.kind===`active`&&e.persistence===null&&!this.pendingClears.has(n);if(!r())return;let i;try{i=await new Promise((e,r)=>{let i=setTimeout(()=>{r(new o$(n,this.clearDataTimeoutMs))},this.clearDataTimeoutMs);this.peekStoredEpoch({branch:this.normalizedObservedBranch(),serverInstanceId:t,docName:n}).then(t=>{clearTimeout(i),e(t)},e=>{clearTimeout(i),r(e)})})}catch(e){this.emitStructuredClientRecoveryEvent({event:`ok-client-persistence-attach-failed`,...this.recoveryTelemetryBase(n),phase:`peek`,errorName:e instanceof Error?e.name:`non-error-throw`,errorMessage:e instanceof Error?e.message:String(e)});return}if(!r())return;if(i===null){this.attachValidatedPersistence(e,t);return}if(!e.hasSynced&&(await this.awaitFirstSyncOrDestroy(e),!r()||!e.hasSynced))return;let a=e.provider.document.getMap(`lifecycle`).get(bt),o=typeof a==`string`&&a.length>0?a:null;if(o===i){this.attachValidatedPersistence(e,t);return}this.emitStructuredClientRecoveryEvent({event:`ok-doc-lineage-mismatch`,...this.recoveryTelemetryBase(n),via:`stored-state-validation`,staleEpoch:i,liveEpoch:o??`<absent>`});let s=this.activeDocName===n;this.runCloseAndClearPersistence(n),this.open(n)!==null&&s&&this.setActive(n)}attachValidatedPersistence(e,t){let n=e.docName;try{let r=this.buildPersistence(t,n,e.provider.document);e.persistence=r,this.notify(),this.backfillCacheAfterFirstSync(e,r).catch(e=>{this.emitStructuredClientRecoveryEvent({event:`ok-client-persistence-attach-failed`,...this.recoveryTelemetryBase(n),phase:`backfill`,errorName:e instanceof Error?e.name:`non-error-throw`,errorMessage:e instanceof Error?e.message:String(e)})})}catch(e){this.emitStructuredClientRecoveryEvent({event:`ok-client-persistence-attach-failed`,...this.recoveryTelemetryBase(n),phase:`attach`,errorName:e instanceof Error?e.name:`non-error-throw`,errorMessage:e instanceof Error?e.message:String(e)})}}async backfillCacheAfterFirstSync(e,t){await t.whenSynced,e.hasSynced||await this.awaitFirstSyncOrDestroy(e),!(this._entries.get(e.docName)!==e||e.kind!==`active`||e.persistence!==t||!e.hasSynced)&&await t.flushFullState()}async awaitFirstSyncOrDestroy(e){e.hasSynced||await new Promise(t=>{let n=()=>{e.provider.off(`synced`,n),e.provider.off(`destroy`,n),t()};e.provider.on(`synced`,n),e.provider.on(`destroy`,n)})}attachDeferredPersistence(e){for(let t of Array.from(this._entries.values()))if(t.kind===`active`&&t.persistence===null&&this._entries.get(t.docName)===t){if(t.hasSynced&&t.lineageEpochRecordAtOpen!==null){let e=t.provider.document.getMap(`lifecycle`).get(bt);if(typeof e==`string`&&e.length>0&&e!==t.lineageEpochRecordAtOpen){let n=t.docName;this.emitStructuredClientRecoveryEvent({event:`ok-doc-lineage-mismatch`,...this.recoveryTelemetryBase(n),via:`deferred-attach`,staleEpoch:t.lineageEpochRecordAtOpen,liveEpoch:e});let r=this.activeDocName===n;this.runCloseAndClearPersistence(n),this.open(n)!==null&&r&&this.setActive(n);continue}}this.validateStoredStateThenAttach(t,e)}}getServerRestartRecoveryState(){return this.serverRestartRecoveryState}observeDiskAck(e,t){let n=this.entries.get(e);!n||n.kind!==`active`||(n.lastDiskAckedSV=KD(n.lastDiskAckedSV,t))}observeDiskAckBatch(e){for(let[t,n]of Object.entries(e))this.observeDiskAck(t,n)}lastObservedBranch=null;lastObservedBranchInitialized=!1;getOrInitObservedBranch(){if(this.lastObservedBranchInitialized)return this.lastObservedBranch;this.lastObservedBranchInitialized=!0;try{let e=this.storage?.getItem(s$)??null;e!==null&&e.length>0&&(this.lastObservedBranch=e)}catch{}return this.lastObservedBranch}persistObservedBranch(e){this.lastObservedBranch=e,this.lastObservedBranchInitialized=!0;try{e===null||e.length===0?this.storage?.removeItem(s$):this.storage?.setItem(s$,e)}catch{}}docLineageEpochs=new Map;docLineageEpochsEnvelopeConsumed=!1;normalizedObservedBranch(){return this.getOrInitObservedBranch()??`_unknown_`}consumeLineageEpochEnvelopeIfValid(){if(this.docLineageEpochsEnvelopeConsumed)return;let e=this.cachedServerInstanceId;if(!(e===null||e.length===0)){this.docLineageEpochsEnvelopeConsumed=!0;try{let t=this.storage?.getItem(c$)??null;if(t===null)return;let n=JSON.parse(t);if(typeof n!=`object`||!n)return;let r=n;if(r.branch!==this.normalizedObservedBranch()||r.serverInstanceId!==e||typeof r.epochs!=`object`||r.epochs===null)return;for(let[e,t]of Object.entries(r.epochs))typeof t==`string`&&t.length>0&&!this.docLineageEpochs.has(e)&&this.docLineageEpochs.set(e,t)}catch(e){e instanceof DOMException||console.warn(JSON.stringify({event:`ok-lineage-epoch-envelope-read-error`,errorName:e instanceof Error?e.name:typeof e,message:e instanceof Error?e.message:String(e)}))}}}getRecordedLineageEpoch(e){let t=this.docLineageEpochs.get(e);return t===void 0?(this.consumeLineageEpochEnvelopeIfValid(),this.docLineageEpochs.get(e)??null):t}persistLineageEpochEnvelope(){let e=this.cachedServerInstanceId;if(!(e===null||e.length===0))try{this.storage?.setItem(c$,JSON.stringify({branch:this.normalizedObservedBranch(),serverInstanceId:e,epochs:Object.fromEntries(this.docLineageEpochs)}))}catch{}}recordLineageEpoch(e,t){this.docLineageEpochs.get(e)!==t&&(this.docLineageEpochs.set(e,t),this.persistLineageEpochEnvelope())}deleteLineageEpochRecord(e){this.docLineageEpochs.delete(e)&&this.persistLineageEpochEnvelope()}withClearDataTimeout(e,t){return new Promise((n,r)=>{let i=setTimeout(()=>{r(new a$(e,this.clearDataTimeoutMs))},this.clearDataTimeoutMs);t.then(()=>{clearTimeout(i),n()},e=>{clearTimeout(i),r(e)})})}recoveryTelemetryBase(e,t){let n={docName:e,branch:this.normalizedObservedBranch()},r=t===void 0?this.recoveryMismatchStaleClaim:t;return r!==void 0&&r.length>0&&(n.serverInstanceId=r),n}emitStructuredClientRecoveryEvent(e){console.warn(JSON.stringify(e))}clearRecoveryMismatchStaleClaimIfTerminal(){let e=this.serverRestartRecoveryState.kind;(e===`idle`||e===`failed`)&&(this.recoveryMismatchStaleClaim=void 0)}beginServerRestartRecovery(e,t){this.serverRestartRecoveryState={kind:`recovering`,phase:`clearing-local-cache`,docNames:e,failedDocNames:[],startedAt:t};for(let t of e)XQ(t);this.notify()}enterServerRestartReconnect(e,t,n,r){if(e.length===0){this.serverRestartRecoveryState=t.length===0?$Q:{kind:`failed`,reason:r,docNames:t,failedDocNames:t,startedAt:n},this.clearRecoveryMismatchStaleClaimIfTerminal(),this.notify();return}this.serverRestartRecoveryState={kind:`recovering`,phase:`reconnecting`,docNames:e,failedDocNames:t,startedAt:n,...t.length>0?{clearFailureReason:r}:{}},this.notify()}markServerRestartRecoverySynced(e){let t=this.serverRestartRecoveryState;if(t.kind!==`recovering`||t.phase!==`reconnecting`||!t.docNames.includes(e))return;let n=t.docNames.filter(t=>t!==e);if(n.length>0){this.serverRestartRecoveryState={...t,docNames:n};return}if(t.failedDocNames.length>0){this.serverRestartRecoveryState={kind:`failed`,reason:t.clearFailureReason??`clear-data-failed`,docNames:t.failedDocNames,failedDocNames:t.failedDocNames,startedAt:t.startedAt},this.clearRecoveryMismatchStaleClaimIfTerminal();return}this.serverRestartRecoveryState=$Q,this.clearRecoveryMismatchStaleClaimIfTerminal()}setObservedBranch(e){this.persistObservedBranch(e)}compareAndUpdateObservedBranch(e){let t=this.getOrInitObservedBranch();return this.persistObservedBranch(e),t!==null&&t!==e}onBranchMismatch=null;branchMismatchInFlight=null;mismatchInFlight=null;setOnBranchMismatch(e){if(e===null){this.onBranchMismatch=null;return}this.onBranchMismatch=()=>{if(this.branchMismatchInFlight!==null)return;let t=Promise.resolve().then(e).finally(()=>{this.branchMismatchInFlight===t&&(this.branchMismatchInFlight=null)});this.branchMismatchInFlight=t}}onRenameRedirect=null;onDocDeleted=null;setOnRenameRedirect(e){this.onRenameRedirect=e}setOnDocDeleted(e){this.onDocDeleted=e}setOnChange(e){this.onChange=e}notify(){this.onChange?.()}evictListeners=new Set;onEvict(e){return this.evictListeners.add(e),()=>{this.evictListeners.delete(e)}}fireEvict(e){for(let t of this.evictListeners)try{t(e)}catch(t){console.warn(`[ProviderPool] evict listener threw for ${e}:`,t)}}touch(e){let t=this.lruOrder.indexOf(e);t!==-1&&this.lruOrder.splice(t,1),this.lruOrder.push(e)}open(e){if(kQ(e))return null;let t=this.entries.get(e);if(t){let n=t.lastAccessedAt;return t.lastAccessedAt=Date.now(),this.touch(e),this.notify(),$(`ok/pool/open`,{docName:e,hit:!0,lastAccessedAt:n,poolEventId:t.poolEventId}),$.count(`ok/pool/open`,{hit:!0}),t}let n=Date.now();this.entries.size>=this.maxSize&&this.evictLru();let r=this.cachedServerInstanceId,i=this.getRecordedLineageEpoch(e),a=mD(this.tabIdentity,r,this.getOrInitObservedBranch(),r!==null&&r.length>0?i:null),o=new pD({url:qD(this.wsUrl),name:e,forceSyncInterval:l$,token:a}),s=this.cachedServerInstanceId;this.clearFailures.has(e)&&this.runCloseAndClearPersistence(e);let c=this.pendingClears.get(e),l=s!==null&&s.length>0&&c===void 0&&i!==null?this.buildPersistence(s,e,o.document):null,u=crypto.randomUUID(),d={kind:`active`,provider:o,persistence:l,lastServerSyncedSV:null,lastDiskAckedSV:null,observerCleanup:null,observerFireCounterCleanup:e$(o.document,e),syncState:`connecting`,docName:e,lastAccessedAt:Date.now(),poolEventId:u,hasSynced:!1,pendingRecycleTimer:null,bridgeSetupFailed:!1,serverDrivenCloseReauthInFlight:!1,persistenceAttachOwned:!1,lineageEpochRecordAtOpen:i};if($(`ok/pool/open`,{docName:e,hit:!1,poolEventId:u}),$.count(`ok/pool/open`,{hit:!1}),o.on(`status`,({status:t})=>{d.kind!==`active`||this.entries.get(e)!==d||t===`disconnected`&&(d.syncState=`disconnected`,this.notify())}),o.on(`synced`,()=>{if(d.kind!==`active`||this.entries.get(e)!==d)return;d.syncState=`synced`,d.hasSynced=!0,d.lastServerSyncedSV=WD(o.document);let t=o.document.getMap(`lifecycle`).get(bt);if(typeof t==`string`&&t.length>0&&this.recordLineageEpoch(e,t),d.pendingRecycleTimer&&=(clearTimeout(d.pendingRecycleTimer),null),this.markServerRestartRecoverySynced(e),this.notify(),!d.observerCleanup)try{let t=o.document,n=new G({extensions:OQ});d.observerCleanup=qU({doc:t,xmlFragment:t.getXmlFragment(`default`),ytext:t.getText(`source`),mdManager:n,schema:n$(),onSyncError:(t,n)=>{console.warn(`[Sync] ${t} failed for ${e}:`,n.message)}})}catch(t){console.error(`[ProviderPool] setupObservers init failed for ${e}:`,t),d.bridgeSetupFailed=!0,ZQ(e,new PQ(e,t))}}),o.on(`disconnect`,()=>{d.kind!==`active`||this.entries.get(e)!==d||(d.syncState=`disconnected`,this.notify(),d.hasSynced&&o.unsyncedChanges===0&&!d.pendingRecycleTimer&&(d.pendingRecycleTimer=setTimeout(()=>{d.kind===`active`&&(d.pendingRecycleTimer=null,this.entries.get(e)===d&&this.recycleDisconnectedEntry(e))},this.recycleDebounceMs)))}),o.on(`authenticationFailed`,({reason:t})=>{let n=[`server-instance-mismatch`,`branch-mismatch`,`rename-redirect`,`doc-deleted`,`doc-lineage-mismatch`],i=t.indexOf(`:`),a=i===-1?t:t.slice(0,i);if(!n.includes(a)){console.warn(JSON.stringify({event:`ok-auth-failed-unknown-reason`,reason:t}));return}let o=i===-1?``:t.slice(i+1),s=o.length>0?o:void 0,c=a;if(c===`server-instance-mismatch`){if(r===null||this.cachedServerInstanceId!==r)return;let e=r;this.cachedServerInstanceId=null,this.handleServerInstanceMismatch(e);return}if(c===`branch-mismatch`){this.onBranchMismatch?.();return}if(c===`rename-redirect`){if(s===void 0||s.length===0){console.warn(JSON.stringify({event:`rename-redirect-missing-payload`,fromDocName:e}));return}let t=e,n=s;this.deleteLineageEpochRecord(t);let r=this.entries.get(t),i=r!==void 0&&r.kind===`active`;this.onRenameRedirect?.({fromDocName:t,toDocName:n,hadOpenProvider:i});return}if(c===`doc-deleted`){this.deleteLineageEpochRecord(e);let t=this.entries.get(e),n=t!==void 0&&t.kind===`active`;this.onDocDeleted?.({docName:e,hadOpenProvider:n});return}if(c===`doc-lineage-mismatch`){if(d.kind!==`active`||this.entries.get(e)!==d)return;this.deleteLineageEpochRecord(e),this.emitStructuredClientRecoveryEvent({event:`ok-doc-lineage-mismatch`,...this.recoveryTelemetryBase(e),via:`auth-rejection`,staleEpoch:d.lineageEpochRecordAtOpen??``});let t=this.activeDocName===e;this.runCloseAndClearPersistence(e),this.open(e)!==null&&t&&this.setActive(e);return}}),o.on(`close`,({event:t})=>{if(d.kind!==`active`||this.entries.get(e)!==d||d.serverDrivenCloseReauthInFlight)return;d.serverDrivenCloseReauthInFlight=!0,o.sendToken().catch(t=>{console.warn(JSON.stringify({event:`ok-provider-server-driven-close-reauth-failed`,docName:e,message:t instanceof Error?t.message:String(t)}))}).finally(()=>{d.kind===`active`&&this.entries.get(e)===d&&(d.serverDrivenCloseReauthInFlight=!1)});let n=t?.reason??`<unknown>`;console.info(JSON.stringify({event:`ok-provider-server-driven-close-reauth`,docName:e,reason:n}))}),this.bufferedUpdates.get(e)!==void 0){let t=this.recoveryMismatchStaleClaim,n=()=>{if(o.off(`synced`,n),d.kind!==`active`||this.entries.get(e)!==d)return;let r=this.bufferedUpdates.get(e);if(r!==void 0){this.bufferedUpdates.delete(e);try{dh(o.document,r,QQ)}catch(n){let i=n instanceof Error?n.name:`non-error-throw`;this.emitStructuredClientRecoveryEvent({event:`ok-buffer-replay-failed`,...this.recoveryTelemetryBase(e,t),replayByteLength:r.byteLength,errorName:i,errorMessage:n instanceof Error?n.message:String(n)})}}};o.on(`synced`,n)}if(this._entries.set(e,d),this.touch(e),this.notify(),l===null&&s!==null&&s.length>0&&c===void 0&&this.validateStoredStateThenAttach(d,s),c!==void 0&&s!==null&&s.length>0){let t=s;c.then(()=>{this.attachDeferredPersistenceForEntry(d,t)},t=>{console.warn(JSON.stringify({event:`ok-pool-deferred-persistence-attach-skipped`,docName:e,reason:`pending-clear-failed`,message:t instanceof Error?t.message:String(t)}))})}let f=TS(e);return f!==void 0&&FS(f,`ok.provider-pool.open`,{"doc.name":e},n,Date.now()),d}attachDeferredPersistenceForEntry(e,t){let n=this._entries.get(e.docName);n!==e||n.kind!==`active`||n.persistence!==null||this.validateStoredStateThenAttach(n,t)}handleServerInstanceMismatch(e){this.recoveryMismatchStaleClaim=e.length>0?e:void 0;let t=Array.from(this.entries.entries()),n=Date.now(),r=this.activeDocName,i=r!==null&&t.some(([e,t])=>e===r&&t.kind===`active`)?[r]:[],a=r??t.find(([,e])=>e.kind===`active`)?.[0]??``;a.length>0&&this.emitStructuredClientRecoveryEvent({event:`ok-client-cache-epoch-mismatch`,...this.recoveryTelemetryBase(a)}),this.beginServerRestartRecovery(i,n);for(let[e,n]of t)n.kind===`active`&&!i.includes(e)&&XQ(e);for(let[e,n]of t){if(n.kind!==`active`)continue;let t=n.lastDiskAckedSV??n.lastServerSyncedSV;if(t===null){this.emitStructuredClientRecoveryEvent({event:`ok-buffer-replay-skipped-no-baseline`,...this.recoveryTelemetryBase(e),reason:`no-disk-ack-or-server-sync-vector`});continue}let r=GD(n.provider.document,t);if(r.byteLength>u$){$(`ok/pool/buffer-overflow`,{docName:e,bytes:r.byteLength});continue}r.byteLength>0&&this.bufferedUpdates.set(e,r)}let o=[];for(let[e,n]of t)n.kind===`active`&&n.persistence!==null&&o.push({docName:e,promise:this.withClearDataTimeout(e,n.persistence.clearData())});let s=Promise.allSettled(o.map(e=>e.promise)).then(e=>{let t=[],i=[],a=!1;e.forEach((e,n)=>{let r=o[n];if(!r)return;let s=r.docName;if(e.status===`rejected`){t.push(s);let n=e.reason instanceof a$;if(n&&(a=!0),n)this.emitStructuredClientRecoveryEvent({event:`ok-client-cache-clear-failed`,...this.recoveryTelemetryBase(s),failureKind:`timeout`});else{let t=e.reason instanceof Error?e.reason.name:`unknown`;this.emitStructuredClientRecoveryEvent({event:`ok-client-cache-clear-failed`,...this.recoveryTelemetryBase(s),failureKind:`rejected`,errorName:t,errorMessage:e.reason instanceof Error?e.reason.message:String(e.reason)})}}else i.push(s)});let s=i.filter(e=>e===r);if(t.length>0){let e=a?`clear-data-timeout`:`clear-data-failed`;console.warn(JSON.stringify({event:`ok-mismatch-recycle-partial-clears-failed`,failedDocs:t,clearedDocs:i})),this.enterServerRestartReconnect(s,t,n,e);for(let e of i)this.recycleDisconnectedEntry(e);return}this.enterServerRestartReconnect(s,[],n,`clear-data-failed`),this.recycleAllEntries()}).finally(()=>{this.mismatchInFlight===s&&(this.mismatchInFlight=null)});this.mismatchInFlight=s}awaitMismatchSettled(){return this.mismatchInFlight??Promise.resolve()}recycleAllEntries(){let e=Array.from(this.entries.keys());for(let t of e)this.recycleDisconnectedEntry(t)}prewarm(e){if(kQ(e))return null;let t=this.entries.get(e);if(t)return t;let n=this.open(e);if(!n)return null;let r=this.lruOrder.indexOf(e);return r!==-1&&(this.lruOrder.splice(r,1),this.lruOrder.unshift(e)),n}close(e){let t=this.entries.get(e);t&&(this.destroyEntry(t),this._entries.delete(e),this.lruOrder=this.lruOrder.filter(t=>t!==e),this.bufferedUpdates.delete(e),this.activeDocName===e&&(this.activeDocName=null),this.notify())}async closeAndClearPersistence(e){try{await this.runCloseAndClearPersistence(e)}catch{}}runCloseAndClearPersistence(e){let t=this.pendingClears.get(e);if(t!==void 0)return t;let n=()=>{},r=()=>{},i=new Promise((e,t)=>{n=e,r=t});this.pendingClears.set(e,i);let a=()=>{this.pendingClears.get(e)===i&&this.pendingClears.delete(e)};return i.then(a,a),this.executeCloseAndClearPersistence(e).then(n,r),i}async executeCloseAndClearPersistence(e){this.clearFailures.delete(e);let t=this.entries.get(e);if(t?.kind===`active`&&t.persistence!==null){let n=t.persistence;try{this.close(e)}catch(t){console.warn(`[ProviderPool] close before clearData threw for ${e}:`,t)}try{await this.withClearDataTimeout(e,n.clearData())}catch(t){throw console.warn(`[ProviderPool] clearData on rename failed for ${e}:`,t),this.clearFailures.add(e),t}return}if(t)try{this.close(e)}catch(t){console.warn(`[ProviderPool] close before IDB-by-name delete threw for ${e}:`,t)}let n=this.normalizedObservedBranch(),r=this.cachedServerInstanceId;if(r===null)return;let i=`ok-ydoc:${n}:${r}:${e}`;try{await this.withClearDataTimeout(e,new Promise((e,t)=>{let n=indexedDB.deleteDatabase(i);n.onsuccess=()=>e(),n.onerror=()=>t(n.error),n.onblocked=()=>{console.warn(`[ProviderPool] IDB delete blocked for ${i}`)}}))}catch(t){throw console.warn(`[ProviderPool] IDB delete on rename failed for ${i}:`,t),this.clearFailures.add(e),t}}clearBufferedUpdates(){this.bufferedUpdates.clear()}__test_seedBufferedUpdate(e,t){this.bufferedUpdates.set(e,t)}__test_bufferedUpdatesSize(){return this.bufferedUpdates.size}__test_hasBufferedUpdate(e){return this.bufferedUpdates.has(e)}__test_getBufferedUpdate(e){return this.bufferedUpdates.get(e)}setActive(e){let t=this.entries.get(e);if(!t)throw Error(`[ProviderPool] Cannot setActive — "${e}" is not open`);t.lastAccessedAt=Date.now(),this.touch(e),this.activeDocName=e,this.notify()}clearActive(){this.activeDocName!==null&&(this.activeDocName=null,this.notify())}getActive(){return this.activeDocName?this.entries.get(this.activeDocName)??null:null}getActiveDocName(){return this.activeDocName}has(e){return this.entries.has(e)}peek(e){return this.entries.get(e)??null}recycle(e){this.recycleDisconnectedEntry(e)}dispose(){for(let e of this._entries.values())this.destroyEntry(e);this._entries.clear(),this.lruOrder=[],this.activeDocName=null,this.onChange=null,this.bufferedUpdates.clear(),this.pendingClears.clear(),this.clearFailures.clear(),this.docLineageEpochs.clear(),this.docLineageEpochsEnvelopeConsumed=!1,this.onBranchMismatch=null,this.branchMismatchInFlight=null,this.onRenameRedirect=null,this.onDocDeleted=null,this.evictListeners.clear(),this.serverRestartRecoveryState=$Q,this.cachedServerInstanceId=null,this.pendingServerInstanceKnown=null,this.tabIdentity=null,this.recoveryMismatchStaleClaim=void 0}evictLru(){for(let e of this.lruOrder)if(e!==this.activeDocName){$(`ok/pool/evict-lru`,{docName:e}),this.close(e);return}}destroyEntry(e){if(e.kind===`tearing-down`)return;let t=e.observerCleanup,n=e.observerFireCounterCleanup,r=e.persistence,i=e.pendingRecycleTimer,a=e.docName,o=e;o.kind=`tearing-down`,o.persistence=null,o.observerCleanup=null,o.observerFireCounterCleanup=null,o.pendingRecycleTimer=null,o.serverDrivenCloseReauthInFlight=!1,i&&clearTimeout(i),XQ(a),this.fireEvict(a);try{t?.()}catch(e){console.warn(`[ProviderPool] observer cleanup threw for ${a}:`,e)}try{n?.()}catch(e){console.warn(`[ProviderPool] observer-fire-counter cleanup threw for ${a}:`,e)}r!==null&&r.destroy().catch(e=>{console.warn(`[ProviderPool] persistence destroy failed for ${a}:`,e)});try{o.provider.destroy()}catch(e){console.warn(`[ProviderPool] Provider destroy failed for ${a}:`,e)}}recycleDisconnectedEntry(e){let t=this.entries.get(e);if(!t||t.kind!==`active`)return;let n=this.activeDocName===e;if($(`ok/pool/recycle-disconnected`,{docName:e,wasActive:n}),this.destroyEntry(t),this._entries.delete(e),this.lruOrder=this.lruOrder.filter(t=>t!==e),n){this.open(e)&&this.setActive(e);return}this.notify()}},p$=crypto.randomUUID(),m$=!1;function h$(e){m$||(m$=!0,console.warn(`[principal-fetch] failed to resolve principal — falling back to random identity.`,e))}var g$=(0,Q.createContext)(null),_$=null;function v$(e){return _$||(_$=new f$(d$,e),FC(_$)),_$}var y$={activeDocName:null,activeProvider:null,syncState:`connecting`,serverRestartRecovery:{kind:`idle`},poolEntries:[]};function b$(){if(typeof window>`u`)return null;let e=window.okDesktop;return e?.config.mode===`editor`?e:null}function x$(){return typeof window>`u`||window.okDesktop?.config.mode===`editor`?null:Ow(window.location.origin)}function S$(){if(typeof window>`u`)return Ew(null,d$);let e=x$();return e?kw(window.localStorage===void 0?null:window.localStorage,e,d$):Ew(null,d$)}function C$(){return S$().openTabs}function w$(){return S$().pinnedTabIds}function T$(){if(typeof window>`u`||window.location.hash.length>0)return null;let e=S$();return e.activeTabId??(e.activeDocName?$C(e.activeDocName):null)??e.openTabs[0]??null}function E$(e){let t=iw(e);switch(t.kind){case`doc`:return Dn(t.docName);case`folder`:return Nn(t.folderPath);case`asset`:return Cn(t.assetPath);case`skill-file`:return xn({scope:t.scope,name:t.name,path:t.path})}}function D$(e){let t=Sn(e);if(t)return tw(t);let n=En(e);if(n)return ZC(n);let r=Rn(e);if(!r)return null;let i=r.trim();if(/\/+$/.test(i)){let e=i.replace(/\/+$/g,``);return e?ew(e):null}return $C(r)}function O$(e){return{kind:`asset`,target:e,assetPath:e,mediaKind:Le(e.split(`.`).pop()??``)}}function k$(e,t){return e?rw(e):t?$C(t):null}function A$(e,t,n){return e.some(e=>!n.has(e)&&aw(e)===t)}function j$(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function M$(e){switch(e.kind){case`doc`:return`doc:${e.docName}`;case`folder-index`:return`folder-index:${e.docName}:${e.folderPath}:${e.noteKind}`;case`folder`:return`folder:${e.folderPath}`;case`asset`:return`asset:${e.assetPath}:${e.mediaKind??``}`;case`skill-file`:return`skill-file:${e.scope}:${e.name}:${e.path}`;case`large-file`:return`large-file:${e.docName}:${e.size}:${e.limit}`;case`missing`:return`missing:${e.target}`}}function N$(e,t){return e===t?!0:!e||!t?!1:M$(e)===M$(t)}function P$(e){let t=e.getActive(),n=[];for(let t of e.entries.values())n.push({docName:t.docName,provider:t.provider,lastAccessedAt:t.lastAccessedAt,poolEventId:t.poolEventId});return n.sort((e,t)=>t.lastAccessedAt-e.lastAccessedAt),{activeDocName:e.getActiveDocName(),activeProvider:t?.provider??null,syncState:t?.syncState??`connecting`,serverRestartRecovery:e.getServerRestartRecoveryState(),poolEntries:n}}function F$(e){let t=(0,Z.c)(175),{children:n}=e,[r,i]=(0,Q.useState)(y$),[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(T$),[l,u]=(0,Q.useState)(C$),[d,f]=(0,Q.useState)(w$),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=[],t[0]=p):p=t[0];let[m,h]=(0,Q.useState)(p),[g,_]=(0,Q.useState)(l),[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(!1),S=(0,Q.useRef)(s),C=(0,Q.useRef)(l),w=(0,Q.useRef)(d),T=(0,Q.useRef)(v),E=(0,Q.useRef)(m),D=(0,Q.useRef)(g),O=(0,Q.useRef)(1),k=(0,Q.useRef)(!1),[A,j]=(0,Q.useState)(!1),[M,N]=(0,Q.useState)(null),[P,F]=(0,Q.useState)(null),[I,L]=(0,Q.useState)(`doc`),[R,z]=(0,Q.useState)(null),[B,V]=(0,Q.useState)(0),{collabUrl:H,terminal:ee,lastError:U,retry:W}=fS(),te;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(te=function(e){S.current=e,c(e)},t[1]=te):te=t[1];let G=te,ne;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(ne=function(e){T.current=e,y(e)},t[2]=ne):ne=t[2];let re=ne,ie;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(ie=function(e){D.current=e,_(t=>j$(t,e)?t:e)},t[3]=ie):ie=t[3];let ae=ie,oe;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(oe=function(e){w.current=e,f(t=>j$(t,e)?t:e)},t[4]=oe):oe=t[4];let se=oe,K;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(K=function(e,t){let n=sw(t,e);C.current=e,w.current=n,u(t=>j$(t,e)?t:e),f(e=>j$(e,n)?e:n),ae(vw(D.current,e,E.current))},t[5]=K):K=t[5];let ce=K,le;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(le=function(e){ce(e,w.current)},t[6]=le):le=t[6];let ue=le,de;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(de=function(e){ue(e(C.current))},t[7]=de):de=t[7];let fe=de,pe;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(pe=function(e){E.current=e,h(t=>j$(t,e)?t:e),ae(vw(D.current,C.current,e))},t[8]=pe):pe=t[8];let me=pe,he;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(he=function(e){let t=T.current;if(!t)return;let n=E.current.filter(e=>e!==t);E.current=n,h(e=>j$(e,n)?e:n),re(null);let r=[],i=new Set;for(let n of D.current){let a=n===t?e:n;!a||i.has(a)||(i.add(a),r.push(a))}ae(vw(r,C.current,n))},t[9]=he):he=t[9];let ge=he,_e,ve;t[10]===s?(_e=t[11],ve=t[12]):(_e=()=>{S.current=s},ve=[s],t[10]=s,t[11]=_e,t[12]=ve),(0,Q.useEffect)(_e,ve);let ye,be;t[13]===l?(ye=t[14],be=t[15]):(ye=()=>{C.current=l},be=[l],t[13]=l,t[14]=ye,t[15]=be),(0,Q.useEffect)(ye,be);let xe,Se;t[16]===d?(xe=t[17],Se=t[18]):(xe=()=>{w.current=d},Se=[d],t[16]=d,t[17]=xe,t[18]=Se),(0,Q.useEffect)(xe,Se);let Ce,we;t[19]===v?(Ce=t[20],we=t[21]):(Ce=()=>{T.current=v},we=[v],t[19]=v,t[20]=Ce,t[21]=we),(0,Q.useEffect)(Ce,we);let Te,Ee;t[22]===m?(Te=t[23],Ee=t[24]):(Te=()=>{E.current=m},Ee=[m],t[22]=m,t[23]=Te,t[24]=Ee),(0,Q.useEffect)(Te,Ee);let De,Oe;t[25]===g?(De=t[26],Oe=t[27]):(De=()=>{D.current=g},Oe=[g],t[25]=g,t[26]=De,t[27]=Oe),(0,Q.useEffect)(De,Oe);let ke=v!==null,Ae,je;t[28]!==H||t[29]!==A||t[30]!==b?(Ae=()=>{if(H===null||b||!A)return;let e=!1,t=b$(),n=x$(),r=typeof localStorage<`u`?localStorage:null;return(t?t.project.getSessionState():Promise.resolve(n?kw(r,n,d$):{openTabs:[],pinnedTabIds:[],activeDocName:null,activeTabId:null,updatedAt:null})).then(t=>{if(e)return;let n=Ew(t,d$);if(k.current)return;let r=v$(H);for(let e of n.openTabs){let t=aw(e);t&&r.open(t)}let i=[...n.pinnedTabIds,...w.current],a=n.openTabs;for(let e of C.current)a=pw(a,e,d$,i);let o=sw(i,a);C.current=a,w.current=o,u(e=>j$(e,a)?e:a),f(e=>j$(e,o)?e:o);let s=vw(D.current,a,E.current);D.current=s,_(e=>j$(e,s)?e:s);let l=Rn(window.location.hash),d=n.activeTabId??(n.activeDocName?$C(n.activeDocName):null)??n.openTabs[0]??null,p=d?E$(d):null;if((l===null&&window.location.hash.length===0||p!==null&&p===window.location.hash)&&d){S.current=d,c(d);let e=E$(d);window.location.hash!==e&&(window.location.hash=e)}}).catch(G$).finally(()=>{e||x(!0)}),()=>{e=!0}},je=[H,A,b],t[28]=H,t[29]=A,t[30]=b,t[31]=Ae,t[32]=je):(Ae=t[31],je=t[32]),(0,Q.useEffect)(Ae,je);let Me,Ne;t[33]!==s||t[34]!==a||t[35]!==l||t[36]!==d||t[37]!==r.activeDocName||t[38]!==b?(Me=()=>{if(!b)return;let e=Dw(l,s??k$(a,r.activeDocName),d),t=b$();if(t){t.project.setSessionState(e).catch(W$);return}let n=x$();n&&Aw(typeof localStorage<`u`?localStorage:null,n,e)},Ne=[s,a,l,d,r.activeDocName,b],t[33]=s,t[34]=a,t[35]=l,t[36]=d,t[37]=r.activeDocName,t[38]=b,t[39]=Me,t[40]=Ne):(Me=t[39],Ne=t[40]),(0,Q.useEffect)(Me,Ne);let Pe;t[41]===b?Pe=t[42]:(Pe=function(){b||(k.current=!0)},t[41]=b,t[42]=Pe);let q=Pe,Fe,Ie;t[43]===H?(Fe=t[44],Ie=t[45]):(Fe=()=>{if(H===null)return;let e=!1;j(!1);let t=v$(H);i(P$(t));let n=function(e,t){let n=sw(t,e);C.current=e,w.current=n,u(t=>j$(t,e)?t:e),f(e=>j$(e,n)?e:n);let r=vw(D.current,e,E.current);D.current=r,_(e=>j$(e,r)?e:r)};return t.setOnBranchMismatch(()=>Yx(t)),t.setOnRenameRedirect(e=>{let{fromDocName:r,toDocName:i,hadOpenProvider:a}=e;(async()=>{let e,s=t.getActiveDocName()===r;hC([{fromDocName:r,toDocName:i}]);try{await Promise.all([t.closeAndClearPersistence(r),t.closeAndClearPersistence(i)]),s&&(t.open(i),t.setActive(i));let e=bw(C.current,[{fromDocName:r,toDocName:i}],d$,[],w.current),a=sw(bw(w.current,[{fromDocName:r,toDocName:i}],2**53-1),e);D.current=xw(D.current,[{fromDocName:r,toDocName:i}]),n(e,a),o(e=>e&&(kn(e)===r?{kind:`doc`,target:i,docName:i}:e)),s&&(window.location.hash=Dn(i))}catch(t){let n=t;e=n,console.warn(JSON.stringify({event:`removal-cleanup-error`,kind:`renamed`,fromDocName:r,toDocName:i,message:String(n instanceof Error?n.message:n)}))}console.info(JSON.stringify({event:`removal.cleanup`,kind:`renamed`,fromDocName:r,toDocName:i,hadOpenProvider:a,hadStaleIdb:!a,source:`auth-rejection`,errored:e!==void 0}))})()}),t.setOnDocDeleted(e=>{let{docName:r,hadOpenProvider:i}=e;(async()=>{let e;try{await t.closeAndClearPersistence(r),n(_w(C.current,r),w.current),o(e=>e&&(kn(e)===r?null:e)),t.getActiveDocName()===r&&(window.location.hash=``)}catch(t){let n=t;e=n,console.warn(JSON.stringify({event:`removal-cleanup-error`,kind:`deleted`,docName:r,message:String(n instanceof Error?n.message:n)}))}console.info(JSON.stringify({event:`removal.cleanup`,kind:`deleted`,fromDocName:r,hadOpenProvider:i,hadStaleIdb:!i,source:`auth-rejection`,errored:e!==void 0}))})()}),t.setOnChange(()=>i(P$(t))),fetch(`/api/principal`).then(U$).then(n=>{if(e)return;let r=Re.safeParse(n);r.success?(t.setTabIdentity({principalId:r.data.id,tabSessionId:p$}),N(r.data)):h$(r.error)}).catch(t=>{e||h$(t)}).finally(()=>{e||j(!0)}),Yx(t),()=>{e=!0,t.setOnChange(null),t.setOnRenameRedirect(null),t.setOnDocDeleted(null)}},Ie=[H],t[43]=H,t[44]=Fe,t[45]=Ie),(0,Q.useEffect)(Fe,Ie);let Le;t[46]===H?Le=t[47]:(Le=e=>{if($(`ok/nav/open-document`,{docName:e,transition:!1}),H===null)return;let t=v$(H),n=t.open(e);if(!n)return;zx(e,n.poolEventId);let r=$C(e);fe(e=>pw(e,r,d$,w.current)),ge(r),G(r),t.setActive(e),o({kind:`doc`,target:e,docName:e})},t[46]=H,t[47]=Le);let ze=Le,Be;t[48]===ze?Be=t[49]:(Be=e=>{$(`ok/nav/open-document`,{docName:e,transition:!1}),ze(e)},t[48]=ze,t[49]=Be);let Ve=Be,He;t[50]!==a||t[51]!==H||t[52]!==q||t[53]!==r.activeDocName?(He=(e,t)=>{let n=t===void 0?{}:t;if(H===null)return;n.tabBehavior===`replace-active`&&q();let i=v$(H),s=kn(e),c=T.current,l=c!==null&&n.tabBehavior===`replace-active`,u=c?null:S.current??k$(a,r.activeDocName),d=u!==null&&C.current.includes(u),f=u!==null&&w.current.includes(u),p=n.tabBehavior===`replace-active`&&f||n.tabBehavior===`replace-active`&&!l&&!d?`append`:n.tabBehavior??`append`;if(s&&e.kind!==`large-file`){let e=i.open(s);if(!e)return;zx(s,e.poolEventId);let t=hw(C.current,s,{behavior:p,currentTabId:u,limit:d$,pinnedTabIds:w.current});ue(t.tabs),ge(t.activeTabId),G(t.activeTabId),i.setActive(s)}else{i.clearActive();let t=rw(e);if(t){let e=gw(C.current,t,{behavior:p,currentTabId:u,limit:d$,pinnedTabIds:w.current});ue(e.tabs),G(e.activeTabId),ge(e.activeTabId)}else ge(t)}o(t=>N$(t,e)?t:e)},t[50]=a,t[51]=H,t[52]=q,t[53]=r.activeDocName,t[54]=He):He=t[54];let Ue=He,We;t[55]===Ue?We=t[56]:(We=(e,t)=>{Ue(e,t===void 0?{}:t)},t[55]=Ue,t[56]=We);let Ge=We,Ke;t[57]===Ue?Ke=t[58]:(Ke=(e,t)=>{let n=t===void 0?{}:t;$(`ok/nav/open-target`,{docName:kn(e),kind:e.kind,transition:!1}),Ue(e,n)},t[57]=Ue,t[58]=Ke);let qe=Ke,Je;t[59]!==s||t[60]!==a||t[61]!==H||t[62]!==q||t[63]!==r.activeDocName?(Je=e=>{if(w.current.includes(e))return;q();let t=null,n=aw(e);if(H!==null){let t=v$(H);n&&!A$(C.current,n,new Set([e]))&&t.close(n)}let i=s??k$(a,r.activeDocName);if(fe(n=>(t=ww(n,i,e),_w(n,e))),i===e){if(t){G(t),window.location.hash=E$(t);return}H!==null&&v$(H).clearActive(),o(null),G(null),window.location.hash=``}},t[59]=s,t[60]=a,t[61]=H,t[62]=q,t[63]=r.activeDocName,t[64]=Je):Je=t[64];let Ye=Je,Xe;t[65]!==H||t[66]!==q?(Xe=e=>{q();let t=E.current;if(!t.includes(e))return;let n=t.filter(t=>t!==e);if(me(n),T.current!==e)return;let r=t.indexOf(e),i=n[r]??n[r-1]??null;if(i){re(i),H!==null&&v$(H).clearActive(),o(null),G(null),window.location.hash!==``&&(window.location.hash=``);return}re(null);let a=C.current[C.current.length-1]??null;if(a){G(a),window.location.hash=E$(a);return}H!==null&&v$(H).clearActive(),o(null),G(null),window.location.hash=``},t[65]=H,t[66]=q,t[67]=Xe):Xe=t[67];let Ze=Xe,Qe;t[68]!==Ze||t[69]!==Ye?(Qe=()=>{let e=T.current;if(e)return Ze(e),!0;let t=new Set(w.current),n=new Set(C.current.filter(e=>!t.has(e))),r=(S.current&&n.has(S.current)?S.current:null)??D.current.find(e=>n.has(e));if(r)return Ye(r),!0;let i=new Set(E.current),a=D.current.find(e=>i.has(e));return a?(Ze(a),!0):!1},t[68]=Ze,t[69]=Ye,t[70]=Qe):Qe=t[70];let $e=Qe,et,tt;t[71]===$e?(et=t[72],tt=t[73]):(et=()=>{let e=b$();if(e)return e.onMenuAction(e=>{e===`close-active-tab-or-window`&&($e()||window.close())})},tt=[$e],t[71]=$e,t[72]=et,t[73]=tt),(0,Q.useEffect)(et,tt);let nt;t[74]===H?nt=t[75]:(nt=()=>{if(H===null){o(H$),S.current=null,c(V$);return}let e=v$(H);e.getActiveDocName()!==null&&e.clearActive(),o(B$),S.current=null,c(z$)},t[74]=H,t[75]=nt);let rt;t[76]!==H||t[77]!==q?(rt=e=>{H!==null&&(q(),v$(H).close(e),fe(t=>_w(t,$C(e))),c(t=>{let n=t&&aw(t)===e?null:t;return S.current=n,n}),o(t=>t&&(kn(t)===e?null:t)))},t[76]=H,t[77]=q,t[78]=rt):rt=t[78];let it;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(it=e=>{let t=lw(w.current,e,C.current);j$(w.current,t)||se(t)},t[79]=it):it=t[79];let at;t[80]===q?at=t[81]:(at=e=>{let t=uw(w.current,e);j$(w.current,t)||(q(),se(t))},t[80]=q,t[81]=at);let ot;t[82]===H?ot=t[83]:(ot=e=>{let t=iw(e);if(re(null),G(e),t.kind===`doc`){if(H!==null){let e=v$(H);if(!e.open(t.docName))return;e.setActive(t.docName)}o({kind:`doc`,target:t.docName,docName:t.docName});let e=Dn(t.docName);window.location.hash!==e&&(window.location.hash=e);return}if(H!==null&&v$(H).clearActive(),t.kind===`asset`){o(O$(t.assetPath));let e=Cn(t.assetPath);window.location.hash!==e&&(window.location.hash=e);return}if(t.kind===`skill-file`){o({kind:`skill-file`,target:`${t.scope}/${t.name}/${t.path}`,scope:t.scope,name:t.name,path:t.path});let e=xn({scope:t.scope,name:t.name,path:t.path});window.location.hash!==e&&(window.location.hash=e);return}o({kind:`folder`,target:t.folderPath,folderPath:t.folderPath});let n=Nn(t.folderPath);window.location.hash!==n&&(window.location.hash=n)},t[82]=H,t[83]=ot);let st;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(st=(e,t)=>{let n=new Set(C.current),r=new Set(E.current),i=new Set,a=[],o=[],s=[];for(let t of e)i.has(t)||(n.has(t)?(a.push(t),s.push(t),i.add(t)):r.has(t)&&(o.push(t),s.push(t),i.add(t)));for(let e of C.current)i.has(e)||(a.push(e),s.push(e),i.add(e));for(let e of E.current)i.has(e)||(o.push(e),s.push(e),i.add(e));let c=j$(C.current,a),l=j$(E.current,o),u=j$(D.current,s);c&&l&&u||(D.current=s,l||(E.current=o,h(e=>j$(e,o)?e:o)),ce(a,fw(a,w.current,t)))},t[84]=st):st=t[84];let ct,lt;t[85]===H?(ct=t[86],lt=t[87]):(ct=()=>{let e=`new-tab:${O.current}`;O.current+=1,me([...E.current,e]),re(e),H!==null&&v$(H).clearActive(),o(null),G(null),window.location.hash!==``&&(window.location.hash=``)},lt=e=>{E.current.includes(e)&&(H!==null&&v$(H).clearActive(),o(null),G(null),re(e),window.location.hash!==``&&(window.location.hash=``))},t[85]=H,t[86]=ct,t[87]=lt);let ut;t[88]!==s||t[89]!==a||t[90]!==H||t[91]!==q||t[92]!==r.activeDocName?(ut=(e,t)=>{let n=t===void 0?{}:t,i=e.filter(R$),c=new Set(n.force?i:dw(i,w.current));if(c.size===0)return;if(q(),H!==null){let e=v$(H),t=new Map;for(let e of c){let n=aw(e);if(!n)continue;let r=t.get(n)??new Set;r.add(e),t.set(n,r)}for(let[n,r]of t)A$(C.current,n,r)||e.close(n)}let l=null,u=s??k$(a,r.activeDocName);if(fe(e=>(l=Tw(e,u,c),e.filter(e=>!c.has(e)))),!u||!c.has(u)){u||o(e=>{if(!e)return e;let t=rw(e);return t&&c.has(t)?null:e});return}if(l){G(l),window.location.hash=E$(l);return}H!==null&&v$(H).clearActive(),o(null),G(null),window.location.hash=``},t[88]=s,t[89]=a,t[90]=H,t[91]=q,t[92]=r.activeDocName,t[93]=ut):ut=t[93];let dt;t[94]!==s||t[95]!==a||t[96]!==H||t[97]!==q||t[98]!==l||t[99]!==r.activeDocName?(dt=e=>{let{pages:t,folderPaths:n,assetPaths:i}=e,c=yw(l,{pages:t,folderPaths:n,assetPaths:i,keepMissingDocName:a?.kind===`missing`?a.target:null,keepHashDocName:typeof window<`u`?Rn(window.location.hash):null});if(c.length===l.length)return;let u=new Set(c),d=l.filter(e=>!u.has(e)),f=new Set(d);if(q(),H!==null){let e=v$(H);for(let t of d){let n=aw(t);n&&e.close(n)}}ue(c);let p=typeof window<`u`?D$(window.location.hash):null,m=s??k$(a,r.activeDocName),h=p&&f.has(p)?p:m&&f.has(m)?m:null;if(!h){o(e=>{if(!e)return e;let t=rw(e);return t&&f.has(t)?null:e});return}let g=Tw(l,h,d);if(g){G(g),window.location.hash=E$(g);return}H!==null&&v$(H).clearActive(),o(null),G(null),window.location.hash=``},t[94]=s,t[95]=a,t[96]=H,t[97]=q,t[98]=l,t[99]=r.activeDocName,t[100]=dt):dt=t[100];let ft;t[101]!==H||t[102]!==q?(ft=(e,t,n)=>{let r=t===void 0?[]:t,i=n===void 0?[]:n;q();let a=bw(C.current,e,d$,r,w.current,i),o=sw(bw(w.current,e,2**53-1,r,[],i),a);if(H!==null){let e=v$(H);for(let t of a){let n=aw(t);n&&e.open(n)}}D.current=xw(D.current,e,r,i),ce(a,o);let s=S.current;if(s){let t=bw([s],e,1,r,[],i)[0];t&&a.includes(t)&&G(t)}},t[101]=H,t[102]=q,t[103]=ft):ft=t[103];let pt,mt,ht,gt,_t;t[104]===H?(pt=t[105],mt=t[106],ht=t[107],gt=t[108],_t=t[109]):(pt=async e=>{H!==null&&(await v$(H).closeAndClearPersistence(e),o(t=>t&&(kn(t)===e?null:t)))},mt=()=>H===null?null:v$(H).getActiveDocName(),ht=e=>H===null?!1:v$(H).has(e),gt=e=>{H!==null&&v$(H).recycle(e)},_t=e=>H===null?null:v$(H).prewarm(e)?.poolEventId??null,t[104]=H,t[105]=pt,t[106]=mt,t[107]=ht,t[108]=gt,t[109]=_t);let vt,yt,bt,xt,St;t[110]===H?(vt=t[111],yt=t[112],bt=t[113],xt=t[114],St=t[115]):(vt=e=>{H!==null&&v$(H).setExpectedServerInstanceId(e)},yt=async e=>{if(H===null)return;let t=v$(H);t.setObservedBranch(e),await Bx(t,e),tr([`files`,`backlinks`,`graph`]),nr(e)},bt=async e=>{if(H===null)return;let t=v$(H);t.compareAndUpdateObservedBranch(e)&&(await Bx(t,e),tr([`files`,`backlinks`,`graph`]),nr(e))},xt=(e,t)=>{H!==null&&v$(H).observeDiskAck(e,t)},St=async()=>{H!==null&&await Yx(v$(H))},t[110]=H,t[111]=vt,t[112]=yt,t[113]=bt,t[114]=xt,t[115]=St);let Ct;t[116]!==R||t[117]!==I||t[118]!==r.activeDocName?(Ct=(e,t)=>{if(!r.activeDocName&&t){window.location.hash=Dn(t),z(e),L(`agent`),V(L$);return}if(I===`agent`&&R===e){L(`doc`);return}z(e),L(`agent`),V(I$)},t[116]=R,t[117]=I,t[118]=r.activeDocName,t[119]=Ct):Ct=t[119];let wt;t[120]===Symbol.for(`react.memo_cache_sentinel`)?(wt=()=>{L(`doc`),z(null)},t[120]=wt):wt=t[120];let Tt;t[121]!==v||t[122]!==s||t[123]!==a||t[124]!==$e||t[125]!==Ze||t[126]!==Ye||t[127]!==U||t[128]!==ee||t[129]!==H||t[130]!==R||t[131]!==B||t[132]!==I||t[133]!==ke||t[134]!==m||t[135]!==ze||t[136]!==Ve||t[137]!==l||t[138]!==Ge||t[139]!==qe||t[140]!==d||t[141]!==M||t[142]!==W||t[143]!==r.activeDocName||t[144]!==r.activeProvider||t[145]!==r.poolEntries||t[146]!==r.serverRestartRecovery||t[147]!==r.syncState||t[148]!==P||t[149]!==nt||t[150]!==rt||t[151]!==at||t[152]!==ot||t[153]!==ct||t[154]!==lt||t[155]!==ut||t[156]!==dt||t[157]!==ft||t[158]!==pt||t[159]!==mt||t[160]!==ht||t[161]!==gt||t[162]!==_t||t[163]!==vt||t[164]!==yt||t[165]!==bt||t[166]!==xt||t[167]!==St||t[168]!==Ct||t[169]!==b||t[170]!==g?(Tt={principal:M,activeTarget:a,activeTabId:s,activeDocName:r.activeDocName,activeProvider:r.activeProvider,openTabs:l,pinnedTabIds:d,visibleTabIds:g,tabSessionLoaded:b,syncState:r.syncState,serverRestartRecovery:r.serverRestartRecovery,poolEntries:r.poolEntries,openDocument:ze,openDocumentTransition:Ve,openTarget:Ge,openTargetTransition:qe,clearTarget:nt,closeDocument:rt,closeActiveTabOrWindow:$e,closeTab:Ye,pinTab:it,unpinTab:at,activateTab:ot,reorderTabs:st,newTabIds:m,activeNewTabId:v,isNewTabActive:ke,openNewTab:ct,activateNewTab:lt,closeNewTab:Ze,closeTabs:ut,syncOpenTabsWithKnownTargets:dt,remapTabsForRename:ft,closeAndClearForRename:pt,getPoolActiveDocName:mt,poolHas:ht,recycleDocument:gt,prewarm:_t,systemProvider:P,setSystemProvider:F,updateServerInstanceId:vt,onBranchSwitched:yt,observeBranch:bt,observeDiskAck:xt,refreshServerInfo:St,collabUrl:H,collabTerminal:ee,collabLastError:U,retryCollab:W,docPanelMode:I,docPanelAgentId:R,docPanelExpandSignal:B,openActivityPanel:Ct,closeActivityPanel:wt},t[121]=v,t[122]=s,t[123]=a,t[124]=$e,t[125]=Ze,t[126]=Ye,t[127]=U,t[128]=ee,t[129]=H,t[130]=R,t[131]=B,t[132]=I,t[133]=ke,t[134]=m,t[135]=ze,t[136]=Ve,t[137]=l,t[138]=Ge,t[139]=qe,t[140]=d,t[141]=M,t[142]=W,t[143]=r.activeDocName,t[144]=r.activeProvider,t[145]=r.poolEntries,t[146]=r.serverRestartRecovery,t[147]=r.syncState,t[148]=P,t[149]=nt,t[150]=rt,t[151]=at,t[152]=ot,t[153]=ct,t[154]=lt,t[155]=ut,t[156]=dt,t[157]=ft,t[158]=pt,t[159]=mt,t[160]=ht,t[161]=gt,t[162]=_t,t[163]=vt,t[164]=yt,t[165]=bt,t[166]=xt,t[167]=St,t[168]=Ct,t[169]=b,t[170]=g,t[171]=Tt):Tt=t[171];let Et=Tt,Dt;return t[172]!==n||t[173]!==Et?(Dt=(0,X.jsx)(g$,{value:Et,children:n}),t[172]=n,t[173]=Et,t[174]=Dt):Dt=t[174],Dt}function I$(e){return e+1}function L$(e){return e+1}function R$(e){return e.length>0}function z$(e){return e===null?e:null}function B$(e){return e===null?e:null}function V$(e){return e===null?e:null}function H$(e){return e===null?e:null}function U$(e){return e.ok?e.json():Promise.reject(Error(`HTTP ${e.status}`))}function W$(e){console.warn(`[editor-tabs] failed to persist tab session:`,e)}function G$(e){console.warn(`[editor-tabs] failed to restore tab session:`,e)}function K$(){let e=(0,Q.use)(g$);if(!e)throw Error(`useDocumentContext must be used within <DocumentProvider />`);return e}function q$(){let e=(0,Z.c)(3),{openDocumentTransition:t,openTargetTransition:n}=K$(),r;return e[0]!==t||e[1]!==n?(r={openDocumentTransition:t,openTargetTransition:n},e[0]=t,e[1]=n,e[2]=r):r=e[2],r}export{tR as $,mc as $n,Cx as $t,EJ as A,zh as An,zi as Ar,CC as At,xW as B,Ml as Bn,DS as Bt,xY as C,jy as Cn,Zi as Cr,rw as Ct,mY as D,Ym as Dn,Wi as Dr,LC as Dt,yY as E,kv as En,Gi as Er,RC as Et,DG as F,sm as Fn,LS as Ft,KU as G,Oc as Gn,CS as Gt,aW as H,Wl as Hn,ES as Ht,yG as I,zf as In,QS as It,MB as J,bc as Jn,Xx as Jt,GU as K,$ as Kn,xS as Kt,XW as L,Tu as Ln,ZS as Lt,rK as M,Lh as Mn,Li as Mr,xC as Mt,tK as N,Mh as Nn,dC as Nt,YJ as O,mg as On,Ui as Or,hC as Ot,nK as P,om as Pn,MC as Pt,DR as Q,gc as Qn,Mx as Qt,IW as R,wu as Rn,XS as Rt,vY as S,ty as Sn,Qi as Sr,Sw as St,bY as T,Hv as Tn,Ki as Tr,zC as Tt,nW as U,Hl as Un,SS as Ut,pW as V,eu as Vn,TS as Vt,JU as W,Ll as Wn,bS as Wt,WR as X,vc as Xn,Rx as Xt,TR as Y,hc as Yn,qx as Yt,NB as Z,_c as Zn,jx as Zt,ZZ as _,sb as _n,sa as _r,tw as _t,NQ as a,Ex as an,Oa as ar,kM as at,KY as b,$y as bn,ta as br,ew as bt,jQ as c,Tb as cn,ba as cr,vA as ct,YQ as d,Eb as dn,_a as dr,dk as dt,wx as en,Ka as er,JL as et,kQ as f,vb as fn,pa as fr,FO as ft,XZ as g,ob as gn,ca as gr,pD as gt,cQ as h,hb as hn,la as hr,pO as ht,PQ as i,kx as in,ka as ir,qI as it,yq as j,Nh as jn,Ri as jr,wC as jt,VJ as k,Bh as kn,Bi as kr,fC as kt,XQ as l,bb as ln,ya as lr,Rk as lt,lQ as m,mb as mn,ua as mr,_O as mt,K$ as n,Ox as nn,La as nr,$L as nt,MQ as o,Ax as on,Ta as or,nj as ot,OQ as p,fb as pn,da as pr,MO as pt,BU as q,Sc as qn,iS as qt,q$ as r,Tx as rn,Aa as rr,JI as rt,FQ as s,Db as sn,xa as sr,jA as st,F$ as t,Dx as tn,za as tr,KL as tt,GQ as u,yb as un,va as ur,pk as ut,KX as v,tb as vn,ia as vr,$C as vt,SY as w,Ly as wn,Yi as wr,nw as wt,TY as x,qy as xn,$i as xr,iw as xt,UX as y,nb as yn,na as yr,dw as yt,DW as z,Pl as zn,US as zt};
|
|
34
|
+
${ZK(e)}`}var eq=`plaintext`;function tq(){return typeof document<`u`&&document.documentElement.classList.contains(`dark`)?`dark`:`light`}function nq(e,t){let n=(0,Z.c)(4),[r,i]=(0,Q.useState)(!1),a,o;return n[0]!==e||n[1]!==t?(a=()=>{let n=()=>{let n=typeof t==`function`?t():void 0;if(typeof n!=`number`)return;let r=e.state.doc.nodeAt(n);if(!r)return;let{from:a,to:o}=e.state.selection,s=n,c=a<n+r.nodeSize&&o>s;i(e=>e===c?e:c)};return n(),e.on(`selectionUpdate`,n),()=>{e.isDestroyed||e.off(`selectionUpdate`,n)}},o=[e,t],n[0]=e,n[1]=t,n[2]=a,n[3]=o):(a=n[2],o=n[3]),(0,Q.useEffect)(a,o),r}function rq(e){let t=(0,Z.c)(174),{node:n,updateAttributes:r,editor:i,getPos:a,selected:c}=e,{_:l}=s(),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(!1),m=(0,Q.useRef)(null),h=(0,Q.useRef)(null),g=(0,Q.useRef)(null),[_,v]=(0,Q.useState)(null),[y,b]=(0,Q.useState)(null),{resolvedTheme:x}=ie(),S;t[0]===x?S=t[1]:(S=x===`dark`||x===`light`?x:tq(),t[0]=x,t[1]=S);let C=S,[w]=(0,Q.useState)(tq),T=n.attrs.language??null,E=n.attrs.meta??null,D;t[2]===E?D=t[3]:(D=zK(E),t[2]=E,t[3]=D);let O=D,[k,A]=(0,Q.useState)(!1),[j,M]=(0,Q.useState)(!1),N=(0,Q.useId)(),P=`${N}-title-input`,F=`${N}-title-help`,I=(0,Q.useRef)(E),L,R;t[4]===E?(L=t[5],R=t[6]):(L=()=>{I.current=E},R=[E],t[4]=E,t[5]=L,t[6]=R),(0,Q.useEffect)(L,R);let z,B,V,H,ee;if(t[7]!==l||t[8]!==T||t[9]!==E){B=SK(T),z=T?bK.find(e=>e.value===B)?.label??T:l({id:`LpB85N`});let e;t[15]===E?e=t[16]:(e=EK(E,`preview`),t[15]=E,t[16]=e),H=e,V=B?kK.has(B):!1,ee=AK(B,E),t[7]=l,t[8]=T,t[9]=E,t[10]=z,t[11]=B,t[12]=V,t[13]=H,t[14]=ee}else z=t[10],B=t[11],V=t[12],H=t[13],ee=t[14];let U=ee,W;t[17]!==U||t[18]!==E?(W=U?FK(E):null,t[17]=U,t[18]=E,t[19]=W):W=t[19];let te=W,G;t[20]!==U||t[21]!==E?(G=U?IK(E):null,t[20]=U,t[21]=E,t[22]=G):G=t[22];let ne=G,re=te??(_===null?void 0:`${_}px`),ae=!U,oe,se;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(oe=()=>()=>{m.current!==null&&window.clearTimeout(m.current)},se=[],t[23]=oe,t[24]=se):(oe=t[23],se=t[24]),(0,Q.useEffect)(oe,se);let K=i.isEditable,ce=nq(i,a),le,ue;t[25]===C?(le=t[26],ue=t[27]):(le=()=>{g.current?.contentWindow?.postMessage(UK(C),`*`)},ue=[C],t[25]=C,t[26]=le,t[27]=ue),(0,Q.useEffect)(le,ue);let de,fe;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(de=()=>{let e=function(e){if(e.source!==g.current?.contentWindow)return;let t=GK(e.data);if(t!==null){v(e=>e!==null&&Math.abs(e-t)<=2?e:t);return}let n=qK(e.data);n!==null&&b(n)};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},fe=[],t[28]=de,t[29]=fe):(de=t[28],fe=t[29]),(0,Q.useEffect)(de,fe);let pe;t[30]===n.textContent?pe=t[31]:(pe=()=>{let e=n.textContent,t=()=>{p(!0),m.current!==null&&window.clearTimeout(m.current),m.current=window.setTimeout(()=>p(!1),1200)};try{typeof navigator<`u`&&navigator.clipboard?.writeText&&navigator.clipboard.writeText(e).then(t,sq)}catch{}},t[30]=n.textContent,t[31]=pe);let me=pe,he;t[32]!==i||t[33]!==a?(he=()=>{let e=typeof a==`function`?a():void 0;if(typeof e==`number`)try{i.chain().focus().setNodeSelection(e).deleteSelection().run()}catch(e){let t=e;if(!(t instanceof RangeError))throw t;console.warn(`[CodeBlockView] delete failed — position race`,t)}},t[32]=i,t[33]=a,t[34]=he):he=t[34];let ge=he,_e;t[35]!==H||t[36]!==E||t[37]!==r?(_e=()=>{r({meta:H?OK(E,`preview`):DK(E,`preview`)})},t[35]=H,t[36]=E,t[37]=r,t[38]=_e):_e=t[38];let ve=_e,ye;t[39]!==E||t[40]!==r?(ye=e=>{let t=BK(E,e.length>0?e:null);t!==E&&r({meta:t})},t[39]=E,t[40]=r,t[41]=ye):ye=t[41];let be=ye,xe;t[42]!==i.state||t[43]!==i.view||t[44]!==a||t[45]!==n.attrs||t[46]!==n.nodeSize||t[47]!==n.type?(xe=e=>{let t=typeof a==`function`?a():void 0;if(typeof t==`number`)try{let{schema:r,tr:a}=i.state,o=n.type.create(n.attrs,e.length>0?r.text(e):null);a.replaceWith(t,t+n.nodeSize,o),i.view.dispatch(a)}catch(e){let t=e;if(!(t instanceof RangeError))throw t;console.warn(`[CodeBlockView] edit-save failed — position race`,t)}},t[42]=i.state,t[43]=i.view,t[44]=a,t[45]=n.attrs,t[46]=n.nodeSize,t[47]=n.type,t[48]=xe):xe=t[48];let Se=xe,Ce;t[49]===r?Ce=t[50]:(Ce=e=>{let t=`${Math.round(e.width)}px`,n=`${Math.round(e.height)}px`;r({meta:PK(PK(I.current,`h`,n),`w`,t)})},t[49]=r,t[50]=Ce);let we=Ce,Te=T??void 0,Ee=ce?`true`:void 0,De=c?`true`:void 0,Oe=U?`true`:void 0,ke=ae?`true`:`false`,Ae;t[51]!==l||t[52]!==C||t[53]!==w||t[54]!==ae||t[55]!==re||t[56]!==we||t[57]!==n.textContent||t[58]!==U||t[59]!==ne?(Ae=U?(0,X.jsxs)(`div`,{ref:h,className:Xt(`ok-codeblock-preview`,ae?`ok-codeblock-preview--with-code`:`ok-codeblock-preview--solo`),contentEditable:!1,style:{...re?{height:re}:{},...ne?{width:ne}:{}},onMouseDown:oq,children:[(0,X.jsx)(`iframe`,{title:l({id:`G7cMuO`}),ref:g,sandbox:`allow-scripts`,referrerPolicy:`no-referrer`,srcDoc:$K(w)+n.textContent,className:`ok-codeblock-preview-frame`,onLoad:()=>{b(null),g.current?.contentWindow?.postMessage(UK(C),`*`)}}),(0,X.jsx)(jk,{targetRef:h,bounds:{minWidth:192,maxWidth:Math.round(window.innerWidth*.9),minHeight:128,maxHeight:Math.round(window.innerHeight*.9)},onResize:e=>{let t=h.current;t&&(t.style.width=`${e.width}px`,t.style.height=`${e.height}px`)},onResizeEnd:we})]}):null,t[51]=l,t[52]=C,t[53]=w,t[54]=ae,t[55]=re,t[56]=we,t[57]=n.textContent,t[58]=U,t[59]=ne,t[60]=Ae):Ae=t[60];let je;t[61]!==y||t[62]!==U?(je=U&&y?(0,X.jsx)(yK,{blocked:y.blocked,truncated:y.truncated,onDismiss:()=>b(null)}):null,t[61]=y,t[62]=U,t[63]=je):je=t[63];let Me;t[64]===O?Me=t[65]:(Me=O?(0,X.jsx)(`div`,{className:`ok-codeblock-title`,contentEditable:!1,"data-testid":`ok-codeblock-title`,title:O,children:(0,X.jsx)(`span`,{className:`ok-codeblock-title-text`,children:O})}):null,t[64]=O,t[65]=Me);let Ne=U&&ae?`rounded-b-lg`:null,Pe=U?null:`rounded-lg`,q;t[66]!==Ne||t[67]!==Pe?(q=Xt(`ok-codeblock-pre m-0 overflow-x-auto px-5 py-4 font-mono text-sm leading-relaxed`,Ne,Pe),t[66]=Ne,t[67]=Pe,t[68]=q):q=t[68];let Fe=!ae||void 0,Ie=T?`language-${T}`:void 0,Le;t[69]===Ie?Le=t[70]:(Le=Xt(`hljs block whitespace-pre bg-transparent p-0`,Ie),t[69]=Ie,t[70]=Le);let Re;t[71]===Le?Re=t[72]:(Re=(0,X.jsx)(ql,{as:`code`,className:Le}),t[71]=Le,t[72]=Re);let ze;t[73]!==q||t[74]!==Fe||t[75]!==Re?(ze=(0,X.jsx)(`pre`,{className:q,"aria-hidden":Fe,children:Re}),t[73]=q,t[74]=Fe,t[75]=Re,t[76]=ze):ze=t[76];let Be;t[77]===Symbol.for(`react.memo_cache_sentinel`)?(Be={[MF]:`true`},t[77]=Be):Be=t[77];let Ve=!K,He;t[78]!==l||t[79]!==z?(He=l({id:`c5f7sm`,values:{currentLabel:z}}),t[78]=l,t[79]=z,t[80]=He):He=t[80];let Ue;t[81]===z?Ue=t[82]:(Ue=(0,X.jsx)(`span`,{children:z}),t[81]=z,t[82]=Ue);let We;t[83]===K?We=t[84]:(We=K?(0,X.jsx)(yn,{className:`size-3 opacity-60`,"aria-hidden":`true`}):null,t[83]=K,t[84]=We);let Ge;t[85]!==Ve||t[86]!==He||t[87]!==Ue||t[88]!==We?(Ge=(0,X.jsx)(gc,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,disabled:Ve,className:`ok-codeblock-chrome-btn ok-codeblock-chrome-lang`,"aria-label":He,children:[Ue,We]})}),t[85]=Ve,t[86]=He,t[87]=Ue,t[88]=We,t[89]=Ge):Ge=t[89];let Ke;t[90]===l?Ke=t[91]:(Ke=l({id:`G_mWXb`}),t[90]=l,t[91]=Ke);let qe;t[92]===Ke?qe=t[93]:(qe=(0,X.jsx)(Tx,{placeholder:Ke}),t[92]=Ke,t[93]=qe);let Je;t[94]===l?Je=t[95]:(Je=l({id:`ETyvvg`}),t[94]=l,t[95]=Je);let Ye;t[96]===Je?Ye=t[97]:(Ye=(0,X.jsx)(Dx,{children:Je}),t[96]=Je,t[97]=Ye);let Xe;t[98]!==i.commands||t[99]!==B||t[100]!==T||t[101]!==r?(Xe=bK.map(e=>{let t=e.value===eq?!T||B===eq:B===e.value;return(0,X.jsxs)(kx,{value:`${e.label} ${e.value} ${e.aliases?.join(` `)??``}`,onSelect:()=>{r({language:e.value===eq?null:e.value}),d(!1),i.commands.focus()},children:[(0,X.jsx)(`span`,{className:`flex-1`,children:e.label}),t?(0,X.jsx)(tn,{className:`size-3.5`,"aria-hidden":`true`}):null]},e.value)}),t[98]=i.commands,t[99]=B,t[100]=T,t[101]=r,t[102]=Xe):Xe=t[102];let Ze;t[103]===Xe?Ze=t[104]:(Ze=(0,X.jsx)(Ox,{children:Xe}),t[103]=Xe,t[104]=Ze);let Qe;t[105]!==Ye||t[106]!==Ze?(Qe=(0,X.jsxs)(Ex,{children:[Ye,Ze]}),t[105]=Ye,t[106]=Ze,t[107]=Qe):Qe=t[107];let $e;t[108]!==qe||t[109]!==Qe?($e=(0,X.jsx)(_c,{align:`end`,sideOffset:6,className:`w-56 p-0`,children:(0,X.jsxs)(Cx,{filter:iq,children:[qe,Qe]})}),t[108]=qe,t[109]=Qe,t[110]=$e):$e=t[110];let et;t[111]!==u||t[112]!==Ge||t[113]!==$e?(et=(0,X.jsxs)(hc,{open:u,onOpenChange:d,children:[Ge,$e]}),t[111]=u,t[112]=Ge,t[113]=$e,t[114]=et):et=t[114];let tt;t[115]!==l||t[116]!==K||t[117]!==U?(tt=K&&U?(0,X.jsx)(`button`,{type:`button`,className:`ok-codeblock-chrome-btn`,"aria-label":l({id:`R3y75Z`}),"data-testid":`ok-codeblock-edit-btn`,onClick:()=>M(!0),children:(0,X.jsx)(qn,{className:`size-3.5`,"aria-hidden":`true`})}):null,t[115]=l,t[116]=K,t[117]=U,t[118]=tt):tt=t[118];let nt;t[119]!==l||t[120]!==K||t[121]!==ve||t[122]!==V||t[123]!==H?(nt=K&&V?(0,X.jsx)(`button`,{type:`button`,className:`ok-codeblock-chrome-btn`,"data-active":H?`true`:void 0,"aria-pressed":H,"aria-label":l(H?{id:`xHGM4U`}:{id:`7OwvEL`}),onClick:ve,children:H?(0,X.jsx)(Qi,{className:`size-3.5`}):(0,X.jsx)($i,{className:`size-3.5`})}):null,t[119]=l,t[120]=K,t[121]=ve,t[122]=V,t[123]=H,t[124]=nt):nt=t[124];let rt;t[125]!==l||t[126]!==K||t[127]!==be||t[128]!==k||t[129]!==O||t[130]!==F||t[131]!==P?(rt=K?(0,X.jsxs)(hc,{open:k,onOpenChange:A,children:[(0,X.jsx)(gc,{asChild:!0,children:(0,X.jsx)(`button`,{type:`button`,className:`ok-codeblock-chrome-btn`,"data-active":O?`true`:void 0,"aria-label":l({id:`DDTdLl`}),children:(0,X.jsx)(ja,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,X.jsx)(_c,{align:`end`,sideOffset:6,className:`w-64 p-3`,children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsx)(`label`,{htmlFor:P,className:`text-2xs font-mono uppercase tracking-wide text-muted-foreground`,children:(0,X.jsx)(o,{id:`MHrjPM`})}),(0,X.jsx)(Ir,{id:P,type:`text`,value:O??``,placeholder:l({id:`mk2poV`}),"data-testid":`ok-codeblock-title-input`,"aria-describedby":F,onChange:e=>be(e.target.value),onKeyDown:e=>{(e.key===`Enter`||e.key===`Escape`)&&(e.preventDefault(),A(!1))},className:`h-8`}),(0,X.jsx)(`p`,{id:F,className:`text-2xs text-muted-foreground`,children:(0,X.jsx)(o,{id:`lond3p`})})]})})]}):null,t[125]=l,t[126]=K,t[127]=be,t[128]=k,t[129]=O,t[130]=F,t[131]=P,t[132]=rt):rt=t[132];let it;t[133]!==l||t[134]!==f?(it=l(f?{id:`6V3Ea3`}:{id:`NmPNJJ`}),t[133]=l,t[134]=f,t[135]=it):it=t[135];let at;t[136]===f?at=t[137]:(at=f?(0,X.jsx)(tn,{className:`size-3.5`,"aria-hidden":`true`}):(0,X.jsx)(Gn,{className:`size-3.5`,"aria-hidden":`true`}),t[136]=f,t[137]=at);let ot;t[138]!==me||t[139]!==it||t[140]!==at?(ot=(0,X.jsx)(`button`,{type:`button`,className:`ok-codeblock-chrome-btn`,"aria-label":it,onClick:me,children:at}),t[138]=me,t[139]=it,t[140]=at,t[141]=ot):ot=t[141];let st;t[142]!==l||t[143]!==K||t[144]!==ge?(st=K?(0,X.jsx)(`button`,{type:`button`,className:`ok-codeblock-chrome-btn ok-codeblock-chrome-btn--delete`,"aria-label":l({id:`oBXkm2`}),onClick:ge,children:(0,X.jsx)(Hn,{className:`size-3.5`,"aria-hidden":`true`})}):null,t[142]=l,t[143]=K,t[144]=ge,t[145]=st):st=t[145];let ct;t[146]!==et||t[147]!==tt||t[148]!==nt||t[149]!==rt||t[150]!==ot||t[151]!==st?(ct=(0,X.jsxs)(`div`,{className:`ok-codeblock-chrome`,contentEditable:!1,onMouseDown:aq,...Be,children:[et,tt,nt,rt,ot,st]}),t[146]=et,t[147]=tt,t[148]=nt,t[149]=rt,t[150]=ot,t[151]=st,t[152]=ct):ct=t[152];let lt;t[153]!==l||t[154]!==w||t[155]!==j||t[156]!==K||t[157]!==Se||t[158]!==n.textContent||t[159]!==B||t[160]!==U?(lt=K&&U?(0,X.jsx)(_K,{open:j,onOpenChange:M,initialValue:n.textContent,language:B===`xml`?`html`:`plain`,title:l({id:`R3y75Z`}),renderPreview:e=>(0,X.jsx)(`iframe`,{title:l({id:`G7cMuO`}),sandbox:`allow-scripts`,className:`size-full border-0`,srcDoc:$K(w)+e}),onSave:Se}):null,t[153]=l,t[154]=w,t[155]=j,t[156]=K,t[157]=Se,t[158]=n.textContent,t[159]=B,t[160]=U,t[161]=lt):lt=t[161];let ut;return t[162]!==Te||t[163]!==Ee||t[164]!==De||t[165]!==Oe||t[166]!==ke||t[167]!==Ae||t[168]!==je||t[169]!==Me||t[170]!==ze||t[171]!==ct||t[172]!==lt?(ut=(0,X.jsxs)(Jl,{className:`ok-codeblock relative my-3`,"data-language":Te,"data-cursor-inside":Ee,"data-selected":De,"data-preview":Oe,"data-code-visible":ke,children:[Ae,je,Me,ze,ct,lt]}),t[162]=Te,t[163]=Ee,t[164]=De,t[165]=Oe,t[166]=ke,t[167]=Ae,t[168]=je,t[169]=Me,t[170]=ze,t[171]=ct,t[172]=lt,t[173]=ut):ut=t[173],ut}function iq(e,t){return t?+!!e.toLowerCase().includes(t.toLowerCase()):1}function aq(e){return e.stopPropagation()}function oq(e){return e.stopPropagation()}function sq(){}function cq(e,t=[]){return e.flatMap(e=>{if(e.type===`text`)return[{text:e.value,classes:t}];let n=[...t,...e.properties?.className??[]];return cq(e.children,n)})}function lq(e){let{doc:t,name:n,lowlight:r,defaultLanguage:i}=e,a=[],o=r.listLanguages();return He(t,e=>e.type.name===n).forEach(e=>{let t=e.pos+1,n=e.node.attrs.language||i;if(!n||!(o.includes(n)||(r.registered?.(n)??!1)))return;let s;try{s=r.highlight(n,e.node.textContent)}catch{return}let c=s.children??[];for(let e of cq(c)){let n=t+e.text.length;e.classes.length>0&&a.push(dt.inline(t,n,{class:e.classes.join(` `)})),t=n}}),Qe.create(t,a)}function uq(e){let{name:t,lowlight:n,defaultLanguage:r}=e,i=new Ht({key:new q(`codeBlockLowlight`),state:{init:(e,{doc:i})=>lq({doc:i,name:t,lowlight:n,defaultLanguage:r}),apply:(e,i,a,o)=>{if(!e.docChanged)return i.map(e.mapping,e.doc);let s=a.selection.$head.parent.type.name,c=o.selection.$head.parent.type.name,l=He(a.doc,e=>e.type.name===t),u=He(o.doc,e=>e.type.name===t);return[s,c].includes(t)||u.length!==l.length||e.steps.some(e=>{let t=e;return t.from===void 0||t.to===void 0?!1:l.some(e=>t.from<e.pos+e.node.nodeSize&&t.to>e.pos)})?lq({doc:e.doc,name:t,lowlight:n,defaultLanguage:r}):i.map(e.mapping,e.doc)}},props:{decorations(e){return i.getState(e)}}});return i}var dq=CF(yF),fq=se.extend({addOptions(){return{...this.parent?.(),enableTabIndentation:!0,tabSize:2}},addNodeView(){return nu(rq)},addProseMirrorPlugins(){return[...this.parent?.()??[],uq({name:this.name,lowlight:dq,defaultLanguage:null})]},addInputRules(){return[...this.parent?.()??[],Ke({find:/^```$/,type:this.type,getAttributes:()=>({language:`js`})})]}});function pq(e){return!!e.getMeta(Hv)}function mq(e,t){let n=Hv.getState(e);return Ay(n.doc,n.type,t,n.binding.mapping)||0}function hq(e,t){let n=Hv.getState(e);return Oy(t,n.type,n.binding.mapping)}var gq=class e extends Se{constructor(e,t){super(e),this.yRelativePosition=t}static fromJSON(t){return new e(t.position,t.yRelativePosition)}toJSON(){return{position:this.position,yRelativePosition:this.yRelativePosition}}};function _q(e,t){return new gq(e,hq(t,e))}function vq(e,t,n){let r=e instanceof gq?e.yRelativePosition:null;if(pq(t)&&r)return{position:new gq(mq(n,r),r),mapResult:null};let i=Ne(e,t),a=i.position.position;return{position:new gq(a,r??hq(n,a)),mapResult:i.mapResult}}var yq=F.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(e=>e.name===`undoRedo`)&&console.warn(`[tiptap warn]: "@tiptap/extension-collaboration" comes with its own history support and is not compatible with "@tiptap/extension-undo-redo".`)},onBeforeCreate(){this.editor.utils.getUpdatedPosition=(e,t)=>vq(e,t,this.editor.state),this.editor.utils.createMappablePosition=e=>_q(e,this.editor.state)},addCommands(){return{undo:()=>({tr:e,state:t,dispatch:n})=>(e.setMeta(`preventDispatch`,!0),Uv.getState(t).undoManager.undoStack.length===0?!1:n?Ry(t):!0),redo:()=>({tr:e,state:t,dispatch:n})=>(e.setMeta(`preventDispatch`,!0),Uv.getState(t).undoManager.redoStack.length===0?!1:n?zy(t):!0)}},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-y":()=>this.editor.commands.redo(),"Shift-Mod-z":()=>this.editor.commands.redo()}},addProseMirrorPlugins(){let e=this.options.fragment?this.options.fragment:this.options.document.getXmlFragment(this.options.field),t=Hy(this.options.yUndoOptions),n=t.spec.view;return t.spec.view=e=>{let{undoManager:t}=Uv.getState(e.state);t.restore&&=(t.restore(),()=>{});let r=n?n(e):void 0;return{destroy:()=>{let e=t.trackedOrigins.has(t),n=t._observers;t.restore=()=>{e&&t.trackedOrigins.add(t),t.doc.on(`afterTransaction`,t.afterTransactionHandler),t._observers=n},r?.destroy&&r.destroy()}}},[Zv(e,{...this.options.ySyncOptions,onFirstRender:this.options.onFirstRender}),t,this.editor.options.enableContentCheck&&new Ht({key:new q(`filterInvalidContent`),filterTransaction:t=>{if(!pq(t))return!0;if(this.storage.isDisabled)return!1;if(!t.docChanged)return!0;try{return t.doc.check(),!0}catch(t){return this.storage.isDisabled=!0,this.editor.emit(`contentError`,{error:t,editor:this.editor,disableCollaboration:()=>{var t;(t=e.doc)==null||t.destroy()}}),!1}}})].filter(Boolean)}});function bq(e){if(!e.length)return Qe.empty;let t=[],n=e[0].$from.node(0);return e.forEach(e=>{let n=e.$from.pos,r=e.$from.nodeAfter;r&&t.push(dt.node(n,n+r.nodeSize,{class:`ProseMirror-selectednoderange`}))}),Qe.create(n,t)}function xq(e,t,n){let r=n.isText||n.isAtom?0:1;return{start:e+r,end:e+t-r}}function Sq(e,t,n,r={}){let i=[],a=e.node(0),{extendOnBoundaryOverlap:o=!0}=r;typeof n==`number`&&n>=0||(n=e.sameParent(t)?Math.max(0,e.sharedDepth(t.pos)-1):e.sharedDepth(t.pos));let s=new g(e,t,n),c=s.depth===0?0:a.resolve(s.start).posAtIndex(0);return s.parent.forEach((n,r)=>{let l=c+r,u=l+n.nodeSize,d=xq(l,n.nodeSize,n),f=o?t.pos>=d.start&&e.pos<=d.end:t.pos>d.start&&e.pos<d.end;if(l<s.start||l>=s.end||!f)return;let p=new K(a.resolve(l),a.resolve(u));i.push(p)}),i}var Cq=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){return new wq(e.resolve(this.anchor),e.resolve(this.head))}},wq=class e extends zt{constructor(e,t,n,r=1){let{doc:i}=e,a=e===t,o=e.pos===i.content.size&&t.pos===i.content.size,s=a&&!o?i.resolve(t.pos+(r>0?1:-1)):t,c=a&&o?i.resolve(e.pos-(r>0?1:-1)):e,l=Sq(c.min(s),c.max(s),n),u=s.pos>=e.pos?l[0].$from:l[l.length-1].$to,d=s.pos>=e.pos?l[l.length-1].$to:l[0].$from;super(u,d,l),this.depth=n}get $to(){return this.ranges[this.ranges.length-1].$to}eq(t){return t instanceof e&&t.$from.pos===this.$from.pos&&t.$to.pos===this.$to.pos}map(t,n){return new e(t.resolve(n.map(this.anchor)),t.resolve(n.map(this.head)))}toJSON(){return{type:`nodeRange`,anchor:this.anchor,head:this.head}}get isForwards(){return this.head>=this.anchor}get isBackwards(){return!this.isForwards}extendBackwards(){let{doc:t}=this.$from;if(this.isForwards&&this.ranges.length>1){let t=this.ranges.slice(0,-1),n=t[0].$from,r=t[t.length-1].$to;return new e(n,r,this.depth)}let n=this.ranges[0],r=t.resolve(Math.max(0,n.$from.pos-1));return new e(this.$anchor,r,this.depth)}extendForwards(){let{doc:t}=this.$from;if(this.isBackwards&&this.ranges.length>1){let t=this.ranges.slice(1),n=t[0].$from,r=t[t.length-1].$to;return new e(r,n,this.depth)}let n=this.ranges[this.ranges.length-1],r=t.resolve(Math.min(t.content.size,n.$to.pos+1));return new e(this.$anchor,r,this.depth)}static fromJSON(t,n){return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(e,t,n,r,i=1){return new this(e.resolve(t),e.resolve(n),r,i)}getBookmark(){return new Cq(this.anchor,this.head)}};wq.prototype.visible=!1;function Tq(e){return e instanceof wq}F.create({name:`nodeRange`,addOptions(){return{depth:void 0,key:`Mod`}},addKeyboardShortcuts(){return{"Shift-ArrowUp":({editor:e})=>{let{depth:t}=this.options,{view:n,state:r}=e,{doc:i,selection:a,tr:o}=r,{anchor:s,head:c}=a;if(!Tq(a)){let e=wq.create(i,s,c,t,-1);return o.setSelection(e),n.dispatch(o),!0}let l=a.extendBackwards();return o.setSelection(l),n.dispatch(o),!0},"Shift-ArrowDown":({editor:e})=>{let{depth:t}=this.options,{view:n,state:r}=e,{doc:i,selection:a,tr:o}=r,{anchor:s,head:c}=a;if(!Tq(a)){let e=wq.create(i,s,c,t);return o.setSelection(e),n.dispatch(o),!0}let l=a.extendForwards();return o.setSelection(l),n.dispatch(o),!0},"Mod-a":({editor:e})=>{let{depth:t}=this.options,{view:n,state:r}=e,{doc:i,tr:a}=r,o=wq.create(i,0,i.content.size,t);return a.setSelection(o),n.dispatch(a),!0}}},onSelectionUpdate(){let{selection:e}=this.editor.state;Tq(e)&&this.editor.view.dom.classList.add(`ProseMirror-noderangeselection`)},addProseMirrorPlugins(){let e=!1,t=!1;return[new Ht({key:new q(`nodeRange`),props:{attributes:()=>e?{class:`ProseMirror-noderangeselection`}:{class:``},handleDOMEvents:{mousedown:(e,n)=>{let{key:r}=this.options,i=/Mac/.test(navigator.platform),a=!!n.shiftKey,o=!!n.ctrlKey,s=!!n.altKey,c=!!n.metaKey;return(r==null||r===`Shift`&&a||r===`Control`&&o||r===`Alt`&&s||r===`Meta`&&c||r===`Mod`&&(i?c:o))&&(t=!0),t&&document.addEventListener(`mouseup`,()=>{t=!1;let{state:n}=e,{doc:r,selection:i,tr:a}=n,{$anchor:o,$head:s}=i;if(o.sameParent(s))return;let c=wq.create(r,o.pos,s.pos,this.options.depth);a.setSelection(c),e.dispatch(a)},{once:!0}),!1}},decorations:n=>{let{selection:r}=n,i=Tq(r);if(e=!1,!t)return i?(e=!0,bq(r.ranges)):null;let{$from:a,$to:o}=r;if(!i&&a.sameParent(o))return null;let s=Sq(a,o,this.options.depth);return s.length?(e=!0,bq(s)):null}}})]}});function Eq(e){let t=``,n=getComputedStyle(e);for(let e=0;e<n.length;e+=1)t+=`${n[e]}:${n.getPropertyValue(n[e])};`;return t}function Dq(e){let t=e.cloneNode(!0),n=[e,...Array.from(e.getElementsByTagName(`*`))],r=[t,...Array.from(t.getElementsByTagName(`*`))];return n.forEach((e,t)=>{r[t].style.cssText=Eq(e)}),t}var Oq=[{id:`listItemFirstChild`,evaluate:({parent:e,isFirst:t})=>t&&e&&[`listItem`,`taskItem`].includes(e.type.name)?1e3:0},{id:`listWrapperDeprioritize`,evaluate:({node:e})=>{let t=[`listItem`,`taskItem`],n=e.firstChild;return n&&t.includes(n.type.name)?1e3:0}},{id:`tableStructure`,evaluate:({node:e,parent:t})=>[`tableRow`,`tableCell`,`tableHeader`].includes(e.type.name)||t&&t.type.name===`tableHeader`?1e3:0},{id:`inlineContent`,evaluate:({node:e})=>e.isInline||e.isText?1e3:0}],kq={edges:[`left`,`top`],threshold:12,strength:500};function Aq(e){return e===void 0||e===`left`?{...kq}:e===`right`?{edges:[`right`,`top`],threshold:12,strength:500}:e===`both`?{edges:[`left`,`right`,`top`],threshold:12,strength:500}:e===`none`?{edges:[],threshold:0,strength:0}:{...kq,...e}}function jq(e,t,n){if(n.edges.length===0)return!1;let r=t.getBoundingClientRect(),{threshold:i,edges:a}=n;return a.some(t=>t===`left`?e.x-r.left<i:t===`right`?r.right-e.x<i:t===`top`?e.y-r.top<i:t===`bottom`?r.bottom-e.y<i:!1)}function Mq(e,t,n,r){return!t||n.edges.length===0?0:jq(e,t,n)?n.strength*r:0}var Nq=1e3;function Pq(e,t,n,r){let i=Nq,a=!1;if(t.every(t=>{let n=t.evaluate(e);return i-=n,i<=0?(a=!0,!1):!0}),a)return-1;let o=e.view.nodeDOM(e.pos);return i-=Mq(r,o,n,e.depth),i<=0?-1:i}function Fq(e,t,n){return Array.from({length:t},(e,n)=>t-1-n).some(t=>n.includes(e.node(t).type.name))}function Iq(e,t,n){if(!Number.isFinite(t.x)||!Number.isFinite(t.y))return null;let r=e.posAtCoords({left:t.x,top:t.y});if(!r)return null;let{doc:i}=e.state,a=i.resolve(r.pos),o=[];n.defaultRules&&o.push(...Oq),o.push(...n.rules);let s=Array.from({length:a.depth},(e,t)=>a.depth-t).map(r=>{let i=a.node(r),s=a.before(r);if(n.allowedContainers&&r>0&&!Fq(a,r,n.allowedContainers))return null;let c=r>0?a.node(r-1):null,l=r>0?a.index(r-1):0,u=c?c.childCount:1,d=Pq({node:i,pos:s,depth:r,parent:c,index:l,isFirst:l===0,isLast:l===u-1,$pos:a,view:e},o,n.edgeDetection,t);return d<0?null:{node:i,pos:s,depth:r,score:d,dom:e.nodeDOM(s)}}).filter(e=>e!==null),c=a.nodeAfter;if(c&&c.isAtom&&!c.isInline){let i=r.pos,l=a.depth+1,u=a.parent,d=a.index(),f=u.childCount,p=!0;if(n.allowedContainers&&(p=Fq(a,l,n.allowedContainers)),p){let r=Pq({node:c,pos:i,depth:l,parent:u,index:d,isFirst:d===0,isLast:d===f-1,$pos:a,view:e},o,n.edgeDetection,t);if(r>=0){let t=e.nodeDOM(i);t&&s.push({node:c,pos:i,depth:l,score:r,dom:t})}}}if(s.length===0)return null;s.sort((e,t)=>t.score===e.score?t.depth-e.depth:t.score-e.score);let l=s[0];return l.dom?{node:l.node,pos:l.pos,dom:l.dom}:null}function Lq(e,t){let n=e;for(;n?.parentElement&&n.parentElement!==t.dom;)n=n.parentElement;return n?.parentElement===t.dom?n:void 0}function Rq(e){return Number.isFinite(e.top)&&Number.isFinite(e.bottom)&&Number.isFinite(e.left)&&Number.isFinite(e.right)&&e.width>0&&e.height>0}function zq(e,t,n,r=5){if(!Number.isFinite(t)||!Number.isFinite(n))return null;let i=e.dom,a=i.firstElementChild,o=i.lastElementChild;if(!a||!o)return null;let s=a.getBoundingClientRect(),c=o.getBoundingClientRect();if(!Rq(s)||!Rq(c))return null;let l=Math.min(Math.max(s.top+r,n),c.bottom-r),u=.5,d=Math.abs(s.left-c.left)<u,f=Math.abs(s.right-c.right)<u,p=s;d&&f&&(p=s);let m=Math.min(Math.max(p.left+r,t),p.right-r);return!Number.isFinite(m)||!Number.isFinite(l)?null:{x:m,y:l}}var Bq=e=>{let{x:t,y:n,editor:r,nestedOptions:i}=e,{view:a,state:o}=r,s=zq(a,t,n,5);if(!s)return{resultElement:null,resultNode:null,pos:null};let{x:c,y:l}=s;if(i?.enabled){let e=Iq(a,{x:c,y:l},i);return e?{resultElement:e.dom,resultNode:e.node,pos:e.pos}:{resultElement:null,resultNode:null,pos:null}}let u=a.root.elementsFromPoint(c,l),d;if(Array.prototype.some.call(u,e=>{if(!a.dom.contains(e))return!1;let t=Lq(e,a);return t?(d=t,!0):!1}),!d){let e=a.posAtCoords({left:c,top:l});if(e){let t=o.doc.resolve(e.pos),n=Math.min(t.depth,1),r=n>0?t.before(n):t.pos,i=o.doc.nodeAt(r);if(i){let e=a.nodeDOM(r);return{resultElement:e instanceof HTMLElement?e:null,resultNode:i,pos:r}}}return{resultElement:null,resultNode:null,pos:null}}let f;try{f=a.posAtDOM(d,0)}catch{return{resultElement:null,resultNode:null,pos:null}}let p=o.doc.nodeAt(f);if(!p){let e=o.doc.resolve(f),t=e.parent;return{resultElement:d,resultNode:t,pos:e.start()}}return{resultElement:d,resultNode:p,pos:f}};function Vq(e,t){let n=null,r=e.nodeDOM(t);if(r instanceof Element)n=r;else{let{node:r,offset:i}=e.domAtPos(t),a=r.childNodes[i];a instanceof Element?n=a:r instanceof Element?n=r:r.nodeType===Node.TEXT_NODE&&r.parentElement&&(n=r.parentElement)}return(n?getComputedStyle(n).direction:getComputedStyle(e.dom).direction)||`ltr`}function Hq(e){var t;(t=e.parentNode)==null||t.removeChild(e)}function Uq(e,t,n,r){let{doc:i}=t.view.state;if(n?.enabled&&r?.node&&r.pos>=0){let e=r.pos,t=r.pos+r.node.nodeSize;return[{$from:i.resolve(e),$to:i.resolve(t)}]}let a=Bq({editor:t,x:e.clientX,y:e.clientY,direction:`right`,nestedOptions:n});if(!a.resultNode||a.pos===null)return[];let o=a.resultNode.isText||a.resultNode.isAtom?0:-1;return Sq(i.resolve(a.pos),i.resolve(a.pos+a.resultNode.nodeSize+o),0,{extendOnBoundaryOverlap:!1})}function Wq(e,t,n,r){let{view:i}=t;if(!e.dataTransfer)return;let{empty:a,$from:o,$to:s}=i.state.selection,c=Uq(e,t,n,r),l=Sq(o,s,0,{extendOnBoundaryOverlap:!1}),u=l.some(e=>c.find(t=>t.$from===e.$from&&t.$to===e.$to)),d=a||!u?c:l;if(!d.length)return;let{tr:f}=i.state,p=document.createElement(`div`),m=d[0].$from.pos,h=d[d.length-1].$to.pos;p.setAttribute(`dir`,Vq(i,m));let g=n?.enabled&&r?.node,_,v;g?(_=i.state.doc.slice(m,h),v=Nt.create(i.state.doc,m)):(v=wq.create(i.state.doc,m,h),_=v.content()),d.forEach(e=>{let t=Dq(i.nodeDOM(e.$from.pos));p.append(t)}),p.style.position=`absolute`,p.style.top=`-10000px`,p.style.contentVisibility=`visible`,document.body.append(p);for(let e of p.querySelectorAll(`*`))e.style&&e.style.contentVisibility===`auto`&&(e.style.contentVisibility=`visible`);e.dataTransfer.clearData();let y=p.getBoundingClientRect(),b=i.nodeDOM(m),x=b&&b.nodeType===1?b.getBoundingClientRect():null,S=x?Math.min(e.clientX-x.left,y.width):Math.max(0,Math.min(e.clientX-y.left,y.width)),C=x?Math.min(Math.max(e.clientY-x.top,0),y.height):0;e.dataTransfer.setDragImage(p,S,C);let w=!1,T=()=>{w||(w=!0,Hq(p),document.removeEventListener(`drop`,T),document.removeEventListener(`dragend`,T))},E=v instanceof Nt?v:void 0;i.dragging={slice:_,move:!0,node:E},f.setSelection(v),i.dispatch(f),document.addEventListener(`drop`,T),document.addEventListener(`dragend`,T)}var Gq=(e,t)=>{let n=e.resolve(t),{depth:r}=n;return r===0?t:n.pos-n.parentOffset-1},Kq=(e,t)=>{let n=e.nodeAt(t),r=e.resolve(t),{depth:i}=r,a=n;for(;i>0;){let e=r.node(i);--i,i===0&&(a=e)}return a},qq=(e,t)=>{let n=Hv.getState(e);return n?Oy(t,n.type,n.binding.mapping):null},Jq=(e,t)=>{let n=Hv.getState(e);return n?Ay(n.doc,n.type,t,n.binding.mapping)||0:-1},Yq=(e,t)=>{let n=t;for(;n?.parentNode&&n.parentNode!==e.dom;)n=n.parentNode;return n},Xq=new q(`dragHandle`),Zq=({pluginKey:e=Xq,element:t,editor:n,computePositionConfig:r,getReferencedVirtualElement:i,onNodeChange:a,onElementDragStart:o,onElementDragEnd:s,nestedOptions:c})=>{let l=document.createElement(`div`),u=!1,d=null,f=-1,p,m=null,h=null;function g(){t&&(t.style.visibility=`hidden`,t.style.pointerEvents=`none`)}function _(){if(t){if(!n.isEditable){g();return}t.style.visibility=``,t.style.pointerEvents=`auto`}}function v(e){Or(i?.()||{getBoundingClientRect:()=>e.getBoundingClientRect()},t,r).then(e=>{Object.assign(t.style,{position:e.strategy,left:`${e.x}px`,top:`${e.y}px`})})}function y(e){o?.(e),Wq(e,n,c,{node:d,pos:f}),t&&(t.dataset.dragging=`true`),setTimeout(()=>{t&&(t.style.pointerEvents=`none`)},0)}function b(e){s?.(e),g(),t&&(t.style.pointerEvents=`auto`,t.dataset.dragging=`false`)}function x(){if(ht()){let e=n.view.dom;requestAnimationFrame(()=>{e.isContentEditable&&(e.contentEditable=`false`,e.contentEditable=`true`)})}}return l.appendChild(t),{unbind(){t.removeEventListener(`dragstart`,y),t.removeEventListener(`dragend`,b),document.removeEventListener(`drop`,x),m&&(cancelAnimationFrame(m),m=null,h=null)},plugin:new Ht({key:typeof e==`string`?new q(e):e,state:{init(){return{locked:!1}},apply(e,r,i,o){let s=e.getMeta(`lockDragHandle`),c=e.getMeta(`hideDragHandle`);if(s!==void 0&&(u=s),c)return g(),u=!1,d=null,f=-1,a?.({editor:n,node:null,pos:-1}),r;if(e.docChanged&&f!==-1&&t)if(pq(e)){let e=Jq(o,p);e!==f&&(f=e)}else{let t=e.mapping.map(f);t!==f&&(f=t,p=qq(o,f))}return r}},view:e=>{var r;return t.draggable=!0,t.style.pointerEvents=`auto`,t.dataset.dragging=`false`,(r=n.view.dom.parentElement)==null||r.appendChild(l),l.style.pointerEvents=`none`,l.style.position=`absolute`,l.style.top=`0`,l.style.left=`0`,t.addEventListener(`dragstart`,y),t.addEventListener(`dragend`,b),document.addEventListener(`drop`,x),{update(r,i){if(!t)return;if(!n.isEditable){g();return}if(u?t.draggable=!1:t.draggable=!0,e.state.doc.eq(i.doc)||f===-1)return;let o=e.nodeDOM(f);if(o=Yq(e,o),o===e.dom||o?.nodeType!==1)return;let s=e.posAtDOM(o,0),c=Kq(n.state.doc,s),l=Gq(n.state.doc,s);d=c,f=l,p=qq(e.state,f),a?.({editor:n,node:d,pos:f}),v(o)},destroy(){t.removeEventListener(`dragstart`,y),t.removeEventListener(`dragend`,b),document.removeEventListener(`drop`,x),m&&(cancelAnimationFrame(m),m=null,h=null),t&&Hq(l)}}},props:{handleDOMEvents:{keydown(e){return!t||u?!1:e.hasFocus()?(g(),d=null,f=-1,a?.({editor:n,node:null,pos:-1}),!1):!1},mouseleave(e,t){return u||t.target&&!l.contains(t.relatedTarget)&&(g(),d=null,f=-1,a?.({editor:n,node:null,pos:-1})),!1},mousemove(e,r){return!t||u||(h={x:r.clientX,y:r.clientY},m)||(m=requestAnimationFrame(()=>{if(m=null,!h)return;let{x:t,y:r}=h;h=null;let i=Bq({x:t,y:r,direction:`right`,editor:n,nestedOptions:c});if(!i.resultElement)return;let o=i.resultElement,s=i.resultNode,l=i.pos;if(!c?.enabled){if(o=Yq(e,o),o===e.dom||o?.nodeType!==1)return;let t=e.posAtDOM(o,0);s=Kq(n.state.doc,t),l=Gq(n.state.doc,t)}s!==d&&(d=s,f=l??-1,p=qq(e.state,f),a?.({editor:n,node:d,pos:f}),v(o),_())})),!1}}}})}};function Qq(e){return e===!1||e===void 0?{enabled:!1,rules:[],defaultRules:!0,allowedContainers:void 0,edgeDetection:Aq(`none`)}:e===!0?{enabled:!0,rules:[],defaultRules:!0,allowedContainers:void 0,edgeDetection:Aq(`left`)}:{enabled:!0,rules:e.rules??[],defaultRules:e.defaultRules??!0,allowedContainers:e.allowedContainers,edgeDetection:Aq(e.edgeDetection)}}var $q={placement:`left-start`,strategy:`absolute`};F.create({name:`dragHandle`,addOptions(){return{render(){let e=document.createElement(`div`);return e.classList.add(`drag-handle`),e},computePositionConfig:{},locked:!1,onNodeChange:()=>null,onElementDragStart:void 0,onElementDragEnd:void 0,nested:!1}},addCommands(){return{lockDragHandle:()=>({editor:e})=>(this.options.locked=!0,e.commands.setMeta(`lockDragHandle`,this.options.locked)),unlockDragHandle:()=>({editor:e})=>(this.options.locked=!1,e.commands.setMeta(`lockDragHandle`,this.options.locked)),toggleDragHandle:()=>({editor:e})=>(this.options.locked=!this.options.locked,e.commands.setMeta(`lockDragHandle`,this.options.locked))}},addProseMirrorPlugins(){let e=this.options.render(),t=Qq(this.options.nested);return[Zq({computePositionConfig:{...$q,...this.options.computePositionConfig},getReferencedVirtualElement:this.options.getReferencedVirtualElement,element:e,editor:this.editor,onNodeChange:this.options.onNodeChange,onElementDragStart:this.options.onElementDragStart,onElementDragEnd:this.options.onElementDragEnd,nestedOptions:t}).plugin]}});var eJ=20,tJ=44,nJ=28;function rJ(e){if(!e)return`Select block`;if(e.type.name===`jsxComponent`){let t=e.attrs.componentName??``;if(t){let e=kM(t),n=e.name===`*`?t:e.displayName??e.name;if(n)return`Select ${n}`}}return`Select ${e.type.name}`}function iJ(){let e=document.createElement(`div`);e.className=`ok-block-controls`,e.setAttribute(MF,`true`),e.style.visibility=`hidden`;let t=document.createElement(`button`);t.className=`ok-add-block-btn`,t.setAttribute(`aria-label`,`Add block below`),t.setAttribute(`type`,`button`),t.innerHTML=`<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-plus"><path d="M5 12h14"/><path d="M12 5v14"/></svg>`,t.addEventListener(`mousedown`,e=>{e.preventDefault(),e.stopPropagation()});let n=document.createElement(`button`);return n.className=`ok-drag-grip`,n.setAttribute(`type`,`button`),n.setAttribute(`aria-label`,`Select block`),n.setAttribute(`tabindex`,`-1`),n.innerHTML=`<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-grip-vertical-icon lucide-grip-vertical"><circle cx="9" cy="12" r="1"/><circle cx="9" cy="5" r="1"/><circle cx="9" cy="19" r="1"/><circle cx="15" cy="12" r="1"/><circle cx="15" cy="5" r="1"/><circle cx="15" cy="19" r="1"/></svg>`,e.appendChild(t),e.appendChild(n),{container:e,addBtn:t,grip:n}}function aJ(e,t,n){let{state:r,view:i}=e;if(n.type.name===`jsxComponent`){let i=n.attrs.componentName??``;if(i){let a=kM(i);if(a.emptyChildName){let i=t+1+n.content.size;if(i>r.doc.content.size)return;let o=a.emptyChildName;e.chain().focus().insertContentAt(i,FM(o)).run(),zM(e,i,kM(o));return}}}let a=t+n.nodeSize;if(a>r.doc.content.size)return;let{tr:o}=r,s=r.schema.nodes.paragraph?.create();if(!s)return;o.insert(a,s);let c=p.near(o.doc.resolve(a+1));o.setSelection(c).scrollIntoView(),i.dispatch(o),i.focus(),e.commands.insertContent(`/`)}var oJ=F.create({name:`blockDragHandle`,addProseMirrorPlugins(){let e=this.editor,t=null,n=-1,{container:r,addBtn:i,grip:a}=iJ();return i.addEventListener(`click`,()=>{t&&n>=0&&aJ(e,n,t)}),a.addEventListener(`click`,()=>{if(n<0)return;let r=t,i=r?.type.name??`unknown`;try{e.chain().focus().setNodeSelection(n).run()||(C(i),console.warn(JSON.stringify({event:`block-grip-click-select-failed`,nodeType:i,componentName:String(r?.attrs.componentName??``).slice(0,200),reason:`chain-dispatch-returned-false`})))}catch(e){if(!(e instanceof RangeError))throw e;C(i),console.warn(JSON.stringify({event:`block-grip-click-select-failed`,nodeType:i,componentName:String(r?.attrs.componentName??``).slice(0,200),reason:e.message.slice(0,500)}))}}),[Zq({element:r,editor:e,onNodeChange({node:e,pos:r}){t=e,n=r??-1,a.setAttribute(`aria-label`,rJ(e))},computePositionConfig:{placement:`left-start`,strategy:`absolute`,middleware:[jr(({rects:e})=>({mainAxis:10,crossAxis:((e.reference.height<=tJ?e.reference.height:nJ)-eJ)/2}))]},nestedOptions:Qq(!1)}).plugin]}}),sJ=/^#fn(?:ref)?-/,cJ=F.create({name:`footnoteAnchorScroll`,addProseMirrorPlugins(){return[new Ht({props:{handleDOMEvents:{click(e,t){let n=t.target;if(!(n instanceof Element))return!1;let r=n.closest(`a[href^="#fn"]`);if(!(r instanceof HTMLAnchorElement))return!1;let i=r.getAttribute(`href`)??``;if(!sJ.test(i))return!1;let a=i.slice(1);t.preventDefault();let o=e.dom.ownerDocument.getElementById(a);return o&&o.scrollIntoView({behavior:`smooth`,block:`start`}),!0}}}})]}}),lJ=F.create({name:`formattingShortcuts`,addKeyboardShortcuts(){return{"Mod-Shift-x":()=>this.editor.commands.toggleStrike()}}}),uJ=F.create({name:`headingAnchors`,addProseMirrorPlugins(){return[new Ht({props:{decorations(e){let t=[],n=new Map;return e.doc.descendants((e,r)=>{if(e.type.name===`heading`){let i=at(e.textContent,n);if(!i)return;t.push(dt.node(r,r+e.nodeSize,{id:i}))}}),Qe.create(e.doc,t)}}})]}});function dJ(e){let t=(0,Z.c)(8),{node:n,editor:r}=e,i=n.attrs.src,a=n.attrs.alt,o=n.attrs.title,s;if(t[0]!==r||t[1]!==i){let e=r?vO(r)??void 0:void 0;s=typeof i==`string`?d(Ve(i,e)):void 0,t[0]=r,t[1]=i,t[2]=s}else s=t[2];let c=s,l=typeof a==`string`?a:``,u=typeof o==`string`?o:void 0,f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f={sizes:void 0},t[3]=f):f=t[3];let p;return t[4]!==l||t[5]!==c||t[6]!==u?(p=(0,X.jsx)(Jl,{as:`span`,"data-image-inline-zoom":!0,"data-clipboard-inline-leaf":`image`,children:(0,X.jsx)(hA,{wrapElement:`span`,zoomMargin:20,zoomImg:f,children:(0,X.jsx)(`img`,{src:c,alt:l,title:u})})}),t[4]=l,t[5]=c,t[6]=u,t[7]=p):p=t[7],p}var fJ=T.extend({addNodeView(){return nu(dJ)}});function pJ(e,t){let n=e;for(;n&&typeof n.hasAttribute==`function`;){if(n.hasAttribute(`data-wiki-embed`)){let e=n.getAttribute(`data-target`)??``;if(!e)return null;let r=h(e,t);return r?{kind:n.tagName===`IMG`?`image`:`asset`,relPath:r,title:r.split(`/`).pop()??e}:null}if(n.hasAttribute(`data-wiki-link`)){let e=n.getAttribute(`data-target`)??``;return e?{kind:`wiki-link`,relPath:`${e}.md`,title:e}:null}if(n.tagName===`A`&&n.hasAttribute(`href`)){let e=u(n.getAttribute(`href`)??``,t);if(e?.kind===`asset`){let n=h(e.url,t);return n?{kind:`asset`,relPath:n,title:n.split(`/`).pop()??e.url}:null}}if(n.tagName===`IMG`){let e=n.getAttribute(`src`)??``;if(e){let n=u(e,t);if(n?.kind===`asset`){let e=h(n.url,t);return e?{kind:`image`,relPath:e,title:e.split(`/`).pop()??n.url}:null}}}n=n.parentElement}return null}var mJ=new q(`asset-context-menu`);function hJ(e){return new Ht({key:mJ,view(t){let n=e.showAssetMenu??(e=>{let t=globalThis.window?.okDesktop;return t?t.shell.showAssetMenu({relPath:e.relPath,title:e.title,kind:e.kind}):Promise.resolve()}),r=t=>{if(!(t.target instanceof Element))return;let r=pJ(t.target,e.sourceDocName);r&&(t.preventDefault(),n(r))};return t.dom.addEventListener(`contextmenu`,r),{destroy(){t.dom.removeEventListener(`contextmenu`,r)}}}})}var gJ=e=>{let t=(0,Z.c)(18),{kind:n,ariaLabel:r,onDeactivate:i,children:a,triggerReference:o,layout:s,className:c,"data-slot":l}=e,u=s===void 0?`standard`:s,d=(0,Q.useRef)(null),f,p;t[0]===o?(f=t[1],p=t[2]):(f=()=>{let e=d.current;if(e)return wr(o,e,()=>{let t=o.getBoundingClientRect();e.isConnected&&(e.style.left=`${t.left}px`,e.style.top=`${t.top}px`,e.style.width=`${t.width}px`,e.style.height=`${t.height}px`)})},p=[o],t[0]=o,t[1]=f,t[2]=p),(0,Q.useLayoutEffect)(f,p);let m;t[3]===i?m=t[4]:(m=e=>{e||i()},t[3]=i,t[4]=m);let h;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,X.jsx)(vc,{asChild:!0,children:(0,X.jsx)(`span`,{ref:d,"aria-hidden":`true`,style:{position:`fixed`,pointerEvents:`none`,left:`-9999px`,top:`-9999px`,width:0,height:0}})}),t[5]=h):h=t[5];let g=u===`wide`?`w-[min(720px,calc(100%-1rem))]`:`w-80`,_;t[6]!==c||t[7]!==g?(_=Xt(`ok-interaction-prop-panel pointer-events-auto p-3`,g,c),t[6]=c,t[7]=g,t[8]=_):_=t[8];let v;t[9]!==r||t[10]!==a||t[11]!==l||t[12]!==n||t[13]!==_?(v=(0,X.jsx)(_c,{side:`bottom`,align:`start`,sideOffset:8,collisionPadding:8,"aria-label":r,"data-ok-prop-panel":n,"data-slot":l,onOpenAutoFocus:_J,onCloseAutoFocus:vJ,onPointerDownOutside:yJ,onFocusOutside:bJ,onInteractOutside:xJ,className:_,children:a}),t[9]=r,t[10]=a,t[11]=l,t[12]=n,t[13]=_,t[14]=v):v=t[14];let y;return t[15]!==m||t[16]!==v?(y=(0,X.jsxs)(hc,{open:!0,onOpenChange:m,children:[h,v]}),t[15]=m,t[16]=v,t[17]=y):y=t[17],y};function _J(e){return e.preventDefault()}function vJ(e){return e.preventDefault()}function yJ(e){e.target?.closest(`[data-ok-layer-spawned]`)&&e.preventDefault()}function bJ(e){e.target?.closest(`[data-ok-layer-spawned]`)&&e.preventDefault()}function xJ(e){e.target?.closest(`[data-ok-layer-spawned]`)&&e.preventDefault()}function SJ(e){let t=e.trim();return/\.(md|mdx)$/i.test(t)?t:`${t}.md`}function CJ(e){let t=e.initialDir.trim().replace(/^\/+|\/+$/g,``),n=SJ(e.suggestedName);return t?`${t}/${n}`:n}async function wJ(e){let t=await jx(await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),`Failed to create page`);if(!t.ok)throw Error(t.title);let n=e.replace(/\.(mdx|md)$/i,``);return{docName:Mx(Ft,t.body,`create-page`,{docName:n}).docName}}async function TJ(e){return wJ(CJ(e))}async function EJ(e,t){let{docName:n}=await TJ(e);return t.addPage(n),tr([`files`,`backlinks`,`graph`]),t.onCreated?.(n),{docName:n}}var DJ=8;function OJ(e){return e.trim().replace(/^\/+/,``).replace(/\.mdx?$/i,``).replace(/\/+$/g,``)}function kJ(e){return AJ(e)?OJ(e.slice(1)).toLowerCase():null}function AJ(e){return e.startsWith(`/`)&&!e.startsWith(`//`)}function jJ(e){return e.split(`/`).at(-1)??e}function MJ(e,t){if(!t)return 0;let n=e.toLowerCase(),r=jJ(e).toLowerCase();return n===t?0:r===t?1:n.startsWith(t)?2:r.startsWith(t)?3:r.includes(t)?4:n.includes(t)?5:null}function NJ(e){switch(e){case`page`:return 0;case`folder`:return 1;case`asset`:return 2}}function PJ(e){let t=[],n=new Set;function r(e,r){let i=OJ(r);if(!i)return;let a=`${e}:${i.toLowerCase()}`;n.has(a)||(n.add(a),t.push({kind:e,path:i}))}for(let t of e.pages)r(`page`,t);for(let t of e.folderPaths??[])r(`folder`,t);if(e.includeAssets)for(let t of e.assetPaths??[])r(`asset`,t);return t}function FJ(e){let t=kJ(e.value);if(t===null)return[];let n=[];for(let r of PJ(e)){let e=MJ(r.path,t);e!==null&&n.push({suggestion:r,score:e})}return n.sort((e,t)=>{if(e.score!==t.score)return e.score-t.score;let n=NJ(e.suggestion.kind)-NJ(t.suggestion.kind);return n===0?e.suggestion.path.localeCompare(t.suggestion.path):n}),n.slice(0,e.limit??DJ).map(e=>e.suggestion)}var IJ=`[data-ok-link-path-suggestion-panel]`;function LJ(e){return e instanceof Element&&e.closest(IJ)!==null}function RJ(e){LJ(e.target)&&e.preventDefault()}function zJ(e){switch(e.kind){case`page`:return(0,X.jsx)(Db,{className:`size-3.5`,docExt:`.md`,kind:`file`,path:e.path});case`folder`:return(0,X.jsx)(Db,{className:`size-3.5`,kind:`folder`,path:e.path});case`asset`:return(0,X.jsx)(Db,{bodyIndexed:!1,className:`size-3.5`,kind:`file`,path:e.path})}}function BJ(e,t){if(e){if(typeof e==`function`){e(t);return}e.current=t}}function VJ(e){let t=(0,Z.c)(54),n,r,i,a,o,c,l,u,d,f,p,m,h,g;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13],g=t[14]):({value:g,pages:f,folderPaths:i,assetPaths:n,includeAssets:m,loading:h,onValueChange:d,onKeyDown:l,onSuggestionSelect:u,onFocus:c,onBlur:o,className:r,ref:p,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m,t[13]=h,t[14]=g);let _=m===void 0?!1:m,v=h===void 0?!1:h,{_:y}=s(),[b,x]=(0,Q.useState)(!1),[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(0),E=(0,Q.useRef)(null),D=(0,Q.useRef)(null),O=(0,Q.useId)(),k;t[15]===g?k=t[16]:(k=g.trim(),t[15]=g,t[16]=k);let A=k===``,j=FJ({value:A?`/`:g,pages:f,folderPaths:i,assetPaths:n,includeAssets:_}),M=j.map(KJ).join(`\0`),N;t[17]===g?N=t[18]:(N=AJ(g),t[17]=g,t[18]=N);let P=A||N,F=j.length>0,I=b&&!S&&P&&(F||v)||b&&!S&&P&&!v&&!F,L=Math.min(w,Math.max(j.length-1,0)),R=F?`${O}-option-${L}`:void 0,z;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(z=()=>{T(0)},t[19]=z):z=t[19],(0,Q.useEffect)(z,[M]);let B,V;t[20]!==R||t[21]!==I?(B=()=>{!I||!R||document.getElementById(R)?.scrollIntoView?.({block:`nearest`})},V=[R,I],t[20]=R,t[21]=I,t[22]=B,t[23]=V):(B=t[22],V=t[23]),(0,Q.useEffect)(B,V);let H,ee;t[24]===I?(H=t[25],ee=t[26]):(H=()=>{if(!I)return;let e=E.current,t=D.current;if(!e||!t)return;let n=e,r=t,i=function(){Or(n,r,{placement:`bottom-start`,strategy:`fixed`,middleware:[jr(4),Pr({padding:8}),kr({padding:8}),Er({padding:8,apply(e){let{availableHeight:t,availableWidth:n,elements:r}=e;Object.assign(r.floating.style,{width:`${Math.min(480,n)}px`,maxHeight:`${Math.min(208,Math.max(96,t))}px`})}})]}).then(e=>{let{x:t,y:n}=e;r.isConnected&&Object.assign(r.style,{left:`${t}px`,top:`${n}px`})}).catch(e=>{r.isConnected&&console.warn(`[LinkPathSuggestionInput] computePosition failed`,e)})},a=wr(n,r,i);return i(),a},ee=[I],t[24]=I,t[25]=H,t[26]=ee),(0,Q.useLayoutEffect)(H,ee);let U;t[27]===p?U=t[28]:(U=function(e){E.current=e,BJ(p,e)},t[27]=p,t[28]=U);let W=U,te=function(e){u?u(e):d(e.path),C(!0),requestAnimationFrame(()=>E.current?.focus())},G=function(e){if(F){if(e.key===`ArrowDown`){e.preventDefault(),T(e=>Math.min(e+1,j.length-1));return}if(e.key===`ArrowUp`){e.preventDefault(),T(GJ);return}if(e.key===`Enter`){e.preventDefault();let t=j[L];t&&te(t);return}if(e.key===`Escape`){e.preventDefault(),C(!0);return}}if(I&&e.key===`Escape`){e.preventDefault(),C(!0);return}l?.(e)},ne;t[29]===y?ne=t[30]:(ne=function(e){switch(e){case`page`:return y({id:`6WdDG7`});case`folder`:return y({id:`kNqMMd`});case`asset`:return y({id:`bUUVED`})}},t[29]=y,t[30]=ne);let re=ne,ie=I?(0,X.jsx)(`div`,{ref:D,id:O,role:`listbox`,"aria-label":y({id:`mBltnd`}),"data-ok-layer-spawned":``,"data-ok-link-path-suggestion-panel":``,className:`fixed z-70 max-h-52 overflow-y-auto overscroll-y-contain rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-md subtle-scrollbar pointer-events-auto`,onWheel:WJ,onTouchMove:UJ,children:F?j.map((e,t)=>{let n=t===L,r=re(e.kind);return(0,X.jsxs)(en,{id:`${O}-option-${t}`,type:`button`,role:`option`,"aria-label":`/${e.path} ${r}`,"aria-selected":n,variant:`ghost`,className:Xt(`h-auto w-full justify-start gap-2 rounded-sm px-2 py-1.5 text-left font-normal`,n&&`bg-accent text-accent-foreground`),onMouseDown:HJ,onClick:()=>te(e),children:[zJ(e),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[`/`,e.path]}),(0,X.jsx)(`span`,{className:`shrink-0 text-muted-foreground text-xs`,children:r})]},`${e.kind}:${e.path}`)}):(0,X.jsx)(`div`,{role:`status`,className:`px-2 py-1.5 text-muted-foreground text-sm`,children:y(v?{id:`sxTdZI`}:{id:`_QwkMu`})})}):null,ae;t[31]===d?ae=t[32]:(ae=e=>{C(!1),d(e.target.value)},t[31]=d,t[32]=ae);let oe;t[33]===c?oe=t[34]:(oe=e=>{x(!0),c?.(e)},t[33]=c,t[34]=oe);let se;t[35]===o?se=t[36]:(se=e=>{x(!1),o?.(e)},t[35]=o,t[36]=se);let K=I?O:void 0,ce;t[37]!==R||t[38]!==r||t[39]!==G||t[40]!==a||t[41]!==W||t[42]!==I||t[43]!==ae||t[44]!==oe||t[45]!==se||t[46]!==K||t[47]!==g?(ce=(0,X.jsx)(Ir,{...a,ref:W,value:g,onChange:ae,onFocus:oe,onBlur:se,onKeyDown:G,role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":I,"aria-controls":K,"aria-activedescendant":R,autoComplete:`off`,className:r}),t[37]=R,t[38]=r,t[39]=G,t[40]=a,t[41]=W,t[42]=I,t[43]=ae,t[44]=oe,t[45]=se,t[46]=K,t[47]=g,t[48]=ce):ce=t[48];let le;t[49]===ie?le=t[50]:(le=ie&&(0,Ga.createPortal)(ie,document.body),t[49]=ie,t[50]=le);let ue;return t[51]!==ce||t[52]!==le?(ue=(0,X.jsxs)(`div`,{className:`relative`,children:[ce,le]}),t[51]=ce,t[52]=le,t[53]=ue):ue=t[53],ue}function HJ(e){return e.preventDefault()}function UJ(e){e.stopPropagation()}function WJ(e){e.stopPropagation()}function GJ(e){return Math.max(e-1,0)}function KJ(e){return`${e.kind}:${e.path}`}var qJ=1500;async function JJ(e){if(typeof navigator>`u`||!navigator.clipboard?.writeText)throw Error(`clipboard unavailable`);await navigator.clipboard.writeText(e)}function YJ(e){let t=(0,Z.c)(20),{copyContent:n,clipboardWrite:r,initialCopied:i}=e,a=r===void 0?JJ:r,o=i===void 0?!1:i,{_:c}=s(),[l,u]=(0,Q.useState)(+!!o),d=l>0,f,p;t[0]===l?(f=t[1],p=t[2]):(f=()=>{if(l===0)return;let e=setTimeout(()=>u(0),qJ);return()=>clearTimeout(e)},p=[l],t[0]=l,t[1]=f,t[2]=p),(0,Q.useEffect)(f,p);let m;t[3]!==a||t[4]!==n?(m=()=>{Promise.resolve().then(()=>a(n)).then(()=>u(ZJ),XJ)},t[3]=a,t[4]=n,t[5]=m):m=t[5];let h=m,g;t[6]!==c||t[7]!==d?(g=c(d?{id:`PiH3UR`}:{id:`he3ygx`}),t[6]=c,t[7]=d,t[8]=g):g=t[8];let _=g,v;t[9]===d?v=t[10]:(v=d?(0,X.jsx)(tn,{className:`size-3.5`,"aria-hidden":`true`}):(0,X.jsx)(Gn,{className:`size-3.5`,"aria-hidden":`true`}),t[9]=d,t[10]=v);let y;t[11]!==h||t[12]!==_||t[13]!==v?(y=(0,X.jsx)(yr,{asChild:!0,children:(0,X.jsx)(en,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":_,onClick:h,children:v})}),t[11]=h,t[12]=_,t[13]=v,t[14]=y):y=t[14];let b;t[15]===_?b=t[16]:(b=(0,X.jsx)(br,{children:_}),t[15]=_,t[16]=b);let x;return t[17]!==y||t[18]!==b?(x=(0,X.jsxs)(xr,{children:[y,b]}),t[17]=y,t[18]=b,t[19]=x):x=t[19],x}function XJ(){}function ZJ(e){return e+1}function QJ(e,t){return JO.getState(e)?.byId.get(t)??null}function $J(e){let{editor:t,layer:n,renderPropPanel:r,handlePrimary:i}=e;return{onRegister:e=>{n.register({type:e.markType,nodeId:e.id,controls:{propPanel:e=>r({editor:t,nodeId:e.nodeId,deactivate:e.deactivate})},handlePrimary:i?e=>i({editor:t,nodeId:e.nodeId,newTab:e.newTab}):void 0})},onDeregister:e=>{n.deregister(e)}}}function eY(e){let{editor:t,layer:n,markTypes:r,predicate:i,renderPropPanel:a,handlePrimary:o}=e,s=$J({editor:t,layer:n,renderPropPanel:a,handlePrimary:o});return $O({markTypes:[...r],predicate:i,onRegister:s.onRegister,onDeregister:s.onDeregister})}function tY(e){let t=pk(e.editor);return eY({...e,layer:t})}function nY(e,t){let n=(0,Z.c)(4),[r,i]=(0,Q.useState)(null),a,o;return n[0]!==e||n[1]!==t?(a=()=>{if(!t||!e){i(null);return}let n=!1;return i(null),OG(e).then(e=>{n||i(e)}).catch(()=>{n||i([])}),()=>{n=!0}},o=[e,t],n[0]=e,n[1]=t,n[2]=a,n[3]=o):(a=n[2],o=n[3]),(0,Q.useEffect)(a,o),r}function rY(e,t){let n=e.trim();return n?n.startsWith(`#`)?`anchor`:P(n)?`external`:`doc`:t}function iY(e){return e?.kind===`doc`?`doc`:e?.kind===`anchor`?`anchor`:`external`}function aY(e){let t=(0,Z.c)(84),{open:n,href:r,text:i,pages:a,folderPaths:c,loading:l,onOpenChange:u,onSave:d}=e,[f,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(``),[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(`doc`),b=(0,Q.useId)(),x=(0,Q.useId)(),S=(0,Q.useId)(),C=(0,Q.useId)(),{_:w}=s(),T=(0,Q.useRef)(!1),E=(0,Q.useRef)(``),D,O;t[0]!==r||t[1]!==n||t[2]!==i?(D=()=>{if(!n){T.current=!1;return}if(T.current)return;T.current=!0,E.current=i,_(i);let e=TW(r);if(y(iY(e)),e?.kind===`doc`){p(e.docName),h(e.anchor??``);return}if(e?.kind===`anchor`){p(`#${e.anchor}`),h(``);return}p(e?.kind===`external`?e.url:r),h(``)},O=[n,r,i],t[0]=r,t[1]=n,t[2]=i,t[3]=D,t[4]=O):(D=t[3],O=t[4]),(0,Q.useEffect)(D,O);let k,A,j;t[5]!==v||t[6]!==f||t[7]!==a?(k=jn(f),A=v===`doc`,j=A&&jO(k,a),t[5]=v,t[6]=f,t[7]=a,t[8]=k,t[9]=A,t[10]=j):(k=t[8],A=t[9],j=t[10]);let M=nY(k,j&&n),N=!!M?.length,P;t[11]!==k||t[12]!==A||t[13]!==m||t[14]!==g||t[15]!==f||t[16]!==u||t[17]!==d?(P=function(){let e=f.trim();e&&(d(A?IW(k,m.trim()||null):e,g,g.trim()!==E.current.trim()),u(!1))},t[11]=k,t[12]=A,t[13]=m,t[14]=g,t[15]=f,t[16]=u,t[17]=d,t[18]=P):P=t[18];let F=P,I;t[19]===F?I=t[20]:(I=function(e){e.key===`Enter`&&(e.preventDefault(),F())},t[19]=F,t[20]=I);let L=I,R;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(R=function(e){p(e.path),y(`doc`),h(``)},t[21]=R):R=t[21];let z=R,B;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,X.jsx)(rn,{children:(0,X.jsx)(o,{id:`B11p-O`})}),t[22]=B):B=t[22];let V;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,X.jsxs)(gn,{children:[B,(0,X.jsx)(nn,{children:(0,X.jsx)(o,{id:`RobAKV`})})]}),t[23]=V):V=t[23];let H;t[24]===A?H=t[25]:(H=A?(0,X.jsx)(o,{id:`6WdDG7`}):(0,X.jsx)(o,{id:`6vEr3W`}),t[24]=A,t[25]=H);let ee;t[26]!==H||t[27]!==b?(ee=(0,X.jsx)(`label`,{className:`mb-1.5 inline-block text-sm font-medium`,htmlFor:b,children:H}),t[26]=H,t[27]=b,t[28]=ee):ee=t[28];let U;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(U=e=>{p(e),y(t=>rY(e,t))},t[29]=U):U=t[29];let W;t[30]===w?W=t[31]:(W=w({id:`Xl-UUg`}),t[30]=w,t[31]=W);let te;t[32]!==f||t[33]!==c||t[34]!==L||t[35]!==l||t[36]!==a||t[37]!==W||t[38]!==b?(te=(0,X.jsx)(VJ,{id:b,value:f,pages:a,folderPaths:c,loading:l,onValueChange:U,onSuggestionSelect:z,placeholder:W,autoFocus:!0,onKeyDown:L}),t[32]=f,t[33]=c,t[34]=L,t[35]=l,t[36]=a,t[37]=W,t[38]=b,t[39]=te):te=t[39];let G;t[40]!==ee||t[41]!==te?(G=(0,X.jsxs)(`div`,{children:[ee,te]}),t[40]=ee,t[41]=te,t[42]=G):G=t[42];let ne;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,X.jsx)(o,{id:`QqBQu1`,components:{0:(0,X.jsx)(`span`,{className:`font-normal text-muted-foreground`})}}),t[43]=ne):ne=t[43];let re;t[44]===S?re=t[45]:(re=(0,X.jsx)(`label`,{className:`mb-1.5 inline-block text-sm font-medium`,htmlFor:S,children:ne}),t[44]=S,t[45]=re);let ie;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(ie=e=>_(e.target.value),t[46]=ie):ie=t[46];let ae;t[47]===w?ae=t[48]:(ae=w({id:`yYR6za`}),t[47]=w,t[48]=ae);let oe;t[49]!==g||t[50]!==L||t[51]!==S||t[52]!==ae?(oe=(0,X.jsx)(Ir,{id:S,value:g,onChange:ie,placeholder:ae,onKeyDown:L}),t[49]=g,t[50]=L,t[51]=S,t[52]=ae,t[53]=oe):oe=t[53];let se;t[54]!==re||t[55]!==oe?(se=(0,X.jsxs)(`div`,{children:[re,oe]}),t[54]=re,t[55]=oe,t[56]=se):se=t[56];let K;t[57]!==w||t[58]!==x||t[59]!==A||t[60]!==m||t[61]!==L||t[62]!==C||t[63]!==M||t[64]!==N?(K=A?(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`label`,{className:`mb-1.5 inline-block text-sm font-medium`,htmlFor:x,children:(0,X.jsx)(o,{id:`Tjc1pH`,components:{0:(0,X.jsx)(`span`,{className:`font-normal text-muted-foreground`})}})}),(0,X.jsx)(Ir,{id:x,value:m,onChange:e=>h(e.target.value),placeholder:w({id:`W-ntoW`}),onKeyDown:L}),N?(0,X.jsx)(`div`,{id:C,className:`mt-1.5 max-h-36 overflow-y-auto subtle-scrollbar rounded-md border border-border bg-muted/30`,children:M.map(e=>(0,X.jsxs)(`button`,{type:`button`,"aria-pressed":m===e.slug,className:Xt(`flex w-full items-center gap-2 px-2 py-1 text-left text-sm hover:bg-accent hover:text-accent-foreground`,m===e.slug&&`bg-accent text-accent-foreground`),style:{paddingLeft:`${(e.level-1)*12+8}px`},onClick:()=>h(m===e.slug?``:e.slug),children:[(0,X.jsxs)(`span`,{className:`w-7 shrink-0 font-mono text-[10px] text-muted-foreground`,children:[`H`,e.level]}),(0,X.jsx)(`span`,{className:`truncate`,children:e.text})]},`${e.slug}-${e.level}-${e.text}`))}):null]}):null,t[57]=w,t[58]=x,t[59]=A,t[60]=m,t[61]=L,t[62]=C,t[63]=M,t[64]=N,t[65]=K):K=t[65];let ce;t[66]!==G||t[67]!==se||t[68]!==K?(ce=(0,X.jsxs)(fn,{className:`space-y-6 pb-1`,children:[G,se,K]}),t[66]=G,t[67]=se,t[68]=K,t[69]=ce):ce=t[69];let le;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,X.jsx)(hn,{asChild:!0,children:(0,X.jsx)(en,{variant:`outline`,children:(0,X.jsx)(o,{id:`dEgA5A`})})}),t[70]=le):le=t[70];let ue;t[71]===f?ue=t[72]:(ue=f.trim(),t[71]=f,t[72]=ue);let de=!ue,fe;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,X.jsx)(o,{id:`tfDRzk`}),t[73]=fe):fe=t[73];let pe;t[74]!==F||t[75]!==de?(pe=(0,X.jsxs)(pn,{children:[le,(0,X.jsx)(en,{onClick:F,disabled:de,children:fe})]}),t[74]=F,t[75]=de,t[76]=pe):pe=t[76];let me;t[77]!==ce||t[78]!==pe?(me=(0,X.jsxs)(ln,{className:`sm:max-w-xl`,"data-ok-layer-spawned":``,onPointerDownOutside:RJ,onFocusOutside:RJ,onInteractOutside:RJ,children:[V,ce,pe]}),t[77]=ce,t[78]=pe,t[79]=me):me=t[79];let he;return t[80]!==u||t[81]!==n||t[82]!==me?(he=(0,X.jsx)(_n,{open:n,onOpenChange:u,children:me}),t[80]=u,t[81]=n,t[82]=me,t[83]=he):he=t[83],he}function oY(e){let t=(0,Z.c)(99),{editor:n,nodeId:r,sourceDocName:i,onClose:a,onNavigate:c}=e,l=QJ(n.state,r),d=l?.attrs?.href??``,[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(!1),g;t[0]!==r||t[1]!==p?(g=()=>{qO(r)&&p(!0)},t[0]=r,t[1]=p,t[2]=g):g=t[2];let _;t[3]===r?_=t[4]:(_=[r],t[3]=r,t[4]=_),(0,Q.useEffect)(g,_);let{addPage:v,folderPaths:y,pages:b,loading:x}=Mn(),{_:S}=s();if(!l)return null;let C=n.state.doc.textBetween(l.from,l.to),w=d?u(d,i):null,T;t[5]!==n||t[6]!==r?(T=function(e,t,i){let a=QJ(n.state,r);if(!a)return;let o=t.trim();if(!i||!o){n.chain().setTextSelection({from:a.from,to:a.to}).extendMarkRange(`link`).updateAttributes(`link`,{href:e}).run();return}let s=n.schema.marks.link;if(!s)return;let c=s.create({href:e}),l=n.schema.text(o,[c]);n.view.dispatch(n.state.tr.replaceWith(a.from,a.to,l))},t[5]=n,t[6]=r,t[7]=T):T=t[7];let E=T,D;t[8]!==n||t[9]!==r||t[10]!==a?(D=function(){let e=QJ(n.state,r);e&&(n.chain().focus().setTextSelection({from:e.from,to:e.to}).extendMarkRange(`link`).unsetLink().run(),a())},t[8]=n,t[9]=r,t[10]=a,t[11]=D):D=t[11];let O=D,k;t[12]!==n||t[13]!==r||t[14]!==a||t[15]!==p?(k=function(e){if(e){p(!0);return}let t=QJ(n.state,r);if(t?.attrs?.href??``){p(!1);return}t&&n.chain().focus().deleteRange({from:t.from,to:t.to}).run(),a()},t[12]=n,t[13]=r,t[14]=a,t[15]=p,t[16]=k):k=t[16];let A=(0,X.jsx)(aY,{open:f,href:d,text:C,pages:b,folderPaths:y,loading:x,onOpenChange:d?p:k,onSave:E});if(!d)return(0,X.jsx)(X.Fragment,{children:A});let j=w?.kind===`doc`?`${w.docName}${w.anchor?`#${w.anchor}`:``}`:w?.kind===`anchor`?`#${w.anchor}`:w?.kind===`external`?w.url:d,M=function(e){let t=QJ(n.state,r);t&&n.chain().setTextSelection({from:t.from,to:t.to}).extendMarkRange(`link`).updateAttributes(`link`,{href:IW(e,w?.kind===`doc`?w.anchor??null:null)}).run()},N,P=!1,F=!1,I=null;if(x){let e;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(zn,{className:`size-3.5 shrink-0 animate-spin`,"aria-hidden":`true`}),t[17]=e):e=t[17],N={icon:e,text:S({id:`yQE2r9`}),className:`text-muted-foreground/80`}}else if(w?.kind===`asset`){let e;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(ia,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),t[18]=e):e=t[18],N={icon:e,text:S({id:`yWWThY`}),className:`text-muted-foreground`}}else if(w?.kind===`external`){let e;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(wn,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),t[19]=e):e=t[19],N={icon:e,text:S({id:`zgSFyG`}),className:`text-muted-foreground`}}else if(w?.kind===`anchor`){let e;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(ia,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),t[20]=e):e=t[20],N={icon:e,text:S({id:`dprWmL`}),className:`text-muted-foreground`}}else if(w?.kind===`doc`){let e=pW(w.docName,{pages:b,folderPaths:y});if(F=e.kind===`navigate`&&e.displayState===`folder`,P=e.kind===`create`,I=e.kind===`create`?{initialDir:e.initialDir,suggestedName:e.suggestedName}:null,F){let e;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(Bn,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),t[21]=e):e=t[21],N={icon:e,text:S({id:`kNqMMd`}),className:`text-muted-foreground`}}else if(P){let e;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(Wi,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),t[22]=e):e=t[22],N={icon:e,text:S({id:`8F1i42`}),className:`text-red-700 dark:text-red-300`}}else{let e;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(ia,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),t[23]=e):e=t[23],N={icon:e,text:S({id:`JtD-Br`}),className:`text-muted-foreground`}}}else{let e;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(Wi,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),t[24]=e):e=t[24],N={icon:e,text:S({id:`-g6KIS`}),className:`text-muted-foreground/80`}}let L=w?.kind===`external`,R=w?.kind===`doc`?EW({docName:w.docName,anchor:w.anchor}):w?.kind===`anchor`?EW({docName:i,anchor:w.anchor}):w?.kind===`external`&&CW(w.url)?w.url:null,z=!x&&R!==null&&(w?.kind===`anchor`||w?.kind===`external`||w?.kind===`doc`&&!P&&!F),B;t[25]!==n.state||t[26]!==n.view||t[27]!==r?(B=()=>{let e=QJ(n.state,r);if(!e)return new DOMRect;try{return At(n.view,e.from,e.to)}catch{return new DOMRect}},t[25]=n.state,t[26]=n.view,t[27]=r,t[28]=B):B=t[28];let V;t[29]!==n.view.dom||t[30]!==B?(V={getBoundingClientRect:B,contextElement:n.view.dom},t[29]=n.view.dom,t[30]=B,t[31]=V):V=t[31];let H=V,ee;t[32]!==S||t[33]!==v||t[34]!==m||t[35]!==I||t[36]!==a||t[37]!==M?(ee=async function(){if(!(!I||m)){h(!0);try{await EJ(I,{addPage:v,onCreated(e){M(e),window.location.hash=`#/${e}`,a()}}),h(!1)}catch(e){let t=e;Qn.error(t instanceof Error?t.message:S({id:`tfi40B`})),h(!1)}}},t[32]=S,t[33]=v,t[34]=m,t[35]=I,t[36]=a,t[37]=M,t[38]=ee):ee=t[38];let U=ee,W=Xt(`flex shrink-0`,N.className),te;t[39]!==N.icon||t[40]!==W?(te=(0,X.jsx)(`span`,{className:W,children:N.icon}),t[39]=N.icon,t[40]=W,t[41]=te):te=t[41];let G=te,ne;t[42]!==G||t[43]!==P||t[44]!==N.text?(ne=P?(0,X.jsxs)(xr,{children:[(0,X.jsx)(yr,{asChild:!0,children:(0,X.jsx)(`span`,{className:`flex shrink-0`,"data-slot":`internal-link-prop-panel-icon-trigger`,children:G})}),(0,X.jsx)(br,{children:N.text})]}):G,t[42]=G,t[43]=P,t[44]=N.text,t[45]=ne):ne=t[45];let re=ne,ie=`${N.text}: ${j}`,ae;t[46]!==j||t[47]!==L||t[48]!==P||t[49]!==R||t[50]!==z||t[51]!==a||t[52]!==c?(ae=(0,X.jsx)(yr,{asChild:!0,children:z?(0,X.jsx)(`a`,{href:R??void 0,...L?{target:`_blank`,rel:`noopener noreferrer`}:{},onClick:e=>NW(e,c,a),"data-slot":`internal-link-prop-panel-text`,className:`block truncate text-sm font-medium text-foreground underline-offset-2 hover:underline focus-visible:underline`,children:j}):(0,X.jsx)(`span`,{"data-slot":`internal-link-prop-panel-text`,className:Xt(`block truncate text-sm font-medium`,P?`text-muted-foreground`:`text-foreground`),children:j})}),t[46]=j,t[47]=L,t[48]=P,t[49]=R,t[50]=z,t[51]=a,t[52]=c,t[53]=ae):ae=t[53];let oe;t[54]===j?oe=t[55]:(oe=(0,X.jsx)(br,{className:`max-w-80 break-all`,children:j}),t[54]=j,t[55]=oe);let se;t[56]!==ae||t[57]!==oe?(se=(0,X.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,X.jsxs)(xr,{children:[ae,oe]})}),t[56]=ae,t[57]=oe,t[58]=se):se=t[58];let K;t[59]!==U||t[60]!==m||t[61]!==P?(K=P?(0,X.jsxs)(en,{type:`button`,size:`sm`,variant:`link`,disabled:m,onClick:()=>void U(),"data-slot":`internal-link-prop-panel-create`,className:`flex items-center text-foreground`,children:[(0,X.jsx)(Oa,{className:`size-3.5`,"aria-hidden":`true`}),m?(0,X.jsx)(o,{id:`HM56Bx`}):(0,X.jsx)(o,{id:`XRuL0i`})]}):null,t[59]=U,t[60]=m,t[61]=P,t[62]=K):K=t[62];let ce;t[63]===S?ce=t[64]:(ce=S({id:`ePK91l`}),t[63]=S,t[64]=ce);let le;t[65]===p?le=t[66]:(le=()=>p(!0),t[65]=p,t[66]=le);let ue;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,X.jsx)(qn,{className:`size-3.5`,"aria-hidden":`true`}),t[67]=ue):ue=t[67];let de;t[68]!==ce||t[69]!==le?(de=(0,X.jsx)(yr,{asChild:!0,children:(0,X.jsx)(en,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":ce,onClick:le,"data-slot":`internal-link-prop-panel-edit`,children:ue})}),t[68]=ce,t[69]=le,t[70]=de):de=t[70];let fe;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,X.jsx)(br,{children:(0,X.jsx)(o,{id:`ePK91l`})}),t[71]=fe):fe=t[71];let pe;t[72]===de?pe=t[73]:(pe=(0,X.jsxs)(xr,{children:[de,fe]}),t[72]=de,t[73]=pe);let me;t[74]===d?me=t[75]:(me=(0,X.jsx)(YJ,{copyContent:d}),t[74]=d,t[75]=me);let he;t[76]===S?he=t[77]:(he=S({id:`t_YqKh`}),t[76]=S,t[77]=he);let ge;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,X.jsx)(Hn,{className:`size-3.5`,"aria-hidden":`true`}),t[78]=ge):ge=t[78];let _e;t[79]!==O||t[80]!==he?(_e=(0,X.jsx)(yr,{asChild:!0,children:(0,X.jsx)(en,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":he,onClick:O,"data-slot":`internal-link-prop-panel-remove`,children:ge})}),t[79]=O,t[80]=he,t[81]=_e):_e=t[81];let ve;t[82]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,X.jsx)(br,{children:(0,X.jsx)(o,{id:`t_YqKh`})}),t[82]=ve):ve=t[82];let ye;t[83]===_e?ye=t[84]:(ye=(0,X.jsxs)(xr,{children:[_e,ve]}),t[83]=_e,t[84]=ye);let be;t[85]!==K||t[86]!==pe||t[87]!==me||t[88]!==ye?(be=(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[K,pe,me,ye]}),t[85]=K,t[86]=pe,t[87]=me,t[88]=ye,t[89]=be):be=t[89];let xe;t[90]!==re||t[91]!==se||t[92]!==be?(xe=(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[re,se,be]}),t[90]=re,t[91]=se,t[92]=be,t[93]=xe):xe=t[93];let Se;return t[94]!==a||t[95]!==ie||t[96]!==xe||t[97]!==H?(Se=(0,X.jsx)(gJ,{kind:`internal-link`,ariaLabel:ie,onDeactivate:a,triggerReference:H,className:`w-96`,children:xe}),t[94]=a,t[95]=ie,t[96]=xe,t[97]=H,t[98]=Se):Se=t[98],(0,X.jsxs)(X.Fragment,{children:[A,Se]})}new q(`markIdentityDecoration`);var sY=`data-mark-id`,cY=new q(`linkResolutionDecoration`);function lY(e,t,n,r,i){if(t.size===0)return null;let a=[];for(let e of t.values()){if(!n.has(e.markType))continue;let t=r(e,i),o={[sY]:e.id};t!==null&&Object.assign(o,t),a.push(dt.inline(e.from,e.to,o))}return a.length===0?null:Qe.create(e,a)}function uY(e){let t=new Set(e.markTypes),{computeAttrs:n}=e;return new Ht({key:cY,state:{init:()=>({version:0}),apply(e,t){let n=e.getMeta(cY);return n&&typeof n==`object`&&n.refresh?{version:t.version+1}:t}},props:{decorations(e){let r=JO.getState(e);if(!r)return null;let i=Fn();return lY(e.doc,r.byId,t,n,i)}},view(e){$(`ok/render/decoration-merge`,{markTypes:Array.from(t).join(`,`)},{startTime:performance.now(),duration:0});let n=Pn(()=>{e.dispatch(e.state.tr.setMeta(cY,{refresh:!0}))});return{destroy(){n()}}}})}var dY=N.extend({addOptions(){return{...this.parent?.(),docName:``}},renderHTML({HTMLAttributes:e}){let t=typeof e.href==`string`?e.href:``;return[`span`,st(e,{"data-link":``,role:`link`,tabindex:`0`,"aria-label":t?`Link: ${t}`:`Link`,style:`touch-action: manipulation;`}),0]},addProseMirrorPlugins(){let e=this.options.docName??``,t=({editor:t,nodeId:n,newTab:r})=>{let i=QJ(t.state,n),a=i?.attrs?.href;if(typeof a!=`string`||!a)return!1;let o=i?.attrs?.sourceForm,s=u(a,e),c=m(a);if(s?.kind===`asset`||o===`wikiembed`&&c!==null){let t=s?.kind===`asset`?s.url:a,n=s?.kind===`asset`?s.ext:c??``,i=h(t,e);if(!i)return!1;let o=Fn();return o===null||(o.assetPaths!==void 0||o.filePaths!==void 0)&&!hW(t,e,o.assetPaths,o.filePaths)?!1:(jW({url:t,projectRelPath:i,ext:n,title:i.split(`/`).pop()??t,newTab:r}),!0)}if(!s)return!1;switch(s.kind){case`doc`:{let e=Fn(),t=pW(s.docName,{pages:e?.pages??new Set,folderPaths:e?.folderPaths??new Set});return t.kind===`create`||t.kind===`navigate`&&t.displayState===`folder`?!1:(r?kW({docName:s.docName,anchor:s.anchor}):window.location.assign(EW({docName:s.docName,anchor:s.anchor})),!0)}case`anchor`:return r?kW({docName:e,anchor:s.anchor}):window.location.assign(EW({docName:e,anchor:s.anchor})),!0;case`external`:return CW(s.url)?(DW(s.url),!0):!1;default:return ge(s)}};return[tY({editor:this.editor,markTypes:[`link`],renderPropPanel:({editor:n,nodeId:r,deactivate:i})=>(0,Q.createElement)(oY,{editor:n,nodeId:r,sourceDocName:e,onClose:i,onNavigate:e=>t({editor:n,nodeId:r,newTab:e})}),handlePrimary:t}),uY({markTypes:[`link`],computeAttrs:vW(e)}),hJ({sourceDocName:e})]}}),fY=(0,Q.createContext)(null),pY={didCatch:!1,error:null},mY=class extends Q.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=pY}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(...e){let{error:t}=this.state;t!==null&&(this.props.onReset?.({args:e,reason:`imperative-api`}),this.setState(pY))}componentDidCatch(e,t){this.props.onError?.(e,t)}componentDidUpdate(e,t){let{didCatch:n}=this.state,{resetKeys:r}=this.props;n&&t.error!==null&&hY(e.resetKeys,r)&&(this.props.onReset?.({next:r,prev:e.resetKeys,reason:`keys`}),this.setState(pY))}render(){let{children:e,fallbackRender:t,FallbackComponent:n,fallback:r}=this.props,{didCatch:i,error:a}=this.state,o=e;if(i){let e={error:a,resetErrorBoundary:this.resetErrorBoundary};if(typeof t==`function`)o=t(e);else if(n)o=(0,Q.createElement)(n,e);else if(r!==void 0)o=r;else throw a}return(0,Q.createElement)(fY.Provider,{value:{didCatch:i,error:a,resetErrorBoundary:this.resetErrorBoundary}},o)}};function hY(e=[],t=[]){return e.length!==t.length||e.some((e,n)=>!Object.is(e,t[n]))}function gY(e){let t=(0,Z.c)(23),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({label:i,Icon:n,onClick:a,selected:s,className:r,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let c=s?`true`:void 0,l;t[7]===a?l=t[8]:(l=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),a())},t[7]=a,t[8]=l);let u;t[9]===r?u=t[10]:(u=Xt(`flex w-full items-center justify-center gap-2 rounded-md border border-dashed border-border bg-transparent px-3 py-2 text-center text-sm text-muted-foreground transition-colors hover:bg-muted/50 cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,r),t[9]=r,t[10]=u);let d;t[11]===n?d=t[12]:(d=(0,X.jsx)(n,{size:16,"aria-hidden":`true`}),t[11]=n,t[12]=d);let f;t[13]===i?f=t[14]:(f=(0,X.jsx)(`span`,{children:i}),t[13]=i,t[14]=f);let p;return t[15]!==a||t[16]!==o||t[17]!==c||t[18]!==l||t[19]!==u||t[20]!==d||t[21]!==f?(p=(0,X.jsxs)(`div`,{...o,role:`button`,tabIndex:-1,contentEditable:!1,"data-descriptor-placeholder":``,"data-selected":c,onClick:a,onMouseDown:_Y,onKeyDown:l,className:u,children:[d,f]}),t[15]=a,t[16]=o,t[17]=c,t[18]=l,t[19]=u,t[20]=d,t[21]=f,t[22]=p):p=t[22],p}function _Y(e){e.preventDefault(),e.stopPropagation()}function vY(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(Vs,{"data-slot":`select`,...n}),t[2]=n,t[3]=r),r}function yY(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(Us,{"data-slot":`select-value`,...n}),t[2]=n,t[3]=r),r}function bY(e){let t=(0,Z.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,size:a,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`default`:a,s;t[5]===r?s=t[6]:(s=Xt(`flex w-full items-center justify-between gap-2 rounded-lg border border-input bg-background text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=default]:px-2.5 data-[size=sm]:px-2 data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,r),t[5]=r,t[6]=s);let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,X.jsx)(Ws,{asChild:!0,children:(0,X.jsx)(yn,{className:`size-4 opacity-50`})}),t[7]=c):c=t[7];let l;return t[8]!==n||t[9]!==i||t[10]!==o||t[11]!==s?(l=(0,X.jsxs)(Hs,{"data-slot":`select-trigger`,"data-size":o,className:s,...i,children:[n,c]}),t[8]=n,t[9]=i,t[10]=o,t[11]=s,t[12]=l):l=t[12],l}function xY(e){let t=(0,Z.c)(20),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,position:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`popper`:a,s=o===`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`,c;t[5]!==r||t[6]!==s?(c=Xt(`relative z-50 max-h-(--radix-select-content-available-height) min-w-32 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border bg-popover text-popover-foreground shadow-md outline-hidden duration-100 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-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 data-[align-trigger=true]:animate-none motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0`,s,r),t[5]=r,t[6]=s,t[7]=c):c=t[7];let l;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,X.jsx)(CY,{}),t[8]=l):l=t[8];let u=o===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1`,d;t[9]===u?d=t[10]:(d=Xt(`p-1`,u),t[9]=u,t[10]=d);let f;t[11]!==n||t[12]!==d?(f=(0,X.jsx)(qs,{className:d,children:n}),t[11]=n,t[12]=d,t[13]=f):f=t[13];let p;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,X.jsx)(wY,{}),t[14]=p):p=t[14];let m;return t[15]!==o||t[16]!==i||t[17]!==c||t[18]!==f?(m=(0,X.jsx)(Gs,{children:(0,X.jsxs)(Ks,{"data-slot":`select-content`,"data-ok-layer-spawned":``,position:o,className:c,...i,children:[l,f,p]})}),t[15]=o,t[16]=i,t[17]=c,t[18]=f,t[19]=m):m=t[19],m}function SY(e){let t=(0,Z.c)(13),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=Xt(`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 focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,r),t[4]=r,t[5]=a);let o;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,X.jsx)(`span`,{className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,X.jsx)(Xs,{children:(0,X.jsx)(tn,{className:`size-4`})})}),t[6]=o):o=t[6];let s;t[7]===n?s=t[8]:(s=(0,X.jsx)(Ys,{children:n}),t[7]=n,t[8]=s);let c;return t[9]!==i||t[10]!==a||t[11]!==s?(c=(0,X.jsxs)(Js,{"data-slot":`select-item`,className:a,...i,children:[o,s]}),t[9]=i,t[10]=a,t[11]=s,t[12]=c):c=t[12],c}function CY(e){let t=(0,Z.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Xt(`flex cursor-default items-center justify-center py-1`,n),t[3]=n,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(Ui,{className:`size-4`}),t[5]=a):a=t[5];let o;return t[6]!==r||t[7]!==i?(o=(0,X.jsx)(Zs,{"data-slot":`select-scroll-up-button`,className:i,...r,children:a}),t[6]=r,t[7]=i,t[8]=o):o=t[8],o}function wY(e){let t=(0,Z.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Xt(`flex cursor-default items-center justify-center py-1`,n),t[3]=n,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(yn,{className:`size-4`}),t[5]=a):a=t[5];let o;return t[6]!==r||t[7]!==i?(o=(0,X.jsx)(Qs,{"data-slot":`select-scroll-down-button`,className:i,...r,children:a}),t[6]=r,t[7]=i,t[8]=o):o=t[8],o}function TY(e){let t=(0,Z.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,size:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`default`:i,o;t[4]===n?o=t[5]:(o=Xt(`peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50`,n),t[4]=n,t[5]=o);let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsx)(dc,{"data-slot":`switch-thumb`,className:`pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground`}),t[6]=s):s=t[6];let c;return t[7]!==r||t[8]!==a||t[9]!==o?(c=(0,X.jsx)(uc,{"data-slot":`switch`,"data-size":a,className:o,...r,children:s}),t[7]=r,t[8]=a,t[9]=o,t[10]=c):c=t[10],c}function EY(e){let t=e.trim();if(/^#[0-9a-fA-F]{6}$/.test(t))return t.toLowerCase();if(/^#[0-9a-fA-F]{3}$/.test(t)){let[,e,n,r]=t.match(/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/)??[];return`#${e}${e}${n}${n}${r}${r}`.toLowerCase()}return`#000000`}function DY(e){let t=(0,Z.c)(36),{id:n,value:r,onChange:i,autoFocus:a}=e,o=(0,Q.useRef)(null),s;t[0]===i?s=t[1]:(s=e=>i(e.target.value),t[0]=i,t[1]=s);let c=a?``:void 0,l=r?`pl-7`:void 0,u;t[2]===l?u=t[3]:(u=Xt(`h-7 text-sm`,l),t[2]=l,t[3]=u);let d;t[4]!==a||t[5]!==n||t[6]!==s||t[7]!==c||t[8]!==u||t[9]!==r?(d=(0,X.jsx)(Ir,{id:n,type:`text`,value:r,placeholder:`#F05032 or rgb(240,80,50)`,onChange:s,autoFocus:a,"data-prop-autofocus":c,className:u,"data-color-picker-input":``}),t[4]=a,t[5]=n,t[6]=s,t[7]=c,t[8]=u,t[9]=r,t[10]=d):d=t[10];let f;t[11]===r?f=t[12]:(f=r&&(0,X.jsx)(`span`,{style:{backgroundColor:r},className:`pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 rounded-sm border border-border`,"aria-hidden":`true`,"data-color-picker-swatch":``}),t[11]=r,t[12]=f);let p;t[13]!==d||t[14]!==f?(p=(0,X.jsxs)(`div`,{className:`relative flex-1`,children:[d,f]}),t[13]=d,t[14]=f,t[15]=p):p=t[15];let m;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>o.current?.click(),t[16]=m):m=t[16];let h=r||`transparent`,g;t[17]===h?g=t[18]:(g=(0,X.jsx)(en,{type:`button`,variant:`outline`,size:`xs`,"aria-label":`Choose color`,"data-color-picker-trigger":``,className:`h-7 gap-1 px-2`,onClick:m,children:(0,X.jsx)(`span`,{style:{backgroundColor:h},className:`size-3.5 rounded-sm border border-border`,"aria-hidden":`true`})}),t[17]=h,t[18]=g);let _;t[19]===r?_=t[20]:(_=EY(r),t[19]=r,t[20]=_);let v;t[21]===i?v=t[22]:(v=e=>i(e.target.value),t[21]=i,t[22]=v);let y;t[23]!==_||t[24]!==v?(y=(0,X.jsx)(`input`,{ref:o,type:`color`,value:_,onChange:v,tabIndex:-1,"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 size-7 opacity-0`,"data-color-picker-native":``}),t[23]=_,t[24]=v,t[25]=y):y=t[25];let b;t[26]!==g||t[27]!==y?(b=(0,X.jsxs)(`div`,{className:`relative`,children:[g,y]}),t[26]=g,t[27]=y,t[28]=b):b=t[28];let x;t[29]!==i||t[30]!==r?(x=r&&(0,X.jsx)(en,{type:`button`,variant:`ghost`,size:`xs`,"aria-label":`Clear color`,"data-color-picker-clear":``,className:`h-7 px-1.5`,onClick:()=>i(``),children:(0,X.jsx)(Xi,{className:`size-3`,"aria-hidden":`true`})}),t[29]=i,t[30]=r,t[31]=x):x=t[31];let S;return t[32]!==b||t[33]!==x||t[34]!==p?(S=(0,X.jsxs)(`div`,{className:`flex gap-1`,children:[p,b,x]}),t[32]=b,t[33]=x,t[34]=p,t[35]=S):S=t[35],S}function OY(e){let t=(0,Z.c)(43),{id:n,value:r,onChange:i,autoFocus:a}=e,[o,s]=(0,Q.useState)(!1),c;t[0]===r?c=t[1]:(c=vk(r),t[0]=r,t[1]=c);let l=c,u;t[2]===r?u=t[3]:(u=r.startsWith(`lucide:`)?r.slice(7):null,t[2]=r,t[3]=u);let d=u,f;t[4]===i?f=t[5]:(f=e=>i(e.target.value),t[4]=i,t[5]=f);let p=a?``:void 0,m=l?`pl-7`:void 0,h;t[6]===m?h=t[7]:(h=Xt(`h-7 text-sm`,m),t[6]=m,t[7]=h);let g;t[8]!==a||t[9]!==n||t[10]!==f||t[11]!==p||t[12]!==h||t[13]!==r?(g=(0,X.jsx)(Ir,{id:n,type:`text`,value:r,placeholder:`lucide:Lightbulb or 📘`,onChange:f,autoFocus:a,"data-prop-autofocus":p,className:h,"data-icon-picker-input":``}),t[8]=a,t[9]=n,t[10]=f,t[11]=p,t[12]=h,t[13]=r,t[14]=g):g=t[14];let _;t[15]===l?_=t[16]:(_=l&&(0,X.jsx)(l,{className:`pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground`,"aria-hidden":`true`}),t[15]=l,t[16]=_);let v;t[17]!==g||t[18]!==_?(v=(0,X.jsxs)(`div`,{className:`relative flex-1`,children:[g,_]}),t[17]=g,t[18]=_,t[19]=v):v=t[19];let y;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,X.jsx)(yn,{className:`size-3`,"aria-hidden":`true`}),t[20]=y):y=t[20];let b;t[21]===o?b=t[22]:(b=(0,X.jsx)(gc,{asChild:!0,children:(0,X.jsx)(en,{type:`button`,variant:`outline`,size:`xs`,"aria-label":`Choose icon`,"aria-haspopup":`listbox`,"aria-expanded":o,"data-icon-picker-trigger":``,className:`h-7 gap-1 px-2`,children:y})}),t[21]=o,t[22]=b);let x;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,X.jsx)(Tx,{placeholder:`Search icons...`,className:`h-8 text-sm`}),t[23]=x):x=t[23];let S;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,X.jsx)(Dx,{children:`No icons match.`}),t[24]=S):S=t[24];let C;t[25]!==i||t[26]!==r.length?(C=r.length>0&&(0,X.jsx)(Ox,{children:(0,X.jsxs)(kx,{value:`__clear__`,onSelect:()=>{i(``),s(!1)},className:`gap-2 text-muted-foreground`,"data-icon-picker-clear":``,children:[(0,X.jsx)($n,{className:`size-3.5`,"aria-hidden":`true`}),`Clear icon`]})}),t[25]=i,t[26]=r.length,t[27]=C):C=t[27];let w;t[28]!==i||t[29]!==d?(w=_k.map(e=>{let[t,n]=e,r=t===d;return(0,X.jsx)(kx,{value:t,onSelect:()=>{i(`lucide:${t}`),s(!1)},title:t,"aria-label":t,"data-icon-picker-item":t,"data-icon-picker-selected":r?``:void 0,className:Xt(`flex aspect-square items-center justify-center rounded-md p-0`,r?`bg-foreground/10 text-foreground ring-1 ring-foreground/30`:`text-muted-foreground hover:bg-muted`),children:(0,X.jsx)(n,{className:`size-4`,"aria-hidden":`true`})},t)}),t[28]=i,t[29]=d,t[30]=w):w=t[30];let T;t[31]===w?T=t[32]:(T=(0,X.jsx)(Ox,{heading:`Lucide`,children:(0,X.jsx)(dx.Group,{className:`[&_[cmdk-group-items]]:grid [&_[cmdk-group-items]]:grid-cols-6 [&_[cmdk-group-items]]:gap-1 [&_[cmdk-group-items]]:p-1`,children:w})}),t[31]=w,t[32]=T);let E;t[33]!==C||t[34]!==T?(E=(0,X.jsx)(_c,{align:`end`,className:`z-70 w-72 p-0`,onOpenAutoFocus:kY,children:(0,X.jsxs)(Cx,{label:`Icon picker`,children:[x,(0,X.jsxs)(Ex,{className:`max-h-64`,children:[S,C,T]})]})}),t[33]=C,t[34]=T,t[35]=E):E=t[35];let D;t[36]!==o||t[37]!==b||t[38]!==E?(D=(0,X.jsxs)(hc,{open:o,onOpenChange:s,children:[b,E]}),t[36]=o,t[37]=b,t[38]=E,t[39]=D):D=t[39];let O;return t[40]!==D||t[41]!==v?(O=(0,X.jsxs)(`div`,{className:`flex gap-1`,children:[v,D]}),t[40]=D,t[41]=v,t[42]=O):O=t[42],O}function kY(e){return e.preventDefault()}function AY(e){let[t]=e.split(`/`);switch(t){case`image`:return`image`;case`video`:return`video`;case`audio`:return`audio`;case`application`:return e===`application/pdf`?`pdf`:null;case`text`:return`text`;default:return null}}function jY(e){if(e.length===1&&e[0]===`*/*`)return`all`;let t=new Set;for(let n of e){if(n===`*/*`)return`all`;let e=AY(n);e&&t.add(e)}return t}function MY(e){let t=e.lastIndexOf(`.`);return t<0||t<e.lastIndexOf(`/`)?``:e.slice(t+1).toLowerCase()}function NY(e,t){let n=jY(t),r=[];for(let t of e){if(n===`all`){r.push(t);continue}let e=Le(MY(t));e&&n.has(e)&&r.push(t)}return r}var PY=8,FY=new Set,IY=null;function LY(e){return{path:e,basename:e.split(`/`).pop()??e}}function RY(e){let t=e.map(e=>e.path).join(``);return IY?.fingerprint===t||(IY={fingerprint:t,byPath:new Map(e.map(e=>[e.path,e])),itemsInOrder:e,corpus:Ae(e.map(e=>Pt({kind:`page`,path:e.path,title:e.basename})))}),IY}function zY(e){let t=e.trim();return t.startsWith(`/`)?t.slice(1):t}function BY(e,t){let n=zY(t);return n?b(e.corpus,n,{intent:`autocomplete`,limit:PY}).map(t=>e.byPath.get(t.document.path)).filter(e=>!!e):e.itemsInOrder.slice(0,PY)}function VY(e){let t=(0,Z.c)(52),{value:n,onChange:r,accept:i,id:a,placeholder:o,autoFocus:s,ariaInvalid:c,ariaDescribedBy:l,dataPropAutofocus:u,className:d,onSubmit:f}=e,p=In()?.assetPaths??FY,m;t[0]!==i||t[1]!==p||t[2]!==n?(m=BY(RY(NY(p,i).map(LY)),n),t[0]=i,t[1]=p,t[2]=n,t[3]=m):m=t[3];let h=m,[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(0),b,x;t[4]!==v||t[5]!==h.length?(b=()=>{v>=h.length&&y(0)},x=[v,h.length],t[4]=v,t[5]=h.length,t[6]=b,t[7]=x):(b=t[6],x=t[7]),(0,Q.useEffect)(b,x);let S=(0,Q.useId)(),C=(0,Q.useRef)(null),w=g&&h.length>0,T;t[8]===r?T=t[9]:(T=e=>{r(`/${e.path}`),_(!1),y(0),C.current?.focus()},t[8]=r,t[9]=T);let E=T,D;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>_(e),t[10]=D):D=t[10];let O=w?S:void 0,k=w&&h[v]?`${S}-opt-${v}`:void 0,A;t[11]===r?A=t[12]:(A=e=>{r(e.target.value),_(!0),y(0)},t[11]=r,t[12]=A);let j,M;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(M=()=>{_(!0)},j=()=>{_(!0)},t[13]=j,t[14]=M):(j=t[13],M=t[14]);let N;t[15]!==v||t[16]!==f||t[17]!==E||t[18]!==h||t[19]!==w?(N=e=>{if(e.key===`ArrowDown`){if(h.length===0)return;e.preventDefault(),_(!0),y(e=>(e+1)%h.length);return}if(e.key===`ArrowUp`){if(h.length===0)return;e.preventDefault(),_(!0),y(e=>(e-1+h.length)%h.length);return}if(e.key===`Enter`){if(w){let t=h[v];if(t){e.preventDefault(),E(t);return}}f&&(e.preventDefault(),f());return}if(e.key===`Escape`){if(!w)return;e.preventDefault(),e.stopPropagation(),_(!1);return}e.key===`Tab`&&_(!1)},t[15]=v,t[16]=f,t[17]=E,t[18]=h,t[19]=w,t[20]=N):N=t[20];let P;t[21]!==l||t[22]!==c||t[23]!==s||t[24]!==d||t[25]!==u||t[26]!==a||t[27]!==o||t[28]!==N||t[29]!==O||t[30]!==k||t[31]!==A||t[32]!==n||t[33]!==w?(P=(0,X.jsx)(vc,{asChild:!0,children:(0,X.jsx)(Ir,{ref:C,id:a,type:`text`,value:n,placeholder:o,autoFocus:s,"data-prop-autofocus":u,"aria-invalid":c,"aria-describedby":l,role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":w,"aria-controls":O,"aria-activedescendant":k,className:d,onChange:A,onFocus:M,onClick:j,onKeyDown:N})}),t[21]=l,t[22]=c,t[23]=s,t[24]=d,t[25]=u,t[26]=a,t[27]=o,t[28]=N,t[29]=O,t[30]=k,t[31]=A,t[32]=n,t[33]=w,t[34]=P):P=t[34];let F;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(F=e=>{let t=e.target;t instanceof Node&&C.current?.contains(t)&&e.preventDefault()},t[35]=F):F=t[35];let I;if(t[36]!==v||t[37]!==S||t[38]!==E||t[39]!==h){let e;t[41]!==v||t[42]!==S||t[43]!==E?(e=(e,t)=>{let n=`${S}-opt-${t}`,r=t===v;return(0,X.jsxs)(`button`,{id:n,type:`button`,role:`option`,"aria-selected":r,"data-testid":`src-autocomplete-option`,"data-highlighted":r?``:void 0,className:Xt(`flex w-full flex-col items-start gap-0.5 rounded-sm px-2 py-1 text-left text-xs`,`transition-colors`,r?`bg-accent text-accent-foreground`:`hover:bg-accent/50`),onMouseEnter:()=>y(t),onMouseDown:t=>{t.preventDefault(),E(e)},children:[(0,X.jsx)(`span`,{className:`font-medium`,children:e.basename}),e.basename!==e.path&&(0,X.jsx)(`span`,{className:`text-muted-foreground/70`,children:e.path})]},e.path)},t[41]=v,t[42]=S,t[43]=E,t[44]=e):e=t[44],I=h.map(e),t[36]=v,t[37]=S,t[38]=E,t[39]=h,t[40]=I}else I=t[40];let L;t[45]!==S||t[46]!==I?(L=(0,X.jsx)(_c,{align:`start`,sideOffset:4,className:`z-70 w-(--radix-popover-trigger-width) p-1`,onOpenAutoFocus:UY,onCloseAutoFocus:HY,onInteractOutside:F,children:(0,X.jsx)(`div`,{id:S,role:`listbox`,"aria-label":`Asset suggestions`,className:`flex flex-col gap-px`,children:I})}),t[45]=S,t[46]=I,t[47]=L):L=t[47];let R;return t[48]!==P||t[49]!==L||t[50]!==w?(R=(0,X.jsxs)(hc,{open:w,onOpenChange:D,children:[P,L]}),t[48]=P,t[49]=L,t[50]=w,t[51]=R):R=t[51],R}function HY(e){e.preventDefault()}function UY(e){e.preventDefault()}function WY(){if(typeof window>`u`)return null;let e=window.location.hash.match(/^#\/([^?#]+)/);return e?decodeURIComponent(e[1]):null}var GY=`/api/upload`;async function KY(e,t,n={}){let r=n.fetch??globalThis.fetch,i=n.docName===void 0?WY():n.docName;if(!i)throw Error(`No document is open`);let a=new FormData;a.append(`file`,e),a.append(`parentDocName`,i);let o;try{o=await r(GY,{method:`POST`,body:a})}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`Upload failed: ${t}`)}let s;try{s=await o.json()}catch(e){throw new MO(`Upload response is not JSON.`,{cause:e,status:o.status})}if(!o.ok){let e=lt.safeParse(s);throw e.success?Error(e.data.title):new MO(`Upload error response did not match ProblemDetails.`,{cause:e.error,status:o.status})}let c=te.safeParse(s);if(!c.success)throw new MO(`Upload success response did not match UploadAssetSuccess.`,{cause:c.error,status:o.status});let l=c.data.path??c.data.src;return{url:l.startsWith(`/`)?l:`/${l}`}}var qY=new Intl.PluralRules(`en-US`);function JY(e,t,n){return n<=0?`${e} (empty)`:`${e} with ${n} ${qY.select(n)===`one`?`item`:`items`}`}function YY(e){for(let t of e)if(t.type===`string`&&t.hidden!==!0&&t.advanced!==!0&&t.autoFocus===!0)return t.name;return null}function XY(e){if(!e)return e;let t=e.replace(/[_-]+/g,` `).replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/([A-Z]+)([A-Z][a-z])/g,`$1 $2`);return t.charAt(0).toUpperCase()+t.slice(1)}var ZY=new Set([`auto`,`inherit`,`initial`,`unset`]),QY=new Set([`px`,`%`,`rem`,`em`,`vh`,`vw`,`ch`,`ex`,`fr`]),$Y=/^(-?\d+(?:\.\d+)?)([a-z%]*)$/i;function eX(e){let t=e.trim();if(!t)return{valid:!1,reason:`empty`};if(ZY.has(t.toLowerCase()))return{valid:!0};let n=t.match($Y);if(!n)return{valid:!1,reason:`malformed-syntax`};let r=(n[2]??``).toLowerCase();return r===``||QY.has(r)?{valid:!0}:{valid:!1,reason:`unknown-unit`}}function tX(e){if(e.valid)return null;switch(e.reason){case`empty`:return null;case`malformed-syntax`:return`Enter a number (e.g. 100), a number with a CSS unit (e.g. 100px, 50%, 26rem), or one of: auto, inherit, initial, unset.`;case`unknown-unit`:return`Unknown CSS unit. Use px, %, rem, em, vh, vw, ch, ex, or fr.`}}var nX={video:w,audio:Me,image:de},rX={youtube:[`youtube.com`,`youtu.be`,`youtube-nocookie.com`],vimeo:[`vimeo.com`],loom:[`loom.com`]};function iX(e){let t=e.toLowerCase();for(let e of Object.keys(rX)){let n=rX[e];for(let r of n)if(t===r||t.endsWith(`.${r}`))return e}return null}function aX(e){let t=e.lastIndexOf(`/`),n=t>=0?e.slice(t+1):e,r=n.lastIndexOf(`.`);return r>0?n.slice(r+1).toLowerCase():``}var oX=`https://placeholder.invalid`;function sX(e,t){let n=e.trim();if(n.length===0)return{valid:!0};let r,i=!0;try{r=new URL(n)}catch{try{r=new URL(n,oX),i=!1}catch{return{valid:!1,reason:`invalid-url`}}}if(t===`video`&&Ut(n)!==null||t===`video`&&St(n)||t===`video`&&Te(n))return{valid:!0};let a=i?iX(r.hostname):null;if(a!==null)return{valid:!1,reason:`embed-provider`,provider:a};if(r.protocol===`data:`)return{valid:!1,reason:`data-uri`};let o=aX(r.pathname),s=nX[t];return o===``?i?{valid:!0}:{valid:!1,reason:`wrong-extension`,extension:``}:s.has(o)?{valid:!0}:{valid:!1,reason:`wrong-extension`,extension:o}}function cX(e){if(e.length===0)return;let t=e[0]?.toLowerCase()??``;if(t.startsWith(`video/`))return`video`;if(t.startsWith(`audio/`))return`audio`;if(t.startsWith(`image/`))return`image`}function lX(e){return`Direct ${e} file URL — ${Array.from(nX[e]).map(e=>`.${e}`).join(`, `)}`}var uX={youtube:`YouTube`,vimeo:`Vimeo`,loom:`Loom`};function dX(e,t){if(e.valid)return``;if(e.reason===`invalid-url`)return`Not a valid URL.`;if(e.reason===`data-uri`)return`Data URIs are not supported for media fields. Use a hosted file URL.`;if(e.reason===`embed-provider`){let n=uX[e.provider];return t===`video`?`Unrecognized ${n} URL. Paste a valid ${n} share or embed link, or a direct ${t} file URL.`:`${n} URLs are not direct ${t} files. Paste a direct ${t} file URL.`}let n=Array.from(nX[t]).map(e=>`.${e}`).join(`, `);return e.extension===``?`Missing file extension. Accepts: ${n}.`:`Unsupported extension .${e.extension}. Accepts: ${n}.`}function fX(e){return`ok.propPanel.advanced.${e}`}function pX(e){try{return typeof localStorage>`u`?!1:localStorage.getItem(fX(e))===`true`}catch{return!1}}function mX(e,t){try{if(typeof localStorage>`u`)return;localStorage.setItem(fX(e),t?`true`:`false`)}catch{}}function hX(e,t){let n=0;for(let r of e){let e=t[r.name],i=`defaultValue`in r?r.defaultValue:void 0;e!==void 0&&e!==i&&(n+=1)}return n}async function gX(e,t,n){try{let{url:r}=await KY(e,t);n(r)}catch(e){let t=e instanceof Error?e.message:String(e);Qn.error(rr._({id:`02P3hL`,values:{message:t}}))}}function _X(e){let t=(0,Z.c)(14),{descriptor:n,values:r,onChange:i,onDismiss:a}=e,s;t[0]===r?s=t[1]:(s=e=>!(`hidden`in e&&e.hidden)&&e.hideWhen?.(r)!==!0&&e.type!==`reactnode`,t[0]=r,t[1]=s);let c=n.props.filter(s),l=c.filter(yX),u=c.filter(vX),d=hX(u,r),f;t[2]===n.props?f=t[3]:(f=YY(n.props),t[2]=n.props,t[3]=f);let p=f,m;t[4]===n.name?m=t[5]:(m=()=>pX(n.name),t[4]=n.name,t[5]=m);let[h,g]=(0,Q.useState)(m);if(c.length===0)return null;let _;t[6]!==p||t[7]!==i||t[8]!==a||t[9]!==r?(_=e=>(0,X.jsx)(xX,{propDef:e,value:r[e.name],onChange:t=>i(e.name,t),onDismiss:a,isAutoFocused:e.name===p},e.name),t[6]=p,t[7]=i,t[8]=a,t[9]=r,t[10]=_):_=t[10];let v=l.map(_),y=u.length>0&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`my-1 border-t border-border`}),(0,X.jsxs)(Zn,{open:h,onOpenChange:e=>{g(e),mX(n.name,e)},children:[(0,X.jsxs)(Xn,{"data-prop-panel-advanced-trigger":``,className:`group flex w-full items-center justify-between rounded px-1 py-1 text-xs text-muted-foreground hover:bg-muted hover:text-foreground uppercase font-mono`,children:[(0,X.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(yn,{className:`size-3 transition-transform group-data-[state=closed]:-rotate-90`}),(0,X.jsx)(o,{id:`sxkWRg`})]}),d>0&&(0,X.jsx)(mc,{variant:`secondary`,"data-prop-panel-advanced-count":``,children:d})]}),(0,X.jsx)(Yn,{className:`flex flex-col gap-4 pt-2`,children:u.map(e=>(0,X.jsx)(xX,{propDef:e,value:r[e.name],onChange:t=>i(e.name,t),onDismiss:a,isAutoFocused:e.name===p},e.name))})]})]}),b;return t[11]!==v||t[12]!==y?(b=(0,X.jsxs)(`div`,{"data-prop-panel":``,className:`flex flex-col gap-4 py-2 text-sm`,children:[v,y]}),t[11]=v,t[12]=y,t[13]=b):b=t[13],b}function vX(e){return`advanced`in e&&e.advanced}function yX(e){return!(`advanced`in e&&e.advanced)}function bX(e){throw Error(`PropPanel: unhandled PropDef type ${JSON.stringify(e)}`)}function xX(e){let t=(0,Z.c)(165),{propDef:n,value:r,onChange:i,onDismiss:a,isAutoFocused:o}=e,s;t[0]===a?s=t[1]:(s=a?e=>{e.key===`Enter`&&(e.preventDefault(),a())}:void 0,t[0]=a,t[1]=s);let c=s;switch(n.type){case`reactnode`:return null;case`string`:{let e=`prop-${n.name}`,s=n.accept,l=s!==void 0&&s.length>0,u=!n.required&&n.defaultValue===void 0;if(n.language){let a=`${e}-label`,s;t[2]===n.name?s=t[3]:(s=XY(n.name),t[2]=n.name,t[3]=s);let c;t[4]!==a||t[5]!==e||t[6]!==s?(c=(0,X.jsx)(`label`,{id:a,htmlFor:e,className:`text-xs text-muted-foreground`,children:s}),t[4]=a,t[5]=e,t[6]=s,t[7]=c):c=t[7];let l=r??``,d;t[8]!==i||t[9]!==u?(d=e=>{if(e===``&&u){i(void 0);return}i(e)},t[8]=i,t[9]=u,t[10]=d):d=t[10];let f;t[11]!==o||t[12]!==a||t[13]!==n.language||t[14]!==e||t[15]!==l||t[16]!==d?(f=(0,X.jsx)(hK,{id:e,ariaLabelledBy:a,value:l,language:n.language,onChange:d,autoFocus:o}),t[11]=o,t[12]=a,t[13]=n.language,t[14]=e,t[15]=l,t[16]=d,t[17]=f):f=t[17];let p;return t[18]!==c||t[19]!==f?(p=(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[c,f]}),t[18]=c,t[19]=f,t[20]=p):p=t[20],p}if(n.iconPicker){let a=r??``,s;t[21]===n.name?s=t[22]:(s=XY(n.name),t[21]=n.name,t[22]=s);let c;t[23]!==e||t[24]!==s?(c=(0,X.jsx)(`label`,{htmlFor:e,className:`text-xs text-muted-foreground`,children:s}),t[23]=e,t[24]=s,t[25]=c):c=t[25];let l;t[26]!==i||t[27]!==u?(l=e=>{if(e===``&&u){i(void 0);return}i(e)},t[26]=i,t[27]=u,t[28]=l):l=t[28];let d;t[29]!==a||t[30]!==o||t[31]!==e||t[32]!==l?(d=(0,X.jsx)(OY,{id:e,value:a,onChange:l,autoFocus:o}),t[29]=a,t[30]=o,t[31]=e,t[32]=l,t[33]=d):d=t[33];let f;return t[34]!==c||t[35]!==d?(f=(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[c,d]}),t[34]=c,t[35]=d,t[36]=f):f=t[36],f}if(n.colorPicker){let a=r??``,s;t[37]===n.name?s=t[38]:(s=XY(n.name),t[37]=n.name,t[38]=s);let c;t[39]!==e||t[40]!==s?(c=(0,X.jsx)(`label`,{htmlFor:e,className:`text-xs text-muted-foreground`,children:s}),t[39]=e,t[40]=s,t[41]=c):c=t[41];let l;t[42]!==i||t[43]!==u?(l=e=>{if(e===``&&u){i(void 0);return}i(e)},t[42]=i,t[43]=u,t[44]=l):l=t[44];let d;t[45]!==a||t[46]!==o||t[47]!==e||t[48]!==l?(d=(0,X.jsx)(DY,{id:e,value:a,onChange:l,autoFocus:o}),t[45]=a,t[46]=o,t[47]=e,t[48]=l,t[49]=d):d=t[49];let f;return t[50]!==c||t[51]!==d?(f=(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[c,d]}),t[50]=c,t[51]=d,t[52]=f):f=t[52],f}if(n.cssLengthInput){let a=r??``,s;if(t[53]!==a){let e=eX(a);s=e.valid?null:tX(e),t[53]=a,t[54]=s}else s=t[54];let l=s,d;t[55]===n.name?d=t[56]:(d=XY(n.name),t[55]=n.name,t[56]=d);let f;t[57]!==e||t[58]!==d?(f=(0,X.jsx)(`label`,{htmlFor:e,className:`text-xs text-muted-foreground`,children:d}),t[57]=e,t[58]=d,t[59]=f):f=t[59];let p;t[60]!==i||t[61]!==u?(p=e=>{let t=e.target.value;if(t===``&&u){i(void 0);return}i(t)},t[60]=i,t[61]=u,t[62]=p):p=t[62];let m=o?``:void 0,h=l===null?void 0:!0,g=l===null?void 0:`${e}-error`,_;t[63]!==a||t[64]!==c||t[65]!==o||t[66]!==e||t[67]!==p||t[68]!==m||t[69]!==h||t[70]!==g?(_=(0,X.jsx)(Ir,{id:e,type:`text`,value:a,placeholder:`100px, 50%, 26rem, auto`,onChange:p,onKeyDown:c,autoFocus:o,"data-prop-autofocus":m,"aria-invalid":h,"aria-describedby":g,className:`h-7 text-sm`,"data-prop-css-length-input":``}),t[63]=a,t[64]=c,t[65]=o,t[66]=e,t[67]=p,t[68]=m,t[69]=h,t[70]=g,t[71]=_):_=t[71];let v;t[72]!==l||t[73]!==e?(v=l!==null&&(0,X.jsx)(`p`,{id:`${e}-error`,"data-prop-css-length-error":``,className:`text-xs text-destructive`,"aria-live":`polite`,children:l}),t[72]=l,t[73]=e,t[74]=v):v=t[74];let y;return t[75]!==v||t[76]!==f||t[77]!==_?(y=(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[f,_,v]}),t[75]=v,t[76]=f,t[77]=_,t[78]=y):y=t[78],y}let d,f,p;if(t[79]!==s||t[80]!==r){let e=s===void 0?void 0:cX(s);d=r??``;let n=e===void 0?null:sX(d,e);f=n!==null&&!n.valid&&e!==void 0&&d.trim().length>0?dX(n,e):null,p=e===void 0?void 0:lX(e),t[79]=s,t[80]=r,t[81]=d,t[82]=f,t[83]=p}else d=t[81],f=t[82],p=t[83];let m=p,h;t[84]===n.name?h=t[85]:(h=XY(n.name),t[84]=n.name,t[85]=h);let g;t[86]!==e||t[87]!==h?(g=(0,X.jsx)(`label`,{htmlFor:e,className:`text-xs text-muted-foreground`,children:h}),t[86]=e,t[87]=h,t[88]=g):g=t[88];let _;t[89]!==s||t[90]!==d||t[91]!==c||t[92]!==o||t[93]!==f||t[94]!==m||t[95]!==i||t[96]!==a||t[97]!==e||t[98]!==u?(_=s===void 0?(0,X.jsx)(Ir,{id:e,type:`text`,value:d,placeholder:m,onChange:e=>{let t=e.target.value;if(t===``&&u){i(void 0);return}i(t)},onKeyDown:c,autoFocus:o,"data-prop-autofocus":o?``:void 0,"aria-invalid":f===null?void 0:!0,"aria-describedby":f===null?void 0:`${e}-error`,className:`h-7 text-sm`}):(0,X.jsx)(VY,{id:e,value:d,onChange:e=>{if(e===``&&u){i(void 0);return}i(e)},onSubmit:a,accept:s,placeholder:m,autoFocus:o,dataPropAutofocus:o?``:void 0,ariaInvalid:f===null?void 0:!0,ariaDescribedBy:f===null?void 0:`${e}-error`,className:`h-7 text-sm`}),t[89]=s,t[90]=d,t[91]=c,t[92]=o,t[93]=f,t[94]=m,t[95]=i,t[96]=a,t[97]=e,t[98]=u,t[99]=_):_=t[99];let v;t[100]!==s||t[101]!==i||t[102]!==l?(v=l&&(0,X.jsx)(CX,{accept:s,onUploaded:e=>i(e)}),t[100]=s,t[101]=i,t[102]=l,t[103]=v):v=t[103];let y;t[104]!==_||t[105]!==v?(y=(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[_,v]}),t[104]=_,t[105]=v,t[106]=y):y=t[106];let b;t[107]!==f||t[108]!==e?(b=f!==null&&(0,X.jsx)(`p`,{id:`${e}-error`,"data-prop-media-error":``,className:`text-xs text-destructive`,"aria-live":`polite`,children:f}),t[107]=f,t[108]=e,t[109]=b):b=t[109];let x;return t[110]!==g||t[111]!==y||t[112]!==b?(x=(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[g,y,b]}),t[110]=g,t[111]=y,t[112]=b,t[113]=x):x=t[113],x}case`boolean`:{let e=`prop-${n.name}`,a;t[114]===n.name?a=t[115]:(a=XY(n.name),t[114]=n.name,t[115]=a);let o=a,s;t[116]!==e||t[117]!==o?(s=(0,X.jsx)(`label`,{htmlFor:e,className:`text-xs text-muted-foreground`,children:o}),t[116]=e,t[117]=o,t[118]=s):s=t[118];let c=!!r,l;t[119]===i?l=t[120]:(l=e=>i(e),t[119]=i,t[120]=l);let u;t[121]!==e||t[122]!==c||t[123]!==l?(u=(0,X.jsx)(TY,{id:e,checked:c,onCheckedChange:l}),t[121]=e,t[122]=c,t[123]=l,t[124]=u):u=t[124];let d;return t[125]!==s||t[126]!==u?(d=(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[s,u]}),t[125]=s,t[126]=u,t[127]=d):d=t[127],d}case`enum`:{let e=`prop-${n.name}`,a=r??n.enumValues[0]??``,o;t[128]===n.name?o=t[129]:(o=XY(n.name),t[128]=n.name,t[129]=o);let s;t[130]!==e||t[131]!==o?(s=(0,X.jsx)(`label`,{htmlFor:e,className:`text-xs text-muted-foreground`,children:o}),t[130]=e,t[131]=o,t[132]=s):s=t[132];let c;t[133]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,X.jsx)(yY,{}),t[133]=c):c=t[133];let l;t[134]===e?l=t[135]:(l=(0,X.jsx)(bY,{id:e,size:`sm`,children:c}),t[134]=e,t[135]=l);let u;t[136]===n.enumValues?u=t[137]:(u=n.enumValues.map(SX),t[136]=n.enumValues,t[137]=u);let d;t[138]===u?d=t[139]:(d=(0,X.jsx)(xY,{className:`z-70`,children:u}),t[138]=u,t[139]=d);let f;t[140]!==a||t[141]!==i||t[142]!==l||t[143]!==d?(f=(0,X.jsxs)(vY,{value:a,onValueChange:i,children:[l,d]}),t[140]=a,t[141]=i,t[142]=l,t[143]=d,t[144]=f):f=t[144];let p;return t[145]!==s||t[146]!==f?(p=(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[s,f]}),t[145]=s,t[146]=f,t[147]=p):p=t[147],p}case`number`:{let e=`prop-${n.name}`,a;t[148]===n.name?a=t[149]:(a=XY(n.name),t[148]=n.name,t[149]=a);let o;t[150]!==e||t[151]!==a?(o=(0,X.jsx)(`label`,{htmlFor:e,className:`text-xs text-muted-foreground`,children:a}),t[150]=e,t[151]=a,t[152]=o):o=t[152];let s=r==null?``:String(r),l;t[153]===i?l=t[154]:(l=e=>{let t=e.target.value;if(t===``){i(void 0);return}if(t===`-`)return;let n=Number(t);Number.isNaN(n)||i(n)},t[153]=i,t[154]=l);let u;t[155]!==c||t[156]!==e||t[157]!==s||t[158]!==l?(u=(0,X.jsx)(Ir,{id:e,type:`number`,inputMode:`numeric`,value:s,onChange:l,onKeyDown:c,className:`h-7 text-sm`}),t[155]=c,t[156]=e,t[157]=s,t[158]=l,t[159]=u):u=t[159];let d;return t[160]!==o||t[161]!==u?(d=(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[o,u]}),t[160]=o,t[161]=u,t[162]=d):d=t[162],d}default:{let e;return t[163]===n?e=t[164]:(e=bX(n),t[163]=n,t[164]=e),e}}}function SX(e){return(0,X.jsx)(SY,{value:e,children:e},e)}function CX(e){let t=(0,Z.c)(17),{accept:n,onUploaded:r}=e,[i,a]=(0,Q.useState)(!1),s=(0,Q.useRef)(null),c;t[0]===n?c=t[1]:(c=n.join(`,`),t[0]=n,t[1]=c);let l;t[2]!==n||t[3]!==r?(l=async e=>{let t=e.target.files?.[0];if(t){a(!0);try{await gX(t,n,r)}catch{}a(!1),s.current&&(s.current.value=``)}},t[2]=n,t[3]=r,t[4]=l):l=t[4];let u;t[5]!==c||t[6]!==l?(u=(0,X.jsx)(`input`,{ref:s,type:`file`,accept:c,className:`hidden`,"data-prop-upload-input":``,onChange:l}),t[5]=c,t[6]=l,t[7]=u):u=t[7];let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>s.current?.click(),t[8]=d):d=t[8];let f;t[9]===i?f=t[10]:(f=i?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(zn,{className:`size-3.5 animate-spin`,"aria-hidden":`true`}),(0,X.jsx)(o,{id:`_eguJc`})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(za,{className:`size-3.5`,"aria-hidden":`true`}),(0,X.jsx)(o,{id:`eJitUk`})]}),t[9]=i,t[10]=f);let p;t[11]!==f||t[12]!==i?(p=(0,X.jsx)(en,{type:`button`,variant:`outline`,size:`sm`,disabled:i,"data-prop-upload-trigger":``,className:`h-7 w-full justify-center gap-1.5 px-2 text-xs`,onClick:d,children:f}),t[11]=f,t[12]=i,t[13]=p):p=t[13];let m;return t[14]!==u||t[15]!==p?(m=(0,X.jsxs)(X.Fragment,{children:[u,p]}),t[14]=u,t[15]=p,t[16]=m):m=t[16],m}var wX=new Set([`img`,`CommonMarkImage`,`video`,`audio`,`Pdf`,`File`]);function TX(e,t,n){if(!wX.has(e)||!n)return t;let r=t.src;if(typeof r!=`string`)return t;let i=Ve(r,n);return i===r?t:{...t,src:i}}var EX=`selectionStatePlugin/origin`,DX=`selectionStatePlugin/refresh`,OX=new q(`selectionState`),kX=new Set,AX={selectedBlockId:null,ancestorChain:[],selectionOrigin:`programmatic`,isDragging:!1,rangeEncompassedBlockIds:kX};function jX(e){return OX.getState(e.state)??AX}function MX(e,t){let n=[],{$from:r}=t;for(let t=1;t<=r.depth;t++){let i=r.node(t);if(i.type.name!==`jsxComponent`)continue;let a=r.before(t);n.push(NX(e,i,a))}if(t instanceof Nt){let r=t.node;r.type.name===`jsxComponent`&&n.push(NX(e,r,t.from))}return n}function NX(e,t,n){let r=t.attrs.componentName??`unknown`;return{bridgeId:PX(e,n),componentName:r,pos:n}}function PX(e,t){return iN.getState(e)?.posToId.get(t)??`pos-${t}`}function FX(e,t){if(t instanceof Nt)return kX;let{from:n,to:r}=t;if(n>=r)return kX;let i=iN.getState(e)?.posToId;if(!i)return kX;let a=null;for(let[t,o]of i){if(t<n)continue;let i=e.doc.nodeAt(t);i&&(t+i.nodeSize>r||(a||=new Set,a.add(o)))}return a??kX}function IX(e,t,n={}){let r=MX(e,e.selection),i=r[r.length-1],a=FX(e,e.selection),o={selectedBlockId:i?.bridgeId??null,ancestorChain:r,selectionOrigin:n.origin??t.selectionOrigin,isDragging:n.isDragging??t.isDragging,rangeEncompassedBlockIds:a};return LX(t,o)?t:o}function LX(e,t){if(e===t)return!0;if(e.selectedBlockId!==t.selectedBlockId||e.selectionOrigin!==t.selectionOrigin||e.isDragging!==t.isDragging||e.ancestorChain.length!==t.ancestorChain.length)return!1;for(let n=0;n<e.ancestorChain.length;n++){let r=e.ancestorChain[n],i=t.ancestorChain[n];if(r.bridgeId!==i.bridgeId||r.componentName!==i.componentName||r.pos!==i.pos)return!1}if(e.rangeEncompassedBlockIds.size!==t.rangeEncompassedBlockIds.size)return!1;for(let n of e.rangeEncompassedBlockIds)if(!t.rangeEncompassedBlockIds.has(n))return!1;return!0}var RX=new WeakMap;function zX(e,t,n,r){let i=r?.isDragging??t.isDragging,a=!!e.getMeta(DX),o=e.selectionSet&&!a,s=e.getMeta(EX),c=o?r?.pendingOrigin??null:null,l=s??c??t.selectionOrigin;return o&&r&&(r.pendingOrigin=null),IX(n,t,{origin:l,isDragging:i})}var BX=F.create({name:`selectionStatePlugin`,addProseMirrorPlugins(){let e=this.editor,t=new Ht({key:OX,state:{init(e,t){return IX(t,AX)},apply(e,n,r,i){return zX(e,n,i,RX.get(t))}},props:{handleDOMEvents:{mousedown:()=>{let e=RX.get(t);return e&&(e.pendingOrigin=`pointer`),!1},pointerdown:()=>{let e=RX.get(t);return e&&(e.pendingOrigin=`pointer`),!1}},handleKeyDown:(e,n)=>{if(VX(n.key)){let e=RX.get(t);e&&(e.pendingOrigin=`keyboard`)}return!1}},view(n){RX.set(t,{pendingOrigin:null,isDragging:!1});let r=n.dom.parentElement??n.dom,i=()=>{let n=RX.get(t);n&&(n.isDragging=!0,HX(e))},a=()=>{let n=RX.get(t);n&&(n.isDragging=!1,HX(e))};return r.addEventListener(`dragstart`,i,!0),r.addEventListener(`dragend`,a,!0),r.addEventListener(`drop`,a,!0),{destroy:()=>{r.removeEventListener(`dragstart`,i,!0),r.removeEventListener(`dragend`,a,!0),r.removeEventListener(`drop`,a,!0),RX.delete(t)}}}});return[t]}});function VX(e){return e===`ArrowUp`||e===`ArrowDown`||e===`ArrowLeft`||e===`ArrowRight`||e===`Tab`||e===`Escape`||e===`Enter`||e===`Home`||e===`End`||e===`PageUp`||e===`PageDown`}function HX(e){queueMicrotask(()=>{if(!e.isDestroyed)try{let t=e.state.tr.setMeta(DX,!0);e.view.dispatch(t)}catch{}})}function UX(e){let t=(0,Z.c)(5),n;t[0]===e?n=t[1]:(n=()=>e?jX(e):null,t[0]=e,t[1]=n);let[r,i]=(0,Q.useState)(n),a,o;return t[2]===e?(a=t[3],o=t[4]):(a=()=>{if(!e){i(null);return}i(jX(e));let t=()=>{i(jX(e))};return e.on(`transaction`,t),e.on(`selectionUpdate`,t),()=>{e.off(`transaction`,t),e.off(`selectionUpdate`,t)}},o=[e],t[2]=e,t[3]=a,t[4]=o),(0,Q.useEffect)(a,o),r}function WX(e,t){if(e.hasChildren)return!1;let n=YY(e.props);return n===null?!1:t[n]===``}function GX(e){let t=e.placeholder?.label,n=`Add ${(e.displayName??e.name).toLowerCase()}`;return{label:t??n,Icon:hk(e.placeholder?.icon??e.icon)}}var KX=new Set([`img`,`CommonMarkImage`,`Embed`,`video`]);function qX(e){if(!e.attrs.sourceDirty&&e.attrs.sourceRaw)return e.attrs.sourceRaw;let t=jA(),n=e.type.schema.node(`doc`,null,[e]);return t.serialize(n.toJSON()).trim()}var JX=new Set($e.map(e=>`${e}:`)),YX=6e4,XX=10,ZX=new Map;function QX(e,t){let n=t.toLowerCase();O(n);let r=Date.now(),i=ZX.get(n);if(!i||r-i.windowStart>=YX)ZX.set(n,{windowStart:r,count:1});else if(i.count+=1,i.count>XX)return;typeof console<`u`&&typeof console.warn==`function`&&console.warn(JSON.stringify({event:`jsx-prop-dropped`,reason:e,prop:t}))}var $X=new Set([`href`,`src`,`action`,`formaction`,`poster`,`cite`,`data`,`manifest`,`background`,`ping`,`xlinkhref`,`xlinkactuate`,`xlinkrole`,`xlinkarcrole`,`xlinkshow`,`url`,`link`]),eZ=new Set([`dangerouslysetinnerhtml`,`ref`,`key`,`defaultvalue`,`defaultchecked`,`__proto__`,`constructor`,`prototype`]),tZ=1e4;function nZ(e){let t=e.toLowerCase();return!!(eZ.has(t)||t.length>=3&&t.startsWith(`on`))}function rZ(e){return $X.has(e.toLowerCase())}function iZ(e){if(typeof e!=`string`)return e;let t=e.trim();if(!t||t.startsWith(`#`)||t.startsWith(`//`)||We(t))return e;let n=t.indexOf(`:`),r=t.slice(0,n+1).toLowerCase();return JX.has(r)?e:`#`}function aZ(e){if(e.length>tZ)return``;let t=e.toLowerCase();return/url\s*\(\s*['"]?\s*(?:javascript|vbscript|data)\s*:/.test(t)||/\bexpression\s*\(/.test(t)?``:e}function oZ(e){if(e==null)return e;if(Array.isArray(e)){let t=!1,n=Array(e.length);for(let r=0;r<e.length;r++){let i=oZ(e[r]);n[r]=i,i!==e[r]&&(t=!0)}return t?n:e}if(typeof e!=`object`)return e;let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)return e;let n=e,r=!1,i={};for(let[e,t]of Object.entries(n)){if(nZ(e)){QX(`dangerous-prop-name-nested`,e),r=!0;continue}if(rZ(e)&&typeof t==`string`){let n=iZ(t);n!==t&&(r=!0),i[e]=n}else{let n=oZ(t);n!==t&&(r=!0),i[e]=n}}return r?i:e}function sZ(e){let t=!1,n={};for(let[r,i]of Object.entries(e)){if(nZ(r)){QX(`dangerous-prop-name`,r),t=!0;continue}if(rZ(r)){let e=iZ(i);e!==i&&(t=!0),n[r]=e;continue}if(r===`style`){if(typeof i==`string`){let e=aZ(i);e!==i&&(t=!0),n[r]=e}else t=!0;continue}let e=oZ(i);e!==i&&(t=!0),n[r]=e}return t?n:e}function cZ(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,X.jsx)(`div`,{className:`jsx-component-error-fallback`,children:n}),t[0]=n,t[1]=r),r}function lZ(e){let t=(0,Z.c)(13),{children:n,resetKey:r,onError:i,descriptorName:a,rawComponentName:o}=e,s;t[0]===r?s=t[1]:(s=[r],t[0]=r,t[1]=s);let c;t[2]!==a||t[3]!==i||t[4]!==o?(c=(e,t)=>{let n=e instanceof Error?e:Error(String(e));console.warn(JSON.stringify({event:`jsx-render-failure`,component:a,rawComponentName:String(o??``).slice(0,200),error:String(n),stack:t.componentStack})),fe(a),i(n)},t[2]=a,t[3]=i,t[4]=o,t[5]=c):c=t[5];let l;t[6]===n?l=t[7]:(l=e=>(0,X.jsx)(cZ,{...e,children:n}),t[6]=n,t[7]=l);let u;return t[8]!==n||t[9]!==s||t[10]!==c||t[11]!==l?(u=(0,X.jsx)(mY,{resetKeys:s,onError:c,fallbackRender:l,children:n}),t[8]=n,t[9]=s,t[10]=c,t[11]=l,t[12]=u):u=t[12],u}function uZ(e){if(typeof e!=`object`||!e)return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(uZ).join(`,`)}]`;let t=Object.entries(e);return t.sort(([e],[t])=>e<t?-1:+(e>t)),`{${t.map(([e,t])=>`${JSON.stringify(e)}:${uZ(t)}`).join(`,`)}}`}function dZ(e,t){let n=e.props??{},r={};for(let[e,i]of Object.entries(n))t.has(e)||(r[e]=i);return sZ(r)}function fZ(e){return e.kind===`element`?e:null}var pZ=3;function mZ(e){let t=(0,Z.c)(162),{node:n,editor:r,extension:i,getPos:a,selected:c}=e,{_:l}=s(),u=kM(n.attrs.componentName),[d,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(!1),_=(0,Q.useRef)(!1),v=typeof a==`function`?a():void 0,y=!1,b=0,x=1;try{if(v!==void 0){let e=r.state.doc.resolve(v);e.depth>0&&e.parent.type.name===`jsxComponent`&&(y=!0,b=e.index(e.depth),x=e.parent.childCount)}}catch(e){let t=e;if(!(t instanceof RangeError))throw t}let S=y&&b>0,C=y&&b<x-1,w=UX(r),T=typeof v==`number`?PX(r.state,v):null,D=T!==null&&(w?.rangeEncompassedBlockIds.has(T)??!1),O;t[0]===w?.ancestorChain?O=t[1]:(O=w?.ancestorChain.at(-1)?.bridgeId??null,t[0]=w?.ancestorChain,t[1]=O);let k=T!==null&&O===T,A=c&&!D&&k,j=T!==null&&!k&&(w?.ancestorChain.some(e=>e.bridgeId===T)??!1),M=A&&w?w.selectionOrigin:void 0,N=A&&(w?.isDragging??!1),P=u.props.some(bZ),F=n.attrs.props??{},I=P&&u.props.some(e=>e.type!==`string`||!e.required||`hidden`in e&&e.hidden?!1:!Object.hasOwn(F,e.name)),L=WX(u,F),z=L?GX(u):null,B=!u.hasChildren||!!u.isSelfClosing,V=KX.has(u.name),H=u.name===`MermaidFence`?{propName:`chart`,language:`mermaid`}:u.name===`Math`||u.name===`DollarMath`||u.name===`MathFence`?{propName:`formula`,language:`latex`}:null,[ee,U]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{c&&!_.current&&P&&RM(v)&&g(!0),_.current=c},[c,P,v]);let W=dZ(n.attrs,u.reactNodePropNames),te=u.surface===`compat`?u.translateProps(W):W,G=i.options.docName,ne=typeof G==`string`&&G?G:vO(r),re=TX(u.name,te,ne),ie=`${u.name}::${uZ(W)}`,oe;t[2]!==a||t[3]!==n.content.size?(oe=()=>(typeof a==`function`?a()??0:0)+1+n.content.size,t[2]=a,t[3]=n.content.size,t[4]=oe):oe=t[4];let se=oe,K=u.name===`*`||d!==null,ce=(0,Q.useRef)(!1),le=(0,Q.useRef)(0),[ue,de]=(0,Q.useState)(!1);if((0,Q.useEffect)(()=>{if(!K||ce.current||ue)return;let e=typeof a==`function`?a():void 0;if(typeof e!=`number`)return;let t=qX(n),i=u.name===`*`?`Unregistered component: ${n.attrs.componentName}`:`Render error in <${u.displayName??u.name}>: ${d?.message??`unknown`}`,o=n.type.schema.nodes.rawMdxFallback.create({reason:i},n.type.schema.text(t)),s=!1,c,l=()=>{if(!s)try{r.view.dispatch(r.state.tr.replaceWith(e,e+n.nodeSize,o)),ce.current=!0,ae(u.name===`*`?`wildcard`:u.name)}catch(e){let t=e,r=u.name===`*`?`wildcard`:u.name;if(console.warn(JSON.stringify({event:`jsx-component-auto-convert-failed`,component:r,rawComponentName:String(n.attrs.componentName??``).slice(0,200),reason:t instanceof Error?t.message.slice(0,500):String(t).slice(0,500),retry:le.current})),R(r),le.current+=1,le.current<pZ){let e=50*(2**le.current-1);c=setTimeout(()=>{s||l()},e)}else s||de(!0)}},f=requestAnimationFrame(l);return()=>{s=!0,cancelAnimationFrame(f),c!==void 0&&clearTimeout(c)}},[K,n,r,a,u,d,ue]),ue){let e=n.attrs.componentName,i=u.displayName??u.name,o=u.name===`*`?l({id:`Kh1n4a`,values:{componentName:e}}):l({id:`g58Kwy`,values:{descriptorLabel:i}}),s=()=>{try{let e=qX(n);typeof navigator<`u`&&navigator.clipboard?.writeText&&navigator.clipboard.writeText(e)}catch(e){let t=e;ve(u.name),console.warn(JSON.stringify({event:`jsx-component-stuck-copy-failed`,component:u.name,rawComponentName:String(n.attrs.componentName??``).slice(0,200),reason:t instanceof Error?t.message.slice(0,500):String(t).slice(0,500)}))}},c=()=>{let e=typeof a==`function`?a():void 0;if(typeof e==`number`)try{r.chain().focus().setNodeSelection(e).deleteSelection().run()}catch(e){let t=e;if(!(t instanceof RangeError))throw t;E(u.name),console.warn(JSON.stringify({event:`jsx-component-stuck-delete-failed`,component:u.name,rawComponentName:String(n.attrs.componentName??``).slice(0,200),reason:t.message.slice(0,500)}))}},d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d={[MF]:`true`},t[5]=d):d=t[5];let f;t[6]===o?f=t[7]:(f=(0,X.jsx)(`span`,{className:`flex-1`,children:o}),t[6]=o,t[7]=f);let p;t[8]===l?p=t[9]:(p=l({id:`E2Mv-X`}),t[8]=l,t[9]=p);let m;t[10]!==s||t[11]!==p?(m=(0,X.jsx)(`button`,{type:`button`,className:`text-xs underline hover:no-underline`,onClick:s,children:p}),t[10]=s,t[11]=p,t[12]=m):m=t[12];let h;t[13]===l?h=t[14]:(h=l({id:`cnGeoo`}),t[13]=l,t[14]=h);let g;t[15]!==c||t[16]!==h?(g=(0,X.jsx)(`button`,{type:`button`,className:`text-xs underline hover:no-underline`,onClick:c,children:h}),t[15]=c,t[16]=h,t[17]=g):g=t[17];let _;t[18]!==m||t[19]!==g||t[20]!==f?(_=(0,X.jsxs)(`div`,{className:`text-xs font-mono text-muted-foreground px-2 py-2 border border-destructive/40 rounded bg-destructive/5 flex items-center gap-2`,contentEditable:!1,...d,children:[f,m,g]}),t[18]=m,t[19]=g,t[20]=f,t[21]=_):_=t[21];let v;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,X.jsx)(ql,{className:`component-children`}),t[22]=v):v=t[22];let y;return t[23]===_?y=t[24]:(y=(0,X.jsxs)(Jl,{className:`jsx-component-wrapper my-2`,children:[_,v]}),t[23]=_,t[24]=y),y}if(K){let e=n.attrs.componentName,r=u.displayName??u.name,i=u.name===`*`?l({id:`oJl7eO`,values:{componentName:e}}):l({id:`bcDHUM`,values:{descriptorLabel:r}}),a;t[25]===i?a=t[26]:(a=(0,X.jsx)(`div`,{className:`text-xs font-mono text-muted-foreground px-2 py-1`,contentEditable:!1,children:i}),t[25]=i,t[26]=a);let o;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,X.jsx)(ql,{className:`component-children`}),t[27]=o):o=t[27];let s;return t[28]===a?s=t[29]:(s=(0,X.jsxs)(Jl,{className:`jsx-component-wrapper my-2`,children:[a,o]}),t[28]=a,t[29]=s),s}let fe=u.Component,pe=u.displayName??u.name,me=u.displayName??u.name,ge=u.displayName??u.name,_e=e=>{if(L||!B)return;let t=e.target;if(!e.currentTarget.contains(t)||t.closest(`.jsx-component-chrome`)||t.closest(`.jsx-add-child-pill, .jsx-empty-child-placeholder`)||t.closest(`a[href]`)||typeof v!=`number`)return;let n=r.state.doc.nodeAt(v);if(!n)return;let i=v+n.nodeSize,a=r.state.selection.from;a<v||a>=i||r.chain().focus().setNodeSelection(v).run()},ye;t[30]!==r||t[31]!==a||t[32]!==g?(ye=()=>{let e=typeof a==`function`?a():void 0;typeof e==`number`&&(r.chain().focus().setNodeSelection(e).run(),g(!0))},t[30]=r,t[31]=a,t[32]=g,t[33]=ye):ye=t[33];let be=ye,xe=u.displayName??u.name,Se=!!u.emptyChildName,Ce=Se?JY(xe,u.emptyChildName,n.childCount):void 0,we=e=>{let t=e.target;if(e.key===`Backspace`||e.key===`Delete`){if(!A||!e.currentTarget.contains(t)||t.matches(`input, textarea`))return;let i=typeof a==`function`?a():void 0;if(typeof i!=`number`)return;e.preventDefault();try{r.chain().focus().setNodeSelection(i).deleteSelection().run()||(Kt(u.name),console.warn(JSON.stringify({event:`jsx-component-keyboard-delete-failed`,component:u.name,rawComponentName:String(n.attrs.componentName??``).slice(0,200),reason:`chain-dispatch-returned-false`})))}catch(e){let t=e;if(!(t instanceof RangeError))throw t;Kt(u.name),console.warn(JSON.stringify({event:`jsx-component-keyboard-delete-failed`,component:u.name,rawComponentName:String(n.attrs.componentName??``).slice(0,200),reason:t.message.slice(0,500)}))}return}e.key!==`Enter`&&e.key!==` `||c&&P&&(t.closest(`.jsx-component-chrome`)||t.closest(`input, textarea, select, button`)||(e.preventDefault(),g(!0)))},Te=e=>{g(e),!e&&requestAnimationFrame(()=>{let e=typeof a==`function`?a():void 0;if(typeof e==`number`)try{let t=r.state.doc.nodeAt(e);if(!t)return;let n=e+t.nodeSize,i=r.state.selection.from;if(i<e||i>=n)return;if(B){let e=r.state.doc.resolve(Math.min(n,r.state.doc.content.size)),t=p.near(e,1);r.view.dispatch(r.state.tr.setSelection(t).scrollIntoView())}else r.chain().setNodeSelection(e).run()}catch(e){let t=e;if(!(t instanceof RangeError))throw t;he(u.name),console.warn(JSON.stringify({event:`jsx-component-popover-close-restore-failed`,component:u.name,rawComponentName:String(n.attrs.componentName??``).slice(0,200),reason:t.message.slice(0,500)}))}})},Ee=hc,De=Jl,Oe;t[34]===u.name?Oe=t[35]:(Oe=u.name.toLowerCase(),t[34]=u.name,t[35]=Oe);let ke;bb0:{let e=F.align;if(e===`left`||e===`right`||e===`center`){ke=e;break bb0}if(V){ke=`center`;break bb0}ke=void 0}let Ae=A?`true`:void 0,je=j?`true`:void 0,Me=D?`true`:void 0,Ne=N?`true`:void 0,Pe=I?`true`:void 0,q=Se?`group`:void 0,Fe=A?0:-1,Ie;t[36]===y?Ie=t[37]:(Ie=y?{draggable:`false`,onDragStart:yZ}:{"data-drag-handle":``,draggable:`true`},t[36]=y,t[37]=Ie);let Le=u.name,Re=vZ,ze;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(ze={[MF]:`true`},t[38]=ze):ze=t[38];let Be=u.name===`Embed`&&typeof W.src==`string`&&/^https?:\/\//i.test(W.src)&&(0,X.jsx)(`a`,{href:W.src,target:`_blank`,rel:`noopener noreferrer`,className:`jsx-chrome-btn`,"aria-label":l({id:`iOHg1t`}),onMouseDown:_Z,children:(0,X.jsx)(Zi,{size:12,"aria-hidden":`true`})}),Ve=u.name===`Mirror`&&typeof W.src==`string`&&W.src.length>0&&(()=>{let e=W.src;return(0,X.jsx)(`a`,{href:Dn(e,typeof W.anchor==`string`&&W.anchor.length>0?W.anchor:null),className:`jsx-chrome-btn`,"aria-label":l({id:`3a_Bd7`,values:{mirrorSrc:e}}),title:l({id:`0kTAXe`,values:{mirrorSrc:e}}),onMouseDown:gZ,children:(0,X.jsx)(Zi,{size:12,"aria-hidden":`true`})})})(),He;t[39]!==l||t[40]!==S||t[41]!==u.name||t[42]!==r||t[43]!==n.attrs.componentName||t[44]!==n.nodeSize||t[45]!==v?(He=S&&(0,X.jsx)(`button`,{type:`button`,className:`jsx-chrome-btn`,"aria-label":l({id:`QyioBP`}),onClick:()=>{try{if(typeof v!=`number`)return;let e=r.state.doc.resolve(v),t=e.index(e.depth);if(t===0)return;let i=v-e.node(e.depth).child(t-1).nodeSize,a=v+n.nodeSize,o=r.state.tr,s=r.state.doc.slice(v,v+n.nodeSize),c=r.state.doc.slice(i,v);o.replaceWith(i,a,s.content.append(c.content)),r.view.dispatch(o.scrollIntoView())}catch(e){let t=e;if(!(t instanceof RangeError))throw t;f(`up`),console.warn(JSON.stringify({event:`jsx-component-move-failed`,direction:`up`,component:u.name,rawComponentName:String(n.attrs.componentName??``).slice(0,200),reason:t.message.slice(0,500)}))}},children:(0,X.jsx)(Ri,{size:12,"aria-hidden":`true`})}),t[39]=l,t[40]=S,t[41]=u.name,t[42]=r,t[43]=n.attrs.componentName,t[44]=n.nodeSize,t[45]=v,t[46]=He):He=t[46];let Ue;t[47]!==l||t[48]!==C||t[49]!==u.name||t[50]!==r||t[51]!==n.attrs.componentName||t[52]!==n.nodeSize||t[53]!==v?(Ue=C&&(0,X.jsx)(`button`,{type:`button`,className:`jsx-chrome-btn`,"aria-label":l({id:`3Ib6FN`}),onClick:()=>{try{if(typeof v!=`number`)return;let e=r.state.doc.resolve(v),t=e.index(e.depth),i=e.node(e.depth);if(t>=i.childCount-1)return;let a=i.child(t+1),o=v,s=v+n.nodeSize+a.nodeSize,c=r.state.tr,l=r.state.doc.slice(v,v+n.nodeSize),u=r.state.doc.slice(v+n.nodeSize,s);c.replaceWith(o,s,u.content.append(l.content)),r.view.dispatch(c.scrollIntoView())}catch(e){let t=e;if(!(t instanceof RangeError))throw t;f(`down`),console.warn(JSON.stringify({event:`jsx-component-move-failed`,direction:`down`,component:u.name,rawComponentName:String(n.attrs.componentName??``).slice(0,200),reason:t.message.slice(0,500)}))}},children:(0,X.jsx)(Li,{size:12,"aria-hidden":`true`})}),t[47]=l,t[48]=C,t[49]=u.name,t[50]=r,t[51]=n.attrs.componentName,t[52]=n.nodeSize,t[53]=v,t[54]=Ue):Ue=t[54];let We;t[55]!==l||t[56]!==u.displayName||t[57]!==u.name||t[58]!==H||t[59]!==v||t[60]!==U?(We=H&&typeof v==`number`?(0,X.jsx)(`button`,{type:`button`,className:`jsx-chrome-btn`,"aria-label":l({id:`ky9Tuc`,values:{0:u.displayName??u.name}}),"data-testid":`jsx-component-edit-btn`,onClick:()=>U(!0),children:(0,X.jsx)(qn,{size:12,"aria-hidden":`true`})}):null,t[55]=l,t[56]=u.displayName,t[57]=u.name,t[58]=H,t[59]=v,t[60]=U,t[61]=We):We=t[61];let Ge;t[62]!==l||t[63]!==pe?(Ge=l({id:`MCjC9A`,values:{deleteDescriptorLabel:pe}}),t[62]=l,t[63]=pe,t[64]=Ge):Ge=t[64];let Ke;t[65]!==u.name||t[66]!==r||t[67]!==n.attrs.componentName||t[68]!==v?(Ke=()=>{if(typeof v==`number`)try{r.chain().focus().setNodeSelection(v).deleteSelection().run()||(Kt(u.name),console.warn(JSON.stringify({event:`jsx-component-chrome-delete-failed`,component:u.name,rawComponentName:String(n.attrs.componentName??``).slice(0,200),reason:`chain-dispatch-returned-false`})))}catch(e){let t=e;if(!(t instanceof RangeError))throw t;Kt(u.name),console.warn(JSON.stringify({event:`jsx-component-chrome-delete-failed`,component:u.name,rawComponentName:String(n.attrs.componentName??``).slice(0,200),reason:t.message.slice(0,500)}))}},t[65]=u.name,t[66]=r,t[67]=n.attrs.componentName,t[68]=v,t[69]=Ke):Ke=t[69];let qe;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(qe=(0,X.jsx)(Hn,{size:12,"aria-hidden":`true`}),t[70]=qe):qe=t[70];let Je;t[71]!==Ge||t[72]!==Ke?(Je=(0,X.jsx)(`button`,{type:`button`,className:`jsx-chrome-btn jsx-chrome-btn--delete`,"aria-label":Ge,onClick:Ke,children:qe}),t[71]=Ge,t[72]=Ke,t[73]=Je):Je=t[73];let Ye;t[74]!==l||t[75]!==P||t[76]!==me?(Ye=P&&(0,X.jsx)(gc,{asChild:!0,children:(0,X.jsx)(`button`,{type:`button`,className:`jsx-chrome-btn`,"data-jsx-gear":``,"aria-label":l({id:`XPJ0sN`,values:{settingsDescriptorLabel:me}}),children:(0,X.jsx)(ja,{size:12,"aria-hidden":`true`})})}),t[74]=l,t[75]=P,t[76]=me,t[77]=Ye):Ye=t[77];let Xe;t[78]!==Re||t[79]!==ze||t[80]!==Be||t[81]!==Ve||t[82]!==He||t[83]!==Ue||t[84]!==We||t[85]!==Je||t[86]!==Ye?(Xe=(0,X.jsxs)(`div`,{className:`jsx-component-chrome`,contentEditable:!1,onMouseDown:Re,...ze,children:[Be,Ve,He,Ue,We,Je,Ye]}),t[78]=Re,t[79]=ze,t[80]=Be,t[81]=Ve,t[82]=He,t[83]=Ue,t[84]=We,t[85]=Je,t[86]=Ye,t[87]=Xe):Xe=t[87];let Ze;t[88]!==fe||t[89]!==u.emptyChildName||t[90]!==u.hasChildren||t[91]!==u.isSelfClosing||t[92]!==u.name||t[93]!==r||t[94]!==a||t[95]!==se||t[96]!==A||t[97]!==n.attrs.componentName||t[98]!==n.childCount||t[99]!==be||t[100]!==re||t[101]!==ie||t[102]!==z||t[103]!==m||t[104]!==L?(Ze=L&&z?(0,X.jsx)(vc,{asChild:!0,children:(0,X.jsx)(gY,{label:z.label,Icon:z.Icon,onClick:be,selected:A})}):(0,X.jsx)(lZ,{resetKey:ie,onError:m,descriptorName:u.name===`*`?`wildcard`:u.name,rawComponentName:n.attrs.componentName??``,children:(0,X.jsx)(Ok,{value:typeof a==`function`?{editor:r,getPos:()=>{let e=a();return typeof e==`number`?e:void 0},addChild:u.emptyChildName?()=>{let e=u.emptyChildName,t=FM(e),n=se();r.chain().focus().insertContentAt(n,t).run(),zM(r,n,kM(e))}:null}:null,children:(0,X.jsx)(fe,{...re,children:(0,X.jsx)(ql,{className:`component-children ${!u.hasChildren&&n.childCount===0?`min-h-0 m-0 p-0`:``}`,...!u.hasChildren||u.isSelfClosing?{contentEditable:!1}:{}})})})}),t[88]=fe,t[89]=u.emptyChildName,t[90]=u.hasChildren,t[91]=u.isSelfClosing,t[92]=u.name,t[93]=r,t[94]=a,t[95]=se,t[96]=A,t[97]=n.attrs.componentName,t[98]=n.childCount,t[99]=be,t[100]=re,t[101]=ie,t[102]=z,t[103]=m,t[104]=L,t[105]=Ze):Ze=t[105];let Qe;t[106]!==u.emptyChildName||t[107]!==u.name||t[108]!==r||t[109]!==se||t[110]!==n.childCount?(Qe=u.emptyChildName&&!(u.name===`Tabs`&&n.childCount>0)&&(()=>{let e=u.emptyChildName;return(0,X.jsx)(`button`,{type:`button`,contentEditable:!1,className:n.childCount===0?`jsx-empty-child-placeholder`:`jsx-add-child-pill`,onMouseDown:hZ,onClick:()=>{let e=u.emptyChildName,t=FM(e),n=se();r.chain().focus().insertContentAt(n,t).run(),zM(r,n,kM(e))},"data-clipboard-omit":`true`,children:(0,X.jsx)(`span`,{children:(0,X.jsx)(o,{id:`7Fkcej`,values:{addChildName:e}})})})})(),t[106]=u.emptyChildName,t[107]=u.name,t[108]=r,t[109]=se,t[110]=n.childCount,t[111]=Qe):Qe=t[111];let $e;t[112]!==De||t[113]!==u.name||t[114]!==Ce||t[115]!==_e||t[116]!==we||t[117]!==M||t[118]!==Oe||t[119]!==ke||t[120]!==Ae||t[121]!==je||t[122]!==Me||t[123]!==Ne||t[124]!==Pe||t[125]!==q||t[126]!==Fe||t[127]!==Ie||t[128]!==Xe||t[129]!==Ze||t[130]!==Qe?($e=(0,X.jsxs)(De,{className:`jsx-component-wrapper my-2`,"data-jsx-component":``,"data-component-type":Oe,"data-align":ke,"data-selected":Ae,"data-has-child-selected":je,"data-range-selected":Me,"data-selection-origin":M,"data-dragging":Ne,"data-needs-config":Pe,role:q,"aria-label":Ce,tabIndex:Fe,...Ie,"data-component-name":Le,onClick:_e,onKeyDown:we,children:[Xe,Ze,Qe]}),t[112]=De,t[113]=u.name,t[114]=Ce,t[115]=_e,t[116]=we,t[117]=M,t[118]=Oe,t[119]=ke,t[120]=Ae,t[121]=je,t[122]=Me,t[123]=Ne,t[124]=Pe,t[125]=q,t[126]=Fe,t[127]=Ie,t[128]=Xe,t[129]=Ze,t[130]=Qe,t[131]=$e):$e=t[131];let et;t[132]!==l||t[133]!==F||t[134]!==u.Component||t[135]!==u.displayName||t[136]!==u.name||t[137]!==ee||t[138]!==H||t[139]!==r||t[140]!==a||t[141]!==v||t[142]!==re||t[143]!==U?(et=H&&typeof v==`number`?(0,X.jsx)(_K,{open:ee,onOpenChange:U,initialValue:typeof F[H.propName]==`string`?F[H.propName]:``,language:H.language,title:l({id:`ky9Tuc`,values:{0:u.displayName??u.name}}),renderPreview:e=>{let t=u.Component;return(0,X.jsx)(`div`,{className:`flex h-full w-full items-center justify-center p-4`,children:(0,X.jsx)(t,{...re,[H.propName]:e})})},onSave:e=>{let t=typeof a==`function`?a():void 0;if(typeof t!=`number`)return;let n=r.state.doc.nodeAt(t);if(!n)return;let i=fZ(n.attrs);if(i)try{let n={...i.props,[H.propName]:e},a={...i,props:n,sourceDirty:!0};r.view.dispatch(r.state.tr.setNodeMarkup(t,null,a))}catch(e){let t=e;if(!(t instanceof RangeError))throw t;console.warn(`[JsxComponentView] edit-save failed — position race`,t)}}}):null,t[132]=l,t[133]=F,t[134]=u.Component,t[135]=u.displayName,t[136]=u.name,t[137]=ee,t[138]=H,t[139]=r,t[140]=a,t[141]=v,t[142]=re,t[143]=U,t[144]=et):et=t[144];let tt;t[145]!==u||t[146]!==r||t[147]!==a||t[148]!==P||t[149]!==B||t[150]!==W||t[151]!==ge||t[152]!==g||t[153]!==L?(tt=P&&(0,X.jsxs)(_c,{side:L?`bottom`:`right`,align:L?`center`:`start`,sideOffset:L?-4:8,className:`w-64 p-3 z-[60] overflow-y-auto subtle-scrollbar max-h-[var(--radix-popper-available-height)] overscroll-contain`,onCloseAutoFocus:B?e=>{e.preventDefault(),r.view.focus()}:void 0,children:[(0,X.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground mb-2`,children:(0,X.jsx)(o,{id:`Mnavhe`,values:{propPanelDescriptorLabel:ge}})}),(0,X.jsx)(_X,{descriptor:u,values:W,onDismiss:()=>g(!1),onChange:(e,t)=>{let n=typeof a==`function`?a():void 0;if(typeof n!=`number`)return;let i=r.state.doc.nodeAt(n);if(!i)return;let o=fZ(i.attrs);if(!o)return;let s={...o.props},c=Array.isArray(i.attrs.attributes)?i.attrs.attributes:[],l=c;t===void 0?(delete s[e],l=c.filter(t=>!(typeof t==`object`&&t&&t.type===`mdxJsxAttribute`&&t.name===e))):s[e]=t,r.view.dispatch(r.state.tr.setNodeMarkup(n,null,{...o,attributes:l,props:s,sourceDirty:!0}))}}),(0,X.jsx)(`div`,{className:`mt-3 flex justify-end border-t border-border pt-2`,children:(0,X.jsx)(en,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>g(!1),className:`h-7 px-3 text-xs`,children:(0,X.jsx)(o,{id:`DPfwMq`})})})]}),t[145]=u,t[146]=r,t[147]=a,t[148]=P,t[149]=B,t[150]=W,t[151]=ge,t[152]=g,t[153]=L,t[154]=tt):tt=t[154];let nt;return t[155]!==Ee||t[156]!==Te||t[157]!==h||t[158]!==$e||t[159]!==et||t[160]!==tt?(nt=(0,X.jsxs)(Ee,{open:h,onOpenChange:Te,children:[$e,et,tt]}),t[155]=Ee,t[156]=Te,t[157]=h,t[158]=$e,t[159]=et,t[160]=tt,t[161]=nt):nt=t[161],nt}function hZ(e){return e.stopPropagation()}function gZ(e){return e.stopPropagation()}function _Z(e){return e.stopPropagation()}function vZ(e){return e.stopPropagation()}function yZ(e){return e.preventDefault()}function bZ(e){return!(`hidden`in e&&e.hidden)&&e.type!==`reactnode`}var xZ=I.extend({addOptions(){return{...this.parent?.(),docName:``}},addNodeView(){return nu(mZ)}}),SZ={name:`InlineMath`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,category:`content`,description:`Inline math`,props:[{name:`formula`,type:`string`,required:!0,autoFocus:!0,description:`LaTeX inline math source`}]},CZ=(0,Q.lazy)(async()=>{let{default:e}=await n(async()=>{let{default:e}=await import(`./katex-zjckjCBG.js`);return{default:e}},[],import.meta.url);function t(t){let n=(0,Z.c)(4),r;n[0]===t.formula?r=n[1]:(r=e.renderToString(t.formula,{displayMode:!1,throwOnError:!1,strict:`ignore`,trust:!1}),n[0]=t.formula,n[1]=r);let i=r,a;return n[2]===i?a=n[3]:(a=(0,X.jsx)(`span`,{className:`math math-inline`,dangerouslySetInnerHTML:{__html:i}}),n[2]=i,n[3]=a),a}return{default:t}});function wZ(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(`span`,{className:`math math-inline math-placeholder math-placeholder-empty inline-flex items-center gap-1 rounded-sm border border-dashed border-muted-foreground/40 bg-muted/30 px-1.5 py-0.5 text-xs italic text-muted-foreground hover:bg-muted/60 cursor-pointer`,"data-component-type":`math-inline`,children:`f(x)`}),e[0]=t):t=e[0],t}function TZ(e){let t=(0,Z.c)(2),n;return t[0]===e.formula?n=t[1]:(n=(0,X.jsx)(`span`,{className:`math math-inline math-placeholder`,"data-component-type":`math-inline`,children:e.formula}),t[0]=e.formula,t[1]=n),n}function EZ(e){let t=(0,Z.c)(38),{node:n,selected:r,getPos:i,editor:a}=e,s=typeof n.attrs.formula==`string`?n.attrs.formula:``,c=typeof n.attrs.id==`string`?n.attrs.id:void 0,[l,u]=(0,Q.useState)(!1),d=(0,Q.useRef)(!1),f;t[0]!==a.state||t[1]!==i||t[2]!==r?(f=()=>{let e=r&&a.state.selection instanceof Nt;e&&!d.current?(RM(typeof i==`function`?i()??0:0),u(!0)):!e&&d.current&&u(!1),d.current=e},t[0]=a.state,t[1]=i,t[2]=r,t[3]=f):f=t[3];let p;t[4]!==a||t[5]!==i||t[6]!==r?(p=[r,i,a],t[4]=a,t[5]=i,t[6]=r,t[7]=p):p=t[7],(0,Q.useEffect)(f,p);let m=r?`math-inline-selected`:void 0,h;t[8]===c?h=t[9]:(h=c?{id:c}:{},t[8]=c,t[9]=h);let g;t[10]===s?g=t[11]:(g=s?(0,X.jsx)(mY,{resetKeys:[s],onError:OZ,fallbackRender:()=>(0,X.jsx)(`span`,{className:`math math-inline math-error`,children:s}),children:(0,X.jsx)(Q.Suspense,{fallback:(0,X.jsx)(TZ,{formula:s}),children:(0,X.jsx)(CZ,{formula:s})})}):(0,X.jsx)(wZ,{}),t[10]=s,t[11]=g);let _;t[12]!==s||t[13]!==h||t[14]!==g?(_=(0,X.jsx)(gc,{asChild:!0,children:(0,X.jsx)(`span`,{className:`math-inline-trigger`,"data-component-type":`math-inline`,"data-formula":s,...h,children:g})}),t[12]=s,t[13]=h,t[14]=g,t[15]=_):_=t[15];let v;t[16]===a.view?v=t[17]:(v=e=>{e.preventDefault(),a.view.focus()},t[16]=a.view,t[17]=v);let y;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,X.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground px-3 pt-2`,children:(0,X.jsx)(o,{id:`EOjU5V`})}),t[18]=y):y=t[18];let b;t[19]===s?b=t[20]:(b={formula:s},t[19]=s,t[20]=b);let x;t[21]!==a.state||t[22]!==a.view||t[23]!==i?(x=(e,t)=>{let n=typeof i==`function`?i():void 0;if(typeof n!=`number`)return;let r=a.state.doc.nodeAt(n);if(!r||r.type.name!==`mathInline`)return;let o=a.state.tr.setNodeMarkup(n,null,{...r.attrs,[e]:t??``});o.setSelection(Nt.create(o.doc,n)),a.view.dispatch(o)},t[21]=a.state,t[22]=a.view,t[23]=i,t[24]=x):x=t[24];let S;t[25]!==x||t[26]!==b?(S=(0,X.jsx)(_X,{descriptor:SZ,values:b,onChange:x}),t[25]=x,t[26]=b,t[27]=S):S=t[27];let C;t[28]!==S||t[29]!==v?(C=(0,X.jsxs)(_c,{className:`z-[60] w-72 p-0`,side:`bottom`,align:`start`,onOpenAutoFocus:DZ,onCloseAutoFocus:v,children:[y,S]}),t[28]=S,t[29]=v,t[30]=C):C=t[30];let w;t[31]!==l||t[32]!==C||t[33]!==_?(w=(0,X.jsxs)(hc,{open:l,onOpenChange:u,children:[_,C]}),t[31]=l,t[32]=C,t[33]=_,t[34]=w):w=t[34];let T;return t[35]!==w||t[36]!==m?(T=(0,X.jsx)(Jl,{as:`span`,className:m,children:w}),t[35]=w,t[36]=m,t[37]=T):T=t[37],T}function DZ(e){e.preventDefault()}function OZ(e,t){let n=e instanceof Error?e:Error(String(e));console.warn(JSON.stringify({event:`jsx-render-failure`,component:`mathInline`,rawComponentName:`mathInline`,error:String(n),stack:t.componentStack})),fe(`mathInline`)}var kZ=c.extend({addNodeView(){return nu(EZ)}});function AZ(e,t){if(!e.selection.empty)return null;let n=t===`up`||t===`left`?-1:1,r=e.selection.$head,i=n>0?r.after():r.before();if(typeof i!=`number`)return null;let a=zt.near(e.doc.resolve(i),n);return a.$head?.parent.type.name===`rawMdxFallback`?a:null}function jZ(e,t){let{state:n,view:r}=e;if(!r.endOfTextblock(t))return!1;let i=AZ(n,t);return i?(r.dispatch(n.tr.setSelection(i)),!0):!1}var MZ=yt.extend({addKeyboardShortcuts(){return{ArrowLeft:({editor:e})=>jZ(e,`left`),ArrowRight:({editor:e})=>jZ(e,`right`),ArrowUp:({editor:e})=>jZ(e,`up`),ArrowDown:({editor:e})=>jZ(e,`down`)}},addNodeView(){return nu(uK,{stopEvent:()=>!0,ignoreMutation:()=>!0})}});function NZ(e){let t=(0,Z.c)(51),{items:n,selectedIndex:r,categoryLabels:i,onSelect:a,onHoverIndex:c}=e,l=(0,Q.useRef)(null),u=(0,Q.useId)(),{_:d}=s(),f=r>=0&&r<n.length?`${u}-option-${r}`:void 0,p=FZ,m,h;if(t[0]===r?(m=t[1],h=t[2]):(m=()=>{let e=l.current;if(!e)return;let t=e.querySelectorAll(`[role="option"]`).item(r);t&&t.scrollIntoView({block:`nearest`})},h=[r],t[0]=r,t[1]=m,t[2]=h),(0,Q.useEffect)(m,h),n.length===0){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e={maxHeight:`var(--suggestion-menu-max-height, 40vh)`},t[3]=e):e=t[3];let n;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,X.jsx)(`div`,{ref:l,role:`status`,"aria-live":`polite`,className:`w-56 rounded-lg border bg-popover p-2 shadow-md text-sm text-muted-foreground`,style:e,onMouseDown:p,children:(0,X.jsx)(o,{id:`Ev2r9A`})}),t[4]=n):n=t[4],n}let g,_,v,y,b,x,S,C,w,T,E,D,O;if(t[5]!==d||t[6]!==f||t[7]!==i||t[8]!==n||t[9]!==u||t[10]!==c||t[11]!==a||t[12]!==r){let e=[],o=0,s=new Map;for(let t of n){s.set(t,o++);let n=e.find(e=>e.key===t.category);n?n.items.push(t):e.push({key:t.category,items:[t]})}_=r>=0&&r<n.length?n[r]:null;let m;t[26]===n?m=t[27]:(m=n.some(PZ),t[26]=n,t[27]=m),g=m,x=`flex items-start gap-2`,S=l,C=`listbox`,t[28]===d?w=t[29]:(w=d({id:`RlCInP`}),t[28]=d,t[29]=w),T=f,E=-1,D=p,O=`w-56 overflow-y-auto subtle-scrollbar rounded-lg border bg-popover p-1 shadow-md`,t[30]===Symbol.for(`react.memo_cache_sentinel`)?(v={maxHeight:`var(--suggestion-menu-max-height, 40vh)`},t[30]=v):v=t[30];let h=_?`${_.label}${_.preview?`. ${_.preview.description}`:``}`:``;t[31]===h?y=t[32]:(y=(0,X.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,"aria-atomic":`true`,children:h}),t[31]=h,t[32]=y),b=e.map(e=>(0,X.jsxs)(`div`,{role:`group`,"aria-labelledby":`${u}-group-${e.key}`,children:[(0,X.jsx)(`div`,{id:`${u}-group-${e.key}`,className:`px-2 py-1.5 text-xs font-semibold text-muted-foreground`,children:i[e.key]??e.key}),e.items.map(e=>{let t=s.get(e)??0,n=t===r,i=e.icon;return(0,X.jsxs)(`button`,{id:`${u}-option-${t}`,type:`button`,role:`option`,"aria-selected":n,"data-selected":n,className:`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm text-left ${n?`bg-accent text-accent-foreground`:``}`,onMouseEnter:()=>c?.(t),onMouseDown:t=>{t.preventDefault(),a(e)},children:[(0,X.jsx)(i,{className:`size-4 shrink-0 text-muted-foreground`}),(0,X.jsx)(`div`,{className:`flex flex-col min-w-0`,children:(0,X.jsx)(`span`,{className:`truncate`,children:e.label})})]},e.name)})]},e.key)),t[5]=d,t[6]=f,t[7]=i,t[8]=n,t[9]=u,t[10]=c,t[11]=a,t[12]=r,t[13]=g,t[14]=_,t[15]=v,t[16]=y,t[17]=b,t[18]=x,t[19]=S,t[20]=C,t[21]=w,t[22]=T,t[23]=E,t[24]=D,t[25]=O}else g=t[13],_=t[14],v=t[15],y=t[16],b=t[17],x=t[18],S=t[19],C=t[20],w=t[21],T=t[22],E=t[23],D=t[24],O=t[25];let k;t[33]!==v||t[34]!==y||t[35]!==b||t[36]!==S||t[37]!==C||t[38]!==w||t[39]!==T||t[40]!==E||t[41]!==D||t[42]!==O?(k=(0,X.jsxs)(`div`,{ref:S,role:C,"aria-label":w,"aria-activedescendant":T,tabIndex:E,onMouseDown:D,className:O,style:v,children:[y,b]}),t[33]=v,t[34]=y,t[35]=b,t[36]=S,t[37]=C,t[38]=w,t[39]=T,t[40]=E,t[41]=D,t[42]=O,t[43]=k):k=t[43];let A;t[44]!==g||t[45]!==_?(A=g?(0,X.jsx)(`aside`,{"aria-hidden":`true`,onMouseDown:p,className:`w-64 rounded-lg border bg-popover p-2 shadow-md ${_?.preview?``:`invisible`}`,children:_?.preview?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`mb-2 flex aspect-5/3 items-center justify-center overflow-hidden rounded-md bg-muted/40 p-3 *:max-h-full *:max-w-full [&_img]:size-full [&_img]:rounded-md [&_img]:object-contain`,children:_.preview.render()}),(0,X.jsx)(`p`,{className:`px-1 pb-1 text-xs text-muted-foreground`,children:_.preview.description})]}):null}):null,t[44]=g,t[45]=_,t[46]=A):A=t[46];let j;return t[47]!==x||t[48]!==k||t[49]!==A?(j=(0,X.jsxs)(`div`,{className:x,children:[k,A]}),t[47]=x,t[48]=k,t[49]=A,t[50]=j):j=t[50],j}function PZ(e){return e.preview}function FZ(e){return e.preventDefault()}var IZ=new q(`slashCommand`),LZ=F.create({name:`slashCommand`,addOptions(){return{itemsSources:[QM],categoryLabels:{basic:`Basic blocks`,insert:`Insert`}}},addProseMirrorPlugins(){let e=this;return[qy({editor:this.editor,pluginKey:IZ,char:`/`,startOfLine:!1,allow:({editor:e})=>!eb(e),items:({query:t})=>{let n=e.options.itemsSources.flatMap(e=>{try{return e()}catch(e){return console.error(`[slash-command] item source threw an error`,e),[]}}),r=Object.keys(e.options.categoryLabels),i=e=>{let t=r.indexOf(e);return t===-1?1/0:t};return $M(n.map((e,t)=>({item:e,i:t})).sort((e,t)=>{let n=i(e.item.category)-i(t.item.category);return n===0?e.i-t.i:n}).map(e=>e.item),t)},command:({editor:e,range:t,props:n})=>{try{e.chain().focus().deleteRange(t).run()}catch(e){console.error(`[slash-command] deleteRange failed for "${n.name}"`,e);return}try{n.command(e)}catch(e){console.error(`[slash-command] command "${n.name}" threw an error`,e)}},render:()=>{let t=null,n=null,r=0,i={popup:null,stopAutoUpdate:null},a=null,o=e=>{e!==r&&(r=e,s())},s=()=>{!t||!n||t.updateProps({items:n.items,selectedIndex:r,categoryLabels:e.options.categoryLabels,onSelect:n.command,onHoverIndex:o})};return{onStart(s){n=s,r=0;let c=tb(()=>n,`slash-command`);i.popup=c.popup,a=c.doPosition,t=new eu(NZ,{props:{items:s.items,selectedIndex:r,categoryLabels:e.options.categoryLabels,onSelect:s.command,onHoverIndex:o},editor:s.editor}),c.popup.appendChild(t.element),i.stopAutoUpdate=c.startAutoUpdate(),c.reveal()},onUpdate(e){n=e,r=Math.min(r,Math.max(0,e.items.length-1)),s(),a?.()},onKeyDown({event:e}){if(!n||n.items.length===0)return!1;let t=n.items;if(e.key===`ArrowDown`)return r=(r+1)%t.length,s(),!0;if(e.key===`ArrowUp`)return r=(r-1+t.length)%t.length,s(),!0;if(e.key===`Enter`||e.key===`Tab`){let e=t[r];return e&&n.command(e),!0}return e.key,!1},onExit(){nb(i),a=null,t?.destroy(),t=null,n=null,r=0}}}})]}}),RZ=new q(`sourceDirty`),zZ=F.create({name:`sourceDirtyObserver`,addProseMirrorPlugins(){return[new Ht({key:RZ,appendTransaction(e,t,n){if(!e.some(e=>!e.getMeta(Hv))||!e.some(e=>e.docChanged))return null;let r=new It;for(let t of e)r.appendMapping(t.mapping);let i=r.invert(),a=[];if(n.doc.descendants((e,n)=>{if(e.type.name!==`jsxComponent`||e.attrs.sourceDirty)return;let r=i.map(n),o=t.doc.nodeAt(r),s=!o||o.type.name!==`jsxComponent`,c=typeof e.attrs.sourceRaw==`string`&&e.attrs.sourceRaw.length>0;if(s&&c)return;if(!o){(e.content.size>0||Object.keys(e.attrs.props??{}).length>0)&&a.push({pos:n});return}if(o.type.name!==`jsxComponent`){a.push({pos:n});return}let l=!BZ(o.attrs.props,e.attrs.props),u=!o.content.eq(e.content);(l||u)&&a.push({pos:n})}),a.length===0)return null;let o=n.tr;for(let{pos:e}of a)o.setNodeAttribute(e,`sourceDirty`,!0);return o}})]}});function BZ(e,t){if(Object.is(e,t))return!0;if(e==null||t==null||typeof e!=typeof t||typeof e!=`object`)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!BZ(e[n],t[n]))return!1;return!0}let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!BZ(e[r],t[r]))return!1;return!0}var VZ=F.create({name:`tabFocusTrap`,priority:1,addKeyboardShortcuts(){return{Tab:()=>!0,"Shift-Tab":()=>!0}}});function HZ(e,t){let n=e.doc.nodeAt(t);if(!n||n.type.name!==`table`)return null;let r=pe.get(n);return{map:r,tableStart:t+1,table:n,left:0,top:0,right:r.width,bottom:r.height}}function UZ(e,t){let n=HZ(e,t);return n?ye(e.tr,n,n.map.width):null}function WZ(e,t){let n=HZ(e,t);return n?D(e.tr,n,n.map.height):null}function GZ(e,t){if(!e.dom.contains(t))return null;let n;try{n=e.posAtDOM(t,0)}catch{return null}return n<0?null:L(e.state.doc.resolve(n))?.pos??null}var KZ=`<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12h14"/><path d="M12 5v14"/></svg>`;function qZ(e,t){let n=document.createElement(`button`);return n.type=`button`,n.className=`ok-table-insert-bar ok-table-insert-${e}`,n.setAttribute(`aria-label`,t),n.tabIndex=-1,n.setAttribute(MF,`true`),n.innerHTML=KZ,n.addEventListener(`mousedown`,e=>{e.preventDefault(),e.stopPropagation()}),n}var JZ=class{overlays=new Map;mount;lastEditable;constructor(e,t){this.view=e,this.editor=t,this.mount=e.dom.parentElement??e.dom,this.lastEditable=t.isEditable,this.reconcile()}update(e,t){let n=this.editor.isEditable!==this.lastEditable;this.lastEditable=this.editor.isEditable,!(!n&&t.doc.eq(this.view.state.doc))&&this.reconcile()}destroy(){for(let e of this.overlays.keys())this.removeOverlay(e)}reconcile(){if(!this.editor.isEditable){this.destroy();return}let e=new Set(this.view.dom.querySelectorAll(`.tableWrapper`));for(let t of this.overlays.keys())e.has(t)||this.removeOverlay(t);for(let t of e)this.overlays.has(t)||this.addOverlay(t)}addOverlay(e){let t=document.createElement(`div`);t.className=`ok-table-insert-controls`,t.setAttribute(MF,`true`);let n=qZ(`column`,`Add column`),r=qZ(`row`,`Add row`);n.addEventListener(`click`,()=>this.insert(e,UZ)),r.addEventListener(`click`,()=>this.insert(e,WZ)),t.append(n,r),this.mount.appendChild(t);let i=wr(e,t,()=>{let{width:t,height:i}=e.getBoundingClientRect();Or(e,n,{strategy:`absolute`,placement:`right-start`}).then(({x:e,y:t})=>{n.style.left=`${e}px`,n.style.top=`${t}px`,n.style.height=`${i}px`}).catch(()=>{}),Or(e,r,{strategy:`absolute`,placement:`bottom-start`}).then(({x:e,y:n})=>{r.style.left=`${e}px`,r.style.top=`${n}px`,r.style.width=`${t}px`}).catch(()=>{})}),a=e=>{let t=e.target instanceof Element?e.target.closest(`td, th`):null,i=t?.parentElement;n.classList.toggle(`is-active`,!!t&&t===i?.lastElementChild),r.classList.toggle(`is-active`,!!i&&i===i.parentElement?.lastElementChild)},o=()=>{n.classList.remove(`is-active`),r.classList.remove(`is-active`)};e.addEventListener(`pointerover`,a),e.addEventListener(`pointerleave`,o),this.overlays.set(e,{container:t,cleanup:()=>{i(),e.removeEventListener(`pointerover`,a),e.removeEventListener(`pointerleave`,o),t.remove()}})}removeOverlay(e){let t=this.overlays.get(e);t&&(t.cleanup(),this.overlays.delete(e))}insert(e,t){let n=e.querySelector(`table`);if(!n)return;let r=GZ(this.view,n);if(r===null)return;let i=t(this.view.state,r);i&&(this.view.dispatch(i),this.view.focus())}},YZ=F.create({name:`tableInsertControls`,addProseMirrorPlugins(){let e=this.editor;return[new Ht({key:new q(`tableInsertControls`),view:t=>new JZ(t,e)})]}}),XZ=`ok:tag-click`;function ZZ(e){if(typeof document>`u`)return;let t={value:e};document.dispatchEvent(new CustomEvent(XZ,{detail:t}))}function QZ(e){return e instanceof Element?e.closest(`a[data-tag]`):null}var $Z=F.create({name:`tagClick`,addProseMirrorPlugins(){return[new Ht({props:{handleDOMEvents:{click(e,t){let n=QZ(t.target);if(!n)return!1;let r=n.getAttribute(`data-tag`);return r?(t.preventDefault(),t.stopPropagation(),ZZ(r),!0):!1}}}})]}});function eQ(e,t,n){if(typeof t!=`number`||!n||!_e.test(n))return!1;let{state:r,view:i}=e,a=r.doc.nodeAt(t);if(!a||a.type.name!==`tag`)return!1;let o=r.tr.setNodeMarkup(t,null,{...a.attrs,value:n}),s=t+a.nodeSize;return o.insertText(` `,s),o.setSelection(p.create(o.doc,s+1)),i.dispatch(o),i.focus(),!0}function tQ(e,t){if(typeof t!=`number`)return;let{state:n,view:r}=e,i=n.doc.nodeAt(t);if(!i||i.type.name!==`tag`)return;let a=n.tr.delete(t,t+i.nodeSize);r.dispatch(a),r.focus()}function nQ(e){let t=(0,Z.c)(3),{value:n}=e,r=`#tag/${n}`,i;return t[0]!==r||t[1]!==n?(i=(0,X.jsxs)(`a`,{className:`tag`,"data-tag":n,href:r,children:[`#`,n]}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function rQ(e){let t=(0,Z.c)(20),{initialDraft:n,onCommit:r,onCancel:i}=e,{_:a}=s(),o=(0,Q.useRef)(null),[c,l]=(0,Q.useState)(n),u=(0,Q.useRef)(!1),d,f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>{let e=requestAnimationFrame(()=>{o.current?.focus()});return()=>cancelAnimationFrame(e)},f=[],t[0]=d,t[1]=f):(d=t[0],f=t[1]),(0,Q.useEffect)(d,f);let p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`font-mono`,children:`#`}),t[2]=p):p=t[2];let m=Math.max(c.length,8),h;t[3]===a?h=t[4]:(h=a({id:`U2pMtf`}),t[3]=a,t[4]=h);let g;t[5]===a?g=t[6]:(g=a({id:`knjOzA`}),t[5]=a,t[6]=g);let _;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>{let t=e.target.value;(t===``||_e.test(t))&&l(t)},t[7]=_):_=t[7];let v,y;t[8]!==c||t[9]!==i||t[10]!==r?(v=e=>{e.key===`Enter`||e.key===` `?(e.preventDefault(),u.current=!0,r(c)||(u.current=!1,i())):(e.key===`Escape`||e.key===`Backspace`&&c===``)&&(e.preventDefault(),i())},y=()=>{if(!u.current){if(c===``){i();return}_e.test(c)?r(c):i()}},t[8]=c,t[9]=i,t[10]=r,t[11]=v,t[12]=y):(v=t[11],y=t[12]);let b;return t[13]!==c||t[14]!==m||t[15]!==h||t[16]!==g||t[17]!==v||t[18]!==y?(b=(0,X.jsxs)(`span`,{className:`tag tag-placeholder inline-flex items-center rounded-sm border border-dashed border-muted-foreground/40 bg-muted/30 px-1.5 py-0.5 text-xs text-muted-foreground`,"data-component-type":`tag-placeholder`,children:[p,(0,X.jsx)(`input`,{ref:o,type:`text`,value:c,size:m,placeholder:h,"aria-label":g,spellCheck:!1,autoCorrect:`off`,autoCapitalize:`off`,className:`bg-transparent border-0 p-0 outline-none focus:outline-none focus:ring-0 text-inherit font-inherit`,onChange:_,onKeyDown:v,onBlur:y})]}),t[13]=c,t[14]=m,t[15]=h,t[16]=g,t[17]=v,t[18]=y,t[19]=b):b=t[19],b}function iQ(e){let t=(0,Z.c)(5),{node:n,getPos:r,editor:i}=e,a=typeof n.attrs.value==`string`?n.attrs.value:``;if(a===``){let e;return t[0]!==i||t[1]!==r?(e=(0,X.jsx)(Jl,{as:`span`,children:(0,X.jsx)(rQ,{initialDraft:``,onCommit:e=>eQ(i,typeof r==`function`?r():void 0,e),onCancel:()=>tQ(i,typeof r==`function`?r():void 0)})}),t[0]=i,t[1]=r,t[2]=e):e=t[2],e}let o;return t[3]===a?o=t[4]:(o=(0,X.jsx)(Jl,{as:`span`,children:(0,X.jsx)(nQ,{value:a})}),t[3]=a,t[4]=o),o}var aQ=it.extend({priority:200,addNodeView(){return nu(iQ)},addKeyboardShortcuts(){return{Backspace:()=>{if(rb.getState(this.editor.state)?.active)return!1;let{selection:e}=this.editor.state;if(!e.empty)return!1;let t=e.$from.nodeBefore;if(t?.type.name===`tag`){let{state:n,view:r}=this.editor;return r.dispatch(n.tr.delete(e.from-t.nodeSize,e.from)),!0}return!1},Delete:()=>{if(rb.getState(this.editor.state)?.active)return!1;let{selection:e}=this.editor.state;if(!e.empty)return!1;let t=e.$from.nodeAfter;if(t?.type.name===`tag`){let{state:n,view:r}=this.editor;return r.dispatch(n.tr.delete(e.from,e.from+t.nodeSize)),!0}return!1}}},addProseMirrorPlugins(){return[ub(this.editor)]}}),oQ=2048,sQ=24;function cQ(e){if(typeof e!=`string`)return{kind:`unsupported`,value:``};let t=e.trim();if(t===``||t.length>oQ)return{kind:`unsupported`,value:``};if(dQ(t))return{kind:`emoji`,value:t};let n=fQ(t);return n===`url`?{kind:`url`,value:t}:n===`path`?{kind:`path`,value:d(`/api/asset?path=${encodeURIComponent(uQ(t))}`)}:{kind:`unsupported`,value:``}}function lQ(e){if(typeof e!=`string`)return{kind:`unsupported`,value:``};let t=e.trim();if(t===``||t.length>oQ)return{kind:`unsupported`,value:``};let n=fQ(t);return n===`url`?{kind:`url`,value:t}:n===`path`?{kind:`path`,value:d(`/api/asset?path=${encodeURIComponent(uQ(t))}`)}:{kind:`unsupported`,value:``}}function uQ(e){return e.startsWith(`/`)?e.slice(1):e}function dQ(e){if(/\p{L}/u.test(e)||e.includes(`/`))return!1;let t=0;for(let n of e)t++;if(t>sQ)return!1;let n=e.lastIndexOf(`.`);if(n>-1){let t=e.slice(n+1).toLowerCase();if(de.has(t))return!1}return!0}function fQ(e){let t=pQ(e);if(!t||!de.has(t))return`unsupported`;let n=e.indexOf(`:`),r=e.indexOf(`/`);return n>-1&&(r===-1||n<r)?Ot(e)?`url`:`unsupported`:e.startsWith(`//`)||e.includes(`?`)||e.includes(`#`)||e.startsWith(`../`)||e.includes(`/../`)?`unsupported`:`path`}function pQ(e){let t=e.lastIndexOf(`/`),n=t>-1?e.slice(t+1):e,r=n.search(/[?#]/),i=r>-1?n.slice(0,r):n,a=i.lastIndexOf(`.`);return a<=0||a===i.length-1?null:i.slice(a+1).toLowerCase()}function mQ(e){let t=(0,Z.c)(133),{open:n,target:r,alias:i,anchor:a,pages:c,assetPaths:l,filePaths:u,loading:d,onOpenChange:f,onSave:p}=e,[m,h]=(0,Q.useState)(r),[g,_]=(0,Q.useState)(i??``),[v,y]=(0,Q.useState)(a??``),b=(0,Q.useId)(),x=(0,Q.useId)(),S=(0,Q.useId)(),C=(0,Q.useId)(),{_:w}=s(),T;t[0]!==l||t[1]!==m||t[2]!==u?(T=AO(m,l,u),t[0]=l,t[1]=m,t[2]=u,t[3]=T):T=t[3];let E=T,D;t[4]!==l||t[5]!==m||t[6]!==u||t[7]!==c?(D=jO(m,c,l,u),t[4]=l,t[5]=m,t[6]=u,t[7]=c,t[8]=D):D=t[8];let O=nY(m,D&&!E&&n),k=(0,Q.useRef)(!1),A,j;t[9]!==i||t[10]!==a||t[11]!==n||t[12]!==r?(A=()=>{if(!n){k.current=!1;return}k.current||(k.current=!0,h(r),_(i??``),y(a??``))},j=[n,r,i,a],t[9]=i,t[10]=a,t[11]=n,t[12]=r,t[13]=A,t[14]=j):(A=t[13],j=t[14]),(0,Q.useEffect)(A,j);let M;t[15]!==g||t[16]!==v||t[17]!==m||t[18]!==f||t[19]!==p?(M=function(){let e=m.trim();e&&(p(e,g.trim()||null,v.trim()||null),f(!1))},t[15]=g,t[16]=v,t[17]=m,t[18]=f,t[19]=p,t[20]=M):M=t[20];let N=M,P;t[21]===N?P=t[22]:(P=function(e){e.key===`Enter`&&(e.preventDefault(),N())},t[21]=N,t[22]=P);let F=P,I;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(I=function(e){h(e.path),y(``)},t[23]=I):I=t[23];let L=I,R,z,B,V,H,ee,U,W,te,G,ne,re,ie,ae,oe,se,K;if(t[24]!==w||t[25]!==S||t[26]!==x||t[27]!==l||t[28]!==g||t[29]!==v||t[30]!==m||t[31]!==F||t[32]!==C||t[33]!==O||t[34]!==d||t[35]!==f||t[36]!==n||t[37]!==c||t[38]!==b){let e=new Map,r=O?.map(t=>{let n=e.get(t.slug)??0;e.set(t.slug,n+1);let r=n===0?t.slug:`${t.slug}-${n}`;return{...t,reactKey:r}}),i=!!r?.length;B=_n,ae=n,oe=f,z=ln,W=`sm:max-w-xl`,te=``,G=RJ,ne=RJ,re=RJ;let a;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(rn,{children:(0,X.jsx)(o,{id:`xzktOa`})}),t[56]=a):a=t[56],t[57]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,X.jsxs)(gn,{children:[a,(0,X.jsx)(nn,{children:(0,X.jsx)(o,{id:`Jhj_lh`})})]}),t[57]=ie):ie=t[57],R=fn,H=`space-y-6`;let s;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsx)(o,{id:`lGs_bQ`,components:{0:(0,X.jsx)(`span`,{className:`text-red-500`})}}),t[58]=s):s=t[58];let u;t[59]===b?u=t[60]:(u=(0,X.jsx)(`label`,{className:`mb-1.5 block text-sm font-medium`,htmlFor:b,children:s}),t[59]=b,t[60]=u);let p;t[61]===w?p=t[62]:(p=w({id:`aM23Wr`}),t[61]=w,t[62]=p);let T;t[63]!==l||t[64]!==m||t[65]!==F||t[66]!==d||t[67]!==c||t[68]!==p||t[69]!==b?(T=(0,X.jsx)(VJ,{id:b,value:m,pages:c,assetPaths:l,includeAssets:!0,loading:d,onValueChange:h,onSuggestionSelect:L,placeholder:p,autoFocus:!0,"aria-required":`true`,onKeyDown:F}),t[63]=l,t[64]=m,t[65]=F,t[66]=d,t[67]=c,t[68]=p,t[69]=b,t[70]=T):T=t[70],t[71]!==u||t[72]!==T?(ee=(0,X.jsxs)(`div`,{children:[u,T]}),t[71]=u,t[72]=T,t[73]=ee):ee=t[73];let E;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,X.jsx)(o,{id:`OTF92M`,components:{0:(0,X.jsx)(`span`,{className:`font-normal text-muted-foreground`})}}),t[74]=E):E=t[74];let D;t[75]===S?D=t[76]:(D=(0,X.jsx)(`label`,{className:`mb-1.5 block text-sm font-medium`,htmlFor:S,children:E}),t[75]=S,t[76]=D);let k;t[77]===Symbol.for(`react.memo_cache_sentinel`)?(k=e=>_(e.target.value),t[77]=k):k=t[77];let A;t[78]===w?A=t[79]:(A=w({id:`BH56dn`}),t[78]=w,t[79]=A);let j;t[80]!==S||t[81]!==g||t[82]!==F||t[83]!==A?(j=(0,X.jsx)(Ir,{id:S,value:g,onChange:k,placeholder:A,onKeyDown:F}),t[80]=S,t[81]=g,t[82]=F,t[83]=A,t[84]=j):j=t[84],t[85]!==D||t[86]!==j?(U=(0,X.jsxs)(`div`,{children:[D,j]}),t[85]=D,t[86]=j,t[87]=U):U=t[87];let M;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,X.jsx)(o,{id:`Tjc1pH`,components:{0:(0,X.jsx)(`span`,{className:`font-normal text-muted-foreground`})}}),t[88]=M):M=t[88],t[89]===x?se=t[90]:(se=(0,X.jsx)(`label`,{className:`mb-1.5 block text-sm font-medium`,htmlFor:x,children:M}),t[89]=x,t[90]=se);let N;t[91]===Symbol.for(`react.memo_cache_sentinel`)?(N=e=>y(e.target.value),t[91]=N):N=t[91];let P;t[92]===w?P=t[93]:(P=w({id:`W-ntoW`}),t[92]=w,t[93]=P),t[94]!==x||t[95]!==v||t[96]!==F||t[97]!==P?(K=(0,X.jsx)(Ir,{id:x,value:v,onChange:N,placeholder:P,onKeyDown:F}),t[94]=x,t[95]=v,t[96]=F,t[97]=P,t[98]=K):K=t[98],V=i&&(0,X.jsx)(`div`,{id:C,className:`mt-1.5 max-h-36 overflow-y-auto subtle-scrollbar rounded-md border border-border bg-muted/30`,children:r.map(e=>(0,X.jsxs)(`button`,{type:`button`,"aria-pressed":v===e.slug,className:Xt(`flex w-full items-center gap-2 px-2 py-1 text-left text-sm hover:bg-accent hover:text-accent-foreground`,v===e.slug&&`bg-accent text-accent-foreground`),style:{paddingLeft:`${(e.level-1)*12+8}px`},onClick:()=>y(v===e.slug?``:e.slug),children:[(0,X.jsxs)(`span`,{className:`w-7 shrink-0 font-mono text-[10px] text-muted-foreground`,children:[`H`,e.level]}),(0,X.jsx)(`span`,{className:`truncate`,children:e.text})]},e.reactKey))}),t[24]=w,t[25]=S,t[26]=x,t[27]=l,t[28]=g,t[29]=v,t[30]=m,t[31]=F,t[32]=C,t[33]=O,t[34]=d,t[35]=f,t[36]=n,t[37]=c,t[38]=b,t[39]=R,t[40]=z,t[41]=B,t[42]=V,t[43]=H,t[44]=ee,t[45]=U,t[46]=W,t[47]=te,t[48]=G,t[49]=ne,t[50]=re,t[51]=ie,t[52]=ae,t[53]=oe,t[54]=se,t[55]=K}else R=t[39],z=t[40],B=t[41],V=t[42],H=t[43],ee=t[44],U=t[45],W=t[46],te=t[47],G=t[48],ne=t[49],re=t[50],ie=t[51],ae=t[52],oe=t[53],se=t[54],K=t[55];let ce;t[99]!==V||t[100]!==se||t[101]!==K?(ce=(0,X.jsxs)(`div`,{children:[se,K,V]}),t[99]=V,t[100]=se,t[101]=K,t[102]=ce):ce=t[102];let le;t[103]!==H||t[104]!==ee||t[105]!==U||t[106]!==ce?(le=(0,X.jsxs)(`div`,{className:H,children:[ee,U,ce]}),t[103]=H,t[104]=ee,t[105]=U,t[106]=ce,t[107]=le):le=t[107];let ue;t[108]!==R||t[109]!==le?(ue=(0,X.jsx)(R,{children:le}),t[108]=R,t[109]=le,t[110]=ue):ue=t[110];let de;t[111]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,X.jsx)(hn,{asChild:!0,children:(0,X.jsx)(en,{variant:`outline`,children:(0,X.jsx)(o,{id:`dEgA5A`})})}),t[111]=de):de=t[111];let fe;t[112]===m?fe=t[113]:(fe=m.trim(),t[112]=m,t[113]=fe);let pe=!fe,me;t[114]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,X.jsx)(o,{id:`tfDRzk`}),t[114]=me):me=t[114];let he;t[115]!==N||t[116]!==pe?(he=(0,X.jsxs)(pn,{children:[de,(0,X.jsx)(en,{onClick:N,disabled:pe,children:me})]}),t[115]=N,t[116]=pe,t[117]=he):he=t[117];let ge;t[118]!==z||t[119]!==W||t[120]!==te||t[121]!==G||t[122]!==ne||t[123]!==re||t[124]!==ie||t[125]!==ue||t[126]!==he?(ge=(0,X.jsxs)(z,{className:W,"data-ok-layer-spawned":te,onPointerDownOutside:G,onFocusOutside:ne,onInteractOutside:re,children:[ie,ue,he]}),t[118]=z,t[119]=W,t[120]=te,t[121]=G,t[122]=ne,t[123]=re,t[124]=ie,t[125]=ue,t[126]=he,t[127]=ge):ge=t[127];let _e;return t[128]!==B||t[129]!==ae||t[130]!==oe||t[131]!==ge?(_e=(0,X.jsx)(B,{open:ae,onOpenChange:oe,children:ge}),t[128]=B,t[129]=ae,t[130]=oe,t[131]=ge,t[132]=_e):_e=t[132],_e}function hQ(e){let t=(0,Z.c)(116),{editor:n,getPos:r,onClose:i,onNavigate:a}=e,c=r(),l=c==null?null:n.state.doc.nodeAt(c),u=String(l?.attrs.target??``),d=qe(l?.attrs.alias),f=qe(l?.attrs.anchor),p=nt({target:u,alias:d,anchor:f}),{addPage:m,assetPaths:h,filePaths:g,folderPaths:_,pages:v,pagesBySlug:y,pagesByBasename:b,loading:x}=Mn(),S=Ue(u,f),C=S?.kind===`external`?S:null,w=S?.kind===`asset`?AO(S.url,h,g)??S.url.replace(/^\//,``):null,T=w?null:pW(u,{pages:v,folderPaths:_,pagesBySlug:y,pagesByBasename:b,fallbackTargets:EO(u)}),[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(!1),{_:A}=s();if(!l)return null;let j;t[0]!==n.state||t[1]!==n.view||t[2]!==r?(j=function(e,t,i){let a=r();a!=null&&n.view.dispatch(n.state.tr.setNodeMarkup(a,void 0,{...n.state.doc.nodeAt(a)?.attrs,target:e,alias:t,anchor:i}))},t[0]=n.state,t[1]=n.view,t[2]=r,t[3]=j):j=t[3];let M=j,N;t[4]!==n.state||t[5]!==n.view||t[6]!==r||t[7]!==i?(N=function(){let e=r();if(e==null)return;let t=n.state.doc.nodeAt(e);t&&(n.view.dispatch(n.state.tr.delete(e,e+t.nodeSize)),i())},t[4]=n.state,t[5]=n.view,t[6]=r,t[7]=i,t[8]=N):N=t[8];let P=N,F=function(e){if(e!==u){let t=r();if(t==null)return;n.view.dispatch(n.state.tr.setNodeMarkup(t,void 0,{...n.state.doc.nodeAt(t)?.attrs,target:e,alias:d??p}))}},I=function(){return T?.kind===`create`?{initialDir:T.initialDir,suggestedName:T.suggestedName}:null},L=async function(){let e=I();if(!(!e||O)){k(!0);try{await EJ(e,{addPage:m,onCreated(e){F(e),window.location.hash=`#/${e}`,i()}}),k(!1)}catch(e){let t=e;Qn.error(t instanceof Error?t.message:A({id:`tfi40B`})),k(!1)}}},R=!C&&!x&&w!==null,z=!C&&!x&&T?.kind===`navigate`&&T.displayState===`resolved`,B=!C&&!x&&T?.kind===`navigate`&&T.displayState===`folder`,V=!C&&!x&&!w&&T?.kind===`create`,H=!!C,ee=C?CW(C.url)?C.url:null:R&&w?Cn(w):z&&T?.kind===`navigate`?EW({docName:T.hashDocName,anchor:f}):null,U=!x&&ee!==null&&(H||R||z),W,te,G,ne,re;if(t[9]!==A||t[10]!==d||t[11]!==f||t[12]!==w||t[13]!==n.state||t[14]!==n.view||t[15]!==C||t[16]!==r||t[17]!==R||t[18]!==B||t[19]!==z||t[20]!==V||t[21]!==x||t[22]!==u){if(x){let e;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(zn,{className:`size-3.5 shrink-0 animate-spin`,"aria-hidden":`true`}),t[28]=e):e=t[28],G={icon:e,text:A({id:`yQE2r9`}),className:`text-muted-foreground/80`}}else if(C){let e;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(wn,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),t[29]=e):e=t[29],G={icon:e,text:A({id:`hpDtUm`}),className:`text-muted-foreground`}}else if(R){let e;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(ea,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),t[30]=e):e=t[30],G={icon:e,text:A({id:`bUUVED`}),className:`text-muted-foreground`}}else if(B){let e;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(Bn,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),t[31]=e):e=t[31],G={icon:e,text:A({id:`kNqMMd`}),className:`text-muted-foreground`}}else if(V){let e;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(Wi,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),t[32]=e):e=t[32],G={icon:e,text:A({id:`8F1i42`}),className:`text-red-700 dark:text-red-300`}}else if(z){let e;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(ia,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),t[33]=e):e=t[33],G={icon:e,text:A({id:`Hrz9NY`}),className:`text-muted-foreground`}}else{let e;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(Wi,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),t[34]=e):e=t[34],G={icon:e,text:A({id:`DeDYLr`}),className:`text-muted-foreground/80`}}let e;t[35]!==n.state||t[36]!==n.view||t[37]!==r?(e=()=>{let e=r();if(typeof e!=`number`)return new DOMRect;let t=n.state.doc.nodeAt(e);if(!t)return new DOMRect;try{return At(n.view,e,e+t.nodeSize)}catch{return new DOMRect}},t[35]=n.state,t[36]=n.view,t[37]=r,t[38]=e):e=t[38];let i;t[39]!==n.view.dom||t[40]!==e?(i={getBoundingClientRect:e,contextElement:n.view.dom},t[39]=n.view.dom,t[40]=e,t[41]=i):i=t[41],re=i,te=w??(C?C.url:`${u}${f?`#${f}`:``}`);let a=f?`${u}#${f}`:u;W=d?`[[${a}|${d}]]`:`[[${a}]]`,ne=Xt(`flex shrink-0`,G.className),t[9]=A,t[10]=d,t[11]=f,t[12]=w,t[13]=n.state,t[14]=n.view,t[15]=C,t[16]=r,t[17]=R,t[18]=B,t[19]=z,t[20]=V,t[21]=x,t[22]=u,t[23]=W,t[24]=te,t[25]=G,t[26]=ne,t[27]=re}else W=t[23],te=t[24],G=t[25],ne=t[26],re=t[27];let ie;t[42]!==G.icon||t[43]!==ne?(ie=(0,X.jsx)(`span`,{className:ne,children:G.icon}),t[42]=G.icon,t[43]=ne,t[44]=ie):ie=t[44];let ae=ie,oe;t[45]!==ae||t[46]!==V||t[47]!==G.text?(oe=V?(0,X.jsxs)(xr,{children:[(0,X.jsx)(yr,{asChild:!0,children:(0,X.jsx)(`span`,{className:`flex shrink-0`,"data-slot":`wiki-link-prop-panel-icon-trigger`,children:ae})}),(0,X.jsx)(br,{children:G.text})]}):ae,t[45]=ae,t[46]=V,t[47]=G.text,t[48]=oe):oe=t[48];let se=oe,K=`${G.text}: ${te}`,ce;t[49]!==te||t[50]!==H||t[51]!==V||t[52]!==ee||t[53]!==U||t[54]!==i||t[55]!==a?(ce=(0,X.jsx)(yr,{asChild:!0,children:U?(0,X.jsx)(`a`,{href:ee??void 0,...H?{target:`_blank`,rel:`noopener noreferrer`}:{},onClick:e=>NW(e,a,i),"data-slot":`wiki-link-prop-panel-text`,className:`block truncate text-sm font-medium text-foreground underline-offset-2 hover:underline focus-visible:underline`,children:te}):(0,X.jsx)(`span`,{"data-slot":`wiki-link-prop-panel-text`,className:Xt(`block truncate text-sm font-medium`,V?`text-muted-foreground`:`text-foreground`),children:te})}),t[49]=te,t[50]=H,t[51]=V,t[52]=ee,t[53]=U,t[54]=i,t[55]=a,t[56]=ce):ce=t[56];let le;t[57]===te?le=t[58]:(le=(0,X.jsx)(br,{className:`max-w-80 break-all`,children:te}),t[57]=te,t[58]=le);let ue;t[59]!==ce||t[60]!==le?(ue=(0,X.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,X.jsxs)(xr,{children:[ce,le]})}),t[59]=ce,t[60]=le,t[61]=ue):ue=t[61];let de;t[62]!==L||t[63]!==O||t[64]!==V?(de=V?(0,X.jsxs)(en,{type:`button`,size:`sm`,variant:`link`,disabled:O,onClick:()=>void L(),"data-slot":`wiki-link-prop-panel-create`,className:`flex items-center text-foreground`,children:[(0,X.jsx)(Oa,{className:`size-3.5`,"aria-hidden":`true`}),O?(0,X.jsx)(o,{id:`HM56Bx`}):(0,X.jsx)(o,{id:`XRuL0i`})]}):null,t[62]=L,t[63]=O,t[64]=V,t[65]=de):de=t[65];let fe;t[66]===A?fe=t[67]:(fe=A({id:`ePK91l`}),t[66]=A,t[67]=fe);let pe;t[68]===D?pe=t[69]:(pe=()=>D(!0),t[68]=D,t[69]=pe);let me;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,X.jsx)(qn,{className:`size-3.5`,"aria-hidden":`true`}),t[70]=me):me=t[70];let he;t[71]!==fe||t[72]!==pe?(he=(0,X.jsx)(yr,{asChild:!0,children:(0,X.jsx)(en,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":fe,onClick:pe,"data-slot":`wiki-link-prop-panel-edit`,children:me})}),t[71]=fe,t[72]=pe,t[73]=he):he=t[73];let ge;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,X.jsx)(br,{children:(0,X.jsx)(o,{id:`ePK91l`})}),t[74]=ge):ge=t[74];let _e;t[75]===he?_e=t[76]:(_e=(0,X.jsxs)(xr,{children:[he,ge]}),t[75]=he,t[76]=_e);let ve;t[77]===W?ve=t[78]:(ve=(0,X.jsx)(YJ,{copyContent:W}),t[77]=W,t[78]=ve);let ye;t[79]===A?ye=t[80]:(ye=A({id:`t_YqKh`}),t[79]=A,t[80]=ye);let be;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,X.jsx)(Hn,{className:`size-3.5`,"aria-hidden":`true`}),t[81]=be):be=t[81];let xe;t[82]!==P||t[83]!==ye?(xe=(0,X.jsx)(yr,{asChild:!0,children:(0,X.jsx)(en,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":ye,onClick:P,"data-slot":`wiki-link-prop-panel-remove`,children:be})}),t[82]=P,t[83]=ye,t[84]=xe):xe=t[84];let Se;t[85]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,X.jsx)(br,{children:(0,X.jsx)(o,{id:`t_YqKh`})}),t[85]=Se):Se=t[85];let Ce;t[86]===xe?Ce=t[87]:(Ce=(0,X.jsxs)(xr,{children:[xe,Se]}),t[86]=xe,t[87]=Ce);let we;t[88]!==de||t[89]!==_e||t[90]!==ve||t[91]!==Ce?(we=(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[de,_e,ve,Ce]}),t[88]=de,t[89]=_e,t[90]=ve,t[91]=Ce,t[92]=we):we=t[92];let Te;t[93]!==se||t[94]!==ue||t[95]!==we?(Te=(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[se,ue,we]}),t[93]=se,t[94]=ue,t[95]=we,t[96]=Te):Te=t[96];let Ee;t[97]!==i||t[98]!==Te||t[99]!==K||t[100]!==re?(Ee=(0,X.jsx)(gJ,{kind:`wiki-link`,ariaLabel:K,onDeactivate:i,triggerReference:re,className:`w-96`,children:Te}),t[97]=i,t[98]=Te,t[99]=K,t[100]=re,t[101]=Ee):Ee=t[101];let De;t[102]!==d||t[103]!==f||t[104]!==h||t[105]!==E||t[106]!==g||t[107]!==M||t[108]!==x||t[109]!==v||t[110]!==D||t[111]!==u?(De=(0,X.jsx)(mQ,{open:E,target:u,alias:d,anchor:f,pages:v,assetPaths:h,filePaths:g,loading:x,onOpenChange:D,onSave:M}),t[102]=d,t[103]=f,t[104]=h,t[105]=E,t[106]=g,t[107]=M,t[108]=x,t[109]=v,t[110]=D,t[111]=u,t[112]=De):De=t[112];let Oe;return t[113]!==Ee||t[114]!==De?(Oe=(0,X.jsxs)(X.Fragment,{children:[Ee,De]}),t[113]=Ee,t[114]=De,t[115]=Oe):Oe=t[115],Oe}var gQ=0;function _Q(){return`wiki-link-${++gQ}`}function vQ(e){let t=e.doc??(typeof document<`u`?document:{createElement:null,createTextNode:null}),n=t.createElement(`span`);n.setAttribute(`data-wiki-link`,``),n.setAttribute(`data-node-id`,e.nodeId),n.setAttribute(`data-target`,e.target),n.setAttribute(`data-alias`,e.alias??``),n.setAttribute(`data-anchor`,e.anchor??``),n.setAttribute(`contenteditable`,`false`),n.setAttribute(`role`,`button`),n.setAttribute(`tabindex`,`0`),n.setAttribute(`aria-label`,`Wiki link: ${e.target}${e.anchor?`#${e.anchor}`:``}`),n.classList.add(`wiki-link-chip`),n.style.touchAction=`manipulation`;let r=t.createElement(`span`);r.setAttribute(`data-wiki-link-icon`,``),r.setAttribute(`aria-hidden`,`true`),n.appendChild(r);let i=e.alias??`${e.target}${e.anchor?`#${e.anchor}`:``}`,a=t.createTextNode(i);return n.appendChild(a),{dom:n,iconSpan:r}}function yQ(e,t){if(!t||!e)return null;let n=DO(e,t);if(!n)return null;let r=t.pageIcons?.get(n);if(!r)return null;let i=cQ(r);return i.kind===`unsupported`?null:i}function bQ(e,t,n=document){let r=t?.kind??``,i=t?.value??``;if(e.getAttribute(`data-kind`)===r&&e.getAttribute(`data-value`)===i)return;for(e.setAttribute(`data-kind`,r),e.setAttribute(`data-value`,i);e.firstChild;)e.removeChild(e.firstChild);if(!t)return;if(t.kind===`emoji`){e.appendChild(n.createTextNode(t.value));return}let a=n.createElement(`img`);a.setAttribute(`src`,t.value),a.setAttribute(`alt`,``),a.setAttribute(`draggable`,`false`),a.setAttribute(`referrerpolicy`,`no-referrer`),e.appendChild(a)}var xQ=z.extend({priority:200,addOptions(){return{...this.parent?.(),docName:``}},addNodeView(){return({editor:e,node:t,getPos:n})=>{let r=_Q(),{dom:i,iconSpan:a}=vQ({nodeId:r,target:String(t.attrs.target??``),alias:t.attrs.alias==null?null:String(t.attrs.alias),anchor:t.attrs.anchor==null?null:String(t.attrs.anchor)}),o=t,s=()=>{bQ(a,yQ(String(o.attrs.target??``),Fn()))};s();let c=Pn(s),l=()=>{let e=n();return typeof e==`number`?e:void 0},u=pk(e),d=({newTab:e})=>{let t=o.attrs,n=typeof t.target==`string`?t.target:``;if(!n)return!1;let r=Ue(n,typeof t.anchor==`string`?t.anchor:null);if(!r)return!1;if(r.kind===`doc`){let t=Fn(),i=pW(n,{pages:t?.pages??new Set,folderPaths:t?.folderPaths??new Set,pagesBySlug:t?.pagesBySlug,pagesByBasename:t?.pagesByBasename,fallbackTargets:EO(n)});if(i.kind===`create`||i.kind===`navigate`&&i.displayState===`folder`)return!1;let a=i.kind===`navigate`?i.hashDocName:r.docName;return e?kW({docName:a,anchor:r.anchor}):window.location.assign(EW({docName:a,anchor:r.anchor})),!0}if(r.kind===`asset`){let t=Fn(),n=AO(r.url,t?.assetPaths??new Set,t?.filePaths)??r.url.replace(/^\//,``);return e?DW(Cn(n)):window.location.hash=Cn(n),!0}return CW(r.url)?(DW(r.url),!0):!1};return u.register({type:`wikiLink`,nodeId:r,getPos:l,controls:{propPanel:t=>(0,Q.createElement)(hQ,{editor:e,getPos:l,onClose:t.deactivate,onNavigate:e=>d({newTab:e})})},handlePrimary:d}),{dom:i,ignoreMutation:()=>!0,update:e=>{if(e.type.name!==`wikiLink`)return!1;o=e;let t=String(e.attrs.target??``),n=e.attrs.alias==null?null:String(e.attrs.alias),r=e.attrs.anchor==null?null:String(e.attrs.anchor);i.setAttribute(`data-target`,t),i.setAttribute(`data-alias`,n??``),i.setAttribute(`data-anchor`,r??``),i.setAttribute(`aria-label`,`Wiki link: ${t}${r?`#${r}`:``}`);let a=n??`${t}${r?`#${r}`:``}`,c=i.lastChild;return c&&c.nodeType===3?c.nodeValue=a:i.appendChild(i.ownerDocument.createTextNode(a)),s(),!0},destroy:()=>{u.deregister(r),c()}}}},addKeyboardShortcuts(){return{Backspace:()=>{if(sG.getState(this.editor.state)?.active)return!1;let{selection:e}=this.editor.state;if(!e.empty)return!1;let t=e.$from.nodeBefore;if(t?.type.name===`wikiLink`){let{state:n,view:r}=this.editor;return r.dispatch(n.tr.delete(e.from-t.nodeSize,e.from)),!0}return!1},Delete:()=>{if(sG.getState(this.editor.state)?.active)return!1;let{selection:e}=this.editor.state;if(!e.empty)return!1;let t=e.$from.nodeAfter;if(t?.type.name===`wikiLink`){let{state:n,view:r}=this.editor;return r.dispatch(n.tr.delete(e.from,e.from+t.nodeSize)),!0}return!1}}},addProseMirrorPlugins(){return[MG(this.editor)]}}),SQ=0;function CQ(){return`wiki-link-embed-${++SQ}`}function wQ(e){let t=e.doc??(typeof document<`u`?document:{createElement:null,createTextNode:null}),n=t.createElement(`a`);n.setAttribute(`data-wiki-embed`,``),n.setAttribute(`data-node-id`,e.nodeId),n.setAttribute(`data-target`,e.target),n.setAttribute(`data-alias`,e.alias??``),n.setAttribute(`data-anchor`,e.anchor??``),n.setAttribute(`href`,e.href),n.setAttribute(`target`,`_blank`),n.setAttribute(`rel`,`noopener noreferrer`),n.setAttribute(`contenteditable`,`false`),n.setAttribute(`role`,`button`),n.setAttribute(`tabindex`,`0`),n.setAttribute(`aria-label`,`Embed: ${e.target}${e.anchor?`#${e.anchor}`:``}`),n.classList.add(`wiki-link-embed-chip`),n.style.touchAction=`manipulation`;let r=e.alias??`${e.target}${e.anchor?`#${e.anchor}`:``}`,i=t.createTextNode(r);return n.appendChild(i),{dom:n}}function TQ(e){let t=(e.doc??(typeof document<`u`?document:{createElement:null})).createElement(`img`);return t.setAttribute(`data-wiki-embed`,``),t.setAttribute(`data-node-id`,e.nodeId),t.setAttribute(`data-target`,e.target),t.setAttribute(`data-alias`,e.alias??``),t.setAttribute(`src`,d(e.src)),t.setAttribute(`alt`,e.alias??e.target),{dom:t}}function EQ(e){let t=m(e);return t!==null&&de.has(t)}var DQ=oe.extend({addNodeView(){return({editor:e,node:t,getPos:n})=>{let r=CQ(),i=t,a=String(t.attrs.target??``),o=t.attrs.alias==null?null:String(t.attrs.alias),s=t.attrs.anchor==null?null:String(t.attrs.anchor),c=t.attrs.resolvedSrc==null?null:String(t.attrs.resolvedSrc);if(EQ(a)){let{dom:e}=TQ({nodeId:r,target:a,alias:o,src:c??a});return{dom:e,ignoreMutation:()=>!0,update:t=>{if(t.type.name!==`wikiLinkEmbed`)return!1;i=t;let n=String(t.attrs.target??``),r=t.attrs.alias==null?null:String(t.attrs.alias),a=t.attrs.resolvedSrc==null?null:String(t.attrs.resolvedSrc);if(!EQ(n))return!1;let o=a??n;return e.setAttribute(`data-target`,n),e.setAttribute(`data-alias`,r??``),e.setAttribute(`src`,d(o)),e.setAttribute(`alt`,r??n),!0}}}let{dom:l}=wQ({nodeId:r,target:a,alias:o,anchor:s,href:c??a});l.addEventListener(`click`,e=>{e.preventDefault()});let u=()=>{let e=n();return typeof e==`number`?e:void 0},f=pk(e);return f.register({type:`wikiLinkEmbed`,nodeId:r,getPos:u,controls:{},handlePrimary:({newTab:e})=>{let t=i.attrs,n=typeof t.target==`string`?t.target:``;if(!n)return!1;let r=(typeof t.resolvedSrc==`string`&&t.resolvedSrc.length>0?t.resolvedSrc:null)??n,a=m(n);if(a===null)return!1;let o=h(r,``)??n;return jW({url:r,projectRelPath:o,ext:a,title:o.split(`/`).pop()??r,newTab:e}),!0}}),{dom:l,ignoreMutation:()=>!0,update:e=>{if(e.type.name!==`wikiLinkEmbed`)return!1;i=e;let t=String(e.attrs.target??``);if(EQ(t))return!1;let n=e.attrs.alias==null?null:String(e.attrs.alias),r=e.attrs.anchor==null?null:String(e.attrs.anchor),a=(e.attrs.resolvedSrc==null?null:String(e.attrs.resolvedSrc))??t;return l.setAttribute(`data-target`,t),l.setAttribute(`data-alias`,n??``),l.setAttribute(`data-anchor`,r??``),l.setAttribute(`href`,a),l.setAttribute(`aria-label`,`Embed: ${t}${r?`#${r}`:``}`),l.textContent=n??`${t}${r?`#${r}`:``}`,!0},destroy:()=>{f.deregister(r)}}}}}),OQ=[..._.map(e=>{if(e.name===`jsxComponent`)return xZ;if(e.name===`image`){let t=e.options??{};return fJ.configure({...t,inline:!0})}return e.name===`rawMdxFallback`?MZ:e.name===`wikiLink`?xQ:e.name===`wikiLinkEmbed`?DQ:e.name===`link`?dY:e.name===`mathInline`?kZ:e.name===`tag`?aQ:e.name===`codeBlock`?fq:e}),LZ.configure({itemsSources:[QM,UM,ZM,KM],categoryLabels:{content:`Components`,layout:`Layout`,media:`Media`,data:`Data`,embed:`Embeds`}}),lJ,VZ,YD.configure({onDrop(e,t,n){for(let r of t)UO(r,e,n)},onPaste(e,t,n){for(let n of t)UO(n,e,e.state.selection.from)}}),uJ,hO,$Z,cJ,oJ,rN,YZ,zZ,$D,cN,BX,F.create({name:`chunkWrapperDecoration`,addProseMirrorPlugins(){return[mN()]}})];function kQ(e){return e===Wt}function AQ(){return Sc(`SYNC_TIMEOUT_MS`,3e4)}var jQ=class extends Error{docName;elapsedMs;constructor(e,t){super(`Sync timed out for "${e}" after ${t}ms`),this.name=`SyncTimeoutError`,this.docName=e,this.elapsedMs=t}},MQ=class extends Error{docName;constructor(e){super(`Provider disconnected before sync for "${e}"`),this.name=`PreSyncDisconnectError`,this.docName=e}},NQ=class extends Error{docName;constructor(e){super(`Document not found: "${e}"`),this.name=`DocumentNotFoundError`,this.docName=e}},PQ=class extends Error{docName;cause;constructor(e,t){let n=t instanceof Error?t.message:String(t??`unknown`);super(`Bridge setup failed for "${e}": ${n}`),this.name=`BridgeSetupError`,this.docName=e,this.cause=t}},FQ=class extends Error{docName;missingCapability;constructor(e,t){super(`Server is missing capability "${t}" required to open "${e}".`),this.name=`ServerCapabilityMismatchError`,this.docName=e,this.missingCapability=t}},IQ=new Map,LQ=!1;function RQ(){for(let e of IQ.values())if(!e.settled)return!0;return!1}function zQ(){typeof document>`u`||document.visibilityState===`visible`&&BQ(Date.now())}function BQ(e){let t=[];for(let[n,r]of IQ){if(r.settled)continue;let i=e-r.createdAt;if(i<AQ())continue;r.settled=!0;let a=new jQ(n,i);WQ(r),r.reject(a);let o=TS(n);o!==void 0&&IS(o),t.push({docName:n,elapsedMs:i})}if(t.length>0){let e=t.map(e=>`${e.docName} (${e.elapsedMs}ms)`).join(`, `);console.warn(`[syncPromise] reaped ${t.length} timed-out ${t.length===1?`entry`:`entries`} on visibility restore (tab-sleep recovered): ${e}`)}return RQ()||HQ(),t.length}function VQ(){LQ||typeof document>`u`||(document.addEventListener(`visibilitychange`,zQ),LQ=!0)}function HQ(){LQ&&(typeof document>`u`||(document.removeEventListener(`visibilitychange`,zQ),LQ=!1))}var UQ=new Map;function WQ(e){e.detached||(e.detached=!0,e.timeoutHandle!==null&&clearTimeout(e.timeoutHandle),e.provider.off(`synced`,e.onSynced),e.provider.off(`close`,e.onClose))}function GQ(e,t){let n=IQ.get(e);if(n)return n.promise;let r=UQ.get(e);if(r!==void 0){UQ.delete(e);let n=r===`timeout`?new jQ(e,0):new MQ(e);console.warn(`[syncPromise] ${e} rejected on creation (test hook, armed ${r}): ${n.message}`),$(`ok/sync/create`,{docName:e,mountId:TS(e),warm:!1,armed:r}),$(`ok/sync/reject`,{docName:e,mountId:TS(e),reason:`armed-${r}`});let i=qQ(n);return IQ.set(e,JQ(i,t)),i}if(t.synced){console.log(`[syncPromise] ${e} resolved synchronously (warm provider)`);let n=TS(e);$(`ok/sync/create`,{docName:e,mountId:n,warm:!0}),$(`ok/sync/resolve`,{docName:e,mountId:n,elapsedMs:0,warm:!0}),$.histogram(`ok/sync/resolve-elapsed-ms`,n===void 0?{docName:e,warm:!0}:{docName:e,mountId:n,warm:!0},0);let r=Promise.resolve();return IQ.set(e,KQ(r,t)),r}let i=Date.now(),a=()=>{},o=()=>{},s=new Promise((e,t)=>{a=e,o=t}),c=()=>{let t=IQ.get(e);if(!t||t.settled)return;t.settled=!0,t.resolved=!0;let n=Date.now()-t.createdAt;console.log(`[syncPromise] ${e} resolved in ${n}ms`);let r=TS(e);if($(`ok/sync/resolve`,{docName:e,mountId:r,elapsedMs:n,warm:!1}),$.histogram(`ok/sync/resolve-elapsed-ms`,r===void 0?{docName:e}:{docName:e,mountId:r},n),WQ(t),RQ()||HQ(),t.resolve(),r!==void 0){let i=Date.now();FS(r,`ok.sync-promise`,{"doc.name":e,elapsed_ms:n},t.createdAt,i),IS(r,i)}},l=t=>{let n=IQ.get(e);if(!n||n.settled)return;n.settled=!0;let r=new MQ(e);console.warn(`[syncPromise] ${e} rejected: ${r.message}`);let i=TS(e);$(`ok/sync/reject`,{docName:e,mountId:i,reason:`pre-sync-disconnect`}),WQ(n),RQ()||HQ(),n.reject(r),i!==void 0&&IS(i)},u=setTimeout(()=>{let t=IQ.get(e);if(!t||t.settled)return;t.settled=!0;let n=Date.now()-t.createdAt,r=new jQ(e,n);console.warn(`[syncPromise] ${e} rejected: ${r.message}`);let i=TS(e);$(`ok/sync/reject`,{docName:e,mountId:i,reason:`timeout`,elapsedMs:n}),WQ(t),RQ()||HQ(),t.reject(r),i!==void 0&&IS(i)},AQ()),d={promise:s,resolve:a,reject:o,createdAt:i,timeoutHandle:u,provider:t,onSynced:c,onClose:l,settled:!1,resolved:!1,detached:!1};return IQ.set(e,d),t.on(`synced`,c),t.on(`close`,l),VQ(),$(`ok/sync/create`,{docName:e,mountId:TS(e),warm:!1}),s}function KQ(e,t){return{promise:e,resolve:()=>{},reject:()=>{},createdAt:Date.now(),timeoutHandle:null,provider:t,onSynced:()=>{},onClose:()=>{},settled:!0,resolved:!0,detached:!0}}function qQ(e){let t=Promise.reject(e);t.catch(()=>{});let n=t;return n.status=`rejected`,n.reason=e,n}function JQ(e,t){return{promise:e,resolve:()=>{},reject:()=>{},createdAt:Date.now(),timeoutHandle:null,provider:t,onSynced:()=>{},onClose:()=>{},settled:!0,resolved:!1,detached:!0}}function YQ(e){return IQ.get(e)?.resolved===!0}function XQ(e){let t=IQ.get(e);t&&(t.settled=!0,WQ(t),IQ.delete(e),RQ()||HQ())}function ZQ(e,t){let n=IQ.get(e);if(!n||n.settled)return!1;n.settled=!0,console.warn(`[syncPromise] ${e} rejected: ${t.message}`),WQ(n),RQ()||HQ(),n.reject(t);let r=TS(e);return r!==void 0&&IS(r),!0}var QQ=Object.freeze({kind:`tab-replay`}),$Q=Object.freeze({kind:`idle`});function e$(e,t){return()=>{}}var t$=null;function n$(){return t$??=pt(OQ),t$}var r$=4e3,i$=1e4,a$=class extends Error{constructor(e,t){super(`client persistence clearData timed out for ${e} after ${t}ms`),this.docName=e,this.timeoutMs=t,this.name=`ClientPersistenceClearTimeoutError`}},o$=class extends Error{constructor(e,t){super(`stored-state epoch peek timed out for ${e} after ${t}ms`),this.docName=e,this.timeoutMs=t,this.name=`StoredEpochPeekTimeoutError`}},s$=`ok-last-observed-branch`,c$=`ok-doc-lineage-epochs`,l$=5e3,u$=Sc(`MAX_BUFFER_BYTES`,1*1024*1024),d$=Sc(`MAX_POOL`,10),f$=class{_entries=new Map;get entries(){return this._entries}lruOrder=[];activeDocName=null;maxSize;wsUrl;recycleDebounceMs;clearDataTimeoutMs;onChange=null;tabIdentity=null;serverRestartRecoveryState=$Q;cachedServerInstanceId=null;pendingServerInstanceKnown=null;recoveryMismatchStaleClaim;bufferedUpdates=new Map;pendingClears=new Map;clearFailures=new Set;persistenceFactory;peekStoredEpoch;storage;constructor(e,t,n){this.maxSize=e,this.wsUrl=t,this.recycleDebounceMs=n?.recycleDebounceMs??r$,this.clearDataTimeoutMs=n?.clearDataTimeoutMs??i$,this.persistenceFactory=n?.persistenceFactory??HD,this.peekStoredEpoch=n?.peekStoredLineageEpoch??UD,n?.storage===void 0?this.storage=globalThis.localStorage===void 0?null:globalThis.localStorage:this.storage=n.storage}setTabIdentity(e){this.tabIdentity=e}setExpectedServerInstanceId(e){if(this.cachedServerInstanceId=e,!(e===null||e.length===0)){if(this.pendingServerInstanceKnown!==null){let t=this.pendingServerInstanceKnown;this.pendingServerInstanceKnown=null,t.resolve(e)}this.attachDeferredPersistence(e)}}whenServerInstanceKnown(){if(this.cachedServerInstanceId!==null&&this.cachedServerInstanceId.length>0)return Promise.resolve(this.cachedServerInstanceId);if(this.pendingServerInstanceKnown!==null)return this.pendingServerInstanceKnown.promise;let e,t=new Promise(t=>{e=t});return this.pendingServerInstanceKnown={promise:t,resolve:e},t}buildPersistence(e,t,n){return this.persistenceFactory({branch:this.normalizedObservedBranch(),serverInstanceId:e,docName:t,doc:n})}async validateStoredStateThenAttach(e,t){if(e.persistenceAttachOwned)return;e.persistenceAttachOwned=!0;let n=e.docName,r=()=>this._entries.get(n)===e&&e.kind===`active`&&e.persistence===null&&!this.pendingClears.has(n);if(!r())return;let i;try{i=await new Promise((e,r)=>{let i=setTimeout(()=>{r(new o$(n,this.clearDataTimeoutMs))},this.clearDataTimeoutMs);this.peekStoredEpoch({branch:this.normalizedObservedBranch(),serverInstanceId:t,docName:n}).then(t=>{clearTimeout(i),e(t)},e=>{clearTimeout(i),r(e)})})}catch(e){this.emitStructuredClientRecoveryEvent({event:`ok-client-persistence-attach-failed`,...this.recoveryTelemetryBase(n),phase:`peek`,errorName:e instanceof Error?e.name:`non-error-throw`,errorMessage:e instanceof Error?e.message:String(e)});return}if(!r())return;if(i===null){this.attachValidatedPersistence(e,t);return}if(!e.hasSynced&&(await this.awaitFirstSyncOrDestroy(e),!r()||!e.hasSynced))return;let a=e.provider.document.getMap(`lifecycle`).get(bt),o=typeof a==`string`&&a.length>0?a:null;if(o===i){this.attachValidatedPersistence(e,t);return}this.emitStructuredClientRecoveryEvent({event:`ok-doc-lineage-mismatch`,...this.recoveryTelemetryBase(n),via:`stored-state-validation`,staleEpoch:i,liveEpoch:o??`<absent>`});let s=this.activeDocName===n;this.runCloseAndClearPersistence(n),this.open(n)!==null&&s&&this.setActive(n)}attachValidatedPersistence(e,t){let n=e.docName;try{let r=this.buildPersistence(t,n,e.provider.document);e.persistence=r,this.notify(),this.backfillCacheAfterFirstSync(e,r).catch(e=>{this.emitStructuredClientRecoveryEvent({event:`ok-client-persistence-attach-failed`,...this.recoveryTelemetryBase(n),phase:`backfill`,errorName:e instanceof Error?e.name:`non-error-throw`,errorMessage:e instanceof Error?e.message:String(e)})})}catch(e){this.emitStructuredClientRecoveryEvent({event:`ok-client-persistence-attach-failed`,...this.recoveryTelemetryBase(n),phase:`attach`,errorName:e instanceof Error?e.name:`non-error-throw`,errorMessage:e instanceof Error?e.message:String(e)})}}async backfillCacheAfterFirstSync(e,t){await t.whenSynced,e.hasSynced||await this.awaitFirstSyncOrDestroy(e),!(this._entries.get(e.docName)!==e||e.kind!==`active`||e.persistence!==t||!e.hasSynced)&&await t.flushFullState()}async awaitFirstSyncOrDestroy(e){e.hasSynced||await new Promise(t=>{let n=()=>{e.provider.off(`synced`,n),e.provider.off(`destroy`,n),t()};e.provider.on(`synced`,n),e.provider.on(`destroy`,n)})}attachDeferredPersistence(e){for(let t of Array.from(this._entries.values()))if(t.kind===`active`&&t.persistence===null&&this._entries.get(t.docName)===t){if(t.hasSynced&&t.lineageEpochRecordAtOpen!==null){let e=t.provider.document.getMap(`lifecycle`).get(bt);if(typeof e==`string`&&e.length>0&&e!==t.lineageEpochRecordAtOpen){let n=t.docName;this.emitStructuredClientRecoveryEvent({event:`ok-doc-lineage-mismatch`,...this.recoveryTelemetryBase(n),via:`deferred-attach`,staleEpoch:t.lineageEpochRecordAtOpen,liveEpoch:e});let r=this.activeDocName===n;this.runCloseAndClearPersistence(n),this.open(n)!==null&&r&&this.setActive(n);continue}}this.validateStoredStateThenAttach(t,e)}}getServerRestartRecoveryState(){return this.serverRestartRecoveryState}observeDiskAck(e,t){let n=this.entries.get(e);!n||n.kind!==`active`||(n.lastDiskAckedSV=KD(n.lastDiskAckedSV,t))}observeDiskAckBatch(e){for(let[t,n]of Object.entries(e))this.observeDiskAck(t,n)}lastObservedBranch=null;lastObservedBranchInitialized=!1;getOrInitObservedBranch(){if(this.lastObservedBranchInitialized)return this.lastObservedBranch;this.lastObservedBranchInitialized=!0;try{let e=this.storage?.getItem(s$)??null;e!==null&&e.length>0&&(this.lastObservedBranch=e)}catch{}return this.lastObservedBranch}persistObservedBranch(e){this.lastObservedBranch=e,this.lastObservedBranchInitialized=!0;try{e===null||e.length===0?this.storage?.removeItem(s$):this.storage?.setItem(s$,e)}catch{}}docLineageEpochs=new Map;docLineageEpochsEnvelopeConsumed=!1;normalizedObservedBranch(){return this.getOrInitObservedBranch()??`_unknown_`}consumeLineageEpochEnvelopeIfValid(){if(this.docLineageEpochsEnvelopeConsumed)return;let e=this.cachedServerInstanceId;if(!(e===null||e.length===0)){this.docLineageEpochsEnvelopeConsumed=!0;try{let t=this.storage?.getItem(c$)??null;if(t===null)return;let n=JSON.parse(t);if(typeof n!=`object`||!n)return;let r=n;if(r.branch!==this.normalizedObservedBranch()||r.serverInstanceId!==e||typeof r.epochs!=`object`||r.epochs===null)return;for(let[e,t]of Object.entries(r.epochs))typeof t==`string`&&t.length>0&&!this.docLineageEpochs.has(e)&&this.docLineageEpochs.set(e,t)}catch(e){e instanceof DOMException||console.warn(JSON.stringify({event:`ok-lineage-epoch-envelope-read-error`,errorName:e instanceof Error?e.name:typeof e,message:e instanceof Error?e.message:String(e)}))}}}getRecordedLineageEpoch(e){let t=this.docLineageEpochs.get(e);return t===void 0?(this.consumeLineageEpochEnvelopeIfValid(),this.docLineageEpochs.get(e)??null):t}persistLineageEpochEnvelope(){let e=this.cachedServerInstanceId;if(!(e===null||e.length===0))try{this.storage?.setItem(c$,JSON.stringify({branch:this.normalizedObservedBranch(),serverInstanceId:e,epochs:Object.fromEntries(this.docLineageEpochs)}))}catch{}}recordLineageEpoch(e,t){this.docLineageEpochs.get(e)!==t&&(this.docLineageEpochs.set(e,t),this.persistLineageEpochEnvelope())}deleteLineageEpochRecord(e){this.docLineageEpochs.delete(e)&&this.persistLineageEpochEnvelope()}withClearDataTimeout(e,t){return new Promise((n,r)=>{let i=setTimeout(()=>{r(new a$(e,this.clearDataTimeoutMs))},this.clearDataTimeoutMs);t.then(()=>{clearTimeout(i),n()},e=>{clearTimeout(i),r(e)})})}recoveryTelemetryBase(e,t){let n={docName:e,branch:this.normalizedObservedBranch()},r=t===void 0?this.recoveryMismatchStaleClaim:t;return r!==void 0&&r.length>0&&(n.serverInstanceId=r),n}emitStructuredClientRecoveryEvent(e){console.warn(JSON.stringify(e))}clearRecoveryMismatchStaleClaimIfTerminal(){let e=this.serverRestartRecoveryState.kind;(e===`idle`||e===`failed`)&&(this.recoveryMismatchStaleClaim=void 0)}beginServerRestartRecovery(e,t){this.serverRestartRecoveryState={kind:`recovering`,phase:`clearing-local-cache`,docNames:e,failedDocNames:[],startedAt:t};for(let t of e)XQ(t);this.notify()}enterServerRestartReconnect(e,t,n,r){if(e.length===0){this.serverRestartRecoveryState=t.length===0?$Q:{kind:`failed`,reason:r,docNames:t,failedDocNames:t,startedAt:n},this.clearRecoveryMismatchStaleClaimIfTerminal(),this.notify();return}this.serverRestartRecoveryState={kind:`recovering`,phase:`reconnecting`,docNames:e,failedDocNames:t,startedAt:n,...t.length>0?{clearFailureReason:r}:{}},this.notify()}markServerRestartRecoverySynced(e){let t=this.serverRestartRecoveryState;if(t.kind!==`recovering`||t.phase!==`reconnecting`||!t.docNames.includes(e))return;let n=t.docNames.filter(t=>t!==e);if(n.length>0){this.serverRestartRecoveryState={...t,docNames:n};return}if(t.failedDocNames.length>0){this.serverRestartRecoveryState={kind:`failed`,reason:t.clearFailureReason??`clear-data-failed`,docNames:t.failedDocNames,failedDocNames:t.failedDocNames,startedAt:t.startedAt},this.clearRecoveryMismatchStaleClaimIfTerminal();return}this.serverRestartRecoveryState=$Q,this.clearRecoveryMismatchStaleClaimIfTerminal()}setObservedBranch(e){this.persistObservedBranch(e)}compareAndUpdateObservedBranch(e){let t=this.getOrInitObservedBranch();return this.persistObservedBranch(e),t!==null&&t!==e}onBranchMismatch=null;branchMismatchInFlight=null;mismatchInFlight=null;setOnBranchMismatch(e){if(e===null){this.onBranchMismatch=null;return}this.onBranchMismatch=()=>{if(this.branchMismatchInFlight!==null)return;let t=Promise.resolve().then(e).finally(()=>{this.branchMismatchInFlight===t&&(this.branchMismatchInFlight=null)});this.branchMismatchInFlight=t}}onRenameRedirect=null;onDocDeleted=null;setOnRenameRedirect(e){this.onRenameRedirect=e}setOnDocDeleted(e){this.onDocDeleted=e}setOnChange(e){this.onChange=e}notify(){this.onChange?.()}evictListeners=new Set;onEvict(e){return this.evictListeners.add(e),()=>{this.evictListeners.delete(e)}}fireEvict(e){for(let t of this.evictListeners)try{t(e)}catch(t){console.warn(`[ProviderPool] evict listener threw for ${e}:`,t)}}touch(e){let t=this.lruOrder.indexOf(e);t!==-1&&this.lruOrder.splice(t,1),this.lruOrder.push(e)}open(e){if(kQ(e))return null;let t=this.entries.get(e);if(t){let n=t.lastAccessedAt;return t.lastAccessedAt=Date.now(),this.touch(e),this.notify(),$(`ok/pool/open`,{docName:e,hit:!0,lastAccessedAt:n,poolEventId:t.poolEventId}),$.count(`ok/pool/open`,{hit:!0}),t}let n=Date.now();this.entries.size>=this.maxSize&&this.evictLru();let r=this.cachedServerInstanceId,i=this.getRecordedLineageEpoch(e),a=mD(this.tabIdentity,r,this.getOrInitObservedBranch(),r!==null&&r.length>0?i:null),o=new pD({url:qD(this.wsUrl),name:e,forceSyncInterval:l$,token:a}),s=this.cachedServerInstanceId;this.clearFailures.has(e)&&this.runCloseAndClearPersistence(e);let c=this.pendingClears.get(e),l=s!==null&&s.length>0&&c===void 0&&i!==null?this.buildPersistence(s,e,o.document):null,u=crypto.randomUUID(),d={kind:`active`,provider:o,persistence:l,lastServerSyncedSV:null,lastDiskAckedSV:null,observerCleanup:null,observerFireCounterCleanup:e$(o.document,e),syncState:`connecting`,docName:e,lastAccessedAt:Date.now(),poolEventId:u,hasSynced:!1,pendingRecycleTimer:null,bridgeSetupFailed:!1,serverDrivenCloseReauthInFlight:!1,persistenceAttachOwned:!1,lineageEpochRecordAtOpen:i};if($(`ok/pool/open`,{docName:e,hit:!1,poolEventId:u}),$.count(`ok/pool/open`,{hit:!1}),o.on(`status`,({status:t})=>{d.kind!==`active`||this.entries.get(e)!==d||t===`disconnected`&&(d.syncState=`disconnected`,this.notify())}),o.on(`synced`,()=>{if(d.kind!==`active`||this.entries.get(e)!==d)return;d.syncState=`synced`,d.hasSynced=!0,d.lastServerSyncedSV=WD(o.document);let t=o.document.getMap(`lifecycle`).get(bt);if(typeof t==`string`&&t.length>0&&this.recordLineageEpoch(e,t),d.pendingRecycleTimer&&=(clearTimeout(d.pendingRecycleTimer),null),this.markServerRestartRecoverySynced(e),this.notify(),!d.observerCleanup)try{let t=o.document,n=new G({extensions:OQ});d.observerCleanup=qU({doc:t,xmlFragment:t.getXmlFragment(`default`),ytext:t.getText(`source`),mdManager:n,schema:n$(),onSyncError:(t,n)=>{console.warn(`[Sync] ${t} failed for ${e}:`,n.message)}})}catch(t){console.error(`[ProviderPool] setupObservers init failed for ${e}:`,t),d.bridgeSetupFailed=!0,ZQ(e,new PQ(e,t))}}),o.on(`disconnect`,()=>{d.kind!==`active`||this.entries.get(e)!==d||(d.syncState=`disconnected`,this.notify(),d.hasSynced&&o.unsyncedChanges===0&&!d.pendingRecycleTimer&&(d.pendingRecycleTimer=setTimeout(()=>{d.kind===`active`&&(d.pendingRecycleTimer=null,this.entries.get(e)===d&&this.recycleDisconnectedEntry(e))},this.recycleDebounceMs)))}),o.on(`authenticationFailed`,({reason:t})=>{let n=[`server-instance-mismatch`,`branch-mismatch`,`rename-redirect`,`doc-deleted`,`doc-lineage-mismatch`],i=t.indexOf(`:`),a=i===-1?t:t.slice(0,i);if(!n.includes(a)){console.warn(JSON.stringify({event:`ok-auth-failed-unknown-reason`,reason:t}));return}let o=i===-1?``:t.slice(i+1),s=o.length>0?o:void 0,c=a;if(c===`server-instance-mismatch`){if(r===null||this.cachedServerInstanceId!==r)return;let e=r;this.cachedServerInstanceId=null,this.handleServerInstanceMismatch(e);return}if(c===`branch-mismatch`){this.onBranchMismatch?.();return}if(c===`rename-redirect`){if(s===void 0||s.length===0){console.warn(JSON.stringify({event:`rename-redirect-missing-payload`,fromDocName:e}));return}let t=e,n=s;this.deleteLineageEpochRecord(t);let r=this.entries.get(t),i=r!==void 0&&r.kind===`active`;this.onRenameRedirect?.({fromDocName:t,toDocName:n,hadOpenProvider:i});return}if(c===`doc-deleted`){this.deleteLineageEpochRecord(e);let t=this.entries.get(e),n=t!==void 0&&t.kind===`active`;this.onDocDeleted?.({docName:e,hadOpenProvider:n});return}if(c===`doc-lineage-mismatch`){if(d.kind!==`active`||this.entries.get(e)!==d)return;this.deleteLineageEpochRecord(e),this.emitStructuredClientRecoveryEvent({event:`ok-doc-lineage-mismatch`,...this.recoveryTelemetryBase(e),via:`auth-rejection`,staleEpoch:d.lineageEpochRecordAtOpen??``});let t=this.activeDocName===e;this.runCloseAndClearPersistence(e),this.open(e)!==null&&t&&this.setActive(e);return}}),o.on(`close`,({event:t})=>{if(d.kind!==`active`||this.entries.get(e)!==d||d.serverDrivenCloseReauthInFlight)return;d.serverDrivenCloseReauthInFlight=!0,o.sendToken().catch(t=>{console.warn(JSON.stringify({event:`ok-provider-server-driven-close-reauth-failed`,docName:e,message:t instanceof Error?t.message:String(t)}))}).finally(()=>{d.kind===`active`&&this.entries.get(e)===d&&(d.serverDrivenCloseReauthInFlight=!1)});let n=t?.reason??`<unknown>`;console.info(JSON.stringify({event:`ok-provider-server-driven-close-reauth`,docName:e,reason:n}))}),this.bufferedUpdates.get(e)!==void 0){let t=this.recoveryMismatchStaleClaim,n=()=>{if(o.off(`synced`,n),d.kind!==`active`||this.entries.get(e)!==d)return;let r=this.bufferedUpdates.get(e);if(r!==void 0){this.bufferedUpdates.delete(e);try{dh(o.document,r,QQ)}catch(n){let i=n instanceof Error?n.name:`non-error-throw`;this.emitStructuredClientRecoveryEvent({event:`ok-buffer-replay-failed`,...this.recoveryTelemetryBase(e,t),replayByteLength:r.byteLength,errorName:i,errorMessage:n instanceof Error?n.message:String(n)})}}};o.on(`synced`,n)}if(this._entries.set(e,d),this.touch(e),this.notify(),l===null&&s!==null&&s.length>0&&c===void 0&&this.validateStoredStateThenAttach(d,s),c!==void 0&&s!==null&&s.length>0){let t=s;c.then(()=>{this.attachDeferredPersistenceForEntry(d,t)},t=>{console.warn(JSON.stringify({event:`ok-pool-deferred-persistence-attach-skipped`,docName:e,reason:`pending-clear-failed`,message:t instanceof Error?t.message:String(t)}))})}let f=TS(e);return f!==void 0&&FS(f,`ok.provider-pool.open`,{"doc.name":e},n,Date.now()),d}attachDeferredPersistenceForEntry(e,t){let n=this._entries.get(e.docName);n!==e||n.kind!==`active`||n.persistence!==null||this.validateStoredStateThenAttach(n,t)}handleServerInstanceMismatch(e){this.recoveryMismatchStaleClaim=e.length>0?e:void 0;let t=Array.from(this.entries.entries()),n=Date.now(),r=this.activeDocName,i=r!==null&&t.some(([e,t])=>e===r&&t.kind===`active`)?[r]:[],a=r??t.find(([,e])=>e.kind===`active`)?.[0]??``;a.length>0&&this.emitStructuredClientRecoveryEvent({event:`ok-client-cache-epoch-mismatch`,...this.recoveryTelemetryBase(a)}),this.beginServerRestartRecovery(i,n);for(let[e,n]of t)n.kind===`active`&&!i.includes(e)&&XQ(e);for(let[e,n]of t){if(n.kind!==`active`)continue;let t=n.lastDiskAckedSV??n.lastServerSyncedSV;if(t===null){this.emitStructuredClientRecoveryEvent({event:`ok-buffer-replay-skipped-no-baseline`,...this.recoveryTelemetryBase(e),reason:`no-disk-ack-or-server-sync-vector`});continue}let r=GD(n.provider.document,t);if(r.byteLength>u$){$(`ok/pool/buffer-overflow`,{docName:e,bytes:r.byteLength});continue}r.byteLength>0&&this.bufferedUpdates.set(e,r)}let o=[];for(let[e,n]of t)n.kind===`active`&&n.persistence!==null&&o.push({docName:e,promise:this.withClearDataTimeout(e,n.persistence.clearData())});let s=Promise.allSettled(o.map(e=>e.promise)).then(e=>{let t=[],i=[],a=!1;e.forEach((e,n)=>{let r=o[n];if(!r)return;let s=r.docName;if(e.status===`rejected`){t.push(s);let n=e.reason instanceof a$;if(n&&(a=!0),n)this.emitStructuredClientRecoveryEvent({event:`ok-client-cache-clear-failed`,...this.recoveryTelemetryBase(s),failureKind:`timeout`});else{let t=e.reason instanceof Error?e.reason.name:`unknown`;this.emitStructuredClientRecoveryEvent({event:`ok-client-cache-clear-failed`,...this.recoveryTelemetryBase(s),failureKind:`rejected`,errorName:t,errorMessage:e.reason instanceof Error?e.reason.message:String(e.reason)})}}else i.push(s)});let s=i.filter(e=>e===r);if(t.length>0){let e=a?`clear-data-timeout`:`clear-data-failed`;console.warn(JSON.stringify({event:`ok-mismatch-recycle-partial-clears-failed`,failedDocs:t,clearedDocs:i})),this.enterServerRestartReconnect(s,t,n,e);for(let e of i)this.recycleDisconnectedEntry(e);return}this.enterServerRestartReconnect(s,[],n,`clear-data-failed`),this.recycleAllEntries()}).finally(()=>{this.mismatchInFlight===s&&(this.mismatchInFlight=null)});this.mismatchInFlight=s}awaitMismatchSettled(){return this.mismatchInFlight??Promise.resolve()}recycleAllEntries(){let e=Array.from(this.entries.keys());for(let t of e)this.recycleDisconnectedEntry(t)}prewarm(e){if(kQ(e))return null;let t=this.entries.get(e);if(t)return t;let n=this.open(e);if(!n)return null;let r=this.lruOrder.indexOf(e);return r!==-1&&(this.lruOrder.splice(r,1),this.lruOrder.unshift(e)),n}close(e){let t=this.entries.get(e);t&&(this.destroyEntry(t),this._entries.delete(e),this.lruOrder=this.lruOrder.filter(t=>t!==e),this.bufferedUpdates.delete(e),this.activeDocName===e&&(this.activeDocName=null),this.notify())}async closeAndClearPersistence(e){try{await this.runCloseAndClearPersistence(e)}catch{}}runCloseAndClearPersistence(e){let t=this.pendingClears.get(e);if(t!==void 0)return t;let n=()=>{},r=()=>{},i=new Promise((e,t)=>{n=e,r=t});this.pendingClears.set(e,i);let a=()=>{this.pendingClears.get(e)===i&&this.pendingClears.delete(e)};return i.then(a,a),this.executeCloseAndClearPersistence(e).then(n,r),i}async executeCloseAndClearPersistence(e){this.clearFailures.delete(e);let t=this.entries.get(e);if(t?.kind===`active`&&t.persistence!==null){let n=t.persistence;try{this.close(e)}catch(t){console.warn(`[ProviderPool] close before clearData threw for ${e}:`,t)}try{await this.withClearDataTimeout(e,n.clearData())}catch(t){throw console.warn(`[ProviderPool] clearData on rename failed for ${e}:`,t),this.clearFailures.add(e),t}return}if(t)try{this.close(e)}catch(t){console.warn(`[ProviderPool] close before IDB-by-name delete threw for ${e}:`,t)}let n=this.normalizedObservedBranch(),r=this.cachedServerInstanceId;if(r===null)return;let i=`ok-ydoc:${n}:${r}:${e}`;try{await this.withClearDataTimeout(e,new Promise((e,t)=>{let n=indexedDB.deleteDatabase(i);n.onsuccess=()=>e(),n.onerror=()=>t(n.error),n.onblocked=()=>{console.warn(`[ProviderPool] IDB delete blocked for ${i}`)}}))}catch(t){throw console.warn(`[ProviderPool] IDB delete on rename failed for ${i}:`,t),this.clearFailures.add(e),t}}clearBufferedUpdates(){this.bufferedUpdates.clear()}__test_seedBufferedUpdate(e,t){this.bufferedUpdates.set(e,t)}__test_bufferedUpdatesSize(){return this.bufferedUpdates.size}__test_hasBufferedUpdate(e){return this.bufferedUpdates.has(e)}__test_getBufferedUpdate(e){return this.bufferedUpdates.get(e)}setActive(e){let t=this.entries.get(e);if(!t)throw Error(`[ProviderPool] Cannot setActive — "${e}" is not open`);t.lastAccessedAt=Date.now(),this.touch(e),this.activeDocName=e,this.notify()}clearActive(){this.activeDocName!==null&&(this.activeDocName=null,this.notify())}getActive(){return this.activeDocName?this.entries.get(this.activeDocName)??null:null}getActiveDocName(){return this.activeDocName}has(e){return this.entries.has(e)}peek(e){return this.entries.get(e)??null}recycle(e){this.recycleDisconnectedEntry(e)}dispose(){for(let e of this._entries.values())this.destroyEntry(e);this._entries.clear(),this.lruOrder=[],this.activeDocName=null,this.onChange=null,this.bufferedUpdates.clear(),this.pendingClears.clear(),this.clearFailures.clear(),this.docLineageEpochs.clear(),this.docLineageEpochsEnvelopeConsumed=!1,this.onBranchMismatch=null,this.branchMismatchInFlight=null,this.onRenameRedirect=null,this.onDocDeleted=null,this.evictListeners.clear(),this.serverRestartRecoveryState=$Q,this.cachedServerInstanceId=null,this.pendingServerInstanceKnown=null,this.tabIdentity=null,this.recoveryMismatchStaleClaim=void 0}evictLru(){for(let e of this.lruOrder)if(e!==this.activeDocName){$(`ok/pool/evict-lru`,{docName:e}),this.close(e);return}}destroyEntry(e){if(e.kind===`tearing-down`)return;let t=e.observerCleanup,n=e.observerFireCounterCleanup,r=e.persistence,i=e.pendingRecycleTimer,a=e.docName,o=e;o.kind=`tearing-down`,o.persistence=null,o.observerCleanup=null,o.observerFireCounterCleanup=null,o.pendingRecycleTimer=null,o.serverDrivenCloseReauthInFlight=!1,i&&clearTimeout(i),XQ(a),this.fireEvict(a);try{t?.()}catch(e){console.warn(`[ProviderPool] observer cleanup threw for ${a}:`,e)}try{n?.()}catch(e){console.warn(`[ProviderPool] observer-fire-counter cleanup threw for ${a}:`,e)}r!==null&&r.destroy().catch(e=>{console.warn(`[ProviderPool] persistence destroy failed for ${a}:`,e)});try{o.provider.destroy()}catch(e){console.warn(`[ProviderPool] Provider destroy failed for ${a}:`,e)}}recycleDisconnectedEntry(e){let t=this.entries.get(e);if(!t||t.kind!==`active`)return;let n=this.activeDocName===e;if($(`ok/pool/recycle-disconnected`,{docName:e,wasActive:n}),this.destroyEntry(t),this._entries.delete(e),this.lruOrder=this.lruOrder.filter(t=>t!==e),n){this.open(e)&&this.setActive(e);return}this.notify()}},p$=crypto.randomUUID(),m$=!1;function h$(e){m$||(m$=!0,console.warn(`[principal-fetch] failed to resolve principal — falling back to random identity.`,e))}var g$=(0,Q.createContext)(null),_$=null;function v$(e){return _$||(_$=new f$(d$,e),FC(_$)),_$}var y$={activeDocName:null,activeProvider:null,syncState:`connecting`,serverRestartRecovery:{kind:`idle`},poolEntries:[]};function b$(){if(typeof window>`u`)return null;let e=window.okDesktop;return e?.config.mode===`editor`?e:null}function x$(){return typeof window>`u`||window.okDesktop?.config.mode===`editor`?null:Ow(window.location.origin)}function S$(){if(typeof window>`u`)return Ew(null,d$);let e=x$();return e?kw(window.localStorage===void 0?null:window.localStorage,e,d$):Ew(null,d$)}function C$(){return S$().openTabs}function w$(){return S$().pinnedTabIds}function T$(){if(typeof window>`u`||window.location.hash.length>0)return null;let e=S$();return e.activeTabId??(e.activeDocName?$C(e.activeDocName):null)??e.openTabs[0]??null}function E$(e){let t=iw(e);switch(t.kind){case`doc`:return Dn(t.docName);case`folder`:return Nn(t.folderPath);case`asset`:return Cn(t.assetPath);case`skill-file`:return xn({scope:t.scope,name:t.name,path:t.path})}}function D$(e){let t=Sn(e);if(t)return tw(t);let n=En(e);if(n)return ZC(n);let r=Rn(e);if(!r)return null;let i=r.trim();if(/\/+$/.test(i)){let e=i.replace(/\/+$/g,``);return e?ew(e):null}return $C(r)}function O$(e){return{kind:`asset`,target:e,assetPath:e,mediaKind:Le(e.split(`.`).pop()??``)}}function k$(e,t){return e?rw(e):t?$C(t):null}function A$(e,t,n){return e.some(e=>!n.has(e)&&aw(e)===t)}function j$(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function M$(e){switch(e.kind){case`doc`:return`doc:${e.docName}`;case`folder-index`:return`folder-index:${e.docName}:${e.folderPath}:${e.noteKind}`;case`folder`:return`folder:${e.folderPath}`;case`asset`:return`asset:${e.assetPath}:${e.mediaKind??``}`;case`skill-file`:return`skill-file:${e.scope}:${e.name}:${e.path}`;case`large-file`:return`large-file:${e.docName}:${e.size}:${e.limit}`;case`missing`:return`missing:${e.target}`}}function N$(e,t){return e===t?!0:!e||!t?!1:M$(e)===M$(t)}function P$(e){let t=e.getActive(),n=[];for(let t of e.entries.values())n.push({docName:t.docName,provider:t.provider,lastAccessedAt:t.lastAccessedAt,poolEventId:t.poolEventId});return n.sort((e,t)=>t.lastAccessedAt-e.lastAccessedAt),{activeDocName:e.getActiveDocName(),activeProvider:t?.provider??null,syncState:t?.syncState??`connecting`,serverRestartRecovery:e.getServerRestartRecoveryState(),poolEntries:n}}function F$(e){let t=(0,Z.c)(175),{children:n}=e,[r,i]=(0,Q.useState)(y$),[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(T$),[l,u]=(0,Q.useState)(C$),[d,f]=(0,Q.useState)(w$),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=[],t[0]=p):p=t[0];let[m,h]=(0,Q.useState)(p),[g,_]=(0,Q.useState)(l),[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(!1),S=(0,Q.useRef)(s),C=(0,Q.useRef)(l),w=(0,Q.useRef)(d),T=(0,Q.useRef)(v),E=(0,Q.useRef)(m),D=(0,Q.useRef)(g),O=(0,Q.useRef)(1),k=(0,Q.useRef)(!1),[A,j]=(0,Q.useState)(!1),[M,N]=(0,Q.useState)(null),[P,F]=(0,Q.useState)(null),[I,L]=(0,Q.useState)(`doc`),[R,z]=(0,Q.useState)(null),[B,V]=(0,Q.useState)(0),{collabUrl:H,terminal:ee,lastError:U,retry:W}=fS(),te;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(te=function(e){S.current=e,c(e)},t[1]=te):te=t[1];let G=te,ne;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(ne=function(e){T.current=e,y(e)},t[2]=ne):ne=t[2];let re=ne,ie;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(ie=function(e){D.current=e,_(t=>j$(t,e)?t:e)},t[3]=ie):ie=t[3];let ae=ie,oe;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(oe=function(e){w.current=e,f(t=>j$(t,e)?t:e)},t[4]=oe):oe=t[4];let se=oe,K;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(K=function(e,t){let n=sw(t,e);C.current=e,w.current=n,u(t=>j$(t,e)?t:e),f(e=>j$(e,n)?e:n),ae(vw(D.current,e,E.current))},t[5]=K):K=t[5];let ce=K,le;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(le=function(e){ce(e,w.current)},t[6]=le):le=t[6];let ue=le,de;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(de=function(e){ue(e(C.current))},t[7]=de):de=t[7];let fe=de,pe;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(pe=function(e){E.current=e,h(t=>j$(t,e)?t:e),ae(vw(D.current,C.current,e))},t[8]=pe):pe=t[8];let me=pe,he;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(he=function(e){let t=T.current;if(!t)return;let n=E.current.filter(e=>e!==t);E.current=n,h(e=>j$(e,n)?e:n),re(null);let r=[],i=new Set;for(let n of D.current){let a=n===t?e:n;!a||i.has(a)||(i.add(a),r.push(a))}ae(vw(r,C.current,n))},t[9]=he):he=t[9];let ge=he,_e,ve;t[10]===s?(_e=t[11],ve=t[12]):(_e=()=>{S.current=s},ve=[s],t[10]=s,t[11]=_e,t[12]=ve),(0,Q.useEffect)(_e,ve);let ye,be;t[13]===l?(ye=t[14],be=t[15]):(ye=()=>{C.current=l},be=[l],t[13]=l,t[14]=ye,t[15]=be),(0,Q.useEffect)(ye,be);let xe,Se;t[16]===d?(xe=t[17],Se=t[18]):(xe=()=>{w.current=d},Se=[d],t[16]=d,t[17]=xe,t[18]=Se),(0,Q.useEffect)(xe,Se);let Ce,we;t[19]===v?(Ce=t[20],we=t[21]):(Ce=()=>{T.current=v},we=[v],t[19]=v,t[20]=Ce,t[21]=we),(0,Q.useEffect)(Ce,we);let Te,Ee;t[22]===m?(Te=t[23],Ee=t[24]):(Te=()=>{E.current=m},Ee=[m],t[22]=m,t[23]=Te,t[24]=Ee),(0,Q.useEffect)(Te,Ee);let De,Oe;t[25]===g?(De=t[26],Oe=t[27]):(De=()=>{D.current=g},Oe=[g],t[25]=g,t[26]=De,t[27]=Oe),(0,Q.useEffect)(De,Oe);let ke=v!==null,Ae,je;t[28]!==H||t[29]!==A||t[30]!==b?(Ae=()=>{if(H===null||b||!A)return;let e=!1,t=b$(),n=x$(),r=typeof localStorage<`u`?localStorage:null;return(t?t.project.getSessionState():Promise.resolve(n?kw(r,n,d$):{openTabs:[],pinnedTabIds:[],activeDocName:null,activeTabId:null,updatedAt:null})).then(t=>{if(e)return;let n=Ew(t,d$);if(k.current)return;let r=v$(H);for(let e of n.openTabs){let t=aw(e);t&&r.open(t)}let i=[...n.pinnedTabIds,...w.current],a=n.openTabs;for(let e of C.current)a=pw(a,e,d$,i);let o=sw(i,a);C.current=a,w.current=o,u(e=>j$(e,a)?e:a),f(e=>j$(e,o)?e:o);let s=vw(D.current,a,E.current);D.current=s,_(e=>j$(e,s)?e:s);let l=Rn(window.location.hash),d=n.activeTabId??(n.activeDocName?$C(n.activeDocName):null)??n.openTabs[0]??null,p=d?E$(d):null;if((l===null&&window.location.hash.length===0||p!==null&&p===window.location.hash)&&d){S.current=d,c(d);let e=E$(d);window.location.hash!==e&&(window.location.hash=e)}}).catch(G$).finally(()=>{e||x(!0)}),()=>{e=!0}},je=[H,A,b],t[28]=H,t[29]=A,t[30]=b,t[31]=Ae,t[32]=je):(Ae=t[31],je=t[32]),(0,Q.useEffect)(Ae,je);let Me,Ne;t[33]!==s||t[34]!==a||t[35]!==l||t[36]!==d||t[37]!==r.activeDocName||t[38]!==b?(Me=()=>{if(!b)return;let e=Dw(l,s??k$(a,r.activeDocName),d),t=b$();if(t){t.project.setSessionState(e).catch(W$);return}let n=x$();n&&Aw(typeof localStorage<`u`?localStorage:null,n,e)},Ne=[s,a,l,d,r.activeDocName,b],t[33]=s,t[34]=a,t[35]=l,t[36]=d,t[37]=r.activeDocName,t[38]=b,t[39]=Me,t[40]=Ne):(Me=t[39],Ne=t[40]),(0,Q.useEffect)(Me,Ne);let Pe;t[41]===b?Pe=t[42]:(Pe=function(){b||(k.current=!0)},t[41]=b,t[42]=Pe);let q=Pe,Fe,Ie;t[43]===H?(Fe=t[44],Ie=t[45]):(Fe=()=>{if(H===null)return;let e=!1;j(!1);let t=v$(H);i(P$(t));let n=function(e,t){let n=sw(t,e);C.current=e,w.current=n,u(t=>j$(t,e)?t:e),f(e=>j$(e,n)?e:n);let r=vw(D.current,e,E.current);D.current=r,_(e=>j$(e,r)?e:r)};return t.setOnBranchMismatch(()=>Yx(t)),t.setOnRenameRedirect(e=>{let{fromDocName:r,toDocName:i,hadOpenProvider:a}=e;(async()=>{let e,s=t.getActiveDocName()===r;hC([{fromDocName:r,toDocName:i}]);try{await Promise.all([t.closeAndClearPersistence(r),t.closeAndClearPersistence(i)]),s&&(t.open(i),t.setActive(i));let e=bw(C.current,[{fromDocName:r,toDocName:i}],d$,[],w.current),a=sw(bw(w.current,[{fromDocName:r,toDocName:i}],2**53-1),e);D.current=xw(D.current,[{fromDocName:r,toDocName:i}]),n(e,a),o(e=>e&&(kn(e)===r?{kind:`doc`,target:i,docName:i}:e)),s&&(window.location.hash=Dn(i))}catch(t){let n=t;e=n,console.warn(JSON.stringify({event:`removal-cleanup-error`,kind:`renamed`,fromDocName:r,toDocName:i,message:String(n instanceof Error?n.message:n)}))}console.info(JSON.stringify({event:`removal.cleanup`,kind:`renamed`,fromDocName:r,toDocName:i,hadOpenProvider:a,hadStaleIdb:!a,source:`auth-rejection`,errored:e!==void 0}))})()}),t.setOnDocDeleted(e=>{let{docName:r,hadOpenProvider:i}=e;(async()=>{let e;try{await t.closeAndClearPersistence(r),n(_w(C.current,r),w.current),o(e=>e&&(kn(e)===r?null:e)),t.getActiveDocName()===r&&(window.location.hash=``)}catch(t){let n=t;e=n,console.warn(JSON.stringify({event:`removal-cleanup-error`,kind:`deleted`,docName:r,message:String(n instanceof Error?n.message:n)}))}console.info(JSON.stringify({event:`removal.cleanup`,kind:`deleted`,fromDocName:r,hadOpenProvider:i,hadStaleIdb:!i,source:`auth-rejection`,errored:e!==void 0}))})()}),t.setOnChange(()=>i(P$(t))),fetch(`/api/principal`).then(U$).then(n=>{if(e)return;let r=Re.safeParse(n);r.success?(t.setTabIdentity({principalId:r.data.id,tabSessionId:p$}),N(r.data)):h$(r.error)}).catch(t=>{e||h$(t)}).finally(()=>{e||j(!0)}),Yx(t),()=>{e=!0,t.setOnChange(null),t.setOnRenameRedirect(null),t.setOnDocDeleted(null)}},Ie=[H],t[43]=H,t[44]=Fe,t[45]=Ie),(0,Q.useEffect)(Fe,Ie);let Le;t[46]===H?Le=t[47]:(Le=e=>{if($(`ok/nav/open-document`,{docName:e,transition:!1}),H===null)return;let t=v$(H),n=t.open(e);if(!n)return;zx(e,n.poolEventId);let r=$C(e);fe(e=>pw(e,r,d$,w.current)),ge(r),G(r),t.setActive(e),o({kind:`doc`,target:e,docName:e})},t[46]=H,t[47]=Le);let ze=Le,Be;t[48]===ze?Be=t[49]:(Be=e=>{$(`ok/nav/open-document`,{docName:e,transition:!1}),ze(e)},t[48]=ze,t[49]=Be);let Ve=Be,He;t[50]!==a||t[51]!==H||t[52]!==q||t[53]!==r.activeDocName?(He=(e,t)=>{let n=t===void 0?{}:t;if(H===null)return;n.tabBehavior===`replace-active`&&q();let i=v$(H),s=kn(e),c=T.current,l=c!==null&&n.tabBehavior===`replace-active`,u=c?null:S.current??k$(a,r.activeDocName),d=u!==null&&C.current.includes(u),f=u!==null&&w.current.includes(u),p=n.tabBehavior===`replace-active`&&f||n.tabBehavior===`replace-active`&&!l&&!d?`append`:n.tabBehavior??`append`;if(s&&e.kind!==`large-file`){let e=i.open(s);if(!e)return;zx(s,e.poolEventId);let t=hw(C.current,s,{behavior:p,currentTabId:u,limit:d$,pinnedTabIds:w.current});ue(t.tabs),ge(t.activeTabId),G(t.activeTabId),i.setActive(s)}else{i.clearActive();let t=rw(e);if(t){let e=gw(C.current,t,{behavior:p,currentTabId:u,limit:d$,pinnedTabIds:w.current});ue(e.tabs),G(e.activeTabId),ge(e.activeTabId)}else ge(t)}o(t=>N$(t,e)?t:e)},t[50]=a,t[51]=H,t[52]=q,t[53]=r.activeDocName,t[54]=He):He=t[54];let Ue=He,We;t[55]===Ue?We=t[56]:(We=(e,t)=>{Ue(e,t===void 0?{}:t)},t[55]=Ue,t[56]=We);let Ge=We,Ke;t[57]===Ue?Ke=t[58]:(Ke=(e,t)=>{let n=t===void 0?{}:t;$(`ok/nav/open-target`,{docName:kn(e),kind:e.kind,transition:!1}),Ue(e,n)},t[57]=Ue,t[58]=Ke);let qe=Ke,Je;t[59]!==s||t[60]!==a||t[61]!==H||t[62]!==q||t[63]!==r.activeDocName?(Je=e=>{if(w.current.includes(e))return;q();let t=null,n=aw(e);if(H!==null){let t=v$(H);n&&!A$(C.current,n,new Set([e]))&&t.close(n)}let i=s??k$(a,r.activeDocName);if(fe(n=>(t=ww(n,i,e),_w(n,e))),i===e){if(t){G(t),window.location.hash=E$(t);return}H!==null&&v$(H).clearActive(),o(null),G(null),window.location.hash=``}},t[59]=s,t[60]=a,t[61]=H,t[62]=q,t[63]=r.activeDocName,t[64]=Je):Je=t[64];let Ye=Je,Xe;t[65]!==H||t[66]!==q?(Xe=e=>{q();let t=E.current;if(!t.includes(e))return;let n=t.filter(t=>t!==e);if(me(n),T.current!==e)return;let r=t.indexOf(e),i=n[r]??n[r-1]??null;if(i){re(i),H!==null&&v$(H).clearActive(),o(null),G(null),window.location.hash!==``&&(window.location.hash=``);return}re(null);let a=C.current[C.current.length-1]??null;if(a){G(a),window.location.hash=E$(a);return}H!==null&&v$(H).clearActive(),o(null),G(null),window.location.hash=``},t[65]=H,t[66]=q,t[67]=Xe):Xe=t[67];let Ze=Xe,Qe;t[68]!==Ze||t[69]!==Ye?(Qe=()=>{let e=T.current;if(e)return Ze(e),!0;let t=new Set(w.current),n=new Set(C.current.filter(e=>!t.has(e))),r=(S.current&&n.has(S.current)?S.current:null)??D.current.find(e=>n.has(e));if(r)return Ye(r),!0;let i=new Set(E.current),a=D.current.find(e=>i.has(e));return a?(Ze(a),!0):!1},t[68]=Ze,t[69]=Ye,t[70]=Qe):Qe=t[70];let $e=Qe,et,tt;t[71]===$e?(et=t[72],tt=t[73]):(et=()=>{let e=b$();if(e)return e.onMenuAction(e=>{e===`close-active-tab-or-window`&&($e()||window.close())})},tt=[$e],t[71]=$e,t[72]=et,t[73]=tt),(0,Q.useEffect)(et,tt);let nt;t[74]===H?nt=t[75]:(nt=()=>{if(H===null){o(H$),S.current=null,c(V$);return}let e=v$(H);e.getActiveDocName()!==null&&e.clearActive(),o(B$),S.current=null,c(z$)},t[74]=H,t[75]=nt);let rt;t[76]!==H||t[77]!==q?(rt=e=>{H!==null&&(q(),v$(H).close(e),fe(t=>_w(t,$C(e))),c(t=>{let n=t&&aw(t)===e?null:t;return S.current=n,n}),o(t=>t&&(kn(t)===e?null:t)))},t[76]=H,t[77]=q,t[78]=rt):rt=t[78];let it;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(it=e=>{let t=lw(w.current,e,C.current);j$(w.current,t)||se(t)},t[79]=it):it=t[79];let at;t[80]===q?at=t[81]:(at=e=>{let t=uw(w.current,e);j$(w.current,t)||(q(),se(t))},t[80]=q,t[81]=at);let ot;t[82]===H?ot=t[83]:(ot=e=>{let t=iw(e);if(re(null),G(e),t.kind===`doc`){if(H!==null){let e=v$(H);if(!e.open(t.docName))return;e.setActive(t.docName)}o({kind:`doc`,target:t.docName,docName:t.docName});let e=Dn(t.docName);window.location.hash!==e&&(window.location.hash=e);return}if(H!==null&&v$(H).clearActive(),t.kind===`asset`){o(O$(t.assetPath));let e=Cn(t.assetPath);window.location.hash!==e&&(window.location.hash=e);return}if(t.kind===`skill-file`){o({kind:`skill-file`,target:`${t.scope}/${t.name}/${t.path}`,scope:t.scope,name:t.name,path:t.path});let e=xn({scope:t.scope,name:t.name,path:t.path});window.location.hash!==e&&(window.location.hash=e);return}o({kind:`folder`,target:t.folderPath,folderPath:t.folderPath});let n=Nn(t.folderPath);window.location.hash!==n&&(window.location.hash=n)},t[82]=H,t[83]=ot);let st;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(st=(e,t)=>{let n=new Set(C.current),r=new Set(E.current),i=new Set,a=[],o=[],s=[];for(let t of e)i.has(t)||(n.has(t)?(a.push(t),s.push(t),i.add(t)):r.has(t)&&(o.push(t),s.push(t),i.add(t)));for(let e of C.current)i.has(e)||(a.push(e),s.push(e),i.add(e));for(let e of E.current)i.has(e)||(o.push(e),s.push(e),i.add(e));let c=j$(C.current,a),l=j$(E.current,o),u=j$(D.current,s);c&&l&&u||(D.current=s,l||(E.current=o,h(e=>j$(e,o)?e:o)),ce(a,fw(a,w.current,t)))},t[84]=st):st=t[84];let ct,lt;t[85]===H?(ct=t[86],lt=t[87]):(ct=()=>{let e=`new-tab:${O.current}`;O.current+=1,me([...E.current,e]),re(e),H!==null&&v$(H).clearActive(),o(null),G(null),window.location.hash!==``&&(window.location.hash=``)},lt=e=>{E.current.includes(e)&&(H!==null&&v$(H).clearActive(),o(null),G(null),re(e),window.location.hash!==``&&(window.location.hash=``))},t[85]=H,t[86]=ct,t[87]=lt);let ut;t[88]!==s||t[89]!==a||t[90]!==H||t[91]!==q||t[92]!==r.activeDocName?(ut=(e,t)=>{let n=t===void 0?{}:t,i=e.filter(R$),c=new Set(n.force?i:dw(i,w.current));if(c.size===0)return;if(q(),H!==null){let e=v$(H),t=new Map;for(let e of c){let n=aw(e);if(!n)continue;let r=t.get(n)??new Set;r.add(e),t.set(n,r)}for(let[n,r]of t)A$(C.current,n,r)||e.close(n)}let l=null,u=s??k$(a,r.activeDocName);if(fe(e=>(l=Tw(e,u,c),e.filter(e=>!c.has(e)))),!u||!c.has(u)){u||o(e=>{if(!e)return e;let t=rw(e);return t&&c.has(t)?null:e});return}if(l){G(l),window.location.hash=E$(l);return}H!==null&&v$(H).clearActive(),o(null),G(null),window.location.hash=``},t[88]=s,t[89]=a,t[90]=H,t[91]=q,t[92]=r.activeDocName,t[93]=ut):ut=t[93];let dt;t[94]!==s||t[95]!==a||t[96]!==H||t[97]!==q||t[98]!==l||t[99]!==r.activeDocName?(dt=e=>{let{pages:t,folderPaths:n,assetPaths:i}=e,c=yw(l,{pages:t,folderPaths:n,assetPaths:i,keepMissingDocName:a?.kind===`missing`?a.target:null,keepHashDocName:typeof window<`u`?Rn(window.location.hash):null});if(c.length===l.length)return;let u=new Set(c),d=l.filter(e=>!u.has(e)),f=new Set(d);if(q(),H!==null){let e=v$(H);for(let t of d){let n=aw(t);n&&e.close(n)}}ue(c);let p=typeof window<`u`?D$(window.location.hash):null,m=s??k$(a,r.activeDocName),h=p&&f.has(p)?p:m&&f.has(m)?m:null;if(!h){o(e=>{if(!e)return e;let t=rw(e);return t&&f.has(t)?null:e});return}let g=Tw(l,h,d);if(g){G(g),window.location.hash=E$(g);return}H!==null&&v$(H).clearActive(),o(null),G(null),window.location.hash=``},t[94]=s,t[95]=a,t[96]=H,t[97]=q,t[98]=l,t[99]=r.activeDocName,t[100]=dt):dt=t[100];let ft;t[101]!==H||t[102]!==q?(ft=(e,t,n)=>{let r=t===void 0?[]:t,i=n===void 0?[]:n;q();let a=bw(C.current,e,d$,r,w.current,i),o=sw(bw(w.current,e,2**53-1,r,[],i),a);if(H!==null){let e=v$(H);for(let t of a){let n=aw(t);n&&e.open(n)}}D.current=xw(D.current,e,r,i),ce(a,o);let s=S.current;if(s){let t=bw([s],e,1,r,[],i)[0];t&&a.includes(t)&&G(t)}},t[101]=H,t[102]=q,t[103]=ft):ft=t[103];let pt,mt,ht,gt,_t;t[104]===H?(pt=t[105],mt=t[106],ht=t[107],gt=t[108],_t=t[109]):(pt=async e=>{H!==null&&(await v$(H).closeAndClearPersistence(e),o(t=>t&&(kn(t)===e?null:t)))},mt=()=>H===null?null:v$(H).getActiveDocName(),ht=e=>H===null?!1:v$(H).has(e),gt=e=>{H!==null&&v$(H).recycle(e)},_t=e=>H===null?null:v$(H).prewarm(e)?.poolEventId??null,t[104]=H,t[105]=pt,t[106]=mt,t[107]=ht,t[108]=gt,t[109]=_t);let vt,yt,bt,xt,St;t[110]===H?(vt=t[111],yt=t[112],bt=t[113],xt=t[114],St=t[115]):(vt=e=>{H!==null&&v$(H).setExpectedServerInstanceId(e)},yt=async e=>{if(H===null)return;let t=v$(H);t.setObservedBranch(e),await Bx(t,e),tr([`files`,`backlinks`,`graph`]),nr(e)},bt=async e=>{if(H===null)return;let t=v$(H);t.compareAndUpdateObservedBranch(e)&&(await Bx(t,e),tr([`files`,`backlinks`,`graph`]),nr(e))},xt=(e,t)=>{H!==null&&v$(H).observeDiskAck(e,t)},St=async()=>{H!==null&&await Yx(v$(H))},t[110]=H,t[111]=vt,t[112]=yt,t[113]=bt,t[114]=xt,t[115]=St);let Ct;t[116]!==R||t[117]!==I||t[118]!==r.activeDocName?(Ct=(e,t)=>{if(!r.activeDocName&&t){window.location.hash=Dn(t),z(e),L(`agent`),V(L$);return}if(I===`agent`&&R===e){L(`doc`);return}z(e),L(`agent`),V(I$)},t[116]=R,t[117]=I,t[118]=r.activeDocName,t[119]=Ct):Ct=t[119];let wt;t[120]===Symbol.for(`react.memo_cache_sentinel`)?(wt=()=>{L(`doc`),z(null)},t[120]=wt):wt=t[120];let Tt;t[121]!==v||t[122]!==s||t[123]!==a||t[124]!==$e||t[125]!==Ze||t[126]!==Ye||t[127]!==U||t[128]!==ee||t[129]!==H||t[130]!==R||t[131]!==B||t[132]!==I||t[133]!==ke||t[134]!==m||t[135]!==ze||t[136]!==Ve||t[137]!==l||t[138]!==Ge||t[139]!==qe||t[140]!==d||t[141]!==M||t[142]!==W||t[143]!==r.activeDocName||t[144]!==r.activeProvider||t[145]!==r.poolEntries||t[146]!==r.serverRestartRecovery||t[147]!==r.syncState||t[148]!==P||t[149]!==nt||t[150]!==rt||t[151]!==at||t[152]!==ot||t[153]!==ct||t[154]!==lt||t[155]!==ut||t[156]!==dt||t[157]!==ft||t[158]!==pt||t[159]!==mt||t[160]!==ht||t[161]!==gt||t[162]!==_t||t[163]!==vt||t[164]!==yt||t[165]!==bt||t[166]!==xt||t[167]!==St||t[168]!==Ct||t[169]!==b||t[170]!==g?(Tt={principal:M,activeTarget:a,activeTabId:s,activeDocName:r.activeDocName,activeProvider:r.activeProvider,openTabs:l,pinnedTabIds:d,visibleTabIds:g,tabSessionLoaded:b,syncState:r.syncState,serverRestartRecovery:r.serverRestartRecovery,poolEntries:r.poolEntries,openDocument:ze,openDocumentTransition:Ve,openTarget:Ge,openTargetTransition:qe,clearTarget:nt,closeDocument:rt,closeActiveTabOrWindow:$e,closeTab:Ye,pinTab:it,unpinTab:at,activateTab:ot,reorderTabs:st,newTabIds:m,activeNewTabId:v,isNewTabActive:ke,openNewTab:ct,activateNewTab:lt,closeNewTab:Ze,closeTabs:ut,syncOpenTabsWithKnownTargets:dt,remapTabsForRename:ft,closeAndClearForRename:pt,getPoolActiveDocName:mt,poolHas:ht,recycleDocument:gt,prewarm:_t,systemProvider:P,setSystemProvider:F,updateServerInstanceId:vt,onBranchSwitched:yt,observeBranch:bt,observeDiskAck:xt,refreshServerInfo:St,collabUrl:H,collabTerminal:ee,collabLastError:U,retryCollab:W,docPanelMode:I,docPanelAgentId:R,docPanelExpandSignal:B,openActivityPanel:Ct,closeActivityPanel:wt},t[121]=v,t[122]=s,t[123]=a,t[124]=$e,t[125]=Ze,t[126]=Ye,t[127]=U,t[128]=ee,t[129]=H,t[130]=R,t[131]=B,t[132]=I,t[133]=ke,t[134]=m,t[135]=ze,t[136]=Ve,t[137]=l,t[138]=Ge,t[139]=qe,t[140]=d,t[141]=M,t[142]=W,t[143]=r.activeDocName,t[144]=r.activeProvider,t[145]=r.poolEntries,t[146]=r.serverRestartRecovery,t[147]=r.syncState,t[148]=P,t[149]=nt,t[150]=rt,t[151]=at,t[152]=ot,t[153]=ct,t[154]=lt,t[155]=ut,t[156]=dt,t[157]=ft,t[158]=pt,t[159]=mt,t[160]=ht,t[161]=gt,t[162]=_t,t[163]=vt,t[164]=yt,t[165]=bt,t[166]=xt,t[167]=St,t[168]=Ct,t[169]=b,t[170]=g,t[171]=Tt):Tt=t[171];let Et=Tt,Dt;return t[172]!==n||t[173]!==Et?(Dt=(0,X.jsx)(g$,{value:Et,children:n}),t[172]=n,t[173]=Et,t[174]=Dt):Dt=t[174],Dt}function I$(e){return e+1}function L$(e){return e+1}function R$(e){return e.length>0}function z$(e){return e===null?e:null}function B$(e){return e===null?e:null}function V$(e){return e===null?e:null}function H$(e){return e===null?e:null}function U$(e){return e.ok?e.json():Promise.reject(Error(`HTTP ${e.status}`))}function W$(e){console.warn(`[editor-tabs] failed to persist tab session:`,e)}function G$(e){console.warn(`[editor-tabs] failed to restore tab session:`,e)}function K$(){let e=(0,Q.use)(g$);if(!e)throw Error(`useDocumentContext must be used within <DocumentProvider />`);return e}function q$(){let e=(0,Z.c)(3),{openDocumentTransition:t,openTargetTransition:n}=K$(),r;return e[0]!==t||e[1]!==n?(r={openDocumentTransition:t,openTargetTransition:n},e[0]=t,e[1]=n,e[2]=r):r=e[2],r}export{tR as $,gc as $n,Mx as $t,EJ as A,Bh as An,Bi as Ar,CC as At,xW as B,Pl as Bn,DS as Bt,xY as C,ty as Cn,Qi as Cr,rw as Ct,mY as D,kv as Dn,Gi as Dr,LC as Dt,yY as E,Hv as En,Ki as Er,RC as Et,DG as F,om as Fn,LS as Ft,KU as G,Ll as Gn,CS as Gt,aW as H,eu as Hn,ES as Ht,yG as I,sm as In,QS as It,MB as J,Sc as Jn,iS as Jt,GU as K,Oc as Kn,xS as Kt,XW as L,zf as Ln,ZS as Lt,rK as M,Nh as Mn,Ri as Mr,xC as Mt,tK as N,Lh as Nn,Li as Nr,dC as Nt,YJ as O,Ym as On,Wi as Or,hC as Ot,nK as P,Mh as Pn,MC as Pt,DR as Q,_c as Qn,jx as Qt,IW as R,Tu as Rn,XS as Rt,vY as S,qy as Sn,$i as Sr,Sw as St,bY as T,Ly as Tn,Yi as Tr,zC as Tt,nW as U,Wl as Un,SS as Ut,pW as V,Ml as Vn,TS as Vt,JU as W,Hl as Wn,bS as Wt,WR as X,hc as Xn,qx as Xt,TR as Y,bc as Yn,Xx as Yt,NB as Z,vc as Zn,Rx as Zt,ZZ as _,ob as _n,ca as _r,tw as _t,NQ as a,kx as an,ka as ar,kM as at,KY as b,nb as bn,na as br,ew as bt,jQ as c,Db as cn,xa as cr,vA as ct,YQ as d,yb as dn,va as dr,dk as dt,Cx as en,mc as er,JL as et,kQ as f,Eb as fn,_a as fr,FO as ft,XZ as g,hb as gn,la as gr,pD as gt,cQ as h,mb as hn,ua as hr,pO as ht,PQ as i,Tx as in,Aa as ir,qI as it,yq as j,zh as jn,zi as jr,wC as jt,VJ as k,mg as kn,Ui as kr,fC as kt,XQ as l,Tb as ln,ba as lr,Rk as lt,lQ as m,fb as mn,da as mr,_O as mt,K$ as n,Dx as nn,za as nr,$L as nt,MQ as o,Ex as on,Oa as or,nj as ot,OQ as p,vb as pn,pa as pr,MO as pt,BU as q,$ as qn,sS as qt,q$ as r,Ox as rn,La as rr,JI as rt,FQ as s,Ax as sn,Ta as sr,jA as st,F$ as t,wx as tn,Ka as tr,KL as tt,GQ as u,bb as un,ya as ur,pk as ut,KX as v,sb as vn,sa as vr,$C as vt,SY as w,jy as wn,Zi as wr,nw as wt,TY as x,$y as xn,ta as xr,iw as xt,UX as y,tb as yn,ia as yr,dw as yt,DW as z,wu as zn,US as zt};
|