ocean-brain 0.10.0 → 0.11.0

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 (80) hide show
  1. package/dist/mcp.js +58 -32
  2. package/package.json +2 -2
  3. package/server/client/dist/assets/{ArrowRight.es-Bm-ZXpEC.js → ArrowRight.es-BEhnlwfe.js} +1 -1
  4. package/server/client/dist/assets/AuxiliaryPanelHeader-B1k7pZpn.js +1 -0
  5. package/server/client/dist/assets/Calendar-D7QJsAlg.js +25 -0
  6. package/server/client/dist/assets/{Callout-CviyPHKO.js → Callout-BTd1BYtV.js} +1 -1
  7. package/server/client/dist/assets/{Copy.es-BPreRnP9.js → Copy.es-BoLjilxv.js} +1 -1
  8. package/server/client/dist/assets/File.es-Ct7fscBg.js +1 -0
  9. package/server/client/dist/assets/{Graph-yPE3ljW0.js → Graph-DYUb7gQb.js} +1 -1
  10. package/server/client/dist/assets/{Graph-vXQQ0a-Q.js → Graph-LY_IgMYy.js} +1 -1
  11. package/server/client/dist/assets/{Image.es-DnR3qc_c.js → Image.es-OYyN3BYt.js} +1 -1
  12. package/server/client/dist/assets/Note-DsMhwrHw.js +25 -0
  13. package/server/client/dist/assets/NotePropertiesPanel-aCKXAe5F.js +2 -0
  14. package/server/client/dist/assets/{PencilLine.es-B9V6u64t.js → PencilLine.es-0JpEgxFY.js} +1 -1
  15. package/server/client/dist/assets/{Plus.es-CRRp2u5J.js → Plus.es-DRfLW_bI.js} +1 -1
  16. package/server/client/dist/assets/{Reminders-BOtfNeYD.js → Reminders-COr1OHvF.js} +1 -1
  17. package/server/client/dist/assets/Search-Ctkx0BQk.js +31 -0
  18. package/server/client/dist/assets/{SurfaceCard-GMt5xM7v.js → SurfaceCard-t7pdfhEe.js} +1 -1
  19. package/server/client/dist/assets/Tag-BjxtrIQW.js +1 -0
  20. package/server/client/dist/assets/TagNotes-DV_fdRbg.js +1 -0
  21. package/server/client/dist/assets/{Trash.es-svHOb5LN.js → Trash.es-Bo1VyK9Q.js} +1 -1
  22. package/server/client/dist/assets/ViewChip-DlCkL4z4.js +1 -0
  23. package/server/client/dist/assets/ViewNotes-wWWeFJyU.js +1 -0
  24. package/server/client/dist/assets/ViewSectionDialog-DhH8harC.js +102 -0
  25. package/server/client/dist/assets/Views-CWE99SnI.js +1 -0
  26. package/server/client/dist/assets/app-B9WZRrAH.css +1 -0
  27. package/server/client/dist/assets/app-BpSMjzET.js +26 -0
  28. package/server/client/dist/assets/{image.api-QmHYjp3z.js → image.api-CyQisInP.js} +1 -1
  29. package/server/client/dist/assets/index-B-E1Ilh9.js +1 -0
  30. package/server/client/dist/assets/manage-image-azmo5iVw.js +1 -0
  31. package/server/client/dist/assets/manage-image-detail-BF-uSqb_.js +1 -0
  32. package/server/client/dist/assets/{mcp-uFZkdhCi.js → mcp-CCaFd0zm.js} +1 -1
  33. package/server/client/dist/assets/mcp-admin-adapter-PMmgPupc.js +1 -0
  34. package/server/client/dist/assets/{note-ui-CxK8ymUc.js → note-ui-CtijppHK.js} +1 -1
  35. package/server/client/dist/assets/{note.api-BQovzEzd.js → note.api-D3oJmG3q.js} +2 -2
  36. package/server/client/dist/assets/{placeholder-D3b8lZGE.js → placeholder-AusSo8p9.js} +2 -2
  37. package/server/client/dist/assets/{properties-M-yWq1D7.js → properties-BrNJLkxR.js} +1 -1
  38. package/server/client/dist/assets/route-preload.js +2 -2
  39. package/server/client/dist/assets/search-D-xKTPdO.js +1 -0
  40. package/server/client/dist/assets/search-admin-adapter-CJnJmL6w.js +1 -0
  41. package/server/client/dist/assets/{tag.api-DUfjr8bg.js → tag.api-DNSQpqwk.js} +1 -1
  42. package/server/client/dist/assets/{time-CfAYZipR.js → time-D5LRMumI.js} +3 -3
  43. package/server/client/dist/assets/trash-D4-9sv8q.js +1 -0
  44. package/server/client/dist/assets/{useReminderMutate--omDLmBV.js → useReminderMutate-BrGO9M0o.js} +1 -1
  45. package/server/client/dist/index.html +5 -5
  46. package/server/dist/features/note/graphql/note.field.resolver.js +2 -0
  47. package/server/dist/features/note/graphql/note.mutation.resolver.js +19 -14
  48. package/server/dist/features/note/graphql/note.query.resolver.js +15 -5
  49. package/server/dist/features/note/graphql/note.type-defs.js +1 -0
  50. package/server/dist/features/note/services/authoring.js +15 -10
  51. package/server/dist/features/note/services/note-reference-index.js +98 -0
  52. package/server/dist/features/note/services/search.js +5 -0
  53. package/server/dist/features/note/services/snapshot.js +4 -0
  54. package/server/dist/features/note/services/trash.js +2 -0
  55. package/server/dist/features/note/services/write.js +10 -3
  56. package/server/dist/features/search/graphql/resolver.js +13 -1
  57. package/server/dist/features/search/graphql/type-defs.js +7 -0
  58. package/server/dist/features/search/hybrid-ranking.js +4 -2
  59. package/server/dist/features/search/hybrid-search.js +4 -2
  60. package/server/dist/features/search/related-notes.js +186 -0
  61. package/server/dist/main.js +10 -3
  62. package/server/prisma/migrations/20260728090000_0019_note_reference_index/migration.sql +15 -0
  63. package/server/prisma/schema.prisma +16 -0
  64. package/server/client/dist/assets/Calendar-BsNs3NzO.js +0 -25
  65. package/server/client/dist/assets/Note-CmreVzvQ.js +0 -25
  66. package/server/client/dist/assets/NotePropertiesPanel-DXYgE8h2.js +0 -2
  67. package/server/client/dist/assets/Search-C-FB3pKf.js +0 -1
  68. package/server/client/dist/assets/Tag-lBxDRE77.js +0 -1
  69. package/server/client/dist/assets/TagNotes-Bgorp_rC.js +0 -1
  70. package/server/client/dist/assets/ViewNotes-C7d10VFf.js +0 -1
  71. package/server/client/dist/assets/ViewSectionDialog-Bhw-ILop.js +0 -102
  72. package/server/client/dist/assets/Views-C7V3saUo.js +0 -1
  73. package/server/client/dist/assets/app-DQBV36r_.js +0 -50
  74. package/server/client/dist/assets/app-ZgwR5t_I.css +0 -1
  75. package/server/client/dist/assets/index-CaF9d-zG.js +0 -1
  76. package/server/client/dist/assets/manage-image-DCDF8AM9.js +0 -1
  77. package/server/client/dist/assets/manage-image-detail-e0ViRAj-.js +0 -1
  78. package/server/client/dist/assets/mcp-admin-adapter-D39G3udJ.js +0 -1
  79. package/server/client/dist/assets/search-DFnzZKLd.js +0 -1
  80. package/server/client/dist/assets/trash-CClKfP1x.js +0 -1
