@inkeep/open-knowledge 0.7.0-beta.10 → 0.7.0-beta.12

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.
Files changed (30) hide show
  1. package/dist/assets/skills/discovery/SKILL.md +1 -1
  2. package/dist/assets/skills/project/SKILL.md +1 -1
  3. package/dist/cli.mjs +4 -4
  4. package/dist/constants-C9WSWL6E.mjs +2 -0
  5. package/dist/index.mjs +1 -1
  6. package/dist/init-BjIga_0S.mjs +1 -0
  7. package/dist/{init-CunaVRVZ.mjs → init-Bvz1uopP.mjs} +3 -3
  8. package/dist/{loader-BzsvSxDc.mjs → loader-7QmmBlnd.mjs} +2 -2
  9. package/dist/loader-dzBchJxr.mjs +1 -0
  10. package/dist/preview-l3z3YFQg.mjs +1 -0
  11. package/dist/{preview-BIJBH1fA.mjs → preview-r_wQsP_5.mjs} +2 -2
  12. package/dist/public/assets/{ActivityModeContent-C_nGfN8W.js → ActivityModeContent-oe_KmZ6Y.js} +1 -1
  13. package/dist/public/assets/{DocumentContext-CBm8YLGb.js → DocumentContext-DbnbvMHR.js} +1 -1
  14. package/dist/public/assets/{SettingsDialogBody-GYre8CjN.js → SettingsDialogBody-BpLMuvP2.js} +1 -1
  15. package/dist/public/assets/{SourceEditor-CJhongAn.js → SourceEditor-BEQlTn2N.js} +1 -1
  16. package/dist/public/assets/{config-validation-events-D0RTRC7o.js → config-validation-events-COByjXe4.js} +1 -1
  17. package/dist/public/assets/{index-DiqK2tn6.js → index-Boa7vp1g.js} +4 -4
  18. package/dist/public/assets/{typing-burst-detector-DqGeUwWw.js → typing-burst-detector-Cik-Z5me.js} +1 -1
  19. package/dist/public/index.html +4 -4
  20. package/dist/{repair-launch-json-Bm5RCuLu.mjs → repair-launch-json-CXmim6Jo.mjs} +2 -2
  21. package/dist/{repair-mcp-configs-CPoWKYLP.mjs → repair-mcp-configs-DGNrIk1W.mjs} +2 -2
  22. package/dist/{src-m-4Jcqfd.mjs → src-BNI8BTEa.mjs} +2 -2
  23. package/dist/start-B78GcjiX.mjs +1 -0
  24. package/dist/{start-CIEWN1Hd.mjs → start-BjFGWmJ6.mjs} +2 -2
  25. package/package.json +1 -1
  26. package/dist/constants-DSHHkn9E.mjs +0 -2
  27. package/dist/init-DZ9fFZoI.mjs +0 -1
  28. package/dist/loader-X-FaB9tm.mjs +0 -1
  29. package/dist/preview-r1zDqs81.mjs +0 -1
  30. package/dist/start-ESWibREv.mjs +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./telemetry-impl-DPRMO_b_.js","./chunk-CFjPhJqf.js","./preload-helper-2ej06EnG.js","./trace-api-CiCjX4Sz.js","./propagation-api-3kmMXRwS.js","./ConsentDialogBody-RTxXUjwn.js","./compiler-runtime-Cs91PcD2.js","./button-DenIdY-r.js","./checkbox-BSqPN8L7.js","./dialog-C1dBa8-m.js","./collapsible-BhpeB6tu.js","./textarea-C_bHQrXh.js","./project-paths-eyh51nmQ.js","./McpConsentDialogBody-cnhKG6kN.js","./label-DCMZaJ38.js","./mcp-consent-store-19Boxoxe.js","./ActivityPanelDiffView-LNHry3BJ.js","./ActivityPanelDiffView-legcy4jI.css","./GraphPanel-D7AmXBQV.js","./prop-types-Cy-YM1RJ.js","./w3c-keyname-B5t0fahT.js","./toggle-group-CaNMUr-8.js","./panel-BNBODYwB.js","./min-CHzARyU6.js","./src-Dz70a8sm.js","./colors-CuFmRbNJ.js","./ordinal-Dk6d5Y-0.js","./init-D-V7N9g_.js","./isObjectLike-HLvQwJYx.js","./now-BN_Nj6nz.js","./isSymbol-BKUBGC2u.js","./target-navigation-intent-Bi7iq3EI.js","./ActivityModeContent-C_nGfN8W.js","./DocumentContext-CBm8YLGb.js","./dist-Cwt7KtW7.js","./dist-sw9fzKjM.js","./dist-DkR43q3h.js","./dist-y5PvfJVO.js","./dist-CadHdAvi.js","./stex-DxnLy7rA.js","./DocumentContext-B0sQn39F.css","./agent-presence-DxGcS3q2.js","./SettingsDialogBody-GYre8CjN.js","./config-validation-events-D0RTRC7o.js","./SourceEditor-CJhongAn.js","./typing-burst-detector-DqGeUwWw.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{a as r,i,n as a,o,r as s,t as c}from"./compiler-runtime-Cs91PcD2.js";import{$ as l,$n as u,$t as d,An as f,At as p,B as m,Bn as h,Bt as g,C as _,Cn as v,Ct as y,D as b,Dn as x,Dt as S,E as C,En as w,Et as T,Fn as E,Ft as D,G as O,Gn as k,Gt as A,H as j,Hn as M,Ht as N,In as P,It as F,J as I,Jn as L,Jt as R,K as z,Kn as B,Kt as V,Ln as H,Lt as U,M as W,Mn as G,Mt as K,Nn as q,Nt as ee,On as te,Ot as ne,P as re,Pn as ie,Pt as ae,Q as oe,Qn as se,Qt as ce,Rn as le,Rt as ue,Sn as de,T as fe,Tn as pe,Tt as me,U as he,Un as ge,Ut as _e,V as ve,Vn as ye,Vt as be,W as xe,Wn as Se,Wt as Ce,X as J,Xn as we,Xt as Te,Y as Ee,Yn as De,Yt as Oe,Z as ke,Zn as Ae,Zt as je,_n as Me,_t as Ne,a as Pe,at as Fe,bn as Ie,bt as Le,c as Re,cr as ze,ct as Be,d as Ve,dr as He,dt as Ue,en as We,er as Ge,et as Y,f as Ke,fr as qe,ft as Je,g as Ye,gn as Xe,gt as Ze,h as Qe,ht as $e,i as et,in as tt,ir as nt,it as rt,jn as it,jt as at,kt as ot,l as st,lr as ct,lt,m as ut,mt as dt,n as ft,nn as pt,nr as mt,nt as ht,o as gt,or as _t,ot as vt,p as yt,pr as bt,pt as xt,qn as St,qt as Ct,r as wt,rr as Tt,rt as Et,s as Dt,st as Ot,t as kt,tn as At,tr as jt,tt as Mt,u as Nt,ur as Pt,ut as Ft,v as It,vn as Lt,vt as Rt,w as zt,wn as Bt,wt as Vt,xn as Ht,y as Ut,yn as Wt,yt as Gt,zn as Kt,zt as qt}from"./DocumentContext-CBm8YLGb.js";import{A as Jt,C as Yt,D as Xt,E as Zt,O as Qt,S as $t,T as en,_ as tn,a as nn,b as rn,c as an,d as on,f as sn,g as cn,h as ln,i as un,k as dn,l as fn,m as pn,n as mn,o as hn,p as gn,r as _n,s as vn,t as yn,u as bn,v as xn,w as Sn,x as Cn,y as wn}from"./panel-BNBODYwB.js";import{$ as Tn,A as En,Ai as Dn,An as On,Ar as kn,B as An,Bn as jn,Br as Mn,D as Nn,Di as Pn,Dn as Fn,Dr as In,Dt as Ln,E as Rn,Ei as X,Et as zn,Fn as Bn,G as Vn,H as Hn,Hn as Un,Hr as Wn,In as Gn,J as Kn,Jn as qn,K as Jn,Kn as Yn,Ln as Xn,Lr as Zn,M as Qn,Mr as $n,Mt as er,N as tr,Nr as nr,Nt as rr,O as ir,Oi as ar,On as or,Or as sr,P as cr,Pn as lr,Pr as ur,Qt as dr,Sn as fr,T as pr,Tt as mr,U as hr,V as gr,Vn as _r,Vr as vr,Vt as yr,W as br,Wn as xr,Xr as Sr,Xt as Cr,Y as wr,Yn as Tr,Yr as Er,Zr as Dr,_n as Or,_t as kr,a as Ar,bn as jr,br as Mr,bt as Nr,c as Pr,cn as Fr,cr as Ir,d as Lr,di as Rr,ei as zr,et as Br,f as Vr,h as Hr,i as Ur,ir as Wr,j as Gr,ji as Kr,jn as qr,jr as Jr,k as Yr,ki as Xr,kn as Zr,kt as Qr,l as $r,li as ei,m as ti,mn as ni,n as ri,nt as ii,o as ai,ot as oi,p as si,q as ci,r as li,ri as ui,s as di,si as fi,sr as pi,ti as mi,tn as hi,u as gi,ui as _i,wt as vi,x as yi,xn as bi,xt as xi,y as Si,yn as Ci,zr as wi}from"./prop-types-Cy-YM1RJ.js";import{C as Ti,S as Ei,d as Di,g as Oi,l as ki,m as Ai,o as ji,p as Mi,t as Ni,w as Pi,x as Fi}from"./button-DenIdY-r.js";import{a as Ii,c as Li,d as Ri,f as zi,i as Bi,l as Vi,m as Hi,n as Ui,o as Wi,p as Gi,r as Ki,s as qi,t as Ji,u as Yi}from"./agent-presence-DxGcS3q2.js";import{$ as Xi,A as Zi,At as Qi,B as $i,Bt as ea,C as ta,Ct as na,D as ra,Dt as ia,E as aa,Et as oa,F as sa,Ft as ca,G as la,H as ua,Ht as da,I as fa,It as pa,J as ma,K as ha,L as ga,Lt as _a,M as va,Mt as ya,N as ba,Nt as xa,O as Sa,Ot as Ca,P as wa,Pt as Ta,Q as Ea,R as Da,Rt as Oa,S as ka,St as Aa,T as ja,Tt as Ma,U as Na,Ut as Pa,V as Fa,W as Ia,Wt as La,X as Ra,Y as za,Z as Ba,_ as Va,_t as Ha,a as Ua,at as Wa,b as Ga,bt as Ka,ct as qa,dt as Ja,et as Ya,ft as Xa,g as Za,gt as Qa,h as $a,ht as eo,it as to,j as no,jt as ro,k as io,kt as ao,lt as oo,m as so,mt as co,nt as lo,o as uo,ot as fo,p as po,pt as mo,q as ho,r as go,rt as _o,st as vo,t as yo,tt as bo,u as xo,ut as So,v as Co,vt as wo,w as To,wt as Eo,x as Do,xt as Oo,y as ko,yt as Ao,z as jo,zt as Mo}from"./config-validation-events-D0RTRC7o.js";import{n as No,r as Po,s as Fo,t as Io}from"./toggle-group-CaNMUr-8.js";import{C as Lo,S as Ro,a as zo,b as Bo,c as Vo,d as Ho,f as Uo,h as Wo,i as Go,m as Ko,n as qo,o as Jo,p as Yo,s as Xo,t as Zo,u as Qo,x as $o}from"./dialog-C1dBa8-m.js";import{a as es,i as ts,n as ns,r as rs,t as is}from"./collapsible-BhpeB6tu.js";import{t as as}from"./checkbox-BSqPN8L7.js";import{t as os}from"./label-DCMZaJ38.js";import{i as ss,n as cs,r as ls}from"./project-paths-eyh51nmQ.js";import{n as us,t as ds}from"./mcp-consent-store-19Boxoxe.js";import{$ as fs,At as ps,Ct as ms,Dt as hs,Ft as gs,I as _s,It as vs,J as ys,Mt as bs,Ot as xs,Pt as Ss,Q as Cs,Tt as ws,X as Ts,Z as Es,at as Ds,bt as Os,c as ks,jt as As,k as js,w as Ms}from"./dist-sw9fzKjM.js";import{n as Ns}from"./dist-DkR43q3h.js";import{n as Ps,o as Fs,r as Is,t as Ls}from"./typing-burst-detector-DqGeUwWw.js";import{t as Rs}from"./target-navigation-intent-Bi7iq3EI.js";import"./textarea-C_bHQrXh.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function zs(){({BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1})?.VITE_OTEL_ENABLED===`true`&&n(()=>import(`./telemetry-impl-DPRMO_b_.js`).then(e=>e.install()),__vite__mapDeps([0,1,2,3,4]),import.meta.url)}function Bs(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{cn(e,()=>t.signal,()=>n=!0)},u=wn(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject();if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?xn:tn;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?Hs:Vs,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Vs(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function Vs(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Hs(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Us=class extends sn{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Ws(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=gn({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){this.state=(t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}})(this.state),ln.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Ws(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Gs=class extends Jt{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new Us({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Ks(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Ks(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Ks(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=Ks(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){ln.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Yt(t,e))}findAll(e={}){return this.getAll().filter(t=>Yt(e,t))}notify(e){ln.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return ln.batch(()=>Promise.all(e.map(e=>e.continue().catch(en))))}};function Ks(e){return e.options.scope?.id}var qs=class extends Jt{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??$t(r,t),a=this.get(i);return a||(a=new on({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){ln.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Sn(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Sn(e,t)):t}notify(e){ln.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){ln.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){ln.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Js=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new qs,this.#t=e.mutationCache||new Gs,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=dn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=pn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Xt(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=rn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return ln.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;ln.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return ln.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=ln.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(en).catch(en)}invalidateQueries(e,t={}){return ln.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=ln.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(en)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(en)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Xt(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(en).catch(en)}fetchInfiniteQuery(e){return e.behavior=Bs(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(en).catch(en)}ensureInfiniteQueryData(e){return e.behavior=Bs(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return pn.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(Cn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Zt(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Cn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Zt(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=$t(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===Qt&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Ys=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Xs=t(((e,t)=>{t.exports=Ys()})),Zs=t((e=>{var t=Xs(),n=r(),i=Pi();function a(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function s(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function c(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function u(e){if(s(e)!==e)throw Error(a(188))}function d(e){var t=e.alternate;if(!t){if(t=s(e),t===null)throw Error(a(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var o=i.alternate;if(o===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return u(i),e;if(o===r)return u(i),t;o=o.sibling}throw Error(a(188))}if(n.return!==r.return)n=i,r=o;else{for(var c=!1,l=i.child;l;){if(l===n){c=!0,n=i,r=o;break}if(l===r){c=!0,r=i,n=o;break}l=l.sibling}if(!c){for(l=o.child;l;){if(l===n){c=!0,n=o,r=i;break}if(l===r){c=!0,r=o,n=i;break}l=l.sibling}if(!c)throw Error(a(189))}}if(n.alternate!==r)throw Error(a(190))}if(n.tag!==3)throw Error(a(188));return n.stateNode.current===n?e:t}function f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}var p=Object.assign,m=Symbol.for(`react.element`),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),D=Symbol.for(`react.activity`),O=Symbol.for(`react.memo_cache_sentinel`),k=Symbol.iterator;function A(e){return typeof e!=`object`||!e?null:(e=k&&e[k]||e[`@@iterator`],typeof e==`function`?e:null)}var j=Symbol.for(`react.client.reference`);function M(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===j?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case w:return`SuspenseList`;case D:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case T:return t=e.displayName||null,t===null?M(e.type)||`Memo`:t;case E:t=e._payload,e=e._init;try{return M(e(t))}catch{}}return null}var N=Array.isArray,P=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I={pending:!1,data:null,method:null,action:null},L=[],R=-1;function z(e){return{current:e}}function B(e){0>R||(e.current=L[R],L[R]=null,R--)}function V(e,t){R++,L[R]=e.current,e.current=t}var H=z(null),U=z(null),W=z(null),G=z(null);function K(e,t){switch(V(W,t),V(U,e),V(H,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}B(H),V(H,e)}function q(){B(H),B(U),B(W)}function ee(e){e.memoizedState!==null&&V(G,e);var t=H.current,n=Hd(t,e.type);t!==n&&(V(U,e),V(H,n))}function te(e){U.current===e&&(B(H),B(U)),G.current===e&&(B(G),Qf._currentValue=I)}var ne,re;function ie(e){if(ne===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ne=t&&t[1]||``,re=-1<e.stack.indexOf(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./telemetry-impl-DPRMO_b_.js","./chunk-CFjPhJqf.js","./preload-helper-2ej06EnG.js","./trace-api-CiCjX4Sz.js","./propagation-api-3kmMXRwS.js","./ConsentDialogBody-RTxXUjwn.js","./compiler-runtime-Cs91PcD2.js","./button-DenIdY-r.js","./checkbox-BSqPN8L7.js","./dialog-C1dBa8-m.js","./collapsible-BhpeB6tu.js","./textarea-C_bHQrXh.js","./project-paths-eyh51nmQ.js","./McpConsentDialogBody-cnhKG6kN.js","./label-DCMZaJ38.js","./mcp-consent-store-19Boxoxe.js","./ActivityPanelDiffView-LNHry3BJ.js","./ActivityPanelDiffView-legcy4jI.css","./GraphPanel-D7AmXBQV.js","./prop-types-Cy-YM1RJ.js","./w3c-keyname-B5t0fahT.js","./toggle-group-CaNMUr-8.js","./panel-BNBODYwB.js","./min-CHzARyU6.js","./src-Dz70a8sm.js","./colors-CuFmRbNJ.js","./ordinal-Dk6d5Y-0.js","./init-D-V7N9g_.js","./isObjectLike-HLvQwJYx.js","./now-BN_Nj6nz.js","./isSymbol-BKUBGC2u.js","./target-navigation-intent-Bi7iq3EI.js","./ActivityModeContent-oe_KmZ6Y.js","./DocumentContext-DbnbvMHR.js","./dist-Cwt7KtW7.js","./dist-sw9fzKjM.js","./dist-DkR43q3h.js","./dist-y5PvfJVO.js","./dist-CadHdAvi.js","./stex-DxnLy7rA.js","./DocumentContext-B0sQn39F.css","./agent-presence-DxGcS3q2.js","./SettingsDialogBody-BpLMuvP2.js","./config-validation-events-COByjXe4.js","./SourceEditor-BEQlTn2N.js","./typing-burst-detector-Cik-Z5me.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{a as r,i,n as a,o,r as s,t as c}from"./compiler-runtime-Cs91PcD2.js";import{$ as l,$n as u,$t as d,An as f,At as p,B as m,Bn as h,Bt as g,C as _,Cn as v,Ct as y,D as b,Dn as x,Dt as S,E as C,En as w,Et as T,Fn as E,Ft as D,G as O,Gn as k,Gt as A,H as j,Hn as M,Ht as N,In as P,It as F,J as I,Jn as L,Jt as R,K as z,Kn as B,Kt as V,Ln as H,Lt as U,M as W,Mn as G,Mt as K,Nn as q,Nt as ee,On as te,Ot as ne,P as re,Pn as ie,Pt as ae,Q as oe,Qn as se,Qt as ce,Rn as le,Rt as ue,Sn as de,T as fe,Tn as pe,Tt as me,U as he,Un as ge,Ut as _e,V as ve,Vn as ye,Vt as be,W as xe,Wn as Se,Wt as Ce,X as J,Xn as we,Xt as Te,Y as Ee,Yn as De,Yt as Oe,Z as ke,Zn as Ae,Zt as je,_n as Me,_t as Ne,a as Pe,at as Fe,bn as Ie,bt as Le,c as Re,cr as ze,ct as Be,d as Ve,dr as He,dt as Ue,en as We,er as Ge,et as Y,f as Ke,fr as qe,ft as Je,g as Ye,gn as Xe,gt as Ze,h as Qe,ht as $e,i as et,in as tt,ir as nt,it as rt,jn as it,jt as at,kt as ot,l as st,lr as ct,lt,m as ut,mt as dt,n as ft,nn as pt,nr as mt,nt as ht,o as gt,or as _t,ot as vt,p as yt,pr as bt,pt as xt,qn as St,qt as Ct,r as wt,rr as Tt,rt as Et,s as Dt,st as Ot,t as kt,tn as At,tr as jt,tt as Mt,u as Nt,ur as Pt,ut as Ft,v as It,vn as Lt,vt as Rt,w as zt,wn as Bt,wt as Vt,xn as Ht,y as Ut,yn as Wt,yt as Gt,zn as Kt,zt as qt}from"./DocumentContext-DbnbvMHR.js";import{A as Jt,C as Yt,D as Xt,E as Zt,O as Qt,S as $t,T as en,_ as tn,a as nn,b as rn,c as an,d as on,f as sn,g as cn,h as ln,i as un,k as dn,l as fn,m as pn,n as mn,o as hn,p as gn,r as _n,s as vn,t as yn,u as bn,v as xn,w as Sn,x as Cn,y as wn}from"./panel-BNBODYwB.js";import{$ as Tn,A as En,Ai as Dn,An as On,Ar as kn,B as An,Bn as jn,Br as Mn,D as Nn,Di as Pn,Dn as Fn,Dr as In,Dt as Ln,E as Rn,Ei as X,Et as zn,Fn as Bn,G as Vn,H as Hn,Hn as Un,Hr as Wn,In as Gn,J as Kn,Jn as qn,K as Jn,Kn as Yn,Ln as Xn,Lr as Zn,M as Qn,Mr as $n,Mt as er,N as tr,Nr as nr,Nt as rr,O as ir,Oi as ar,On as or,Or as sr,P as cr,Pn as lr,Pr as ur,Qt as dr,Sn as fr,T as pr,Tt as mr,U as hr,V as gr,Vn as _r,Vr as vr,Vt as yr,W as br,Wn as xr,Xr as Sr,Xt as Cr,Y as wr,Yn as Tr,Yr as Er,Zr as Dr,_n as Or,_t as kr,a as Ar,bn as jr,br as Mr,bt as Nr,c as Pr,cn as Fr,cr as Ir,d as Lr,di as Rr,ei as zr,et as Br,f as Vr,h as Hr,i as Ur,ir as Wr,j as Gr,ji as Kr,jn as qr,jr as Jr,k as Yr,ki as Xr,kn as Zr,kt as Qr,l as $r,li as ei,m as ti,mn as ni,n as ri,nt as ii,o as ai,ot as oi,p as si,q as ci,r as li,ri as ui,s as di,si as fi,sr as pi,ti as mi,tn as hi,u as gi,ui as _i,wt as vi,x as yi,xn as bi,xt as xi,y as Si,yn as Ci,zr as wi}from"./prop-types-Cy-YM1RJ.js";import{C as Ti,S as Ei,d as Di,g as Oi,l as ki,m as Ai,o as ji,p as Mi,t as Ni,w as Pi,x as Fi}from"./button-DenIdY-r.js";import{a as Ii,c as Li,d as Ri,f as zi,i as Bi,l as Vi,m as Hi,n as Ui,o as Wi,p as Gi,r as Ki,s as qi,t as Ji,u as Yi}from"./agent-presence-DxGcS3q2.js";import{$ as Xi,A as Zi,At as Qi,B as $i,Bt as ea,C as ta,Ct as na,D as ra,Dt as ia,E as aa,Et as oa,F as sa,Ft as ca,G as la,H as ua,Ht as da,I as fa,It as pa,J as ma,K as ha,L as ga,Lt as _a,M as va,Mt as ya,N as ba,Nt as xa,O as Sa,Ot as Ca,P as wa,Pt as Ta,Q as Ea,R as Da,Rt as Oa,S as ka,St as Aa,T as ja,Tt as Ma,U as Na,Ut as Pa,V as Fa,W as Ia,Wt as La,X as Ra,Y as za,Z as Ba,_ as Va,_t as Ha,a as Ua,at as Wa,b as Ga,bt as Ka,ct as qa,dt as Ja,et as Ya,ft as Xa,g as Za,gt as Qa,h as $a,ht as eo,it as to,j as no,jt as ro,k as io,kt as ao,lt as oo,m as so,mt as co,nt as lo,o as uo,ot as fo,p as po,pt as mo,q as ho,r as go,rt as _o,st as vo,t as yo,tt as bo,u as xo,ut as So,v as Co,vt as wo,w as To,wt as Eo,x as Do,xt as Oo,y as ko,yt as Ao,z as jo,zt as Mo}from"./config-validation-events-COByjXe4.js";import{n as No,r as Po,s as Fo,t as Io}from"./toggle-group-CaNMUr-8.js";import{C as Lo,S as Ro,a as zo,b as Bo,c as Vo,d as Ho,f as Uo,h as Wo,i as Go,m as Ko,n as qo,o as Jo,p as Yo,s as Xo,t as Zo,u as Qo,x as $o}from"./dialog-C1dBa8-m.js";import{a as es,i as ts,n as ns,r as rs,t as is}from"./collapsible-BhpeB6tu.js";import{t as as}from"./checkbox-BSqPN8L7.js";import{t as os}from"./label-DCMZaJ38.js";import{i as ss,n as cs,r as ls}from"./project-paths-eyh51nmQ.js";import{n as us,t as ds}from"./mcp-consent-store-19Boxoxe.js";import{$ as fs,At as ps,Ct as ms,Dt as hs,Ft as gs,I as _s,It as vs,J as ys,Mt as bs,Ot as xs,Pt as Ss,Q as Cs,Tt as ws,X as Ts,Z as Es,at as Ds,bt as Os,c as ks,jt as As,k as js,w as Ms}from"./dist-sw9fzKjM.js";import{n as Ns}from"./dist-DkR43q3h.js";import{n as Ps,o as Fs,r as Is,t as Ls}from"./typing-burst-detector-Cik-Z5me.js";import{t as Rs}from"./target-navigation-intent-Bi7iq3EI.js";import"./textarea-C_bHQrXh.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function zs(){({BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1})?.VITE_OTEL_ENABLED===`true`&&n(()=>import(`./telemetry-impl-DPRMO_b_.js`).then(e=>e.install()),__vite__mapDeps([0,1,2,3,4]),import.meta.url)}function Bs(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{cn(e,()=>t.signal,()=>n=!0)},u=wn(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject();if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?xn:tn;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?Hs:Vs,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Vs(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function Vs(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Hs(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Us=class extends sn{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Ws(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=gn({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){this.state=(t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}})(this.state),ln.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Ws(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Gs=class extends Jt{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new Us({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Ks(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Ks(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Ks(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=Ks(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){ln.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Yt(t,e))}findAll(e={}){return this.getAll().filter(t=>Yt(e,t))}notify(e){ln.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return ln.batch(()=>Promise.all(e.map(e=>e.continue().catch(en))))}};function Ks(e){return e.options.scope?.id}var qs=class extends Jt{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??$t(r,t),a=this.get(i);return a||(a=new on({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){ln.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Sn(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Sn(e,t)):t}notify(e){ln.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){ln.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){ln.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Js=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new qs,this.#t=e.mutationCache||new Gs,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=dn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=pn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Xt(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=rn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return ln.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;ln.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return ln.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=ln.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(en).catch(en)}invalidateQueries(e,t={}){return ln.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=ln.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(en)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(en)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Xt(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(en).catch(en)}fetchInfiniteQuery(e){return e.behavior=Bs(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(en).catch(en)}ensureInfiniteQueryData(e){return e.behavior=Bs(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return pn.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(Cn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Zt(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Cn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Zt(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=$t(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===Qt&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Ys=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Xs=t(((e,t)=>{t.exports=Ys()})),Zs=t((e=>{var t=Xs(),n=r(),i=Pi();function a(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function s(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function c(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function u(e){if(s(e)!==e)throw Error(a(188))}function d(e){var t=e.alternate;if(!t){if(t=s(e),t===null)throw Error(a(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var o=i.alternate;if(o===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return u(i),e;if(o===r)return u(i),t;o=o.sibling}throw Error(a(188))}if(n.return!==r.return)n=i,r=o;else{for(var c=!1,l=i.child;l;){if(l===n){c=!0,n=i,r=o;break}if(l===r){c=!0,r=i,n=o;break}l=l.sibling}if(!c){for(l=o.child;l;){if(l===n){c=!0,n=o,r=i;break}if(l===r){c=!0,r=o,n=i;break}l=l.sibling}if(!c)throw Error(a(189))}}if(n.alternate!==r)throw Error(a(190))}if(n.tag!==3)throw Error(a(188));return n.stateNode.current===n?e:t}function f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}var p=Object.assign,m=Symbol.for(`react.element`),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),D=Symbol.for(`react.activity`),O=Symbol.for(`react.memo_cache_sentinel`),k=Symbol.iterator;function A(e){return typeof e!=`object`||!e?null:(e=k&&e[k]||e[`@@iterator`],typeof e==`function`?e:null)}var j=Symbol.for(`react.client.reference`);function M(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===j?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case w:return`SuspenseList`;case D:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case T:return t=e.displayName||null,t===null?M(e.type)||`Memo`:t;case E:t=e._payload,e=e._init;try{return M(e(t))}catch{}}return null}var N=Array.isArray,P=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I={pending:!1,data:null,method:null,action:null},L=[],R=-1;function z(e){return{current:e}}function B(e){0>R||(e.current=L[R],L[R]=null,R--)}function V(e,t){R++,L[R]=e.current,e.current=t}var H=z(null),U=z(null),W=z(null),G=z(null);function K(e,t){switch(V(W,t),V(U,e),V(H,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}B(H),V(H,e)}function q(){B(H),B(U),B(W)}function ee(e){e.memoizedState!==null&&V(G,e);var t=H.current,n=Hd(t,e.type);t!==n&&(V(U,e),V(H,n))}function te(e){U.current===e&&(B(H),B(U)),G.current===e&&(B(G),Qf._currentValue=I)}var ne,re;function ie(e){if(ne===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ne=t&&t[1]||``,re=-1<e.stack.indexOf(`
3
3
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
4
  `+ne+e+re}var ae=!1;function oe(e,t){if(!e||ae)return``;ae=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,`props`,{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,`name`,{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
5
5
  `),l=s.split(`
@@ -20,7 +20,7 @@ Error generating stack: `+e.message+`
20
20
  `}function zg(e,t,n,r,i,a,o){if(typeof o==`function`&&(o={callback:o}),o?.callback){let{callback:s}=o;Lg(e,t,n,r,i,a,Object.assign(Object.assign({},o),{callback:e=>{s(e?Rg(e,o.headerOptions):void 0)}}))}else{let s=Lg(e,t,n,r,i,a,o);return s?Rg(s,o?.headerOptions):void 0}}function Bg(e,t,n,r,i,a){return zg(e,e,t,n,r,i,a)}function Vg(e){let t=e.endsWith(`
21
21
  `),n=e.split(`
22
22
  `).map(e=>e+`
23
- `);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function Hg(e,t){return`${e}\u0000${t}`}function Ug(e,t,n){let r=nr(e).body,i=nr(t).body;return r===i?``:Bg(n,r,i,``,``,{context:3})}function Wg(e,t,n){let r=(0,$.c)(8),{activeProvider:i}=ft(),a;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={status:`idle`,diff:null},r[0]=a):a=r[0];let[o,s]=(0,Q.useState)(a),c=(0,Q.useRef)(i),l;r[1]===i?l=r[2]:(l=()=>{c.current=i},r[1]=i,r[2]=l),(0,Q.useEffect)(l);let u,d;return r[3]!==n||r[4]!==t||r[5]!==e?(u=()=>{if(!e){s({status:`idle`,diff:null});return}let r=e,i=!1;return s({status:`loading`,diff:null}),(async function(){try{let e=Hg(t,r),a=n.get(e);if(a===void 0){let o=await fetch(`/api/history/${r}?docName=${encodeURIComponent(t)}`);if(i)return;if(!o.ok){s({status:`error`,diff:null});return}let c=await o.json();if(i)return;a=c.content??``,n.set(e,a)}if(i)return;let o=c.current?.document.getText(`source`).toString()??``,l=Ug(a,o,t);if(i)return;s({status:`ready`,diff:l})}catch(e){i||(console.error(`[timeline-diff] failed to load entry diff`,{sha:r,docName:t,err:e}),s({status:`error`,diff:null}))}})(),()=>{i=!0}},d=[e,t,n],r[3]=n,r[4]=t,r[5]=e,r[6]=u,r[7]=d):(u=r[6],d=r[7]),(0,Q.useEffect)(u,d),o}var Gg=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityPanelDiffView-LNHry3BJ.js`),__vite__mapDeps([16,1,6,17]),import.meta.url)).ActivityPanelDiffView}));function Kg(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/1e3);if(r<60)return X._({id:`xOTzt5`});if(r<3600){let e=Math.floor(r/60);return X._({id:`UyROxs`,values:{mins:e}})}if(r<86400){let e=Math.floor(r/3600);return X._({id:`wXO4Tg`,values:{hrs:e}})}if(r<86400*2)return X._({id:`rQRrkB`});let i=Math.floor(r/86400);return i<7?X._({id:`6u9LvN`,values:{days:i}}):t.toLocaleDateString()}function qg(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function Jg(e){return e.slice(0,7)}function Yg(e){return e.type===`upstream`?X._({id:`K_vT1F`}):e.contributors.length===1?e.contributors[0].name:e.contributors.length>1?e.contributors.map(e=>e.name).join(`, `):e.author===`openknowledge-server`||e.author===`server`?X._({id:`B2DrPb`}):e.author}function Xg(e){let t=(0,$.c)(17),n,r;if(t[0]===e?(n=t[1],r=t[2]):({icon:n,...r}=e,t[0]=e,t[1]=n,t[2]=r),n===`claude`){let e;return t[3]===r?e=t[4]:(e=(0,Z.jsx)(Ri,{...r}),t[3]=r,t[4]=e),e}if(n===`cursor`){let e;return t[5]===r?e=t[6]:(e=(0,Z.jsx)(Wi,{...r}),t[5]=r,t[6]=e),e}if(n===`windsurf`){let e;return t[7]===r?e=t[8]:(e=(0,Z.jsx)(Ii,{...r}),t[7]=r,t[8]=e),e}if(n===`openai`){let e;return t[9]===r?e=t[10]:(e=(0,Z.jsx)(Vi,{...r}),t[9]=r,t[10]=e),e}if(n===`cline`){let e;return t[11]===r?e=t[12]:(e=(0,Z.jsx)(Yi,{...r}),t[11]=r,t[12]=e),e}if(n===`github`){let e;return t[13]===r?e=t[14]:(e=(0,Z.jsx)(qi,{...r}),t[13]=r,t[14]=e),e}let i=r,a;return t[15]===i?a=t[16]:(a=(0,Z.jsx)(Gi,{strokeWidth:1.5,...i}),t[15]=i,t[16]=a),a}function Zg(e){let t=(0,$.c)(17),{entry:n,isDark:r}=e;if(n.type===`upstream`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Ae,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[0]=e):e=t[0],e}if(n.contributors.length>0){let e=n.contributors[0],i=e.colorSeed??e.name,a;t[1]===i?a=t[2]:(a=Tr(i),t[1]=i,t[2]=a);let o=a,s=r?Br[o]??Tn[o]:Tn[o],c;t[3]!==s||t[4]!==i?(c=s??Fn(i),t[3]=s,t[4]=i,t[5]=c):c=t[5];let l=c;if(o!==`bot`){let e;t[6]===l?e=t[7]:(e={color:l},t[6]=l,t[7]=e);let n;return t[8]!==o||t[9]!==e?(n=(0,Z.jsx)(Xg,{icon:o,width:14,height:14,className:`shrink-0`,style:e}),t[8]=o,t[9]=e,t[10]=n):n=t[10],n}if(e.name===`File System`){let e;return t[11]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(kc,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[11]=e):e=t[11],e}if(e.name===`Open Knowledge (service)`||e.name===`Git (upstream)`){let e;return t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)($s,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[12]=e):e=t[12],e}let u;return t[13]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(gl,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[13]=u):u=t[13],u}if(n.authorEmail.includes(`agent`)||n.author.includes(`agent`)||n.authorEmail.includes(`cursor`)||n.authorEmail.includes(`claude`)){let e;return t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Gi,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[14]=e):e=t[14],e}if(n.author===`openknowledge-server`||n.author===`server`){let e;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)($s,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[15]=e):e=t[15],e}let i;return t[16]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(gl,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[16]=i):i=t[16],i}function Qg(e){let t=(0,$.c)(23),{entries:n,defaultExpanded:r,isDark:i,diffLayout:a,cache:o,docName:s,expandedShas:c,onToggleExpanded:l,onRestoreSuccess:u}=e,[d,f]=(0,Q.useState)(r),p=n.length;if(n.length===0)return null;let m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>f($g),t[0]=m):m=t[0];let h;t[1]===d?h=t[2]:(h=d?(0,Z.jsx)(ct,{className:`size-3`}):(0,Z.jsx)(es,{className:`size-3`}),t[1]=d,t[2]=h);let g;t[3]!==p||t[4]!==d?(g=d?X._({id:`OKQe56`,values:{entryCount:p}}):X._({id:`k9jDvw`,values:{entryCount:p}}),t[3]=p,t[4]=d,t[5]=g):g=t[5];let _;t[6]!==d||t[7]!==h||t[8]!==g?(_=(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":d,className:`flex items-center gap-1.5 rounded-lg px-3 py-2 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/80 transition-colors text-left`,onClick:m,children:[h,g]}),t[6]=d,t[7]=h,t[8]=g,t[9]=_):_=t[9];let v;t[10]!==o||t[11]!==a||t[12]!==s||t[13]!==n||t[14]!==d||t[15]!==c||t[16]!==i||t[17]!==u||t[18]!==l?(v=d&&n.map(e=>(0,Z.jsx)(d_,{entry:e,isDark:i,diffLayout:a,cache:o,docName:s,expanded:c.has(e.sha),onToggleExpanded:l,onRestoreSuccess:u},e.sha)),t[10]=o,t[11]=a,t[12]=s,t[13]=n,t[14]=d,t[15]=c,t[16]=i,t[17]=u,t[18]=l,t[19]=v):v=t[19];let y;return t[20]!==_||t[21]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[_,v]}),t[20]=_,t[21]=v,t[22]=y):y=t[22],y}function $g(e){return!e}function e_(e){return e.checkpoint?e.checkpoint.kind:`save`}function t_(e){let t=e_(e);if(t===`save`)return X._({id:`gsePqm`});let n=e.checkpoint?.size??null,r=n!=null&&n>0?` (${n_(n)})`:``;return t===`bridge-merge-loss`?X._({id:`uZAG7T`,values:{sizeSuffix:r}}):X._({id:`_4rAQI`,values:{sizeSuffix:r}})}function n_(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/102.4)/10} KB`:`${Math.round(e/104857.6)/10} MB`}function r_(e){return e.type===`checkpoint`?e_(e)===`save`?`version`:`auto-save`:`wip`}function i_(e){let t=r_(e);return t===`version`?X._({id:`RFQ1Yx`}):t===`auto-save`?X._({id:`9Uv1CD`}):X._({id:`Yea-K5`})}function a_(e){let t=r_(e);return t===`version`?X._({id:`gg3Rpy`}):t===`auto-save`?X._({id:`PXXeW8`}):X._({id:`Pyp1NA`})}function o_(e){let t=[];for(let n of e.contributors)if(n.summaries)for(let e of n.summaries)t.push(e);return t}function s_(e){let t=(0,$.c)(21),{summaries:n}=e,[r,i]=(0,Q.useState)(!1),a=(0,Q.useId)();if(n.length===0)return null;let o,c;t[0]===n?(o=t[1],c=t[2]):([o,...c]=n,t[0]=n,t[1]=o,t[2]=c);let l=c.length,u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`• `}),t[3]=u):u=t[3];let d;t[4]===o?d=t[5]:(d=(0,Z.jsxs)(`li`,{className:`text-xs text-foreground/90`,children:[u,o]}),t[4]=o,t[5]=d);let f;t[6]!==r||t[7]!==c?(f=r&&c.map(l_),t[6]=r,t[7]=c,t[8]=f):f=t[8];let p;t[9]!==a||t[10]!==d||t[11]!==f?(p=(0,Z.jsxs)(`ul`,{id:a,className:`list-none`,children:[d,f]}),t[9]=a,t[10]=d,t[11]=f,t[12]=p):p=t[12];let m;t[13]!==r||t[14]!==l||t[15]!==a||t[16]!==c.length?(m=c.length>0&&(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":r,"aria-controls":a,className:`inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,onClick:e=>{e.stopPropagation(),i(c_)},children:[r?(0,Z.jsx)(ct,{className:`size-3`}):(0,Z.jsx)(es,{className:`size-3`}),r?(0,Z.jsx)(s,{id:`vLyv1R`}):(0,Z.jsx)(s,{id:`ZptNUh`,values:{hidden:l}})]}),t[13]=r,t[14]=l,t[15]=a,t[16]=c.length,t[17]=m):m=t[17];let h;return t[18]!==p||t[19]!==m?(h=(0,Z.jsxs)(`div`,{className:`mt-0.5`,children:[p,m]}),t[18]=p,t[19]=m,t[20]=h):h=t[20],h}function c_(e){return!e}function l_(e,t){return(0,Z.jsxs)(`li`,{className:`text-xs text-foreground/90`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`• `}),e]},`${t}-${e}`)}function u_(e){let t=(0,$.c)(13),{sha:n,docName:r,cache:i,diffLayout:a,panelId:o}=e,c=Wg(n,r,i),l;t[0]===c.status?l=t[1]:(l=c.status===`loading`&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-xs text-muted-foreground`,children:[(0,Z.jsx)(Kt,{className:`size-3 animate-spin`}),(0,Z.jsx)(s,{id:`38foVZ`})]}),t[0]=c.status,t[1]=l);let u;t[2]===c.status?u=t[3]:(u=c.status===`error`&&(0,Z.jsx)(`p`,{className:`py-2 text-xs text-destructive`,children:(0,Z.jsx)(s,{id:`vvWZnu`})}),t[2]=c.status,t[3]=u);let d;t[4]!==a||t[5]!==c.diff||t[6]!==c.status?(d=c.status===`ready`&&(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-xs text-muted-foreground`,children:[(0,Z.jsx)(Kt,{className:`size-3 animate-spin`}),(0,Z.jsx)(s,{id:`EDm3wJ`})]}),children:(0,Z.jsx)(Gg,{diff:c.diff,viewType:a})}),t[4]=a,t[5]=c.diff,t[6]=c.status,t[7]=d):d=t[7];let f;return t[8]!==o||t[9]!==l||t[10]!==u||t[11]!==d?(f=(0,Z.jsxs)(`div`,{id:o,className:`px-3 pb-2`,"data-testid":`timeline-entry-diff`,children:[l,u,d]}),t[8]=o,t[9]=l,t[10]=u,t[11]=d,t[12]=f):f=t[12],f}function d_(e){let t=(0,$.c)(130),{entry:n,prominent:r,isDark:a,diffLayout:o,cache:c,docName:l,expanded:u,onToggleExpanded:d,onRestoreSuccess:f}=e,p=r===void 0?!1:r,{_:m}=i(),h;t[0]===n.timestamp?h=t[1]:(h=Kg(n.timestamp),t[0]=n.timestamp,t[1]=h);let g=h,_;t[2]===n?_=t[3]:(_=Yg(n),t[2]=n,t[3]=_);let v=_,y;t[4]===n.timestamp?y=t[5]:(y=qg(n.timestamp),t[4]=n.timestamp,t[5]=y);let b=y,x;t[6]===n.sha?x=t[7]:(x=Jg(n.sha),t[6]=n.sha,t[7]=x);let S=x,C=n.contributors.flatMap(f_),w;t[8]===n?w=t[9]:(w=o_(n),t[8]=n,t[9]=w);let T=w,[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(!1),A=(0,Q.useRef)(null),j=(0,Q.useId)(),M,N;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(M=()=>()=>A.current?.abort(),N=[],t[10]=M,t[11]=N):(M=t[10],N=t[11]),(0,Q.useEffect)(M,N);let P;t[12]!==n.sha||t[13]!==d?(P=()=>d(n.sha),t[12]=n.sha,t[13]=d,t[14]=P):P=t[14];let F=P,I;t[15]===D?I=t[16]:(I=function(){A.current?.abort(),A.current=null,k(!1),D(!1)},t[15]=D,t[16]=I);let L=I,R;t[17]!==m||t[18]!==l||t[19]!==n.sha||t[20]!==f||t[21]!==D?(R=async function(){k(!0);let e=new AbortController;A.current=e;let t=function(){e.signal.aborted||k(!1),A.current===e&&(A.current=null)},r;try{r=await fetch(`/api/rollback`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({docName:l,commitSha:n.sha}),signal:e.signal})}catch(r){let i=r;!e.signal.aborted&&!(i instanceof DOMException&&i.name===`AbortError`)&&(console.error(`[timeline] rollback fetch failed`,{docName:l,sha:n.sha,err:i}),$o.error(m({id:`NkXEFS`}),{duration:4e3})),t();return}if(e.signal.aborted){t();return}if(r.ok)D(!1),f();else{let e=`HTTP ${r.status}`;try{let t=Cr.safeParse(await r.json());t.success&&(e=t.data.title)}catch{}console.error(`[timeline] rollback failed`,{docName:l,sha:n.sha,status:r.status,detail:e}),$o.error(m({id:`uM6jnS`}),{description:e,duration:6e3})}t()},t[17]=m,t[18]=l,t[19]=n.sha,t[20]=f,t[21]=D,t[22]=R):R=t[22];let z=R,B;t[23]!==n||t[24]!==a||t[25]!==p?(B=p?(()=>{let e=e_(n);return e===`bridge-merge-loss`?(0,Z.jsx)(Pn,{className:`size-3.5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":`true`}):e===`external-change-rescue`?(0,Z.jsx)(bc,{className:`size-3.5 shrink-0 text-sky-600 dark:text-sky-400`,"aria-hidden":`true`}):(0,Z.jsx)(_c,{className:`size-3.5 shrink-0 text-muted-foreground`})})():(0,Z.jsx)(Zg,{entry:n,isDark:a}),t[23]=n,t[24]=a,t[25]=p,t[26]=B):B=t[26];let V=B,H=u?j:void 0,U=u?`bg-muted`:`hover:bg-muted/80`,W;t[27]===U?W=t[28]:(W=[`group flex w-full items-start gap-2.5 rounded-lg px-3 py-2.5 text-left transition-colors cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-ring`,U],t[27]=U,t[28]=W);let G=W.join(` `),K;t[29]===F?K=t[30]:(K=e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),F())},t[29]=F,t[30]=K);let q;t[31]===V?q=t[32]:(q=(0,Z.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:V}),t[31]=V,t[32]=q);let ee;t[33]!==v||t[34]!==n||t[35]!==p?(ee=p?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`text-xs text-foreground truncate`,children:t_(n)}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground/50`,children:`·`}),(0,Z.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:v})]}):(0,Z.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:v}),t[33]=v,t[34]=n,t[35]=p,t[36]=ee):ee=t[36];let te;t[37]!==n.timestamp||t[38]!==g?(te=(0,Z.jsx)(`time`,{className:`ml-auto shrink-0 text-xs text-muted-foreground/80`,dateTime:n.timestamp,title:n.timestamp,children:g}),t[37]=n.timestamp,t[38]=g,t[39]=te):te=t[39];let ne;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-px shrink-0 bg-border`}),t[40]=ne):ne=t[40];let re;t[41]===n?re=t[42]:(re=i_(n),t[41]=n,t[42]=re);let ie;t[43]===D?ie=t[44]:(ie=e=>{e.stopPropagation(),D(!0)},t[43]=D,t[44]=ie);let ae;t[45]===O?ae=t[46]:(ae=O?(0,Z.jsx)(Kt,{className:`size-3 animate-spin`}):(0,Z.jsx)(zi,{className:`size-3`}),t[45]=O,t[46]=ae);let oe;t[47]!==O||t[48]!==re||t[49]!==ie||t[50]!==ae?(oe=(0,Z.jsx)(cr,{asChild:!0,children:(0,Z.jsx)(Ni,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-destructive`,"data-testid":`timeline-entry-restore`,"aria-label":re,disabled:O,onClick:ie,children:ae})}),t[47]=O,t[48]=re,t[49]=ie,t[50]=ae,t[51]=oe):oe=t[51];let se;t[52]===n?se=t[53]:(se=i_(n),t[52]=n,t[53]=se);let ce;t[54]===se?ce=t[55]:(ce=(0,Z.jsx)(Qn,{side:`top`,children:se}),t[54]=se,t[55]=ce);let le;t[56]!==oe||t[57]!==ce?(le=(0,Z.jsxs)(Gr,{children:[oe,ce]}),t[56]=oe,t[57]=ce,t[58]=le):le=t[58];let ue;t[59]!==ee||t[60]!==te||t[61]!==le?(ue=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[ee,te,ne,le]}),t[59]=ee,t[60]=te,t[61]=le,t[62]=ue):ue=t[62];let de;t[63]===T?de=t[64]:(de=T.length>0&&(0,Z.jsx)(s_,{summaries:T}),t[63]=T,t[64]=de);let fe=C.length>0?(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:C.join(`, `),children:C.join(`, `)}):(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:n.message,children:n.message}),pe;t[65]!==ue||t[66]!==de||t[67]!==fe?(pe=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[ue,de,fe]}),t[65]=ue,t[66]=de,t[67]=fe,t[68]=pe):pe=t[68];let me;t[69]!==u||t[70]!==F||t[71]!==H||t[72]!==G||t[73]!==K||t[74]!==q||t[75]!==pe?(me=(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-expanded":u,"aria-controls":H,"data-testid":`timeline-entry-expand`,className:G,onClick:F,onKeyDown:K,children:[q,pe]}),t[69]=u,t[70]=F,t[71]=H,t[72]=G,t[73]=K,t[74]=q,t[75]=pe,t[76]=me):me=t[76];let he;t[77]!==c||t[78]!==o||t[79]!==j||t[80]!==l||t[81]!==n.sha||t[82]!==u?(he=u&&(0,Z.jsx)(u_,{sha:n.sha,docName:l,cache:c,diffLayout:o,panelId:j}),t[77]=c,t[78]=o,t[79]=j,t[80]=l,t[81]=n.sha,t[82]=u,t[83]=he):he=t[83];let ge;t[84]!==me||t[85]!==he?(ge=(0,Z.jsxs)(`div`,{className:`flex flex-col rounded-lg`,children:[me,he]}),t[84]=me,t[85]=he,t[86]=ge):ge=t[86];let _e;t[87]!==L||t[88]!==D?(_e=e=>{e?D(!0):L()},t[87]=L,t[88]=D,t[89]=_e):_e=t[89];let ve;t[90]===n?ve=t[91]:(ve=a_(n),t[90]=n,t[91]=ve);let ye;t[92]===ve?ye=t[93]:(ye=(0,Z.jsx)(Vo,{children:ve}),t[92]=ve,t[93]=ye);let be;t[94]!==b||t[95]!==v||t[96]!==S||t[97]!==g?(be={relative:g,absoluteTime:b,entrySha:S,authorName:v},t[94]=b,t[95]=v,t[96]=S,t[97]=g,t[98]=be):be=t[98];let xe;t[99]===Symbol.for(`react.memo_cache_sentinel`)?(xe={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`}),1:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[99]=xe):xe=t[99];let Se;t[100]===be?Se=t[101]:(Se=(0,Z.jsx)(zo,{children:(0,Z.jsx)(s,{id:`h6EvY-`,values:be,components:xe})}),t[100]=be,t[101]=Se);let Ce;t[102]!==ye||t[103]!==Se?(Ce=(0,Z.jsxs)(Xo,{children:[ye,Se]}),t[102]=ye,t[103]=Se,t[104]=Ce):Ce=t[104];let J;t[105]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Z.jsx)(s,{id:`dEgA5A`}),t[105]=J):J=t[105];let we;t[106]===L?we=t[107]:(we=(0,Z.jsx)(Ni,{variant:`outline`,"data-testid":`timeline-entry-restore-cancel`,onClick:L,children:J}),t[106]=L,t[107]=we);let Te;t[108]===z?Te=t[109]:(Te=()=>z(),t[108]=z,t[109]=Te);let Ee;t[110]===O?Ee=t[111]:(Ee=O?(0,Z.jsx)(Kt,{className:`mr-2 size-4 animate-spin`}):null,t[110]=O,t[111]=Ee);let De;t[112]===Symbol.for(`react.memo_cache_sentinel`)?(De=(0,Z.jsx)(s,{id:`yKu_3Y`}),t[112]=De):De=t[112];let Oe;t[113]!==O||t[114]!==Te||t[115]!==Ee?(Oe=(0,Z.jsxs)(Ni,{variant:`destructive`,"data-testid":`timeline-entry-restore-confirm`,disabled:O,onClick:Te,children:[Ee,De]}),t[113]=O,t[114]=Te,t[115]=Ee,t[116]=Oe):Oe=t[116];let ke;t[117]!==we||t[118]!==Oe?(ke=(0,Z.jsxs)(Jo,{children:[we,Oe]}),t[117]=we,t[118]=Oe,t[119]=ke):ke=t[119];let Ae;t[120]!==Ce||t[121]!==ke?(Ae=(0,Z.jsxs)(Go,{children:[Ce,ke]}),t[120]=Ce,t[121]=ke,t[122]=Ae):Ae=t[122];let je;t[123]!==E||t[124]!==_e||t[125]!==Ae?(je=(0,Z.jsx)(Zo,{open:E,onOpenChange:_e,children:Ae}),t[123]=E,t[124]=_e,t[125]=Ae,t[126]=je):je=t[126];let Me;return t[127]!==ge||t[128]!==je?(Me=(0,Z.jsxs)(Z.Fragment,{children:[ge,je]}),t[127]=ge,t[128]=je,t[129]=Me):Me=t[129],Me}function f_(e){return e.docs}function p_(e){let t=(0,$.c)(87),{docName:n,diffLayout:r,onDiffLayoutChange:a,onSaveVersion:o,saving:c}=e,{_:l}=i(),{resolvedTheme:u}=Kr(),d=u===`dark`,f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=[],t[0]=f):f=t[0];let[p,m]=(0,Q.useState)(f),[h,g]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)(null),y=(0,Q.useRef)(null),[b]=(0,Q.useState)(__),[x,S]=(0,Q.useState)(g_),C;t[1]===b?C=t[2]:(C=()=>{S(new Set),b.clear()},t[1]=b,t[2]=C);let w;t[3]===n?w=t[4]:(w=[n],t[3]=n,t[4]=w),(0,Q.useEffect)(C,w);let T;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(T=function(e){S(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[5]=T):T=t[5];let E=T,D;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(D=function(){S(new Set)},t[6]=D):D=t[6];let O=D,k,A;t[7]!==l||t[8]!==n?(k=()=>{if(!n){m([]);return}let e=!1,t=async function(){if(n)try{let t=await fetch(`/api/history?docName=${encodeURIComponent(n)}&limit=100`);if(e)return;if(!t.ok){v(l({id:`brCtGB`}));return}let r=await t.json();if(e)return;m(r.entries??[]),v(null)}catch(t){let n=t;if(e)return;v(l({id:`brCtGB`})),console.error(`[timeline]`,n)}};return g(!0),t().finally(()=>{e||g(!1)}),y.current=setInterval(t,1e4),()=>{e=!0,y.current&&clearInterval(y.current)}},A=[n,l],t[7]=l,t[8]=n,t[9]=k,t[10]=A):(k=t[9],A=t[10]),(0,Q.useEffect)(k,A);let j,M,N,P,F,I,L,R;if(t[11]!==l||t[12]!==b||t[13]!==r||t[14]!==n||t[15]!==p||t[16]!==_||t[17]!==x||t[18]!==d||t[19]!==h||t[20]!==a||t[21]!==o||t[22]!==c){let e=[],i=[],u=!1;for(let t of p)t.type===`checkpoint`?(i.length>0&&(e.push({kind:`wip-group`,entries:i,isPreCheckpoint:!u}),i=[]),e.push({kind:`checkpoint`,entry:t}),u=!0):i.push(t);i.length>0&&e.push({kind:`wip-group`,entries:i,isPreCheckpoint:!u});let f;t[31]===p?f=t[32]:(f=p.some(h_),t[31]=p,t[32]=f);let m=!f,g=!h&&!_&&p.length>0;F=`flex h-full flex-col`;let v;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(vn,{children:(0,Z.jsx)(s,{id:`cklVjM`})}),t[33]=v):v=t[33];let y;t[34]!==l||t[35]!==r||t[36]!==g||t[37]!==a?(y=g&&(0,Z.jsxs)(Gr,{children:[(0,Z.jsx)(cr,{asChild:!0,children:(0,Z.jsxs)(Io,{type:`single`,value:r,onValueChange:e=>{e&&a(e)},"aria-label":l({id:`XvPJaT`}),variant:`segmented`,size:`sm`,spacing:1,className:`bg-muted dark:bg-background p-0.5 rounded-md shrink-0`,children:[(0,Z.jsx)(No,{value:`unified`,"aria-label":l({id:`379t2h`}),className:`size-6 px-0`,children:(0,Z.jsx)($c,{className:`size-3.5`})}),(0,Z.jsx)(No,{value:`split`,"aria-label":l({id:`HXFyWD`}),className:`size-6 px-0`,children:(0,Z.jsx)(pc,{className:`size-3.5`})})]})}),(0,Z.jsx)(Qn,{children:r===`unified`?(0,Z.jsx)(s,{id:`379t2h`}):(0,Z.jsx)(s,{id:`HXFyWD`})})]}),t[34]=l,t[35]=r,t[36]=g,t[37]=a,t[38]=y):y=t[38];let S;t[39]===l?S=t[40]:(S=l({id:`IrYrzq`}),t[39]=l,t[40]=S);let C;t[41]===c?C=t[42]:(C=c?(0,Z.jsx)(Kt,{className:`size-4 animate-spin`}):(0,Z.jsx)(el,{className:`size-4`}),t[41]=c,t[42]=C);let w;t[43]!==o||t[44]!==c||t[45]!==S||t[46]!==C?(w=(0,Z.jsx)(cr,{asChild:!0,children:(0,Z.jsx)(Ni,{variant:`ghost`,size:`icon-sm`,onClick:o,disabled:c,"aria-label":S,className:`text-muted-foreground`,"data-testid":`timeline-save-version`,children:C})}),t[43]=o,t[44]=c,t[45]=S,t[46]=C,t[47]=w):w=t[47];let T;t[48]===c?T=t[49]:(T=(0,Z.jsx)(Qn,{children:c?(0,Z.jsx)(s,{id:`uF9ruK`}):(0,Z.jsx)(s,{id:`IrYrzq`})}),t[48]=c,t[49]=T);let D;t[50]!==w||t[51]!==T?(D=(0,Z.jsxs)(Gr,{children:[w,T]}),t[50]=w,t[51]=T,t[52]=D):D=t[52],t[53]!==y||t[54]!==D?(I=(0,Z.jsxs)(hn,{children:[v,(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[y,D]})]}),t[53]=y,t[54]=D,t[55]=I):I=t[55],L=`flex-1 overflow-y-auto subtle-scrollbar scroll-fade-mask`,t[56]!==l||t[57]!==h?(R=h&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,role:`status`,"aria-busy":`true`,"aria-label":l({id:`o49mDZ`}),children:[1,2,3].map(m_)}),t[56]=l,t[57]=h,t[58]=R):R=t[58],t[59]!==_||t[60]!==h?(j=!h&&_&&(0,Z.jsx)(`div`,{className:`px-4 py-3`,children:(0,Z.jsx)(`p`,{className:`text-xs text-destructive`,children:_})}),t[59]=_,t[60]=h,t[61]=j):j=t[61],t[62]!==p.length||t[63]!==_||t[64]!==h?(M=!h&&!_&&p.length===0&&(0,Z.jsx)(`div`,{className:`px-4 py-8 text-center`,children:(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(s,{id:`Ta25TG`})})}),t[62]=p.length,t[63]=_,t[64]=h,t[65]=M):M=t[65],t[66]!==b||t[67]!==r||t[68]!==n||t[69]!==p||t[70]!==_||t[71]!==x||t[72]!==m||t[73]!==d||t[74]!==h?(N=!h&&!_&&m&&p.length>0&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,children:p.map(e=>(0,Z.jsx)(d_,{entry:e,isDark:d,diffLayout:r,cache:b,docName:n,expanded:x.has(e.sha),onToggleExpanded:E,onRestoreSuccess:O},e.sha))}),t[66]=b,t[67]=r,t[68]=n,t[69]=p,t[70]=_,t[71]=x,t[72]=m,t[73]=d,t[74]=h,t[75]=N):N=t[75],P=!h&&!_&&!m&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,children:e.map((e,t)=>e.kind===`checkpoint`?(0,Z.jsx)(d_,{entry:e.entry,prominent:!0,isDark:d,diffLayout:r,cache:b,docName:n,expanded:x.has(e.entry.sha),onToggleExpanded:E,onRestoreSuccess:O},e.entry.sha):(0,Z.jsx)(Qg,{entries:e.entries,defaultExpanded:e.isPreCheckpoint,isDark:d,diffLayout:r,cache:b,docName:n,expandedShas:x,onToggleExpanded:E,onRestoreSuccess:O},e.entries[0]?.sha??`wip-${t}`))}),t[11]=l,t[12]=b,t[13]=r,t[14]=n,t[15]=p,t[16]=_,t[17]=x,t[18]=d,t[19]=h,t[20]=a,t[21]=o,t[22]=c,t[23]=j,t[24]=M,t[25]=N,t[26]=P,t[27]=F,t[28]=I,t[29]=L,t[30]=R}else j=t[23],M=t[24],N=t[25],P=t[26],F=t[27],I=t[28],L=t[29],R=t[30];let z;t[76]!==j||t[77]!==M||t[78]!==N||t[79]!==P||t[80]!==L||t[81]!==R?(z=(0,Z.jsxs)(`div`,{className:L,children:[R,j,M,N,P]}),t[76]=j,t[77]=M,t[78]=N,t[79]=P,t[80]=L,t[81]=R,t[82]=z):z=t[82];let B;return t[83]!==F||t[84]!==I||t[85]!==z?(B=(0,Z.jsxs)(`div`,{className:F,children:[I,z]}),t[83]=F,t[84]=I,t[85]=z,t[86]=B):B=t[86],B}function m_(e){return(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg px-3 py-2.5`,children:[(0,Z.jsx)(eo,{className:`size-3.5 rounded mt-0.5 shrink-0`}),(0,Z.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,Z.jsx)(eo,{className:`h-3 w-28`}),(0,Z.jsx)(eo,{className:`h-3 w-40`})]})]},e)}function h_(e){return e.type===`checkpoint`}function g_(){return new Set}function __(){return new Bi(32)}var v_=[{id:`outline`,icon:Ic},{id:`links`,icon:ge},{id:`graph`,icon:zc},{id:`timeline`,icon:lc}];function y_(e){return e===`outline`?X._({id:`dD7NPy`}):e===`links`?X._({id:`Rj01Fz`}):e===`graph`?X._({id:`x2fr_j`}):X._({id:`cklVjM`})}function b_(){return n(()=>import(`./GraphPanel-D7AmXBQV.js`),__vite__mapDeps([18,1,19,6,3,7,20,21,22,23,24,25,26,27,28,29,30,31]),import.meta.url)}var x_=(0,Q.lazy)(async()=>({default:(await b_()).GraphPanel})),S_=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-C_nGfN8W.js`),__vite__mapDeps([32,1,2,33,34,35,20,36,37,38,39,19,6,3,7,4,10,9,40,41]),import.meta.url)).ActivityModeContent}));function C_(e){let t=(0,$.c)(16),{docName:n,isSourceMode:r,activeTab:a,onActiveTabChange:o,mode:c,onSaveVersion:l,saving:u}=e,{_:d}=i(),[f,p]=(0,Q.useState)(`unified`),m;t[0]!==d||t[1]!==a||t[2]!==c||t[3]!==o?(m=c===`doc`?(0,Z.jsx)(`div`,{className:`flex flex-row items-center justify-center gap-3 p-2`,children:(0,Z.jsx)(Io,{type:`single`,variant:`outline`,value:a,onValueChange:e=>{e&&o(e)},"aria-label":d({id:`SrOuyg`}),children:v_.map(w_)})}):null,t[0]=d,t[1]=a,t[2]=c,t[3]=o,t[4]=m):m=t[4];let h;t[5]!==a||t[6]!==f||t[7]!==n||t[8]!==r||t[9]!==c||t[10]!==l||t[11]!==u?(h=c===`doc`?(0,Z.jsxs)(`div`,{role:`tabpanel`,id:`panel-${a}`,"aria-labelledby":`tab-${a}`,className:`min-h-0 flex-1`,children:[a===`outline`&&(0,Z.jsx)(Is,{docName:n,isSourceMode:r}),a===`links`&&(0,Z.jsx)(mg,{docName:n}),a===`graph`&&(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`-lCAuQ`})}),children:(0,Z.jsx)(x_,{activeDocName:n})}),a===`timeline`&&(0,Z.jsx)(p_,{docName:n,diffLayout:f,onDiffLayoutChange:p,onSaveVersion:l,saving:u})]}):(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{role:`status`,"aria-busy":`true`,className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`ONPvOb`})}),children:(0,Z.jsx)(S_,{})})}),t[5]=a,t[6]=f,t[7]=n,t[8]=r,t[9]=c,t[10]=l,t[11]=u,t[12]=h):h=t[12];let g;return t[13]!==m||t[14]!==h?(g=(0,Z.jsxs)(Z.Fragment,{children:[m,h]}),t[13]=m,t[14]=h,t[15]=g):g=t[15],g}function w_(e){let{id:t,icon:n}=e,r=y_(t);return(0,Z.jsxs)(Gr,{children:[(0,Z.jsx)(No,{value:t,role:`tab`,id:`tab-${t}`,"aria-controls":`panel-${t}`,"aria-label":r,asChild:!0,children:(0,Z.jsx)(cr,{children:(0,Z.jsx)(n,{})})}),(0,Z.jsx)(Qn,{side:`bottom`,children:r})]},t)}function T_(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function E_(e,t){let n=getComputedStyle(e.ownerDocument.body);return t*parseFloat(n.fontSize)}function D_(e){return e/100*window.innerHeight}function O_(e){return e/100*window.innerWidth}function k_(e){switch(typeof e){case`number`:return[e,`px`];case`string`:{let t=parseFloat(e);return e.endsWith(`%`)?[t,`%`]:e.endsWith(`px`)?[t,`px`]:e.endsWith(`rem`)?[t,`rem`]:e.endsWith(`em`)?[t,`em`]:e.endsWith(`vh`)?[t,`vh`]:e.endsWith(`vw`)?[t,`vw`]:[t,`%`]}}}function A_({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=k_(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=E_(t,i);break;case`em`:r=T_(t,i);break;case`vh`:r=D_(i);break;case`vw`:r=O_(i);break}return r}function j_(e){return parseFloat(e.toFixed(3))}function M_({group:e}){let{orientation:t,panels:n}=e;return n.reduce((e,n)=>(e+=t===`horizontal`?n.element.offsetWidth:n.element.offsetHeight,e),0)}function N_(e){let{panels:t}=e,n=M_({group:e});return n===0?t.map(e=>({groupResizeBehavior:e.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:e.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:e.panelConstraints.disabled,minSize:0,maxSize:100,panelId:e.id})):t.map(e=>{let{element:t,panelConstraints:r}=e,i=0;r.collapsedSize!==void 0&&(i=j_(A_({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=j_(A_({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=j_(A_({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=j_(A_({groupSize:n,panelElement:t,styleProp:r.maxSize})/n*100)),{groupResizeBehavior:r.groupResizeBehavior,collapsedSize:i,collapsible:r.collapsible===!0,defaultSize:a,disabled:r.disabled,minSize:o,maxSize:s,panelId:e.id}})}function P_(e,t=`Assertion error`){if(!e)throw Error(t)}function F_(e,t){return Array.from(t).sort(e===`horizontal`?I_:L_)}function I_(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function L_(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function R_(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function z_(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function B_({orientation:e,rects:t,targetRect:n}){let r={x:n.x+n.width/2,y:n.y+n.height/2},i,a=Number.MAX_VALUE;for(let n of t){let{x:t,y:o}=z_(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return P_(i,`No rect found`),i}var V_;function H_(){return V_===void 0&&(V_=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),V_}function U_(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=F_(n,Array.from(t.children).filter(R_).map(e=>({element:e}))).map(({element:e})=>e),o=[],s=!1,c=!1,l=-1,u=-1,d=0,f,p=[];{let e=-1;for(let t of a)t.hasAttribute(`data-panel`)&&(e++,t.hasAttribute(`data-disabled`)||(d++,l===-1&&(l=e),u=e))}if(d>1){let t=-1;for(let d of a)if(d.hasAttribute(`data-panel`)){t++;let i=r.find(e=>e.element===d);if(i){if(f){let r=f.element.getBoundingClientRect(),a=d.getBoundingClientRect(),m;if(c){let e=n===`horizontal`?new DOMRect(r.right,r.top,0,r.height):new DOMRect(r.left,r.bottom,r.width,0),t=n===`horizontal`?new DOMRect(a.left,a.top,0,a.height):new DOMRect(a.left,a.top,a.width,0);switch(p.length){case 0:m=[e,t];break;case 1:{let i=p[0];m=[i,B_({orientation:n,rects:[r,a],targetRect:i.element.getBoundingClientRect()})===r?t:e];break}default:m=p;break}}else m=p.length?p:[n===`horizontal`?new DOMRect(r.right,a.top,a.left-r.right,a.height):new DOMRect(a.left,r.bottom,a.width,a.top-r.bottom)];for(let n of m){let r=`width`in n?n:n.element.getBoundingClientRect(),a=H_()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(r.width<a){let e=a-r.width;r=new DOMRect(r.x-e/2,r.y,r.width+e,r.height)}if(r.height<a){let e=a-r.height;r=new DOMRect(r.x,r.y-e/2,r.width,r.height+e)}!s&&!(t<=l||t>u)&&o.push({group:e,groupSize:M_({group:e}),panels:[f,i],separator:`width`in n?void 0:n,rect:r}),s=!1}}c=!1,f=i,p=[]}}else if(d.hasAttribute(`data-separator`)){d.ariaDisabled!==null&&(s=!0);let e=i.find(e=>e.element===d);e?p.push(e):(f=void 0,p=[])}else c=!0}return o}var W_=class{#e={};addListener(e,t){let n=this.#e[e];return n===void 0?this.#e[e]=[t]:n.includes(t)||n.push(t),()=>{this.removeListener(e,t)}}emit(e,t){let n=this.#e[e];if(n!==void 0)if(n.length===1)n[0].call(null,t);else{let e=!1,r=null,i=Array.from(n);for(let n=0;n<i.length;n++){let a=i[n];try{a.call(null,t)}catch(t){r===null&&(e=!0,r=t)}}if(e)throw r}}removeAllListeners(){this.#e={}}removeListener(e,t){let n=this.#e[e];if(n!==void 0){let e=n.indexOf(t);e>=0&&n.splice(e,1)}}},G_=new Map,K_=new W_;function q_(e){G_=new Map(G_),G_.delete(e)}function J_(e,t){for(let[t]of G_)if(t.id===e)return t}function Y_(e,t){for(let[t,n]of G_)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function X_(){return G_}function Z_(e,t){return K_.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function Q_(e,t){let n=G_.get(e);G_=new Map(G_),G_.set(e,t),K_.emit(`groupChange`,{group:e,prev:n,next:t})}function $_(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=z_(n,a.rect);switch(e){case`horizontal`:t.x<=i.x&&(r=a,i=t);break;case`vertical`:t.y<=i.y&&(r=a,i=t);break}}return r?{distance:i,hitRegion:r}:void 0}function ev(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function tv(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:sv(e),b:sv(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();P_(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:ov(av(n.a)),b:ov(av(n.b))};if(i.a===i.b){let e=r.childNodes,t={a:n.a.at(-1),b:n.b.at(-1)},i=e.length;for(;i--;){let n=e[i];if(n===t.a)return 1;if(n===t.b)return-1}}return Math.sign(i.a-i.b)}var nv=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function rv(e){let t=getComputedStyle(cv(e)??e).display;return t===`flex`||t===`inline-flex`}function iv(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||rv(e))||+t.opacity<1||`transform`in t&&t.transform!==`none`||`webkitTransform`in t&&t.webkitTransform!==`none`||`mixBlendMode`in t&&t.mixBlendMode!==`normal`||`filter`in t&&t.filter!==`none`||`webkitFilter`in t&&t.webkitFilter!==`none`||`isolation`in t&&t.isolation===`isolate`||nv.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function av(e){let t=e.length;for(;t--;){let n=e[t];if(P_(n,`Missing node`),iv(n))return n}return null}function ov(e){return e&&Number(getComputedStyle(e).zIndex)||0}function sv(e){let t=[];for(;e;)t.push(e),e=cv(e);return t}function cv(e){let{parentNode:t}=e;return ev(t)?t.host:t}function lv(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function uv({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!R_(n)||n.contains(e)||e.contains(n))return!0;if(tv(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(lv(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function dv(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=U_(r),a=$_(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&uv({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function fv(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function pv(e,t,n=0){return Math.abs(j_(e)-j_(t))<=n}function mv(e,t){return pv(e,t)?0:e>t?1:-1}function hv({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){let{collapsedSize:i=0,collapsible:a,disabled:o,maxSize:s=100,minSize:c=0}=t;if(o&&!e)return n;if(mv(r,c)<0)if(a){let e=(i+c)/2;r=mv(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=j_(r),r}function gv({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(pv(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;P_(u!=null,`Invalid first pivot index`),P_(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];P_(r,`Panel constraints not found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(P_(n!=null,`Previous layout not found for panel index ${t}`),pv(n,i)){let t=o-n;mv(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];P_(r,`No panel constraints found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(P_(n!=null,`Previous layout not found for panel index ${t}`),pv(n,o)){let t=n-i;mv(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];P_(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&mv(i,c)<0)if(e>0){let t=c-o,n=t/2;mv(i+e,c)<0&&(e=mv(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;mv(i-e,c)<0&&(e=mv(100+e,n)>0?0:-t)}break}}{let t=e<0?1:-1,r=e<0?d:u,i=0;for(;;){let e=s[r];P_(e!=null,`Previous layout not found for panel index ${r}`);let a=hv({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:e,size:100})-e;if(i+=a,r+=t,r<0||r>=n.length)break}let a=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-a:a}{let t=e<0?u:d;for(;t>=0&&t<n.length;){let r=Math.abs(e)-Math.abs(f),i=s[t];P_(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=hv({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!pv(i,c)&&(f+=i-c,l[t]=c,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?t--:t++}}if(fv(c,l))return i;{let t=e<0?d:u,r=s[t];P_(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=hv({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!pv(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];P_(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=hv({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(pv(i,s)||(t-=s-i,l[r]=s),pv(t,0))break;e>0?r--:r++}}}if(!pv(Object.values(l).reduce((e,t)=>t+e,0),100,.1))return i;let p=Object.keys(i);return l.reduce((e,t,n)=>(e[p[n]]=t,e),{})}function _v(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||mv(e[n],t[n])!==0)return!1;return!0}function vv({layout:e,panelConstraints:t}){let n=Object.values(e),r=[...n],i=r.reduce((e,t)=>e+t,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(e=>`${e}%`).join(`, `)}`);if(!pv(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];P_(t!=null,`No layout data found for index ${e}`),r[e]=100/i*t}let a=0;for(let e=0;e<t.length;e++){let i=n[e];P_(i!=null,`No layout data found for index ${e}`);let o=r[e];P_(o!=null,`No layout data found for index ${e}`);let s=hv({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!pv(a,0))for(let e=0;e<t.length;e++){let n=r[e];P_(n!=null,`No layout data found for index ${e}`);let i=n+a,o=hv({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,pv(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function yv({groupId:e,panelId:t}){let n=()=>{let t=X_();for(let[n,{defaultLayoutDeferred:r,derivedPanelConstraints:i,layout:a,groupSize:o,separatorToPanels:s}]of t)if(n.id===e)return{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:n,groupSize:o,layout:a,separatorToPanels:s};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedPanelConstraints.find(e=>e.panelId===t);if(e!==void 0)return e;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{let e=n().group.panels.find(e=>e.id===t);if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},a=()=>{let e=n().layout[t];if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},o=e=>{let r=a();if(e===r)return;let{defaultLayoutDeferred:i,derivedPanelConstraints:o,group:s,groupSize:c,layout:l,separatorToPanels:u}=n(),d=s.panels.findIndex(e=>e.id===t),f=d===s.panels.length-1,p=vv({layout:gv({delta:f?r-e:e-r,initialLayout:l,panelConstraints:o,pivotIndices:f?[d-1,d]:[d,d+1],prevLayout:l,trigger:`imperative-api`}),panelConstraints:o});_v(l,p)||Q_(s,{defaultLayoutDeferred:i,derivedPanelConstraints:o,groupSize:c,layout:p,separatorToPanels:u})};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=i(),s=a();e&&s!==t&&(n.expandToSize=s,o(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:s}=i(),c=a();if(e&&c===t){let e=s.expandToSize??n;e===0&&(e=1),o(e)}},getSize:()=>{let{group:e}=n(),t=a(),{element:r}=i();return{asPercentage:t,inPixels:e.orientation===`horizontal`?r.offsetWidth:r.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=a();return e&&pv(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=M_({group:t});o(j_(A_({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function bv(e){e.defaultPrevented||dv(e,X_()).forEach(t=>{if(t.separator&&!t.separator.disableDoubleClick){let n=t.panels.find(e=>e.panelConstraints.defaultSize!==void 0);if(n){let r=n.panelConstraints.defaultSize,i=yv({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function xv(e){let t=X_();for(let[n]of t)if(n.separators.some(t=>t.element===e))return n;throw Error(`Could not find parent Group for separator element`)}function Sv({groupId:e}){let t=()=>{let t=X_();for(let[n,r]of t)if(n.id===e)return{group:n,...r};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){let{defaultLayoutDeferred:e,layout:n}=t();return e?{}:n},setLayout(e){let{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:i,groupSize:a,layout:o,separatorToPanels:s}=t(),c=vv({layout:e,panelConstraints:r});return n?o:(_v(o,c)||Q_(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function Cv(e,t){let n=xv(e),r=Y_(n.id,!0),i=n.separators.find(t=>t.element===e);P_(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);P_(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=Sv({groupId:n.id}).getLayout(),c=vv({layout:gv({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});_v(s,c)||Q_(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function wv(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=xv(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&Cv(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&Cv(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&Cv(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&Cv(t,-5);break;case`End`:e.preventDefault(),Cv(t,100);break;case`Enter`:{e.preventDefault();let n=xv(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=Y_(n.id,!0),o=n.separators.find(e=>e.element===t);P_(o,`Matching separator not found`);let s=a.get(o);P_(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(P_(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];Cv(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=xv(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);P_(r!==null,`Index not found`),n[e.shiftKey?r>0?r-1:n.length-1:r+1<n.length?r+1:0].focus({preventScroll:!0});break}case`Home`:e.preventDefault(),Cv(t,-100);break}}var Tv={cursorFlags:0,state:`inactive`},Ev=new W_;function Dv(){return Tv}function Ov(e){return Ev.addListener(`change`,e)}function kv(e){let t=Tv,n={...Tv};n.cursorFlags=e,Tv=n,Ev.emit(`change`,{prev:t,next:n})}function Av(e){let t=Tv;Tv=e,Ev.emit(`change`,{prev:t,next:e})}function jv(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=X_(),n=dv(e,t),r=new Map,i=!1;n.forEach(e=>{e.separator&&(i||(i=!0,e.separator.element.focus({preventScroll:!0})));let n=t.get(e.group);n&&r.set(e.group,n.layout)}),Av({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}var Mv=e=>e,Nv=()=>{},Pv=1,Fv=2,Iv=4,Lv=8,Rv=3,zv=12,Bv;function Vv(){return Bv===void 0&&(Bv=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(Bv=!0)),Bv}function Hv({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case`active`:case`hover`:t.forEach(e=>{if(!e.mutableState.disableCursor)switch(e.orientation){case`horizontal`:r++;break;case`vertical`:i++;break}})}if(!(r===0&&i===0)){switch(n){case`active`:if(e&&Vv()){let t=(e&Pv)!==0,n=(e&Fv)!==0,r=(e&Iv)!==0,i=(e&Lv)!==0;if(t)return r?`se-resize`:i?`ne-resize`:`e-resize`;if(n)return r?`sw-resize`:i?`nw-resize`:`w-resize`;if(r)return`s-resize`;if(i)return`n-resize`}break}return Vv()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var Uv=new WeakMap;function Wv(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=Uv.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));let r=Dv();switch(r.state){case`active`:case`hover`:{let e=Hv({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(e=>e.group),state:r.state}),i=`*, *:hover {cursor: ${e} !important; }`;if(t===i)return;t=i,e?n.cssRules.length===0?n.insertRule(i):n.replaceSync(i):n.cssRules.length===1&&n.deleteRule(0);break}case`inactive`:t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}Uv.set(e,{prevStyle:t,styleSheet:n})}function Gv({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:i,pointerDownAtPoint:a,prevCursorFlags:o}){let s=0;n.forEach(e=>{let{group:n,groupSize:o}=e,{orientation:c,panels:l}=n,{disableCursor:u}=n.mutableState,d=0;d=a?c===`horizontal`?(t.clientX-a.x)/o*100:(t.clientY-a.y)/o*100:c===`horizontal`?t.clientX<0?-100:100:t.clientY<0?-100:100;let f=r.get(n),p=i.get(n);if(!f||!p)return;let{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:_,separatorToPanels:v}=p;if(h&&_&&v){let t=gv({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(_v(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?Pv:Fv;break;case`vertical`:s|=d<0?Iv:Lv;break}}else Q_(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&Rv:c|=s&Rv,t.movementY===0?c|=o&zv:c|=s&zv,kv(c),Wv(e)}function Kv(e){let t=X_(),n=Dv();switch(n.state){case`active`:Gv({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function qv(e){if(e.defaultPrevented)return;let t=Dv(),n=X_();switch(t.state){case`active`:if(e.buttons===0){Av({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=Y_(e.group.id,!0);Q_(e.group,t)});return}for(let n of t.hitRegions)if(n.separator){let{element:t}=n.separator;t.hasPointerCapture?.(e.pointerId)||t.setPointerCapture?.(e.pointerId)}Gv({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=dv(e,n);r.length===0?t.state!==`inactive`&&Av({cursorFlags:0,state:`inactive`}):Av({cursorFlags:0,hitRegions:r,state:`hover`}),Wv(e.currentTarget);break}}}function Jv(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(Dv().state){case`hover`:Av({cursorFlags:0,state:`inactive`})}}function Yv(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=Dv();switch(t.state){case`active`:Av({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(Wv(e.currentTarget),t.hitRegions.forEach(e=>{let t=Y_(e.group.id,!0);Q_(e.group,t)}),e.preventDefault())}}function Xv(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=j_(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=j_((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function Zv(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=M_({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:j_(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function Qv(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function $v({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let i=0,a=0,o=!1,s=new Map,c=[];for(let l of e.panels){let e=r[l.id]??0;switch(l.panelConstraints.groupResizeBehavior){case`preserve-pixel-size`:{o=!0;let r=j_(e/100*n/t*100);s.set(l.id,r),i+=r;break}default:c.push(l.id),a+=e;break}}if(!o||c.length===0)return r;let l=100-i,u={...r};if(s.forEach((e,t)=>{u[t]=e}),a>0)for(let e of c)u[e]=j_((r[e]??0)/a*l);else{let e=j_(l/c.length);for(let t of c)u[t]=e}return u}function ey(e,t){let n=e.map(e=>e.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e of n)if(!r.includes(e))return!1;return!0}var ty=new Map;function ny(e){let t=!0;P_(e.element.ownerDocument.defaultView,`Cannot register an unmounted Group`);let n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,i=new Set,a=new n(n=>{for(let r of n){let{borderBoxSize:n,target:i}=r;if(i===e.element){if(t){let t=M_({group:e});if(t===0)return;let n=Y_(e.id);if(!n)return;let r=N_(e),i=n.defaultLayoutDeferred?Xv(r):n.layout,a=vv({layout:$v({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&_v(n.layout,a)&&Qv(n.derivedPanelConstraints,r)&&n.groupSize===t)return;Q_(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else Zv(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{P_(!r.has(e.id),`Panel ids must be unique; id "${e.id}" was used more than once`),r.add(e.id),e.onResize&&a.observe(e.element)});let o=M_({group:e}),s=N_(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(ey(e.panels,l)||(l=void 0));let u=vv({layout:e.mutableState.layouts[c]??l??Xv(s),panelConstraints:s}),d=e.element.ownerDocument;ty.set(d,(ty.get(d)??0)+1);let f=new Map;return U_(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),Q_(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{P_(!i.has(e.id),`Separator ids must be unique; id "${e.id}" was used more than once`),i.add(e.id),e.element.addEventListener(`keydown`,wv)}),ty.get(d)===1&&(d.addEventListener(`dblclick`,bv,!0),d.addEventListener(`pointerdown`,jv,!0),d.addEventListener(`pointerleave`,Kv),d.addEventListener(`pointermove`,qv),d.addEventListener(`pointerout`,Jv),d.addEventListener(`pointerup`,Yv,!0)),function(){t=!1,ty.set(d,Math.max(0,(ty.get(d)??0)-1)),q_(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,wv)}),ty.get(d)||(d.removeEventListener(`dblclick`,bv,!0),d.removeEventListener(`pointerdown`,jv,!0),d.removeEventListener(`pointerleave`,Kv),d.removeEventListener(`pointermove`,qv),d.removeEventListener(`pointerout`,Jv),d.removeEventListener(`pointerup`,Yv,!0)),a.disconnect()}}function ry(){let[e,t]=(0,Q.useState)({});return[e,(0,Q.useCallback)(()=>t({}),[])]}function iy(e){let t=(0,Q.useId)();return`${e??t}`}var ay=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function oy(e){let t=(0,Q.useRef)(e);return ay(()=>{t.current=e},[e]),(0,Q.useCallback)((...e)=>t.current?.(...e),[t])}function sy(...e){return oy(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function cy(e){let t=(0,Q.useRef)({...e});return ay(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var ly=(0,Q.createContext)(null);function uy(e,t){let n=(0,Q.useRef)({getLayout:()=>({}),setLayout:Mv});(0,Q.useImperativeHandle)(t,()=>n.current,[]),ay(()=>{Object.assign(n.current,Sv({groupId:e}))})}function dy({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:i,elementRef:a,groupRef:o,id:s,onLayoutChange:c,onLayoutChanged:l,orientation:u=`horizontal`,resizeTargetMinimumSize:d={coarse:20,fine:10},style:f,...p}){let m=(0,Q.useRef)({onLayoutChange:{},onLayoutChanged:{}}),h=oy(e=>{_v(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=oy(e=>{_v(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e))}),_=iy(s),v=(0,Q.useRef)(null),[y,b]=ry(),x=(0,Q.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=sy(v,a);uy(_,o);let C=oy((e,t)=>{let r=Dv(),i=J_(e),a=Y_(e);if(a){let e=!1;switch(r.state){case`active`:e=r.hitRegions.some(e=>e.group===i);break}return{flexGrow:a.layout[t]??1,pointerEvents:e?`none`:void 0}}if(n?.[t])return{flexGrow:n?.[t]}}),w=cy({defaultLayout:n,disableCursor:r}),T=(0,Q.useMemo)(()=>({get disableCursor(){return!!w.disableCursor},getPanelStyles:C,id:_,orientation:u,registerPanel:e=>{let t=x.current;return t.panels=F_(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=F_(u,[...t.separators,e]),b(),()=>{t.separators=t.separators.filter(t=>t!==e),b()}},updatePanelProps:(e,{disabled:t})=>{let n=x.current.panels.find(t=>t.id===e);n&&(n.panelConstraints.disabled=t);let r=J_(_),i=Y_(_);r&&i&&Q_(r,{...i,derivedPanelConstraints:N_(r)})},updateSeparatorProps:(e,{disabled:t,disableDoubleClick:n})=>{let r=x.current.separators.find(t=>t.id===e);r&&(r.disabled=t,r.disableDoubleClick=n)}}),[C,_,b,u,w]),E=(0,Q.useRef)(null);return ay(()=>{let e=v.current;if(e===null)return;let t=x.current,n;if(w.defaultLayout!==void 0&&Object.keys(w.defaultLayout).length===t.panels.length){n={};for(let e of t.panels){let t=w.defaultLayout[e.id];t!==void 0&&(n[e.id]=t)}}let r={disabled:!!i,element:e,id:_,mutableState:{defaultLayout:n,disableCursor:!!w.disableCursor,expandedPanelSizes:x.current.lastExpandedPanelSizes,layouts:x.current.layouts},orientation:u,panels:t.panels,resizeTargetMinimumSize:t.resizeTargetMinimumSize,separators:t.separators};E.current=r;let a=ny(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=Y_(r.id,!0);!o&&s.length>0&&(h(c),g(c));let l=Z_(_,e=>{let{defaultLayoutDeferred:t,derivedPanelConstraints:n,layout:i}=e.next;if(t||n.length===0)return;let a=r.panels.map(({id:e})=>e).join(`,`);r.mutableState.layouts[a]=i,n.forEach(t=>{if(t.collapsible){let{layout:n}=e.prev??{};if(n){let e=pv(t.collapsedSize,i[t.panelId]),a=pv(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=Dv().state!==`active`;h(i),o&&g(i)});return()=>{E.current=null,a(),l()}},[i,_,g,h,u,y,w]),(0,Q.useEffect)(()=>{let e=E.current;e&&(e.mutableState.defaultLayout=n,e.mutableState.disableCursor=!!r)}),(0,Z.jsx)(ly.Provider,{value:T,children:(0,Z.jsx)(`div`,{...p,className:t,"data-group":!0,"data-testid":_,id:_,ref:S,style:{height:`100%`,width:`100%`,overflow:`hidden`,...f,display:`flex`,flexDirection:u===`horizontal`?`row`:`column`,flexWrap:`nowrap`,touchAction:u===`horizontal`?`pan-y`:`pan-x`},children:e})})}dy.displayName=`Group`;function fy(){let e=(0,Q.useContext)(ly);return P_(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function py(e,t){let{id:n}=fy(),r=(0,Q.useRef)({collapse:Nv,expand:Nv,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:Nv});(0,Q.useImperativeHandle)(t,()=>r.current,[]),ay(()=>{Object.assign(r.current,yv({groupId:n,panelId:e}))})}function my({children:e,className:t,collapsedSize:n=`0%`,collapsible:r=!1,defaultSize:i,disabled:a,elementRef:o,groupResizeBehavior:s=`preserve-relative-size`,id:c,maxSize:l=`100%`,minSize:u=`0%`,onResize:d,panelRef:f,style:p,...m}){let h=!!c,g=iy(c),_=cy({disabled:a}),v=(0,Q.useRef)(null),y=sy(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=fy(),T=d!==null,E=oy((e,t,n)=>{d?.(e,c,n)});ay(()=>{let e=v.current;if(e!==null)return C({element:e,id:g,idIsStable:h,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:T?E:void 0,panelConstraints:{groupResizeBehavior:s,collapsedSize:n,collapsible:r,defaultSize:i,disabled:_.disabled,maxSize:l,minSize:u}})},[s,n,r,i,T,g,h,l,u,E,C,_]),(0,Q.useEffect)(()=>{w(g,{disabled:a})},[a,g,w]),py(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,Q.useSyncExternalStore)(e=>Z_(x,e),D,D),k;return k=O?JSON.parse(O):i?{flexGrow:void 0,flexShrink:void 0,flexBasis:i}:{flexGrow:1},(0,Z.jsx)(`div`,{...m,"data-disabled":a||void 0,"data-panel":!0,"data-testid":g,id:g,ref:y,style:{...hy,display:`flex`,flexBasis:0,flexShrink:1,overflow:`visible`,...k},children:(0,Z.jsx)(`div`,{className:t,style:{maxHeight:`100%`,maxWidth:`100%`,flexGrow:1,overflow:`auto`,...p,touchAction:S===`horizontal`?`pan-y`:`pan-x`},children:e})})}my.displayName=`Panel`;var hy={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function gy(){return(0,Q.useRef)(null)}function _y({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,a,o=e[n],s=t.find(e=>e.panelId===n);if(s){let c=s.maxSize,l=s.collapsible?s.collapsedSize:s.minSize,u=[r,r+1];a=vv({layout:gv({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=vv({layout:gv({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function vy({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=iy(a),l=cy({disabled:n,disableDoubleClick:r}),[u,d]=(0,Q.useState)({}),[f,p]=(0,Q.useState)(`inactive`),m=(0,Q.useRef)(null),h=sy(m,i),{disableCursor:g,id:_,orientation:v,registerSeparator:y,updateSeparatorProps:b}=fy(),x=v===`horizontal`?`vertical`:`horizontal`;ay(()=>{let e=m.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=y(t),r=Ov(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=Z_(_,e=>{let{derivedPanelConstraints:n,layout:r,separatorToPanels:i}=e.next,a=i.get(t);if(a){let e=a[0],t=a.indexOf(e);d(_y({layout:r,panelConstraints:n,panelId:e.id,panelIndex:t}))}});return()=>{r(),i(),n()}}},[_,c,y,l]),(0,Q.useEffect)(()=>{b(c,{disabled:n,disableDoubleClick:r})},[n,r,c,b]);let S;return n&&!g&&(S=`not-allowed`),(0,Z.jsx)(`div`,{...s,"aria-controls":u.valueControls,"aria-disabled":n||void 0,"aria-orientation":x,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:e,className:t,"data-separator":n?`disabled`:f,"data-testid":c,id:c,ref:h,role:`separator`,style:{flexBasis:`auto`,cursor:S,...o,flexGrow:0,flexShrink:0,touchAction:`none`},tabIndex:n?void 0:0})}vy.displayName=`Separator`;var yy={name:`toml`,startState:function(){return{inString:!1,stringType:``,lhs:!0,inArray:0}},token:function(e,t){let n;if(!t.inString&&(n=e.match(/^('''|"""|'|")/))&&(t.stringType=n[0],t.inString=!0),e.sol()&&!t.inString&&t.inArray===0&&(t.lhs=!0),t.inString){for(;t.inString;)if(e.match(t.stringType))t.inString=!1;else if(e.peek()===`\\`)e.next(),e.next();else if(e.eol())break;else e.match(/^.[^\\\"\']*/);return t.lhs?`property`:`string`}else if(t.inArray&&e.peek()===`]`)return e.next(),t.inArray--,`bracket`;else if(t.lhs&&e.peek()===`[`&&e.skipTo(`]`))return e.next(),e.peek()===`]`&&e.next(),`atom`;else if(e.peek()===`#`)return e.skipToEnd(),`comment`;else if(e.eatSpace())return null;else if(t.lhs&&e.eatWhile(function(e){return e!=`=`&&e!=` `}))return`property`;else if(t.lhs&&e.peek()===`=`)return e.next(),t.lhs=!1,null;else if(!t.lhs&&e.match(/^\d\d\d\d[\d\-\:\.T]*Z/))return`atom`;else if(!t.lhs&&(e.match(`true`)||e.match(`false`)))return`atom`;else if(!t.lhs&&e.peek()===`[`)return t.inArray++,e.next(),`bracket`;else if(!t.lhs&&e.match(/^\-?\d+(?:\.\d+)?/))return`number`;else e.eatSpace()||e.next();return null},languageData:{commentTokens:{line:`#`}}},by=zt({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),xy=_({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}});function Sy(e){switch(e.toLowerCase()){case`json`:return Ns().language;case`toml`:return ks.define(yy);default:return null}}function Cy(e){let t=(0,$.c)(5),{_:n}=i(),r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={status:`loading`},t[0]=r):r=t[0];let[a,o]=(0,Q.useState)(r),s,c;return t[1]!==n||t[2]!==e?(s=()=>{let t=!1,r=new AbortController;return o({status:`loading`}),fetch(e,{credentials:`same-origin`,signal:r.signal}).then(async e=>{if(!e.ok){let t=e.status;throw Error(n({id:`PauP7d`,values:{status:t}}))}return e.text()}).then(e=>{t||o({status:`loaded`,content:e})}).catch(e=>{t||e instanceof Error&&e.name===`AbortError`||o({status:`error`,message:e instanceof Error?e.message:n({id:`ig5vUe`})})}),()=>{t=!0,r.abort()}},c=[e,n],t[1]=n,t[2]=e,t[3]=s,t[4]=c):(s=t[3],c=t[4]),(0,Q.useEffect)(s,c),a}function wy(e){let t=(0,$.c)(28),{src:n,fileName:r,extension:i}=e,a=(0,Q.useRef)(null),o=(0,Q.useRef)(null),{resolvedTheme:c}=Kr(),l=Cy(n),u=l.status===`loaded`?l.content:null,d,f;if(t[0]!==i||t[1]!==u||t[2]!==c?(d=()=>{if(!a.current||u===null)return;let e=Sy(i),t=c===`dark`?by:xy,n=[Ls,...e?[e]:[],Ts.editable.of(!1),hs.readOnly.of(!0),Ts.lineWrapping,t],r=new Ts({state:hs.create({doc:u,extensions:n}),parent:a.current});return o.current=r,()=>{r.destroy(),o.current=null}},f=[u,i,c],t[0]=i,t[1]=u,t[2]=c,t[3]=d,t[4]=f):(d=t[3],f=t[4]),(0,Q.useEffect)(d,f),l.status===`loading`){let e;t[5]===r?e=t[6]:(e=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`Md709y`,values:{fileName:r}})}),t[5]=r,t[6]=e);let n;return t[7]!==i||t[8]!==r||t[9]!==e?(n=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col items-center justify-center bg-background text-muted-foreground text-sm`,"aria-label":r,"data-text-viewer":``,"data-text-viewer-state":`loading`,"data-text-viewer-extension":i,children:e}),t[7]=i,t[8]=r,t[9]=e,t[10]=n):n=t[10],n}if(l.status===`error`){let e;t[11]===r?e=t[12]:(e=(0,Z.jsx)(`div`,{className:`font-medium text-sm`,children:(0,Z.jsx)(s,{id:`qdBUHP`,values:{fileName:r}})}),t[11]=r,t[12]=e);let a;t[13]===l.message?a=t[14]:(a=(0,Z.jsx)(`div`,{className:`text-muted-foreground text-xs`,children:l.message}),t[13]=l.message,t[14]=a);let o;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(s,{id:`9npOH9`}),t[15]=o):o=t[15];let c;t[16]===n?c=t[17]:(c=(0,Z.jsx)(`a`,{href:n,className:`mt-2 rounded-md border px-3 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground`,children:o}),t[16]=n,t[17]=c);let u;return t[18]!==i||t[19]!==r||t[20]!==e||t[21]!==a||t[22]!==c?(u=(0,Z.jsxs)(`main`,{className:`flex h-full min-h-0 flex-col items-center justify-center gap-2 bg-background p-4 text-center`,"aria-label":r,"data-text-viewer":``,"data-text-viewer-state":`error`,"data-text-viewer-extension":i,children:[e,a,c]}),t[18]=i,t[19]=r,t[20]=e,t[21]=a,t[22]=c,t[23]=u):u=t[23],u}let p;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(`div`,{ref:a,className:`min-h-0 flex-1 overflow-auto`}),t[24]=p):p=t[24];let m;return t[25]!==i||t[26]!==r?(m=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":r,"data-text-viewer":``,"data-text-viewer-state":`loaded`,"data-text-viewer-extension":i,children:p}),t[25]=i,t[26]=r,t[27]=m):m=t[27],m}function Ty(e){return ur(`/api/asset?path=${encodeURIComponent(e)}`)}function Ey(e){return`/api/asset-text?path=${encodeURIComponent(e)}`}function Dy(e){let t=(0,$.c)(28),{assetPath:n,mediaKind:r}=e,[i,a]=(0,Q.useState)(!1),o;t[0]===n?o=t[1]:(o=Ty(n),t[0]=n,t[1]=o);let c=o,l;t[2]===n?l=t[3]:(l=n.split(`/`).pop()??n,t[2]=n,t[3]=l);let u=l,d,f,p;if(t[4]!==n||t[5]!==u||t[6]!==i||t[7]!==r||t[8]!==c){p=Symbol.for(`react.early_return_sentinel`);bb0:{let e=u.includes(`.`)?u.split(`.`).pop()??``:``;if(f=e.length>0?e.toUpperCase():`FILE`,d=i?`text`:r,d===`pdf`){let e;t[12]!==u||t[13]!==c?(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,Z.jsx)(Mt,{src:c,title:u,fillContainer:!0})}),t[12]=u,t[13]=c,t[14]=e):e=t[14];let n;t[15]!==u||t[16]!==e?(n=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":u,children:e}),t[15]=u,t[16]=e,t[17]=n):n=t[17],p=n;break bb0}if(d===`text`){let r;t[18]===n?r=t[19]:(r=Ey(n),t[18]=n,t[19]=r),p=(0,Z.jsx)(wy,{src:r,fileName:u,extension:e.toLowerCase()},n);break bb0}}t[4]=n,t[5]=u,t[6]=i,t[7]=r,t[8]=c,t[9]=d,t[10]=f,t[11]=p}else d=t[9],f=t[10],p=t[11];if(p!==Symbol.for(`react.early_return_sentinel`))return p;let m;t[20]!==d||t[21]!==f||t[22]!==u||t[23]!==c?(m=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto p-4`,children:d===`image`?(0,Z.jsx)(Et,{src:c,alt:u,draggable:!1,slotClassName:`flex h-full w-full items-center justify-center`,className:`max-h-full max-w-full`}):d===`video`?(0,Z.jsx)(`video`,{src:c,controls:!0,className:`max-h-full max-w-full`}):d===`audio`?(0,Z.jsx)(`audio`,{src:c,controls:!0,className:`w-full max-w-md`}):(0,Z.jsxs)(`div`,{className:`flex max-w-sm flex-col items-center gap-3 text-center`,children:[(0,Z.jsx)(`div`,{className:`flex size-16 items-center justify-center rounded-md border bg-muted font-medium text-muted-foreground text-sm`,children:f}),(0,Z.jsx)(`div`,{className:`max-w-full break-words font-medium text-sm`,children:u}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[(0,Z.jsx)(Ni,{asChild:!0,variant:`outline`,size:`sm`,children:(0,Z.jsx)(`a`,{href:c,children:(0,Z.jsx)(s,{id:`9npOH9`})})}),(0,Z.jsx)(Ni,{variant:`outline`,size:`sm`,onClick:()=>a(!0),"data-testid":`asset-preview-open-as-text`,children:(0,Z.jsx)(s,{id:`Ruuu3v`})})]})]})}),t[20]=d,t[21]=f,t[22]=u,t[23]=c,t[24]=m):m=t[24];let h;return t[25]!==u||t[26]!==m?(h=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":u,children:m}),t[25]=u,t[26]=m,t[27]=h):h=t[27],h}function Oy(){let e=(0,$.c)(5),{_:t}=i(),n;e[0]===t?n=e[1]:(n=t({id:`3VsNTI`}),e[0]=t,e[1]=n);let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsx)(eo,{className:`h-9 w-2/5 mt-6 mb-5`}),(0,Z.jsx)(eo,{className:`h-4 w-full`}),(0,Z.jsx)(eo,{className:`h-4 w-3/4`})]}),e[2]=r):r=e[2];let a;return e[3]===n?a=e[4]:(a=(0,Z.jsx)(`div`,{className:`tiptap-editor pt-10`,role:`status`,"aria-busy":`true`,"aria-label":n,children:r}),e[3]=n,e[4]=a),a}var ky={"claude-cowork":`claude`,"claude-code":`claude`,codex:`openai`,cursor:`cursor`};function Ay(e){let t=(0,$.c)(23),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({id:r,style:a,className:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let{resolvedTheme:o}=Kr(),s=ky[r],c=s?(o===`dark`?Br[s]:void 0)??Tn[s]:void 0,l;t[5]!==c||t[6]!==a?(l=c?{...a,"--ok-brand-color":c}:a,t[5]=c,t[6]=a,t[7]=l):l=t[7];let u=l,d=c&&`[&_*]:![color:var(--ok-brand-color)]`,f;t[8]!==n||t[9]!==d?(f=Ei(d,n),t[8]=n,t[9]=d,t[10]=f):f=t[10];let p=f;if(r===`claude-cowork`||r===`claude-code`){let e;return t[11]!==p||t[12]!==u||t[13]!==i?(e=(0,Z.jsx)(Ri,{style:u,className:p,...i}),t[11]=p,t[12]=u,t[13]=i,t[14]=e):e=t[14],e}if(r===`codex`){let e;return t[15]!==p||t[16]!==u||t[17]!==i?(e=(0,Z.jsx)(Li,{style:u,className:p,...i}),t[15]=p,t[16]=u,t[17]=i,t[18]=e):e=t[18],e}if(r===`cursor`){let e;return t[19]!==p||t[20]!==u||t[21]!==i?(e=(0,Z.jsx)(Wi,{style:u,className:p,...i}),t[19]=p,t[20]=u,t[21]=i,t[22]=e):e=t[22],e}return null}function jy(e){let{installState:t}=e;return t.installed===null?X._({id:`IA6JW2`}):t.installed===!1?X._({id:`5SwVv1`}):null}function My(e){let{target:t,installState:n}=e;if(n.installed===null)return{enabled:!1,tooltip:null};if(n.installed===!1){let e=t.appBrandName??t.displayName;return{enabled:!1,tooltip:{message:X._({id:`OJTOUj`,values:{brand:e}}),installAction:{label:X._({id:`fG0X0e`,values:{brand:e}}),url:t.installUrl},...t.hasWebFallback?{webFallback:{label:X._({id:`0S9PW_`}),url:``}}:{}}}}return{enabled:!0,tooltip:null}}function Ny(e){return Ci(e)}function Py(e){return X._({id:`h_HYHD`,values:{displayName:e}})}var Fy=`claude.ai`;async function Iy(e,t=Jm){(await t(Ci(e))).ok?$o.success(Py(Fy)):$o.error(X._({id:`9NC_MT`,values:{CLAUDE_WEB_FALLBACK_LABEL:Fy}}))}function Ly(e){let t=(0,$.c)(68),{_:n}=i(),{target:r,installState:a,isElectronHost:o,prompt:s,onSelect:c}=e,l=e.openExternal??Jm,u=e.onWebFallbackSuccess??zy,d=e.onWebFallbackError??Ry,{displayName:f}=r,p,m,h,g,_,v,y,b,x,S;if(t[0]!==n||t[1]!==a||t[2]!==o||t[3]!==c||t[4]!==d||t[5]!==u||t[6]!==l||t[7]!==s||t[8]!==r||t[9]!==f){S=Symbol.for(`react.early_return_sentinel`);bb0:{let e=My({target:r,installState:a,isElectronHost:o}),i=jy({target:r,installState:a,isElectronHost:o}),C=()=>{e.tooltip&&l(e.tooltip.installAction.url)},w;t[20]!==d||t[21]!==u||t[22]!==l||t[23]!==s||t[24]!==r?(w=()=>{(async()=>{let e=await l(Ny(s));e.ok?u(r):d(r,e.detail??e.reason)})()},t[20]=d,t[21]=u,t[22]=l,t[23]=s,t[24]=r,t[25]=w):w=t[25];let T=w;if(e.enabled){let e=`open-in-agent-item-${r.id}`,i;t[26]!==n||t[27]!==f?(i=n({id:`NnQapF`,values:{targetDisplayName:f}}),t[26]=n,t[27]=f,t[28]=i):i=t[28];let a;t[29]===r.id?a=t[30]:(a=(0,Z.jsx)(Ay,{id:r.id,"aria-hidden":`true`}),t[29]=r.id,t[30]=a);let o;t[31]===r.displayName?o=t[32]:(o=(0,Z.jsx)(`span`,{children:r.displayName}),t[31]=r.displayName,t[32]=o);let s;t[33]!==c||t[34]!==i||t[35]!==a||t[36]!==o||t[37]!==e?(s=(0,Z.jsxs)(ha,{onSelect:c,"data-testid":e,"aria-label":i,children:[a,o]}),t[33]=c,t[34]=i,t[35]=a,t[36]=o,t[37]=e,t[38]=s):s=t[38],S=s;break bb0}if(!e.tooltip){let e=n(i?{id:`If0crP`,values:{targetDisplayName:f,hint:i}}:{id:`NnQapF`,values:{targetDisplayName:f}}),a;t[39]===r.id?a=t[40]:(a=(0,Z.jsx)(Ay,{id:r.id,"aria-hidden":`true`}),t[39]=r.id,t[40]=a);let o;t[41]===r.displayName?o=t[42]:(o=(0,Z.jsx)(`span`,{className:`flex-1`,children:r.displayName}),t[41]=r.displayName,t[42]=o),S=(0,Z.jsxs)(ha,{disabled:!0,"data-testid":`open-in-agent-item-${r.id}`,"aria-label":e,children:[a,o,i?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:i}):null]});break bb0}let E=n(i?{id:`If0crP`,values:{targetDisplayName:f,hint:i}}:{id:`NnQapF`,values:{targetDisplayName:f}}),D=e.tooltip.webFallback?.label??``;m=za;let O=`open-in-agent-item-${r.id}`,k;t[43]===r.id?k=t[44]:(k=(0,Z.jsx)(Ay,{id:r.id,"aria-hidden":`true`,className:`mr-2`}),t[43]=r.id,t[44]=k);let A;t[45]===r.displayName?A=t[46]:(A=(0,Z.jsx)(`span`,{className:`flex-1`,children:r.displayName}),t[45]=r.displayName,t[46]=A);let j;t[47]===i?j=t[48]:(j=i?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:i}):null,t[47]=i,t[48]=j),t[49]!==E||t[50]!==k||t[51]!==A||t[52]!==j||t[53]!==O?(x=(0,Z.jsxs)(Ba,{"data-testid":O,"data-row-disabled":``,"aria-label":E,children:[k,A,j]}),t[49]=E,t[50]=k,t[51]=A,t[52]=j,t[53]=O,t[54]=x):x=t[54],p=Ra,h=`min-w-[260px]`,g=`open-in-agent-submenu-${r.id}`,_=(0,Z.jsx)(ho,{className:`font-normal text-muted-foreground text-xs`,"data-testid":`open-in-agent-message-${r.id}`,children:e.tooltip.message}),t[55]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(ma,{}),t[55]=v):v=t[55],y=(0,Z.jsx)(ha,{onSelect:C,"data-testid":`open-in-agent-install-${r.id}`,children:(0,Z.jsx)(`span`,{children:e.tooltip.installAction.label})}),b=e.tooltip.webFallback?(0,Z.jsxs)(ha,{onSelect:T,"data-testid":`open-in-agent-web-fallback-${r.id}`,"aria-label":n({id:`lsOFZR`,values:{webFallbackLabel:D}}),children:[(0,Z.jsx)(`span`,{className:`flex-1`,children:e.tooltip.webFallback.label}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:n({id:`Z9BoIy`})})]}):null}t[0]=n,t[1]=a,t[2]=o,t[3]=c,t[4]=d,t[5]=u,t[6]=l,t[7]=s,t[8]=r,t[9]=f,t[10]=p,t[11]=m,t[12]=h,t[13]=g,t[14]=_,t[15]=v,t[16]=y,t[17]=b,t[18]=x,t[19]=S}else p=t[10],m=t[11],h=t[12],g=t[13],_=t[14],v=t[15],y=t[16],b=t[17],x=t[18],S=t[19];if(S!==Symbol.for(`react.early_return_sentinel`))return S;let C;t[56]!==p||t[57]!==h||t[58]!==g||t[59]!==_||t[60]!==v||t[61]!==y||t[62]!==b?(C=(0,Z.jsxs)(p,{className:h,"data-testid":g,children:[_,v,y,b]}),t[56]=p,t[57]=h,t[58]=g,t[59]=_,t[60]=v,t[61]=y,t[62]=b,t[63]=C):C=t[63];let w;return t[64]!==m||t[65]!==x||t[66]!==C?(w=(0,Z.jsxs)(m,{children:[x,C]}),t[64]=m,t[65]=x,t[66]=C,t[67]=w):w=t[67],w}function Ry(){}function zy(){}function By(e){let t=(0,$.c)(12),{className:n}=e,{states:r,refresh:i}=Ch(),{dispatch:a}=fh(),o=Wa(),s,c;if(t[0]!==n||t[1]!==a||t[2]!==i||t[3]!==r||t[4]!==o){let e=eh({workspace:o});t[7]===n?s=t[8]:(s=Ei(`grid w-full max-w-5xl gap-4 sm:grid-cols-3`,n),t[7]=n,t[8]=s),c=xm.map(t=>{let n=r[t.id]?.installed,o=n===!0?`installed`:n===!1?`missing`:`pending`;return(0,Z.jsx)(Vy,{target:t,status:o,onOpen:o===`installed`&&e!==null?()=>{a(t.id,e)}:void 0,onInstall:()=>{nh(t),i()}},t.id)}),t[0]=n,t[1]=a,t[2]=i,t[3]=r,t[4]=o,t[5]=s,t[6]=c}else s=t[5],c=t[6];let l;return t[9]!==s||t[10]!==c?(l=(0,Z.jsx)(`div`,{className:s,children:c}),t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function Vy(e){let t=(0,$.c)(22),{target:n,status:r,onOpen:i,onInstall:a}=e,o=r===`installed`?i:r===`missing`?a:void 0,s=r===`pending`||r===`installed`&&i===void 0,c=r===`installed`?`Open`:r===`missing`?`Install`:`Checking`,l;t[0]===n.id?l=t[1]:(l=(0,Z.jsx)(Ay,{id:n.id,"aria-hidden":`true`,className:`size-4`}),t[0]=n.id,t[1]=l);let u;t[2]===n.displayName?u=t[3]:(u=(0,Z.jsx)(`h3`,{className:`text-sm font-medium leading-tight`,children:n.displayName}),t[2]=n.displayName,t[3]=u);let d;t[4]!==l||t[5]!==u?(d=(0,Z.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-start sm:items-center gap-2`,children:[l,u]}),t[4]=l,t[5]=u,t[6]=d):d=t[6];let f;t[7]===n.tagline?f=t[8]:(f=n.tagline?(0,Z.jsx)(`p`,{className:`text-1sm leading-relaxed text-muted-foreground`,children:n.tagline}):null,t[7]=n.tagline,t[8]=f);let p;t[9]!==d||t[10]!==f?(p=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[d,f]}),t[9]=d,t[10]=f,t[11]=p):p=t[11];let m;t[12]===r?m=t[13]:(m=r===`missing`?(0,Z.jsx)(Fo,{"aria-hidden":`true`,className:`size-3`}):null,t[12]=r,t[13]=m);let h;t[14]!==c||t[15]!==m?(h=(0,Z.jsxs)(`p`,{className:`mt-auto inline-flex items-center gap-1 pt-2 font-mono text-2xs uppercase tracking-wider text-muted-foreground`,children:[c,m]}),t[14]=c,t[15]=m,t[16]=h):h=t[16];let g;return t[17]!==s||t[18]!==o||t[19]!==p||t[20]!==h?(g=(0,Z.jsxs)(`button`,{type:`button`,onClick:o,disabled:s,className:`group flex h-full flex-col items-start gap-4 rounded-2xl border border-border/60 bg-card p-5 text-left transition-[border-color,box-shadow,transform] hover:border-border hover:shadow-sm focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 active:translate-y-px disabled:cursor-not-allowed disabled:opacity-60`,children:[p,h]}),t[17]=s,t[18]=o,t[19]=p,t[20]=h,t[21]=g):g=t[21],g}var Hy=3100,Uy=3;function Wy(e,t,n){let r=n?.windowMs??600,i=n?.maxLevel??Uy;if(e===0||t>=r)return 1;let a=e+1;return a>i?i:a}var Gy={0:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},1:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},2:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},3:{count:16,startRadius:11,baseDistance:7,distanceVariance:3,sizeMin:.45,sizeMax:1.2,maxDelay:500,durationMin:1100,durationMax:2400}},Ky=[`var(--color-azure-blue)`,`var(--color-sky-blue)`,`var(--color-violet-300)`,`var(--color-orange-light)`,`var(--color-crystal-blue)`,`var(--color-white-cream)`];function qy(e,t={}){let n=t.rng??Math.random,r=t.colors??Ky,i=Gy[e];if(i.count===0||r.length===0)return[];let a=[],o=Math.PI*2/i.count;for(let e=0;e<i.count;e++){let t=e*o+(n()-.5)*o*.7,s=i.baseDistance+(n()-.5)*2*i.distanceVariance,c=i.sizeMin+n()*(i.sizeMax-i.sizeMin),l=n()*i.maxDelay,u=i.durationMin+n()*(i.durationMax-i.durationMin),d=Math.floor(n()*r.length),f=Math.cos(t),p=Math.sin(t);a.push({id:e,dx:f*s,dy:p*s,originDx:f*i.startRadius,originDy:p*i.startRadius,size:c,color:r[d]??`currentColor`,delay:l,duration:u})}return a}var Jy=1.8,Yy=90,Xy=16,Zy=380,Qy=.025,$y=.1,eb=.18,tb=400,nb=9.2736,rb=18.1799,ib=14.5244,ab={1:{halfWidth:1.5,apexLift:2.2},2:{halfWidth:1.4,apexLift:2.6},3:{halfWidth:1.25,apexLift:3}};function ob(e,t){let{halfWidth:n,apexLift:r}=ab[t];return`M${e-n} ${ib+.3} Q${e} ${ib-r}, ${e+n} ${ib+.3}`}function sb(e){let t=1.5,n=.3;return`M${e-t} ${ib-n} Q${e} ${ib+1.4}, ${e+t} ${ib-n}`}var cb=15,lb=15;function ub(e){return{fill:e.color,"--fx-tx":`${e.dx}px`,"--fx-ty":`${e.dy}px`,"--fx-delay":`${e.delay}ms`,"--fx-duration":`${e.duration}ms`}}function db(e){let t=(0,$.c)(71),{size:n,className:r,trackMouse:i,variant:a,celebrateSignal:o}=e,s=n===void 0?48:n,c=i===void 0?!0:i,l=a===void 0?`default`:a,u=o===void 0?0:o,d=(0,Q.useRef)(null),f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m={x:0,y:0},t[0]=m):m=t[0];let h=(0,Q.useRef)(m),[g,_]=(0,Q.useState)(0),[v,y]=(0,Q.useState)(0),b;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(b=[],t[1]=b):b=t[1];let[x,S]=(0,Q.useState)(b),C=(0,Q.useRef)(0),w=(0,Q.useRef)(void 0),T=l===`sleeping`,E;t[2]!==g||t[3]!==T?(E=function(){if(T)return;let e=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),t=C.current===0?1/0:e-C.current;C.current=e;let n=Wy(g,t);_(n),y(hb),S(qy(n)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},Hy)},t[2]=g,t[3]=T,t[4]=E):E=t[4];let D=E,O,k;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>()=>clearTimeout(w.current),k=[],t[5]=O,t[6]=k):(O=t[5],k=t[6]),(0,Q.useEffect)(O,k);let A,j;t[7]!==u||t[8]!==T?(A=()=>{u===0||T||(_(3),y(mb),S(qy(3)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},Hy))},j=[u,T],t[7]=u,t[8]=T,t[9]=A,t[10]=j):(A=t[9],j=t[10]),(0,Q.useEffect)(A,j);let M,N;t[11]!==T||t[12]!==c?(M=()=>{if(!c||T||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let e=0,t=0,n=!1,r=0,i=0,a=0,o=0,s=0,l=function(){s===0&&(s=requestAnimationFrame(m))},u=function(r){e=r.clientX,t=r.clientY,n=!0,l()};function m(){s=0;let c=f.current,u=d.current;if(!c||!u){l();return}let m=n;n=!1;let g=c.getBoundingClientRect(),_=g.left+g.width/2,v=g.top+g.height*.48,y=e-_,b=t-v,x=Math.hypot(y,b),S=Math.max(-1,Math.min(1,y/Zy)),C=Math.max(-1,Math.min(1,b/Zy)),w=S*Xy,T=-C*Xy,E=0,D=0;if(x>=1){let e=Math.min(x/Yy,1)*Jy;E=y/x*e,D=b/x*e}let O=Math.abs(T-r)<.01&&Math.abs(w-i)<.01&&Math.abs(E-a)<.01&&Math.abs(D-o)<.01;if(!m&&O)return;l(),r+=(T-r)*$y,i+=(w-i)*$y,u.style.transform=`perspective(${tb}px) rotateX(${r.toFixed(3)}deg) rotateY(${i.toFixed(3)}deg)`,a+=(E-a)*eb,o+=(D-o)*eb;let k=i*Qy,A=-r*Qy,j=a+k,M=o+A;h.current.x=j,h.current.y=M,p.current?.setAttribute(`transform`,`translate(${j.toFixed(3)} ${M.toFixed(3)})`)}return document.addEventListener(`mousemove`,u,{passive:!0}),l(),()=>{document.removeEventListener(`mousemove`,u),s!==0&&cancelAnimationFrame(s),s=0,d.current&&(d.current.style.transform=``),h.current={x:0,y:0},p.current?.removeAttribute(`transform`)}},N=[c,T],t[11]=T,t[12]=c,t[13]=M,t[14]=N):(M=t[13],N=t[14]),(0,Q.useEffect)(M,N);let P;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>{let e=p.current;if(!e)return;let{x:t,y:n}=h.current;e.setAttribute(`transform`,`translate(${t.toFixed(3)} ${n.toFixed(3)})`)},t[15]=P):P=t[15],(0,Q.useLayoutEffect)(P);let F=g>0,I=F?g:1,L=F?`ok-blob-clicked-${g}`:null,R;t[16]===r?R=t[17]:(R=Ei(`ok-blob-3d-wrapper`,r),t[16]=r,t[17]=R);let z=T?`cursor-default`:`cursor-pointer`,B=`body-${v}`,V=T&&`ok-blob-sleeping`,H;t[18]!==L||t[19]!==V?(H=Ei(`ok-blob-group`,V,L),t[18]=L,t[19]=V,t[20]=H):H=t[20];let U;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(`path`,{d:`M25.2339 6.78134C25.5199 7.35734 25.8179 8.47234 26.0179 9.07834C26.0189 9.08234 26.0209 9.08634 26.0219 9.09134C26.0229 9.09534 26.0249 9.10034 26.0259 9.10434C26.0539 9.19734 26.0949 9.29533 26.1519 9.41633C26.2919 9.71133 26.5269 10.1173 27.1299 11.1683C27.3259 11.4643 27.5209 11.7693 27.7119 12.0903C29.9739 15.1623 29.3259 20.1913 27.0469 22.9153C26.7779 23.2953 26.4869 23.6043 26.1889 23.8863C26.1519 23.9253 26.1129 23.9643 26.0729 24.0033C25.3159 24.7543 24.2949 25.4673 23.6129 25.8323C22.7469 26.2983 22.1349 26.5483 21.6299 26.7463C20.3649 27.3063 19.0609 27.7733 17.6569 28.0423C15.9649 28.3513 14.1939 28.4433 12.4569 28.1373C11.4779 27.9663 10.5119 27.6663 9.60891 27.2493C8.77491 26.8663 7.99192 26.3853 7.26992 25.8403C6.83592 25.5393 6.43893 25.2343 6.08093 24.9383C5.57893 24.5223 5.15993 24.1263 4.83493 23.7793C4.04993 22.9443 3.31593 21.8893 2.80893 21.0953C2.72593 20.9663 2.64792 20.8433 2.57592 20.7293C2.56192 20.7093 2.54793 20.6893 2.53393 20.6703C2.08593 20.0263 1.71892 19.3293 1.43792 18.5993C1.42892 18.5453 1.42093 18.4903 1.41293 18.4353C1.32093 17.7443 1.08292 16.9423 1.01092 15.6333C0.984921 15.0653 0.998928 14.4013 1.12393 13.6353C1.20693 13.1413 1.31993 12.9023 1.40893 12.7113C1.43593 12.6543 1.46193 12.6023 1.48593 12.5483C1.56793 12.3653 1.59392 12.1563 1.63592 11.9083C1.68992 11.5883 1.76992 11.1943 2.04592 10.7553C2.94392 9.37934 3.36792 8.81934 3.66592 8.33934C3.75592 8.20334 3.84292 8.08134 3.94192 7.96634C4.21592 7.64634 4.67693 7.29534 5.10293 7.05734C5.16693 7.02234 5.23093 6.98834 5.29193 6.95534C5.62993 6.77834 6.22592 6.30135 6.66992 5.92035C6.83692 5.77635 7.08193 5.60735 7.37393 5.40935C7.67393 5.20535 8.02593 4.96934 8.39193 4.70234C9.32093 4.02634 9.84091 3.69134 10.2599 3.42334C10.3799 3.34734 10.4919 3.27734 10.6049 3.20834C10.9609 2.98834 11.4149 2.73034 11.8869 2.48634C12.4519 2.19334 13.0469 1.92133 13.5089 1.72233C14.7399 1.30233 16.0539 1.01333 17.4169 1.00033C18.1169 0.991333 18.7939 1.16534 19.2389 1.43034C19.6869 1.69534 19.8689 2.00335 19.8039 2.23935C19.7379 2.47835 19.4399 2.63634 19.0109 2.74734C18.5789 2.85634 18.0469 2.92035 17.4889 2.96135C16.3639 3.04235 15.2399 3.36435 14.1499 3.80835C12.8199 4.35135 11.5379 5.07133 10.2719 5.84733C9.38691 6.39133 8.51192 6.97334 7.63592 7.56834C7.54492 7.63034 7.45492 7.69135 7.36492 7.75235C6.97392 8.06635 6.58293 8.38134 6.22293 8.66334C5.97893 8.85734 5.76793 9.04834 5.59393 9.21434C5.26893 9.52334 5.02393 9.74334 4.81893 9.93934C4.67793 10.0753 4.55793 10.2013 4.45593 10.3443C4.40093 10.4213 4.32992 10.5273 4.24792 10.6593C3.90492 11.1933 3.44493 12.1693 3.15393 13.1173C3.01893 13.5363 2.87991 14.0343 2.79391 14.5253C2.66591 15.2253 2.65594 15.9053 2.71994 16.2373C2.82794 16.8193 2.95593 17.4833 3.14093 18.0553C3.31293 18.6003 3.52991 19.0583 3.70791 19.2823C3.81591 19.4183 3.90394 19.5473 3.99594 19.6913C4.09394 19.8413 4.19191 20.0073 4.31091 20.2033C4.47891 20.4803 4.68592 20.8163 5.00192 21.2493C5.36492 21.7463 5.61793 22.1043 5.83493 22.4023C6.14493 22.8243 6.38591 23.1343 6.83691 23.5033C7.33891 23.9113 7.86593 24.3113 8.26693 24.6393C8.44893 24.7883 8.66993 24.9443 8.90493 25.0963C9.21593 25.2963 9.55192 25.4893 9.85592 25.6703C10.1059 25.8203 10.3059 25.9633 10.4869 26.0863C10.5429 26.1243 10.5979 26.1603 10.6519 26.1943C10.8699 26.2803 11.0929 26.3593 11.3159 26.4283C11.3539 26.4323 11.3949 26.4353 11.4369 26.4393C11.6509 26.4573 11.9089 26.4733 12.2209 26.5133C12.7169 26.5753 13.1399 26.6603 13.6019 26.7243C13.9589 26.7733 14.3409 26.8083 14.7729 26.7893C15.0729 26.7753 15.4069 26.7353 15.7389 26.6813C16.2349 26.6023 16.7179 26.4943 17.0569 26.4473C17.1499 26.4343 17.2359 26.4343 17.3209 26.4373C17.3489 26.4393 17.3799 26.4413 17.4109 26.4433C17.4119 26.4433 17.4119 26.4433 17.4129 26.4433C17.4199 26.4433 17.4279 26.4443 17.4349 26.4443C18.2329 26.2413 19.0259 25.9433 19.7959 25.5983C19.8609 25.5633 19.9259 25.5273 19.9899 25.4913C20.3059 25.3173 20.6049 25.1383 20.7869 24.9943C20.9829 24.8393 21.5189 24.5373 22.0579 24.1853C22.4109 23.9553 22.7649 23.7053 23.0369 23.4833C23.1949 23.3553 23.3689 23.2693 23.5479 23.1773C23.7129 23.0923 23.8809 23.0013 24.0349 22.8653C24.1109 22.7983 24.1869 22.7173 24.2639 22.6303C24.3309 22.5563 24.4039 22.4723 24.4759 22.3923C24.5459 22.3153 24.7199 22.1723 24.9139 21.9793C25.0079 21.8863 25.1059 21.7783 25.1909 21.6713C25.2199 21.6323 25.2489 21.5943 25.2769 21.5553C25.5919 21.0403 25.8779 20.5003 26.1019 19.9653C26.1299 19.8403 26.1379 19.7293 26.1279 19.6373C26.1199 19.5703 26.1029 19.5113 26.0839 19.4503C26.0599 19.3643 26.0329 19.2773 26.0239 19.1723C26.0169 19.0893 26.0309 19.0043 26.0629 18.9543C26.0779 18.9323 26.0969 18.9143 26.1129 18.8993C26.1329 18.8823 26.1499 18.8673 26.1569 18.8443C26.1609 18.8273 26.1579 18.8073 26.1529 18.7833C26.1459 18.7443 26.1369 18.6943 26.1539 18.6293C26.2189 18.3853 26.2869 18.1103 26.3319 17.8383C26.3829 17.5393 26.4049 17.2433 26.3949 17.0123C26.3849 16.7493 26.3909 16.3823 26.3469 16.0003C26.3179 15.7343 26.2659 15.4663 26.1979 15.2383C26.1319 15.0143 26.0219 14.7913 25.9039 14.5783C25.7629 14.3223 25.6119 14.0783 25.5169 13.8453C25.4969 13.7983 25.4999 13.7263 25.4999 13.6323C25.5009 13.5673 25.4999 13.4913 25.4919 13.4083C25.3239 13.1243 25.1459 12.8423 24.9589 12.5483C24.9479 12.5413 24.9369 12.5333 24.9249 12.5263C24.6689 12.3503 24.3139 12.1173 24.0769 11.5503C24.0179 11.4063 24.0069 11.2983 23.9969 11.1993C23.9859 11.1013 23.9799 11.0183 23.9289 10.9093C23.8709 10.7853 23.7759 10.6583 23.6709 10.4993C23.5849 10.3703 23.4899 10.2133 23.4199 10.0423C23.3819 9.95134 23.3509 9.85734 23.3329 9.75934C23.3299 9.74334 23.3269 9.72534 23.3229 9.70634C23.2899 9.52734 23.2439 9.26534 23.2409 8.98634C23.0209 8.24434 22.8339 7.48833 22.6519 6.77633C22.3429 5.57133 22.0519 4.54234 21.3329 3.95434C20.9839 3.65334 20.5689 3.35433 20.2459 3.05433C19.9259 2.75633 19.7449 2.47534 19.8019 2.23834C19.8639 2.00634 20.1589 1.82934 20.6659 1.80534C21.1699 1.78334 21.8699 1.93235 22.5209 2.39235C23.6159 3.14235 24.2029 4.38334 24.5599 5.35734C24.5829 5.40834 24.6049 5.46034 24.6259 5.51234C24.7849 5.89434 24.9529 6.22834 25.1199 6.55534C25.1579 6.63034 25.1969 6.70834 25.2339 6.78134Z`,className:`ok-blob-body`}),t[21]=U):U=t[21];let W=(F||T)&&`ok-blob-eye-hidden`,G;t[22]===W?G=t[23]:(G=Ei(`ok-blob-eye`,W),t[22]=W,t[23]=G);let K;t[24]===G?K=t[25]:(K=(0,Z.jsx)(`ellipse`,{cx:nb,cy:ib,rx:1.2722,ry:1.9083,className:G}),t[24]=G,t[25]=K);let q=(F||T)&&`ok-blob-eye-hidden`,ee;t[26]===q?ee=t[27]:(ee=Ei(`ok-blob-eye ok-blob-eye-right`,q),t[26]=q,t[27]=ee);let te;t[28]===ee?te=t[29]:(te=(0,Z.jsx)(`ellipse`,{cx:rb,cy:ib,rx:1.2722,ry:1.9083,className:ee}),t[28]=ee,t[29]=te);let ne;t[30]===I?ne=t[31]:(ne=ob(nb,I),t[30]=I,t[31]=ne);let re=(!F||T)&&`ok-blob-eye-hidden`,ie;t[32]===re?ie=t[33]:(ie=Ei(`ok-blob-happy-eye`,re),t[32]=re,t[33]=ie);let ae;t[34]!==ne||t[35]!==ie?(ae=(0,Z.jsx)(`path`,{d:ne,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:ie}),t[34]=ne,t[35]=ie,t[36]=ae):ae=t[36];let oe;t[37]===I?oe=t[38]:(oe=ob(rb,I),t[37]=I,t[38]=oe);let se=(!F||T)&&`ok-blob-eye-hidden`,ce;t[39]===se?ce=t[40]:(ce=Ei(`ok-blob-happy-eye`,se),t[39]=se,t[40]=ce);let le;t[41]!==oe||t[42]!==ce?(le=(0,Z.jsx)(`path`,{d:oe,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:ce}),t[41]=oe,t[42]=ce,t[43]=le):le=t[43];let ue;t[44]===T?ue=t[45]:(ue=T?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`path`,{d:sb(nb),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`}),(0,Z.jsx)(`path`,{d:sb(rb),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`})]}):null,t[44]=T,t[45]=ue);let de;t[46]!==K||t[47]!==te||t[48]!==ae||t[49]!==le||t[50]!==ue?(de=(0,Z.jsxs)(`g`,{ref:p,children:[K,te,ae,le,ue]}),t[46]=K,t[47]=te,t[48]=ae,t[49]=le,t[50]=ue,t[51]=de):de=t[51];let fe;t[52]!==B||t[53]!==H||t[54]!==de?(fe=(0,Z.jsxs)(`g`,{className:H,children:[U,de]},B),t[52]=B,t[53]=H,t[54]=de,t[55]=fe):fe=t[55];let pe;t[56]===T?pe=t[57]:(pe=T?(0,Z.jsxs)(`g`,{children:[(0,Z.jsx)(`text`,{x:21,y:7,className:`ok-blob-z ok-blob-z-1`,children:`z`}),(0,Z.jsx)(`text`,{x:26,y:2,className:`ok-blob-z ok-blob-z-2`,children:`z`})]}):null,t[56]=T,t[57]=pe);let me;t[58]!==v||t[59]!==x?(me=x.length>0&&(0,Z.jsx)(`g`,{children:x.map(fb)},`firework-${v}`),t[58]=v,t[59]=x,t[60]=me):me=t[60];let he;t[61]!==D||t[62]!==s||t[63]!==z||t[64]!==fe||t[65]!==pe||t[66]!==me?(he=(0,Z.jsxs)(`svg`,{ref:f,width:s,height:s,viewBox:`0 0 30 30`,fill:`none`,overflow:`visible`,xmlns:`http://www.w3.org/2000/svg`,className:z,"aria-hidden":`true`,onClick:D,onMouseDown:pb,children:[fe,pe,me]}),t[61]=D,t[62]=s,t[63]=z,t[64]=fe,t[65]=pe,t[66]=me,t[67]=he):he=t[67];let ge;return t[68]!==R||t[69]!==he?(ge=(0,Z.jsx)(`span`,{ref:d,className:R,children:he}),t[68]=R,t[69]=he,t[70]=ge):ge=t[70],ge}function fb(e){return(0,Z.jsx)(`circle`,{cx:cb+e.originDx,cy:lb+e.originDy,r:e.size,className:`ok-blob-firework`,style:ub(e)},e.id)}function pb(e){return e.preventDefault()}function mb(e){return e+1}function hb(e){return e+1}function gb(e){let t=(0,$.c)(12),{title:n,subtitle:r,celebrateSignal:i}=e,a;t[0]===i?a=t[1]:(a=(0,Z.jsx)(db,{size:64,celebrateSignal:i}),t[0]=i,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,Z.jsx)(`h2`,{className:`text-2xl font-light tracking-tighter text-balance`,children:n}),t[2]=n,t[3]=o);let s;t[4]===r?s=t[5]:(s=r?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r}):null,t[4]=r,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;return t[9]!==a||t[10]!==c?(l=(0,Z.jsxs)(`div`,{className:`flex items-center gap-4`,children:[a,c]}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}function _b(e){let t=(0,$.c)(8),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=Ei(`pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm bg-muted px-1 font-sans text-xs font-medium text-muted-foreground select-none in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background dark:in-data-[slot=tooltip-content]:bg-background/10 [&_svg:not([class*='size-'])]:size-3`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`kbd`,{"data-slot":`kbd`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function vb(){let e=(0,$.c)(2),t=zr()?`⌘ K`:`Ctrl K`,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(_b,{children:t}),e[0]=n):n=e[0];let r;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(`p`,{className:`text-1sm text-muted-foreground`,children:[n,` `,(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`A1taO8`})})]}),e[1]=r):r=e[1],r}var yb=`open-knowledge:create-top-level-file`;function bb(){window.dispatchEvent(new CustomEvent(yb))}function xb(e){let t=()=>e();return window.addEventListener(yb,t),()=>window.removeEventListener(yb,t)}function Sb(){let e=(0,$.c)(14),[t,n]=(0,Q.useState)(!1),[r,i]=(0,Q.useState)(void 0),[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(0),l=(0,Q.useRef)(!1),u=(0,Q.useRef)(void 0),d,f;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>{let e=!1,t=async function(){try{let t=await fetch(`/api/documents`),n=await t.json().catch(Eb);if(e)return;let r=t.ok?mr.safeParse(n):null;r?.success?(o(Db(r.data.documents)),l.current=!0):l.current||=(o(1),!0)}catch{!e&&!l.current&&(o(1),l.current=!0)}};t();let n=yi(e=>{e.includes(`files`)&&t()});return()=>{e=!0,n(),clearTimeout(u.current)}},f=[],e[0]=d,e[1]=f):(d=e[0],f=e[1]),(0,Q.useEffect)(d,f);let p;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=function(){clearTimeout(u.current),u.current=setTimeout(()=>c(Tb),500),fetch(`/api/documents`).then(async e=>{let t=await e.json().catch(wb);if(!e.ok)return;let n=mr.safeParse(t);n.success&&o(Db(n.data.documents))}).catch(Cb)},e[2]=p):p=e[2];let m=p,h=a!==null,g=a===0,_;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(_=function(e){n(e),e||i(void 0)},e[3]=_):_=e[3];let v=_,y;e[4]!==s||e[5]!==g||e[6]!==h?(y=h?g?(0,Z.jsx)(Ob,{celebrateSignal:s,onPackSelect:e=>{i(e),n(!0)}}):(0,Z.jsx)(kb,{celebrateSignal:s,onAddStarterPack:()=>{n(!0)}}):null,e[4]=s,e[5]=g,e[6]=h,e[7]=y):y=e[7];let b;e[8]!==r||e[9]!==t?(b=(0,Z.jsx)(hm,{open:t,onOpenChange:v,onSeedApplied:m,initialPackId:r}),e[8]=r,e[9]=t,e[10]=b):b=e[10];let x;return e[11]!==y||e[12]!==b?(x=(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center overflow-y-auto px-6 sm:px-12 md:px-16 subtle-scrollbar`,children:[y,b]}),e[11]=y,e[12]=b,e[13]=x):x=e[13],x}function Cb(){}function wb(){return null}function Tb(e){return e+1}function Eb(){return null}function Db(e){return Rn(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}function Ob(e){let t=(0,$.c)(16),{celebrateSignal:n,onPackSelect:r}=e,{_:a}=i(),o;t[0]===a?o=t[1]:(o=a({id:`ZmGmNh`}),t[0]=a,t[1]=o);let c;t[2]===a?c=t[3]:(c=a({id:`W8uemY`}),t[2]=a,t[3]=c);let l;t[4]!==n||t[5]!==o||t[6]!==c?(l=(0,Z.jsx)(gb,{title:o,subtitle:c,celebrateSignal:n}),t[4]=n,t[5]=o,t[6]=c,t[7]=l):l=t[7];let u;t[8]===r?u=t[9]:(u=(0,Z.jsx)(cm,{onPackSelect:r}),t[8]=r,t[9]=u);let d;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Ni,{variant:`link`,className:`text-muted-foreground font-normal justify-end`,size:`sm`,onClick:bb,children:(0,Z.jsx)(s,{id:`ensWZc`,components:{0:(0,Z.jsx)(La,{"aria-hidden":`true`,className:`size-3`})}})}),t[10]=d):d=t[10];let f;t[11]===u?f=t[12]:(f=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-3`,children:[u,d]}),t[11]=u,t[12]=f);let p;return t[13]!==l||t[14]!==f?(p=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,children:[l,f]}),t[13]=l,t[14]=f,t[15]=p):p=t[15],p}function kb(e){let t=(0,$.c)(19),{celebrateSignal:n,onAddStarterPack:r}=e,{_:a}=i(),o;t[0]===a?o=t[1]:(o=a({id:`8XS8nG`}),t[0]=a,t[1]=o);let c;t[2]===a?c=t[3]:(c=a({id:`GjElCU`}),t[2]=a,t[3]=c);let l;t[4]!==n||t[5]!==o||t[6]!==c?(l=(0,Z.jsx)(gb,{title:o,subtitle:c,celebrateSignal:n}),t[4]=n,t[5]=o,t[6]=c,t[7]=l):l=t[7];let u;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(By,{}),t[8]=u):u=t[8];let d,f;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(P,{"aria-hidden":`true`,className:`size-3`}),f=(0,Z.jsx)(s,{id:`IajAbS`}),t[9]=d,t[10]=f):(d=t[9],f=t[10]);let p;t[11]===r?p=t[12]:(p=(0,Z.jsxs)(Ni,{onClick:r,variant:`link`,size:`xs`,className:`font-mono text-xs uppercase tracking-wider text-muted-foreground font-normal hover:text-foreground hover:no-underline`,children:[d,f]}),t[11]=r,t[12]=p);let m;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(vb,{}),t[13]=m):m=t[13];let h;t[14]===p?h=t[15]:(h=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[u,(0,Z.jsxs)(`div`,{className:`flex w-full items-center justify-between gap-4`,children:[p,m]})]}),t[14]=p,t[15]=h);let g;return t[16]!==l||t[17]!==h?(g=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,children:[l,h]}),t[16]=l,t[17]=h,t[18]=g):g=t[18],g}function Ab(e){return e===``?`.ok/frontmatter.yml`:`${e}/.ok/frontmatter.yml`}function jb(e){let t=(0,$.c)(76),{folderPath:n,state:r,onChange:a}=e,{_:o}=i(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(null);if(r.status===`idle`||r.status===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card p-4 space-y-3`,children:[(0,Z.jsx)(Nb,{}),(0,Z.jsx)(eo,{className:`h-7 w-full`}),(0,Z.jsx)(eo,{className:`h-7 w-full`}),(0,Z.jsx)(eo,{className:`h-7 w-full`})]}),t[0]=e):e=t[0],e}if(r.status===`error`){let{message:e}=r,n;return t[1]===e?n=t[2]:(n=(0,Z.jsx)(`section`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-4 text-sm text-destructive`,role:`alert`,children:(0,Z.jsx)(s,{id:`4UMKtb`,values:{message:e}})}),t[1]=e,t[2]=n),n}let m;t[3]===r.data.folder.frontmatter_defaults?m=t[4]:(m=r.data.folder.frontmatter_defaults??{},t[3]=r.data.folder.frontmatter_defaults,t[4]=m);let h=m,g;t[5]===r.data.frontmatterLocal?g=t[6]:(g=r.data.frontmatterLocal??{},t[5]=r.data.frontmatterLocal,t[6]=g);let _=g,v=r.data.frontmatterSources,y;t[7]===r.data.folder.path?y=t[8]:(y=Ab(r.data.folder.path),t[7]=r.data.folder.path,t[8]=y);let b=y,x,S,C,w,T,E,D,O,k,A,j,M,N;if(t[9]!==o||t[10]!==u||t[11]!==c||t[12]!==b||t[13]!==n||t[14]!==_||t[15]!==h||t[16]!==a||t[17]!==f||t[18]!==v){let e=Object.keys(h),r=async function(e,t){let r=await ta(n,{[e]:t});if(!r.ok){let{error:e}=r;$o.error(o({id:`xXo8FT`,values:{error:e}}));return}a()},i=async function(e){let t=await ta(n,{[e]:null});if(!t.ok){let{error:e}=t;$o.error(o({id:`ZU8VV_`,values:{error:e}}));return}a()},m=function(e,t){let n=h[e];r(e,Sa(n,t))},g;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(g=function(){d({name:``,type:`text`,value:``,error:null}),l(!1)},t[32]=g):g=t[32],C=g;let y;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(y=function(e){d(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):ra[e];return{...t,type:e,value:n,error:null}})},t[33]=y):y=t[33],T=y;let P;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(P=function(e){d(t=>t&&{...t,value:e})},t[34]=P):P=t[34],E=P;let F;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(F=function(e){d(t=>t&&{...t,name:e,error:null})},t[35]=F):F=t[35],w=F;let I;t[36]!==o||t[37]!==u||t[38]!==n||t[39]!==h||t[40]!==a?(I=async function(){if(!u)return;let e=u.name.trim();if(!e){d({...u,error:o({id:`8_brI5`})});return}if(Object.hasOwn(h,e)){d({...u,error:o({id:`6lBXm5`,values:{trimmed:e}})});return}let t=await ta(n,{[e]:u.value});if(!t.ok){d({...u,error:t.error});return}d(null),a()},t[36]=o,t[37]=u,t[38]=n,t[39]=h,t[40]=a,t[41]=I):I=t[41],D=I;let L=function(e){p({key:e,draft:e,error:null})},R=function(e){p(t=>t&&{...t,draft:e,error:null})},z=async function(){if(!f)return;let e=f.draft.trim();if(!e){p({...f,error:o({id:`8_brI5`})});return}if(e===f.key){p(null);return}if(Object.hasOwn(h,e)){p({...f,error:o({id:`6lBXm5`,values:{trimmed:e}})});return}let t=h[f.key],r=await ta(n,{[f.key]:null,[e]:t});if(!r.ok){p({...f,error:r.error});return}p(null),a()},B=function(){p(null)};N=`rounded-lg border bg-card`,S=is,A=!c,t[42]===Symbol.for(`react.memo_cache_sentinel`)?(j=e=>l(!e),t[42]=j):j=t[42];let V=`size-3 transition-transform ${c?``:`rotate-90`}`,H;t[43]===V?H=t[44]:(H=(0,Z.jsx)(es,{className:V,"aria-hidden":!0}),t[43]=V,t[44]=H);let U;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`IX_qeH`})}),t[45]=U):U=t[45];let W;t[46]===H?W=t[47]:(W=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:[H,U]}),t[46]=H,t[47]=W);let G;t[48]===b?G=t[49]:(G=(0,Z.jsx)(`code`,{className:`text-xs text-muted-foreground font-mono cursor-text select-text`,onClick:Mb,children:b}),t[48]=b,t[49]=G),t[50]!==W||t[51]!==G?(M=(0,Z.jsxs)(rs,{className:`flex w-full cursor-pointer items-center justify-between gap-2 px-3 py-2.5 data-[state=open]:border-b border-border`,children:[W,G]}),t[50]=W,t[51]=G,t[52]=M):M=t[52],x=ns,O=`px-2 py-2`,k=e.length===0&&!u?(0,Z.jsx)(`p`,{className:`px-1 py-1 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`50Y3WA`})}):e.map(e=>{let t=h[e],n=Object.hasOwn(_,e);return(0,Z.jsx)(ja,{keyName:e,value:t,declared:io(t,pi(t)),rename:n?{state:f?.key===e?f:null,onBegin:()=>L(e),onChangeDraft:R,onCommit:z,onCancel:B}:void 0,badge:n?null:(0,Z.jsx)(aa,{source:v[e]??``}),isInherited:!n,onCommit:t=>void r(e,t),onChangeType:t=>m(e,t),onRemove:n?()=>void i(e):void 0},e)}),t[9]=o,t[10]=u,t[11]=c,t[12]=b,t[13]=n,t[14]=_,t[15]=h,t[16]=a,t[17]=f,t[18]=v,t[19]=x,t[20]=S,t[21]=C,t[22]=w,t[23]=T,t[24]=E,t[25]=D,t[26]=O,t[27]=k,t[28]=A,t[29]=j,t[30]=M,t[31]=N}else x=t[19],S=t[20],C=t[21],w=t[22],T=t[23],E=t[24],D=t[25],O=t[26],k=t[27],A=t[28],j=t[29],M=t[30],N=t[31];let F;t[53]!==u||t[54]!==C||t[55]!==w||t[56]!==T||t[57]!==E||t[58]!==D?(F=u?(0,Z.jsx)(To,{draft:u,onChangeName:w,onChangeType:T,onChangeValue:E,onCommit:()=>void D(),onCancel:()=>d(null)}):(0,Z.jsxs)(Ni,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:C,className:`mt-1 flex items-center gap-1.5 rounded px-2 py-1 font-medium text-sm hover:bg-muted/50 hover:text-foreground`,children:[(0,Z.jsx)(P,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`F-NRCj`})})]}),t[53]=u,t[54]=C,t[55]=w,t[56]=T,t[57]=E,t[58]=D,t[59]=F):F=t[59];let I;t[60]!==F||t[61]!==O||t[62]!==k?(I=(0,Z.jsxs)(`div`,{className:O,children:[k,F]}),t[60]=F,t[61]=O,t[62]=k,t[63]=I):I=t[63];let L;t[64]!==x||t[65]!==I?(L=(0,Z.jsx)(x,{children:I}),t[64]=x,t[65]=I,t[66]=L):L=t[66];let R;t[67]!==S||t[68]!==L||t[69]!==A||t[70]!==j||t[71]!==M?(R=(0,Z.jsxs)(S,{open:A,onOpenChange:j,children:[M,L]}),t[67]=S,t[68]=L,t[69]=A,t[70]=j,t[71]=M,t[72]=R):R=t[72];let z;return t[73]!==R||t[74]!==N?(z=(0,Z.jsx)(`section`,{className:N,children:R}),t[73]=R,t[74]=N,t[75]=z):z=t[75],z}function Mb(e){return e.stopPropagation()}function Nb(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Tc,{className:`size-4 text-muted-foreground`,"aria-hidden":!0}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t,(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(s,{id:`IX_qeH`})})]}),e[1]=n):n=e[1],n}function Pb(e){let t=e.split(`/`).pop();return t?`${e}/${t}`:null}function Fb(e,t){let n=t.get(`${e}/index`);if(n)return n;let r=Pb(e);if(r){let e=t.get(r);if(e)return e}return e.split(`/`).pop()??e}function Ib(e,t,n){let r=n.get(e);return r&&r!==e?r:t}function Lb(e,t){let n=`${e}/`,r=[...t.folderPaths].filter(e=>e.startsWith(n)).map(e=>({path:e,rel:e.slice(n.length)})).filter(e=>e.rel.length>0&&!e.rel.includes(`/`)).map(({path:e,rel:n})=>({kind:`folder`,path:e,name:n,title:Fb(e,t.pageTitles)})),i=[...t.pages].filter(e=>e.startsWith(n)).map(e=>({docName:e,rel:e.slice(n.length)})).filter(e=>e.rel.length>0&&!e.rel.includes(`/`)).map(({docName:e,rel:n})=>{let r=t.pageMeta.get(e);return{kind:`file`,path:e,name:n,title:Ib(e,n,t.pageTitles),size:r?.size??0,modified:r?.modified??``}}),a=[...r,...i].sort((e,t)=>e.kind===t.kind?e.title.localeCompare(t.title)||e.name.localeCompare(t.name):e.kind===`folder`?-1:1);return{title:Fb(e,t.pageTitles),children:a}}function Rb(e){let t=(0,$.c)(44),{folderPath:n,state:r,onChange:i,folderConfigHandle:a}=e,[o,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(!1);if(r.status===`idle`||r.status===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card px-3 py-2.5 space-y-3`,children:[(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(s,{id:`-QCLWk`})})}),(0,Z.jsx)(eo,{className:`h-12 w-full`}),(0,Z.jsx)(eo,{className:`h-12 w-full`})]}),t[0]=e):e=t[0],e}if(r.status===`error`){let{message:e}=r,n;return t[1]===e?n=t[2]:(n=(0,Z.jsx)(`section`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-4 text-sm text-destructive`,role:`alert`,children:(0,Z.jsx)(s,{id:`iDZtvM`,values:{message:e}})}),t[1]=e,t[2]=n),n}let h;t[3]===r.data.folder.templates_available?h=t[4]:(h=r.data.folder.templates_available??[],t[3]=r.data.folder.templates_available,t[4]=h);let g=h,_;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(s,{id:`-QCLWk`})}),t[5]=_):_=t[5];let v;t[6]===g.length?v=t[7]:(v=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[_,(0,Z.jsx)(x,{className:`text-xs`,variant:`secondary`,children:g.length})]}),t[6]=g.length,t[7]=v);let y;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsxs)(Ni,{variant:`ghost`,className:`font-mono uppercase`,size:`sm`,onClick:()=>m(!0),children:[(0,Z.jsx)(P,{className:`size-3.5`,"aria-hidden":!0}),(0,Z.jsx)(s,{id:`G1Gw0v`})]}),t[8]=y):y=t[8];let b;t[9]===v?b=t[10]:(b=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border px-3 py-1`,children:[v,y]}),t[9]=v,t[10]=b);let S;t[11]===g?S=t[12]:(S=(0,Z.jsx)(`div`,{className:`px-3 py-2.5`,children:g.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`BHW0EW`})}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:g.map(e=>(0,Z.jsx)(Co,{template:e,onCreate:()=>f(e.name),onEdit:()=>c(e),onDelete:()=>u(e),badge:e.scope===`inherited`?(0,Z.jsx)(aa,{source:e.source_folder,target:`templates/${e.name}.md`}):void 0},e.path))})}),t[11]=g,t[12]=S);let C;t[13]!==b||t[14]!==S?(C=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card`,children:[b,S]}),t[13]=b,t[14]=S,t[15]=C):C=t[15];let w;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(w=e=>{e||c(null)},t[16]=w):w=t[16];let T;t[17]!==o||t[18]!==n||t[19]!==i?(T=(0,Z.jsx)(ko,{folderPath:n,template:o,onOpenChange:w,onSaved:i}),t[17]=o,t[18]=n,t[19]=i,t[20]=T):T=t[20];let E;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>{e||u(null)},t[21]=E):E=t[21];let D;t[22]!==l||t[23]!==i?(D=(0,Z.jsx)(Ga,{template:l,onOpenChange:E,onDeleted:i}),t[22]=l,t[23]=i,t[24]=D):D=t[24];let O;t[25]===g?O=t[26]:(O=new Set(g.map(zb)),t[25]=g,t[26]=O);let k;t[27]!==n||t[28]!==p||t[29]!==i||t[30]!==O?(k=(0,Z.jsx)(ka,{folderPath:n,existingNames:O,open:p,onOpenChange:m,onCreated:i}),t[27]=n,t[28]=p,t[29]=i,t[30]=O,t[31]=k):k=t[31];let A=d!==null,j;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(j=e=>{e||f(null)},t[32]=j):j=t[32];let M=d??void 0,N;t[33]!==a||t[34]!==n||t[35]!==A||t[36]!==M?(N=(0,Z.jsx)(Gp,{open:A,onOpenChange:j,kind:`file`,initialDir:n,initialTemplate:M,folderConfig:a}),t[33]=a,t[34]=n,t[35]=A,t[36]=M,t[37]=N):N=t[37];let F;return t[38]!==D||t[39]!==k||t[40]!==N||t[41]!==C||t[42]!==T?(F=(0,Z.jsxs)(Z.Fragment,{children:[C,T,D,k,N]}),t[38]=D,t[39]=k,t[40]=N,t[41]=C,t[42]=T,t[43]=F):F=t[43],F}function zb(e){return e.name}function Bb(e){let t=(0,$.c)(14),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,containerClassName:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=Ei(`relative w-full overflow-x-auto subtle-scrollbar`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=Ei(`w-full caption-bottom text-sm`,n),t[6]=n,t[7]=o);let s;t[8]!==i||t[9]!==o?(s=(0,Z.jsx)(`table`,{"data-slot":`table`,className:o,...i}),t[8]=i,t[9]=o,t[10]=s):s=t[10];let c;return t[11]!==a||t[12]!==s?(c=(0,Z.jsx)(`div`,{"data-slot":`table-container`,className:a,children:s}),t[11]=a,t[12]=s,t[13]=c):c=t[13],c}function Vb(e){let t=(0,$.c)(8),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=Ei(`[&_tr]:border-b`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`thead`,{"data-slot":`table-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Hb(e){let t=(0,$.c)(8),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=Ei(`[&_tr:last-child]:border-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`tbody`,{"data-slot":`table-body`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ub(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,noHover:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=(i===void 0?!1:i)&&`hover:bg-transparent`,o;t[4]!==n||t[5]!==a?(o=Ei(`hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors`,a,n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(`tr`,{"data-slot":`table-row`,className:o,...r}),t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function Wb(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,scope:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`col`:i,o;t[4]===n?o=t[5]:(o=Ei(`font-mono uppercase text-xs text-muted-foreground h-10 px-4 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,n),t[4]=n,t[5]=o);let s;return t[6]!==r||t[7]!==a||t[8]!==o?(s=(0,Z.jsx)(`th`,{"data-slot":`table-head`,scope:a,className:o,...r}),t[6]=r,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function Gb(e){let t=(0,$.c)(8),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=Ei(`py-3 px-4 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`td`,{"data-slot":`table-cell`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Kb(e){if(!e)return`—`;let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return X._({id:`xOTzt5`});if(r<60)return X._({id:`NRSLBe`,values:{diffMin:r}});let i=Math.floor(r/60);if(i<24)return X._({id:`hDKtoF`,values:{diffHrs:i}});let a=Math.floor(i/24);return a<30?X._({id:`QDZbvN`,values:{diffDays:a}}):t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function qb(e,t,n){return[...e].sort((e,r)=>{if(e.kind!==r.kind)return e.kind===`folder`?-1:1;let i=0;switch(t){case`name`:i=e.title.localeCompare(r.title)||e.name.localeCompare(r.name);break;case`modified`:{let t=e.kind===`file`?e.modified:``,n=r.kind===`file`?r.modified:``;i=t.localeCompare(n);break}}return n===`asc`?i:-i})}function Jb(e){let t=(0,$.c)(10),{label:n,sortKey:r,activeKey:i,activeDir:a,onSort:o}=e,s=i===r,c;t[0]!==o||t[1]!==r?(c=()=>o(r),t[0]=o,t[1]=r,t[2]=c):c=t[2];let l;t[3]!==a||t[4]!==s?(l=s?a===`asc`?(0,Z.jsx)(qe,{className:`ml-1 size-3`}):(0,Z.jsx)(bt,{className:`ml-1 size-3`}):(0,Z.jsx)(ec,{className:`ml-1 size-3 text-muted-foreground/50`}),t[3]=a,t[4]=s,t[5]=l):l=t[5];let u;return t[6]!==n||t[7]!==c||t[8]!==l?(u=(0,Z.jsxs)(Ni,{variant:`ghost`,size:`sm`,className:`-ml-3 h-8 uppercase font-mono`,onClick:c,children:[n,l]}),t[6]=n,t[7]=c,t[8]=l,t[9]=u):u=t[9],u}function Yb(e){let t=(0,$.c)(92),{folderPath:n}=e,{_:r}=i(),{folderPaths:a,loading:o,pages:c,pageTitles:l,pageMeta:u}=gi(),d=co(n),{state:f,refresh:p}=d,[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(`name`),[v,y]=(0,Q.useState)(`asc`);if(o){let e;t[0]===r?e=t[1]:(e=r({id:`X9VpsP`}),t[0]=r,t[1]=e);let n;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(eo,{className:`size-5 rounded`}),(0,Z.jsx)(eo,{className:`h-7 w-48`})]}),(0,Z.jsx)(eo,{className:`h-9 w-20 rounded-md`})]}),t[2]=n):n=t[2];let i;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(eo,{className:`h-4 w-16`}),t[3]=i):i=t[3];let a;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(`div`,{className:`mx-auto flex w-full max-w-4xl flex-col gap-6 px-6 py-8`,children:[n,(0,Z.jsxs)(`div`,{className:`rounded-lg border`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-4 border-b px-4 py-3`,children:[i,(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(eo,{className:`h-4 w-20`})})]}),[`a`,`b`,`c`,`d`].map(Qb)]})]}),t[4]=a):a=t[4];let o;return t[5]===e?o=t[6]:(o=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-start overflow-y-auto subtle-scrollbar`,role:`status`,"aria-busy":`true`,"aria-label":e,children:a}),t[5]=e,t[6]=o),o}let b,x,S,C,w,T,E,D,O,k;if(t[7]!==r||t[8]!==f||t[9]!==d||t[10]!==n||t[11]!==a||t[12]!==u||t[13]!==l||t[14]!==c||t[15]!==p||t[16]!==v||t[17]!==g){let e=Lb(n,{pages:c,pageTitles:l,pageMeta:u,folderPaths:a}),i=qb(e.children,g,v),o;t[28]===g?o=t[29]:(o=function(e){e===g?y(Zb):(_(e),y(`asc`))},t[28]=g,t[29]=o);let m=o;k=`flex min-h-0 flex-1 items-start overflow-y-auto subtle-scrollbar`,T=`mx-auto flex w-full max-w-4xl flex-col gap-6 px-6 py-8`;let A;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(se,{className:`size-5 text-muted-foreground`}),t[30]=A):A=t[30];let j=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[A,(0,Z.jsx)(`h1`,{className:`text-2xl font-light tracking-tight`,children:e.title})]}),M;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsxs)(Ni,{onClick:()=>h(!0),children:[(0,Z.jsx)(P,{className:`size-4`}),(0,Z.jsx)(s,{id:`isRobC`})]}),t[31]=M):M=t[31],t[32]===j?E=t[33]:(E=(0,Z.jsx)(`div`,{className:`flex flex-col gap-6`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[j,M]})}),t[32]=j,t[33]=E),t[34]!==f||t[35]!==n||t[36]!==p?(D=(0,Z.jsx)(jb,{folderPath:n,state:f,onChange:p}),t[34]=f,t[35]=n,t[36]=p,t[37]=D):D=t[37],t[38]!==f||t[39]!==d||t[40]!==n||t[41]!==p?(O=(0,Z.jsx)(Rb,{folderPath:n,state:f,onChange:p,folderConfigHandle:d}),t[38]=f,t[39]=d,t[40]=n,t[41]=p,t[42]=O):O=t[42],w=`rounded-lg border`,x=Bb;let N=g===`name`?v===`asc`?`ascending`:`descending`:`none`,F;t[43]===r?F=t[44]:(F=r({id:`6YtxFj`}),t[43]=r,t[44]=F);let I;t[45]!==m||t[46]!==v||t[47]!==g||t[48]!==F?(I=(0,Z.jsx)(Jb,{label:F,sortKey:`name`,activeKey:g,activeDir:v,onSort:m}),t[45]=m,t[46]=v,t[47]=g,t[48]=F,t[49]=I):I=t[49];let L;t[50]!==N||t[51]!==I?(L=(0,Z.jsx)(Wb,{"aria-sort":N,children:I}),t[50]=N,t[51]=I,t[52]=L):L=t[52];let R=g===`modified`?v===`asc`?`ascending`:`descending`:`none`,z;t[53]===r?z=t[54]:(z=r({id:`tgWuMB`}),t[53]=r,t[54]=z);let B;t[55]!==m||t[56]!==v||t[57]!==g||t[58]!==z?(B=(0,Z.jsx)(Jb,{label:z,sortKey:`modified`,activeKey:g,activeDir:v,onSort:m}),t[55]=m,t[56]=v,t[57]=g,t[58]=z,t[59]=B):B=t[59];let V;t[60]!==R||t[61]!==B?(V=(0,Z.jsx)(Wb,{className:`w-32`,"aria-sort":R,children:B}),t[60]=R,t[61]=B,t[62]=V):V=t[62],t[63]!==L||t[64]!==V?(C=(0,Z.jsx)(Vb,{children:(0,Z.jsxs)(Ub,{children:[L,V]})}),t[63]=L,t[64]=V,t[65]=C):C=t[65],b=Hb,S=i.length?i.map(Xb):(0,Z.jsx)(Ub,{children:(0,Z.jsx)(Gb,{colSpan:2,className:`h-24 text-center text-muted-foreground`,children:(0,Z.jsx)(s,{id:`Pkw7J9`})})}),t[7]=r,t[8]=f,t[9]=d,t[10]=n,t[11]=a,t[12]=u,t[13]=l,t[14]=c,t[15]=p,t[16]=v,t[17]=g,t[18]=b,t[19]=x,t[20]=S,t[21]=C,t[22]=w,t[23]=T,t[24]=E,t[25]=D,t[26]=O,t[27]=k}else 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=t[26],k=t[27];let A;t[66]!==b||t[67]!==S?(A=(0,Z.jsx)(b,{children:S}),t[66]=b,t[67]=S,t[68]=A):A=t[68];let j;t[69]!==x||t[70]!==C||t[71]!==A?(j=(0,Z.jsxs)(x,{children:[C,A]}),t[69]=x,t[70]=C,t[71]=A,t[72]=j):j=t[72];let M;t[73]!==j||t[74]!==w?(M=(0,Z.jsx)(`div`,{className:w,children:j}),t[73]=j,t[74]=w,t[75]=M):M=t[75];let N;t[76]!==M||t[77]!==T||t[78]!==E||t[79]!==D||t[80]!==O?(N=(0,Z.jsxs)(`div`,{className:T,children:[E,D,O,M]}),t[76]=M,t[77]=T,t[78]=E,t[79]=D,t[80]=O,t[81]=N):N=t[81];let F;t[82]!==N||t[83]!==k?(F=(0,Z.jsx)(`div`,{className:k,children:N}),t[82]=N,t[83]=k,t[84]=F):F=t[84];let I;t[85]!==m||t[86]!==d||t[87]!==n?(I=(0,Z.jsx)(Gp,{open:m,onOpenChange:h,kind:`file`,initialDir:n,folderConfig:d,suggestedName:`index`}),t[85]=m,t[86]=d,t[87]=n,t[88]=I):I=t[88];let L;return t[89]!==F||t[90]!==I?(L=(0,Z.jsxs)(Z.Fragment,{children:[F,I]}),t[89]=F,t[90]=I,t[91]=L):L=t[91],L}function Xb(e){return(0,Z.jsxs)(Ub,{children:[(0,Z.jsx)(Gb,{children:(0,Z.jsxs)(`a`,{href:di(e.path),className:`flex items-center gap-2 rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[e.kind===`folder`?(0,Z.jsx)(Dc,{className:`size-4 shrink-0 text-muted-foreground`}):(0,Z.jsx)(u,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.title})]})}),(0,Z.jsx)(Gb,{className:`text-muted-foreground`,children:e.kind===`file`?Kb(e.modified):`—`})]},e.path)}function Zb(e){return e===`asc`?`desc`:`asc`}function Qb(e){return(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 border-b px-4 py-3 last:border-b-0`,children:[(0,Z.jsx)(eo,{className:`size-4 rounded`}),(0,Z.jsx)(eo,{className:`h-4 w-40`}),(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(eo,{className:`h-4 w-16`})})]},e)}function $b(e){let t=(0,$.c)(24),{docName:n,size:r,limit:i,backNav:a}=e,o=a!==void 0,c=(0,Q.useRef)(null),l=(0,Q.useRef)(null),u,d;t[0]===o?(u=t[1],d=t[2]):(u=()=>{o?c.current?.focus():l.current?.focus()},d=[o],t[0]=o,t[1]=u,t[2]=d),(0,Q.useEffect)(u,d);let f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(`div`,{className:`flex size-16 items-center justify-center rounded-full border bg-muted/40 text-muted-foreground`,children:(0,Z.jsx)(xc,{className:`size-9`,"aria-hidden":`true`})}),t[3]=f):f=t[3];let p=o?void 0:-1,m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(s,{id:`P3hnm0`}),t[4]=m):m=t[4];let h;t[5]===p?h=t[6]:(h=(0,Z.jsx)(`h2`,{ref:l,id:`large-file-title`,tabIndex:p,className:`text-2xl font-light text-balance outline-none`,children:m}),t[5]=p,t[6]=h);let g;t[7]===r?g=t[8]:(g=_r(r),t[7]=r,t[8]=g);let _;t[9]===i?_=t[10]:(_=_r(i),t[9]=i,t[10]=_);let v;t[11]!==n||t[12]!==g||t[13]!==_?(v=(0,Z.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`_GBioJ`,values:{0:g,1:_,docName:n}})}),t[11]=n,t[12]=g,t[13]=_,t[14]=v):v=t[14];let y;t[15]!==h||t[16]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[h,v]}),t[15]=h,t[16]=v,t[17]=y):y=t[17];let b;t[18]!==a||t[19]!==o?(b=o?(0,Z.jsxs)(Ni,{ref:c,variant:`default`,onClick:()=>a.onNavigateBack(a.previousDocName),children:[(0,Z.jsx)(Hi,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`CKyk7Q`})]}):null,t[18]=a,t[19]=o,t[20]=b):b=t[20];let x;return t[21]!==y||t[22]!==b?(x=(0,Z.jsxs)(`div`,{role:`status`,"aria-labelledby":`large-file-title`,"data-slot":`large-file-editor-state`,className:`flex h-full flex-col items-center justify-center gap-8 p-8 text-center`,children:[f,y,b]}),t[21]=y,t[22]=b,t[23]=x):x=t[23],x}function ex(e){let t=(0,$.c)(8),{docName:n}=e,[r,i]=(0,Q.useState)(tx),a,o;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>p(e=>{i(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),n})}),o=[],t[0]=a,t[1]=o):(a=t[0],o=t[1]),(0,Q.useEffect)(a,o),!r.has(n))return null;let c;t[2]===n?c=t[3]:(c=function(){S(n)?.abort(),i(e=>{if(!e.has(n))return e;let t=new Set(e);return t.delete(n),t})},t[2]=n,t[3]=c);let l=c,u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`A67Uwj`})}),t[4]=u):u=t[4];let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(s,{id:`dEgA5A`}),t[5]=d):d=t[5];let f;return t[6]===l?f=t[7]:(f=(0,Z.jsxs)(`div`,{className:`absolute inset-x-0 bottom-8 z-20 flex justify-center text-xs text-muted-foreground`,children:[u,(0,Z.jsx)(Ni,{variant:`link`,size:`sm`,className:`h-auto px-2 py-0 text-xs`,onClick:l,children:d})]}),t[6]=l,t[7]=f),f}function tx(){return new Set}var nx=(0,Q.createContext)(null);function rx(e){let t=(0,$.c)(7),{children:n}=e,[r,i]=(0,Q.useState)(ix),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=e=>{i(t=>{let n=new Map(t);return n.set(e,(t.get(e)??0)+1),n})},t[0]=a):a=t[0];let o=a,s;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=e=>{i(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},t[1]=s):s=t[1];let c=s,l;t[2]===r?l=t[3]:(l={addPropertySignal:r,requestAddProperty:o,clearAddProperty:c},t[2]=r,t[3]=l);let u=l,d;return t[4]!==n||t[5]!==u?(d=(0,Z.jsx)(nx,{value:u,children:n}),t[4]=n,t[5]=u,t[6]=d):d=t[6],d}function ix(){return new Map}function ax(){let e=(0,Q.use)(nx);if(e===null)throw Error(`useProperties must be used within <PropertyProvider />`);return e}function ox(e){let t=null,n=()=>(t===null&&(t=e(),t.catch(()=>{})),t),r=(0,Q.lazy)(n);return r.preload=n,r}var sx=ox(()=>n(()=>import(`./SettingsDialogBody-GYre8CjN.js`).then(e=>({default:e.SettingsDialogBody})),__vite__mapDeps([42,1,33,2,34,35,20,36,37,38,39,19,6,3,7,4,10,9,40,43,8,14,21,11]),import.meta.url));function cx(e){let t=(0,$.c)(9),{error:n}=e,{_:r}=i(),a;t[0]!==r||t[1]!==n?(a=n instanceof Error&&/dynamically imported module|Failed to fetch/i.test(n.message)?r({id:`Y8ViJx`}):r({id:`3h5zMp`}),t[0]=r,t[1]=n,t[2]=a):a=t[2];let o=a,c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`h3`,{id:`settings-body-error-title`,className:`font-heading text-base leading-none font-medium`,children:(0,Z.jsx)(s,{id:`hwFOFD`})}),t[3]=c):c=t[3];let l;t[4]===o?l=t[5]:(l=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[c,(0,Z.jsx)(`p`,{className:`max-w-xs text-sm text-muted-foreground`,children:o})]}),t[4]=o,t[5]=l);let u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(Ni,{variant:`default`,onClick:lx,children:(0,Z.jsx)(s,{id:`HpK_8d`})}),t[6]=u):u=t[6];let d;return t[7]===l?d=t[8]:(d=(0,Z.jsxs)(`div`,{role:`alert`,"aria-labelledby":`settings-body-error-title`,"data-slot":`settings-body-error-boundary`,className:`flex h-full flex-col items-center justify-center gap-5 p-8 text-center`,children:[l,u]}),t[7]=l,t[8]=d),d}function lx(){return window.location.reload()}function ux(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(m,{fallbackRender:fx,onError:dx,children:n}),t[0]=n,t[1]=r),r}function dx(e,t){console.error(`[SettingsDialogErrorBoundary] rendered fallback for Settings body`,e,t.componentStack)}function fx(e){return(0,Z.jsx)(cx,{...e})}function px(e){let t=(0,$.c)(71),{open:n,onOpenChange:r}=e,{_:a}=i(),{collabUrl:o}=ft(),{userBinding:c,userSynced:u,okignoreBinding:d,okignoreSynced:f}=l(),{desktopPresent:p}=Va(),[m,h]=(0,Q.useState)(`preferences`),g,_;t[0]===n?(g=t[1],_=t[2]):(g=()=>{n&&h(`preferences`)},_=[n],t[0]=n,t[1]=g,t[2]=_),(0,Q.useEffect)(g,_);let v=o!==null,y;t[3]===a?y=t[4]:(y=a({id:`7PzzBU`}),t[3]=a,t[4]=y);let b;t[5]===a?b=t[6]:(b=a({id:`Q6hhn8`}),t[5]=a,t[6]=b);let x;t[7]===b?x=t[8]:(x={id:`preferences`,label:b},t[7]=b,t[8]=x);let S;t[9]===a?S=t[10]:(S=a({id:`AeXO77`}),t[9]=a,t[10]=S);let C;t[11]===S?C=t[12]:(C={id:`account`,label:S},t[11]=S,t[12]=C);let w;t[13]!==x||t[14]!==C?(w=[x,C],t[13]=x,t[14]=C,t[15]=w):w=t[15];let T;t[16]!==y||t[17]!==w?(T={id:`user`,label:y,enabled:!0,items:w},t[16]=y,t[17]=w,t[18]=T):T=t[18];let E;t[19]===a?E=t[20]:(E=a({id:`ZWyHmq`}),t[19]=a,t[20]=E);let D;t[21]===a?D=t[22]:(D=a({id:`Nu4DdT`}),t[21]=a,t[22]=D);let O;t[23]===D?O=t[24]:(O={id:`sync`,label:D},t[23]=D,t[24]=O);let k;t[25]===a?k=t[26]:(k=a({id:`iTylMl`}),t[25]=a,t[26]=k);let A;t[27]===k?A=t[28]:(A={id:`project-templates`,label:k},t[27]=k,t[28]=A);let j;t[29]===a?j=t[30]:(j=a({id:`3zyg_A`}),t[29]=a,t[30]=j);let M;t[31]===j?M=t[32]:(M={id:`okignore`,label:j},t[31]=j,t[32]=M);let N;t[33]!==O||t[34]!==A||t[35]!==M?(N=[O,A,M],t[33]=O,t[34]=A,t[35]=M,t[36]=N):N=t[36];let P;t[37]!==v||t[38]!==E||t[39]!==N?(P={id:`project`,label:E,enabled:v,items:N},t[37]=v,t[38]=E,t[39]=N,t[40]=P):P=t[40];let F;t[41]===a?F=t[42]:(F=a({id:`nbfdhU`}),t[41]=a,t[42]=F);let I;t[43]!==a||t[44]!==p?(I=p?[{id:`claude-desktop`,label:a({id:`yvHDYG`})}]:[],t[43]=a,t[44]=p,t[45]=I):I=t[45];let L;t[46]!==F||t[47]!==I?(L={id:`integrations`,label:F,enabled:!0,items:I},t[46]=F,t[47]=I,t[48]=L):L=t[48];let R;t[49]!==P||t[50]!==L||t[51]!==T?(R=[T,P,L],t[49]=P,t[50]=L,t[51]=T,t[52]=R):R=t[52];let z=R,B;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(Vo,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`Tz0i8g`})}),t[53]=B):B=t[53];let V;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Z.jsx)(zo,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`RDrXh4`})}),t[54]=V):V=t[54];let H;t[55]!==m||t[56]!==z?(H=(0,Z.jsx)(mx,{groups:z,activeId:m,onSelect:h}),t[55]=m,t[56]=z,t[57]=H):H=t[57];let U;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(gx,{}),t[58]=U):U=t[58];let W=u?c:null,G;t[59]!==m||t[60]!==d||t[61]!==f||t[62]!==W?(G=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain subtle-scrollbar p-6`,children:(0,Z.jsx)(ux,{children:(0,Z.jsx)(Q.Suspense,{fallback:U,children:(0,Z.jsx)(sx,{activeId:m,userBinding:W,okignoreBinding:d,okignoreSynced:f})})})}),t[59]=m,t[60]=d,t[61]=f,t[62]=W,t[63]=G):G=t[63];let K;t[64]!==H||t[65]!==G?(K=(0,Z.jsxs)(Go,{className:`flex h-[700px] max-h-[calc(100dvh-4rem)] w-[900px] max-w-[calc(100%-2rem)] flex-col gap-0 overflow-hidden p-0 sm:grid sm:grid-cols-[220px_1fr] sm:max-w-[min(900px,calc(100%-2rem))]`,"data-testid":`settings-dialog`,children:[B,V,H,G]}),t[64]=H,t[65]=G,t[66]=K):K=t[66];let q;return t[67]!==r||t[68]!==n||t[69]!==K?(q=(0,Z.jsx)(Zo,{open:n,onOpenChange:r,children:K}),t[67]=r,t[68]=n,t[69]=K,t[70]=q):q=t[70],q}function mx(e){let t=(0,$.c)(12),{groups:n,activeId:r,onSelect:a}=e,{_:o}=i(),s;t[0]===o?s=t[1]:(s=o({id:`y1t8bQ`}),t[0]=o,t[1]=s);let c;if(t[2]!==r||t[3]!==n||t[4]!==a){let e;t[6]!==r||t[7]!==a?(e=e=>(0,Z.jsx)(hx,{group:e,activeId:r,onSelect:a},e.id),t[6]=r,t[7]=a,t[8]=e):e=t[8],c=n.map(e),t[2]=r,t[3]=n,t[4]=a,t[5]=c}else c=t[5];let l;return t[9]!==s||t[10]!==c?(l=(0,Z.jsx)(`nav`,{"aria-label":s,className:`flex shrink-0 gap-x-3 overflow-x-auto overscroll-contain subtle-scrollbar scroll-fade-mask-x-max-sm border-b bg-muted/30 px-3 py-2 max-sm:pt-10 sm:h-full sm:flex-col sm:gap-0 sm:overflow-x-visible sm:overflow-y-auto sm:border-r sm:border-b-0 sm:py-4`,children:c}),t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function hx(e){let t=(0,$.c)(28),{group:n,activeId:r,onSelect:i}=e;if(n.items.length===0)return null;let a=`settings-group-${n.id}`,o=`${a}-caption`,c=n.enabled?void 0:o,l=n.enabled?`text-muted-foreground/80`:`text-muted-foreground/50`,u;t[0]===l?u=t[1]:(u=Ei(`shrink-0 whitespace-nowrap px-2 text-xs font-semibold uppercase tracking-wide font-mono sm:mb-1`,l),t[0]=l,t[1]=u);let d;t[2]!==n.label||t[3]!==a||t[4]!==c||t[5]!==u?(d=(0,Z.jsx)(`h3`,{id:a,"aria-describedby":c,className:u,children:n.label}),t[2]=n.label,t[3]=a,t[4]=c,t[5]=u,t[6]=d):d=t[6];let f;t[7]!==o||t[8]!==n.enabled?(f=n.enabled?null:(0,Z.jsx)(`p`,{id:o,className:`px-2 text-xs italic text-muted-foreground/60 sm:mb-1`,children:(0,Z.jsx)(s,{id:`JWsZlx`})}),t[7]=o,t[8]=n.enabled,t[9]=f):f=t[9];let p;if(t[10]!==r||t[11]!==o||t[12]!==n.enabled||t[13]!==n.items||t[14]!==i){let e;t[16]!==r||t[17]!==o||t[18]!==n.enabled||t[19]!==i?(e=e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`button`,{type:`button`,"aria-current":r===e.id?`page`:void 0,"aria-disabled":n.enabled?void 0:!0,"aria-describedby":n.enabled?void 0:o,tabIndex:n.enabled?0:-1,disabled:!n.enabled,onClick:()=>n.enabled&&i(e.id),"data-testid":`settings-sidebar-item-${e.id}`,className:Ei(`w-auto whitespace-nowrap rounded px-2 py-1.5 text-left text-sm transition-colors sm:w-full`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,`disabled:cursor-not-allowed disabled:opacity-50`,r===e.id&&n.enabled?`bg-accent text-accent-foreground`:`hover:bg-accent/50`),children:e.label})},e.id),t[16]=r,t[17]=o,t[18]=n.enabled,t[19]=i,t[20]=e):e=t[20],p=n.items.map(e),t[10]=r,t[11]=o,t[12]=n.enabled,t[13]=n.items,t[14]=i,t[15]=p}else p=t[15];let m;t[21]!==a||t[22]!==p?(m=(0,Z.jsx)(`ul`,{"aria-labelledby":a,className:`flex gap-1 sm:block sm:space-y-0.5`,children:p}),t[21]=a,t[22]=p,t[23]=m):m=t[23];let h;return t[24]!==d||t[25]!==f||t[26]!==m?(h=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 sm:mb-4 sm:block`,children:[d,f,m]}),t[24]=d,t[25]=f,t[26]=m,t[27]=h):h=t[27],h}function gx(){let e=(0,$.c)(4),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`GsBUCk`})}),n=(0,Z.jsx)(eo,{className:`h-5 w-32`}),r=(0,Z.jsx)(eo,{className:`h-4 w-64`}),e[0]=t,e[1]=n,e[2]=r):(t=e[0],n=e[1],r=e[2]);let i;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"aria-busy":`true`,className:`space-y-3`,"data-testid":`settings-content-skeleton`,children:[t,n,r,(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(eo,{className:`h-9 w-full`}),(0,Z.jsx)(eo,{className:`h-9 w-full`})]})]}),e[3]=i):i=e[3],i}function _x(e){let t=(0,$.c)(8),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=Ei(`flex h-full w-full aria-[orientation=vertical]:flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(dy,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function vx(e){let t=(0,$.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,Z.jsx)(my,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function yx(e){let t=(0,$.c)(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({withHandle:i,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=Ei(`relative flex w-px items-center justify-center bg-border ring-offset-background after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90`,n),t[4]=n,t[5]=a);let o;t[6]===i?o=t[7]:(o=i&&(0,Z.jsx)(`div`,{className:`z-10 flex h-6 w-1 shrink-0 rounded-lg bg-border`}),t[6]=i,t[7]=o);let s;return t[8]!==r||t[9]!==a||t[10]!==o?(s=(0,Z.jsx)(vy,{"data-slot":`resizable-handle`,className:a,...r,children:o}),t[8]=r,t[9]=a,t[10]=o,t[11]=s):s=t[11],s}function bx(e){let t=(0,$.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,Z.jsx)(Ko,{"data-slot":`sheet`,...n}),t[2]=n,t[3]=r),r}function xx(e){let t=(0,$.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,Z.jsx)(Yo,{"data-slot":`sheet-portal`,...n}),t[2]=n,t[3]=r),r}function Sx(e){let t=(0,$.c)(8),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=Ei(`fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Uo,{"data-slot":`sheet-overlay`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Cx(e){let t=(0,$.c)(17),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:r,children:n,side:a,showCloseButton:o,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let c=a===void 0?`right`:a,l=o===void 0?!0:o,u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(Sx,{}),t[6]=u):u=t[6];let d;t[7]===r?d=t[8]:(d=Ei(`fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-[side=bottom]:data-open:slide-in-from-bottom-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:animate-out data-closed:fade-out-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=right]:data-closed:slide-out-to-right-10 data-[side=top]:data-closed:slide-out-to-top-10 motion-reduce:transition-none motion-reduce:duration-0 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none`,r),t[7]=r,t[8]=d);let f;t[9]===l?f=t[10]:(f=l&&(0,Z.jsx)(Qo,{"data-slot":`sheet-close`,asChild:!0,children:(0,Z.jsxs)(Ni,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`,children:[(0,Z.jsx)(Ro,{}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`yz7wBu`})})]})}),t[9]=l,t[10]=f);let p;return t[11]!==n||t[12]!==i||t[13]!==c||t[14]!==d||t[15]!==f?(p=(0,Z.jsxs)(xx,{children:[u,(0,Z.jsxs)(Ho,{"data-slot":`sheet-content`,"data-side":c,className:d,...i,children:[n,f]})]}),t[11]=n,t[12]=i,t[13]=c,t[14]=d,t[15]=f,t[16]=p):p=t[16],p}function wx(e){let t=(0,$.c)(8),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=Ei(`flex flex-col gap-0.5 p-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sheet-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Tx(e){let t=(0,$.c)(8),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=Ei(`font-heading text-base font-medium text-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Wo,{"data-slot":`sheet-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ex(e){let t=(0,$.c)(8),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=Ei(`group/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`input-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Dx=Fi(`flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4`,{variants:{align:{"inline-start":`order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]`,"inline-end":`order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]`,"block-start":`order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2`,"block-end":`order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2`}},defaultVariants:{align:`inline-start`}});function Ox(e){let t=(0,$.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,align:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`inline-start`:i,o;t[4]!==a||t[5]!==n?(o=Ei(Dx({align:a}),n),t[4]=a,t[5]=n,t[6]=o):o=t[6];let s;return t[7]!==a||t[8]!==r||t[9]!==o?(s=(0,Z.jsx)(`div`,{"data-slot":`input-group-addon`,"data-align":a,className:o,onMouseDown:kx,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function kx(e){e.target.closest(`button`)||(e.preventDefault(),e.currentTarget.parentElement?.querySelector(`input`)?.focus())}Fi(`flex items-center gap-2 text-sm shadow-none`,{variants:{size:{xs:`h-6 gap-1 rounded-[calc(var(--radius)-3px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5`,sm:``,"icon-xs":`size-6 rounded-[calc(var(--radius)-3px)] p-0 has-[>svg]:p-0`,"icon-sm":`size-8 p-0 has-[>svg]:p-0`}},defaultVariants:{size:`xs`}});function Ax(e){let t=(0,$.c)(8),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=Ei(`flex items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`span`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function jx(e){let t=(0,$.c)(8),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=Ei(`flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(ts,{"data-slot":`input-group-control`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Mx(e){let t=(0,$.c)(119),{findInputRef:n,query:r,replacement:a,replaceOpen:o,caseSensitive:c,wholeWord:l,current:u,total:d,onQueryChange:f,onReplacementChange:p,onReplaceOpenChange:m,onCaseSensitiveChange:h,onWholeWordChange:g,onNext:_,onPrevious:v,onReplaceCurrent:y,onReplaceAll:b,onClose:x}=e,{_:S}=i(),C=r.length>0,w=d>0,T;t[0]!==S||t[1]!==u||t[2]!==w||t[3]!==C||t[4]!==d?(T=C?w?`${u} / ${d}`:S({id:`Ev2r9A`}):``,t[0]=S,t[1]=u,t[2]=w,t[3]=C,t[4]=d,t[5]=T):T=t[5];let E=T,D;t[6]!==x||t[7]!==_||t[8]!==v?(D=function(e){e.key===`Enter`?(e.preventDefault(),e.shiftKey?v():_()):e.key===`Escape`&&(e.preventDefault(),x())},t[6]=x,t[7]=_,t[8]=v,t[9]=D):D=t[9];let O=D,k;t[10]!==x||t[11]!==y?(k=function(e){e.key===`Enter`?(e.preventDefault(),y()):e.key===`Escape`&&(e.preventDefault(),x())},t[10]=x,t[11]=y,t[12]=k):k=t[12];let A=k,j;t[13]===S?j=t[14]:(j=S({id:`MVxpbf`}),t[13]=S,t[14]=j);let M;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-find-input`,children:(0,Z.jsx)(s,{id:`KujtjC`})}),t[15]=M):M=t[15];let N;t[16]===f?N=t[17]:(N=e=>f(e.target.value),t[16]=f,t[17]=N);let P;t[18]===S?P=t[19]:(P=S({id:`KujtjC`}),t[18]=S,t[19]=P);let F;t[20]!==n||t[21]!==O||t[22]!==r||t[23]!==N||t[24]!==P?(F=(0,Z.jsx)(jx,{ref:n,id:`ok-find-input`,value:r,onChange:N,onKeyDown:O,placeholder:P,autoComplete:`off`,spellCheck:!1,className:`h-7 px-2 text-sm`}),t[20]=n,t[21]=O,t[22]=r,t[23]=N,t[24]=P,t[25]=F):F=t[25];let I;t[26]===S?I=t[27]:(I=S({id:`-8PP0T`}),t[26]=S,t[27]=I);let L;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(oc,{"aria-hidden":`true`}),t[28]=L):L=t[28];let R;t[29]!==c||t[30]!==h||t[31]!==I?(R=(0,Z.jsx)(cr,{asChild:!0,children:(0,Z.jsx)(Po,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":I,pressed:c,onPressedChange:h,className:`size-6 min-w-6 px-0`,children:L})}),t[29]=c,t[30]=h,t[31]=I,t[32]=R):R=t[32];let z;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsx)(Qn,{side:`bottom`,children:(0,Z.jsx)(s,{id:`-8PP0T`})}),t[33]=z):z=t[33];let B;t[34]===R?B=t[35]:(B=(0,Z.jsxs)(Gr,{children:[R,z]}),t[34]=R,t[35]=B);let V;t[36]===S?V=t[37]:(V=S({id:`_7UQ7y`}),t[36]=S,t[37]=V);let H;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(_l,{"aria-hidden":`true`}),t[38]=H):H=t[38];let U;t[39]!==g||t[40]!==V||t[41]!==l?(U=(0,Z.jsx)(cr,{asChild:!0,children:(0,Z.jsx)(Po,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":V,pressed:l,onPressedChange:g,className:`size-6 min-w-6 px-0`,children:H})}),t[39]=g,t[40]=V,t[41]=l,t[42]=U):U=t[42];let W;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Z.jsx)(Qn,{side:`bottom`,children:(0,Z.jsx)(s,{id:`_7UQ7y`})}),t[43]=W):W=t[43];let G;t[44]===U?G=t[45]:(G=(0,Z.jsxs)(Gr,{children:[U,W]}),t[44]=U,t[45]=G);let K;t[46]!==B||t[47]!==G?(K=(0,Z.jsxs)(Ox,{align:`inline-end`,className:`gap-0.5`,children:[B,G]}),t[46]=B,t[47]=G,t[48]=K):K=t[48];let q;t[49]!==K||t[50]!==F?(q=(0,Z.jsxs)(Ex,{className:`h-7 w-56 rounded-[min(var(--radius-md),12px)]`,children:[F,K]}),t[49]=K,t[50]=F,t[51]=q):q=t[51];let ee;t[52]===E?ee=t[53]:(ee=(0,Z.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`min-w-14 px-1 text-right text-muted-foreground text-xs tabular-nums shrink-0`,children:E}),t[52]=E,t[53]=ee);let te;t[54]===S?te=t[55]:(te=S({id:`oqB2ez`}),t[54]=S,t[55]=te);let ne=!w,re;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(ze,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[56]=re):re=t[56];let ie;t[57]!==v||t[58]!==te||t[59]!==ne?(ie=(0,Z.jsx)(cr,{asChild:!0,children:(0,Z.jsx)(Ni,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":te,disabled:ne,onClick:v,children:re})}),t[57]=v,t[58]=te,t[59]=ne,t[60]=ie):ie=t[60];let ae;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,Z.jsx)(Qn,{side:`bottom`,children:(0,Z.jsx)(s,{id:`oqB2ez`})}),t[61]=ae):ae=t[61];let oe;t[62]===ie?oe=t[63]:(oe=(0,Z.jsxs)(Gr,{children:[ie,ae]}),t[62]=ie,t[63]=oe);let se;t[64]===S?se=t[65]:(se=S({id:`SiUUCS`}),t[64]=S,t[65]=se);let ce=!w,le;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Z.jsx)(ct,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[66]=le):le=t[66];let ue;t[67]!==_||t[68]!==se||t[69]!==ce?(ue=(0,Z.jsx)(cr,{asChild:!0,children:(0,Z.jsx)(Ni,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":se,disabled:ce,onClick:_,children:le})}),t[67]=_,t[68]=se,t[69]=ce,t[70]=ue):ue=t[70];let de;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,Z.jsx)(Qn,{side:`bottom`,children:(0,Z.jsx)(s,{id:`SiUUCS`})}),t[71]=de):de=t[71];let fe;t[72]===ue?fe=t[73]:(fe=(0,Z.jsxs)(Gr,{children:[ue,de]}),t[72]=ue,t[73]=fe);let pe=o?`secondary`:`ghost`,me;t[74]!==S||t[75]!==o?(me=S(o?{id:`UkQGhd`}:{id:`1RluQD`}),t[74]=S,t[75]=o,t[76]=me):me=t[76];let he=o?`ok-replace-input`:void 0,ge;t[77]!==m||t[78]!==o?(ge=()=>m(!o),t[77]=m,t[78]=o,t[79]=ge):ge=t[79];let _e;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,Z.jsx)(Qc,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[80]=_e):_e=t[80];let ve;t[81]!==o||t[82]!==pe||t[83]!==me||t[84]!==he||t[85]!==ge?(ve=(0,Z.jsx)(cr,{asChild:!0,children:(0,Z.jsx)(Ni,{type:`button`,variant:pe,size:`icon-sm`,"aria-label":me,"aria-expanded":o,"aria-controls":he,onClick:ge,children:_e})}),t[81]=o,t[82]=pe,t[83]=me,t[84]=he,t[85]=ge,t[86]=ve):ve=t[86];let ye;t[87]===o?ye=t[88]:(ye=(0,Z.jsx)(Qn,{side:`bottom`,children:o?(0,Z.jsx)(s,{id:`UkQGhd`}):(0,Z.jsx)(s,{id:`1RluQD`})}),t[87]=o,t[88]=ye);let be;t[89]!==ve||t[90]!==ye?(be=(0,Z.jsxs)(Gr,{children:[ve,ye]}),t[89]=ve,t[90]=ye,t[91]=be):be=t[91];let xe;t[92]!==S||t[93]!==A||t[94]!==w||t[95]!==b||t[96]!==y||t[97]!==p||t[98]!==o||t[99]!==a?(xe=o?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-replace-input`,children:(0,Z.jsx)(s,{id:`fqSfXY`})}),(0,Z.jsx)(ts,{id:`ok-replace-input`,value:a,onChange:e=>p(e.target.value),onKeyDown:A,placeholder:S({id:`fqSfXY`}),autoComplete:`off`,spellCheck:!1,className:`h-7 w-48 rounded-[min(var(--radius-md),12px)] px-2 text-sm shadow-none focus-visible:ring-2`}),(0,Z.jsxs)(Gr,{children:[(0,Z.jsx)(cr,{asChild:!0,children:(0,Z.jsx)(Ni,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":S({id:`bS_boY`}),disabled:!w,onClick:y,children:(0,Z.jsx)(Qc,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(Qn,{side:`bottom`,children:(0,Z.jsx)(s,{id:`bS_boY`})})]}),(0,Z.jsxs)(Gr,{children:[(0,Z.jsx)(cr,{asChild:!0,children:(0,Z.jsx)(Ni,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":S({id:`dr1vFs`}),disabled:!w,onClick:b,children:(0,Z.jsx)(Zc,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(Qn,{side:`bottom`,children:(0,Z.jsx)(s,{id:`dr1vFs`})})]})]}):null,t[92]=S,t[93]=A,t[94]=w,t[95]=b,t[96]=y,t[97]=p,t[98]=o,t[99]=a,t[100]=xe):xe=t[100];let Se;t[101]===S?Se=t[102]:(Se=S({id:`wJo9oS`}),t[101]=S,t[102]=Se);let Ce;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,Z.jsx)(Ro,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[103]=Ce):Ce=t[103];let J;t[104]!==x||t[105]!==Se?(J=(0,Z.jsx)(cr,{asChild:!0,children:(0,Z.jsx)(Ni,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":Se,onClick:x,children:Ce})}),t[104]=x,t[105]=Se,t[106]=J):J=t[106];let we;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,Z.jsx)(Qn,{side:`bottom`,children:(0,Z.jsx)(s,{id:`yz7wBu`})}),t[107]=we):we=t[107];let Te;t[108]===J?Te=t[109]:(Te=(0,Z.jsxs)(Gr,{children:[J,we]}),t[108]=J,t[109]=Te);let Ee;return t[110]!==q||t[111]!==ee||t[112]!==oe||t[113]!==fe||t[114]!==j||t[115]!==be||t[116]!==xe||t[117]!==Te?(Ee=(0,Z.jsxs)(`search`,{"data-testid":`find-replace-bar`,"aria-label":j,className:`pointer-events-auto flex max-w-[min(calc(100vw-1rem),720px)] touch-manipulation items-center gap-1 rounded-[calc(var(--radius)+2px)] border border-input bg-popover/95 p-1 text-popover-foreground shadow-md shadow-black/10 backdrop-blur`,children:[M,q,ee,oe,fe,be,xe,Te]}),t[110]=q,t[111]=ee,t[112]=oe,t[113]=fe,t[114]=j,t[115]=be,t[116]=xe,t[117]=Te,t[118]=Ee):Ee=t[118],Ee}var Nx={current:0,total:0},Px=120,Fx=100;function Ix(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=()=>e?ae(e):null,t[0]=e,t[1]=n),(0,Q.useSyncExternalStore)(F,n,Lx)}function Lx(){return null}function Rx(e){if(!e||e.isDestroyed)return null;let{from:t,to:n,empty:r}=e.state.selection;if(r)return null;let i=e.state.doc.textBetween(t,n,`
23
+ `);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function Hg(e,t){return`${e}\u0000${t}`}function Ug(e,t,n){let r=nr(e).body,i=nr(t).body;return r===i?``:Bg(n,r,i,``,``,{context:3})}function Wg(e,t,n){let r=(0,$.c)(8),{activeProvider:i}=ft(),a;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={status:`idle`,diff:null},r[0]=a):a=r[0];let[o,s]=(0,Q.useState)(a),c=(0,Q.useRef)(i),l;r[1]===i?l=r[2]:(l=()=>{c.current=i},r[1]=i,r[2]=l),(0,Q.useEffect)(l);let u,d;return r[3]!==n||r[4]!==t||r[5]!==e?(u=()=>{if(!e){s({status:`idle`,diff:null});return}let r=e,i=!1;return s({status:`loading`,diff:null}),(async function(){try{let e=Hg(t,r),a=n.get(e);if(a===void 0){let o=await fetch(`/api/history/${r}?docName=${encodeURIComponent(t)}`);if(i)return;if(!o.ok){s({status:`error`,diff:null});return}let c=await o.json();if(i)return;a=c.content??``,n.set(e,a)}if(i)return;let o=c.current?.document.getText(`source`).toString()??``,l=Ug(a,o,t);if(i)return;s({status:`ready`,diff:l})}catch(e){i||(console.error(`[timeline-diff] failed to load entry diff`,{sha:r,docName:t,err:e}),s({status:`error`,diff:null}))}})(),()=>{i=!0}},d=[e,t,n],r[3]=n,r[4]=t,r[5]=e,r[6]=u,r[7]=d):(u=r[6],d=r[7]),(0,Q.useEffect)(u,d),o}var Gg=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityPanelDiffView-LNHry3BJ.js`),__vite__mapDeps([16,1,6,17]),import.meta.url)).ActivityPanelDiffView}));function Kg(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/1e3);if(r<60)return X._({id:`xOTzt5`});if(r<3600){let e=Math.floor(r/60);return X._({id:`UyROxs`,values:{mins:e}})}if(r<86400){let e=Math.floor(r/3600);return X._({id:`wXO4Tg`,values:{hrs:e}})}if(r<86400*2)return X._({id:`rQRrkB`});let i=Math.floor(r/86400);return i<7?X._({id:`6u9LvN`,values:{days:i}}):t.toLocaleDateString()}function qg(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function Jg(e){return e.slice(0,7)}function Yg(e){return e.type===`upstream`?X._({id:`K_vT1F`}):e.contributors.length===1?e.contributors[0].name:e.contributors.length>1?e.contributors.map(e=>e.name).join(`, `):e.author===`openknowledge-server`||e.author===`server`?X._({id:`B2DrPb`}):e.author}function Xg(e){let t=(0,$.c)(17),n,r;if(t[0]===e?(n=t[1],r=t[2]):({icon:n,...r}=e,t[0]=e,t[1]=n,t[2]=r),n===`claude`){let e;return t[3]===r?e=t[4]:(e=(0,Z.jsx)(Ri,{...r}),t[3]=r,t[4]=e),e}if(n===`cursor`){let e;return t[5]===r?e=t[6]:(e=(0,Z.jsx)(Wi,{...r}),t[5]=r,t[6]=e),e}if(n===`windsurf`){let e;return t[7]===r?e=t[8]:(e=(0,Z.jsx)(Ii,{...r}),t[7]=r,t[8]=e),e}if(n===`openai`){let e;return t[9]===r?e=t[10]:(e=(0,Z.jsx)(Vi,{...r}),t[9]=r,t[10]=e),e}if(n===`cline`){let e;return t[11]===r?e=t[12]:(e=(0,Z.jsx)(Yi,{...r}),t[11]=r,t[12]=e),e}if(n===`github`){let e;return t[13]===r?e=t[14]:(e=(0,Z.jsx)(qi,{...r}),t[13]=r,t[14]=e),e}let i=r,a;return t[15]===i?a=t[16]:(a=(0,Z.jsx)(Gi,{strokeWidth:1.5,...i}),t[15]=i,t[16]=a),a}function Zg(e){let t=(0,$.c)(17),{entry:n,isDark:r}=e;if(n.type===`upstream`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Ae,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[0]=e):e=t[0],e}if(n.contributors.length>0){let e=n.contributors[0],i=e.colorSeed??e.name,a;t[1]===i?a=t[2]:(a=Tr(i),t[1]=i,t[2]=a);let o=a,s=r?Br[o]??Tn[o]:Tn[o],c;t[3]!==s||t[4]!==i?(c=s??Fn(i),t[3]=s,t[4]=i,t[5]=c):c=t[5];let l=c;if(o!==`bot`){let e;t[6]===l?e=t[7]:(e={color:l},t[6]=l,t[7]=e);let n;return t[8]!==o||t[9]!==e?(n=(0,Z.jsx)(Xg,{icon:o,width:14,height:14,className:`shrink-0`,style:e}),t[8]=o,t[9]=e,t[10]=n):n=t[10],n}if(e.name===`File System`){let e;return t[11]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(kc,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[11]=e):e=t[11],e}if(e.name===`Open Knowledge (service)`||e.name===`Git (upstream)`){let e;return t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)($s,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[12]=e):e=t[12],e}let u;return t[13]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(gl,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[13]=u):u=t[13],u}if(n.authorEmail.includes(`agent`)||n.author.includes(`agent`)||n.authorEmail.includes(`cursor`)||n.authorEmail.includes(`claude`)){let e;return t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Gi,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[14]=e):e=t[14],e}if(n.author===`openknowledge-server`||n.author===`server`){let e;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)($s,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[15]=e):e=t[15],e}let i;return t[16]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(gl,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[16]=i):i=t[16],i}function Qg(e){let t=(0,$.c)(23),{entries:n,defaultExpanded:r,isDark:i,diffLayout:a,cache:o,docName:s,expandedShas:c,onToggleExpanded:l,onRestoreSuccess:u}=e,[d,f]=(0,Q.useState)(r),p=n.length;if(n.length===0)return null;let m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>f($g),t[0]=m):m=t[0];let h;t[1]===d?h=t[2]:(h=d?(0,Z.jsx)(ct,{className:`size-3`}):(0,Z.jsx)(es,{className:`size-3`}),t[1]=d,t[2]=h);let g;t[3]!==p||t[4]!==d?(g=d?X._({id:`OKQe56`,values:{entryCount:p}}):X._({id:`k9jDvw`,values:{entryCount:p}}),t[3]=p,t[4]=d,t[5]=g):g=t[5];let _;t[6]!==d||t[7]!==h||t[8]!==g?(_=(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":d,className:`flex items-center gap-1.5 rounded-lg px-3 py-2 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/80 transition-colors text-left`,onClick:m,children:[h,g]}),t[6]=d,t[7]=h,t[8]=g,t[9]=_):_=t[9];let v;t[10]!==o||t[11]!==a||t[12]!==s||t[13]!==n||t[14]!==d||t[15]!==c||t[16]!==i||t[17]!==u||t[18]!==l?(v=d&&n.map(e=>(0,Z.jsx)(d_,{entry:e,isDark:i,diffLayout:a,cache:o,docName:s,expanded:c.has(e.sha),onToggleExpanded:l,onRestoreSuccess:u},e.sha)),t[10]=o,t[11]=a,t[12]=s,t[13]=n,t[14]=d,t[15]=c,t[16]=i,t[17]=u,t[18]=l,t[19]=v):v=t[19];let y;return t[20]!==_||t[21]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[_,v]}),t[20]=_,t[21]=v,t[22]=y):y=t[22],y}function $g(e){return!e}function e_(e){return e.checkpoint?e.checkpoint.kind:`save`}function t_(e){let t=e_(e);if(t===`save`)return X._({id:`gsePqm`});let n=e.checkpoint?.size??null,r=n!=null&&n>0?` (${n_(n)})`:``;return t===`bridge-merge-loss`?X._({id:`uZAG7T`,values:{sizeSuffix:r}}):X._({id:`_4rAQI`,values:{sizeSuffix:r}})}function n_(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/102.4)/10} KB`:`${Math.round(e/104857.6)/10} MB`}function r_(e){return e.type===`checkpoint`?e_(e)===`save`?`version`:`auto-save`:`wip`}function i_(e){let t=r_(e);return t===`version`?X._({id:`RFQ1Yx`}):t===`auto-save`?X._({id:`9Uv1CD`}):X._({id:`Yea-K5`})}function a_(e){let t=r_(e);return t===`version`?X._({id:`gg3Rpy`}):t===`auto-save`?X._({id:`PXXeW8`}):X._({id:`Pyp1NA`})}function o_(e){let t=[];for(let n of e.contributors)if(n.summaries)for(let e of n.summaries)t.push(e);return t}function s_(e){let t=(0,$.c)(21),{summaries:n}=e,[r,i]=(0,Q.useState)(!1),a=(0,Q.useId)();if(n.length===0)return null;let o,c;t[0]===n?(o=t[1],c=t[2]):([o,...c]=n,t[0]=n,t[1]=o,t[2]=c);let l=c.length,u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`• `}),t[3]=u):u=t[3];let d;t[4]===o?d=t[5]:(d=(0,Z.jsxs)(`li`,{className:`text-xs text-foreground/90`,children:[u,o]}),t[4]=o,t[5]=d);let f;t[6]!==r||t[7]!==c?(f=r&&c.map(l_),t[6]=r,t[7]=c,t[8]=f):f=t[8];let p;t[9]!==a||t[10]!==d||t[11]!==f?(p=(0,Z.jsxs)(`ul`,{id:a,className:`list-none`,children:[d,f]}),t[9]=a,t[10]=d,t[11]=f,t[12]=p):p=t[12];let m;t[13]!==r||t[14]!==l||t[15]!==a||t[16]!==c.length?(m=c.length>0&&(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":r,"aria-controls":a,className:`inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,onClick:e=>{e.stopPropagation(),i(c_)},children:[r?(0,Z.jsx)(ct,{className:`size-3`}):(0,Z.jsx)(es,{className:`size-3`}),r?(0,Z.jsx)(s,{id:`vLyv1R`}):(0,Z.jsx)(s,{id:`ZptNUh`,values:{hidden:l}})]}),t[13]=r,t[14]=l,t[15]=a,t[16]=c.length,t[17]=m):m=t[17];let h;return t[18]!==p||t[19]!==m?(h=(0,Z.jsxs)(`div`,{className:`mt-0.5`,children:[p,m]}),t[18]=p,t[19]=m,t[20]=h):h=t[20],h}function c_(e){return!e}function l_(e,t){return(0,Z.jsxs)(`li`,{className:`text-xs text-foreground/90`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`• `}),e]},`${t}-${e}`)}function u_(e){let t=(0,$.c)(13),{sha:n,docName:r,cache:i,diffLayout:a,panelId:o}=e,c=Wg(n,r,i),l;t[0]===c.status?l=t[1]:(l=c.status===`loading`&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-xs text-muted-foreground`,children:[(0,Z.jsx)(Kt,{className:`size-3 animate-spin`}),(0,Z.jsx)(s,{id:`38foVZ`})]}),t[0]=c.status,t[1]=l);let u;t[2]===c.status?u=t[3]:(u=c.status===`error`&&(0,Z.jsx)(`p`,{className:`py-2 text-xs text-destructive`,children:(0,Z.jsx)(s,{id:`vvWZnu`})}),t[2]=c.status,t[3]=u);let d;t[4]!==a||t[5]!==c.diff||t[6]!==c.status?(d=c.status===`ready`&&(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-xs text-muted-foreground`,children:[(0,Z.jsx)(Kt,{className:`size-3 animate-spin`}),(0,Z.jsx)(s,{id:`EDm3wJ`})]}),children:(0,Z.jsx)(Gg,{diff:c.diff,viewType:a})}),t[4]=a,t[5]=c.diff,t[6]=c.status,t[7]=d):d=t[7];let f;return t[8]!==o||t[9]!==l||t[10]!==u||t[11]!==d?(f=(0,Z.jsxs)(`div`,{id:o,className:`px-3 pb-2`,"data-testid":`timeline-entry-diff`,children:[l,u,d]}),t[8]=o,t[9]=l,t[10]=u,t[11]=d,t[12]=f):f=t[12],f}function d_(e){let t=(0,$.c)(130),{entry:n,prominent:r,isDark:a,diffLayout:o,cache:c,docName:l,expanded:u,onToggleExpanded:d,onRestoreSuccess:f}=e,p=r===void 0?!1:r,{_:m}=i(),h;t[0]===n.timestamp?h=t[1]:(h=Kg(n.timestamp),t[0]=n.timestamp,t[1]=h);let g=h,_;t[2]===n?_=t[3]:(_=Yg(n),t[2]=n,t[3]=_);let v=_,y;t[4]===n.timestamp?y=t[5]:(y=qg(n.timestamp),t[4]=n.timestamp,t[5]=y);let b=y,x;t[6]===n.sha?x=t[7]:(x=Jg(n.sha),t[6]=n.sha,t[7]=x);let S=x,C=n.contributors.flatMap(f_),w;t[8]===n?w=t[9]:(w=o_(n),t[8]=n,t[9]=w);let T=w,[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(!1),A=(0,Q.useRef)(null),j=(0,Q.useId)(),M,N;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(M=()=>()=>A.current?.abort(),N=[],t[10]=M,t[11]=N):(M=t[10],N=t[11]),(0,Q.useEffect)(M,N);let P;t[12]!==n.sha||t[13]!==d?(P=()=>d(n.sha),t[12]=n.sha,t[13]=d,t[14]=P):P=t[14];let F=P,I;t[15]===D?I=t[16]:(I=function(){A.current?.abort(),A.current=null,k(!1),D(!1)},t[15]=D,t[16]=I);let L=I,R;t[17]!==m||t[18]!==l||t[19]!==n.sha||t[20]!==f||t[21]!==D?(R=async function(){k(!0);let e=new AbortController;A.current=e;let t=function(){e.signal.aborted||k(!1),A.current===e&&(A.current=null)},r;try{r=await fetch(`/api/rollback`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({docName:l,commitSha:n.sha}),signal:e.signal})}catch(r){let i=r;!e.signal.aborted&&!(i instanceof DOMException&&i.name===`AbortError`)&&(console.error(`[timeline] rollback fetch failed`,{docName:l,sha:n.sha,err:i}),$o.error(m({id:`NkXEFS`}),{duration:4e3})),t();return}if(e.signal.aborted){t();return}if(r.ok)D(!1),f();else{let e=`HTTP ${r.status}`;try{let t=Cr.safeParse(await r.json());t.success&&(e=t.data.title)}catch{}console.error(`[timeline] rollback failed`,{docName:l,sha:n.sha,status:r.status,detail:e}),$o.error(m({id:`uM6jnS`}),{description:e,duration:6e3})}t()},t[17]=m,t[18]=l,t[19]=n.sha,t[20]=f,t[21]=D,t[22]=R):R=t[22];let z=R,B;t[23]!==n||t[24]!==a||t[25]!==p?(B=p?(()=>{let e=e_(n);return e===`bridge-merge-loss`?(0,Z.jsx)(Pn,{className:`size-3.5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":`true`}):e===`external-change-rescue`?(0,Z.jsx)(bc,{className:`size-3.5 shrink-0 text-sky-600 dark:text-sky-400`,"aria-hidden":`true`}):(0,Z.jsx)(_c,{className:`size-3.5 shrink-0 text-muted-foreground`})})():(0,Z.jsx)(Zg,{entry:n,isDark:a}),t[23]=n,t[24]=a,t[25]=p,t[26]=B):B=t[26];let V=B,H=u?j:void 0,U=u?`bg-muted`:`hover:bg-muted/80`,W;t[27]===U?W=t[28]:(W=[`group flex w-full items-start gap-2.5 rounded-lg px-3 py-2.5 text-left transition-colors cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-ring`,U],t[27]=U,t[28]=W);let G=W.join(` `),K;t[29]===F?K=t[30]:(K=e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),F())},t[29]=F,t[30]=K);let q;t[31]===V?q=t[32]:(q=(0,Z.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:V}),t[31]=V,t[32]=q);let ee;t[33]!==v||t[34]!==n||t[35]!==p?(ee=p?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`text-xs text-foreground truncate`,children:t_(n)}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground/50`,children:`·`}),(0,Z.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:v})]}):(0,Z.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:v}),t[33]=v,t[34]=n,t[35]=p,t[36]=ee):ee=t[36];let te;t[37]!==n.timestamp||t[38]!==g?(te=(0,Z.jsx)(`time`,{className:`ml-auto shrink-0 text-xs text-muted-foreground/80`,dateTime:n.timestamp,title:n.timestamp,children:g}),t[37]=n.timestamp,t[38]=g,t[39]=te):te=t[39];let ne;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-px shrink-0 bg-border`}),t[40]=ne):ne=t[40];let re;t[41]===n?re=t[42]:(re=i_(n),t[41]=n,t[42]=re);let ie;t[43]===D?ie=t[44]:(ie=e=>{e.stopPropagation(),D(!0)},t[43]=D,t[44]=ie);let ae;t[45]===O?ae=t[46]:(ae=O?(0,Z.jsx)(Kt,{className:`size-3 animate-spin`}):(0,Z.jsx)(zi,{className:`size-3`}),t[45]=O,t[46]=ae);let oe;t[47]!==O||t[48]!==re||t[49]!==ie||t[50]!==ae?(oe=(0,Z.jsx)(cr,{asChild:!0,children:(0,Z.jsx)(Ni,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-destructive`,"data-testid":`timeline-entry-restore`,"aria-label":re,disabled:O,onClick:ie,children:ae})}),t[47]=O,t[48]=re,t[49]=ie,t[50]=ae,t[51]=oe):oe=t[51];let se;t[52]===n?se=t[53]:(se=i_(n),t[52]=n,t[53]=se);let ce;t[54]===se?ce=t[55]:(ce=(0,Z.jsx)(Qn,{side:`top`,children:se}),t[54]=se,t[55]=ce);let le;t[56]!==oe||t[57]!==ce?(le=(0,Z.jsxs)(Gr,{children:[oe,ce]}),t[56]=oe,t[57]=ce,t[58]=le):le=t[58];let ue;t[59]!==ee||t[60]!==te||t[61]!==le?(ue=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[ee,te,ne,le]}),t[59]=ee,t[60]=te,t[61]=le,t[62]=ue):ue=t[62];let de;t[63]===T?de=t[64]:(de=T.length>0&&(0,Z.jsx)(s_,{summaries:T}),t[63]=T,t[64]=de);let fe=C.length>0?(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:C.join(`, `),children:C.join(`, `)}):(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:n.message,children:n.message}),pe;t[65]!==ue||t[66]!==de||t[67]!==fe?(pe=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[ue,de,fe]}),t[65]=ue,t[66]=de,t[67]=fe,t[68]=pe):pe=t[68];let me;t[69]!==u||t[70]!==F||t[71]!==H||t[72]!==G||t[73]!==K||t[74]!==q||t[75]!==pe?(me=(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-expanded":u,"aria-controls":H,"data-testid":`timeline-entry-expand`,className:G,onClick:F,onKeyDown:K,children:[q,pe]}),t[69]=u,t[70]=F,t[71]=H,t[72]=G,t[73]=K,t[74]=q,t[75]=pe,t[76]=me):me=t[76];let he;t[77]!==c||t[78]!==o||t[79]!==j||t[80]!==l||t[81]!==n.sha||t[82]!==u?(he=u&&(0,Z.jsx)(u_,{sha:n.sha,docName:l,cache:c,diffLayout:o,panelId:j}),t[77]=c,t[78]=o,t[79]=j,t[80]=l,t[81]=n.sha,t[82]=u,t[83]=he):he=t[83];let ge;t[84]!==me||t[85]!==he?(ge=(0,Z.jsxs)(`div`,{className:`flex flex-col rounded-lg`,children:[me,he]}),t[84]=me,t[85]=he,t[86]=ge):ge=t[86];let _e;t[87]!==L||t[88]!==D?(_e=e=>{e?D(!0):L()},t[87]=L,t[88]=D,t[89]=_e):_e=t[89];let ve;t[90]===n?ve=t[91]:(ve=a_(n),t[90]=n,t[91]=ve);let ye;t[92]===ve?ye=t[93]:(ye=(0,Z.jsx)(Vo,{children:ve}),t[92]=ve,t[93]=ye);let be;t[94]!==b||t[95]!==v||t[96]!==S||t[97]!==g?(be={relative:g,absoluteTime:b,entrySha:S,authorName:v},t[94]=b,t[95]=v,t[96]=S,t[97]=g,t[98]=be):be=t[98];let xe;t[99]===Symbol.for(`react.memo_cache_sentinel`)?(xe={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`}),1:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[99]=xe):xe=t[99];let Se;t[100]===be?Se=t[101]:(Se=(0,Z.jsx)(zo,{children:(0,Z.jsx)(s,{id:`h6EvY-`,values:be,components:xe})}),t[100]=be,t[101]=Se);let Ce;t[102]!==ye||t[103]!==Se?(Ce=(0,Z.jsxs)(Xo,{children:[ye,Se]}),t[102]=ye,t[103]=Se,t[104]=Ce):Ce=t[104];let J;t[105]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Z.jsx)(s,{id:`dEgA5A`}),t[105]=J):J=t[105];let we;t[106]===L?we=t[107]:(we=(0,Z.jsx)(Ni,{variant:`outline`,"data-testid":`timeline-entry-restore-cancel`,onClick:L,children:J}),t[106]=L,t[107]=we);let Te;t[108]===z?Te=t[109]:(Te=()=>z(),t[108]=z,t[109]=Te);let Ee;t[110]===O?Ee=t[111]:(Ee=O?(0,Z.jsx)(Kt,{className:`mr-2 size-4 animate-spin`}):null,t[110]=O,t[111]=Ee);let De;t[112]===Symbol.for(`react.memo_cache_sentinel`)?(De=(0,Z.jsx)(s,{id:`yKu_3Y`}),t[112]=De):De=t[112];let Oe;t[113]!==O||t[114]!==Te||t[115]!==Ee?(Oe=(0,Z.jsxs)(Ni,{variant:`destructive`,"data-testid":`timeline-entry-restore-confirm`,disabled:O,onClick:Te,children:[Ee,De]}),t[113]=O,t[114]=Te,t[115]=Ee,t[116]=Oe):Oe=t[116];let ke;t[117]!==we||t[118]!==Oe?(ke=(0,Z.jsxs)(Jo,{children:[we,Oe]}),t[117]=we,t[118]=Oe,t[119]=ke):ke=t[119];let Ae;t[120]!==Ce||t[121]!==ke?(Ae=(0,Z.jsxs)(Go,{children:[Ce,ke]}),t[120]=Ce,t[121]=ke,t[122]=Ae):Ae=t[122];let je;t[123]!==E||t[124]!==_e||t[125]!==Ae?(je=(0,Z.jsx)(Zo,{open:E,onOpenChange:_e,children:Ae}),t[123]=E,t[124]=_e,t[125]=Ae,t[126]=je):je=t[126];let Me;return t[127]!==ge||t[128]!==je?(Me=(0,Z.jsxs)(Z.Fragment,{children:[ge,je]}),t[127]=ge,t[128]=je,t[129]=Me):Me=t[129],Me}function f_(e){return e.docs}function p_(e){let t=(0,$.c)(87),{docName:n,diffLayout:r,onDiffLayoutChange:a,onSaveVersion:o,saving:c}=e,{_:l}=i(),{resolvedTheme:u}=Kr(),d=u===`dark`,f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=[],t[0]=f):f=t[0];let[p,m]=(0,Q.useState)(f),[h,g]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)(null),y=(0,Q.useRef)(null),[b]=(0,Q.useState)(__),[x,S]=(0,Q.useState)(g_),C;t[1]===b?C=t[2]:(C=()=>{S(new Set),b.clear()},t[1]=b,t[2]=C);let w;t[3]===n?w=t[4]:(w=[n],t[3]=n,t[4]=w),(0,Q.useEffect)(C,w);let T;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(T=function(e){S(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[5]=T):T=t[5];let E=T,D;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(D=function(){S(new Set)},t[6]=D):D=t[6];let O=D,k,A;t[7]!==l||t[8]!==n?(k=()=>{if(!n){m([]);return}let e=!1,t=async function(){if(n)try{let t=await fetch(`/api/history?docName=${encodeURIComponent(n)}&limit=100`);if(e)return;if(!t.ok){v(l({id:`brCtGB`}));return}let r=await t.json();if(e)return;m(r.entries??[]),v(null)}catch(t){let n=t;if(e)return;v(l({id:`brCtGB`})),console.error(`[timeline]`,n)}};return g(!0),t().finally(()=>{e||g(!1)}),y.current=setInterval(t,1e4),()=>{e=!0,y.current&&clearInterval(y.current)}},A=[n,l],t[7]=l,t[8]=n,t[9]=k,t[10]=A):(k=t[9],A=t[10]),(0,Q.useEffect)(k,A);let j,M,N,P,F,I,L,R;if(t[11]!==l||t[12]!==b||t[13]!==r||t[14]!==n||t[15]!==p||t[16]!==_||t[17]!==x||t[18]!==d||t[19]!==h||t[20]!==a||t[21]!==o||t[22]!==c){let e=[],i=[],u=!1;for(let t of p)t.type===`checkpoint`?(i.length>0&&(e.push({kind:`wip-group`,entries:i,isPreCheckpoint:!u}),i=[]),e.push({kind:`checkpoint`,entry:t}),u=!0):i.push(t);i.length>0&&e.push({kind:`wip-group`,entries:i,isPreCheckpoint:!u});let f;t[31]===p?f=t[32]:(f=p.some(h_),t[31]=p,t[32]=f);let m=!f,g=!h&&!_&&p.length>0;F=`flex h-full flex-col`;let v;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(vn,{children:(0,Z.jsx)(s,{id:`cklVjM`})}),t[33]=v):v=t[33];let y;t[34]!==l||t[35]!==r||t[36]!==g||t[37]!==a?(y=g&&(0,Z.jsxs)(Gr,{children:[(0,Z.jsx)(cr,{asChild:!0,children:(0,Z.jsxs)(Io,{type:`single`,value:r,onValueChange:e=>{e&&a(e)},"aria-label":l({id:`XvPJaT`}),variant:`segmented`,size:`sm`,spacing:1,className:`bg-muted dark:bg-background p-0.5 rounded-md shrink-0`,children:[(0,Z.jsx)(No,{value:`unified`,"aria-label":l({id:`379t2h`}),className:`size-6 px-0`,children:(0,Z.jsx)($c,{className:`size-3.5`})}),(0,Z.jsx)(No,{value:`split`,"aria-label":l({id:`HXFyWD`}),className:`size-6 px-0`,children:(0,Z.jsx)(pc,{className:`size-3.5`})})]})}),(0,Z.jsx)(Qn,{children:r===`unified`?(0,Z.jsx)(s,{id:`379t2h`}):(0,Z.jsx)(s,{id:`HXFyWD`})})]}),t[34]=l,t[35]=r,t[36]=g,t[37]=a,t[38]=y):y=t[38];let S;t[39]===l?S=t[40]:(S=l({id:`IrYrzq`}),t[39]=l,t[40]=S);let C;t[41]===c?C=t[42]:(C=c?(0,Z.jsx)(Kt,{className:`size-4 animate-spin`}):(0,Z.jsx)(el,{className:`size-4`}),t[41]=c,t[42]=C);let w;t[43]!==o||t[44]!==c||t[45]!==S||t[46]!==C?(w=(0,Z.jsx)(cr,{asChild:!0,children:(0,Z.jsx)(Ni,{variant:`ghost`,size:`icon-sm`,onClick:o,disabled:c,"aria-label":S,className:`text-muted-foreground`,"data-testid":`timeline-save-version`,children:C})}),t[43]=o,t[44]=c,t[45]=S,t[46]=C,t[47]=w):w=t[47];let T;t[48]===c?T=t[49]:(T=(0,Z.jsx)(Qn,{children:c?(0,Z.jsx)(s,{id:`uF9ruK`}):(0,Z.jsx)(s,{id:`IrYrzq`})}),t[48]=c,t[49]=T);let D;t[50]!==w||t[51]!==T?(D=(0,Z.jsxs)(Gr,{children:[w,T]}),t[50]=w,t[51]=T,t[52]=D):D=t[52],t[53]!==y||t[54]!==D?(I=(0,Z.jsxs)(hn,{children:[v,(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[y,D]})]}),t[53]=y,t[54]=D,t[55]=I):I=t[55],L=`flex-1 overflow-y-auto subtle-scrollbar scroll-fade-mask`,t[56]!==l||t[57]!==h?(R=h&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,role:`status`,"aria-busy":`true`,"aria-label":l({id:`o49mDZ`}),children:[1,2,3].map(m_)}),t[56]=l,t[57]=h,t[58]=R):R=t[58],t[59]!==_||t[60]!==h?(j=!h&&_&&(0,Z.jsx)(`div`,{className:`px-4 py-3`,children:(0,Z.jsx)(`p`,{className:`text-xs text-destructive`,children:_})}),t[59]=_,t[60]=h,t[61]=j):j=t[61],t[62]!==p.length||t[63]!==_||t[64]!==h?(M=!h&&!_&&p.length===0&&(0,Z.jsx)(`div`,{className:`px-4 py-8 text-center`,children:(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(s,{id:`Ta25TG`})})}),t[62]=p.length,t[63]=_,t[64]=h,t[65]=M):M=t[65],t[66]!==b||t[67]!==r||t[68]!==n||t[69]!==p||t[70]!==_||t[71]!==x||t[72]!==m||t[73]!==d||t[74]!==h?(N=!h&&!_&&m&&p.length>0&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,children:p.map(e=>(0,Z.jsx)(d_,{entry:e,isDark:d,diffLayout:r,cache:b,docName:n,expanded:x.has(e.sha),onToggleExpanded:E,onRestoreSuccess:O},e.sha))}),t[66]=b,t[67]=r,t[68]=n,t[69]=p,t[70]=_,t[71]=x,t[72]=m,t[73]=d,t[74]=h,t[75]=N):N=t[75],P=!h&&!_&&!m&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,children:e.map((e,t)=>e.kind===`checkpoint`?(0,Z.jsx)(d_,{entry:e.entry,prominent:!0,isDark:d,diffLayout:r,cache:b,docName:n,expanded:x.has(e.entry.sha),onToggleExpanded:E,onRestoreSuccess:O},e.entry.sha):(0,Z.jsx)(Qg,{entries:e.entries,defaultExpanded:e.isPreCheckpoint,isDark:d,diffLayout:r,cache:b,docName:n,expandedShas:x,onToggleExpanded:E,onRestoreSuccess:O},e.entries[0]?.sha??`wip-${t}`))}),t[11]=l,t[12]=b,t[13]=r,t[14]=n,t[15]=p,t[16]=_,t[17]=x,t[18]=d,t[19]=h,t[20]=a,t[21]=o,t[22]=c,t[23]=j,t[24]=M,t[25]=N,t[26]=P,t[27]=F,t[28]=I,t[29]=L,t[30]=R}else j=t[23],M=t[24],N=t[25],P=t[26],F=t[27],I=t[28],L=t[29],R=t[30];let z;t[76]!==j||t[77]!==M||t[78]!==N||t[79]!==P||t[80]!==L||t[81]!==R?(z=(0,Z.jsxs)(`div`,{className:L,children:[R,j,M,N,P]}),t[76]=j,t[77]=M,t[78]=N,t[79]=P,t[80]=L,t[81]=R,t[82]=z):z=t[82];let B;return t[83]!==F||t[84]!==I||t[85]!==z?(B=(0,Z.jsxs)(`div`,{className:F,children:[I,z]}),t[83]=F,t[84]=I,t[85]=z,t[86]=B):B=t[86],B}function m_(e){return(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg px-3 py-2.5`,children:[(0,Z.jsx)(eo,{className:`size-3.5 rounded mt-0.5 shrink-0`}),(0,Z.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,Z.jsx)(eo,{className:`h-3 w-28`}),(0,Z.jsx)(eo,{className:`h-3 w-40`})]})]},e)}function h_(e){return e.type===`checkpoint`}function g_(){return new Set}function __(){return new Bi(32)}var v_=[{id:`outline`,icon:Ic},{id:`links`,icon:ge},{id:`graph`,icon:zc},{id:`timeline`,icon:lc}];function y_(e){return e===`outline`?X._({id:`dD7NPy`}):e===`links`?X._({id:`Rj01Fz`}):e===`graph`?X._({id:`x2fr_j`}):X._({id:`cklVjM`})}function b_(){return n(()=>import(`./GraphPanel-D7AmXBQV.js`),__vite__mapDeps([18,1,19,6,3,7,20,21,22,23,24,25,26,27,28,29,30,31]),import.meta.url)}var x_=(0,Q.lazy)(async()=>({default:(await b_()).GraphPanel})),S_=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-oe_KmZ6Y.js`),__vite__mapDeps([32,1,2,33,34,35,20,36,37,38,39,19,6,3,7,4,10,9,40,41]),import.meta.url)).ActivityModeContent}));function C_(e){let t=(0,$.c)(16),{docName:n,isSourceMode:r,activeTab:a,onActiveTabChange:o,mode:c,onSaveVersion:l,saving:u}=e,{_:d}=i(),[f,p]=(0,Q.useState)(`unified`),m;t[0]!==d||t[1]!==a||t[2]!==c||t[3]!==o?(m=c===`doc`?(0,Z.jsx)(`div`,{className:`flex flex-row items-center justify-center gap-3 p-2`,children:(0,Z.jsx)(Io,{type:`single`,variant:`outline`,value:a,onValueChange:e=>{e&&o(e)},"aria-label":d({id:`SrOuyg`}),children:v_.map(w_)})}):null,t[0]=d,t[1]=a,t[2]=c,t[3]=o,t[4]=m):m=t[4];let h;t[5]!==a||t[6]!==f||t[7]!==n||t[8]!==r||t[9]!==c||t[10]!==l||t[11]!==u?(h=c===`doc`?(0,Z.jsxs)(`div`,{role:`tabpanel`,id:`panel-${a}`,"aria-labelledby":`tab-${a}`,className:`min-h-0 flex-1`,children:[a===`outline`&&(0,Z.jsx)(Is,{docName:n,isSourceMode:r}),a===`links`&&(0,Z.jsx)(mg,{docName:n}),a===`graph`&&(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`-lCAuQ`})}),children:(0,Z.jsx)(x_,{activeDocName:n})}),a===`timeline`&&(0,Z.jsx)(p_,{docName:n,diffLayout:f,onDiffLayoutChange:p,onSaveVersion:l,saving:u})]}):(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{role:`status`,"aria-busy":`true`,className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`ONPvOb`})}),children:(0,Z.jsx)(S_,{})})}),t[5]=a,t[6]=f,t[7]=n,t[8]=r,t[9]=c,t[10]=l,t[11]=u,t[12]=h):h=t[12];let g;return t[13]!==m||t[14]!==h?(g=(0,Z.jsxs)(Z.Fragment,{children:[m,h]}),t[13]=m,t[14]=h,t[15]=g):g=t[15],g}function w_(e){let{id:t,icon:n}=e,r=y_(t);return(0,Z.jsxs)(Gr,{children:[(0,Z.jsx)(No,{value:t,role:`tab`,id:`tab-${t}`,"aria-controls":`panel-${t}`,"aria-label":r,asChild:!0,children:(0,Z.jsx)(cr,{children:(0,Z.jsx)(n,{})})}),(0,Z.jsx)(Qn,{side:`bottom`,children:r})]},t)}function T_(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function E_(e,t){let n=getComputedStyle(e.ownerDocument.body);return t*parseFloat(n.fontSize)}function D_(e){return e/100*window.innerHeight}function O_(e){return e/100*window.innerWidth}function k_(e){switch(typeof e){case`number`:return[e,`px`];case`string`:{let t=parseFloat(e);return e.endsWith(`%`)?[t,`%`]:e.endsWith(`px`)?[t,`px`]:e.endsWith(`rem`)?[t,`rem`]:e.endsWith(`em`)?[t,`em`]:e.endsWith(`vh`)?[t,`vh`]:e.endsWith(`vw`)?[t,`vw`]:[t,`%`]}}}function A_({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=k_(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=E_(t,i);break;case`em`:r=T_(t,i);break;case`vh`:r=D_(i);break;case`vw`:r=O_(i);break}return r}function j_(e){return parseFloat(e.toFixed(3))}function M_({group:e}){let{orientation:t,panels:n}=e;return n.reduce((e,n)=>(e+=t===`horizontal`?n.element.offsetWidth:n.element.offsetHeight,e),0)}function N_(e){let{panels:t}=e,n=M_({group:e});return n===0?t.map(e=>({groupResizeBehavior:e.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:e.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:e.panelConstraints.disabled,minSize:0,maxSize:100,panelId:e.id})):t.map(e=>{let{element:t,panelConstraints:r}=e,i=0;r.collapsedSize!==void 0&&(i=j_(A_({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=j_(A_({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=j_(A_({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=j_(A_({groupSize:n,panelElement:t,styleProp:r.maxSize})/n*100)),{groupResizeBehavior:r.groupResizeBehavior,collapsedSize:i,collapsible:r.collapsible===!0,defaultSize:a,disabled:r.disabled,minSize:o,maxSize:s,panelId:e.id}})}function P_(e,t=`Assertion error`){if(!e)throw Error(t)}function F_(e,t){return Array.from(t).sort(e===`horizontal`?I_:L_)}function I_(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function L_(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function R_(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function z_(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function B_({orientation:e,rects:t,targetRect:n}){let r={x:n.x+n.width/2,y:n.y+n.height/2},i,a=Number.MAX_VALUE;for(let n of t){let{x:t,y:o}=z_(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return P_(i,`No rect found`),i}var V_;function H_(){return V_===void 0&&(V_=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),V_}function U_(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=F_(n,Array.from(t.children).filter(R_).map(e=>({element:e}))).map(({element:e})=>e),o=[],s=!1,c=!1,l=-1,u=-1,d=0,f,p=[];{let e=-1;for(let t of a)t.hasAttribute(`data-panel`)&&(e++,t.hasAttribute(`data-disabled`)||(d++,l===-1&&(l=e),u=e))}if(d>1){let t=-1;for(let d of a)if(d.hasAttribute(`data-panel`)){t++;let i=r.find(e=>e.element===d);if(i){if(f){let r=f.element.getBoundingClientRect(),a=d.getBoundingClientRect(),m;if(c){let e=n===`horizontal`?new DOMRect(r.right,r.top,0,r.height):new DOMRect(r.left,r.bottom,r.width,0),t=n===`horizontal`?new DOMRect(a.left,a.top,0,a.height):new DOMRect(a.left,a.top,a.width,0);switch(p.length){case 0:m=[e,t];break;case 1:{let i=p[0];m=[i,B_({orientation:n,rects:[r,a],targetRect:i.element.getBoundingClientRect()})===r?t:e];break}default:m=p;break}}else m=p.length?p:[n===`horizontal`?new DOMRect(r.right,a.top,a.left-r.right,a.height):new DOMRect(a.left,r.bottom,a.width,a.top-r.bottom)];for(let n of m){let r=`width`in n?n:n.element.getBoundingClientRect(),a=H_()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(r.width<a){let e=a-r.width;r=new DOMRect(r.x-e/2,r.y,r.width+e,r.height)}if(r.height<a){let e=a-r.height;r=new DOMRect(r.x,r.y-e/2,r.width,r.height+e)}!s&&!(t<=l||t>u)&&o.push({group:e,groupSize:M_({group:e}),panels:[f,i],separator:`width`in n?void 0:n,rect:r}),s=!1}}c=!1,f=i,p=[]}}else if(d.hasAttribute(`data-separator`)){d.ariaDisabled!==null&&(s=!0);let e=i.find(e=>e.element===d);e?p.push(e):(f=void 0,p=[])}else c=!0}return o}var W_=class{#e={};addListener(e,t){let n=this.#e[e];return n===void 0?this.#e[e]=[t]:n.includes(t)||n.push(t),()=>{this.removeListener(e,t)}}emit(e,t){let n=this.#e[e];if(n!==void 0)if(n.length===1)n[0].call(null,t);else{let e=!1,r=null,i=Array.from(n);for(let n=0;n<i.length;n++){let a=i[n];try{a.call(null,t)}catch(t){r===null&&(e=!0,r=t)}}if(e)throw r}}removeAllListeners(){this.#e={}}removeListener(e,t){let n=this.#e[e];if(n!==void 0){let e=n.indexOf(t);e>=0&&n.splice(e,1)}}},G_=new Map,K_=new W_;function q_(e){G_=new Map(G_),G_.delete(e)}function J_(e,t){for(let[t]of G_)if(t.id===e)return t}function Y_(e,t){for(let[t,n]of G_)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function X_(){return G_}function Z_(e,t){return K_.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function Q_(e,t){let n=G_.get(e);G_=new Map(G_),G_.set(e,t),K_.emit(`groupChange`,{group:e,prev:n,next:t})}function $_(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=z_(n,a.rect);switch(e){case`horizontal`:t.x<=i.x&&(r=a,i=t);break;case`vertical`:t.y<=i.y&&(r=a,i=t);break}}return r?{distance:i,hitRegion:r}:void 0}function ev(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function tv(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:sv(e),b:sv(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();P_(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:ov(av(n.a)),b:ov(av(n.b))};if(i.a===i.b){let e=r.childNodes,t={a:n.a.at(-1),b:n.b.at(-1)},i=e.length;for(;i--;){let n=e[i];if(n===t.a)return 1;if(n===t.b)return-1}}return Math.sign(i.a-i.b)}var nv=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function rv(e){let t=getComputedStyle(cv(e)??e).display;return t===`flex`||t===`inline-flex`}function iv(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||rv(e))||+t.opacity<1||`transform`in t&&t.transform!==`none`||`webkitTransform`in t&&t.webkitTransform!==`none`||`mixBlendMode`in t&&t.mixBlendMode!==`normal`||`filter`in t&&t.filter!==`none`||`webkitFilter`in t&&t.webkitFilter!==`none`||`isolation`in t&&t.isolation===`isolate`||nv.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function av(e){let t=e.length;for(;t--;){let n=e[t];if(P_(n,`Missing node`),iv(n))return n}return null}function ov(e){return e&&Number(getComputedStyle(e).zIndex)||0}function sv(e){let t=[];for(;e;)t.push(e),e=cv(e);return t}function cv(e){let{parentNode:t}=e;return ev(t)?t.host:t}function lv(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function uv({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!R_(n)||n.contains(e)||e.contains(n))return!0;if(tv(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(lv(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function dv(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=U_(r),a=$_(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&uv({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function fv(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function pv(e,t,n=0){return Math.abs(j_(e)-j_(t))<=n}function mv(e,t){return pv(e,t)?0:e>t?1:-1}function hv({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){let{collapsedSize:i=0,collapsible:a,disabled:o,maxSize:s=100,minSize:c=0}=t;if(o&&!e)return n;if(mv(r,c)<0)if(a){let e=(i+c)/2;r=mv(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=j_(r),r}function gv({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(pv(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;P_(u!=null,`Invalid first pivot index`),P_(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];P_(r,`Panel constraints not found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(P_(n!=null,`Previous layout not found for panel index ${t}`),pv(n,i)){let t=o-n;mv(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];P_(r,`No panel constraints found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(P_(n!=null,`Previous layout not found for panel index ${t}`),pv(n,o)){let t=n-i;mv(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];P_(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&mv(i,c)<0)if(e>0){let t=c-o,n=t/2;mv(i+e,c)<0&&(e=mv(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;mv(i-e,c)<0&&(e=mv(100+e,n)>0?0:-t)}break}}{let t=e<0?1:-1,r=e<0?d:u,i=0;for(;;){let e=s[r];P_(e!=null,`Previous layout not found for panel index ${r}`);let a=hv({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:e,size:100})-e;if(i+=a,r+=t,r<0||r>=n.length)break}let a=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-a:a}{let t=e<0?u:d;for(;t>=0&&t<n.length;){let r=Math.abs(e)-Math.abs(f),i=s[t];P_(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=hv({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!pv(i,c)&&(f+=i-c,l[t]=c,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?t--:t++}}if(fv(c,l))return i;{let t=e<0?d:u,r=s[t];P_(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=hv({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!pv(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];P_(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=hv({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(pv(i,s)||(t-=s-i,l[r]=s),pv(t,0))break;e>0?r--:r++}}}if(!pv(Object.values(l).reduce((e,t)=>t+e,0),100,.1))return i;let p=Object.keys(i);return l.reduce((e,t,n)=>(e[p[n]]=t,e),{})}function _v(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||mv(e[n],t[n])!==0)return!1;return!0}function vv({layout:e,panelConstraints:t}){let n=Object.values(e),r=[...n],i=r.reduce((e,t)=>e+t,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(e=>`${e}%`).join(`, `)}`);if(!pv(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];P_(t!=null,`No layout data found for index ${e}`),r[e]=100/i*t}let a=0;for(let e=0;e<t.length;e++){let i=n[e];P_(i!=null,`No layout data found for index ${e}`);let o=r[e];P_(o!=null,`No layout data found for index ${e}`);let s=hv({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!pv(a,0))for(let e=0;e<t.length;e++){let n=r[e];P_(n!=null,`No layout data found for index ${e}`);let i=n+a,o=hv({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,pv(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function yv({groupId:e,panelId:t}){let n=()=>{let t=X_();for(let[n,{defaultLayoutDeferred:r,derivedPanelConstraints:i,layout:a,groupSize:o,separatorToPanels:s}]of t)if(n.id===e)return{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:n,groupSize:o,layout:a,separatorToPanels:s};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedPanelConstraints.find(e=>e.panelId===t);if(e!==void 0)return e;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{let e=n().group.panels.find(e=>e.id===t);if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},a=()=>{let e=n().layout[t];if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},o=e=>{let r=a();if(e===r)return;let{defaultLayoutDeferred:i,derivedPanelConstraints:o,group:s,groupSize:c,layout:l,separatorToPanels:u}=n(),d=s.panels.findIndex(e=>e.id===t),f=d===s.panels.length-1,p=vv({layout:gv({delta:f?r-e:e-r,initialLayout:l,panelConstraints:o,pivotIndices:f?[d-1,d]:[d,d+1],prevLayout:l,trigger:`imperative-api`}),panelConstraints:o});_v(l,p)||Q_(s,{defaultLayoutDeferred:i,derivedPanelConstraints:o,groupSize:c,layout:p,separatorToPanels:u})};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=i(),s=a();e&&s!==t&&(n.expandToSize=s,o(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:s}=i(),c=a();if(e&&c===t){let e=s.expandToSize??n;e===0&&(e=1),o(e)}},getSize:()=>{let{group:e}=n(),t=a(),{element:r}=i();return{asPercentage:t,inPixels:e.orientation===`horizontal`?r.offsetWidth:r.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=a();return e&&pv(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=M_({group:t});o(j_(A_({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function bv(e){e.defaultPrevented||dv(e,X_()).forEach(t=>{if(t.separator&&!t.separator.disableDoubleClick){let n=t.panels.find(e=>e.panelConstraints.defaultSize!==void 0);if(n){let r=n.panelConstraints.defaultSize,i=yv({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function xv(e){let t=X_();for(let[n]of t)if(n.separators.some(t=>t.element===e))return n;throw Error(`Could not find parent Group for separator element`)}function Sv({groupId:e}){let t=()=>{let t=X_();for(let[n,r]of t)if(n.id===e)return{group:n,...r};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){let{defaultLayoutDeferred:e,layout:n}=t();return e?{}:n},setLayout(e){let{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:i,groupSize:a,layout:o,separatorToPanels:s}=t(),c=vv({layout:e,panelConstraints:r});return n?o:(_v(o,c)||Q_(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function Cv(e,t){let n=xv(e),r=Y_(n.id,!0),i=n.separators.find(t=>t.element===e);P_(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);P_(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=Sv({groupId:n.id}).getLayout(),c=vv({layout:gv({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});_v(s,c)||Q_(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function wv(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=xv(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&Cv(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&Cv(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&Cv(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&Cv(t,-5);break;case`End`:e.preventDefault(),Cv(t,100);break;case`Enter`:{e.preventDefault();let n=xv(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=Y_(n.id,!0),o=n.separators.find(e=>e.element===t);P_(o,`Matching separator not found`);let s=a.get(o);P_(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(P_(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];Cv(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=xv(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);P_(r!==null,`Index not found`),n[e.shiftKey?r>0?r-1:n.length-1:r+1<n.length?r+1:0].focus({preventScroll:!0});break}case`Home`:e.preventDefault(),Cv(t,-100);break}}var Tv={cursorFlags:0,state:`inactive`},Ev=new W_;function Dv(){return Tv}function Ov(e){return Ev.addListener(`change`,e)}function kv(e){let t=Tv,n={...Tv};n.cursorFlags=e,Tv=n,Ev.emit(`change`,{prev:t,next:n})}function Av(e){let t=Tv;Tv=e,Ev.emit(`change`,{prev:t,next:e})}function jv(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=X_(),n=dv(e,t),r=new Map,i=!1;n.forEach(e=>{e.separator&&(i||(i=!0,e.separator.element.focus({preventScroll:!0})));let n=t.get(e.group);n&&r.set(e.group,n.layout)}),Av({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}var Mv=e=>e,Nv=()=>{},Pv=1,Fv=2,Iv=4,Lv=8,Rv=3,zv=12,Bv;function Vv(){return Bv===void 0&&(Bv=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(Bv=!0)),Bv}function Hv({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case`active`:case`hover`:t.forEach(e=>{if(!e.mutableState.disableCursor)switch(e.orientation){case`horizontal`:r++;break;case`vertical`:i++;break}})}if(!(r===0&&i===0)){switch(n){case`active`:if(e&&Vv()){let t=(e&Pv)!==0,n=(e&Fv)!==0,r=(e&Iv)!==0,i=(e&Lv)!==0;if(t)return r?`se-resize`:i?`ne-resize`:`e-resize`;if(n)return r?`sw-resize`:i?`nw-resize`:`w-resize`;if(r)return`s-resize`;if(i)return`n-resize`}break}return Vv()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var Uv=new WeakMap;function Wv(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=Uv.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));let r=Dv();switch(r.state){case`active`:case`hover`:{let e=Hv({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(e=>e.group),state:r.state}),i=`*, *:hover {cursor: ${e} !important; }`;if(t===i)return;t=i,e?n.cssRules.length===0?n.insertRule(i):n.replaceSync(i):n.cssRules.length===1&&n.deleteRule(0);break}case`inactive`:t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}Uv.set(e,{prevStyle:t,styleSheet:n})}function Gv({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:i,pointerDownAtPoint:a,prevCursorFlags:o}){let s=0;n.forEach(e=>{let{group:n,groupSize:o}=e,{orientation:c,panels:l}=n,{disableCursor:u}=n.mutableState,d=0;d=a?c===`horizontal`?(t.clientX-a.x)/o*100:(t.clientY-a.y)/o*100:c===`horizontal`?t.clientX<0?-100:100:t.clientY<0?-100:100;let f=r.get(n),p=i.get(n);if(!f||!p)return;let{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:_,separatorToPanels:v}=p;if(h&&_&&v){let t=gv({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(_v(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?Pv:Fv;break;case`vertical`:s|=d<0?Iv:Lv;break}}else Q_(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&Rv:c|=s&Rv,t.movementY===0?c|=o&zv:c|=s&zv,kv(c),Wv(e)}function Kv(e){let t=X_(),n=Dv();switch(n.state){case`active`:Gv({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function qv(e){if(e.defaultPrevented)return;let t=Dv(),n=X_();switch(t.state){case`active`:if(e.buttons===0){Av({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=Y_(e.group.id,!0);Q_(e.group,t)});return}for(let n of t.hitRegions)if(n.separator){let{element:t}=n.separator;t.hasPointerCapture?.(e.pointerId)||t.setPointerCapture?.(e.pointerId)}Gv({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=dv(e,n);r.length===0?t.state!==`inactive`&&Av({cursorFlags:0,state:`inactive`}):Av({cursorFlags:0,hitRegions:r,state:`hover`}),Wv(e.currentTarget);break}}}function Jv(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(Dv().state){case`hover`:Av({cursorFlags:0,state:`inactive`})}}function Yv(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=Dv();switch(t.state){case`active`:Av({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(Wv(e.currentTarget),t.hitRegions.forEach(e=>{let t=Y_(e.group.id,!0);Q_(e.group,t)}),e.preventDefault())}}function Xv(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=j_(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=j_((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function Zv(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=M_({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:j_(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function Qv(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function $v({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let i=0,a=0,o=!1,s=new Map,c=[];for(let l of e.panels){let e=r[l.id]??0;switch(l.panelConstraints.groupResizeBehavior){case`preserve-pixel-size`:{o=!0;let r=j_(e/100*n/t*100);s.set(l.id,r),i+=r;break}default:c.push(l.id),a+=e;break}}if(!o||c.length===0)return r;let l=100-i,u={...r};if(s.forEach((e,t)=>{u[t]=e}),a>0)for(let e of c)u[e]=j_((r[e]??0)/a*l);else{let e=j_(l/c.length);for(let t of c)u[t]=e}return u}function ey(e,t){let n=e.map(e=>e.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e of n)if(!r.includes(e))return!1;return!0}var ty=new Map;function ny(e){let t=!0;P_(e.element.ownerDocument.defaultView,`Cannot register an unmounted Group`);let n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,i=new Set,a=new n(n=>{for(let r of n){let{borderBoxSize:n,target:i}=r;if(i===e.element){if(t){let t=M_({group:e});if(t===0)return;let n=Y_(e.id);if(!n)return;let r=N_(e),i=n.defaultLayoutDeferred?Xv(r):n.layout,a=vv({layout:$v({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&_v(n.layout,a)&&Qv(n.derivedPanelConstraints,r)&&n.groupSize===t)return;Q_(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else Zv(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{P_(!r.has(e.id),`Panel ids must be unique; id "${e.id}" was used more than once`),r.add(e.id),e.onResize&&a.observe(e.element)});let o=M_({group:e}),s=N_(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(ey(e.panels,l)||(l=void 0));let u=vv({layout:e.mutableState.layouts[c]??l??Xv(s),panelConstraints:s}),d=e.element.ownerDocument;ty.set(d,(ty.get(d)??0)+1);let f=new Map;return U_(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),Q_(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{P_(!i.has(e.id),`Separator ids must be unique; id "${e.id}" was used more than once`),i.add(e.id),e.element.addEventListener(`keydown`,wv)}),ty.get(d)===1&&(d.addEventListener(`dblclick`,bv,!0),d.addEventListener(`pointerdown`,jv,!0),d.addEventListener(`pointerleave`,Kv),d.addEventListener(`pointermove`,qv),d.addEventListener(`pointerout`,Jv),d.addEventListener(`pointerup`,Yv,!0)),function(){t=!1,ty.set(d,Math.max(0,(ty.get(d)??0)-1)),q_(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,wv)}),ty.get(d)||(d.removeEventListener(`dblclick`,bv,!0),d.removeEventListener(`pointerdown`,jv,!0),d.removeEventListener(`pointerleave`,Kv),d.removeEventListener(`pointermove`,qv),d.removeEventListener(`pointerout`,Jv),d.removeEventListener(`pointerup`,Yv,!0)),a.disconnect()}}function ry(){let[e,t]=(0,Q.useState)({});return[e,(0,Q.useCallback)(()=>t({}),[])]}function iy(e){let t=(0,Q.useId)();return`${e??t}`}var ay=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function oy(e){let t=(0,Q.useRef)(e);return ay(()=>{t.current=e},[e]),(0,Q.useCallback)((...e)=>t.current?.(...e),[t])}function sy(...e){return oy(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function cy(e){let t=(0,Q.useRef)({...e});return ay(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var ly=(0,Q.createContext)(null);function uy(e,t){let n=(0,Q.useRef)({getLayout:()=>({}),setLayout:Mv});(0,Q.useImperativeHandle)(t,()=>n.current,[]),ay(()=>{Object.assign(n.current,Sv({groupId:e}))})}function dy({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:i,elementRef:a,groupRef:o,id:s,onLayoutChange:c,onLayoutChanged:l,orientation:u=`horizontal`,resizeTargetMinimumSize:d={coarse:20,fine:10},style:f,...p}){let m=(0,Q.useRef)({onLayoutChange:{},onLayoutChanged:{}}),h=oy(e=>{_v(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=oy(e=>{_v(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e))}),_=iy(s),v=(0,Q.useRef)(null),[y,b]=ry(),x=(0,Q.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=sy(v,a);uy(_,o);let C=oy((e,t)=>{let r=Dv(),i=J_(e),a=Y_(e);if(a){let e=!1;switch(r.state){case`active`:e=r.hitRegions.some(e=>e.group===i);break}return{flexGrow:a.layout[t]??1,pointerEvents:e?`none`:void 0}}if(n?.[t])return{flexGrow:n?.[t]}}),w=cy({defaultLayout:n,disableCursor:r}),T=(0,Q.useMemo)(()=>({get disableCursor(){return!!w.disableCursor},getPanelStyles:C,id:_,orientation:u,registerPanel:e=>{let t=x.current;return t.panels=F_(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=F_(u,[...t.separators,e]),b(),()=>{t.separators=t.separators.filter(t=>t!==e),b()}},updatePanelProps:(e,{disabled:t})=>{let n=x.current.panels.find(t=>t.id===e);n&&(n.panelConstraints.disabled=t);let r=J_(_),i=Y_(_);r&&i&&Q_(r,{...i,derivedPanelConstraints:N_(r)})},updateSeparatorProps:(e,{disabled:t,disableDoubleClick:n})=>{let r=x.current.separators.find(t=>t.id===e);r&&(r.disabled=t,r.disableDoubleClick=n)}}),[C,_,b,u,w]),E=(0,Q.useRef)(null);return ay(()=>{let e=v.current;if(e===null)return;let t=x.current,n;if(w.defaultLayout!==void 0&&Object.keys(w.defaultLayout).length===t.panels.length){n={};for(let e of t.panels){let t=w.defaultLayout[e.id];t!==void 0&&(n[e.id]=t)}}let r={disabled:!!i,element:e,id:_,mutableState:{defaultLayout:n,disableCursor:!!w.disableCursor,expandedPanelSizes:x.current.lastExpandedPanelSizes,layouts:x.current.layouts},orientation:u,panels:t.panels,resizeTargetMinimumSize:t.resizeTargetMinimumSize,separators:t.separators};E.current=r;let a=ny(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=Y_(r.id,!0);!o&&s.length>0&&(h(c),g(c));let l=Z_(_,e=>{let{defaultLayoutDeferred:t,derivedPanelConstraints:n,layout:i}=e.next;if(t||n.length===0)return;let a=r.panels.map(({id:e})=>e).join(`,`);r.mutableState.layouts[a]=i,n.forEach(t=>{if(t.collapsible){let{layout:n}=e.prev??{};if(n){let e=pv(t.collapsedSize,i[t.panelId]),a=pv(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=Dv().state!==`active`;h(i),o&&g(i)});return()=>{E.current=null,a(),l()}},[i,_,g,h,u,y,w]),(0,Q.useEffect)(()=>{let e=E.current;e&&(e.mutableState.defaultLayout=n,e.mutableState.disableCursor=!!r)}),(0,Z.jsx)(ly.Provider,{value:T,children:(0,Z.jsx)(`div`,{...p,className:t,"data-group":!0,"data-testid":_,id:_,ref:S,style:{height:`100%`,width:`100%`,overflow:`hidden`,...f,display:`flex`,flexDirection:u===`horizontal`?`row`:`column`,flexWrap:`nowrap`,touchAction:u===`horizontal`?`pan-y`:`pan-x`},children:e})})}dy.displayName=`Group`;function fy(){let e=(0,Q.useContext)(ly);return P_(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function py(e,t){let{id:n}=fy(),r=(0,Q.useRef)({collapse:Nv,expand:Nv,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:Nv});(0,Q.useImperativeHandle)(t,()=>r.current,[]),ay(()=>{Object.assign(r.current,yv({groupId:n,panelId:e}))})}function my({children:e,className:t,collapsedSize:n=`0%`,collapsible:r=!1,defaultSize:i,disabled:a,elementRef:o,groupResizeBehavior:s=`preserve-relative-size`,id:c,maxSize:l=`100%`,minSize:u=`0%`,onResize:d,panelRef:f,style:p,...m}){let h=!!c,g=iy(c),_=cy({disabled:a}),v=(0,Q.useRef)(null),y=sy(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=fy(),T=d!==null,E=oy((e,t,n)=>{d?.(e,c,n)});ay(()=>{let e=v.current;if(e!==null)return C({element:e,id:g,idIsStable:h,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:T?E:void 0,panelConstraints:{groupResizeBehavior:s,collapsedSize:n,collapsible:r,defaultSize:i,disabled:_.disabled,maxSize:l,minSize:u}})},[s,n,r,i,T,g,h,l,u,E,C,_]),(0,Q.useEffect)(()=>{w(g,{disabled:a})},[a,g,w]),py(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,Q.useSyncExternalStore)(e=>Z_(x,e),D,D),k;return k=O?JSON.parse(O):i?{flexGrow:void 0,flexShrink:void 0,flexBasis:i}:{flexGrow:1},(0,Z.jsx)(`div`,{...m,"data-disabled":a||void 0,"data-panel":!0,"data-testid":g,id:g,ref:y,style:{...hy,display:`flex`,flexBasis:0,flexShrink:1,overflow:`visible`,...k},children:(0,Z.jsx)(`div`,{className:t,style:{maxHeight:`100%`,maxWidth:`100%`,flexGrow:1,overflow:`auto`,...p,touchAction:S===`horizontal`?`pan-y`:`pan-x`},children:e})})}my.displayName=`Panel`;var hy={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function gy(){return(0,Q.useRef)(null)}function _y({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,a,o=e[n],s=t.find(e=>e.panelId===n);if(s){let c=s.maxSize,l=s.collapsible?s.collapsedSize:s.minSize,u=[r,r+1];a=vv({layout:gv({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=vv({layout:gv({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function vy({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=iy(a),l=cy({disabled:n,disableDoubleClick:r}),[u,d]=(0,Q.useState)({}),[f,p]=(0,Q.useState)(`inactive`),m=(0,Q.useRef)(null),h=sy(m,i),{disableCursor:g,id:_,orientation:v,registerSeparator:y,updateSeparatorProps:b}=fy(),x=v===`horizontal`?`vertical`:`horizontal`;ay(()=>{let e=m.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=y(t),r=Ov(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=Z_(_,e=>{let{derivedPanelConstraints:n,layout:r,separatorToPanels:i}=e.next,a=i.get(t);if(a){let e=a[0],t=a.indexOf(e);d(_y({layout:r,panelConstraints:n,panelId:e.id,panelIndex:t}))}});return()=>{r(),i(),n()}}},[_,c,y,l]),(0,Q.useEffect)(()=>{b(c,{disabled:n,disableDoubleClick:r})},[n,r,c,b]);let S;return n&&!g&&(S=`not-allowed`),(0,Z.jsx)(`div`,{...s,"aria-controls":u.valueControls,"aria-disabled":n||void 0,"aria-orientation":x,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:e,className:t,"data-separator":n?`disabled`:f,"data-testid":c,id:c,ref:h,role:`separator`,style:{flexBasis:`auto`,cursor:S,...o,flexGrow:0,flexShrink:0,touchAction:`none`},tabIndex:n?void 0:0})}vy.displayName=`Separator`;var yy={name:`toml`,startState:function(){return{inString:!1,stringType:``,lhs:!0,inArray:0}},token:function(e,t){let n;if(!t.inString&&(n=e.match(/^('''|"""|'|")/))&&(t.stringType=n[0],t.inString=!0),e.sol()&&!t.inString&&t.inArray===0&&(t.lhs=!0),t.inString){for(;t.inString;)if(e.match(t.stringType))t.inString=!1;else if(e.peek()===`\\`)e.next(),e.next();else if(e.eol())break;else e.match(/^.[^\\\"\']*/);return t.lhs?`property`:`string`}else if(t.inArray&&e.peek()===`]`)return e.next(),t.inArray--,`bracket`;else if(t.lhs&&e.peek()===`[`&&e.skipTo(`]`))return e.next(),e.peek()===`]`&&e.next(),`atom`;else if(e.peek()===`#`)return e.skipToEnd(),`comment`;else if(e.eatSpace())return null;else if(t.lhs&&e.eatWhile(function(e){return e!=`=`&&e!=` `}))return`property`;else if(t.lhs&&e.peek()===`=`)return e.next(),t.lhs=!1,null;else if(!t.lhs&&e.match(/^\d\d\d\d[\d\-\:\.T]*Z/))return`atom`;else if(!t.lhs&&(e.match(`true`)||e.match(`false`)))return`atom`;else if(!t.lhs&&e.peek()===`[`)return t.inArray++,e.next(),`bracket`;else if(!t.lhs&&e.match(/^\-?\d+(?:\.\d+)?/))return`number`;else e.eatSpace()||e.next();return null},languageData:{commentTokens:{line:`#`}}},by=zt({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),xy=_({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}});function Sy(e){switch(e.toLowerCase()){case`json`:return Ns().language;case`toml`:return ks.define(yy);default:return null}}function Cy(e){let t=(0,$.c)(5),{_:n}=i(),r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={status:`loading`},t[0]=r):r=t[0];let[a,o]=(0,Q.useState)(r),s,c;return t[1]!==n||t[2]!==e?(s=()=>{let t=!1,r=new AbortController;return o({status:`loading`}),fetch(e,{credentials:`same-origin`,signal:r.signal}).then(async e=>{if(!e.ok){let t=e.status;throw Error(n({id:`PauP7d`,values:{status:t}}))}return e.text()}).then(e=>{t||o({status:`loaded`,content:e})}).catch(e=>{t||e instanceof Error&&e.name===`AbortError`||o({status:`error`,message:e instanceof Error?e.message:n({id:`ig5vUe`})})}),()=>{t=!0,r.abort()}},c=[e,n],t[1]=n,t[2]=e,t[3]=s,t[4]=c):(s=t[3],c=t[4]),(0,Q.useEffect)(s,c),a}function wy(e){let t=(0,$.c)(28),{src:n,fileName:r,extension:i}=e,a=(0,Q.useRef)(null),o=(0,Q.useRef)(null),{resolvedTheme:c}=Kr(),l=Cy(n),u=l.status===`loaded`?l.content:null,d,f;if(t[0]!==i||t[1]!==u||t[2]!==c?(d=()=>{if(!a.current||u===null)return;let e=Sy(i),t=c===`dark`?by:xy,n=[Ls,...e?[e]:[],Ts.editable.of(!1),hs.readOnly.of(!0),Ts.lineWrapping,t],r=new Ts({state:hs.create({doc:u,extensions:n}),parent:a.current});return o.current=r,()=>{r.destroy(),o.current=null}},f=[u,i,c],t[0]=i,t[1]=u,t[2]=c,t[3]=d,t[4]=f):(d=t[3],f=t[4]),(0,Q.useEffect)(d,f),l.status===`loading`){let e;t[5]===r?e=t[6]:(e=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`Md709y`,values:{fileName:r}})}),t[5]=r,t[6]=e);let n;return t[7]!==i||t[8]!==r||t[9]!==e?(n=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col items-center justify-center bg-background text-muted-foreground text-sm`,"aria-label":r,"data-text-viewer":``,"data-text-viewer-state":`loading`,"data-text-viewer-extension":i,children:e}),t[7]=i,t[8]=r,t[9]=e,t[10]=n):n=t[10],n}if(l.status===`error`){let e;t[11]===r?e=t[12]:(e=(0,Z.jsx)(`div`,{className:`font-medium text-sm`,children:(0,Z.jsx)(s,{id:`qdBUHP`,values:{fileName:r}})}),t[11]=r,t[12]=e);let a;t[13]===l.message?a=t[14]:(a=(0,Z.jsx)(`div`,{className:`text-muted-foreground text-xs`,children:l.message}),t[13]=l.message,t[14]=a);let o;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(s,{id:`9npOH9`}),t[15]=o):o=t[15];let c;t[16]===n?c=t[17]:(c=(0,Z.jsx)(`a`,{href:n,className:`mt-2 rounded-md border px-3 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground`,children:o}),t[16]=n,t[17]=c);let u;return t[18]!==i||t[19]!==r||t[20]!==e||t[21]!==a||t[22]!==c?(u=(0,Z.jsxs)(`main`,{className:`flex h-full min-h-0 flex-col items-center justify-center gap-2 bg-background p-4 text-center`,"aria-label":r,"data-text-viewer":``,"data-text-viewer-state":`error`,"data-text-viewer-extension":i,children:[e,a,c]}),t[18]=i,t[19]=r,t[20]=e,t[21]=a,t[22]=c,t[23]=u):u=t[23],u}let p;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(`div`,{ref:a,className:`min-h-0 flex-1 overflow-auto`}),t[24]=p):p=t[24];let m;return t[25]!==i||t[26]!==r?(m=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":r,"data-text-viewer":``,"data-text-viewer-state":`loaded`,"data-text-viewer-extension":i,children:p}),t[25]=i,t[26]=r,t[27]=m):m=t[27],m}function Ty(e){return ur(`/api/asset?path=${encodeURIComponent(e)}`)}function Ey(e){return`/api/asset-text?path=${encodeURIComponent(e)}`}function Dy(e){let t=(0,$.c)(28),{assetPath:n,mediaKind:r}=e,[i,a]=(0,Q.useState)(!1),o;t[0]===n?o=t[1]:(o=Ty(n),t[0]=n,t[1]=o);let c=o,l;t[2]===n?l=t[3]:(l=n.split(`/`).pop()??n,t[2]=n,t[3]=l);let u=l,d,f,p;if(t[4]!==n||t[5]!==u||t[6]!==i||t[7]!==r||t[8]!==c){p=Symbol.for(`react.early_return_sentinel`);bb0:{let e=u.includes(`.`)?u.split(`.`).pop()??``:``;if(f=e.length>0?e.toUpperCase():`FILE`,d=i?`text`:r,d===`pdf`){let e;t[12]!==u||t[13]!==c?(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,Z.jsx)(Mt,{src:c,title:u,fillContainer:!0})}),t[12]=u,t[13]=c,t[14]=e):e=t[14];let n;t[15]!==u||t[16]!==e?(n=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":u,children:e}),t[15]=u,t[16]=e,t[17]=n):n=t[17],p=n;break bb0}if(d===`text`){let r;t[18]===n?r=t[19]:(r=Ey(n),t[18]=n,t[19]=r),p=(0,Z.jsx)(wy,{src:r,fileName:u,extension:e.toLowerCase()},n);break bb0}}t[4]=n,t[5]=u,t[6]=i,t[7]=r,t[8]=c,t[9]=d,t[10]=f,t[11]=p}else d=t[9],f=t[10],p=t[11];if(p!==Symbol.for(`react.early_return_sentinel`))return p;let m;t[20]!==d||t[21]!==f||t[22]!==u||t[23]!==c?(m=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto p-4`,children:d===`image`?(0,Z.jsx)(Et,{src:c,alt:u,draggable:!1,slotClassName:`flex h-full w-full items-center justify-center`,className:`max-h-full max-w-full`}):d===`video`?(0,Z.jsx)(`video`,{src:c,controls:!0,className:`max-h-full max-w-full`}):d===`audio`?(0,Z.jsx)(`audio`,{src:c,controls:!0,className:`w-full max-w-md`}):(0,Z.jsxs)(`div`,{className:`flex max-w-sm flex-col items-center gap-3 text-center`,children:[(0,Z.jsx)(`div`,{className:`flex size-16 items-center justify-center rounded-md border bg-muted font-medium text-muted-foreground text-sm`,children:f}),(0,Z.jsx)(`div`,{className:`max-w-full break-words font-medium text-sm`,children:u}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[(0,Z.jsx)(Ni,{asChild:!0,variant:`outline`,size:`sm`,children:(0,Z.jsx)(`a`,{href:c,children:(0,Z.jsx)(s,{id:`9npOH9`})})}),(0,Z.jsx)(Ni,{variant:`outline`,size:`sm`,onClick:()=>a(!0),"data-testid":`asset-preview-open-as-text`,children:(0,Z.jsx)(s,{id:`Ruuu3v`})})]})]})}),t[20]=d,t[21]=f,t[22]=u,t[23]=c,t[24]=m):m=t[24];let h;return t[25]!==u||t[26]!==m?(h=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":u,children:m}),t[25]=u,t[26]=m,t[27]=h):h=t[27],h}function Oy(){let e=(0,$.c)(5),{_:t}=i(),n;e[0]===t?n=e[1]:(n=t({id:`3VsNTI`}),e[0]=t,e[1]=n);let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsx)(eo,{className:`h-9 w-2/5 mt-6 mb-5`}),(0,Z.jsx)(eo,{className:`h-4 w-full`}),(0,Z.jsx)(eo,{className:`h-4 w-3/4`})]}),e[2]=r):r=e[2];let a;return e[3]===n?a=e[4]:(a=(0,Z.jsx)(`div`,{className:`tiptap-editor pt-10`,role:`status`,"aria-busy":`true`,"aria-label":n,children:r}),e[3]=n,e[4]=a),a}var ky={"claude-cowork":`claude`,"claude-code":`claude`,codex:`openai`,cursor:`cursor`};function Ay(e){let t=(0,$.c)(23),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({id:r,style:a,className:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let{resolvedTheme:o}=Kr(),s=ky[r],c=s?(o===`dark`?Br[s]:void 0)??Tn[s]:void 0,l;t[5]!==c||t[6]!==a?(l=c?{...a,"--ok-brand-color":c}:a,t[5]=c,t[6]=a,t[7]=l):l=t[7];let u=l,d=c&&`[&_*]:![color:var(--ok-brand-color)]`,f;t[8]!==n||t[9]!==d?(f=Ei(d,n),t[8]=n,t[9]=d,t[10]=f):f=t[10];let p=f;if(r===`claude-cowork`||r===`claude-code`){let e;return t[11]!==p||t[12]!==u||t[13]!==i?(e=(0,Z.jsx)(Ri,{style:u,className:p,...i}),t[11]=p,t[12]=u,t[13]=i,t[14]=e):e=t[14],e}if(r===`codex`){let e;return t[15]!==p||t[16]!==u||t[17]!==i?(e=(0,Z.jsx)(Li,{style:u,className:p,...i}),t[15]=p,t[16]=u,t[17]=i,t[18]=e):e=t[18],e}if(r===`cursor`){let e;return t[19]!==p||t[20]!==u||t[21]!==i?(e=(0,Z.jsx)(Wi,{style:u,className:p,...i}),t[19]=p,t[20]=u,t[21]=i,t[22]=e):e=t[22],e}return null}function jy(e){let{installState:t}=e;return t.installed===null?X._({id:`IA6JW2`}):t.installed===!1?X._({id:`5SwVv1`}):null}function My(e){let{target:t,installState:n}=e;if(n.installed===null)return{enabled:!1,tooltip:null};if(n.installed===!1){let e=t.appBrandName??t.displayName;return{enabled:!1,tooltip:{message:X._({id:`OJTOUj`,values:{brand:e}}),installAction:{label:X._({id:`fG0X0e`,values:{brand:e}}),url:t.installUrl},...t.hasWebFallback?{webFallback:{label:X._({id:`0S9PW_`}),url:``}}:{}}}}return{enabled:!0,tooltip:null}}function Ny(e){return Ci(e)}function Py(e){return X._({id:`h_HYHD`,values:{displayName:e}})}var Fy=`claude.ai`;async function Iy(e,t=Jm){(await t(Ci(e))).ok?$o.success(Py(Fy)):$o.error(X._({id:`9NC_MT`,values:{CLAUDE_WEB_FALLBACK_LABEL:Fy}}))}function Ly(e){let t=(0,$.c)(68),{_:n}=i(),{target:r,installState:a,isElectronHost:o,prompt:s,onSelect:c}=e,l=e.openExternal??Jm,u=e.onWebFallbackSuccess??zy,d=e.onWebFallbackError??Ry,{displayName:f}=r,p,m,h,g,_,v,y,b,x,S;if(t[0]!==n||t[1]!==a||t[2]!==o||t[3]!==c||t[4]!==d||t[5]!==u||t[6]!==l||t[7]!==s||t[8]!==r||t[9]!==f){S=Symbol.for(`react.early_return_sentinel`);bb0:{let e=My({target:r,installState:a,isElectronHost:o}),i=jy({target:r,installState:a,isElectronHost:o}),C=()=>{e.tooltip&&l(e.tooltip.installAction.url)},w;t[20]!==d||t[21]!==u||t[22]!==l||t[23]!==s||t[24]!==r?(w=()=>{(async()=>{let e=await l(Ny(s));e.ok?u(r):d(r,e.detail??e.reason)})()},t[20]=d,t[21]=u,t[22]=l,t[23]=s,t[24]=r,t[25]=w):w=t[25];let T=w;if(e.enabled){let e=`open-in-agent-item-${r.id}`,i;t[26]!==n||t[27]!==f?(i=n({id:`NnQapF`,values:{targetDisplayName:f}}),t[26]=n,t[27]=f,t[28]=i):i=t[28];let a;t[29]===r.id?a=t[30]:(a=(0,Z.jsx)(Ay,{id:r.id,"aria-hidden":`true`}),t[29]=r.id,t[30]=a);let o;t[31]===r.displayName?o=t[32]:(o=(0,Z.jsx)(`span`,{children:r.displayName}),t[31]=r.displayName,t[32]=o);let s;t[33]!==c||t[34]!==i||t[35]!==a||t[36]!==o||t[37]!==e?(s=(0,Z.jsxs)(ha,{onSelect:c,"data-testid":e,"aria-label":i,children:[a,o]}),t[33]=c,t[34]=i,t[35]=a,t[36]=o,t[37]=e,t[38]=s):s=t[38],S=s;break bb0}if(!e.tooltip){let e=n(i?{id:`If0crP`,values:{targetDisplayName:f,hint:i}}:{id:`NnQapF`,values:{targetDisplayName:f}}),a;t[39]===r.id?a=t[40]:(a=(0,Z.jsx)(Ay,{id:r.id,"aria-hidden":`true`}),t[39]=r.id,t[40]=a);let o;t[41]===r.displayName?o=t[42]:(o=(0,Z.jsx)(`span`,{className:`flex-1`,children:r.displayName}),t[41]=r.displayName,t[42]=o),S=(0,Z.jsxs)(ha,{disabled:!0,"data-testid":`open-in-agent-item-${r.id}`,"aria-label":e,children:[a,o,i?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:i}):null]});break bb0}let E=n(i?{id:`If0crP`,values:{targetDisplayName:f,hint:i}}:{id:`NnQapF`,values:{targetDisplayName:f}}),D=e.tooltip.webFallback?.label??``;m=za;let O=`open-in-agent-item-${r.id}`,k;t[43]===r.id?k=t[44]:(k=(0,Z.jsx)(Ay,{id:r.id,"aria-hidden":`true`,className:`mr-2`}),t[43]=r.id,t[44]=k);let A;t[45]===r.displayName?A=t[46]:(A=(0,Z.jsx)(`span`,{className:`flex-1`,children:r.displayName}),t[45]=r.displayName,t[46]=A);let j;t[47]===i?j=t[48]:(j=i?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:i}):null,t[47]=i,t[48]=j),t[49]!==E||t[50]!==k||t[51]!==A||t[52]!==j||t[53]!==O?(x=(0,Z.jsxs)(Ba,{"data-testid":O,"data-row-disabled":``,"aria-label":E,children:[k,A,j]}),t[49]=E,t[50]=k,t[51]=A,t[52]=j,t[53]=O,t[54]=x):x=t[54],p=Ra,h=`min-w-[260px]`,g=`open-in-agent-submenu-${r.id}`,_=(0,Z.jsx)(ho,{className:`font-normal text-muted-foreground text-xs`,"data-testid":`open-in-agent-message-${r.id}`,children:e.tooltip.message}),t[55]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(ma,{}),t[55]=v):v=t[55],y=(0,Z.jsx)(ha,{onSelect:C,"data-testid":`open-in-agent-install-${r.id}`,children:(0,Z.jsx)(`span`,{children:e.tooltip.installAction.label})}),b=e.tooltip.webFallback?(0,Z.jsxs)(ha,{onSelect:T,"data-testid":`open-in-agent-web-fallback-${r.id}`,"aria-label":n({id:`lsOFZR`,values:{webFallbackLabel:D}}),children:[(0,Z.jsx)(`span`,{className:`flex-1`,children:e.tooltip.webFallback.label}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:n({id:`Z9BoIy`})})]}):null}t[0]=n,t[1]=a,t[2]=o,t[3]=c,t[4]=d,t[5]=u,t[6]=l,t[7]=s,t[8]=r,t[9]=f,t[10]=p,t[11]=m,t[12]=h,t[13]=g,t[14]=_,t[15]=v,t[16]=y,t[17]=b,t[18]=x,t[19]=S}else p=t[10],m=t[11],h=t[12],g=t[13],_=t[14],v=t[15],y=t[16],b=t[17],x=t[18],S=t[19];if(S!==Symbol.for(`react.early_return_sentinel`))return S;let C;t[56]!==p||t[57]!==h||t[58]!==g||t[59]!==_||t[60]!==v||t[61]!==y||t[62]!==b?(C=(0,Z.jsxs)(p,{className:h,"data-testid":g,children:[_,v,y,b]}),t[56]=p,t[57]=h,t[58]=g,t[59]=_,t[60]=v,t[61]=y,t[62]=b,t[63]=C):C=t[63];let w;return t[64]!==m||t[65]!==x||t[66]!==C?(w=(0,Z.jsxs)(m,{children:[x,C]}),t[64]=m,t[65]=x,t[66]=C,t[67]=w):w=t[67],w}function Ry(){}function zy(){}function By(e){let t=(0,$.c)(12),{className:n}=e,{states:r,refresh:i}=Ch(),{dispatch:a}=fh(),o=Wa(),s,c;if(t[0]!==n||t[1]!==a||t[2]!==i||t[3]!==r||t[4]!==o){let e=eh({workspace:o});t[7]===n?s=t[8]:(s=Ei(`grid w-full max-w-5xl gap-4 sm:grid-cols-3`,n),t[7]=n,t[8]=s),c=xm.map(t=>{let n=r[t.id]?.installed,o=n===!0?`installed`:n===!1?`missing`:`pending`;return(0,Z.jsx)(Vy,{target:t,status:o,onOpen:o===`installed`&&e!==null?()=>{a(t.id,e)}:void 0,onInstall:()=>{nh(t),i()}},t.id)}),t[0]=n,t[1]=a,t[2]=i,t[3]=r,t[4]=o,t[5]=s,t[6]=c}else s=t[5],c=t[6];let l;return t[9]!==s||t[10]!==c?(l=(0,Z.jsx)(`div`,{className:s,children:c}),t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function Vy(e){let t=(0,$.c)(22),{target:n,status:r,onOpen:i,onInstall:a}=e,o=r===`installed`?i:r===`missing`?a:void 0,s=r===`pending`||r===`installed`&&i===void 0,c=r===`installed`?`Open`:r===`missing`?`Install`:`Checking`,l;t[0]===n.id?l=t[1]:(l=(0,Z.jsx)(Ay,{id:n.id,"aria-hidden":`true`,className:`size-4`}),t[0]=n.id,t[1]=l);let u;t[2]===n.displayName?u=t[3]:(u=(0,Z.jsx)(`h3`,{className:`text-sm font-medium leading-tight`,children:n.displayName}),t[2]=n.displayName,t[3]=u);let d;t[4]!==l||t[5]!==u?(d=(0,Z.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-start sm:items-center gap-2`,children:[l,u]}),t[4]=l,t[5]=u,t[6]=d):d=t[6];let f;t[7]===n.tagline?f=t[8]:(f=n.tagline?(0,Z.jsx)(`p`,{className:`text-1sm leading-relaxed text-muted-foreground`,children:n.tagline}):null,t[7]=n.tagline,t[8]=f);let p;t[9]!==d||t[10]!==f?(p=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[d,f]}),t[9]=d,t[10]=f,t[11]=p):p=t[11];let m;t[12]===r?m=t[13]:(m=r===`missing`?(0,Z.jsx)(Fo,{"aria-hidden":`true`,className:`size-3`}):null,t[12]=r,t[13]=m);let h;t[14]!==c||t[15]!==m?(h=(0,Z.jsxs)(`p`,{className:`mt-auto inline-flex items-center gap-1 pt-2 font-mono text-2xs uppercase tracking-wider text-muted-foreground`,children:[c,m]}),t[14]=c,t[15]=m,t[16]=h):h=t[16];let g;return t[17]!==s||t[18]!==o||t[19]!==p||t[20]!==h?(g=(0,Z.jsxs)(`button`,{type:`button`,onClick:o,disabled:s,className:`group flex h-full flex-col items-start gap-4 rounded-2xl border border-border/60 bg-card p-5 text-left transition-[border-color,box-shadow,transform] hover:border-border hover:shadow-sm focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 active:translate-y-px disabled:cursor-not-allowed disabled:opacity-60`,children:[p,h]}),t[17]=s,t[18]=o,t[19]=p,t[20]=h,t[21]=g):g=t[21],g}var Hy=3100,Uy=3;function Wy(e,t,n){let r=n?.windowMs??600,i=n?.maxLevel??Uy;if(e===0||t>=r)return 1;let a=e+1;return a>i?i:a}var Gy={0:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},1:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},2:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},3:{count:16,startRadius:11,baseDistance:7,distanceVariance:3,sizeMin:.45,sizeMax:1.2,maxDelay:500,durationMin:1100,durationMax:2400}},Ky=[`var(--color-azure-blue)`,`var(--color-sky-blue)`,`var(--color-violet-300)`,`var(--color-orange-light)`,`var(--color-crystal-blue)`,`var(--color-white-cream)`];function qy(e,t={}){let n=t.rng??Math.random,r=t.colors??Ky,i=Gy[e];if(i.count===0||r.length===0)return[];let a=[],o=Math.PI*2/i.count;for(let e=0;e<i.count;e++){let t=e*o+(n()-.5)*o*.7,s=i.baseDistance+(n()-.5)*2*i.distanceVariance,c=i.sizeMin+n()*(i.sizeMax-i.sizeMin),l=n()*i.maxDelay,u=i.durationMin+n()*(i.durationMax-i.durationMin),d=Math.floor(n()*r.length),f=Math.cos(t),p=Math.sin(t);a.push({id:e,dx:f*s,dy:p*s,originDx:f*i.startRadius,originDy:p*i.startRadius,size:c,color:r[d]??`currentColor`,delay:l,duration:u})}return a}var Jy=1.8,Yy=90,Xy=16,Zy=380,Qy=.025,$y=.1,eb=.18,tb=400,nb=9.2736,rb=18.1799,ib=14.5244,ab={1:{halfWidth:1.5,apexLift:2.2},2:{halfWidth:1.4,apexLift:2.6},3:{halfWidth:1.25,apexLift:3}};function ob(e,t){let{halfWidth:n,apexLift:r}=ab[t];return`M${e-n} ${ib+.3} Q${e} ${ib-r}, ${e+n} ${ib+.3}`}function sb(e){let t=1.5,n=.3;return`M${e-t} ${ib-n} Q${e} ${ib+1.4}, ${e+t} ${ib-n}`}var cb=15,lb=15;function ub(e){return{fill:e.color,"--fx-tx":`${e.dx}px`,"--fx-ty":`${e.dy}px`,"--fx-delay":`${e.delay}ms`,"--fx-duration":`${e.duration}ms`}}function db(e){let t=(0,$.c)(71),{size:n,className:r,trackMouse:i,variant:a,celebrateSignal:o}=e,s=n===void 0?48:n,c=i===void 0?!0:i,l=a===void 0?`default`:a,u=o===void 0?0:o,d=(0,Q.useRef)(null),f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m={x:0,y:0},t[0]=m):m=t[0];let h=(0,Q.useRef)(m),[g,_]=(0,Q.useState)(0),[v,y]=(0,Q.useState)(0),b;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(b=[],t[1]=b):b=t[1];let[x,S]=(0,Q.useState)(b),C=(0,Q.useRef)(0),w=(0,Q.useRef)(void 0),T=l===`sleeping`,E;t[2]!==g||t[3]!==T?(E=function(){if(T)return;let e=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),t=C.current===0?1/0:e-C.current;C.current=e;let n=Wy(g,t);_(n),y(hb),S(qy(n)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},Hy)},t[2]=g,t[3]=T,t[4]=E):E=t[4];let D=E,O,k;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>()=>clearTimeout(w.current),k=[],t[5]=O,t[6]=k):(O=t[5],k=t[6]),(0,Q.useEffect)(O,k);let A,j;t[7]!==u||t[8]!==T?(A=()=>{u===0||T||(_(3),y(mb),S(qy(3)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},Hy))},j=[u,T],t[7]=u,t[8]=T,t[9]=A,t[10]=j):(A=t[9],j=t[10]),(0,Q.useEffect)(A,j);let M,N;t[11]!==T||t[12]!==c?(M=()=>{if(!c||T||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let e=0,t=0,n=!1,r=0,i=0,a=0,o=0,s=0,l=function(){s===0&&(s=requestAnimationFrame(m))},u=function(r){e=r.clientX,t=r.clientY,n=!0,l()};function m(){s=0;let c=f.current,u=d.current;if(!c||!u){l();return}let m=n;n=!1;let g=c.getBoundingClientRect(),_=g.left+g.width/2,v=g.top+g.height*.48,y=e-_,b=t-v,x=Math.hypot(y,b),S=Math.max(-1,Math.min(1,y/Zy)),C=Math.max(-1,Math.min(1,b/Zy)),w=S*Xy,T=-C*Xy,E=0,D=0;if(x>=1){let e=Math.min(x/Yy,1)*Jy;E=y/x*e,D=b/x*e}let O=Math.abs(T-r)<.01&&Math.abs(w-i)<.01&&Math.abs(E-a)<.01&&Math.abs(D-o)<.01;if(!m&&O)return;l(),r+=(T-r)*$y,i+=(w-i)*$y,u.style.transform=`perspective(${tb}px) rotateX(${r.toFixed(3)}deg) rotateY(${i.toFixed(3)}deg)`,a+=(E-a)*eb,o+=(D-o)*eb;let k=i*Qy,A=-r*Qy,j=a+k,M=o+A;h.current.x=j,h.current.y=M,p.current?.setAttribute(`transform`,`translate(${j.toFixed(3)} ${M.toFixed(3)})`)}return document.addEventListener(`mousemove`,u,{passive:!0}),l(),()=>{document.removeEventListener(`mousemove`,u),s!==0&&cancelAnimationFrame(s),s=0,d.current&&(d.current.style.transform=``),h.current={x:0,y:0},p.current?.removeAttribute(`transform`)}},N=[c,T],t[11]=T,t[12]=c,t[13]=M,t[14]=N):(M=t[13],N=t[14]),(0,Q.useEffect)(M,N);let P;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>{let e=p.current;if(!e)return;let{x:t,y:n}=h.current;e.setAttribute(`transform`,`translate(${t.toFixed(3)} ${n.toFixed(3)})`)},t[15]=P):P=t[15],(0,Q.useLayoutEffect)(P);let F=g>0,I=F?g:1,L=F?`ok-blob-clicked-${g}`:null,R;t[16]===r?R=t[17]:(R=Ei(`ok-blob-3d-wrapper`,r),t[16]=r,t[17]=R);let z=T?`cursor-default`:`cursor-pointer`,B=`body-${v}`,V=T&&`ok-blob-sleeping`,H;t[18]!==L||t[19]!==V?(H=Ei(`ok-blob-group`,V,L),t[18]=L,t[19]=V,t[20]=H):H=t[20];let U;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(`path`,{d:`M25.2339 6.78134C25.5199 7.35734 25.8179 8.47234 26.0179 9.07834C26.0189 9.08234 26.0209 9.08634 26.0219 9.09134C26.0229 9.09534 26.0249 9.10034 26.0259 9.10434C26.0539 9.19734 26.0949 9.29533 26.1519 9.41633C26.2919 9.71133 26.5269 10.1173 27.1299 11.1683C27.3259 11.4643 27.5209 11.7693 27.7119 12.0903C29.9739 15.1623 29.3259 20.1913 27.0469 22.9153C26.7779 23.2953 26.4869 23.6043 26.1889 23.8863C26.1519 23.9253 26.1129 23.9643 26.0729 24.0033C25.3159 24.7543 24.2949 25.4673 23.6129 25.8323C22.7469 26.2983 22.1349 26.5483 21.6299 26.7463C20.3649 27.3063 19.0609 27.7733 17.6569 28.0423C15.9649 28.3513 14.1939 28.4433 12.4569 28.1373C11.4779 27.9663 10.5119 27.6663 9.60891 27.2493C8.77491 26.8663 7.99192 26.3853 7.26992 25.8403C6.83592 25.5393 6.43893 25.2343 6.08093 24.9383C5.57893 24.5223 5.15993 24.1263 4.83493 23.7793C4.04993 22.9443 3.31593 21.8893 2.80893 21.0953C2.72593 20.9663 2.64792 20.8433 2.57592 20.7293C2.56192 20.7093 2.54793 20.6893 2.53393 20.6703C2.08593 20.0263 1.71892 19.3293 1.43792 18.5993C1.42892 18.5453 1.42093 18.4903 1.41293 18.4353C1.32093 17.7443 1.08292 16.9423 1.01092 15.6333C0.984921 15.0653 0.998928 14.4013 1.12393 13.6353C1.20693 13.1413 1.31993 12.9023 1.40893 12.7113C1.43593 12.6543 1.46193 12.6023 1.48593 12.5483C1.56793 12.3653 1.59392 12.1563 1.63592 11.9083C1.68992 11.5883 1.76992 11.1943 2.04592 10.7553C2.94392 9.37934 3.36792 8.81934 3.66592 8.33934C3.75592 8.20334 3.84292 8.08134 3.94192 7.96634C4.21592 7.64634 4.67693 7.29534 5.10293 7.05734C5.16693 7.02234 5.23093 6.98834 5.29193 6.95534C5.62993 6.77834 6.22592 6.30135 6.66992 5.92035C6.83692 5.77635 7.08193 5.60735 7.37393 5.40935C7.67393 5.20535 8.02593 4.96934 8.39193 4.70234C9.32093 4.02634 9.84091 3.69134 10.2599 3.42334C10.3799 3.34734 10.4919 3.27734 10.6049 3.20834C10.9609 2.98834 11.4149 2.73034 11.8869 2.48634C12.4519 2.19334 13.0469 1.92133 13.5089 1.72233C14.7399 1.30233 16.0539 1.01333 17.4169 1.00033C18.1169 0.991333 18.7939 1.16534 19.2389 1.43034C19.6869 1.69534 19.8689 2.00335 19.8039 2.23935C19.7379 2.47835 19.4399 2.63634 19.0109 2.74734C18.5789 2.85634 18.0469 2.92035 17.4889 2.96135C16.3639 3.04235 15.2399 3.36435 14.1499 3.80835C12.8199 4.35135 11.5379 5.07133 10.2719 5.84733C9.38691 6.39133 8.51192 6.97334 7.63592 7.56834C7.54492 7.63034 7.45492 7.69135 7.36492 7.75235C6.97392 8.06635 6.58293 8.38134 6.22293 8.66334C5.97893 8.85734 5.76793 9.04834 5.59393 9.21434C5.26893 9.52334 5.02393 9.74334 4.81893 9.93934C4.67793 10.0753 4.55793 10.2013 4.45593 10.3443C4.40093 10.4213 4.32992 10.5273 4.24792 10.6593C3.90492 11.1933 3.44493 12.1693 3.15393 13.1173C3.01893 13.5363 2.87991 14.0343 2.79391 14.5253C2.66591 15.2253 2.65594 15.9053 2.71994 16.2373C2.82794 16.8193 2.95593 17.4833 3.14093 18.0553C3.31293 18.6003 3.52991 19.0583 3.70791 19.2823C3.81591 19.4183 3.90394 19.5473 3.99594 19.6913C4.09394 19.8413 4.19191 20.0073 4.31091 20.2033C4.47891 20.4803 4.68592 20.8163 5.00192 21.2493C5.36492 21.7463 5.61793 22.1043 5.83493 22.4023C6.14493 22.8243 6.38591 23.1343 6.83691 23.5033C7.33891 23.9113 7.86593 24.3113 8.26693 24.6393C8.44893 24.7883 8.66993 24.9443 8.90493 25.0963C9.21593 25.2963 9.55192 25.4893 9.85592 25.6703C10.1059 25.8203 10.3059 25.9633 10.4869 26.0863C10.5429 26.1243 10.5979 26.1603 10.6519 26.1943C10.8699 26.2803 11.0929 26.3593 11.3159 26.4283C11.3539 26.4323 11.3949 26.4353 11.4369 26.4393C11.6509 26.4573 11.9089 26.4733 12.2209 26.5133C12.7169 26.5753 13.1399 26.6603 13.6019 26.7243C13.9589 26.7733 14.3409 26.8083 14.7729 26.7893C15.0729 26.7753 15.4069 26.7353 15.7389 26.6813C16.2349 26.6023 16.7179 26.4943 17.0569 26.4473C17.1499 26.4343 17.2359 26.4343 17.3209 26.4373C17.3489 26.4393 17.3799 26.4413 17.4109 26.4433C17.4119 26.4433 17.4119 26.4433 17.4129 26.4433C17.4199 26.4433 17.4279 26.4443 17.4349 26.4443C18.2329 26.2413 19.0259 25.9433 19.7959 25.5983C19.8609 25.5633 19.9259 25.5273 19.9899 25.4913C20.3059 25.3173 20.6049 25.1383 20.7869 24.9943C20.9829 24.8393 21.5189 24.5373 22.0579 24.1853C22.4109 23.9553 22.7649 23.7053 23.0369 23.4833C23.1949 23.3553 23.3689 23.2693 23.5479 23.1773C23.7129 23.0923 23.8809 23.0013 24.0349 22.8653C24.1109 22.7983 24.1869 22.7173 24.2639 22.6303C24.3309 22.5563 24.4039 22.4723 24.4759 22.3923C24.5459 22.3153 24.7199 22.1723 24.9139 21.9793C25.0079 21.8863 25.1059 21.7783 25.1909 21.6713C25.2199 21.6323 25.2489 21.5943 25.2769 21.5553C25.5919 21.0403 25.8779 20.5003 26.1019 19.9653C26.1299 19.8403 26.1379 19.7293 26.1279 19.6373C26.1199 19.5703 26.1029 19.5113 26.0839 19.4503C26.0599 19.3643 26.0329 19.2773 26.0239 19.1723C26.0169 19.0893 26.0309 19.0043 26.0629 18.9543C26.0779 18.9323 26.0969 18.9143 26.1129 18.8993C26.1329 18.8823 26.1499 18.8673 26.1569 18.8443C26.1609 18.8273 26.1579 18.8073 26.1529 18.7833C26.1459 18.7443 26.1369 18.6943 26.1539 18.6293C26.2189 18.3853 26.2869 18.1103 26.3319 17.8383C26.3829 17.5393 26.4049 17.2433 26.3949 17.0123C26.3849 16.7493 26.3909 16.3823 26.3469 16.0003C26.3179 15.7343 26.2659 15.4663 26.1979 15.2383C26.1319 15.0143 26.0219 14.7913 25.9039 14.5783C25.7629 14.3223 25.6119 14.0783 25.5169 13.8453C25.4969 13.7983 25.4999 13.7263 25.4999 13.6323C25.5009 13.5673 25.4999 13.4913 25.4919 13.4083C25.3239 13.1243 25.1459 12.8423 24.9589 12.5483C24.9479 12.5413 24.9369 12.5333 24.9249 12.5263C24.6689 12.3503 24.3139 12.1173 24.0769 11.5503C24.0179 11.4063 24.0069 11.2983 23.9969 11.1993C23.9859 11.1013 23.9799 11.0183 23.9289 10.9093C23.8709 10.7853 23.7759 10.6583 23.6709 10.4993C23.5849 10.3703 23.4899 10.2133 23.4199 10.0423C23.3819 9.95134 23.3509 9.85734 23.3329 9.75934C23.3299 9.74334 23.3269 9.72534 23.3229 9.70634C23.2899 9.52734 23.2439 9.26534 23.2409 8.98634C23.0209 8.24434 22.8339 7.48833 22.6519 6.77633C22.3429 5.57133 22.0519 4.54234 21.3329 3.95434C20.9839 3.65334 20.5689 3.35433 20.2459 3.05433C19.9259 2.75633 19.7449 2.47534 19.8019 2.23834C19.8639 2.00634 20.1589 1.82934 20.6659 1.80534C21.1699 1.78334 21.8699 1.93235 22.5209 2.39235C23.6159 3.14235 24.2029 4.38334 24.5599 5.35734C24.5829 5.40834 24.6049 5.46034 24.6259 5.51234C24.7849 5.89434 24.9529 6.22834 25.1199 6.55534C25.1579 6.63034 25.1969 6.70834 25.2339 6.78134Z`,className:`ok-blob-body`}),t[21]=U):U=t[21];let W=(F||T)&&`ok-blob-eye-hidden`,G;t[22]===W?G=t[23]:(G=Ei(`ok-blob-eye`,W),t[22]=W,t[23]=G);let K;t[24]===G?K=t[25]:(K=(0,Z.jsx)(`ellipse`,{cx:nb,cy:ib,rx:1.2722,ry:1.9083,className:G}),t[24]=G,t[25]=K);let q=(F||T)&&`ok-blob-eye-hidden`,ee;t[26]===q?ee=t[27]:(ee=Ei(`ok-blob-eye ok-blob-eye-right`,q),t[26]=q,t[27]=ee);let te;t[28]===ee?te=t[29]:(te=(0,Z.jsx)(`ellipse`,{cx:rb,cy:ib,rx:1.2722,ry:1.9083,className:ee}),t[28]=ee,t[29]=te);let ne;t[30]===I?ne=t[31]:(ne=ob(nb,I),t[30]=I,t[31]=ne);let re=(!F||T)&&`ok-blob-eye-hidden`,ie;t[32]===re?ie=t[33]:(ie=Ei(`ok-blob-happy-eye`,re),t[32]=re,t[33]=ie);let ae;t[34]!==ne||t[35]!==ie?(ae=(0,Z.jsx)(`path`,{d:ne,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:ie}),t[34]=ne,t[35]=ie,t[36]=ae):ae=t[36];let oe;t[37]===I?oe=t[38]:(oe=ob(rb,I),t[37]=I,t[38]=oe);let se=(!F||T)&&`ok-blob-eye-hidden`,ce;t[39]===se?ce=t[40]:(ce=Ei(`ok-blob-happy-eye`,se),t[39]=se,t[40]=ce);let le;t[41]!==oe||t[42]!==ce?(le=(0,Z.jsx)(`path`,{d:oe,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:ce}),t[41]=oe,t[42]=ce,t[43]=le):le=t[43];let ue;t[44]===T?ue=t[45]:(ue=T?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`path`,{d:sb(nb),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`}),(0,Z.jsx)(`path`,{d:sb(rb),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`})]}):null,t[44]=T,t[45]=ue);let de;t[46]!==K||t[47]!==te||t[48]!==ae||t[49]!==le||t[50]!==ue?(de=(0,Z.jsxs)(`g`,{ref:p,children:[K,te,ae,le,ue]}),t[46]=K,t[47]=te,t[48]=ae,t[49]=le,t[50]=ue,t[51]=de):de=t[51];let fe;t[52]!==B||t[53]!==H||t[54]!==de?(fe=(0,Z.jsxs)(`g`,{className:H,children:[U,de]},B),t[52]=B,t[53]=H,t[54]=de,t[55]=fe):fe=t[55];let pe;t[56]===T?pe=t[57]:(pe=T?(0,Z.jsxs)(`g`,{children:[(0,Z.jsx)(`text`,{x:21,y:7,className:`ok-blob-z ok-blob-z-1`,children:`z`}),(0,Z.jsx)(`text`,{x:26,y:2,className:`ok-blob-z ok-blob-z-2`,children:`z`})]}):null,t[56]=T,t[57]=pe);let me;t[58]!==v||t[59]!==x?(me=x.length>0&&(0,Z.jsx)(`g`,{children:x.map(fb)},`firework-${v}`),t[58]=v,t[59]=x,t[60]=me):me=t[60];let he;t[61]!==D||t[62]!==s||t[63]!==z||t[64]!==fe||t[65]!==pe||t[66]!==me?(he=(0,Z.jsxs)(`svg`,{ref:f,width:s,height:s,viewBox:`0 0 30 30`,fill:`none`,overflow:`visible`,xmlns:`http://www.w3.org/2000/svg`,className:z,"aria-hidden":`true`,onClick:D,onMouseDown:pb,children:[fe,pe,me]}),t[61]=D,t[62]=s,t[63]=z,t[64]=fe,t[65]=pe,t[66]=me,t[67]=he):he=t[67];let ge;return t[68]!==R||t[69]!==he?(ge=(0,Z.jsx)(`span`,{ref:d,className:R,children:he}),t[68]=R,t[69]=he,t[70]=ge):ge=t[70],ge}function fb(e){return(0,Z.jsx)(`circle`,{cx:cb+e.originDx,cy:lb+e.originDy,r:e.size,className:`ok-blob-firework`,style:ub(e)},e.id)}function pb(e){return e.preventDefault()}function mb(e){return e+1}function hb(e){return e+1}function gb(e){let t=(0,$.c)(12),{title:n,subtitle:r,celebrateSignal:i}=e,a;t[0]===i?a=t[1]:(a=(0,Z.jsx)(db,{size:64,celebrateSignal:i}),t[0]=i,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,Z.jsx)(`h2`,{className:`text-2xl font-light tracking-tighter text-balance`,children:n}),t[2]=n,t[3]=o);let s;t[4]===r?s=t[5]:(s=r?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r}):null,t[4]=r,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;return t[9]!==a||t[10]!==c?(l=(0,Z.jsxs)(`div`,{className:`flex items-center gap-4`,children:[a,c]}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}function _b(e){let t=(0,$.c)(8),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=Ei(`pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm bg-muted px-1 font-sans text-xs font-medium text-muted-foreground select-none in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background dark:in-data-[slot=tooltip-content]:bg-background/10 [&_svg:not([class*='size-'])]:size-3`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`kbd`,{"data-slot":`kbd`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function vb(){let e=(0,$.c)(2),t=zr()?`⌘ K`:`Ctrl K`,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(_b,{children:t}),e[0]=n):n=e[0];let r;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(`p`,{className:`text-1sm text-muted-foreground`,children:[n,` `,(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`A1taO8`})})]}),e[1]=r):r=e[1],r}var yb=`open-knowledge:create-top-level-file`;function bb(){window.dispatchEvent(new CustomEvent(yb))}function xb(e){let t=()=>e();return window.addEventListener(yb,t),()=>window.removeEventListener(yb,t)}function Sb(){let e=(0,$.c)(14),[t,n]=(0,Q.useState)(!1),[r,i]=(0,Q.useState)(void 0),[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(0),l=(0,Q.useRef)(!1),u=(0,Q.useRef)(void 0),d,f;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>{let e=!1,t=async function(){try{let t=await fetch(`/api/documents`),n=await t.json().catch(Eb);if(e)return;let r=t.ok?mr.safeParse(n):null;r?.success?(o(Db(r.data.documents)),l.current=!0):l.current||=(o(1),!0)}catch{!e&&!l.current&&(o(1),l.current=!0)}};t();let n=yi(e=>{e.includes(`files`)&&t()});return()=>{e=!0,n(),clearTimeout(u.current)}},f=[],e[0]=d,e[1]=f):(d=e[0],f=e[1]),(0,Q.useEffect)(d,f);let p;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=function(){clearTimeout(u.current),u.current=setTimeout(()=>c(Tb),500),fetch(`/api/documents`).then(async e=>{let t=await e.json().catch(wb);if(!e.ok)return;let n=mr.safeParse(t);n.success&&o(Db(n.data.documents))}).catch(Cb)},e[2]=p):p=e[2];let m=p,h=a!==null,g=a===0,_;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(_=function(e){n(e),e||i(void 0)},e[3]=_):_=e[3];let v=_,y;e[4]!==s||e[5]!==g||e[6]!==h?(y=h?g?(0,Z.jsx)(Ob,{celebrateSignal:s,onPackSelect:e=>{i(e),n(!0)}}):(0,Z.jsx)(kb,{celebrateSignal:s,onAddStarterPack:()=>{n(!0)}}):null,e[4]=s,e[5]=g,e[6]=h,e[7]=y):y=e[7];let b;e[8]!==r||e[9]!==t?(b=(0,Z.jsx)(hm,{open:t,onOpenChange:v,onSeedApplied:m,initialPackId:r}),e[8]=r,e[9]=t,e[10]=b):b=e[10];let x;return e[11]!==y||e[12]!==b?(x=(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center overflow-y-auto px-6 sm:px-12 md:px-16 subtle-scrollbar`,children:[y,b]}),e[11]=y,e[12]=b,e[13]=x):x=e[13],x}function Cb(){}function wb(){return null}function Tb(e){return e+1}function Eb(){return null}function Db(e){return Rn(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}function Ob(e){let t=(0,$.c)(16),{celebrateSignal:n,onPackSelect:r}=e,{_:a}=i(),o;t[0]===a?o=t[1]:(o=a({id:`ZmGmNh`}),t[0]=a,t[1]=o);let c;t[2]===a?c=t[3]:(c=a({id:`W8uemY`}),t[2]=a,t[3]=c);let l;t[4]!==n||t[5]!==o||t[6]!==c?(l=(0,Z.jsx)(gb,{title:o,subtitle:c,celebrateSignal:n}),t[4]=n,t[5]=o,t[6]=c,t[7]=l):l=t[7];let u;t[8]===r?u=t[9]:(u=(0,Z.jsx)(cm,{onPackSelect:r}),t[8]=r,t[9]=u);let d;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Ni,{variant:`link`,className:`text-muted-foreground font-normal justify-end`,size:`sm`,onClick:bb,children:(0,Z.jsx)(s,{id:`ensWZc`,components:{0:(0,Z.jsx)(La,{"aria-hidden":`true`,className:`size-3`})}})}),t[10]=d):d=t[10];let f;t[11]===u?f=t[12]:(f=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-3`,children:[u,d]}),t[11]=u,t[12]=f);let p;return t[13]!==l||t[14]!==f?(p=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,children:[l,f]}),t[13]=l,t[14]=f,t[15]=p):p=t[15],p}function kb(e){let t=(0,$.c)(19),{celebrateSignal:n,onAddStarterPack:r}=e,{_:a}=i(),o;t[0]===a?o=t[1]:(o=a({id:`8XS8nG`}),t[0]=a,t[1]=o);let c;t[2]===a?c=t[3]:(c=a({id:`GjElCU`}),t[2]=a,t[3]=c);let l;t[4]!==n||t[5]!==o||t[6]!==c?(l=(0,Z.jsx)(gb,{title:o,subtitle:c,celebrateSignal:n}),t[4]=n,t[5]=o,t[6]=c,t[7]=l):l=t[7];let u;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(By,{}),t[8]=u):u=t[8];let d,f;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(P,{"aria-hidden":`true`,className:`size-3`}),f=(0,Z.jsx)(s,{id:`IajAbS`}),t[9]=d,t[10]=f):(d=t[9],f=t[10]);let p;t[11]===r?p=t[12]:(p=(0,Z.jsxs)(Ni,{onClick:r,variant:`link`,size:`xs`,className:`font-mono text-xs uppercase tracking-wider text-muted-foreground font-normal hover:text-foreground hover:no-underline`,children:[d,f]}),t[11]=r,t[12]=p);let m;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(vb,{}),t[13]=m):m=t[13];let h;t[14]===p?h=t[15]:(h=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[u,(0,Z.jsxs)(`div`,{className:`flex w-full items-center justify-between gap-4`,children:[p,m]})]}),t[14]=p,t[15]=h);let g;return t[16]!==l||t[17]!==h?(g=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,children:[l,h]}),t[16]=l,t[17]=h,t[18]=g):g=t[18],g}function Ab(e){return e===``?`.ok/frontmatter.yml`:`${e}/.ok/frontmatter.yml`}function jb(e){let t=(0,$.c)(76),{folderPath:n,state:r,onChange:a}=e,{_:o}=i(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(null);if(r.status===`idle`||r.status===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card p-4 space-y-3`,children:[(0,Z.jsx)(Nb,{}),(0,Z.jsx)(eo,{className:`h-7 w-full`}),(0,Z.jsx)(eo,{className:`h-7 w-full`}),(0,Z.jsx)(eo,{className:`h-7 w-full`})]}),t[0]=e):e=t[0],e}if(r.status===`error`){let{message:e}=r,n;return t[1]===e?n=t[2]:(n=(0,Z.jsx)(`section`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-4 text-sm text-destructive`,role:`alert`,children:(0,Z.jsx)(s,{id:`4UMKtb`,values:{message:e}})}),t[1]=e,t[2]=n),n}let m;t[3]===r.data.folder.frontmatter_defaults?m=t[4]:(m=r.data.folder.frontmatter_defaults??{},t[3]=r.data.folder.frontmatter_defaults,t[4]=m);let h=m,g;t[5]===r.data.frontmatterLocal?g=t[6]:(g=r.data.frontmatterLocal??{},t[5]=r.data.frontmatterLocal,t[6]=g);let _=g,v=r.data.frontmatterSources,y;t[7]===r.data.folder.path?y=t[8]:(y=Ab(r.data.folder.path),t[7]=r.data.folder.path,t[8]=y);let b=y,x,S,C,w,T,E,D,O,k,A,j,M,N;if(t[9]!==o||t[10]!==u||t[11]!==c||t[12]!==b||t[13]!==n||t[14]!==_||t[15]!==h||t[16]!==a||t[17]!==f||t[18]!==v){let e=Object.keys(h),r=async function(e,t){let r=await ta(n,{[e]:t});if(!r.ok){let{error:e}=r;$o.error(o({id:`xXo8FT`,values:{error:e}}));return}a()},i=async function(e){let t=await ta(n,{[e]:null});if(!t.ok){let{error:e}=t;$o.error(o({id:`ZU8VV_`,values:{error:e}}));return}a()},m=function(e,t){let n=h[e];r(e,Sa(n,t))},g;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(g=function(){d({name:``,type:`text`,value:``,error:null}),l(!1)},t[32]=g):g=t[32],C=g;let y;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(y=function(e){d(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):ra[e];return{...t,type:e,value:n,error:null}})},t[33]=y):y=t[33],T=y;let P;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(P=function(e){d(t=>t&&{...t,value:e})},t[34]=P):P=t[34],E=P;let F;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(F=function(e){d(t=>t&&{...t,name:e,error:null})},t[35]=F):F=t[35],w=F;let I;t[36]!==o||t[37]!==u||t[38]!==n||t[39]!==h||t[40]!==a?(I=async function(){if(!u)return;let e=u.name.trim();if(!e){d({...u,error:o({id:`8_brI5`})});return}if(Object.hasOwn(h,e)){d({...u,error:o({id:`6lBXm5`,values:{trimmed:e}})});return}let t=await ta(n,{[e]:u.value});if(!t.ok){d({...u,error:t.error});return}d(null),a()},t[36]=o,t[37]=u,t[38]=n,t[39]=h,t[40]=a,t[41]=I):I=t[41],D=I;let L=function(e){p({key:e,draft:e,error:null})},R=function(e){p(t=>t&&{...t,draft:e,error:null})},z=async function(){if(!f)return;let e=f.draft.trim();if(!e){p({...f,error:o({id:`8_brI5`})});return}if(e===f.key){p(null);return}if(Object.hasOwn(h,e)){p({...f,error:o({id:`6lBXm5`,values:{trimmed:e}})});return}let t=h[f.key],r=await ta(n,{[f.key]:null,[e]:t});if(!r.ok){p({...f,error:r.error});return}p(null),a()},B=function(){p(null)};N=`rounded-lg border bg-card`,S=is,A=!c,t[42]===Symbol.for(`react.memo_cache_sentinel`)?(j=e=>l(!e),t[42]=j):j=t[42];let V=`size-3 transition-transform ${c?``:`rotate-90`}`,H;t[43]===V?H=t[44]:(H=(0,Z.jsx)(es,{className:V,"aria-hidden":!0}),t[43]=V,t[44]=H);let U;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`IX_qeH`})}),t[45]=U):U=t[45];let W;t[46]===H?W=t[47]:(W=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:[H,U]}),t[46]=H,t[47]=W);let G;t[48]===b?G=t[49]:(G=(0,Z.jsx)(`code`,{className:`text-xs text-muted-foreground font-mono cursor-text select-text`,onClick:Mb,children:b}),t[48]=b,t[49]=G),t[50]!==W||t[51]!==G?(M=(0,Z.jsxs)(rs,{className:`flex w-full cursor-pointer items-center justify-between gap-2 px-3 py-2.5 data-[state=open]:border-b border-border`,children:[W,G]}),t[50]=W,t[51]=G,t[52]=M):M=t[52],x=ns,O=`px-2 py-2`,k=e.length===0&&!u?(0,Z.jsx)(`p`,{className:`px-1 py-1 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`50Y3WA`})}):e.map(e=>{let t=h[e],n=Object.hasOwn(_,e);return(0,Z.jsx)(ja,{keyName:e,value:t,declared:io(t,pi(t)),rename:n?{state:f?.key===e?f:null,onBegin:()=>L(e),onChangeDraft:R,onCommit:z,onCancel:B}:void 0,badge:n?null:(0,Z.jsx)(aa,{source:v[e]??``}),isInherited:!n,onCommit:t=>void r(e,t),onChangeType:t=>m(e,t),onRemove:n?()=>void i(e):void 0},e)}),t[9]=o,t[10]=u,t[11]=c,t[12]=b,t[13]=n,t[14]=_,t[15]=h,t[16]=a,t[17]=f,t[18]=v,t[19]=x,t[20]=S,t[21]=C,t[22]=w,t[23]=T,t[24]=E,t[25]=D,t[26]=O,t[27]=k,t[28]=A,t[29]=j,t[30]=M,t[31]=N}else x=t[19],S=t[20],C=t[21],w=t[22],T=t[23],E=t[24],D=t[25],O=t[26],k=t[27],A=t[28],j=t[29],M=t[30],N=t[31];let F;t[53]!==u||t[54]!==C||t[55]!==w||t[56]!==T||t[57]!==E||t[58]!==D?(F=u?(0,Z.jsx)(To,{draft:u,onChangeName:w,onChangeType:T,onChangeValue:E,onCommit:()=>void D(),onCancel:()=>d(null)}):(0,Z.jsxs)(Ni,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:C,className:`mt-1 flex items-center gap-1.5 rounded px-2 py-1 font-medium text-sm hover:bg-muted/50 hover:text-foreground`,children:[(0,Z.jsx)(P,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`F-NRCj`})})]}),t[53]=u,t[54]=C,t[55]=w,t[56]=T,t[57]=E,t[58]=D,t[59]=F):F=t[59];let I;t[60]!==F||t[61]!==O||t[62]!==k?(I=(0,Z.jsxs)(`div`,{className:O,children:[k,F]}),t[60]=F,t[61]=O,t[62]=k,t[63]=I):I=t[63];let L;t[64]!==x||t[65]!==I?(L=(0,Z.jsx)(x,{children:I}),t[64]=x,t[65]=I,t[66]=L):L=t[66];let R;t[67]!==S||t[68]!==L||t[69]!==A||t[70]!==j||t[71]!==M?(R=(0,Z.jsxs)(S,{open:A,onOpenChange:j,children:[M,L]}),t[67]=S,t[68]=L,t[69]=A,t[70]=j,t[71]=M,t[72]=R):R=t[72];let z;return t[73]!==R||t[74]!==N?(z=(0,Z.jsx)(`section`,{className:N,children:R}),t[73]=R,t[74]=N,t[75]=z):z=t[75],z}function Mb(e){return e.stopPropagation()}function Nb(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Tc,{className:`size-4 text-muted-foreground`,"aria-hidden":!0}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t,(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(s,{id:`IX_qeH`})})]}),e[1]=n):n=e[1],n}function Pb(e){let t=e.split(`/`).pop();return t?`${e}/${t}`:null}function Fb(e,t){let n=t.get(`${e}/index`);if(n)return n;let r=Pb(e);if(r){let e=t.get(r);if(e)return e}return e.split(`/`).pop()??e}function Ib(e,t,n){let r=n.get(e);return r&&r!==e?r:t}function Lb(e,t){let n=`${e}/`,r=[...t.folderPaths].filter(e=>e.startsWith(n)).map(e=>({path:e,rel:e.slice(n.length)})).filter(e=>e.rel.length>0&&!e.rel.includes(`/`)).map(({path:e,rel:n})=>({kind:`folder`,path:e,name:n,title:Fb(e,t.pageTitles)})),i=[...t.pages].filter(e=>e.startsWith(n)).map(e=>({docName:e,rel:e.slice(n.length)})).filter(e=>e.rel.length>0&&!e.rel.includes(`/`)).map(({docName:e,rel:n})=>{let r=t.pageMeta.get(e);return{kind:`file`,path:e,name:n,title:Ib(e,n,t.pageTitles),size:r?.size??0,modified:r?.modified??``}}),a=[...r,...i].sort((e,t)=>e.kind===t.kind?e.title.localeCompare(t.title)||e.name.localeCompare(t.name):e.kind===`folder`?-1:1);return{title:Fb(e,t.pageTitles),children:a}}function Rb(e){let t=(0,$.c)(44),{folderPath:n,state:r,onChange:i,folderConfigHandle:a}=e,[o,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(!1);if(r.status===`idle`||r.status===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card px-3 py-2.5 space-y-3`,children:[(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(s,{id:`-QCLWk`})})}),(0,Z.jsx)(eo,{className:`h-12 w-full`}),(0,Z.jsx)(eo,{className:`h-12 w-full`})]}),t[0]=e):e=t[0],e}if(r.status===`error`){let{message:e}=r,n;return t[1]===e?n=t[2]:(n=(0,Z.jsx)(`section`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-4 text-sm text-destructive`,role:`alert`,children:(0,Z.jsx)(s,{id:`iDZtvM`,values:{message:e}})}),t[1]=e,t[2]=n),n}let h;t[3]===r.data.folder.templates_available?h=t[4]:(h=r.data.folder.templates_available??[],t[3]=r.data.folder.templates_available,t[4]=h);let g=h,_;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(s,{id:`-QCLWk`})}),t[5]=_):_=t[5];let v;t[6]===g.length?v=t[7]:(v=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[_,(0,Z.jsx)(x,{className:`text-xs`,variant:`secondary`,children:g.length})]}),t[6]=g.length,t[7]=v);let y;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsxs)(Ni,{variant:`ghost`,className:`font-mono uppercase`,size:`sm`,onClick:()=>m(!0),children:[(0,Z.jsx)(P,{className:`size-3.5`,"aria-hidden":!0}),(0,Z.jsx)(s,{id:`G1Gw0v`})]}),t[8]=y):y=t[8];let b;t[9]===v?b=t[10]:(b=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border px-3 py-1`,children:[v,y]}),t[9]=v,t[10]=b);let S;t[11]===g?S=t[12]:(S=(0,Z.jsx)(`div`,{className:`px-3 py-2.5`,children:g.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`BHW0EW`})}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:g.map(e=>(0,Z.jsx)(Co,{template:e,onCreate:()=>f(e.name),onEdit:()=>c(e),onDelete:()=>u(e),badge:e.scope===`inherited`?(0,Z.jsx)(aa,{source:e.source_folder,target:`templates/${e.name}.md`}):void 0},e.path))})}),t[11]=g,t[12]=S);let C;t[13]!==b||t[14]!==S?(C=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card`,children:[b,S]}),t[13]=b,t[14]=S,t[15]=C):C=t[15];let w;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(w=e=>{e||c(null)},t[16]=w):w=t[16];let T;t[17]!==o||t[18]!==n||t[19]!==i?(T=(0,Z.jsx)(ko,{folderPath:n,template:o,onOpenChange:w,onSaved:i}),t[17]=o,t[18]=n,t[19]=i,t[20]=T):T=t[20];let E;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>{e||u(null)},t[21]=E):E=t[21];let D;t[22]!==l||t[23]!==i?(D=(0,Z.jsx)(Ga,{template:l,onOpenChange:E,onDeleted:i}),t[22]=l,t[23]=i,t[24]=D):D=t[24];let O;t[25]===g?O=t[26]:(O=new Set(g.map(zb)),t[25]=g,t[26]=O);let k;t[27]!==n||t[28]!==p||t[29]!==i||t[30]!==O?(k=(0,Z.jsx)(ka,{folderPath:n,existingNames:O,open:p,onOpenChange:m,onCreated:i}),t[27]=n,t[28]=p,t[29]=i,t[30]=O,t[31]=k):k=t[31];let A=d!==null,j;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(j=e=>{e||f(null)},t[32]=j):j=t[32];let M=d??void 0,N;t[33]!==a||t[34]!==n||t[35]!==A||t[36]!==M?(N=(0,Z.jsx)(Gp,{open:A,onOpenChange:j,kind:`file`,initialDir:n,initialTemplate:M,folderConfig:a}),t[33]=a,t[34]=n,t[35]=A,t[36]=M,t[37]=N):N=t[37];let F;return t[38]!==D||t[39]!==k||t[40]!==N||t[41]!==C||t[42]!==T?(F=(0,Z.jsxs)(Z.Fragment,{children:[C,T,D,k,N]}),t[38]=D,t[39]=k,t[40]=N,t[41]=C,t[42]=T,t[43]=F):F=t[43],F}function zb(e){return e.name}function Bb(e){let t=(0,$.c)(14),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,containerClassName:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=Ei(`relative w-full overflow-x-auto subtle-scrollbar`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=Ei(`w-full caption-bottom text-sm`,n),t[6]=n,t[7]=o);let s;t[8]!==i||t[9]!==o?(s=(0,Z.jsx)(`table`,{"data-slot":`table`,className:o,...i}),t[8]=i,t[9]=o,t[10]=s):s=t[10];let c;return t[11]!==a||t[12]!==s?(c=(0,Z.jsx)(`div`,{"data-slot":`table-container`,className:a,children:s}),t[11]=a,t[12]=s,t[13]=c):c=t[13],c}function Vb(e){let t=(0,$.c)(8),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=Ei(`[&_tr]:border-b`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`thead`,{"data-slot":`table-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Hb(e){let t=(0,$.c)(8),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=Ei(`[&_tr:last-child]:border-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`tbody`,{"data-slot":`table-body`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ub(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,noHover:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=(i===void 0?!1:i)&&`hover:bg-transparent`,o;t[4]!==n||t[5]!==a?(o=Ei(`hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors`,a,n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(`tr`,{"data-slot":`table-row`,className:o,...r}),t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function Wb(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,scope:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`col`:i,o;t[4]===n?o=t[5]:(o=Ei(`font-mono uppercase text-xs text-muted-foreground h-10 px-4 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,n),t[4]=n,t[5]=o);let s;return t[6]!==r||t[7]!==a||t[8]!==o?(s=(0,Z.jsx)(`th`,{"data-slot":`table-head`,scope:a,className:o,...r}),t[6]=r,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function Gb(e){let t=(0,$.c)(8),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=Ei(`py-3 px-4 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`td`,{"data-slot":`table-cell`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Kb(e){if(!e)return`—`;let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return X._({id:`xOTzt5`});if(r<60)return X._({id:`NRSLBe`,values:{diffMin:r}});let i=Math.floor(r/60);if(i<24)return X._({id:`hDKtoF`,values:{diffHrs:i}});let a=Math.floor(i/24);return a<30?X._({id:`QDZbvN`,values:{diffDays:a}}):t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function qb(e,t,n){return[...e].sort((e,r)=>{if(e.kind!==r.kind)return e.kind===`folder`?-1:1;let i=0;switch(t){case`name`:i=e.title.localeCompare(r.title)||e.name.localeCompare(r.name);break;case`modified`:{let t=e.kind===`file`?e.modified:``,n=r.kind===`file`?r.modified:``;i=t.localeCompare(n);break}}return n===`asc`?i:-i})}function Jb(e){let t=(0,$.c)(10),{label:n,sortKey:r,activeKey:i,activeDir:a,onSort:o}=e,s=i===r,c;t[0]!==o||t[1]!==r?(c=()=>o(r),t[0]=o,t[1]=r,t[2]=c):c=t[2];let l;t[3]!==a||t[4]!==s?(l=s?a===`asc`?(0,Z.jsx)(qe,{className:`ml-1 size-3`}):(0,Z.jsx)(bt,{className:`ml-1 size-3`}):(0,Z.jsx)(ec,{className:`ml-1 size-3 text-muted-foreground/50`}),t[3]=a,t[4]=s,t[5]=l):l=t[5];let u;return t[6]!==n||t[7]!==c||t[8]!==l?(u=(0,Z.jsxs)(Ni,{variant:`ghost`,size:`sm`,className:`-ml-3 h-8 uppercase font-mono`,onClick:c,children:[n,l]}),t[6]=n,t[7]=c,t[8]=l,t[9]=u):u=t[9],u}function Yb(e){let t=(0,$.c)(92),{folderPath:n}=e,{_:r}=i(),{folderPaths:a,loading:o,pages:c,pageTitles:l,pageMeta:u}=gi(),d=co(n),{state:f,refresh:p}=d,[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(`name`),[v,y]=(0,Q.useState)(`asc`);if(o){let e;t[0]===r?e=t[1]:(e=r({id:`X9VpsP`}),t[0]=r,t[1]=e);let n;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(eo,{className:`size-5 rounded`}),(0,Z.jsx)(eo,{className:`h-7 w-48`})]}),(0,Z.jsx)(eo,{className:`h-9 w-20 rounded-md`})]}),t[2]=n):n=t[2];let i;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(eo,{className:`h-4 w-16`}),t[3]=i):i=t[3];let a;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(`div`,{className:`mx-auto flex w-full max-w-4xl flex-col gap-6 px-6 py-8`,children:[n,(0,Z.jsxs)(`div`,{className:`rounded-lg border`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-4 border-b px-4 py-3`,children:[i,(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(eo,{className:`h-4 w-20`})})]}),[`a`,`b`,`c`,`d`].map(Qb)]})]}),t[4]=a):a=t[4];let o;return t[5]===e?o=t[6]:(o=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-start overflow-y-auto subtle-scrollbar`,role:`status`,"aria-busy":`true`,"aria-label":e,children:a}),t[5]=e,t[6]=o),o}let b,x,S,C,w,T,E,D,O,k;if(t[7]!==r||t[8]!==f||t[9]!==d||t[10]!==n||t[11]!==a||t[12]!==u||t[13]!==l||t[14]!==c||t[15]!==p||t[16]!==v||t[17]!==g){let e=Lb(n,{pages:c,pageTitles:l,pageMeta:u,folderPaths:a}),i=qb(e.children,g,v),o;t[28]===g?o=t[29]:(o=function(e){e===g?y(Zb):(_(e),y(`asc`))},t[28]=g,t[29]=o);let m=o;k=`flex min-h-0 flex-1 items-start overflow-y-auto subtle-scrollbar`,T=`mx-auto flex w-full max-w-4xl flex-col gap-6 px-6 py-8`;let A;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(se,{className:`size-5 text-muted-foreground`}),t[30]=A):A=t[30];let j=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[A,(0,Z.jsx)(`h1`,{className:`text-2xl font-light tracking-tight`,children:e.title})]}),M;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsxs)(Ni,{onClick:()=>h(!0),children:[(0,Z.jsx)(P,{className:`size-4`}),(0,Z.jsx)(s,{id:`isRobC`})]}),t[31]=M):M=t[31],t[32]===j?E=t[33]:(E=(0,Z.jsx)(`div`,{className:`flex flex-col gap-6`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[j,M]})}),t[32]=j,t[33]=E),t[34]!==f||t[35]!==n||t[36]!==p?(D=(0,Z.jsx)(jb,{folderPath:n,state:f,onChange:p}),t[34]=f,t[35]=n,t[36]=p,t[37]=D):D=t[37],t[38]!==f||t[39]!==d||t[40]!==n||t[41]!==p?(O=(0,Z.jsx)(Rb,{folderPath:n,state:f,onChange:p,folderConfigHandle:d}),t[38]=f,t[39]=d,t[40]=n,t[41]=p,t[42]=O):O=t[42],w=`rounded-lg border`,x=Bb;let N=g===`name`?v===`asc`?`ascending`:`descending`:`none`,F;t[43]===r?F=t[44]:(F=r({id:`6YtxFj`}),t[43]=r,t[44]=F);let I;t[45]!==m||t[46]!==v||t[47]!==g||t[48]!==F?(I=(0,Z.jsx)(Jb,{label:F,sortKey:`name`,activeKey:g,activeDir:v,onSort:m}),t[45]=m,t[46]=v,t[47]=g,t[48]=F,t[49]=I):I=t[49];let L;t[50]!==N||t[51]!==I?(L=(0,Z.jsx)(Wb,{"aria-sort":N,children:I}),t[50]=N,t[51]=I,t[52]=L):L=t[52];let R=g===`modified`?v===`asc`?`ascending`:`descending`:`none`,z;t[53]===r?z=t[54]:(z=r({id:`tgWuMB`}),t[53]=r,t[54]=z);let B;t[55]!==m||t[56]!==v||t[57]!==g||t[58]!==z?(B=(0,Z.jsx)(Jb,{label:z,sortKey:`modified`,activeKey:g,activeDir:v,onSort:m}),t[55]=m,t[56]=v,t[57]=g,t[58]=z,t[59]=B):B=t[59];let V;t[60]!==R||t[61]!==B?(V=(0,Z.jsx)(Wb,{className:`w-32`,"aria-sort":R,children:B}),t[60]=R,t[61]=B,t[62]=V):V=t[62],t[63]!==L||t[64]!==V?(C=(0,Z.jsx)(Vb,{children:(0,Z.jsxs)(Ub,{children:[L,V]})}),t[63]=L,t[64]=V,t[65]=C):C=t[65],b=Hb,S=i.length?i.map(Xb):(0,Z.jsx)(Ub,{children:(0,Z.jsx)(Gb,{colSpan:2,className:`h-24 text-center text-muted-foreground`,children:(0,Z.jsx)(s,{id:`Pkw7J9`})})}),t[7]=r,t[8]=f,t[9]=d,t[10]=n,t[11]=a,t[12]=u,t[13]=l,t[14]=c,t[15]=p,t[16]=v,t[17]=g,t[18]=b,t[19]=x,t[20]=S,t[21]=C,t[22]=w,t[23]=T,t[24]=E,t[25]=D,t[26]=O,t[27]=k}else 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=t[26],k=t[27];let A;t[66]!==b||t[67]!==S?(A=(0,Z.jsx)(b,{children:S}),t[66]=b,t[67]=S,t[68]=A):A=t[68];let j;t[69]!==x||t[70]!==C||t[71]!==A?(j=(0,Z.jsxs)(x,{children:[C,A]}),t[69]=x,t[70]=C,t[71]=A,t[72]=j):j=t[72];let M;t[73]!==j||t[74]!==w?(M=(0,Z.jsx)(`div`,{className:w,children:j}),t[73]=j,t[74]=w,t[75]=M):M=t[75];let N;t[76]!==M||t[77]!==T||t[78]!==E||t[79]!==D||t[80]!==O?(N=(0,Z.jsxs)(`div`,{className:T,children:[E,D,O,M]}),t[76]=M,t[77]=T,t[78]=E,t[79]=D,t[80]=O,t[81]=N):N=t[81];let F;t[82]!==N||t[83]!==k?(F=(0,Z.jsx)(`div`,{className:k,children:N}),t[82]=N,t[83]=k,t[84]=F):F=t[84];let I;t[85]!==m||t[86]!==d||t[87]!==n?(I=(0,Z.jsx)(Gp,{open:m,onOpenChange:h,kind:`file`,initialDir:n,folderConfig:d,suggestedName:`index`}),t[85]=m,t[86]=d,t[87]=n,t[88]=I):I=t[88];let L;return t[89]!==F||t[90]!==I?(L=(0,Z.jsxs)(Z.Fragment,{children:[F,I]}),t[89]=F,t[90]=I,t[91]=L):L=t[91],L}function Xb(e){return(0,Z.jsxs)(Ub,{children:[(0,Z.jsx)(Gb,{children:(0,Z.jsxs)(`a`,{href:di(e.path),className:`flex items-center gap-2 rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[e.kind===`folder`?(0,Z.jsx)(Dc,{className:`size-4 shrink-0 text-muted-foreground`}):(0,Z.jsx)(u,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.title})]})}),(0,Z.jsx)(Gb,{className:`text-muted-foreground`,children:e.kind===`file`?Kb(e.modified):`—`})]},e.path)}function Zb(e){return e===`asc`?`desc`:`asc`}function Qb(e){return(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 border-b px-4 py-3 last:border-b-0`,children:[(0,Z.jsx)(eo,{className:`size-4 rounded`}),(0,Z.jsx)(eo,{className:`h-4 w-40`}),(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(eo,{className:`h-4 w-16`})})]},e)}function $b(e){let t=(0,$.c)(24),{docName:n,size:r,limit:i,backNav:a}=e,o=a!==void 0,c=(0,Q.useRef)(null),l=(0,Q.useRef)(null),u,d;t[0]===o?(u=t[1],d=t[2]):(u=()=>{o?c.current?.focus():l.current?.focus()},d=[o],t[0]=o,t[1]=u,t[2]=d),(0,Q.useEffect)(u,d);let f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(`div`,{className:`flex size-16 items-center justify-center rounded-full border bg-muted/40 text-muted-foreground`,children:(0,Z.jsx)(xc,{className:`size-9`,"aria-hidden":`true`})}),t[3]=f):f=t[3];let p=o?void 0:-1,m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(s,{id:`P3hnm0`}),t[4]=m):m=t[4];let h;t[5]===p?h=t[6]:(h=(0,Z.jsx)(`h2`,{ref:l,id:`large-file-title`,tabIndex:p,className:`text-2xl font-light text-balance outline-none`,children:m}),t[5]=p,t[6]=h);let g;t[7]===r?g=t[8]:(g=_r(r),t[7]=r,t[8]=g);let _;t[9]===i?_=t[10]:(_=_r(i),t[9]=i,t[10]=_);let v;t[11]!==n||t[12]!==g||t[13]!==_?(v=(0,Z.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`_GBioJ`,values:{0:g,1:_,docName:n}})}),t[11]=n,t[12]=g,t[13]=_,t[14]=v):v=t[14];let y;t[15]!==h||t[16]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[h,v]}),t[15]=h,t[16]=v,t[17]=y):y=t[17];let b;t[18]!==a||t[19]!==o?(b=o?(0,Z.jsxs)(Ni,{ref:c,variant:`default`,onClick:()=>a.onNavigateBack(a.previousDocName),children:[(0,Z.jsx)(Hi,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`CKyk7Q`})]}):null,t[18]=a,t[19]=o,t[20]=b):b=t[20];let x;return t[21]!==y||t[22]!==b?(x=(0,Z.jsxs)(`div`,{role:`status`,"aria-labelledby":`large-file-title`,"data-slot":`large-file-editor-state`,className:`flex h-full flex-col items-center justify-center gap-8 p-8 text-center`,children:[f,y,b]}),t[21]=y,t[22]=b,t[23]=x):x=t[23],x}function ex(e){let t=(0,$.c)(8),{docName:n}=e,[r,i]=(0,Q.useState)(tx),a,o;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>p(e=>{i(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),n})}),o=[],t[0]=a,t[1]=o):(a=t[0],o=t[1]),(0,Q.useEffect)(a,o),!r.has(n))return null;let c;t[2]===n?c=t[3]:(c=function(){S(n)?.abort(),i(e=>{if(!e.has(n))return e;let t=new Set(e);return t.delete(n),t})},t[2]=n,t[3]=c);let l=c,u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`A67Uwj`})}),t[4]=u):u=t[4];let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(s,{id:`dEgA5A`}),t[5]=d):d=t[5];let f;return t[6]===l?f=t[7]:(f=(0,Z.jsxs)(`div`,{className:`absolute inset-x-0 bottom-8 z-20 flex justify-center text-xs text-muted-foreground`,children:[u,(0,Z.jsx)(Ni,{variant:`link`,size:`sm`,className:`h-auto px-2 py-0 text-xs`,onClick:l,children:d})]}),t[6]=l,t[7]=f),f}function tx(){return new Set}var nx=(0,Q.createContext)(null);function rx(e){let t=(0,$.c)(7),{children:n}=e,[r,i]=(0,Q.useState)(ix),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=e=>{i(t=>{let n=new Map(t);return n.set(e,(t.get(e)??0)+1),n})},t[0]=a):a=t[0];let o=a,s;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=e=>{i(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},t[1]=s):s=t[1];let c=s,l;t[2]===r?l=t[3]:(l={addPropertySignal:r,requestAddProperty:o,clearAddProperty:c},t[2]=r,t[3]=l);let u=l,d;return t[4]!==n||t[5]!==u?(d=(0,Z.jsx)(nx,{value:u,children:n}),t[4]=n,t[5]=u,t[6]=d):d=t[6],d}function ix(){return new Map}function ax(){let e=(0,Q.use)(nx);if(e===null)throw Error(`useProperties must be used within <PropertyProvider />`);return e}function ox(e){let t=null,n=()=>(t===null&&(t=e(),t.catch(()=>{})),t),r=(0,Q.lazy)(n);return r.preload=n,r}var sx=ox(()=>n(()=>import(`./SettingsDialogBody-BpLMuvP2.js`).then(e=>({default:e.SettingsDialogBody})),__vite__mapDeps([42,1,33,2,34,35,20,36,37,38,39,19,6,3,7,4,10,9,40,43,8,14,21,11]),import.meta.url));function cx(e){let t=(0,$.c)(9),{error:n}=e,{_:r}=i(),a;t[0]!==r||t[1]!==n?(a=n instanceof Error&&/dynamically imported module|Failed to fetch/i.test(n.message)?r({id:`Y8ViJx`}):r({id:`3h5zMp`}),t[0]=r,t[1]=n,t[2]=a):a=t[2];let o=a,c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`h3`,{id:`settings-body-error-title`,className:`font-heading text-base leading-none font-medium`,children:(0,Z.jsx)(s,{id:`hwFOFD`})}),t[3]=c):c=t[3];let l;t[4]===o?l=t[5]:(l=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[c,(0,Z.jsx)(`p`,{className:`max-w-xs text-sm text-muted-foreground`,children:o})]}),t[4]=o,t[5]=l);let u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(Ni,{variant:`default`,onClick:lx,children:(0,Z.jsx)(s,{id:`HpK_8d`})}),t[6]=u):u=t[6];let d;return t[7]===l?d=t[8]:(d=(0,Z.jsxs)(`div`,{role:`alert`,"aria-labelledby":`settings-body-error-title`,"data-slot":`settings-body-error-boundary`,className:`flex h-full flex-col items-center justify-center gap-5 p-8 text-center`,children:[l,u]}),t[7]=l,t[8]=d),d}function lx(){return window.location.reload()}function ux(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(m,{fallbackRender:fx,onError:dx,children:n}),t[0]=n,t[1]=r),r}function dx(e,t){console.error(`[SettingsDialogErrorBoundary] rendered fallback for Settings body`,e,t.componentStack)}function fx(e){return(0,Z.jsx)(cx,{...e})}function px(e){let t=(0,$.c)(71),{open:n,onOpenChange:r}=e,{_:a}=i(),{collabUrl:o}=ft(),{userBinding:c,userSynced:u,okignoreBinding:d,okignoreSynced:f}=l(),{desktopPresent:p}=Va(),[m,h]=(0,Q.useState)(`preferences`),g,_;t[0]===n?(g=t[1],_=t[2]):(g=()=>{n&&h(`preferences`)},_=[n],t[0]=n,t[1]=g,t[2]=_),(0,Q.useEffect)(g,_);let v=o!==null,y;t[3]===a?y=t[4]:(y=a({id:`7PzzBU`}),t[3]=a,t[4]=y);let b;t[5]===a?b=t[6]:(b=a({id:`Q6hhn8`}),t[5]=a,t[6]=b);let x;t[7]===b?x=t[8]:(x={id:`preferences`,label:b},t[7]=b,t[8]=x);let S;t[9]===a?S=t[10]:(S=a({id:`AeXO77`}),t[9]=a,t[10]=S);let C;t[11]===S?C=t[12]:(C={id:`account`,label:S},t[11]=S,t[12]=C);let w;t[13]!==x||t[14]!==C?(w=[x,C],t[13]=x,t[14]=C,t[15]=w):w=t[15];let T;t[16]!==y||t[17]!==w?(T={id:`user`,label:y,enabled:!0,items:w},t[16]=y,t[17]=w,t[18]=T):T=t[18];let E;t[19]===a?E=t[20]:(E=a({id:`ZWyHmq`}),t[19]=a,t[20]=E);let D;t[21]===a?D=t[22]:(D=a({id:`Nu4DdT`}),t[21]=a,t[22]=D);let O;t[23]===D?O=t[24]:(O={id:`sync`,label:D},t[23]=D,t[24]=O);let k;t[25]===a?k=t[26]:(k=a({id:`iTylMl`}),t[25]=a,t[26]=k);let A;t[27]===k?A=t[28]:(A={id:`project-templates`,label:k},t[27]=k,t[28]=A);let j;t[29]===a?j=t[30]:(j=a({id:`3zyg_A`}),t[29]=a,t[30]=j);let M;t[31]===j?M=t[32]:(M={id:`okignore`,label:j},t[31]=j,t[32]=M);let N;t[33]!==O||t[34]!==A||t[35]!==M?(N=[O,A,M],t[33]=O,t[34]=A,t[35]=M,t[36]=N):N=t[36];let P;t[37]!==v||t[38]!==E||t[39]!==N?(P={id:`project`,label:E,enabled:v,items:N},t[37]=v,t[38]=E,t[39]=N,t[40]=P):P=t[40];let F;t[41]===a?F=t[42]:(F=a({id:`nbfdhU`}),t[41]=a,t[42]=F);let I;t[43]!==a||t[44]!==p?(I=p?[{id:`claude-desktop`,label:a({id:`yvHDYG`})}]:[],t[43]=a,t[44]=p,t[45]=I):I=t[45];let L;t[46]!==F||t[47]!==I?(L={id:`integrations`,label:F,enabled:!0,items:I},t[46]=F,t[47]=I,t[48]=L):L=t[48];let R;t[49]!==P||t[50]!==L||t[51]!==T?(R=[T,P,L],t[49]=P,t[50]=L,t[51]=T,t[52]=R):R=t[52];let z=R,B;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(Vo,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`Tz0i8g`})}),t[53]=B):B=t[53];let V;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Z.jsx)(zo,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`RDrXh4`})}),t[54]=V):V=t[54];let H;t[55]!==m||t[56]!==z?(H=(0,Z.jsx)(mx,{groups:z,activeId:m,onSelect:h}),t[55]=m,t[56]=z,t[57]=H):H=t[57];let U;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(gx,{}),t[58]=U):U=t[58];let W=u?c:null,G;t[59]!==m||t[60]!==d||t[61]!==f||t[62]!==W?(G=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain subtle-scrollbar p-6`,children:(0,Z.jsx)(ux,{children:(0,Z.jsx)(Q.Suspense,{fallback:U,children:(0,Z.jsx)(sx,{activeId:m,userBinding:W,okignoreBinding:d,okignoreSynced:f})})})}),t[59]=m,t[60]=d,t[61]=f,t[62]=W,t[63]=G):G=t[63];let K;t[64]!==H||t[65]!==G?(K=(0,Z.jsxs)(Go,{className:`flex h-[700px] max-h-[calc(100dvh-4rem)] w-[900px] max-w-[calc(100%-2rem)] flex-col gap-0 overflow-hidden p-0 sm:grid sm:grid-cols-[220px_1fr] sm:max-w-[min(900px,calc(100%-2rem))]`,"data-testid":`settings-dialog`,children:[B,V,H,G]}),t[64]=H,t[65]=G,t[66]=K):K=t[66];let q;return t[67]!==r||t[68]!==n||t[69]!==K?(q=(0,Z.jsx)(Zo,{open:n,onOpenChange:r,children:K}),t[67]=r,t[68]=n,t[69]=K,t[70]=q):q=t[70],q}function mx(e){let t=(0,$.c)(12),{groups:n,activeId:r,onSelect:a}=e,{_:o}=i(),s;t[0]===o?s=t[1]:(s=o({id:`y1t8bQ`}),t[0]=o,t[1]=s);let c;if(t[2]!==r||t[3]!==n||t[4]!==a){let e;t[6]!==r||t[7]!==a?(e=e=>(0,Z.jsx)(hx,{group:e,activeId:r,onSelect:a},e.id),t[6]=r,t[7]=a,t[8]=e):e=t[8],c=n.map(e),t[2]=r,t[3]=n,t[4]=a,t[5]=c}else c=t[5];let l;return t[9]!==s||t[10]!==c?(l=(0,Z.jsx)(`nav`,{"aria-label":s,className:`flex shrink-0 gap-x-3 overflow-x-auto overscroll-contain subtle-scrollbar scroll-fade-mask-x-max-sm border-b bg-muted/30 px-3 py-2 max-sm:pt-10 sm:h-full sm:flex-col sm:gap-0 sm:overflow-x-visible sm:overflow-y-auto sm:border-r sm:border-b-0 sm:py-4`,children:c}),t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function hx(e){let t=(0,$.c)(28),{group:n,activeId:r,onSelect:i}=e;if(n.items.length===0)return null;let a=`settings-group-${n.id}`,o=`${a}-caption`,c=n.enabled?void 0:o,l=n.enabled?`text-muted-foreground/80`:`text-muted-foreground/50`,u;t[0]===l?u=t[1]:(u=Ei(`shrink-0 whitespace-nowrap px-2 text-xs font-semibold uppercase tracking-wide font-mono sm:mb-1`,l),t[0]=l,t[1]=u);let d;t[2]!==n.label||t[3]!==a||t[4]!==c||t[5]!==u?(d=(0,Z.jsx)(`h3`,{id:a,"aria-describedby":c,className:u,children:n.label}),t[2]=n.label,t[3]=a,t[4]=c,t[5]=u,t[6]=d):d=t[6];let f;t[7]!==o||t[8]!==n.enabled?(f=n.enabled?null:(0,Z.jsx)(`p`,{id:o,className:`px-2 text-xs italic text-muted-foreground/60 sm:mb-1`,children:(0,Z.jsx)(s,{id:`JWsZlx`})}),t[7]=o,t[8]=n.enabled,t[9]=f):f=t[9];let p;if(t[10]!==r||t[11]!==o||t[12]!==n.enabled||t[13]!==n.items||t[14]!==i){let e;t[16]!==r||t[17]!==o||t[18]!==n.enabled||t[19]!==i?(e=e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`button`,{type:`button`,"aria-current":r===e.id?`page`:void 0,"aria-disabled":n.enabled?void 0:!0,"aria-describedby":n.enabled?void 0:o,tabIndex:n.enabled?0:-1,disabled:!n.enabled,onClick:()=>n.enabled&&i(e.id),"data-testid":`settings-sidebar-item-${e.id}`,className:Ei(`w-auto whitespace-nowrap rounded px-2 py-1.5 text-left text-sm transition-colors sm:w-full`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,`disabled:cursor-not-allowed disabled:opacity-50`,r===e.id&&n.enabled?`bg-accent text-accent-foreground`:`hover:bg-accent/50`),children:e.label})},e.id),t[16]=r,t[17]=o,t[18]=n.enabled,t[19]=i,t[20]=e):e=t[20],p=n.items.map(e),t[10]=r,t[11]=o,t[12]=n.enabled,t[13]=n.items,t[14]=i,t[15]=p}else p=t[15];let m;t[21]!==a||t[22]!==p?(m=(0,Z.jsx)(`ul`,{"aria-labelledby":a,className:`flex gap-1 sm:block sm:space-y-0.5`,children:p}),t[21]=a,t[22]=p,t[23]=m):m=t[23];let h;return t[24]!==d||t[25]!==f||t[26]!==m?(h=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 sm:mb-4 sm:block`,children:[d,f,m]}),t[24]=d,t[25]=f,t[26]=m,t[27]=h):h=t[27],h}function gx(){let e=(0,$.c)(4),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`GsBUCk`})}),n=(0,Z.jsx)(eo,{className:`h-5 w-32`}),r=(0,Z.jsx)(eo,{className:`h-4 w-64`}),e[0]=t,e[1]=n,e[2]=r):(t=e[0],n=e[1],r=e[2]);let i;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"aria-busy":`true`,className:`space-y-3`,"data-testid":`settings-content-skeleton`,children:[t,n,r,(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(eo,{className:`h-9 w-full`}),(0,Z.jsx)(eo,{className:`h-9 w-full`})]})]}),e[3]=i):i=e[3],i}function _x(e){let t=(0,$.c)(8),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=Ei(`flex h-full w-full aria-[orientation=vertical]:flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(dy,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function vx(e){let t=(0,$.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,Z.jsx)(my,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function yx(e){let t=(0,$.c)(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({withHandle:i,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=Ei(`relative flex w-px items-center justify-center bg-border ring-offset-background after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90`,n),t[4]=n,t[5]=a);let o;t[6]===i?o=t[7]:(o=i&&(0,Z.jsx)(`div`,{className:`z-10 flex h-6 w-1 shrink-0 rounded-lg bg-border`}),t[6]=i,t[7]=o);let s;return t[8]!==r||t[9]!==a||t[10]!==o?(s=(0,Z.jsx)(vy,{"data-slot":`resizable-handle`,className:a,...r,children:o}),t[8]=r,t[9]=a,t[10]=o,t[11]=s):s=t[11],s}function bx(e){let t=(0,$.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,Z.jsx)(Ko,{"data-slot":`sheet`,...n}),t[2]=n,t[3]=r),r}function xx(e){let t=(0,$.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,Z.jsx)(Yo,{"data-slot":`sheet-portal`,...n}),t[2]=n,t[3]=r),r}function Sx(e){let t=(0,$.c)(8),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=Ei(`fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Uo,{"data-slot":`sheet-overlay`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Cx(e){let t=(0,$.c)(17),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:r,children:n,side:a,showCloseButton:o,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let c=a===void 0?`right`:a,l=o===void 0?!0:o,u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(Sx,{}),t[6]=u):u=t[6];let d;t[7]===r?d=t[8]:(d=Ei(`fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-[side=bottom]:data-open:slide-in-from-bottom-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:animate-out data-closed:fade-out-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=right]:data-closed:slide-out-to-right-10 data-[side=top]:data-closed:slide-out-to-top-10 motion-reduce:transition-none motion-reduce:duration-0 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none`,r),t[7]=r,t[8]=d);let f;t[9]===l?f=t[10]:(f=l&&(0,Z.jsx)(Qo,{"data-slot":`sheet-close`,asChild:!0,children:(0,Z.jsxs)(Ni,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`,children:[(0,Z.jsx)(Ro,{}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`yz7wBu`})})]})}),t[9]=l,t[10]=f);let p;return t[11]!==n||t[12]!==i||t[13]!==c||t[14]!==d||t[15]!==f?(p=(0,Z.jsxs)(xx,{children:[u,(0,Z.jsxs)(Ho,{"data-slot":`sheet-content`,"data-side":c,className:d,...i,children:[n,f]})]}),t[11]=n,t[12]=i,t[13]=c,t[14]=d,t[15]=f,t[16]=p):p=t[16],p}function wx(e){let t=(0,$.c)(8),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=Ei(`flex flex-col gap-0.5 p-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sheet-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Tx(e){let t=(0,$.c)(8),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=Ei(`font-heading text-base font-medium text-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Wo,{"data-slot":`sheet-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ex(e){let t=(0,$.c)(8),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=Ei(`group/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`input-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Dx=Fi(`flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4`,{variants:{align:{"inline-start":`order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]`,"inline-end":`order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]`,"block-start":`order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2`,"block-end":`order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2`}},defaultVariants:{align:`inline-start`}});function Ox(e){let t=(0,$.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,align:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`inline-start`:i,o;t[4]!==a||t[5]!==n?(o=Ei(Dx({align:a}),n),t[4]=a,t[5]=n,t[6]=o):o=t[6];let s;return t[7]!==a||t[8]!==r||t[9]!==o?(s=(0,Z.jsx)(`div`,{"data-slot":`input-group-addon`,"data-align":a,className:o,onMouseDown:kx,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function kx(e){e.target.closest(`button`)||(e.preventDefault(),e.currentTarget.parentElement?.querySelector(`input`)?.focus())}Fi(`flex items-center gap-2 text-sm shadow-none`,{variants:{size:{xs:`h-6 gap-1 rounded-[calc(var(--radius)-3px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5`,sm:``,"icon-xs":`size-6 rounded-[calc(var(--radius)-3px)] p-0 has-[>svg]:p-0`,"icon-sm":`size-8 p-0 has-[>svg]:p-0`}},defaultVariants:{size:`xs`}});function Ax(e){let t=(0,$.c)(8),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=Ei(`flex items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`span`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function jx(e){let t=(0,$.c)(8),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=Ei(`flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(ts,{"data-slot":`input-group-control`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Mx(e){let t=(0,$.c)(119),{findInputRef:n,query:r,replacement:a,replaceOpen:o,caseSensitive:c,wholeWord:l,current:u,total:d,onQueryChange:f,onReplacementChange:p,onReplaceOpenChange:m,onCaseSensitiveChange:h,onWholeWordChange:g,onNext:_,onPrevious:v,onReplaceCurrent:y,onReplaceAll:b,onClose:x}=e,{_:S}=i(),C=r.length>0,w=d>0,T;t[0]!==S||t[1]!==u||t[2]!==w||t[3]!==C||t[4]!==d?(T=C?w?`${u} / ${d}`:S({id:`Ev2r9A`}):``,t[0]=S,t[1]=u,t[2]=w,t[3]=C,t[4]=d,t[5]=T):T=t[5];let E=T,D;t[6]!==x||t[7]!==_||t[8]!==v?(D=function(e){e.key===`Enter`?(e.preventDefault(),e.shiftKey?v():_()):e.key===`Escape`&&(e.preventDefault(),x())},t[6]=x,t[7]=_,t[8]=v,t[9]=D):D=t[9];let O=D,k;t[10]!==x||t[11]!==y?(k=function(e){e.key===`Enter`?(e.preventDefault(),y()):e.key===`Escape`&&(e.preventDefault(),x())},t[10]=x,t[11]=y,t[12]=k):k=t[12];let A=k,j;t[13]===S?j=t[14]:(j=S({id:`MVxpbf`}),t[13]=S,t[14]=j);let M;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-find-input`,children:(0,Z.jsx)(s,{id:`KujtjC`})}),t[15]=M):M=t[15];let N;t[16]===f?N=t[17]:(N=e=>f(e.target.value),t[16]=f,t[17]=N);let P;t[18]===S?P=t[19]:(P=S({id:`KujtjC`}),t[18]=S,t[19]=P);let F;t[20]!==n||t[21]!==O||t[22]!==r||t[23]!==N||t[24]!==P?(F=(0,Z.jsx)(jx,{ref:n,id:`ok-find-input`,value:r,onChange:N,onKeyDown:O,placeholder:P,autoComplete:`off`,spellCheck:!1,className:`h-7 px-2 text-sm`}),t[20]=n,t[21]=O,t[22]=r,t[23]=N,t[24]=P,t[25]=F):F=t[25];let I;t[26]===S?I=t[27]:(I=S({id:`-8PP0T`}),t[26]=S,t[27]=I);let L;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(oc,{"aria-hidden":`true`}),t[28]=L):L=t[28];let R;t[29]!==c||t[30]!==h||t[31]!==I?(R=(0,Z.jsx)(cr,{asChild:!0,children:(0,Z.jsx)(Po,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":I,pressed:c,onPressedChange:h,className:`size-6 min-w-6 px-0`,children:L})}),t[29]=c,t[30]=h,t[31]=I,t[32]=R):R=t[32];let z;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsx)(Qn,{side:`bottom`,children:(0,Z.jsx)(s,{id:`-8PP0T`})}),t[33]=z):z=t[33];let B;t[34]===R?B=t[35]:(B=(0,Z.jsxs)(Gr,{children:[R,z]}),t[34]=R,t[35]=B);let V;t[36]===S?V=t[37]:(V=S({id:`_7UQ7y`}),t[36]=S,t[37]=V);let H;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(_l,{"aria-hidden":`true`}),t[38]=H):H=t[38];let U;t[39]!==g||t[40]!==V||t[41]!==l?(U=(0,Z.jsx)(cr,{asChild:!0,children:(0,Z.jsx)(Po,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":V,pressed:l,onPressedChange:g,className:`size-6 min-w-6 px-0`,children:H})}),t[39]=g,t[40]=V,t[41]=l,t[42]=U):U=t[42];let W;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Z.jsx)(Qn,{side:`bottom`,children:(0,Z.jsx)(s,{id:`_7UQ7y`})}),t[43]=W):W=t[43];let G;t[44]===U?G=t[45]:(G=(0,Z.jsxs)(Gr,{children:[U,W]}),t[44]=U,t[45]=G);let K;t[46]!==B||t[47]!==G?(K=(0,Z.jsxs)(Ox,{align:`inline-end`,className:`gap-0.5`,children:[B,G]}),t[46]=B,t[47]=G,t[48]=K):K=t[48];let q;t[49]!==K||t[50]!==F?(q=(0,Z.jsxs)(Ex,{className:`h-7 w-56 rounded-[min(var(--radius-md),12px)]`,children:[F,K]}),t[49]=K,t[50]=F,t[51]=q):q=t[51];let ee;t[52]===E?ee=t[53]:(ee=(0,Z.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`min-w-14 px-1 text-right text-muted-foreground text-xs tabular-nums shrink-0`,children:E}),t[52]=E,t[53]=ee);let te;t[54]===S?te=t[55]:(te=S({id:`oqB2ez`}),t[54]=S,t[55]=te);let ne=!w,re;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(ze,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[56]=re):re=t[56];let ie;t[57]!==v||t[58]!==te||t[59]!==ne?(ie=(0,Z.jsx)(cr,{asChild:!0,children:(0,Z.jsx)(Ni,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":te,disabled:ne,onClick:v,children:re})}),t[57]=v,t[58]=te,t[59]=ne,t[60]=ie):ie=t[60];let ae;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,Z.jsx)(Qn,{side:`bottom`,children:(0,Z.jsx)(s,{id:`oqB2ez`})}),t[61]=ae):ae=t[61];let oe;t[62]===ie?oe=t[63]:(oe=(0,Z.jsxs)(Gr,{children:[ie,ae]}),t[62]=ie,t[63]=oe);let se;t[64]===S?se=t[65]:(se=S({id:`SiUUCS`}),t[64]=S,t[65]=se);let ce=!w,le;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Z.jsx)(ct,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[66]=le):le=t[66];let ue;t[67]!==_||t[68]!==se||t[69]!==ce?(ue=(0,Z.jsx)(cr,{asChild:!0,children:(0,Z.jsx)(Ni,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":se,disabled:ce,onClick:_,children:le})}),t[67]=_,t[68]=se,t[69]=ce,t[70]=ue):ue=t[70];let de;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,Z.jsx)(Qn,{side:`bottom`,children:(0,Z.jsx)(s,{id:`SiUUCS`})}),t[71]=de):de=t[71];let fe;t[72]===ue?fe=t[73]:(fe=(0,Z.jsxs)(Gr,{children:[ue,de]}),t[72]=ue,t[73]=fe);let pe=o?`secondary`:`ghost`,me;t[74]!==S||t[75]!==o?(me=S(o?{id:`UkQGhd`}:{id:`1RluQD`}),t[74]=S,t[75]=o,t[76]=me):me=t[76];let he=o?`ok-replace-input`:void 0,ge;t[77]!==m||t[78]!==o?(ge=()=>m(!o),t[77]=m,t[78]=o,t[79]=ge):ge=t[79];let _e;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,Z.jsx)(Qc,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[80]=_e):_e=t[80];let ve;t[81]!==o||t[82]!==pe||t[83]!==me||t[84]!==he||t[85]!==ge?(ve=(0,Z.jsx)(cr,{asChild:!0,children:(0,Z.jsx)(Ni,{type:`button`,variant:pe,size:`icon-sm`,"aria-label":me,"aria-expanded":o,"aria-controls":he,onClick:ge,children:_e})}),t[81]=o,t[82]=pe,t[83]=me,t[84]=he,t[85]=ge,t[86]=ve):ve=t[86];let ye;t[87]===o?ye=t[88]:(ye=(0,Z.jsx)(Qn,{side:`bottom`,children:o?(0,Z.jsx)(s,{id:`UkQGhd`}):(0,Z.jsx)(s,{id:`1RluQD`})}),t[87]=o,t[88]=ye);let be;t[89]!==ve||t[90]!==ye?(be=(0,Z.jsxs)(Gr,{children:[ve,ye]}),t[89]=ve,t[90]=ye,t[91]=be):be=t[91];let xe;t[92]!==S||t[93]!==A||t[94]!==w||t[95]!==b||t[96]!==y||t[97]!==p||t[98]!==o||t[99]!==a?(xe=o?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-replace-input`,children:(0,Z.jsx)(s,{id:`fqSfXY`})}),(0,Z.jsx)(ts,{id:`ok-replace-input`,value:a,onChange:e=>p(e.target.value),onKeyDown:A,placeholder:S({id:`fqSfXY`}),autoComplete:`off`,spellCheck:!1,className:`h-7 w-48 rounded-[min(var(--radius-md),12px)] px-2 text-sm shadow-none focus-visible:ring-2`}),(0,Z.jsxs)(Gr,{children:[(0,Z.jsx)(cr,{asChild:!0,children:(0,Z.jsx)(Ni,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":S({id:`bS_boY`}),disabled:!w,onClick:y,children:(0,Z.jsx)(Qc,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(Qn,{side:`bottom`,children:(0,Z.jsx)(s,{id:`bS_boY`})})]}),(0,Z.jsxs)(Gr,{children:[(0,Z.jsx)(cr,{asChild:!0,children:(0,Z.jsx)(Ni,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":S({id:`dr1vFs`}),disabled:!w,onClick:b,children:(0,Z.jsx)(Zc,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(Qn,{side:`bottom`,children:(0,Z.jsx)(s,{id:`dr1vFs`})})]})]}):null,t[92]=S,t[93]=A,t[94]=w,t[95]=b,t[96]=y,t[97]=p,t[98]=o,t[99]=a,t[100]=xe):xe=t[100];let Se;t[101]===S?Se=t[102]:(Se=S({id:`wJo9oS`}),t[101]=S,t[102]=Se);let Ce;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,Z.jsx)(Ro,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[103]=Ce):Ce=t[103];let J;t[104]!==x||t[105]!==Se?(J=(0,Z.jsx)(cr,{asChild:!0,children:(0,Z.jsx)(Ni,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":Se,onClick:x,children:Ce})}),t[104]=x,t[105]=Se,t[106]=J):J=t[106];let we;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,Z.jsx)(Qn,{side:`bottom`,children:(0,Z.jsx)(s,{id:`yz7wBu`})}),t[107]=we):we=t[107];let Te;t[108]===J?Te=t[109]:(Te=(0,Z.jsxs)(Gr,{children:[J,we]}),t[108]=J,t[109]=Te);let Ee;return t[110]!==q||t[111]!==ee||t[112]!==oe||t[113]!==fe||t[114]!==j||t[115]!==be||t[116]!==xe||t[117]!==Te?(Ee=(0,Z.jsxs)(`search`,{"data-testid":`find-replace-bar`,"aria-label":j,className:`pointer-events-auto flex max-w-[min(calc(100vw-1rem),720px)] touch-manipulation items-center gap-1 rounded-[calc(var(--radius)+2px)] border border-input bg-popover/95 p-1 text-popover-foreground shadow-md shadow-black/10 backdrop-blur`,children:[M,q,ee,oe,fe,be,xe,Te]}),t[110]=q,t[111]=ee,t[112]=oe,t[113]=fe,t[114]=j,t[115]=be,t[116]=xe,t[117]=Te,t[118]=Ee):Ee=t[118],Ee}var Nx={current:0,total:0},Px=120,Fx=100;function Ix(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=()=>e?ae(e):null,t[0]=e,t[1]=n),(0,Q.useSyncExternalStore)(F,n,Lx)}function Lx(){return null}function Rx(e){if(!e||e.isDestroyed)return null;let{from:t,to:n,empty:r}=e.state.selection;if(r)return null;let i=e.state.doc.textBetween(t,n,`
24
24
  `,`
25
25
  `).trim();return i.length===0||i.length>Px||i.includes(`
26
26
  `)?null:i}function zx(e,t){return(zr()?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey)&&!e.altKey&&e.key.toLocaleLowerCase()===t}function Bx(e){let t=e.key.toLocaleLowerCase();return zr()?e.metaKey&&e.altKey&&!e.ctrlKey&&t===`f`:e.ctrlKey&&!e.metaKey&&!e.altKey&&t===`h`}function Vx(e){let t=Ft(e.state);return{current:t.matches.length===0?0:t.activeIndex+1,total:t.matches.length}}function Hx(e,t){return e.current===t.current&&e.total===t.total}function Ux(e,t,n){e&&!e.isDestroyed&&(e.commands.clearFindMatches(),e.commands.focus()),t(e=>({...e,open:!1,activeIndex:0})),n(Nx)}function Wx(e){!e||e.isDestroyed||typeof window>`u`||window.requestAnimationFrame(()=>{if(e.isDestroyed)return;let t=fe(e);if(!t)return;let n=t.dom.querySelector(`.ok-find-match-active`);n instanceof HTMLElement&&n.scrollIntoView({block:`center`,inline:`nearest`,behavior:`auto`})})}function Gx(e){let t=(0,$.c)(81),{activeDocName:n,isSourceMode:r}=e,i=Ix(n),a=(0,Q.useRef)(null),o=(0,Q.useRef)(null),s=(0,Q.useRef)(n),c=(0,Q.useRef)(0),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l={open:!1,replaceOpen:!1,query:``,replacement:``,caseSensitive:!1,wholeWord:!1,activeIndex:0},t[0]=l):l=t[0];let[u,d]=(0,Q.useState)(l),[f,p]=(0,Q.useState)(Nx),m,h;t[1]===n?(m=t[2],h=t[3]):(m=()=>{s.current!==n&&(s.current=n,d(qx))},h=[n],t[1]=n,t[2]=m,t[3]=h),(0,Q.useEffect)(m,h);let g,_;t[4]===u.activeIndex?(g=t[5],_=t[6]):(g=()=>{c.current=u.activeIndex},_=[u.activeIndex],t[4]=u.activeIndex,t[5]=g,t[6]=_),(0,Q.useEffect)(g,_);let v,y;t[7]===i?(v=t[8],y=t[9]):(v=()=>{let e=o.current;e&&e!==i&&!e.isDestroyed&&e.commands.clearFindMatches(),o.current=i},y=[i],t[7]=i,t[8]=v,t[9]=y),(0,Q.useEffect)(v,y);let b,x;t[10]===u.open?(b=t[11],x=t[12]):(b=()=>{if(!u.open||!a.current)return;let e=requestAnimationFrame(()=>{a.current?.focus(),a.current?.select()});return()=>cancelAnimationFrame(e)},x=[u.open],t[10]=u.open,t[11]=b,t[12]=x),(0,Q.useEffect)(b,x);let S,C;t[13]!==u.open||t[14]!==r?(S=()=>{!u.open||!r||d(Kx)},C=[u.open,r],t[13]=u.open,t[14]=r,t[15]=S,t[16]=C):(S=t[15],C=t[16]),(0,Q.useEffect)(S,C);let w,T;t[17]!==i||t[18]!==u.caseSensitive||t[19]!==u.open||t[20]!==u.query||t[21]!==u.wholeWord||t[22]!==r?(w=()=>{if(!i||i.isDestroyed){p(Nx);return}if(!u.open||r){i.commands.clearFindMatches(),p(Nx);return}let e=window.setTimeout(()=>{if(i.isDestroyed)return;i.commands.setFindQuery(u.query,{options:{caseSensitive:u.caseSensitive,wholeWord:u.wholeWord},activeIndex:c.current});let e=Vx(i);p(t=>Hx(t,e)?t:e)},Fx);return()=>window.clearTimeout(e)},T=[i,u.open,u.query,u.caseSensitive,u.wholeWord,r],t[17]=i,t[18]=u.caseSensitive,t[19]=u.open,t[20]=u.query,t[21]=u.wholeWord,t[22]=r,t[23]=w,t[24]=T):(w=t[23],T=t[24]),(0,Q.useEffect)(w,T);let E,D;t[25]!==i||t[26]!==u.open||t[27]!==r?(E=()=>{if(!i||i.isDestroyed||!u.open||r)return;let e=()=>{let e=Ft(i.state),t=Vx(i);p(e=>Hx(e,t)?e:t),d(t=>t.activeIndex===e.activeIndex?t:{...t,activeIndex:e.activeIndex})};return i.on(`transaction`,e),()=>{i.off(`transaction`,e)}},D=[i,u.open,r],t[25]=i,t[26]=u.open,t[27]=r,t[28]=E,t[29]=D):(E=t[28],D=t[29]),(0,Q.useEffect)(E,D);let O,k;t[30]!==n||t[31]!==i||t[32]!==u.open||t[33]!==r?(O=()=>{let e=function(e){let t=Rx(i);d(n=>({...n,open:!0,replaceOpen:e,query:t??n.query,activeIndex:0}))},t=function(t){if(!(!n||r||t.defaultPrevented)){if(zx(t,`f`)){t.preventDefault(),u.open?Ux(i,d,p):e(!1);return}if(Bx(t)){t.preventDefault(),e(!0);return}if(zx(t,`g`)&&u.open){t.preventDefault(),(t.shiftKey?i?.commands.selectPreviousFindMatch():i?.commands.selectNextFindMatch())&&Wx(i);return}t.key===`Escape`&&u.open&&(t.preventDefault(),Ux(i,d,p))}};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},k=[n,i,u.open,r],t[30]=n,t[31]=i,t[32]=u.open,t[33]=r,t[34]=O,t[35]=k):(O=t[34],k=t[35]),(0,Q.useEffect)(O,k);let A;t[36]!==i||t[37]!==u.caseSensitive||t[38]!==u.query||t[39]!==u.wholeWord?(A=function(){return!i||i.isDestroyed?!1:(i.commands.setFindQuery(u.query,{options:{caseSensitive:u.caseSensitive,wholeWord:u.wholeWord},activeIndex:c.current}),!0)},t[36]=i,t[37]=u.caseSensitive,t[38]=u.query,t[39]=u.wholeWord,t[40]=A):A=t[40];let j=A,M;t[41]===i?M=t[42]:(M=function(){if(!i||i.isDestroyed)return;let e=Ft(i.state),t=Vx(i);p(e=>Hx(e,t)?e:t),d(t=>t.activeIndex===e.activeIndex?t:{...t,activeIndex:e.activeIndex})},t[41]=i,t[42]=M);let N=M,P;t[43]===i?P=t[44]:(P=function(){Ux(i,d,p)},t[43]=i,t[44]=P);let F=P,I;t[45]!==j||t[46]!==i||t[47]!==N?(I=function(){!i||i.isDestroyed||(j(),i.commands.selectNextFindMatch()&&Wx(i),N())},t[45]=j,t[46]=i,t[47]=N,t[48]=I):I=t[48];let L=I,R;t[49]!==j||t[50]!==i||t[51]!==N?(R=function(){!i||i.isDestroyed||(j(),i.commands.selectPreviousFindMatch()&&Wx(i),N())},t[49]=j,t[50]=i,t[51]=N,t[52]=R):R=t[52];let z=R,B;t[53]!==j||t[54]!==i||t[55]!==u.replacement||t[56]!==N?(B=function(){!i||i.isDestroyed||(j(),i.commands.replaceCurrentFindMatch(u.replacement)&&Wx(i),N())},t[53]=j,t[54]=i,t[55]=u.replacement,t[56]=N,t[57]=B):B=t[57];let V=B,H;t[58]!==j||t[59]!==i||t[60]!==u.replacement||t[61]!==N?(H=function(){!i||i.isDestroyed||(j(),i.commands.replaceAllFindMatches(u.replacement)&&Wx(i),N())},t[58]=j,t[59]=i,t[60]=u.replacement,t[61]=N,t[62]=H):H=t[62];let U=H;if(!u.open||!n||r)return null;let W,G,K,q,ee;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(W=e=>d(t=>({...t,query:e,activeIndex:0})),G=e=>d(t=>({...t,replacement:e})),K=e=>d(t=>({...t,replaceOpen:e})),q=e=>d(t=>({...t,caseSensitive:e})),ee=e=>d(t=>({...t,wholeWord:e})),t[63]=W,t[64]=G,t[65]=K,t[66]=q,t[67]=ee):(W=t[63],G=t[64],K=t[65],q=t[66],ee=t[67]);let te;return t[68]!==F||t[69]!==u.caseSensitive||t[70]!==u.query||t[71]!==u.replaceOpen||t[72]!==u.replacement||t[73]!==u.wholeWord||t[74]!==f.current||t[75]!==f.total||t[76]!==U||t[77]!==V||t[78]!==L||t[79]!==z?(te=(0,Z.jsx)(`div`,{className:`editor-content-aligned pointer-events-none absolute inset-x-0 top-2 z-30 px-2`,children:(0,Z.jsx)(`div`,{className:`flex justify-end`,children:(0,Z.jsx)(Mx,{findInputRef:a,query:u.query,replacement:u.replacement,replaceOpen:u.replaceOpen,caseSensitive:u.caseSensitive,wholeWord:u.wholeWord,current:f.current,total:f.total,onQueryChange:W,onReplacementChange:G,onReplaceOpenChange:K,onCaseSensitiveChange:q,onWholeWordChange:ee,onNext:L,onPrevious:z,onReplaceCurrent:V,onReplaceAll:U,onClose:F})})}),t[68]=F,t[69]=u.caseSensitive,t[70]=u.query,t[71]=u.replaceOpen,t[72]=u.replacement,t[73]=u.wholeWord,t[74]=f.current,t[75]=f.total,t[76]=U,t[77]=V,t[78]=L,t[79]=z,t[80]=te):te=t[80],te}function Kx(e){return{...e,open:!1,activeIndex:0}}function qx(e){return{...e,activeIndex:0}}var Jx=960,Yx=1024;function Xx(){let e=(0,$.c)(5),[t,n]=(0,Q.useState)(Qx),[r,i]=(0,Q.useState)(Zx),a,o;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{let e=window.matchMedia(`(max-width: ${Jx-1}px)`),t=window.matchMedia(`(max-width: ${Yx-1}px)`),r=()=>{let r=e.matches;n(r?`sheet`:`panel`),i(!r&&t.matches)};return e.addEventListener(`change`,r),t.addEventListener(`change`,r),()=>{e.removeEventListener(`change`,r),t.removeEventListener(`change`,r)}},o=[],e[0]=a,e[1]=o):(a=e[0],o=e[1]),(0,Q.useEffect)(a,o);let s;return e[2]!==r||e[3]!==t?(s={layout:t,autoCollapse:r},e[2]=r,e[3]=t,e[4]=s):s=e[4],s}function Zx(){return window.innerWidth>=Jx&&window.innerWidth<Yx}function Qx(){return window.innerWidth<Jx?`sheet`:`panel`}var $x={words:0,chars:0,tokens:0},eS=/[ -〿぀-ゟ゠-ヿ㐀-䶿一-鿿豈-﫿＀-￯฀-๿ក-៿]/,tS=/[\p{L}\p{N}]/u,nS=new Set([`text`,`inlineCode`,`code`,`tag`]),rS=new Set([`html`,`definition`,`footnoteDefinition`,`yaml`,`toml`,`image`,`imageReference`,`mdxFlowExpression`,`mdxTextExpression`,`mdxjsEsm`,`rawMdxFallback`,`rawMdxFallbackMdast`]),iS=new Set([`paragraph`,`heading`,`blockquote`,`list`,`listItem`,`thematicBreak`,`table`,`tableRow`,`tableCell`,`mdxJsxFlowElement`,`commentBlock`]);function aS(e,t){if(!e)return;let n=e.type;if(!rS.has(n)){if(nS.has(n)){e.value&&(t.push(e.value),n===`code`&&t.push(`
@@ -28,7 +28,7 @@ Error generating stack: `+e.message+`
28
28
  `)&&t.push(`
29
29
  `)}}}}function oS(e){try{let t=ht().parseToMdast(e),n=[];return aS(t,n),n.join(``).trim()}catch(t){return console.warn(`[document-stats] mdast parse failed, falling back to raw text`,t),e.trim()}}function sS(e){if(!e)return 0;let t=0;for(let n of e.split(/\s+/))tS.test(n)&&t++;return t}function cS(e){let t=globalThis.Intl.Segmenter;if(!t)return sS(e);let n=new t(void 0,{granularity:`word`}),r=0;for(let t of n.segment(e))t.isWordLike&&r++;return r}function lS(e){let t=eS.test(e)?1.5:4;return Math.ceil(e.length/t)}function uS(e){if(!e)return{words:0,chars:0,tokens:0};let{body:t}=nr(e);if(!t.trim())return{words:0,chars:0,tokens:0};let n=oS(t);return n?{words:eS.test(n)?cS(n):sS(n),chars:n.length,tokens:lS(n)}:{words:0,chars:0,tokens:0}}var dS=300;function fS(e,t){let n=(0,$.c)(4),[r,i]=(0,Q.useState)($x),a,o;return n[0]!==t||n[1]!==e?(a=()=>{if(!e||!t){i($x);return}let n=e.document.getText(`source`),r=!1,a=null,o=function(){r||i(uS(n.toString()))};o();let s=function(){a&&clearTimeout(a),a=setTimeout(o,dS)};return n.observe(s),()=>{r=!0,n.unobserve(s),a&&clearTimeout(a)}},o=[e,t],n[0]=t,n[1]=e,n[2]=a,n[3]=o):(a=n[2],o=n[3]),(0,Q.useEffect)(a,o),r}function pS(e){return e&&e.document.getMap(`lifecycle`).get(`status`)===`conflict`?`conflict`:null}function mS(e){let t=(0,$.c)(8),{poolEntries:n}=ft(),r;t[0]!==e||t[1]!==n?(r=e?n.find(t=>t.docName===e)??null:null,t[0]=e,t[1]=n,t[2]=r):r=t[2];let i=r?.provider??null,a;t[3]===i?a=t[4]:(a=()=>pS(i),t[3]=i,t[4]=a);let[o,s]=(0,Q.useState)(a),c,l;return t[5]===i?(c=t[6],l=t[7]):(c=()=>{if(!i){s(null);return}let e=i.document.getMap(`lifecycle`);s(pS(i));let t=()=>s(pS(i));return e.observe(t),()=>{e.unobserve(t)}},l=[i],t[5]=i,t[6]=c,t[7]=l),(0,Q.useEffect)(c,l),o}function hS(e){let t=(0,$.c)(3),[n,r]=(0,Q.useState)(`connecting`),i,a;return t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(!e){r(`connecting`);return}let t=e.configuration.websocketProvider.status;e.isSynced?r(`synced`):r(t===`connected`?`connected`:t===`disconnected`?`disconnected`:`connecting`);let n=e=>{let{status:t}=e;r(t===`connected`?gS:t===`disconnected`?`disconnected`:`connecting`)},i=e=>{let{state:t}=e;r(t?`synced`:`connected`)},a=()=>r(`disconnected`);return e.on(`status`,n),e.on(`synced`,i),e.on(`disconnect`,a),()=>{e.off(`status`,n),e.off(`synced`,i),e.off(`disconnect`,a)}},a=[e],t[0]=e,t[1]=i,t[2]=a),(0,Q.useEffect)(i,a),n}function gS(e){return e===`synced`?`synced`:`connected`}var _S=wi;function vS(e,t={}){let n=Y(e.componentName);return n.name===`*`?t.unregisteredSuffix?`${e.componentName} (unregistered)`:e.componentName:n.displayName??n.name}var yS=200,bS=`Outside any block`;function xS(e){let t=(0,$.c)(5),{editor:n}=e,r=Ut(n),i=(0,Q.useRef)(null),a=(0,Q.useRef)(null),o=(0,Q.useRef)(!1),s,c;t[0]!==r||t[1]!==n?(s=()=>{if(a.current!==null&&(window.clearTimeout(a.current),a.current=null),!n||!i.current)return;let e=r!==null&&r.ancestorChain.length>0,t;return t=e?SS(n,r):o.current?bS:``,a.current=window.setTimeout(()=>{i.current&&(i.current.textContent=``,i.current.textContent=t),o.current=e,a.current=null},yS),()=>{a.current!==null&&(window.clearTimeout(a.current),a.current=null)}},c=[n,r],t[0]=r,t[1]=n,t[2]=s,t[3]=c):(s=t[2],c=t[3]),(0,Q.useEffect)(s,c);let l;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`div`,{ref:i,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`sr-only`}),t[4]=l):l=t[4],l}function SS(e,t){if(!t||t.ancestorChain.length===0)return``;let n=t.ancestorChain,r=n[n.length-1],i=vS(r,{unregisteredSuffix:!0});if(n.length===1)return`Selected: ${i}`;let a=n[n.length-2],o=vS(a);try{let t=e.state.doc.resolve(r.pos),n=t.index(t.depth),a=t.parent.childCount;return`Selected: ${i}, ${n+1} of ${a} in ${o}`}catch{return`Selected: ${i} in ${o}`}}function CS(){let[e]=(0,Q.useState)(xr);return e}function wS({principal:e,identity:t}){return e&&e.source===`git-config`?{type:`human`,name:Un(e.display_name),color:Fn(e.id,rr),coeditor:t.coeditor,tabId:t.tabId,principalId:e.id}:e&&e.source===`synthesized`?{type:`human`,name:t.name,color:Fn(e.id,rr),coeditor:t.coeditor,tabId:t.tabId}:{type:`human`,name:t.name,color:t.color,coeditor:t.coeditor,tabId:t.tabId}}function TS(e,t){let n=Math.min(e.top,t.top),r=Math.max(e.bottom,t.bottom),i=Math.min(e.left,t.left),a=Math.max(e.right,t.right)-i,o=r-n;return new DOMRect(i,n,a,o)}var ES=class{constructor({editor:e,element:t,view:n,pluginKey:r=`bubbleMenu`,updateDelay:i=250,resizeDelay:a=60,shouldShow:o,appendTo:s,getReferencedVirtualElement:c,options:l}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:`absolute`,placement:`top`,offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:e,state:t,from:n,to:r})=>{let{doc:i,selection:a}=t,{empty:o}=a,s=!i.textBetween(n,r).length&&mi(t.selection),c=this.element.contains(document.activeElement);return!(!(e.hasFocus()||c)||o||s||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(e,t)=>{let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);!n&&!r||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(e,n,r,t)},this.updateDelay))},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.show(),this.updatePosition()}},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`?this.updateOptions(t.options):t===`hide`?this.hide():t===`show`&&(this.updatePosition(),this.show())},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=a,this.appendTo=s,this.scrollTarget=l?.scrollTarget??window,this.getReferencedVirtualElement=c,this.floatingUIOptions={...this.floatingUIOptions,...l},this.element.tabIndex=0,o&&(this.shouldShow=o),this.element.addEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener(`dragstart`,this.dragstartHandler),this.editor.on(`focus`,this.focusHandler),this.editor.on(`blur`,this.blurHandler),this.editor.on(`transaction`,this.transactionHandler),window.addEventListener(`resize`,this.resizeHandler),this.scrollTarget.addEventListener(`scroll`,this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(br(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Kn(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(ci(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(An(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(wr(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(gr(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(Vn(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(Jn(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}get virtualElement(){let{selection:e}=this.editor.state,t=this.getReferencedVirtualElement?.call(this);if(t)return t;if(!this.view?.dom?.parentNode)return;let n=ui(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof ei){let t=this.view.nodeDOM(e.from),n=t.dataset.nodeViewWrapper?t:t.querySelector(`[data-node-view-wrapper]`);n&&(t=n),t&&(r={getBoundingClientRect:()=>t.getBoundingClientRect(),getClientRects:()=>[t.getBoundingClientRect()]})}if(e instanceof Mn){let{$anchorCell:t,$headCell:n}=e,i=t?t.pos:n.pos,a=n?n.pos:t.pos,o=this.view.nodeDOM(i),s=this.view.nodeDOM(a);if(!o||!s)return;let c=o===s?o.getBoundingClientRect():TS(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&hr(e,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{if(!(!this.isVisible||this.editor.isDestroyed||!this.element.isConnected)){if(r.hide?.referenceHidden||r.hide?.escaped){this.element.style.visibility=`hidden`;return}this.element.style.visibility=`visible`,this.element.style.width=`max-content`,this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()}})}update(e,t){let{state:n}=e,r=n.selection.from!==n.selection.to;if(this.updateDelay>0&&r){this.handleDebouncedUpdate(e,t);return}let i=!t?.selection.eq(e.state.selection),a=!t?.doc.eq(e.state.doc);this.updateHandler(e,i,a,t)}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,element:this.element,view:this.view,state:t,oldState:e,from:i,to:a})||!1}show(){var e;this.isVisible||(this.element.style.visibility=`visible`,this.element.style.opacity=`1`,(e=(typeof this.appendTo==`function`?this.appendTo():this.appendTo)??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0)}hide(){this.isVisible&&=(this.element.style.visibility=`hidden`,this.element.style.opacity=`0`,this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),!1)}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.getReferencedVirtualElement!==void 0&&(this.getReferencedVirtualElement=e.getReferencedVirtualElement),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener(`scroll`,this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}destroy(){this.hide(),this.element.removeEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener(`dragstart`,this.dragstartHandler),window.removeEventListener(`resize`,this.resizeHandler),this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.editor.off(`focus`,this.focusHandler),this.editor.off(`blur`,this.blurHandler),this.editor.off(`transaction`,this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},DS=e=>new _i({key:typeof e.pluginKey==`string`?new Rr(e.pluginKey):e.pluginKey,view:t=>new ES({view:t,...e})});Wn.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[DS({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var OS=class{constructor({editor:e,element:t,view:n,pluginKey:r=`floatingMenu`,updateDelay:i=250,resizeDelay:a=60,options:o,appendTo:s,shouldShow:c}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:e,state:t})=>{let{selection:n}=t,{$anchor:r,empty:i}=n,a=r.depth===1,o=r.parent.isTextblock&&!r.parent.type.spec.code&&!r.parent.textContent&&r.parent.childCount===0&&!this.getTextContent(r.parent);return!(!e.hasFocus()||!i||!a||!o||!this.editor.isEditable)},this.floatingUIOptions={strategy:`absolute`,placement:`right`,offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.updatePosition(),this.show()}},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`?this.updateOptions(t.options):t===`hide`?this.hide():t===`show`&&(this.updatePosition(),this.show())},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=a,this.appendTo=s,this.scrollTarget=o?.scrollTarget??window,this.floatingUIOptions={...this.floatingUIOptions,...o},this.element.tabIndex=0,c&&(this.shouldShow=c),this.element.addEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.editor.on(`focus`,this.focusHandler),this.editor.on(`blur`,this.blurHandler),this.editor.on(`transaction`,this.transactionHandler),window.addEventListener(`resize`,this.resizeHandler),this.scrollTarget.addEventListener(`scroll`,this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(e){return Sr(e,{textSerializers:Dr(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(br(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Kn(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(ci(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(An(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(wr(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(gr(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(Vn(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(Jn(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,view:this.view,state:t,oldState:e,from:i,to:a})}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener(`scroll`,this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}updatePosition(){let{selection:e}=this.editor.state,t=ui(this.view,e.from,e.to);hr({getBoundingClientRect:()=>t,getClientRects:()=>[t]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{if(r.hide?.referenceHidden||r.hide?.escaped){this.element.style.visibility=`hidden`;return}this.element.style.visibility=`visible`,this.element.style.width=`max-content`,this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);this.updateHandler(e,n,r,t)}show(){var e;this.isVisible||(this.element.style.visibility=`visible`,this.element.style.opacity=`1`,(e=(typeof this.appendTo==`function`?this.appendTo():this.appendTo)??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0)}hide(){this.isVisible&&=(this.element.style.visibility=`hidden`,this.element.style.opacity=`0`,this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),!1)}destroy(){this.hide(),this.element.removeEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),window.removeEventListener(`resize`,this.resizeHandler),this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.editor.off(`focus`,this.focusHandler),this.editor.off(`blur`,this.blurHandler),this.editor.off(`transaction`,this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},kS=e=>new _i({key:typeof e.pluginKey==`string`?new Rr(e.pluginKey):e.pluginKey,view:t=>new OS({view:t,...e})});Wn.create({name:`floatingMenu`,addOptions(){return{element:null,options:{},pluginKey:`floatingMenu`,updateDelay:void 0,resizeDelay:void 0,appendTo:void 0,shouldShow:null}},addCommands(){return{updateFloatingMenuPosition:()=>({tr:e,dispatch:t})=>(t&&e.setMeta(this.options.pluginKey,`updatePosition`),!0)}},addProseMirrorPlugins(){return this.options.element?[kS({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,resizeDelay:this.options.resizeDelay,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});function AS(e,t){return e??new Rr(t)}var jS=typeof window<`u`?Q.useLayoutEffect:Q.useEffect,MS=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),NS=new Set(`animationIterationCount.aspectRatio.borderImageOutset.borderImageSlice.borderImageWidth.columnCount.columns.fillOpacity.flex.flexGrow.flexShrink.fontWeight.gridArea.gridColumn.gridColumnEnd.gridColumnStart.gridRow.gridRowEnd.gridRowStart.lineClamp.lineHeight.opacity.order.orphans.scale.stopOpacity.strokeDasharray.strokeDashoffset.strokeMiterlimit.strokeOpacity.strokeWidth.tabSize.widows.zIndex.zoom`.split(`.`)),PS=new Set([`children`,`className`,`style`]),FS=new Set([`tabIndex`]),IS=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),LS={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function RS(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function zS(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function BS(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||IS.has(e)}function VS(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function HS(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:LS[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function US(e,t){let n=t.defaultPrevented,r=!1,i=Object.create(t);return Object.defineProperties(i,{nativeEvent:{value:t},currentTarget:{value:e},target:{value:t.target},persist:{value:()=>void 0},isDefaultPrevented:{value:()=>n},isPropagationStopped:{value:()=>r},preventDefault:{value:()=>{n=!0,t.preventDefault()}},stopPropagation:{value:()=>{r=!0,t.stopPropagation()}}}),i}function WS(e){return FS.has(e)}function GS(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function KS(e,t){if(t===`tabIndex`){e.removeAttribute(`tabindex`);return}let n=e[t];if(typeof n==`boolean`){e[t]=!1;return}if(typeof n==`number`){e[t]=0;return}e[t]=``}function qS(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||NS.has(e)?String(t):`${t}px`}function JS(e,t){MS.has(t)||e.style.removeProperty(VS(t))}function YS(e,t,n){MS.has(t)||e.style.setProperty(VS(t),qS(t,n))}function XS(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(PS.has(r)||!BS(r)||RS(r,t[r])||RS(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=zS(r);if(a==null||a===!1){WS(r)&&KS(e,r),e.removeAttribute(o);return}if(a===!0){WS(r)&&GS(e,r,!0),e.setAttribute(o,``);return}if(WS(r)){GS(e,r,a);return}e.setAttribute(o,String(a))})}function ZS(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function QS(e,t,n){let r=t??{},i=n??{};new Set([...Object.keys(r),...Object.keys(i)]).forEach(t=>{let n=r[t],a=i[t];if(n!==a){if(a==null){JS(e,t);return}YS(e,t,a)}})}function $S(e,t,n){t.forEach(({eventName:t,listener:n,options:r})=>{e.removeEventListener(t,n,r)});let r=[];return Object.entries(n).forEach(([t,n])=>{if(!RS(t,n))return;let{eventName:i,options:a}=HS(t),o=t=>{n(US(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function eC(e,t){let n=(0,Q.useRef)({}),r=(0,Q.useRef)([]);jS(()=>{let i=n.current;return ZS(e,i.className,t.className),QS(e,i.style,t.style),XS(e,i,t),r.current=$S(e,r.current,t),n.current=t,()=>{r.current.forEach(({eventName:t,listener:n,options:r})=>{e.removeEventListener(t,n,r)}),r.current=[]}},[e,t])}var tC=Q.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:a=null,getReferencedVirtualElement:o,options:s,children:c,...l},u)=>{let d=(0,Q.useRef)(document.createElement(`div`)),f=(0,Q.useRef)(AS(e,`bubbleMenu`)).current;eC(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=Lt(),m=t||p,h={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:f,shouldShow:a,getReferencedVirtualElement:o,options:s},g=(0,Q.useRef)(h);g.current=h;let[_,v]=(0,Q.useState)(!1),y=(0,Q.useRef)(!0);return(0,Q.useEffect)(()=>{if(m?.isDestroyed)return;if(!m){console.warn(`BubbleMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=d.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=DS({...g.current,editor:m,element:e});m.registerPlugin(t);let n=g.current.pluginKey;return y.current=!0,v(!0),()=>{v(!1),m.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[m]),(0,Q.useEffect)(()=>{if(!(!_||!m||m.isDestroyed)){if(y.current){y.current=!1;return}m.view.dispatch(m.state.tr.setMeta(f,{type:`updateOptions`,options:g.current}))}},[_,m,n,r,a,s,i,o,f]),(0,rc.createPortal)(c,d.current)});Q.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:a=null,options:o,children:s,...c},l)=>{let u=(0,Q.useRef)(document.createElement(`div`)),d=(0,Q.useRef)(AS(e,`floatingMenu`)).current;eC(u.current,c),typeof l==`function`?l(u.current):l&&(l.current=u.current);let{editor:f}=Lt(),p=t||f,m={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:d,shouldShow:a,options:o},h=(0,Q.useRef)(m);h.current=m;let[g,_]=(0,Q.useState)(!1),v=(0,Q.useRef)(!0);return(0,Q.useEffect)(()=>{if(p?.isDestroyed)return;if(!p){console.warn(`FloatingMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=u.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=kS({...h.current,editor:p,element:e});p.registerPlugin(t);let n=h.current.pluginKey;return v.current=!0,_(!0),()=>{_(!1),p.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[p]),(0,Q.useEffect)(()=>{if(!(!g||!p||p.isDestroyed)){if(v.current){v.current=!1;return}p.view.dispatch(p.state.tr.setMeta(d,{type:`updateOptions`,options:h.current}))}},[g,p,n,r,a,o,i,d]),(0,rc.createPortal)(s,u.current)});var nC=[{name:`paragraph`,label:`Text`,icon:Kc,isActive:e=>e.isActive(`paragraph`)&&!e.isActive(`list`),command:e=>e.chain().focus().setParagraph().run()},{name:`heading1`,label:`Heading 1`,icon:De,isActive:e=>e.isActive(`heading`,{level:1}),command:e=>e.chain().focus().toggleHeading({level:1}).run()},{name:`heading2`,label:`Heading 2`,icon:L,isActive:e=>e.isActive(`heading`,{level:2}),command:e=>e.chain().focus().toggleHeading({level:2}).run()},{name:`heading3`,label:`Heading 3`,icon:St,isActive:e=>e.isActive(`heading`,{level:3}),command:e=>e.chain().focus().toggleHeading({level:3}).run()},{name:`bulletList`,label:`Bullet List`,icon:h,isActive:e=>e.isActive(`list`,{ordered:!1})&&!e.isActive(`listItem`,{checked:!0})&&!e.isActive(`listItem`,{checked:!1}),command:e=>e.chain().focus().toggleBulletList().run()},{name:`orderedList`,label:`Ordered List`,icon:M,isActive:e=>e.isActive(`list`,{ordered:!0}),command:e=>e.chain().focus().toggleOrderedList().run()},{name:`taskList`,label:`Task List`,icon:ye,isActive:e=>e.isActive(`listItem`,{checked:!0})||e.isActive(`listItem`,{checked:!1}),command:e=>e.chain().focus().toggleTaskList().run()},{name:`blockquote`,label:`Quote`,icon:E,isActive:e=>e.isActive(`blockquote`),command:e=>e.chain().focus().toggleBlockquote().run()},{name:`codeBlock`,label:`Code Block`,icon:al,isActive:e=>e.isActive(`codeBlock`),command:e=>e.chain().focus().toggleCodeBlock().run()}];function rC(e){let t=(0,$.c)(18),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:iC},t[0]=n,t[1]=r);let{current:i,activeStates:a}=Wt(r),o=i.icon,s;t[2]===o?s=t[3]:(s=(0,Z.jsx)(o,{className:`size-3.5`}),t[2]=o,t[3]=s);let c;t[4]===i.label?c=t[5]:(c=(0,Z.jsx)(`span`,{children:i.label}),t[4]=i.label,t[5]=c);let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(ct,{className:`size-3 opacity-50`}),t[6]=l):l=t[6];let u;t[7]!==s||t[8]!==c?(u=(0,Z.jsx)(Ea,{asChild:!0,children:(0,Z.jsxs)(Ni,{variant:`ghost`,size:`sm`,className:`gap-1 px-2 text-sm font-medium text-accent-foreground/80`,children:[s,c,l]})}),t[7]=s,t[8]=c,t[9]=u):u=t[9];let d;t[10]!==a||t[11]!==n?(d=nC.map(e=>{let t=e.icon,r=a[e.name];return(0,Z.jsxs)(ha,{className:r?`bg-accent text-accent-foreground`:``,onSelect:()=>{e.command(n)},children:[(0,Z.jsx)(t,{className:`size-4`}),(0,Z.jsx)(`span`,{children:e.label})]},e.name)}),t[10]=a,t[11]=n,t[12]=d):d=t[12];let f;t[13]===d?f=t[14]:(f=(0,Z.jsx)(la,{align:`start`,sideOffset:8,className:`w-44 max-h-(--radix-dropdown-menu-content-available-height) overflow-y-auto subtle-scrollbar`,children:d}),t[13]=d,t[14]=f);let p;return t[15]!==u||t[16]!==f?(p=(0,Z.jsxs)(Na,{children:[u,f]}),t[15]=u,t[16]=f,t[17]=p):p=t[17],p}function iC(e){let t=Object.fromEntries(nC.map(t=>[t.name,t.isActive(e.editor)]));return{current:nC.find(e=>t[e.name])??nC[0],activeStates:t}}function aC(e){let t=e.state.selection.node;if(!t||t.type.name!==`jsxComponent`)return null;let n=t.attrs.componentName;if(n!==`File`&&n!==`WikiEmbedFile`)return null;let r=(t.attrs.props??{}).src;return typeof r!=`string`||r.length===0?null:r}function oC(e){let t=e.state.selection.node;if(!t)return``;let n=t.attrs.props??{},r=typeof n.alias==`string`?n.alias:``;if(r.length>0)return r;let i=typeof n.name==`string`?n.name:``;return i.length>0?i:rt(typeof n.src==`string`?n.src:``)}function sC(e,t){let n=document.createElement(`a`);n.href=e,n.download=t,n.rel=`noopener noreferrer`,n.style.display=`none`,document.body.appendChild(n),n.click(),n.remove()}function cC(e){let t=(0,$.c)(13),{editor:n}=e,{_:r}=i(),a;if(t[0]===n?a=t[1]:(a={editor:n,selector:lC},t[0]=n,t[1]=a),Wt(a)===null)return null;let o;t[2]===r?o=t[3]:(o=r({id:`WcWS__`}),t[2]=r,t[3]=o);let c;t[4]===n?c=t[5]:(c=e=>{e.preventDefault();let t=aC(n);t&&sC(t,oC(n))},t[4]=n,t[5]=c);let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(Pa,{className:`size-3.5`}),t[6]=l):l=t[6];let u;t[7]!==o||t[8]!==c?(u=(0,Z.jsx)(cr,{asChild:!0,children:(0,Z.jsx)(Ni,{variant:`ghost`,size:`icon-xs`,"aria-label":o,className:`text-accent-foreground`,onMouseDown:c,children:l})}),t[7]=o,t[8]=c,t[9]=u):u=t[9];let d;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Qn,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(s,{id:`WcWS__`})}),t[10]=d):d=t[10];let f;return t[11]===u?f=t[12]:(f=(0,Z.jsx)(`div`,{className:`flex items-center gap-0.5`,children:(0,Z.jsxs)(Gr,{children:[u,d]})}),t[11]=u,t[12]=f),f}function lC(e){return aC(e.editor)}function uC(e){return aC(e)!==null}var dC=[{value:`left`,label:`Align left`,icon:it},{value:`center`,label:`Align center`,icon:q},{value:`right`,label:`Align right`,icon:G}];function fC(e){let t=e.state.selection.node;if(!t||t.type.name!==`jsxComponent`)return null;let n=t.attrs.componentName;if(n!==`img`&&n!==`CommonMarkImage`&&n!==`Embed`)return null;let r=(t.attrs.props??{}).align;return r===`left`||r===`right`||r===`center`?r:`center`}function pC(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:mC},t[0]=n,t[1]=r);let i=Wt(r);if(i===null)return null;let a;t[2]!==i||t[3]!==n?(a=dC.map(e=>{let{value:t,label:r,icon:a}=e,o=i===t;return(0,Z.jsxs)(Gr,{children:[(0,Z.jsx)(cr,{asChild:!0,children:(0,Z.jsx)(Ni,{variant:`ghost`,size:`icon-xs`,"aria-label":r,"aria-pressed":o,className:o?`bg-accent text-primary`:`text-accent-foreground`,onMouseDown:e=>{e.preventDefault();let r=n.state.selection,i=r.node;if(!i||i.type.name!==`jsxComponent`)return;let a=String(i.attrs.componentName??``);if(a!==`img`&&a!==`CommonMarkImage`&&a!==`Embed`||i.attrs.kind!==`element`)return;let o=a===`CommonMarkImage`,s=r.from,c={...i.attrs.props??{},align:t},l=o?{...i.attrs,componentName:`img`,props:c,sourceDirty:!0}:{...i.attrs,props:c,sourceDirty:!0},u=n.state.tr.setNodeMarkup(s,null,l);u.setSelection(ei.create(u.doc,s)),It(n.view.nodeDOM(s),()=>{n.view.dispatch(u)})},children:(0,Z.jsx)(a,{className:`size-3.5`})})}),(0,Z.jsx)(Qn,{side:`bottom`,sideOffset:8,children:r})]},t)}),t[2]=i,t[3]=n,t[4]=a):a=t[4];let o;return t[5]===a?o=t[6]:(o=(0,Z.jsx)(`div`,{className:`flex items-center gap-0.5`,children:a}),t[5]=a,t[6]=o),o}function mC(e){return fC(e.editor)}function hC(e){return fC(e)!==null}var gC=[{name:`bold`,icon:nc,command:e=>e.chain().focus().toggleBold().run(),isActive:e=>e.isActive(`strong`),shortcut:`⌘ B`},{name:`italic`,icon:jc,command:e=>e.chain().focus().toggleItalic().run(),isActive:e=>e.isActive(`emphasis`),shortcut:`⌘ I`},{name:`underline`,icon:pl,command:e=>e.chain().focus().toggleUnderline().run(),isActive:e=>e.isActive(`underline`),shortcut:`⌘ U`},{name:`strikethrough`,icon:ll,command:e=>e.chain().focus().toggleStrike().run(),isActive:e=>e.isActive(`strike`),shortcut:`⌘ ⇧ X`},{name:`code`,icon:fc,command:e=>e.chain().focus().toggleCode().run(),isActive:e=>e.isActive(`code`),shortcut:`⌘ E`},{name:`highlight`,icon:Ac,command:e=>e.chain().focus().toggleHighlight().run(),isActive:e=>e.isActive(`highlight`),shortcut:`⌘ ⇧ H`}];function _C(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:vC},t[0]=n,t[1]=r);let i=Wt(r),a;t[2]!==i||t[3]!==n?(a=gC.map(e=>{let t=e.icon,r=i[e.name];return(0,Z.jsxs)(Gr,{children:[(0,Z.jsx)(cr,{asChild:!0,children:(0,Z.jsx)(Ni,{variant:`ghost`,size:`icon-xs`,"aria-label":e.name,className:r?`bg-accent text-primary`:`text-accent-foreground`,onMouseDown:t=>{t.preventDefault(),e.command(n)},children:(0,Z.jsx)(t,{className:`size-3.5`})})}),(0,Z.jsxs)(Qn,{side:`bottom`,sideOffset:8,children:[(0,Z.jsx)(`span`,{className:`capitalize`,children:e.name}),(0,Z.jsx)(_b,{children:zr()?e.shortcut:e.shortcut.replace(`⌘`,`Ctrl`)})]})]},e.name)}),t[2]=i,t[3]=n,t[4]=a):a=t[4];let o;return t[5]===a?o=t[6]:(o=(0,Z.jsx)(`div`,{className:`flex items-center gap-0.5`,children:a}),t[5]=a,t[6]=o),o}function vC(e){return Object.fromEntries(gC.map(t=>[t.name,t.isActive(e.editor)]))}function yC(e){let t=(0,$.c)(63),{editor:n}=e,{_:r}=i(),[a,o]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(``),u=(0,Q.useRef)(null),{folderPaths:d,loading:p,pages:m}=gi(),h;t[0]===n?h=t[1]:(h=n.isActive(`link`),t[0]=n,t[1]=h);let g=h,_;t[2]===n?_=t[3]:(_=n.getAttributes(`link`).href??``,t[2]=n,t[3]=_);let v=_,y,b;t[4]===n?(y=t[5],b=t[6]):(y=()=>{let e=function(){n.state.selection.empty&&o(!1)};return n.on(`selectionUpdate`,e),()=>{n.off(`selectionUpdate`,e)}},b=[n],t[4]=n,t[5]=y,t[6]=b),(0,Q.useEffect)(y,b);let x,S;t[7]!==v||t[8]!==a?(x=()=>{a&&(l(v),requestAnimationFrame(()=>u.current?.focus()))},S=[a,v],t[7]=v,t[8]=a,t[9]=x,t[10]=S):(x=t[9],S=t[10]),(0,Q.useEffect)(x,S);let C;t[11]!==n||t[12]!==g||t[13]!==c?(C=function(){c.trim()?n.chain().focus().setLink({href:c.trim()}).run():g&&n.chain().focus().unsetLink().run(),o(!1)},t[11]=n,t[12]=g,t[13]=c,t[14]=C):C=t[14];let w=C,T;t[15]===n?T=t[16]:(T=function(){n.chain().focus().unsetLink().run(),o(!1)},t[15]=n,t[16]=T);let E=T,D;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(D=function(e){l(he(e.path,null))},t[17]=D):D=t[17];let O=D,k;t[18]!==w||t[19]!==n?(k=function(e){e.key===`Enter`&&(e.preventDefault(),w()),e.key===`Escape`&&(e.preventDefault(),o(!1),n.chain().focus().run())},t[18]=w,t[19]=n,t[20]=k):k=t[20];let A=k;if(a){let e;t[21]===r?e=t[22]:(e=r({id:`ZsGpr_`}),t[21]=r,t[22]=e);let n;t[23]===r?n=t[24]:(n=r({id:`roAe2K`}),t[23]=r,t[24]=n);let i;t[25]!==d||t[26]!==A||t[27]!==p||t[28]!==m||t[29]!==e||t[30]!==n||t[31]!==c?(i=(0,Z.jsx)(ve,{ref:u,type:`text`,placeholder:e,value:c,pages:m,folderPaths:d,loading:p,onValueChange:l,onSuggestionSelect:O,onKeyDown:A,"aria-label":n,className:`h-5 w-44 rounded-none border-none bg-transparent px-0 py-0 text-sm placeholder:text-muted-foreground focus-visible:border-transparent focus-visible:ring-0 dark:bg-transparent`}),t[25]=d,t[26]=A,t[27]=p,t[28]=m,t[29]=e,t[30]=n,t[31]=c,t[32]=i):i=t[32];let a;t[33]===r?a=t[34]:(a=r({id:`tP5DDk`}),t[33]=r,t[34]=a);let o;t[35]===w?o=t[36]:(o=()=>{w()},t[35]=w,t[36]=o);let h;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(gc,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[37]=h):h=t[37];let _;t[38]!==a||t[39]!==o?(_=(0,Z.jsx)(Ni,{variant:`ghost`,size:`icon-xs`,"aria-label":a,onClick:o,children:h}),t[38]=a,t[39]=o,t[40]=_):_=t[40];let y;t[41]!==i||t[42]!==_?(y=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-md border bg-background px-2 py-1 focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`,children:[i,_]}),t[41]=i,t[42]=_,t[43]=y):y=t[43];let b;t[44]!==r||t[45]!==v||t[46]!==g||t[47]!==E?(b=g&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Gr,{children:[(0,Z.jsx)(cr,{asChild:!0,children:(0,Z.jsx)(Ni,{variant:`ghost`,size:`icon-xs`,"aria-label":r({id:`2vIPtm`}),onMouseDown:e=>{e.preventDefault(),xe(v)},children:(0,Z.jsx)(Fo,{className:`size-3.5`})})}),(0,Z.jsx)(Qn,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(s,{id:`2vIPtm`})})]}),(0,Z.jsxs)(Gr,{children:[(0,Z.jsx)(cr,{asChild:!0,children:(0,Z.jsx)(Ni,{variant:`ghost`,size:`icon-xs`,"aria-label":r({id:`484LKL`}),onMouseDown:e=>{e.preventDefault(),E()},children:(0,Z.jsx)(f,{className:`size-3.5`})})}),(0,Z.jsx)(Qn,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(s,{id:`484LKL`})})]})]}),t[44]=r,t[45]=v,t[46]=g,t[47]=E,t[48]=b):b=t[48];let x;return t[49]!==y||t[50]!==b?(x=(0,Z.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[y,b]}),t[49]=y,t[50]=b,t[51]=x):x=t[51],x}let j;t[52]===r?j=t[53]:(j=r({id:`p0Iq25`}),t[52]=r,t[53]=j);let M=g?`bg-accent text-primary`:`text-accent-foreground`,N,P;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(N=e=>{e.preventDefault(),o(!0)},P=(0,Z.jsx)(Nc,{className:`size-3.5`}),t[54]=N,t[55]=P):(N=t[54],P=t[55]);let F;t[56]!==j||t[57]!==M?(F=(0,Z.jsx)(cr,{asChild:!0,children:(0,Z.jsx)(Ni,{variant:`ghost`,size:`icon-xs`,"aria-label":j,className:M,onMouseDown:N,children:P})}),t[56]=j,t[57]=M,t[58]=F):F=t[58];let I;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(s,{id:`yzF66j`}),t[59]=I):I=t[59];let L;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsxs)(Qn,{side:`bottom`,sideOffset:8,children:[I,(0,Z.jsx)(_b,{children:zr()?`⌘ K`:`Ctrl K`})]}),t[60]=L):L=t[60];let R;return t[61]===F?R=t[62]:(R=(0,Z.jsxs)(Gr,{children:[F,L]}),t[61]=F,t[62]=R),R}function bC({editor:e}){if(Ft(e.state).query||e.isActive(`codeBlock`))return!1;if(hC(e)||uC(e))return!0;if(e.state.selection.empty)return!1;let{from:t,to:n}=e.state.selection;return!!e.state.doc.textBetween(t,n,` `).trim()}function xC(e){let t=(0,$.c)(22),{editor:n}=e,r=(0,Q.useRef)(null),[i,a]=(0,Q.useState)(0),o=(0,Q.useRef)(null),s;t[0]===n?s=t[1]:(s={editor:n,selector:EC},t[0]=n,t[1]=s);let c=Wt(s),l;t[2]===n?l=t[3]:(l={editor:n,selector:TC},t[2]=n,t[3]=l);let u=Wt(l),d;t[4]!==n.state||t[5]!==n.view?(d=()=>{try{let{from:e,to:t}=n.state.selection;return ui(n.view,e,t)}catch{return new DOMRect}},t[4]=n.state,t[5]=n.view,t[6]=d):d=t[6];let f;if(t[7]!==n.view.dom||t[8]!==d){let e={getBoundingClientRect:d,contextElement:n.view.dom};f=()=>{let t=r.current;t&&(o.current?.(),o.current=Hn(e,t,()=>{hr(e,t,{placement:`top`,strategy:`fixed`,middleware:[ci(8),br(),Kn({padding:8})]}).then(e=>{let{x:n,y:r}=e;t.isConnected&&(t.style.position=`fixed`,t.style.left=`${n}px`,t.style.top=`${r}px`)}).catch(wC)}))},t[7]=n.view.dom,t[8]=d,t[9]=f}else f=t[9];let p=f,m;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>{o.current?.(),o.current=null,a(CC)},t[10]=m):m=t[10];let h=m,g;t[11]===p?g=t[12]:(g={onShow:p,onHide:h,strategy:`fixed`},t[11]=p,t[12]=g);let _;t[13]!==n||t[14]!==u||t[15]!==c||t[16]!==i?(_=c?(0,Z.jsx)(pC,{editor:n},`${i}-img-align`):u?(0,Z.jsx)(cC,{editor:n},`${i}-file`):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(rC,{editor:n}),(0,Z.jsx)(mo,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(_C,{editor:n},i),(0,Z.jsx)(mo,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(yC,{editor:n},`${i}-link`)]}),t[13]=n,t[14]=u,t[15]=c,t[16]=i,t[17]=_):_=t[17];let v;return t[18]!==n||t[19]!==g||t[20]!==_?(v=(0,Z.jsx)(tC,{ref:r,editor:n,"data-testid":`bubble-menu-bar`,appendTo:SC,shouldShow:bC,updateDelay:250,options:g,className:`z-50 flex items-center gap-0.5 rounded-lg border bg-background p-1 shadow-md`,children:_}),t[18]=n,t[19]=g,t[20]=_,t[21]=v):v=t[21],v}function SC(){return document.body}function CC(e){return e+1}function wC(){}function TC(e){return uC(e.editor)}function EC(e){return hC(e.editor)}var DC=[{name:`addRowBefore`,icon:qe,label:`Add row above`,command:e=>e.chain().focus().addRowBefore().run()},{name:`addRowAfter`,icon:bt,label:`Add row below`,command:e=>e.chain().focus().addRowAfter().run()},{name:`deleteRow`,icon:f,label:`Delete row`,command:e=>e.chain().focus().deleteRow().run()}],OC=[{name:`addColumnBefore`,icon:Hi,label:`Add column left`,command:e=>e.chain().focus().addColumnBefore().run()},{name:`addColumnAfter`,icon:La,label:`Add column right`,command:e=>e.chain().focus().addColumnAfter().run()},{name:`deleteColumn`,icon:f,label:`Delete column`,command:e=>e.chain().focus().deleteColumn().run()}],kC=[{name:`toggleHeaderRow`,icon:ul,label:`Toggle header row`,command:e=>e.chain().focus().toggleHeaderRow().run()},{name:`toggleHeaderColumn`,icon:mc,label:`Toggle header column`,command:e=>e.chain().focus().toggleHeaderColumn().run()},{name:`deleteTable`,icon:Oc,label:`Delete table`,command:e=>e.chain().focus().deleteTable().run()}];function AC({editor:e}){return Ft(e.state).query?!1:e.isActive(`table`)}function jC(e){let t=(0,$.c)(14),{action:n,editor:r}=e,i=n.icon,a;t[0]!==n||t[1]!==r?(a=e=>{e.preventDefault(),n.command(r)},t[0]=n,t[1]=r,t[2]=a):a=t[2];let o;t[3]===i?o=t[4]:(o=(0,Z.jsx)(i,{className:`size-3.5`}),t[3]=i,t[4]=o);let s;t[5]!==n.label||t[6]!==a||t[7]!==o?(s=(0,Z.jsx)(cr,{asChild:!0,children:(0,Z.jsx)(Ni,{variant:`ghost`,size:`icon-xs`,"aria-label":n.label,className:`text-muted-foreground`,onMouseDown:a,children:o})}),t[5]=n.label,t[6]=a,t[7]=o,t[8]=s):s=t[8];let c;t[9]===n.label?c=t[10]:(c=(0,Z.jsx)(Qn,{side:`bottom`,sideOffset:8,children:n.label}),t[9]=n.label,t[10]=c);let l;return t[11]!==s||t[12]!==c?(l=(0,Z.jsxs)(Gr,{children:[s,c]}),t[11]=s,t[12]=c,t[13]=l):l=t[13],l}function MC(e){let t=(0,$.c)(13),{editor:n}=e,r;t[0]===n?r=t[1]:(r=DC.map(e=>(0,Z.jsx)(jC,{action:e,editor:n},e.name)),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(mo,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),t[2]=i):i=t[2];let a;t[3]===n?a=t[4]:(a=OC.map(e=>(0,Z.jsx)(jC,{action:e,editor:n},e.name)),t[3]=n,t[4]=a);let o;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(mo,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),t[5]=o):o=t[5];let s;t[6]===n?s=t[7]:(s=kC.map(e=>(0,Z.jsx)(jC,{action:e,editor:n},e.name)),t[6]=n,t[7]=s);let c;return t[8]!==n||t[9]!==r||t[10]!==a||t[11]!==s?(c=(0,Z.jsxs)(tC,{editor:n,"data-testid":`table-controls-menu`,shouldShow:AC,updateDelay:100,className:`flex items-center gap-0.5 rounded-lg border bg-background p-1 shadow-md`,children:[r,i,a,o,s]}),t[8]=n,t[9]=r,t[10]=a,t[11]=s,t[12]=c):c=t[12],c}var NC=new WeakMap;function PC(e){let t=document.createElement(`span`);t.classList.add(`collaboration-cursor__caret`),t.style.borderColor=e.color;let n=document.createElement(`div`);return n.classList.add(`collaboration-cursor__label`),n.style.backgroundColor=e.color,n.style.color=Gn(e.color),n.textContent=e.name,t.append(n),t}var FC={state:`idle`,count:0,lastFiredAt:null,position:`append`,lastAgentId:null},IC=100,LC=100,RC=3,zC=250;function BC(){let e=new yr({extensions:$n});return{mdManager:e,text:Ee({mdManager:e}),html:I({mdManager:e}),paste:ke({mdManager:e}),drop:J({mdManager:e})}}function VC(e){let{provider:t,placeholder:n,prebuiltMapping:r}=e;return[...yt.map(e=>e.name===`link`||e.name===`wikiLink`||e.name===`jsxComponent`?e.configure({docName:t.configuration.name??``}):e.name===`toggleHeadings`?e.configure({getDocName:()=>t.configuration.name??null}):e),_S.configure({placeholder:n??`Type '/' for commands`,showOnlyCurrent:!0}),z.configure({document:t.document,...r?{ySyncOptions:{mapping:r}}:{}}),Wn.create({name:`imageUploadDecoration`,addProseMirrorPlugins(){return[Ot]}}),Wn.create({name:`collaborationCursor`,addProseMirrorPlugins(){let e=t.awareness;if(!e)throw Error(`[TiptapEditor] HocuspocusProvider has no awareness instance — cursor plugin cannot initialize`);return[pt(e,{cursorBuilder:PC})]}})]}function HC(e){let{provider:t,clipboard:n,ctorStart:r}=e;return{onBeforeCreate:({editor:e})=>{NC.set(e,r)},onCreate:({editor:e})=>{n.html.setView(e.view);let r=NC.get(e);if(NC.delete(e),r==null)return;let i=performance.now();Ht(`ok/editor/create-tiptap`,{docName:t.configuration.name??`unknown`,ytextLength:t.document.getText(`source`).length},{startTime:r,duration:Math.max(0,i-r)})},editorProps:{attributes:{class:`pt-4 pb-4 h-full`},clipboardTextParser:(e,t,r,i)=>{let a=n.mdManager.parse(e);return i.state.schema.nodeFromJSON(a).content},clipboardTextSerializer:(e,t)=>n.text(e,t),clipboardSerializer:n.html.serializer,handlePaste:(e,t)=>n.paste(e,t),handleDrop:(e,t)=>n.drop(e,t)},extensions:xf(VC(e))}}function UC(e){let{provider:t,placeholder:n,clipboard:r,ctorStart:i}=e,a=Er(VC({provider:t,placeholder:n,clipboard:r,ctorStart:i})),{doc:o,mapping:s}=At(t.document.getXmlFragment(`default`),a);return{...HC({provider:t,placeholder:n,clipboard:r,ctorStart:i,prebuiltMapping:s}),content:o.toJSON(),element:null}}var WC=e=>{let t=(0,$.c)(21),{provider:n,placeholder:r,isSourceMode:i,portalTarget:a}=e,o=(0,Q.useRef)(null),s=(0,Q.useRef)(FC),c=CS(),{principal:l,activeDocName:u}=ft(),d=n.configuration.name??``,[f]=(0,Q.useState)(BC),p;t[0]!==f||t[1]!==r||t[2]!==n?(p=()=>()=>({editor:new vr(UC({provider:n,placeholder:r,clipboard:f,ctorStart:performance.now()})),ydoc:n.document,ytext:n.document.getText(`source`),provider:n}),t[0]=f,t[1]=r,t[2]=n,t[3]=p):p=t[3];let[m]=(0,Q.useState)(p),h,g;if(t[4]!==m||t[5]!==d||t[6]!==n.document){let e={viewCount:0,bytes:n.document.getText(`source`).length},r=K(d)??crypto.randomUUID();h=Q.use,g=ot({docName:d,mountId:r,construct:m,sizeStats:e}),t[4]=m,t[5]=d,t[6]=n.document,t[7]=h,t[8]=g}else h=t[7],g=t[8];let _=h(g),v=_.editor,b,x;t[9]===_?(b=t[10],x=t[11]):(b=()=>()=>{y(_)},x=[_],t[9]=_,t[10]=b,t[11]=x),(0,Q.useEffect)(b,x);let S;return t[12]!==u||t[13]!==d||t[14]!==v||t[15]!==c||t[16]!==i||t[17]!==a||t[18]!==l||t[19]!==n?(S=(0,Z.jsx)(GC,{provider:n,isSourceMode:i,docName:d,activeDocName:u,identity:c,principal:l,editor:v,wrapperRef:o,flashStateRef:s,portalTarget:a}),t[12]=u,t[13]=d,t[14]=v,t[15]=c,t[16]=i,t[17]=a,t[18]=l,t[19]=n,t[20]=S):S=t[20],S},GC=e=>{let t=(0,$.c)(85),{provider:n,isSourceMode:r,docName:i,activeDocName:a,identity:o,principal:s,editor:c,wrapperRef:l,flashStateRef:u,portalTarget:f}=e,p=(0,Q.useRef)(null),m,h;t[0]===f?(m=t[1],h=t[2]):(m=()=>{let e=p.current;if(e)return e.appendChild(f),()=>{f.parentNode===e&&e.removeChild(f)}},h=[f],t[0]=f,t[1]=m,t[2]=h),(0,Q.useLayoutEffect)(m,h);let g;t[3]!==c||t[4]!==n.configuration.name?(g=()=>(lt(c,n.configuration.name??null),()=>{lt(c,null)}),t[3]=c,t[4]=n.configuration.name,t[5]=g):g=t[5];let _;t[6]!==c||t[7]!==n?(_=[c,n],t[6]=c,t[7]=n,t[8]=_):_=t[8],(0,Q.useEffect)(g,_);let v;t[9]!==c||t[10]!==n.configuration.name?(v=()=>{let e=n.configuration.name;if(e)return D(e,c),()=>U(e,c)},t[9]=c,t[10]=n.configuration.name,t[11]=v):v=t[11];let y;t[12]!==c||t[13]!==n?(y=[c,n],t[12]=c,t[13]=n,t[14]=y):y=t[14],(0,Q.useEffect)(v,y);let b;t[15]!==c||t[16]!==n.configuration.name?(b=()=>{},t[15]=c,t[16]=n.configuration.name,t[17]=b):b=t[17];let x;t[18]!==c||t[19]!==n?(x=[c,n],t[18]=c,t[19]=n,t[20]=x):x=t[20],(0,Q.useEffect)(b,x);let S,C;t[21]===c?(S=t[22],C=t[23]):(C=()=>{let e=KC,t=null,n=()=>{if(t||c.isDestroyed)return;let n=fe(c);n&&(t=n.dom,t.addEventListener(`keydown`,e),t.addEventListener(`paste`,e),t.addEventListener(`drop`,e),t.addEventListener(`cut`,e))},r=()=>{t&&=(t.removeEventListener(`keydown`,e),t.removeEventListener(`paste`,e),t.removeEventListener(`drop`,e),t.removeEventListener(`cut`,e),null)};return fe(c)?n():c.on(`create`,n),()=>{c.off(`create`,n),r()}},S=[c],t[21]=c,t[22]=S,t[23]=C),(0,Q.useEffect)(C,S);let w,T;t[24]!==i||t[25]!==c?(w=()=>{let e=!1,t=()=>{if(e||c.isDestroyed||!fe(c))return;e=!0;let t=Vt(i)?.selection??null;if(t)try{let e=c.state.doc.content.size;if(t.type===`text`){let n=Math.max(0,Math.min(t.anchor,e)),r=Math.max(0,Math.min(t.head,e));c.commands.setTextSelection({from:n,to:r})}else{let n=Math.max(0,Math.min(t.from,e));c.commands.setNodeSelection(n)}}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(JSON.stringify({event:`ok-editor-selection-restore-failed`,docName:i,message:n})),Ht(`ok/editor/selection-restore-failed`,{docName:i,message:n})}Le(i)};if(fe(c)){t();return}return c.on(`create`,t),()=>{c.off(`create`,t)}},T=[c,i],t[24]=i,t[25]=c,t[26]=w,t[27]=T):(w=t[26],T=t[27]),(0,Q.useEffect)(w,T);let E,O;t[28]!==u||t[29]!==n.document||t[30]!==l?(E=()=>{let e=n.document.getMap(`agent-flash`),t=Date.now(),r=0,i=null,a=null,o=null,s=()=>{let t=null;for(let[,n]of e.entries()){let e=n;e.timestamp&&(!t||e.timestamp>t.timestamp)&&(t={agentId:e.agentId??`unknown`,timestamp:e.timestamp,type:e.type??`insert`,description:e.description})}return t},c=e=>{u.current=e;let t=l.current;t&&(t.setAttribute(`data-agent-flash-state`,e.state),t.setAttribute(`data-agent-flash-count`,String(e.count)),t.setAttribute(`data-agent-flash-position`,e.position),t.setAttribute(`data-agent-flash-agent-id`,e.lastAgentId??``))},d=()=>{let e=s(),t=e?.description?.toLowerCase().includes(`prepend`)?`prepend`:`append`,n={state:`editing`,count:(u.current?.count??0)+1,lastFiredAt:Date.now(),position:t,lastAgentId:e?.agentId??null};c(n),document.dispatchEvent(new CustomEvent(`agent-flash`,{detail:n})),a&&clearTimeout(a),o&&clearTimeout(o),a=window.setTimeout(()=>{let e={...n,state:`settled`};c(e),document.dispatchEvent(new CustomEvent(`agent-flash-end`,{detail:e})),o=window.setTimeout(()=>{c({...e,state:`idle`})},300)},Qr)};c(FC);let f=()=>{if(Xn(e),!Yn(e,t)||document.visibilityState!==`visible`)return;let n=Date.now();if(t=n,n-r<500){if(!i){let e=500-(n-r);i=window.setTimeout(()=>{i=null,r=Date.now(),d()},e)}return}r=n,d()};e.observe(f);let p=()=>{document.visibilityState===`visible`?Yn(e,t)&&(t=Date.now(),r=Date.now(),d()):t=Date.now()};return document.addEventListener(`visibilitychange`,p),()=>{e.unobserve(f),document.removeEventListener(`visibilitychange`,p),i&&clearTimeout(i),a&&clearTimeout(a),o&&clearTimeout(o)}},O=[n.document,u,l],t[28]=u,t[29]=n.document,t[30]=l,t[31]=E,t[32]=O):(E=t[31],O=t[32]),(0,Q.useEffect)(E,O);let k,A;t[33]!==a||t[34]!==i||t[35]!==c||t[36]!==n?(k=()=>{let e=0,t,r=null,o=null,s=null,l=function(){if(e<IC){e+=1,t=window.setTimeout(p,LC);return}r=null,o=null,e=0},u=function(e){let t=fe(c);if(!t)return null;let n=CSS.escape(e);return t.dom.querySelector(`#${n}`)??t.dom.querySelector(`[data-mirror-source-id="${n}"]`)},d=function(e){let t=u(e);return t?(t.scrollIntoView({behavior:`smooth`,block:`start`}),!0):!1},f=function(e,n){let r=RC,o=()=>{t=void 0,!(i!==a||window.location.hash!==n)&&(d(e),--r,r>0&&(t=window.setTimeout(o,zC)))};t=window.setTimeout(o,zC)};function p(){if(!r||i!==a)return;let t=r,n=o;if(!n){l();return}d(t)?(s=n,r=null,o=null,e=0,f(t,n)):l()}let m=function(){if(i!==a)return;let n=window.location.hash;if(!r&&s===n)return;let c=ri(n);if(!c){s=n;return}r=c,o=n,e=0,t!==void 0&&(clearTimeout(t),t=void 0),p()},h=function(){if(i===a){if(r){p();return}m()}};return m(),n.on(`synced`,h),c.on(`transaction`,h),window.addEventListener(`hashchange`,m),()=>{t!==void 0&&clearTimeout(t),n.off(`synced`,h),c.off(`transaction`,h),window.removeEventListener(`hashchange`,m)}},A=[n,c,i,a],t[33]=a,t[34]=i,t[35]=c,t[36]=n,t[37]=k,t[38]=A):(k=t[37],A=t[38]),(0,Q.useEffect)(k,A);let j,M;t[39]===c?(j=t[40],M=t[41]):(j=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`wysiwyg`||c.isDestroyed)return;let n=fe(c);if(!n)return;let r=n.dom.querySelectorAll(`h1, h2, h3, h4, h5, h6`)[t.index];r&&r.scrollIntoView({behavior:`smooth`,block:`start`})};return window.addEventListener(Ps,e),()=>window.removeEventListener(Ps,e)},M=[c],t[39]=c,t[40]=j,t[41]=M),(0,Q.useEffect)(j,M);let N;t[42]!==a||t[43]!==i||t[44]!==o||t[45]!==r||t[46]!==s||t[47]!==n.awareness?(N=()=>{let e=n.awareness;if(e){if(i!==a){e.setLocalState(null);return}e.setLocalState({user:wS({principal:s,identity:o}),mode:r?`source`:`wysiwyg`})}},t[42]=a,t[43]=i,t[44]=o,t[45]=r,t[46]=s,t[47]=n.awareness,t[48]=N):N=t[48];let P;t[49]!==a||t[50]!==i||t[51]!==o||t[52]!==r||t[53]!==s||t[54]!==n?(P=[n,i,a,o,s,r],t[49]=a,t[50]=i,t[51]=o,t[52]=r,t[53]=s,t[54]=n,t[55]=P):P=t[55],(0,Q.useEffect)(N,P);let F,I;t[56]!==c||t[57]!==r?(F=()=>(d(c,r),()=>{d(c,!1)}),I=[c,r],t[56]=c,t[57]=r,t[58]=F,t[59]=I):(F=t[58],I=t[59]),(0,Q.useEffect)(F,I);let L;t[60]!==c||t[61]!==r?(L=!r&&(0,Z.jsx)(xC,{editor:c}),t[60]=c,t[61]=r,t[62]=L):L=t[62];let R;t[63]!==c||t[64]!==r?(R=!r&&(0,Z.jsx)(MC,{editor:c}),t[63]=c,t[64]=r,t[65]=R):R=t[65];let z;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsx)(`div`,{ref:p,style:{display:`contents`}}),t[66]=z):z=t[66];let B;t[67]===c?B=t[68]:(B=(0,Z.jsx)(Xe,{editor:c,className:`tiptap-editor-portal-content h-full`}),t[67]=c,t[68]=B);let V;t[69]!==f||t[70]!==B?(V=(0,rc.createPortal)(B,f),t[69]=f,t[70]=B,t[71]=V):V=t[71];let H;t[72]===c?H=t[73]:(H=(0,Z.jsx)(xS,{editor:c}),t[72]=c,t[73]=H);let W;t[74]===c?W=t[75]:(W=Fe(c),t[74]=c,t[75]=W);let G;t[76]===W.store?G=t[77]:(G=(0,Z.jsx)(vt,{store:W.store}),t[76]=W.store,t[77]=G);let K;return t[78]!==L||t[79]!==R||t[80]!==V||t[81]!==H||t[82]!==G||t[83]!==l?(K=(0,Z.jsxs)(`div`,{ref:l,className:`tiptap-editor h-full`,"data-agent-flash-state":`idle`,"data-agent-flash-count":`0`,"data-agent-flash-position":`append`,"data-agent-flash-agent-id":``,children:[L,R,z,V,H,G]}),t[78]=L,t[79]=R,t[80]=V,t[81]=H,t[82]=G,t[83]=l,t[84]=K):K=t[84],K};function KC(){return C()}async function qC(){try{let e=await fetch(`/api/sync/conflicts`);return e.ok?{conflicts:(await e.json()).conflicts??[]}:(console.warn(JSON.stringify({event:`conflicts-fetch-failed`,status:e.status})),{conflicts:[],error:`server`})}catch(e){return console.warn(JSON.stringify({event:`conflicts-fetch-failed`,status:null,detail:e instanceof Error?e.message:String(e)})),{conflicts:[],error:`network`}}}function JC(){let e=(0,$.c)(10),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0];let[n,r]=(0,Q.useState)(t),[i,a]=(0,Q.useState)(!0),[o,s]=(0,Q.useState)(null),c=(0,Q.useRef)(0),l;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(l=function(){let e=c.current+=1;qC().then(t=>{let{conflicts:n,error:i}=t;e===c.current&&(r(n),s(i??null),a(!1))})},e[1]=l):l=e[1];let u=l,d,f;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>{u()},f=[],e[2]=d,e[3]=f):(d=e[2],f=e[3]),(0,Q.useEffect)(d,f);let p,m;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>yi(e=>{e.includes(`sync-status`)&&u()}),m=[],e[4]=p,e[5]=m):(p=e[4],m=e[5]),(0,Q.useEffect)(p,m);let h;return e[6]!==n||e[7]!==o||e[8]!==i?(h={conflicts:n,loading:i,error:o},e[6]=n,e[7]=o,e[8]=i,e[9]=h):h=e[9],h}var YC=class e{constructor(e,t,n,r){this.fromA=e,this.toA=t,this.fromB=n,this.toB=r}offset(t,n=t){return new e(this.fromA+t,this.toA+t,this.fromB+n,this.toB+n)}};function XC(e,t,n,r,i,a){if(e==r)return[];let o=ow(e,t,n,r,i,a),s=sw(e,t+o,n,r,i+o,a);t+=o,n-=s,i+=o,a-=s;let c=n-t,l=a-i;if(!c||!l)return[new YC(t,n,i,a)];if(c>l){let o=e.slice(t,n).indexOf(r.slice(i,a));if(o>-1)return[new YC(t,t+o,i,i),new YC(t+o+l,n,a,a)]}else if(l>c){let o=r.slice(i,a).indexOf(e.slice(t,n));if(o>-1)return[new YC(t,t,i,i+o),new YC(n,n,i+o+c,a)]}if(c==1||l==1)return[new YC(t,n,i,a)];let u=lw(e,t,n,r,i,a);if(u){let[o,s,c]=u;return XC(e,t,o,r,i,s).concat(XC(e,o+c,n,r,s+c,a))}return ew(e,t,n,r,i,a)}var ZC=1e9,QC=0,$C=!1;function ew(e,t,n,r,i,a){let o=n-t,s=a-i;if(ZC<1e9&&Math.min(o,s)>ZC*16||QC>0&&Date.now()>QC)return Math.min(o,s)>ZC*64?[new YC(t,n,i,a)]:uw(e,t,n,r,i,a);let c=Math.ceil((o+s)/2);nw.reset(c),rw.reset(c);let l=(n,a)=>e.charCodeAt(t+n)==r.charCodeAt(i+a),u=(t,i)=>e.charCodeAt(n-t-1)==r.charCodeAt(a-i-1),d=(o-s)%2==0?null:rw,f=d?null:nw;for(let p=0;p<c;p++){if(p>ZC||QC>0&&!(p&63)&&Date.now()>QC)return uw(e,t,n,r,i,a);let m=nw.advance(p,o,s,c,d,!1,l)||rw.advance(p,o,s,c,f,!0,u);if(m)return iw(e,t,n,t+m[0],r,i,a,i+m[1])}return[new YC(t,n,i,a)]}var tw=class{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let e=0;e<this.len;e++)this.vec[e]=-1;this.vec[e+1]=0,this.start=this.end=0}advance(e,t,n,r,i,a,o){for(let s=-e+this.start;s<=e-this.end;s+=2){let c=r+s,l=s==-e||s!=e&&this.vec[c-1]<this.vec[c+1]?this.vec[c+1]:this.vec[c-1]+1,u=l-s;for(;l<t&&u<n&&o(l,u);)l++,u++;if(this.vec[c]=l,l>t)this.end+=2;else if(u>n)this.start+=2;else if(i){let e=r+(t-n)-s;if(e>=0&&e<this.len&&i.vec[e]!=-1)if(a){let n=i.vec[e];if(n>=t-l)return[n,r+n-e]}else{let n=t-i.vec[e];if(l>=n)return[l,u]}}}return null}},nw=new tw,rw=new tw;function iw(e,t,n,r,i,a,o,s){let c=!1;return!Tw(e,r)&&++r==n&&(c=!0),!Tw(i,s)&&++s==o&&(c=!0),c?[new YC(t,n,a,o)]:XC(e,t,r,i,a,s).concat(XC(e,r,n,i,s,o))}function aw(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n<<=1;return n}function ow(e,t,n,r,i,a){if(t==n||t==a||e.charCodeAt(t)!=r.charCodeAt(i))return 0;let o=aw(n-t,a-i);for(let s=t,c=i;;){let i=s+o,l=c+o;if(i>n||l>a||e.slice(s,i)!=r.slice(c,l)){if(o==1)return s-t-+!Tw(e,s);o>>=1}else if(i==n||l==a)return i-t;else s=i,c=l}}function sw(e,t,n,r,i,a){if(t==n||i==a||e.charCodeAt(n-1)!=r.charCodeAt(a-1))return 0;let o=aw(n-t,a-i);for(let s=n,c=a;;){let a=s-o,l=c-o;if(a<t||l<i||e.slice(a,s)!=r.slice(l,c)){if(o==1)return n-s-+!Tw(e,s);o>>=1}else if(a==t||l==i)return n-a;else s=a,c=l}}function cw(e,t,n,r,i,a,o,s){let c=r.slice(i,a),l=null;for(;;){if(l||o<s)return l;for(let s=t+o;;){Tw(e,s)||s++;let u=s+o;if(Tw(e,u)||(u+=u==s+1?1:-1),u>=n)break;let d=e.slice(s,u),f=-1;for(;(f=c.indexOf(d,f+1))!=-1;){let o=ow(e,u,n,r,i+f+d.length,a),c=sw(e,t,s,r,i,i+f),p=d.length+o+c;(!l||l[2]<p)&&(l=[s-c,i+f-c,p])}s=u}if(s<0)return l;o>>=1}}function lw(e,t,n,r,i,a){let o=n-t,s=a-i;if(o<s){let o=lw(r,i,a,e,t,n);return o&&[o[1],o[0],o[2]]}return o<4||s*2<o?null:cw(e,t,n,r,i,a,Math.floor(o/4),-1)}function uw(e,t,n,r,i,a){$C=!0;let o=n-t,s=a-i,c;if(o<s){let s=cw(r,i,a,e,t,n,Math.floor(o/6),50);c=s&&[s[1],s[0],s[2]]}else c=cw(e,t,n,r,i,a,Math.floor(s/6),50);if(!c)return[new YC(t,n,i,a)];let[l,u,d]=c;return XC(e,t,l,r,i,u).concat(XC(e,l+d,n,r,u+d,a))}function dw(e,t){for(let n=1;n<e.length;n++){let r=e[n-1],i=e[n];r.toA>i.fromA-t&&r.toB>i.fromB-t&&(e[n-1]=new YC(r.fromA,i.toA,r.fromB,i.toB),e.splice(n--,1))}}function fw(e,t,n){for(;;){dw(n,1);let r=!1;for(let i=0;i<n.length;i++){let a=n[i],o,s;(o=ow(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new YC(a.fromA+o,a.toA,a.fromB+o,a.toB)),(s=sw(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new YC(a.fromA,a.toA-s,a.fromB,a.toB-s));let c=a.toA-a.fromA,l=a.toB-a.fromB;if(c&&l)continue;let u=a.fromA-(i?n[i-1].toA:0),d=(i<n.length-1?n[i+1].fromA:e.length)-a.toA;if(!u||!d)continue;let f=c?e.slice(a.fromA,a.toA):t.slice(a.fromB,a.toB);u<=f.length&&e.slice(a.fromA-u,a.fromA)==f.slice(f.length-u)?(n[i]=new YC(a.fromA-u,a.toA-u,a.fromB-u,a.toB-u),r=!0):d<=f.length&&e.slice(a.toA,a.toA+d)==f.slice(0,d)&&(n[i]=new YC(a.fromA+d,a.toA+d,a.fromB+d,a.toB+d),r=!0)}if(!r)break}return n}function pw(e,t,n){for(let r=0,i=0;i<e.length;i++){let a=e[i],o=a.toA-a.fromA,s=a.toB-a.fromB;if(o&&s||o>3||s>3){let c=i==e.length-1?t.length:e[i+1].fromA,l=a.fromA-r,u=c-a.toA,d=bw(t,a.fromA,l),f=yw(t,a.toA,u),p=a.fromA-d,m=f-a.toA;if((!o||!s)&&p&&m){let l=Math.max(o,s),[u,h,g]=o?[t,a.fromA,a.toA]:[n,a.fromB,a.toB];l>p&&t.slice(d,a.fromA)==u.slice(g-p,g)?(a=e[i]=new YC(d,d+o,a.fromB-p,a.toB-p),d=a.fromA,f=yw(t,a.toA,c-a.toA)):l>m&&t.slice(a.toA,f)==u.slice(h,h+m)&&(a=e[i]=new YC(f-o,f,a.fromB+m,a.toB+m),f=a.toA,d=bw(t,a.fromA,a.fromA-r)),p=a.fromA-d,m=f-a.toA}if(p||m)a=e[i]=new YC(a.fromA-p,a.toA+m,a.fromB-p,a.toB+m);else if(!o){let t=Sw(n,a.fromB,a.toB),r,o=t<0?-1:xw(n,a.toB,a.fromB);t>-1&&(r=t-a.fromB)<=u&&n.slice(a.fromB,t)==n.slice(a.toB,a.toB+r)?a=e[i]=a.offset(r):o>-1&&(r=a.toB-o)<=l&&n.slice(a.fromB-r,a.fromB)==n.slice(o,a.toB)&&(a=e[i]=a.offset(-r))}else if(!s){let n=Sw(t,a.fromA,a.toA),r,o=n<0?-1:xw(t,a.toA,a.fromA);n>-1&&(r=n-a.fromA)<=u&&t.slice(a.fromA,n)==t.slice(a.toA,a.toA+r)?a=e[i]=a.offset(r):o>-1&&(r=a.toA-o)<=l&&t.slice(a.fromA-r,a.fromA)==t.slice(o,a.toA)&&(a=e[i]=a.offset(-r))}}r=a.toA}return dw(e,3),e}var mw;try{mw=RegExp(`[\\p{Alphabetic}\\p{Number}]`,`u`)}catch{}function hw(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function gw(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?+!!hw(n):mw?!Cw(n)||t==e.length-1?+!!mw.test(String.fromCharCode(n)):mw.test(e.slice(t,t+2))?2:0:0}function _w(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?+!!hw(n):mw?!ww(n)||t==1?+!!mw.test(String.fromCharCode(n)):mw.test(e.slice(t-2,t))?2:0:0}var vw=8;function yw(e,t,n){if(t==e.length||!_w(e,t))return t;for(let r=t,i=t+n,a=0;a<vw;a++){let t=gw(e,r);if(!t||r+t>i)return r;r+=t}return t}function bw(e,t,n){if(!t||!gw(e,t))return t;for(let r=t,i=t-n,a=0;a<vw;a++){let t=_w(e,r);if(!t||r-t<i)return r;r-=t}return t}function xw(e,t,n){for(;t!=n;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function Sw(e,t,n){for(;t!=n;t++)if(e.charCodeAt(t)==10)return t;return-1}var Cw=e=>e>=55296&&e<=56319,ww=e=>e>=56320&&e<=57343;function Tw(e,t){return!t||t==e.length||!Cw(e.charCodeAt(t-1))||!ww(e.charCodeAt(t))}function Ew(e,t,n){let r=n?.override;return r?r(e,t):(ZC=(n?.scanLimit??1e9)>>1,QC=n?.timeout?Date.now()+n.timeout:0,$C=!1,fw(e,t,XC(e,0,e.length,t,0,t.length)))}function Dw(){return!$C}function Ow(e,t,n){return pw(Ew(e,t,n),e,t)}var kw=xs.define({combine:e=>e[0]}),Aw=Ss.define(),jw=xs.define(),Mw=gs.define({create(e){return null},update(e,t){for(let n of t.effects)n.is(Aw)&&(e=n.value);for(let n of t.state.facet(jw))e=n(e,t);return e}});function Nw(e){let t=e.field(Mw,!1);if(!t)return null;let n=e.facet(kw);return{chunks:t,side:n?n.side:null}}var Pw=class e{constructor(e,t,n,r,i,a=!0){this.changes=e,this.fromA=t,this.toA=n,this.fromB=r,this.toB=i,this.precise=a}offset(t,n){return t||n?new e(this.changes,this.fromA+t,this.toA+t,this.fromB+n,this.toB+n,this.precise):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(e,t,n){return Lw(Ow(e.toString(),t.toString(),n),e,t,0,0,Dw())}static updateA(e,t,n,r,i){return Vw(Bw(e,r,!0,n.length),e,t,n,i)}static updateB(e,t,n,r,i){return Vw(Bw(e,r,!1,t.length),e,t,n,i)}};function Fw(e,t,n,r){let i=n.lineAt(e),a=r.lineAt(t);return i.to==e&&a.to==t&&e<n.length&&t<r.length?[e+1,t+1]:[i.from,a.from]}function Iw(e,t,n,r){let i=n.lineAt(e),a=r.lineAt(t);return i.from==e&&a.from==t?[e,t]:[i.to+1,a.to+1]}function Lw(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length;s++){let c=e[s],[l,u]=Fw(c.fromA+r,c.fromB+i,t,n),[d,f]=Iw(c.toA+r,c.toB+i,t,n),p=[c.offset(-l+r,-u+i)];for(;s<e.length-1;){let a=e[s+1],[o,c]=Fw(a.fromA+r,a.fromB+i,t,n);if(o>d+1&&c>f+1)break;p.push(a.offset(-l+r,-u+i)),[d,f]=Iw(a.toA+r,a.toB+i,t,n),s++}o.push(new Pw(p,l,Math.max(l,d),u,Math.max(u,f),a))}return o}var Rw=1e3;function zw(e,t,n,r){let i=0,a=e.length;for(;;){if(i==a){let r=0,a=0;i&&({toA:r,toB:a}=e[i-1]);let o=t-(n?r:a);return[r+o,a+o]}let o=i+a>>1,s=e[o],[c,l]=n?[s.fromA,s.toA]:[s.fromB,s.toB];if(c>t)a=o;else if(l<=t)i=o+1;else return r?[s.fromA,s.fromB]:[s.toA,s.toB]}}function Bw(e,t,n,r){let i=[];return t.iterChangedRanges((a,o,s,c)=>{let l=0,u=n?t.length:r,d=0,f=n?r:t.length;a>Rw&&([l,d]=zw(e,a-Rw,n,!0)),o<t.length-Rw&&([u,f]=zw(e,o+Rw,n,!1));let p=c-s-(o-a),m,[h,g]=n?[p,0]:[0,p];i.length&&(m=i[i.length-1]).toA>=l?i[i.length-1]={fromA:m.fromA,fromB:m.fromB,toA:u,toB:f,diffA:m.diffA+h,diffB:m.diffB+g}:i.push({fromA:l,toA:u,fromB:d,toB:f,diffA:h,diffB:g})}),i}function Vw(e,t,n,r,i){if(!e.length)return t;let a=[];for(let o=0,s=0,c=0,l=0;;o++){let u=o==e.length?null:e[o],d=u?u.fromA+s:n.length,f=u?u.fromB+c:r.length;for(;l<t.length;){let e=t[l];if(u&&(e.toA+s>d||e.toB+c>f))break;a.push(e.offset(s,c)),l++}if(!u)break;let p=u.toA+s+u.diffA,m=u.toB+c+u.diffB,h=Ow(n.sliceString(d,p),r.sliceString(f,m),i);for(let e of Lw(h,n,r,d,f,Dw()))a.push(e);for(s+=u.diffA,c+=u.diffB;l<t.length;){let e=t[l];if(e.fromA+s>p&&e.fromB+c>m)break;l++}}return a}var Hw={scanLimit:500},Uw=Cs.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=$w(e))}update(e){(e.docChanged||e.viewportChanged||Gw(e.startState,e.state)||Kw(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=$w(e.view))}},{decorations:e=>e.deco}),Ww=ps.low(Ds({class:`cm-changeGutter`,markers:e=>e.plugin(Uw)?.gutter||As.empty}));function Gw(e,t){return e.field(Mw,!1)!=t.field(Mw,!1)}function Kw(e,t){return e.facet(kw)!=t.facet(kw)}var qw=ys.line({class:`cm-changedLine`}),Jw=ys.mark({class:`cm-changedText`}),Yw=ys.mark({tagName:`ins`,class:`cm-insertedLine`}),Xw=ys.mark({tagName:`del`,class:`cm-deletedLine`}),Zw=new class extends Es{constructor(){super(...arguments),this.elementClass=`cm-changedLineGutter`}};function Qw(e,t,n,r,i,a){let o=n?e.fromA:e.fromB,s=n?e.toA:e.toB,c=0;if(o!=s){i.add(o,o,qw),i.add(o,s,n?Xw:Yw),a&&a.add(o,o,Zw);for(let l=t.iterRange(o,s-1),u=o;!l.next().done;){if(l.lineBreak){u++,i.add(u,u,qw),a&&a.add(u,u,Zw);continue}let t=u+l.value.length;if(r)for(;c<e.changes.length;){let r=e.changes[c],a=o+(n?r.fromA:r.fromB),s=o+(n?r.toA:r.toB),l=Math.max(u,a),d=Math.min(t,s);if(l<d&&i.add(l,d,Jw),s<t)c++;else break}u=t}}}function $w(e){let t=e.state.field(Mw),{side:n,highlightChanges:r,markGutter:i,overrideChunk:a}=e.state.facet(kw),o=n==`a`,s=new bs,c=i?new bs:null,{from:l,to:u}=e.viewport;for(let n of t){if((o?n.fromA:n.fromB)>=u)break;(o?n.toA:n.toB)>l&&(!a||!a(e.state,n,s,c))&&Qw(n,e.state.doc,o,r,s,c)}return{deco:s.finish(),gutter:c&&c.finish()}}var eT=class extends fs{constructor(e){super(),this.height=e}eq(e){return this.height==e.height}toDOM(){let e=document.createElement(`div`);return e.className=`cm-mergeSpacer`,e.style.height=this.height+`px`,e}updateDOM(e){return e.style.height=this.height+`px`,!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}},tT=Ss.define({map:(e,t)=>e.map(t)}),nT=gs.define({create:()=>ys.none,update:(e,t)=>{for(let e of t.effects)if(e.is(tT))return e.value;return e.map(t.changes)},provide:e=>Ts.decorations.from(e)}),rT=.01;function iT(e,t){if(e.size!=t.size)return!1;let n=e.iter(),r=t.iter();for(;n.value;){if(n.from!=r.from||Math.abs(n.value.spec.widget.height-r.value.spec.widget.height)>1)return!1;n.next(),r.next()}return!0}function aT(e,t,n){let r=new bs,i=new bs,a=e.state.field(nT).iter(),o=t.state.field(nT).iter(),s=0,c=0,l=0,u=0,d=e.viewport,f=t.viewport;for(let p=0;;p++){let m=p<n.length?n[p]:null,h=m?m.fromA:e.state.doc.length,g=m?m.fromB:t.state.doc.length;if(s<h){let n=e.lineBlockAt(s).top+l-(t.lineBlockAt(c).top+u);n<-rT?(l-=n,r.add(s,s,ys.widget({widget:new eT(-n),block:!0,side:-1}))):n>rT&&(u+=n,i.add(c,c,ys.widget({widget:new eT(n),block:!0,side:-1})))}if(h>s+1e3&&s<d.from&&h>d.from&&c<f.from&&g>f.from){let e=Math.min(d.from-s,f.from-c);s+=e,c+=e,p--}else if(m)s=m.toA,c=m.toB;else break;for(;a.value&&a.from<s;)l-=a.value.spec.widget.height,a.next();for(;o.value&&o.from<c;)u-=o.value.spec.widget.height,o.next()}for(;a.value;)l-=a.value.spec.widget.height,a.next();for(;o.value;)u-=o.value.spec.widget.height,o.next();let p=e.contentHeight+l-(t.contentHeight+u);p<rT?r.add(e.state.doc.length,e.state.doc.length,ys.widget({widget:new eT(-p),block:!0,side:1})):p>rT&&i.add(t.state.doc.length,t.state.doc.length,ys.widget({widget:new eT(p),block:!0,side:1}));let m=r.finish(),h=i.finish();iT(m,e.state.field(nT))||e.dispatch({effects:tT.of(m)}),iT(h,t.state.field(nT))||t.dispatch({effects:tT.of(h)})}var oT=Ss.define({map:(e,t)=>t.mapPos(e)}),sT=class extends fs{constructor(e){super(),this.lines=e}eq(e){return this.lines==e.lines}toDOM(e){let t=document.createElement(`div`);return t.className=`cm-collapsedLines`,t.textContent=e.state.phrase(`$ unchanged lines`,this.lines),t.addEventListener(`click`,t=>{let n=e.posAtDOM(t.target);e.dispatch({effects:oT.of(n)});let{side:r,sibling:i}=e.state.facet(kw);i&&i().dispatch({effects:oT.of(cT(n,e.state.field(Mw),r==`a`))})}),t}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return`collapsed-unchanged-code`}};function cT(e,t,n){let r=0,i=0;for(let a=0;;a++){let o=a<t.length?t[a]:null;if(!o||(n?o.fromA:o.fromB)>=e)return i+(e-r);[r,i]=n?[o.toA,o.toB]:[o.toB,o.toA]}}var lT=gs.define({create(e){return ys.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(oT)&&(e=e.update({filter:e=>e!=n.value}));return e},provide:e=>Ts.decorations.from(e)});function uT({margin:e=3,minSize:t=4}){return lT.init(n=>dT(n,e,t))}function dT(e,t,n){let r=new bs,i=e.facet(kw).side==`a`,a=e.field(Mw),o=1;for(let s=0;;s++){let c=s<a.length?a[s]:null,l=s?o+t:1,u=c?e.doc.lineAt(i?c.fromA:c.fromB).number-1-t:e.doc.lines,d=u-l+1;if(d>=n&&r.add(e.doc.line(l).from,e.doc.line(u).to,ys.replace({widget:new sT(d),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,i?c.toA:c.toB)).number}return r.finish()}var fT=Ts.styleModule.of(new Os({".cm-mergeView":{overflowY:`auto`},".cm-mergeViewEditors":{display:`flex`,alignItems:`stretch`},".cm-mergeViewEditor":{flexGrow:1,flexBasis:0,overflow:`hidden`},".cm-merge-revert":{width:`1.6em`,flexGrow:0,flexShrink:0,position:`relative`},".cm-merge-revert button":{position:`absolute`,display:`block`,width:`100%`,boxSizing:`border-box`,textAlign:`center`,background:`none`,border:`none`,font:`inherit`,cursor:`pointer`}})),pT=Ts.baseTheme({".cm-mergeView & .cm-scroller, .cm-mergeView &":{height:`auto !important`,overflowY:`visible !important`},"&.cm-merge-a .cm-changedLine, .cm-deletedChunk":{backgroundColor:`rgba(160, 128, 100, .08)`},"&.cm-merge-b .cm-changedLine, .cm-inlineChangedLine":{backgroundColor:`rgba(100, 160, 128, .08)`},"&light.cm-merge-a .cm-changedText, &light .cm-deletedChunk .cm-deletedText":{background:`linear-gradient(#ee443366, #ee443366) bottom/100% 2px no-repeat`},"&dark.cm-merge-a .cm-changedText, &dark .cm-deletedChunk .cm-deletedText":{background:`linear-gradient(#ffaa9966, #ffaa9966) bottom/100% 2px no-repeat`},"&light.cm-merge-b .cm-changedText":{background:`linear-gradient(#22bb22aa, #22bb22aa) bottom/100% 2px no-repeat`},"&dark.cm-merge-b .cm-changedText":{background:`linear-gradient(#88ff88aa, #88ff88aa) bottom/100% 2px no-repeat`},"&.cm-merge-b .cm-deletedText":{background:`#ff000033`},".cm-insertedLine, .cm-deletedLine, .cm-deletedLine del":{textDecoration:`none`},".cm-deletedChunk":{paddingLeft:`6px`,"& .cm-chunkButtons":{position:`absolute`,insetInlineEnd:`5px`},"& button":{border:`none`,cursor:`pointer`,color:`white`,margin:`0 2px`,borderRadius:`3px`,"&[name=accept]":{background:`#2a2`},"&[name=reject]":{background:`#d43`}}},".cm-collapsedLines":{padding:`5px 5px 5px 10px`,cursor:`pointer`,"&:before":{content:`"⦚"`,marginInlineEnd:`7px`},"&:after":{content:`"⦚"`,marginInlineStart:`7px`}},"&light .cm-collapsedLines":{color:`#444`,background:`linear-gradient(to bottom, transparent 0, #f3f3f3 30%, #f3f3f3 70%, transparent 100%)`},"&dark .cm-collapsedLines":{color:`#ddd`,background:`linear-gradient(to bottom, transparent 0, #222 30%, #222 70%, transparent 100%)`},".cm-changeGutter":{width:`3px`,paddingLeft:`1px`},"&light.cm-merge-a .cm-changedLineGutter, &light .cm-deletedLineGutter":{background:`#e43`},"&dark.cm-merge-a .cm-changedLineGutter, &dark .cm-deletedLineGutter":{background:`#fa9`},"&light.cm-merge-b .cm-changedLineGutter":{background:`#2b2`},"&dark.cm-merge-b .cm-changedLineGutter":{background:`#8f8`},".cm-inlineChangedLineGutter":{background:`#75d`}}),mT=new ws,hT=new ws,gT=class{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||Hw;let t=[ps.low(Uw),pT,fT,nT,Ts.updateListener.of(e=>{this.measuring<0&&(e.heightChanged||e.viewportChanged)&&!e.transactions.some(e=>e.effects.some(e=>e.is(tT)))&&this.measure()})],n=[kw.of({side:`a`,sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&n.push(Ww);let r=hs.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],Ts.editorAttributes.of({class:`cm-merge-a`}),hT.of(n),t]}),i=[kw.of({side:`b`,sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&i.push(Ww);let a=hs.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],Ts.editorAttributes.of({class:`cm-merge-b`}),hT.of(i),t]});this.chunks=Pw.build(r.doc,a.doc,this.diffConf);let o=[Mw.init(()=>this.chunks),mT.of(e.collapseUnchanged?uT(e.collapseUnchanged):[])];r=r.update({effects:Ss.appendConfig.of(o)}).state,a=a.update({effects:Ss.appendConfig.of(o)}).state,this.dom=document.createElement(`div`),this.dom.className=`cm-mergeView`,this.editorDOM=this.dom.appendChild(document.createElement(`div`)),this.editorDOM.className=`cm-mergeViewEditors`;let s=e.orientation||`a-b`,c=document.createElement(`div`);c.className=`cm-mergeViewEditor`;let l=document.createElement(`div`);l.className=`cm-mergeViewEditor`,this.editorDOM.appendChild(s==`a-b`?c:l),this.editorDOM.appendChild(s==`a-b`?l:c),this.a=new Ts({state:r,parent:c,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.a)}),this.b=new Ts({state:a,parent:l,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.b)}),this.setupRevertControls(!!e.revertControls,e.revertControls==`b-to-a`,e.renderRevertControl),e.parent&&e.parent.appendChild(this.dom),this.scheduleMeasure()}dispatch(e,t){if(e.some(e=>e.docChanged)){let n=e[e.length-1],r=e.reduce((e,t)=>e.compose(t.changes),ms.empty(e[0].startState.doc.length));this.chunks=t==this.a?Pw.updateA(this.chunks,n.newDoc,this.b.state.doc,r,this.diffConf):Pw.updateB(this.chunks,this.a.state.doc,n.newDoc,r,this.diffConf),t.update([...e,n.state.update({effects:Aw.of(this.chunks)})]);let i=t==this.a?this.b:this.a;i.update([i.state.update({effects:Aw.of(this.chunks)})]),this.scheduleMeasure()}else t.update(e)}reconfigure(e){if(`diffConfig`in e&&(this.diffConf=e.diffConfig),`orientation`in e){let t=e.orientation!=`b-a`;if(t!=(this.editorDOM.firstChild==this.a.dom.parentNode)){let e=this.a.dom.parentNode,n=this.b.dom.parentNode;e.remove(),n.remove(),this.editorDOM.insertBefore(t?e:n,this.editorDOM.firstChild),this.editorDOM.appendChild(t?n:e),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent=``)}}if(`revertControls`in e||`renderRevertControl`in e){let t=!!this.revertDOM,n=this.revertToA,r=this.renderRevert;`revertControls`in e&&(t=!!e.revertControls,n=e.revertControls==`b-to-a`),`renderRevertControl`in e&&(r=e.renderRevertControl),this.setupRevertControls(t,n,r)}let t=`highlightChanges`in e,n=`gutter`in e,r=`collapseUnchanged`in e;if(t||n||r){let i=[],a=[];if(t||n){let r=this.a.state.facet(kw),o=n?e.gutter!==!1:r.markGutter,s=t?e.highlightChanges!==!1:r.highlightChanges;i.push(hT.reconfigure([kw.of({side:`a`,sibling:()=>this.b,highlightChanges:s,markGutter:o}),o?Ww:[]])),a.push(hT.reconfigure([kw.of({side:`b`,sibling:()=>this.a,highlightChanges:s,markGutter:o}),o?Ww:[]]))}if(r){let t=mT.reconfigure(e.collapseUnchanged?uT(e.collapseUnchanged):[]);i.push(t),a.push(t)}this.a.dispatch({effects:i}),this.b.dispatch({effects:a})}this.scheduleMeasure()}setupRevertControls(e,t,n){this.revertToA=t,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=n,!e&&this.revertDOM?(this.revertDOM.remove(),this.revertDOM=null):e&&!this.revertDOM?(this.revertDOM=this.editorDOM.insertBefore(document.createElement(`div`),this.editorDOM.firstChild.nextSibling),this.revertDOM.addEventListener(`mousedown`,e=>this.revertClicked(e)),this.revertDOM.className=`cm-merge-revert`):this.revertDOM&&(this.revertDOM.textContent=``)}scheduleMeasure(){this.measuring<0&&(this.measuring=(this.dom.ownerDocument.defaultView||window).requestAnimationFrame(()=>{this.measuring=-1,this.measure()}))}measure(){aT(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let e=this.revertDOM,t=e.firstChild,n=this.a.viewport,r=this.b.viewport;for(let i=0;i<this.chunks.length;i++){let a=this.chunks[i];if(a.fromA>n.to||a.fromB>r.to)break;if(a.fromA<n.from||a.fromB<r.from)continue;let o=this.a.lineBlockAt(a.fromA).top+`px`;for(;t&&+t.dataset.chunk<i;)t=_T(t);t&&t.dataset.chunk==String(i)?(t.style.top!=o&&(t.style.top=o),t=t.nextSibling):e.insertBefore(this.renderRevertButton(o,i),t)}for(;t;)t=_T(t)}renderRevertButton(e,t){let n;if(this.renderRevert)n=this.renderRevert();else{n=document.createElement(`button`);let e=this.a.state.phrase(`Revert this chunk`);n.setAttribute(`aria-label`,e),n.setAttribute(`title`,e),n.textContent=this.revertToLeft?`⇜`:`⇝`}return n.style.top=e,n.setAttribute(`data-chunk`,String(t)),n}revertClicked(e){let t=e.target,n;for(;t&&t.parentNode!=this.revertDOM;)t=t.parentNode;if(t&&(n=this.chunks[t.dataset.chunk])){let[t,r,i,a,o,s]=this.revertToA?[this.b,this.a,n.fromB,n.toB,n.fromA,n.toA]:[this.a,this.b,n.fromA,n.toA,n.fromB,n.toB],c=t.state.sliceDoc(i,Math.max(i,a-1));i!=a&&s<=r.state.doc.length&&(c+=t.state.lineBreak),r.dispatch({changes:{from:o,to:Math.min(r.state.doc.length,s),insert:c},userEvent:`revert`}),e.preventDefault()}}destroy(){this.a.destroy(),this.b.destroy(),this.measuring>-1&&(this.dom.ownerDocument.defaultView||window).cancelAnimationFrame(this.measuring),this.dom.remove()}};function _T(e){let t=e.nextSibling;return e.remove(),t}var vT=new class extends Es{constructor(){super(...arguments),this.elementClass=`cm-deletedLineGutter`}},yT=ps.low(Ds({class:`cm-changeGutter`,markers:e=>e.plugin(Uw)?.gutter||As.empty,widgetMarker:(e,t)=>t instanceof wT?vT:null}));function bT(e){let t=typeof e.original==`string`?vs.of(e.original.split(/\r?\n/)):e.original,n=e.diffConfig||Hw;return[ps.low(Uw),kT,pT,Ts.editorAttributes.of({class:`cm-merge-b`}),jw.of((e,t)=>{let r=t.effects.find(e=>e.is(xT));return r&&(e=Pw.updateA(e,r.value.doc,t.startState.doc,r.value.changes,n)),t.docChanged&&(e=Pw.updateB(e,t.state.field(ST),t.newDoc,t.changes,n)),e}),kw.of({highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1,syntaxHighlightDeletions:e.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:e.mergeControls??!0,overrideChunk:e.allowInlineDiffs?FT:void 0,side:`b`}),ST.init(()=>t),e.gutter===!1?[]:yT,e.collapseUnchanged?uT(e.collapseUnchanged):[],Mw.init(e=>Pw.build(t,e.doc,n))]}var xT=Ss.define(),ST=gs.define({create:()=>vs.empty,update(e,t){for(let n of t.effects)n.is(xT)&&(e=n.value.doc);return e}}),CT=new WeakMap,wT=class extends fs{constructor(e){super(),this.buildDOM=e,this.dom=null}eq(e){return this.dom==e.dom}toDOM(e){return this.dom||=this.buildDOM(e)}};function TT(e,t,n){let r=CT.get(t.changes);if(r)return r;let i=ys.widget({block:!0,side:-1,widget:new wT(r=>{let{highlightChanges:i,syntaxHighlightDeletions:a,syntaxHighlightDeletionsMaxLength:o,mergeControls:s}=e.facet(kw),c=document.createElement(`div`);if(c.className=`cm-deletedChunk`,s){let t=c.appendChild(document.createElement(`div`));t.className=`cm-chunkButtons`;let n=e=>{e.preventDefault(),ET(r,r.posAtDOM(c))},i=e=>{e.preventDefault(),DT(r,r.posAtDOM(c))};if(typeof s==`function`)t.appendChild(s(`accept`,n)),t.appendChild(s(`reject`,i));else{let r=t.appendChild(document.createElement(`button`));r.name=`accept`,r.textContent=e.phrase(`Accept`),r.onmousedown=n;let a=t.appendChild(document.createElement(`button`));a.name=`reject`,a.textContent=e.phrase(`Reject`),a.onmousedown=i}}if(n||t.fromA>=t.toA)return c;let l=r.state.field(ST).sliceString(t.fromA,t.endA),u=a&&e.facet(js),d=h(),f=t.changes,p=0,m=!1;function h(){let e=c.appendChild(document.createElement(`div`));return e.className=`cm-deletedLine`,e.appendChild(document.createElement(`del`))}function g(e,t,n){for(let r=e;r<t;){if(l.charAt(r)==`
30
30
  `){d.firstChild||d.appendChild(document.createElement(`br`)),d=h(),r++;continue}let e=t,a=n+(m?` cm-deletedText`:``),o=!1,s=l.indexOf(`
31
- `,r);if(s>-1&&s<t&&(e=s),i&&p<f.length){let t=Math.max(0,m?f[p].toA:f[p].fromA);t<=e&&(e=t,m&&p++,o=!0)}if(e>r){let t=document.createTextNode(l.slice(r,e));if(a){let e=d.appendChild(document.createElement(`span`));e.className=a,e.appendChild(t)}else d.appendChild(t);r=e}o&&(m=!m)}}if(u&&t.toA-t.fromA<=o){let t=u.parser.parse(l),n=0;_s(t,{style:t=>Ms(e,t)},(e,t,r)=>{e>n&&g(n,e,``),g(e,t,r),n=t}),g(n,l.length,``)}else g(0,l.length,``);return d.firstChild||d.appendChild(document.createElement(`br`)),c})});return CT.set(t.changes,i),i}function ET(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(Mw).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=e.state.sliceDoc(i.fromB,Math.max(i.fromB,i.toB-1)),o=e.state.field(ST);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=ms.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:xT.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function DT(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(Mw).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(ST).sliceString(i.fromA,Math.max(i.fromA,i.toA-1));return i.fromA!=i.toA&&i.toB<=n.doc.length&&(a+=n.lineBreak),e.dispatch({changes:{from:i.fromB,to:Math.min(n.doc.length,i.toB),insert:a},userEvent:`revert`}),!0}function OT(e){let t=new bs;for(let n of e.field(Mw)){let r=e.facet(kw).overrideChunk&&jT(e,n);t.add(n.fromB,n.fromB,TT(e,n,!!r))}return t.finish()}var kT=gs.define({create:e=>OT(e),update(e,t){return t.state.field(Mw,!1)==t.startState.field(Mw,!1)?e:OT(t.state)},provide:e=>Ts.decorations.from(e)}),AT=new WeakMap;function jT(e,t){let n=AT.get(t);if(n!==void 0)return n;n=null;let r=e.field(ST),i=e.doc,a=r.lineAt(t.endA).number-r.lineAt(t.fromA).number+1,o=i.lineAt(t.endB).number-i.lineAt(t.fromB).number+1;abort:if(a==o&&a<10){let e=[],i=0,o=t.fromA,s=t.fromB;for(let n of t.changes){if(n.fromA<n.toA){i+=n.toA-n.fromA;let t=r.sliceString(o+n.fromA,o+n.toA);if(/\n/.test(t))break abort;e.push(ys.widget({widget:new MT(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(Jw.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return AT.set(t,n),n}var MT=class extends fs{constructor(e){super(),this.text=e}eq(e){return this.text==e.text}toDOM(e){let t=document.createElement(`del`);return t.className=`cm-deletedText`,t.textContent=this.text,t}},NT=new class extends Es{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},PT=ys.line({class:`cm-inlineChangedLine`});function FT(e,t,n,r){let i=jT(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,NT),n.add(o.from,o.from,PT);a<i.length&&i[a].to<=o.to;){let e=i[a++];n.add(e.from,e.to,e.value)}if(o.to>=t.endB)break;o=e.doc.lineAt(o.to+1)}return!0}var IT=zt({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),LT=_({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}});function RT(e){let t=(0,$.c)(24),{oldContent:n,newContent:r,layout:a,conflictMode:o,oursOverride:c,onResolve:l,onAbort:u}=e,{_:d}=i(),f=c??r,p=(0,Q.useRef)(null),m=(0,Q.useRef)(null),{resolvedTheme:h}=Kr(),g=(0,Q.useRef)(l),_=(0,Q.useRef)(u),[v,y]=(0,Q.useState)(null),x;t[0]!==u||t[1]!==l?(x=()=>{g.current=l,_.current=u},t[0]=u,t[1]=l,t[2]=x):x=t[2],(0,Q.useEffect)(x);let S,C;t[3]!==o||t[4]!==f||t[5]!==a||t[6]!==n||t[7]!==h?(S=()=>{if(!p.current)return;let e=h===`dark`?IT:LT,t=[Ts.editable.of(!1),hs.readOnly.of(!0)],r=[Ls,b(),...t,e,Ts.lineWrapping];if(m.current&&=(m.current.destroy(),null),o){let t=new Ts({doc:f,extensions:[Ls,b(),Ts.editable.of(!1),e,Ts.lineWrapping,bT({original:n,highlightChanges:!0,gutter:!0,mergeControls:!0,collapseUnchanged:{margin:3,minSize:4}}),Ts.updateListener.of(e=>{let t=Nw(e.state);y(t?t.chunks.length:0)})],parent:p.current});m.current=t;let r=Nw(t.state);y(r?r.chunks.length:0)}else a===`split`?m.current=new gT({a:{doc:n,extensions:r},b:{doc:f,extensions:r},parent:p.current,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}}):m.current=new Ts({doc:f,extensions:[...r,bT({original:n,highlightChanges:!0,gutter:!0,mergeControls:!1,collapseUnchanged:{margin:3,minSize:4}})],parent:p.current});return()=>{m.current&&=(m.current.destroy(),null)}},C=[n,f,a,h,o],t[3]=o,t[4]=f,t[5]=a,t[6]=n,t[7]=h,t[8]=S,t[9]=C):(S=t[8],C=t[9]),(0,Q.useEffect)(S,C);let w;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(w=function(){let e=m.current;!e||!(e instanceof Ts)||g.current?.(e.state.doc.toString())},t[10]=w):w=t[10];let T=w,E;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(E=function(){let e=m.current;!e||!(e instanceof Ts)||W(e)},t[11]=E):E=t[11];let D=E,O=v===0,k;t[12]!==d||t[13]!==v?(k=v===null?``:v===0?d({id:`lPzyrU`}):X._({id:`8FqTCr`,values:{chunksRemaining:v}}),t[12]=d,t[13]=v,t[14]=k):k=t[14];let A=k,j;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(`div`,{ref:p,className:`diff-view min-h-0 flex-1 overflow-y-auto subtle-scrollbar`}),t[15]=j):j=t[15];let M;t[16]!==O||t[17]!==o||t[18]!==A||t[19]!==u||t[20]!==l?(M=o&&(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 py-2 border-t shrink-0`,children:[(0,Z.jsx)(`span`,{className:`text-xs ${O?`text-emerald-600 dark:text-emerald-400`:`text-muted-foreground`}`,children:A}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[u&&(0,Z.jsx)(Ni,{variant:`ghost`,size:`sm`,onClick:u,children:(0,Z.jsx)(s,{id:`XyOUTJ`})}),(0,Z.jsx)(Ni,{variant:`outline`,size:`sm`,onClick:D,children:`Undo`}),l&&(0,Z.jsx)(Ni,{variant:`default`,size:`sm`,disabled:!O,onClick:T,children:(0,Z.jsx)(s,{id:`Lcehxn`})})]})]}),t[16]=O,t[17]=o,t[18]=A,t[19]=u,t[20]=l,t[21]=M):M=t[21];let N;return t[22]===M?N=t[23]:(N=(0,Z.jsxs)(`div`,{className:`flex flex-col h-full`,children:[j,M]}),t[22]=M,t[23]=N),N}async function zT(e,t,n){try{let r={file:e,strategy:t};n!==void 0&&(r.content=n);let i=await fetch(`/api/sync/resolve-conflict`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(r)});if(i.ok)return{ok:!0};let a;try{let e=await i.json();typeof e.detail==`string`?a=e.detail:typeof e.title==`string`&&(a=e.title)}catch{}return{ok:!1,detail:a}}catch(n){let r=n instanceof Error?n.message:String(n);return console.warn(JSON.stringify({event:`conflict-resolve-dispatch-failed`,file:e,strategy:t,detail:r})),{ok:!1,detail:r}}}async function BT(e,t){return zT(e,`content`,t)}async function VT(e){try{let t=await fetch(`/api/sync/conflict-content?file=${encodeURIComponent(e)}&source=ytext`);if(!t.ok){let n;try{let e=await t.json();typeof e.detail==`string`?n=e.detail:typeof e.title==`string`&&(n=e.title)}catch{}return console.warn(JSON.stringify({event:`conflict-content-fetch-failed`,file:e,status:t.status,detail:n})),null}let n=await t.json();return{base:n.base??``,ours:n.ours??``,theirs:n.theirs??``}}catch(t){return console.warn(JSON.stringify({event:`conflict-content-fetch-failed`,file:e,status:null,detail:t instanceof Error?t.message:String(t)})),null}}function HT(e){let t=(0,$.c)(24),{docName:n}=e,{conflicts:r,loading:i}=JC(),a;if(t[0]!==r||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>Ar(e.file)===n,t[3]=n,t[4]=e),a=r.find(e),t[0]=r,t[1]=n,t[2]=a}else a=t[2];let o=a,s=o?.file??`${n}.md`,[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(!1),f,p;t[5]===n?(f=t[6],p=t[7]):(f=()=>(console.warn(JSON.stringify({event:`editor-area-swap-to-diffview`,"doc.name":n})),()=>{console.warn(JSON.stringify({event:`editor-area-swap-from-diffview`,"doc.name":n}))}),p=[n],t[5]=n,t[6]=f,t[7]=p),(0,Q.useEffect)(f,p);let m=i||o===void 0,h,g;t[8]!==m||t[9]!==s?(h=()=>{if(m)return;let e=!1;return l(null),d(!1),VT(s).then(t=>{e||(t===null?d(!0):l(t))}),()=>{e=!0}},g=[s,m],t[8]=m,t[9]=s,t[10]=h,t[11]=g):(h=t[10],g=t[11]),(0,Q.useEffect)(h,g);let _;t[12]===s?_=t[13]:(_=async function(e){let t=await BT(s,e);t.ok||$o.error(`Failed to save resolution for ${s}`,{description:t.detail})},t[12]=s,t[13]=_);let v=_;if(u){let e;return t[14]===s?e=t[15]:(e=(0,Z.jsxs)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:[`Couldn't load conflict content for `,s,`. Try reloading the page.`]}),t[14]=s,t[15]=e),e}if(c===null){let e;return t[16]===s?e=t[17]:(e=(0,Z.jsxs)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:[`Loading conflict for `,s]}),t[16]=s,t[17]=e),e}let y;t[18]===v?y=t[19]:(y=e=>void v(e),t[18]=v,t[19]=y);let b;return t[20]!==c.ours||t[21]!==c.theirs||t[22]!==y?(b=(0,Z.jsx)(RT,{oldContent:c.theirs,newContent:c.ours,layout:`unified`,conflictMode:!0,onResolve:y}),t[20]=c.ours,t[21]=c.theirs,t[22]=y,t[23]=b):b=t[23],b}function UT(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(Nt(n,r));let a;return t[0]===i?a=t[1]:(a=(0,Z.jsx)(Z.Fragment,{children:i}),t[0]=i,t[1]=a),a}var WT=`__back-nav__`;function GT(e){return e instanceof Re||e instanceof gt||e instanceof Pe||e instanceof et||e instanceof Dt||e instanceof T?e.docName:null}function KT(e){if(e instanceof Re){let t=e.docName;return{title:X._({id:`Jejur6`}),summary:X._({id:`jSY41h`,values:{docName:t}})}}if(e instanceof gt){let t=e.docName;return{title:X._({id:`V7QxyT`}),summary:X._({id:`xG4tb6`,values:{docName:t}})}}if(e instanceof Pe){let t=e.docName;return{title:X._({id:`1di5fu`}),summary:X._({id:`PQCdtv`,values:{docName:t}})}}if(e instanceof et){let t=e.docName;return{title:X._({id:`wvbc1r`}),summary:X._({id:`IX7-sq`,values:{docName:t}})}}if(e instanceof Dt)return{title:X._({id:`Gfr4fu`}),summary:X._({id:`j6LB7S`})};if(e instanceof T){let t=e.docName;return{title:X._({id:`vv7kpg`}),summary:X._({id:`mdKFEy`,values:{docName:t}})}}let t=e instanceof Error&&e.message?e.message:X._({id:`W5A0Ly`});return{title:X._({id:`29VNqC`}),summary:t}}function qT(e){let t=(0,$.c)(28),{error:n,resetErrorBoundary:r,activeDocName:i,previousDocName:a,onNavigateBack:o}=e,c;t[0]===n?c=t[1]:(c=KT(n),t[0]=n,t[1]=c);let{title:l,summary:u}=c,d=!!a&&!!o,f=(0,Q.useRef)(null),p,m;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>{f.current?.focus()},m=[],t[2]=p,t[3]=m):(p=t[2],m=t[3]),(0,Q.useEffect)(p,m);let h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(db,{size:80,variant:`sleeping`}),t[4]=h):h=t[4];let g;t[5]===l?g=t[6]:(g=(0,Z.jsx)(`h2`,{id:`document-error-title`,className:`text-2xl font-light tracking-tighter text-balance`,children:l}),t[5]=l,t[6]=g);let _;t[7]===u?_=t[8]:(_=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:u}),t[7]=u,t[8]=_);let v;t[9]!==g||t[10]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[g,_]}),t[9]=g,t[10]=_,t[11]=v):v=t[11];let y;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(s,{id:`KDw4GX`}),t[12]=y):y=t[12];let b;t[13]===r?b=t[14]:(b=(0,Z.jsx)(Ni,{ref:f,variant:`default`,onClick:r,children:y}),t[13]=r,t[14]=b);let x;t[15]!==i||t[16]!==d||t[17]!==n||t[18]!==o||t[19]!==a||t[20]!==r?(x=d?(0,Z.jsx)(Ni,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(st(GT(n)??i),o(a),r(WT))},children:(0,Z.jsx)(s,{id:`CKyk7Q`})}):null,t[15]=i,t[16]=d,t[17]=n,t[18]=o,t[19]=a,t[20]=r,t[21]=x):x=t[21];let S;t[22]!==x||t[23]!==b?(S=(0,Z.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[b,x]}),t[22]=x,t[23]=b,t[24]=S):S=t[24];let C;return t[25]!==S||t[26]!==v?(C=(0,Z.jsxs)(`div`,{role:`alert`,"aria-labelledby":`document-error-title`,"data-slot":`document-error-boundary`,className:`flex h-full flex-col items-center justify-center gap-8 p-8 text-center`,children:[h,v,S]}),t[25]=S,t[26]=v,t[27]=C):C=t[27],C}function JT(e){let t=(0,$.c)(17),{activeDocName:n,previousDocName:r,onNavigateBack:i,onRecycle:a,children:o}=e,s;t[0]!==n||t[1]!==i||t[2]!==r?(s=e=>(0,Z.jsx)(qT,{...e,activeDocName:n,previousDocName:r,onNavigateBack:i}),t[0]=n,t[1]=i,t[2]=r,t[3]=s):s=t[3];let c;t[4]===n?c=t[5]:(c=[n],t[4]=n,t[5]=c);let l;t[6]!==n||t[7]!==a?(l=e=>{if(e.reason===`imperative-api`){if(Array.isArray(e.args)&&e.args[0]===WT){console.warn(`[DocumentErrorBoundary] back-nav reset (no recycle)`);return}a(n),console.warn(`[DocumentErrorBoundary] retry recycled ${n}`)}else console.warn(`[DocumentErrorBoundary] reset by key change (${e.prev?.[0]} → ${e.next?.[0]})`)},t[6]=n,t[7]=a,t[8]=l):l=t[8];let u;t[9]===n?u=t[10]:(u=e=>{console.error(`[DocumentErrorBoundary] rendered fallback for ${n}: ${KT(e).title}`,e)},t[9]=n,t[10]=u);let d;return t[11]!==o||t[12]!==s||t[13]!==c||t[14]!==l||t[15]!==u?(d=(0,Z.jsx)(m,{fallbackRender:s,resetKeys:c,onReset:l,onError:u,children:o}),t[11]=o,t[12]=s,t[13]=c,t[14]=l,t[15]=u,t[16]=d):d=t[16],d}function YT(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=sr(t);return{map:n,keys:In(t),parseError:r}}function XT(e){let t=(0,$.c)(21),{provider:n}=e,r;t[0]===n?r=t[1]:(r=()=>YT(n),t[0]=n,t[1]=r);let[i,a]=(0,Q.useState)(r),o,s;t[2]===n?(o=t[3],s=t[4]):(o=()=>{let e=Or(n);a(e.current());let t=e.subscribe(e=>{a(e)});return()=>{t(),e.dispose()}},s=[n],t[2]=n,t[3]=o,t[4]=s),(0,Q.useEffect)(o,s);let c;t[5]===i.map.icon?c=t[6]:(c=Qe(i.map.icon),t[5]=i.map.icon,t[6]=c);let l=c,u;t[7]===i.map.cover?u=t[8]:(u=ut(i.map.cover),t[7]=i.map.cover,t[8]=u);let d=u,f=d.kind===`url`||d.kind===`path`,p=l.kind!==`unsupported`;if(!f&&!p)return null;let m=f?`true`:`false`,h=p?`true`:`false`,g;t[9]!==d||t[10]!==f?(g=f?(0,Z.jsx)(ZT,{cover:d}):null,t[9]=d,t[10]=f,t[11]=g):g=t[11];let _;t[12]!==f||t[13]!==p||t[14]!==l?(_=p?(0,Z.jsx)(QT,{icon:l,hasCover:f}):null,t[12]=f,t[13]=p,t[14]=l,t[15]=_):_=t[15];let v;return t[16]!==m||t[17]!==h||t[18]!==g||t[19]!==_?(v=(0,Z.jsxs)(`div`,{className:`page-header editor-content-aligned`,"data-has-cover":m,"data-has-icon":h,"aria-hidden":`true`,"data-testid":`page-header`,children:[g,_]}),t[16]=m,t[17]=h,t[18]=g,t[19]=_,t[20]=v):v=t[20],v}function ZT(e){let t=(0,$.c)(2),{cover:n}=e,r;return t[0]===n.value?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`page-header-cover`,"data-testid":`page-header-cover`,children:(0,Z.jsx)(`img`,{src:n.value,alt:``,draggable:!1,loading:`lazy`,referrerPolicy:`no-referrer`,className:`page-header-cover-img`})}),t[0]=n.value,t[1]=r),r}function QT(e){let t=(0,$.c)(9),{icon:n,hasCover:r}=e,i=r?`page-header-icon page-header-icon--with-cover`:`page-header-icon`;if(n.kind===`emoji`){let e;return t[0]!==n.value||t[1]!==i?(e=(0,Z.jsx)(`span`,{className:i,"data-testid":`page-header-icon`,"data-kind":`emoji`,children:n.value}),t[0]=n.value,t[1]=i,t[2]=e):e=t[2],e}let a;t[3]===n.value?a=t[4]:(a=(0,Z.jsx)(`img`,{src:n.value,alt:``,draggable:!1,referrerPolicy:`no-referrer`,className:`page-header-icon-img`}),t[3]=n.value,t[4]=a);let o;return t[5]!==n.kind||t[6]!==i||t[7]!==a?(o=(0,Z.jsx)(`span`,{className:i,"data-testid":`page-header-icon`,"data-kind":n.kind,children:a}),t[5]=n.kind,t[6]=i,t[7]=a,t[8]=o):o=t[8],o}function $T(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=sr(t);return{map:n,keys:In(t),parseError:r}}function eE(e){let t=(0,$.c)(175),{provider:n}=e,{_:r}=i(),[a,o]=(0,Q.useState)(null),c;t[0]===n?c=t[1]:(c=()=>$T(n),t[0]=n,t[1]=c);let[l,u]=(0,Q.useState)(c),d,f;t[2]===n?(d=t[3],f=t[4]):(d=()=>{let e=Or(n);o(e),u(e.current());let t=e.subscribe(e=>{u(e)});return()=>{t(),e.dispose(),o(t=>t===e?null:t)}},f=[n],t[2]=n,t[3]=d,t[4]=f),(0,Q.useEffect)(d,f);let p=l.map,m=l.keys,h=l.parseError,[g,_]=(0,Q.useState)(!1),v;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(v={},t[5]=v):v=t[5];let[y,b]=(0,Q.useState)(v),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(null),T;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(T={},t[6]=T):T=t[6];let[E,D]=(0,Q.useState)(T),O;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(O={},t[7]=O):O=t[7];let[k,A]=(0,Q.useState)(O),j=n.configuration.name??``,M;t[8]===j?M=t[9]:(M=iE(j),t[8]=j,t[9]=M);let N=M,F;t[10]===j?F=t[11]:(F=nE(j),t[10]=j,t[11]=F);let I=co(N?null:F),L;t[12]!==I||t[13]!==N?(L=!N&&I.state.status===`ready`?I.state.data.folder.frontmatter_defaults??{}:{},t[12]=I,t[13]=N,t[14]=L):L=t[14];let R=L,z;t[15]!==I||t[16]!==N?(z=!N&&I.state.status===`ready`?I.state.data.frontmatterSources:{},t[15]=I,t[16]=N,t[17]=z):z=t[17];let B=z,V;t[18]!==r||t[19]!==a?(V=function(e){if(!a)return{ok:!1,error:r({id:`9zb2WA`})};let t=a.patch(e);if(t.ok)return{ok:!0};if(t.error.code===`WRITE_ERROR`)return console.warn(`[PropertyPanel] binding write error:`,t.error.detail),{ok:!1,error:t.error.detail};let n=jn(t.error);return{ok:!1,error:t.error.issues[0]?.message??r({id:`8fRyLo`}),fieldErrors:Object.keys(n).length>0?n:void 0}},t[18]=r,t[19]=a,t[20]=V):V=t[20];let H=V,U;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(U=function(e){D(t=>{if(!Object.hasOwn(t,e))return t;let n={...t};return delete n[e],n})},t[21]=U):U=t[21];let W=U,G;t[22]===r?G=t[23]:(G=function(e,t){if(e.ok)return;let n=e.error??r({id:`4g19V6`}),i=e.fieldErrors??{};D(e=>{let r={...e};for(let e of t)r[e]=i[e]??n;return r}),A(e=>{let n={...e};for(let e of t)n[e]=(n[e]??0)+1;return n})},t[22]=r,t[23]=G);let K=G,q;t[24]!==H||t[25]!==K?(q=function(e,t){W(e),K(H({[e]:t}),[e])},t[24]=H,t[25]=K,t[26]=q):q=t[26];let ee=q,te;t[27]!==H||t[28]!==K?(te=function(e){W(e),K(H({[e]:null}),[e])},t[27]=H,t[28]=K,t[29]=te):te=t[29];let ne=te,re;t[30]!==r||t[31]!==a?(re=function(e,t){if(!a)return{ok:!1,error:r({id:`9zb2WA`})};if(e===t)return{ok:!0};let n=a.rename(e,t);if(n.ok)return{ok:!0};if(n.error.code===`WRITE_ERROR`)return{ok:!1,error:n.error.detail};let i=jn(n.error);return{ok:!1,error:n.error.issues[0]?.message??r({id:`I1gRhX`}),fieldErrors:Object.keys(i).length>0?i:void 0}},t[30]=r,t[31]=a,t[32]=re):re=t[32];let ie=re,ae;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(ae=function(e,t){return`${e} ${t}`},t[33]=ae):ae=t[33];let oe=ae,se;t[34]!==a||t[35]!==m?(se=function(e){if(!a)return;let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=m.map((e,t)=>oe(e,t)),i=r.indexOf(t),o=r.indexOf(n);if(i<0||o<0)return;let s=m.slice(),[c]=s.splice(i,1);if(!c)return;s.splice(o,0,c);let l=a.reorder(s);l.ok||console.warn(`[PropertyPanel] reorder failed:`,l.error)},t[34]=a,t[35]=m,t[36]=se):se=t[36];let ce=se,le;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(le={activationConstraint:{distance:4}},t[37]=le):le=t[37];let ue;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(ue={coordinateGetter:ba},t[38]=ue):ue=t[38];let de=Fa($i(Da,le),$i(ga,ue)),fe;t[39]!==R||t[40]!==ee||t[41]!==p?(fe=function(e,t){let n=p[e]??aE(R[e]);if(n===void 0)return;b(n=>({...n,[e]:t}));let r=Sa(n,t);(!Object.hasOwn(p,e)||!tE(n,r))&&ee(e,r)},t[39]=R,t[40]=ee,t[41]=p,t[42]=fe):fe=t[42];let pe=fe,me;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(me=function(){S({name:``,type:`text`,value:``,error:null}),_(!1)},t[43]=me):me=t[43];let he=me,{addPropertySignal:ge,clearAddProperty:_e}=ax(),ve;t[44]!==ge||t[45]!==j?(ve=ge.get(j)??0,t[44]=ge,t[45]=j,t[46]=ve):ve=t[46];let ye=ve,be,xe;t[47]===ye?(be=t[48],xe=t[49]):(be=()=>{ye>0&&(S({name:``,type:`text`,value:``,error:null}),_(!1))},xe=[ye],t[47]=ye,t[48]=be,t[49]=xe),(0,Q.useEffect)(be,xe);let Se,Ce;t[50]!==_e||t[51]!==j?(Se=()=>()=>_e(j),Ce=[j,_e],t[50]=_e,t[51]=j,t[52]=Se,t[53]=Ce):(Se=t[52],Ce=t[53]),(0,Q.useEffect)(Se,Ce);let J;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(J=function(e){S(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):ra[e];return{...t,type:e,value:n,error:null}})},t[54]=J):J=t[54];let we=J,Te;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(Te=function(e){S(t=>t&&{...t,value:e})},t[55]=Te):Te=t[55];let Ee=Te,De;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(De=function(e){S(t=>t&&{...t,name:e,error:null})},t[56]=De):De=t[56];let Oe=De,ke;t[57]!==r||t[58]!==x||t[59]!==H||t[60]!==p?(ke=function(){if(!x)return;let e=x.name.trim();if(!e){S({...x,error:r({id:`8_brI5`})});return}if(e===`frontmatter`){S({...x,error:r({id:`dURmlQ`})});return}if(Object.hasOwn(p,e)){S({...x,error:r({id:`njU86j`,values:{trimmed:e}})});return}let t=H({[e]:x.value});if(t.ok){S(null);return}let n=t.fieldErrors?.[e],i=t.error??r({id:`OJeiSH`});S({...x,error:n??i})},t[57]=r,t[58]=x,t[59]=H,t[60]=p,t[61]=ke):ke=t[61];let Ae=ke,je;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(je=function(){S(null)},t[62]=je):je=t[62];let Me=je,Ne;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=function(e){w({key:e,draft:e,error:null})},t[63]=Ne):Ne=t[63];let Pe=Ne,Fe;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=function(e){w(t=>t&&{...t,draft:e,error:null})},t[64]=Fe):Fe=t[64];let Ie=Fe,Le;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(Le=function(){w(null)},t[65]=Le):Le=t[65];let Re=Le,ze;t[66]!==r||t[67]!==p||t[68]!==ie||t[69]!==C?(ze=function(){if(!C)return;let e=C.draft.trim();if(!e){w(null);return}if(e===C.key){w(null);return}if(e===`frontmatter`){w({...C,error:r({id:`dURmlQ`})});return}if(Object.hasOwn(p,e)){w({...C,error:r({id:`njU86j`,values:{trimmed:e}})});return}let t=ie(C.key,e);if(t.ok){b(t=>{if(!Object.hasOwn(t,C.key))return t;let n={...t};return n[e]=n[C.key],delete n[C.key],n}),W(C.key),w(null);return}let n=t.fieldErrors?.[e]??t.fieldErrors?.[C.key]??t.error??r({id:`2ryd91`});w({...C,error:n})},t[66]=r,t[67]=p,t[68]=ie,t[69]=C,t[70]=ze):ze=t[70];let Be=ze,Ve;t[71]!==p||t[72]!==m?(Ve=m.length>0?m:Object.keys(p),t[71]=p,t[72]=m,t[73]=Ve):Ve=t[73];let He=Ve,Ue;if(t[74]!==He){Ue=new Map;for(let e of He)Ue.set(e,(Ue.get(e)??0)+1);t[74]=He,t[75]=Ue}else Ue=t[75];let We,Ge,Y,Ke,qe,Je,Ye,Xe,Ze,Qe,$e,et;if(t[76]!==x||t[77]!==R||t[78]!==B||t[79]!==g||t[80]!==ee||t[81]!==Be||t[82]!==Ue||t[83]!==E||t[84]!==ce||t[85]!==p||t[86]!==y||t[87]!==h||t[88]!==ne||t[89]!==C||t[90]!==He||t[91]!==k||t[92]!==de||t[93]!==pe){et=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Object.keys(R).filter(e=>!Object.hasOwn(p,e)).sort();if(He.length===0&&e.length===0&&!x&&!h){et=null;break bb0}Qe=`property-panel editor-content-aligned pt-4 pb-4 text-sm`,$e=`property-panel`,Ge=is,Ye=!g,t[106]===Symbol.for(`react.memo_cache_sentinel`)?(Xe=e=>_(!e),t[106]=Xe):Xe=t[106];let n=!g,r;t[107]===n?r=t[108]:(r=(0,Z.jsx)(es,{"data-expanded":n,className:`size-3.5 shrink-0 text-muted-foreground transition-transform duration-150 ease-out data-[expanded=true]:rotate-90`}),t[107]=n,t[108]=r);let i;t[109]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`l_UFPv`})}),t[109]=i):i=t[109],t[110]===r?Ze=t[111]:(Ze=(0,Z.jsx)(rs,{asChild:!0,children:(0,Z.jsxs)(Ni,{type:`button`,variant:`ghost`,className:`mb-1.5 flex h-auto w-fit bg-transparent! items-center gap-1 px-1 py-0.5 text-base font-medium text-foreground hover:bg-transparent hover:text-foreground`,children:[r,i]})}),t[110]=r,t[111]=Ze),We=ns,Y=`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in]`,t[112]===h?Ke=t[113]:(Ke=h?(0,Z.jsxs)(`div`,{role:`alert`,"data-testid":`property-panel-yaml-error`,className:`mb-1 flex items-start gap-1.5 rounded border border-destructive/30 bg-destructive/5 px-2 py-1.5 text-[11px] text-destructive`,children:[(0,Z.jsx)(Pn,{className:`size-3.5 shrink-0 mt-0.5`}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(s,{id:`UG-Phk`}),(0,Z.jsx)(`span`,{className:`block text-[10px] opacity-80`,children:h})]})]}):null,t[112]=h,t[113]=Ke);let a;if(t[114]!==He){let e;t[116]===Symbol.for(`react.memo_cache_sentinel`)?(e=(e,t)=>oe(e,t),t[116]=e):e=t[116],a=He.map(e),t[114]=He,t[115]=a}else a=t[115];let o;if(t[117]!==ee||t[118]!==Be||t[119]!==Ue||t[120]!==E||t[121]!==p||t[122]!==y||t[123]!==ne||t[124]!==C||t[125]!==He||t[126]!==k||t[127]!==pe){let e;t[129]!==ee||t[130]!==Be||t[131]!==Ue||t[132]!==E||t[133]!==p||t[134]!==y||t[135]!==ne||t[136]!==C||t[137]!==k||t[138]!==pe?(e=(e,t)=>{let n=p[e];if(n===void 0)return null;let r=y[e]??pi(n),i=C?.key===e?C:null,a=(Ue.get(e)??0)>1;return(0,Z.jsx)(ja,{sortableId:oe(e,t),keyName:e,value:n,declared:r,error:E[e]??null,resetCounter:k[e]??0,isDuplicate:a,rename:{state:i,onBegin:()=>Pe(e),onChangeDraft:Ie,onCommit:Be,onCancel:Re},onCommit:t=>ee(e,t),onChangeType:t=>pe(e,t),onRemove:()=>ne(e)},`${e}-${t}`)},t[129]=ee,t[130]=Be,t[131]=Ue,t[132]=E,t[133]=p,t[134]=y,t[135]=ne,t[136]=C,t[137]=k,t[138]=pe,t[139]=e):e=t[139],o=He.map(e),t[117]=ee,t[118]=Be,t[119]=Ue,t[120]=E,t[121]=p,t[122]=y,t[123]=ne,t[124]=C,t[125]=He,t[126]=k,t[127]=pe,t[128]=o}else o=t[128];let c;t[140]!==a||t[141]!==o?(c=(0,Z.jsx)(Zi,{items:a,strategy:sa,children:o}),t[140]=a,t[141]=o,t[142]=c):c=t[142],t[143]!==ce||t[144]!==de||t[145]!==c?(qe=(0,Z.jsx)(fa,{sensors:de,collisionDetection:jo,onDragEnd:ce,children:c}),t[143]=ce,t[144]=de,t[145]=c,t[146]=qe):qe=t[146];let l;t[147]!==R||t[148]!==B||t[149]!==ee||t[150]!==E||t[151]!==k||t[152]!==pe?(l=e=>{let t=R[e],n=aE(t),r=pi(n),i=B[e]??``;return(0,Z.jsx)(ja,{keyName:e,value:n,declared:r,error:E[e]??null,resetCounter:k[e]??0,isInherited:!0,badge:(0,Z.jsx)(aa,{source:i}),onCommit:t=>ee(e,t),onChangeType:t=>pe(e,t)},`inherited-${e}`)},t[147]=R,t[148]=B,t[149]=ee,t[150]=E,t[151]=k,t[152]=pe,t[153]=l):l=t[153],Je=e.map(l)}t[76]=x,t[77]=R,t[78]=B,t[79]=g,t[80]=ee,t[81]=Be,t[82]=Ue,t[83]=E,t[84]=ce,t[85]=p,t[86]=y,t[87]=h,t[88]=ne,t[89]=C,t[90]=He,t[91]=k,t[92]=de,t[93]=pe,t[94]=We,t[95]=Ge,t[96]=Y,t[97]=Ke,t[98]=qe,t[99]=Je,t[100]=Ye,t[101]=Xe,t[102]=Ze,t[103]=Qe,t[104]=$e,t[105]=et}else We=t[94],Ge=t[95],Y=t[96],Ke=t[97],qe=t[98],Je=t[99],Ye=t[100],Xe=t[101],Ze=t[102],Qe=t[103],$e=t[104],et=t[105];if(et!==Symbol.for(`react.early_return_sentinel`))return et;let tt;t[154]!==r||t[155]!==x||t[156]!==Ae?(tt=x?(0,Z.jsx)(To,{draft:x,onChangeName:Oe,onChangeType:we,onChangeValue:Ee,onCommit:Ae,onCancel:Me}):(0,Z.jsxs)(`div`,{className:`mt-1 flex items-center gap-1`,children:[(0,Z.jsx)(`span`,{"aria-hidden":!0,className:`h-7 w-4 shrink-0`}),(0,Z.jsxs)(Ni,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:he,"aria-label":r({id:`F-NRCj`}),className:`flex items-center gap-1.5 rounded px-2 py-1 font-medium text-sm hover:bg-muted/50 hover:text-foreground`,children:[(0,Z.jsx)(P,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`m16xKo`})})]})]}),t[154]=r,t[155]=x,t[156]=Ae,t[157]=tt):tt=t[157];let nt;t[158]!==We||t[159]!==Y||t[160]!==Ke||t[161]!==qe||t[162]!==Je||t[163]!==tt?(nt=(0,Z.jsxs)(We,{className:Y,children:[Ke,qe,Je,tt]}),t[158]=We,t[159]=Y,t[160]=Ke,t[161]=qe,t[162]=Je,t[163]=tt,t[164]=nt):nt=t[164];let rt;t[165]!==Ge||t[166]!==Ye||t[167]!==Xe||t[168]!==Ze||t[169]!==nt?(rt=(0,Z.jsxs)(Ge,{open:Ye,onOpenChange:Xe,children:[Ze,nt]}),t[165]=Ge,t[166]=Ye,t[167]=Xe,t[168]=Ze,t[169]=nt,t[170]=rt):rt=t[170];let it;return t[171]!==Qe||t[172]!==$e||t[173]!==rt?(it=(0,Z.jsx)(`div`,{className:Qe,"data-testid":$e,children:rt}),t[171]=Qe,t[172]=$e,t[173]=rt,t[174]=it):it=t[174],it}function tE(e,t){return Array.isArray(e)&&Array.isArray(t)?e.length===t.length?e.every((e,n)=>e===t[n]):!1:e===t}function nE(e){if(!e)return``;let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}var rE=/(^|\/)\.ok\/templates\//;function iE(e){return rE.test(e)}function aE(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`?e:Array.isArray(e)?e.map(e=>typeof e==`string`?e:JSON.stringify(e)):e==null?``:JSON.stringify(e)}var oE=de(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function sE(e){let t=e.threshold??oE;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function cE(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var lE=de(`ACTIVITY_MOUNT_LIMIT`,3);function uE(){return n(()=>import(`./SourceEditor-CJhongAn.js`),__vite__mapDeps([44,1,33,2,34,35,20,36,37,38,39,19,6,3,7,4,10,9,40,45,22]),import.meta.url)}var dE=(0,Q.lazy)(async()=>({default:(await uE()).SourceEditor}));function fE(e,t,n){if(n<=0)return[];let r=e.filter(e=>!Ke(e.docName)),i=[...r].sort((e,t)=>t.lastAccessedAt-e.lastAccessedAt).slice(0,n);if(t===null||i.some(e=>e.docName===t))return i;let a=r.find(e=>e.docName===t);return a?[...i.slice(0,n-1),a]:i}function pE(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:X._({id:`MTs6g3`}),summary:t.reason===`clear-data-timeout`?X._({id:`Sc1bKE`,values:{docName:e}}):X._({id:`ovIGrT`,values:{docName:e}}),actionLabel:X._({id:`HpK_8d`})}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:X._({id:`cF9DyA`}),summary:t.phase===`clearing-local-cache`?X._({id:`bmC18N`,values:{docName:e}}):X._({id:`pAgkuZ`,values:{docName:e}})}:null}function mE(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(Ie,{name:`activity-pool`,children:(0,Z.jsx)(hE,{...e})}),t[0]=e,t[1]=n),n}function hE(e){let t=(0,$.c)(15),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c,serverRestartRecovery:l}=ft(),{pages:u,loading:d}=gi(),f=fE(c,n,lE),p=(0,Q.useRef)(``),m=f.map(gE).join(`,`),h=(0,Q.useRef)(c),g,_;t[0]===c?(g=t[1],_=t[2]):(g=()=>{h.current=c},_=[c],t[0]=c,t[1]=g,t[2]=_),(0,Q.useLayoutEffect)(g,_),(0,Q.useLayoutEffect)(()=>{if(p.current===m)return;let e=p.current?p.current.split(`,`):[],t=m?m.split(`,`):[],r=e.filter(e=>!t.includes(e)),i=t.filter(t=>!e.includes(t));for(let e of r)at(e);for(let e of i){let t=h.current.find(t=>t.docName===e)?.poolEventId;ee(e,t&&t.length>0?t:crypto.randomUUID())}Ht(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),p.current=m,me(t)},[m,n]);let v;t[3]!==n||t[4]!==i||t[5]!==r||t[6]!==d||t[7]!==o||t[8]!==s||t[9]!==u||t[10]!==a||t[11]!==l?(v=e=>(0,Z.jsx)(SE,{entry:e,isActive:e.docName===n,isSourceMode:r,editorPlaceholder:i,isNewDoc:!d&&!u.has(e.docName),previousDocName:a,onNavigateBack:o,onRecycle:s,serverRestartRecovery:l},e.docName),t[3]=n,t[4]=i,t[5]=r,t[6]=d,t[7]=o,t[8]=s,t[9]=u,t[10]=a,t[11]=l,t[12]=v):v=t[12];let y=f.map(v),b;return t[13]===y?b=t[14]:(b=(0,Z.jsx)(Z.Fragment,{children:y}),t[13]=y,t[14]=b),b}function gE(e){return e.docName}function _E(e){let t=(0,$.c)(8),{isActive:n,initialScrollTop:r,children:i}=e,a=(0,Q.useRef)(null),o=(0,Q.useRef)(r??0),s,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=a.current;if(!e)return;let t=()=>{e.scrollTop>0&&(o.current=e.scrollTop)};return e.addEventListener(`scroll`,t,{passive:!0}),()=>e.removeEventListener(`scroll`,t)},c=[],t[0]=s,t[1]=c):(s=t[0],c=t[1]),(0,Q.useEffect)(s,c);let l,u;t[2]===n?(l=t[3],u=t[4]):(l=()=>{if(!n)return;let e=a.current;if(!e)return;let t=o.current;if(t===0)return;let r=performance.now(),i=!1;e.scrollTop=t,e.scrollTop===t&&e.scrollHeight>t&&Ht(`ok/scroll-restore/phase1-success`,{target:t,elapsedMs:performance.now()-r});let s=!1,c=0,l=()=>{s||(s=!0,cancelAnimationFrame(c),clearTimeout(f),e.removeEventListener(`wheel`,u),e.removeEventListener(`touchstart`,u))},u=()=>l();e.addEventListener(`wheel`,u,{passive:!0}),e.addEventListener(`touchstart`,u,{passive:!0});let d=()=>{s||(e.scrollTop!==t&&e.scrollHeight>t&&(e.scrollTop=t,e.scrollTop===t&&!i&&(Ht(`ok/scroll-restore/phase2-success`,{target:t,elapsedMs:performance.now()-r}),i=!0)),c=requestAnimationFrame(d))};c=requestAnimationFrame(d);let f=setTimeout(()=>{s||(e.scrollTop!==t&&e.scrollHeight>t&&Ht(`ok/scroll-restore/abandoned`,{target:t,elapsedMs:performance.now()-r,scrollHeight:e.scrollHeight,finalScrollTop:e.scrollTop}),l())},2e3);return l},u=[n],t[2]=n,t[3]=l,t[4]=u),(0,Q.useLayoutEffect)(l,u);let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d={overflowAnchor:`auto`},t[5]=d):d=t[5];let f;return t[6]===i?f=t[7]:(f=(0,Z.jsx)(`div`,{ref:a,"data-testid":`editor-scroll-container`,className:`subtle-scrollbar h-full overflow-y-auto pt-14 scroll-pt-14`,style:d,children:i}),t[6]=i,t[7]=f),f}function vE(e){let t=(0,$.c)(12),{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a}=e,o=r&&i,[s,c]=(0,Q.useState)(o),l,u;if(t[0]===o?(l=t[1],u=t[2]):(l=()=>{o&&c(!0)},u=[o],t[0]=o,t[1]=l,t[2]=u),(0,Q.useEffect)(l,u),!s&&!o)return null;let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Oy,{}),t[3]=d):d=t[3];let f=n.docName,p;t[4]===n.provider.document?p=t[5]:(p=n.provider.document.getText(`source`),t[4]=n.provider.document,t[5]=p);let m;return t[6]!==a||t[7]!==n.docName||t[8]!==n.provider||t[9]!==o||t[10]!==p?(m=(0,Z.jsx)(Q.Suspense,{fallback:d,children:(0,Z.jsx)(dE,{docName:f,ytext:p,provider:n.provider,placeholder:a,isSourceModeActive:o})}),t[6]=a,t[7]=n.docName,t[8]=n.provider,t[9]=o,t[10]=p,t[11]=m):m=t[11],m}function yE(e){let t=(0,$.c)(18),{view:n}=e,r=n.kind===`failed`,i=r?`alert`:`status`,a=!r,o;t[0]===r?o=t[1]:(o=(0,Z.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-full border bg-muted text-muted-foreground`,children:r?(0,Z.jsx)(Xc,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(Kt,{className:`size-5 animate-spin`,"aria-hidden":`true`})}),t[0]=r,t[1]=o);let s;t[2]===n.title?s=t[3]:(s=(0,Z.jsx)(`h2`,{className:`text-lg font-medium`,children:n.title}),t[2]=n.title,t[3]=s);let c;t[4]===n.summary?c=t[5]:(c=(0,Z.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:n.summary}),t[4]=n.summary,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]!==r||t[10]!==n.actionLabel?(u=r?(0,Z.jsxs)(Ni,{type:`button`,onClick:bE,children:[(0,Z.jsx)(Xc,{className:`size-4`,"aria-hidden":`true`}),n.actionLabel]}):null,t[9]=r,t[10]=n.actionLabel,t[11]=u):u=t[11];let d;return t[12]!==i||t[13]!==a||t[14]!==o||t[15]!==l||t[16]!==u?(d=(0,Z.jsxs)(`div`,{"data-slot":`server-restart-recovery`,role:i,"aria-busy":a,className:`flex h-full flex-col items-center justify-center gap-6 p-8 text-center`,children:[o,l,u]}),t[12]=i,t[13]=a,t[14]=o,t[15]=l,t[16]=u,t[17]=d):d=t[17],d}function bE(){return window.location.reload()}function xE(e){let t=(0,$.c)(2),{html:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`tiptap-editor h-full pointer-events-none`,"aria-hidden":`true`,children:(0,Z.jsx)(`div`,{className:`tiptap ProseMirror tiptap-editor-portal-content`,dangerouslySetInnerHTML:{__html:n}})}),t[0]=n,t[1]=r),r}function SE(e){let t=(0,$.c)(53),{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a,isNewDoc:o,previousDocName:s,onNavigateBack:c,onRecycle:l,serverRestartRecovery:u}=e,d;t[0]!==n.docName||t[1]!==u?(d=pE(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,p=mS(n.docName)===`conflict`,m;t[3]===n.docName?m=t[4]:(m=()=>{let e=document.createElement(`div`);return e.setAttribute(`data-ok-editor-portal`,n.docName),e.style.display=`contents`,e},t[3]=n.docName,t[4]=m);let[h]=(0,Q.useState)(m),g=n.provider.document.getText(`source`).length,[_,v]=(0,Q.useState)(i),[y,b]=(0,Q.useState)(!i),x,S;t[5]!==i||t[6]!==_||t[7]!==y?(x=()=>{i&&!_?v(!0):!i&&!y&&b(!0)},S=[i,_,y],t[5]=i,t[6]=_,t[7]=y,t[8]=x,t[9]=S):(x=t[8],S=t[9]),(0,Q.useEffect)(x,S);let C=sE({ytextLength:g,isSourceMode:i,visitedSource:_,visitedVisual:y}),w=(0,Q.useRef)(``),T=`${C.isLarge}-${C.renderSource}-${C.renderVisual}`,E,D;t[10]!==n.docName||t[11]!==C.isLarge||t[12]!==C.renderSource||t[13]!==C.renderVisual||t[14]!==T||t[15]!==i||t[16]!==g?(E=()=>{w.current!==T&&(w.current=T,C.isLarge&&Ht(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:g,isSourceMode:i,renderSource:C.renderSource,renderVisual:C.renderVisual}))},D=[T,C.isLarge,C.renderSource,C.renderVisual,n.docName,g,i],t[10]=n.docName,t[11]=C.isLarge,t[12]=C.renderSource,t[13]=C.renderVisual,t[14]=T,t[15]=i,t[16]=g,t[17]=E,t[18]=D):(E=t[17],D=t[18]),(0,Q.useEffect)(E,D);let O;t[19]===n.docName?O=t[20]:(O=()=>Vt(n.docName),t[19]=n.docName,t[20]=O);let[k]=(0,Q.useState)(O),A=k?.html??null,[j,M]=(0,Q.useState)(!1),N,P;t[21]!==n.docName||t[22]!==C.isLarge||t[23]!==C.renderSource||t[24]!==C.renderVisual||t[25]!==j||t[26]!==i||t[27]!==g?(N=()=>{cE({isLarge:C.isLarge,renderSource:C.renderSource,renderVisual:C.renderVisual,hasEmittedFirstToggle:j})&&(Ht(`ok/cold/first-toggle`,{docName:n.docName,mountId:K(n.docName),ytextLength:g,modeEnteredFirst:i?`source`:`visual`}),M(!0))},P=[j,C.isLarge,C.renderSource,C.renderVisual,n.docName,g,i],t[21]=n.docName,t[22]=C.isLarge,t[23]=C.renderSource,t[24]=C.renderVisual,t[25]=j,t[26]=i,t[27]=g,t[28]=N,t[29]=P):(N=t[28],P=t[29]),(0,Q.useEffect)(N,P);let F=r?`visible`:`hidden`,I=`editor:${n.docName}`,L=k?.scrollTop,R;t[30]!==a||t[31]!==n||t[32]!==C.renderSource||t[33]!==C.renderVisual||t[34]!==r||t[35]!==p||t[36]!==o||t[37]!==i||t[38]!==c||t[39]!==l||t[40]!==h||t[41]!==s||t[42]!==f||t[43]!==A?(R=f?(0,Z.jsx)(yE,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(JT,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:A?(0,Z.jsx)(xE,{html:A}):(0,Z.jsx)(Oy,{}),children:(0,Z.jsx)(UT,{docName:n.docName,provider:n.provider,children:p?(0,Z.jsx)(HT,{docName:n.docName,provider:n.provider}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(0,Z.jsx)(XT,{provider:n.provider}),!i&&(0,Z.jsx)(eE,{provider:n.provider}),(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[C.renderSource?(0,Z.jsx)(`div`,{className:i?`h-full`:`ok-mode-hidden h-full`,children:(0,Z.jsx)(vE,{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a})}):null,C.renderVisual?(0,Z.jsx)(`div`,{className:i?`ok-mode-hidden h-full`:`h-full`,children:(0,Z.jsx)(WC,{provider:n.provider,placeholder:a,isSourceMode:i,portalTarget:h},`${n.docName}-${String(o)}`)}):null]})]})})})})}),t[30]=a,t[31]=n,t[32]=C.renderSource,t[33]=C.renderVisual,t[34]=r,t[35]=p,t[36]=o,t[37]=i,t[38]=c,t[39]=l,t[40]=h,t[41]=s,t[42]=f,t[43]=A,t[44]=R):R=t[44];let z;t[45]!==r||t[46]!==L||t[47]!==R?(z=(0,Z.jsx)(_E,{isActive:r,initialScrollTop:L,children:R}),t[45]=r,t[46]=L,t[47]=R,t[48]=z):z=t[48];let B;return t[49]!==F||t[50]!==I||t[51]!==z?(B=(0,Z.jsx)(Q.Activity,{mode:F,name:I,children:z}),t[49]=F,t[50]=I,t[51]=z,t[52]=B):B=t[52],B}function CE(e){let t=(0,$.c)(36),{stats:n}=e,{_:r}=i(),{words:a,chars:o,tokens:c}=n,l;t[0]===r?l=t[1]:(l=r({id:`L1ZE3M`}),t[0]=r,t[1]=l);let u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-full h-2 bg-linear-to-t from-background to-transparent`}),t[2]=u):u=t[2];let d;t[3]===n.words?d=t[4]:(d=n.words.toLocaleString(),t[3]=n.words,t[4]=d);let f;t[5]===d?f=t[6]:(f=(0,Z.jsx)(`span`,{className:`tabular-nums`,children:d}),t[5]=d,t[6]=f);let p;t[7]===a?p=t[8]:(p=(0,Z.jsx)(s,{id:`gljvbT`,values:{words:a}}),t[7]=a,t[8]=p);let m;t[9]!==f||t[10]!==p?(m=(0,Z.jsxs)(`span`,{children:[f,` `,p]}),t[9]=f,t[10]=p,t[11]=m):m=t[11];let h;t[12]===n.chars?h=t[13]:(h=n.chars.toLocaleString(),t[12]=n.chars,t[13]=h);let g;t[14]===h?g=t[15]:(g=(0,Z.jsx)(`span`,{className:`tabular-nums`,children:h}),t[14]=h,t[15]=g);let _;t[16]===o?_=t[17]:(_=(0,Z.jsx)(s,{id:`d5rK4X`,values:{chars:o}}),t[16]=o,t[17]=_);let v;t[18]!==g||t[19]!==_?(v=(0,Z.jsxs)(`span`,{children:[g,` `,_]}),t[18]=g,t[19]=_,t[20]=v):v=t[20];let y=n.tokens>0?`~`:``,b;t[21]===n.tokens?b=t[22]:(b=n.tokens.toLocaleString(),t[21]=n.tokens,t[22]=b);let x;t[23]===b?x=t[24]:(x=(0,Z.jsx)(`span`,{className:`tabular-nums`,children:b}),t[23]=b,t[24]=x);let S;t[25]===c?S=t[26]:(S=(0,Z.jsx)(s,{id:`uynXup`,values:{tokens:c}}),t[25]=c,t[26]=S);let C;t[27]!==y||t[28]!==x||t[29]!==S?(C=(0,Z.jsxs)(`span`,{children:[y,x,` `,S]}),t[27]=y,t[28]=x,t[29]=S,t[30]=C):C=t[30];let w;return t[31]!==l||t[32]!==v||t[33]!==C||t[34]!==m?(w=(0,Z.jsxs)(`section`,{"aria-label":l,className:`relative flex h-6 shrink-0 items-center justify-end gap-3 bg-background px-3 text-2xs text-muted-foreground`,children:[u,m,v,C]}),t[31]=l,t[32]=v,t[33]=C,t[34]=m,t[35]=w):w=t[35],w}function wE(e){let t=(0,$.c)(11),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{_:a}=i(),o;t[3]===a?o=t[4]:(o=a({id:`3__SjS`}),t[3]=a,t[4]=o);let s;t[5]===n?s=t[6]:(s=Ei(n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==o||t[9]!==s?(c=(0,Z.jsx)(`nav`,{"aria-label":o,"data-slot":`breadcrumb`,className:s,...r}),t[7]=r,t[8]=o,t[9]=s,t[10]=c):c=t[10],c}function TE(e){let t=(0,$.c)(8),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=Ei(`flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`ol`,{"data-slot":`breadcrumb-list`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function EE(e){let t=(0,$.c)(8),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=Ei(`inline-flex items-center gap-1`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`li`,{"data-slot":`breadcrumb-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function DE(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({current:i,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0||i?`page`:void 0,o;t[4]===n?o=t[5]:(o=Ei(`font-normal text-foreground`,n),t[4]=n,t[5]=o);let s;return t[6]!==r||t[7]!==a||t[8]!==o?(s=(0,Z.jsx)(`span`,{"data-slot":`breadcrumb-page`,"aria-current":a,className:o,...r}),t[6]=r,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function OE(e){let t=(0,$.c)(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({children:n,className:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=Ei(`[&>svg]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=n??(0,Z.jsx)(es,{}),t[6]=n,t[7]=o);let s;return t[8]!==i||t[9]!==a||t[10]!==o?(s=(0,Z.jsx)(`li`,{"data-slot":`breadcrumb-separator`,role:`presentation`,"aria-hidden":`true`,className:a,...i,children:o}),t[8]=i,t[9]=a,t[10]=o,t[11]=s):s=t[11],s}var kE=1,AE=2,jE=4;function ME(e){let t=(0,$.c)(18),{docName:n,className:r}=e;if(!n)return null;let i,a,o,s,c,l;if(t[0]!==r||t[1]!==n){l=Symbol.for(`react.early_return_sentinel`);bb0:{let{prefix:e}=Rt(n,``);if(!e){l=null;break bb0}let u=e.replace(/\/$/,``).split(`/`).filter(Boolean);if(u.length===0){l=null;break bb0}let d=(e,t)=>({kind:`segment`,value:e,key:u.slice(0,t+1).join(`/`)}),f=u.length>jE?[...u.slice(0,kE).map((e,t)=>d(e,t)),{kind:`ellipsis`,hidden:u.slice(kE,-AE)},...u.slice(-AE).map((e,t)=>d(e,u.length-AE+t))]:u.map((e,t)=>d(e,t));a=wE,t[8]===r?c=t[9]:(c=Ei(`flex min-w-0 items-center`,r),t[8]=r,t[9]=c),i=TE,o=`min-w-0 flex-nowrap gap-1 overflow-hidden text-muted-foreground/70 text-xs`,s=f.map(NE)}t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l}else i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7];if(l!==Symbol.for(`react.early_return_sentinel`))return l;let u;t[10]!==i||t[11]!==o||t[12]!==s?(u=(0,Z.jsx)(i,{className:o,children:s}),t[10]=i,t[11]=o,t[12]=s,t[13]=u):u=t[13];let d;return t[14]!==a||t[15]!==c||t[16]!==u?(d=(0,Z.jsx)(a,{className:c,children:u}),t[14]=a,t[15]=c,t[16]=u,t[17]=d):d=t[17],d}function NE(e,t){let n=e.kind===`segment`?e.key:`ellipsis`;return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(OE,{className:`shrink-0 text-muted-foreground/70 [&>svg]:size-3`}),e.kind===`ellipsis`?(0,Z.jsxs)(EE,{className:`shrink-0`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,title:e.hidden.join(` / `),className:`flex size-4 items-center justify-center text-muted-foreground/70`,children:(0,Z.jsx)(yc,{className:`size-3.5`})}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.hidden.join(` / `)})]}):(0,Z.jsx)(EE,{className:`min-w-0`,children:(0,Z.jsx)(DE,{current:!1,className:`min-w-0 truncate font-normal text-muted-foreground/70`,title:e.value,children:e.value})})]},n)}var PE={fill:`none`,height:24,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,viewBox:`0 0 24 24`,width:24,xmlns:`http://www.w3.org/2000/svg`},FE=e=>{let t=(0,$.c)(15),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({color:a,size:o,strokeWidth:s,absoluteStrokeWidth:n,className:c,children:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=a===void 0?`currentColor`:a,u=o===void 0?24:o,d=s===void 0?2:s,f=c===void 0?``:c,p=n?Number(d)*24/Number(u):d,m;return t[8]!==r||t[9]!==f||t[10]!==l||t[11]!==i||t[12]!==u||t[13]!==p?(m=(0,Z.jsx)(`svg`,{"aria-hidden":`true`,...PE,className:f,height:u,stroke:l,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:p,width:u,...i,children:r}),t[8]=r,t[9]=f,t[10]=l,t[11]=i,t[12]=u,t[13]=p,t[14]=m):m=t[14],m},IE=e=>{let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`Markdown`}),r=(0,Z.jsx)(`path`,{d:`M232,48H24A16,16,0,0,0,8,64V192a16,16,0,0,0,16,16H232a16,16,0,0,0,16-16V64A16,16,0,0,0,232,48Zm0,144H24V64H232V192ZM128,104v48a8,8,0,0,1-16,0V123.31L93.66,141.66a8,8,0,0,1-11.32,0L64,123.31V152a8,8,0,0,1-16,0V104a8,8,0,0,1,13.66-5.66L88,124.69l26.34-26.35A8,8,0,0,1,128,104Zm77.66,18.34a8,8,0,0,1,0,11.32l-24,24a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L168,132.69V104a8,8,0,0,1,16,0v28.69l10.34-10.35A8,8,0,0,1,205.66,122.34Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(FE,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},LE=e=>{let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`Textbox`}),r=(0,Z.jsx)(`path`,{d:`M112,40a8,8,0,0,0-8,8V64H24A16,16,0,0,0,8,80v96a16,16,0,0,0,16,16h80v16a8,8,0,0,0,16,0V48A8,8,0,0,0,112,40ZM24,176V80h80v96ZM248,80v96a16,16,0,0,1-16,16H144a8,8,0,0,1,0-16h88V80H144a8,8,0,0,1,0-16h88A16,16,0,0,1,248,80ZM88,112a8,8,0,0,1-8,8H72v24a8,8,0,0,1-16,0V120H48a8,8,0,0,1,0-16H80A8,8,0,0,1,88,112Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(FE,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function RE(e){let t=(0,$.c)(60),{activeDocName:n,isSourceMode:r,sourceDisabled:a,onModeChange:o,showAddPropertyButton:c,onAddProperty:l,isPanelCollapsed:u,onTogglePanel:d}=e,{_:f}=i(),p;t[0]===n?p=t[1]:(p=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex min-w-0 items-center`,children:(0,Z.jsx)(ME,{docName:n})}),t[0]=n,t[1]=p);let m=r?`source`:`wysiwyg`,h;t[2]===o?h=t[3]:(h=e=>{e&&o(e)},t[2]=o,t[3]=h);let g;t[4]===f?g=t[5]:(g=f({id:`n7aopT`}),t[4]=f,t[5]=g);let _;t[6]===f?_=t[7]:(_=f({id:`ur2XSb`}),t[6]=f,t[7]=_);let v;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(cr,{children:(0,Z.jsx)(LE,{className:`size-4`})}),t[8]=v):v=t[8];let y;t[9]===_?y=t[10]:(y=(0,Z.jsx)(No,{value:`wysiwyg`,"aria-label":_,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:v}),t[9]=_,t[10]=y);let b;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(Qn,{side:`bottom`,children:(0,Z.jsx)(s,{id:`Mb_20S`})}),t[11]=b):b=t[11];let x;t[12]===y?x=t[13]:(x=(0,Z.jsxs)(Gr,{children:[y,b]}),t[12]=y,t[13]=x);let S;t[14]===f?S=t[15]:(S=f({id:`xbdtfY`}),t[14]=f,t[15]=S);let C;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(IE,{className:`size-4`}),t[16]=C):C=t[16];let w;t[17]!==a||t[18]!==S?(w=(0,Z.jsx)(cr,{asChild:!0,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(No,{value:`source`,"aria-label":S,disabled:a,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,children:C})})}),t[17]=a,t[18]=S,t[19]=w):w=t[19];let T;t[20]===a?T=t[21]:(T=(0,Z.jsx)(Qn,{side:`bottom`,children:a?(0,Z.jsx)(s,{id:`G-JBA1`}):(0,Z.jsx)(s,{id:`u6Hp4N`})}),t[20]=a,t[21]=T);let E;t[22]!==w||t[23]!==T?(E=(0,Z.jsxs)(Gr,{children:[w,T]}),t[22]=w,t[23]=T,t[24]=E):E=t[24];let D;t[25]!==E||t[26]!==m||t[27]!==h||t[28]!==g||t[29]!==x?(D=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex justify-center`,children:(0,Z.jsxs)(Io,{type:`single`,value:m,onValueChange:h,"aria-label":g,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 data-[size=sm]:rounded-[10px] bg-muted p-0.5`,children:[x,E]})}),t[25]=E,t[26]=m,t[27]=h,t[28]=g,t[29]=x,t[30]=D):D=t[30];let O;t[31]!==p||t[32]!==D?(O=(0,Z.jsx)(`div`,{className:`editor-content-aligned bg-background py-2`,children:(0,Z.jsxs)(`div`,{className:`grid grid-cols-3 items-center`,children:[p,D]})}),t[31]=p,t[32]=D,t[33]=O):O=t[33];let k;t[34]!==f||t[35]!==l||t[36]!==c?(k=c&&(0,Z.jsxs)(Gr,{children:[(0,Z.jsx)(Ni,{variant:`ghost`,size:`icon`,"aria-label":f({id:`81H_23`}),onClick:l,"data-testid":`add-properties-button`,asChild:!0,children:(0,Z.jsx)(cr,{children:(0,Z.jsx)(Fc,{})})}),(0,Z.jsx)(Qn,{side:`bottom`,children:(0,Z.jsx)(s,{id:`81H_23`})})]}),t[34]=f,t[35]=l,t[36]=c,t[37]=k):k=t[37];let A=!u,j;t[38]!==f||t[39]!==u?(j=f(u?{id:`6iDEWA`}:{id:`170Js2`}),t[38]=f,t[39]=u,t[40]=j):j=t[40];let M;t[41]===u?M=t[42]:(M=(0,Z.jsx)(cr,{children:u?(0,Z.jsx)(Wc,{}):(0,Z.jsx)(Uc,{})}),t[41]=u,t[42]=M);let N;t[43]!==d||t[44]!==A||t[45]!==j||t[46]!==M?(N=(0,Z.jsx)(Ni,{variant:`ghost`,size:`icon`,onClick:d,"aria-expanded":A,"aria-label":j,asChild:!0,children:M}),t[43]=d,t[44]=A,t[45]=j,t[46]=M,t[47]=N):N=t[47];let P;t[48]===u?P=t[49]:(P=(0,Z.jsx)(Qn,{side:`bottom`,children:u?(0,Z.jsx)(s,{id:`6iDEWA`}):(0,Z.jsx)(s,{id:`170Js2`})}),t[48]=u,t[49]=P);let F;t[50]!==N||t[51]!==P?(F=(0,Z.jsxs)(Gr,{children:[N,P]}),t[50]=N,t[51]=P,t[52]=F):F=t[52];let I;t[53]!==k||t[54]!==F?(I=(0,Z.jsxs)(`div`,{className:`pointer-events-auto absolute top-0 right-0 flex items-center justify-end gap-1 py-2 pr-2`,children:[k,F]}),t[53]=k,t[54]=F,t[55]=I):I=t[55];let L;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none h-2 bg-linear-to-b from-background to-transparent`}),t[56]=L):L=t[56];let R;return t[57]!==O||t[58]!==I?(R=(0,Z.jsxs)(`div`,{"data-testid":`editor-toolbar`,className:`pointer-events-none absolute inset-x-0 top-0 z-10`,children:[O,I,L]}),t[57]=O,t[58]=I,t[59]=R):R=t[59],R}function zE(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}var BE=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-C_nGfN8W.js`),__vite__mapDeps([32,1,2,33,34,35,20,36,37,38,39,19,6,3,7,4,10,9,40,41]),import.meta.url)).ActivityModeContent}));function VE(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(UE,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(HE,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(Ie,{name:`editor-area`,children:(0,Z.jsxs)(rx,{children:[n,r]})}),t[3]=n,t[4]=i),i}function HE(){let e=(0,$.c)(5),t=Em(),n;e[0]===t?n=e[1]:(n=e=>{e||t.close()},e[0]=t,e[1]=n);let r;return e[2]!==t.open||e[3]!==n?(r=(0,Z.jsx)(px,{open:t.open,onOpenChange:n}),e[2]=t.open,e[3]=n,e[4]=r):r=e[4],r}function UE(e){let t=(0,$.c)(119),{editorMode:n,onModeChange:r,activeTab:a,onActiveTabChange:o,onSaveVersion:c,saving:l}=e,{_:u}=i(),{activeDocName:d,activeProvider:f,activeTarget:p,recycleDocument:m,docPanelMode:h,docPanelAgentId:g,docPanelExpandSignal:_}=ft(),{openDocumentTransition:v}=wt(),{requestAddProperty:y}=ax(),b=fS(f,d),x=hS(f),S=x===`connected`||x===`synced`,C=mS(d)===`conflict`,w=(0,Q.useDeferredValue)(d),T=p?.kind===`missing`,E=!!d&&p?.kind!==`folder`,D;t[0]!==u||t[1]!==T?(D=T?u({id:`K-a33w`}):void 0,t[0]=u,t[1]=T,t[2]=D):D=t[2];let O=D,k=gy(),[A,j]=(0,Q.useState)(!1),{layout:M,autoCollapse:N}=Xx(),P=M===`sheet`,[F,I]=(0,Q.useState)(!1),L=(0,Q.useRef)(!1),R,z;t[3]!==N||t[4]!==M||t[5]!==k?(R=()=>{if(M!==`panel`)return;let e=requestAnimationFrame(()=>{N?(L.current=!1,k.current?.collapse()):L.current||k.current?.expand()});return()=>cancelAnimationFrame(e)},z=[N,M,k],t[3]=N,t[4]=M,t[5]=k,t[6]=R,t[7]=z):(R=t[6],z=t[7]),(0,Q.useEffect)(R,z);let B,V;t[8]!==P||t[9]!==o||t[10]!==k?(B=()=>{let e=e=>{o(e),P?I(!0):(L.current=!1,k.current?.expand())},t=jp();return t&&e(t),Np(t=>{jp(),e(t)})},V=[P,o,k],t[8]=P,t[9]=o,t[10]=k,t[11]=B,t[12]=V):(B=t[11],V=t[12]),(0,Q.useEffect)(B,V);let H,U;t[13]!==_||t[14]!==P||t[15]!==k?(H=()=>{_!==0&&(P?I(!0):(L.current=!1,k.current?.expand()))},U=[_,P,k],t[13]=_,t[14]=P,t[15]=k,t[16]=H,t[17]=U):(H=t[16],U=t[17]),(0,Q.useEffect)(H,U);let W=(0,Q.useRef)(null),[G,K]=(0,Q.useState)(null),q=p?.kind===`large-file`?p.docName:d,ee,te;t[18]===q?(ee=t[19],te=t[20]):(ee=()=>{if(q&&q!==W.current){let e=W.current;W.current=q,K(e)}},te=[q],t[18]=q,t[19]=ee,t[20]=te),(0,Q.useEffect)(ee,te);let re;t[21]===v?re=t[22]:(re=function(e){let t=di(e);window.location.hash===t?v(e):window.location.hash=t},t[21]=v,t[22]=re);let ie=re;if(p?.kind===`large-file`){let e;t[23]!==ie||t[24]!==G?(e=G?{previousDocName:G,onNavigateBack:ie}:void 0,t[23]=ie,t[24]=G,t[25]=e):e=t[25];let n;return t[26]!==p.docName||t[27]!==p.limit||t[28]!==p.size||t[29]!==e?(n=(0,Z.jsx)($b,{docName:p.docName,size:p.size,limit:p.limit,backNav:e}),t[26]=p.docName,t[27]=p.limit,t[28]=p.size,t[29]=e,t[30]=n):n=t[30],n}if(p?.kind===`folder`){if(!(h===`agent`&&g!==null)){let e;return t[31]===p.folderPath?e=t[32]:(e=(0,Z.jsx)(Yb,{folderPath:p.folderPath}),t[31]=p.folderPath,t[32]=e),e}let e;t[33]===p.folderPath?e=t[34]:(e=(0,Z.jsx)(vx,{minSize:`30%`,defaultSize:`75%`,children:(0,Z.jsx)(Yb,{folderPath:p.folderPath})}),t[33]=p.folderPath,t[34]=e);let n;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(yx,{withHandle:!0}),t[35]=n):n=t[35];let r;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(vx,{defaultSize:`25%`,minSize:`300px`,maxSize:`40%`,className:`flex flex-col bg-muted/20`,children:(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{role:`status`,"aria-busy":`true`,className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`ONPvOb`})}),children:(0,Z.jsx)(BE,{showBackButton:!1})})}),t[36]=r):r=t[36];let i;return t[37]===e?i=t[38]:(i=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:(0,Z.jsxs)(_x,{orientation:`horizontal`,children:[e,n,r]})}),t[37]=e,t[38]=i),i}if(p?.kind===`asset`){let e;return t[39]!==p.assetPath||t[40]!==p.mediaKind?(e=(0,Z.jsx)(Dy,{assetPath:p.assetPath,mediaKind:p.mediaKind},p.assetPath),t[39]=p.assetPath,t[40]=p.mediaKind,t[41]=e):e=t[41],e}if(!f||!d){if((typeof window<`u`?Ur(window.location.hash):null)!==null){let e;return t[42]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Oy,{}),t[42]=e):e=t[42],e}let e;return t[43]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Sb,{}),t[43]=e):e=t[43],e}let ae=n===`source`,oe=!S,se=P?!F:A,ce;t[44]!==d||t[45]!==y?(ce=function(){d&&y(d)},t[44]=d,t[45]=y,t[46]=ce):ce=t[46];let le=ce,ue;t[47]!==A||t[48]!==P||t[49]!==k?(ue=function(){P?I(WE):A?(L.current=!1,k.current?.expand()):(L.current=!0,k.current?.collapse())},t[47]=A,t[48]=P,t[49]=k,t[50]=ue):ue=t[50];let de=ue,fe=w??d,pe=G??void 0,me;t[51]!==O||t[52]!==ae||t[53]!==ie||t[54]!==m||t[55]!==fe||t[56]!==pe?(me=(0,Z.jsx)(mE,{activeDocName:fe,isSourceMode:ae,editorPlaceholder:O,previousDocName:pe,onNavigateBack:ie,onRecycle:m}),t[51]=O,t[52]=ae,t[53]=ie,t[54]=m,t[55]=fe,t[56]=pe,t[57]=me):me=t[57];let he;t[58]!==d||t[59]!==ae?(he=(0,Z.jsx)(Gx,{activeDocName:d,isSourceMode:ae}),t[58]=d,t[59]=ae,t[60]=he):he=t[60];let ge;t[61]!==d||t[62]!==w?(ge=zE({activeDocName:d,deferredActiveDocName:w,mountResolved:d!==null&&ne(d),syncResolved:d!==null&&Ve(d)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(Oy,{}),d===null?null:(0,Z.jsx)(ex,{docName:d})]}):null,t[61]=d,t[62]=w,t[63]=ge):ge=t[63];let _e;t[64]!==me||t[65]!==he||t[66]!==ge?(_e=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[me,he,ge]}),t[64]=me,t[65]=he,t[66]=ge,t[67]=_e):_e=t[67];let ve;t[68]!==d||t[69]!==C||t[70]!==se||t[71]!==ae||t[72]!==r||t[73]!==le||t[74]!==oe||t[75]!==de?(ve=!C&&(0,Z.jsx)(RE,{activeDocName:d,isSourceMode:ae,sourceDisabled:oe,onModeChange:r,showAddPropertyButton:!ae,onAddProperty:le,isPanelCollapsed:se,onTogglePanel:de}),t[68]=d,t[69]=C,t[70]=se,t[71]=ae,t[72]=r,t[73]=le,t[74]=oe,t[75]=de,t[76]=ve):ve=t[76];let ye;t[77]!==_e||t[78]!==ve?(ye=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[_e,ve]}),t[77]=_e,t[78]=ve,t[79]=ye):ye=t[79];let be;t[80]!==E||t[81]!==b?(be=E&&(0,Z.jsx)(CE,{stats:b}),t[80]=E,t[81]=b,t[82]=be):be=t[82];let xe;t[83]!==ye||t[84]!==be?(xe=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[ye,be]}),t[83]=ye,t[84]=be,t[85]=xe):xe=t[85];let Se=xe,Ce=P?`100%`:`30%`,J=P?`100%`:`75%`,we;t[86]!==Se||t[87]!==Ce||t[88]!==J?(we=(0,Z.jsx)(vx,{minSize:Ce,defaultSize:J,children:Se}),t[86]=Se,t[87]=Ce,t[88]=J,t[89]=we):we=t[89];let Te;t[90]===P?Te=t[91]:(Te=P?null:(0,Z.jsx)(yx,{withHandle:!0}),t[90]=P,t[91]=Te);let Ee;t[92]!==d||t[93]!==a||t[94]!==h||t[95]!==P||t[96]!==ae||t[97]!==o||t[98]!==c||t[99]!==k||t[100]!==l?(Ee=P?null:(0,Z.jsx)(vx,{panelRef:k,defaultSize:`25%`,minSize:`300px`,maxSize:`40%`,collapsible:!0,collapsedSize:0,onResize:e=>j(e.asPercentage===0),className:`flex flex-col bg-muted/20`,children:(0,Z.jsx)(C_,{docName:d,isSourceMode:ae,activeTab:a,onActiveTabChange:o,mode:h,onSaveVersion:c,saving:l})}),t[92]=d,t[93]=a,t[94]=h,t[95]=P,t[96]=ae,t[97]=o,t[98]=c,t[99]=k,t[100]=l,t[101]=Ee):Ee=t[101];let De;t[102]!==we||t[103]!==Te||t[104]!==Ee?(De=(0,Z.jsxs)(_x,{orientation:`horizontal`,children:[we,Te,Ee]}),t[102]=we,t[103]=Te,t[104]=Ee,t[105]=De):De=t[105];let Oe;t[106]!==d||t[107]!==a||t[108]!==h||t[109]!==P||t[110]!==ae||t[111]!==o||t[112]!==c||t[113]!==l||t[114]!==F?(Oe=P?(0,Z.jsx)(bx,{open:F,onOpenChange:I,children:(0,Z.jsxs)(Cx,{side:`right`,className:`flex w-80 sm:w-96 flex-col gap-0 p-0`,children:[(0,Z.jsx)(wx,{className:`sr-only`,children:(0,Z.jsx)(Tx,{children:(0,Z.jsx)(s,{id:`5Q9-G-`})})}),(0,Z.jsx)(C_,{docName:d,isSourceMode:ae,activeTab:a,onActiveTabChange:o,mode:h,onSaveVersion:c,saving:l})]})}):null,t[106]=d,t[107]=a,t[108]=h,t[109]=P,t[110]=ae,t[111]=o,t[112]=c,t[113]=l,t[114]=F,t[115]=Oe):Oe=t[115];let ke;return t[116]!==De||t[117]!==Oe?(ke=(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[De,Oe]}),t[116]=De,t[117]=Oe,t[118]=ke):ke=t[118],ke}function WE(e){return!e}var GE=1280;function KE(){let e=(0,$.c)(2),[t,n]=(0,Q.useState)(qE),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=window.matchMedia(`(max-width: ${GE-1}px)`),t=()=>{n(window.innerWidth<GE)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Q.useEffect)(r,i),t}function qE(){return window.innerWidth<GE}function JE(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function YE(e){let{value:t,unit:n}=JE(e);return n===`rem`?t*16:t}function XE(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var ZE=3600*24*7;function QE(e){let t=(0,$.c)(28),{direction:n,currentWidth:r,onResize:i,onToggle:a,isCollapsed:o,minResizeWidth:s,maxResizeWidth:c,enableToggle:l,enableAutoCollapse:u,autoCollapseThreshold:d,expandThreshold:f,enableDrag:p,setIsDraggingRail:m,widthCookieName:h,widthCookieMaxAge:g,isNested:_}=e,v=n===void 0?`right`:n,y=o===void 0?!1:o,b=s===void 0?`14rem`:s,x=c===void 0?`24rem`:c,S=l===void 0?!0:l,C=u===void 0?!0:u,w=d===void 0?1.5:d,T=f===void 0?.2:f,E=p===void 0?!0:p,D=m===void 0?$E:m,O=g===void 0?ZE:g,k=_===void 0?!1:_,A=(0,Q.useRef)(null),j=(0,Q.useRef)(0),M=(0,Q.useRef)(0),N=(0,Q.useRef)(!1),P=(0,Q.useRef)(!1),F=(0,Q.useRef)(null),I=(0,Q.useRef)(0),L=(0,Q.useRef)(!1),R=(0,Q.useRef)(0),z=(0,Q.useRef)(0),B=(0,Q.useRef)(null),V=(0,Q.useRef)(r),H=(0,Q.useRef)(y),U,W;t[0]===r?(U=t[1],W=t[2]):(U=()=>{V.current=r},W=[r],t[0]=r,t[1]=U,t[2]=W),(0,Q.useEffect)(U,W);let G,K;t[3]===y?(G=t[4],K=t[5]):(G=()=>{H.current=y},K=[y],t[3]=y,t[4]=G,t[5]=K),(0,Q.useEffect)(G,K);let q=YE(b),ee;t[6]===x?ee=t[7]:(ee=YE(x),t[6]=x,t[7]=ee);let te=ee,ne;t[8]!==E||t[9]!==k?(ne=function(e){P.current=!0,E&&(j.current=H.current?0:YE(V.current),M.current=e.clientX,I.current=e.clientX,F.current=null,L.current=!1,R.current=0,z.current=0,B.current=k&&A.current?A.current.getBoundingClientRect():null,e.preventDefault())},t[8]=E,t[9]=k,t[10]=ne):ne=t[10];let re=ne,ie,ae;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==te||t[18]!==q||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(ie=()=>{let e=function(e){h&&(document.cookie=`${h}=${e}; path=/; max-age=${O}`)},t=function(e,t){return v===`left`?e<t:e>t},n=function(e,t,n,r){if(k&&r){let r=e.clientX-t;return v===`left`?n-r:n+r}return v===`left`?window.innerWidth-e.clientX:e.clientX},r=function(r){if(!P.current)return;let o=Math.abs(r.clientX-M.current);if(!N.current&&o>5&&(N.current=!0,D(!0)),N.current){let{unit:o}=JE(V.current),s=B.current;k&&A.current&&(s=A.current.getBoundingClientRect());let c=t(r.clientX,I.current)?`expand`:`collapse`;F.current!==c&&(F.current=c),z.current=Math.abs(r.clientX-I.current);let l=Date.now();if(L.current&&l-R.current>200&&(L.current=!1),!L.current){if(C&&a&&!H.current){let e=n(r,M.current,j.current,s),t=!1;if(w<=1)t=e<=q*w;else if(e<=q){let n=q*(w-1);t=q-e>=n}if(c===`collapse`&&t){a(),I.current=r.clientX,L.current=!0,R.current=l;return}}if(a&&H.current&&c===`expand`&&z.current>q*T){a();let t=n(r,M.current,j.current,s),c=Math.max(q,Math.min(te,t)),u=XE(o===`rem`?c/16:c,o);i(u),e(u),I.current=r.clientX,L.current=!0,R.current=l;return}}if(H.current)return;let u=n(r,M.current,j.current,s),d=Math.max(q,Math.min(te,u)),f=XE(o===`rem`?d/16:d,o);i(f),e(f)}},o=function(){P.current&&(!N.current&&a&&S&&a(),N.current=!1,P.current=!1,F.current=null,I.current=0,L.current=!1,R.current=0,z.current=0,B.current=null,D(!1))};return document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,o),()=>{document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,o)}},ae=[i,a,D,q,te,k,C,w,T,S,h,O,v],t[11]=w,t[12]=v,t[13]=C,t[14]=S,t[15]=T,t[16]=k,t[17]=te,t[18]=q,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=ie,t[25]=ae):(ie=t[24],ae=t[25]),(0,Q.useEffect)(ie,ae);let oe;return t[26]===re?oe=t[27]:(oe={dragRef:A,isDragging:N,handleMouseDown:re},t[26]=re,t[27]=oe),oe}function $E(){}var eD=`sidebar_state`,tD=3600*24*7,nD=`18rem`,rD=`3rem`,iD=`app-file-sidebar`,aD=`14.625rem`,oD=`22rem`,sD=`sidebar_width`,cD=/^\d+(?:\.\d+)?(?:rem|px)$/,lD=Q.createContext(null);function uD(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${sD}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return cD.test(n)?n:e}function dD(){let e=Q.use(lD);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function fD(e){let t=(0,$.c)(53),n,r,i,a,o,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8]):({defaultOpen:c,open:i,onOpenChange:o,className:r,style:s,children:n,defaultWidth:l,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l);let u=c===void 0?!0:c,d=l===void 0?nD:l,f=KE(),p;t[9]===d?p=t[10]:(p=()=>uD(d),t[9]=d,t[10]=p);let[m,h]=Q.useState(p),[g,_]=Q.useState(!1),v=Q.useRef(g),[y,b]=Q.useState(!1),[x,S]=Q.useState(!1),[C,w]=Q.useState(u),T=i??C,E;t[11]!==T||t[12]!==o?(E=e=>{let t=typeof e==`function`?e(T):e;o?o(t):w(t),document.cookie=`${eD}=${t}; path=/; max-age=${tD}`},t[11]=T,t[12]=o,t[13]=E):E=t[13];let D=E,O;t[14]===D?O=t[15]:(O=function(){return window.innerWidth<1280?_(mD):D(pD)},t[14]=D,t[15]=O);let k=O,A;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(){window.innerWidth>=1280||v.current&&(window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||S(!0))},t[16]=A):A=t[16];let j=A,M;t[17]===g?M=t[18]:(M=()=>{v.current=g},t[17]=g,t[18]=M),Q.useLayoutEffect(M);let N,P;t[19]!==f||t[20]!==g?(N=()=>{if(!f||!g)return;let e=e=>{e.key===`Escape`&&(document.querySelector(`[data-state="open"][role="dialog"], [data-state="open"][role="alertdialog"], [data-state="open"][role="menu"], [data-state="open"][role="listbox"], [data-radix-popper-content-wrapper] [data-state="open"]`)||_(!1))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},P=[f,g],t[19]=f,t[20]=g,t[21]=N,t[22]=P):(N=t[21],P=t[22]),Q.useEffect(N,P);let F,I;t[23]===k?(F=t[24],I=t[25]):(F=()=>{if(typeof window<`u`&&window.okDesktop!=null)return;let e=e=>{e.altKey&&(e.metaKey||e.ctrlKey)&&e.code===`KeyS`&&(e.preventDefault(),k())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},I=[k],t[23]=k,t[24]=F,t[25]=I),Q.useEffect(F,I);let L=Q.useRef(f),R,z;t[26]!==f||t[27]!==T?(R=()=>{!L.current&&f&&_(T),L.current=f},z=[f,T],t[26]=f,t[27]=T,t[28]=R,t[29]=z):(R=t[28],z=t[29]),Q.useEffect(R,z);let B=f?g?`expanded`:`collapsed`:T?`expanded`:`collapsed`,V;t[30]!==y||t[31]!==f||t[32]!==T||t[33]!==g||t[34]!==D||t[35]!==x||t[36]!==B||t[37]!==k||t[38]!==m?(V={state:B,open:T,setOpen:D,isMobile:f,openMobile:g,setOpenMobile:_,toggleSidebar:k,width:m,setWidth:h,isDraggingRail:y,setIsDraggingRail:b,showPushPulse:x,setShowPushPulse:S,notifySidebarFileSelected:j},t[30]=y,t[31]=f,t[32]=T,t[33]=g,t[34]=D,t[35]=x,t[36]=B,t[37]=k,t[38]=m,t[39]=V):V=t[39];let H;t[40]!==s||t[41]!==m?(H={"--sidebar-width":m,"--sidebar-width-icon":rD,...s},t[40]=s,t[41]=m,t[42]=H):H=t[42];let U=H,W;t[43]===r?W=t[44]:(W=Ei(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),t[43]=r,t[44]=W);let G;t[45]!==n||t[46]!==a||t[47]!==U||t[48]!==W?(G=(0,Z.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:U,className:W,...a,children:n}),t[45]=n,t[46]=a,t[47]=U,t[48]=W,t[49]=G):G=t[49];let K;return t[50]!==V||t[51]!==G?(K=(0,Z.jsx)(lD.Provider,{value:V,children:G}),t[50]=V,t[51]=G,t[52]=K):K=t[52],K}function pD(e){return!e}function mD(e){return!e}function hD(e){let t=(0,$.c)(57),n,r,a,o,s,c;t[0]===e?(n=t[1],r=t[2],a=t[3],o=t[4],s=t[5],c=t[6]):({side:o,variant:s,collapsible:c,className:r,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=o,t[5]=s,t[6]=c);let l=o===void 0?`left`:o,u=s===void 0?`sidebar`:s,d=c===void 0?`offcanvas`:c,{_:f}=i(),{isMobile:p,state:m,openMobile:h,isDraggingRail:g}=dD();if(d===`none`){let e;t[7]===r?e=t[8]:(e=Ei(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),t[7]=r,t[8]=e);let i;return t[9]!==n||t[10]!==a||t[11]!==e||t[12]!==u?(i=(0,Z.jsx)(`div`,{"data-slot":`sidebar`,"data-variant":u,className:e,...a,children:n}),t[9]=n,t[10]=a,t[11]=e,t[12]=u,t[13]=i):i=t[13],i}if(p){let e=h?`expanded`:`collapsed`,i;t[14]===f?i=t[15]:(i=f({id:`07q4Qk`}),t[14]=f,t[15]=i);let o=u===`floating`||u===`inset`?`p-2`:``,s;t[16]!==r||t[17]!==o?(s=Ei(`fixed inset-y-0 z-30 flex h-svh w-(--sidebar-width)`,`transition-transform duration-200 ease-linear motion-reduce:transition-none`,`data-[side=left]:left-0 data-[side=right]:right-0`,`group-data-[state=collapsed]:data-[side=left]:-translate-x-full`,`group-data-[state=collapsed]:data-[side=right]:translate-x-full`,o,r),t[16]=r,t[17]=o,t[18]=s):s=t[18];let c;t[19]===n?c=t[20]:(c=(0,Z.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,children:n}),t[19]=n,t[20]=c);let d;t[21]!==a||t[22]!==l||t[23]!==i||t[24]!==s||t[25]!==c?(d=(0,Z.jsx)(`nav`,{id:iD,"aria-label":i,"data-slot":`sidebar-container`,"data-side":l,className:s,...a,children:c}),t[21]=a,t[22]=l,t[23]=i,t[24]=s,t[25]=c,t[26]=d):d=t[26];let p;return t[27]!==e||t[28]!==l||t[29]!==d||t[30]!==u?(p=(0,Z.jsx)(`div`,{className:`group peer text-sidebar-foreground`,"data-state":e,"data-variant":u,"data-side":l,"data-slot":`sidebar`,"data-mobile":`true`,children:d}),t[27]=e,t[28]=l,t[29]=d,t[30]=u,t[31]=p):p=t[31],p}let _=m===`collapsed`?d:``,v=u===`floating`||u===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`,y;t[32]===v?y=t[33]:(y=Ei(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,v,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`),t[32]=v,t[33]=y);let b;t[34]===y?b=t[35]:(b=(0,Z.jsx)(`div`,{"data-slot":`sidebar-gap`,className:y}),t[34]=y,t[35]=b);let x;t[36]===f?x=t[37]:(x=f({id:`07q4Qk`}),t[36]=f,t[37]=x);let S=u===`floating`||u===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,C;t[38]!==r||t[39]!==S?(C=Ei(`fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex`,S,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`,r),t[38]=r,t[39]=S,t[40]=C):C=t[40];let w;t[41]===n?w=t[42]:(w=(0,Z.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,children:n}),t[41]=n,t[42]=w);let T;t[43]!==a||t[44]!==l||t[45]!==C||t[46]!==w||t[47]!==x?(T=(0,Z.jsx)(`nav`,{id:iD,"aria-label":x,"data-slot":`sidebar-container`,"data-side":l,className:C,...a,children:w}),t[43]=a,t[44]=l,t[45]=C,t[46]=w,t[47]=x,t[48]=T):T=t[48];let E;return t[49]!==g||t[50]!==l||t[51]!==m||t[52]!==T||t[53]!==_||t[54]!==b||t[55]!==u?(E=(0,Z.jsxs)(`div`,{className:`group peer hidden text-sidebar-foreground md:block`,"data-state":m,"data-collapsible":_,"data-variant":u,"data-side":l,"data-slot":`sidebar`,"data-dragging":g,children:[b,T]}),t[49]=g,t[50]=l,t[51]=m,t[52]=T,t[53]=_,t[54]=b,t[55]=u,t[56]=E):E=t[56],E}function gD(e){let t=(0,$.c)(21),n,r,a;t[0]===e?(n=t[1],r=t[2],a=t[3]):({className:n,onClick:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a);let{_:o}=i(),{toggleSidebar:s,state:c}=dD(),l=c===`expanded`,u;t[4]!==o||t[5]!==c?(u=o(c===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[4]=o,t[5]=c,t[6]=u):u=t[6];let d;t[7]===n?d=t[8]:(d=Ei(n),t[7]=n,t[8]=d);let f;t[9]!==r||t[10]!==s?(f=e=>{r?.(e),s()},t[9]=r,t[10]=s,t[11]=f):f=t[11];let p;t[12]===c?p=t[13]:(p=c===`expanded`?(0,Z.jsx)(le,{}):(0,Z.jsx)(Hc,{}),t[12]=c,t[13]=p);let m;return t[14]!==a||t[15]!==l||t[16]!==u||t[17]!==d||t[18]!==f||t[19]!==p?(m=(0,Z.jsx)(Ni,{"data-sidebar":`trigger`,"data-slot":`sidebar-trigger`,variant:`ghost`,size:`icon-sm`,"aria-expanded":l,"aria-controls":iD,"aria-label":u,className:d,onClick:f,...a,children:p}),t[14]=a,t[15]=l,t[16]=u,t[17]=d,t[18]=f,t[19]=p,t[20]=m):m=t[20],m}function _D(e){let t=(0,$.c)(32),n,r,a,o,s;t[0]===e?(n=t[1],r=t[2],a=t[3],o=t[4],s=t[5]):({className:n,enableDrag:o,enableToggle:s,onMouseDown:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=o,t[5]=s);let c=o===void 0?!0:o,l=s===void 0?!0:s,{_:u}=i(),{toggleSidebar:d,setWidth:f,state:p,width:m,setIsDraggingRail:h}=dD(),g=p===`collapsed`,_;t[6]!==c||t[7]!==l||t[8]!==h||t[9]!==f||t[10]!==g||t[11]!==d||t[12]!==m?(_={direction:`right`,enableDrag:c,enableToggle:l,onResize:f,onToggle:d,currentWidth:m,isCollapsed:g,minResizeWidth:aD,maxResizeWidth:oD,setIsDraggingRail:h,widthCookieName:sD,widthCookieMaxAge:tD},t[6]=c,t[7]=l,t[8]=h,t[9]=f,t[10]=g,t[11]=d,t[12]=m,t[13]=_):_=t[13];let{dragRef:v,handleMouseDown:y}=QE(_),b;t[14]!==u||t[15]!==p?(b=u(p===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[14]=u,t[15]=p,t[16]=b):b=t[16];let x;t[17]!==y||t[18]!==r?(x=e=>{r?.(e),e.defaultPrevented||y(e)},t[17]=y,t[18]=r,t[19]=x):x=t[19];let S;t[20]!==u||t[21]!==p?(S=u(p===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[20]=u,t[21]=p,t[22]=S):S=t[22];let C;t[23]===n?C=t[24]:(C=Ei(`absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2`,`in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize`,`[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize`,`group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar`,`[[data-side=left][data-collapsible=offcanvas]_&]:-right-2`,`[[data-side=right][data-collapsible=offcanvas]_&]:-left-2`,`md:group-data-[variant=inset]:after:inset-y-5`,n),t[23]=n,t[24]=C);let w;return t[25]!==v||t[26]!==a||t[27]!==b||t[28]!==x||t[29]!==S||t[30]!==C?(w=(0,Z.jsx)(`button`,{ref:v,"data-sidebar":`rail`,"data-slot":`sidebar-rail`,"aria-label":b,tabIndex:-1,onMouseDown:x,title:S,className:C,...a}),t[25]=v,t[26]=a,t[27]=b,t[28]=x,t[29]=S,t[30]=C,t[31]=w):w=t[31],w}function vD(e){let t=(0,$.c)(21),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,onClick:i,onAnimationEnd:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let{isMobile:o,openMobile:s,setOpenMobile:c,showPushPulse:l,setShowPushPulse:u}=dD(),d;t[5]!==o||t[6]!==i||t[7]!==s||t[8]!==c?(d=e=>{i?.(e),!e.defaultPrevented&&(!o||!s||e.target?.closest(`[data-sidebar="trigger"]`)||c(!1))},t[5]=o,t[6]=i,t[7]=s,t[8]=c,t[9]=d):d=t[9];let f=d,p;t[10]!==r||t[11]!==u?(p=e=>{r?.(e),e.animationName===`sidebar-push-pulse`&&u(!1)},t[10]=r,t[11]=u,t[12]=p):p=t[12];let m=p,h=l?``:void 0,g;t[13]===n?g=t[14]:(g=Ei(`relative flex w-full flex-1 flex-col bg-background peer-data-[variant=inset]:m-2 peer-data-[variant=inset]:ml-0 peer-data-[variant=inset]:rounded-xl peer-data-[variant=inset]:shadow-sm peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2`,`transition-transform duration-200 ease-linear motion-reduce:transition-none`,`peer-data-[mobile=true]:peer-data-[state=expanded]:translate-x-(--sidebar-width)`,n),t[13]=n,t[14]=g);let _;return t[15]!==m||t[16]!==f||t[17]!==a||t[18]!==h||t[19]!==g?(_=(0,Z.jsx)(`main`,{"data-slot":`sidebar-inset`,"data-push-pulse":h,onClick:f,onAnimationEnd:m,className:g,...a}),t[15]=m,t[16]=f,t[17]=a,t[18]=h,t[19]=g,t[20]=_):_=t[20],_}function yD(e){let t=(0,$.c)(8),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=Ei(`flex flex-col gap-2 p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-header`,"data-sidebar":`header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function bD(e){let t=(0,$.c)(8),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=Ei(`flex flex-col gap-2 p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-footer`,"data-sidebar":`footer`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function xD(e){let t=(0,$.c)(8),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=Ei(`no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-content`,"data-sidebar":`content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function SD(e){let t=(0,$.c)(8),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=Ei(`flex w-full min-w-0 flex-col gap-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`ul`,{"data-slot":`sidebar-menu`,"data-sidebar":`menu`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function CD(e){let t=(0,$.c)(8),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=Ei(`group/menu-item relative`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`li`,{"data-slot":`sidebar-menu-item`,"data-sidebar":`menu-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var wD=Fi(`peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-hover hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-hover active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-hover data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground data-active:hover:bg-sidebar-accent [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate`,{variants:{variant:{default:`hover:bg-sidebar-hover hover:text-sidebar-accent-foreground`,outline:`bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-hover hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]`},size:{default:`h-8 text-sm`,sm:`h-7 text-xs`,lg:`h-12 text-sm group-data-[collapsible=icon]:p-0!`}},defaultVariants:{variant:`default`,size:`default`}});function TD(e){let t=(0,$.c)(28),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({asChild:i,isActive:a,variant:o,size:s,tooltip:c,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=i===void 0?!1:i,u=a===void 0?!1:a,d=o===void 0?`default`:o,f=s===void 0?`default`:s,p=l?Oi:`button`,{isMobile:m,state:h}=dD(),g;t[8]!==n||t[9]!==f||t[10]!==d?(g=Ei(wD({variant:d,size:f}),n),t[8]=n,t[9]=f,t[10]=d,t[11]=g):g=t[11];let _;t[12]!==p||t[13]!==u||t[14]!==r||t[15]!==f||t[16]!==g?(_=(0,Z.jsx)(p,{"data-slot":`sidebar-menu-button`,"data-sidebar":`menu-button`,"data-size":f,"data-active":u,className:g,...r}),t[12]=p,t[13]=u,t[14]=r,t[15]=f,t[16]=g,t[17]=_):_=t[17];let v=_;if(!c)return v;if(typeof c==`string`){let e;t[18]===c?e=t[19]:(e={children:c},t[18]=c,t[19]=e),c=e}let y;t[20]===v?y=t[21]:(y=(0,Z.jsx)(cr,{asChild:!0,children:v}),t[20]=v,t[21]=y);let b=h!==`collapsed`||m,x;t[22]!==b||t[23]!==c?(x=(0,Z.jsx)(Qn,{side:`right`,align:`center`,hidden:b,...c}),t[22]=b,t[23]=c,t[24]=x):x=t[24];let S;return t[25]!==y||t[26]!==x?(S=(0,Z.jsxs)(Gr,{children:[y,x]}),t[25]=y,t[26]=x,t[27]=S):S=t[27],S}function ED(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r.kind!==i.kind)return!1;if(r.kind===`human`&&i.kind===`human`){if(r.clientId!==i.clientId||r.mode!==i.mode||r.tabCount!==i.tabCount)return!1;let e=r.user,t=i.user;if(e.name!==t.name||e.color!==t.color||e.icon!==t.icon)return!1}else if(r.kind===`agent`&&i.kind===`agent`){if(r.agentId!==i.agentId)return!1;let e=r.presence,t=i.presence;if(e.displayName!==t.displayName||e.icon!==t.icon||e.color!==t.color||e.currentDoc!==t.currentDoc||e.mode!==t.mode)return!1}}return!0}function DD(e){let t=new Map;for(let n of e){let e=n.user.principalId;if(typeof e==`string`&&e.length>0){let r=t.get(e);r?r.push(n):t.set(e,[n])}}let n=new Map;for(let[e,r]of t){let t=r.reduce((e,t)=>Math.min(e,t.clientId),1/0);n.set(e,{repClientId:t,count:r.length})}let r=[];for(let t of e){let e=t.user.principalId;if(typeof e==`string`&&e.length>0){let i=n.get(e);i&&i.repClientId===t.clientId&&r.push({...t,tabCount:i.count})}else r.push({...t,tabCount:1})}return r}var OD=1e3,kD=!1;function AD(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function jD(e,t,n){let r=(0,$.c)(9),i;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={current:[],crossDoc:[]},r[0]=i):i=r[0];let[a,o]=(0,Q.useState)(i),s;r[1]!==n||r[2]!==e?.awareness||r[3]!==t?.awareness?(s=()=>{let r=e?.awareness,i=t?.awareness,a;i==null?a=void 0:Ji(i)?a=i:(a=void 0,kD||(kD=!0,console.warn(`[agent-presence] __system__ provider awareness missing getStates() — presence bar will render without agent peers`)));let s=()=>{let e=(r?.getLocalState())?.user?.principalId??null,t=r?.clientID??null,i=[];if(r)for(let[n,a]of r.getStates().entries()){let r=a;if(!r.user||typeof r.user!=`object`)continue;let o=r.user;o.type===`human`&&(AD({entryPrincipalId:o.principalId,entryClientId:n,localPrincipalId:e,localClientId:t})||i.push({kind:`human`,clientId:n,user:o,mode:r.mode??`wysiwyg`,tabCount:1}))}let s=DD(i),{current:c,crossDoc:l}=a?Ui(a,n,Date.now()):{current:[],crossDoc:[]},u=MD,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>ED(e.current,p)&&ED(e.crossDoc,m)?e:{current:p,crossDoc:m})};s();let c=()=>s(),l=()=>s();r?.on(`change`,c),t?.awareness?.on(`change`,l);let u=setInterval(s,OD);return()=>{r?.off(`change`,c),t?.awareness?.off(`change`,l),clearInterval(u)}},r[1]=n,r[2]=e?.awareness,r[3]=t?.awareness,r[4]=s):s=r[4];let c;return r[5]!==n||r[6]!==e||r[7]!==t?(c=[e,t,n],r[5]=n,r[6]=e,r[7]=t,r[8]=c):c=r[8],(0,Q.useEffect)(s,c),a}function MD(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var ND=`sync-status`;function PD(e,t){let n=(0,$.c)(5),{_:r}=i(),a=(0,Q.useRef)(!1),o=(0,Q.useRef)(!1),s=(0,Q.useRef)(t),c,l;n[0]!==r||n[1]!==t||n[2]!==e?(c=()=>{s.current!==t&&(s.current=t,a.current=!1,o.current=!1),t&&(e===`synced`&&(a.current=!0),e===`disconnected`&&a.current?(o.current=!0,$o.warning(r({id:`HGNCsl`}),{id:ND,duration:1/0})):o.current&&e===`synced`&&(o.current=!1,$o.success(r({id:`GhjUB_`}),{id:ND,duration:3e3})))},l=[e,t,r],n[0]=r,n[1]=t,n[2]=e,n[3]=c,n[4]=l):(c=n[3],l=n[4]),(0,Q.useEffect)(c,l)}var FD=4,ID=3,LD={Bird:tc,Cat:sc,Dog:vc,Fish:Cc,Mouse:Yc,Rabbit:Jc,Shrimp:rl,Snail:il,Squirrel:sl,Turtle:fl};Object.freeze(Object.keys(LD));function RD(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(LD,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var zD={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function BD(e){let t=(0,$.c)(28),{user:n,mode:r,tabCount:a}=e,{_:o}=i(),s=RD(n),c=s.kind===`animal`?LD[s.animal]:void 0,l;t[0]===n.name?l=t[1]:(l=qr(n.name),t[0]=n.name,t[1]=l);let u=l,d;t[2]===n.color?d=t[3]:(d=Gn(n.color),t[2]=n.color,t[3]=d);let f=d,p=n.name,m;t[4]!==o||t[5]!==a||t[6]!==p?(m=a>1?o({id:`qAhFeg`,values:{userName:p,tabCount:a}}):p,t[4]=o,t[5]=a,t[6]=p,t[7]=m):m=t[7];let h=m,g;t[8]!==o||t[9]!==a||t[10]!==p?(g=a>1?o({id:`BEkF-P`,values:{userName:p,tabCount:a}}):p,t[8]=o,t[9]=a,t[10]=p,t[11]=g):g=t[11];let _=g,v;t[12]===n.color?v=t[13]:(v={backgroundColor:n.color},t[12]=n.color,t[13]=v);let y;t[14]!==c||t[15]!==f||t[16]!==u?(y=c?(0,Z.jsx)(c,{size:18,color:f,strokeWidth:1.5}):(0,Z.jsx)(`span`,{className:`font-mono text-2xs font-semibold leading-none`,style:{color:f},children:u}),t[14]=c,t[15]=f,t[16]=u,t[17]=y):y=t[17];let b;t[18]!==_||t[19]!==r||t[20]!==v||t[21]!==y?(b=(0,Z.jsx)(cr,{asChild:!0,children:(0,Z.jsx)(`div`,{"data-presence-badge":`human`,"data-presence-mode":r,role:`img`,"aria-label":_,className:`inline-flex size-7 shrink-0 cursor-default items-center justify-center rounded-full ring-2 ring-background`,style:v,children:y})}),t[18]=_,t[19]=r,t[20]=v,t[21]=y,t[22]=b):b=t[22];let x;t[23]===h?x=t[24]:(x=(0,Z.jsx)(Qn,{children:h}),t[23]=h,t[24]=x);let S;return t[25]!==b||t[26]!==x?(S=(0,Z.jsxs)(Gr,{children:[b,x]}),t[25]=b,t[26]=x,t[27]=S):S=t[27],S}function VD(e){let t=zD[e.icon];return e.displayName||t||X._({id:`iEQQyu`})}function HD(e){let t=(0,$.c)(3),[n,r]=(0,Q.useState)(e===`writing`),i=(0,Q.useRef)(null),a,o;return t[0]===e?(a=t[1],o=t[2]):(a=()=>{if(e===`writing`){i.current!==null&&(clearTimeout(i.current),i.current=null),r(!0);return}return i.current!==null&&clearTimeout(i.current),i.current=setTimeout(()=>{i.current=null,r(!1)},600),()=>{i.current!==null&&(clearTimeout(i.current),i.current=null)}},o=[e],t[0]=e,t[1]=a,t[2]=o),(0,Q.useEffect)(a,o),n}function UD(e){let t=(0,$.c)(34),{participant:n,crossDoc:r,scoped:a,onClickAgent:o}=e,{_:c}=i(),{presence:l,agentId:u}=n,d=VD(l),f=HD(l.mode),p=!r&&f,m=a?`ring-primary ring-offset-2 ring-offset-background`:`ring-background`,h=p&&!a?`ring-primary/40 animate-pulse`:``,g;t[0]!==m||t[1]!==h?(g=[`inline-flex size-7 shrink-0 items-center justify-center rounded-full ring-2 cursor-pointer`,m,h].filter(Boolean),t[0]=m,t[1]=h,t[2]=g):g=t[2];let _=g.join(` `),v=r?`true`:void 0,y=a?`true`:void 0,b;t[3]!==l.mode||t[4]!==v||t[5]!==y?(b={"data-presence-badge":`agent`,"data-presence-mode":l.mode,"data-presence-crossdoc":v,"data-presence-scoped":y},t[3]=l.mode,t[4]=v,t[5]=y,t[6]=b):b=t[6];let x=b,S=l.currentDoc&&l.currentDoc!==`(connected)`?l.currentDoc:null,C=c(r&&S?{id:`b4AQFK`,values:{tooltipName:d,realCurrentDoc:S}}:{id:`RfHNf8`,values:{tooltipName:d}}),w;t[7]===l.color?w=t[8]:(w={backgroundColor:l.color},t[7]=l.color,t[8]=w);let T;t[9]!==u||t[10]!==o?(T=()=>o(u),t[9]=u,t[10]=o,t[11]=T):T=t[11];let E;t[12]===l.icon?E=t[13]:(E=(0,Z.jsx)(Ki,{icon:l.icon,width:16,height:16,className:`text-white`}),t[12]=l.icon,t[13]=E);let D;t[14]!==C||t[15]!==x||t[16]!==_||t[17]!==w||t[18]!==T||t[19]!==E?(D=(0,Z.jsx)(`button`,{type:`button`,...x,"aria-label":C,className:_,style:w,onClick:T,children:E}),t[14]=C,t[15]=x,t[16]=_,t[17]=w,t[18]=T,t[19]=E,t[20]=D):D=t[20];let O=D,k;t[21]===O?k=t[22]:(k=(0,Z.jsx)(cr,{asChild:!0,children:O}),t[21]=O,t[22]=k);let A;t[23]===d?A=t[24]:(A=(0,Z.jsx)(`span`,{className:`font-medium`,children:d}),t[23]=d,t[24]=A);let j;t[25]!==r||t[26]!==S?(j=r&&S?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(s,{id:`Wh0im4`,values:{realCurrentDoc:S}})}):null,t[25]=r,t[26]=S,t[27]=j):j=t[27];let M;t[28]!==A||t[29]!==j?(M=(0,Z.jsxs)(Qn,{className:`flex flex-col gap-0.5`,children:[A,j]}),t[28]=A,t[29]=j,t[30]=M):M=t[30];let N;return t[31]!==k||t[32]!==M?(N=(0,Z.jsxs)(Gr,{children:[k,M]}),t[31]=k,t[32]=M,t[33]=N):N=t[33],N}function WD(e){let t=(0,$.c)(21),{count:n,remainder:r,crossDoc:i,scopedAgentId:a,onClickAgent:o}=e,s;t[0]!==n||t[1]!==i?(s=i?X._({id:`9euN0m`,values:{count:n}}):X._({id:`uhJEA2`,values:{count:n}}),t[0]=n,t[1]=i,t[2]=s):s=t[2];let c=s,l=i?`true`:void 0,u;t[3]!==n||t[4]!==c||t[5]!==l?(u=(0,Z.jsx)(w,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`presence-overflow`,"data-presence-crossdoc":l,className:`inline-flex size-7 shrink-0 cursor-pointer items-center justify-center rounded-full bg-muted font-medium text-muted-foreground text-xs ring-2 ring-background hover:bg-muted/80`,"aria-label":c,children:[`+`,n]})}),t[3]=n,t[4]=c,t[5]=l,t[6]=u):u=t[6];let d;if(t[7]!==i||t[8]!==o||t[9]!==r||t[10]!==a){let e;t[12]!==i||t[13]!==o||t[14]!==a?(e=e=>e.kind===`human`?(0,Z.jsx)(BD,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(UD,{participant:e,crossDoc:i,scoped:a===e.agentId,onClickAgent:o},e.agentId),t[12]=i,t[13]=o,t[14]=a,t[15]=e):e=t[15],d=r.map(e),t[7]=i,t[8]=o,t[9]=r,t[10]=a,t[11]=d}else d=t[11];let f;t[16]===d?f=t[17]:(f=(0,Z.jsx)(pe,{align:`end`,className:`w-auto max-w-xs p-2`,children:(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:d})}),t[16]=d,t[17]=f);let p;return t[18]!==u||t[19]!==f?(p=(0,Z.jsxs)(v,{children:[u,f]}),t[18]=u,t[19]=f,t[20]=p):p=t[20],p}function GD(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(BD,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(UD,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function KD(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=ft(),{current:s,crossDoc:c}=jD(t,r,n);if(PD(hS(t),n),s.length===0&&c.length===0)return null;let l;if(e[0]!==c||e[1]!==s||e[2]!==o||e[3]!==a||e[4]!==i){let t=s.slice(0,FD),n;e[6]===s?n=e[7]:(n=s.slice(FD),e[6]=s,e[7]=n);let r=n,u=c.slice(0,ID),d;e[8]===c?d=e[9]:(d=c.slice(ID),e[8]=c,e[9]=d);let f=d,p=i,m=a===`agent`?o:null,h;e[10]!==p||e[11]!==m?(h=e=>GD(e,p,!1,m),e[10]=p,e[11]=m,e[12]=h):h=e[12];let g=t.map(h),_;e[13]!==r||e[14]!==p||e[15]!==m?(_=r.length>0?(0,Z.jsx)(WD,{count:r.length,remainder:r,crossDoc:!1,scopedAgentId:m,onClickAgent:p}):null,e[13]=r,e[14]=p,e[15]=m,e[16]=_):_=e[16];let v;e[17]!==g||e[18]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,"data-presence-section":`current`,children:[g,_]}),e[17]=g,e[18]=_,e[19]=v):v=e[19],l=(0,Z.jsxs)(`div`,{"data-slot":`presence-bar`,className:`flex items-center px-1 py-1.5`,children:[v,c.length>0?(0,Z.jsxs)(`div`,{className:`ml-1.5 flex items-center gap-1.5`,"data-presence-section":`crossdoc`,children:[u.map(e=>GD(e,p,!0,m)),f.length>0?(0,Z.jsx)(WD,{count:f.length,remainder:f,crossDoc:!0,scopedAgentId:m,onClickAgent:p}):null]}):null]}),e[0]=c,e[1]=s,e[2]=o,e[3]=a,e[4]=i,e[5]=l}else l=e[5];return l}var qD=`.md`,JD=/\.(md|mdx)$/i;function YD(e,t=qD){return`${e}${t}`}function XD(e){return hO(e).replace(JD,``)}function ZD(e){return Yr(e)?eO(e.path):Nn(e)?e.path:YD(e.docName,e.docExt)}function QD(e){let t=hO(e).match(JD);return t?`.${t[1].toLowerCase()}`:void 0}function $D(e){return hO(e)}function eO(e){let t=hO(e.trim());return t?`${t}/`:``}function tO(e){return e.endsWith(`/`)?$D(e):XD(e)}function nO(e){return e.map(ZD)}function rO(e){return[...e].sort().join(`\0`)}function iO(e){return rO(nO(e))}function aO(e){let t=new Set;for(let n of e){if(Yr(n)){let e=eO(n.path);e&&t.add(e)}let e=(Yr(n)||Nn(n)?n.path:n.docName).split(`/`).filter(Boolean),r=Yr(n)?e.length:e.length-1;for(let n=1;n<=r;n++)t.add(`${e.slice(0,n).join(`/`)}/`)}return[...t].sort()}function oO(e){if(!e)return[];let t=hO(e.replace(JD,``)).split(`/`).filter(Boolean),n=[],r=e.endsWith(`/`)?t.length:t.length-1;for(let e=1;e<=r;e++)n.push(`${t.slice(0,e).join(`/`)}/`);return n}function sO(e,t,n){let r=QD(e);if(r)return r;let i=n.find(e=>ir(e)&&e.docName===t);return i?i.docExt??qD:mO(e).includes(`.`)?void 0:qD}function cO(e,t){let n=e.kind===`directory`,r=n?$D(e.path):XD(e.path),i=n?void 0:sO(e.path,r,t);return{kind:n?`folder`:`file`,name:hO(mO(e.path)).replace(JD,``),path:r,treePath:uO(e.path,n),docExt:i}}function lO(e){return e.kind===`directory`?$D(e.path):e.path}function uO(e,t){return t?eO(e):JD.test(e)?e:`${e}${qD}`}function dO(e,t,n){let r=eO(t),i=new Set(n);for(let t=0;t<100;t++){let n=t===0?``:` ${t+1}`;if(e===`file`){let e=`${r}Untitled${n}${qD}`;if(!i.has(e))return{addPath:e,renamePath:e};continue}let a=`${r}New Folder${n}/`;if(!i.has(a))return{addPath:a,renamePath:a}}throw Error(`Could not allocate a unique tree placeholder`)}function fO(e,t){return e===`file`?uO(t,!1):`${$D(t)}/index${qD}`}function pO(e,t){return t.kind===`root`||t.directoryPath==null?mO(e):`${t.directoryPath}${mO(e)}`}function mO(e){let t=hO(e),n=t.lastIndexOf(`/`),r=n===-1?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function hO(e){return e.endsWith(`/`)?e.slice(0,-1):e}function gO(e,t){return t.trim()}function _O(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function vO(e,t){let n=gO(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function yO(e,t,n=[]){if(t.length===0&&n.length===0)return e;let r=new Map(t.map(e=>[e.fromDocName,e.toDocName]));return e.map(e=>ir(e)?{...e,docName:r.get(e.docName)??e.docName}:Yr(e)||Nn(e)?{...e,path:TO(e.path,n)}:e)}function bO(e,t,n){if(t.length===0&&!n)return e;let r=new Set(t);return e.filter(e=>ir(e)?!r.has(e.docName)&&!kO(e.docName,n):Yr(e)||Nn(e)?!kO(e.path,n):!0)}function xO(e,t,n,r=new Date().toISOString()){let i=!1,a=[...e],o=e=>{a.some(t=>EO(t,e))||(a.push(e),i=!0)};if(n.kind===`file`){let s=e.find(e=>ir(e)&&e.docName===t.path);return o({kind:`document`,docName:n.path,docExt:s?.docExt??t.docExt,size:s?.size??0,modified:r}),i?a:e}let s=e.find(e=>Yr(e)&&e.path===t.path);o({kind:`folder`,path:n.path,size:s?.size??0,modified:r});let c=new Set(n.duplicatedDocNames);for(let i of e){if(ir(i)){let e=OO(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(Yr(i)){let e=DO(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function SO(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function CO(e,t){return e.flatMap(e=>t===e.toDocName?[e.fromDocName]:[e.fromDocName,e.toDocName])}function wO(e,t){let n=e.kind===`folder`||e.docExt===void 0?e.path:YD(e.path,e.docExt);return Zm(t.contentDir,n,t.pathSeparator)}function TO(e,t){for(let{fromPath:n,toPath:r}of t){if(e===n)return r;if(e.startsWith(`${n}/`))return`${r}${e.slice(n.length)}`}return e}function EO(e,t){return ir(e)&&ir(t)?e.docName===t.docName:Yr(e)&&Yr(t)||Nn(e)&&Nn(t)?e.path===t.path:!1}function DO(e,t,n){return e===t?n:OO(e,t,n)}function OO(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function kO(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function AO(e){let t=(0,$.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,Z.jsx)(yu,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}function jO(e){let t=(0,$.c)(8),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=Ei(`select-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(bu,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function MO(e){let t=(0,$.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,Z.jsx)(Du,{"data-slot":`context-menu-sub`,...n}),t[2]=n,t[3]=r),r}function NO(e){let t=(0,$.c)(8),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=Ei(`z-50 max-h-(--radix-context-menu-content-available-height) min-w-36 origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 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[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(xu,{children:(0,Z.jsx)(Su,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function PO(e){let t=(0,$.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,inset:r,variant:a,...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]===n?s=t[6]:(s=Ei(`group/context-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 focus:*:[svg]:text-accent-foreground data-[variant=destructive]:*:[svg]:text-destructive`,n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==i||t[9]!==s||t[10]!==o?(c=(0,Z.jsx)(Cu,{"data-slot":`context-menu-item`,"data-inset":r,"data-variant":o,className:s,...i}),t[7]=r,t[8]=i,t[9]=s,t[10]=o,t[11]=c):c=t[11],c}function FO(e){let t=(0,$.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,inset:i,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=Ei(`flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,r),t[5]=r,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(es,{className:`ml-auto`}),t[7]=s):s=t[7];let c;return t[8]!==n||t[9]!==i||t[10]!==a||t[11]!==o?(c=(0,Z.jsxs)(Ou,{"data-slot":`context-menu-sub-trigger`,"data-inset":i,className:o,...a,children:[n,s]}),t[8]=n,t[9]=i,t[10]=a,t[11]=o,t[12]=c):c=t[12],c}function IO(e){let t=(0,$.c)(8),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=Ei(`z-50 min-w-32 origin-(--radix-context-menu-content-transform-origin) overflow-hidden rounded-lg border bg-popover p-1 text-popover-foreground shadow-lg 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[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(ku,{"data-slot":`context-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function LO(e){let t=(0,$.c)(15),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:i,children:r,checked:n,inset:a,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s;t[6]===i?s=t[7]:(s=Ei(`relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,i),t[6]=i,t[7]=s);let c;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`span`,{className:`pointer-events-none absolute right-2`,children:(0,Z.jsx)(Tu,{children:(0,Z.jsx)(Lo,{})})}),t[8]=c):c=t[8];let l;return t[9]!==n||t[10]!==r||t[11]!==a||t[12]!==o||t[13]!==s?(l=(0,Z.jsxs)(wu,{"data-slot":`context-menu-checkbox-item`,"data-inset":a,className:s,checked:n,...o,children:[c,r]}),t[9]=n,t[10]=r,t[11]=a,t[12]=o,t[13]=s,t[14]=l):l=t[14],l}function RO(e){let t=(0,$.c)(8),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=Ei(`-mx-1 my-1 h-px bg-border`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Eu,{"data-slot":`context-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var zO=[`.md`,`.mdx`],BO=`group relative -mb-px flex h-10 min-w-28 max-w-64 shrink-0 cursor-pointer items-center overflow-hidden border border-transparent font-medium transition-colors`,VO=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,HO=Ei(VO,`bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent hover:border-border focus-visible:border-border`),UO=`flex h-full min-w-0 flex-1 cursor-pointer items-center overflow-hidden px-3 text-left text-[13px] outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,WO=`mr-1.5 flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-sm text-muted-foreground outline-none transition hover:bg-foreground/10 hover:text-foreground hover:opacity-100 focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:opacity-100`;function GO(e){return Ei(WO,e?`opacity-100`:`pointer-events-none opacity-0 group-focus-within:pointer-events-auto group-focus-within:opacity-100 group-hover:pointer-events-auto group-hover:opacity-100`)}function KO(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function qO(e){let t=di(e);window.location.hash!==t&&(window.location.hash=t)}function JO(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}function YO(e,t){let n=[t,...zO].filter((e,t,n)=>e&&n.indexOf(e)===t),r=e.toLowerCase(),i=n.find(t=>e.length>t.length&&r.endsWith(t.toLowerCase()));return i?e.slice(0,-i.length):e}function XO(e){let t=(0,$.c)(26),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({tabId:o,disabled:n,ref:r,style:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s;t[6]!==n||t[7]!==o?(s={id:o,disabled:n},t[6]=n,t[7]=o,t[8]=s):s=t[8];let{attributes:c,listeners:l,setNodeRef:u,transform:d,transition:f,isDragging:p}=wa(s),m;t[9]===d?m=t[10]:(m=ua.Transform.toString(d),t[9]=d,t[10]=m);let h=p?.5:i?.opacity,g=p?1:i?.zIndex,_;t[11]!==i||t[12]!==m||t[13]!==h||t[14]!==g||t[15]!==f?(_={...i,transform:m,transition:f,opacity:h,zIndex:g},t[11]=i,t[12]=m,t[13]=h,t[14]=g,t[15]=f,t[16]=_):_=t[16];let v=_,y;t[17]!==r||t[18]!==u?(y=function(e){u(e),typeof r==`function`?r(e):r&&`current`in r&&(r.current=e)},t[17]=r,t[18]=u,t[19]=y):y=t[19];let b=y,x;return t[20]!==c||t[21]!==b||t[22]!==l||t[23]!==a||t[24]!==v?(x=(0,Z.jsx)(`div`,{ref:b,style:v,...a,...c,...l}),t[20]=c,t[21]=b,t[22]=l,t[23]=a,t[24]=v,t[25]=x):x=t[25],x}function ZO(e){let t=(0,$.c)(52),{children:n,closeTab:r,closeTabs:i,canPin:a,disabled:o,openTabs:c,pinTab:l,pinnedTabIds:u,tabId:d,unpinTab:f}=e,p=a===void 0?!0:a;if(o!==void 0&&o)return n;let m;t[0]!==p||t[1]!==u||t[2]!==d?(m=p&&u.includes(d),t[0]=p,t[1]=u,t[2]=d,t[3]=m):m=t[3];let h=m,g;if(t[4]!==c||t[5]!==u||t[6]!==d){let e;t[8]===d?e=t[9]:(e=e=>e!==d,t[8]=d,t[9]=e),g=xt(c.filter(e),u),t[4]=c,t[5]=u,t[6]=d,t[7]=g}else g=t[7];let _=g,v;t[10]!==c||t[11]!==u?(v=xt(c,u),t[10]=c,t[11]=u,t[12]=v):v=t[12];let y=v,b;t[13]===n?b=t[14]:(b=(0,Z.jsx)(jO,{asChild:!0,children:n}),t[13]=n,t[14]=b);let x;t[15]!==r||t[16]!==d?(x=()=>r(d),t[15]=r,t[16]=d,t[17]=x):x=t[17];let S;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(s,{id:`yz7wBu`}),t[18]=S):S=t[18];let C;t[19]!==h||t[20]!==x?(C=(0,Z.jsx)(PO,{disabled:h,onSelect:x,children:S}),t[19]=h,t[20]=x,t[21]=C):C=t[21];let w=_.length===0,T;t[22]!==i||t[23]!==_?(T=()=>{i(_)},t[22]=i,t[23]=_,t[24]=T):T=t[24];let E;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(s,{id:`omXJcU`}),t[25]=E):E=t[25];let D;t[26]!==w||t[27]!==T?(D=(0,Z.jsx)(PO,{disabled:w,onSelect:T,children:E}),t[26]=w,t[27]=T,t[28]=D):D=t[28];let O=y.length===0,k;t[29]!==y||t[30]!==i?(k=()=>{i(y)},t[29]=y,t[30]=i,t[31]=k):k=t[31];let A;t[32]===u.length?A=t[33]:(A=u.length?(0,Z.jsx)(s,{id:`U2Kx6T`}):(0,Z.jsx)(s,{id:`WyXG7w`}),t[32]=u.length,t[33]=A);let j;t[34]!==O||t[35]!==k||t[36]!==A?(j=(0,Z.jsx)(PO,{disabled:O,"data-testid":`editor-tab-context-close-all`,onSelect:k,children:A}),t[34]=O,t[35]=k,t[36]=A,t[37]=j):j=t[37];let M;t[38]!==p||t[39]!==h||t[40]!==l||t[41]!==d||t[42]!==f?(M=p&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(RO,{}),(0,Z.jsx)(PO,{"data-testid":`editor-tab-context-pin-toggle`,onSelect:()=>h?f(d):l(d),children:h?(0,Z.jsx)(s,{id:`SYfHmN`}):(0,Z.jsx)(s,{id:`3pU8e-`})})]}),t[38]=p,t[39]=h,t[40]=l,t[41]=d,t[42]=f,t[43]=M):M=t[43];let N;t[44]!==D||t[45]!==j||t[46]!==M||t[47]!==C?(N=(0,Z.jsxs)(NO,{className:`min-w-40`,children:[C,D,j,M]}),t[44]=D,t[45]=j,t[46]=M,t[47]=C,t[48]=N):N=t[48];let P;return t[49]!==N||t[50]!==b?(P=(0,Z.jsxs)(AO,{children:[b,N]}),t[49]=N,t[50]=b,t[51]=P):P=t[51],P}function QO(e){let t=(0,$.c)(20),{accessibleLabel:n,closeTab:r,isPinned:a,tabId:o,unpinTab:s}=e,{_:c}=i();if(a){let e;t[0]!==c||t[1]!==n?(e=c({id:`t18QYR`,values:{accessibleLabel:n}}),t[0]=c,t[1]=n,t[2]=e):e=t[2];let r;t[3]!==o||t[4]!==s?(r=e=>{e.stopPropagation(),s(o)},t[3]=o,t[4]=s,t[5]=r):r=t[5];let i;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(qc,{"aria-hidden":`true`}),t[6]=i):i=t[6];let a;return t[7]!==e||t[8]!==r?(a=(0,Z.jsx)(Ni,{variant:`ghost`,size:`icon-xs`,type:`button`,"aria-label":e,"data-testid":`editor-tab-unpin-button`,className:`mr-1.5 text-primary! hover:bg-primary/10!`,onClick:r,children:i}),t[7]=e,t[8]=r,t[9]=a):a=t[9],a}let l;t[10]!==c||t[11]!==n?(l=c({id:`JLzQi_`,values:{accessibleLabel:n}}),t[10]=c,t[11]=n,t[12]=l):l=t[12];let u;t[13]!==r||t[14]!==o?(u=e=>{e.stopPropagation(),r(o)},t[13]=r,t[14]=o,t[15]=u):u=t[15];let d;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Ro,{"aria-hidden":`true`}),t[16]=d):d=t[16];let f;return t[17]!==l||t[18]!==u?(f=(0,Z.jsx)(Ni,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":l,"data-testid":`editor-tab-close-button`,className:`mr-1.5`,onClick:u,children:d}),t[17]=l,t[18]=u,t[19]=f):f=t[19],f}function $O(e){let t=(0,$.c)(1),{docName:n}=e;if(mS(n)!==`conflict`)return null;let r;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(Pn,{"aria-label":`Conflict`,"data-testid":`editor-tab-conflict-badge`,className:`mr-1 size-3.5 shrink-0 text-amber-500`}),t[0]=r):r=t[0],r}function ek(){let e=(0,$.c)(69),{activeDocName:t,activeTabId:n,activeNewTabId:r,activeTarget:a,activateTab:o,activateNewTab:c,closeAndClearForRename:l,closeNewTab:u,closeTab:d,closeTabs:f,getPoolActiveDocName:p,isNewTabActive:m,newTabIds:h,openNewTab:g,openTabs:_,pinTab:v,pinnedTabIds:y,remapTabsForRename:b,reorderTabs:x,unpinTab:S,visibleTabIds:C}=ft(),{_:w}=i(),{pageMeta:T}=gi(),E=(0,Q.useRef)(null),[D,O]=(0,Q.useState)(null),[k,A]=(0,Q.useState)(``),[j,M]=(0,Q.useState)(null),[F,I]=(0,Q.useState)(!1),L=(0,Q.useRef)(null),R=(0,Q.useRef)(!1),z=(0,Q.useRef)(!1),B=(0,Q.useRef)(null),V=(0,Q.useRef)(t),H;e[0]!==n||e[1]!==t||e[2]!==a?(H=n??(a?Ne(a):t?Je(t):null),e[0]=n,e[1]=t,e[2]=a,e[3]=H):H=e[3];let U=H,W;e[4]!==r||e[5]!==U||e[6]!==m||e[7]!==h||e[8]!==_?(W=m?`${r??`__new-tab__`}\u0000${_.join(`\0`)}\u0000${h.join(`\0`)}`:U?`${U}\u0000${_.join(`\0`)}`:``,e[4]=r,e[5]=U,e[6]=m,e[7]=h,e[8]=_,e[9]=W):W=e[9];let G=W,K,q;e[10]===t?(K=e[11],q=e[12]):(K=()=>{V.current=t},q=[t],e[10]=t,e[11]=K,e[12]=q),(0,Q.useEffect)(K,q);let ee,te;e[13]===G?(ee=e[14],te=e[15]):(ee=()=>{G&&(E.current?.querySelector(`[data-active-tab="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},te=[G],e[13]=G,e[14]=ee,e[15]=te),(0,Q.useEffect)(ee,te);let ne,re;e[16]===D?(ne=e[17],re=e[18]):(ne=()=>{D&&(L.current?.focus(),L.current?.select())},re=[D],e[16]=D,e[17]=ne,e[18]=re),(0,Q.useEffect)(ne,re);let ie,ae;e[19]!==_||e[20]!==D?(ie=()=>{!D||_.includes(D.tabId)||(z.current=!0,B.current=null,O(null),A(``),M(null),I(!1))},ae=[_,D],e[19]=_,e[20]=D,e[21]=ie,e[22]=ae):(ie=e[21],ae=e[22]),(0,Q.useEffect)(ie,ae);let oe=function(e,t){let n=t.split(`/`);z.current=!1,B.current=null,O({docName:t,tabId:e}),A(n[n.length-1]),M(null)},se=function(){z.current=!0,B.current=null,O(null),A(``),M(null),I(!1)},ce=async function(){if(z.current){z.current=!1;return}if(R.current)return;let e=D?.docName;if(!e){se();return}let t=gO(`file`,YO(k,T.get(e)?.docExt??`.md`)),n=e.split(`/`),r=n[n.length-1];if(t===r){se();return}if(t===B.current){L.current?.focus();return}if(!_O(t)){M(w({id:`P8yDjG`})),L.current?.focus();return}let i=vO({kind:`file`,path:e,name:r},t);R.current=!0,I(!0),M(null);try{let n=await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:`file`,fromPath:e,toPath:i})});if(z.current){I(!1),R.current=!1;return}let r=await be(n,`Server error (HTTP ${n.status})`);if(!r.ok){M(r.title),I(!1),R.current=!1,B.current=t,L.current?.focus();return}let a=N(dr,r.body,`rename-path:tab`,{renamed:[]}).renamed,o=V.current,s=SO(o,a);Gt(a);let c=!0;try{let e=CO(a,p());await Promise.all(e.map(e=>l(e))),b(a),Si([`files`,`backlinks`,`graph`])}catch(n){let r=n;c=!1,console.warn(`[EditorTabs] post-rename reconciliation failed`,{err:r,docName:e,newDocName:i,normalized:t}),$o.error(w({id:`MUBR8r`}))}z.current=!0,O(null),A(``),M(null),I(!1),R.current=!1,B.current=null,c&&s&&s!==o&&qO(s)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),M(w({id:`HIb0vl`})),I(!1),R.current=!1,B.current=t,L.current?.focus()}},le=typeof window<`u`&&window.okDesktop!=null,ue;e[23]===h?ue=e[24]:(ue=new Set(h),e[23]=h,e[24]=ue);let de=ue,fe;e[25]!==u||e[26]!==f||e[27]!==de?(fe=function(e){let t=[],n=[];for(let r of e)de.has(r)?n.push(r):t.push(r);t.length>0&&f(t);for(let e of n)u(e)},e[25]=u,e[26]=f,e[27]=de,e[28]=fe):fe=e[28];let pe=fe,me;e[29]===Symbol.for(`react.memo_cache_sentinel`)?(me={activationConstraint:{distance:8}},e[29]=me):me=e[29];let he;e[30]===Symbol.for(`react.memo_cache_sentinel`)?(he={coordinateGetter:ba},e[30]=he):he=e[30];let ge=Fa($i(Da,me),$i(ga,he)),_e;e[31]!==x||e[32]!==C?(_e=function(e){let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=C.indexOf(t),i=C.indexOf(n);r<0||i<0||r===i||x(no([...C],r,i),t)},e[31]=x,e[32]=C,e[33]=_e):_e=e[33];let ve=_e,ye=le?``:void 0,xe;e[34]===Symbol.for(`react.memo_cache_sentinel`)?(xe=Ei(`pl-2 flex h-12 min-w-0 touch-manipulation flex-1 items-end overflow-x-auto overflow-y-hidden overscroll-x-contain scroll-fade-mask-x [scrollbar-width:none]`,le&&`[-webkit-app-region:drag]`),e[34]=xe):xe=e[34];let Se=JO,Ce;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=Ei(`flex items-end gap-1`,le&&`[-webkit-app-region:no-drag]`),e[35]=Ce):Ce=e[35];let J=fa,we=jo,Te;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(Te={container:typeof document<`u`?document.body:void 0},e[36]=Te):Te=e[36];let Ee=Zi,De;e[37]===C?De=e[38]:(De=[...C],e[37]=C,e[38]=De);let Oe=va,ke=C.map(e=>{if(de.has(e)){let t=e===r;return(0,Z.jsx)(ZO,{tabId:e,canPin:!1,openTabs:C,closeTab:u,closeTabs:pe,pinTab:v,pinnedTabIds:y,unpinTab:S,children:(0,Z.jsxs)(XO,{tabId:e,"aria-current":t?`page`:void 0,"data-active-tab":t?`true`:void 0,className:Ei(BO,t?VO:HO),onAuxClick:t=>{t.button===1&&(t.preventDefault(),u(e))},onClick:t=>{t.target===t.currentTarget&&c(e)},children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":w({id:`zLak8b`}),"data-testid":`editor-new-tab-placeholder-button`,className:UO,onClick:()=>c(e),children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:(0,Z.jsx)(s,{id:`3YvS-c`})})}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":w({id:`xCdTnb`}),"data-testid":`editor-new-tab-placeholder-close`,className:GO(t),onClick:t=>{t.stopPropagation(),u(e)},children:(0,Z.jsx)(Ro,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let t=$e(e),n=e===U,i=y.includes(e);if(t.kind===`folder`){let{baseName:r,label:a,prefix:s}=Rt(t.folderPath,`/`),c=`${s}${a}`;return(0,Z.jsx)(ZO,{tabId:e,openTabs:C,closeTab:d,closeTabs:pe,pinTab:v,pinnedTabIds:y,unpinTab:S,children:(0,Z.jsxs)(XO,{tabId:e,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:Ei(BO,n?VO:HO),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&d(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,title:c,className:UO,onClick:()=>{o(e)},children:[s&&(0,Z.jsx)(`span`,{className:Ei(`min-w-0 flex-1 truncate`,n&&`text-muted-foreground`),children:s}),(0,Z.jsxs)(`span`,{className:Ei(`flex min-w-0 items-center`,s?`max-w-[70%] shrink-0`:`flex-1`),children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:r}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:`/`})]})]}),(0,Z.jsx)(QO,{accessibleLabel:c,closeTab:d,isPinned:i,tabId:e,unpinTab:S})]})},e)}if(t.kind===`asset`){let{baseName:r,label:a,prefix:s}=Rt(t.assetPath,``),c=`${s}${a}`;return(0,Z.jsx)(ZO,{tabId:e,openTabs:C,closeTab:d,closeTabs:pe,pinTab:v,pinnedTabIds:y,unpinTab:S,children:(0,Z.jsxs)(XO,{tabId:e,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:Ei(BO,n?VO:HO),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&d(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,className:UO,onClick:()=>{o(e)},children:[s?(0,Z.jsx)(`span`,{className:Ei(`min-w-0 flex-1 truncate text-muted-foreground/60`,n&&`text-muted-foreground`),children:s}):null,(0,Z.jsx)(`span`,{className:Ei(`min-w-0 truncate`,s?`max-w-[70%] shrink-0`:`flex-1`),children:r})]}),(0,Z.jsx)(QO,{accessibleLabel:c,closeTab:d,isPinned:i,tabId:e,unpinTab:S})]})},e)}let a=t.docName,l=T.get(a)?.docExt??`.md`,{baseName:f,extension:p,label:m,prefix:h}=Rt(a,l),g=`${h}${m}`,_=l===`.md`||l===`.mdx`,b=D?.tabId===e,x=`editor-tab-rename-error-${KO(a)}`;return(0,Z.jsx)(ZO,{disabled:b,tabId:e,openTabs:C,closeTab:d,closeTabs:pe,pinTab:v,pinnedTabIds:y,unpinTab:S,children:(0,Z.jsx)(XO,{tabId:e,disabled:b,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:Ei(BO,n?VO:HO,b&&j&&`border-destructive`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&d(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:b?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ex,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(jx,{ref:L,value:k,disabled:F,"aria-label":w({id:`Dw1T_W`,values:{label:m}}),"data-testid":`editor-tab-rename-input`,"aria-invalid":j?!0:void 0,"aria-describedby":j?x:void 0,"aria-busy":F||void 0,title:j??a,className:`h-full min-w-0 px-2 py-0 font-medium text-foreground text-xs selection:bg-primary selection:text-primary-foreground`,onChange:e=>{A(YO(e.target.value,l)),M(null),B.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),ce()):e.key===`Escape`&&(e.preventDefault(),se())},onBlur:ce}),(0,Z.jsx)(Ox,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)(Ax,{className:`text-muted-foreground/60 text-xs`,children:l})})]}),j?(0,Z.jsx)(`span`,{id:x,role:`alert`,className:`sr-only`,children:j}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":g,title:g,className:UO,onClick:()=>{o(e)},onDoubleClick:t=>{t.preventDefault(),t.stopPropagation(),oe(e,a)},children:[(0,Z.jsx)($O,{docName:a}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:f}),!_&&(0,Z.jsx)(`span`,{className:`shrink-0`,children:p})]})]}),(0,Z.jsx)(QO,{accessibleLabel:g,closeTab:d,isPinned:i,tabId:e,unpinTab:S})]})})},e)}),Ae;e[39]!==Ee||e[40]!==De||e[41]!==Oe||e[42]!==ke?(Ae=(0,Z.jsx)(Ee,{items:De,strategy:Oe,children:ke}),e[39]=Ee,e[40]=De,e[41]=Oe,e[42]=ke,e[43]=Ae):Ae=e[43];let je;e[44]!==J||e[45]!==ve||e[46]!==ge||e[47]!==we||e[48]!==Te||e[49]!==Ae?(je=(0,Z.jsx)(J,{sensors:ge,collisionDetection:we,onDragEnd:ve,accessibility:Te,children:Ae}),e[44]=J,e[45]=ve,e[46]=ge,e[47]=we,e[48]=Te,e[49]=Ae,e[50]=je):je=e[50];let Me;e[51]===w?Me=e[52]:(Me=w({id:`3YvS-c`}),e[51]=w,e[52]=Me);let Pe;e[53]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=(0,Z.jsx)(P,{"aria-hidden":`true`}),e[53]=Pe):Pe=e[53];let Fe;e[54]!==g||e[55]!==Me?(Fe=(0,Z.jsx)(cr,{asChild:!0,children:(0,Z.jsx)(Ni,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":Me,"data-testid":`editor-new-tab-button`,className:`first:mb-3 mb-1.5`,onClick:g,children:Pe})}),e[54]=g,e[55]=Me,e[56]=Fe):Fe=e[56];let Ie;e[57]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=(0,Z.jsx)(Qn,{children:(0,Z.jsx)(s,{id:`3YvS-c`})}),e[57]=Ie):Ie=e[57];let Le;e[58]===Fe?Le=e[59]:(Le=(0,Z.jsxs)(Gr,{children:[Fe,Ie]}),e[58]=Fe,e[59]=Le);let Re;e[60]!==Ce||e[61]!==je||e[62]!==Le?(Re=(0,Z.jsxs)(`div`,{className:Ce,children:[je,Le]}),e[60]=Ce,e[61]=je,e[62]=Le,e[63]=Re):Re=e[63];let ze;return e[64]!==ye||e[65]!==xe||e[66]!==Se||e[67]!==Re?(ze=(0,Z.jsx)(`div`,{ref:E,"data-electron-drag":ye,className:xe,onWheel:Se,children:Re}),e[64]=ye,e[65]=xe,e[66]=Se,e[67]=Re,e[68]=ze):ze=e[68],ze}function tk(e){let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`Discord`}),r=(0,Z.jsx)(`path`,{d:`M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9554 2.4189-2.1568 2.4189Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(`svg`,{role:`img`,fill:`currentColor`,height:24,width:24,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}function nk(e){let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`X (Twitter)`}),r=(0,Z.jsx)(`path`,{d:`M18.901 1.153h3.68l-8.04 9.19L24 22.846h-7.406l-5.8-7.584-6.638 7.584H.474l8.6-9.83L0 1.154h7.594l5.243 6.932ZM17.61 20.644h2.039L6.486 3.24H4.298Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(`svg`,{role:`img`,fill:`currentColor`,height:24,width:24,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}var rk=[{label:{id:`TvY_XA`},href:`https://openknowledge.ai/docs`,icon:He},{label:`GitHub`,href:`https://github.com/inkeep/open-knowledge`,icon:ld},{label:{id:`On0aF2`},href:`https://openknowledge.ai/`,icon:ar},{label:`Discord`,href:`https://go.inkeep.com/ok-discord`,icon:tk},{label:`Twitter`,href:`https://x.com/inkeep`,icon:nk}],ik=()=>{let e=(0,$.c)(16),{_:t}=i(),[n,r]=(0,Q.useState)(!1),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(_t,{className:`size-4`}),e[0]=a):a=e[0];let o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(cr,{asChild:!0,children:(0,Z.jsx)(w,{asChild:!0,children:(0,Z.jsxs)(Ni,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[a,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`s-MGs7`})})]})})}),e[1]=o):o=e[1];let c;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsxs)(Gr,{children:[o,(0,Z.jsx)(Qn,{children:(0,Z.jsx)(s,{id:`s-MGs7`})})]}),e[2]=c):c=e[2];let l;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs mb-1`,children:(0,Z.jsx)(s,{id:`s-MGs7`})}),e[3]=l):l=e[3];let u;e[4]===t?u=e[5]:(u=t({id:`s-MGs7`}),e[4]=t,e[5]=u);let d;e[6]===t?d=e[7]:(d=rk.map(e=>{let{label:n,href:r,icon:i}=e;return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`a`,{href:r,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>pa(e,r),onAuxClick:e=>pa(e,r),className:`flex items-center gap-2.5 rounded-md px-2 py-1.5 text-sm text-muted-foreground transition-colors hover:bg-azure-900/5 dark:hover:bg-white/20 hover:text-primary`,children:[(0,Z.jsx)(i,{"aria-hidden":`true`,className:`size-4 shrink-0`}),typeof n==`string`?n:t(n)]})},r)}),e[6]=t,e[7]=d);let f;e[8]===d?f=e[9]:(f=(0,Z.jsx)(`ul`,{className:`space-y-0.5`,children:d}),e[8]=d,e[9]=f);let p;e[10]!==u||e[11]!==f?(p=(0,Z.jsxs)(pe,{align:`end`,className:`w-64 p-3`,children:[l,(0,Z.jsx)(`nav`,{"aria-label":u,children:f})]}),e[10]=u,e[11]=f,e[12]=p):p=e[12];let m;return e[13]!==n||e[14]!==p?(m=(0,Z.jsxs)(v,{open:n,onOpenChange:r,children:[c,p]}),e[13]=n,e[14]=p,e[15]=m):m=e[15],m};function ak(e){let t=(0,$.c)(62),{input:n}=e,{_:r}=i(),{states:a,refresh:o}=Ch(),{dispatch:c}=fh(),[l,u]=(0,Q.useState)(!1),d=typeof window<`u`&&window.okDesktop!=null,f;t[0]===o?f=t[1]:(f=e=>{u(e),e&&o()},t[0]=o,t[1]=f);let p=f,m=n===null,h;t[2]===n?h=t[3]:(h=n!==null&&n.docContext!==null?Zr(n.docContext.relativePath):``,t[2]=n,t[3]=h);let g=h,_;t[4]!==c||t[5]!==n?(_=e=>{n!==null&&c(e.id,n)},t[4]=c,t[5]=n,t[6]=_):_=t[6];let v=_,y,b,x,S,C,w,T,E,D,O,k,A;if(t[7]!==p||t[8]!==v||t[9]!==n||t[10]!==l||t[11]!==g||t[12]!==a||t[13]!==m){let e;t[26]===a?e=t[27]:(e=e=>a[e.id]?.installed===!0,t[26]=a,t[27]=e);let r=xm.filter(e);x=a[`claude-code`]?.installed===!0;let i;t[28]!==n||t[29]!==g?(i=()=>{n!==null&&Iy(g)},t[28]=n,t[29]=g,t[30]=i):i=t[30],S=i,b=Na,A=l,C=p;let o,c;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Gi,{className:`size-3.5`}),c=(0,Z.jsx)(s,{id:`xWEvuo`}),t[31]=o,t[32]=c):(o=t[31],c=t[32]);let u;t[33]===m?u=t[34]:(u=(0,Z.jsx)(cr,{asChild:!0,children:(0,Z.jsx)(Ea,{asChild:!0,children:(0,Z.jsxs)(Ni,{variant:`ghost`,size:`sm`,disabled:m,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`open-in-agent-trigger`,children:[o,c]})})}),t[33]=m,t[34]=u);let f;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(Qn,{children:(0,Z.jsx)(s,{id:`xWEvuo`})}),t[35]=f):f=t[35],t[36]===u?w=t[37]:(w=(0,Z.jsxs)(Gr,{children:[u,f]}),t[36]=u,t[37]=w),y=la,T=`end`,E=`min-w-[220px]`,D=`open-in-agent-menu`,t[38]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(ho,{className:`font-mono font-normal tracking-wide uppercase text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`O7_W_a`})}),t[38]=O):O=t[38];let h;t[39]!==v||t[40]!==g||t[41]!==a?(h=e=>{let t=a[e.id];return(0,Z.jsx)(Ly,{target:e,installState:t,isElectronHost:d,prompt:g,onSelect:()=>v(e)},e.id)},t[39]=v,t[40]=g,t[41]=a,t[42]=h):h=t[42],k=r.map(h),t[7]=p,t[8]=v,t[9]=n,t[10]=l,t[11]=g,t[12]=a,t[13]=m,t[14]=y,t[15]=b,t[16]=x,t[17]=S,t[18]=C,t[19]=w,t[20]=T,t[21]=E,t[22]=D,t[23]=O,t[24]=k,t[25]=A}else y=t[14],b=t[15],x=t[16],S=t[17],C=t[18],w=t[19],T=t[20],E=t[21],D=t[22],O=t[23],k=t[24],A=t[25];let j;t[43]!==r||t[44]!==x||t[45]!==S||t[46]!==n?(j=x?null:(0,Z.jsxs)(ha,{onSelect:S,disabled:n===null,"data-testid":`open-in-agent-claude-web-fallback`,"aria-label":r({id:`aA51jP`}),children:[(0,Z.jsx)(mt,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`0S9PW_`})}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`pcfY8r`})})]}),t[43]=r,t[44]=x,t[45]=S,t[46]=n,t[47]=j):j=t[47];let M;t[48]!==y||t[49]!==j||t[50]!==T||t[51]!==E||t[52]!==D||t[53]!==O||t[54]!==k?(M=(0,Z.jsxs)(y,{align:T,className:E,"data-testid":D,children:[O,k,j]}),t[48]=y,t[49]=j,t[50]=T,t[51]=E,t[52]=D,t[53]=O,t[54]=k,t[55]=M):M=t[55];let N;return t[56]!==b||t[57]!==C||t[58]!==w||t[59]!==M||t[60]!==A?(N=(0,Z.jsxs)(b,{open:A,onOpenChange:C,children:[w,M]}),t[56]=b,t[57]=C,t[58]=w,t[59]=M,t[60]=A,t[61]=N):N=t[61],N}var ok=50,sk=()=>{let e=(0,$.c)(8),t=(0,Q.useRef)(null),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=()=>{t.current===null&&(t.current=setTimeout(()=>{t.current=null,sx.preload()},ok))},e[0]=n):n=e[0];let r=n,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{t.current!==null&&(clearTimeout(t.current),t.current=null)},e[1]=i):i=e[1];let a=i,o,c;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>()=>{t.current!==null&&clearTimeout(t.current)},c=[],e[2]=o,e[3]=c):(o=e[2],c=e[3]),(0,Q.useEffect)(o,c);let l,u;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{a(),window.location.hash!==`#settings`&&(window.location.hash=Sm)},u=(0,Z.jsx)(tl,{className:`size-4`}),e[4]=l,e[5]=u):(l=e[4],u=e[5]);let d;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(cr,{asChild:!0,children:(0,Z.jsxs)(Ni,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,"data-testid":`header-settings-button`,onMouseEnter:r,onMouseLeave:a,onFocus:r,onBlur:a,onClick:l,children:[u,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`Tz0i8g`})})]})}),e[6]=d):d=e[6];let f;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsxs)(Gr,{children:[d,(0,Z.jsx)(Qn,{children:(0,Z.jsx)(s,{id:`Tz0i8g`})})]}),e[7]=f):f=e[7],f};function ck(e){let t=(0,$.c)(17),{onClickWhenNoRemote:n}=e,{_:r}=i(),{activeDocName:a}=ft(),{status:o}=to(),[c,l]=(0,Q.useState)(!1);if(!a)return null;let u=o?.hasRemote===!0,d;t[0]!==r||t[1]!==a||t[2]!==c||t[3]!==u||t[4]!==n?(d=async function(){if(!c&&a){l(!0);try{await Za({docName:a,hasRemote:u,onClickWhenNoRemote:n},{clipboardWrite:fk,toastSuccess:dk,toastError:uk,logEvent:lk})}catch{$o.error(r({id:`u3YnKw`}))}l(!1)}},t[0]=r,t[1]=a,t[2]=c,t[3]=u,t[4]=n,t[5]=d):d=t[5];let f=d,p;t[6]===r?p=t[7]:(p=r({id:`F4IYWe`}),t[6]=r,t[7]=p);let m,h;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(nl,{className:`size-3.5`,"aria-hidden":!0}),h=(0,Z.jsx)(s,{id:`Z8lGw6`}),t[8]=m,t[9]=h):(m=t[8],h=t[9]);let g;t[10]!==c||t[11]!==f||t[12]!==p?(g=(0,Z.jsx)(cr,{asChild:!0,children:(0,Z.jsxs)(Ni,{variant:`ghost`,size:`sm`,"aria-label":p,onClick:f,disabled:c,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`share-button`,children:[m,h]})}),t[10]=c,t[11]=f,t[12]=p,t[13]=g):g=t[13];let _;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(Qn,{children:(0,Z.jsx)(s,{id:`Z8lGw6`})}),t[14]=_):_=t[14];let v;return t[15]===g?v=t[16]:(v=(0,Z.jsxs)(Gr,{children:[g,_]}),t[15]=g,t[16]=v),v}function lk(e){return console.log(e)}function uk(e){return $o.error(e)}function dk(e){return $o.success(e)}function fk(e){return navigator.clipboard.writeText(e)}function pk(e){if(!e)return X._({id:`Zul8Ry`});let t=Date.now()-new Date(e).getTime();if(t<6e4)return X._({id:`xOTzt5`});if(t<36e5){let e=Math.floor(t/6e4);return X._({id:`LNum6A`,values:{minutes:e}})}if(t<864e5){let e=Math.floor(t/36e5);return X._({id:`nYeBmY`,values:{hours:e}})}return new Date(e).toLocaleDateString()}async function mk(e){await fetch(`/api/sync/trigger`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({op:e})})}function hk(e){let t=(0,$.c)(9),{status:n}=e;switch(n.state){case`dormant`:{let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(dc,{className:`size-3.5 text-muted-foreground`}),t[0]=e):e=t[0],e}case`idle`:{if(n.ahead>0||n.behind>0){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Xc,{className:`size-3.5 text-muted-foreground`}),t[1]=e):e=t[1],e}let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(dc,{className:`size-3.5 text-muted-foreground`}),t[2]=e):e=t[2],e}case`fetching`:case`pulling`:case`pushing`:{let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Xc,{className:`size-3.5 text-muted-foreground animate-spin`}),t[3]=e):e=t[3],e}case`conflict`:{let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Pn,{className:`size-3.5 text-amber-500`}),t[4]=e):e=t[4],e}case`offline`:{let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(uc,{className:`size-3.5 text-muted-foreground`}),t[5]=e):e=t[5],e}case`auth-error`:{let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Rc,{className:`size-3.5 text-destructive`}),t[6]=e):e=t[6],e}case`disabled`:{let e;return t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Pn,{className:`size-3.5 text-amber-500`}),t[7]=e):e=t[7],e}default:{let e;return t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(dc,{className:`size-3.5 text-muted-foreground`}),t[8]=e):e=t[8],e}}}function gk(e){switch(e.state){case`idle`:return e.ahead>0?`↑${e.ahead}`:e.behind>0?`↓${e.behind}`:``;case`fetching`:case`pulling`:case`pushing`:return``;case`conflict`:return e.conflictCount>0?`${e.conflictCount}`:``;case`offline`:return``;case`auth-error`:return``;default:return``}}function _k(e){switch(e){case`dormant`:return X._({id:`RmBY0A`});case`idle`:return X._({id:`N2FcBE`});case`fetching`:return X._({id:`Wgmlsw`});case`pulling`:return X._({id:`4uNLmk`});case`pushing`:return X._({id:`iycx_A`});case`conflict`:return X._({id:`IInnZo`});case`offline`:return X._({id:`6Aih4U`});case`auth-error`:return X._({id:`mHVPm5`});case`disabled`:return X._({id:`DrYM2Z`});default:return e}}function vk(e){switch(e){case`external-changes-pending`:return X._({id:`W9_Bub`});case`dirty-tree`:return X._({id:`a5Gha5`});case`non-content-merge-failure`:return X._({id:`sIxSSP`});case`detached-head`:return X._({id:`uQNW00`});case`auth-error`:return X._({id:`mHVPm5`});case`protected-branch`:return X._({id:`8fc_3j`});default:return e}}function yk(e){if(!e.syncEnabled)return X._({id:`kUn-CN`});if(e.state===`idle`){let{ahead:t,behind:n}=e;return t>0&&n>0?X._({id:`5F5HYj`,values:{ahead:t,behind:n}}):t>0?X._({id:`PdA9NZ`,values:{ahead:t}}):n>0?X._({id:`9o1bIV`,values:{behind:n}}):X._({id:`N2FcBE`})}if(e.state===`conflict`&&e.conflictCount>0){let{conflictCount:t}=e;return X._({id:`cUK8lW`,values:{conflictCount:t}})}return _k(e.state)}function bk(e){let t=(0,$.c)(88),{status:n,onSignIn:r,onSetIdentity:a}=e,{_:o}=i(),{ahead:c,behind:u,conflictCount:d}=n,{projectLocalConfig:f,projectLocalSynced:p}=l(),m=f?.autoSync?.enabled??!1,h;t[0]===n.lastSyncUtc?h=t[1]:(h=pk(n.lastSyncUtc),t[0]=n.lastSyncUtc,t[1]=h);let g=h,{confirmOpen:_,setConfirmOpen:v,onToggleRequest:y,onConfirm:b}=Xi(Ya()),{conflicts:x}=JC(),S=x[0]??null,C;t[2]===n?C=t[3]:(C=(0,Z.jsx)(hk,{status:n}),t[2]=n,t[3]=C);let w;t[4]===n.state?w=t[5]:(w=_k(n.state),t[4]=n.state,t[5]=w);let T;t[6]===w?T=t[7]:(T=(0,Z.jsx)(`span`,{className:`text-1sm font-medium truncate`,children:w}),t[6]=w,t[7]=T);let E;t[8]!==C||t[9]!==T?(E=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[C,T]}),t[8]=C,t[9]=T,t[10]=E):E=t[10];let D=!p,O;t[11]!==o||t[12]!==m?(O=o(m?{id:`lIn9L9`}:{id:`wbwHYD`}),t[11]=o,t[12]=m,t[13]=O):O=t[13];let k;t[14]!==m||t[15]!==y||t[16]!==D||t[17]!==O?(k=(0,Z.jsx)(re,{checked:m,disabled:D,onCheckedChange:y,"aria-label":O}),t[14]=m,t[15]=y,t[16]=D,t[17]=O,t[18]=k):k=t[18];let A;t[19]!==E||t[20]!==k?(A=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[E,k]}),t[19]=E,t[20]=k,t[21]=A):A=t[21];let j;t[22]!==_||t[23]!==b||t[24]!==v?(j=(0,Z.jsx)(so,{open:_,onOpenChange:v,onConfirm:b}),t[22]=_,t[23]=b,t[24]=v,t[25]=j):j=t[25];let M;t[26]===n.error?M=t[27]:(M=n.error&&(0,Z.jsx)(`p`,{className:`text-xs text-destructive`,children:n.error}),t[26]=n.error,t[27]=M);let N;t[28]===n.pausedReason?N=t[29]:(N=n.pausedReason&&(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:vk(n.pausedReason)}),t[28]=n.pausedReason,t[29]=N);let P;t[30]===n.state?P=t[31]:(P=n.state===`conflict`&&(0,Z.jsx)(`p`,{className:`text-xs text-amber-700 dark:text-amber-400`,children:(0,Z.jsx)(s,{id:`t2TkQ3`})}),t[30]=n.state,t[31]=P);let F;t[32]!==o||t[33]!==n.remote?(F=n.remote&&(0,Z.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,Z.jsx)(`span`,{className:`w-20 shrink-0 font-mono uppercase tracking-wide text-2xs`,children:(0,Z.jsx)(s,{id:`IreQBq`})}),n.remote.webUrl?(0,Z.jsxs)(`a`,{href:n.remote.webUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex min-w-0 items-center gap-0.5 text-foreground hover:text-primary hover:underline`,"aria-label":o({id:`1nke1r`,values:{0:n.remote.label}}),children:[(0,Z.jsx)(`span`,{className:`truncate`,children:n.remote.label}),(0,Z.jsx)(Fo,{className:`size-3.5 shrink-0`,"aria-hidden":!0})]}):(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-foreground`,children:n.remote.label})]}),t[32]=o,t[33]=n.remote,t[34]=F):F=t[34];let I;t[35]!==m||t[36]!==g||t[37]!==n.state?(I=m&&n.state!==`dormant`&&(0,Z.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,Z.jsx)(`span`,{className:`w-20 shrink-0 font-mono uppercase tracking-wide text-2xs`,children:(0,Z.jsx)(s,{id:`uWx2ZP`})}),(0,Z.jsx)(`span`,{className:`text-foreground`,children:g})]}),t[35]=m,t[36]=g,t[37]=n.state,t[38]=I):I=t[38];let L;t[39]!==c||t[40]!==n.ahead?(L=n.ahead>0&&(0,Z.jsx)(`div`,{children:(0,Z.jsx)(s,{id:`iTlqm3`,values:{ahead:c}})}),t[39]=c,t[40]=n.ahead,t[41]=L):L=t[41];let R;t[42]!==u||t[43]!==n.behind?(R=n.behind>0&&(0,Z.jsx)(`div`,{children:(0,Z.jsx)(s,{id:`YsEYYS`,values:{behind:u}})}),t[42]=u,t[43]=n.behind,t[44]=R):R=t[44];let z;t[45]!==d||t[46]!==n.conflictCount?(z=n.conflictCount>0&&(0,Z.jsx)(`div`,{children:(0,Z.jsx)(s,{id:`B4_ipX`,values:{conflictCount:d}})}),t[45]=d,t[46]=n.conflictCount,t[47]=z):z=t[47];let B;t[48]===m?B=t[49]:(B=!m&&(0,Z.jsx)(`div`,{children:(0,Z.jsx)(s,{id:`Wt5W56`})}),t[48]=m,t[49]=B);let V;t[50]!==F||t[51]!==I||t[52]!==L||t[53]!==R||t[54]!==z||t[55]!==B?(V=(0,Z.jsxs)(`div`,{className:`text-xs text-muted-foreground space-y-2`,children:[F,I,L,R,z,B]}),t[50]=F,t[51]=I,t[52]=L,t[53]=R,t[54]=z,t[55]=B,t[56]=V):V=t[56];let H;t[57]!==a||t[58]!==n.identityUnresolved?(H=n.identityUnresolved&&a&&(0,Z.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-dashed p-2`,children:[(0,Z.jsx)(hl,{className:`size-3.5 mt-0.5 text-muted-foreground shrink-0`}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 min-w-0`,children:[(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground leading-snug`,children:(0,Z.jsx)(s,{id:`nrGWJ7`})}),(0,Z.jsx)(Ni,{variant:`outline`,size:`xs`,className:`self-start`,onClick:a,children:(0,Z.jsx)(s,{id:`keNFEd`})})]})]}),t[57]=a,t[58]=n.identityUnresolved,t[59]=H):H=t[59];let U;t[60]!==m||t[61]!==n.state?(U=m&&n.state!==`dormant`&&n.state!==`disabled`&&n.state!==`auth-error`&&n.state!==`conflict`&&(0,Z.jsx)(Ni,{variant:`outline`,size:`xs`,onClick:Sk,children:(0,Z.jsx)(s,{id:`lb_UU4`})}),t[60]=m,t[61]=n.state,t[62]=U):U=t[62];let W;t[63]!==m||t[64]!==r||t[65]!==n.state?(W=m&&n.state===`auth-error`&&(0,Z.jsx)(Ni,{variant:`outline`,size:`xs`,onClick:r,children:(0,Z.jsx)(s,{id:`3jod3l`})}),t[63]=m,t[64]=r,t[65]=n.state,t[66]=W):W=t[66];let G;t[67]!==m||t[68]!==n.state?(G=m&&n.state===`offline`&&(0,Z.jsx)(Ni,{variant:`outline`,size:`xs`,onClick:xk,children:(0,Z.jsx)(s,{id:`6gRgw8`})}),t[67]=m,t[68]=n.state,t[69]=G):G=t[69];let K;t[70]!==m||t[71]!==S||t[72]!==n.state?(K=m&&n.state===`conflict`&&S&&(0,Z.jsx)(Ni,{variant:`outline`,size:`xs`,onClick:()=>{if(typeof window>`u`)return;let e=di(Ar(S.file));window.location.hash!==e&&(window.location.hash=e)},children:(0,Z.jsx)(s,{id:`0yL--g`})}),t[70]=m,t[71]=S,t[72]=n.state,t[73]=K):K=t[73];let q;t[74]!==U||t[75]!==W||t[76]!==G||t[77]!==K?(q=(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-1 pt-1`,children:[U,W,G,K]}),t[74]=U,t[75]=W,t[76]=G,t[77]=K,t[78]=q):q=t[78];let ee;return t[79]!==j||t[80]!==M||t[81]!==N||t[82]!==P||t[83]!==V||t[84]!==H||t[85]!==q||t[86]!==A?(ee=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3.5`,children:[A,j,M,N,P,V,H,q]}),t[79]=j,t[80]=M,t[81]=N,t[82]=P,t[83]=V,t[84]=H,t[85]=q,t[86]=A,t[87]=ee):ee=t[87],ee}function xk(){mk(`sync`)}function Sk(){mk(`sync`)}function Ck(e){let t=(0,$.c)(69),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onSignIn:r,onSetIdentity:a}=n,{_:o}=i(),{status:c,fetchError:l}=to();if(!c){if(l){let e;t[2]===o?e=t[3]:(e=o({id:`iqIDv4`}),t[2]=o,t[3]=e);let n;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(uc,{className:`size-3.5`}),t[4]=n):n=t[4];let r;t[5]===e?r=t[6]:(r=(0,Z.jsx)(cr,{asChild:!0,children:(0,Z.jsx)(Ni,{variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground`,"aria-label":e,disabled:!0,children:n})}),t[5]=e,t[6]=r);let i;t[7]===l?i=t[8]:(i=(0,Z.jsx)(Qn,{children:l===`network`?(0,Z.jsx)(s,{id:`I5AfhE`}):(0,Z.jsx)(s,{id:`uKRYiW`})}),t[7]=l,t[8]=i);let a;return t[9]!==r||t[10]!==i?(a=(0,Z.jsxs)(Gr,{children:[r,i]}),t[9]=r,t[10]=i,t[11]=a):a=t[11],a}return null}if(c.state===`dormant`&&!c.hasRemote||c.state===`disabled`&&!c.pausedReason)return null;let u;t[12]===c?u=t[13]:(u=gk(c),t[12]=c,t[13]=u);let d=u,f,p,m,h,g,_,y,b,x,S,C,T;if(t[14]!==o||t[15]!==c.identityUnresolved||t[16]!==c.state){let e=_k(c.state);_=!!c.identityUnresolved,g=v,h=Gr,m=cr,T=!0,p=w,C=!0,f=Ni,y=`ghost`,b=`icon-sm`,x=`text-muted-foreground relative`,S=o(_?{id:`DFfRbX`,values:{syncStateLabel:e}}:{id:`F4vEsL`,values:{syncStateLabel:e}}),t[14]=o,t[15]=c.identityUnresolved,t[16]=c.state,t[17]=f,t[18]=p,t[19]=m,t[20]=h,t[21]=g,t[22]=_,t[23]=y,t[24]=b,t[25]=x,t[26]=S,t[27]=C,t[28]=T}else f=t[17],p=t[18],m=t[19],h=t[20],g=t[21],_=t[22],y=t[23],b=t[24],x=t[25],S=t[26],C=t[27],T=t[28];let E;t[29]===c?E=t[30]:(E=(0,Z.jsx)(hk,{status:c}),t[29]=c,t[30]=E);let D;t[31]===d?D=t[32]:(D=d&&(0,Z.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 text-[9px] leading-none font-medium bg-background border rounded-full px-0.5`,children:d}),t[31]=d,t[32]=D);let O;t[33]!==d||t[34]!==_?(O=!d&&_&&(0,Z.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 size-1.5 rounded-full bg-amber-500 ring-2 ring-background`,"aria-hidden":!0}),t[33]=d,t[34]=_,t[35]=O):O=t[35];let k;t[36]!==f||t[37]!==D||t[38]!==O||t[39]!==y||t[40]!==b||t[41]!==x||t[42]!==S||t[43]!==E?(k=(0,Z.jsxs)(f,{variant:y,size:b,className:x,"aria-label":S,children:[E,D,O]}),t[36]=f,t[37]=D,t[38]=O,t[39]=y,t[40]=b,t[41]=x,t[42]=S,t[43]=E,t[44]=k):k=t[44];let A;t[45]!==p||t[46]!==k||t[47]!==C?(A=(0,Z.jsx)(p,{asChild:C,children:k}),t[45]=p,t[46]=k,t[47]=C,t[48]=A):A=t[48];let j;t[49]!==m||t[50]!==A||t[51]!==T?(j=(0,Z.jsx)(m,{asChild:T,children:A}),t[49]=m,t[50]=A,t[51]=T,t[52]=j):j=t[52];let M;t[53]===c?M=t[54]:(M=yk(c),t[53]=c,t[54]=M);let N;t[55]===M?N=t[56]:(N=(0,Z.jsx)(Qn,{children:M}),t[55]=M,t[56]=N);let P;t[57]!==h||t[58]!==j||t[59]!==N?(P=(0,Z.jsxs)(h,{children:[j,N]}),t[57]=h,t[58]=j,t[59]=N,t[60]=P):P=t[60];let F;t[61]!==a||t[62]!==r||t[63]!==c?(F=(0,Z.jsx)(pe,{align:`end`,className:`w-64 p-3`,children:(0,Z.jsx)(bk,{status:c,onSignIn:r,onSetIdentity:a})}),t[61]=a,t[62]=r,t[63]=c,t[64]=F):F=t[64];let I;return t[65]!==g||t[66]!==P||t[67]!==F?(I=(0,Z.jsxs)(g,{children:[P,F]}),t[65]=g,t[66]=P,t[67]=F,t[68]=I):I=t[68],I}function wk(e){let t=(0,$.c)(39),{onSignIn:n,onSetIdentity:r}=e,{activeDocName:i,activeTarget:a}=ft(),{state:o}=dD(),c=Wa(),[l,u]=(0,Q.useState)(!1),d;bb0:{if(a===null){let e;t[0]===c?e=t[1]:(e=eh({workspace:c}),t[0]=c,t[1]=e),d=e;break bb0}if(a.kind===`folder`){if(!c){d=null;break bb0}let e;t[2]!==a.folderPath||t[3]!==c?(e=th({folderRelativePath:a.folderPath,workspace:c}),t[2]=a.folderPath,t[3]=c,t[4]=e):e=t[4],d=e;break bb0}let e;t[5]!==i||t[6]!==c?(e=$m({docName:i,workspace:c}),t[5]=i,t[6]=c,t[7]=e):e=t[7],d=e}let f=d,p=typeof window<`u`&&window.okDesktop!=null,m=p&&o===`collapsed`&&`pl-[78px]`,h;t[8]===m?h=t[9]:(h=Ei(`flex h-12 shrink-0 items-center bg-muted/35 shadow-[inset_0_-1px_0_var(--border)]`,p&&`[-webkit-app-region:drag]`,m,p&&`motion-safe:transition-[padding] motion-safe:duration-200 motion-safe:ease-linear`),t[8]=m,t[9]=h);let g;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(cr,{asChild:!0,children:(0,Z.jsx)(gD,{className:Ei(`-ml-1 shrink-0 text-muted-foreground`,p&&`[-webkit-app-region:no-drag]`)})}),t[10]=g):g=t[10];let _;t[11]===o?_=t[12]:(_=(0,Z.jsxs)(Gr,{children:[g,(0,Z.jsx)(Qn,{children:o===`expanded`?(0,Z.jsx)(s,{id:`w3vFfL`}):(0,Z.jsx)(s,{id:`e8zRrb`})})]}),t[11]=o,t[12]=_);let v,y;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(mo,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),y=(0,Z.jsx)(ek,{}),t[13]=v,t[14]=y):(v=t[13],y=t[14]);let b;t[15]===_?b=t[16]:(b=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 px-3`,children:[_,v,y]}),t[15]=_,t[16]=b);let x;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(x=Ei(`flex shrink-0 items-center justify-end gap-2 px-3`,p&&`[&>*]:[-webkit-app-region:no-drag]`),t[17]=x):x=t[17];let S;t[18]===f?S=t[19]:(S=(0,Z.jsx)(ak,{input:f}),t[18]=f,t[19]=S);let C;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(ck,{onClickWhenNoRemote:()=>u(!0)}),t[20]=C):C=t[20];let w;t[21]===l?w=t[22]:(w=(0,Z.jsx)($a,{open:l,onOpenChange:u}),t[21]=l,t[22]=w);let T;t[23]!==r||t[24]!==n?(T=(0,Z.jsx)(Ck,{onSignIn:n,onSetIdentity:r}),t[23]=r,t[24]=n,t[25]=T):T=t[25];let E,D,O,k,A;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(KD,{}),D=(0,Z.jsx)(mo,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),O=(0,Z.jsx)(Mu,{}),k=(0,Z.jsx)(sk,{}),A=(0,Z.jsx)(ik,{}),t[26]=E,t[27]=D,t[28]=O,t[29]=k,t[30]=A):(E=t[26],D=t[27],O=t[28],k=t[29],A=t[30]);let j;t[31]!==S||t[32]!==w||t[33]!==T?(j=(0,Z.jsxs)(`div`,{className:x,children:[S,C,w,T,E,D,O,k,A]}),t[31]=S,t[32]=w,t[33]=T,t[34]=j):j=t[34];let M;return t[35]!==j||t[36]!==h||t[37]!==b?(M=(0,Z.jsxs)(`header`,{"data-electron-drag":p?``:void 0,className:h,children:[b,j]}),t[35]=j,t[36]=h,t[37]=b,t[38]=M):M=t[38],M}function Tk(){let e=(0,$.c)(26),{_:t}=i(),[n,r]=$h(),[a,o]=(0,Q.useState)(n),[s,c]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(`auth`),[f,p]=(0,Q.useState)(v_[0].id),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(!1),v=_o(),{projectLocalConfig:y,projectLocalSynced:b}=l(),{activeDocName:x}=ft(),S=!g&&v?.hasRemote===!0&&b===!0&&y!==null&&y.autoSync?.enabled===null,C,w;e[0]===x?(C=e[1],w=e[2]):(C=()=>{let e=function(e){let t=e.detail;t&&x&&Fs(x,{kind:`raw-mdx`,detail:t}),o(`source`)};return window.addEventListener(Gh,e),()=>window.removeEventListener(Gh,e)},w=[x],e[0]=x,e[1]=C,e[2]=w),(0,Q.useEffect)(C,w);let T;e[3]===r?T=e[4]:(T=function(e){o(e),r(e)},e[3]=r,e[4]=T);let E=T,D;e[5]===t?D=e[6]:(D=async function(){h(!0);try{let e=await fetch(`/api/save-version`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({})});e.ok?$o.success(t({id:`rdE6_3`})):(console.error(`[save-version] failed:`,await e.text()),$o.error(t({id:`q7zsRM`})))}catch(e){console.error(`[save-version] failed:`,e),$o.error(t({id:`q7zsRM`}))}h(!1)},e[5]=t,e[6]=D);let O=D,k;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(wk,{onSignIn:()=>{d(`auth`),c(!0)},onSetIdentity:()=>{d(`identity`),c(!0)}}),e[7]=k):k=e[7];let A;e[8]!==f||e[9]!==a||e[10]!==E||e[11]!==O||e[12]!==m?(A=(0,Z.jsx)(VE,{editorMode:a,onModeChange:E,activeTab:f,onActiveTabChange:p,onSaveVersion:O,saving:m}),e[8]=f,e[9]=a,e[10]=E,e[11]=O,e[12]=m,e[13]=A):A=e[13];let j=u===`identity`,M;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(M=()=>{c(!1)},e[14]=M):M=e[14];let N;e[15]!==s||e[16]!==j?(N=(0,Z.jsx)(wo,{open:s,onOpenChange:c,identityPrompt:j,onSuccess:M}),e[15]=s,e[16]=j,e[17]=N):N=e[17];let P;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>_(!0),e[18]=P):P=e[18];let F;e[19]===S?F=e[20]:(F=(0,Z.jsx)(eg,{open:S,onResolved:P}),e[19]=S,e[20]=F);let I;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(Hh,{}),e[21]=I):I=e[21];let L;return e[22]!==F||e[23]!==A||e[24]!==N?(L=(0,Z.jsxs)(Z.Fragment,{children:[k,A,N,F,I]}),e[22]=F,e[23]=A,e[24]=N,e[25]=L):L=e[25],L}function Ek(e){let t=di(Ar(e));typeof window>`u`||window.location.hash!==t&&(window.location.hash=t)}function Dk(){let e=(0,$.c)(11),{conflicts:t,loading:n,error:r}=JC();if(n)return null;if(r!==null){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`section`,{"data-testid":`conflicts-section`,"aria-label":`Conflicted files`,className:`border-b border-amber-200/60 bg-amber-50/40 px-2 py-2 dark:border-amber-900/40 dark:bg-amber-950/20`,children:(0,Z.jsxs)(`p`,{"data-testid":`conflicts-section-error`,className:`px-2 py-1.5 text-[12px] text-amber-700 dark:text-amber-400`,children:[(0,Z.jsx)(Pn,{"aria-hidden":`true`,className:`mr-1.5 inline size-3`}),`Couldn't load conflicts — reload to retry.`]})}),e[0]=t):t=e[0],t}if(t.length===0)return null;let i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 font-mono text-[11px] uppercase tracking-wider text-amber-700 dark:text-amber-400`,children:[(0,Z.jsx)(Pn,{"aria-hidden":`true`,className:`size-3`}),`Conflicts`]}),e[1]=i):i=e[1];let a;e[2]===t.length?a=e[3]:(a=(0,Z.jsxs)(`header`,{className:`flex items-center justify-between px-2 pb-1.5`,children:[i,(0,Z.jsx)(`span`,{"data-testid":`conflicts-section-count`,className:`rounded-full bg-amber-500 px-1.5 py-0.5 font-mono text-[10px] font-medium leading-none text-white`,children:t.length})]}),e[2]=t.length,e[3]=a);let o;e[4]===t?o=e[5]:(o=t.map(Ok),e[4]=t,e[5]=o);let s;e[6]===o?s=e[7]:(s=(0,Z.jsx)(`ul`,{className:`flex flex-col gap-px`,children:o}),e[6]=o,e[7]=s);let c;return e[8]!==a||e[9]!==s?(c=(0,Z.jsxs)(`section`,{"data-testid":`conflicts-section`,"aria-label":`Conflicted files`,className:`border-b border-amber-200/60 bg-amber-50/40 px-2 py-2 dark:border-amber-900/40 dark:bg-amber-950/20`,children:[a,s]}),e[8]=a,e[9]=s,e[10]=c):c=e[10],c}function Ok(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(Ni,{variant:`ghost`,size:`sm`,"data-testid":`conflicts-section-row`,"data-file":e.file,title:e.file,className:`h-7 w-full justify-start gap-1.5 px-2 font-normal text-[13px] text-amber-800 hover:bg-amber-100/60 hover:text-amber-900 dark:text-amber-300 dark:hover:bg-amber-900/30 dark:hover:text-amber-200`,onClick:()=>Ek(e.file),children:[(0,Z.jsx)(Pn,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.file})]})},e.file)}var kk=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
31
+ `,r);if(s>-1&&s<t&&(e=s),i&&p<f.length){let t=Math.max(0,m?f[p].toA:f[p].fromA);t<=e&&(e=t,m&&p++,o=!0)}if(e>r){let t=document.createTextNode(l.slice(r,e));if(a){let e=d.appendChild(document.createElement(`span`));e.className=a,e.appendChild(t)}else d.appendChild(t);r=e}o&&(m=!m)}}if(u&&t.toA-t.fromA<=o){let t=u.parser.parse(l),n=0;_s(t,{style:t=>Ms(e,t)},(e,t,r)=>{e>n&&g(n,e,``),g(e,t,r),n=t}),g(n,l.length,``)}else g(0,l.length,``);return d.firstChild||d.appendChild(document.createElement(`br`)),c})});return CT.set(t.changes,i),i}function ET(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(Mw).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=e.state.sliceDoc(i.fromB,Math.max(i.fromB,i.toB-1)),o=e.state.field(ST);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=ms.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:xT.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function DT(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(Mw).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(ST).sliceString(i.fromA,Math.max(i.fromA,i.toA-1));return i.fromA!=i.toA&&i.toB<=n.doc.length&&(a+=n.lineBreak),e.dispatch({changes:{from:i.fromB,to:Math.min(n.doc.length,i.toB),insert:a},userEvent:`revert`}),!0}function OT(e){let t=new bs;for(let n of e.field(Mw)){let r=e.facet(kw).overrideChunk&&jT(e,n);t.add(n.fromB,n.fromB,TT(e,n,!!r))}return t.finish()}var kT=gs.define({create:e=>OT(e),update(e,t){return t.state.field(Mw,!1)==t.startState.field(Mw,!1)?e:OT(t.state)},provide:e=>Ts.decorations.from(e)}),AT=new WeakMap;function jT(e,t){let n=AT.get(t);if(n!==void 0)return n;n=null;let r=e.field(ST),i=e.doc,a=r.lineAt(t.endA).number-r.lineAt(t.fromA).number+1,o=i.lineAt(t.endB).number-i.lineAt(t.fromB).number+1;abort:if(a==o&&a<10){let e=[],i=0,o=t.fromA,s=t.fromB;for(let n of t.changes){if(n.fromA<n.toA){i+=n.toA-n.fromA;let t=r.sliceString(o+n.fromA,o+n.toA);if(/\n/.test(t))break abort;e.push(ys.widget({widget:new MT(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(Jw.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return AT.set(t,n),n}var MT=class extends fs{constructor(e){super(),this.text=e}eq(e){return this.text==e.text}toDOM(e){let t=document.createElement(`del`);return t.className=`cm-deletedText`,t.textContent=this.text,t}},NT=new class extends Es{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},PT=ys.line({class:`cm-inlineChangedLine`});function FT(e,t,n,r){let i=jT(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,NT),n.add(o.from,o.from,PT);a<i.length&&i[a].to<=o.to;){let e=i[a++];n.add(e.from,e.to,e.value)}if(o.to>=t.endB)break;o=e.doc.lineAt(o.to+1)}return!0}var IT=zt({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),LT=_({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}});function RT(e){let t=(0,$.c)(24),{oldContent:n,newContent:r,layout:a,conflictMode:o,oursOverride:c,onResolve:l,onAbort:u}=e,{_:d}=i(),f=c??r,p=(0,Q.useRef)(null),m=(0,Q.useRef)(null),{resolvedTheme:h}=Kr(),g=(0,Q.useRef)(l),_=(0,Q.useRef)(u),[v,y]=(0,Q.useState)(null),x;t[0]!==u||t[1]!==l?(x=()=>{g.current=l,_.current=u},t[0]=u,t[1]=l,t[2]=x):x=t[2],(0,Q.useEffect)(x);let S,C;t[3]!==o||t[4]!==f||t[5]!==a||t[6]!==n||t[7]!==h?(S=()=>{if(!p.current)return;let e=h===`dark`?IT:LT,t=[Ts.editable.of(!1),hs.readOnly.of(!0)],r=[Ls,b(),...t,e,Ts.lineWrapping];if(m.current&&=(m.current.destroy(),null),o){let t=new Ts({doc:f,extensions:[Ls,b(),Ts.editable.of(!1),e,Ts.lineWrapping,bT({original:n,highlightChanges:!0,gutter:!0,mergeControls:!0,collapseUnchanged:{margin:3,minSize:4}}),Ts.updateListener.of(e=>{let t=Nw(e.state);y(t?t.chunks.length:0)})],parent:p.current});m.current=t;let r=Nw(t.state);y(r?r.chunks.length:0)}else a===`split`?m.current=new gT({a:{doc:n,extensions:r},b:{doc:f,extensions:r},parent:p.current,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}}):m.current=new Ts({doc:f,extensions:[...r,bT({original:n,highlightChanges:!0,gutter:!0,mergeControls:!1,collapseUnchanged:{margin:3,minSize:4}})],parent:p.current});return()=>{m.current&&=(m.current.destroy(),null)}},C=[n,f,a,h,o],t[3]=o,t[4]=f,t[5]=a,t[6]=n,t[7]=h,t[8]=S,t[9]=C):(S=t[8],C=t[9]),(0,Q.useEffect)(S,C);let w;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(w=function(){let e=m.current;!e||!(e instanceof Ts)||g.current?.(e.state.doc.toString())},t[10]=w):w=t[10];let T=w,E;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(E=function(){let e=m.current;!e||!(e instanceof Ts)||W(e)},t[11]=E):E=t[11];let D=E,O=v===0,k;t[12]!==d||t[13]!==v?(k=v===null?``:v===0?d({id:`lPzyrU`}):X._({id:`8FqTCr`,values:{chunksRemaining:v}}),t[12]=d,t[13]=v,t[14]=k):k=t[14];let A=k,j;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(`div`,{ref:p,className:`diff-view min-h-0 flex-1 overflow-y-auto subtle-scrollbar`}),t[15]=j):j=t[15];let M;t[16]!==O||t[17]!==o||t[18]!==A||t[19]!==u||t[20]!==l?(M=o&&(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 py-2 border-t shrink-0`,children:[(0,Z.jsx)(`span`,{className:`text-xs ${O?`text-emerald-600 dark:text-emerald-400`:`text-muted-foreground`}`,children:A}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[u&&(0,Z.jsx)(Ni,{variant:`ghost`,size:`sm`,onClick:u,children:(0,Z.jsx)(s,{id:`XyOUTJ`})}),(0,Z.jsx)(Ni,{variant:`outline`,size:`sm`,onClick:D,children:`Undo`}),l&&(0,Z.jsx)(Ni,{variant:`default`,size:`sm`,disabled:!O,onClick:T,children:(0,Z.jsx)(s,{id:`Lcehxn`})})]})]}),t[16]=O,t[17]=o,t[18]=A,t[19]=u,t[20]=l,t[21]=M):M=t[21];let N;return t[22]===M?N=t[23]:(N=(0,Z.jsxs)(`div`,{className:`flex flex-col h-full`,children:[j,M]}),t[22]=M,t[23]=N),N}async function zT(e,t,n){try{let r={file:e,strategy:t};n!==void 0&&(r.content=n);let i=await fetch(`/api/sync/resolve-conflict`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(r)});if(i.ok)return{ok:!0};let a;try{let e=await i.json();typeof e.detail==`string`?a=e.detail:typeof e.title==`string`&&(a=e.title)}catch{}return{ok:!1,detail:a}}catch(n){let r=n instanceof Error?n.message:String(n);return console.warn(JSON.stringify({event:`conflict-resolve-dispatch-failed`,file:e,strategy:t,detail:r})),{ok:!1,detail:r}}}async function BT(e,t){return zT(e,`content`,t)}async function VT(e){try{let t=await fetch(`/api/sync/conflict-content?file=${encodeURIComponent(e)}&source=ytext`);if(!t.ok){let n;try{let e=await t.json();typeof e.detail==`string`?n=e.detail:typeof e.title==`string`&&(n=e.title)}catch{}return console.warn(JSON.stringify({event:`conflict-content-fetch-failed`,file:e,status:t.status,detail:n})),null}let n=await t.json();return{base:n.base??``,ours:n.ours??``,theirs:n.theirs??``}}catch(t){return console.warn(JSON.stringify({event:`conflict-content-fetch-failed`,file:e,status:null,detail:t instanceof Error?t.message:String(t)})),null}}function HT(e){let t=(0,$.c)(24),{docName:n}=e,{conflicts:r,loading:i}=JC(),a;if(t[0]!==r||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>Ar(e.file)===n,t[3]=n,t[4]=e),a=r.find(e),t[0]=r,t[1]=n,t[2]=a}else a=t[2];let o=a,s=o?.file??`${n}.md`,[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(!1),f,p;t[5]===n?(f=t[6],p=t[7]):(f=()=>(console.warn(JSON.stringify({event:`editor-area-swap-to-diffview`,"doc.name":n})),()=>{console.warn(JSON.stringify({event:`editor-area-swap-from-diffview`,"doc.name":n}))}),p=[n],t[5]=n,t[6]=f,t[7]=p),(0,Q.useEffect)(f,p);let m=i||o===void 0,h,g;t[8]!==m||t[9]!==s?(h=()=>{if(m)return;let e=!1;return l(null),d(!1),VT(s).then(t=>{e||(t===null?d(!0):l(t))}),()=>{e=!0}},g=[s,m],t[8]=m,t[9]=s,t[10]=h,t[11]=g):(h=t[10],g=t[11]),(0,Q.useEffect)(h,g);let _;t[12]===s?_=t[13]:(_=async function(e){let t=await BT(s,e);t.ok||$o.error(`Failed to save resolution for ${s}`,{description:t.detail})},t[12]=s,t[13]=_);let v=_;if(u){let e;return t[14]===s?e=t[15]:(e=(0,Z.jsxs)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:[`Couldn't load conflict content for `,s,`. Try reloading the page.`]}),t[14]=s,t[15]=e),e}if(c===null){let e;return t[16]===s?e=t[17]:(e=(0,Z.jsxs)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:[`Loading conflict for `,s]}),t[16]=s,t[17]=e),e}let y;t[18]===v?y=t[19]:(y=e=>void v(e),t[18]=v,t[19]=y);let b;return t[20]!==c.ours||t[21]!==c.theirs||t[22]!==y?(b=(0,Z.jsx)(RT,{oldContent:c.theirs,newContent:c.ours,layout:`unified`,conflictMode:!0,onResolve:y}),t[20]=c.ours,t[21]=c.theirs,t[22]=y,t[23]=b):b=t[23],b}function UT(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(Nt(n,r));let a;return t[0]===i?a=t[1]:(a=(0,Z.jsx)(Z.Fragment,{children:i}),t[0]=i,t[1]=a),a}var WT=`__back-nav__`;function GT(e){return e instanceof Re||e instanceof gt||e instanceof Pe||e instanceof et||e instanceof Dt||e instanceof T?e.docName:null}function KT(e){if(e instanceof Re){let t=e.docName;return{title:X._({id:`Jejur6`}),summary:X._({id:`jSY41h`,values:{docName:t}})}}if(e instanceof gt){let t=e.docName;return{title:X._({id:`V7QxyT`}),summary:X._({id:`xG4tb6`,values:{docName:t}})}}if(e instanceof Pe){let t=e.docName;return{title:X._({id:`1di5fu`}),summary:X._({id:`PQCdtv`,values:{docName:t}})}}if(e instanceof et){let t=e.docName;return{title:X._({id:`wvbc1r`}),summary:X._({id:`IX7-sq`,values:{docName:t}})}}if(e instanceof Dt)return{title:X._({id:`Gfr4fu`}),summary:X._({id:`j6LB7S`})};if(e instanceof T){let t=e.docName;return{title:X._({id:`vv7kpg`}),summary:X._({id:`mdKFEy`,values:{docName:t}})}}let t=e instanceof Error&&e.message?e.message:X._({id:`W5A0Ly`});return{title:X._({id:`29VNqC`}),summary:t}}function qT(e){let t=(0,$.c)(28),{error:n,resetErrorBoundary:r,activeDocName:i,previousDocName:a,onNavigateBack:o}=e,c;t[0]===n?c=t[1]:(c=KT(n),t[0]=n,t[1]=c);let{title:l,summary:u}=c,d=!!a&&!!o,f=(0,Q.useRef)(null),p,m;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>{f.current?.focus()},m=[],t[2]=p,t[3]=m):(p=t[2],m=t[3]),(0,Q.useEffect)(p,m);let h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(db,{size:80,variant:`sleeping`}),t[4]=h):h=t[4];let g;t[5]===l?g=t[6]:(g=(0,Z.jsx)(`h2`,{id:`document-error-title`,className:`text-2xl font-light tracking-tighter text-balance`,children:l}),t[5]=l,t[6]=g);let _;t[7]===u?_=t[8]:(_=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:u}),t[7]=u,t[8]=_);let v;t[9]!==g||t[10]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[g,_]}),t[9]=g,t[10]=_,t[11]=v):v=t[11];let y;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(s,{id:`KDw4GX`}),t[12]=y):y=t[12];let b;t[13]===r?b=t[14]:(b=(0,Z.jsx)(Ni,{ref:f,variant:`default`,onClick:r,children:y}),t[13]=r,t[14]=b);let x;t[15]!==i||t[16]!==d||t[17]!==n||t[18]!==o||t[19]!==a||t[20]!==r?(x=d?(0,Z.jsx)(Ni,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(st(GT(n)??i),o(a),r(WT))},children:(0,Z.jsx)(s,{id:`CKyk7Q`})}):null,t[15]=i,t[16]=d,t[17]=n,t[18]=o,t[19]=a,t[20]=r,t[21]=x):x=t[21];let S;t[22]!==x||t[23]!==b?(S=(0,Z.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[b,x]}),t[22]=x,t[23]=b,t[24]=S):S=t[24];let C;return t[25]!==S||t[26]!==v?(C=(0,Z.jsxs)(`div`,{role:`alert`,"aria-labelledby":`document-error-title`,"data-slot":`document-error-boundary`,className:`flex h-full flex-col items-center justify-center gap-8 p-8 text-center`,children:[h,v,S]}),t[25]=S,t[26]=v,t[27]=C):C=t[27],C}function JT(e){let t=(0,$.c)(17),{activeDocName:n,previousDocName:r,onNavigateBack:i,onRecycle:a,children:o}=e,s;t[0]!==n||t[1]!==i||t[2]!==r?(s=e=>(0,Z.jsx)(qT,{...e,activeDocName:n,previousDocName:r,onNavigateBack:i}),t[0]=n,t[1]=i,t[2]=r,t[3]=s):s=t[3];let c;t[4]===n?c=t[5]:(c=[n],t[4]=n,t[5]=c);let l;t[6]!==n||t[7]!==a?(l=e=>{if(e.reason===`imperative-api`){if(Array.isArray(e.args)&&e.args[0]===WT){console.warn(`[DocumentErrorBoundary] back-nav reset (no recycle)`);return}a(n),console.warn(`[DocumentErrorBoundary] retry recycled ${n}`)}else console.warn(`[DocumentErrorBoundary] reset by key change (${e.prev?.[0]} → ${e.next?.[0]})`)},t[6]=n,t[7]=a,t[8]=l):l=t[8];let u;t[9]===n?u=t[10]:(u=e=>{console.error(`[DocumentErrorBoundary] rendered fallback for ${n}: ${KT(e).title}`,e)},t[9]=n,t[10]=u);let d;return t[11]!==o||t[12]!==s||t[13]!==c||t[14]!==l||t[15]!==u?(d=(0,Z.jsx)(m,{fallbackRender:s,resetKeys:c,onReset:l,onError:u,children:o}),t[11]=o,t[12]=s,t[13]=c,t[14]=l,t[15]=u,t[16]=d):d=t[16],d}function YT(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=sr(t);return{map:n,keys:In(t),parseError:r}}function XT(e){let t=(0,$.c)(21),{provider:n}=e,r;t[0]===n?r=t[1]:(r=()=>YT(n),t[0]=n,t[1]=r);let[i,a]=(0,Q.useState)(r),o,s;t[2]===n?(o=t[3],s=t[4]):(o=()=>{let e=Or(n);a(e.current());let t=e.subscribe(e=>{a(e)});return()=>{t(),e.dispose()}},s=[n],t[2]=n,t[3]=o,t[4]=s),(0,Q.useEffect)(o,s);let c;t[5]===i.map.icon?c=t[6]:(c=Qe(i.map.icon),t[5]=i.map.icon,t[6]=c);let l=c,u;t[7]===i.map.cover?u=t[8]:(u=ut(i.map.cover),t[7]=i.map.cover,t[8]=u);let d=u,f=d.kind===`url`||d.kind===`path`,p=l.kind!==`unsupported`;if(!f&&!p)return null;let m=f?`true`:`false`,h=p?`true`:`false`,g;t[9]!==d||t[10]!==f?(g=f?(0,Z.jsx)(ZT,{cover:d}):null,t[9]=d,t[10]=f,t[11]=g):g=t[11];let _;t[12]!==f||t[13]!==p||t[14]!==l?(_=p?(0,Z.jsx)(QT,{icon:l,hasCover:f}):null,t[12]=f,t[13]=p,t[14]=l,t[15]=_):_=t[15];let v;return t[16]!==m||t[17]!==h||t[18]!==g||t[19]!==_?(v=(0,Z.jsxs)(`div`,{className:`page-header editor-content-aligned`,"data-has-cover":m,"data-has-icon":h,"aria-hidden":`true`,"data-testid":`page-header`,children:[g,_]}),t[16]=m,t[17]=h,t[18]=g,t[19]=_,t[20]=v):v=t[20],v}function ZT(e){let t=(0,$.c)(2),{cover:n}=e,r;return t[0]===n.value?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`page-header-cover`,"data-testid":`page-header-cover`,children:(0,Z.jsx)(`img`,{src:n.value,alt:``,draggable:!1,loading:`lazy`,referrerPolicy:`no-referrer`,className:`page-header-cover-img`})}),t[0]=n.value,t[1]=r),r}function QT(e){let t=(0,$.c)(9),{icon:n,hasCover:r}=e,i=r?`page-header-icon page-header-icon--with-cover`:`page-header-icon`;if(n.kind===`emoji`){let e;return t[0]!==n.value||t[1]!==i?(e=(0,Z.jsx)(`span`,{className:i,"data-testid":`page-header-icon`,"data-kind":`emoji`,children:n.value}),t[0]=n.value,t[1]=i,t[2]=e):e=t[2],e}let a;t[3]===n.value?a=t[4]:(a=(0,Z.jsx)(`img`,{src:n.value,alt:``,draggable:!1,referrerPolicy:`no-referrer`,className:`page-header-icon-img`}),t[3]=n.value,t[4]=a);let o;return t[5]!==n.kind||t[6]!==i||t[7]!==a?(o=(0,Z.jsx)(`span`,{className:i,"data-testid":`page-header-icon`,"data-kind":n.kind,children:a}),t[5]=n.kind,t[6]=i,t[7]=a,t[8]=o):o=t[8],o}function $T(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=sr(t);return{map:n,keys:In(t),parseError:r}}function eE(e){let t=(0,$.c)(175),{provider:n}=e,{_:r}=i(),[a,o]=(0,Q.useState)(null),c;t[0]===n?c=t[1]:(c=()=>$T(n),t[0]=n,t[1]=c);let[l,u]=(0,Q.useState)(c),d,f;t[2]===n?(d=t[3],f=t[4]):(d=()=>{let e=Or(n);o(e),u(e.current());let t=e.subscribe(e=>{u(e)});return()=>{t(),e.dispose(),o(t=>t===e?null:t)}},f=[n],t[2]=n,t[3]=d,t[4]=f),(0,Q.useEffect)(d,f);let p=l.map,m=l.keys,h=l.parseError,[g,_]=(0,Q.useState)(!1),v;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(v={},t[5]=v):v=t[5];let[y,b]=(0,Q.useState)(v),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(null),T;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(T={},t[6]=T):T=t[6];let[E,D]=(0,Q.useState)(T),O;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(O={},t[7]=O):O=t[7];let[k,A]=(0,Q.useState)(O),j=n.configuration.name??``,M;t[8]===j?M=t[9]:(M=iE(j),t[8]=j,t[9]=M);let N=M,F;t[10]===j?F=t[11]:(F=nE(j),t[10]=j,t[11]=F);let I=co(N?null:F),L;t[12]!==I||t[13]!==N?(L=!N&&I.state.status===`ready`?I.state.data.folder.frontmatter_defaults??{}:{},t[12]=I,t[13]=N,t[14]=L):L=t[14];let R=L,z;t[15]!==I||t[16]!==N?(z=!N&&I.state.status===`ready`?I.state.data.frontmatterSources:{},t[15]=I,t[16]=N,t[17]=z):z=t[17];let B=z,V;t[18]!==r||t[19]!==a?(V=function(e){if(!a)return{ok:!1,error:r({id:`9zb2WA`})};let t=a.patch(e);if(t.ok)return{ok:!0};if(t.error.code===`WRITE_ERROR`)return console.warn(`[PropertyPanel] binding write error:`,t.error.detail),{ok:!1,error:t.error.detail};let n=jn(t.error);return{ok:!1,error:t.error.issues[0]?.message??r({id:`8fRyLo`}),fieldErrors:Object.keys(n).length>0?n:void 0}},t[18]=r,t[19]=a,t[20]=V):V=t[20];let H=V,U;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(U=function(e){D(t=>{if(!Object.hasOwn(t,e))return t;let n={...t};return delete n[e],n})},t[21]=U):U=t[21];let W=U,G;t[22]===r?G=t[23]:(G=function(e,t){if(e.ok)return;let n=e.error??r({id:`4g19V6`}),i=e.fieldErrors??{};D(e=>{let r={...e};for(let e of t)r[e]=i[e]??n;return r}),A(e=>{let n={...e};for(let e of t)n[e]=(n[e]??0)+1;return n})},t[22]=r,t[23]=G);let K=G,q;t[24]!==H||t[25]!==K?(q=function(e,t){W(e),K(H({[e]:t}),[e])},t[24]=H,t[25]=K,t[26]=q):q=t[26];let ee=q,te;t[27]!==H||t[28]!==K?(te=function(e){W(e),K(H({[e]:null}),[e])},t[27]=H,t[28]=K,t[29]=te):te=t[29];let ne=te,re;t[30]!==r||t[31]!==a?(re=function(e,t){if(!a)return{ok:!1,error:r({id:`9zb2WA`})};if(e===t)return{ok:!0};let n=a.rename(e,t);if(n.ok)return{ok:!0};if(n.error.code===`WRITE_ERROR`)return{ok:!1,error:n.error.detail};let i=jn(n.error);return{ok:!1,error:n.error.issues[0]?.message??r({id:`I1gRhX`}),fieldErrors:Object.keys(i).length>0?i:void 0}},t[30]=r,t[31]=a,t[32]=re):re=t[32];let ie=re,ae;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(ae=function(e,t){return`${e} ${t}`},t[33]=ae):ae=t[33];let oe=ae,se;t[34]!==a||t[35]!==m?(se=function(e){if(!a)return;let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=m.map((e,t)=>oe(e,t)),i=r.indexOf(t),o=r.indexOf(n);if(i<0||o<0)return;let s=m.slice(),[c]=s.splice(i,1);if(!c)return;s.splice(o,0,c);let l=a.reorder(s);l.ok||console.warn(`[PropertyPanel] reorder failed:`,l.error)},t[34]=a,t[35]=m,t[36]=se):se=t[36];let ce=se,le;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(le={activationConstraint:{distance:4}},t[37]=le):le=t[37];let ue;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(ue={coordinateGetter:ba},t[38]=ue):ue=t[38];let de=Fa($i(Da,le),$i(ga,ue)),fe;t[39]!==R||t[40]!==ee||t[41]!==p?(fe=function(e,t){let n=p[e]??aE(R[e]);if(n===void 0)return;b(n=>({...n,[e]:t}));let r=Sa(n,t);(!Object.hasOwn(p,e)||!tE(n,r))&&ee(e,r)},t[39]=R,t[40]=ee,t[41]=p,t[42]=fe):fe=t[42];let pe=fe,me;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(me=function(){S({name:``,type:`text`,value:``,error:null}),_(!1)},t[43]=me):me=t[43];let he=me,{addPropertySignal:ge,clearAddProperty:_e}=ax(),ve;t[44]!==ge||t[45]!==j?(ve=ge.get(j)??0,t[44]=ge,t[45]=j,t[46]=ve):ve=t[46];let ye=ve,be,xe;t[47]===ye?(be=t[48],xe=t[49]):(be=()=>{ye>0&&(S({name:``,type:`text`,value:``,error:null}),_(!1))},xe=[ye],t[47]=ye,t[48]=be,t[49]=xe),(0,Q.useEffect)(be,xe);let Se,Ce;t[50]!==_e||t[51]!==j?(Se=()=>()=>_e(j),Ce=[j,_e],t[50]=_e,t[51]=j,t[52]=Se,t[53]=Ce):(Se=t[52],Ce=t[53]),(0,Q.useEffect)(Se,Ce);let J;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(J=function(e){S(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):ra[e];return{...t,type:e,value:n,error:null}})},t[54]=J):J=t[54];let we=J,Te;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(Te=function(e){S(t=>t&&{...t,value:e})},t[55]=Te):Te=t[55];let Ee=Te,De;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(De=function(e){S(t=>t&&{...t,name:e,error:null})},t[56]=De):De=t[56];let Oe=De,ke;t[57]!==r||t[58]!==x||t[59]!==H||t[60]!==p?(ke=function(){if(!x)return;let e=x.name.trim();if(!e){S({...x,error:r({id:`8_brI5`})});return}if(e===`frontmatter`){S({...x,error:r({id:`dURmlQ`})});return}if(Object.hasOwn(p,e)){S({...x,error:r({id:`njU86j`,values:{trimmed:e}})});return}let t=H({[e]:x.value});if(t.ok){S(null);return}let n=t.fieldErrors?.[e],i=t.error??r({id:`OJeiSH`});S({...x,error:n??i})},t[57]=r,t[58]=x,t[59]=H,t[60]=p,t[61]=ke):ke=t[61];let Ae=ke,je;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(je=function(){S(null)},t[62]=je):je=t[62];let Me=je,Ne;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=function(e){w({key:e,draft:e,error:null})},t[63]=Ne):Ne=t[63];let Pe=Ne,Fe;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=function(e){w(t=>t&&{...t,draft:e,error:null})},t[64]=Fe):Fe=t[64];let Ie=Fe,Le;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(Le=function(){w(null)},t[65]=Le):Le=t[65];let Re=Le,ze;t[66]!==r||t[67]!==p||t[68]!==ie||t[69]!==C?(ze=function(){if(!C)return;let e=C.draft.trim();if(!e){w(null);return}if(e===C.key){w(null);return}if(e===`frontmatter`){w({...C,error:r({id:`dURmlQ`})});return}if(Object.hasOwn(p,e)){w({...C,error:r({id:`njU86j`,values:{trimmed:e}})});return}let t=ie(C.key,e);if(t.ok){b(t=>{if(!Object.hasOwn(t,C.key))return t;let n={...t};return n[e]=n[C.key],delete n[C.key],n}),W(C.key),w(null);return}let n=t.fieldErrors?.[e]??t.fieldErrors?.[C.key]??t.error??r({id:`2ryd91`});w({...C,error:n})},t[66]=r,t[67]=p,t[68]=ie,t[69]=C,t[70]=ze):ze=t[70];let Be=ze,Ve;t[71]!==p||t[72]!==m?(Ve=m.length>0?m:Object.keys(p),t[71]=p,t[72]=m,t[73]=Ve):Ve=t[73];let He=Ve,Ue;if(t[74]!==He){Ue=new Map;for(let e of He)Ue.set(e,(Ue.get(e)??0)+1);t[74]=He,t[75]=Ue}else Ue=t[75];let We,Ge,Y,Ke,qe,Je,Ye,Xe,Ze,Qe,$e,et;if(t[76]!==x||t[77]!==R||t[78]!==B||t[79]!==g||t[80]!==ee||t[81]!==Be||t[82]!==Ue||t[83]!==E||t[84]!==ce||t[85]!==p||t[86]!==y||t[87]!==h||t[88]!==ne||t[89]!==C||t[90]!==He||t[91]!==k||t[92]!==de||t[93]!==pe){et=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Object.keys(R).filter(e=>!Object.hasOwn(p,e)).sort();if(He.length===0&&e.length===0&&!x&&!h){et=null;break bb0}Qe=`property-panel editor-content-aligned pt-4 pb-4 text-sm`,$e=`property-panel`,Ge=is,Ye=!g,t[106]===Symbol.for(`react.memo_cache_sentinel`)?(Xe=e=>_(!e),t[106]=Xe):Xe=t[106];let n=!g,r;t[107]===n?r=t[108]:(r=(0,Z.jsx)(es,{"data-expanded":n,className:`size-3.5 shrink-0 text-muted-foreground transition-transform duration-150 ease-out data-[expanded=true]:rotate-90`}),t[107]=n,t[108]=r);let i;t[109]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`l_UFPv`})}),t[109]=i):i=t[109],t[110]===r?Ze=t[111]:(Ze=(0,Z.jsx)(rs,{asChild:!0,children:(0,Z.jsxs)(Ni,{type:`button`,variant:`ghost`,className:`mb-1.5 flex h-auto w-fit bg-transparent! items-center gap-1 px-1 py-0.5 text-base font-medium text-foreground hover:bg-transparent hover:text-foreground`,children:[r,i]})}),t[110]=r,t[111]=Ze),We=ns,Y=`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in]`,t[112]===h?Ke=t[113]:(Ke=h?(0,Z.jsxs)(`div`,{role:`alert`,"data-testid":`property-panel-yaml-error`,className:`mb-1 flex items-start gap-1.5 rounded border border-destructive/30 bg-destructive/5 px-2 py-1.5 text-[11px] text-destructive`,children:[(0,Z.jsx)(Pn,{className:`size-3.5 shrink-0 mt-0.5`}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(s,{id:`UG-Phk`}),(0,Z.jsx)(`span`,{className:`block text-[10px] opacity-80`,children:h})]})]}):null,t[112]=h,t[113]=Ke);let a;if(t[114]!==He){let e;t[116]===Symbol.for(`react.memo_cache_sentinel`)?(e=(e,t)=>oe(e,t),t[116]=e):e=t[116],a=He.map(e),t[114]=He,t[115]=a}else a=t[115];let o;if(t[117]!==ee||t[118]!==Be||t[119]!==Ue||t[120]!==E||t[121]!==p||t[122]!==y||t[123]!==ne||t[124]!==C||t[125]!==He||t[126]!==k||t[127]!==pe){let e;t[129]!==ee||t[130]!==Be||t[131]!==Ue||t[132]!==E||t[133]!==p||t[134]!==y||t[135]!==ne||t[136]!==C||t[137]!==k||t[138]!==pe?(e=(e,t)=>{let n=p[e];if(n===void 0)return null;let r=y[e]??pi(n),i=C?.key===e?C:null,a=(Ue.get(e)??0)>1;return(0,Z.jsx)(ja,{sortableId:oe(e,t),keyName:e,value:n,declared:r,error:E[e]??null,resetCounter:k[e]??0,isDuplicate:a,rename:{state:i,onBegin:()=>Pe(e),onChangeDraft:Ie,onCommit:Be,onCancel:Re},onCommit:t=>ee(e,t),onChangeType:t=>pe(e,t),onRemove:()=>ne(e)},`${e}-${t}`)},t[129]=ee,t[130]=Be,t[131]=Ue,t[132]=E,t[133]=p,t[134]=y,t[135]=ne,t[136]=C,t[137]=k,t[138]=pe,t[139]=e):e=t[139],o=He.map(e),t[117]=ee,t[118]=Be,t[119]=Ue,t[120]=E,t[121]=p,t[122]=y,t[123]=ne,t[124]=C,t[125]=He,t[126]=k,t[127]=pe,t[128]=o}else o=t[128];let c;t[140]!==a||t[141]!==o?(c=(0,Z.jsx)(Zi,{items:a,strategy:sa,children:o}),t[140]=a,t[141]=o,t[142]=c):c=t[142],t[143]!==ce||t[144]!==de||t[145]!==c?(qe=(0,Z.jsx)(fa,{sensors:de,collisionDetection:jo,onDragEnd:ce,children:c}),t[143]=ce,t[144]=de,t[145]=c,t[146]=qe):qe=t[146];let l;t[147]!==R||t[148]!==B||t[149]!==ee||t[150]!==E||t[151]!==k||t[152]!==pe?(l=e=>{let t=R[e],n=aE(t),r=pi(n),i=B[e]??``;return(0,Z.jsx)(ja,{keyName:e,value:n,declared:r,error:E[e]??null,resetCounter:k[e]??0,isInherited:!0,badge:(0,Z.jsx)(aa,{source:i}),onCommit:t=>ee(e,t),onChangeType:t=>pe(e,t)},`inherited-${e}`)},t[147]=R,t[148]=B,t[149]=ee,t[150]=E,t[151]=k,t[152]=pe,t[153]=l):l=t[153],Je=e.map(l)}t[76]=x,t[77]=R,t[78]=B,t[79]=g,t[80]=ee,t[81]=Be,t[82]=Ue,t[83]=E,t[84]=ce,t[85]=p,t[86]=y,t[87]=h,t[88]=ne,t[89]=C,t[90]=He,t[91]=k,t[92]=de,t[93]=pe,t[94]=We,t[95]=Ge,t[96]=Y,t[97]=Ke,t[98]=qe,t[99]=Je,t[100]=Ye,t[101]=Xe,t[102]=Ze,t[103]=Qe,t[104]=$e,t[105]=et}else We=t[94],Ge=t[95],Y=t[96],Ke=t[97],qe=t[98],Je=t[99],Ye=t[100],Xe=t[101],Ze=t[102],Qe=t[103],$e=t[104],et=t[105];if(et!==Symbol.for(`react.early_return_sentinel`))return et;let tt;t[154]!==r||t[155]!==x||t[156]!==Ae?(tt=x?(0,Z.jsx)(To,{draft:x,onChangeName:Oe,onChangeType:we,onChangeValue:Ee,onCommit:Ae,onCancel:Me}):(0,Z.jsxs)(`div`,{className:`mt-1 flex items-center gap-1`,children:[(0,Z.jsx)(`span`,{"aria-hidden":!0,className:`h-7 w-4 shrink-0`}),(0,Z.jsxs)(Ni,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:he,"aria-label":r({id:`F-NRCj`}),className:`flex items-center gap-1.5 rounded px-2 py-1 font-medium text-sm hover:bg-muted/50 hover:text-foreground`,children:[(0,Z.jsx)(P,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`m16xKo`})})]})]}),t[154]=r,t[155]=x,t[156]=Ae,t[157]=tt):tt=t[157];let nt;t[158]!==We||t[159]!==Y||t[160]!==Ke||t[161]!==qe||t[162]!==Je||t[163]!==tt?(nt=(0,Z.jsxs)(We,{className:Y,children:[Ke,qe,Je,tt]}),t[158]=We,t[159]=Y,t[160]=Ke,t[161]=qe,t[162]=Je,t[163]=tt,t[164]=nt):nt=t[164];let rt;t[165]!==Ge||t[166]!==Ye||t[167]!==Xe||t[168]!==Ze||t[169]!==nt?(rt=(0,Z.jsxs)(Ge,{open:Ye,onOpenChange:Xe,children:[Ze,nt]}),t[165]=Ge,t[166]=Ye,t[167]=Xe,t[168]=Ze,t[169]=nt,t[170]=rt):rt=t[170];let it;return t[171]!==Qe||t[172]!==$e||t[173]!==rt?(it=(0,Z.jsx)(`div`,{className:Qe,"data-testid":$e,children:rt}),t[171]=Qe,t[172]=$e,t[173]=rt,t[174]=it):it=t[174],it}function tE(e,t){return Array.isArray(e)&&Array.isArray(t)?e.length===t.length?e.every((e,n)=>e===t[n]):!1:e===t}function nE(e){if(!e)return``;let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}var rE=/(^|\/)\.ok\/templates\//;function iE(e){return rE.test(e)}function aE(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`?e:Array.isArray(e)?e.map(e=>typeof e==`string`?e:JSON.stringify(e)):e==null?``:JSON.stringify(e)}var oE=de(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function sE(e){let t=e.threshold??oE;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function cE(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var lE=de(`ACTIVITY_MOUNT_LIMIT`,3);function uE(){return n(()=>import(`./SourceEditor-BEQlTn2N.js`),__vite__mapDeps([44,1,33,2,34,35,20,36,37,38,39,19,6,3,7,4,10,9,40,45,22]),import.meta.url)}var dE=(0,Q.lazy)(async()=>({default:(await uE()).SourceEditor}));function fE(e,t,n){if(n<=0)return[];let r=e.filter(e=>!Ke(e.docName)),i=[...r].sort((e,t)=>t.lastAccessedAt-e.lastAccessedAt).slice(0,n);if(t===null||i.some(e=>e.docName===t))return i;let a=r.find(e=>e.docName===t);return a?[...i.slice(0,n-1),a]:i}function pE(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:X._({id:`MTs6g3`}),summary:t.reason===`clear-data-timeout`?X._({id:`Sc1bKE`,values:{docName:e}}):X._({id:`ovIGrT`,values:{docName:e}}),actionLabel:X._({id:`HpK_8d`})}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:X._({id:`cF9DyA`}),summary:t.phase===`clearing-local-cache`?X._({id:`bmC18N`,values:{docName:e}}):X._({id:`pAgkuZ`,values:{docName:e}})}:null}function mE(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(Ie,{name:`activity-pool`,children:(0,Z.jsx)(hE,{...e})}),t[0]=e,t[1]=n),n}function hE(e){let t=(0,$.c)(15),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c,serverRestartRecovery:l}=ft(),{pages:u,loading:d}=gi(),f=fE(c,n,lE),p=(0,Q.useRef)(``),m=f.map(gE).join(`,`),h=(0,Q.useRef)(c),g,_;t[0]===c?(g=t[1],_=t[2]):(g=()=>{h.current=c},_=[c],t[0]=c,t[1]=g,t[2]=_),(0,Q.useLayoutEffect)(g,_),(0,Q.useLayoutEffect)(()=>{if(p.current===m)return;let e=p.current?p.current.split(`,`):[],t=m?m.split(`,`):[],r=e.filter(e=>!t.includes(e)),i=t.filter(t=>!e.includes(t));for(let e of r)at(e);for(let e of i){let t=h.current.find(t=>t.docName===e)?.poolEventId;ee(e,t&&t.length>0?t:crypto.randomUUID())}Ht(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),p.current=m,me(t)},[m,n]);let v;t[3]!==n||t[4]!==i||t[5]!==r||t[6]!==d||t[7]!==o||t[8]!==s||t[9]!==u||t[10]!==a||t[11]!==l?(v=e=>(0,Z.jsx)(SE,{entry:e,isActive:e.docName===n,isSourceMode:r,editorPlaceholder:i,isNewDoc:!d&&!u.has(e.docName),previousDocName:a,onNavigateBack:o,onRecycle:s,serverRestartRecovery:l},e.docName),t[3]=n,t[4]=i,t[5]=r,t[6]=d,t[7]=o,t[8]=s,t[9]=u,t[10]=a,t[11]=l,t[12]=v):v=t[12];let y=f.map(v),b;return t[13]===y?b=t[14]:(b=(0,Z.jsx)(Z.Fragment,{children:y}),t[13]=y,t[14]=b),b}function gE(e){return e.docName}function _E(e){let t=(0,$.c)(8),{isActive:n,initialScrollTop:r,children:i}=e,a=(0,Q.useRef)(null),o=(0,Q.useRef)(r??0),s,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=a.current;if(!e)return;let t=()=>{e.scrollTop>0&&(o.current=e.scrollTop)};return e.addEventListener(`scroll`,t,{passive:!0}),()=>e.removeEventListener(`scroll`,t)},c=[],t[0]=s,t[1]=c):(s=t[0],c=t[1]),(0,Q.useEffect)(s,c);let l,u;t[2]===n?(l=t[3],u=t[4]):(l=()=>{if(!n)return;let e=a.current;if(!e)return;let t=o.current;if(t===0)return;let r=performance.now(),i=!1;e.scrollTop=t,e.scrollTop===t&&e.scrollHeight>t&&Ht(`ok/scroll-restore/phase1-success`,{target:t,elapsedMs:performance.now()-r});let s=!1,c=0,l=()=>{s||(s=!0,cancelAnimationFrame(c),clearTimeout(f),e.removeEventListener(`wheel`,u),e.removeEventListener(`touchstart`,u))},u=()=>l();e.addEventListener(`wheel`,u,{passive:!0}),e.addEventListener(`touchstart`,u,{passive:!0});let d=()=>{s||(e.scrollTop!==t&&e.scrollHeight>t&&(e.scrollTop=t,e.scrollTop===t&&!i&&(Ht(`ok/scroll-restore/phase2-success`,{target:t,elapsedMs:performance.now()-r}),i=!0)),c=requestAnimationFrame(d))};c=requestAnimationFrame(d);let f=setTimeout(()=>{s||(e.scrollTop!==t&&e.scrollHeight>t&&Ht(`ok/scroll-restore/abandoned`,{target:t,elapsedMs:performance.now()-r,scrollHeight:e.scrollHeight,finalScrollTop:e.scrollTop}),l())},2e3);return l},u=[n],t[2]=n,t[3]=l,t[4]=u),(0,Q.useLayoutEffect)(l,u);let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d={overflowAnchor:`auto`},t[5]=d):d=t[5];let f;return t[6]===i?f=t[7]:(f=(0,Z.jsx)(`div`,{ref:a,"data-testid":`editor-scroll-container`,className:`subtle-scrollbar h-full overflow-y-auto pt-14 scroll-pt-14`,style:d,children:i}),t[6]=i,t[7]=f),f}function vE(e){let t=(0,$.c)(12),{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a}=e,o=r&&i,[s,c]=(0,Q.useState)(o),l,u;if(t[0]===o?(l=t[1],u=t[2]):(l=()=>{o&&c(!0)},u=[o],t[0]=o,t[1]=l,t[2]=u),(0,Q.useEffect)(l,u),!s&&!o)return null;let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Oy,{}),t[3]=d):d=t[3];let f=n.docName,p;t[4]===n.provider.document?p=t[5]:(p=n.provider.document.getText(`source`),t[4]=n.provider.document,t[5]=p);let m;return t[6]!==a||t[7]!==n.docName||t[8]!==n.provider||t[9]!==o||t[10]!==p?(m=(0,Z.jsx)(Q.Suspense,{fallback:d,children:(0,Z.jsx)(dE,{docName:f,ytext:p,provider:n.provider,placeholder:a,isSourceModeActive:o})}),t[6]=a,t[7]=n.docName,t[8]=n.provider,t[9]=o,t[10]=p,t[11]=m):m=t[11],m}function yE(e){let t=(0,$.c)(18),{view:n}=e,r=n.kind===`failed`,i=r?`alert`:`status`,a=!r,o;t[0]===r?o=t[1]:(o=(0,Z.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-full border bg-muted text-muted-foreground`,children:r?(0,Z.jsx)(Xc,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(Kt,{className:`size-5 animate-spin`,"aria-hidden":`true`})}),t[0]=r,t[1]=o);let s;t[2]===n.title?s=t[3]:(s=(0,Z.jsx)(`h2`,{className:`text-lg font-medium`,children:n.title}),t[2]=n.title,t[3]=s);let c;t[4]===n.summary?c=t[5]:(c=(0,Z.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:n.summary}),t[4]=n.summary,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]!==r||t[10]!==n.actionLabel?(u=r?(0,Z.jsxs)(Ni,{type:`button`,onClick:bE,children:[(0,Z.jsx)(Xc,{className:`size-4`,"aria-hidden":`true`}),n.actionLabel]}):null,t[9]=r,t[10]=n.actionLabel,t[11]=u):u=t[11];let d;return t[12]!==i||t[13]!==a||t[14]!==o||t[15]!==l||t[16]!==u?(d=(0,Z.jsxs)(`div`,{"data-slot":`server-restart-recovery`,role:i,"aria-busy":a,className:`flex h-full flex-col items-center justify-center gap-6 p-8 text-center`,children:[o,l,u]}),t[12]=i,t[13]=a,t[14]=o,t[15]=l,t[16]=u,t[17]=d):d=t[17],d}function bE(){return window.location.reload()}function xE(e){let t=(0,$.c)(2),{html:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`tiptap-editor h-full pointer-events-none`,"aria-hidden":`true`,children:(0,Z.jsx)(`div`,{className:`tiptap ProseMirror tiptap-editor-portal-content`,dangerouslySetInnerHTML:{__html:n}})}),t[0]=n,t[1]=r),r}function SE(e){let t=(0,$.c)(53),{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a,isNewDoc:o,previousDocName:s,onNavigateBack:c,onRecycle:l,serverRestartRecovery:u}=e,d;t[0]!==n.docName||t[1]!==u?(d=pE(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,p=mS(n.docName)===`conflict`,m;t[3]===n.docName?m=t[4]:(m=()=>{let e=document.createElement(`div`);return e.setAttribute(`data-ok-editor-portal`,n.docName),e.style.display=`contents`,e},t[3]=n.docName,t[4]=m);let[h]=(0,Q.useState)(m),g=n.provider.document.getText(`source`).length,[_,v]=(0,Q.useState)(i),[y,b]=(0,Q.useState)(!i),x,S;t[5]!==i||t[6]!==_||t[7]!==y?(x=()=>{i&&!_?v(!0):!i&&!y&&b(!0)},S=[i,_,y],t[5]=i,t[6]=_,t[7]=y,t[8]=x,t[9]=S):(x=t[8],S=t[9]),(0,Q.useEffect)(x,S);let C=sE({ytextLength:g,isSourceMode:i,visitedSource:_,visitedVisual:y}),w=(0,Q.useRef)(``),T=`${C.isLarge}-${C.renderSource}-${C.renderVisual}`,E,D;t[10]!==n.docName||t[11]!==C.isLarge||t[12]!==C.renderSource||t[13]!==C.renderVisual||t[14]!==T||t[15]!==i||t[16]!==g?(E=()=>{w.current!==T&&(w.current=T,C.isLarge&&Ht(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:g,isSourceMode:i,renderSource:C.renderSource,renderVisual:C.renderVisual}))},D=[T,C.isLarge,C.renderSource,C.renderVisual,n.docName,g,i],t[10]=n.docName,t[11]=C.isLarge,t[12]=C.renderSource,t[13]=C.renderVisual,t[14]=T,t[15]=i,t[16]=g,t[17]=E,t[18]=D):(E=t[17],D=t[18]),(0,Q.useEffect)(E,D);let O;t[19]===n.docName?O=t[20]:(O=()=>Vt(n.docName),t[19]=n.docName,t[20]=O);let[k]=(0,Q.useState)(O),A=k?.html??null,[j,M]=(0,Q.useState)(!1),N,P;t[21]!==n.docName||t[22]!==C.isLarge||t[23]!==C.renderSource||t[24]!==C.renderVisual||t[25]!==j||t[26]!==i||t[27]!==g?(N=()=>{cE({isLarge:C.isLarge,renderSource:C.renderSource,renderVisual:C.renderVisual,hasEmittedFirstToggle:j})&&(Ht(`ok/cold/first-toggle`,{docName:n.docName,mountId:K(n.docName),ytextLength:g,modeEnteredFirst:i?`source`:`visual`}),M(!0))},P=[j,C.isLarge,C.renderSource,C.renderVisual,n.docName,g,i],t[21]=n.docName,t[22]=C.isLarge,t[23]=C.renderSource,t[24]=C.renderVisual,t[25]=j,t[26]=i,t[27]=g,t[28]=N,t[29]=P):(N=t[28],P=t[29]),(0,Q.useEffect)(N,P);let F=r?`visible`:`hidden`,I=`editor:${n.docName}`,L=k?.scrollTop,R;t[30]!==a||t[31]!==n||t[32]!==C.renderSource||t[33]!==C.renderVisual||t[34]!==r||t[35]!==p||t[36]!==o||t[37]!==i||t[38]!==c||t[39]!==l||t[40]!==h||t[41]!==s||t[42]!==f||t[43]!==A?(R=f?(0,Z.jsx)(yE,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(JT,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:A?(0,Z.jsx)(xE,{html:A}):(0,Z.jsx)(Oy,{}),children:(0,Z.jsx)(UT,{docName:n.docName,provider:n.provider,children:p?(0,Z.jsx)(HT,{docName:n.docName,provider:n.provider}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(0,Z.jsx)(XT,{provider:n.provider}),!i&&(0,Z.jsx)(eE,{provider:n.provider}),(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[C.renderSource?(0,Z.jsx)(`div`,{className:i?`h-full`:`ok-mode-hidden h-full`,children:(0,Z.jsx)(vE,{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a})}):null,C.renderVisual?(0,Z.jsx)(`div`,{className:i?`ok-mode-hidden h-full`:`h-full`,children:(0,Z.jsx)(WC,{provider:n.provider,placeholder:a,isSourceMode:i,portalTarget:h},`${n.docName}-${String(o)}`)}):null]})]})})})})}),t[30]=a,t[31]=n,t[32]=C.renderSource,t[33]=C.renderVisual,t[34]=r,t[35]=p,t[36]=o,t[37]=i,t[38]=c,t[39]=l,t[40]=h,t[41]=s,t[42]=f,t[43]=A,t[44]=R):R=t[44];let z;t[45]!==r||t[46]!==L||t[47]!==R?(z=(0,Z.jsx)(_E,{isActive:r,initialScrollTop:L,children:R}),t[45]=r,t[46]=L,t[47]=R,t[48]=z):z=t[48];let B;return t[49]!==F||t[50]!==I||t[51]!==z?(B=(0,Z.jsx)(Q.Activity,{mode:F,name:I,children:z}),t[49]=F,t[50]=I,t[51]=z,t[52]=B):B=t[52],B}function CE(e){let t=(0,$.c)(36),{stats:n}=e,{_:r}=i(),{words:a,chars:o,tokens:c}=n,l;t[0]===r?l=t[1]:(l=r({id:`L1ZE3M`}),t[0]=r,t[1]=l);let u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-full h-2 bg-linear-to-t from-background to-transparent`}),t[2]=u):u=t[2];let d;t[3]===n.words?d=t[4]:(d=n.words.toLocaleString(),t[3]=n.words,t[4]=d);let f;t[5]===d?f=t[6]:(f=(0,Z.jsx)(`span`,{className:`tabular-nums`,children:d}),t[5]=d,t[6]=f);let p;t[7]===a?p=t[8]:(p=(0,Z.jsx)(s,{id:`gljvbT`,values:{words:a}}),t[7]=a,t[8]=p);let m;t[9]!==f||t[10]!==p?(m=(0,Z.jsxs)(`span`,{children:[f,` `,p]}),t[9]=f,t[10]=p,t[11]=m):m=t[11];let h;t[12]===n.chars?h=t[13]:(h=n.chars.toLocaleString(),t[12]=n.chars,t[13]=h);let g;t[14]===h?g=t[15]:(g=(0,Z.jsx)(`span`,{className:`tabular-nums`,children:h}),t[14]=h,t[15]=g);let _;t[16]===o?_=t[17]:(_=(0,Z.jsx)(s,{id:`d5rK4X`,values:{chars:o}}),t[16]=o,t[17]=_);let v;t[18]!==g||t[19]!==_?(v=(0,Z.jsxs)(`span`,{children:[g,` `,_]}),t[18]=g,t[19]=_,t[20]=v):v=t[20];let y=n.tokens>0?`~`:``,b;t[21]===n.tokens?b=t[22]:(b=n.tokens.toLocaleString(),t[21]=n.tokens,t[22]=b);let x;t[23]===b?x=t[24]:(x=(0,Z.jsx)(`span`,{className:`tabular-nums`,children:b}),t[23]=b,t[24]=x);let S;t[25]===c?S=t[26]:(S=(0,Z.jsx)(s,{id:`uynXup`,values:{tokens:c}}),t[25]=c,t[26]=S);let C;t[27]!==y||t[28]!==x||t[29]!==S?(C=(0,Z.jsxs)(`span`,{children:[y,x,` `,S]}),t[27]=y,t[28]=x,t[29]=S,t[30]=C):C=t[30];let w;return t[31]!==l||t[32]!==v||t[33]!==C||t[34]!==m?(w=(0,Z.jsxs)(`section`,{"aria-label":l,className:`relative flex h-6 shrink-0 items-center justify-end gap-3 bg-background px-3 text-2xs text-muted-foreground`,children:[u,m,v,C]}),t[31]=l,t[32]=v,t[33]=C,t[34]=m,t[35]=w):w=t[35],w}function wE(e){let t=(0,$.c)(11),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{_:a}=i(),o;t[3]===a?o=t[4]:(o=a({id:`3__SjS`}),t[3]=a,t[4]=o);let s;t[5]===n?s=t[6]:(s=Ei(n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==o||t[9]!==s?(c=(0,Z.jsx)(`nav`,{"aria-label":o,"data-slot":`breadcrumb`,className:s,...r}),t[7]=r,t[8]=o,t[9]=s,t[10]=c):c=t[10],c}function TE(e){let t=(0,$.c)(8),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=Ei(`flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`ol`,{"data-slot":`breadcrumb-list`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function EE(e){let t=(0,$.c)(8),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=Ei(`inline-flex items-center gap-1`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`li`,{"data-slot":`breadcrumb-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function DE(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({current:i,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0||i?`page`:void 0,o;t[4]===n?o=t[5]:(o=Ei(`font-normal text-foreground`,n),t[4]=n,t[5]=o);let s;return t[6]!==r||t[7]!==a||t[8]!==o?(s=(0,Z.jsx)(`span`,{"data-slot":`breadcrumb-page`,"aria-current":a,className:o,...r}),t[6]=r,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function OE(e){let t=(0,$.c)(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({children:n,className:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=Ei(`[&>svg]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=n??(0,Z.jsx)(es,{}),t[6]=n,t[7]=o);let s;return t[8]!==i||t[9]!==a||t[10]!==o?(s=(0,Z.jsx)(`li`,{"data-slot":`breadcrumb-separator`,role:`presentation`,"aria-hidden":`true`,className:a,...i,children:o}),t[8]=i,t[9]=a,t[10]=o,t[11]=s):s=t[11],s}var kE=1,AE=2,jE=4;function ME(e){let t=(0,$.c)(18),{docName:n,className:r}=e;if(!n)return null;let i,a,o,s,c,l;if(t[0]!==r||t[1]!==n){l=Symbol.for(`react.early_return_sentinel`);bb0:{let{prefix:e}=Rt(n,``);if(!e){l=null;break bb0}let u=e.replace(/\/$/,``).split(`/`).filter(Boolean);if(u.length===0){l=null;break bb0}let d=(e,t)=>({kind:`segment`,value:e,key:u.slice(0,t+1).join(`/`)}),f=u.length>jE?[...u.slice(0,kE).map((e,t)=>d(e,t)),{kind:`ellipsis`,hidden:u.slice(kE,-AE)},...u.slice(-AE).map((e,t)=>d(e,u.length-AE+t))]:u.map((e,t)=>d(e,t));a=wE,t[8]===r?c=t[9]:(c=Ei(`flex min-w-0 items-center`,r),t[8]=r,t[9]=c),i=TE,o=`min-w-0 flex-nowrap gap-1 overflow-hidden text-muted-foreground/70 text-xs`,s=f.map(NE)}t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l}else i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7];if(l!==Symbol.for(`react.early_return_sentinel`))return l;let u;t[10]!==i||t[11]!==o||t[12]!==s?(u=(0,Z.jsx)(i,{className:o,children:s}),t[10]=i,t[11]=o,t[12]=s,t[13]=u):u=t[13];let d;return t[14]!==a||t[15]!==c||t[16]!==u?(d=(0,Z.jsx)(a,{className:c,children:u}),t[14]=a,t[15]=c,t[16]=u,t[17]=d):d=t[17],d}function NE(e,t){let n=e.kind===`segment`?e.key:`ellipsis`;return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(OE,{className:`shrink-0 text-muted-foreground/70 [&>svg]:size-3`}),e.kind===`ellipsis`?(0,Z.jsxs)(EE,{className:`shrink-0`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,title:e.hidden.join(` / `),className:`flex size-4 items-center justify-center text-muted-foreground/70`,children:(0,Z.jsx)(yc,{className:`size-3.5`})}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.hidden.join(` / `)})]}):(0,Z.jsx)(EE,{className:`min-w-0`,children:(0,Z.jsx)(DE,{current:!1,className:`min-w-0 truncate font-normal text-muted-foreground/70`,title:e.value,children:e.value})})]},n)}var PE={fill:`none`,height:24,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,viewBox:`0 0 24 24`,width:24,xmlns:`http://www.w3.org/2000/svg`},FE=e=>{let t=(0,$.c)(15),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({color:a,size:o,strokeWidth:s,absoluteStrokeWidth:n,className:c,children:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=a===void 0?`currentColor`:a,u=o===void 0?24:o,d=s===void 0?2:s,f=c===void 0?``:c,p=n?Number(d)*24/Number(u):d,m;return t[8]!==r||t[9]!==f||t[10]!==l||t[11]!==i||t[12]!==u||t[13]!==p?(m=(0,Z.jsx)(`svg`,{"aria-hidden":`true`,...PE,className:f,height:u,stroke:l,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:p,width:u,...i,children:r}),t[8]=r,t[9]=f,t[10]=l,t[11]=i,t[12]=u,t[13]=p,t[14]=m):m=t[14],m},IE=e=>{let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`Markdown`}),r=(0,Z.jsx)(`path`,{d:`M232,48H24A16,16,0,0,0,8,64V192a16,16,0,0,0,16,16H232a16,16,0,0,0,16-16V64A16,16,0,0,0,232,48Zm0,144H24V64H232V192ZM128,104v48a8,8,0,0,1-16,0V123.31L93.66,141.66a8,8,0,0,1-11.32,0L64,123.31V152a8,8,0,0,1-16,0V104a8,8,0,0,1,13.66-5.66L88,124.69l26.34-26.35A8,8,0,0,1,128,104Zm77.66,18.34a8,8,0,0,1,0,11.32l-24,24a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L168,132.69V104a8,8,0,0,1,16,0v28.69l10.34-10.35A8,8,0,0,1,205.66,122.34Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(FE,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},LE=e=>{let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`Textbox`}),r=(0,Z.jsx)(`path`,{d:`M112,40a8,8,0,0,0-8,8V64H24A16,16,0,0,0,8,80v96a16,16,0,0,0,16,16h80v16a8,8,0,0,0,16,0V48A8,8,0,0,0,112,40ZM24,176V80h80v96ZM248,80v96a16,16,0,0,1-16,16H144a8,8,0,0,1,0-16h88V80H144a8,8,0,0,1,0-16h88A16,16,0,0,1,248,80ZM88,112a8,8,0,0,1-8,8H72v24a8,8,0,0,1-16,0V120H48a8,8,0,0,1,0-16H80A8,8,0,0,1,88,112Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(FE,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function RE(e){let t=(0,$.c)(60),{activeDocName:n,isSourceMode:r,sourceDisabled:a,onModeChange:o,showAddPropertyButton:c,onAddProperty:l,isPanelCollapsed:u,onTogglePanel:d}=e,{_:f}=i(),p;t[0]===n?p=t[1]:(p=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex min-w-0 items-center`,children:(0,Z.jsx)(ME,{docName:n})}),t[0]=n,t[1]=p);let m=r?`source`:`wysiwyg`,h;t[2]===o?h=t[3]:(h=e=>{e&&o(e)},t[2]=o,t[3]=h);let g;t[4]===f?g=t[5]:(g=f({id:`n7aopT`}),t[4]=f,t[5]=g);let _;t[6]===f?_=t[7]:(_=f({id:`ur2XSb`}),t[6]=f,t[7]=_);let v;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(cr,{children:(0,Z.jsx)(LE,{className:`size-4`})}),t[8]=v):v=t[8];let y;t[9]===_?y=t[10]:(y=(0,Z.jsx)(No,{value:`wysiwyg`,"aria-label":_,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:v}),t[9]=_,t[10]=y);let b;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(Qn,{side:`bottom`,children:(0,Z.jsx)(s,{id:`Mb_20S`})}),t[11]=b):b=t[11];let x;t[12]===y?x=t[13]:(x=(0,Z.jsxs)(Gr,{children:[y,b]}),t[12]=y,t[13]=x);let S;t[14]===f?S=t[15]:(S=f({id:`xbdtfY`}),t[14]=f,t[15]=S);let C;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(IE,{className:`size-4`}),t[16]=C):C=t[16];let w;t[17]!==a||t[18]!==S?(w=(0,Z.jsx)(cr,{asChild:!0,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(No,{value:`source`,"aria-label":S,disabled:a,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,children:C})})}),t[17]=a,t[18]=S,t[19]=w):w=t[19];let T;t[20]===a?T=t[21]:(T=(0,Z.jsx)(Qn,{side:`bottom`,children:a?(0,Z.jsx)(s,{id:`G-JBA1`}):(0,Z.jsx)(s,{id:`u6Hp4N`})}),t[20]=a,t[21]=T);let E;t[22]!==w||t[23]!==T?(E=(0,Z.jsxs)(Gr,{children:[w,T]}),t[22]=w,t[23]=T,t[24]=E):E=t[24];let D;t[25]!==E||t[26]!==m||t[27]!==h||t[28]!==g||t[29]!==x?(D=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex justify-center`,children:(0,Z.jsxs)(Io,{type:`single`,value:m,onValueChange:h,"aria-label":g,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 data-[size=sm]:rounded-[10px] bg-muted p-0.5`,children:[x,E]})}),t[25]=E,t[26]=m,t[27]=h,t[28]=g,t[29]=x,t[30]=D):D=t[30];let O;t[31]!==p||t[32]!==D?(O=(0,Z.jsx)(`div`,{className:`editor-content-aligned bg-background py-2`,children:(0,Z.jsxs)(`div`,{className:`grid grid-cols-3 items-center`,children:[p,D]})}),t[31]=p,t[32]=D,t[33]=O):O=t[33];let k;t[34]!==f||t[35]!==l||t[36]!==c?(k=c&&(0,Z.jsxs)(Gr,{children:[(0,Z.jsx)(Ni,{variant:`ghost`,size:`icon`,"aria-label":f({id:`81H_23`}),onClick:l,"data-testid":`add-properties-button`,asChild:!0,children:(0,Z.jsx)(cr,{children:(0,Z.jsx)(Fc,{})})}),(0,Z.jsx)(Qn,{side:`bottom`,children:(0,Z.jsx)(s,{id:`81H_23`})})]}),t[34]=f,t[35]=l,t[36]=c,t[37]=k):k=t[37];let A=!u,j;t[38]!==f||t[39]!==u?(j=f(u?{id:`6iDEWA`}:{id:`170Js2`}),t[38]=f,t[39]=u,t[40]=j):j=t[40];let M;t[41]===u?M=t[42]:(M=(0,Z.jsx)(cr,{children:u?(0,Z.jsx)(Wc,{}):(0,Z.jsx)(Uc,{})}),t[41]=u,t[42]=M);let N;t[43]!==d||t[44]!==A||t[45]!==j||t[46]!==M?(N=(0,Z.jsx)(Ni,{variant:`ghost`,size:`icon`,onClick:d,"aria-expanded":A,"aria-label":j,asChild:!0,children:M}),t[43]=d,t[44]=A,t[45]=j,t[46]=M,t[47]=N):N=t[47];let P;t[48]===u?P=t[49]:(P=(0,Z.jsx)(Qn,{side:`bottom`,children:u?(0,Z.jsx)(s,{id:`6iDEWA`}):(0,Z.jsx)(s,{id:`170Js2`})}),t[48]=u,t[49]=P);let F;t[50]!==N||t[51]!==P?(F=(0,Z.jsxs)(Gr,{children:[N,P]}),t[50]=N,t[51]=P,t[52]=F):F=t[52];let I;t[53]!==k||t[54]!==F?(I=(0,Z.jsxs)(`div`,{className:`pointer-events-auto absolute top-0 right-0 flex items-center justify-end gap-1 py-2 pr-2`,children:[k,F]}),t[53]=k,t[54]=F,t[55]=I):I=t[55];let L;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none h-2 bg-linear-to-b from-background to-transparent`}),t[56]=L):L=t[56];let R;return t[57]!==O||t[58]!==I?(R=(0,Z.jsxs)(`div`,{"data-testid":`editor-toolbar`,className:`pointer-events-none absolute inset-x-0 top-0 z-10`,children:[O,I,L]}),t[57]=O,t[58]=I,t[59]=R):R=t[59],R}function zE(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}var BE=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-oe_KmZ6Y.js`),__vite__mapDeps([32,1,2,33,34,35,20,36,37,38,39,19,6,3,7,4,10,9,40,41]),import.meta.url)).ActivityModeContent}));function VE(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(UE,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(HE,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(Ie,{name:`editor-area`,children:(0,Z.jsxs)(rx,{children:[n,r]})}),t[3]=n,t[4]=i),i}function HE(){let e=(0,$.c)(5),t=Em(),n;e[0]===t?n=e[1]:(n=e=>{e||t.close()},e[0]=t,e[1]=n);let r;return e[2]!==t.open||e[3]!==n?(r=(0,Z.jsx)(px,{open:t.open,onOpenChange:n}),e[2]=t.open,e[3]=n,e[4]=r):r=e[4],r}function UE(e){let t=(0,$.c)(119),{editorMode:n,onModeChange:r,activeTab:a,onActiveTabChange:o,onSaveVersion:c,saving:l}=e,{_:u}=i(),{activeDocName:d,activeProvider:f,activeTarget:p,recycleDocument:m,docPanelMode:h,docPanelAgentId:g,docPanelExpandSignal:_}=ft(),{openDocumentTransition:v}=wt(),{requestAddProperty:y}=ax(),b=fS(f,d),x=hS(f),S=x===`connected`||x===`synced`,C=mS(d)===`conflict`,w=(0,Q.useDeferredValue)(d),T=p?.kind===`missing`,E=!!d&&p?.kind!==`folder`,D;t[0]!==u||t[1]!==T?(D=T?u({id:`K-a33w`}):void 0,t[0]=u,t[1]=T,t[2]=D):D=t[2];let O=D,k=gy(),[A,j]=(0,Q.useState)(!1),{layout:M,autoCollapse:N}=Xx(),P=M===`sheet`,[F,I]=(0,Q.useState)(!1),L=(0,Q.useRef)(!1),R,z;t[3]!==N||t[4]!==M||t[5]!==k?(R=()=>{if(M!==`panel`)return;let e=requestAnimationFrame(()=>{N?(L.current=!1,k.current?.collapse()):L.current||k.current?.expand()});return()=>cancelAnimationFrame(e)},z=[N,M,k],t[3]=N,t[4]=M,t[5]=k,t[6]=R,t[7]=z):(R=t[6],z=t[7]),(0,Q.useEffect)(R,z);let B,V;t[8]!==P||t[9]!==o||t[10]!==k?(B=()=>{let e=e=>{o(e),P?I(!0):(L.current=!1,k.current?.expand())},t=jp();return t&&e(t),Np(t=>{jp(),e(t)})},V=[P,o,k],t[8]=P,t[9]=o,t[10]=k,t[11]=B,t[12]=V):(B=t[11],V=t[12]),(0,Q.useEffect)(B,V);let H,U;t[13]!==_||t[14]!==P||t[15]!==k?(H=()=>{_!==0&&(P?I(!0):(L.current=!1,k.current?.expand()))},U=[_,P,k],t[13]=_,t[14]=P,t[15]=k,t[16]=H,t[17]=U):(H=t[16],U=t[17]),(0,Q.useEffect)(H,U);let W=(0,Q.useRef)(null),[G,K]=(0,Q.useState)(null),q=p?.kind===`large-file`?p.docName:d,ee,te;t[18]===q?(ee=t[19],te=t[20]):(ee=()=>{if(q&&q!==W.current){let e=W.current;W.current=q,K(e)}},te=[q],t[18]=q,t[19]=ee,t[20]=te),(0,Q.useEffect)(ee,te);let re;t[21]===v?re=t[22]:(re=function(e){let t=di(e);window.location.hash===t?v(e):window.location.hash=t},t[21]=v,t[22]=re);let ie=re;if(p?.kind===`large-file`){let e;t[23]!==ie||t[24]!==G?(e=G?{previousDocName:G,onNavigateBack:ie}:void 0,t[23]=ie,t[24]=G,t[25]=e):e=t[25];let n;return t[26]!==p.docName||t[27]!==p.limit||t[28]!==p.size||t[29]!==e?(n=(0,Z.jsx)($b,{docName:p.docName,size:p.size,limit:p.limit,backNav:e}),t[26]=p.docName,t[27]=p.limit,t[28]=p.size,t[29]=e,t[30]=n):n=t[30],n}if(p?.kind===`folder`){if(!(h===`agent`&&g!==null)){let e;return t[31]===p.folderPath?e=t[32]:(e=(0,Z.jsx)(Yb,{folderPath:p.folderPath}),t[31]=p.folderPath,t[32]=e),e}let e;t[33]===p.folderPath?e=t[34]:(e=(0,Z.jsx)(vx,{minSize:`30%`,defaultSize:`75%`,children:(0,Z.jsx)(Yb,{folderPath:p.folderPath})}),t[33]=p.folderPath,t[34]=e);let n;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(yx,{withHandle:!0}),t[35]=n):n=t[35];let r;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(vx,{defaultSize:`25%`,minSize:`300px`,maxSize:`40%`,className:`flex flex-col bg-muted/20`,children:(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{role:`status`,"aria-busy":`true`,className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`ONPvOb`})}),children:(0,Z.jsx)(BE,{showBackButton:!1})})}),t[36]=r):r=t[36];let i;return t[37]===e?i=t[38]:(i=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:(0,Z.jsxs)(_x,{orientation:`horizontal`,children:[e,n,r]})}),t[37]=e,t[38]=i),i}if(p?.kind===`asset`){let e;return t[39]!==p.assetPath||t[40]!==p.mediaKind?(e=(0,Z.jsx)(Dy,{assetPath:p.assetPath,mediaKind:p.mediaKind},p.assetPath),t[39]=p.assetPath,t[40]=p.mediaKind,t[41]=e):e=t[41],e}if(!f||!d){if((typeof window<`u`?Ur(window.location.hash):null)!==null){let e;return t[42]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Oy,{}),t[42]=e):e=t[42],e}let e;return t[43]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Sb,{}),t[43]=e):e=t[43],e}let ae=n===`source`,oe=!S,se=P?!F:A,ce;t[44]!==d||t[45]!==y?(ce=function(){d&&y(d)},t[44]=d,t[45]=y,t[46]=ce):ce=t[46];let le=ce,ue;t[47]!==A||t[48]!==P||t[49]!==k?(ue=function(){P?I(WE):A?(L.current=!1,k.current?.expand()):(L.current=!0,k.current?.collapse())},t[47]=A,t[48]=P,t[49]=k,t[50]=ue):ue=t[50];let de=ue,fe=w??d,pe=G??void 0,me;t[51]!==O||t[52]!==ae||t[53]!==ie||t[54]!==m||t[55]!==fe||t[56]!==pe?(me=(0,Z.jsx)(mE,{activeDocName:fe,isSourceMode:ae,editorPlaceholder:O,previousDocName:pe,onNavigateBack:ie,onRecycle:m}),t[51]=O,t[52]=ae,t[53]=ie,t[54]=m,t[55]=fe,t[56]=pe,t[57]=me):me=t[57];let he;t[58]!==d||t[59]!==ae?(he=(0,Z.jsx)(Gx,{activeDocName:d,isSourceMode:ae}),t[58]=d,t[59]=ae,t[60]=he):he=t[60];let ge;t[61]!==d||t[62]!==w?(ge=zE({activeDocName:d,deferredActiveDocName:w,mountResolved:d!==null&&ne(d),syncResolved:d!==null&&Ve(d)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(Oy,{}),d===null?null:(0,Z.jsx)(ex,{docName:d})]}):null,t[61]=d,t[62]=w,t[63]=ge):ge=t[63];let _e;t[64]!==me||t[65]!==he||t[66]!==ge?(_e=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[me,he,ge]}),t[64]=me,t[65]=he,t[66]=ge,t[67]=_e):_e=t[67];let ve;t[68]!==d||t[69]!==C||t[70]!==se||t[71]!==ae||t[72]!==r||t[73]!==le||t[74]!==oe||t[75]!==de?(ve=!C&&(0,Z.jsx)(RE,{activeDocName:d,isSourceMode:ae,sourceDisabled:oe,onModeChange:r,showAddPropertyButton:!ae,onAddProperty:le,isPanelCollapsed:se,onTogglePanel:de}),t[68]=d,t[69]=C,t[70]=se,t[71]=ae,t[72]=r,t[73]=le,t[74]=oe,t[75]=de,t[76]=ve):ve=t[76];let ye;t[77]!==_e||t[78]!==ve?(ye=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[_e,ve]}),t[77]=_e,t[78]=ve,t[79]=ye):ye=t[79];let be;t[80]!==E||t[81]!==b?(be=E&&(0,Z.jsx)(CE,{stats:b}),t[80]=E,t[81]=b,t[82]=be):be=t[82];let xe;t[83]!==ye||t[84]!==be?(xe=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[ye,be]}),t[83]=ye,t[84]=be,t[85]=xe):xe=t[85];let Se=xe,Ce=P?`100%`:`30%`,J=P?`100%`:`75%`,we;t[86]!==Se||t[87]!==Ce||t[88]!==J?(we=(0,Z.jsx)(vx,{minSize:Ce,defaultSize:J,children:Se}),t[86]=Se,t[87]=Ce,t[88]=J,t[89]=we):we=t[89];let Te;t[90]===P?Te=t[91]:(Te=P?null:(0,Z.jsx)(yx,{withHandle:!0}),t[90]=P,t[91]=Te);let Ee;t[92]!==d||t[93]!==a||t[94]!==h||t[95]!==P||t[96]!==ae||t[97]!==o||t[98]!==c||t[99]!==k||t[100]!==l?(Ee=P?null:(0,Z.jsx)(vx,{panelRef:k,defaultSize:`25%`,minSize:`300px`,maxSize:`40%`,collapsible:!0,collapsedSize:0,onResize:e=>j(e.asPercentage===0),className:`flex flex-col bg-muted/20`,children:(0,Z.jsx)(C_,{docName:d,isSourceMode:ae,activeTab:a,onActiveTabChange:o,mode:h,onSaveVersion:c,saving:l})}),t[92]=d,t[93]=a,t[94]=h,t[95]=P,t[96]=ae,t[97]=o,t[98]=c,t[99]=k,t[100]=l,t[101]=Ee):Ee=t[101];let De;t[102]!==we||t[103]!==Te||t[104]!==Ee?(De=(0,Z.jsxs)(_x,{orientation:`horizontal`,children:[we,Te,Ee]}),t[102]=we,t[103]=Te,t[104]=Ee,t[105]=De):De=t[105];let Oe;t[106]!==d||t[107]!==a||t[108]!==h||t[109]!==P||t[110]!==ae||t[111]!==o||t[112]!==c||t[113]!==l||t[114]!==F?(Oe=P?(0,Z.jsx)(bx,{open:F,onOpenChange:I,children:(0,Z.jsxs)(Cx,{side:`right`,className:`flex w-80 sm:w-96 flex-col gap-0 p-0`,children:[(0,Z.jsx)(wx,{className:`sr-only`,children:(0,Z.jsx)(Tx,{children:(0,Z.jsx)(s,{id:`5Q9-G-`})})}),(0,Z.jsx)(C_,{docName:d,isSourceMode:ae,activeTab:a,onActiveTabChange:o,mode:h,onSaveVersion:c,saving:l})]})}):null,t[106]=d,t[107]=a,t[108]=h,t[109]=P,t[110]=ae,t[111]=o,t[112]=c,t[113]=l,t[114]=F,t[115]=Oe):Oe=t[115];let ke;return t[116]!==De||t[117]!==Oe?(ke=(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[De,Oe]}),t[116]=De,t[117]=Oe,t[118]=ke):ke=t[118],ke}function WE(e){return!e}var GE=1280;function KE(){let e=(0,$.c)(2),[t,n]=(0,Q.useState)(qE),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=window.matchMedia(`(max-width: ${GE-1}px)`),t=()=>{n(window.innerWidth<GE)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Q.useEffect)(r,i),t}function qE(){return window.innerWidth<GE}function JE(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function YE(e){let{value:t,unit:n}=JE(e);return n===`rem`?t*16:t}function XE(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var ZE=3600*24*7;function QE(e){let t=(0,$.c)(28),{direction:n,currentWidth:r,onResize:i,onToggle:a,isCollapsed:o,minResizeWidth:s,maxResizeWidth:c,enableToggle:l,enableAutoCollapse:u,autoCollapseThreshold:d,expandThreshold:f,enableDrag:p,setIsDraggingRail:m,widthCookieName:h,widthCookieMaxAge:g,isNested:_}=e,v=n===void 0?`right`:n,y=o===void 0?!1:o,b=s===void 0?`14rem`:s,x=c===void 0?`24rem`:c,S=l===void 0?!0:l,C=u===void 0?!0:u,w=d===void 0?1.5:d,T=f===void 0?.2:f,E=p===void 0?!0:p,D=m===void 0?$E:m,O=g===void 0?ZE:g,k=_===void 0?!1:_,A=(0,Q.useRef)(null),j=(0,Q.useRef)(0),M=(0,Q.useRef)(0),N=(0,Q.useRef)(!1),P=(0,Q.useRef)(!1),F=(0,Q.useRef)(null),I=(0,Q.useRef)(0),L=(0,Q.useRef)(!1),R=(0,Q.useRef)(0),z=(0,Q.useRef)(0),B=(0,Q.useRef)(null),V=(0,Q.useRef)(r),H=(0,Q.useRef)(y),U,W;t[0]===r?(U=t[1],W=t[2]):(U=()=>{V.current=r},W=[r],t[0]=r,t[1]=U,t[2]=W),(0,Q.useEffect)(U,W);let G,K;t[3]===y?(G=t[4],K=t[5]):(G=()=>{H.current=y},K=[y],t[3]=y,t[4]=G,t[5]=K),(0,Q.useEffect)(G,K);let q=YE(b),ee;t[6]===x?ee=t[7]:(ee=YE(x),t[6]=x,t[7]=ee);let te=ee,ne;t[8]!==E||t[9]!==k?(ne=function(e){P.current=!0,E&&(j.current=H.current?0:YE(V.current),M.current=e.clientX,I.current=e.clientX,F.current=null,L.current=!1,R.current=0,z.current=0,B.current=k&&A.current?A.current.getBoundingClientRect():null,e.preventDefault())},t[8]=E,t[9]=k,t[10]=ne):ne=t[10];let re=ne,ie,ae;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==te||t[18]!==q||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(ie=()=>{let e=function(e){h&&(document.cookie=`${h}=${e}; path=/; max-age=${O}`)},t=function(e,t){return v===`left`?e<t:e>t},n=function(e,t,n,r){if(k&&r){let r=e.clientX-t;return v===`left`?n-r:n+r}return v===`left`?window.innerWidth-e.clientX:e.clientX},r=function(r){if(!P.current)return;let o=Math.abs(r.clientX-M.current);if(!N.current&&o>5&&(N.current=!0,D(!0)),N.current){let{unit:o}=JE(V.current),s=B.current;k&&A.current&&(s=A.current.getBoundingClientRect());let c=t(r.clientX,I.current)?`expand`:`collapse`;F.current!==c&&(F.current=c),z.current=Math.abs(r.clientX-I.current);let l=Date.now();if(L.current&&l-R.current>200&&(L.current=!1),!L.current){if(C&&a&&!H.current){let e=n(r,M.current,j.current,s),t=!1;if(w<=1)t=e<=q*w;else if(e<=q){let n=q*(w-1);t=q-e>=n}if(c===`collapse`&&t){a(),I.current=r.clientX,L.current=!0,R.current=l;return}}if(a&&H.current&&c===`expand`&&z.current>q*T){a();let t=n(r,M.current,j.current,s),c=Math.max(q,Math.min(te,t)),u=XE(o===`rem`?c/16:c,o);i(u),e(u),I.current=r.clientX,L.current=!0,R.current=l;return}}if(H.current)return;let u=n(r,M.current,j.current,s),d=Math.max(q,Math.min(te,u)),f=XE(o===`rem`?d/16:d,o);i(f),e(f)}},o=function(){P.current&&(!N.current&&a&&S&&a(),N.current=!1,P.current=!1,F.current=null,I.current=0,L.current=!1,R.current=0,z.current=0,B.current=null,D(!1))};return document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,o),()=>{document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,o)}},ae=[i,a,D,q,te,k,C,w,T,S,h,O,v],t[11]=w,t[12]=v,t[13]=C,t[14]=S,t[15]=T,t[16]=k,t[17]=te,t[18]=q,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=ie,t[25]=ae):(ie=t[24],ae=t[25]),(0,Q.useEffect)(ie,ae);let oe;return t[26]===re?oe=t[27]:(oe={dragRef:A,isDragging:N,handleMouseDown:re},t[26]=re,t[27]=oe),oe}function $E(){}var eD=`sidebar_state`,tD=3600*24*7,nD=`18rem`,rD=`3rem`,iD=`app-file-sidebar`,aD=`14.625rem`,oD=`22rem`,sD=`sidebar_width`,cD=/^\d+(?:\.\d+)?(?:rem|px)$/,lD=Q.createContext(null);function uD(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${sD}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return cD.test(n)?n:e}function dD(){let e=Q.use(lD);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function fD(e){let t=(0,$.c)(53),n,r,i,a,o,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8]):({defaultOpen:c,open:i,onOpenChange:o,className:r,style:s,children:n,defaultWidth:l,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l);let u=c===void 0?!0:c,d=l===void 0?nD:l,f=KE(),p;t[9]===d?p=t[10]:(p=()=>uD(d),t[9]=d,t[10]=p);let[m,h]=Q.useState(p),[g,_]=Q.useState(!1),v=Q.useRef(g),[y,b]=Q.useState(!1),[x,S]=Q.useState(!1),[C,w]=Q.useState(u),T=i??C,E;t[11]!==T||t[12]!==o?(E=e=>{let t=typeof e==`function`?e(T):e;o?o(t):w(t),document.cookie=`${eD}=${t}; path=/; max-age=${tD}`},t[11]=T,t[12]=o,t[13]=E):E=t[13];let D=E,O;t[14]===D?O=t[15]:(O=function(){return window.innerWidth<1280?_(mD):D(pD)},t[14]=D,t[15]=O);let k=O,A;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(){window.innerWidth>=1280||v.current&&(window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||S(!0))},t[16]=A):A=t[16];let j=A,M;t[17]===g?M=t[18]:(M=()=>{v.current=g},t[17]=g,t[18]=M),Q.useLayoutEffect(M);let N,P;t[19]!==f||t[20]!==g?(N=()=>{if(!f||!g)return;let e=e=>{e.key===`Escape`&&(document.querySelector(`[data-state="open"][role="dialog"], [data-state="open"][role="alertdialog"], [data-state="open"][role="menu"], [data-state="open"][role="listbox"], [data-radix-popper-content-wrapper] [data-state="open"]`)||_(!1))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},P=[f,g],t[19]=f,t[20]=g,t[21]=N,t[22]=P):(N=t[21],P=t[22]),Q.useEffect(N,P);let F,I;t[23]===k?(F=t[24],I=t[25]):(F=()=>{if(typeof window<`u`&&window.okDesktop!=null)return;let e=e=>{e.altKey&&(e.metaKey||e.ctrlKey)&&e.code===`KeyS`&&(e.preventDefault(),k())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},I=[k],t[23]=k,t[24]=F,t[25]=I),Q.useEffect(F,I);let L=Q.useRef(f),R,z;t[26]!==f||t[27]!==T?(R=()=>{!L.current&&f&&_(T),L.current=f},z=[f,T],t[26]=f,t[27]=T,t[28]=R,t[29]=z):(R=t[28],z=t[29]),Q.useEffect(R,z);let B=f?g?`expanded`:`collapsed`:T?`expanded`:`collapsed`,V;t[30]!==y||t[31]!==f||t[32]!==T||t[33]!==g||t[34]!==D||t[35]!==x||t[36]!==B||t[37]!==k||t[38]!==m?(V={state:B,open:T,setOpen:D,isMobile:f,openMobile:g,setOpenMobile:_,toggleSidebar:k,width:m,setWidth:h,isDraggingRail:y,setIsDraggingRail:b,showPushPulse:x,setShowPushPulse:S,notifySidebarFileSelected:j},t[30]=y,t[31]=f,t[32]=T,t[33]=g,t[34]=D,t[35]=x,t[36]=B,t[37]=k,t[38]=m,t[39]=V):V=t[39];let H;t[40]!==s||t[41]!==m?(H={"--sidebar-width":m,"--sidebar-width-icon":rD,...s},t[40]=s,t[41]=m,t[42]=H):H=t[42];let U=H,W;t[43]===r?W=t[44]:(W=Ei(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),t[43]=r,t[44]=W);let G;t[45]!==n||t[46]!==a||t[47]!==U||t[48]!==W?(G=(0,Z.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:U,className:W,...a,children:n}),t[45]=n,t[46]=a,t[47]=U,t[48]=W,t[49]=G):G=t[49];let K;return t[50]!==V||t[51]!==G?(K=(0,Z.jsx)(lD.Provider,{value:V,children:G}),t[50]=V,t[51]=G,t[52]=K):K=t[52],K}function pD(e){return!e}function mD(e){return!e}function hD(e){let t=(0,$.c)(57),n,r,a,o,s,c;t[0]===e?(n=t[1],r=t[2],a=t[3],o=t[4],s=t[5],c=t[6]):({side:o,variant:s,collapsible:c,className:r,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=o,t[5]=s,t[6]=c);let l=o===void 0?`left`:o,u=s===void 0?`sidebar`:s,d=c===void 0?`offcanvas`:c,{_:f}=i(),{isMobile:p,state:m,openMobile:h,isDraggingRail:g}=dD();if(d===`none`){let e;t[7]===r?e=t[8]:(e=Ei(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),t[7]=r,t[8]=e);let i;return t[9]!==n||t[10]!==a||t[11]!==e||t[12]!==u?(i=(0,Z.jsx)(`div`,{"data-slot":`sidebar`,"data-variant":u,className:e,...a,children:n}),t[9]=n,t[10]=a,t[11]=e,t[12]=u,t[13]=i):i=t[13],i}if(p){let e=h?`expanded`:`collapsed`,i;t[14]===f?i=t[15]:(i=f({id:`07q4Qk`}),t[14]=f,t[15]=i);let o=u===`floating`||u===`inset`?`p-2`:``,s;t[16]!==r||t[17]!==o?(s=Ei(`fixed inset-y-0 z-30 flex h-svh w-(--sidebar-width)`,`transition-transform duration-200 ease-linear motion-reduce:transition-none`,`data-[side=left]:left-0 data-[side=right]:right-0`,`group-data-[state=collapsed]:data-[side=left]:-translate-x-full`,`group-data-[state=collapsed]:data-[side=right]:translate-x-full`,o,r),t[16]=r,t[17]=o,t[18]=s):s=t[18];let c;t[19]===n?c=t[20]:(c=(0,Z.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,children:n}),t[19]=n,t[20]=c);let d;t[21]!==a||t[22]!==l||t[23]!==i||t[24]!==s||t[25]!==c?(d=(0,Z.jsx)(`nav`,{id:iD,"aria-label":i,"data-slot":`sidebar-container`,"data-side":l,className:s,...a,children:c}),t[21]=a,t[22]=l,t[23]=i,t[24]=s,t[25]=c,t[26]=d):d=t[26];let p;return t[27]!==e||t[28]!==l||t[29]!==d||t[30]!==u?(p=(0,Z.jsx)(`div`,{className:`group peer text-sidebar-foreground`,"data-state":e,"data-variant":u,"data-side":l,"data-slot":`sidebar`,"data-mobile":`true`,children:d}),t[27]=e,t[28]=l,t[29]=d,t[30]=u,t[31]=p):p=t[31],p}let _=m===`collapsed`?d:``,v=u===`floating`||u===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`,y;t[32]===v?y=t[33]:(y=Ei(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,v,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`),t[32]=v,t[33]=y);let b;t[34]===y?b=t[35]:(b=(0,Z.jsx)(`div`,{"data-slot":`sidebar-gap`,className:y}),t[34]=y,t[35]=b);let x;t[36]===f?x=t[37]:(x=f({id:`07q4Qk`}),t[36]=f,t[37]=x);let S=u===`floating`||u===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,C;t[38]!==r||t[39]!==S?(C=Ei(`fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex`,S,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`,r),t[38]=r,t[39]=S,t[40]=C):C=t[40];let w;t[41]===n?w=t[42]:(w=(0,Z.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,children:n}),t[41]=n,t[42]=w);let T;t[43]!==a||t[44]!==l||t[45]!==C||t[46]!==w||t[47]!==x?(T=(0,Z.jsx)(`nav`,{id:iD,"aria-label":x,"data-slot":`sidebar-container`,"data-side":l,className:C,...a,children:w}),t[43]=a,t[44]=l,t[45]=C,t[46]=w,t[47]=x,t[48]=T):T=t[48];let E;return t[49]!==g||t[50]!==l||t[51]!==m||t[52]!==T||t[53]!==_||t[54]!==b||t[55]!==u?(E=(0,Z.jsxs)(`div`,{className:`group peer hidden text-sidebar-foreground md:block`,"data-state":m,"data-collapsible":_,"data-variant":u,"data-side":l,"data-slot":`sidebar`,"data-dragging":g,children:[b,T]}),t[49]=g,t[50]=l,t[51]=m,t[52]=T,t[53]=_,t[54]=b,t[55]=u,t[56]=E):E=t[56],E}function gD(e){let t=(0,$.c)(21),n,r,a;t[0]===e?(n=t[1],r=t[2],a=t[3]):({className:n,onClick:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a);let{_:o}=i(),{toggleSidebar:s,state:c}=dD(),l=c===`expanded`,u;t[4]!==o||t[5]!==c?(u=o(c===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[4]=o,t[5]=c,t[6]=u):u=t[6];let d;t[7]===n?d=t[8]:(d=Ei(n),t[7]=n,t[8]=d);let f;t[9]!==r||t[10]!==s?(f=e=>{r?.(e),s()},t[9]=r,t[10]=s,t[11]=f):f=t[11];let p;t[12]===c?p=t[13]:(p=c===`expanded`?(0,Z.jsx)(le,{}):(0,Z.jsx)(Hc,{}),t[12]=c,t[13]=p);let m;return t[14]!==a||t[15]!==l||t[16]!==u||t[17]!==d||t[18]!==f||t[19]!==p?(m=(0,Z.jsx)(Ni,{"data-sidebar":`trigger`,"data-slot":`sidebar-trigger`,variant:`ghost`,size:`icon-sm`,"aria-expanded":l,"aria-controls":iD,"aria-label":u,className:d,onClick:f,...a,children:p}),t[14]=a,t[15]=l,t[16]=u,t[17]=d,t[18]=f,t[19]=p,t[20]=m):m=t[20],m}function _D(e){let t=(0,$.c)(32),n,r,a,o,s;t[0]===e?(n=t[1],r=t[2],a=t[3],o=t[4],s=t[5]):({className:n,enableDrag:o,enableToggle:s,onMouseDown:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=o,t[5]=s);let c=o===void 0?!0:o,l=s===void 0?!0:s,{_:u}=i(),{toggleSidebar:d,setWidth:f,state:p,width:m,setIsDraggingRail:h}=dD(),g=p===`collapsed`,_;t[6]!==c||t[7]!==l||t[8]!==h||t[9]!==f||t[10]!==g||t[11]!==d||t[12]!==m?(_={direction:`right`,enableDrag:c,enableToggle:l,onResize:f,onToggle:d,currentWidth:m,isCollapsed:g,minResizeWidth:aD,maxResizeWidth:oD,setIsDraggingRail:h,widthCookieName:sD,widthCookieMaxAge:tD},t[6]=c,t[7]=l,t[8]=h,t[9]=f,t[10]=g,t[11]=d,t[12]=m,t[13]=_):_=t[13];let{dragRef:v,handleMouseDown:y}=QE(_),b;t[14]!==u||t[15]!==p?(b=u(p===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[14]=u,t[15]=p,t[16]=b):b=t[16];let x;t[17]!==y||t[18]!==r?(x=e=>{r?.(e),e.defaultPrevented||y(e)},t[17]=y,t[18]=r,t[19]=x):x=t[19];let S;t[20]!==u||t[21]!==p?(S=u(p===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[20]=u,t[21]=p,t[22]=S):S=t[22];let C;t[23]===n?C=t[24]:(C=Ei(`absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2`,`in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize`,`[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize`,`group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar`,`[[data-side=left][data-collapsible=offcanvas]_&]:-right-2`,`[[data-side=right][data-collapsible=offcanvas]_&]:-left-2`,`md:group-data-[variant=inset]:after:inset-y-5`,n),t[23]=n,t[24]=C);let w;return t[25]!==v||t[26]!==a||t[27]!==b||t[28]!==x||t[29]!==S||t[30]!==C?(w=(0,Z.jsx)(`button`,{ref:v,"data-sidebar":`rail`,"data-slot":`sidebar-rail`,"aria-label":b,tabIndex:-1,onMouseDown:x,title:S,className:C,...a}),t[25]=v,t[26]=a,t[27]=b,t[28]=x,t[29]=S,t[30]=C,t[31]=w):w=t[31],w}function vD(e){let t=(0,$.c)(21),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,onClick:i,onAnimationEnd:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let{isMobile:o,openMobile:s,setOpenMobile:c,showPushPulse:l,setShowPushPulse:u}=dD(),d;t[5]!==o||t[6]!==i||t[7]!==s||t[8]!==c?(d=e=>{i?.(e),!e.defaultPrevented&&(!o||!s||e.target?.closest(`[data-sidebar="trigger"]`)||c(!1))},t[5]=o,t[6]=i,t[7]=s,t[8]=c,t[9]=d):d=t[9];let f=d,p;t[10]!==r||t[11]!==u?(p=e=>{r?.(e),e.animationName===`sidebar-push-pulse`&&u(!1)},t[10]=r,t[11]=u,t[12]=p):p=t[12];let m=p,h=l?``:void 0,g;t[13]===n?g=t[14]:(g=Ei(`relative flex w-full flex-1 flex-col bg-background peer-data-[variant=inset]:m-2 peer-data-[variant=inset]:ml-0 peer-data-[variant=inset]:rounded-xl peer-data-[variant=inset]:shadow-sm peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2`,`transition-transform duration-200 ease-linear motion-reduce:transition-none`,`peer-data-[mobile=true]:peer-data-[state=expanded]:translate-x-(--sidebar-width)`,n),t[13]=n,t[14]=g);let _;return t[15]!==m||t[16]!==f||t[17]!==a||t[18]!==h||t[19]!==g?(_=(0,Z.jsx)(`main`,{"data-slot":`sidebar-inset`,"data-push-pulse":h,onClick:f,onAnimationEnd:m,className:g,...a}),t[15]=m,t[16]=f,t[17]=a,t[18]=h,t[19]=g,t[20]=_):_=t[20],_}function yD(e){let t=(0,$.c)(8),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=Ei(`flex flex-col gap-2 p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-header`,"data-sidebar":`header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function bD(e){let t=(0,$.c)(8),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=Ei(`flex flex-col gap-2 p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-footer`,"data-sidebar":`footer`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function xD(e){let t=(0,$.c)(8),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=Ei(`no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-content`,"data-sidebar":`content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function SD(e){let t=(0,$.c)(8),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=Ei(`flex w-full min-w-0 flex-col gap-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`ul`,{"data-slot":`sidebar-menu`,"data-sidebar":`menu`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function CD(e){let t=(0,$.c)(8),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=Ei(`group/menu-item relative`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`li`,{"data-slot":`sidebar-menu-item`,"data-sidebar":`menu-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var wD=Fi(`peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-hover hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-hover active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-hover data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground data-active:hover:bg-sidebar-accent [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate`,{variants:{variant:{default:`hover:bg-sidebar-hover hover:text-sidebar-accent-foreground`,outline:`bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-hover hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]`},size:{default:`h-8 text-sm`,sm:`h-7 text-xs`,lg:`h-12 text-sm group-data-[collapsible=icon]:p-0!`}},defaultVariants:{variant:`default`,size:`default`}});function TD(e){let t=(0,$.c)(28),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({asChild:i,isActive:a,variant:o,size:s,tooltip:c,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=i===void 0?!1:i,u=a===void 0?!1:a,d=o===void 0?`default`:o,f=s===void 0?`default`:s,p=l?Oi:`button`,{isMobile:m,state:h}=dD(),g;t[8]!==n||t[9]!==f||t[10]!==d?(g=Ei(wD({variant:d,size:f}),n),t[8]=n,t[9]=f,t[10]=d,t[11]=g):g=t[11];let _;t[12]!==p||t[13]!==u||t[14]!==r||t[15]!==f||t[16]!==g?(_=(0,Z.jsx)(p,{"data-slot":`sidebar-menu-button`,"data-sidebar":`menu-button`,"data-size":f,"data-active":u,className:g,...r}),t[12]=p,t[13]=u,t[14]=r,t[15]=f,t[16]=g,t[17]=_):_=t[17];let v=_;if(!c)return v;if(typeof c==`string`){let e;t[18]===c?e=t[19]:(e={children:c},t[18]=c,t[19]=e),c=e}let y;t[20]===v?y=t[21]:(y=(0,Z.jsx)(cr,{asChild:!0,children:v}),t[20]=v,t[21]=y);let b=h!==`collapsed`||m,x;t[22]!==b||t[23]!==c?(x=(0,Z.jsx)(Qn,{side:`right`,align:`center`,hidden:b,...c}),t[22]=b,t[23]=c,t[24]=x):x=t[24];let S;return t[25]!==y||t[26]!==x?(S=(0,Z.jsxs)(Gr,{children:[y,x]}),t[25]=y,t[26]=x,t[27]=S):S=t[27],S}function ED(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r.kind!==i.kind)return!1;if(r.kind===`human`&&i.kind===`human`){if(r.clientId!==i.clientId||r.mode!==i.mode||r.tabCount!==i.tabCount)return!1;let e=r.user,t=i.user;if(e.name!==t.name||e.color!==t.color||e.icon!==t.icon)return!1}else if(r.kind===`agent`&&i.kind===`agent`){if(r.agentId!==i.agentId)return!1;let e=r.presence,t=i.presence;if(e.displayName!==t.displayName||e.icon!==t.icon||e.color!==t.color||e.currentDoc!==t.currentDoc||e.mode!==t.mode)return!1}}return!0}function DD(e){let t=new Map;for(let n of e){let e=n.user.principalId;if(typeof e==`string`&&e.length>0){let r=t.get(e);r?r.push(n):t.set(e,[n])}}let n=new Map;for(let[e,r]of t){let t=r.reduce((e,t)=>Math.min(e,t.clientId),1/0);n.set(e,{repClientId:t,count:r.length})}let r=[];for(let t of e){let e=t.user.principalId;if(typeof e==`string`&&e.length>0){let i=n.get(e);i&&i.repClientId===t.clientId&&r.push({...t,tabCount:i.count})}else r.push({...t,tabCount:1})}return r}var OD=1e3,kD=!1;function AD(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function jD(e,t,n){let r=(0,$.c)(9),i;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={current:[],crossDoc:[]},r[0]=i):i=r[0];let[a,o]=(0,Q.useState)(i),s;r[1]!==n||r[2]!==e?.awareness||r[3]!==t?.awareness?(s=()=>{let r=e?.awareness,i=t?.awareness,a;i==null?a=void 0:Ji(i)?a=i:(a=void 0,kD||(kD=!0,console.warn(`[agent-presence] __system__ provider awareness missing getStates() — presence bar will render without agent peers`)));let s=()=>{let e=(r?.getLocalState())?.user?.principalId??null,t=r?.clientID??null,i=[];if(r)for(let[n,a]of r.getStates().entries()){let r=a;if(!r.user||typeof r.user!=`object`)continue;let o=r.user;o.type===`human`&&(AD({entryPrincipalId:o.principalId,entryClientId:n,localPrincipalId:e,localClientId:t})||i.push({kind:`human`,clientId:n,user:o,mode:r.mode??`wysiwyg`,tabCount:1}))}let s=DD(i),{current:c,crossDoc:l}=a?Ui(a,n,Date.now()):{current:[],crossDoc:[]},u=MD,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>ED(e.current,p)&&ED(e.crossDoc,m)?e:{current:p,crossDoc:m})};s();let c=()=>s(),l=()=>s();r?.on(`change`,c),t?.awareness?.on(`change`,l);let u=setInterval(s,OD);return()=>{r?.off(`change`,c),t?.awareness?.off(`change`,l),clearInterval(u)}},r[1]=n,r[2]=e?.awareness,r[3]=t?.awareness,r[4]=s):s=r[4];let c;return r[5]!==n||r[6]!==e||r[7]!==t?(c=[e,t,n],r[5]=n,r[6]=e,r[7]=t,r[8]=c):c=r[8],(0,Q.useEffect)(s,c),a}function MD(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var ND=`sync-status`;function PD(e,t){let n=(0,$.c)(5),{_:r}=i(),a=(0,Q.useRef)(!1),o=(0,Q.useRef)(!1),s=(0,Q.useRef)(t),c,l;n[0]!==r||n[1]!==t||n[2]!==e?(c=()=>{s.current!==t&&(s.current=t,a.current=!1,o.current=!1),t&&(e===`synced`&&(a.current=!0),e===`disconnected`&&a.current?(o.current=!0,$o.warning(r({id:`HGNCsl`}),{id:ND,duration:1/0})):o.current&&e===`synced`&&(o.current=!1,$o.success(r({id:`GhjUB_`}),{id:ND,duration:3e3})))},l=[e,t,r],n[0]=r,n[1]=t,n[2]=e,n[3]=c,n[4]=l):(c=n[3],l=n[4]),(0,Q.useEffect)(c,l)}var FD=4,ID=3,LD={Bird:tc,Cat:sc,Dog:vc,Fish:Cc,Mouse:Yc,Rabbit:Jc,Shrimp:rl,Snail:il,Squirrel:sl,Turtle:fl};Object.freeze(Object.keys(LD));function RD(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(LD,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var zD={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function BD(e){let t=(0,$.c)(28),{user:n,mode:r,tabCount:a}=e,{_:o}=i(),s=RD(n),c=s.kind===`animal`?LD[s.animal]:void 0,l;t[0]===n.name?l=t[1]:(l=qr(n.name),t[0]=n.name,t[1]=l);let u=l,d;t[2]===n.color?d=t[3]:(d=Gn(n.color),t[2]=n.color,t[3]=d);let f=d,p=n.name,m;t[4]!==o||t[5]!==a||t[6]!==p?(m=a>1?o({id:`qAhFeg`,values:{userName:p,tabCount:a}}):p,t[4]=o,t[5]=a,t[6]=p,t[7]=m):m=t[7];let h=m,g;t[8]!==o||t[9]!==a||t[10]!==p?(g=a>1?o({id:`BEkF-P`,values:{userName:p,tabCount:a}}):p,t[8]=o,t[9]=a,t[10]=p,t[11]=g):g=t[11];let _=g,v;t[12]===n.color?v=t[13]:(v={backgroundColor:n.color},t[12]=n.color,t[13]=v);let y;t[14]!==c||t[15]!==f||t[16]!==u?(y=c?(0,Z.jsx)(c,{size:18,color:f,strokeWidth:1.5}):(0,Z.jsx)(`span`,{className:`font-mono text-2xs font-semibold leading-none`,style:{color:f},children:u}),t[14]=c,t[15]=f,t[16]=u,t[17]=y):y=t[17];let b;t[18]!==_||t[19]!==r||t[20]!==v||t[21]!==y?(b=(0,Z.jsx)(cr,{asChild:!0,children:(0,Z.jsx)(`div`,{"data-presence-badge":`human`,"data-presence-mode":r,role:`img`,"aria-label":_,className:`inline-flex size-7 shrink-0 cursor-default items-center justify-center rounded-full ring-2 ring-background`,style:v,children:y})}),t[18]=_,t[19]=r,t[20]=v,t[21]=y,t[22]=b):b=t[22];let x;t[23]===h?x=t[24]:(x=(0,Z.jsx)(Qn,{children:h}),t[23]=h,t[24]=x);let S;return t[25]!==b||t[26]!==x?(S=(0,Z.jsxs)(Gr,{children:[b,x]}),t[25]=b,t[26]=x,t[27]=S):S=t[27],S}function VD(e){let t=zD[e.icon];return e.displayName||t||X._({id:`iEQQyu`})}function HD(e){let t=(0,$.c)(3),[n,r]=(0,Q.useState)(e===`writing`),i=(0,Q.useRef)(null),a,o;return t[0]===e?(a=t[1],o=t[2]):(a=()=>{if(e===`writing`){i.current!==null&&(clearTimeout(i.current),i.current=null),r(!0);return}return i.current!==null&&clearTimeout(i.current),i.current=setTimeout(()=>{i.current=null,r(!1)},600),()=>{i.current!==null&&(clearTimeout(i.current),i.current=null)}},o=[e],t[0]=e,t[1]=a,t[2]=o),(0,Q.useEffect)(a,o),n}function UD(e){let t=(0,$.c)(34),{participant:n,crossDoc:r,scoped:a,onClickAgent:o}=e,{_:c}=i(),{presence:l,agentId:u}=n,d=VD(l),f=HD(l.mode),p=!r&&f,m=a?`ring-primary ring-offset-2 ring-offset-background`:`ring-background`,h=p&&!a?`ring-primary/40 animate-pulse`:``,g;t[0]!==m||t[1]!==h?(g=[`inline-flex size-7 shrink-0 items-center justify-center rounded-full ring-2 cursor-pointer`,m,h].filter(Boolean),t[0]=m,t[1]=h,t[2]=g):g=t[2];let _=g.join(` `),v=r?`true`:void 0,y=a?`true`:void 0,b;t[3]!==l.mode||t[4]!==v||t[5]!==y?(b={"data-presence-badge":`agent`,"data-presence-mode":l.mode,"data-presence-crossdoc":v,"data-presence-scoped":y},t[3]=l.mode,t[4]=v,t[5]=y,t[6]=b):b=t[6];let x=b,S=l.currentDoc&&l.currentDoc!==`(connected)`?l.currentDoc:null,C=c(r&&S?{id:`b4AQFK`,values:{tooltipName:d,realCurrentDoc:S}}:{id:`RfHNf8`,values:{tooltipName:d}}),w;t[7]===l.color?w=t[8]:(w={backgroundColor:l.color},t[7]=l.color,t[8]=w);let T;t[9]!==u||t[10]!==o?(T=()=>o(u),t[9]=u,t[10]=o,t[11]=T):T=t[11];let E;t[12]===l.icon?E=t[13]:(E=(0,Z.jsx)(Ki,{icon:l.icon,width:16,height:16,className:`text-white`}),t[12]=l.icon,t[13]=E);let D;t[14]!==C||t[15]!==x||t[16]!==_||t[17]!==w||t[18]!==T||t[19]!==E?(D=(0,Z.jsx)(`button`,{type:`button`,...x,"aria-label":C,className:_,style:w,onClick:T,children:E}),t[14]=C,t[15]=x,t[16]=_,t[17]=w,t[18]=T,t[19]=E,t[20]=D):D=t[20];let O=D,k;t[21]===O?k=t[22]:(k=(0,Z.jsx)(cr,{asChild:!0,children:O}),t[21]=O,t[22]=k);let A;t[23]===d?A=t[24]:(A=(0,Z.jsx)(`span`,{className:`font-medium`,children:d}),t[23]=d,t[24]=A);let j;t[25]!==r||t[26]!==S?(j=r&&S?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(s,{id:`Wh0im4`,values:{realCurrentDoc:S}})}):null,t[25]=r,t[26]=S,t[27]=j):j=t[27];let M;t[28]!==A||t[29]!==j?(M=(0,Z.jsxs)(Qn,{className:`flex flex-col gap-0.5`,children:[A,j]}),t[28]=A,t[29]=j,t[30]=M):M=t[30];let N;return t[31]!==k||t[32]!==M?(N=(0,Z.jsxs)(Gr,{children:[k,M]}),t[31]=k,t[32]=M,t[33]=N):N=t[33],N}function WD(e){let t=(0,$.c)(21),{count:n,remainder:r,crossDoc:i,scopedAgentId:a,onClickAgent:o}=e,s;t[0]!==n||t[1]!==i?(s=i?X._({id:`9euN0m`,values:{count:n}}):X._({id:`uhJEA2`,values:{count:n}}),t[0]=n,t[1]=i,t[2]=s):s=t[2];let c=s,l=i?`true`:void 0,u;t[3]!==n||t[4]!==c||t[5]!==l?(u=(0,Z.jsx)(w,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`presence-overflow`,"data-presence-crossdoc":l,className:`inline-flex size-7 shrink-0 cursor-pointer items-center justify-center rounded-full bg-muted font-medium text-muted-foreground text-xs ring-2 ring-background hover:bg-muted/80`,"aria-label":c,children:[`+`,n]})}),t[3]=n,t[4]=c,t[5]=l,t[6]=u):u=t[6];let d;if(t[7]!==i||t[8]!==o||t[9]!==r||t[10]!==a){let e;t[12]!==i||t[13]!==o||t[14]!==a?(e=e=>e.kind===`human`?(0,Z.jsx)(BD,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(UD,{participant:e,crossDoc:i,scoped:a===e.agentId,onClickAgent:o},e.agentId),t[12]=i,t[13]=o,t[14]=a,t[15]=e):e=t[15],d=r.map(e),t[7]=i,t[8]=o,t[9]=r,t[10]=a,t[11]=d}else d=t[11];let f;t[16]===d?f=t[17]:(f=(0,Z.jsx)(pe,{align:`end`,className:`w-auto max-w-xs p-2`,children:(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:d})}),t[16]=d,t[17]=f);let p;return t[18]!==u||t[19]!==f?(p=(0,Z.jsxs)(v,{children:[u,f]}),t[18]=u,t[19]=f,t[20]=p):p=t[20],p}function GD(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(BD,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(UD,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function KD(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=ft(),{current:s,crossDoc:c}=jD(t,r,n);if(PD(hS(t),n),s.length===0&&c.length===0)return null;let l;if(e[0]!==c||e[1]!==s||e[2]!==o||e[3]!==a||e[4]!==i){let t=s.slice(0,FD),n;e[6]===s?n=e[7]:(n=s.slice(FD),e[6]=s,e[7]=n);let r=n,u=c.slice(0,ID),d;e[8]===c?d=e[9]:(d=c.slice(ID),e[8]=c,e[9]=d);let f=d,p=i,m=a===`agent`?o:null,h;e[10]!==p||e[11]!==m?(h=e=>GD(e,p,!1,m),e[10]=p,e[11]=m,e[12]=h):h=e[12];let g=t.map(h),_;e[13]!==r||e[14]!==p||e[15]!==m?(_=r.length>0?(0,Z.jsx)(WD,{count:r.length,remainder:r,crossDoc:!1,scopedAgentId:m,onClickAgent:p}):null,e[13]=r,e[14]=p,e[15]=m,e[16]=_):_=e[16];let v;e[17]!==g||e[18]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,"data-presence-section":`current`,children:[g,_]}),e[17]=g,e[18]=_,e[19]=v):v=e[19],l=(0,Z.jsxs)(`div`,{"data-slot":`presence-bar`,className:`flex items-center px-1 py-1.5`,children:[v,c.length>0?(0,Z.jsxs)(`div`,{className:`ml-1.5 flex items-center gap-1.5`,"data-presence-section":`crossdoc`,children:[u.map(e=>GD(e,p,!0,m)),f.length>0?(0,Z.jsx)(WD,{count:f.length,remainder:f,crossDoc:!0,scopedAgentId:m,onClickAgent:p}):null]}):null]}),e[0]=c,e[1]=s,e[2]=o,e[3]=a,e[4]=i,e[5]=l}else l=e[5];return l}var qD=`.md`,JD=/\.(md|mdx)$/i;function YD(e,t=qD){return`${e}${t}`}function XD(e){return hO(e).replace(JD,``)}function ZD(e){return Yr(e)?eO(e.path):Nn(e)?e.path:YD(e.docName,e.docExt)}function QD(e){let t=hO(e).match(JD);return t?`.${t[1].toLowerCase()}`:void 0}function $D(e){return hO(e)}function eO(e){let t=hO(e.trim());return t?`${t}/`:``}function tO(e){return e.endsWith(`/`)?$D(e):XD(e)}function nO(e){return e.map(ZD)}function rO(e){return[...e].sort().join(`\0`)}function iO(e){return rO(nO(e))}function aO(e){let t=new Set;for(let n of e){if(Yr(n)){let e=eO(n.path);e&&t.add(e)}let e=(Yr(n)||Nn(n)?n.path:n.docName).split(`/`).filter(Boolean),r=Yr(n)?e.length:e.length-1;for(let n=1;n<=r;n++)t.add(`${e.slice(0,n).join(`/`)}/`)}return[...t].sort()}function oO(e){if(!e)return[];let t=hO(e.replace(JD,``)).split(`/`).filter(Boolean),n=[],r=e.endsWith(`/`)?t.length:t.length-1;for(let e=1;e<=r;e++)n.push(`${t.slice(0,e).join(`/`)}/`);return n}function sO(e,t,n){let r=QD(e);if(r)return r;let i=n.find(e=>ir(e)&&e.docName===t);return i?i.docExt??qD:mO(e).includes(`.`)?void 0:qD}function cO(e,t){let n=e.kind===`directory`,r=n?$D(e.path):XD(e.path),i=n?void 0:sO(e.path,r,t);return{kind:n?`folder`:`file`,name:hO(mO(e.path)).replace(JD,``),path:r,treePath:uO(e.path,n),docExt:i}}function lO(e){return e.kind===`directory`?$D(e.path):e.path}function uO(e,t){return t?eO(e):JD.test(e)?e:`${e}${qD}`}function dO(e,t,n){let r=eO(t),i=new Set(n);for(let t=0;t<100;t++){let n=t===0?``:` ${t+1}`;if(e===`file`){let e=`${r}Untitled${n}${qD}`;if(!i.has(e))return{addPath:e,renamePath:e};continue}let a=`${r}New Folder${n}/`;if(!i.has(a))return{addPath:a,renamePath:a}}throw Error(`Could not allocate a unique tree placeholder`)}function fO(e,t){return e===`file`?uO(t,!1):`${$D(t)}/index${qD}`}function pO(e,t){return t.kind===`root`||t.directoryPath==null?mO(e):`${t.directoryPath}${mO(e)}`}function mO(e){let t=hO(e),n=t.lastIndexOf(`/`),r=n===-1?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function hO(e){return e.endsWith(`/`)?e.slice(0,-1):e}function gO(e,t){return t.trim()}function _O(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function vO(e,t){let n=gO(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function yO(e,t,n=[]){if(t.length===0&&n.length===0)return e;let r=new Map(t.map(e=>[e.fromDocName,e.toDocName]));return e.map(e=>ir(e)?{...e,docName:r.get(e.docName)??e.docName}:Yr(e)||Nn(e)?{...e,path:TO(e.path,n)}:e)}function bO(e,t,n){if(t.length===0&&!n)return e;let r=new Set(t);return e.filter(e=>ir(e)?!r.has(e.docName)&&!kO(e.docName,n):Yr(e)||Nn(e)?!kO(e.path,n):!0)}function xO(e,t,n,r=new Date().toISOString()){let i=!1,a=[...e],o=e=>{a.some(t=>EO(t,e))||(a.push(e),i=!0)};if(n.kind===`file`){let s=e.find(e=>ir(e)&&e.docName===t.path);return o({kind:`document`,docName:n.path,docExt:s?.docExt??t.docExt,size:s?.size??0,modified:r}),i?a:e}let s=e.find(e=>Yr(e)&&e.path===t.path);o({kind:`folder`,path:n.path,size:s?.size??0,modified:r});let c=new Set(n.duplicatedDocNames);for(let i of e){if(ir(i)){let e=OO(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(Yr(i)){let e=DO(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function SO(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function CO(e,t){return e.flatMap(e=>t===e.toDocName?[e.fromDocName]:[e.fromDocName,e.toDocName])}function wO(e,t){let n=e.kind===`folder`||e.docExt===void 0?e.path:YD(e.path,e.docExt);return Zm(t.contentDir,n,t.pathSeparator)}function TO(e,t){for(let{fromPath:n,toPath:r}of t){if(e===n)return r;if(e.startsWith(`${n}/`))return`${r}${e.slice(n.length)}`}return e}function EO(e,t){return ir(e)&&ir(t)?e.docName===t.docName:Yr(e)&&Yr(t)||Nn(e)&&Nn(t)?e.path===t.path:!1}function DO(e,t,n){return e===t?n:OO(e,t,n)}function OO(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function kO(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function AO(e){let t=(0,$.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,Z.jsx)(yu,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}function jO(e){let t=(0,$.c)(8),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=Ei(`select-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(bu,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function MO(e){let t=(0,$.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,Z.jsx)(Du,{"data-slot":`context-menu-sub`,...n}),t[2]=n,t[3]=r),r}function NO(e){let t=(0,$.c)(8),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=Ei(`z-50 max-h-(--radix-context-menu-content-available-height) min-w-36 origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 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[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(xu,{children:(0,Z.jsx)(Su,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function PO(e){let t=(0,$.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,inset:r,variant:a,...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]===n?s=t[6]:(s=Ei(`group/context-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 focus:*:[svg]:text-accent-foreground data-[variant=destructive]:*:[svg]:text-destructive`,n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==i||t[9]!==s||t[10]!==o?(c=(0,Z.jsx)(Cu,{"data-slot":`context-menu-item`,"data-inset":r,"data-variant":o,className:s,...i}),t[7]=r,t[8]=i,t[9]=s,t[10]=o,t[11]=c):c=t[11],c}function FO(e){let t=(0,$.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,inset:i,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=Ei(`flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,r),t[5]=r,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(es,{className:`ml-auto`}),t[7]=s):s=t[7];let c;return t[8]!==n||t[9]!==i||t[10]!==a||t[11]!==o?(c=(0,Z.jsxs)(Ou,{"data-slot":`context-menu-sub-trigger`,"data-inset":i,className:o,...a,children:[n,s]}),t[8]=n,t[9]=i,t[10]=a,t[11]=o,t[12]=c):c=t[12],c}function IO(e){let t=(0,$.c)(8),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=Ei(`z-50 min-w-32 origin-(--radix-context-menu-content-transform-origin) overflow-hidden rounded-lg border bg-popover p-1 text-popover-foreground shadow-lg 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[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(ku,{"data-slot":`context-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function LO(e){let t=(0,$.c)(15),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:i,children:r,checked:n,inset:a,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s;t[6]===i?s=t[7]:(s=Ei(`relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,i),t[6]=i,t[7]=s);let c;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`span`,{className:`pointer-events-none absolute right-2`,children:(0,Z.jsx)(Tu,{children:(0,Z.jsx)(Lo,{})})}),t[8]=c):c=t[8];let l;return t[9]!==n||t[10]!==r||t[11]!==a||t[12]!==o||t[13]!==s?(l=(0,Z.jsxs)(wu,{"data-slot":`context-menu-checkbox-item`,"data-inset":a,className:s,checked:n,...o,children:[c,r]}),t[9]=n,t[10]=r,t[11]=a,t[12]=o,t[13]=s,t[14]=l):l=t[14],l}function RO(e){let t=(0,$.c)(8),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=Ei(`-mx-1 my-1 h-px bg-border`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Eu,{"data-slot":`context-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var zO=[`.md`,`.mdx`],BO=`group relative -mb-px flex h-10 min-w-28 max-w-64 shrink-0 cursor-pointer items-center overflow-hidden border border-transparent font-medium transition-colors`,VO=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,HO=Ei(VO,`bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent hover:border-border focus-visible:border-border`),UO=`flex h-full min-w-0 flex-1 cursor-pointer items-center overflow-hidden px-3 text-left text-[13px] outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,WO=`mr-1.5 flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-sm text-muted-foreground outline-none transition hover:bg-foreground/10 hover:text-foreground hover:opacity-100 focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:opacity-100`;function GO(e){return Ei(WO,e?`opacity-100`:`pointer-events-none opacity-0 group-focus-within:pointer-events-auto group-focus-within:opacity-100 group-hover:pointer-events-auto group-hover:opacity-100`)}function KO(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function qO(e){let t=di(e);window.location.hash!==t&&(window.location.hash=t)}function JO(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}function YO(e,t){let n=[t,...zO].filter((e,t,n)=>e&&n.indexOf(e)===t),r=e.toLowerCase(),i=n.find(t=>e.length>t.length&&r.endsWith(t.toLowerCase()));return i?e.slice(0,-i.length):e}function XO(e){let t=(0,$.c)(26),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({tabId:o,disabled:n,ref:r,style:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s;t[6]!==n||t[7]!==o?(s={id:o,disabled:n},t[6]=n,t[7]=o,t[8]=s):s=t[8];let{attributes:c,listeners:l,setNodeRef:u,transform:d,transition:f,isDragging:p}=wa(s),m;t[9]===d?m=t[10]:(m=ua.Transform.toString(d),t[9]=d,t[10]=m);let h=p?.5:i?.opacity,g=p?1:i?.zIndex,_;t[11]!==i||t[12]!==m||t[13]!==h||t[14]!==g||t[15]!==f?(_={...i,transform:m,transition:f,opacity:h,zIndex:g},t[11]=i,t[12]=m,t[13]=h,t[14]=g,t[15]=f,t[16]=_):_=t[16];let v=_,y;t[17]!==r||t[18]!==u?(y=function(e){u(e),typeof r==`function`?r(e):r&&`current`in r&&(r.current=e)},t[17]=r,t[18]=u,t[19]=y):y=t[19];let b=y,x;return t[20]!==c||t[21]!==b||t[22]!==l||t[23]!==a||t[24]!==v?(x=(0,Z.jsx)(`div`,{ref:b,style:v,...a,...c,...l}),t[20]=c,t[21]=b,t[22]=l,t[23]=a,t[24]=v,t[25]=x):x=t[25],x}function ZO(e){let t=(0,$.c)(52),{children:n,closeTab:r,closeTabs:i,canPin:a,disabled:o,openTabs:c,pinTab:l,pinnedTabIds:u,tabId:d,unpinTab:f}=e,p=a===void 0?!0:a;if(o!==void 0&&o)return n;let m;t[0]!==p||t[1]!==u||t[2]!==d?(m=p&&u.includes(d),t[0]=p,t[1]=u,t[2]=d,t[3]=m):m=t[3];let h=m,g;if(t[4]!==c||t[5]!==u||t[6]!==d){let e;t[8]===d?e=t[9]:(e=e=>e!==d,t[8]=d,t[9]=e),g=xt(c.filter(e),u),t[4]=c,t[5]=u,t[6]=d,t[7]=g}else g=t[7];let _=g,v;t[10]!==c||t[11]!==u?(v=xt(c,u),t[10]=c,t[11]=u,t[12]=v):v=t[12];let y=v,b;t[13]===n?b=t[14]:(b=(0,Z.jsx)(jO,{asChild:!0,children:n}),t[13]=n,t[14]=b);let x;t[15]!==r||t[16]!==d?(x=()=>r(d),t[15]=r,t[16]=d,t[17]=x):x=t[17];let S;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(s,{id:`yz7wBu`}),t[18]=S):S=t[18];let C;t[19]!==h||t[20]!==x?(C=(0,Z.jsx)(PO,{disabled:h,onSelect:x,children:S}),t[19]=h,t[20]=x,t[21]=C):C=t[21];let w=_.length===0,T;t[22]!==i||t[23]!==_?(T=()=>{i(_)},t[22]=i,t[23]=_,t[24]=T):T=t[24];let E;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(s,{id:`omXJcU`}),t[25]=E):E=t[25];let D;t[26]!==w||t[27]!==T?(D=(0,Z.jsx)(PO,{disabled:w,onSelect:T,children:E}),t[26]=w,t[27]=T,t[28]=D):D=t[28];let O=y.length===0,k;t[29]!==y||t[30]!==i?(k=()=>{i(y)},t[29]=y,t[30]=i,t[31]=k):k=t[31];let A;t[32]===u.length?A=t[33]:(A=u.length?(0,Z.jsx)(s,{id:`U2Kx6T`}):(0,Z.jsx)(s,{id:`WyXG7w`}),t[32]=u.length,t[33]=A);let j;t[34]!==O||t[35]!==k||t[36]!==A?(j=(0,Z.jsx)(PO,{disabled:O,"data-testid":`editor-tab-context-close-all`,onSelect:k,children:A}),t[34]=O,t[35]=k,t[36]=A,t[37]=j):j=t[37];let M;t[38]!==p||t[39]!==h||t[40]!==l||t[41]!==d||t[42]!==f?(M=p&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(RO,{}),(0,Z.jsx)(PO,{"data-testid":`editor-tab-context-pin-toggle`,onSelect:()=>h?f(d):l(d),children:h?(0,Z.jsx)(s,{id:`SYfHmN`}):(0,Z.jsx)(s,{id:`3pU8e-`})})]}),t[38]=p,t[39]=h,t[40]=l,t[41]=d,t[42]=f,t[43]=M):M=t[43];let N;t[44]!==D||t[45]!==j||t[46]!==M||t[47]!==C?(N=(0,Z.jsxs)(NO,{className:`min-w-40`,children:[C,D,j,M]}),t[44]=D,t[45]=j,t[46]=M,t[47]=C,t[48]=N):N=t[48];let P;return t[49]!==N||t[50]!==b?(P=(0,Z.jsxs)(AO,{children:[b,N]}),t[49]=N,t[50]=b,t[51]=P):P=t[51],P}function QO(e){let t=(0,$.c)(20),{accessibleLabel:n,closeTab:r,isPinned:a,tabId:o,unpinTab:s}=e,{_:c}=i();if(a){let e;t[0]!==c||t[1]!==n?(e=c({id:`t18QYR`,values:{accessibleLabel:n}}),t[0]=c,t[1]=n,t[2]=e):e=t[2];let r;t[3]!==o||t[4]!==s?(r=e=>{e.stopPropagation(),s(o)},t[3]=o,t[4]=s,t[5]=r):r=t[5];let i;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(qc,{"aria-hidden":`true`}),t[6]=i):i=t[6];let a;return t[7]!==e||t[8]!==r?(a=(0,Z.jsx)(Ni,{variant:`ghost`,size:`icon-xs`,type:`button`,"aria-label":e,"data-testid":`editor-tab-unpin-button`,className:`mr-1.5 text-primary! hover:bg-primary/10!`,onClick:r,children:i}),t[7]=e,t[8]=r,t[9]=a):a=t[9],a}let l;t[10]!==c||t[11]!==n?(l=c({id:`JLzQi_`,values:{accessibleLabel:n}}),t[10]=c,t[11]=n,t[12]=l):l=t[12];let u;t[13]!==r||t[14]!==o?(u=e=>{e.stopPropagation(),r(o)},t[13]=r,t[14]=o,t[15]=u):u=t[15];let d;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Ro,{"aria-hidden":`true`}),t[16]=d):d=t[16];let f;return t[17]!==l||t[18]!==u?(f=(0,Z.jsx)(Ni,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":l,"data-testid":`editor-tab-close-button`,className:`mr-1.5`,onClick:u,children:d}),t[17]=l,t[18]=u,t[19]=f):f=t[19],f}function $O(e){let t=(0,$.c)(1),{docName:n}=e;if(mS(n)!==`conflict`)return null;let r;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(Pn,{"aria-label":`Conflict`,"data-testid":`editor-tab-conflict-badge`,className:`mr-1 size-3.5 shrink-0 text-amber-500`}),t[0]=r):r=t[0],r}function ek(){let e=(0,$.c)(69),{activeDocName:t,activeTabId:n,activeNewTabId:r,activeTarget:a,activateTab:o,activateNewTab:c,closeAndClearForRename:l,closeNewTab:u,closeTab:d,closeTabs:f,getPoolActiveDocName:p,isNewTabActive:m,newTabIds:h,openNewTab:g,openTabs:_,pinTab:v,pinnedTabIds:y,remapTabsForRename:b,reorderTabs:x,unpinTab:S,visibleTabIds:C}=ft(),{_:w}=i(),{pageMeta:T}=gi(),E=(0,Q.useRef)(null),[D,O]=(0,Q.useState)(null),[k,A]=(0,Q.useState)(``),[j,M]=(0,Q.useState)(null),[F,I]=(0,Q.useState)(!1),L=(0,Q.useRef)(null),R=(0,Q.useRef)(!1),z=(0,Q.useRef)(!1),B=(0,Q.useRef)(null),V=(0,Q.useRef)(t),H;e[0]!==n||e[1]!==t||e[2]!==a?(H=n??(a?Ne(a):t?Je(t):null),e[0]=n,e[1]=t,e[2]=a,e[3]=H):H=e[3];let U=H,W;e[4]!==r||e[5]!==U||e[6]!==m||e[7]!==h||e[8]!==_?(W=m?`${r??`__new-tab__`}\u0000${_.join(`\0`)}\u0000${h.join(`\0`)}`:U?`${U}\u0000${_.join(`\0`)}`:``,e[4]=r,e[5]=U,e[6]=m,e[7]=h,e[8]=_,e[9]=W):W=e[9];let G=W,K,q;e[10]===t?(K=e[11],q=e[12]):(K=()=>{V.current=t},q=[t],e[10]=t,e[11]=K,e[12]=q),(0,Q.useEffect)(K,q);let ee,te;e[13]===G?(ee=e[14],te=e[15]):(ee=()=>{G&&(E.current?.querySelector(`[data-active-tab="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},te=[G],e[13]=G,e[14]=ee,e[15]=te),(0,Q.useEffect)(ee,te);let ne,re;e[16]===D?(ne=e[17],re=e[18]):(ne=()=>{D&&(L.current?.focus(),L.current?.select())},re=[D],e[16]=D,e[17]=ne,e[18]=re),(0,Q.useEffect)(ne,re);let ie,ae;e[19]!==_||e[20]!==D?(ie=()=>{!D||_.includes(D.tabId)||(z.current=!0,B.current=null,O(null),A(``),M(null),I(!1))},ae=[_,D],e[19]=_,e[20]=D,e[21]=ie,e[22]=ae):(ie=e[21],ae=e[22]),(0,Q.useEffect)(ie,ae);let oe=function(e,t){let n=t.split(`/`);z.current=!1,B.current=null,O({docName:t,tabId:e}),A(n[n.length-1]),M(null)},se=function(){z.current=!0,B.current=null,O(null),A(``),M(null),I(!1)},ce=async function(){if(z.current){z.current=!1;return}if(R.current)return;let e=D?.docName;if(!e){se();return}let t=gO(`file`,YO(k,T.get(e)?.docExt??`.md`)),n=e.split(`/`),r=n[n.length-1];if(t===r){se();return}if(t===B.current){L.current?.focus();return}if(!_O(t)){M(w({id:`P8yDjG`})),L.current?.focus();return}let i=vO({kind:`file`,path:e,name:r},t);R.current=!0,I(!0),M(null);try{let n=await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:`file`,fromPath:e,toPath:i})});if(z.current){I(!1),R.current=!1;return}let r=await be(n,`Server error (HTTP ${n.status})`);if(!r.ok){M(r.title),I(!1),R.current=!1,B.current=t,L.current?.focus();return}let a=N(dr,r.body,`rename-path:tab`,{renamed:[]}).renamed,o=V.current,s=SO(o,a);Gt(a);let c=!0;try{let e=CO(a,p());await Promise.all(e.map(e=>l(e))),b(a),Si([`files`,`backlinks`,`graph`])}catch(n){let r=n;c=!1,console.warn(`[EditorTabs] post-rename reconciliation failed`,{err:r,docName:e,newDocName:i,normalized:t}),$o.error(w({id:`MUBR8r`}))}z.current=!0,O(null),A(``),M(null),I(!1),R.current=!1,B.current=null,c&&s&&s!==o&&qO(s)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),M(w({id:`HIb0vl`})),I(!1),R.current=!1,B.current=t,L.current?.focus()}},le=typeof window<`u`&&window.okDesktop!=null,ue;e[23]===h?ue=e[24]:(ue=new Set(h),e[23]=h,e[24]=ue);let de=ue,fe;e[25]!==u||e[26]!==f||e[27]!==de?(fe=function(e){let t=[],n=[];for(let r of e)de.has(r)?n.push(r):t.push(r);t.length>0&&f(t);for(let e of n)u(e)},e[25]=u,e[26]=f,e[27]=de,e[28]=fe):fe=e[28];let pe=fe,me;e[29]===Symbol.for(`react.memo_cache_sentinel`)?(me={activationConstraint:{distance:8}},e[29]=me):me=e[29];let he;e[30]===Symbol.for(`react.memo_cache_sentinel`)?(he={coordinateGetter:ba},e[30]=he):he=e[30];let ge=Fa($i(Da,me),$i(ga,he)),_e;e[31]!==x||e[32]!==C?(_e=function(e){let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=C.indexOf(t),i=C.indexOf(n);r<0||i<0||r===i||x(no([...C],r,i),t)},e[31]=x,e[32]=C,e[33]=_e):_e=e[33];let ve=_e,ye=le?``:void 0,xe;e[34]===Symbol.for(`react.memo_cache_sentinel`)?(xe=Ei(`pl-2 flex h-12 min-w-0 touch-manipulation flex-1 items-end overflow-x-auto overflow-y-hidden overscroll-x-contain scroll-fade-mask-x [scrollbar-width:none]`,le&&`[-webkit-app-region:drag]`),e[34]=xe):xe=e[34];let Se=JO,Ce;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=Ei(`flex items-end gap-1`,le&&`[-webkit-app-region:no-drag]`),e[35]=Ce):Ce=e[35];let J=fa,we=jo,Te;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(Te={container:typeof document<`u`?document.body:void 0},e[36]=Te):Te=e[36];let Ee=Zi,De;e[37]===C?De=e[38]:(De=[...C],e[37]=C,e[38]=De);let Oe=va,ke=C.map(e=>{if(de.has(e)){let t=e===r;return(0,Z.jsx)(ZO,{tabId:e,canPin:!1,openTabs:C,closeTab:u,closeTabs:pe,pinTab:v,pinnedTabIds:y,unpinTab:S,children:(0,Z.jsxs)(XO,{tabId:e,"aria-current":t?`page`:void 0,"data-active-tab":t?`true`:void 0,className:Ei(BO,t?VO:HO),onAuxClick:t=>{t.button===1&&(t.preventDefault(),u(e))},onClick:t=>{t.target===t.currentTarget&&c(e)},children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":w({id:`zLak8b`}),"data-testid":`editor-new-tab-placeholder-button`,className:UO,onClick:()=>c(e),children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:(0,Z.jsx)(s,{id:`3YvS-c`})})}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":w({id:`xCdTnb`}),"data-testid":`editor-new-tab-placeholder-close`,className:GO(t),onClick:t=>{t.stopPropagation(),u(e)},children:(0,Z.jsx)(Ro,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let t=$e(e),n=e===U,i=y.includes(e);if(t.kind===`folder`){let{baseName:r,label:a,prefix:s}=Rt(t.folderPath,`/`),c=`${s}${a}`;return(0,Z.jsx)(ZO,{tabId:e,openTabs:C,closeTab:d,closeTabs:pe,pinTab:v,pinnedTabIds:y,unpinTab:S,children:(0,Z.jsxs)(XO,{tabId:e,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:Ei(BO,n?VO:HO),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&d(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,title:c,className:UO,onClick:()=>{o(e)},children:[s&&(0,Z.jsx)(`span`,{className:Ei(`min-w-0 flex-1 truncate`,n&&`text-muted-foreground`),children:s}),(0,Z.jsxs)(`span`,{className:Ei(`flex min-w-0 items-center`,s?`max-w-[70%] shrink-0`:`flex-1`),children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:r}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:`/`})]})]}),(0,Z.jsx)(QO,{accessibleLabel:c,closeTab:d,isPinned:i,tabId:e,unpinTab:S})]})},e)}if(t.kind===`asset`){let{baseName:r,label:a,prefix:s}=Rt(t.assetPath,``),c=`${s}${a}`;return(0,Z.jsx)(ZO,{tabId:e,openTabs:C,closeTab:d,closeTabs:pe,pinTab:v,pinnedTabIds:y,unpinTab:S,children:(0,Z.jsxs)(XO,{tabId:e,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:Ei(BO,n?VO:HO),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&d(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,className:UO,onClick:()=>{o(e)},children:[s?(0,Z.jsx)(`span`,{className:Ei(`min-w-0 flex-1 truncate text-muted-foreground/60`,n&&`text-muted-foreground`),children:s}):null,(0,Z.jsx)(`span`,{className:Ei(`min-w-0 truncate`,s?`max-w-[70%] shrink-0`:`flex-1`),children:r})]}),(0,Z.jsx)(QO,{accessibleLabel:c,closeTab:d,isPinned:i,tabId:e,unpinTab:S})]})},e)}let a=t.docName,l=T.get(a)?.docExt??`.md`,{baseName:f,extension:p,label:m,prefix:h}=Rt(a,l),g=`${h}${m}`,_=l===`.md`||l===`.mdx`,b=D?.tabId===e,x=`editor-tab-rename-error-${KO(a)}`;return(0,Z.jsx)(ZO,{disabled:b,tabId:e,openTabs:C,closeTab:d,closeTabs:pe,pinTab:v,pinnedTabIds:y,unpinTab:S,children:(0,Z.jsx)(XO,{tabId:e,disabled:b,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:Ei(BO,n?VO:HO,b&&j&&`border-destructive`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&d(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:b?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ex,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(jx,{ref:L,value:k,disabled:F,"aria-label":w({id:`Dw1T_W`,values:{label:m}}),"data-testid":`editor-tab-rename-input`,"aria-invalid":j?!0:void 0,"aria-describedby":j?x:void 0,"aria-busy":F||void 0,title:j??a,className:`h-full min-w-0 px-2 py-0 font-medium text-foreground text-xs selection:bg-primary selection:text-primary-foreground`,onChange:e=>{A(YO(e.target.value,l)),M(null),B.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),ce()):e.key===`Escape`&&(e.preventDefault(),se())},onBlur:ce}),(0,Z.jsx)(Ox,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)(Ax,{className:`text-muted-foreground/60 text-xs`,children:l})})]}),j?(0,Z.jsx)(`span`,{id:x,role:`alert`,className:`sr-only`,children:j}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":g,title:g,className:UO,onClick:()=>{o(e)},onDoubleClick:t=>{t.preventDefault(),t.stopPropagation(),oe(e,a)},children:[(0,Z.jsx)($O,{docName:a}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:f}),!_&&(0,Z.jsx)(`span`,{className:`shrink-0`,children:p})]})]}),(0,Z.jsx)(QO,{accessibleLabel:g,closeTab:d,isPinned:i,tabId:e,unpinTab:S})]})})},e)}),Ae;e[39]!==Ee||e[40]!==De||e[41]!==Oe||e[42]!==ke?(Ae=(0,Z.jsx)(Ee,{items:De,strategy:Oe,children:ke}),e[39]=Ee,e[40]=De,e[41]=Oe,e[42]=ke,e[43]=Ae):Ae=e[43];let je;e[44]!==J||e[45]!==ve||e[46]!==ge||e[47]!==we||e[48]!==Te||e[49]!==Ae?(je=(0,Z.jsx)(J,{sensors:ge,collisionDetection:we,onDragEnd:ve,accessibility:Te,children:Ae}),e[44]=J,e[45]=ve,e[46]=ge,e[47]=we,e[48]=Te,e[49]=Ae,e[50]=je):je=e[50];let Me;e[51]===w?Me=e[52]:(Me=w({id:`3YvS-c`}),e[51]=w,e[52]=Me);let Pe;e[53]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=(0,Z.jsx)(P,{"aria-hidden":`true`}),e[53]=Pe):Pe=e[53];let Fe;e[54]!==g||e[55]!==Me?(Fe=(0,Z.jsx)(cr,{asChild:!0,children:(0,Z.jsx)(Ni,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":Me,"data-testid":`editor-new-tab-button`,className:`first:mb-3 mb-1.5`,onClick:g,children:Pe})}),e[54]=g,e[55]=Me,e[56]=Fe):Fe=e[56];let Ie;e[57]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=(0,Z.jsx)(Qn,{children:(0,Z.jsx)(s,{id:`3YvS-c`})}),e[57]=Ie):Ie=e[57];let Le;e[58]===Fe?Le=e[59]:(Le=(0,Z.jsxs)(Gr,{children:[Fe,Ie]}),e[58]=Fe,e[59]=Le);let Re;e[60]!==Ce||e[61]!==je||e[62]!==Le?(Re=(0,Z.jsxs)(`div`,{className:Ce,children:[je,Le]}),e[60]=Ce,e[61]=je,e[62]=Le,e[63]=Re):Re=e[63];let ze;return e[64]!==ye||e[65]!==xe||e[66]!==Se||e[67]!==Re?(ze=(0,Z.jsx)(`div`,{ref:E,"data-electron-drag":ye,className:xe,onWheel:Se,children:Re}),e[64]=ye,e[65]=xe,e[66]=Se,e[67]=Re,e[68]=ze):ze=e[68],ze}function tk(e){let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`Discord`}),r=(0,Z.jsx)(`path`,{d:`M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9554 2.4189-2.1568 2.4189Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(`svg`,{role:`img`,fill:`currentColor`,height:24,width:24,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}function nk(e){let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`X (Twitter)`}),r=(0,Z.jsx)(`path`,{d:`M18.901 1.153h3.68l-8.04 9.19L24 22.846h-7.406l-5.8-7.584-6.638 7.584H.474l8.6-9.83L0 1.154h7.594l5.243 6.932ZM17.61 20.644h2.039L6.486 3.24H4.298Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(`svg`,{role:`img`,fill:`currentColor`,height:24,width:24,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}var rk=[{label:{id:`TvY_XA`},href:`https://openknowledge.ai/docs`,icon:He},{label:`GitHub`,href:`https://github.com/inkeep/open-knowledge`,icon:ld},{label:{id:`On0aF2`},href:`https://openknowledge.ai/`,icon:ar},{label:`Discord`,href:`https://go.inkeep.com/ok-discord`,icon:tk},{label:`Twitter`,href:`https://x.com/inkeep`,icon:nk}],ik=()=>{let e=(0,$.c)(16),{_:t}=i(),[n,r]=(0,Q.useState)(!1),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(_t,{className:`size-4`}),e[0]=a):a=e[0];let o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(cr,{asChild:!0,children:(0,Z.jsx)(w,{asChild:!0,children:(0,Z.jsxs)(Ni,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[a,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`s-MGs7`})})]})})}),e[1]=o):o=e[1];let c;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsxs)(Gr,{children:[o,(0,Z.jsx)(Qn,{children:(0,Z.jsx)(s,{id:`s-MGs7`})})]}),e[2]=c):c=e[2];let l;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs mb-1`,children:(0,Z.jsx)(s,{id:`s-MGs7`})}),e[3]=l):l=e[3];let u;e[4]===t?u=e[5]:(u=t({id:`s-MGs7`}),e[4]=t,e[5]=u);let d;e[6]===t?d=e[7]:(d=rk.map(e=>{let{label:n,href:r,icon:i}=e;return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`a`,{href:r,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>pa(e,r),onAuxClick:e=>pa(e,r),className:`flex items-center gap-2.5 rounded-md px-2 py-1.5 text-sm text-muted-foreground transition-colors hover:bg-azure-900/5 dark:hover:bg-white/20 hover:text-primary`,children:[(0,Z.jsx)(i,{"aria-hidden":`true`,className:`size-4 shrink-0`}),typeof n==`string`?n:t(n)]})},r)}),e[6]=t,e[7]=d);let f;e[8]===d?f=e[9]:(f=(0,Z.jsx)(`ul`,{className:`space-y-0.5`,children:d}),e[8]=d,e[9]=f);let p;e[10]!==u||e[11]!==f?(p=(0,Z.jsxs)(pe,{align:`end`,className:`w-64 p-3`,children:[l,(0,Z.jsx)(`nav`,{"aria-label":u,children:f})]}),e[10]=u,e[11]=f,e[12]=p):p=e[12];let m;return e[13]!==n||e[14]!==p?(m=(0,Z.jsxs)(v,{open:n,onOpenChange:r,children:[c,p]}),e[13]=n,e[14]=p,e[15]=m):m=e[15],m};function ak(e){let t=(0,$.c)(62),{input:n}=e,{_:r}=i(),{states:a,refresh:o}=Ch(),{dispatch:c}=fh(),[l,u]=(0,Q.useState)(!1),d=typeof window<`u`&&window.okDesktop!=null,f;t[0]===o?f=t[1]:(f=e=>{u(e),e&&o()},t[0]=o,t[1]=f);let p=f,m=n===null,h;t[2]===n?h=t[3]:(h=n!==null&&n.docContext!==null?Zr(n.docContext.relativePath):``,t[2]=n,t[3]=h);let g=h,_;t[4]!==c||t[5]!==n?(_=e=>{n!==null&&c(e.id,n)},t[4]=c,t[5]=n,t[6]=_):_=t[6];let v=_,y,b,x,S,C,w,T,E,D,O,k,A;if(t[7]!==p||t[8]!==v||t[9]!==n||t[10]!==l||t[11]!==g||t[12]!==a||t[13]!==m){let e;t[26]===a?e=t[27]:(e=e=>a[e.id]?.installed===!0,t[26]=a,t[27]=e);let r=xm.filter(e);x=a[`claude-code`]?.installed===!0;let i;t[28]!==n||t[29]!==g?(i=()=>{n!==null&&Iy(g)},t[28]=n,t[29]=g,t[30]=i):i=t[30],S=i,b=Na,A=l,C=p;let o,c;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Gi,{className:`size-3.5`}),c=(0,Z.jsx)(s,{id:`xWEvuo`}),t[31]=o,t[32]=c):(o=t[31],c=t[32]);let u;t[33]===m?u=t[34]:(u=(0,Z.jsx)(cr,{asChild:!0,children:(0,Z.jsx)(Ea,{asChild:!0,children:(0,Z.jsxs)(Ni,{variant:`ghost`,size:`sm`,disabled:m,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`open-in-agent-trigger`,children:[o,c]})})}),t[33]=m,t[34]=u);let f;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(Qn,{children:(0,Z.jsx)(s,{id:`xWEvuo`})}),t[35]=f):f=t[35],t[36]===u?w=t[37]:(w=(0,Z.jsxs)(Gr,{children:[u,f]}),t[36]=u,t[37]=w),y=la,T=`end`,E=`min-w-[220px]`,D=`open-in-agent-menu`,t[38]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(ho,{className:`font-mono font-normal tracking-wide uppercase text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`O7_W_a`})}),t[38]=O):O=t[38];let h;t[39]!==v||t[40]!==g||t[41]!==a?(h=e=>{let t=a[e.id];return(0,Z.jsx)(Ly,{target:e,installState:t,isElectronHost:d,prompt:g,onSelect:()=>v(e)},e.id)},t[39]=v,t[40]=g,t[41]=a,t[42]=h):h=t[42],k=r.map(h),t[7]=p,t[8]=v,t[9]=n,t[10]=l,t[11]=g,t[12]=a,t[13]=m,t[14]=y,t[15]=b,t[16]=x,t[17]=S,t[18]=C,t[19]=w,t[20]=T,t[21]=E,t[22]=D,t[23]=O,t[24]=k,t[25]=A}else y=t[14],b=t[15],x=t[16],S=t[17],C=t[18],w=t[19],T=t[20],E=t[21],D=t[22],O=t[23],k=t[24],A=t[25];let j;t[43]!==r||t[44]!==x||t[45]!==S||t[46]!==n?(j=x?null:(0,Z.jsxs)(ha,{onSelect:S,disabled:n===null,"data-testid":`open-in-agent-claude-web-fallback`,"aria-label":r({id:`aA51jP`}),children:[(0,Z.jsx)(mt,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`0S9PW_`})}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`pcfY8r`})})]}),t[43]=r,t[44]=x,t[45]=S,t[46]=n,t[47]=j):j=t[47];let M;t[48]!==y||t[49]!==j||t[50]!==T||t[51]!==E||t[52]!==D||t[53]!==O||t[54]!==k?(M=(0,Z.jsxs)(y,{align:T,className:E,"data-testid":D,children:[O,k,j]}),t[48]=y,t[49]=j,t[50]=T,t[51]=E,t[52]=D,t[53]=O,t[54]=k,t[55]=M):M=t[55];let N;return t[56]!==b||t[57]!==C||t[58]!==w||t[59]!==M||t[60]!==A?(N=(0,Z.jsxs)(b,{open:A,onOpenChange:C,children:[w,M]}),t[56]=b,t[57]=C,t[58]=w,t[59]=M,t[60]=A,t[61]=N):N=t[61],N}var ok=50,sk=()=>{let e=(0,$.c)(8),t=(0,Q.useRef)(null),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=()=>{t.current===null&&(t.current=setTimeout(()=>{t.current=null,sx.preload()},ok))},e[0]=n):n=e[0];let r=n,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{t.current!==null&&(clearTimeout(t.current),t.current=null)},e[1]=i):i=e[1];let a=i,o,c;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>()=>{t.current!==null&&clearTimeout(t.current)},c=[],e[2]=o,e[3]=c):(o=e[2],c=e[3]),(0,Q.useEffect)(o,c);let l,u;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{a(),window.location.hash!==`#settings`&&(window.location.hash=Sm)},u=(0,Z.jsx)(tl,{className:`size-4`}),e[4]=l,e[5]=u):(l=e[4],u=e[5]);let d;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(cr,{asChild:!0,children:(0,Z.jsxs)(Ni,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,"data-testid":`header-settings-button`,onMouseEnter:r,onMouseLeave:a,onFocus:r,onBlur:a,onClick:l,children:[u,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`Tz0i8g`})})]})}),e[6]=d):d=e[6];let f;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsxs)(Gr,{children:[d,(0,Z.jsx)(Qn,{children:(0,Z.jsx)(s,{id:`Tz0i8g`})})]}),e[7]=f):f=e[7],f};function ck(e){let t=(0,$.c)(17),{onClickWhenNoRemote:n}=e,{_:r}=i(),{activeDocName:a}=ft(),{status:o}=to(),[c,l]=(0,Q.useState)(!1);if(!a)return null;let u=o?.hasRemote===!0,d;t[0]!==r||t[1]!==a||t[2]!==c||t[3]!==u||t[4]!==n?(d=async function(){if(!c&&a){l(!0);try{await Za({docName:a,hasRemote:u,onClickWhenNoRemote:n},{clipboardWrite:fk,toastSuccess:dk,toastError:uk,logEvent:lk})}catch{$o.error(r({id:`u3YnKw`}))}l(!1)}},t[0]=r,t[1]=a,t[2]=c,t[3]=u,t[4]=n,t[5]=d):d=t[5];let f=d,p;t[6]===r?p=t[7]:(p=r({id:`F4IYWe`}),t[6]=r,t[7]=p);let m,h;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(nl,{className:`size-3.5`,"aria-hidden":!0}),h=(0,Z.jsx)(s,{id:`Z8lGw6`}),t[8]=m,t[9]=h):(m=t[8],h=t[9]);let g;t[10]!==c||t[11]!==f||t[12]!==p?(g=(0,Z.jsx)(cr,{asChild:!0,children:(0,Z.jsxs)(Ni,{variant:`ghost`,size:`sm`,"aria-label":p,onClick:f,disabled:c,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`share-button`,children:[m,h]})}),t[10]=c,t[11]=f,t[12]=p,t[13]=g):g=t[13];let _;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(Qn,{children:(0,Z.jsx)(s,{id:`Z8lGw6`})}),t[14]=_):_=t[14];let v;return t[15]===g?v=t[16]:(v=(0,Z.jsxs)(Gr,{children:[g,_]}),t[15]=g,t[16]=v),v}function lk(e){return console.log(e)}function uk(e){return $o.error(e)}function dk(e){return $o.success(e)}function fk(e){return navigator.clipboard.writeText(e)}function pk(e){if(!e)return X._({id:`Zul8Ry`});let t=Date.now()-new Date(e).getTime();if(t<6e4)return X._({id:`xOTzt5`});if(t<36e5){let e=Math.floor(t/6e4);return X._({id:`LNum6A`,values:{minutes:e}})}if(t<864e5){let e=Math.floor(t/36e5);return X._({id:`nYeBmY`,values:{hours:e}})}return new Date(e).toLocaleDateString()}async function mk(e){await fetch(`/api/sync/trigger`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({op:e})})}function hk(e){let t=(0,$.c)(9),{status:n}=e;switch(n.state){case`dormant`:{let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(dc,{className:`size-3.5 text-muted-foreground`}),t[0]=e):e=t[0],e}case`idle`:{if(n.ahead>0||n.behind>0){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Xc,{className:`size-3.5 text-muted-foreground`}),t[1]=e):e=t[1],e}let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(dc,{className:`size-3.5 text-muted-foreground`}),t[2]=e):e=t[2],e}case`fetching`:case`pulling`:case`pushing`:{let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Xc,{className:`size-3.5 text-muted-foreground animate-spin`}),t[3]=e):e=t[3],e}case`conflict`:{let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Pn,{className:`size-3.5 text-amber-500`}),t[4]=e):e=t[4],e}case`offline`:{let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(uc,{className:`size-3.5 text-muted-foreground`}),t[5]=e):e=t[5],e}case`auth-error`:{let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Rc,{className:`size-3.5 text-destructive`}),t[6]=e):e=t[6],e}case`disabled`:{let e;return t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Pn,{className:`size-3.5 text-amber-500`}),t[7]=e):e=t[7],e}default:{let e;return t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(dc,{className:`size-3.5 text-muted-foreground`}),t[8]=e):e=t[8],e}}}function gk(e){switch(e.state){case`idle`:return e.ahead>0?`↑${e.ahead}`:e.behind>0?`↓${e.behind}`:``;case`fetching`:case`pulling`:case`pushing`:return``;case`conflict`:return e.conflictCount>0?`${e.conflictCount}`:``;case`offline`:return``;case`auth-error`:return``;default:return``}}function _k(e){switch(e){case`dormant`:return X._({id:`RmBY0A`});case`idle`:return X._({id:`N2FcBE`});case`fetching`:return X._({id:`Wgmlsw`});case`pulling`:return X._({id:`4uNLmk`});case`pushing`:return X._({id:`iycx_A`});case`conflict`:return X._({id:`IInnZo`});case`offline`:return X._({id:`6Aih4U`});case`auth-error`:return X._({id:`mHVPm5`});case`disabled`:return X._({id:`DrYM2Z`});default:return e}}function vk(e){switch(e){case`external-changes-pending`:return X._({id:`W9_Bub`});case`dirty-tree`:return X._({id:`a5Gha5`});case`non-content-merge-failure`:return X._({id:`sIxSSP`});case`detached-head`:return X._({id:`uQNW00`});case`auth-error`:return X._({id:`mHVPm5`});case`protected-branch`:return X._({id:`8fc_3j`});default:return e}}function yk(e){if(!e.syncEnabled)return X._({id:`kUn-CN`});if(e.state===`idle`){let{ahead:t,behind:n}=e;return t>0&&n>0?X._({id:`5F5HYj`,values:{ahead:t,behind:n}}):t>0?X._({id:`PdA9NZ`,values:{ahead:t}}):n>0?X._({id:`9o1bIV`,values:{behind:n}}):X._({id:`N2FcBE`})}if(e.state===`conflict`&&e.conflictCount>0){let{conflictCount:t}=e;return X._({id:`cUK8lW`,values:{conflictCount:t}})}return _k(e.state)}function bk(e){let t=(0,$.c)(88),{status:n,onSignIn:r,onSetIdentity:a}=e,{_:o}=i(),{ahead:c,behind:u,conflictCount:d}=n,{projectLocalConfig:f,projectLocalSynced:p}=l(),m=f?.autoSync?.enabled??!1,h;t[0]===n.lastSyncUtc?h=t[1]:(h=pk(n.lastSyncUtc),t[0]=n.lastSyncUtc,t[1]=h);let g=h,{confirmOpen:_,setConfirmOpen:v,onToggleRequest:y,onConfirm:b}=Xi(Ya()),{conflicts:x}=JC(),S=x[0]??null,C;t[2]===n?C=t[3]:(C=(0,Z.jsx)(hk,{status:n}),t[2]=n,t[3]=C);let w;t[4]===n.state?w=t[5]:(w=_k(n.state),t[4]=n.state,t[5]=w);let T;t[6]===w?T=t[7]:(T=(0,Z.jsx)(`span`,{className:`text-1sm font-medium truncate`,children:w}),t[6]=w,t[7]=T);let E;t[8]!==C||t[9]!==T?(E=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[C,T]}),t[8]=C,t[9]=T,t[10]=E):E=t[10];let D=!p,O;t[11]!==o||t[12]!==m?(O=o(m?{id:`lIn9L9`}:{id:`wbwHYD`}),t[11]=o,t[12]=m,t[13]=O):O=t[13];let k;t[14]!==m||t[15]!==y||t[16]!==D||t[17]!==O?(k=(0,Z.jsx)(re,{checked:m,disabled:D,onCheckedChange:y,"aria-label":O}),t[14]=m,t[15]=y,t[16]=D,t[17]=O,t[18]=k):k=t[18];let A;t[19]!==E||t[20]!==k?(A=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[E,k]}),t[19]=E,t[20]=k,t[21]=A):A=t[21];let j;t[22]!==_||t[23]!==b||t[24]!==v?(j=(0,Z.jsx)(so,{open:_,onOpenChange:v,onConfirm:b}),t[22]=_,t[23]=b,t[24]=v,t[25]=j):j=t[25];let M;t[26]===n.error?M=t[27]:(M=n.error&&(0,Z.jsx)(`p`,{className:`text-xs text-destructive`,children:n.error}),t[26]=n.error,t[27]=M);let N;t[28]===n.pausedReason?N=t[29]:(N=n.pausedReason&&(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:vk(n.pausedReason)}),t[28]=n.pausedReason,t[29]=N);let P;t[30]===n.state?P=t[31]:(P=n.state===`conflict`&&(0,Z.jsx)(`p`,{className:`text-xs text-amber-700 dark:text-amber-400`,children:(0,Z.jsx)(s,{id:`t2TkQ3`})}),t[30]=n.state,t[31]=P);let F;t[32]!==o||t[33]!==n.remote?(F=n.remote&&(0,Z.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,Z.jsx)(`span`,{className:`w-20 shrink-0 font-mono uppercase tracking-wide text-2xs`,children:(0,Z.jsx)(s,{id:`IreQBq`})}),n.remote.webUrl?(0,Z.jsxs)(`a`,{href:n.remote.webUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex min-w-0 items-center gap-0.5 text-foreground hover:text-primary hover:underline`,"aria-label":o({id:`1nke1r`,values:{0:n.remote.label}}),children:[(0,Z.jsx)(`span`,{className:`truncate`,children:n.remote.label}),(0,Z.jsx)(Fo,{className:`size-3.5 shrink-0`,"aria-hidden":!0})]}):(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-foreground`,children:n.remote.label})]}),t[32]=o,t[33]=n.remote,t[34]=F):F=t[34];let I;t[35]!==m||t[36]!==g||t[37]!==n.state?(I=m&&n.state!==`dormant`&&(0,Z.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,Z.jsx)(`span`,{className:`w-20 shrink-0 font-mono uppercase tracking-wide text-2xs`,children:(0,Z.jsx)(s,{id:`uWx2ZP`})}),(0,Z.jsx)(`span`,{className:`text-foreground`,children:g})]}),t[35]=m,t[36]=g,t[37]=n.state,t[38]=I):I=t[38];let L;t[39]!==c||t[40]!==n.ahead?(L=n.ahead>0&&(0,Z.jsx)(`div`,{children:(0,Z.jsx)(s,{id:`iTlqm3`,values:{ahead:c}})}),t[39]=c,t[40]=n.ahead,t[41]=L):L=t[41];let R;t[42]!==u||t[43]!==n.behind?(R=n.behind>0&&(0,Z.jsx)(`div`,{children:(0,Z.jsx)(s,{id:`YsEYYS`,values:{behind:u}})}),t[42]=u,t[43]=n.behind,t[44]=R):R=t[44];let z;t[45]!==d||t[46]!==n.conflictCount?(z=n.conflictCount>0&&(0,Z.jsx)(`div`,{children:(0,Z.jsx)(s,{id:`B4_ipX`,values:{conflictCount:d}})}),t[45]=d,t[46]=n.conflictCount,t[47]=z):z=t[47];let B;t[48]===m?B=t[49]:(B=!m&&(0,Z.jsx)(`div`,{children:(0,Z.jsx)(s,{id:`Wt5W56`})}),t[48]=m,t[49]=B);let V;t[50]!==F||t[51]!==I||t[52]!==L||t[53]!==R||t[54]!==z||t[55]!==B?(V=(0,Z.jsxs)(`div`,{className:`text-xs text-muted-foreground space-y-2`,children:[F,I,L,R,z,B]}),t[50]=F,t[51]=I,t[52]=L,t[53]=R,t[54]=z,t[55]=B,t[56]=V):V=t[56];let H;t[57]!==a||t[58]!==n.identityUnresolved?(H=n.identityUnresolved&&a&&(0,Z.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-dashed p-2`,children:[(0,Z.jsx)(hl,{className:`size-3.5 mt-0.5 text-muted-foreground shrink-0`}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 min-w-0`,children:[(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground leading-snug`,children:(0,Z.jsx)(s,{id:`nrGWJ7`})}),(0,Z.jsx)(Ni,{variant:`outline`,size:`xs`,className:`self-start`,onClick:a,children:(0,Z.jsx)(s,{id:`keNFEd`})})]})]}),t[57]=a,t[58]=n.identityUnresolved,t[59]=H):H=t[59];let U;t[60]!==m||t[61]!==n.state?(U=m&&n.state!==`dormant`&&n.state!==`disabled`&&n.state!==`auth-error`&&n.state!==`conflict`&&(0,Z.jsx)(Ni,{variant:`outline`,size:`xs`,onClick:Sk,children:(0,Z.jsx)(s,{id:`lb_UU4`})}),t[60]=m,t[61]=n.state,t[62]=U):U=t[62];let W;t[63]!==m||t[64]!==r||t[65]!==n.state?(W=m&&n.state===`auth-error`&&(0,Z.jsx)(Ni,{variant:`outline`,size:`xs`,onClick:r,children:(0,Z.jsx)(s,{id:`3jod3l`})}),t[63]=m,t[64]=r,t[65]=n.state,t[66]=W):W=t[66];let G;t[67]!==m||t[68]!==n.state?(G=m&&n.state===`offline`&&(0,Z.jsx)(Ni,{variant:`outline`,size:`xs`,onClick:xk,children:(0,Z.jsx)(s,{id:`6gRgw8`})}),t[67]=m,t[68]=n.state,t[69]=G):G=t[69];let K;t[70]!==m||t[71]!==S||t[72]!==n.state?(K=m&&n.state===`conflict`&&S&&(0,Z.jsx)(Ni,{variant:`outline`,size:`xs`,onClick:()=>{if(typeof window>`u`)return;let e=di(Ar(S.file));window.location.hash!==e&&(window.location.hash=e)},children:(0,Z.jsx)(s,{id:`0yL--g`})}),t[70]=m,t[71]=S,t[72]=n.state,t[73]=K):K=t[73];let q;t[74]!==U||t[75]!==W||t[76]!==G||t[77]!==K?(q=(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-1 pt-1`,children:[U,W,G,K]}),t[74]=U,t[75]=W,t[76]=G,t[77]=K,t[78]=q):q=t[78];let ee;return t[79]!==j||t[80]!==M||t[81]!==N||t[82]!==P||t[83]!==V||t[84]!==H||t[85]!==q||t[86]!==A?(ee=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3.5`,children:[A,j,M,N,P,V,H,q]}),t[79]=j,t[80]=M,t[81]=N,t[82]=P,t[83]=V,t[84]=H,t[85]=q,t[86]=A,t[87]=ee):ee=t[87],ee}function xk(){mk(`sync`)}function Sk(){mk(`sync`)}function Ck(e){let t=(0,$.c)(69),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onSignIn:r,onSetIdentity:a}=n,{_:o}=i(),{status:c,fetchError:l}=to();if(!c){if(l){let e;t[2]===o?e=t[3]:(e=o({id:`iqIDv4`}),t[2]=o,t[3]=e);let n;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(uc,{className:`size-3.5`}),t[4]=n):n=t[4];let r;t[5]===e?r=t[6]:(r=(0,Z.jsx)(cr,{asChild:!0,children:(0,Z.jsx)(Ni,{variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground`,"aria-label":e,disabled:!0,children:n})}),t[5]=e,t[6]=r);let i;t[7]===l?i=t[8]:(i=(0,Z.jsx)(Qn,{children:l===`network`?(0,Z.jsx)(s,{id:`I5AfhE`}):(0,Z.jsx)(s,{id:`uKRYiW`})}),t[7]=l,t[8]=i);let a;return t[9]!==r||t[10]!==i?(a=(0,Z.jsxs)(Gr,{children:[r,i]}),t[9]=r,t[10]=i,t[11]=a):a=t[11],a}return null}if(c.state===`dormant`&&!c.hasRemote||c.state===`disabled`&&!c.pausedReason)return null;let u;t[12]===c?u=t[13]:(u=gk(c),t[12]=c,t[13]=u);let d=u,f,p,m,h,g,_,y,b,x,S,C,T;if(t[14]!==o||t[15]!==c.identityUnresolved||t[16]!==c.state){let e=_k(c.state);_=!!c.identityUnresolved,g=v,h=Gr,m=cr,T=!0,p=w,C=!0,f=Ni,y=`ghost`,b=`icon-sm`,x=`text-muted-foreground relative`,S=o(_?{id:`DFfRbX`,values:{syncStateLabel:e}}:{id:`F4vEsL`,values:{syncStateLabel:e}}),t[14]=o,t[15]=c.identityUnresolved,t[16]=c.state,t[17]=f,t[18]=p,t[19]=m,t[20]=h,t[21]=g,t[22]=_,t[23]=y,t[24]=b,t[25]=x,t[26]=S,t[27]=C,t[28]=T}else f=t[17],p=t[18],m=t[19],h=t[20],g=t[21],_=t[22],y=t[23],b=t[24],x=t[25],S=t[26],C=t[27],T=t[28];let E;t[29]===c?E=t[30]:(E=(0,Z.jsx)(hk,{status:c}),t[29]=c,t[30]=E);let D;t[31]===d?D=t[32]:(D=d&&(0,Z.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 text-[9px] leading-none font-medium bg-background border rounded-full px-0.5`,children:d}),t[31]=d,t[32]=D);let O;t[33]!==d||t[34]!==_?(O=!d&&_&&(0,Z.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 size-1.5 rounded-full bg-amber-500 ring-2 ring-background`,"aria-hidden":!0}),t[33]=d,t[34]=_,t[35]=O):O=t[35];let k;t[36]!==f||t[37]!==D||t[38]!==O||t[39]!==y||t[40]!==b||t[41]!==x||t[42]!==S||t[43]!==E?(k=(0,Z.jsxs)(f,{variant:y,size:b,className:x,"aria-label":S,children:[E,D,O]}),t[36]=f,t[37]=D,t[38]=O,t[39]=y,t[40]=b,t[41]=x,t[42]=S,t[43]=E,t[44]=k):k=t[44];let A;t[45]!==p||t[46]!==k||t[47]!==C?(A=(0,Z.jsx)(p,{asChild:C,children:k}),t[45]=p,t[46]=k,t[47]=C,t[48]=A):A=t[48];let j;t[49]!==m||t[50]!==A||t[51]!==T?(j=(0,Z.jsx)(m,{asChild:T,children:A}),t[49]=m,t[50]=A,t[51]=T,t[52]=j):j=t[52];let M;t[53]===c?M=t[54]:(M=yk(c),t[53]=c,t[54]=M);let N;t[55]===M?N=t[56]:(N=(0,Z.jsx)(Qn,{children:M}),t[55]=M,t[56]=N);let P;t[57]!==h||t[58]!==j||t[59]!==N?(P=(0,Z.jsxs)(h,{children:[j,N]}),t[57]=h,t[58]=j,t[59]=N,t[60]=P):P=t[60];let F;t[61]!==a||t[62]!==r||t[63]!==c?(F=(0,Z.jsx)(pe,{align:`end`,className:`w-64 p-3`,children:(0,Z.jsx)(bk,{status:c,onSignIn:r,onSetIdentity:a})}),t[61]=a,t[62]=r,t[63]=c,t[64]=F):F=t[64];let I;return t[65]!==g||t[66]!==P||t[67]!==F?(I=(0,Z.jsxs)(g,{children:[P,F]}),t[65]=g,t[66]=P,t[67]=F,t[68]=I):I=t[68],I}function wk(e){let t=(0,$.c)(39),{onSignIn:n,onSetIdentity:r}=e,{activeDocName:i,activeTarget:a}=ft(),{state:o}=dD(),c=Wa(),[l,u]=(0,Q.useState)(!1),d;bb0:{if(a===null){let e;t[0]===c?e=t[1]:(e=eh({workspace:c}),t[0]=c,t[1]=e),d=e;break bb0}if(a.kind===`folder`){if(!c){d=null;break bb0}let e;t[2]!==a.folderPath||t[3]!==c?(e=th({folderRelativePath:a.folderPath,workspace:c}),t[2]=a.folderPath,t[3]=c,t[4]=e):e=t[4],d=e;break bb0}let e;t[5]!==i||t[6]!==c?(e=$m({docName:i,workspace:c}),t[5]=i,t[6]=c,t[7]=e):e=t[7],d=e}let f=d,p=typeof window<`u`&&window.okDesktop!=null,m=p&&o===`collapsed`&&`pl-[78px]`,h;t[8]===m?h=t[9]:(h=Ei(`flex h-12 shrink-0 items-center bg-muted/35 shadow-[inset_0_-1px_0_var(--border)]`,p&&`[-webkit-app-region:drag]`,m,p&&`motion-safe:transition-[padding] motion-safe:duration-200 motion-safe:ease-linear`),t[8]=m,t[9]=h);let g;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(cr,{asChild:!0,children:(0,Z.jsx)(gD,{className:Ei(`-ml-1 shrink-0 text-muted-foreground`,p&&`[-webkit-app-region:no-drag]`)})}),t[10]=g):g=t[10];let _;t[11]===o?_=t[12]:(_=(0,Z.jsxs)(Gr,{children:[g,(0,Z.jsx)(Qn,{children:o===`expanded`?(0,Z.jsx)(s,{id:`w3vFfL`}):(0,Z.jsx)(s,{id:`e8zRrb`})})]}),t[11]=o,t[12]=_);let v,y;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(mo,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),y=(0,Z.jsx)(ek,{}),t[13]=v,t[14]=y):(v=t[13],y=t[14]);let b;t[15]===_?b=t[16]:(b=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 px-3`,children:[_,v,y]}),t[15]=_,t[16]=b);let x;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(x=Ei(`flex shrink-0 items-center justify-end gap-2 px-3`,p&&`[&>*]:[-webkit-app-region:no-drag]`),t[17]=x):x=t[17];let S;t[18]===f?S=t[19]:(S=(0,Z.jsx)(ak,{input:f}),t[18]=f,t[19]=S);let C;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(ck,{onClickWhenNoRemote:()=>u(!0)}),t[20]=C):C=t[20];let w;t[21]===l?w=t[22]:(w=(0,Z.jsx)($a,{open:l,onOpenChange:u}),t[21]=l,t[22]=w);let T;t[23]!==r||t[24]!==n?(T=(0,Z.jsx)(Ck,{onSignIn:n,onSetIdentity:r}),t[23]=r,t[24]=n,t[25]=T):T=t[25];let E,D,O,k,A;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(KD,{}),D=(0,Z.jsx)(mo,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),O=(0,Z.jsx)(Mu,{}),k=(0,Z.jsx)(sk,{}),A=(0,Z.jsx)(ik,{}),t[26]=E,t[27]=D,t[28]=O,t[29]=k,t[30]=A):(E=t[26],D=t[27],O=t[28],k=t[29],A=t[30]);let j;t[31]!==S||t[32]!==w||t[33]!==T?(j=(0,Z.jsxs)(`div`,{className:x,children:[S,C,w,T,E,D,O,k,A]}),t[31]=S,t[32]=w,t[33]=T,t[34]=j):j=t[34];let M;return t[35]!==j||t[36]!==h||t[37]!==b?(M=(0,Z.jsxs)(`header`,{"data-electron-drag":p?``:void 0,className:h,children:[b,j]}),t[35]=j,t[36]=h,t[37]=b,t[38]=M):M=t[38],M}function Tk(){let e=(0,$.c)(26),{_:t}=i(),[n,r]=$h(),[a,o]=(0,Q.useState)(n),[s,c]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(`auth`),[f,p]=(0,Q.useState)(v_[0].id),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(!1),v=_o(),{projectLocalConfig:y,projectLocalSynced:b}=l(),{activeDocName:x}=ft(),S=!g&&v?.hasRemote===!0&&b===!0&&y!==null&&y.autoSync?.enabled===null,C,w;e[0]===x?(C=e[1],w=e[2]):(C=()=>{let e=function(e){let t=e.detail;t&&x&&Fs(x,{kind:`raw-mdx`,detail:t}),o(`source`)};return window.addEventListener(Gh,e),()=>window.removeEventListener(Gh,e)},w=[x],e[0]=x,e[1]=C,e[2]=w),(0,Q.useEffect)(C,w);let T;e[3]===r?T=e[4]:(T=function(e){o(e),r(e)},e[3]=r,e[4]=T);let E=T,D;e[5]===t?D=e[6]:(D=async function(){h(!0);try{let e=await fetch(`/api/save-version`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({})});e.ok?$o.success(t({id:`rdE6_3`})):(console.error(`[save-version] failed:`,await e.text()),$o.error(t({id:`q7zsRM`})))}catch(e){console.error(`[save-version] failed:`,e),$o.error(t({id:`q7zsRM`}))}h(!1)},e[5]=t,e[6]=D);let O=D,k;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(wk,{onSignIn:()=>{d(`auth`),c(!0)},onSetIdentity:()=>{d(`identity`),c(!0)}}),e[7]=k):k=e[7];let A;e[8]!==f||e[9]!==a||e[10]!==E||e[11]!==O||e[12]!==m?(A=(0,Z.jsx)(VE,{editorMode:a,onModeChange:E,activeTab:f,onActiveTabChange:p,onSaveVersion:O,saving:m}),e[8]=f,e[9]=a,e[10]=E,e[11]=O,e[12]=m,e[13]=A):A=e[13];let j=u===`identity`,M;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(M=()=>{c(!1)},e[14]=M):M=e[14];let N;e[15]!==s||e[16]!==j?(N=(0,Z.jsx)(wo,{open:s,onOpenChange:c,identityPrompt:j,onSuccess:M}),e[15]=s,e[16]=j,e[17]=N):N=e[17];let P;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>_(!0),e[18]=P):P=e[18];let F;e[19]===S?F=e[20]:(F=(0,Z.jsx)(eg,{open:S,onResolved:P}),e[19]=S,e[20]=F);let I;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(Hh,{}),e[21]=I):I=e[21];let L;return e[22]!==F||e[23]!==A||e[24]!==N?(L=(0,Z.jsxs)(Z.Fragment,{children:[k,A,N,F,I]}),e[22]=F,e[23]=A,e[24]=N,e[25]=L):L=e[25],L}function Ek(e){let t=di(Ar(e));typeof window>`u`||window.location.hash!==t&&(window.location.hash=t)}function Dk(){let e=(0,$.c)(11),{conflicts:t,loading:n,error:r}=JC();if(n)return null;if(r!==null){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`section`,{"data-testid":`conflicts-section`,"aria-label":`Conflicted files`,className:`border-b border-amber-200/60 bg-amber-50/40 px-2 py-2 dark:border-amber-900/40 dark:bg-amber-950/20`,children:(0,Z.jsxs)(`p`,{"data-testid":`conflicts-section-error`,className:`px-2 py-1.5 text-[12px] text-amber-700 dark:text-amber-400`,children:[(0,Z.jsx)(Pn,{"aria-hidden":`true`,className:`mr-1.5 inline size-3`}),`Couldn't load conflicts — reload to retry.`]})}),e[0]=t):t=e[0],t}if(t.length===0)return null;let i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 font-mono text-[11px] uppercase tracking-wider text-amber-700 dark:text-amber-400`,children:[(0,Z.jsx)(Pn,{"aria-hidden":`true`,className:`size-3`}),`Conflicts`]}),e[1]=i):i=e[1];let a;e[2]===t.length?a=e[3]:(a=(0,Z.jsxs)(`header`,{className:`flex items-center justify-between px-2 pb-1.5`,children:[i,(0,Z.jsx)(`span`,{"data-testid":`conflicts-section-count`,className:`rounded-full bg-amber-500 px-1.5 py-0.5 font-mono text-[10px] font-medium leading-none text-white`,children:t.length})]}),e[2]=t.length,e[3]=a);let o;e[4]===t?o=e[5]:(o=t.map(Ok),e[4]=t,e[5]=o);let s;e[6]===o?s=e[7]:(s=(0,Z.jsx)(`ul`,{className:`flex flex-col gap-px`,children:o}),e[6]=o,e[7]=s);let c;return e[8]!==a||e[9]!==s?(c=(0,Z.jsxs)(`section`,{"data-testid":`conflicts-section`,"aria-label":`Conflicted files`,className:`border-b border-amber-200/60 bg-amber-50/40 px-2 py-2 dark:border-amber-900/40 dark:bg-amber-950/20`,children:[a,s]}),e[8]=a,e[9]=s,e[10]=c):c=e[10],c}function Ok(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(Ni,{variant:`ghost`,size:`sm`,"data-testid":`conflicts-section-row`,"data-file":e.file,title:e.file,className:`h-7 w-full justify-start gap-1.5 px-2 font-normal text-[13px] text-amber-800 hover:bg-amber-100/60 hover:text-amber-900 dark:text-amber-300 dark:hover:bg-amber-900/30 dark:hover:text-amber-200`,onClick:()=>Ek(e.file),children:[(0,Z.jsx)(Pn,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.file})]})},e.file)}var kk=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
32
32
  <symbol id="file-tree-icon-chevron" viewBox="0 0 16 16">
33
33
  <path d="M3.47 5.47a.75.75 0 0 1 1.06 0L8 8.94l3.47-3.47a.75.75 0 1 1 1.06 1.06l-4 4a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 0 1 0-1.06" fill="currentcolor"/>
34
34
  </symbol>