@@ -1,2 +1,2 @@
1
- import{r as d,j as r,w as Zt,b as pe,a as ae}from"./floating-ui.react-dom-BWTnA00G.js";import{$ as Xt,q as Jt,U as en,s as tn,v as B,w as R,L as nn,I as on,P as z,D as P,n as Y,Z as U,a as S,C as ge,K as ie,M as Z,b as rn,O as ln,i as be,c as D,Y as _e,V as Ge,d as an,o as sn,e as et,A as cn,x as tt,f as nt,u as dn,g as un,N as X,W as mn,T as ot,H as pn,r as $e,h as gn,j as bn,k as fn,l as hn,m as xn,F as j,p as Re}from"./note-core-DUTqUh5N.js";import{aL as vn,aM as Cn,aN as Me,aO as kn,aP as jn,aQ as wn,aR as yn,aS as Sn,aT as Tn,aU as ve,aV as _n,aW as Rn,I as En,aX as He,aY as In,aZ as Mn,a_ as Pn,a$ as Nn,b0 as Bn,b1 as A,b2 as J,b3 as ee,T as On,b4 as rt,b5 as se,b6 as Fn,b7 as Dn,b8 as Ln,b9 as An,ba as zn,bb as Gn,bc as $n,bd as Hn,be as Pe,bf as lt,bg as it,bh as at,bi as st,bj as ct,bk as ce,bl as de,bm as ue,bn as dt,bo as ut,bp as mt,bq as pt,br as Ue,bs as Un,bt as Ve,bu as Vn,bv as qn,bw as Kn,bx as Qn,by as Wn,bz as Yn,bA as Zn,bB as Xn,bC as Jn,bD as eo,bE as to,bF as no,bG as oo,bH as ro,bI as gt,bJ as bt,bK as lo,bL as io,bM as ao,bN as ft,bO as so,bP as co,bQ as uo,bR as mo,bS as po,bT as ht,bU as xt,N as go,bV as bo,bW as fo,bX as ho,bY as $,bZ as vt,b_ as xo,b$ as M,c0 as N,c1 as V,c2 as vo,c3 as Ct,c4 as Ne,c5 as kt,c6 as Co,c7 as ko,c8 as Be,c9 as jo,ca as wo,cb as yo,cc as So,cd as jt,ce as wt,cf as Oe,cg as To,ch as _o,ci as oe,cj as Ro,ck as qe,cl as Eo,cm as Io}from"./note-runtime-zN5ddTba.js";import{_ as me}from"./preload-helper-BXl3LOEh.js";import{c as Mo}from"./time-CfAYZipR.js";var yt=d.createContext(void 0);function O(e){return d.useContext(yt)}function v(e){let o=O();if(!o?.editor)throw Error("useBlockNoteEditor was called outside of a BlockNoteContext provider or BlockNoteView component");return o.editor}function w(e,o){let t=(o?.editor??v()).getExtension(e);if(!t)throw Error("Extension not found",{cause:{plugin:e}});return t}function y(e,o){let{store:t}=w(e,o);if(!t)throw Error("Store not found on plugin",{cause:{plugin:e}});return vn(t,o?.selector)}function Po(e){let o=new DOMRect,t="getBoundingClientRect"in e?()=>e.getBoundingClientRect():()=>e.element.getBoundingClientRect();return()=>e.element&&(e.cacheMountedBoundingClientRect??!0)?(e.element.isConnected&&(o=t()),o):t()}function No(e,o){return e?o?(t,n,l)=>{let i=e(t,n,l),s=o(t,n,l);return()=>{i?.(),s?.()}}:e:o}var L=e=>{let o=v(),t=o?.portalElement;if(!t)throw Error("Portal element not found");let{whileElementsMounted:n,...l}=e.useFloatingOptions??{},{refs:i,floatingStyles:s,context:a}=Cn({whileElementsMounted:No(Me,e.useFloatingOptions?.whileElementsMounted),...l}),{isMounted:c,styles:u}=kn(a,e.useTransitionStylesProps),{status:m}=jn(a,e.useTransitionStatusProps),{getFloatingProps:p}=wn([yn(a,e.useDismissProps),Sn(a,{enabled:!1,...e.useHoverProps})]),g=d.useRef(""),b=d.useRef(null),f=Tn([b,i.setFloating]);if(d.useEffect(()=>{if(e.reference){let C="element"in e.reference?e.reference.element:void 0;C!==void 0&&(e.focusManagerProps?.disabled||!o.isWithinEditor(C))&&i.setReference(C),i.setPositionReference({getBoundingClientRect:Po(e.reference),contextElement:C})}},[e.reference,i,e.focusManagerProps?.disabled,o]),d.useEffect(()=>{(m==="initial"||m==="open")&&b.current?.innerHTML&&(g.current=b.current.innerHTML)},[m,e.reference,e.children]),!c)return!1;let x={...e.elementProps,style:{display:"flex",...e.elementProps?.style,zIndex:`calc(var(--bn-ui-base-z-index, 0) + ${e.elementProps?.style?.zIndex||0})`,...s,...u},...p()};return m==="close"?r.jsx(ve,{root:t,children:r.jsx("div",{ref:f,...x,dangerouslySetInnerHTML:{__html:g.current}})}):e.focusManagerProps?.disabled?r.jsx(ve,{root:t,children:r.jsx("div",{ref:f,...x,children:e.children})}):r.jsx(ve,{root:t,children:r.jsx(_n,{...e.focusManagerProps,context:a,children:r.jsx("div",{ref:f,...x,children:e.children})})})},St=d.createContext(void 0);function h(){return d.useContext(St)}function k(){return O().editor.dictionary}var Bo=typeof window<"u"?d.useLayoutEffect:d.useEffect,Oo=class{transactionNumber=0;lastTransactionNumber=0;lastSnapshot;editor;subscribers=new Set;constructor(o){this.editor=o,this.lastSnapshot={editor:o,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(o){return this.subscribers.add(o),()=>{this.subscribers.delete(o)}}watch(o,t){if(this.editor=o,this.editor){let n=()=>{this.transactionNumber+=1,this.subscribers.forEach(s=>s())},l=this.editor._tiptapEditor,i={all:["transaction","create","mount","unmount"],mount:["create","mount","unmount"],selection:["selectionUpdate"],change:["update"]};for(let s of i[t])l.on(s,n);return()=>{for(let s of i[t])l.off(s,n)}}}};function E(e){let o=O(),t=e.editor||o?.editor||null,n=e.on||"all",[l]=d.useState(()=>new Oo(t)),i=Zt.useSyncExternalStoreWithSelector(l.subscribe,l.getSnapshot,l.getServerSnapshot,e.selector,e.equalityFn??Rn);return Bo(()=>l.watch(t,n),[t,l,n]),d.useDebugValue(i),i}function q(e){let o=O();return e||=o?.editor,E({editor:e,selector:t=>t.editor?.domElement,equalityFn:(t,n)=>t===n,on:"mount"})}var Fe=e=>{let{position:o,children:t,...n}=e,{from:l,to:i}=o||{},s=v(),a=q();return r.jsx(L,{reference:d.useMemo(()=>{if(!(l===void 0||i===void 0))return{element:a?.firstElementChild||void 0,getBoundingClientRect:()=>En(s.prosemirrorView,l,i??l)}},[s,a,l,i]),...n,children:o!==void 0&&t})},De=(e={},o=[])=>d.useMemo(()=>{let t=Xt.create(e);return window&&(window.ProseMirror=t._tiptapEditor),t},o),Le=e=>{let[o,t]=d.useState(!1),n=E({editor:e.editor,selector:({editor:a})=>a.isEmpty}),l=h(),i=d.useCallback(()=>{t(!0)},[]),s=d.useCallback(()=>{t(!1)},[]);return d.useEffect(()=>{e.editable&&e.autoFocus&&e.editor.focus()},[e.autoFocus,e.editable,e.editor]),r.jsxs(r.Fragment,{children:[r.jsx(l.Comments.Editor,{autoFocus:e.autoFocus,className:"bn-comment-editor",editor:e.editor,onFocus:i,onBlur:s,editable:e.editable}),e.actions&&r.jsx("div",{className:"bn-comment-actions-wrapper",children:r.jsx(e.actions,{isFocused:o,isEmpty:n})})]})},{textColor:ui,backgroundColor:mi,...Fo}=en,Ae=Jt.create({blockSpecs:{paragraph:tn()},styleSpecs:Fo}),Ke=Object.defineProperty,Tt=(e,o)=>{let t={};for(var n in e)Ke(t,n,{get:e[n],enumerable:!0});return Ke(t,Symbol.toStringTag,{value:"Module"}),t},Ce;async function Do(){return Ce||(Ce=(async()=>{let[e,o]=await Promise.all([me(()=>import("./module-RjUF93sV.js"),[]),me(()=>import("./native-48B9X9Wg.js"),[])]),t="default"in e?e.default:e,n="default"in o?o.default:o;return await t.init({data:n}),{emojiMart:t,emojiData:n}})(),Ce)}function Lo(e){let o=d.useRef(null),t=d.useRef(null);return t.current&&t.current.update(e),d.useEffect(()=>((async()=>{let{emojiMart:n}=await Do();t.current=new n.Picker({...e,ref:o})})(),()=>{t.current=null}),[]),pe.createElement("div",{ref:o})}var Qe=e=>{let[o,t]=d.useState(!1),n=h(),l=O(),i=l.editor?.portalElement;if(!i)throw Error("Portal root not found");return r.jsxs(n.Generic.Popover.Root,{open:o,portalRoot:i,children:[r.jsx(n.Generic.Popover.Trigger,{children:r.jsx("div",{onClick:s=>{s.preventDefault(),s.stopPropagation(),t(!o),e.onOpenChange?.(!o)},style:{display:"flex",justifyContent:"center",alignItems:"center"},children:e.children})}),r.jsx(n.Generic.Popover.Content,{className:"bn-emoji-picker-popover",variant:"panel-popover",children:r.jsx(Lo,{perLine:7,onClickOutside:()=>{t(!1),e.onOpenChange?.(!1)},onEmojiSelect:s=>{e.onEmojiSelect(s),t(!1),e.onOpenChange?.(!1)},theme:l?.colorSchemePreference})})]})};function _t(e){return fe([e]).get(e)}function fe(e){let o=w(B).userStore,t=d.useCallback(()=>{let l=new Map;for(let i of e){let s=o.getUser(i);s&&l.set(i,s)}return l},[o,e]),n=d.useMemo(()=>({current:t()}),[t]);return d.useSyncExternalStore(d.useCallback(l=>{let i=o.subscribe(s=>{n.current=t(),l()});return o.loadUsers(e),i},[o,t,e,n]),()=>n.current)}var Ao=e=>{let o=h(),t=k(),n=w(B),l=e.comment.reactions.find(c=>c.emoji===e.emoji);if(!l)throw Error("Trying to render reaction badge for non-existing reaction");let[i,s]=d.useState([]),a=fe(i);return r.jsx(o.Generic.Badge.Root,{className:R("bn-badge","bn-comment-reaction"),text:l.userIds.length.toString(),icon:l.emoji,isSelected:n.threadStore.auth.canDeleteReaction(e.comment,l.emoji),onClick:()=>e.onReactionSelect(l.emoji),onMouseEnter:()=>s(l.userIds),mainTooltip:t.comments.reactions.reacted_by,secondaryTooltip:`${Array.from(a.values()).map(c=>c.username).join(`
1
+ import{r as d,j as r,w as Zt,b as pe,a as ae}from"./floating-ui.react-dom-BWTnA00G.js";import{$ as Xt,q as Jt,U as en,s as tn,v as B,w as R,L as nn,I as on,P as z,D as P,n as Y,Z as U,a as S,C as ge,K as ie,M as Z,b as rn,O as ln,i as be,c as D,Y as _e,V as Ge,d as an,o as sn,e as et,A as cn,x as tt,f as nt,u as dn,g as un,N as X,W as mn,T as ot,H as pn,r as $e,h as gn,j as bn,k as fn,l as hn,m as xn,F as j,p as Re}from"./note-core-DUTqUh5N.js";import{aL as vn,aM as Cn,aN as Me,aO as kn,aP as jn,aQ as wn,aR as yn,aS as Sn,aT as Tn,aU as ve,aV as _n,aW as Rn,I as En,aX as He,aY as In,aZ as Mn,a_ as Pn,a$ as Nn,b0 as Bn,b1 as A,b2 as J,b3 as ee,T as On,b4 as rt,b5 as se,b6 as Fn,b7 as Dn,b8 as Ln,b9 as An,ba as zn,bb as Gn,bc as $n,bd as Hn,be as Pe,bf as lt,bg as it,bh as at,bi as st,bj as ct,bk as ce,bl as de,bm as ue,bn as dt,bo as ut,bp as mt,bq as pt,br as Ue,bs as Un,bt as Ve,bu as Vn,bv as qn,bw as Kn,bx as Qn,by as Wn,bz as Yn,bA as Zn,bB as Xn,bC as Jn,bD as eo,bE as to,bF as no,bG as oo,bH as ro,bI as gt,bJ as bt,bK as lo,bL as io,bM as ao,bN as ft,bO as so,bP as co,bQ as uo,bR as mo,bS as po,bT as ht,bU as xt,N as go,bV as bo,bW as fo,bX as ho,bY as $,bZ as vt,b_ as xo,b$ as M,c0 as N,c1 as V,c2 as vo,c3 as Ct,c4 as Ne,c5 as kt,c6 as Co,c7 as ko,c8 as Be,c9 as jo,ca as wo,cb as yo,cc as So,cd as jt,ce as wt,cf as Oe,cg as To,ch as _o,ci as oe,cj as Ro,ck as qe,cl as Eo,cm as Io}from"./note-runtime-zN5ddTba.js";import{_ as me}from"./preload-helper-BXl3LOEh.js";import{c as Mo}from"./time-D5LRMumI.js";var yt=d.createContext(void 0);function O(e){return d.useContext(yt)}function v(e){let o=O();if(!o?.editor)throw Error("useBlockNoteEditor was called outside of a BlockNoteContext provider or BlockNoteView component");return o.editor}function w(e,o){let t=(o?.editor??v()).getExtension(e);if(!t)throw Error("Extension not found",{cause:{plugin:e}});return t}function y(e,o){let{store:t}=w(e,o);if(!t)throw Error("Store not found on plugin",{cause:{plugin:e}});return vn(t,o?.selector)}function Po(e){let o=new DOMRect,t="getBoundingClientRect"in e?()=>e.getBoundingClientRect():()=>e.element.getBoundingClientRect();return()=>e.element&&(e.cacheMountedBoundingClientRect??!0)?(e.element.isConnected&&(o=t()),o):t()}function No(e,o){return e?o?(t,n,l)=>{let i=e(t,n,l),s=o(t,n,l);return()=>{i?.(),s?.()}}:e:o}var L=e=>{let o=v(),t=o?.portalElement;if(!t)throw Error("Portal element not found");let{whileElementsMounted:n,...l}=e.useFloatingOptions??{},{refs:i,floatingStyles:s,context:a}=Cn({whileElementsMounted:No(Me,e.useFloatingOptions?.whileElementsMounted),...l}),{isMounted:c,styles:u}=kn(a,e.useTransitionStylesProps),{status:m}=jn(a,e.useTransitionStatusProps),{getFloatingProps:p}=wn([yn(a,e.useDismissProps),Sn(a,{enabled:!1,...e.useHoverProps})]),g=d.useRef(""),b=d.useRef(null),f=Tn([b,i.setFloating]);if(d.useEffect(()=>{if(e.reference){let C="element"in e.reference?e.reference.element:void 0;C!==void 0&&(e.focusManagerProps?.disabled||!o.isWithinEditor(C))&&i.setReference(C),i.setPositionReference({getBoundingClientRect:Po(e.reference),contextElement:C})}},[e.reference,i,e.focusManagerProps?.disabled,o]),d.useEffect(()=>{(m==="initial"||m==="open")&&b.current?.innerHTML&&(g.current=b.current.innerHTML)},[m,e.reference,e.children]),!c)return!1;let x={...e.elementProps,style:{display:"flex",...e.elementProps?.style,zIndex:`calc(var(--bn-ui-base-z-index, 0) + ${e.elementProps?.style?.zIndex||0})`,...s,...u},...p()};return m==="close"?r.jsx(ve,{root:t,children:r.jsx("div",{ref:f,...x,dangerouslySetInnerHTML:{__html:g.current}})}):e.focusManagerProps?.disabled?r.jsx(ve,{root:t,children:r.jsx("div",{ref:f,...x,children:e.children})}):r.jsx(ve,{root:t,children:r.jsx(_n,{...e.focusManagerProps,context:a,children:r.jsx("div",{ref:f,...x,children:e.children})})})},St=d.createContext(void 0);function h(){return d.useContext(St)}function k(){return O().editor.dictionary}var Bo=typeof window<"u"?d.useLayoutEffect:d.useEffect,Oo=class{transactionNumber=0;lastTransactionNumber=0;lastSnapshot;editor;subscribers=new Set;constructor(o){this.editor=o,this.lastSnapshot={editor:o,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(o){return this.subscribers.add(o),()=>{this.subscribers.delete(o)}}watch(o,t){if(this.editor=o,this.editor){let n=()=>{this.transactionNumber+=1,this.subscribers.forEach(s=>s())},l=this.editor._tiptapEditor,i={all:["transaction","create","mount","unmount"],mount:["create","mount","unmount"],selection:["selectionUpdate"],change:["update"]};for(let s of i[t])l.on(s,n);return()=>{for(let s of i[t])l.off(s,n)}}}};function E(e){let o=O(),t=e.editor||o?.editor||null,n=e.on||"all",[l]=d.useState(()=>new Oo(t)),i=Zt.useSyncExternalStoreWithSelector(l.subscribe,l.getSnapshot,l.getServerSnapshot,e.selector,e.equalityFn??Rn);return Bo(()=>l.watch(t,n),[t,l,n]),d.useDebugValue(i),i}function q(e){let o=O();return e||=o?.editor,E({editor:e,selector:t=>t.editor?.domElement,equalityFn:(t,n)=>t===n,on:"mount"})}var Fe=e=>{let{position:o,children:t,...n}=e,{from:l,to:i}=o||{},s=v(),a=q();return r.jsx(L,{reference:d.useMemo(()=>{if(!(l===void 0||i===void 0))return{element:a?.firstElementChild||void 0,getBoundingClientRect:()=>En(s.prosemirrorView,l,i??l)}},[s,a,l,i]),...n,children:o!==void 0&&t})},De=(e={},o=[])=>d.useMemo(()=>{let t=Xt.create(e);return window&&(window.ProseMirror=t._tiptapEditor),t},o),Le=e=>{let[o,t]=d.useState(!1),n=E({editor:e.editor,selector:({editor:a})=>a.isEmpty}),l=h(),i=d.useCallback(()=>{t(!0)},[]),s=d.useCallback(()=>{t(!1)},[]);return d.useEffect(()=>{e.editable&&e.autoFocus&&e.editor.focus()},[e.autoFocus,e.editable,e.editor]),r.jsxs(r.Fragment,{children:[r.jsx(l.Comments.Editor,{autoFocus:e.autoFocus,className:"bn-comment-editor",editor:e.editor,onFocus:i,onBlur:s,editable:e.editable}),e.actions&&r.jsx("div",{className:"bn-comment-actions-wrapper",children:r.jsx(e.actions,{isFocused:o,isEmpty:n})})]})},{textColor:ui,backgroundColor:mi,...Fo}=en,Ae=Jt.create({blockSpecs:{paragraph:tn()},styleSpecs:Fo}),Ke=Object.defineProperty,Tt=(e,o)=>{let t={};for(var n in e)Ke(t,n,{get:e[n],enumerable:!0});return Ke(t,Symbol.toStringTag,{value:"Module"}),t},Ce;async function Do(){return Ce||(Ce=(async()=>{let[e,o]=await Promise.all([me(()=>import("./module-RjUF93sV.js"),[]),me(()=>import("./native-48B9X9Wg.js"),[])]),t="default"in e?e.default:e,n="default"in o?o.default:o;return await t.init({data:n}),{emojiMart:t,emojiData:n}})(),Ce)}function Lo(e){let o=d.useRef(null),t=d.useRef(null);return t.current&&t.current.update(e),d.useEffect(()=>((async()=>{let{emojiMart:n}=await Do();t.current=new n.Picker({...e,ref:o})})(),()=>{t.current=null}),[]),pe.createElement("div",{ref:o})}var Qe=e=>{let[o,t]=d.useState(!1),n=h(),l=O(),i=l.editor?.portalElement;if(!i)throw Error("Portal root not found");return r.jsxs(n.Generic.Popover.Root,{open:o,portalRoot:i,children:[r.jsx(n.Generic.Popover.Trigger,{children:r.jsx("div",{onClick:s=>{s.preventDefault(),s.stopPropagation(),t(!o),e.onOpenChange?.(!o)},style:{display:"flex",justifyContent:"center",alignItems:"center"},children:e.children})}),r.jsx(n.Generic.Popover.Content,{className:"bn-emoji-picker-popover",variant:"panel-popover",children:r.jsx(Lo,{perLine:7,onClickOutside:()=>{t(!1),e.onOpenChange?.(!1)},onEmojiSelect:s=>{e.onEmojiSelect(s),t(!1),e.onOpenChange?.(!1)},theme:l?.colorSchemePreference})})]})};function _t(e){return fe([e]).get(e)}function fe(e){let o=w(B).userStore,t=d.useCallback(()=>{let l=new Map;for(let i of e){let s=o.getUser(i);s&&l.set(i,s)}return l},[o,e]),n=d.useMemo(()=>({current:t()}),[t]);return d.useSyncExternalStore(d.useCallback(l=>{let i=o.subscribe(s=>{n.current=t(),l()});return o.loadUsers(e),i},[o,t,e,n]),()=>n.current)}var Ao=e=>{let o=h(),t=k(),n=w(B),l=e.comment.reactions.find(c=>c.emoji===e.emoji);if(!l)throw Error("Trying to render reaction badge for non-existing reaction");let[i,s]=d.useState([]),a=fe(i);return r.jsx(o.Generic.Badge.Root,{className:R("bn-badge","bn-comment-reaction"),text:l.userIds.length.toString(),icon:l.emoji,isSelected:n.threadStore.auth.canDeleteReaction(e.comment,l.emoji),onClick:()=>e.onReactionSelect(l.emoji),onMouseEnter:()=>s(l.userIds),mainTooltip:t.comments.reactions.reacted_by,secondaryTooltip:`${Array.from(a.values()).map(c=>c.username).join(`
2
2
  `)}`},l.emoji)},Rt=({comment:e,thread:o,showResolveButton:t})=>{let n=w(B),l=k(),i=De({initialContent:e.body,trailingBlock:!1,dictionary:{...l,placeholders:{emptyDocument:l.placeholders.edit_comment}},schema:n.commentEditorSchema||Ae}),s=h(),[a,c]=d.useState(!1),[u,m]=d.useState(!1),p=n.threadStore,g=d.useCallback(()=>{c(!0)},[]),b=d.useCallback(()=>{i.replaceBlocks(i.document,e.body),c(!1)},[i,e.body]),f=d.useCallback(async _=>{await p.updateComment({commentId:e.id,comment:{body:i.document},threadId:o.id}),c(!1)},[e,o.id,i,p]),x=d.useCallback(async()=>{await p.deleteComment({commentId:e.id,threadId:o.id})},[e,o.id,p]),C=d.useCallback(async _=>{p.auth.canAddReaction(e,_)?await p.addReaction({threadId:o.id,commentId:e.id,emoji:_}):p.auth.canDeleteReaction(e,_)&&await p.deleteReaction({threadId:o.id,commentId:e.id,emoji:_})},[p,e,o.id]),T=d.useCallback(async()=>{await p.resolveThread({threadId:o.id})},[o.id,p]),I=d.useCallback(async()=>{await p.unresolveThread({threadId:o.id})},[o.id,p]),F=_t(e.userId);if(!e.body)return null;let Q,te=p.auth.canAddReaction(e),K=p.auth.canDeleteComment(e),ne=p.auth.canUpdateComment(e),xe=t&&(o.resolved?p.auth.canUnresolveThread(o):p.auth.canResolveThread(o));a||(Q=r.jsxs(s.Generic.Toolbar.Root,{className:R("bn-action-toolbar","bn-comment-actions"),variant:"action-toolbar",children:[te&&r.jsx(Qe,{onEmojiSelect:_=>C(_.native),onOpenChange:m,children:r.jsx(s.Generic.Toolbar.Button,{mainTooltip:l.comments.actions.add_reaction,variant:"compact",children:r.jsx(He,{size:16})},"add-reaction")}),xe&&(o.resolved?r.jsx(s.Generic.Toolbar.Button,{mainTooltip:"Re-open",variant:"compact",onClick:I,children:r.jsx(In,{size:16})},"reopen"):r.jsx(s.Generic.Toolbar.Button,{mainTooltip:l.comments.actions.resolve,variant:"compact",onClick:T,children:r.jsx(Mn,{size:16})},"resolve")),(K||ne)&&r.jsxs(s.Generic.Menu.Root,{position:"bottom-start",children:[r.jsx(s.Generic.Menu.Trigger,{children:r.jsx(s.Generic.Toolbar.Button,{mainTooltip:l.comments.actions.more_actions,variant:"compact",children:r.jsx(Pn,{size:16})},"more-actions")}),r.jsxs(s.Generic.Menu.Dropdown,{className:"bn-menu-dropdown",children:[ne&&r.jsx(s.Generic.Menu.Item,{icon:r.jsx(Nn,{}),onClick:g,children:l.comments.actions.edit_comment},"edit-comment"),K&&r.jsx(s.Generic.Menu.Item,{icon:r.jsx(Bn,{}),onClick:x,children:l.comments.actions.delete_comment},"delete-comment")]})]})]}));let G=e.createdAt.toLocaleDateString(void 0,{month:"short",day:"numeric"});if(!e.body)throw Error("soft deletes are not yet supported");return r.jsx(s.Comments.Comment,{authorInfo:F??"loading",timeString:G,edited:e.updatedAt.getTime()!==e.createdAt.getTime(),showActions:"hover",actions:Q,className:"bn-thread-comment",emojiPickerOpen:u,children:r.jsx(Le,{autoFocus:a,editor:i,editable:a,actions:e.reactions.length>0||a?({isEmpty:_})=>r.jsxs(r.Fragment,{children:[e.reactions.length>0&&!a&&r.jsxs(s.Generic.Badge.Group,{className:R("bn-badge-group","bn-comment-reactions"),children:[e.reactions.map(H=>r.jsx(Ao,{comment:e,emoji:H.emoji,onReactionSelect:C},H.emoji)),te&&r.jsx(Qe,{onEmojiSelect:H=>C(H.native),onOpenChange:m,children:r.jsx(s.Generic.Badge.Root,{className:R("bn-badge","bn-comment-add-reaction"),text:"+",icon:r.jsx(He,{size:16}),mainTooltip:l.comments.actions.add_reaction})})]}),a&&r.jsxs(s.Generic.Toolbar.Root,{variant:"action-toolbar",className:R("bn-action-toolbar","bn-comment-actions"),children:[r.jsx(s.Generic.Toolbar.Button,{mainTooltip:l.comments.save_button_text,variant:"compact",onClick:f,isDisabled:_,children:l.comments.save_button_text}),r.jsx(s.Generic.Toolbar.Button,{className:"bn-button",mainTooltip:l.comments.cancel_button_text,variant:"compact",onClick:b,children:l.comments.cancel_button_text})]})]}):void 0})})},Et=({thread:e,maxCommentsBeforeCollapse:o})=>{let t=h(),n=k(),l=fe(e.resolvedBy?[e.resolvedBy]:[]),i=e.comments.map((s,a)=>r.jsx(Rt,{thread:e,comment:s,showResolveButton:a===0},s.id+JSON.stringify(s.body||"{}")));if(e.resolved&&e.resolvedUpdatedAt&&e.resolvedBy){if(!l.get(e.resolvedBy))throw Error(`User ${e.resolvedBy} resolved thread ${e.id}, but their data could not be found.`);let s=e.comments.findLastIndex(a=>e.resolvedUpdatedAt.getTime()>a.createdAt.getTime())+1;i.splice(s,0,r.jsx(t.Comments.Comment,{className:"bn-thread-comment",authorInfo:e.resolvedBy&&l.get(e.resolvedBy)||"loading",timeString:e.resolvedUpdatedAt.toLocaleDateString(void 0,{month:"short",day:"numeric"}),edited:!1,showActions:!1,children:r.jsx("div",{className:"bn-resolved-text",children:n.comments.sidebar.marked_as_resolved})},"resolved-comment"))}return o&&i.length>o&&i.splice(1,i.length-2,r.jsx(t.Comments.ExpandSectionsPrompt,{className:"bn-thread-expand-prompt",children:n.comments.sidebar.more_replies(e.comments.length-2)},"expand-prompt")),i},ze=({thread:e,selected:o,referenceText:t,maxCommentsBeforeCollapse:n,onFocus:l,onBlur:i,tabIndex:s})=>{let a=h(),c=k(),u=w(B),m=De({trailingBlock:!1,dictionary:{...c,placeholders:{emptyDocument:c.placeholders.comment_reply}},schema:u.commentEditorSchema||Ae}),p=d.useCallback(async()=>{await u.threadStore.addComment({comment:{body:m.document},threadId:e.id}),m.removeBlocks(m.document)},[u,m,e.id]);return r.jsxs(a.Comments.Card,{className:"bn-thread",headerText:t,onFocus:l,onBlur:i,selected:o,tabIndex:s,children:[r.jsx(a.Comments.CardSection,{className:"bn-thread-comments",children:r.jsx(Et,{thread:e,maxCommentsBeforeCollapse:o?void 0:n||5})}),o&&r.jsx(a.Comments.CardSection,{className:"bn-thread-composer",children:r.jsx(Le,{autoFocus:!1,editable:!0,editor:m,actions:({isEmpty:g})=>g?null:r.jsx(a.Generic.Toolbar.Root,{variant:"action-toolbar",className:R("bn-action-toolbar","bn-comment-actions"),children:r.jsx(a.Generic.Toolbar.Button,{mainTooltip:c.comments.save_button_text,variant:"compact",isDisabled:g,onClick:p,children:c.comments.save_button_text})})})})]})};function It(){let e=w(B).threadStore,o=d.useRef(void 0);return o.current||=e.getThreads(),d.useSyncExternalStore(d.useCallback(t=>e.subscribe(n=>{o.current=n,t()}),[e]),()=>o.current)}var zo=Tt({default:()=>Mt});function Mt(e){let o=v(),t=w(B),n=y(B,{editor:o,selector:c=>c.selectedThreadId?{id:c.selectedThreadId,position:c.threadPositions.get(c.selectedThreadId)}:void 0}),l=It(),i=d.useMemo(()=>n?l.get(n.id):void 0,[n,l]),s=d.useMemo(()=>({...e.floatingUIOptions,useFloatingOptions:{open:!!n,onOpenChange:(c,u,m)=>{m==="escape-key"&&o.focus(),c||t.selectThread(void 0)},placement:"bottom",middleware:[A(10),J(),ee()],...e.floatingUIOptions?.useFloatingOptions},focusManagerProps:{disabled:!0,...e.floatingUIOptions?.focusManagerProps},elementProps:{style:{zIndex:30},...e.floatingUIOptions?.elementProps}}),[t,o,e.floatingUIOptions,n]),a=e.floatingThread||ze;return r.jsx(Fe,{position:n?.position,...s,children:i&&r.jsx(a,{thread:i,selected:!0})})}const Go=Object.freeze(Object.defineProperty({__proto__:null,a:Et,c:fe,i:ze,n:zo,o:Rt,r:It,s:_t,t:Mt},Symbol.toStringTag,{value:"Module"}));function Pt(){let e=v(),o=w(B),t=h(),n=k(),l=De({trailingBlock:!1,dictionary:{...n,placeholders:{emptyDocument:n.placeholders.new_comment}},schema:o.commentEditorSchema||Ae});return r.jsx(t.Comments.Card,{className:"bn-thread",children:r.jsx(Le,{autoFocus:!0,editable:!0,editor:l,actions:({isEmpty:i})=>r.jsx(t.Generic.Toolbar.Root,{className:R("bn-action-toolbar","bn-comment-actions"),variant:"action-toolbar",children:r.jsx(t.Generic.Toolbar.Button,{className:"bn-button",mainTooltip:"Save",variant:"compact",isDisabled:i,onClick:async()=>{await o.createThread({initialComment:{body:l.document}}),o.stopPendingComment(),e.transact(s=>{s.setSelection(On.create(s.doc,s.selection.to))}),e.focus()},children:"Save"})})})})}var $o=Tt({default:()=>Nt});function Nt(e){let o=v(),t=w(B),n=y(B,{editor:o,selector:a=>a.pendingComment}),l=E({editor:o,selector:({editor:a})=>n?{from:a.prosemirrorState.selection.from,to:a.prosemirrorState.selection.to}:void 0}),i=d.useMemo(()=>({...e.floatingUIOptions,useFloatingOptions:{open:!!n,onOpenChange:a=>{a||(t.stopPendingComment(),o.focus())},placement:"bottom",middleware:[A(10),J(),ee()],...e.floatingUIOptions?.useFloatingOptions},focusManagerProps:{disabled:!1},elementProps:{style:{zIndex:60},...e.floatingUIOptions?.elementProps}}),[t,o,n,e.floatingUIOptions]),s=e.floatingComposer||Pt;return r.jsx(Fe,{position:l,...i,children:r.jsx(s,{})})}const Ho=Object.freeze(Object.defineProperty({__proto__:null,n:$o,r:Pt,t:Nt},Symbol.toStringTag,{value:"Module"}));var Bt=e=>{let{blockId:o,children:t,...n}=e,l=v();return r.jsx(L,{reference:d.useMemo(()=>l.transact(i=>{if(!o)return;let s=et(o,i.doc);if(!s)return;let{node:a}=l.prosemirrorView.domAtPos(s.posBeforeNode+1);if(a instanceof Element)return{element:a}}),[l,o]),...n,children:o!==void 0&&t})},Uo=e=>{let o=h(),t=k(),n=v(),l=n.getBlock(e.blockId),[i,s]=d.useState(""),a=d.useCallback(m=>{s(m.currentTarget.value)},[]),c=d.useCallback(m=>{m.key==="Enter"&&!m.nativeEvent.isComposing&&(m.preventDefault(),n.updateBlock(l.id,{props:{name:Ge(i),url:i}}))},[n,l.id,i]),u=d.useCallback(()=>{n.updateBlock(l.id,{props:{name:Ge(i),url:i}})},[n,l.id,i]);return r.jsxs(o.FilePanel.TabPanel,{className:"bn-tab-panel",children:[r.jsx(o.FilePanel.TextInput,{className:"bn-text-input",placeholder:t.file_panel.embed.url_placeholder,value:i,onChange:a,onKeyDown:c,"data-test":"embed-input"}),r.jsx(o.FilePanel.Button,{className:"bn-button",onClick:u,"data-test":"embed-input-button",children:t.file_panel.embed.embed_button[l.type]||t.file_panel.embed.embed_button.file})]})},Vo=e=>{let o=h(),t=k(),{setLoading:n}=e,l=v(),i=l.getBlock(e.blockId),[s,a]=d.useState(!1);d.useEffect(()=>{s&&setTimeout(()=>{a(!1)},3e3)},[s]);let c=d.useCallback(p=>{if(p===null)return;async function g(b){if(n(!0),l.uploadFile!==void 0)try{let f=await l.uploadFile(b,e.blockId);typeof f=="string"&&(f={props:{name:b.name,url:f}}),l.updateBlock(e.blockId,f)}catch{a(!0)}finally{n(!1)}}g(p)},[e.blockId,l,n]),u=l.schema.blockSpecs[i.type],m=u.implementation.meta?.fileBlockAccept?.length?u.implementation.meta.fileBlockAccept.join(","):"*/*";return r.jsxs(o.FilePanel.TabPanel,{className:"bn-tab-panel",children:[r.jsx(o.FilePanel.FileInput,{className:"bn-file-input","data-test":"upload-input",accept:m,placeholder:t.file_panel.upload.file_placeholder[i.type]||t.file_panel.upload.file_placeholder.file,value:null,onChange:c}),s&&r.jsx("div",{className:"bn-error-text",children:t.file_panel.upload.upload_error})]})},Ot=e=>{let o=h(),t=k(),n=v(),[l,i]=d.useState(!1),s=e.tabs??[...n.uploadFile===void 0?[]:[{name:t.file_panel.upload.title,tabPanel:r.jsx(Vo,{blockId:e.blockId,setLoading:i})}],{name:t.file_panel.embed.title,tabPanel:r.jsx(Uo,{blockId:e.blockId})}],[a,c]=d.useState(e.defaultOpenTab||s[0].name);return r.jsx(o.FilePanel.Root,{className:"bn-panel",defaultOpenTab:a,openTab:a,setOpenTab:c,tabs:s,loading:l})},qo=e=>{let o=v(),t=w(_e),n=y(_e),l=d.useMemo(()=>({...e.floatingUIOptions,useFloatingOptions:{open:!!n,onOpenChange:(s,a,c)=>{s||t.closeMenu(),c==="escape-key"&&o.focus()},middleware:[A(10),ee()],...e.floatingUIOptions?.useFloatingOptions},focusManagerProps:{disabled:!0,...e.floatingUIOptions?.focusManagerProps},elementProps:{style:{zIndex:90},...e.floatingUIOptions?.elementProps}}),[n,o,t,e.floatingUIOptions]),i=e.filePanel||Ot;return r.jsx(Bt,{blockId:n,...l,children:n&&r.jsx(i,{blockId:n})})},Ko={bold:Xn,italic:Zn,underline:Yn,strike:Wn,code:Qn};function Qo(e,o){return e in o.schema.styleSchema&&o.schema.styleSchema[e].type===e&&o.schema.styleSchema[e].propSchema==="boolean"}var re=e=>{let o=k(),t=h(),n=v(),l=E({editor:n,selector:({editor:a})=>{if(!(!a.isEditable||!Qo(e.basicTextStyle,a)||!(a.getSelection()?.blocks||[a.getTextCursorPosition().block]).find(c=>c.content!==void 0)))return e.basicTextStyle in a.getActiveStyles()?{active:!0}:{active:!1}}}),i=d.useCallback(a=>{n.focus(),n.toggleStyles({[a]:!0})},[n,e]);if(l===void 0)return null;let s=Ko[e.basicTextStyle];return r.jsx(t.FormattingToolbar.Button,{className:"bn-button","data-test":e.basicTextStyle,onClick:()=>i(e.basicTextStyle),isSelected:l.active,label:o.formatting_toolbar[e.basicTextStyle].tooltip,mainTooltip:o.formatting_toolbar[e.basicTextStyle].tooltip,secondaryTooltip:ge(o.formatting_toolbar[e.basicTextStyle].secondary_tooltip,o.generic.ctrl_shortcut),icon:r.jsx(s,{})})},Ee=e=>{let o=e.textColor||"default",t=e.backgroundColor||"default",n=e.size||16;return r.jsx("div",{className:"bn-color-icon","data-background-color":t,"data-text-color":o,style:d.useMemo(()=>({pointerEvents:"none",fontSize:(n*.75).toString()+"px",height:n.toString()+"px",lineHeight:n.toString()+"px",textAlign:"center",width:n.toString()+"px"}),[n]),children:"A"})},We=["default","gray","brown","red","orange","yellow","green","blue","purple","pink"],he=e=>{let o=h(),t=k();return r.jsxs(r.Fragment,{children:[r.jsx(()=>e.text?r.jsxs(r.Fragment,{children:[r.jsx(o.Generic.Menu.Label,{children:t.color_picker.text_title}),We.map(n=>r.jsx(o.Generic.Menu.Item,{onClick:()=>{e.onClick&&e.onClick(),e.text.setColor(n)},"data-test":"text-color-"+n,icon:r.jsx(Ee,{textColor:n,size:e.iconSize}),checked:e.text.color===n,children:t.color_picker.colors[n]},"text-color-"+n))]}):null,{}),r.jsx(()=>e.background?r.jsxs(r.Fragment,{children:[r.jsx(o.Generic.Menu.Label,{children:t.color_picker.background_title}),We.map(n=>r.jsx(o.Generic.Menu.Item,{onClick:()=>{e.onClick&&e.onClick(),e.background.setColor(n)},"data-test":"background-color-"+n,icon:r.jsx(Ee,{backgroundColor:n,size:e.iconSize}),checked:e.background.color===n,children:t.color_picker.colors[n]},"background-color-"+n))]}):null,{})]})};function le(e,o){return`${e}Color`in o.schema.styleSchema&&o.schema.styleSchema[`${e}Color`].type===`${e}Color`&&o.schema.styleSchema[`${e}Color`].propSchema==="string"}var Wo=()=>{let e=h(),o=k(),t=v(),n=le("text",t),l=le("background",t),i=E({editor:t,selector:({editor:c})=>{if(!c.isEditable||!(c.getSelection()?.blocks||[c.getTextCursorPosition().block]).find(p=>p.content!==void 0))return;let u=le("text",c),m=le("background",c);if(!(!u&&!m))return{textColor:u?c.getActiveStyles().textColor||"default":void 0,backgroundColor:m?c.getActiveStyles().backgroundColor||"default":void 0}}}),s=d.useCallback(c=>{if(!n)throw Error("Tried to set text color, but style does not exist in editor schema.");c==="default"?t.removeStyles({textColor:c}):t.addStyles({textColor:c}),setTimeout(()=>{t.focus()})},[t,n]),a=d.useCallback(c=>{if(!l)throw Error("Tried to set background color, but style does not exist in editor schema.");c==="default"?t.removeStyles({backgroundColor:c}):t.addStyles({backgroundColor:c}),setTimeout(()=>{t.focus()})},[l,t]);return i===void 0?null:r.jsxs(e.Generic.Menu.Root,{children:[r.jsx(e.Generic.Menu.Trigger,{children:r.jsx(e.FormattingToolbar.Button,{className:"bn-button","data-test":"colors",label:o.formatting_toolbar.colors.tooltip,mainTooltip:o.formatting_toolbar.colors.tooltip,icon:r.jsx(Ee,{textColor:i.textColor,backgroundColor:i.backgroundColor,size:20})})}),r.jsx(e.Generic.Menu.Dropdown,{className:"bn-menu-dropdown bn-color-picker-dropdown",children:r.jsx(he,{text:i.textColor?{color:i.textColor,setColor:s}:void 0,background:i.backgroundColor?{color:i.backgroundColor,setColor:a}:void 0})})]})},Ye=e=>{for(let o of an)if(e.startsWith(o))return e;return`${sn}://${e}`},Ft=e=>{let o=h(),t=k(),{editLink:n}=w(be),{url:l,text:i,showTextField:s}=e,[a,c]=d.useState(l),[u,m]=d.useState(i);d.useEffect(()=>{c(l),m(i)},[i,l]);let p=d.useCallback(x=>{x.key==="Enter"&&!x.nativeEvent.isComposing&&(x.preventDefault(),n(Ye(a),u,e.range.from),e.setToolbarOpen?.(!1),e.setToolbarPositionFrozen?.(!1))},[n,a,u,e]),g=d.useCallback(x=>c(x.currentTarget.value),[]),b=d.useCallback(x=>m(x.currentTarget.value),[]),f=d.useCallback(()=>{n(Ye(a),u,e.range.from),e.setToolbarOpen?.(!1),e.setToolbarPositionFrozen?.(!1)},[n,a,u,e]);return r.jsxs(o.Generic.Form.Root,{children:[r.jsx(o.Generic.Form.TextInput,{className:"bn-text-input",name:"url",icon:r.jsx(gt,{}),autoFocus:!0,placeholder:t.link_toolbar.form.url_placeholder,value:a,onKeyDown:p,onChange:g,onSubmit:f}),s!==!1&&r.jsx(o.Generic.Form.TextInput,{className:"bn-text-input",name:"title",icon:r.jsx(Pe,{}),placeholder:t.link_toolbar.form.title_placeholder,value:u,onKeyDown:p,onChange:b,onSubmit:f})]})};function Yo(e){return"link"in e.schema.inlineContentSchema&&e.schema.inlineContentSchema.link==="link"}var Zo=()=>{let e=v(),o=q(),t=h(),n=k(),l=w(Y),{showSelection:i}=w(rn),[s,a]=d.useState(!1);d.useEffect(()=>(i(s,"createLinkButton"),()=>i(!1,"createLinkButton")),[s,i]);let c=E({editor:e,selector:({editor:u})=>{if(!(!u.isEditable||!Yo(u)||ln(u.prosemirrorState.selection)||!(u.getSelection()?.blocks||[u.getTextCursorPosition().block]).find(m=>m.content!==void 0)))return{url:u.getSelectedLinkUrl(),text:u.getSelectedText(),range:{from:u.prosemirrorState.selection.from,to:u.prosemirrorState.selection.to}}}});return d.useEffect(()=>{a(!1)},[c]),d.useEffect(()=>{let u=m=>{(m.ctrlKey||m.metaKey)&&m.key==="k"&&(a(!0),m.preventDefault())};return o?.addEventListener("keydown",u),()=>{o?.removeEventListener("keydown",u)}},[o]),c===void 0?null:r.jsxs(t.Generic.Popover.Root,{open:s,onOpenChange:a,children:[r.jsx(t.Generic.Popover.Trigger,{children:r.jsx(t.FormattingToolbar.Button,{className:"bn-button","data-test":"createLink",label:n.formatting_toolbar.link.tooltip,mainTooltip:n.formatting_toolbar.link.tooltip,secondaryTooltip:ge(n.formatting_toolbar.link.secondary_tooltip,n.generic.ctrl_shortcut),icon:r.jsx(gt,{}),onClick:()=>a(u=>!u)})}),r.jsx(t.Generic.Popover.Content,{className:"bn-popover-content bn-form-popover",variant:"form-popover",children:r.jsx(Ft,{url:c.url||"",text:c.text,range:c.range,showTextField:!1,setToolbarOpen:u=>l.store.setState(u)})})]})},Xo=()=>{let e=k(),o=h(),t=v(),n=E({editor:t,selector:({editor:c})=>{if(!c.isEditable)return;let u=c.getSelection()?.blocks||[c.getTextCursorPosition().block];if(u.length!==1)return;let m=u[0];if(P(m,c,m.type,{url:"string",caption:"string"}))return m}}),[l,i]=d.useState(!1),s=d.useCallback(c=>{n!==void 0&&U(t,n.type,{caption:"string"})&&t.updateBlock(n.id,{props:{caption:c.currentTarget.value}})},[n,t]),a=d.useCallback(c=>{c.key==="Enter"&&!c.nativeEvent.isComposing&&(c.preventDefault(),i(!1))},[]);return n===void 0?null:r.jsxs(o.Generic.Popover.Root,{open:l,onOpenChange:i,children:[r.jsx(o.Generic.Popover.Trigger,{children:r.jsx(o.FormattingToolbar.Button,{className:"bn-button",label:e.formatting_toolbar.file_caption.tooltip,mainTooltip:e.formatting_toolbar.file_caption.tooltip,icon:r.jsx(Ue,{}),onClick:()=>i(c=>!c)})}),r.jsx(o.Generic.Popover.Content,{className:"bn-popover-content bn-form-popover",variant:"form-popover",children:r.jsx(o.Generic.Form.Root,{children:r.jsx(o.Generic.Form.TextInput,{name:"file-caption",icon:r.jsx(Ue,{}),value:n.props.caption,autoFocus:!0,placeholder:e.formatting_toolbar.file_caption.input_placeholder,onKeyDown:a,onChange:s})})})]})},Jo=()=>{let e=k(),o=h(),t=v(),n=E({editor:t,selector:({editor:i})=>{if(!i.isEditable)return;let s=i.getSelection()?.blocks||[i.getTextCursorPosition().block];if(s.length!==1)return;let a=s[0];if(P(a,i,a.type,{url:"string"}))return a}}),l=d.useCallback(()=>{n!==void 0&&(t.focus(),t.removeBlocks([n.id]))},[n,t]);return n===void 0?null:r.jsx(o.FormattingToolbar.Button,{className:"bn-button",label:e.formatting_toolbar.file_delete.tooltip[n.type]||e.formatting_toolbar.file_delete.tooltip.file,mainTooltip:e.formatting_toolbar.file_delete.tooltip[n.type]||e.formatting_toolbar.file_delete.tooltip.file,icon:r.jsx(Vn,{}),onClick:l})},er=()=>{let e=k(),o=h(),t=v(),n=E({editor:t,selector:({editor:c})=>{if(!c.isEditable)return;let u=c.getSelection()?.blocks||[c.getTextCursorPosition().block];if(u.length!==1)return;let m=u[0];if(P(m,c,m.type,{url:"string",name:"string"}))return m}}),[l,i]=d.useState(!1),s=d.useCallback(c=>{n!==void 0&&U(t,n.type,{name:"string"})&&t.updateBlock(n.id,{props:{name:c.currentTarget.value}})},[n,t]),a=d.useCallback(c=>{c.key==="Enter"&&!c.nativeEvent.isComposing&&(c.preventDefault(),i(!1))},[]);return n===void 0?null:r.jsxs(o.Generic.Popover.Root,{open:l,onOpenChange:i,children:[r.jsx(o.Generic.Popover.Trigger,{children:r.jsx(o.FormattingToolbar.Button,{className:"bn-button",label:e.formatting_toolbar.file_rename.tooltip[n.type]||e.formatting_toolbar.file_rename.tooltip.file,mainTooltip:e.formatting_toolbar.file_rename.tooltip[n.type]||e.formatting_toolbar.file_rename.tooltip.file,icon:r.jsx(Ve,{}),onClick:()=>i(c=>!c)})}),r.jsx(o.Generic.Popover.Content,{className:"bn-popover-content bn-form-popover",variant:"form-popover",children:r.jsx(o.Generic.Form.Root,{children:r.jsx(o.Generic.Form.TextInput,{name:"file-name",icon:r.jsx(Ve,{}),value:n.props.name,autoFocus:!0,placeholder:e.formatting_toolbar.file_rename.input_placeholder[n.type]||e.formatting_toolbar.file_rename.input_placeholder.file,onKeyDown:a,onChange:s})})})]})},tr=()=>{let e=k(),o=h(),t=E({editor:v(),selector:({editor:n})=>{if(!n.isEditable)return;let l=n.getSelection()?.blocks||[n.getTextCursorPosition().block];if(l.length!==1)return;let i=l[0];if(P(i,n,i.type,{url:"string"}))return i}});return t===void 0?null:r.jsxs(o.Generic.Popover.Root,{position:"bottom",children:[r.jsx(o.Generic.Popover.Trigger,{children:r.jsx(o.FormattingToolbar.Button,{className:"bn-button",mainTooltip:e.formatting_toolbar.file_replace.tooltip[t.type]||e.formatting_toolbar.file_replace.tooltip.file,label:e.formatting_toolbar.file_replace.tooltip[t.type]||e.formatting_toolbar.file_replace.tooltip.file,icon:r.jsx(Un,{})})}),r.jsx(o.Generic.Popover.Content,{className:"bn-popover-content bn-panel-popover",variant:"panel-popover",children:r.jsx(Ot,{blockId:t.id})})]})},nr=()=>{let e=k(),o=h(),t=v(),n=E({editor:t,selector:({editor:i})=>{if(!(!i.isEditable||!(i.getSelection()?.blocks||[i.getTextCursorPosition().block]).find(s=>s.content!==void 0)))return{canNestBlock:i.canNestBlock()}}}),l=d.useCallback(()=>{n!==void 0&&n.canNestBlock&&(t.focus(),t.nestBlock())},[t,n]);return n===void 0?null:r.jsx(o.FormattingToolbar.Button,{className:"bn-button","data-test":"nestBlock",onClick:l,isDisabled:!n.canNestBlock,label:e.formatting_toolbar.nest.tooltip,mainTooltip:e.formatting_toolbar.nest.tooltip,secondaryTooltip:ge(e.formatting_toolbar.nest.secondary_tooltip,e.generic.ctrl_shortcut),icon:r.jsx(oo,{})})},or=()=>{let e=k(),o=h(),t=v(),n=E({editor:t,selector:({editor:i})=>{if(!(!i.isEditable||!(i.getSelection()?.blocks||[i.getTextCursorPosition().block]).find(s=>s.content!==void 0)))return{canUnnestBlock:i.canUnnestBlock()}}}),l=d.useCallback(()=>{n!==void 0&&n.canUnnestBlock&&(t.focus(),t.unnestBlock())},[t,n]);return n===void 0?null:r.jsx(o.FormattingToolbar.Button,{className:"bn-button","data-test":"unnestBlock",onClick:l,isDisabled:!n.canUnnestBlock,label:e.formatting_toolbar.unnest.tooltip,mainTooltip:e.formatting_toolbar.unnest.tooltip,secondaryTooltip:ge(e.formatting_toolbar.unnest.secondary_tooltip,e.generic.ctrl_shortcut),icon:r.jsx(ro,{})})},rr=e=>[{name:e.slash_menu.paragraph.title,type:"paragraph",icon:Pe},{name:e.slash_menu.heading.title,type:"heading",props:{level:1,isToggleable:!1},icon:ue},{name:e.slash_menu.heading_2.title,type:"heading",props:{level:2,isToggleable:!1},icon:de},{name:e.slash_menu.heading_3.title,type:"heading",props:{level:3,isToggleable:!1},icon:ce},{name:e.slash_menu.heading_4.title,type:"heading",props:{level:4,isToggleable:!1},icon:mt},{name:e.slash_menu.heading_5.title,type:"heading",props:{level:5,isToggleable:!1},icon:ut},{name:e.slash_menu.heading_6.title,type:"heading",props:{level:6,isToggleable:!1},icon:dt},{name:e.slash_menu.toggle_heading.title,type:"heading",props:{level:1,isToggleable:!0},icon:ue},{name:e.slash_menu.toggle_heading_2.title,type:"heading",props:{level:2,isToggleable:!0},icon:de},{name:e.slash_menu.toggle_heading_3.title,type:"heading",props:{level:3,isToggleable:!0},icon:ce},{name:e.slash_menu.quote.title,type:"quote",icon:ct},{name:e.slash_menu.toggle_list.title,type:"toggleListItem",icon:st},{name:e.slash_menu.bullet_list.title,type:"bulletListItem",icon:it},{name:e.slash_menu.numbered_list.title,type:"numberedListItem",icon:at},{name:e.slash_menu.check_list.title,type:"checkListItem",icon:lt}],lr=e=>{let o=h(),t=v(),n=E({editor:t,selector:({editor:a})=>a.getSelection()?.blocks||[a.getTextCursorPosition().block]}),l=n[0],i=d.useMemo(()=>(e.items||rr(t.dictionary)).filter(a=>U(t,a.type,Object.fromEntries(Object.entries(a.props||{}).map(([c,u])=>[c,typeof u])))),[t,e.items]),s=d.useMemo(()=>i.map(a=>{let c=a.icon,u=a.type===l.type,m=Object.entries(a.props||{}).filter(([p,g])=>g!==l.props[p]).length===0;return{text:a.name,icon:r.jsx(c,{size:16}),onClick:()=>{t.focus(),t.transact(()=>{for(let p of n)t.updateBlock(p,{type:a.type,props:a.props})})},isSelected:u&&m}}),[t,i,l.props,l.type,n]);return!d.useMemo(()=>s.find(a=>a.isSelected)!==void 0,[s])||!t.isEditable?null:r.jsx(o.FormattingToolbar.Select,{className:"bn-select",items:s})},ir=()=>{let e=k(),o=h(),t=w("comments"),{store:n}=w(Y),l=d.useCallback(()=>{t.startPendingComment(),n.setState(!1)},[t,n]);return r.jsx(o.FormattingToolbar.Button,{className:"bn-button",label:e.formatting_toolbar.comment.tooltip,mainTooltip:e.formatting_toolbar.comment.tooltip,icon:r.jsx(bt,{}),onClick:l})},ar=()=>v().getExtension("comments")?r.jsx(ir,{}):null,sr=()=>{let e=k(),o=h(),t=v(),n=d.useCallback(()=>{t._tiptapEditor.chain().focus().addPendingComment().run()},[t]);return!t._tiptapEditor.commands.addPendingComment||!t.isEditable?null:r.jsx(o.FormattingToolbar.Button,{className:"bn-button",label:e.formatting_toolbar.comment.tooltip,mainTooltip:e.formatting_toolbar.comment.tooltip,icon:r.jsx(bt,{}),onClick:n})};function Ie(e,o){try{let t=new URL(e,o);if(t.protocol!=="javascript:")return t.href}catch{}return"#"}var cr=()=>{let e=k(),o=h(),t=v(),n=E({editor:t,selector:({editor:i})=>{let s=i.getSelection()?.blocks||[i.getTextCursorPosition().block];if(s.length!==1)return;let a=s[0];if(P(a,i,a.type,{url:"string"}))return a}}),l=d.useCallback(()=>{n!==void 0&&(t.focus(),t.resolveFileUrl?t.resolveFileUrl(n.props.url).then(i=>window.open(Ie(i,window.location.href))):window.open(Ie(n.props.url,window.location.href)))},[n,t]);return n===void 0?null:r.jsx(o.FormattingToolbar.Button,{className:"bn-button",label:e.formatting_toolbar.file_download.tooltip[n.type]||e.formatting_toolbar.file_download.tooltip.file,mainTooltip:e.formatting_toolbar.file_download.tooltip[n.type]||e.formatting_toolbar.file_download.tooltip.file,icon:r.jsx(qn,{}),onClick:l})},dr=()=>{let e=k(),o=h(),t=v(),n=E({editor:t,selector:({editor:i})=>{if(!i.isEditable)return;let s=i.getSelection()?.blocks||[i.getTextCursorPosition().block];if(s.length!==1)return;let a=s[0];if(P(a,i,a.type,{url:"string",showPreview:"boolean"}))return a}}),l=d.useCallback(()=>{n!==void 0&&U(t,n.type,{showPreview:"boolean"})&&t.updateBlock(n.id,{props:{showPreview:!n.props.showPreview}})},[n,t]);return n===void 0?null:r.jsx(o.FormattingToolbar.Button,{className:"bn-button",label:"Toggle preview",mainTooltip:e.formatting_toolbar.file_preview_toggle.tooltip,icon:r.jsx(Kn,{}),isSelected:n.props.showPreview,onClick:l})},ur=()=>{let e=k(),o=h(),t=v(),n=w(S),l=E({editor:t,selector:({editor:s})=>{if(!s.isEditable||!s.settings.tables.splitCells)return;let a=s.getSelection()?.blocks||[s.getTextCursorPosition().block];if(a.length!==1)return;let c=a[0];if(c.type==="table")return{mergeDirection:n.getMergeDirection(c)}}}),i=d.useCallback(()=>{n?.mergeCells()},[n]);return l===void 0?null:r.jsx(o.FormattingToolbar.Button,{className:"bn-button",label:e.formatting_toolbar.table_cell_merge.tooltip,mainTooltip:e.formatting_toolbar.table_cell_merge.tooltip,icon:l.mergeDirection==="horizontal"?r.jsx(lo,{}):r.jsx(io,{}),onClick:i})},mr=()=>v().getExtension(S)?r.jsx(ur,{}):null,pr={left:no,center:to,right:eo,justify:Jn},ke=e=>{let o=h(),t=k(),n=v(),l=E({editor:n,selector:({editor:a})=>{if(!a.isEditable)return;let c=a.getSelection()?.blocks||[a.getTextCursorPosition().block],u=c[0];if(P(u,a,u.type,{textAlignment:ie.textAlignment}))return{textAlignment:u.props.textAlignment,blocks:c};if(c.length===1&&P(u,a,"table"))return a.getExtension(S)?.getCellSelection()?{textAlignment:Z(u.content.rows[0].cells[0]).props.textAlignment,blocks:[u]}:void 0}}),i=d.useCallback(a=>{if(l!==void 0){n.focus();for(let c of l.blocks)if(P(c,n,c.type,{textAlignment:ie.textAlignment})&&U(n,c.type,{textAlignment:ie.textAlignment}))n.updateBlock(c,{props:{textAlignment:a}});else if(c.type==="table"){let u=n.getExtension(S)?.getCellSelection();if(!u)continue;let m=c.content.rows.map(p=>({...p,cells:p.cells.map(g=>Z(g))}));u.cells.forEach(({row:p,col:g})=>{m[p].cells[g].props.textAlignment=a}),n.updateBlock(c,{type:"table",content:{...c.content,type:"tableContent",rows:m}}),n.setTextCursorPosition(c)}}},[n,l]);if(l===void 0)return null;let s=pr[e.textAlignment];return r.jsx(o.FormattingToolbar.Button,{className:"bn-button","data-test":`alignText${e.textAlignment.slice(0,1).toUpperCase()+e.textAlignment.slice(1)}`,onClick:()=>i(e.textAlignment),isSelected:l.textAlignment===e.textAlignment,label:t.formatting_toolbar[`align_${e.textAlignment}`].tooltip,mainTooltip:t.formatting_toolbar[`align_${e.textAlignment}`].tooltip,icon:r.jsx(s,{})})},Dt=e=>[r.jsx(lr,{items:e},"blockTypeSelect"),r.jsx(mr,{},"tableCellMergeButton"),r.jsx(Xo,{},"fileCaptionButton"),r.jsx(tr,{},"replaceFileButton"),r.jsx(er,{},"fileRenameButton"),r.jsx(Jo,{},"fileDeleteButton"),r.jsx(cr,{},"fileDownloadButton"),r.jsx(dr,{},"filePreviewButton"),r.jsx(re,{basicTextStyle:"bold"},"boldStyleButton"),r.jsx(re,{basicTextStyle:"italic"},"italicStyleButton"),r.jsx(re,{basicTextStyle:"underline"},"underlineStyleButton"),r.jsx(re,{basicTextStyle:"strike"},"strikeStyleButton"),r.jsx(ke,{textAlignment:"left"},"textAlignLeftButton"),r.jsx(ke,{textAlignment:"center"},"textAlignCenterButton"),r.jsx(ke,{textAlignment:"right"},"textAlignRightButton"),r.jsx(Wo,{},"colorStyleButton"),r.jsx(nr,{},"nestBlockButton"),r.jsx(or,{},"unnestBlockButton"),r.jsx(Zo,{},"createLinkButton"),r.jsx(ar,{},"addCommentButton"),r.jsx(sr,{},"addTiptapCommentButton")],Lt=e=>r.jsx(h().FormattingToolbar.Root,{className:"bn-toolbar bn-formatting-toolbar",children:e.children||Dt(e.blockTypeSelectItems)}),gr=e=>{switch(e){case"left":return"top-start";case"center":return"top";case"right":return"top-end";default:return"top-start"}},At=e=>{let o=v(),t=w(Y,{editor:o}),n=y(Y,{editor:o}),l=E({editor:o,selector:({editor:c})=>t.store.state?{from:c.prosemirrorState.selection.from,to:c.prosemirrorState.selection.to}:void 0}),i=E({editor:o,selector:({editor:c})=>{let u=c.getTextCursorPosition().block;return P(u,c,u.type,{textAlignment:ie.textAlignment})?gr(u.props.textAlignment):"top-start"}}),s=d.useMemo(()=>({...e.floatingUIOptions,useFloatingOptions:{open:n,onOpenChange:(c,u,m)=>{t.store.setState(c),m==="escape-key"&&o.focus()},placement:i,middleware:[A(10),J(),ee()],...e.floatingUIOptions?.useFloatingOptions},focusManagerProps:{disabled:!0,...e.floatingUIOptions?.focusManagerProps},elementProps:{style:{zIndex:40},...e.floatingUIOptions?.elementProps}}),[n,i,e.floatingUIOptions,t.store,o]),a=e.formattingToolbar||Lt;return r.jsx(Fe,{position:l,...s,children:n&&r.jsx(a,{})})},br=e=>{let o=h(),t=k(),{deleteLink:n}=w(be);return r.jsx(o.LinkToolbar.Button,{className:"bn-button",label:t.link_toolbar.delete.tooltip,mainTooltip:t.link_toolbar.delete.tooltip,isSelected:!1,onClick:()=>{n(e.range.from),e.setToolbarOpen?.(!1)},icon:r.jsx(mo,{})})},fr=e=>{let o=h(),t=k();return r.jsxs(o.Generic.Popover.Root,{onOpenChange:e.setToolbarPositionFrozen,children:[r.jsx(o.Generic.Popover.Trigger,{children:r.jsx(o.LinkToolbar.Button,{className:"bn-button",mainTooltip:t.link_toolbar.edit.tooltip,isSelected:!1,children:t.link_toolbar.edit.text})}),r.jsx(o.Generic.Popover.Content,{className:"bn-popover-content bn-form-popover",variant:"form-popover",children:r.jsx(Ft,{url:e.url,text:e.text,range:e.range,setToolbarOpen:e.setToolbarOpen,setToolbarPositionFrozen:e.setToolbarPositionFrozen})})]})},hr=e=>{let o=h(),t=k();return r.jsx(o.LinkToolbar.Button,{className:"bn-button",mainTooltip:t.link_toolbar.open.tooltip,label:t.link_toolbar.open.tooltip,isSelected:!1,onClick:()=>{window.open(Ie(e.url,window.location.href),"_blank")},icon:r.jsx(uo,{})})},xr=e=>r.jsx(h().LinkToolbar.Root,{className:"bn-toolbar bn-link-toolbar",children:e.children||r.jsxs(r.Fragment,{children:[r.jsx(fr,{url:e.url,text:e.text,range:e.range,setToolbarOpen:e.setToolbarOpen,setToolbarPositionFrozen:e.setToolbarPositionFrozen}),r.jsx(hr,{url:e.url}),r.jsx(br,{range:e.range,setToolbarOpen:e.setToolbarOpen})]})}),vr=e=>{let o=v(),[t,n]=d.useState(!1),[l,i]=d.useState(!1),s=q(),a=w(be),[c,u]=d.useState(void 0);d.useEffect(()=>{let b=()=>{let T=a.getLinkAtSelection();if(!T){u(void 0),l||n(!1);return}u({cursorType:"text",url:T.mark.attrs.href,text:T.text,range:T.range,element:a.getLinkElementAtPos(T.range.from)}),l||n(!0)},f=T=>{if(c!==void 0&&c.cursorType==="text"||!(T.target instanceof HTMLElement))return;let I=a.getLinkAtElement(T.target);I&&u({cursorType:"mouse",url:I.mark.attrs.href,text:I.text,range:I.range,element:a.getLinkElementAtPos(I.range.from)})},x=o.onChange(b),C=o.onSelectionChange(b);return s?.addEventListener("mouseover",f),()=>{x(),C(),s?.removeEventListener("mouseover",f)}},[o,s,a,c,l]);let m=d.useMemo(()=>({...e.floatingUIOptions,useFloatingOptions:{open:t,onOpenChange:(b,f,x)=>{l||c!==void 0&&c.cursorType==="text"&&x==="hover"||(x==="escape-key"&&o.focus(),n(b))},placement:"top-start",middleware:[A(10),ee()],...e.floatingUIOptions?.useFloatingOptions},useHoverProps:{enabled:c!==void 0&&c.cursorType==="mouse",delay:{open:250,close:250},handleClose:ao(),...e.floatingUIOptions?.useHoverProps},focusManagerProps:{disabled:!0,...e.floatingUIOptions?.focusManagerProps},elementProps:{style:{zIndex:50},...e.floatingUIOptions?.elementProps}}),[o,c,e.floatingUIOptions,t,l]),p=d.useMemo(()=>c?.element?{element:c.element}:void 0,[c?.element]);if(!o.isEditable)return null;let g=e.linkToolbar||xr;return r.jsx(L,{reference:p,...m,children:c&&r.jsx(g,{url:c.url,text:c.text,range:c.range,setToolbarOpen:n,setToolbarPositionFrozen:i})})},Cr=()=>{let e=h(),o=k(),t=v(),n=w(z),l=y(D,{editor:t,selector:s=>s?.block}),i=d.useCallback(()=>{if(l===void 0)return;let s=l.content;if(s!==void 0&&Array.isArray(s)&&s.length===0)t.setTextCursorPosition(l),n.openSuggestionMenu("/");else{let a=t.insertBlocks([{type:"paragraph"}],l,"after")[0];t.setTextCursorPosition(a),n.openSuggestionMenu("/")}},[l,t,n]);return l===void 0?null:r.jsx(e.SideMenu.Button,{className:"bn-button",label:o.side_menu.add_block_label,icon:r.jsx(po,{size:24,onClick:i,"data-test":"dragHandleAdd"})})},kr=e=>{let o=h(),t=v(),n=y(D,{editor:t,selector:l=>l?.block});return n===void 0||!P(n,t,n.type,{textColor:"string"})&&!P(n,t,n.type,{backgroundColor:"string"})?null:r.jsxs(o.Generic.Menu.Root,{position:"right",sub:!0,children:[r.jsx(o.Generic.Menu.Trigger,{sub:!0,children:r.jsx(o.Generic.Menu.Item,{className:"bn-menu-item",subTrigger:!0,children:e.children})}),r.jsx(o.Generic.Menu.Dropdown,{sub:!0,className:"bn-menu-dropdown bn-color-picker-dropdown",children:r.jsx(he,{iconSize:18,text:P(n,t,n.type,{textColor:"string"})&&U(t,n.type,{textColor:"string"})?{color:n.props.textColor,setColor:l=>t.updateBlock(n,{type:n.type,props:{textColor:l}})}:void 0,background:P(n,t,n.type,{backgroundColor:"string"})&&U(t,n.type,{backgroundColor:"string"})?{color:n.props.backgroundColor,setColor:l=>t.updateBlock(n,{props:{backgroundColor:l}})}:void 0})})]})},jr=e=>{let o=h(),t=v(),n=y(D,{editor:t,selector:l=>l?.block});return n===void 0?null:r.jsx(o.Generic.Menu.Item,{className:"bn-menu-item",onClick:()=>t.removeBlocks([n]),children:e.children})},wr=e=>{let o=h(),t=v(),n=y(D,{editor:t,selector:i=>i?.block});if(n===void 0||n.type!=="table"||!t.settings.tables.headers)return null;let l=!!n.content.headerRows;return r.jsx(o.Generic.Menu.Item,{className:"bn-menu-item",checked:l,onClick:()=>{t.updateBlock(n,{content:{...n.content,headerRows:l?void 0:1}})},children:e.children})},yr=e=>{let o=h(),t=v(),n=y(D,{editor:t,selector:i=>i?.block});if(n===void 0||n.type!=="table"||!t.settings.tables.headers)return null;let l=!!n.content.headerCols;return r.jsx(o.Generic.Menu.Item,{className:"bn-menu-item",checked:l,onClick:()=>{t.updateBlock(n,{content:{...n.content,headerCols:l?void 0:1}})},children:e.children})},Sr=e=>{let o=h(),t=k();return r.jsx(o.Generic.Menu.Dropdown,{className:"bn-menu-dropdown bn-drag-handle-menu",children:e.children||r.jsxs(r.Fragment,{children:[r.jsx(jr,{children:t.drag_handle.delete_menuitem}),r.jsx(kr,{children:t.drag_handle.colors_menuitem}),r.jsx(wr,{children:t.drag_handle.header_row_menuitem}),r.jsx(yr,{children:t.drag_handle.header_column_menuitem})]})})},Tr=e=>{let o=h(),t=k(),n=w(D),l=y(D,{selector:s=>s?.block});if(l===void 0)return null;let i=e.dragHandleMenu||Sr;return r.jsxs(o.Generic.Menu.Root,{onOpenChange:s=>{s?n.freezeMenu():n.unfreezeMenu()},position:"left",children:[r.jsx(o.Generic.Menu.Trigger,{children:r.jsx(o.SideMenu.Button,{label:t.side_menu.drag_handle_label,draggable:!0,onDragStart:s=>n.blockDragStart(s,l),onDragEnd:n.blockDragEnd,className:"bn-button",icon:r.jsx(ft,{size:24,"data-test":"dragHandle"})})}),r.jsx(i,{children:e.children})]})},_r=e=>{let o=h(),t=v(),n=y(D,{editor:t,selector:i=>i?.block}),l=d.useMemo(()=>{if(n===void 0)return{};let i={"data-block-type":n.type};return n.type==="heading"&&(i["data-level"]=n.props.level.toString()),t.schema.blockSpecs[n.type].implementation.meta?.fileBlockAccept&&(n.props.url?i["data-url"]="true":i["data-url"]="false"),i},[n,t.schema.blockSpecs]);return r.jsx(o.SideMenu.Root,{className:"bn-side-menu",...l,children:e.children||r.jsxs(r.Fragment,{children:[r.jsx(Cr,{}),r.jsx(Tr,{dragHandleMenu:e.dragHandleMenu})]})})},Rr=e=>{let o=v(),{show:t,block:n}=y(D,{selector:a=>a===void 0?void 0:{show:a.show,block:a.block}})||{},l=d.useCallback((a,c,u)=>{let m=!1;return Me(a,c,()=>{if(!m){m=!0;return}o.getExtension(D)?.hideMenuIfNotFrozen()},{ancestorScroll:!0,ancestorResize:!1,elementResize:!1,layoutShift:!1})},[o]),i=d.useMemo(()=>({...e.floatingUIOptions,useFloatingOptions:{open:t,placement:"left-start",whileElementsMounted:l,...e.floatingUIOptions?.useFloatingOptions},useDismissProps:{enabled:!1,...e.floatingUIOptions?.useDismissProps},focusManagerProps:{disabled:!0,...e.floatingUIOptions?.focusManagerProps},elementProps:{style:{zIndex:20},...e.floatingUIOptions?.elementProps}}),[e.floatingUIOptions,t,l]),s=e.sideMenu||_r;return r.jsx(Bt,{blockId:t?n?.id:void 0,...i,children:n?.id&&r.jsx(s,{})})};async function Er(e,o){return(await cn(e,o)).map(({id:t,onItemClick:n})=>({id:t,onItemClick:n,icon:t}))}function Ir(e){let o=h(),t=k(),{items:n,loadingState:l,selectedIndex:i,onItemClick:s,columns:a}=e,c=l==="loading-initial"||l==="loading"?r.jsx(o.GridSuggestionMenu.Loader,{className:"bn-grid-suggestion-menu-loader",columns:a}):null,u=d.useMemo(()=>{let m=[];for(let p=0;p<n.length;p++){let g=n[p];m.push(r.jsx(o.GridSuggestionMenu.Item,{className:"bn-grid-suggestion-menu-item",item:g,id:`bn-grid-suggestion-menu-item-${p}`,isSelected:p===i,onClick:()=>s?.(g)},g.id))}return m},[o,n,s,i]);return r.jsxs(o.GridSuggestionMenu.Root,{id:"bn-grid-suggestion-menu",columns:a,className:"bn-grid-suggestion-menu",children:[c,u,u.length===0&&e.loadingState==="loaded"&&r.jsx(o.GridSuggestionMenu.EmptyItem,{className:"bn-grid-suggestion-menu-empty-item",columns:a,children:t.suggestion_menu.no_items_title})]})}function zt(e,o,t,n=3){let l=d.useRef(0);d.useEffect(()=>{o!==void 0&&(e.length>0?l.current=o.length:o.length-l.current>n&&t())},[t,n,e.length,o])}function Gt(e,o){let[t,n]=d.useState([]),[l,i]=d.useState(!1),s=d.useRef(void 0),a=d.useRef(void 0);return d.useEffect(()=>{let c=e;s.current=e,i(!0),o(e).then(u=>{s.current===c&&(n(u),i(!1),a.current=c)})},[e,o]),{items:t||[],usedQuery:a.current,loadingState:a.current===void 0?"loading-initial":l?"loading":"loaded"}}function Mr(e,o,t,n,l){let i=q(e),[s,a]=d.useState(0);return d.useEffect(()=>{let c=u=>(u.key==="ArrowLeft"&&(u.preventDefault(),t.length&&a((s-1+t.length)%t.length)),u.key==="ArrowRight"&&(u.preventDefault(),t.length&&a((s+1+t.length)%t.length)),u.key==="ArrowUp"?(u.preventDefault(),t.length&&a((s-n+t.length)%t.length),!0):u.key==="ArrowDown"?(u.preventDefault(),t.length&&a((s+n)%t.length),!0):u.key==="Enter"&&!u.isComposing?(u.stopPropagation(),u.preventDefault(),t.length&&l?.(t[s]),!0):!1);return i?.addEventListener("keydown",c,!0),()=>{i?.removeEventListener("keydown",c,!0)}},[i,t,s,l,n,n!==void 0&&n>1]),d.useEffect(()=>{a(0)},[o]),{selectedIndex:t.length===0?void 0:s}}function Pr(e){let o=O().setContentEditableProps,t=v(),{getItems:n,gridSuggestionMenuComponent:l,query:i,clearQuery:s,closeMenu:a,onItemClick:c,columns:u}=e,m=d.useCallback(x=>{a(),s(),c?.(x)},[c,a,s]),{items:p,usedQuery:g,loadingState:b}=Gt(i,n);zt(p,g,a);let{selectedIndex:f}=Mr(t,i,p,u,m);return d.useEffect(()=>(o(x=>({...x,"aria-expanded":!0,"aria-controls":"bn-suggestion-menu"})),()=>{o(x=>({...x,"aria-expanded":!1,"aria-controls":void 0}))}),[o]),d.useEffect(()=>(o(x=>({...x,"aria-activedescendant":f?"bn-suggestion-menu-item-"+f:void 0})),()=>{o(x=>({...x,"aria-activedescendant":void 0}))}),[o,f]),r.jsx(l,{items:p,onItemClick:m,loadingState:b,selectedIndex:f,columns:u})}function Nr(e){let o=v(),t=q(),{triggerCharacter:n,gridSuggestionMenuComponent:l,columns:i,shouldOpen:s,minQueryLength:a,onItemClick:c,getItems:u}=e,m=d.useMemo(()=>c||(C=>{C.onItemClick(o)}),[o,c]),p=d.useMemo(()=>u||(async C=>await Er(o,C)),[o,u]),g=w(z);d.useEffect(()=>{g.addSuggestionMenu({triggerCharacter:n,shouldOpen:s})},[g,n,s]);let b=y(z),f=y(z,{selector:C=>({element:t?.firstChild||void 0,getBoundingClientRect:()=>C?.referencePos||new DOMRect})}),x=d.useMemo(()=>({...e.floatingUIOptions,useFloatingOptions:{open:b?.show&&b?.triggerCharacter===n,onOpenChange:C=>{C||g.closeMenu()},placement:"bottom-start",middleware:[A(10),rt({allowedPlacements:["bottom-start","top-start"],padding:10}),J(),se({apply({elements:C,availableHeight:T}){C.floating.style.maxHeight=`${Math.max(0,T)}px`},padding:10})],...e.floatingUIOptions?.useFloatingOptions},focusManagerProps:{disabled:!0,...e.floatingUIOptions?.focusManagerProps},elementProps:{onMouseDownCapture:C=>C.preventDefault(),style:{zIndex:70},...e.floatingUIOptions?.elementProps}}),[e.floatingUIOptions,b?.show,b?.triggerCharacter,g,n]);return!b||!b.ignoreQueryLength&&a&&(b.query.startsWith(" ")||b.query.length<a)?null:r.jsx(L,{reference:f,...x,children:n&&r.jsx(Pr,{query:b.query,closeMenu:g.closeMenu,clearQuery:g.clearQuery,getItems:p,columns:i,gridSuggestionMenuComponent:l||Ir,onItemClick:m})})}function Br(e){let o=h(),t=k(),{items:n,loadingState:l,selectedIndex:i,onItemClick:s}=e,a=l==="loading-initial"||l==="loading"?r.jsx(o.SuggestionMenu.Loader,{className:"bn-suggestion-menu-loader"}):null,c=d.useMemo(()=>{let u,m=[];for(let p=0;p<n.length;p++){let g=n[p];g.group!==u&&(u=g.group,m.push(r.jsx(o.SuggestionMenu.Label,{className:"bn-suggestion-menu-label",children:u},u))),m.push(r.jsx(o.SuggestionMenu.Item,{className:R("bn-suggestion-menu-item",g.size==="small"?"bn-suggestion-menu-item-small":""),item:g,id:`bn-suggestion-menu-item-${p}`,isSelected:p===i,onClick:()=>s?.(g)},g.title))}return m},[o,n,s,i]);return r.jsxs(o.SuggestionMenu.Root,{id:"bn-suggestion-menu",className:"bn-suggestion-menu",children:[c,c.length===0&&(e.loadingState==="loading"||e.loadingState==="loaded")&&r.jsx(o.SuggestionMenu.EmptyItem,{className:"bn-suggestion-menu-item",children:t.suggestion_menu.no_items_title}),a]})}function Or(e,o){let[t,n]=d.useState(0);return{selectedIndex:t,setSelectedIndex:n,handler:l=>{if(l.key==="ArrowUp")return l.preventDefault(),e.length&&n((t-1+e.length)%e.length),!0;if(l.key==="ArrowDown")return l.preventDefault(),e.length&&n((t+1)%e.length),!0;if(l.key==="PageUp")return l.preventDefault(),e.length&&n(0),!0;if(l.key==="PageDown")return l.preventDefault(),e.length&&n(e.length-1),!0;let i=Fr(l)?l.nativeEvent.isComposing:l.isComposing;return l.key==="Enter"&&!i?(l.preventDefault(),l.stopPropagation(),e.length&&o?.(e[t]),!0):!1}}}function Fr(e){return e.nativeEvent!==void 0}function Dr(e,o,t,n,l){let i=q(),{selectedIndex:s,setSelectedIndex:a,handler:c}=Or(t,n);return d.useEffect(()=>{let u=i;return u?.addEventListener("keydown",c,!0),()=>{u?.removeEventListener("keydown",c,!0)}},[i,t,s,n,l,c]),d.useEffect(()=>{a(0)},[o,a]),{selectedIndex:t.length===0?void 0:s}}function Lr(e){let o=O().setContentEditableProps,t=v(),{getItems:n,suggestionMenuComponent:l,query:i,clearQuery:s,closeMenu:a,onItemClick:c}=e,u=d.useCallback(f=>{a(),s(),c?.(f)},[c,a,s]),{items:m,usedQuery:p,loadingState:g}=Gt(i,n);zt(m,p,a);let{selectedIndex:b}=Dr(t,i,m,u);return d.useEffect(()=>(o(f=>({...f,"aria-expanded":!0,"aria-controls":"bn-suggestion-menu"})),()=>{o(f=>({...f,"aria-expanded":!1,"aria-controls":void 0}))}),[o]),d.useEffect(()=>(o(f=>({...f,"aria-activedescendant":b?"bn-suggestion-menu-item-"+b:void 0})),()=>{o(f=>({...f,"aria-activedescendant":void 0}))}),[o,b]),r.jsx(l,{items:m,onItemClick:u,loadingState:g,selectedIndex:b})}var Ar={heading:ue,heading_2:de,heading_3:ce,heading_4:mt,heading_5:ut,heading_6:dt,toggle_heading:ue,toggle_heading_2:de,toggle_heading_3:ce,quote:ct,toggle_list:st,numbered_list:at,bullet_list:it,check_list:lt,paragraph:Pe,table:Hn,image:$n,video:Gn,audio:zn,file:An,emoji:Ln,code_block:Dn,divider:Fn};function zr(e){return on(e).map(o=>{let t=Ar[o.key];return{...o,icon:r.jsx(t,{size:18})}})}function Gr(e){let o=v(),t=q(),{triggerCharacter:n,suggestionMenuComponent:l,shouldOpen:i,minQueryLength:s,onItemClick:a,getItems:c}=e,u=d.useMemo(()=>a||(x=>{x.onItemClick(o)}),[o,a]),m=d.useMemo(()=>c||(async x=>nn(zr(o),x)),[o,c]),p=w(z);d.useEffect(()=>{p.addSuggestionMenu({triggerCharacter:n,shouldOpen:i})},[p,n,i]);let g=y(z),b=y(z,{selector:x=>({element:t?.firstChild||void 0,getBoundingClientRect:()=>x?.referencePos||new DOMRect})}),f=d.useMemo(()=>({...e.floatingUIOptions,useFloatingOptions:{open:g?.show&&g?.triggerCharacter===n,onOpenChange:x=>{x||p.closeMenu()},placement:"bottom-start",middleware:[A(10),rt({allowedPlacements:["bottom-start","top-start"],padding:10}),J(),se({apply({elements:x,availableHeight:C}){x.floating.style.maxHeight=`${Math.max(0,C)}px`},padding:10})],...e.floatingUIOptions?.useFloatingOptions},focusManagerProps:{disabled:!0,...e.floatingUIOptions?.focusManagerProps},elementProps:{onMouseDownCapture:x=>x.preventDefault(),style:{zIndex:80},...e.floatingUIOptions?.elementProps}}),[e.floatingUIOptions,g?.show,g?.triggerCharacter,p,n]);return!g||!g.ignoreQueryLength&&s&&(g.query.startsWith(" ")||g.query.length<s)?null:r.jsx(L,{reference:b,...f,children:n&&r.jsx(Lr,{query:g.query,closeMenu:p.closeMenu,clearQuery:p.clearQuery,getItems:m,suggestionMenuComponent:l||Br,onItemClick:u})})}var $r=(e,o=.3)=>{let t=Math.floor(e)+o,n=Math.ceil(e)-o;return e>=t&&e<=n?Math.round(e):e<t?Math.floor(e):Math.ceil(e)},Hr=e=>{let o=h(),t=v(),n=w(S),l=y(S,{selector:m=>m?.block}),i=d.useRef(!1),[s,a]=d.useState(),c=d.useCallback(m=>{n.freezeHandles(),e.hideOtherElements(!0),l&&(a({originalContent:l.content,originalCroppedContent:{rows:n.cropEmptyRowsOrColumns(l,e.orientation==="addOrRemoveColumns"?"columns":"rows")},startPos:e.orientation==="addOrRemoveColumns"?m.clientX:m.clientY}),i.current=!1,m.preventDefault())},[l,e,n]),u=d.useCallback(()=>{!l||i.current||t.updateBlock(l,{type:"table",content:{...l.content,rows:e.orientation==="addOrRemoveColumns"?n.addRowsOrColumns(l,"columns",1):n.addRowsOrColumns(l,"rows",1)}})},[l,t,e.orientation,n]);return d.useEffect(()=>{let m=p=>{if(!l)return;if(!s)throw Error("editingState is undefined");i.current=!0;let g=(e.orientation==="addOrRemoveColumns"?p.clientX:p.clientY)-s.startPos,b=e.orientation==="addOrRemoveColumns"?s.originalCroppedContent.rows[0]?.cells.length??0:s.originalCroppedContent.rows.length,f=e.orientation==="addOrRemoveColumns"?s.originalContent.rows[0]?.cells.length??0:s.originalContent.rows.length,x=e.orientation==="addOrRemoveColumns"?l.content.rows[0].cells.length:l.content.rows.length,C=f+$r(g/(e.orientation==="addOrRemoveColumns"?dn:un),.3);C>=b&&C>0&&C!==x&&(t.updateBlock(l,{type:"table",content:{...l.content,rows:e.orientation==="addOrRemoveColumns"?n.addRowsOrColumns({type:"table",content:s.originalCroppedContent},"columns",C-b):n.addRowsOrColumns({type:"table",content:s.originalCroppedContent},"rows",C-b)}}),l.content&&t.setTextCursorPosition(l))};return s&&window.addEventListener("mousemove",m),()=>{window.removeEventListener("mousemove",m)}},[l,s,t,e.orientation,n]),d.useEffect(()=>{let m=()=>{e.hideOtherElements(!1),n.unfreezeHandles(),a(void 0)};return s&&window.addEventListener("mouseup",m),()=>{window.removeEventListener("mouseup",m)}},[s,e,n]),t.isEditable?r.jsx(o.TableHandle.ExtendButton,{className:R("bn-extend-button",e.orientation==="addOrRemoveColumns"?"bn-extend-button-add-remove-columns":"bn-extend-button-add-remove-rows",s===null?"":"bn-extend-button-editing"),onClick:u,onMouseDown:c,children:e.children||r.jsx(so,{size:18,"data-test":"extendButton"})}):null},Ur=e=>{let o=h(),t=k(),n=v(),{block:l,colIndex:i,rowIndex:s}=y(S,{selector:u=>({block:u?.block,colIndex:u?.colIndex,rowIndex:u?.rowIndex})}),a=(u,m)=>{if(l===void 0||i===void 0||s===void 0)return;let p=l.content.rows.map(g=>({...g,cells:g.cells.map(b=>Z(b))}));m==="text"?p[s].cells[i].props.textColor=u:p[s].cells[i].props.backgroundColor=u,n.updateBlock(l,{type:"table",content:{...l.content,rows:p}}),n.setTextCursorPosition(l)};if(l===void 0||i===void 0||s===void 0)return null;let c=l.content.rows[s]?.cells?.[i];return!c||n.settings.tables.cellTextColor===!1&&n.settings.tables.cellBackgroundColor===!1?null:r.jsxs(o.Generic.Menu.Root,{position:"right",sub:!0,children:[r.jsx(o.Generic.Menu.Trigger,{sub:!0,children:r.jsx(o.Generic.Menu.Item,{className:"bn-menu-item",subTrigger:!0,children:e.children||t.drag_handle.colors_menuitem})}),r.jsx(o.Generic.Menu.Dropdown,{sub:!0,className:"bn-menu-dropdown bn-color-picker-dropdown",children:r.jsx(he,{iconSize:18,text:n.settings.tables.cellTextColor?{color:X(c)?c.props.textColor:"default",setColor:u=>a(u,"text")}:void 0,background:n.settings.tables.cellBackgroundColor?{color:X(c)?c.props.backgroundColor:"default",setColor:u=>a(u,"background")}:void 0})})]})},Vr=()=>{let e=h(),o=k(),t=v(),n=w(S),{block:l,colIndex:i,rowIndex:s}=y(S,{selector:c=>({block:c?.block,colIndex:c?.colIndex,rowIndex:c?.rowIndex})});if(l===void 0||i===void 0||s===void 0)return null;let a=l.content.rows[s]?.cells?.[i];return!a||!X(a)||nt(a)===1&&tt(a)===1||!t.settings.tables.splitCells?null:r.jsx(e.Generic.Menu.Item,{onClick:()=>{n.splitCell({row:s,col:i})},children:o.table_handle.split_cell_menuitem})},qr=e=>r.jsx(h().Generic.Menu.Dropdown,{className:"bn-menu-dropdown bn-table-handle-menu",children:e.children||r.jsxs(r.Fragment,{children:[r.jsx(Vr,{}),r.jsx(Ur,{})]})}),Kr=e=>{let o=h(),t=v(),n=w(S),l=e.tableCellMenu||qr;return!t.settings.tables.splitCells&&!t.settings.tables.cellBackgroundColor&&!t.settings.tables.cellTextColor?null:r.jsxs(o.Generic.Menu.Root,{onOpenChange:i=>{i?(n.freezeHandles(),e.hideOtherElements(!0)):(n.unfreezeHandles(),e.hideOtherElements(!1),t.focus())},position:"right",children:[r.jsx(o.Generic.Menu.Trigger,{children:r.jsx(o.Generic.Menu.Button,{className:"bn-table-cell-handle",children:e.children||r.jsx(co,{size:12,"data-test":"tableCellHandle"})})}),r.jsx(l,{})]})},Ze=e=>{let o=h(),t=k(),n=w(S),l=y(S,{selector:i=>e.orientation==="column"?i?.colIndex:i?.rowIndex});return n===void 0||l===void 0?null:r.jsx(o.Generic.Menu.Item,{onClick:()=>{n.addRowOrColumn(l,e.orientation==="row"?{orientation:"row",side:e.side}:{orientation:"column",side:e.side})},children:t.table_handle[`add_${e.side}_menuitem`]})},Qr=e=>{let o=h(),t=k(),n=w(S),l=y(S,{selector:i=>e.orientation==="column"?i?.colIndex:i?.rowIndex});return n===void 0||l===void 0?null:r.jsx(o.Generic.Menu.Item,{onClick:()=>n.removeRowOrColumn(l,e.orientation),children:e.orientation==="row"?t.table_handle.delete_row_menuitem:t.table_handle.delete_column_menuitem})},Wr=e=>{let o=h(),t=k(),n=v(),l=w(S),{block:i,index:s}=y(S,{selector:m=>({block:m?.block,index:e.orientation==="column"?m?.colIndex:m?.rowIndex})}),a=d.useMemo(()=>l===void 0||i===void 0||s===void 0?[]:e.orientation==="row"?l.getCellsAtRowHandle(i,s):l.getCellsAtColumnHandle(i,s),[i,s,e.orientation,l]),c=(m,p)=>{if(i===void 0)return;let g=i.content.rows.map(b=>({...b,cells:b.cells.map(f=>Z(f))}));a.forEach(({row:b,col:f})=>{p==="text"?g[b].cells[f].props.textColor=m:g[b].cells[f].props.backgroundColor=m}),n.updateBlock(i,{type:"table",content:{...i.content,rows:g}}),n.setTextCursorPosition(i)};if(!a||!a[0]||!l||n.settings.tables.cellTextColor===!1&&n.settings.tables.cellBackgroundColor===!1)return null;let u=Z(a[0].cell);return r.jsxs(o.Generic.Menu.Root,{position:"right",sub:!0,children:[r.jsx(o.Generic.Menu.Trigger,{sub:!0,children:r.jsx(o.Generic.Menu.Item,{className:"bn-menu-item",subTrigger:!0,children:e.children||t.drag_handle.colors_menuitem})}),r.jsx(o.Generic.Menu.Dropdown,{sub:!0,className:"bn-menu-dropdown bn-color-picker-dropdown",children:r.jsx(he,{iconSize:18,text:n.settings.tables.cellTextColor?{color:a.every(({cell:m})=>X(m)&&m.props.textColor===u.props.textColor)?u.props.textColor:"default",setColor:m=>{c(m,"text")}}:void 0,background:n.settings.tables.cellBackgroundColor?{color:a.every(({cell:m})=>X(m)&&m.props.backgroundColor===u.props.backgroundColor)?u.props.backgroundColor:"default",setColor:m=>c(m,"background")}:void 0})})]})},Yr=e=>{let o=h(),t=k(),n=v(),l=w(S),{block:i,index:s}=y(S,{selector:c=>({block:c?.block,index:e.orientation==="column"?c?.colIndex:c?.rowIndex})});if(l===void 0||i===void 0||s!==0||e.orientation!=="row"||!n.settings.tables.headers)return null;let a=!!i.content.headerRows;return r.jsx(o.Generic.Menu.Item,{className:"bn-menu-item",checked:a,onClick:()=>{n.updateBlock(i,{...i,content:{...i.content,headerRows:a?void 0:1}})},children:t.drag_handle.header_row_menuitem})},Zr=e=>{let o=h(),t=k(),n=v(),l=w(S),i=y(S,{selector:c=>c?.block}),s=y(S,{selector:c=>e.orientation==="column"?c?.colIndex:c?.rowIndex});if(!l||s!==0||!i||e.orientation!=="column"||!n.settings.tables.headers)return null;let a=!!i.content.headerCols;return r.jsx(o.Generic.Menu.Item,{className:"bn-menu-item",checked:a,onClick:()=>{n.updateBlock(i,{...i,content:{...i.content,headerCols:a?void 0:1}})},children:t.drag_handle.header_column_menuitem})},Xr=e=>r.jsx(h().Generic.Menu.Dropdown,{className:"bn-table-handle-menu",children:e.children||r.jsxs(r.Fragment,{children:[r.jsx(Qr,{orientation:e.orientation}),r.jsx(Ze,{orientation:e.orientation,side:e.orientation==="row"?"above":"left"}),r.jsx(Ze,{orientation:e.orientation,side:e.orientation==="row"?"below":"right"}),r.jsx(Yr,{orientation:e.orientation}),r.jsx(Zr,{orientation:e.orientation}),r.jsx(Wr,{orientation:e.orientation})]})}),Jr=e=>{let o=v(),t=h(),[n,l]=d.useState(!1),i=e.tableHandleMenu||Xr,s=w(S),a=y(S),c=d.useMemo(()=>!s||!a||!a.block||a.block.type!=="table"?!1:e.orientation==="column"?s.getCellsAtColumnHandle(a.block,a.colIndex).every(({cell:u})=>tt(u)===1):s.getCellsAtRowHandle(a.block,a.rowIndex).every(({cell:u})=>nt(u)===1),[e.orientation,a,s]);return a?r.jsxs(t.Generic.Menu.Root,{onOpenChange:u=>{u?(s.freezeHandles(),e.hideOtherElements(!0)):(s.unfreezeHandles(),e.hideOtherElements(!1),o.focus())},position:"right",children:[r.jsx(t.Generic.Menu.Trigger,{children:r.jsx(t.TableHandle.Root,{className:R("bn-table-handle",n?"bn-table-handle-dragging":"",c?"":"bn-table-handle-not-draggable"),draggable:c,onDragStart:u=>{l(!0),e.hideOtherElements(!0),e.orientation==="column"?s.colDragStart(u):s.rowDragStart(u)},onDragEnd:()=>{s.dragEnd(),e.hideOtherElements(!1),l(!1)},style:e.orientation==="column"?{transform:"rotate(0.25turn)"}:void 0,children:e.children||r.jsx(ft,{size:24,"data-test":"tableHandle"})})}),r.jsx(i,{orientation:e.orientation})]}):null},el=e=>{let o=v(),[t,n]=d.useState(),l=y(S),i=d.useMemo(()=>{let p={};if(l===void 0)return{};let g=et(l.block.id,o.prosemirrorState.doc);if(!g)return{};let b=g.posBeforeNode+1,f=o.prosemirrorView.domAtPos(b+1).node;if(!(f instanceof Element))return{};if(p.tableReference={element:f},l.rowIndex===void 0||l.colIndex===void 0)return p;let x=o.prosemirrorState.doc.resolve(b+1).posAtIndex(l.rowIndex),C=o.prosemirrorState.doc.resolve(x+1).posAtIndex(l.colIndex),T=o.prosemirrorView.domAtPos(C+1).node;return T instanceof Element?(p.cellReference={element:T},p.rowReference={element:f,getBoundingClientRect:()=>{let I=f.getBoundingClientRect(),F=T.getBoundingClientRect();return new DOMRect(I.x,l.draggingState&&l.draggingState.draggedCellOrientation==="row"?l.draggingState.mousePos-F.height/2:F.y,I.width,F.height)}},p.columnReference={element:f,getBoundingClientRect:()=>{let I=f.getBoundingClientRect(),F=T.getBoundingClientRect();return new DOMRect(l.draggingState&&l.draggingState.draggedCellOrientation==="col"?l.draggingState.mousePos-F.width/2:F.x,I.y,F.width,I.height)}},p):{}},[o,l]),s=d.useCallback((p,g,b)=>{let f=!1;return Me(p,g,()=>{if(!f){f=!0;return}o.getExtension(S)?.hideHandlesIfNotFrozen()},{ancestorScroll:!0,ancestorResize:!1,elementResize:!1,layoutShift:!1})},[o]),a=d.useMemo(()=>l===void 0?void 0:{rowTableHandle:{useFloatingOptions:{open:l.show&&l.rowIndex!==void 0&&(!t||t==="rowTableHandle"),placement:"left",middleware:[A(-10)],whileElementsMounted:s},focusManagerProps:{disabled:!0},elementProps:{style:{zIndex:10}}},columnTableHandle:{useFloatingOptions:{open:l.show&&l.colIndex!==void 0&&(!t||t==="columnTableHandle"),placement:"top",middleware:[A(-12)],whileElementsMounted:s},focusManagerProps:{disabled:!0},elementProps:{style:{zIndex:10}}},tableCellHandle:{useFloatingOptions:{open:l.show&&l.rowIndex!==void 0&&l.colIndex!==void 0&&(!t||t==="tableCellHandle"),placement:"top-end",middleware:[A({mainAxis:-15,crossAxis:-1})],whileElementsMounted:s},focusManagerProps:{disabled:!0},elementProps:{style:{zIndex:10}}},extendRowsButton:{useFloatingOptions:{open:l.show&&l.showAddOrRemoveRowsButton&&(!t||t==="extendRowsButton"),placement:"bottom",whileElementsMounted:s,middleware:[se({apply({rects:p,elements:g}){Object.assign(g.floating.style,{width:`${p.reference.width}px`})}})]},focusManagerProps:{disabled:!0},elementProps:{style:{zIndex:10}}},extendColumnsButton:{useFloatingOptions:{open:l.show&&l.showAddOrRemoveColumnsButton&&(!t||t==="extendColumnsButton"),placement:"right",whileElementsMounted:s,middleware:[se({apply({rects:p,elements:g}){Object.assign(g.floating.style,{height:`${p.reference.height}px`})}})]},focusManagerProps:{disabled:!0},elementProps:{style:{zIndex:10}}}},[t,l,s]);if(!l)return null;let c=e.tableHandle||Jr,u=e.extendButton||Hr,m=e.tableCellHandle||Kr;return r.jsxs(r.Fragment,{children:[r.jsx(L,{reference:i?.rowReference,...a?.rowTableHandle,children:l.show&&l.rowIndex!==void 0&&(!t||t==="rowTableHandle")&&r.jsx(c,{orientation:"row",hideOtherElements:p=>n(p?"rowTableHandle":void 0)})}),r.jsx(L,{reference:i?.columnReference,...a?.columnTableHandle,children:l.show&&l.colIndex!==void 0&&(!t||t==="columnTableHandle")&&r.jsx(c,{orientation:"column",hideOtherElements:p=>n(p?"columnTableHandle":void 0)})}),r.jsx(L,{reference:i?.cellReference,...a?.tableCellHandle,children:l.show&&l.rowIndex!==void 0&&l.colIndex!==void 0&&(!t||t==="tableCellHandle")&&r.jsx(m,{hideOtherElements:p=>n(p?"tableCellHandle":void 0)})}),r.jsx(L,{reference:i?.tableReference,...a?.extendRowsButton,children:l.show&&l.showAddOrRemoveRowsButton&&(!t||t==="extendRowsButton")&&r.jsx(u,{orientation:"addOrRemoveRows",hideOtherElements:p=>n(p?"extendRowsButton":void 0)})}),r.jsx(L,{reference:i?.tableReference,...a?.extendColumnsButton,children:l.show&&l.showAddOrRemoveColumnsButton&&(!t||t==="extendColumnsButton")&&r.jsx(u,{orientation:"addOrRemoveColumns",hideOtherElements:p=>n(p?"extendColumnsButton":void 0)})})]})},tl=d.lazy(()=>me(()=>Promise.resolve().then(()=>Ho),void 0).then(e=>e.n)),nl=d.lazy(()=>me(()=>Promise.resolve().then(()=>Go),void 0).then(e=>e.n));function ol(e){let o=v();if(!o)throw Error("BlockNoteDefaultUI must be used within a BlockNoteContext.Provider");return r.jsxs(r.Fragment,{children:[o.getExtension(Y)&&e.formattingToolbar!==!1&&r.jsx(At,{}),o.getExtension(be)&&e.linkToolbar!==!1&&r.jsx(vr,{}),o.getExtension(z)&&e.slashMenu!==!1&&r.jsx(Gr,{triggerCharacter:"/",shouldOpen:t=>!t.selection.$from.parent.type.isInGroup("tableContent")}),o.getExtension(z)&&e.emojiPicker!==!1&&r.jsx(Nr,{triggerCharacter:":",columns:10,minQueryLength:2}),o.getExtension(D)&&e.sideMenu!==!1&&r.jsx(Rr,{}),o.getExtension(_e)&&e.filePanel!==!1&&r.jsx(qo,{}),o.getExtension(S)&&e.tableHandles!==!1&&r.jsx(el,{}),o.getExtension(B)&&e.comments!==!1&&r.jsxs(d.Suspense,{children:[r.jsx(tl,{}),r.jsx(nl,{})]})]})}function rl(e,o){let t=O();o||=t?.editor,d.useEffect(()=>{if(!o)throw Error("'editor' is required, either from BlockNoteContext or as a function argument");return o.onChange(e)},[e,o])}function ll(e,o,t){let n=O();o||=n?.editor,d.useEffect(()=>{if(!o)throw Error("'editor' is required, either from BlockNoteContext or as a function argument");return o.onSelectionChange(e,t)},[e,o,t])}var $t=()=>{let e=d.useMemo(()=>window.matchMedia?.("(prefers-color-scheme: dark)"),[]),o=d.useMemo(()=>window.matchMedia?.("(prefers-color-scheme: light)"),[]),t=e?.matches,n=o?.matches,[l,i]=d.useState(t?"dark":n?"light":"no-preference");return d.useEffect(()=>{i(t?"dark":n?"light":"no-preference")},[t,n]),d.useEffect(()=>{if(typeof e?.addEventListener=="function"){let s=({matches:c})=>c&&i("dark"),a=({matches:c})=>c&&i("light");return e?.addEventListener("change",s),o?.addEventListener("change",a),()=>{e?.removeEventListener("change",s),o?.removeEventListener("change",a)}}else{let s=()=>i(e.matches?"dark":o.matches?"light":"no-preference");return e?.addEventListener("change",s),o?.addEventListener("change",s),()=>{e?.removeEventListener("change",s),o?.removeEventListener("change",s)}}},[e,o]),l},Ht=d.createContext(void 0);function il(){return d.useContext(Ht)}function al(){let e=new Set,o={};return{subscribe(t){return e.add(t),()=>{e.delete(t)}},getSnapshot(){return o},getServerSnapshot(){return o},setRenderer(t,n){o={...o,[t]:ae.createPortal(n.reactElement,n.element,t)},e.forEach(l=>l())},removeRenderer(t){let n={...o};delete n[t],o=n,e.forEach(l=>l())}}}var sl=({contentComponent:e})=>{let o=d.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getServerSnapshot);return r.jsx(r.Fragment,{children:Object.values(o)})},cl=d.forwardRef((e,o)=>{let[t,n]=d.useState();return d.useImperativeHandle(o,()=>(l,i)=>{ae.flushSync(()=>{n({node:l,container:i})}),n(void 0)},[]),r.jsx(r.Fragment,{children:t&&ae.createPortal(t.node,t.container)})}),Xe=()=>{};function dl(e,o){let{editor:t,className:n,theme:l,children:i,editable:s,onSelectionChange:a,onChange:c,formattingToolbar:u,linkToolbar:m,slashMenu:p,emojiPicker:g,sideMenu:b,filePanel:f,tableHandles:x,comments:C,autoFocus:T,renderEditor:I=!0,...F}=e,[Q,te]=d.useState(),K=O(),ne=$t(),xe=K?.colorSchemePreference||ne,G=l||(xe==="dark"?"dark":"light"),_=h(),H=d.useMemo(()=>({formattingToolbar:_?u:!1,linkToolbar:_?m:!1,sideMenu:_?b:!1,slashMenu:_?p:!1,filePanel:_?f:!1,tableHandles:_?x:!1,emojiPicker:_?g:!1,comments:_?C:!1}),[C,_,g,f,u,m,b,p,x]);rl(c||Xe,t),ll(a||Xe,t);let Kt=d.useCallback(Yt=>{t.elementRenderer=Yt},[t]);d.useEffect(()=>{if(!t.portalElement)throw Error("Portal element not found");t.portalElement.className=R("bn-root",G,n||""),t.portalElement.setAttribute("data-color-scheme",G)},[t,G,n]);let Qt=d.useMemo(()=>({...K,editor:t,setContentEditableProps:te,colorSchemePreference:G}),[K,t,G]),Wt=d.useMemo(()=>({editorProps:{autoFocus:T,contentEditableProps:Q,editable:s},defaultUIProps:H}),[T,Q,s,H]);return r.jsx(yt.Provider,{value:Qt,children:r.jsxs(Ht.Provider,{value:Wt,children:[r.jsx(cl,{ref:Kt}),r.jsx(ul,{className:n,renderEditor:I,editorColorScheme:G,ref:o,...F,children:i})]})})}var ul=pe.forwardRef(({className:e,renderEditor:o,editorColorScheme:t,children:n,...l},i)=>r.jsx("div",{className:R("bn-root","bn-container",t,e),"data-color-scheme":t,...l,ref:i,children:o?r.jsx(pl,{children:n}):n})),ml=pe.forwardRef(dl),pl=e=>{let o=il(),t=v(),n=d.useMemo(()=>al(),[]),l=d.useCallback(i=>{t.isEditable=o.editorProps.editable!==!1,t._tiptapEditor.contentComponent=n,i?t.mount(i):t.unmount()},[o.editorProps.editable,t,n]);return r.jsxs(r.Fragment,{children:[r.jsx(sl,{contentComponent:n}),r.jsx(gl,{...o.editorProps,...e,mount:l}),r.jsx(ol,{...o.defaultUIProps}),e.children]})},gl=e=>{let{autoFocus:o,mount:t,contentEditableProps:n}=e;return r.jsx("div",{"aria-autocomplete":"list","aria-haspopup":"listbox","data-bn-autofocus":o,ref:t,...n})};function W(e,o){let t,n=document.createElement("div"),l;if(o?.elementRenderer)o.elementRenderer(e(c=>t=c||void 0),n);else{if(!o?.headless)throw Error("elementRenderer not available, expected headless editor");l=Mo.createRoot(n),ae.flushSync(()=>{l.render(e(c=>t=c||void 0))})}if(!n.childElementCount)return console.warn("ReactInlineContentSpec: renderHTML() failed"),{dom:document.createElement("span")};t?.setAttribute("data-tmp-find","true");let i=n.cloneNode(!0),s=i.firstElementChild,a=i.querySelector("[data-tmp-find]");return a?.removeAttribute("data-tmp-find"),l?.unmount(),{dom:s,contentDOM:a||void 0}}function je(e){return r.jsx(xt,{onDragOver:o=>o.preventDefault(),...Object.fromEntries(Object.entries(e.domAttributes||{}).filter(([o])=>o!=="class")),className:R("bn-block-content",e.domAttributes?.class||""),"data-content-type":e.blockType,...Object.fromEntries(Object.entries(e.blockProps).filter(([o,t])=>t!==e.propSchema[o].default).map(([o,t])=>[ot(o),t])),"data-file-block":e.isFileBlock===!0||void 0,children:e.children})}function pi(e,o,t){return(n={})=>{let l=typeof e=="function"?e(n):e,i=typeof o=="function"?o(n):o,s=t?typeof t=="function"?t(n):t:void 0;return{config:l,implementation:{...i,toExternalHTML(a,c,u){let m=i.toExternalHTML||i.render;return W(p=>r.jsx(je,{blockType:a.type,blockProps:a.props,propSchema:l.propSchema,domAttributes:this.blockContentDOMAttributes,isFileBlock:i.meta?.fileBlockAccept!==void 0,children:r.jsx(m,{block:a,editor:c,contentRef:g=>{p(g),g&&(g.className=R("bn-inline-content",g.className))},context:u})}),c)},render(a,c){if(this.renderType==="nodeView")return pt(u=>{let m=mn(u.getPos,c,u.editor,l.type),p=ht().nodeViewContentRef;if(!p)throw Error("nodeViewContentRef is not set");let g=i.render;return r.jsx(je,{blockType:m.type,blockProps:m.props,propSchema:l.propSchema,isFileBlock:!!i.meta?.fileBlockAccept,domAttributes:this.blockContentDOMAttributes,children:r.jsx(g,{block:m,editor:c,contentRef:b=>{p(b),b&&(b.className=R("bn-inline-content",b.className),b.dataset.nodeViewContent="")}})})},{className:"bn-react-node-view-renderer"})(this.props);{let u=i.render;return W(m=>r.jsx(je,{blockType:a.type,blockProps:a.props,propSchema:l.propSchema,domAttributes:this.blockContentDOMAttributes,children:r.jsx(u,{block:a,editor:c,contentRef:p=>{m(p),p&&(p.className=R("bn-inline-content",p.className))}})}),c)}}},extensions:s}}}pe.memo(({thread:e,selectedThreadId:o,maxCommentsBeforeCollapse:t,referenceText:n})=>{let l=w(B),i=d.useCallback(a=>{a.target.closest(".bn-action-toolbar")||l.selectThread(e.id)},[l,e.id]),s=d.useCallback(a=>{if(!a.relatedTarget||a.relatedTarget.closest(".bn-action-toolbar"))return;let c=a.target instanceof Node?a.target:null,u=a.relatedTarget instanceof Node?a.relatedTarget.closest(".bn-thread"):null;(!c||!u||!u.contains(c))&&l.selectThread(void 0)},[l]);return r.jsx(ze,{thread:e,selected:e.id===o,referenceText:n,maxCommentsBeforeCollapse:t,onFocus:i,onBlur:s,tabIndex:0})});function we(e){return r.jsx(xt,{as:"span",className:"bn-inline-content-section","data-inline-content-type":e.inlineContentType,...Object.fromEntries(Object.entries(e.inlineContentProps).filter(([o,t])=>t!==e.propSchema[o].default).map(([o,t])=>[ot(o),t])),children:e.children})}function gi(e,o){let t=go.create({name:e.type,inline:!0,group:"inline",selectable:e.content==="styled",atom:e.content==="none",draggable:o.meta?.draggable,content:e.content==="styled"?"inline*":"",addAttributes(){return hn(e.propSchema)},addKeyboardShortcuts(){return fn(e)},parseHTML(){return bn(e,o.parse)},renderHTML({node:n}){let l=this.options.editor,i=$e(n,l.schema.inlineContentSchema,l.schema.styleSchema),s=o.toExternalHTML||o.render;return gn(W(a=>r.jsx(s,{contentRef:c=>{a(c),c&&(c.dataset.editable="")},inlineContent:i,updateInlineContent:()=>{},editor:l}),l),e.type,n.attrs,e.propSchema)},addNodeView(){let n=this.options.editor;return l=>pt(i=>{let s=ht().nodeViewContentRef;if(!s)throw Error("nodeViewContentRef is not set");let a=o.render;return r.jsx(we,{inlineContentProps:i.node.attrs,inlineContentType:e.type,propSchema:e.propSchema,children:r.jsx(a,{contentRef:c=>{s(c),c&&(c.dataset.editable="")},editor:n,inlineContent:$e(i.node,n.schema.inlineContentSchema,n.schema.styleSchema),updateInlineContent:c=>{let u=pn([c],n.pmSchema),m=i.getPos();m!==void 0&&n.transact(p=>p.replaceWith(m,m+i.node.nodeSize,u))}})})},{className:"bn-ic-react-node-view-renderer",as:"span"})(l)}});return xn(e,{...o,node:t,render(n,l,i){let s=o.render;return W(a=>r.jsx(we,{inlineContentProps:n.props,inlineContentType:e.type,propSchema:e.propSchema,children:r.jsx(s,{contentRef:c=>{a(c),c&&(c.dataset.editable="")},editor:i,inlineContent:n,updateInlineContent:l})}),i)},toExternalHTML(n,l){let i=o.toExternalHTML||o.render;return W(s=>r.jsx(we,{inlineContentProps:n.props,inlineContentType:e.type,propSchema:e.propSchema,children:r.jsx(i,{contentRef:a=>{s(a),a&&(a.dataset.editable="")},editor:l,inlineContent:n,updateInlineContent:()=>{}})}),l)}})}function Ut(e,o){let t=e.getBoundingClientRect(),n=o.getBoundingClientRect(),l=t.top<n.top,i=t.bottom>n.bottom;return l&&i?"both":l?"top":i?"bottom":"none"}function bl(e){return o=>{e.forEach(t=>{typeof t=="function"?t(o):t!=null&&(t.current=o)})}}var Vt=(e,o,t=!1)=>{let n=[];function l(i,s="--bn"){for(let a in i){let c=`${s}-${a.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}`;typeof i[a]=="object"?l(i[a],c):(typeof i[a]=="number"&&(i[a]=`${i[a]}px`),t?o.style.removeProperty(c):o.style.setProperty(c,i[a].toString()))}}return l(e),n},Je=(e,o)=>Vt(e,o),fl={colors:{editor:{text:void 0,background:void 0},menu:{text:void 0,background:void 0},tooltip:{text:void 0,background:void 0},hovered:{text:void 0,background:void 0},selected:{text:void 0,background:void 0},disabled:{text:void 0,background:void 0},shadow:void 0,border:void 0,sideMenu:void 0,highlights:{gray:{text:void 0,background:void 0},brown:{text:void 0,background:void 0},red:{text:void 0,background:void 0},orange:{text:void 0,background:void 0},yellow:{text:void 0,background:void 0},green:{text:void 0,background:void 0},blue:{text:void 0,background:void 0},purple:{text:void 0,background:void 0},pink:{text:void 0,background:void 0}}},borderRadius:void 0,fontFamily:void 0},hl=e=>Vt(fl,e,!0),qt=e=>r.jsxs(Oe,{gap:0,className:"bn-tooltip",children:[r.jsx($,{size:"sm",lineClamp:5,children:e.mainTooltip}),e.secondaryTooltip&&r.jsx($,{size:"xs",lineClamp:5,children:e.secondaryTooltip})]}),ye=d.forwardRef((e,o)=>{let{className:t,children:n,mainTooltip:l,secondaryTooltip:i,icon:s,isSelected:a,isDisabled:c,onClick:u,label:m,variant:p,...g}=e;j(g,!1);let[b,f]=d.useState(!1),x=n?r.jsx(V,{"aria-label":m,className:t,onMouseDown:C=>{Re()&&C.currentTarget.focus()},onClick:C=>{f(!0),u?.(C)},onPointerLeave:()=>f(!1),"aria-pressed":a,"data-selected":a||void 0,"data-test":l?l.slice(0,1).toLowerCase()+l.replace(/\s+/g,"").slice(1):void 0,size:p==="compact"?"compact-xs":"xs",disabled:c||!1,ref:o,...g,children:n}):r.jsx(Ne,{className:t,"aria-label":m,onMouseDown:C=>{Re()&&C.currentTarget.focus()},onClick:C=>{f(!0),u?.(C)},onPointerLeave:()=>f(!1),"aria-pressed":a,"data-selected":a||void 0,"data-test":l?l.slice(0,1).toLowerCase()+l.replace(/\s+/g,"").slice(1):void 0,size:p==="compact"?20:30,disabled:c||!1,ref:o,...g,children:s});return l?r.jsx(kt,{disabled:b,withinPortal:!1,label:r.jsx(qt,{mainTooltip:l,secondaryTooltip:i}),children:x}):x}),xl=d.forwardRef((e,o)=>{let{className:t,text:n,icon:l,isSelected:i,mainTooltip:s,secondaryTooltip:a,onClick:c,onMouseEnter:u,...m}=e;j(m,!1);let[p,g]=d.useState(!1),b=r.jsxs(Io,{className:t,checked:i===!0,wrapperProps:{onMouseEnter:u,onMouseLeave:()=>g(!1),onClick:f=>{g(!0),c?.(f)}},variant:"light",icon:null,ref:o,children:[r.jsx("span",{children:l}),r.jsx("span",{children:n})]});return!s||p?b:r.jsx(kt,{refProp:"rootRef",withinPortal:!1,label:r.jsx(qt,{mainTooltip:s,secondaryTooltip:a}),children:b})}),vl=d.forwardRef((e,o)=>{let{className:t,children:n,...l}=e;return j(l),r.jsx(M,{className:t,ref:o,children:n})}),Cl=d.forwardRef((e,o)=>{let{className:t,children:n,headerText:l,selected:i,onFocus:s,onBlur:a,tabIndex:c,...u}=e;return j(u,!1),r.jsxs(vt,{className:R(t,i?"selected":""),onFocus:s,onBlur:a,tabIndex:c,ref:o,children:[l&&r.jsx($,{className:"bn-header-text",children:l}),n]})}),kl=d.forwardRef((e,o)=>{let{className:t,children:n,...l}=e;return j(l,!1),r.jsx(vt.Section,{className:t,ref:o,children:n})}),jl=d.forwardRef((e,o)=>{let{className:t,children:n,...l}=e;return j(l,!1),r.jsx(ho,{className:t,label:r.jsx($,{children:n}),ref:o})}),wl=d.forwardRef((e,o)=>{let{authorInfo:t,timeString:n,edited:l,...i}=e,s=k();return j(i,!1),t==="loading"?r.jsxs(M,{children:[r.jsx(qe,{height:24,width:24}),r.jsx("div",{children:r.jsx(qe,{height:12,width:100})})]}):r.jsxs(M,{children:[r.jsx(Eo,{src:t.avatarUrl,alt:t.username,radius:"xl",size:"sm",color:"initials"}),r.jsxs($,{fz:"sm",fw:"bold",children:[t.username,r.jsxs($,{fz:"xs",c:"dimmed",span:!0,ml:"xs",children:[n," ",l&&`(${s.comments.edited})`]})]})]})}),yl=d.forwardRef((e,o)=>{let{className:t,showActions:n,authorInfo:l,timeString:i,edited:s,actions:a,emojiPickerOpen:c,children:u,...m}=e,{hovered:p,ref:g}=xo(),b=bl([o,g]);return j(m,!1),r.jsxs(M,{pos:"relative",ref:b,className:t,children:[a&&(n===!0||n===void 0||n==="hover"&&p||c)?r.jsx(M,{style:{position:"absolute",right:0,top:0,zIndex:10},children:a}):null,r.jsx(wl,{...e}),u]})}),Sl=d.forwardRef((e,o)=>{let{className:t,autoFocus:n,onFocus:l,onBlur:i,editor:s,editable:a,...c}=e;j(c,!1);let u=O();return r.jsx(ri,{autoFocus:n,className:t,editor:e.editor,sideMenu:!1,slashMenu:!1,tableHandles:!1,filePanel:!1,formattingToolbar:!1,editable:a,theme:u?.colorSchemePreference,ref:o,onFocus:l,onBlur:i,children:r.jsx(At,{formattingToolbar:Tl})})}),Tl=()=>r.jsx(Lt,{blockTypeSelectItems:[],children:Dt([]).filter(e=>e.key!=="nestBlockButton"&&e.key!=="unnestBlockButton")}),_l=d.forwardRef((e,o)=>{let{className:t,name:n,label:l,variant:i,icon:s,value:a,autoFocus:c,placeholder:u,disabled:m,onKeyDown:p,onChange:g,onSubmit:b,autoComplete:f,"aria-activedescendant":x,rightSection:C,...T}=e;return j(T),r.jsx(jt,{size:"xs",className:R(t||"",i==="large"?"bn-mt-input-large":""),ref:o,name:n,label:l,leftSection:s,value:a,autoFocus:c,"data-autofocus":c?"true":void 0,rightSection:C,placeholder:u,disabled:m,onKeyDown:p,onChange:g,onSubmit:b,autoComplete:f,"aria-activedescendant":x})}),Rl=d.createContext(void 0),El=e=>{let{children:o,onOpenChange:t,position:n,sub:l,...i}=e;return j(i),l?r.jsx(N.Sub,{transitionProps:{duration:250,exitDelay:250},withinPortal:!1,middlewares:{flip:!0,shift:!0,inline:!1,size:!0},onChange:t,position:n,children:o}):r.jsx(N,{withinPortal:!1,middlewares:{flip:!0,shift:!0,inline:!1,size:!0},onChange:t,position:n,returnFocus:!1,children:o})},Il=d.forwardRef((e,o)=>{let{className:t,children:n,icon:l,checked:i,subTrigger:s,onClick:a,...c}=e;return j(c,!1),r.jsx(s?N.Sub.Item:N.Item,{className:t,ref:o,leftSection:l,rightSection:i?r.jsx(Ct,{size:10}):i===!1?r.jsx("div",{className:"bn-tick-space"}):null,onClick:a,...c,children:n})}),Ml=e=>{let{children:o,sub:t,...n}=e;return j(n),r.jsx(t?N.Sub.Target:N.Target,{children:o})},Pl=d.forwardRef((e,o)=>{let{className:t,children:n,sub:l,...i}=e;j(i);let s=d.useContext(Rl);return r.jsx(l?N.Sub.Dropdown:N.Dropdown,{className:t,ref:o,onMouseOver:s?.onMenuMouseOver,onMouseLeave:s?.onMenuMouseLeave,children:n})}),Nl=d.forwardRef((e,o)=>{let{className:t,...n}=e;return j(n),r.jsx(N.Divider,{className:t,ref:o})}),Bl=d.forwardRef((e,o)=>{let{className:t,children:n,...l}=e;return j(l),r.jsx(N.Label,{className:t,ref:o,children:n})}),Ol=d.forwardRef((e,o)=>{let{className:t,children:n,icon:l,onClick:i,onDragEnd:s,onDragStart:a,draggable:c,label:u,...m}=e;return j(m,!1),l?r.jsx(Ne,{size:24,className:t,ref:o,onClick:i,onDragEnd:s,onDragStart:a,draggable:c,"aria-label":u,...m,children:l}):r.jsx(V,{className:t,ref:o,onClick:i,onDragEnd:s,onDragStart:a,draggable:c,"aria-label":u,...m,children:n})}),Fl=d.forwardRef((e,o)=>{let{className:t,tabs:n,defaultOpenTab:l,openTab:i,setOpenTab:s,loading:a,...c}=e;return j(c),r.jsx(M,{className:t,ref:o,children:r.jsxs(oe,{value:i,defaultValue:l,onChange:s,children:[a&&r.jsx(Ro,{visible:a}),r.jsx(oe.List,{children:n.map(u=>r.jsx(oe.Tab,{"data-test":`${u.name.toLowerCase()}-tab`,value:u.name,children:u.name},u.name))}),n.map(u=>r.jsx(oe.Panel,{value:u.name,children:u.tabPanel},u.name))]})})}),Dl=d.forwardRef((e,o)=>{let{className:t,children:n,onClick:l,label:i,...s}=e;return j(s),r.jsx(V,{size:"xs","aria-label":i,className:t,ref:o,onClick:l,...s,children:n})}),Ll=d.forwardRef((e,o)=>{let{className:t,accept:n,value:l,placeholder:i,onChange:s,...a}=e;return j(a),r.jsx(_o,{size:"xs",className:t,ref:o,accept:n,value:l,placeholder:i,onChange:s,...a})}),Al=d.forwardRef((e,o)=>{let{className:t,children:n,...l}=e;return j(l),r.jsx("div",{className:t,ref:o,children:n})}),zl=d.forwardRef((e,o)=>{let{className:t,value:n,placeholder:l,onKeyDown:i,onChange:s,...a}=e;return j(a),r.jsx(jt,{size:"xs","data-test":"embed-input",className:t,ref:o,value:n,placeholder:l,onKeyDown:i,onChange:s})}),Gl=e=>{let{open:o,onOpenChange:t,position:n,portalRoot:l,children:i,...s}=e;return j(s),r.jsx(So,{middlewares:{size:{padding:20}},withinPortal:!!l,portalProps:l?{target:l}:void 0,opened:o,onChange:t,position:n,children:i})},$l=e=>{let{children:o,...t}=e;return j(t),r.jsx(yo,{children:o})},Hl=d.forwardRef((e,o)=>{let{className:t,children:n,variant:l,...i}=e;return j(i),r.jsx(wo,{className:t,ref:o,children:n})}),Ul=d.forwardRef((e,o)=>{let{className:t,children:n,...l}=e;return j(l,!1),r.jsx(M,{align:"center",gap:0,className:t,ref:o,...l,children:n})}),Vl=d.forwardRef((e,o)=>{let{className:t,children:n,icon:l,onClick:i,onDragEnd:s,onDragStart:a,draggable:c,label:u,...m}=e;return j(m,!1),l?r.jsx(Ne,{size:24,className:t,ref:o,onClick:i,onDragEnd:s,onDragStart:a,draggable:c,"aria-label":u,...m,children:l}):r.jsx(V,{className:t,ref:o,onClick:i,onDragEnd:s,onDragStart:a,draggable:c,"aria-label":u,...m,children:n})}),ql=d.forwardRef((e,o)=>{let{className:t,children:n,id:l,...i}=e;return j(i),r.jsx(Oe,{gap:0,className:t,ref:o,id:l,role:"listbox",children:n})}),Kl=d.forwardRef((e,o)=>{let{className:t,children:n,...l}=e;return j(l),r.jsx(M,{className:t,ref:o,children:r.jsx(M,{className:"bn-mt-suggestion-menu-item-title",children:n})})}),Ql=d.forwardRef((e,o)=>{let{className:t,isSelected:n,onClick:l,item:i,id:s,...a}=e;j(a);let c=d.useRef(null);return d.useEffect(()=>{!c.current||!n||Ut(c.current,c.current.closest(".bn-suggestion-menu, #ai-suggestion-menu"))!=="none"&&c.current.scrollIntoView({block:"nearest"})},[n]),r.jsxs(M,{gap:0,className:t,ref:Be(o,c),id:s,role:"option",onMouseDown:u=>u.preventDefault(),onClick:l,"aria-selected":n||void 0,children:[i.icon&&r.jsx(M,{className:"bn-mt-suggestion-menu-item-section","data-position":"left",children:i.icon}),r.jsxs(Oe,{gap:0,className:"bn-mt-suggestion-menu-item-body",children:[r.jsx($,{className:"bn-mt-suggestion-menu-item-title",children:i.title}),r.jsx($,{className:"bn-mt-suggestion-menu-item-subtitle",children:i.subtext})]}),i.badge&&r.jsx(M,{"data-position":"right",className:"bn-mt-suggestion-menu-item-section",children:r.jsx(To,{size:"xs",children:i.badge})})]})}),Wl=d.forwardRef((e,o)=>{let{className:t,children:n,...l}=e;return j(l),r.jsx(M,{className:t,ref:o,children:n})}),Yl=d.forwardRef((e,o)=>{let{className:t,...n}=e;return j(n),r.jsx(wt,{className:t,type:"dots",size:16,ref:o})}),Zl=d.forwardRef((e,o)=>{let{className:t,children:n,id:l,columns:i,...s}=e;return j(s),r.jsx("div",{className:t,style:{gridTemplateColumns:`repeat(${i}, 1fr)`},ref:o,id:l,role:"grid",children:n})}),Xl=d.forwardRef((e,o)=>{let{className:t,children:n,columns:l,...i}=e;return j(i),r.jsx(M,{className:t,style:{gridColumn:`1 / ${l+1}`},ref:o,children:r.jsx(M,{className:"bn-mt-suggestion-menu-item-title",children:n})})}),Jl=d.forwardRef((e,o)=>{let{className:t,isSelected:n,onClick:l,item:i,id:s,...a}=e;j(a);let c=d.useRef(null);return d.useEffect(()=>{!c.current||!n||Ut(c.current,c.current.closest(".bn-grid-suggestion-menu"))!=="none"&&c.current.scrollIntoView({block:"nearest"})},[n]),r.jsx("div",{className:t,ref:Be(o,c),id:s,role:"option",onClick:l,"aria-selected":n||void 0,children:i.icon})}),ei=d.forwardRef((e,o)=>{let{className:t,children:n,columns:l,...i}=e;return j(i),r.jsx(wt,{className:t,style:{gridColumn:`1 / ${l+1}`},type:"dots",ref:o})}),ti=d.forwardRef((e,o)=>{let{children:t,className:n,onMouseDown:l,onClick:i,...s}=e;return j(s,!1),r.jsx(V,{className:n,ref:o,onMouseDown:l,onClick:i,...s,children:t})}),ni=d.forwardRef((e,o)=>{let{className:t,children:n,draggable:l,onDragStart:i,onDragEnd:s,style:a,label:c,...u}=e;return j(u,!1),r.jsx(V,{className:t,ref:o,"aria-label":c,draggable:l,onDragStart:i,onDragEnd:s,style:a,...u,children:n})}),Se=d.forwardRef((e,o)=>{let{className:t,children:n,onMouseEnter:l,onMouseLeave:i,variant:s,...a}=e;j(a);let{ref:c,focused:u}=Co();return r.jsx(ko,{className:t,ref:Be(o,c,jo(u)),role:"toolbar",onMouseEnter:l,onMouseLeave:i,gap:s==="action-toolbar"?2:void 0,children:n})}),Te=d.forwardRef((e,o)=>{let{className:t,items:n,isDisabled:l,...i}=e;j(i);let s=n.filter(a=>a.isSelected)[0];return s?r.jsxs(N,{withinPortal:!1,transitionProps:{exitDuration:0},disabled:l,middlewares:{flip:!0,shift:!0,inline:!1,size:!0},children:[r.jsx(N.Target,{children:r.jsx(V,{onMouseDown:a=>{Re()&&a.currentTarget.focus()},leftSection:s.icon,rightSection:r.jsx(vo,{}),size:"xs",variant:"subtle",disabled:l,children:s.text})}),r.jsx(N.Dropdown,{className:t,ref:o,children:n.map(a=>r.jsx(N.Item,{onClick:a.onClick,leftSection:a.icon,rightSection:a.isSelected?r.jsx(Ct,{size:10,className:"bn-tick-icon"}):r.jsx("div",{className:"bn-tick-space"}),disabled:a.isDisabled,children:a.text},a.text))})]}):null}),oi={FormattingToolbar:{Root:Se,Button:ye,Select:Te},FilePanel:{Root:Fl,Button:Dl,FileInput:Ll,TabPanel:Al,TextInput:zl},GridSuggestionMenu:{Root:Zl,Item:Jl,EmptyItem:Xl,Loader:ei},LinkToolbar:{Root:Se,Button:ye,Select:Te},SideMenu:{Root:Ul,Button:Vl},SuggestionMenu:{Root:ql,Item:Ql,EmptyItem:Kl,Label:Wl,Loader:Yl},TableHandle:{Root:ni,ExtendButton:ti},Generic:{Badge:{Root:xl,Group:vl},Form:{Root:e=>r.jsx("div",{children:e.children}),TextInput:_l},Menu:{Root:El,Trigger:Ml,Dropdown:Pl,Divider:Nl,Label:Bl,Item:Il,Button:Ol},Popover:{Root:Gl,Trigger:$l,Content:Hl},Toolbar:{Root:Se,Button:ye,Select:Te}},Comments:{Comment:yl,Editor:Sl,Card:Cl,CardSection:kl,ExpandSectionsPrompt:jl}},ri=e=>{let{className:o,theme:t,editor:n,...l}=e,i=O(),s=$t(),a=i?.colorSchemePreference||s,c=typeof t=="string"?t:a==="no-preference"?"light":a,u=d.useCallback(g=>{if(g&&(hl(g),typeof t=="object")){if("light"in t&&"dark"in t){Je(t[a==="dark"?"dark":"light"],g);return}Je(t,g);return}},[a,t]);d.useEffect(()=>{if(!n.portalElement)throw Error("Portal element not found");n.portalElement.setAttribute("data-mantine-color-scheme",c),u(n.portalElement)},[n,u,c]);let m=d.useContext(bo),p=r.jsx(St.Provider,{value:oi,children:r.jsx(ml,{"data-mantine-color-scheme":c,className:R("bn-mantine",o||""),theme:typeof t=="object"?void 0:t,editor:n,...l,ref:u})});return m?p:r.jsx(fo,{withCssVariables:!1,getRootElement:()=>{},children:p})};export{De as K,gi as L,v as M,pi as Z,ri as a,Gr as h,zr as m};
@@ -56,7 +56,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/alert-
56
56
  `);return i===-1?"":o.stack.slice(i+1)})();try{if(!r.stack)r.stack=s;else if(s){const i=s.indexOf(`
57
57
  `),a=i===-1?-1:s.indexOf(`
58
58
  `,i+1),c=a===-1?"":s.slice(a+1);String(r.stack).endsWith(c)||(r.stack+=`
59
- `+s)}}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Tt(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:s}=n;r!==void 0&&Kn.assertOptions(r,{silentJSONParsing:Te.transitional(Te.boolean),forcedJSONParsing:Te.transitional(Te.boolean),clarifyTimeoutError:Te.transitional(Te.boolean),legacyInterceptorReqResOrdering:Te.transitional(Te.boolean),advertiseZstdAcceptEncoding:Te.transitional(Te.boolean),validateStatusUndefinedResolves:Te.transitional(Te.boolean)},!1),o!=null&&(w.isFunction(o)?n.paramsSerializer={serialize:o}:Kn.assertOptions(o,{encode:Te.function,serialize:Te.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Kn.assertOptions(n,{baseUrl:Te.spelling("baseURL"),withXsrfToken:Te.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=s&&w.merge(s.common,s[n.method]);s&&w.forEach(["delete","get","head","post","put","patch","query","common"],b=>{delete s[b]}),n.headers=Re.concat(i,s);const a=[];let c=!0;this.interceptors.request.forEach(function(g){if(typeof g.runWhen=="function"&&g.runWhen(n)===!1)return;c=c&&g.synchronous;const y=n.transitional||fs;y&&y.legacyInterceptorReqResOrdering?a.unshift(g.fulfilled,g.rejected):a.push(g.fulfilled,g.rejected)});const d=[];this.interceptors.response.forEach(function(g){d.push(g.fulfilled,g.rejected)});let f,u=0,h;if(!c){const b=[Ba.bind(this),void 0];for(b.unshift(...a),b.push(...d),h=b.length,f=Promise.resolve(n);u<h;)f=f.then(b[u++],b[u++]);return f}h=a.length;let m=n;for(;u<h;){const b=a[u++],g=a[u++];try{m=b(m)}catch(y){g.call(this,y);break}}try{f=Ba.call(this,m)}catch(b){return Promise.reject(b)}for(u=0,h=d.length;u<h;)f=f.then(d[u++],d[u++]);return f}getUri(t){t=Tt(this.defaults,t);const n=cl(t.baseURL,t.url,t.allowAbsoluteUrls,t);return rl(n,t.params,t.paramsSerializer)}};w.forEach(["delete","get","head","options"],function(t){yt.prototype[t]=function(n,r){return this.request(Tt(r||{},{method:t,url:n,data:r&&w.hasOwnProp(r,"data")?r.data:void 0}))}});w.forEach(["post","put","patch","query"],function(t){function n(r){return function(s,i,a){return this.request(Tt(a||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:i}))}}yt.prototype[t]=n(),t!=="query"&&(yt.prototype[t+"Form"]=n(!0))});let by=class fl{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(s){n=s});const r=this;this.promise.then(o=>{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](o);r._listeners=null}),this.promise.then=o=>{let s;const i=new Promise(a=>{r.subscribe(a),s=a}).then(o);return i.cancel=function(){r.unsubscribe(s)},i},t(function(s,i,a){r.reason||(r.reason=new Rn(s,i,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new fl(function(o){t=o}),cancel:t}}};function xy(e){return function(n){return e.apply(null,n)}}function wy(e){return w.isObject(e)&&e.isAxiosError===!0}const To={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(To).forEach(([e,t])=>{To[t]=e});function pl(e){const t=new yt(e),n=Vc(yt.prototype.request,t);return w.extend(n,yt.prototype,t,{allOwnKeys:!0}),w.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return pl(Tt(e,o))},n}const ue=pl(Tn);ue.Axios=yt;ue.CanceledError=Rn;ue.CancelToken=by;ue.isCancel=al;ue.VERSION=hs;ue.toFormData=yr;ue.AxiosError=N;ue.Cancel=ue.CanceledError;ue.all=function(t){return Promise.all(t)};ue.spread=xy;ue.isAxiosError=wy;ue.mergeConfig=Tt;ue.AxiosHeaders=Re;ue.formToJSON=e=>sl(w.isHTMLForm(e)?new FormData(e):e);ue.getAdapter=dl.getAdapter;ue.HttpStatusCode=To;ue.default=ue;const{Axios:cE,AxiosError:lE,CanceledError:uE,isCancel:dE,CancelToken:fE,VERSION:pE,all:hE,Cancel:mE,isAxiosError:gE,spread:vE,toFormData:yE,AxiosHeaders:bE,HttpStatusCode:xE,formToJSON:wE,getAdapter:EE,mergeConfig:SE,create:CE}=ue,Ey=e=>!e||e.length===0?null:[...new Set(e)].sort(),Sy=e=>!e||e.length===0?[]:[...new Set(e.map(t=>t.trim()).filter(Boolean))].sort(),Cy=e=>!e||e.length===0?null:[...new Set(e)].sort(),TE={notes:{all:()=>["notes"],listAll:()=>["notes","list"],list:(e={})=>["notes","list",{limit:e.limit??25,offset:e.offset??0,query:e.query??"",sortBy:e.sortBy??null,sortOrder:e.sortOrder??null,pinnedFirst:e.pinnedFirst??null,fields:Ey(e.fields)}],tagListAll:()=>["notes","tag-list"],tagList:(e={})=>["notes","tag-list",{limit:e.limit??25,offset:e.offset??0,query:e.query??""}],tagNameListAll:()=>["notes","tag-name-list"],tagNameList:e=>["notes","tag-name-list",{limit:e.limit??25,offset:e.offset??0,mode:e.mode??"and",tagNames:Sy(e.tagNames)}],detail:e=>["notes","detail",{id:e}],snapshots:(e,t=10)=>["notes","snapshots",{id:e,limit:t}],snapshotDetail:e=>["notes","snapshot-detail",{id:e}],trashAll:()=>["notes","trash"],trash:(e={})=>["notes","trash",{limit:e.limit??25,offset:e.offset??0}],trashDetail:e=>["notes","trash","detail",{id:e}],pinned:()=>["notes","pinned"],backReferencesAll:()=>["notes","back-references"],backReferences:e=>["notes","back-references",{noteId:e}],graph:()=>["notes","graph"],propertyKeysAll:()=>["notes","property-keys"],propertyKeys:(e={})=>["notes","property-keys",{query:e.query??"",limit:e.limit??50,offset:e.offset??0}]},tags:{all:()=>["tags"],list:(e={})=>["tags","list",{limit:e.limit??50,offset:e.offset??0,query:e.query??"",sortBy:e.sortBy??"referenceCount",sortOrder:e.sortOrder??"desc"}]},images:{all:()=>["images"],listAll:()=>["images","list"],list:(e={})=>["images","list",{limit:e.limit??50,offset:e.offset??0}],detail:e=>["images","detail",{id:e}],notes:e=>["images","notes",{id:e}]},reminders:{all:()=>["reminders"],note:(e,t={})=>["reminders","note",e,{limit:t.limit??10,offset:t.offset??0}],noteAllPages:e=>["reminders","note",e],upcoming:(e={})=>["reminders","upcoming",{limit:e.limit??10,offset:e.offset??0}],upcomingAllPages:()=>["reminders","upcoming"],inDateRangeAll:()=>["reminders","in-date-range"],inDateRange:(e,t)=>["reminders","in-date-range",{year:e,month:t}]},placeholders:{all:()=>["placeholders"],listAll:()=>["placeholders","list"],list:(e={})=>["placeholders","list",{limit:e.limit??25,offset:e.offset??0,query:e.query??"",fields:Cy(e.fields)}]},calendar:{all:()=>["calendar"],notesInDateRange:(e,t)=>["calendar","notes-in-date-range",{year:e,month:t}]},views:{all:()=>["views"],workspace:()=>["views","workspace"],section:e=>["views","section",{id:e}],sectionNotesAll:()=>["views","section-notes"],sectionNotes:(e,t={})=>["views","section-notes",{id:e,limit:t.limit??25,offset:t.offset??0}]},search:{all:()=>["search"],resultsAll:()=>["search","results"],results:e=>["search","results",{query:e.query.trim(),limit:e.limit??25,offset:e.offset??0,mode:e.mode??"hybrid"}],adminStatus:()=>["search","admin-status"]},ui:{heroBanner:()=>["ui","hero-banner"]}},Ty={sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"},Ha={sm:10,md:12,lg:14},Ry=l.forwardRef(({className:e,size:t="md",checked:n,disabled:r,...o},s)=>p.jsxs("label",{className:fe("relative inline-flex items-center justify-center cursor-pointer",r&&"cursor-not-allowed opacity-50",e),children:[p.jsx("input",{ref:s,type:"checkbox",checked:n,disabled:r,className:"sr-only peer",...o}),p.jsx("span",{className:fe(Ty[t],"flex items-center justify-center","border border-border-secondary","rounded-[6px]","bg-surface","transition-all duration-200","peer-checked:bg-cta","peer-checked:border-cta","focus-ring-soft","peer-focus-visible:border-border-focus","peer-focus-visible:shadow-[0_0_0_4px_color-mix(in_srgb,var(--accent-soft-primary)_90%,transparent)]"),children:n&&p.jsx(Fm,{width:Ha[t],height:Ha[t],className:"text-fg-on-filled",weight:"bold"})})]}));Ry.displayName="Checkbox";var Py=lc,Ay=uc,hl=dc,ml=fc,Oy=rs,gl=pc,vl=hc;const Ny=Py,_y=Ay,Iy=Oy,yl=l.createContext("default"),Pn=()=>l.useContext(yl),bl=l.forwardRef(({className:e,...t},n)=>p.jsx(hl,{ref:n,className:fe("fixed","inset-0","z-[1090]","bg-overlay","backdrop-blur-[2px]","data-[state=open]:animate-in","data-[state=closed]:animate-out","data-[state=closed]:fade-out-0","data-[state=open]:fade-in-0",e),...t}));bl.displayName=hl.displayName;const xl=l.forwardRef(({className:e,children:t,variant:n="default",...r},o)=>p.jsxs(_y,{children:[p.jsx(bl,{}),p.jsx("div",{className:"pointer-events-none fixed inset-0 z-[1100] flex items-center justify-center p-4",children:p.jsx(ml,{ref:o,"data-dialog-variant":n,className:os({variant:n,className:e}),...r,children:p.jsx(yl.Provider,{value:n,children:t})})})]}));xl.displayName=ml.displayName;const wl=({title:e,onClose:t,className:n})=>{const r=Pn();return p.jsxs("div",{className:Hm({variant:r,className:n}),children:[p.jsx(Cl,{children:e}),t&&p.jsx(Iy,{asChild:!0,children:p.jsx("button",{type:"button","aria-label":"Close dialog",className:Vm({variant:r}),onClick:t,children:p.jsx(Bm,{className:r==="compact"||r==="form"||r==="confirm"?"h-[18px] w-[18px]":"h-5 w-5"})})})]})};wl.displayName="DialogHeader";const El=l.forwardRef(({className:e,...t},n)=>{const r=Pn();return p.jsx("div",{ref:n,className:ss({variant:r,className:e}),...t})});El.displayName="DialogBody";const Sl=l.forwardRef(({className:e,...t},n)=>{const r=Pn();return p.jsx("div",{ref:n,className:as({variant:r,className:e}),...t})});Sl.displayName="DialogFooter";const Cl=l.forwardRef(({className:e,...t},n)=>{const r=Pn();return p.jsx(gl,{ref:n,className:fe(is({variant:r}),e),...t})});Cl.displayName=gl.displayName;const Tl=l.forwardRef(({className:e,...t},n)=>{const r=Pn();return p.jsx(vl,{ref:n,className:fe(cs({variant:r}),e),...t})});Tl.displayName=vl.displayName;const xr=({isOpen:e,onClose:t,children:n,className:r,variant:o="default"})=>p.jsx(Ny,{open:e,onOpenChange:s=>!s&&t(),children:p.jsx(xl,{variant:o,className:r,children:n})});xr.Header=wl;xr.Body=El;xr.Footer=Sl;xr.Description=Tl;function gs(e){const t=e+"CollectionProvider",[n,r]=Xe(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=g=>{const{scope:y,children:v}=g,x=C.useRef(null),E=C.useRef(new Map).current;return p.jsx(o,{scope:y,itemMap:E,collectionRef:x,children:v})};i.displayName=t;const a=e+"CollectionSlot",c=Gt(a),d=C.forwardRef((g,y)=>{const{scope:v,children:x}=g,E=s(a,v),S=re(y,E.collectionRef);return p.jsx(c,{ref:S,children:x})});d.displayName=a;const f=e+"CollectionItemSlot",u="data-radix-collection-item",h=Gt(f),m=C.forwardRef((g,y)=>{const{scope:v,children:x,...E}=g,S=C.useRef(null),T=re(y,S),P=s(f,v);return C.useEffect(()=>(P.itemMap.set(S,{ref:S,...E}),()=>{P.itemMap.delete(S)})),p.jsx(h,{[u]:"",ref:T,children:x})});m.displayName=f;function b(g){const y=s(e+"CollectionConsumer",g);return C.useCallback(()=>{const x=y.collectionRef.current;if(!x)return[];const E=Array.from(x.querySelectorAll(`[${u}]`));return Array.from(y.itemMap.values()).sort((P,R)=>E.indexOf(P.ref.current)-E.indexOf(R.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:i,Slot:d,ItemSlot:m},b,r]}var My=l.createContext(void 0);function wr(e){const t=l.useContext(My);return e||t||"ltr"}var Dy="Arrow",Rl=l.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...s}=e;return p.jsx(Y.svg,{...s,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:p.jsx("polygon",{points:"0,0 30,0 15,10"})})});Rl.displayName=Dy;var jy=Rl;function Ly(e){const[t,n]=l.useState(void 0);return Pe(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let i,a;if("borderBoxSize"in s){const c=s.borderBoxSize,d=Array.isArray(c)?c[0]:c;i=d.inlineSize,a=d.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var vs="Popper",[Pl,Jt]=Xe(vs),[ky,Al]=Pl(vs),Ol=e=>{const{__scopePopper:t,children:n}=e,[r,o]=l.useState(null);return p.jsx(ky,{scope:t,anchor:r,onAnchorChange:o,children:n})};Ol.displayName=vs;var Nl="PopperAnchor",_l=l.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,s=Al(Nl,n),i=l.useRef(null),a=re(t,i),c=l.useRef(null);return l.useEffect(()=>{const d=c.current;c.current=r?.current||i.current,d!==c.current&&s.onAnchorChange(c.current)}),r?null:p.jsx(Y.div,{...o,ref:a})});_l.displayName=Nl;var ys="PopperContent",[Fy,$y]=Pl(ys),Il=l.forwardRef((e,t)=>{const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,arrowPadding:a=0,avoidCollisions:c=!0,collisionBoundary:d=[],collisionPadding:f=0,sticky:u="partial",hideWhenDetached:h=!1,updatePositionStrategy:m="optimized",onPlaced:b,...g}=e,y=Al(ys,n),[v,x]=l.useState(null),E=re(t,O=>x(O)),[S,T]=l.useState(null),P=Ly(S),R=P?.width??0,A=P?.height??0,_=r+(s!=="center"?"-"+s:""),D=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},k=Array.isArray(d)?d:[d],U=k.length>0,H={padding:D,boundary:k.filter(Uy),altBoundary:U},{refs:Q,floatingStyles:ne,placement:L,isPositioned:Z,middlewareData:te}=Kd({strategy:"fixed",placement:_,whileElementsMounted:(...O)=>tf(...O,{animationFrame:m==="always"}),elements:{reference:y.anchor},middleware:[Zd({mainAxis:o+A,alignmentAxis:i}),c&&Qd({mainAxis:!0,crossAxis:!1,limiter:u==="partial"?nf():void 0,...H}),c&&Yd({...H}),Xd({...H,apply:({elements:O,rects:j,availableWidth:oe,availableHeight:ee})=>{const{width:X,height:G}=j.reference,me=O.floating.style;me.setProperty("--radix-popper-available-width",`${oe}px`),me.setProperty("--radix-popper-available-height",`${ee}px`),me.setProperty("--radix-popper-anchor-width",`${X}px`),me.setProperty("--radix-popper-anchor-height",`${G}px`)}}),S&&Jd({element:S,padding:a}),Hy({arrowWidth:R,arrowHeight:A}),h&&ef({strategy:"referenceHidden",...H})]}),[I,J]=jl(L),W=Ye(b);Pe(()=>{Z&&W?.()},[Z,W]);const ae=te.arrow?.x,$=te.arrow?.y,q=te.arrow?.centerOffset!==0,[V,F]=l.useState();return Pe(()=>{v&&F(window.getComputedStyle(v).zIndex)},[v]),p.jsx("div",{ref:Q.setFloating,"data-radix-popper-content-wrapper":"",style:{...ne,transform:Z?ne.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:V,"--radix-popper-transform-origin":[te.transformOrigin?.x,te.transformOrigin?.y].join(" "),...te.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:p.jsx(Fy,{scope:n,placedSide:I,onArrowChange:T,arrowX:ae,arrowY:$,shouldHideArrow:q,children:p.jsx(Y.div,{"data-side":I,"data-align":J,...g,ref:E,style:{...g.style,animation:Z?void 0:"none"}})})})});Il.displayName=ys;var Ml="PopperArrow",By={top:"bottom",right:"left",bottom:"top",left:"right"},Dl=l.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,s=$y(Ml,r),i=By[s.placedSide];return p.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:p.jsx(jy,{...o,ref:n,style:{...o.style,display:"block"}})})});Dl.displayName=Ml;function Uy(e){return e!==null}var Hy=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:o}=t,i=o.arrow?.centerOffset!==0,a=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[d,f]=jl(n),u={start:"0%",center:"50%",end:"100%"}[f],h=(o.arrow?.x??0)+a/2,m=(o.arrow?.y??0)+c/2;let b="",g="";return d==="bottom"?(b=i?u:`${h}px`,g=`${-c}px`):d==="top"?(b=i?u:`${h}px`,g=`${r.floating.height+c}px`):d==="right"?(b=`${-c}px`,g=i?u:`${m}px`):d==="left"&&(b=`${r.floating.width+c}px`,g=i?u:`${m}px`),{data:{x:b,y:g}}}});function jl(e){const[t,n="center"]=e.split("-");return[t,n]}var bs=Ol,xs=_l,ws=Il,Es=Dl,eo="rovingFocusGroup.onEntryFocus",Vy={bubbles:!1,cancelable:!0},An="RovingFocusGroup",[Ro,Ll,qy]=gs(An),[Wy,Er]=Xe(An,[qy]),[zy,Gy]=Wy(An),kl=l.forwardRef((e,t)=>p.jsx(Ro.Provider,{scope:e.__scopeRovingFocusGroup,children:p.jsx(Ro.Slot,{scope:e.__scopeRovingFocusGroup,children:p.jsx(Ky,{...e,ref:t})})}));kl.displayName=An;var Ky=l.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:s,currentTabStopId:i,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...u}=e,h=l.useRef(null),m=re(t,h),b=wr(s),[g,y]=nt({prop:i,defaultProp:a??null,onChange:c,caller:An}),[v,x]=l.useState(!1),E=Ye(d),S=Ll(n),T=l.useRef(!1),[P,R]=l.useState(0);return l.useEffect(()=>{const A=h.current;if(A)return A.addEventListener(eo,E),()=>A.removeEventListener(eo,E)},[E]),p.jsx(zy,{scope:n,orientation:r,dir:b,loop:o,currentTabStopId:g,onItemFocus:l.useCallback(A=>y(A),[y]),onItemShiftTab:l.useCallback(()=>x(!0),[]),onFocusableItemAdd:l.useCallback(()=>R(A=>A+1),[]),onFocusableItemRemove:l.useCallback(()=>R(A=>A-1),[]),children:p.jsx(Y.div,{tabIndex:v||P===0?-1:0,"data-orientation":r,...u,ref:m,style:{outline:"none",...e.style},onMouseDown:M(e.onMouseDown,()=>{T.current=!0}),onFocus:M(e.onFocus,A=>{const _=!T.current;if(A.target===A.currentTarget&&_&&!v){const D=new CustomEvent(eo,Vy);if(A.currentTarget.dispatchEvent(D),!D.defaultPrevented){const k=S().filter(L=>L.focusable),U=k.find(L=>L.active),H=k.find(L=>L.id===g),ne=[U,H,...k].filter(Boolean).map(L=>L.ref.current);Bl(ne,f)}}T.current=!1}),onBlur:M(e.onBlur,()=>x(!1))})})}),Fl="RovingFocusGroupItem",$l=l.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,children:i,...a}=e,c=Ze(),d=s||c,f=Gy(Fl,n),u=f.currentTabStopId===d,h=Ll(n),{onFocusableItemAdd:m,onFocusableItemRemove:b,currentTabStopId:g}=f;return l.useEffect(()=>{if(r)return m(),()=>b()},[r,m,b]),p.jsx(Ro.ItemSlot,{scope:n,id:d,focusable:r,active:o,children:p.jsx(Y.span,{tabIndex:u?0:-1,"data-orientation":f.orientation,...a,ref:t,onMouseDown:M(e.onMouseDown,y=>{r?f.onItemFocus(d):y.preventDefault()}),onFocus:M(e.onFocus,()=>f.onItemFocus(d)),onKeyDown:M(e.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){f.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const v=Yy(y,f.orientation,f.dir);if(v!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let E=h().filter(S=>S.focusable).map(S=>S.ref.current);if(v==="last")E.reverse();else if(v==="prev"||v==="next"){v==="prev"&&E.reverse();const S=E.indexOf(y.currentTarget);E=f.loop?Xy(E,S+1):E.slice(S+1)}setTimeout(()=>Bl(E))}}),children:typeof i=="function"?i({isCurrentTabStop:u,hasTabStop:g!=null}):i})})});$l.displayName=Fl;var Zy={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Qy(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Yy(e,t,n){const r=Qy(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Zy[r]}function Bl(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Xy(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Ul=kl,Hl=$l,Po=["Enter"," "],Jy=["ArrowDown","PageUp","Home"],Vl=["ArrowUp","PageDown","End"],e0=[...Jy,...Vl],t0={ltr:[...Po,"ArrowRight"],rtl:[...Po,"ArrowLeft"]},n0={ltr:["ArrowLeft"],rtl:["ArrowRight"]},On="Menu",[hn,r0,o0]=gs(On),[Ot,ql]=Xe(On,[o0,Jt,Er]),Sr=Jt(),Wl=Er(),[s0,Nt]=Ot(On),[a0,Nn]=Ot(On),zl=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:o,onOpenChange:s,modal:i=!0}=e,a=Sr(t),[c,d]=l.useState(null),f=l.useRef(!1),u=Ye(s),h=wr(o);return l.useEffect(()=>{const m=()=>{f.current=!0,document.addEventListener("pointerdown",b,{capture:!0,once:!0}),document.addEventListener("pointermove",b,{capture:!0,once:!0})},b=()=>f.current=!1;return document.addEventListener("keydown",m,{capture:!0}),()=>{document.removeEventListener("keydown",m,{capture:!0}),document.removeEventListener("pointerdown",b,{capture:!0}),document.removeEventListener("pointermove",b,{capture:!0})}},[]),p.jsx(bs,{...a,children:p.jsx(s0,{scope:t,open:n,onOpenChange:u,content:c,onContentChange:d,children:p.jsx(a0,{scope:t,onClose:l.useCallback(()=>u(!1),[u]),isUsingKeyboardRef:f,dir:h,modal:i,children:r})})})};zl.displayName=On;var i0="MenuAnchor",Ss=l.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=Sr(n);return p.jsx(xs,{...o,...r,ref:t})});Ss.displayName=i0;var Cs="MenuPortal",[c0,Gl]=Ot(Cs,{forceMount:void 0}),Kl=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:o}=e,s=Nt(Cs,t);return p.jsx(c0,{scope:t,forceMount:n,children:p.jsx(Je,{present:n||s.open,children:p.jsx(En,{asChild:!0,container:o,children:r})})})};Kl.displayName=Cs;var Be="MenuContent",[l0,Ts]=Ot(Be),Zl=l.forwardRef((e,t)=>{const n=Gl(Be,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,s=Nt(Be,e.__scopeMenu),i=Nn(Be,e.__scopeMenu);return p.jsx(hn.Provider,{scope:e.__scopeMenu,children:p.jsx(Je,{present:r||s.open,children:p.jsx(hn.Slot,{scope:e.__scopeMenu,children:i.modal?p.jsx(u0,{...o,ref:t}):p.jsx(d0,{...o,ref:t})})})})}),u0=l.forwardRef((e,t)=>{const n=Nt(Be,e.__scopeMenu),r=l.useRef(null),o=re(t,r);return l.useEffect(()=>{const s=r.current;if(s)return Jo(s)},[]),p.jsx(Rs,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:M(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),d0=l.forwardRef((e,t)=>{const n=Nt(Be,e.__scopeMenu);return p.jsx(Rs,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),f0=Gt("MenuContent.ScrollLock"),Rs=l.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:a,onEntryFocus:c,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:u,onInteractOutside:h,onDismiss:m,disableOutsideScroll:b,...g}=e,y=Nt(Be,n),v=Nn(Be,n),x=Sr(n),E=Wl(n),S=r0(n),[T,P]=l.useState(null),R=l.useRef(null),A=re(t,R,y.onContentChange),_=l.useRef(0),D=l.useRef(""),k=l.useRef(0),U=l.useRef(null),H=l.useRef("right"),Q=l.useRef(0),ne=b?mr:l.Fragment,L=b?{as:f0,allowPinchZoom:!0}:void 0,Z=I=>{const J=D.current+I,W=S().filter(O=>!O.disabled),ae=document.activeElement,$=W.find(O=>O.ref.current===ae)?.textValue,q=W.map(O=>O.textValue),V=C0(q,J,$),F=W.find(O=>O.textValue===V)?.ref.current;(function O(j){D.current=j,window.clearTimeout(_.current),j!==""&&(_.current=window.setTimeout(()=>O(""),1e3))})(J),F&&setTimeout(()=>F.focus())};l.useEffect(()=>()=>window.clearTimeout(_.current),[]),Xo();const te=l.useCallback(I=>H.current===U.current?.side&&R0(I,U.current?.area),[]);return p.jsx(l0,{scope:n,searchRef:D,onItemEnter:l.useCallback(I=>{te(I)&&I.preventDefault()},[te]),onItemLeave:l.useCallback(I=>{te(I)||(R.current?.focus(),P(null))},[te]),onTriggerLeave:l.useCallback(I=>{te(I)&&I.preventDefault()},[te]),pointerGraceTimerRef:k,onPointerGraceIntentChange:l.useCallback(I=>{U.current=I},[]),children:p.jsx(ne,{...L,children:p.jsx(pr,{asChild:!0,trapped:o,onMountAutoFocus:M(s,I=>{I.preventDefault(),R.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:p.jsx(wn,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:u,onInteractOutside:h,onDismiss:m,children:p.jsx(Ul,{asChild:!0,...E,dir:v.dir,orientation:"vertical",loop:r,currentTabStopId:T,onCurrentTabStopIdChange:P,onEntryFocus:M(c,I=>{v.isUsingKeyboardRef.current||I.preventDefault()}),preventScrollOnEntryFocus:!0,children:p.jsx(ws,{role:"menu","aria-orientation":"vertical","data-state":du(y.open),"data-radix-menu-content":"",dir:v.dir,...x,...g,ref:A,style:{outline:"none",...g.style},onKeyDown:M(g.onKeyDown,I=>{const W=I.target.closest("[data-radix-menu-content]")===I.currentTarget,ae=I.ctrlKey||I.altKey||I.metaKey,$=I.key.length===1;W&&(I.key==="Tab"&&I.preventDefault(),!ae&&$&&Z(I.key));const q=R.current;if(I.target!==q||!e0.includes(I.key))return;I.preventDefault();const F=S().filter(O=>!O.disabled).map(O=>O.ref.current);Vl.includes(I.key)&&F.reverse(),E0(F)}),onBlur:M(e.onBlur,I=>{I.currentTarget.contains(I.target)||(window.clearTimeout(_.current),D.current="")}),onPointerMove:M(e.onPointerMove,mn(I=>{const J=I.target,W=Q.current!==I.clientX;if(I.currentTarget.contains(J)&&W){const ae=I.clientX>Q.current?"right":"left";H.current=ae,Q.current=I.clientX}}))})})})})})})});Zl.displayName=Be;var p0="MenuGroup",Ps=l.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return p.jsx(Y.div,{role:"group",...r,ref:t})});Ps.displayName=p0;var h0="MenuLabel",Ql=l.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return p.jsx(Y.div,{...r,ref:t})});Ql.displayName=h0;var or="MenuItem",Va="menu.itemSelect",Cr=l.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,s=l.useRef(null),i=Nn(or,e.__scopeMenu),a=Ts(or,e.__scopeMenu),c=re(t,s),d=l.useRef(!1),f=()=>{const u=s.current;if(!n&&u){const h=new CustomEvent(Va,{bubbles:!0,cancelable:!0});u.addEventListener(Va,m=>r?.(m),{once:!0}),Di(u,h),h.defaultPrevented?d.current=!1:i.onClose()}};return p.jsx(Yl,{...o,ref:c,disabled:n,onClick:M(e.onClick,f),onPointerDown:u=>{e.onPointerDown?.(u),d.current=!0},onPointerUp:M(e.onPointerUp,u=>{d.current||u.currentTarget?.click()}),onKeyDown:M(e.onKeyDown,u=>{const h=a.searchRef.current!=="";n||h&&u.key===" "||Po.includes(u.key)&&(u.currentTarget.click(),u.preventDefault())})})});Cr.displayName=or;var Yl=l.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...s}=e,i=Ts(or,n),a=Wl(n),c=l.useRef(null),d=re(t,c),[f,u]=l.useState(!1),[h,m]=l.useState("");return l.useEffect(()=>{const b=c.current;b&&m((b.textContent??"").trim())},[s.children]),p.jsx(hn.ItemSlot,{scope:n,disabled:r,textValue:o??h,children:p.jsx(Hl,{asChild:!0,...a,focusable:!r,children:p.jsx(Y.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:d,onPointerMove:M(e.onPointerMove,mn(b=>{r?i.onItemLeave(b):(i.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:M(e.onPointerLeave,mn(b=>i.onItemLeave(b))),onFocus:M(e.onFocus,()=>u(!0)),onBlur:M(e.onBlur,()=>u(!1))})})})}),m0="MenuCheckboxItem",Xl=l.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...o}=e;return p.jsx(ru,{scope:e.__scopeMenu,checked:n,children:p.jsx(Cr,{role:"menuitemcheckbox","aria-checked":sr(n)?"mixed":n,...o,ref:t,"data-state":Os(n),onSelect:M(o.onSelect,()=>r?.(sr(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Xl.displayName=m0;var Jl="MenuRadioGroup",[g0,v0]=Ot(Jl,{value:void 0,onValueChange:()=>{}}),eu=l.forwardRef((e,t)=>{const{value:n,onValueChange:r,...o}=e,s=Ye(r);return p.jsx(g0,{scope:e.__scopeMenu,value:n,onValueChange:s,children:p.jsx(Ps,{...o,ref:t})})});eu.displayName=Jl;var tu="MenuRadioItem",nu=l.forwardRef((e,t)=>{const{value:n,...r}=e,o=v0(tu,e.__scopeMenu),s=n===o.value;return p.jsx(ru,{scope:e.__scopeMenu,checked:s,children:p.jsx(Cr,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":Os(s),onSelect:M(r.onSelect,()=>o.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});nu.displayName=tu;var As="MenuItemIndicator",[ru,y0]=Ot(As,{checked:!1}),ou=l.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...o}=e,s=y0(As,n);return p.jsx(Je,{present:r||sr(s.checked)||s.checked===!0,children:p.jsx(Y.span,{...o,ref:t,"data-state":Os(s.checked)})})});ou.displayName=As;var b0="MenuSeparator",su=l.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return p.jsx(Y.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});su.displayName=b0;var x0="MenuArrow",au=l.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=Sr(n);return p.jsx(Es,{...o,...r,ref:t})});au.displayName=x0;var w0="MenuSub",[RE,iu]=Ot(w0),cn="MenuSubTrigger",cu=l.forwardRef((e,t)=>{const n=Nt(cn,e.__scopeMenu),r=Nn(cn,e.__scopeMenu),o=iu(cn,e.__scopeMenu),s=Ts(cn,e.__scopeMenu),i=l.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:c}=s,d={__scopeMenu:e.__scopeMenu},f=l.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return l.useEffect(()=>f,[f]),l.useEffect(()=>{const u=a.current;return()=>{window.clearTimeout(u),c(null)}},[a,c]),p.jsx(Ss,{asChild:!0,...d,children:p.jsx(Yl,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":du(n.open),...e,ref:xn(t,o.onTriggerChange),onClick:u=>{e.onClick?.(u),!(e.disabled||u.defaultPrevented)&&(u.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:M(e.onPointerMove,mn(u=>{s.onItemEnter(u),!u.defaultPrevented&&!e.disabled&&!n.open&&!i.current&&(s.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{n.onOpenChange(!0),f()},100))})),onPointerLeave:M(e.onPointerLeave,mn(u=>{f();const h=n.content?.getBoundingClientRect();if(h){const m=n.content?.dataset.side,b=m==="right",g=b?-5:5,y=h[b?"left":"right"],v=h[b?"right":"left"];s.onPointerGraceIntentChange({area:[{x:u.clientX+g,y:u.clientY},{x:y,y:h.top},{x:v,y:h.top},{x:v,y:h.bottom},{x:y,y:h.bottom}],side:m}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(u),u.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:M(e.onKeyDown,u=>{const h=s.searchRef.current!=="";e.disabled||h&&u.key===" "||t0[r.dir].includes(u.key)&&(n.onOpenChange(!0),n.content?.focus(),u.preventDefault())})})})});cu.displayName=cn;var lu="MenuSubContent",uu=l.forwardRef((e,t)=>{const n=Gl(Be,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,s=Nt(Be,e.__scopeMenu),i=Nn(Be,e.__scopeMenu),a=iu(lu,e.__scopeMenu),c=l.useRef(null),d=re(t,c);return p.jsx(hn.Provider,{scope:e.__scopeMenu,children:p.jsx(Je,{present:r||s.open,children:p.jsx(hn.Slot,{scope:e.__scopeMenu,children:p.jsx(Rs,{id:a.contentId,"aria-labelledby":a.triggerId,...o,ref:d,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:f=>{i.isUsingKeyboardRef.current&&c.current?.focus(),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:M(e.onFocusOutside,f=>{f.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:M(e.onEscapeKeyDown,f=>{i.onClose(),f.preventDefault()}),onKeyDown:M(e.onKeyDown,f=>{const u=f.currentTarget.contains(f.target),h=n0[i.dir].includes(f.key);u&&h&&(s.onOpenChange(!1),a.trigger?.focus(),f.preventDefault())})})})})})});uu.displayName=lu;function du(e){return e?"open":"closed"}function sr(e){return e==="indeterminate"}function Os(e){return sr(e)?"indeterminate":e?"checked":"unchecked"}function E0(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function S0(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function C0(e,t,n){const o=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let i=S0(e,Math.max(s,0));o.length===1&&(i=i.filter(d=>d!==n));const c=i.find(d=>d.toLowerCase().startsWith(o.toLowerCase()));return c!==n?c:void 0}function T0(e,t){const{x:n,y:r}=e;let o=!1;for(let s=0,i=t.length-1;s<t.length;i=s++){const a=t[s],c=t[i],d=a.x,f=a.y,u=c.x,h=c.y;f>r!=h>r&&n<(u-d)*(r-f)/(h-f)+d&&(o=!o)}return o}function R0(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return T0(n,t)}function mn(e){return t=>t.pointerType==="mouse"?e(t):void 0}var P0=zl,A0=Ss,O0=Kl,N0=Zl,_0=Ps,I0=Ql,M0=Cr,D0=Xl,j0=eu,L0=nu,k0=ou,F0=su,$0=au,B0=cu,U0=uu,Tr="DropdownMenu",[H0]=Xe(Tr,[ql]),Oe=ql(),[V0,fu]=H0(Tr),pu=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:o,defaultOpen:s,onOpenChange:i,modal:a=!0}=e,c=Oe(t),d=l.useRef(null),[f,u]=nt({prop:o,defaultProp:s??!1,onChange:i,caller:Tr});return p.jsx(V0,{scope:t,triggerId:Ze(),triggerRef:d,contentId:Ze(),open:f,onOpenChange:u,onOpenToggle:l.useCallback(()=>u(h=>!h),[u]),modal:a,children:p.jsx(P0,{...c,open:f,onOpenChange:u,dir:r,modal:a,children:n})})};pu.displayName=Tr;var hu="DropdownMenuTrigger",mu=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=e,s=fu(hu,n),i=Oe(n);return p.jsx(A0,{asChild:!0,...i,children:p.jsx(Y.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...o,ref:xn(t,s.triggerRef),onPointerDown:M(e.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(s.onOpenToggle(),s.open||a.preventDefault())}),onKeyDown:M(e.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&s.onOpenToggle(),a.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});mu.displayName=hu;var q0="DropdownMenuPortal",gu=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Oe(t);return p.jsx(O0,{...r,...n})};gu.displayName=q0;var vu="DropdownMenuContent",yu=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=fu(vu,n),s=Oe(n),i=l.useRef(!1);return p.jsx(N0,{id:o.contentId,"aria-labelledby":o.triggerId,...s,...r,ref:t,onCloseAutoFocus:M(e.onCloseAutoFocus,a=>{i.current||o.triggerRef.current?.focus(),i.current=!1,a.preventDefault()}),onInteractOutside:M(e.onInteractOutside,a=>{const c=a.detail.originalEvent,d=c.button===0&&c.ctrlKey===!0,f=c.button===2||d;(!o.modal||f)&&(i.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});yu.displayName=vu;var W0="DropdownMenuGroup",z0=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Oe(n);return p.jsx(_0,{...o,...r,ref:t})});z0.displayName=W0;var G0="DropdownMenuLabel",bu=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Oe(n);return p.jsx(I0,{...o,...r,ref:t})});bu.displayName=G0;var K0="DropdownMenuItem",xu=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Oe(n);return p.jsx(M0,{...o,...r,ref:t})});xu.displayName=K0;var Z0="DropdownMenuCheckboxItem",wu=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Oe(n);return p.jsx(D0,{...o,...r,ref:t})});wu.displayName=Z0;var Q0="DropdownMenuRadioGroup",Y0=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Oe(n);return p.jsx(j0,{...o,...r,ref:t})});Y0.displayName=Q0;var X0="DropdownMenuRadioItem",Eu=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Oe(n);return p.jsx(L0,{...o,...r,ref:t})});Eu.displayName=X0;var J0="DropdownMenuItemIndicator",Su=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Oe(n);return p.jsx(k0,{...o,...r,ref:t})});Su.displayName=J0;var eb="DropdownMenuSeparator",Cu=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Oe(n);return p.jsx(F0,{...o,...r,ref:t})});Cu.displayName=eb;var tb="DropdownMenuArrow",nb=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Oe(n);return p.jsx($0,{...o,...r,ref:t})});nb.displayName=tb;var rb="DropdownMenuSubTrigger",Tu=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Oe(n);return p.jsx(B0,{...o,...r,ref:t})});Tu.displayName=rb;var ob="DropdownMenuSubContent",Ru=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Oe(n);return p.jsx(U0,{...o,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Ru.displayName=ob;var sb=pu,ab=mu,ib=gu,cb=yu,lb=bu,ub=xu,db=wu,fb=Eu,pb=Su,hb=Cu,mb=Tu,gb=Ru,vb=sb,yb=ab,bb=ib,Pu=cb,Au=ub,Ou=db,Nu=fb,_u=pb,Iu=lb,Mu=hb,Du=mb,ju=gb;const xb=vb,wb=yb,Eb=l.forwardRef(({className:e,inset:t,children:n,...r},o)=>p.jsx(Du,{ref:o,className:fe("flex","cursor-default","select-none","items-center","rounded-[10px]","px-3","py-2","text-sm","font-medium","text-fg-secondary","outline-none","focus-ring-soft","focus:bg-hover-subtle","focus:text-fg-default","data-[state=open]:bg-hover-subtle","data-[state=open]:text-fg-default",t&&"pl-8",e),...r,children:n}));Eb.displayName=Du.displayName;const Sb=l.forwardRef(({className:e,...t},n)=>p.jsx(ju,{ref:n,className:fe("z-50","min-w-[8rem]","overflow-hidden","surface-floating","p-1",e),...t}));Sb.displayName=ju.displayName;const Lu=l.forwardRef(({className:e,sideOffset:t=4,...n},r)=>p.jsx(bb,{children:p.jsx(Pu,{ref:r,sideOffset:t,className:fe("z-[1100]","min-w-[10rem]","overflow-hidden","surface-floating","p-1","data-[state=open]:animate-fade-in","data-[state=open]:animate-zoom-in",e),...n})}));Lu.displayName=Pu.displayName;const ku=l.forwardRef(({className:e,inset:t,...n},r)=>p.jsx(Au,{ref:r,className:fe("relative","flex","cursor-pointer","select-none","items-center","px-3","py-2","text-sm","font-medium","text-fg-secondary","outline-none","focus-ring-soft","transition-colors","rounded-[10px]","focus:bg-hover-subtle","focus:text-fg-default","data-[disabled]:pointer-events-none","data-[disabled]:opacity-50",t&&"pl-8",e),...n}));ku.displayName=Au.displayName;const Cb=l.forwardRef(({className:e,children:t,checked:n,...r},o)=>p.jsxs(Ou,{ref:o,className:fe("relative","flex","cursor-pointer","select-none","items-center","rounded-[10px]","py-2","pl-8","pr-3","text-sm","font-medium","text-fg-secondary","outline-none","focus-ring-soft","transition-colors","focus:bg-hover-subtle","focus:text-fg-default","data-[disabled]:pointer-events-none","data-[disabled]:opacity-50",e),checked:n,...r,children:[p.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:p.jsx(_u,{children:"✓"})}),t]}));Cb.displayName=Ou.displayName;const Tb=l.forwardRef(({className:e,children:t,...n},r)=>p.jsxs(Nu,{ref:r,className:fe("relative","flex","cursor-pointer","select-none","items-center","rounded-[10px]","py-2","pl-8","pr-3","text-sm","font-medium","text-fg-secondary","outline-none","focus-ring-soft","transition-colors","focus:bg-hover-subtle","focus:text-fg-default","data-[disabled]:pointer-events-none","data-[disabled]:opacity-50",e),...n,children:[p.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:p.jsx(_u,{children:"●"})}),t]}));Tb.displayName=Nu.displayName;const Rb=l.forwardRef(({className:e,inset:t,...n},r)=>p.jsx(Iu,{ref:r,className:fe("px-2","py-1.5","text-sm","font-semibold","text-fg-secondary",t&&"pl-8",e),...n}));Rb.displayName=Iu.displayName;const Fu=l.forwardRef(({className:e,...t},n)=>p.jsx(Mu,{ref:n,className:fe("-mx-1","my-1","h-px","bg-divider",e),...t}));Fu.displayName=Mu.displayName;const PE=({button:e,items:t})=>p.jsxs(xb,{children:[p.jsx(wb,{asChild:!0,children:e}),p.jsx(Lu,{align:"end",children:t.map((n,r)=>n.type==="separator"?p.jsx(Fu,{},n.key??`separator-${r}`):p.jsx(ku,{onClick:n.onClick,children:n.name},n.name))})]}),Pb=l.forwardRef(({title:e,description:t,className:n="",...r},o)=>p.jsxs("div",{ref:o,className:fe("flex flex-col items-center justify-center text-center","h-[400px]","bg-muted/30","border-2 border-dashed","border-border-secondary","rounded-[20px]","p-8",n),...r,children:[e&&p.jsx($e,{as:"h3",variant:"heading",weight:"bold",tone:"muted",className:"mb-2",children:e}),t&&p.jsx($e,{as:"p",variant:"meta",weight:"medium",tone:"tertiary",className:"max-w-[400px]",children:t})]}));Pb.displayName="Empty";const Ab=Ae(["w-full","border","border-border-subtle","bg-elevated","text-fg-default","placeholder:text-fg-placeholder","transition-colors","outline-none","focus-ring-soft","disabled:cursor-not-allowed","disabled:opacity-50"],{variants:{variant:{default:[],ghost:["border-transparent","bg-subtle","hover:bg-hover-subtle"],error:["border-border-error","bg-accent-soft-danger/40","text-fg-default"]},size:{sm:"h-8 px-3 text-sm rounded-[12px]",md:"h-9 px-3 text-sm rounded-[14px]",lg:"h-11 px-4 text-base rounded-[16px]"}},defaultVariants:{variant:"default",size:"md"}}),Ob=l.forwardRef(({className:e,variant:t,size:n,type:r="text",...o},s)=>p.jsx("input",{ref:s,type:r,className:Ab({variant:t,size:n,className:e}),...o}));Ob.displayName="Input";const Nb=Ae(["font-bold","text-fg-muted","whitespace-nowrap"],{variants:{size:{sm:"text-xs",md:"text-sm",lg:"text-base"}},defaultVariants:{size:"sm"}}),_b=l.forwardRef(({className:e,size:t,...n},r)=>p.jsx("label",{ref:r,className:Nb({size:t,className:e}),...n}));_b.displayName="Label";const Ib=l.forwardRef(({page:e,last:t,onChange:n,className:r="",...o},s)=>{const i=Number(e),a=Number(t),c=[];for(let u=1;u<a+1;u++)(i===u||i===1&&u<i+5||i===2&&u<i+4||u>i-3&&u<i+3||i===a-1&&u>i-4||i===a&&u>i-5)&&c.push(u);const d=i===1,f=i===a;return p.jsxs("nav",{ref:s,className:`mt-8 flex justify-center items-center gap-1 ${r}`,...o,children:[p.jsxs(Ut,{disabled:d,onClick:()=>!d&&n(1),"aria-label":"First page",isSkip:!0,children:[p.jsx(Kr,{width:16}),p.jsx(Kr,{width:16})]}),p.jsx(Ut,{disabled:d,onClick:()=>!d&&n(i-1),"aria-label":"Previous page",children:p.jsx(Kr,{width:20})}),c.map(u=>p.jsx(Ut,{active:i===u,onClick:()=>n(u),"aria-label":`Page ${u}`,"aria-current":i===u?"page":void 0,children:u},u)),p.jsx(Ut,{disabled:f,onClick:()=>!f&&n(i+1),"aria-label":"Next page",children:p.jsx(Zr,{width:20})}),p.jsxs(Ut,{disabled:f,onClick:()=>!f&&n(a),"aria-label":"Last page",isSkip:!0,children:[p.jsx(Zr,{width:16}),p.jsx(Zr,{width:16})]})]})});Ib.displayName="Pagination";const Ut=l.forwardRef(({active:e,disabled:t,isSkip:n,children:r,className:o="",...s},i)=>{const a=`
59
+ `+s)}}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Tt(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:s}=n;r!==void 0&&Kn.assertOptions(r,{silentJSONParsing:Te.transitional(Te.boolean),forcedJSONParsing:Te.transitional(Te.boolean),clarifyTimeoutError:Te.transitional(Te.boolean),legacyInterceptorReqResOrdering:Te.transitional(Te.boolean),advertiseZstdAcceptEncoding:Te.transitional(Te.boolean),validateStatusUndefinedResolves:Te.transitional(Te.boolean)},!1),o!=null&&(w.isFunction(o)?n.paramsSerializer={serialize:o}:Kn.assertOptions(o,{encode:Te.function,serialize:Te.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Kn.assertOptions(n,{baseUrl:Te.spelling("baseURL"),withXsrfToken:Te.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=s&&w.merge(s.common,s[n.method]);s&&w.forEach(["delete","get","head","post","put","patch","query","common"],b=>{delete s[b]}),n.headers=Re.concat(i,s);const a=[];let c=!0;this.interceptors.request.forEach(function(g){if(typeof g.runWhen=="function"&&g.runWhen(n)===!1)return;c=c&&g.synchronous;const y=n.transitional||fs;y&&y.legacyInterceptorReqResOrdering?a.unshift(g.fulfilled,g.rejected):a.push(g.fulfilled,g.rejected)});const d=[];this.interceptors.response.forEach(function(g){d.push(g.fulfilled,g.rejected)});let f,u=0,h;if(!c){const b=[Ba.bind(this),void 0];for(b.unshift(...a),b.push(...d),h=b.length,f=Promise.resolve(n);u<h;)f=f.then(b[u++],b[u++]);return f}h=a.length;let m=n;for(;u<h;){const b=a[u++],g=a[u++];try{m=b(m)}catch(y){g.call(this,y);break}}try{f=Ba.call(this,m)}catch(b){return Promise.reject(b)}for(u=0,h=d.length;u<h;)f=f.then(d[u++],d[u++]);return f}getUri(t){t=Tt(this.defaults,t);const n=cl(t.baseURL,t.url,t.allowAbsoluteUrls,t);return rl(n,t.params,t.paramsSerializer)}};w.forEach(["delete","get","head","options"],function(t){yt.prototype[t]=function(n,r){return this.request(Tt(r||{},{method:t,url:n,data:r&&w.hasOwnProp(r,"data")?r.data:void 0}))}});w.forEach(["post","put","patch","query"],function(t){function n(r){return function(s,i,a){return this.request(Tt(a||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:i}))}}yt.prototype[t]=n(),t!=="query"&&(yt.prototype[t+"Form"]=n(!0))});let by=class fl{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(s){n=s});const r=this;this.promise.then(o=>{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](o);r._listeners=null}),this.promise.then=o=>{let s;const i=new Promise(a=>{r.subscribe(a),s=a}).then(o);return i.cancel=function(){r.unsubscribe(s)},i},t(function(s,i,a){r.reason||(r.reason=new Rn(s,i,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new fl(function(o){t=o}),cancel:t}}};function xy(e){return function(n){return e.apply(null,n)}}function wy(e){return w.isObject(e)&&e.isAxiosError===!0}const To={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(To).forEach(([e,t])=>{To[t]=e});function pl(e){const t=new yt(e),n=Vc(yt.prototype.request,t);return w.extend(n,yt.prototype,t,{allOwnKeys:!0}),w.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return pl(Tt(e,o))},n}const ue=pl(Tn);ue.Axios=yt;ue.CanceledError=Rn;ue.CancelToken=by;ue.isCancel=al;ue.VERSION=hs;ue.toFormData=yr;ue.AxiosError=N;ue.Cancel=ue.CanceledError;ue.all=function(t){return Promise.all(t)};ue.spread=xy;ue.isAxiosError=wy;ue.mergeConfig=Tt;ue.AxiosHeaders=Re;ue.formToJSON=e=>sl(w.isHTMLForm(e)?new FormData(e):e);ue.getAdapter=dl.getAdapter;ue.HttpStatusCode=To;ue.default=ue;const{Axios:cE,AxiosError:lE,CanceledError:uE,isCancel:dE,CancelToken:fE,VERSION:pE,all:hE,Cancel:mE,isAxiosError:gE,spread:vE,toFormData:yE,AxiosHeaders:bE,HttpStatusCode:xE,formToJSON:wE,getAdapter:EE,mergeConfig:SE,create:CE}=ue,Ey=e=>!e||e.length===0?null:[...new Set(e)].sort(),Sy=e=>!e||e.length===0?[]:[...new Set(e.map(t=>t.trim()).filter(Boolean))].sort(),Cy=e=>!e||e.length===0?null:[...new Set(e)].sort(),TE={notes:{all:()=>["notes"],listAll:()=>["notes","list"],list:(e={})=>["notes","list",{limit:e.limit??25,offset:e.offset??0,query:e.query??"",sortBy:e.sortBy??null,sortOrder:e.sortOrder??null,pinnedFirst:e.pinnedFirst??null,fields:Ey(e.fields)}],tagListAll:()=>["notes","tag-list"],tagList:(e={})=>["notes","tag-list",{limit:e.limit??25,offset:e.offset??0,query:e.query??""}],tagNameListAll:()=>["notes","tag-name-list"],tagNameList:e=>["notes","tag-name-list",{limit:e.limit??25,offset:e.offset??0,mode:e.mode??"and",tagNames:Sy(e.tagNames)}],detail:e=>["notes","detail",{id:e}],snapshots:(e,t=10)=>["notes","snapshots",{id:e,limit:t}],snapshotDetail:e=>["notes","snapshot-detail",{id:e}],trashAll:()=>["notes","trash"],trash:(e={})=>["notes","trash",{limit:e.limit??25,offset:e.offset??0}],trashDetail:e=>["notes","trash","detail",{id:e}],pinned:()=>["notes","pinned"],backReferencesAll:()=>["notes","back-references"],backReferences:e=>["notes","back-references",{noteId:e}],graph:()=>["notes","graph"],propertyKeysAll:()=>["notes","property-keys"],propertyKeys:(e={})=>["notes","property-keys",{query:e.query??"",limit:e.limit??50,offset:e.offset??0}]},tags:{all:()=>["tags"],list:(e={})=>["tags","list",{limit:e.limit??50,offset:e.offset??0,query:e.query??"",sortBy:e.sortBy??"referenceCount",sortOrder:e.sortOrder??"desc"}]},images:{all:()=>["images"],listAll:()=>["images","list"],list:(e={})=>["images","list",{limit:e.limit??50,offset:e.offset??0}],detail:e=>["images","detail",{id:e}],notes:e=>["images","notes",{id:e}]},reminders:{all:()=>["reminders"],note:(e,t={})=>["reminders","note",e,{limit:t.limit??10,offset:t.offset??0}],noteAllPages:e=>["reminders","note",e],upcoming:(e={})=>["reminders","upcoming",{limit:e.limit??10,offset:e.offset??0}],upcomingAllPages:()=>["reminders","upcoming"],inDateRangeAll:()=>["reminders","in-date-range"],inDateRange:(e,t)=>["reminders","in-date-range",{year:e,month:t}]},placeholders:{all:()=>["placeholders"],listAll:()=>["placeholders","list"],list:(e={})=>["placeholders","list",{limit:e.limit??25,offset:e.offset??0,query:e.query??"",fields:Cy(e.fields)}]},calendar:{all:()=>["calendar"],notesInDateRange:(e,t)=>["calendar","notes-in-date-range",{year:e,month:t}]},views:{all:()=>["views"],workspace:()=>["views","workspace"],section:e=>["views","section",{id:e}],sectionNotesAll:()=>["views","section-notes"],sectionNotes:(e,t={})=>["views","section-notes",{id:e,limit:t.limit??25,offset:t.offset??0}]},search:{all:()=>["search"],resultsAll:()=>["search","results"],results:e=>["search","results",{query:e.query.trim(),limit:e.limit??25,offset:e.offset??0,mode:e.mode??"hybrid"}],relatedAll:()=>["search","related"],related:(e,t=5)=>["search","related",{noteId:e,limit:t}],adminStatus:()=>["search","admin-status"]},ui:{heroBanner:()=>["ui","hero-banner"]}},Ty={sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"},Ha={sm:10,md:12,lg:14},Ry=l.forwardRef(({className:e,size:t="md",checked:n,disabled:r,...o},s)=>p.jsxs("label",{className:fe("relative inline-flex items-center justify-center cursor-pointer",r&&"cursor-not-allowed opacity-50",e),children:[p.jsx("input",{ref:s,type:"checkbox",checked:n,disabled:r,className:"sr-only peer",...o}),p.jsx("span",{className:fe(Ty[t],"flex items-center justify-center","border border-border-secondary","rounded-[6px]","bg-surface","transition-all duration-200","peer-checked:bg-cta","peer-checked:border-cta","focus-ring-soft","peer-focus-visible:border-border-focus","peer-focus-visible:shadow-[0_0_0_4px_color-mix(in_srgb,var(--accent-soft-primary)_90%,transparent)]"),children:n&&p.jsx(Fm,{width:Ha[t],height:Ha[t],className:"text-fg-on-filled",weight:"bold"})})]}));Ry.displayName="Checkbox";var Py=lc,Ay=uc,hl=dc,ml=fc,Oy=rs,gl=pc,vl=hc;const Ny=Py,_y=Ay,Iy=Oy,yl=l.createContext("default"),Pn=()=>l.useContext(yl),bl=l.forwardRef(({className:e,...t},n)=>p.jsx(hl,{ref:n,className:fe("fixed","inset-0","z-[1090]","bg-overlay","backdrop-blur-[2px]","data-[state=open]:animate-in","data-[state=closed]:animate-out","data-[state=closed]:fade-out-0","data-[state=open]:fade-in-0",e),...t}));bl.displayName=hl.displayName;const xl=l.forwardRef(({className:e,children:t,variant:n="default",...r},o)=>p.jsxs(_y,{children:[p.jsx(bl,{}),p.jsx("div",{className:"pointer-events-none fixed inset-0 z-[1100] flex items-center justify-center p-4",children:p.jsx(ml,{ref:o,"data-dialog-variant":n,className:os({variant:n,className:e}),...r,children:p.jsx(yl.Provider,{value:n,children:t})})})]}));xl.displayName=ml.displayName;const wl=({title:e,onClose:t,className:n})=>{const r=Pn();return p.jsxs("div",{className:Hm({variant:r,className:n}),children:[p.jsx(Cl,{children:e}),t&&p.jsx(Iy,{asChild:!0,children:p.jsx("button",{type:"button","aria-label":"Close dialog",className:Vm({variant:r}),onClick:t,children:p.jsx(Bm,{className:r==="compact"||r==="form"||r==="confirm"?"h-[18px] w-[18px]":"h-5 w-5"})})})]})};wl.displayName="DialogHeader";const El=l.forwardRef(({className:e,...t},n)=>{const r=Pn();return p.jsx("div",{ref:n,className:ss({variant:r,className:e}),...t})});El.displayName="DialogBody";const Sl=l.forwardRef(({className:e,...t},n)=>{const r=Pn();return p.jsx("div",{ref:n,className:as({variant:r,className:e}),...t})});Sl.displayName="DialogFooter";const Cl=l.forwardRef(({className:e,...t},n)=>{const r=Pn();return p.jsx(gl,{ref:n,className:fe(is({variant:r}),e),...t})});Cl.displayName=gl.displayName;const Tl=l.forwardRef(({className:e,...t},n)=>{const r=Pn();return p.jsx(vl,{ref:n,className:fe(cs({variant:r}),e),...t})});Tl.displayName=vl.displayName;const xr=({isOpen:e,onClose:t,children:n,className:r,variant:o="default"})=>p.jsx(Ny,{open:e,onOpenChange:s=>!s&&t(),children:p.jsx(xl,{variant:o,className:r,children:n})});xr.Header=wl;xr.Body=El;xr.Footer=Sl;xr.Description=Tl;function gs(e){const t=e+"CollectionProvider",[n,r]=Xe(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=g=>{const{scope:y,children:v}=g,x=C.useRef(null),E=C.useRef(new Map).current;return p.jsx(o,{scope:y,itemMap:E,collectionRef:x,children:v})};i.displayName=t;const a=e+"CollectionSlot",c=Gt(a),d=C.forwardRef((g,y)=>{const{scope:v,children:x}=g,E=s(a,v),S=re(y,E.collectionRef);return p.jsx(c,{ref:S,children:x})});d.displayName=a;const f=e+"CollectionItemSlot",u="data-radix-collection-item",h=Gt(f),m=C.forwardRef((g,y)=>{const{scope:v,children:x,...E}=g,S=C.useRef(null),T=re(y,S),P=s(f,v);return C.useEffect(()=>(P.itemMap.set(S,{ref:S,...E}),()=>{P.itemMap.delete(S)})),p.jsx(h,{[u]:"",ref:T,children:x})});m.displayName=f;function b(g){const y=s(e+"CollectionConsumer",g);return C.useCallback(()=>{const x=y.collectionRef.current;if(!x)return[];const E=Array.from(x.querySelectorAll(`[${u}]`));return Array.from(y.itemMap.values()).sort((P,R)=>E.indexOf(P.ref.current)-E.indexOf(R.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:i,Slot:d,ItemSlot:m},b,r]}var My=l.createContext(void 0);function wr(e){const t=l.useContext(My);return e||t||"ltr"}var Dy="Arrow",Rl=l.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...s}=e;return p.jsx(Y.svg,{...s,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:p.jsx("polygon",{points:"0,0 30,0 15,10"})})});Rl.displayName=Dy;var jy=Rl;function Ly(e){const[t,n]=l.useState(void 0);return Pe(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let i,a;if("borderBoxSize"in s){const c=s.borderBoxSize,d=Array.isArray(c)?c[0]:c;i=d.inlineSize,a=d.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var vs="Popper",[Pl,Jt]=Xe(vs),[ky,Al]=Pl(vs),Ol=e=>{const{__scopePopper:t,children:n}=e,[r,o]=l.useState(null);return p.jsx(ky,{scope:t,anchor:r,onAnchorChange:o,children:n})};Ol.displayName=vs;var Nl="PopperAnchor",_l=l.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,s=Al(Nl,n),i=l.useRef(null),a=re(t,i),c=l.useRef(null);return l.useEffect(()=>{const d=c.current;c.current=r?.current||i.current,d!==c.current&&s.onAnchorChange(c.current)}),r?null:p.jsx(Y.div,{...o,ref:a})});_l.displayName=Nl;var ys="PopperContent",[Fy,$y]=Pl(ys),Il=l.forwardRef((e,t)=>{const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,arrowPadding:a=0,avoidCollisions:c=!0,collisionBoundary:d=[],collisionPadding:f=0,sticky:u="partial",hideWhenDetached:h=!1,updatePositionStrategy:m="optimized",onPlaced:b,...g}=e,y=Al(ys,n),[v,x]=l.useState(null),E=re(t,O=>x(O)),[S,T]=l.useState(null),P=Ly(S),R=P?.width??0,A=P?.height??0,_=r+(s!=="center"?"-"+s:""),D=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},k=Array.isArray(d)?d:[d],U=k.length>0,H={padding:D,boundary:k.filter(Uy),altBoundary:U},{refs:Q,floatingStyles:ne,placement:L,isPositioned:Z,middlewareData:te}=Kd({strategy:"fixed",placement:_,whileElementsMounted:(...O)=>tf(...O,{animationFrame:m==="always"}),elements:{reference:y.anchor},middleware:[Zd({mainAxis:o+A,alignmentAxis:i}),c&&Qd({mainAxis:!0,crossAxis:!1,limiter:u==="partial"?nf():void 0,...H}),c&&Yd({...H}),Xd({...H,apply:({elements:O,rects:j,availableWidth:oe,availableHeight:ee})=>{const{width:X,height:G}=j.reference,me=O.floating.style;me.setProperty("--radix-popper-available-width",`${oe}px`),me.setProperty("--radix-popper-available-height",`${ee}px`),me.setProperty("--radix-popper-anchor-width",`${X}px`),me.setProperty("--radix-popper-anchor-height",`${G}px`)}}),S&&Jd({element:S,padding:a}),Hy({arrowWidth:R,arrowHeight:A}),h&&ef({strategy:"referenceHidden",...H})]}),[I,J]=jl(L),W=Ye(b);Pe(()=>{Z&&W?.()},[Z,W]);const ae=te.arrow?.x,$=te.arrow?.y,q=te.arrow?.centerOffset!==0,[V,F]=l.useState();return Pe(()=>{v&&F(window.getComputedStyle(v).zIndex)},[v]),p.jsx("div",{ref:Q.setFloating,"data-radix-popper-content-wrapper":"",style:{...ne,transform:Z?ne.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:V,"--radix-popper-transform-origin":[te.transformOrigin?.x,te.transformOrigin?.y].join(" "),...te.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:p.jsx(Fy,{scope:n,placedSide:I,onArrowChange:T,arrowX:ae,arrowY:$,shouldHideArrow:q,children:p.jsx(Y.div,{"data-side":I,"data-align":J,...g,ref:E,style:{...g.style,animation:Z?void 0:"none"}})})})});Il.displayName=ys;var Ml="PopperArrow",By={top:"bottom",right:"left",bottom:"top",left:"right"},Dl=l.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,s=$y(Ml,r),i=By[s.placedSide];return p.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:p.jsx(jy,{...o,ref:n,style:{...o.style,display:"block"}})})});Dl.displayName=Ml;function Uy(e){return e!==null}var Hy=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:o}=t,i=o.arrow?.centerOffset!==0,a=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[d,f]=jl(n),u={start:"0%",center:"50%",end:"100%"}[f],h=(o.arrow?.x??0)+a/2,m=(o.arrow?.y??0)+c/2;let b="",g="";return d==="bottom"?(b=i?u:`${h}px`,g=`${-c}px`):d==="top"?(b=i?u:`${h}px`,g=`${r.floating.height+c}px`):d==="right"?(b=`${-c}px`,g=i?u:`${m}px`):d==="left"&&(b=`${r.floating.width+c}px`,g=i?u:`${m}px`),{data:{x:b,y:g}}}});function jl(e){const[t,n="center"]=e.split("-");return[t,n]}var bs=Ol,xs=_l,ws=Il,Es=Dl,eo="rovingFocusGroup.onEntryFocus",Vy={bubbles:!1,cancelable:!0},An="RovingFocusGroup",[Ro,Ll,qy]=gs(An),[Wy,Er]=Xe(An,[qy]),[zy,Gy]=Wy(An),kl=l.forwardRef((e,t)=>p.jsx(Ro.Provider,{scope:e.__scopeRovingFocusGroup,children:p.jsx(Ro.Slot,{scope:e.__scopeRovingFocusGroup,children:p.jsx(Ky,{...e,ref:t})})}));kl.displayName=An;var Ky=l.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:s,currentTabStopId:i,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...u}=e,h=l.useRef(null),m=re(t,h),b=wr(s),[g,y]=nt({prop:i,defaultProp:a??null,onChange:c,caller:An}),[v,x]=l.useState(!1),E=Ye(d),S=Ll(n),T=l.useRef(!1),[P,R]=l.useState(0);return l.useEffect(()=>{const A=h.current;if(A)return A.addEventListener(eo,E),()=>A.removeEventListener(eo,E)},[E]),p.jsx(zy,{scope:n,orientation:r,dir:b,loop:o,currentTabStopId:g,onItemFocus:l.useCallback(A=>y(A),[y]),onItemShiftTab:l.useCallback(()=>x(!0),[]),onFocusableItemAdd:l.useCallback(()=>R(A=>A+1),[]),onFocusableItemRemove:l.useCallback(()=>R(A=>A-1),[]),children:p.jsx(Y.div,{tabIndex:v||P===0?-1:0,"data-orientation":r,...u,ref:m,style:{outline:"none",...e.style},onMouseDown:M(e.onMouseDown,()=>{T.current=!0}),onFocus:M(e.onFocus,A=>{const _=!T.current;if(A.target===A.currentTarget&&_&&!v){const D=new CustomEvent(eo,Vy);if(A.currentTarget.dispatchEvent(D),!D.defaultPrevented){const k=S().filter(L=>L.focusable),U=k.find(L=>L.active),H=k.find(L=>L.id===g),ne=[U,H,...k].filter(Boolean).map(L=>L.ref.current);Bl(ne,f)}}T.current=!1}),onBlur:M(e.onBlur,()=>x(!1))})})}),Fl="RovingFocusGroupItem",$l=l.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,children:i,...a}=e,c=Ze(),d=s||c,f=Gy(Fl,n),u=f.currentTabStopId===d,h=Ll(n),{onFocusableItemAdd:m,onFocusableItemRemove:b,currentTabStopId:g}=f;return l.useEffect(()=>{if(r)return m(),()=>b()},[r,m,b]),p.jsx(Ro.ItemSlot,{scope:n,id:d,focusable:r,active:o,children:p.jsx(Y.span,{tabIndex:u?0:-1,"data-orientation":f.orientation,...a,ref:t,onMouseDown:M(e.onMouseDown,y=>{r?f.onItemFocus(d):y.preventDefault()}),onFocus:M(e.onFocus,()=>f.onItemFocus(d)),onKeyDown:M(e.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){f.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const v=Yy(y,f.orientation,f.dir);if(v!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let E=h().filter(S=>S.focusable).map(S=>S.ref.current);if(v==="last")E.reverse();else if(v==="prev"||v==="next"){v==="prev"&&E.reverse();const S=E.indexOf(y.currentTarget);E=f.loop?Xy(E,S+1):E.slice(S+1)}setTimeout(()=>Bl(E))}}),children:typeof i=="function"?i({isCurrentTabStop:u,hasTabStop:g!=null}):i})})});$l.displayName=Fl;var Zy={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Qy(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Yy(e,t,n){const r=Qy(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Zy[r]}function Bl(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Xy(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Ul=kl,Hl=$l,Po=["Enter"," "],Jy=["ArrowDown","PageUp","Home"],Vl=["ArrowUp","PageDown","End"],e0=[...Jy,...Vl],t0={ltr:[...Po,"ArrowRight"],rtl:[...Po,"ArrowLeft"]},n0={ltr:["ArrowLeft"],rtl:["ArrowRight"]},On="Menu",[hn,r0,o0]=gs(On),[Ot,ql]=Xe(On,[o0,Jt,Er]),Sr=Jt(),Wl=Er(),[s0,Nt]=Ot(On),[a0,Nn]=Ot(On),zl=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:o,onOpenChange:s,modal:i=!0}=e,a=Sr(t),[c,d]=l.useState(null),f=l.useRef(!1),u=Ye(s),h=wr(o);return l.useEffect(()=>{const m=()=>{f.current=!0,document.addEventListener("pointerdown",b,{capture:!0,once:!0}),document.addEventListener("pointermove",b,{capture:!0,once:!0})},b=()=>f.current=!1;return document.addEventListener("keydown",m,{capture:!0}),()=>{document.removeEventListener("keydown",m,{capture:!0}),document.removeEventListener("pointerdown",b,{capture:!0}),document.removeEventListener("pointermove",b,{capture:!0})}},[]),p.jsx(bs,{...a,children:p.jsx(s0,{scope:t,open:n,onOpenChange:u,content:c,onContentChange:d,children:p.jsx(a0,{scope:t,onClose:l.useCallback(()=>u(!1),[u]),isUsingKeyboardRef:f,dir:h,modal:i,children:r})})})};zl.displayName=On;var i0="MenuAnchor",Ss=l.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=Sr(n);return p.jsx(xs,{...o,...r,ref:t})});Ss.displayName=i0;var Cs="MenuPortal",[c0,Gl]=Ot(Cs,{forceMount:void 0}),Kl=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:o}=e,s=Nt(Cs,t);return p.jsx(c0,{scope:t,forceMount:n,children:p.jsx(Je,{present:n||s.open,children:p.jsx(En,{asChild:!0,container:o,children:r})})})};Kl.displayName=Cs;var Be="MenuContent",[l0,Ts]=Ot(Be),Zl=l.forwardRef((e,t)=>{const n=Gl(Be,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,s=Nt(Be,e.__scopeMenu),i=Nn(Be,e.__scopeMenu);return p.jsx(hn.Provider,{scope:e.__scopeMenu,children:p.jsx(Je,{present:r||s.open,children:p.jsx(hn.Slot,{scope:e.__scopeMenu,children:i.modal?p.jsx(u0,{...o,ref:t}):p.jsx(d0,{...o,ref:t})})})})}),u0=l.forwardRef((e,t)=>{const n=Nt(Be,e.__scopeMenu),r=l.useRef(null),o=re(t,r);return l.useEffect(()=>{const s=r.current;if(s)return Jo(s)},[]),p.jsx(Rs,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:M(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),d0=l.forwardRef((e,t)=>{const n=Nt(Be,e.__scopeMenu);return p.jsx(Rs,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),f0=Gt("MenuContent.ScrollLock"),Rs=l.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:a,onEntryFocus:c,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:u,onInteractOutside:h,onDismiss:m,disableOutsideScroll:b,...g}=e,y=Nt(Be,n),v=Nn(Be,n),x=Sr(n),E=Wl(n),S=r0(n),[T,P]=l.useState(null),R=l.useRef(null),A=re(t,R,y.onContentChange),_=l.useRef(0),D=l.useRef(""),k=l.useRef(0),U=l.useRef(null),H=l.useRef("right"),Q=l.useRef(0),ne=b?mr:l.Fragment,L=b?{as:f0,allowPinchZoom:!0}:void 0,Z=I=>{const J=D.current+I,W=S().filter(O=>!O.disabled),ae=document.activeElement,$=W.find(O=>O.ref.current===ae)?.textValue,q=W.map(O=>O.textValue),V=C0(q,J,$),F=W.find(O=>O.textValue===V)?.ref.current;(function O(j){D.current=j,window.clearTimeout(_.current),j!==""&&(_.current=window.setTimeout(()=>O(""),1e3))})(J),F&&setTimeout(()=>F.focus())};l.useEffect(()=>()=>window.clearTimeout(_.current),[]),Xo();const te=l.useCallback(I=>H.current===U.current?.side&&R0(I,U.current?.area),[]);return p.jsx(l0,{scope:n,searchRef:D,onItemEnter:l.useCallback(I=>{te(I)&&I.preventDefault()},[te]),onItemLeave:l.useCallback(I=>{te(I)||(R.current?.focus(),P(null))},[te]),onTriggerLeave:l.useCallback(I=>{te(I)&&I.preventDefault()},[te]),pointerGraceTimerRef:k,onPointerGraceIntentChange:l.useCallback(I=>{U.current=I},[]),children:p.jsx(ne,{...L,children:p.jsx(pr,{asChild:!0,trapped:o,onMountAutoFocus:M(s,I=>{I.preventDefault(),R.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:p.jsx(wn,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:u,onInteractOutside:h,onDismiss:m,children:p.jsx(Ul,{asChild:!0,...E,dir:v.dir,orientation:"vertical",loop:r,currentTabStopId:T,onCurrentTabStopIdChange:P,onEntryFocus:M(c,I=>{v.isUsingKeyboardRef.current||I.preventDefault()}),preventScrollOnEntryFocus:!0,children:p.jsx(ws,{role:"menu","aria-orientation":"vertical","data-state":du(y.open),"data-radix-menu-content":"",dir:v.dir,...x,...g,ref:A,style:{outline:"none",...g.style},onKeyDown:M(g.onKeyDown,I=>{const W=I.target.closest("[data-radix-menu-content]")===I.currentTarget,ae=I.ctrlKey||I.altKey||I.metaKey,$=I.key.length===1;W&&(I.key==="Tab"&&I.preventDefault(),!ae&&$&&Z(I.key));const q=R.current;if(I.target!==q||!e0.includes(I.key))return;I.preventDefault();const F=S().filter(O=>!O.disabled).map(O=>O.ref.current);Vl.includes(I.key)&&F.reverse(),E0(F)}),onBlur:M(e.onBlur,I=>{I.currentTarget.contains(I.target)||(window.clearTimeout(_.current),D.current="")}),onPointerMove:M(e.onPointerMove,mn(I=>{const J=I.target,W=Q.current!==I.clientX;if(I.currentTarget.contains(J)&&W){const ae=I.clientX>Q.current?"right":"left";H.current=ae,Q.current=I.clientX}}))})})})})})})});Zl.displayName=Be;var p0="MenuGroup",Ps=l.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return p.jsx(Y.div,{role:"group",...r,ref:t})});Ps.displayName=p0;var h0="MenuLabel",Ql=l.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return p.jsx(Y.div,{...r,ref:t})});Ql.displayName=h0;var or="MenuItem",Va="menu.itemSelect",Cr=l.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,s=l.useRef(null),i=Nn(or,e.__scopeMenu),a=Ts(or,e.__scopeMenu),c=re(t,s),d=l.useRef(!1),f=()=>{const u=s.current;if(!n&&u){const h=new CustomEvent(Va,{bubbles:!0,cancelable:!0});u.addEventListener(Va,m=>r?.(m),{once:!0}),Di(u,h),h.defaultPrevented?d.current=!1:i.onClose()}};return p.jsx(Yl,{...o,ref:c,disabled:n,onClick:M(e.onClick,f),onPointerDown:u=>{e.onPointerDown?.(u),d.current=!0},onPointerUp:M(e.onPointerUp,u=>{d.current||u.currentTarget?.click()}),onKeyDown:M(e.onKeyDown,u=>{const h=a.searchRef.current!=="";n||h&&u.key===" "||Po.includes(u.key)&&(u.currentTarget.click(),u.preventDefault())})})});Cr.displayName=or;var Yl=l.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...s}=e,i=Ts(or,n),a=Wl(n),c=l.useRef(null),d=re(t,c),[f,u]=l.useState(!1),[h,m]=l.useState("");return l.useEffect(()=>{const b=c.current;b&&m((b.textContent??"").trim())},[s.children]),p.jsx(hn.ItemSlot,{scope:n,disabled:r,textValue:o??h,children:p.jsx(Hl,{asChild:!0,...a,focusable:!r,children:p.jsx(Y.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:d,onPointerMove:M(e.onPointerMove,mn(b=>{r?i.onItemLeave(b):(i.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:M(e.onPointerLeave,mn(b=>i.onItemLeave(b))),onFocus:M(e.onFocus,()=>u(!0)),onBlur:M(e.onBlur,()=>u(!1))})})})}),m0="MenuCheckboxItem",Xl=l.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...o}=e;return p.jsx(ru,{scope:e.__scopeMenu,checked:n,children:p.jsx(Cr,{role:"menuitemcheckbox","aria-checked":sr(n)?"mixed":n,...o,ref:t,"data-state":Os(n),onSelect:M(o.onSelect,()=>r?.(sr(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Xl.displayName=m0;var Jl="MenuRadioGroup",[g0,v0]=Ot(Jl,{value:void 0,onValueChange:()=>{}}),eu=l.forwardRef((e,t)=>{const{value:n,onValueChange:r,...o}=e,s=Ye(r);return p.jsx(g0,{scope:e.__scopeMenu,value:n,onValueChange:s,children:p.jsx(Ps,{...o,ref:t})})});eu.displayName=Jl;var tu="MenuRadioItem",nu=l.forwardRef((e,t)=>{const{value:n,...r}=e,o=v0(tu,e.__scopeMenu),s=n===o.value;return p.jsx(ru,{scope:e.__scopeMenu,checked:s,children:p.jsx(Cr,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":Os(s),onSelect:M(r.onSelect,()=>o.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});nu.displayName=tu;var As="MenuItemIndicator",[ru,y0]=Ot(As,{checked:!1}),ou=l.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...o}=e,s=y0(As,n);return p.jsx(Je,{present:r||sr(s.checked)||s.checked===!0,children:p.jsx(Y.span,{...o,ref:t,"data-state":Os(s.checked)})})});ou.displayName=As;var b0="MenuSeparator",su=l.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return p.jsx(Y.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});su.displayName=b0;var x0="MenuArrow",au=l.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=Sr(n);return p.jsx(Es,{...o,...r,ref:t})});au.displayName=x0;var w0="MenuSub",[RE,iu]=Ot(w0),cn="MenuSubTrigger",cu=l.forwardRef((e,t)=>{const n=Nt(cn,e.__scopeMenu),r=Nn(cn,e.__scopeMenu),o=iu(cn,e.__scopeMenu),s=Ts(cn,e.__scopeMenu),i=l.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:c}=s,d={__scopeMenu:e.__scopeMenu},f=l.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return l.useEffect(()=>f,[f]),l.useEffect(()=>{const u=a.current;return()=>{window.clearTimeout(u),c(null)}},[a,c]),p.jsx(Ss,{asChild:!0,...d,children:p.jsx(Yl,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":du(n.open),...e,ref:xn(t,o.onTriggerChange),onClick:u=>{e.onClick?.(u),!(e.disabled||u.defaultPrevented)&&(u.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:M(e.onPointerMove,mn(u=>{s.onItemEnter(u),!u.defaultPrevented&&!e.disabled&&!n.open&&!i.current&&(s.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{n.onOpenChange(!0),f()},100))})),onPointerLeave:M(e.onPointerLeave,mn(u=>{f();const h=n.content?.getBoundingClientRect();if(h){const m=n.content?.dataset.side,b=m==="right",g=b?-5:5,y=h[b?"left":"right"],v=h[b?"right":"left"];s.onPointerGraceIntentChange({area:[{x:u.clientX+g,y:u.clientY},{x:y,y:h.top},{x:v,y:h.top},{x:v,y:h.bottom},{x:y,y:h.bottom}],side:m}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(u),u.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:M(e.onKeyDown,u=>{const h=s.searchRef.current!=="";e.disabled||h&&u.key===" "||t0[r.dir].includes(u.key)&&(n.onOpenChange(!0),n.content?.focus(),u.preventDefault())})})})});cu.displayName=cn;var lu="MenuSubContent",uu=l.forwardRef((e,t)=>{const n=Gl(Be,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,s=Nt(Be,e.__scopeMenu),i=Nn(Be,e.__scopeMenu),a=iu(lu,e.__scopeMenu),c=l.useRef(null),d=re(t,c);return p.jsx(hn.Provider,{scope:e.__scopeMenu,children:p.jsx(Je,{present:r||s.open,children:p.jsx(hn.Slot,{scope:e.__scopeMenu,children:p.jsx(Rs,{id:a.contentId,"aria-labelledby":a.triggerId,...o,ref:d,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:f=>{i.isUsingKeyboardRef.current&&c.current?.focus(),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:M(e.onFocusOutside,f=>{f.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:M(e.onEscapeKeyDown,f=>{i.onClose(),f.preventDefault()}),onKeyDown:M(e.onKeyDown,f=>{const u=f.currentTarget.contains(f.target),h=n0[i.dir].includes(f.key);u&&h&&(s.onOpenChange(!1),a.trigger?.focus(),f.preventDefault())})})})})})});uu.displayName=lu;function du(e){return e?"open":"closed"}function sr(e){return e==="indeterminate"}function Os(e){return sr(e)?"indeterminate":e?"checked":"unchecked"}function E0(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function S0(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function C0(e,t,n){const o=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let i=S0(e,Math.max(s,0));o.length===1&&(i=i.filter(d=>d!==n));const c=i.find(d=>d.toLowerCase().startsWith(o.toLowerCase()));return c!==n?c:void 0}function T0(e,t){const{x:n,y:r}=e;let o=!1;for(let s=0,i=t.length-1;s<t.length;i=s++){const a=t[s],c=t[i],d=a.x,f=a.y,u=c.x,h=c.y;f>r!=h>r&&n<(u-d)*(r-f)/(h-f)+d&&(o=!o)}return o}function R0(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return T0(n,t)}function mn(e){return t=>t.pointerType==="mouse"?e(t):void 0}var P0=zl,A0=Ss,O0=Kl,N0=Zl,_0=Ps,I0=Ql,M0=Cr,D0=Xl,j0=eu,L0=nu,k0=ou,F0=su,$0=au,B0=cu,U0=uu,Tr="DropdownMenu",[H0]=Xe(Tr,[ql]),Oe=ql(),[V0,fu]=H0(Tr),pu=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:o,defaultOpen:s,onOpenChange:i,modal:a=!0}=e,c=Oe(t),d=l.useRef(null),[f,u]=nt({prop:o,defaultProp:s??!1,onChange:i,caller:Tr});return p.jsx(V0,{scope:t,triggerId:Ze(),triggerRef:d,contentId:Ze(),open:f,onOpenChange:u,onOpenToggle:l.useCallback(()=>u(h=>!h),[u]),modal:a,children:p.jsx(P0,{...c,open:f,onOpenChange:u,dir:r,modal:a,children:n})})};pu.displayName=Tr;var hu="DropdownMenuTrigger",mu=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=e,s=fu(hu,n),i=Oe(n);return p.jsx(A0,{asChild:!0,...i,children:p.jsx(Y.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...o,ref:xn(t,s.triggerRef),onPointerDown:M(e.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(s.onOpenToggle(),s.open||a.preventDefault())}),onKeyDown:M(e.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&s.onOpenToggle(),a.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});mu.displayName=hu;var q0="DropdownMenuPortal",gu=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Oe(t);return p.jsx(O0,{...r,...n})};gu.displayName=q0;var vu="DropdownMenuContent",yu=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=fu(vu,n),s=Oe(n),i=l.useRef(!1);return p.jsx(N0,{id:o.contentId,"aria-labelledby":o.triggerId,...s,...r,ref:t,onCloseAutoFocus:M(e.onCloseAutoFocus,a=>{i.current||o.triggerRef.current?.focus(),i.current=!1,a.preventDefault()}),onInteractOutside:M(e.onInteractOutside,a=>{const c=a.detail.originalEvent,d=c.button===0&&c.ctrlKey===!0,f=c.button===2||d;(!o.modal||f)&&(i.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});yu.displayName=vu;var W0="DropdownMenuGroup",z0=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Oe(n);return p.jsx(_0,{...o,...r,ref:t})});z0.displayName=W0;var G0="DropdownMenuLabel",bu=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Oe(n);return p.jsx(I0,{...o,...r,ref:t})});bu.displayName=G0;var K0="DropdownMenuItem",xu=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Oe(n);return p.jsx(M0,{...o,...r,ref:t})});xu.displayName=K0;var Z0="DropdownMenuCheckboxItem",wu=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Oe(n);return p.jsx(D0,{...o,...r,ref:t})});wu.displayName=Z0;var Q0="DropdownMenuRadioGroup",Y0=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Oe(n);return p.jsx(j0,{...o,...r,ref:t})});Y0.displayName=Q0;var X0="DropdownMenuRadioItem",Eu=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Oe(n);return p.jsx(L0,{...o,...r,ref:t})});Eu.displayName=X0;var J0="DropdownMenuItemIndicator",Su=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Oe(n);return p.jsx(k0,{...o,...r,ref:t})});Su.displayName=J0;var eb="DropdownMenuSeparator",Cu=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Oe(n);return p.jsx(F0,{...o,...r,ref:t})});Cu.displayName=eb;var tb="DropdownMenuArrow",nb=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Oe(n);return p.jsx($0,{...o,...r,ref:t})});nb.displayName=tb;var rb="DropdownMenuSubTrigger",Tu=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Oe(n);return p.jsx(B0,{...o,...r,ref:t})});Tu.displayName=rb;var ob="DropdownMenuSubContent",Ru=l.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Oe(n);return p.jsx(U0,{...o,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Ru.displayName=ob;var sb=pu,ab=mu,ib=gu,cb=yu,lb=bu,ub=xu,db=wu,fb=Eu,pb=Su,hb=Cu,mb=Tu,gb=Ru,vb=sb,yb=ab,bb=ib,Pu=cb,Au=ub,Ou=db,Nu=fb,_u=pb,Iu=lb,Mu=hb,Du=mb,ju=gb;const xb=vb,wb=yb,Eb=l.forwardRef(({className:e,inset:t,children:n,...r},o)=>p.jsx(Du,{ref:o,className:fe("flex","cursor-default","select-none","items-center","rounded-[10px]","px-3","py-2","text-sm","font-medium","text-fg-secondary","outline-none","focus-ring-soft","focus:bg-hover-subtle","focus:text-fg-default","data-[state=open]:bg-hover-subtle","data-[state=open]:text-fg-default",t&&"pl-8",e),...r,children:n}));Eb.displayName=Du.displayName;const Sb=l.forwardRef(({className:e,...t},n)=>p.jsx(ju,{ref:n,className:fe("z-50","min-w-[8rem]","overflow-hidden","surface-floating","p-1",e),...t}));Sb.displayName=ju.displayName;const Lu=l.forwardRef(({className:e,sideOffset:t=4,...n},r)=>p.jsx(bb,{children:p.jsx(Pu,{ref:r,sideOffset:t,className:fe("z-[1100]","min-w-[10rem]","overflow-hidden","surface-floating","p-1","data-[state=open]:animate-fade-in","data-[state=open]:animate-zoom-in",e),...n})}));Lu.displayName=Pu.displayName;const ku=l.forwardRef(({className:e,inset:t,...n},r)=>p.jsx(Au,{ref:r,className:fe("relative","flex","cursor-pointer","select-none","items-center","px-3","py-2","text-sm","font-medium","text-fg-secondary","outline-none","focus-ring-soft","transition-colors","rounded-[10px]","focus:bg-hover-subtle","focus:text-fg-default","data-[disabled]:pointer-events-none","data-[disabled]:opacity-50",t&&"pl-8",e),...n}));ku.displayName=Au.displayName;const Cb=l.forwardRef(({className:e,children:t,checked:n,...r},o)=>p.jsxs(Ou,{ref:o,className:fe("relative","flex","cursor-pointer","select-none","items-center","rounded-[10px]","py-2","pl-8","pr-3","text-sm","font-medium","text-fg-secondary","outline-none","focus-ring-soft","transition-colors","focus:bg-hover-subtle","focus:text-fg-default","data-[disabled]:pointer-events-none","data-[disabled]:opacity-50",e),checked:n,...r,children:[p.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:p.jsx(_u,{children:"✓"})}),t]}));Cb.displayName=Ou.displayName;const Tb=l.forwardRef(({className:e,children:t,...n},r)=>p.jsxs(Nu,{ref:r,className:fe("relative","flex","cursor-pointer","select-none","items-center","rounded-[10px]","py-2","pl-8","pr-3","text-sm","font-medium","text-fg-secondary","outline-none","focus-ring-soft","transition-colors","focus:bg-hover-subtle","focus:text-fg-default","data-[disabled]:pointer-events-none","data-[disabled]:opacity-50",e),...n,children:[p.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:p.jsx(_u,{children:"●"})}),t]}));Tb.displayName=Nu.displayName;const Rb=l.forwardRef(({className:e,inset:t,...n},r)=>p.jsx(Iu,{ref:r,className:fe("px-2","py-1.5","text-sm","font-semibold","text-fg-secondary",t&&"pl-8",e),...n}));Rb.displayName=Iu.displayName;const Fu=l.forwardRef(({className:e,...t},n)=>p.jsx(Mu,{ref:n,className:fe("-mx-1","my-1","h-px","bg-divider",e),...t}));Fu.displayName=Mu.displayName;const PE=({button:e,items:t})=>p.jsxs(xb,{children:[p.jsx(wb,{asChild:!0,children:e}),p.jsx(Lu,{align:"end",children:t.map((n,r)=>n.type==="separator"?p.jsx(Fu,{},n.key??`separator-${r}`):p.jsx(ku,{onClick:n.onClick,children:n.name},n.name))})]}),Pb=l.forwardRef(({title:e,description:t,className:n="",...r},o)=>p.jsxs("div",{ref:o,className:fe("flex flex-col items-center justify-center text-center","h-[400px]","bg-muted/30","border-2 border-dashed","border-border-secondary","rounded-[20px]","p-8",n),...r,children:[e&&p.jsx($e,{as:"h3",variant:"heading",weight:"bold",tone:"muted",className:"mb-2",children:e}),t&&p.jsx($e,{as:"p",variant:"meta",weight:"medium",tone:"tertiary",className:"max-w-[400px]",children:t})]}));Pb.displayName="Empty";const Ab=Ae(["w-full","border","border-border-subtle","bg-elevated","text-fg-default","placeholder:text-fg-placeholder","transition-colors","outline-none","focus-ring-soft","disabled:cursor-not-allowed","disabled:opacity-50"],{variants:{variant:{default:[],ghost:["border-transparent","bg-subtle","hover:bg-hover-subtle"],error:["border-border-error","bg-accent-soft-danger/40","text-fg-default"]},size:{sm:"h-8 px-3 text-sm rounded-[12px]",md:"h-9 px-3 text-sm rounded-[14px]",lg:"h-11 px-4 text-base rounded-[16px]"}},defaultVariants:{variant:"default",size:"md"}}),Ob=l.forwardRef(({className:e,variant:t,size:n,type:r="text",...o},s)=>p.jsx("input",{ref:s,type:r,className:Ab({variant:t,size:n,className:e}),...o}));Ob.displayName="Input";const Nb=Ae(["font-bold","text-fg-muted","whitespace-nowrap"],{variants:{size:{sm:"text-xs",md:"text-sm",lg:"text-base"}},defaultVariants:{size:"sm"}}),_b=l.forwardRef(({className:e,size:t,...n},r)=>p.jsx("label",{ref:r,className:Nb({size:t,className:e}),...n}));_b.displayName="Label";const Ib=l.forwardRef(({page:e,last:t,onChange:n,className:r="",...o},s)=>{const i=Number(e),a=Number(t),c=[];for(let u=1;u<a+1;u++)(i===u||i===1&&u<i+5||i===2&&u<i+4||u>i-3&&u<i+3||i===a-1&&u>i-4||i===a&&u>i-5)&&c.push(u);const d=i===1,f=i===a;return p.jsxs("nav",{ref:s,className:`mt-8 flex justify-center items-center gap-1 ${r}`,...o,children:[p.jsxs(Ut,{disabled:d,onClick:()=>!d&&n(1),"aria-label":"First page",isSkip:!0,children:[p.jsx(Kr,{width:16}),p.jsx(Kr,{width:16})]}),p.jsx(Ut,{disabled:d,onClick:()=>!d&&n(i-1),"aria-label":"Previous page",children:p.jsx(Kr,{width:20})}),c.map(u=>p.jsx(Ut,{active:i===u,onClick:()=>n(u),"aria-label":`Page ${u}`,"aria-current":i===u?"page":void 0,children:u},u)),p.jsx(Ut,{disabled:f,onClick:()=>!f&&n(i+1),"aria-label":"Next page",children:p.jsx(Zr,{width:20})}),p.jsxs(Ut,{disabled:f,onClick:()=>!f&&n(a),"aria-label":"Last page",isSkip:!0,children:[p.jsx(Zr,{width:16}),p.jsx(Zr,{width:16})]})]})});Ib.displayName="Pagination";const Ut=l.forwardRef(({active:e,disabled:t,isSkip:n,children:r,className:o="",...s},i)=>{const a=`
60
60
  flex justify-center items-center
61
61
  leading-normal text-base font-medium
62
62
  w-9 h-9 md:w-10 md:h-10
@@ -353,4 +353,4 @@ __NOTE_ADDITIONAL_FIELDS__ id
353
353
  target
354
354
  }
355
355
  }
356
- }`)}export{Fu as $,Bm as A,it as B,Go as C,LE as D,Pb as E,Ry as F,PE as G,fe as H,Ob as I,Db as J,Fo as K,_b as L,xr as M,Kr as N,$E as O,Ds as P,ME as Q,AE as R,_x as S,$e as T,Zr as U,g1 as V,WE as W,xb as X,wb as Y,Lu as Z,Rb as _,qx as a,K1 as a$,ku as a0,bn as a1,po as a2,dn as a3,ap as a4,Ee as a5,wp as a6,tp as a7,Me as a8,Ei as a9,B1 as aA,fi as aB,hi as aC,Gs as aD,L1 as aE,Vn as aF,_1 as aG,H1 as aH,li as aI,co as aJ,I1 as aK,j1 as aL,k1 as aM,pt as aN,M1 as aO,Q1 as aP,Qe as aQ,zo as aR,Wo as aS,qo as aT,Vo as aU,O1 as aV,W1 as aW,uo as aX,G1 as aY,z1 as aZ,Rf as a_,eE as aa,fr as ab,tS as ac,qE as ad,nS as ae,zt as af,GE as ag,ZE as ah,KE as ai,jE as aj,zE as ak,kE as al,QE as am,Ld as an,Us as ao,N1 as ap,q1 as aq,V1 as ar,Bo as as,A1 as at,$1 as au,Lr as av,U1 as aw,lo as ax,F1 as ay,D1 as az,Wx as b,Tf as b0,X1 as b1,oE as b2,tE as b3,nE as b4,xw as b5,Nd as b6,OE as b7,rS as b8,Y1 as b9,IE as ba,_E as bb,NE as bc,Bd as bd,DE as be,ce as bf,oS as bg,Mx as c,rE as d,ue as e,Z1 as f,de as g,J1 as h,YE as i,Ib as j,Zn as k,FE as l,XE as m,BE as n,UE as o,eS as p,TE as q,JE as r,km as s,HE as t,up as u,VE as v,Ox as w,Nx as x,Ae as y,At as z};
356
+ }`)}export{g1 as $,At as A,it as B,LE as C,Ry as D,Pb as E,Go as F,PE as G,Bm as H,Ob as I,Db as J,Fo as K,_b as L,xr as M,Kr as N,$E as O,Ds as P,ME as Q,AE as R,_x as S,$e as T,WE as U,xb as V,wb as W,Lu as X,Rb as Y,Fu as Z,ku as _,qx as a,K1 as a$,Zr as a0,bn as a1,po as a2,dn as a3,ap as a4,Ee as a5,wp as a6,tp as a7,Me as a8,Ei as a9,B1 as aA,fi as aB,hi as aC,Gs as aD,L1 as aE,Vn as aF,_1 as aG,H1 as aH,li as aI,co as aJ,I1 as aK,j1 as aL,k1 as aM,pt as aN,M1 as aO,Q1 as aP,Qe as aQ,zo as aR,Wo as aS,qo as aT,Vo as aU,O1 as aV,W1 as aW,uo as aX,G1 as aY,z1 as aZ,Rf as a_,eE as aa,fr as ab,tS as ac,qE as ad,nS as ae,zt as af,GE as ag,ZE as ah,KE as ai,jE as aj,zE as ak,kE as al,QE as am,Ld as an,Us as ao,N1 as ap,q1 as aq,V1 as ar,Bo as as,A1 as at,$1 as au,Lr as av,U1 as aw,lo as ax,F1 as ay,D1 as az,Wx as b,Tf as b0,X1 as b1,oE as b2,tE as b3,nE as b4,xw as b5,Nd as b6,OE as b7,rS as b8,Y1 as b9,IE as ba,_E as bb,NE as bc,Bd as bd,DE as be,ce as bf,oS as bg,fe as c,Mx as d,rE as e,ue as f,de as g,Z1 as h,J1 as i,YE as j,Ib as k,Zn as l,FE as m,XE as n,BE as o,eS as p,TE as q,JE as r,km as s,UE as t,up as u,HE as v,VE as w,Ox as x,Nx as y,Ae as z};
@@ -1,4 +1,4 @@
1
- import{r as a,j as e}from"./floating-ui.react-dom-BWTnA00G.js";import{g as J,a as V,b as M,P as v,h as j,M as W}from"./time-CfAYZipR.js";import{z as ee,g as P,u as ae,q as N,P as te,T as s,s as se,B as C,A as le,M as m,L as b,I as w,j as ne,k as $,f as re,d as ce}from"./note.api-BQovzEzd.js";import{F as ie}from"./app-DQBV36r_.js";import{S as D}from"./SurfaceCard-GMt5xM7v.js";import{f as oe}from"./url-9nrbQs7Z.js";import{n as de}from"./Plus.es-CRRp2u5J.js";import"./preload-helper-BXl3LOEh.js";import"./Graph-vXQQ0a-Q.js";const me=new Map([["bold",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216.49,168.49a12,12,0,0,1-17,0L128,97,56.49,168.49a12,12,0,0,1-17-17l80-80a12,12,0,0,1,17,0l80,80A12,12,0,0,1,216.49,168.49Z"}))],["duotone",a.createElement(a.Fragment,null,a.createElement("path",{d:"M208,160H48l80-80Z",opacity:"0.2"}),a.createElement("path",{d:"M213.66,154.34l-80-80a8,8,0,0,0-11.32,0l-80,80A8,8,0,0,0,48,168H208a8,8,0,0,0,5.66-13.66ZM67.31,152,128,91.31,188.69,152Z"}))],["fill",a.createElement(a.Fragment,null,a.createElement("path",{d:"M215.39,163.06A8,8,0,0,1,208,168H48a8,8,0,0,1-5.66-13.66l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,215.39,163.06Z"}))],["light",a.createElement(a.Fragment,null,a.createElement("path",{d:"M212.24,164.24a6,6,0,0,1-8.48,0L128,88.49,52.24,164.24a6,6,0,0,1-8.48-8.48l80-80a6,6,0,0,1,8.48,0l80,80A6,6,0,0,1,212.24,164.24Z"}))],["regular",a.createElement(a.Fragment,null,a.createElement("path",{d:"M213.66,165.66a8,8,0,0,1-11.32,0L128,91.31,53.66,165.66a8,8,0,0,1-11.32-11.32l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,213.66,165.66Z"}))],["thin",a.createElement(a.Fragment,null,a.createElement("path",{d:"M210.83,162.83a4,4,0,0,1-5.66,0L128,85.66,50.83,162.83a4,4,0,0,1-5.66-5.66l80-80a4,4,0,0,1,5.66,0l80,80A4,4,0,0,1,210.83,162.83Z"}))]]),k=a.forwardRef((l,c)=>a.createElement(ee,{ref:c,...l,weights:me}));k.displayName="CaretUpIcon";const he=k,O=["id","name","template","replacement","createdAt","updatedAt"],pe=new Set(O),ue=`query FetchPlaceholders(
1
+ import{r as a,j as e}from"./floating-ui.react-dom-BWTnA00G.js";import{g as J,a as V,b as M,P as v,h as j,M as W}from"./time-D5LRMumI.js";import{A as ee,g as P,u as ae,q as N,P as te,T as s,s as se,B as C,H as le,M as m,L as b,I as w,k as ne,l as $,h as re,e as ce}from"./note.api-D3oJmG3q.js";import{F as ie}from"./app-BpSMjzET.js";import{S as D}from"./SurfaceCard-t7pdfhEe.js";import{f as oe}from"./url-9nrbQs7Z.js";import{n as de}from"./Plus.es-DRfLW_bI.js";import"./preload-helper-BXl3LOEh.js";import"./Graph-LY_IgMYy.js";const me=new Map([["bold",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216.49,168.49a12,12,0,0,1-17,0L128,97,56.49,168.49a12,12,0,0,1-17-17l80-80a12,12,0,0,1,17,0l80,80A12,12,0,0,1,216.49,168.49Z"}))],["duotone",a.createElement(a.Fragment,null,a.createElement("path",{d:"M208,160H48l80-80Z",opacity:"0.2"}),a.createElement("path",{d:"M213.66,154.34l-80-80a8,8,0,0,0-11.32,0l-80,80A8,8,0,0,0,48,168H208a8,8,0,0,0,5.66-13.66ZM67.31,152,128,91.31,188.69,152Z"}))],["fill",a.createElement(a.Fragment,null,a.createElement("path",{d:"M215.39,163.06A8,8,0,0,1,208,168H48a8,8,0,0,1-5.66-13.66l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,215.39,163.06Z"}))],["light",a.createElement(a.Fragment,null,a.createElement("path",{d:"M212.24,164.24a6,6,0,0,1-8.48,0L128,88.49,52.24,164.24a6,6,0,0,1-8.48-8.48l80-80a6,6,0,0,1,8.48,0l80,80A6,6,0,0,1,212.24,164.24Z"}))],["regular",a.createElement(a.Fragment,null,a.createElement("path",{d:"M213.66,165.66a8,8,0,0,1-11.32,0L128,91.31,53.66,165.66a8,8,0,0,1-11.32-11.32l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,213.66,165.66Z"}))],["thin",a.createElement(a.Fragment,null,a.createElement("path",{d:"M210.83,162.83a4,4,0,0,1-5.66,0L128,85.66,50.83,162.83a4,4,0,0,1-5.66-5.66l80-80a4,4,0,0,1,5.66,0l80,80A4,4,0,0,1,210.83,162.83Z"}))]]),k=a.forwardRef((l,c)=>a.createElement(ee,{ref:c,...l,weights:me}));k.displayName="CaretUpIcon";const he=k,O=["id","name","template","replacement","createdAt","updatedAt"],pe=new Set(O),ue=`query FetchPlaceholders(
2
2
  $searchFilter: SearchFilterInput,
3
3
  $pagination: PaginationInput
4
4
  ) {
@@ -31,4 +31,4 @@ __PLACEHOLDER_FIELDS__ }
31
31
  }
32
32
  }`,l),ye=l=>P(`mutation DeletePlaceholder($id: ID!) {
33
33
  deletePlaceholder(id: $id)
34
- }`,{id:l}),I=re(oe),Ae=()=>{const l=ce(),c=ae(),h=I.useNavigate(),{page:r}=I.useSearch(),[g,i]=a.useState(!1),[f,H]=a.useState(!0),[n,p]=a.useState({name:"",template:"",replacement:""}),o=25,T=N.placeholders.list({limit:o,offset:(r-1)*o}),[E]=a.useState(J),{data:d,isLoading:u}=V({queryKey:T,queryFn:async()=>{const t=await ge({offset:(r-1)*o,limit:o});if(t.type==="error")throw t;return t.allPlaceholders}}),F=M({mutationFn:fe,onSuccess:async()=>{l("Placeholder added successfully"),i(!1),p({name:"",template:"",replacement:""}),await c.invalidateQueries({queryKey:N.placeholders.listAll(),exact:!1})}}),q=M({mutationFn:ye,onSuccess:async()=>{l("Placeholder deleted successfully"),await c.invalidateQueries({queryKey:N.placeholders.listAll(),exact:!1})}}),B=E.length,x=d?.totalCount??0,Z=d?.placeholders??[],y="font-medium text-fg-tertiary",L="leading-[1.2]",A="break-all leading-[1.2]",S="leading-[1.2]",_="flex flex-col gap-px",R="space-y-px",Q="focus-ring-soft inline-flex items-center gap-2 rounded-[12px] border border-transparent px-2.5 py-1.5 text-fg-tertiary outline-none transition-colors hover:bg-hover-subtle hover:text-fg-default",K="relative",U="absolute right-2 top-2",z="focus-ring-soft surface-base group flex flex-col items-center justify-center gap-0.5 px-4 py-4 text-center text-fg-secondary outline-none transition-colors hover:bg-hover-subtle hover:text-fg-default",G="inline-flex h-[34px] w-[34px] items-center justify-center rounded-full border border-border-subtle bg-surface text-current transition-colors group-hover:border-border-secondary/70",X=x>0?`Placeholders (${x})`:void 0;return e.jsxs(te,{title:"Placeholders",variant:"default",heading:u?e.jsx($,{width:244,height:24,className:"rounded-full"}):X,description:u?e.jsx($,{width:260,height:16,className:"rounded-full"}):"Create tokens that get replaced with values when you clone a note",children:[e.jsxs("div",{className:"flex flex-col gap-5",children:[e.jsxs("section",{className:"space-y-3 border-b border-border-subtle/80 pb-5",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(s,{as:"p",variant:"body",weight:"medium",children:"System placeholders"}),e.jsx(s,{as:"p",variant:"meta",tone:"secondary",children:"Built-in tokens for date and time that are always available when cloning notes"})]}),e.jsxs("button",{type:"button",onClick:()=>H(!f),className:Q,children:[e.jsxs(s,{as:"span",variant:"meta",weight:"medium",tone:"secondary",children:[B," items"]}),f?e.jsx(he,{className:"h-4 w-4"}):e.jsx(se,{className:"h-4 w-4"})]})]}),f&&e.jsx("div",{className:"grid-auto-cards grid gap-5",children:E.map(t=>e.jsx(D,{children:e.jsxs("div",{className:_,children:[e.jsx(s,{as:"div",variant:"body",weight:"medium",className:L,children:t.name}),e.jsxs("div",{className:R,children:[e.jsxs(s,{as:"div",variant:"meta",weight:"medium",tone:"secondary",className:A,children:[v,t.template,j]}),e.jsxs(s,{as:"div",variant:"label",weight:"medium",tone:"tertiary",className:S,children:["Current value: ",t.replacement]})]})]})},t.name))})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(s,{as:"p",variant:"body",weight:"medium",children:"Custom placeholders"}),e.jsx(s,{as:"p",variant:"meta",tone:"secondary",children:"Custom tokens you define once and reuse whenever you clone a note"})]}),!u&&e.jsx(s,{as:"span",variant:"meta",weight:"medium",tone:"secondary",children:x===1?"1 item":`${x} items`})]}),!u&&e.jsxs("div",{className:"grid-auto-cards grid gap-5",children:[Z.map(t=>e.jsxs(D,{className:K,children:[e.jsx(C,{variant:"ghost",size:"icon-sm",className:U,"aria-label":`Delete placeholder ${t.name}`,onClick:()=>q.mutate(t.id.toString()),children:e.jsx(le,{className:"h-4 w-4"})}),e.jsxs("div",{className:_,children:[e.jsx(s,{as:"div",variant:"body",weight:"medium",className:`min-w-0 pr-8 ${L}`,children:t.name}),e.jsxs("div",{className:R,children:[e.jsxs(s,{as:"div",variant:"meta",weight:"medium",tone:"secondary",className:A,children:[v,t.template,j]}),e.jsxs(s,{as:"div",variant:"label",weight:"medium",tone:"tertiary",className:S,children:["Replaces with: ",t.replacement]})]})]})]},t.id)),e.jsxs("button",{type:"button",onClick:()=>i(!0),className:z,children:[e.jsx("span",{className:G,children:e.jsx(de,{className:"h-4.5 w-4.5"})}),e.jsx(s,{as:"div",variant:"meta",weight:"medium",tone:"secondary",className:"text-current",children:"New custom"})]})]})]})]}),e.jsxs(m,{isOpen:g,onClose:()=>i(!1),variant:"form",children:[e.jsx(m.Header,{title:"Add Placeholder",onClose:()=>i(!1)}),e.jsxs(m.Body,{children:[e.jsx(m.Description,{className:"mb-4",children:"Create a token that swaps in a value when you clone a note"}),e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{htmlFor:"name",className:y,children:"Name"}),e.jsx(w,{id:"name",type:"text",value:n.name,onChange:t=>p({...n,name:t.target.value}),placeholder:"Description of this placeholder"}),e.jsx(s,{as:"p",variant:"meta",tone:"secondary",children:"A readable label so you can find this placeholder later"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{htmlFor:"template",className:y,children:"Placeholder"}),e.jsx(w,{id:"template",type:"text",value:n.template,onChange:t=>p({...n,template:t.target.value}),placeholder:"note_app"}),e.jsxs(s,{as:"p",variant:"meta",tone:"secondary",children:["Use it in a note as ",v,"your_placeholder",j]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{htmlFor:"replacement",className:y,children:"Replacement"}),e.jsx(w,{id:"replacement",type:"text",value:n.replacement,onChange:t=>p({...n,replacement:t.target.value}),placeholder:"Ocean Brain"}),e.jsx(s,{as:"p",variant:"meta",tone:"secondary",children:"This value is inserted when the placeholder is replaced during cloning"})]})]})]}),e.jsx(m.Footer,{children:e.jsxs(W,{children:[e.jsx(C,{variant:"ghost",onClick:()=>i(!1),children:"Cancel"}),e.jsx(C,{variant:"primary",isLoading:F.isPending,onClick:()=>{if(!n.name||!n.template||!n.replacement){l("All fields are required");return}F.mutate({name:n.name,template:n.template,replacement:n.replacement})},children:"Add"})]})})]}),e.jsx(ie,{fallback:null,children:d?.totalCount&&o<d.totalCount&&e.jsx(ne,{page:r,last:Math.ceil(d.totalCount/o),onChange:t=>{h({search:Y=>({...Y,page:t})})}})})]})};export{Ae as default};
34
+ }`,{id:l}),I=re(oe),Ae=()=>{const l=ce(),c=ae(),h=I.useNavigate(),{page:r}=I.useSearch(),[g,i]=a.useState(!1),[f,H]=a.useState(!0),[n,p]=a.useState({name:"",template:"",replacement:""}),o=25,T=N.placeholders.list({limit:o,offset:(r-1)*o}),[E]=a.useState(J),{data:d,isLoading:u}=V({queryKey:T,queryFn:async()=>{const t=await ge({offset:(r-1)*o,limit:o});if(t.type==="error")throw t;return t.allPlaceholders}}),F=M({mutationFn:fe,onSuccess:async()=>{l("Placeholder added successfully"),i(!1),p({name:"",template:"",replacement:""}),await c.invalidateQueries({queryKey:N.placeholders.listAll(),exact:!1})}}),q=M({mutationFn:ye,onSuccess:async()=>{l("Placeholder deleted successfully"),await c.invalidateQueries({queryKey:N.placeholders.listAll(),exact:!1})}}),B=E.length,x=d?.totalCount??0,Z=d?.placeholders??[],y="font-medium text-fg-tertiary",L="leading-[1.2]",A="break-all leading-[1.2]",S="leading-[1.2]",_="flex flex-col gap-px",R="space-y-px",Q="focus-ring-soft inline-flex items-center gap-2 rounded-[12px] border border-transparent px-2.5 py-1.5 text-fg-tertiary outline-none transition-colors hover:bg-hover-subtle hover:text-fg-default",K="relative",U="absolute right-2 top-2",G="focus-ring-soft surface-base group flex flex-col items-center justify-center gap-0.5 px-4 py-4 text-center text-fg-secondary outline-none transition-colors hover:bg-hover-subtle hover:text-fg-default",X="inline-flex h-[34px] w-[34px] items-center justify-center rounded-full border border-border-subtle bg-surface text-current transition-colors group-hover:border-border-secondary/70",z=x>0?`Placeholders (${x})`:void 0;return e.jsxs(te,{title:"Placeholders",variant:"default",heading:u?e.jsx($,{width:244,height:24,className:"rounded-full"}):z,description:u?e.jsx($,{width:260,height:16,className:"rounded-full"}):"Create tokens that get replaced with values when you clone a note",children:[e.jsxs("div",{className:"flex flex-col gap-5",children:[e.jsxs("section",{className:"space-y-3 border-b border-border-subtle/80 pb-5",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(s,{as:"p",variant:"body",weight:"medium",children:"System placeholders"}),e.jsx(s,{as:"p",variant:"meta",tone:"secondary",children:"Built-in tokens for date and time that are always available when cloning notes"})]}),e.jsxs("button",{type:"button",onClick:()=>H(!f),className:Q,children:[e.jsxs(s,{as:"span",variant:"meta",weight:"medium",tone:"secondary",children:[B," items"]}),f?e.jsx(he,{className:"h-4 w-4"}):e.jsx(se,{className:"h-4 w-4"})]})]}),f&&e.jsx("div",{className:"grid-auto-cards grid gap-5",children:E.map(t=>e.jsx(D,{children:e.jsxs("div",{className:_,children:[e.jsx(s,{as:"div",variant:"body",weight:"medium",className:L,children:t.name}),e.jsxs("div",{className:R,children:[e.jsxs(s,{as:"div",variant:"meta",weight:"medium",tone:"secondary",className:A,children:[v,t.template,j]}),e.jsxs(s,{as:"div",variant:"label",weight:"medium",tone:"tertiary",className:S,children:["Current value: ",t.replacement]})]})]})},t.name))})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(s,{as:"p",variant:"body",weight:"medium",children:"Custom placeholders"}),e.jsx(s,{as:"p",variant:"meta",tone:"secondary",children:"Custom tokens you define once and reuse whenever you clone a note"})]}),!u&&e.jsx(s,{as:"span",variant:"meta",weight:"medium",tone:"secondary",children:x===1?"1 item":`${x} items`})]}),!u&&e.jsxs("div",{className:"grid-auto-cards grid gap-5",children:[Z.map(t=>e.jsxs(D,{className:K,children:[e.jsx(C,{variant:"ghost",size:"icon-sm",className:U,"aria-label":`Delete placeholder ${t.name}`,onClick:()=>q.mutate(t.id.toString()),children:e.jsx(le,{className:"h-4 w-4"})}),e.jsxs("div",{className:_,children:[e.jsx(s,{as:"div",variant:"body",weight:"medium",className:`min-w-0 pr-8 ${L}`,children:t.name}),e.jsxs("div",{className:R,children:[e.jsxs(s,{as:"div",variant:"meta",weight:"medium",tone:"secondary",className:A,children:[v,t.template,j]}),e.jsxs(s,{as:"div",variant:"label",weight:"medium",tone:"tertiary",className:S,children:["Replaces with: ",t.replacement]})]})]})]},t.id)),e.jsxs("button",{type:"button",onClick:()=>i(!0),className:G,children:[e.jsx("span",{className:X,children:e.jsx(de,{className:"h-4.5 w-4.5"})}),e.jsx(s,{as:"div",variant:"meta",weight:"medium",tone:"secondary",className:"text-current",children:"New custom"})]})]})]})]}),e.jsxs(m,{isOpen:g,onClose:()=>i(!1),variant:"form",children:[e.jsx(m.Header,{title:"Add Placeholder",onClose:()=>i(!1)}),e.jsxs(m.Body,{children:[e.jsx(m.Description,{className:"mb-4",children:"Create a token that swaps in a value when you clone a note"}),e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{htmlFor:"name",className:y,children:"Name"}),e.jsx(w,{id:"name",type:"text",value:n.name,onChange:t=>p({...n,name:t.target.value}),placeholder:"Description of this placeholder"}),e.jsx(s,{as:"p",variant:"meta",tone:"secondary",children:"A readable label so you can find this placeholder later"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{htmlFor:"template",className:y,children:"Placeholder"}),e.jsx(w,{id:"template",type:"text",value:n.template,onChange:t=>p({...n,template:t.target.value}),placeholder:"note_app"}),e.jsxs(s,{as:"p",variant:"meta",tone:"secondary",children:["Use it in a note as ",v,"your_placeholder",j]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{htmlFor:"replacement",className:y,children:"Replacement"}),e.jsx(w,{id:"replacement",type:"text",value:n.replacement,onChange:t=>p({...n,replacement:t.target.value}),placeholder:"Ocean Brain"}),e.jsx(s,{as:"p",variant:"meta",tone:"secondary",children:"This value is inserted when the placeholder is replaced during cloning"})]})]})]}),e.jsx(m.Footer,{children:e.jsxs(W,{children:[e.jsx(C,{variant:"ghost",onClick:()=>i(!1),children:"Cancel"}),e.jsx(C,{variant:"primary",isLoading:F.isPending,onClick:()=>{if(!n.name||!n.template||!n.replacement){l("All fields are required");return}F.mutate({name:n.name,template:n.template,replacement:n.replacement})},children:"Add"})]})})]}),e.jsx(ie,{fallback:null,children:d?.totalCount&&o<d.totalCount&&e.jsx(ne,{page:r,last:Math.ceil(d.totalCount/o),onChange:t=>{h({search:Y=>({...Y,page:t})})}})})]})};export{Ae as default};