ocean-brain 0.3.4 → 0.4.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.
- package/package.json +5 -5
- package/scripts/postinstall-prisma.mjs +3 -2
- package/server/client/dist/assets/Calendar-CSXEuWmQ.js +25 -0
- package/server/client/dist/assets/Callout-Ap1OcxWN.js +1 -0
- package/server/client/dist/assets/Graph-C0Ax9qjI.js +1 -0
- package/server/client/dist/assets/{Image-ZxF459sC.js → Image-CSbcG-5a.js} +1 -1
- package/server/client/dist/assets/{Image.es-BQfyKc2-.js → Image.es-Fbe7aDDo.js} +1 -1
- package/server/client/dist/assets/{ModalActionRow-DyOb58KJ.js → ModalActionRow-DjI5b4bl.js} +1 -1
- package/server/client/dist/assets/Note-BY6WgYLq.js +1 -0
- package/server/client/dist/assets/Note-W4f6H9K0.css +1 -0
- package/server/client/dist/assets/Reminders-vRksvSQE.js +1 -0
- package/server/client/dist/assets/Search-Cq4tuiJO.js +1 -0
- package/server/client/dist/assets/{SurfaceCard-nZNf9lyE.js → SurfaceCard-Br6TjX5W.js} +1 -1
- package/server/client/dist/assets/Tag-ARDLA-Pb.js +1 -0
- package/server/client/dist/assets/TagNotes-CDGVrCJU.js +1 -0
- package/server/client/dist/assets/{Trash.es-BGoN5q9L.js → Trash.es-BfCEiL3-.js} +1 -1
- package/server/client/dist/assets/ViewNotes-ZBOQ1adH.js +1 -0
- package/server/client/dist/assets/Views-DQHPfdwM.js +1 -0
- package/server/client/dist/assets/{image.api-0mMkElZk.js → image.api-DGXlQ_Ca.js} +1 -1
- package/server/client/dist/assets/index-B28TO4FC.js +1 -0
- package/server/client/dist/assets/{index-DL7pUwq2.css → index-Bm9l_L20.css} +1 -1
- package/server/client/dist/assets/index-Bsx4P7EA.js +210 -0
- package/server/client/dist/assets/manage-image-Dg297A_h.js +1 -0
- package/server/client/dist/assets/manage-image-detail-hk6jWyiB.js +1 -0
- package/server/client/dist/assets/mcp-CSjmBjFR.js +1 -0
- package/server/client/dist/assets/{note-core-BCgMq5QA.js → note-core-GgFcksAF.js} +1 -1
- package/server/client/dist/assets/{note-vendor-BofYbzmZ.js → note-vendor-5N5mRkIT.js} +3 -3
- package/server/client/dist/assets/{placeholder-i-uNe71U.js → placeholder-Bmiowo28.js} +4 -4
- package/server/client/dist/assets/trash-CM7SbVtW.js +1 -0
- package/server/client/dist/assets/{useReminderMutate-tNMwwRnx.js → useReminderMutate-DsIvVpCQ.js} +2 -2
- package/server/client/dist/assets/view-dashboard-CP8nhfxQ.js +90 -0
- package/server/client/dist/index.html +4 -4
- package/server/dist/app.js +8 -84
- package/server/dist/app.js.map +1 -1
- package/server/dist/features/auth/http/api.js +43 -0
- package/server/dist/features/auth/http/api.js.map +1 -0
- package/server/dist/features/auth/http/login-page.js +28 -0
- package/server/dist/features/auth/http/login-page.js.map +1 -0
- package/server/dist/features/auth/http/pages.js +50 -0
- package/server/dist/features/auth/http/pages.js.map +1 -0
- package/server/dist/features/auth/service.js +94 -0
- package/server/dist/features/auth/service.js.map +1 -0
- package/server/dist/features/cache/graphql/cache.field.resolver.js +5 -0
- package/server/dist/features/cache/graphql/cache.field.resolver.js.map +1 -0
- package/server/dist/features/cache/graphql/cache.mutation.resolver.js +49 -0
- package/server/dist/features/cache/graphql/cache.mutation.resolver.js.map +1 -0
- package/server/dist/features/cache/graphql/cache.query.resolver.js +21 -0
- package/server/dist/features/cache/graphql/cache.query.resolver.js.map +1 -0
- package/server/dist/features/cache/graphql/cache.resolver.js +12 -0
- package/server/dist/features/cache/graphql/cache.resolver.js.map +1 -0
- package/server/dist/features/cache/graphql/cache.type-defs.js +32 -0
- package/server/dist/features/cache/graphql/cache.type-defs.js.map +1 -0
- package/server/dist/features/cache/graphql/index.js +21 -0
- package/server/dist/features/cache/graphql/index.js.map +1 -0
- package/server/dist/features/image/graphql/image.field.resolver.js +14 -0
- package/server/dist/features/image/graphql/image.field.resolver.js.map +1 -0
- package/server/dist/features/image/graphql/image.mutation.resolver.js +21 -0
- package/server/dist/features/image/graphql/image.mutation.resolver.js.map +1 -0
- package/server/dist/features/image/graphql/image.query.resolver.js +40 -0
- package/server/dist/features/image/graphql/image.query.resolver.js.map +1 -0
- package/server/dist/features/image/graphql/image.resolver.js +12 -0
- package/server/dist/features/image/graphql/image.resolver.js.map +1 -0
- package/server/dist/features/image/graphql/image.type-defs.js +31 -0
- package/server/dist/features/image/graphql/image.type-defs.js.map +1 -0
- package/server/dist/features/image/graphql/index.js +16 -0
- package/server/dist/features/image/graphql/index.js.map +1 -0
- package/server/dist/features/image/http/upload.js +48 -0
- package/server/dist/features/image/http/upload.js.map +1 -0
- package/server/dist/features/image/services/delete.js +52 -0
- package/server/dist/features/image/services/delete.js.map +1 -0
- package/server/dist/{modules/remote-image.js → features/image/services/remote-fetch.js} +1 -1
- package/server/dist/features/image/services/remote-fetch.js.map +1 -0
- package/server/dist/{modules/image-upload.js → features/image/services/upload.js} +4 -8
- package/server/dist/features/image/services/upload.js.map +1 -0
- package/server/dist/{views/mcp-admin.js → features/mcp-admin/http/handlers.js} +3 -3
- package/server/dist/features/mcp-admin/http/handlers.js.map +1 -0
- package/server/dist/{modules/mcp-admin.js → features/mcp-admin/service.js} +3 -3
- package/server/dist/features/mcp-admin/service.js.map +1 -0
- package/server/dist/features/note/graphql/index.js +8 -0
- package/server/dist/features/note/graphql/index.js.map +1 -0
- package/server/dist/features/note/graphql/note.field.resolver.js +12 -0
- package/server/dist/features/note/graphql/note.field.resolver.js.map +1 -0
- package/server/dist/features/note/graphql/note.graphql.shared.js +23 -0
- package/server/dist/features/note/graphql/note.graphql.shared.js.map +1 -0
- package/server/dist/features/note/graphql/note.mutation.resolver.js +140 -0
- package/server/dist/features/note/graphql/note.mutation.resolver.js.map +1 -0
- package/server/dist/features/note/graphql/note.query.resolver.js +382 -0
- package/server/dist/features/note/graphql/note.query.resolver.js.map +1 -0
- package/server/dist/features/note/graphql/note.resolver.js +14 -0
- package/server/dist/features/note/graphql/note.resolver.js.map +1 -0
- package/server/dist/features/note/graphql/note.type-defs.js +184 -0
- package/server/dist/features/note/graphql/note.type-defs.js.map +1 -0
- package/server/dist/{views/note.js → features/note/http/mcp.js} +27 -15
- package/server/dist/features/note/http/mcp.js.map +1 -0
- package/server/dist/{modules/note-authoring.js → features/note/services/authoring.js} +25 -7
- package/server/dist/features/note/services/authoring.js.map +1 -0
- package/server/dist/{modules/note-cleanup.js → features/note/services/cleanup.js} +14 -23
- package/server/dist/features/note/services/cleanup.js.map +1 -0
- package/server/dist/features/note/services/search-backfill.js +84 -0
- package/server/dist/features/note/services/search-backfill.js.map +1 -0
- package/server/dist/features/note/services/search.js +197 -0
- package/server/dist/features/note/services/search.js.map +1 -0
- package/server/dist/{modules/note-snapshot.js → features/note/services/snapshot.js} +51 -49
- package/server/dist/features/note/services/snapshot.js.map +1 -0
- package/server/dist/{modules/note-tag-filter.js → features/note/services/tag-filter.js} +2 -6
- package/server/dist/features/note/services/tag-filter.js.map +1 -0
- package/server/dist/{modules/note-trash.js → features/note/services/trash.js} +28 -23
- package/server/dist/features/note/services/trash.js.map +1 -0
- package/server/dist/features/placeholder/graphql/index.js +27 -0
- package/server/dist/features/placeholder/graphql/index.js.map +1 -0
- package/server/dist/features/placeholder/graphql/placeholder.field.resolver.js +5 -0
- package/server/dist/features/placeholder/graphql/placeholder.field.resolver.js.map +1 -0
- package/server/dist/features/placeholder/graphql/placeholder.mutation.resolver.js +72 -0
- package/server/dist/features/placeholder/graphql/placeholder.mutation.resolver.js.map +1 -0
- package/server/dist/features/placeholder/graphql/placeholder.query.resolver.js +36 -0
- package/server/dist/features/placeholder/graphql/placeholder.query.resolver.js.map +1 -0
- package/server/dist/features/placeholder/graphql/placeholder.resolver.js +12 -0
- package/server/dist/features/placeholder/graphql/placeholder.resolver.js.map +1 -0
- package/server/dist/features/placeholder/graphql/placeholder.type-defs.js +50 -0
- package/server/dist/features/placeholder/graphql/placeholder.type-defs.js.map +1 -0
- package/server/dist/features/reminder/graphql/index.js +27 -0
- package/server/dist/features/reminder/graphql/index.js.map +1 -0
- package/server/dist/features/reminder/graphql/reminder.field.resolver.js +10 -0
- package/server/dist/features/reminder/graphql/reminder.field.resolver.js.map +1 -0
- package/server/dist/features/reminder/graphql/reminder.mutation.resolver.js +59 -0
- package/server/dist/features/reminder/graphql/reminder.mutation.resolver.js.map +1 -0
- package/server/dist/features/reminder/graphql/reminder.query.resolver.js +79 -0
- package/server/dist/features/reminder/graphql/reminder.query.resolver.js.map +1 -0
- package/server/dist/features/reminder/graphql/reminder.resolver.js +12 -0
- package/server/dist/features/reminder/graphql/reminder.resolver.js.map +1 -0
- package/server/dist/features/reminder/graphql/reminder.type-defs.js +51 -0
- package/server/dist/features/reminder/graphql/reminder.type-defs.js.map +1 -0
- package/server/dist/features/tag/graphql/index.js +14 -0
- package/server/dist/features/tag/graphql/index.js.map +1 -0
- package/server/dist/features/tag/graphql/tag.field.resolver.js +10 -0
- package/server/dist/features/tag/graphql/tag.field.resolver.js.map +1 -0
- package/server/dist/features/tag/graphql/tag.mutation.resolver.js +15 -0
- package/server/dist/features/tag/graphql/tag.mutation.resolver.js.map +1 -0
- package/server/dist/features/tag/graphql/tag.query.resolver.js +26 -0
- package/server/dist/features/tag/graphql/tag.query.resolver.js.map +1 -0
- package/server/dist/features/tag/graphql/tag.resolver.js +12 -0
- package/server/dist/features/tag/graphql/tag.resolver.js.map +1 -0
- package/server/dist/features/tag/graphql/tag.type-defs.js +46 -0
- package/server/dist/features/tag/graphql/tag.type-defs.js.map +1 -0
- package/server/dist/{views/tag.js → features/tag/http/mcp.js} +3 -3
- package/server/dist/features/tag/http/mcp.js.map +1 -0
- package/server/dist/{modules/tag-organization.js → features/tag/services/organization.js} +38 -8
- package/server/dist/features/tag/services/organization.js.map +1 -0
- package/server/dist/features/view/graphql/index.js +11 -0
- package/server/dist/features/view/graphql/index.js.map +1 -0
- package/server/dist/features/view/graphql/view.mutation.resolver.js +53 -0
- package/server/dist/features/view/graphql/view.mutation.resolver.js.map +1 -0
- package/server/dist/features/view/graphql/view.query.resolver.js +29 -0
- package/server/dist/features/view/graphql/view.query.resolver.js.map +1 -0
- package/server/dist/features/view/graphql/view.resolver.js +10 -0
- package/server/dist/features/view/graphql/view.resolver.js.map +1 -0
- package/server/dist/features/view/graphql/view.type-defs.js +63 -0
- package/server/dist/features/view/graphql/view.type-defs.js.map +1 -0
- package/server/dist/features/view/services/workspace.js +432 -0
- package/server/dist/features/view/services/workspace.js.map +1 -0
- package/server/dist/main.js +14 -0
- package/server/dist/main.js.map +1 -1
- package/server/dist/modules/auth-guard.js +10 -9
- package/server/dist/modules/auth-guard.js.map +1 -1
- package/server/dist/modules/auth-mode.js +1 -3
- package/server/dist/modules/auth-mode.js.map +1 -1
- package/server/dist/modules/blocknote.js +8 -17
- package/server/dist/modules/blocknote.js.map +1 -1
- package/server/dist/modules/data-maintenance.js +75 -0
- package/server/dist/modules/data-maintenance.js.map +1 -0
- package/server/dist/modules/error-handler.js.map +1 -1
- package/server/dist/modules/logger.js +5 -23
- package/server/dist/modules/logger.js.map +1 -1
- package/server/dist/modules/mcp-auth.js +4 -5
- package/server/dist/modules/mcp-auth.js.map +1 -1
- package/server/dist/modules/mcp-token.js.map +1 -1
- package/server/dist/modules/prisma-runtime.js +2 -7
- package/server/dist/modules/prisma-runtime.js.map +1 -1
- package/server/dist/modules/recovery-retention.js +1 -1
- package/server/dist/modules/recovery-retention.js.map +1 -1
- package/server/dist/modules/server-events-handler.js +34 -0
- package/server/dist/modules/server-events-handler.js.map +1 -0
- package/server/dist/modules/server-events.js +32 -0
- package/server/dist/modules/server-events.js.map +1 -0
- package/server/dist/modules/use-async.js.map +1 -1
- package/server/dist/paths.js.map +1 -1
- package/server/dist/routes/api.js +34 -0
- package/server/dist/routes/api.js.map +1 -0
- package/server/dist/routes/auth-pages.js +11 -0
- package/server/dist/routes/auth-pages.js.map +1 -0
- package/server/dist/routes/client.js +27 -0
- package/server/dist/routes/client.js.map +1 -0
- package/server/dist/routes/graphql.js +33 -0
- package/server/dist/routes/graphql.js.map +1 -0
- package/server/dist/routes/index.js +11 -0
- package/server/dist/routes/index.js.map +1 -0
- package/server/dist/routes/mcp.js +30 -0
- package/server/dist/routes/mcp.js.map +1 -0
- package/server/dist/schema/index.js +11 -8
- package/server/dist/schema/index.js.map +1 -1
- package/server/dist/types/index.js.map +1 -1
- package/server/prisma/migrations/20260413143000_0014_tag_name_unique/migration.sql +32 -0
- package/server/prisma/migrations/20260414143000_0015_note_searchable_text/migration.sql +5 -0
- package/server/prisma/migrations/20260416090000_0016_view_workspace/migration.sql +50 -0
- package/server/prisma/schema.prisma +66 -12
- package/server/client/dist/assets/Calendar-Kjy1PX6L.js +0 -25
- package/server/client/dist/assets/Graph-Bl5K2qUw.js +0 -1
- package/server/client/dist/assets/Note-BfGma2Qc.css +0 -1
- package/server/client/dist/assets/Note-DN_ko2M3.js +0 -1
- package/server/client/dist/assets/Reminders-BK-Uv9Ps.js +0 -1
- package/server/client/dist/assets/Search-ClHeWvmI.js +0 -1
- package/server/client/dist/assets/Tag-Dph4V_kl.js +0 -1
- package/server/client/dist/assets/TagNotes-CxP5qHZj.js +0 -1
- package/server/client/dist/assets/index-6lIw6jYW.js +0 -1
- package/server/client/dist/assets/index-Ba2XPRI8.js +0 -205
- package/server/client/dist/assets/manage-image-Br_kKxbb.js +0 -1
- package/server/client/dist/assets/manage-image-detail-9DzqbiqI.js +0 -1
- package/server/client/dist/assets/mcp-C_So91eX.js +0 -1
- package/server/client/dist/assets/trash-Cg3nJ1m5.js +0 -1
- package/server/dist/modules/auth.js +0 -25
- package/server/dist/modules/auth.js.map +0 -1
- package/server/dist/modules/image-upload.js.map +0 -1
- package/server/dist/modules/mcp-admin.js.map +0 -1
- package/server/dist/modules/note-authoring.js.map +0 -1
- package/server/dist/modules/note-cleanup.js.map +0 -1
- package/server/dist/modules/note-snapshot.js.map +0 -1
- package/server/dist/modules/note-tag-filter.js.map +0 -1
- package/server/dist/modules/note-trash.js.map +0 -1
- package/server/dist/modules/remote-image.js.map +0 -1
- package/server/dist/modules/tag-organization.js.map +0 -1
- package/server/dist/schema/cache/index.js +0 -58
- package/server/dist/schema/cache/index.js.map +0 -1
- package/server/dist/schema/image/index.js +0 -88
- package/server/dist/schema/image/index.js.map +0 -1
- package/server/dist/schema/note/index.js +0 -582
- package/server/dist/schema/note/index.js.map +0 -1
- package/server/dist/schema/placeholder/index.js +0 -105
- package/server/dist/schema/placeholder/index.js.map +0 -1
- package/server/dist/schema/reminder/index.js +0 -161
- package/server/dist/schema/reminder/index.js.map +0 -1
- package/server/dist/schema/tag/index.js +0 -81
- package/server/dist/schema/tag/index.js.map +0 -1
- package/server/dist/urls.js +0 -9
- package/server/dist/urls.js.map +0 -1
- package/server/dist/views/auth.js +0 -305
- package/server/dist/views/auth.js.map +0 -1
- package/server/dist/views/image.js +0 -44
- package/server/dist/views/image.js.map +0 -1
- package/server/dist/views/index.js +0 -6
- package/server/dist/views/index.js.map +0 -1
- package/server/dist/views/mcp-admin.js.map +0 -1
- package/server/dist/views/note.js.map +0 -1
- package/server/dist/views/tag.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as qs,g as pv,a as S,R as hv,N as Ve}from"./graph-vendor-CUxe67Lr.js";import{a as tS,f as nS,P as oS,b as lS,y as aS,g as rS,c as Td,D as Uf,d as iS,M as sS,m as cS,e as uS,H as fS,N as dS,h as mS,L as pS,A as hS,B as gS,_ as po,i as ht,j as vS,w as zg,k as yS,K as bS,l as xS,C as SS,x as CS,n as kt,o as ys,p as Or,q as wS,r as xl,s as Fe,t as Ys,S as Nr,T as TS,u as Xs,v as Gn,I as Ed,z as Lg,E as ES,F as MS,G as gv,J as vv,O as yv,Q as RS,R as jS,U as Ar,V as _S,W as OS,X as NS,Y as AS,Z as DS,$ as bv,a0 as Ce,a1 as Md}from"./note-core-BCgMq5QA.js";var $f={exports:{}},wr={};var Vg;function HS(){if(Vg)return wr;Vg=1;var t=Symbol.for("react.transitional.element"),o=Symbol.for("react.fragment");function a(r,s,c){var f=null;if(c!==void 0&&(f=""+c),s.key!==void 0&&(f=""+s.key),"key"in s){c={};for(var d in s)d!=="key"&&(c[d]=s[d])}else c=s;return s=c.ref,{$$typeof:t,type:r,key:f,ref:s!==void 0?s:null,props:c}}return wr.Fragment=o,wr.jsx=a,wr.jsxs=a,wr}var kg;function zS(){return kg||(kg=1,$f.exports=HS()),$f.exports}var g=zS(),Gf={exports:{}},Tr={},Zf={exports:{}},qf={};var Bg;function LS(){return Bg||(Bg=1,(function(t){function o(D,U){var V=D.length;D.push(U);e:for(;0<V;){var K=V-1>>>1,W=D[K];if(0<s(W,U))D[K]=U,D[V]=W,V=K;else break e}}function a(D){return D.length===0?null:D[0]}function r(D){if(D.length===0)return null;var U=D[0],V=D.pop();if(V!==U){D[0]=V;e:for(var K=0,W=D.length,de=W>>>1;K<de;){var le=2*(K+1)-1,ae=D[le],ye=le+1,ge=D[ye];if(0>s(ae,V))ye<W&&0>s(ge,ae)?(D[K]=ge,D[ye]=V,K=ye):(D[K]=ae,D[le]=V,K=le);else if(ye<W&&0>s(ge,V))D[K]=ge,D[ye]=V,K=ye;else break e}}return U}function s(D,U){var V=D.sortIndex-U.sortIndex;return V!==0?V:D.id-U.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;t.unstable_now=function(){return c.now()}}else{var f=Date,d=f.now();t.unstable_now=function(){return f.now()-d}}var p=[],h=[],v=1,y=null,x=3,C=!1,T=!1,w=!1,M=!1,R=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;function A(D){for(var U=a(h);U!==null;){if(U.callback===null)r(h);else if(U.startTime<=D)r(h),U.sortIndex=U.expirationTime,o(p,U);else break;U=a(h)}}function H(D){if(w=!1,A(D),!T)if(a(p)!==null)T=!0,L||(L=!0,oe());else{var U=a(h);U!==null&&ne(H,U.startTime-D)}}var L=!1,Z=-1,I=5,J=-1;function P(){return M?!0:!(t.unstable_now()-J<I)}function ee(){if(M=!1,L){var D=t.unstable_now();J=D;var U=!0;try{e:{T=!1,w&&(w=!1,_(Z),Z=-1),C=!0;var V=x;try{t:{for(A(D),y=a(p);y!==null&&!(y.expirationTime>D&&P());){var K=y.callback;if(typeof K=="function"){y.callback=null,x=y.priorityLevel;var W=K(y.expirationTime<=D);if(D=t.unstable_now(),typeof W=="function"){y.callback=W,A(D),U=!0;break t}y===a(p)&&r(p),A(D)}else r(p);y=a(p)}if(y!==null)U=!0;else{var de=a(h);de!==null&&ne(H,de.startTime-D),U=!1}}break e}finally{y=null,x=V,C=!1}U=void 0}}finally{U?oe():L=!1}}}var oe;if(typeof N=="function")oe=function(){N(ee)};else if(typeof MessageChannel<"u"){var te=new MessageChannel,B=te.port2;te.port1.onmessage=ee,oe=function(){B.postMessage(null)}}else oe=function(){R(ee,0)};function ne(D,U){Z=R(function(){D(t.unstable_now())},U)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(D){D.callback=null},t.unstable_forceFrameRate=function(D){0>D||125<D?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<D?Math.floor(1e3/D):5},t.unstable_getCurrentPriorityLevel=function(){return x},t.unstable_next=function(D){switch(x){case 1:case 2:case 3:var U=3;break;default:U=x}var V=x;x=U;try{return D()}finally{x=V}},t.unstable_requestPaint=function(){M=!0},t.unstable_runWithPriority=function(D,U){switch(D){case 1:case 2:case 3:case 4:case 5:break;default:D=3}var V=x;x=D;try{return U()}finally{x=V}},t.unstable_scheduleCallback=function(D,U,V){var K=t.unstable_now();switch(typeof V=="object"&&V!==null?(V=V.delay,V=typeof V=="number"&&0<V?K+V:K):V=K,D){case 1:var W=-1;break;case 2:W=250;break;case 5:W=1073741823;break;case 4:W=1e4;break;default:W=5e3}return W=V+W,D={id:v++,callback:U,priorityLevel:D,startTime:V,expirationTime:W,sortIndex:-1},V>K?(D.sortIndex=V,o(h,D),a(p)===null&&D===a(h)&&(w?(_(Z),Z=-1):w=!0,ne(H,V-K))):(D.sortIndex=W,o(p,D),T||C||(T=!0,L||(L=!0,oe()))),D},t.unstable_shouldYield=P,t.unstable_wrapCallback=function(D){var U=x;return function(){var V=x;x=U;try{return D.apply(this,arguments)}finally{x=V}}}})(qf)),qf}var Ug;function VS(){return Ug||(Ug=1,Zf.exports=LS()),Zf.exports}var Yf={exports:{}},Tt={};var $g;function kS(){if($g)return Tt;$g=1;var t=qs();function o(p){var h="https://react.dev/errors/"+p;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var v=2;v<arguments.length;v++)h+="&args[]="+encodeURIComponent(arguments[v])}return"Minified React error #"+p+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(){}var r={d:{f:a,r:function(){throw Error(o(522))},D:a,C:a,L:a,m:a,X:a,S:a,M:a},p:0,findDOMNode:null},s=Symbol.for("react.portal");function c(p,h,v){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:y==null?null:""+y,children:p,containerInfo:h,implementation:v}}var f=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(p,h){if(p==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return Tt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Tt.createPortal=function(p,h){var v=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(o(299));return c(p,h,null,v)},Tt.flushSync=function(p){var h=f.T,v=r.p;try{if(f.T=null,r.p=2,p)return p()}finally{f.T=h,r.p=v,r.d.f()}},Tt.preconnect=function(p,h){typeof p=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,r.d.C(p,h))},Tt.prefetchDNS=function(p){typeof p=="string"&&r.d.D(p)},Tt.preinit=function(p,h){if(typeof p=="string"&&h&&typeof h.as=="string"){var v=h.as,y=d(v,h.crossOrigin),x=typeof h.integrity=="string"?h.integrity:void 0,C=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;v==="style"?r.d.S(p,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:y,integrity:x,fetchPriority:C}):v==="script"&&r.d.X(p,{crossOrigin:y,integrity:x,fetchPriority:C,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},Tt.preinitModule=function(p,h){if(typeof p=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var v=d(h.as,h.crossOrigin);r.d.M(p,{crossOrigin:v,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&r.d.M(p)},Tt.preload=function(p,h){if(typeof p=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var v=h.as,y=d(v,h.crossOrigin);r.d.L(p,v,{crossOrigin:y,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},Tt.preloadModule=function(p,h){if(typeof p=="string")if(h){var v=d(h.as,h.crossOrigin);r.d.m(p,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:v,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else r.d.m(p)},Tt.requestFormReset=function(p){r.d.r(p)},Tt.unstable_batchedUpdates=function(p,h){return p(h)},Tt.useFormState=function(p,h,v){return f.H.useFormState(p,h,v)},Tt.useFormStatus=function(){return f.H.useHostTransitionStatus()},Tt.version="19.2.4",Tt}var Gg;function xv(){if(Gg)return Yf.exports;Gg=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(o){console.error(o)}}return t(),Yf.exports=kS(),Yf.exports}var Zg;function BS(){if(Zg)return Tr;Zg=1;var t=VS(),o=qs(),a=xv();function r(e){var n="https://react.dev/errors/"+e;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)n+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function c(e){var n=e,l=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(l=n.return),e=n.return;while(e)}return n.tag===3?l:null}function f(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function d(e){if(e.tag===31){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function p(e){if(c(e)!==e)throw Error(r(188))}function h(e){var n=e.alternate;if(!n){if(n=c(e),n===null)throw Error(r(188));return n!==e?null:e}for(var l=e,i=n;;){var u=l.return;if(u===null)break;var m=u.alternate;if(m===null){if(i=u.return,i!==null){l=i;continue}break}if(u.child===m.child){for(m=u.child;m;){if(m===l)return p(u),e;if(m===i)return p(u),n;m=m.sibling}throw Error(r(188))}if(l.return!==i.return)l=u,i=m;else{for(var b=!1,E=u.child;E;){if(E===l){b=!0,l=u,i=m;break}if(E===i){b=!0,i=u,l=m;break}E=E.sibling}if(!b){for(E=m.child;E;){if(E===l){b=!0,l=m,i=u;break}if(E===i){b=!0,i=m,l=u;break}E=E.sibling}if(!b)throw Error(r(189))}}if(l.alternate!==i)throw Error(r(190))}if(l.tag!==3)throw Error(r(188));return l.stateNode.current===l?e:n}function v(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e;for(e=e.child;e!==null;){if(n=v(e),n!==null)return n;e=e.sibling}return null}var y=Object.assign,x=Symbol.for("react.element"),C=Symbol.for("react.transitional.element"),T=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),M=Symbol.for("react.strict_mode"),R=Symbol.for("react.profiler"),_=Symbol.for("react.consumer"),N=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),H=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),Z=Symbol.for("react.memo"),I=Symbol.for("react.lazy"),J=Symbol.for("react.activity"),P=Symbol.for("react.memo_cache_sentinel"),ee=Symbol.iterator;function oe(e){return e===null||typeof e!="object"?null:(e=ee&&e[ee]||e["@@iterator"],typeof e=="function"?e:null)}var te=Symbol.for("react.client.reference");function B(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===te?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case w:return"Fragment";case R:return"Profiler";case M:return"StrictMode";case H:return"Suspense";case L:return"SuspenseList";case J:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case T:return"Portal";case N:return e.displayName||"Context";case _:return(e._context.displayName||"Context")+".Consumer";case A:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Z:return n=e.displayName||null,n!==null?n:B(e.type)||"Memo";case I:n=e._payload,e=e._init;try{return B(e(n))}catch{}}return null}var ne=Array.isArray,D=o.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,U=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V={pending:!1,data:null,method:null,action:null},K=[],W=-1;function de(e){return{current:e}}function le(e){0>W||(e.current=K[W],K[W]=null,W--)}function ae(e,n){W++,K[W]=e.current,e.current=n}var ye=de(null),ge=de(null),Ne=de(null),Pe=de(null);function Ee(e,n){switch(ae(Ne,n),ae(ge,e),ae(ye,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?lg(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=lg(n),e=ag(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}le(ye),ae(ye,e)}function ve(){le(ye),le(ge),le(Ne)}function We(e){e.memoizedState!==null&&ae(Pe,e);var n=ye.current,l=ag(n,e.type);n!==l&&(ae(ge,e),ae(ye,l))}function rt(e){ge.current===e&&(le(ye),le(ge)),Pe.current===e&&(le(Pe),br._currentValue=V)}var et,ze;function ot(e){if(et===void 0)try{throw Error()}catch(l){var n=l.stack.trim().match(/\n( *(at )?)/);et=n&&n[1]||"",ze=-1<l.stack.indexOf(`
|
|
1
|
+
import{r as qs,g as pv,a as S,R as hv,N as Ve}from"./graph-vendor-CUxe67Lr.js";import{a as tS,f as nS,P as oS,b as lS,y as aS,g as rS,c as Td,D as Uf,d as iS,M as sS,m as cS,e as uS,H as fS,N as dS,h as mS,L as pS,A as hS,B as gS,_ as po,i as ht,j as kt,k as ys,l as Or,p as vS,n as xl,o as Fe,q as Ys,S as Nr,T as yS,r as Xs,s as Gn,I as Ed,t as zg,C as bS,u as xS,v as gv,w as vv,x as yv,z as SS,E as CS,R as Ar,F as wS,G as TS,J as ES,K as MS,O as bv,Q as RS,U as jS,V as Lg,W as _S,X as OS,Y as NS,Z as AS,$ as DS,a0 as Ce,a1 as Md}from"./note-core-GgFcksAF.js";var $f={exports:{}},wr={};var Vg;function HS(){if(Vg)return wr;Vg=1;var t=Symbol.for("react.transitional.element"),o=Symbol.for("react.fragment");function a(r,s,c){var f=null;if(c!==void 0&&(f=""+c),s.key!==void 0&&(f=""+s.key),"key"in s){c={};for(var d in s)d!=="key"&&(c[d]=s[d])}else c=s;return s=c.ref,{$$typeof:t,type:r,key:f,ref:s!==void 0?s:null,props:c}}return wr.Fragment=o,wr.jsx=a,wr.jsxs=a,wr}var kg;function zS(){return kg||(kg=1,$f.exports=HS()),$f.exports}var g=zS(),Gf={exports:{}},Tr={},Zf={exports:{}},qf={};var Bg;function LS(){return Bg||(Bg=1,(function(t){function o(D,U){var V=D.length;D.push(U);e:for(;0<V;){var K=V-1>>>1,W=D[K];if(0<s(W,U))D[K]=U,D[V]=W,V=K;else break e}}function a(D){return D.length===0?null:D[0]}function r(D){if(D.length===0)return null;var U=D[0],V=D.pop();if(V!==U){D[0]=V;e:for(var K=0,W=D.length,de=W>>>1;K<de;){var le=2*(K+1)-1,ae=D[le],ye=le+1,ge=D[ye];if(0>s(ae,V))ye<W&&0>s(ge,ae)?(D[K]=ge,D[ye]=V,K=ye):(D[K]=ae,D[le]=V,K=le);else if(ye<W&&0>s(ge,V))D[K]=ge,D[ye]=V,K=ye;else break e}}return U}function s(D,U){var V=D.sortIndex-U.sortIndex;return V!==0?V:D.id-U.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;t.unstable_now=function(){return c.now()}}else{var f=Date,d=f.now();t.unstable_now=function(){return f.now()-d}}var p=[],h=[],v=1,y=null,x=3,C=!1,T=!1,w=!1,M=!1,R=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;function A(D){for(var U=a(h);U!==null;){if(U.callback===null)r(h);else if(U.startTime<=D)r(h),U.sortIndex=U.expirationTime,o(p,U);else break;U=a(h)}}function H(D){if(w=!1,A(D),!T)if(a(p)!==null)T=!0,L||(L=!0,oe());else{var U=a(h);U!==null&&ne(H,U.startTime-D)}}var L=!1,Z=-1,I=5,J=-1;function P(){return M?!0:!(t.unstable_now()-J<I)}function ee(){if(M=!1,L){var D=t.unstable_now();J=D;var U=!0;try{e:{T=!1,w&&(w=!1,_(Z),Z=-1),C=!0;var V=x;try{t:{for(A(D),y=a(p);y!==null&&!(y.expirationTime>D&&P());){var K=y.callback;if(typeof K=="function"){y.callback=null,x=y.priorityLevel;var W=K(y.expirationTime<=D);if(D=t.unstable_now(),typeof W=="function"){y.callback=W,A(D),U=!0;break t}y===a(p)&&r(p),A(D)}else r(p);y=a(p)}if(y!==null)U=!0;else{var de=a(h);de!==null&&ne(H,de.startTime-D),U=!1}}break e}finally{y=null,x=V,C=!1}U=void 0}}finally{U?oe():L=!1}}}var oe;if(typeof N=="function")oe=function(){N(ee)};else if(typeof MessageChannel<"u"){var te=new MessageChannel,B=te.port2;te.port1.onmessage=ee,oe=function(){B.postMessage(null)}}else oe=function(){R(ee,0)};function ne(D,U){Z=R(function(){D(t.unstable_now())},U)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(D){D.callback=null},t.unstable_forceFrameRate=function(D){0>D||125<D?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<D?Math.floor(1e3/D):5},t.unstable_getCurrentPriorityLevel=function(){return x},t.unstable_next=function(D){switch(x){case 1:case 2:case 3:var U=3;break;default:U=x}var V=x;x=U;try{return D()}finally{x=V}},t.unstable_requestPaint=function(){M=!0},t.unstable_runWithPriority=function(D,U){switch(D){case 1:case 2:case 3:case 4:case 5:break;default:D=3}var V=x;x=D;try{return U()}finally{x=V}},t.unstable_scheduleCallback=function(D,U,V){var K=t.unstable_now();switch(typeof V=="object"&&V!==null?(V=V.delay,V=typeof V=="number"&&0<V?K+V:K):V=K,D){case 1:var W=-1;break;case 2:W=250;break;case 5:W=1073741823;break;case 4:W=1e4;break;default:W=5e3}return W=V+W,D={id:v++,callback:U,priorityLevel:D,startTime:V,expirationTime:W,sortIndex:-1},V>K?(D.sortIndex=V,o(h,D),a(p)===null&&D===a(h)&&(w?(_(Z),Z=-1):w=!0,ne(H,V-K))):(D.sortIndex=W,o(p,D),T||C||(T=!0,L||(L=!0,oe()))),D},t.unstable_shouldYield=P,t.unstable_wrapCallback=function(D){var U=x;return function(){var V=x;x=U;try{return D.apply(this,arguments)}finally{x=V}}}})(qf)),qf}var Ug;function VS(){return Ug||(Ug=1,Zf.exports=LS()),Zf.exports}var Yf={exports:{}},Tt={};var $g;function kS(){if($g)return Tt;$g=1;var t=qs();function o(p){var h="https://react.dev/errors/"+p;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var v=2;v<arguments.length;v++)h+="&args[]="+encodeURIComponent(arguments[v])}return"Minified React error #"+p+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(){}var r={d:{f:a,r:function(){throw Error(o(522))},D:a,C:a,L:a,m:a,X:a,S:a,M:a},p:0,findDOMNode:null},s=Symbol.for("react.portal");function c(p,h,v){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:y==null?null:""+y,children:p,containerInfo:h,implementation:v}}var f=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(p,h){if(p==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return Tt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Tt.createPortal=function(p,h){var v=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(o(299));return c(p,h,null,v)},Tt.flushSync=function(p){var h=f.T,v=r.p;try{if(f.T=null,r.p=2,p)return p()}finally{f.T=h,r.p=v,r.d.f()}},Tt.preconnect=function(p,h){typeof p=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,r.d.C(p,h))},Tt.prefetchDNS=function(p){typeof p=="string"&&r.d.D(p)},Tt.preinit=function(p,h){if(typeof p=="string"&&h&&typeof h.as=="string"){var v=h.as,y=d(v,h.crossOrigin),x=typeof h.integrity=="string"?h.integrity:void 0,C=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;v==="style"?r.d.S(p,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:y,integrity:x,fetchPriority:C}):v==="script"&&r.d.X(p,{crossOrigin:y,integrity:x,fetchPriority:C,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},Tt.preinitModule=function(p,h){if(typeof p=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var v=d(h.as,h.crossOrigin);r.d.M(p,{crossOrigin:v,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&r.d.M(p)},Tt.preload=function(p,h){if(typeof p=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var v=h.as,y=d(v,h.crossOrigin);r.d.L(p,v,{crossOrigin:y,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},Tt.preloadModule=function(p,h){if(typeof p=="string")if(h){var v=d(h.as,h.crossOrigin);r.d.m(p,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:v,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else r.d.m(p)},Tt.requestFormReset=function(p){r.d.r(p)},Tt.unstable_batchedUpdates=function(p,h){return p(h)},Tt.useFormState=function(p,h,v){return f.H.useFormState(p,h,v)},Tt.useFormStatus=function(){return f.H.useHostTransitionStatus()},Tt.version="19.2.4",Tt}var Gg;function xv(){if(Gg)return Yf.exports;Gg=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(o){console.error(o)}}return t(),Yf.exports=kS(),Yf.exports}var Zg;function BS(){if(Zg)return Tr;Zg=1;var t=VS(),o=qs(),a=xv();function r(e){var n="https://react.dev/errors/"+e;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)n+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function c(e){var n=e,l=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(l=n.return),e=n.return;while(e)}return n.tag===3?l:null}function f(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function d(e){if(e.tag===31){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function p(e){if(c(e)!==e)throw Error(r(188))}function h(e){var n=e.alternate;if(!n){if(n=c(e),n===null)throw Error(r(188));return n!==e?null:e}for(var l=e,i=n;;){var u=l.return;if(u===null)break;var m=u.alternate;if(m===null){if(i=u.return,i!==null){l=i;continue}break}if(u.child===m.child){for(m=u.child;m;){if(m===l)return p(u),e;if(m===i)return p(u),n;m=m.sibling}throw Error(r(188))}if(l.return!==i.return)l=u,i=m;else{for(var b=!1,E=u.child;E;){if(E===l){b=!0,l=u,i=m;break}if(E===i){b=!0,i=u,l=m;break}E=E.sibling}if(!b){for(E=m.child;E;){if(E===l){b=!0,l=m,i=u;break}if(E===i){b=!0,i=m,l=u;break}E=E.sibling}if(!b)throw Error(r(189))}}if(l.alternate!==i)throw Error(r(190))}if(l.tag!==3)throw Error(r(188));return l.stateNode.current===l?e:n}function v(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e;for(e=e.child;e!==null;){if(n=v(e),n!==null)return n;e=e.sibling}return null}var y=Object.assign,x=Symbol.for("react.element"),C=Symbol.for("react.transitional.element"),T=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),M=Symbol.for("react.strict_mode"),R=Symbol.for("react.profiler"),_=Symbol.for("react.consumer"),N=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),H=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),Z=Symbol.for("react.memo"),I=Symbol.for("react.lazy"),J=Symbol.for("react.activity"),P=Symbol.for("react.memo_cache_sentinel"),ee=Symbol.iterator;function oe(e){return e===null||typeof e!="object"?null:(e=ee&&e[ee]||e["@@iterator"],typeof e=="function"?e:null)}var te=Symbol.for("react.client.reference");function B(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===te?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case w:return"Fragment";case R:return"Profiler";case M:return"StrictMode";case H:return"Suspense";case L:return"SuspenseList";case J:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case T:return"Portal";case N:return e.displayName||"Context";case _:return(e._context.displayName||"Context")+".Consumer";case A:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Z:return n=e.displayName||null,n!==null?n:B(e.type)||"Memo";case I:n=e._payload,e=e._init;try{return B(e(n))}catch{}}return null}var ne=Array.isArray,D=o.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,U=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V={pending:!1,data:null,method:null,action:null},K=[],W=-1;function de(e){return{current:e}}function le(e){0>W||(e.current=K[W],K[W]=null,W--)}function ae(e,n){W++,K[W]=e.current,e.current=n}var ye=de(null),ge=de(null),Ne=de(null),Pe=de(null);function Ee(e,n){switch(ae(Ne,n),ae(ge,e),ae(ye,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?lg(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=lg(n),e=ag(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}le(ye),ae(ye,e)}function ve(){le(ye),le(ge),le(Ne)}function We(e){e.memoizedState!==null&&ae(Pe,e);var n=ye.current,l=ag(n,e.type);n!==l&&(ae(ge,e),ae(ye,l))}function rt(e){ge.current===e&&(le(ye),le(ge)),Pe.current===e&&(le(Pe),br._currentValue=V)}var et,ze;function ot(e){if(et===void 0)try{throw Error()}catch(l){var n=l.stack.trim().match(/\n( *(at )?)/);et=n&&n[1]||"",ze=-1<l.stack.indexOf(`
|
|
2
2
|
at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
3
|
`+et+e+ze}var tn=!1;function On(e,n){if(!e||tn)return"";tn=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var i={DetermineComponentFrameRoot:function(){try{if(n){var Q=function(){throw Error()};if(Object.defineProperty(Q.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Q,[])}catch(q){var G=q}Reflect.construct(e,[],Q)}else{try{Q.call()}catch(q){G=q}e.call(Q.prototype)}}else{try{throw Error()}catch(q){G=q}(Q=e())&&typeof Q.catch=="function"&&Q.catch(function(){})}}catch(q){if(q&&G&&typeof q.stack=="string")return[q.stack,G.stack]}return[null,null]}};i.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(i.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(i.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var m=i.DetermineComponentFrameRoot(),b=m[0],E=m[1];if(b&&E){var j=b.split(`
|
|
4
4
|
`),$=E.split(`
|
|
@@ -46,8 +46,8 @@ Error generating stack: `+i.message+`
|
|
|
46
46
|
`)},Kg=function(){var t=parseInt(document.body.getAttribute(va)||"0",10);return isFinite(t)?t:0},d4=function(){S.useEffect(function(){return document.body.setAttribute(va,(Kg()+1).toString()),function(){var t=Kg()-1;t<=0?document.body.removeAttribute(va):document.body.setAttribute(va,t.toString())}},[])},m4=function(t){var o=t.noRelative,a=t.noImportant,r=t.gapMode,s=r===void 0?"margin":r;d4();var c=S.useMemo(function(){return c4(s)},[s]);return S.createElement(u4,{styles:f4(c,!o,s,a?"":"!important")})},Rd=!1;if(typeof window<"u")try{var cs=Object.defineProperty({},"passive",{get:function(){return Rd=!0,!0}});window.addEventListener("test",cs,cs),window.removeEventListener("test",cs,cs)}catch{Rd=!1}var ua=Rd?{passive:!1}:!1,p4=function(t){return t.tagName==="TEXTAREA"},_v=function(t,o){if(!(t instanceof Element))return!1;var a=window.getComputedStyle(t);return a[o]!=="hidden"&&!(a.overflowY===a.overflowX&&!p4(t)&&a[o]==="visible")},h4=function(t){return _v(t,"overflowY")},g4=function(t){return _v(t,"overflowX")},Fg=function(t,o){var a=o.ownerDocument,r=o;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=Ov(t,r);if(s){var c=Nv(t,r),f=c[1],d=c[2];if(f>d)return!0}r=r.parentNode}while(r&&r!==a.body);return!1},v4=function(t){var o=t.scrollTop,a=t.scrollHeight,r=t.clientHeight;return[o,a,r]},y4=function(t){var o=t.scrollLeft,a=t.scrollWidth,r=t.clientWidth;return[o,a,r]},Ov=function(t,o){return t==="v"?h4(o):g4(o)},Nv=function(t,o){return t==="v"?v4(o):y4(o)},b4=function(t,o){return t==="h"&&o==="rtl"?-1:1},x4=function(t,o,a,r,s){var c=b4(t,window.getComputedStyle(o).direction),f=c*r,d=a.target,p=o.contains(d),h=!1,v=f>0,y=0,x=0;do{if(!d)break;var C=Nv(t,d),T=C[0],w=C[1],M=C[2],R=w-M-c*T;(T||R)&&Ov(t,d)&&(y+=R,x+=T);var _=d.parentNode;d=_&&_.nodeType===Node.DOCUMENT_FRAGMENT_NODE?_.host:_}while(!p&&d!==document.body||p&&(o.contains(d)||o===d));return(v&&Math.abs(y)<1||!v&&Math.abs(x)<1)&&(h=!0),h},us=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},Jg=function(t){return[t.deltaX,t.deltaY]},Wg=function(t){return t&&"current"in t?t.current:t},S4=function(t,o){return t[0]===o[0]&&t[1]===o[1]},C4=function(t){return`
|
|
47
47
|
.block-interactivity-`.concat(t,` {pointer-events: none;}
|
|
48
48
|
.allow-interactivity-`).concat(t,` {pointer-events: all;}
|
|
49
|
-
`)},w4=0,fa=[];function T4(t){var o=S.useRef([]),a=S.useRef([0,0]),r=S.useRef(),s=S.useState(w4++)[0],c=S.useState(jv)[0],f=S.useRef(t);S.useEffect(function(){f.current=t},[t]),S.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(s));var w=YS([t.lockRef.current],(t.shards||[]).map(Wg),!0).filter(Boolean);return w.forEach(function(M){return M.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),w.forEach(function(M){return M.classList.remove("allow-interactivity-".concat(s))})}}},[t.inert,t.lockRef.current,t.shards]);var d=S.useCallback(function(w,M){if("touches"in w&&w.touches.length===2||w.type==="wheel"&&w.ctrlKey)return!f.current.allowPinchZoom;var R=us(w),_=a.current,N="deltaX"in w?w.deltaX:_[0]-R[0],A="deltaY"in w?w.deltaY:_[1]-R[1],H,L=w.target,Z=Math.abs(N)>Math.abs(A)?"h":"v";if("touches"in w&&Z==="h"&&L.type==="range")return!1;var I=window.getSelection(),J=I&&I.anchorNode,P=J?J===L||J.contains(L):!1;if(P)return!1;var ee=Fg(Z,L);if(!ee)return!0;if(ee?H=Z:(H=Z==="v"?"h":"v",ee=Fg(Z,L)),!ee)return!1;if(!r.current&&"changedTouches"in w&&(N||A)&&(r.current=H),!H)return!0;var oe=r.current||H;return x4(oe,M,w,oe==="h"?N:A)},[]),p=S.useCallback(function(w){var M=w;if(!(!fa.length||fa[fa.length-1]!==c)){var R="deltaY"in M?Jg(M):us(M),_=o.current.filter(function(H){return H.name===M.type&&(H.target===M.target||M.target===H.shadowParent)&&S4(H.delta,R)})[0];if(_&&_.should){M.cancelable&&M.preventDefault();return}if(!_){var N=(f.current.shards||[]).map(Wg).filter(Boolean).filter(function(H){return H.contains(M.target)}),A=N.length>0?d(M,N[0]):!f.current.noIsolation;A&&M.cancelable&&M.preventDefault()}}},[]),h=S.useCallback(function(w,M,R,_){var N={name:w,delta:M,target:R,should:_,shadowParent:E4(R)};o.current.push(N),setTimeout(function(){o.current=o.current.filter(function(A){return A!==N})},1)},[]),v=S.useCallback(function(w){a.current=us(w),r.current=void 0},[]),y=S.useCallback(function(w){h(w.type,Jg(w),w.target,d(w,t.lockRef.current))},[]),x=S.useCallback(function(w){h(w.type,us(w),w.target,d(w,t.lockRef.current))},[]);S.useEffect(function(){return fa.push(c),t.setCallbacks({onScrollCapture:y,onWheelCapture:y,onTouchMoveCapture:x}),document.addEventListener("wheel",p,ua),document.addEventListener("touchmove",p,ua),document.addEventListener("touchstart",v,ua),function(){fa=fa.filter(function(w){return w!==c}),document.removeEventListener("wheel",p,ua),document.removeEventListener("touchmove",p,ua),document.removeEventListener("touchstart",v,ua)}},[]);var C=t.removeScrollBar,T=t.inert;return S.createElement(S.Fragment,null,T?S.createElement(c,{styles:C4(s)}):null,C?S.createElement(m4,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function E4(t){for(var o=null;t!==null;)t instanceof ShadowRoot&&(o=t.host,t=t.host),t=t.parentNode;return o}const M4=e4(Rv,T4);var R4=S.forwardRef(function(t,o){return S.createElement(Ps,Vn({},t,{ref:o,sideCar:M4}))});R4.classNames=Ps.classNames;const Av=["top","right","bottom","left"],e0=["start","end"],t0=Av.reduce((t,o)=>t.concat(o,o+"-"+e0[0],o+"-"+e0[1]),[]),Tn=Math.min,Et=Math.max,Ts=Math.round,fs=Math.floor,Un=t=>({x:t,y:t}),j4={left:"right",right:"left",bottom:"top",top:"bottom"},_4={start:"end",end:"start"};function jd(t,o,a){return Et(t,Tn(o,a))}function En(t,o){return typeof t=="function"?t(o):t}function Jt(t){return t.split("-")[0]}function wn(t){return t.split("-")[1]}function kd(t){return t==="x"?"y":"x"}function Bd(t){return t==="y"?"height":"width"}const O4=new Set(["top","bottom"]);function Sn(t){return O4.has(Jt(t))?"y":"x"}function Ud(t){return kd(Sn(t))}function Dv(t,o,a){a===void 0&&(a=!1);const r=wn(t),s=Ud(t),c=Bd(s);let f=s==="x"?r===(a?"end":"start")?"right":"left":r==="start"?"bottom":"top";return o.reference[c]>o.floating[c]&&(f=Ms(f)),[f,Ms(f)]}function N4(t){const o=Ms(t);return[Es(t),o,Es(o)]}function Es(t){return t.replace(/start|end/g,o=>_4[o])}const n0=["left","right"],o0=["right","left"],A4=["top","bottom"],D4=["bottom","top"];function H4(t,o,a){switch(t){case"top":case"bottom":return a?o?o0:n0:o?n0:o0;case"left":case"right":return o?A4:D4;default:return[]}}function z4(t,o,a,r){const s=wn(t);let c=H4(Jt(t),a==="start",r);return s&&(c=c.map(f=>f+"-"+s),o&&(c=c.concat(c.map(Es)))),c}function Ms(t){return t.replace(/left|right|bottom|top/g,o=>j4[o])}function L4(t){return{top:0,right:0,bottom:0,left:0,...t}}function $d(t){return typeof t!="number"?L4(t):{top:t,right:t,bottom:t,left:t}}function ba(t){const{x:o,y:a,width:r,height:s}=t;return{width:r,height:s,top:a,left:o,right:o+r,bottom:a+s,x:o,y:a}}function l0(t,o,a){let{reference:r,floating:s}=t;const c=Sn(o),f=Ud(o),d=Bd(f),p=Jt(o),h=c==="y",v=r.x+r.width/2-s.width/2,y=r.y+r.height/2-s.height/2,x=r[d]/2-s[d]/2;let C;switch(p){case"top":C={x:v,y:r.y-s.height};break;case"bottom":C={x:v,y:r.y+r.height};break;case"right":C={x:r.x+r.width,y};break;case"left":C={x:r.x-s.width,y};break;default:C={x:r.x,y:r.y}}switch(wn(o)){case"start":C[f]-=x*(a&&h?-1:1);break;case"end":C[f]+=x*(a&&h?-1:1);break}return C}async function V4(t,o){var a;o===void 0&&(o={});const{x:r,y:s,platform:c,rects:f,elements:d,strategy:p}=t,{boundary:h="clippingAncestors",rootBoundary:v="viewport",elementContext:y="floating",altBoundary:x=!1,padding:C=0}=En(o,t),T=$d(C),M=d[x?y==="floating"?"reference":"floating":y],R=ba(await c.getClippingRect({element:(a=await(c.isElement==null?void 0:c.isElement(M)))==null||a?M:M.contextElement||await(c.getDocumentElement==null?void 0:c.getDocumentElement(d.floating)),boundary:h,rootBoundary:v,strategy:p})),_=y==="floating"?{x:r,y:s,width:f.floating.width,height:f.floating.height}:f.reference,N=await(c.getOffsetParent==null?void 0:c.getOffsetParent(d.floating)),A=await(c.isElement==null?void 0:c.isElement(N))?await(c.getScale==null?void 0:c.getScale(N))||{x:1,y:1}:{x:1,y:1},H=ba(c.convertOffsetParentRelativeRectToViewportRelativeRect?await c.convertOffsetParentRelativeRectToViewportRelativeRect({elements:d,rect:_,offsetParent:N,strategy:p}):_);return{top:(R.top-H.top+T.top)/A.y,bottom:(H.bottom-R.bottom+T.bottom)/A.y,left:(R.left-H.left+T.left)/A.x,right:(H.right-R.right+T.right)/A.x}}const k4=async(t,o,a)=>{const{placement:r="bottom",strategy:s="absolute",middleware:c=[],platform:f}=a,d=c.filter(Boolean),p=await(f.isRTL==null?void 0:f.isRTL(o));let h=await f.getElementRects({reference:t,floating:o,strategy:s}),{x:v,y}=l0(h,r,p),x=r,C={},T=0;for(let M=0;M<d.length;M++){var w;const{name:R,fn:_}=d[M],{x:N,y:A,data:H,reset:L}=await _({x:v,y,initialPlacement:r,placement:x,strategy:s,middlewareData:C,rects:h,platform:{...f,detectOverflow:(w=f.detectOverflow)!=null?w:V4},elements:{reference:t,floating:o}});v=N??v,y=A??y,C={...C,[R]:{...C[R],...H}},L&&T<=50&&(T++,typeof L=="object"&&(L.placement&&(x=L.placement),L.rects&&(h=L.rects===!0?await f.getElementRects({reference:t,floating:o,strategy:s}):L.rects),{x:v,y}=l0(h,x,p)),M=-1)}return{x:v,y,placement:x,strategy:s,middlewareData:C}},B4=t=>({name:"arrow",options:t,async fn(o){const{x:a,y:r,placement:s,rects:c,platform:f,elements:d,middlewareData:p}=o,{element:h,padding:v=0}=En(t,o)||{};if(h==null)return{};const y=$d(v),x={x:a,y:r},C=Ud(s),T=Bd(C),w=await f.getDimensions(h),M=C==="y",R=M?"top":"left",_=M?"bottom":"right",N=M?"clientHeight":"clientWidth",A=c.reference[T]+c.reference[C]-x[C]-c.floating[T],H=x[C]-c.reference[C],L=await(f.getOffsetParent==null?void 0:f.getOffsetParent(h));let Z=L?L[N]:0;(!Z||!await(f.isElement==null?void 0:f.isElement(L)))&&(Z=d.floating[N]||c.floating[T]);const I=A/2-H/2,J=Z/2-w[T]/2-1,P=Tn(y[R],J),ee=Tn(y[_],J),oe=P,te=Z-w[T]-ee,B=Z/2-w[T]/2+I,ne=jd(oe,B,te),D=!p.arrow&&wn(s)!=null&&B!==ne&&c.reference[T]/2-(B<oe?P:ee)-w[T]/2<0,U=D?B<oe?B-oe:B-te:0;return{[C]:x[C]+U,data:{[C]:ne,centerOffset:B-ne-U,...D&&{alignmentOffset:U}},reset:D}}});function U4(t,o,a){return(t?[...a.filter(s=>wn(s)===t),...a.filter(s=>wn(s)!==t)]:a.filter(s=>Jt(s)===s)).filter(s=>t?wn(s)===t||(o?Es(s)!==s:!1):!0)}const $4=function(t){return t===void 0&&(t={}),{name:"autoPlacement",options:t,async fn(o){var a,r,s;const{rects:c,middlewareData:f,placement:d,platform:p,elements:h}=o,{crossAxis:v=!1,alignment:y,allowedPlacements:x=t0,autoAlignment:C=!0,...T}=En(t,o),w=y!==void 0||x===t0?U4(y||null,C,x):x,M=await p.detectOverflow(o,T),R=((a=f.autoPlacement)==null?void 0:a.index)||0,_=w[R];if(_==null)return{};const N=Dv(_,c,await(p.isRTL==null?void 0:p.isRTL(h.floating)));if(d!==_)return{reset:{placement:w[0]}};const A=[M[Jt(_)],M[N[0]],M[N[1]]],H=[...((r=f.autoPlacement)==null?void 0:r.overflows)||[],{placement:_,overflows:A}],L=w[R+1];if(L)return{data:{index:R+1,overflows:H},reset:{placement:L}};const Z=H.map(P=>{const ee=wn(P.placement);return[P.placement,ee&&v?P.overflows.slice(0,2).reduce((oe,te)=>oe+te,0):P.overflows[0],P.overflows]}).sort((P,ee)=>P[1]-ee[1]),J=((s=Z.filter(P=>P[2].slice(0,wn(P[0])?2:3).every(ee=>ee<=0))[0])==null?void 0:s[0])||Z[0][0];return J!==d?{data:{index:R+1,overflows:H},reset:{placement:J}}:{}}}},G4=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(o){var a,r;const{placement:s,middlewareData:c,rects:f,initialPlacement:d,platform:p,elements:h}=o,{mainAxis:v=!0,crossAxis:y=!0,fallbackPlacements:x,fallbackStrategy:C="bestFit",fallbackAxisSideDirection:T="none",flipAlignment:w=!0,...M}=En(t,o);if((a=c.arrow)!=null&&a.alignmentOffset)return{};const R=Jt(s),_=Sn(d),N=Jt(d)===d,A=await(p.isRTL==null?void 0:p.isRTL(h.floating)),H=x||(N||!w?[Ms(d)]:N4(d)),L=T!=="none";!x&&L&&H.push(...z4(d,w,T,A));const Z=[d,...H],I=await p.detectOverflow(o,M),J=[];let P=((r=c.flip)==null?void 0:r.overflows)||[];if(v&&J.push(I[R]),y){const B=Dv(s,f,A);J.push(I[B[0]],I[B[1]])}if(P=[...P,{placement:s,overflows:J}],!J.every(B=>B<=0)){var ee,oe;const B=(((ee=c.flip)==null?void 0:ee.index)||0)+1,ne=Z[B];if(ne&&(!(y==="alignment"?_!==Sn(ne):!1)||P.every(V=>Sn(V.placement)===_?V.overflows[0]>0:!0)))return{data:{index:B,overflows:P},reset:{placement:ne}};let D=(oe=P.filter(U=>U.overflows[0]<=0).sort((U,V)=>U.overflows[1]-V.overflows[1])[0])==null?void 0:oe.placement;if(!D)switch(C){case"bestFit":{var te;const U=(te=P.filter(V=>{if(L){const K=Sn(V.placement);return K===_||K==="y"}return!0}).map(V=>[V.placement,V.overflows.filter(K=>K>0).reduce((K,W)=>K+W,0)]).sort((V,K)=>V[1]-K[1])[0])==null?void 0:te[0];U&&(D=U);break}case"initialPlacement":D=d;break}if(s!==D)return{reset:{placement:D}}}return{}}}};function a0(t,o){return{top:t.top-o.height,right:t.right-o.width,bottom:t.bottom-o.height,left:t.left-o.width}}function r0(t){return Av.some(o=>t[o]>=0)}const Z4=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(o){const{rects:a,platform:r}=o,{strategy:s="referenceHidden",...c}=En(t,o);switch(s){case"referenceHidden":{const f=await r.detectOverflow(o,{...c,elementContext:"reference"}),d=a0(f,a.reference);return{data:{referenceHiddenOffsets:d,referenceHidden:r0(d)}}}case"escaped":{const f=await r.detectOverflow(o,{...c,altBoundary:!0}),d=a0(f,a.floating);return{data:{escapedOffsets:d,escaped:r0(d)}}}default:return{}}}}};function Hv(t){const o=Tn(...t.map(c=>c.left)),a=Tn(...t.map(c=>c.top)),r=Et(...t.map(c=>c.right)),s=Et(...t.map(c=>c.bottom));return{x:o,y:a,width:r-o,height:s-a}}function q4(t){const o=t.slice().sort((s,c)=>s.y-c.y),a=[];let r=null;for(let s=0;s<o.length;s++){const c=o[s];!r||c.y-r.y>r.height/2?a.push([c]):a[a.length-1].push(c),r=c}return a.map(s=>ba(Hv(s)))}const Y4=function(t){return t===void 0&&(t={}),{name:"inline",options:t,async fn(o){const{placement:a,elements:r,rects:s,platform:c,strategy:f}=o,{padding:d=2,x:p,y:h}=En(t,o),v=Array.from(await(c.getClientRects==null?void 0:c.getClientRects(r.reference))||[]),y=q4(v),x=ba(Hv(v)),C=$d(d);function T(){if(y.length===2&&y[0].left>y[1].right&&p!=null&&h!=null)return y.find(M=>p>M.left-C.left&&p<M.right+C.right&&h>M.top-C.top&&h<M.bottom+C.bottom)||x;if(y.length>=2){if(Sn(a)==="y"){const P=y[0],ee=y[y.length-1],oe=Jt(a)==="top",te=P.top,B=ee.bottom,ne=oe?P.left:ee.left,D=oe?P.right:ee.right,U=D-ne,V=B-te;return{top:te,bottom:B,left:ne,right:D,width:U,height:V,x:ne,y:te}}const M=Jt(a)==="left",R=Et(...y.map(P=>P.right)),_=Tn(...y.map(P=>P.left)),N=y.filter(P=>M?P.left===_:P.right===R),A=N[0].top,H=N[N.length-1].bottom,L=_,Z=R,I=Z-L,J=H-A;return{top:A,bottom:H,left:L,right:Z,width:I,height:J,x:L,y:A}}return x}const w=await c.getElementRects({reference:{getBoundingClientRect:T},floating:r.floating,strategy:f});return s.reference.x!==w.reference.x||s.reference.y!==w.reference.y||s.reference.width!==w.reference.width||s.reference.height!==w.reference.height?{reset:{rects:w}}:{}}}},zv=new Set(["left","top"]);async function X4(t,o){const{placement:a,platform:r,elements:s}=t,c=await(r.isRTL==null?void 0:r.isRTL(s.floating)),f=Jt(a),d=wn(a),p=Sn(a)==="y",h=zv.has(f)?-1:1,v=c&&p?-1:1,y=En(o,t);let{mainAxis:x,crossAxis:C,alignmentAxis:T}=typeof y=="number"?{mainAxis:y,crossAxis:0,alignmentAxis:null}:{mainAxis:y.mainAxis||0,crossAxis:y.crossAxis||0,alignmentAxis:y.alignmentAxis};return d&&typeof T=="number"&&(C=d==="end"?T*-1:T),p?{x:C*v,y:x*h}:{x:x*h,y:C*v}}const P4=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(o){var a,r;const{x:s,y:c,placement:f,middlewareData:d}=o,p=await X4(o,t);return f===((a=d.offset)==null?void 0:a.placement)&&(r=d.arrow)!=null&&r.alignmentOffset?{}:{x:s+p.x,y:c+p.y,data:{...p,placement:f}}}}},Q4=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(o){const{x:a,y:r,placement:s,platform:c}=o,{mainAxis:f=!0,crossAxis:d=!1,limiter:p={fn:R=>{let{x:_,y:N}=R;return{x:_,y:N}}},...h}=En(t,o),v={x:a,y:r},y=await c.detectOverflow(o,h),x=Sn(Jt(s)),C=kd(x);let T=v[C],w=v[x];if(f){const R=C==="y"?"top":"left",_=C==="y"?"bottom":"right",N=T+y[R],A=T-y[_];T=jd(N,T,A)}if(d){const R=x==="y"?"top":"left",_=x==="y"?"bottom":"right",N=w+y[R],A=w-y[_];w=jd(N,w,A)}const M=p.fn({...o,[C]:T,[x]:w});return{...M,data:{x:M.x-a,y:M.y-r,enabled:{[C]:f,[x]:d}}}}}},I4=function(t){return t===void 0&&(t={}),{options:t,fn(o){const{x:a,y:r,placement:s,rects:c,middlewareData:f}=o,{offset:d=0,mainAxis:p=!0,crossAxis:h=!0}=En(t,o),v={x:a,y:r},y=Sn(s),x=kd(y);let C=v[x],T=v[y];const w=En(d,o),M=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(p){const N=x==="y"?"height":"width",A=c.reference[x]-c.floating[N]+M.mainAxis,H=c.reference[x]+c.reference[N]-M.mainAxis;C<A?C=A:C>H&&(C=H)}if(h){var R,_;const N=x==="y"?"width":"height",A=zv.has(Jt(s)),H=c.reference[y]-c.floating[N]+(A&&((R=f.offset)==null?void 0:R[y])||0)+(A?0:M.crossAxis),L=c.reference[y]+c.reference[N]+(A?0:((_=f.offset)==null?void 0:_[y])||0)-(A?M.crossAxis:0);T<H?T=H:T>L&&(T=L)}return{[x]:C,[y]:T}}}},K4=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(o){var a,r;const{placement:s,rects:c,platform:f,elements:d}=o,{apply:p=()=>{},...h}=En(t,o),v=await f.detectOverflow(o,h),y=Jt(s),x=wn(s),C=Sn(s)==="y",{width:T,height:w}=c.floating;let M,R;y==="top"||y==="bottom"?(M=y,R=x===(await(f.isRTL==null?void 0:f.isRTL(d.floating))?"start":"end")?"left":"right"):(R=y,M=x==="end"?"top":"bottom");const _=w-v.top-v.bottom,N=T-v.left-v.right,A=Tn(w-v[M],_),H=Tn(T-v[R],N),L=!o.middlewareData.shift;let Z=A,I=H;if((a=o.middlewareData.shift)!=null&&a.enabled.x&&(I=N),(r=o.middlewareData.shift)!=null&&r.enabled.y&&(Z=_),L&&!x){const P=Et(v.left,0),ee=Et(v.right,0),oe=Et(v.top,0),te=Et(v.bottom,0);C?I=T-2*(P!==0||ee!==0?P+ee:Et(v.left,v.right)):Z=w-2*(oe!==0||te!==0?oe+te:Et(v.top,v.bottom))}await p({...o,availableWidth:I,availableHeight:Z});const J=await f.getDimensions(d.floating);return T!==J.width||w!==J.height?{reset:{rects:!0}}:{}}}};function Qs(){return typeof window<"u"}function Sa(t){return Lv(t)?(t.nodeName||"").toLowerCase():"#document"}function Ut(t){var o;return(t==null||(o=t.ownerDocument)==null?void 0:o.defaultView)||window}function Yn(t){var o;return(o=(Lv(t)?t.ownerDocument:t.document)||window.document)==null?void 0:o.documentElement}function Lv(t){return Qs()?t instanceof Node||t instanceof Ut(t).Node:!1}function Ye(t){return Qs()?t instanceof Element||t instanceof Ut(t).Element:!1}function Wt(t){return Qs()?t instanceof HTMLElement||t instanceof Ut(t).HTMLElement:!1}function Rs(t){return!Qs()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Ut(t).ShadowRoot}const F4=new Set(["inline","contents"]);function kr(t){const{overflow:o,overflowX:a,overflowY:r,display:s}=hn(t);return/auto|scroll|overlay|hidden|clip/.test(o+r+a)&&!F4.has(s)}const J4=new Set(["table","td","th"]);function W4(t){return J4.has(Sa(t))}const eC=[":popover-open",":modal"];function Is(t){return eC.some(o=>{try{return t.matches(o)}catch{return!1}})}const tC=["transform","translate","scale","rotate","perspective"],nC=["transform","translate","scale","rotate","perspective","filter"],oC=["paint","layout","strict","content"];function Gd(t){const o=Ks(),a=Ye(t)?hn(t):t;return tC.some(r=>a[r]?a[r]!=="none":!1)||(a.containerType?a.containerType!=="normal":!1)||!o&&(a.backdropFilter?a.backdropFilter!=="none":!1)||!o&&(a.filter?a.filter!=="none":!1)||nC.some(r=>(a.willChange||"").includes(r))||oC.some(r=>(a.contain||"").includes(r))}function lC(t){let o=vo(t);for(;Wt(o)&&!ho(o);){if(Gd(o))return o;if(Is(o))return null;o=vo(o)}return null}function Ks(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const aC=new Set(["html","body","#document"]);function ho(t){return aC.has(Sa(t))}function hn(t){return Ut(t).getComputedStyle(t)}function Fs(t){return Ye(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function vo(t){if(Sa(t)==="html")return t;const o=t.assignedSlot||t.parentNode||Rs(t)&&t.host||Yn(t);return Rs(o)?o.host:o}function Vv(t){const o=vo(t);return ho(o)?t.ownerDocument?t.ownerDocument.body:t.body:Wt(o)&&kr(o)?o:Vv(o)}function go(t,o,a){var r;o===void 0&&(o=[]),a===void 0&&(a=!0);const s=Vv(t),c=s===((r=t.ownerDocument)==null?void 0:r.body),f=Ut(s);if(c){const d=_d(f);return o.concat(f,f.visualViewport||[],kr(s)?s:[],d&&a?go(d):[])}return o.concat(s,go(s,[],a))}function _d(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function kv(t){const o=hn(t);let a=parseFloat(o.width)||0,r=parseFloat(o.height)||0;const s=Wt(t),c=s?t.offsetWidth:a,f=s?t.offsetHeight:r,d=Ts(a)!==c||Ts(r)!==f;return d&&(a=c,r=f),{width:a,height:r,$:d}}function Zd(t){return Ye(t)?t:t.contextElement}function ya(t){const o=Zd(t);if(!Wt(o))return Un(1);const a=o.getBoundingClientRect(),{width:r,height:s,$:c}=kv(o);let f=(c?Ts(a.width):a.width)/r,d=(c?Ts(a.height):a.height)/s;return(!f||!Number.isFinite(f))&&(f=1),(!d||!Number.isFinite(d))&&(d=1),{x:f,y:d}}const rC=Un(0);function Bv(t){const o=Ut(t);return!Ks()||!o.visualViewport?rC:{x:o.visualViewport.offsetLeft,y:o.visualViewport.offsetTop}}function iC(t,o,a){return o===void 0&&(o=!1),!a||o&&a!==Ut(t)?!1:o}function Sl(t,o,a,r){o===void 0&&(o=!1),a===void 0&&(a=!1);const s=t.getBoundingClientRect(),c=Zd(t);let f=Un(1);o&&(r?Ye(r)&&(f=ya(r)):f=ya(t));const d=iC(c,a,r)?Bv(c):Un(0);let p=(s.left+d.x)/f.x,h=(s.top+d.y)/f.y,v=s.width/f.x,y=s.height/f.y;if(c){const x=Ut(c),C=r&&Ye(r)?Ut(r):r;let T=x,w=_d(T);for(;w&&r&&C!==T;){const M=ya(w),R=w.getBoundingClientRect(),_=hn(w),N=R.left+(w.clientLeft+parseFloat(_.paddingLeft))*M.x,A=R.top+(w.clientTop+parseFloat(_.paddingTop))*M.y;p*=M.x,h*=M.y,v*=M.x,y*=M.y,p+=N,h+=A,T=Ut(w),w=_d(T)}}return ba({width:v,height:y,x:p,y:h})}function Js(t,o){const a=Fs(t).scrollLeft;return o?o.left+a:Sl(Yn(t)).left+a}function Uv(t,o){const a=t.getBoundingClientRect(),r=a.left+o.scrollLeft-Js(t,a),s=a.top+o.scrollTop;return{x:r,y:s}}function sC(t){let{elements:o,rect:a,offsetParent:r,strategy:s}=t;const c=s==="fixed",f=Yn(r),d=o?Is(o.floating):!1;if(r===f||d&&c)return a;let p={scrollLeft:0,scrollTop:0},h=Un(1);const v=Un(0),y=Wt(r);if((y||!y&&!c)&&((Sa(r)!=="body"||kr(f))&&(p=Fs(r)),Wt(r))){const C=Sl(r);h=ya(r),v.x=C.x+r.clientLeft,v.y=C.y+r.clientTop}const x=f&&!y&&!c?Uv(f,p):Un(0);return{width:a.width*h.x,height:a.height*h.y,x:a.x*h.x-p.scrollLeft*h.x+v.x+x.x,y:a.y*h.y-p.scrollTop*h.y+v.y+x.y}}function cC(t){return Array.from(t.getClientRects())}function uC(t){const o=Yn(t),a=Fs(t),r=t.ownerDocument.body,s=Et(o.scrollWidth,o.clientWidth,r.scrollWidth,r.clientWidth),c=Et(o.scrollHeight,o.clientHeight,r.scrollHeight,r.clientHeight);let f=-a.scrollLeft+Js(t);const d=-a.scrollTop;return hn(r).direction==="rtl"&&(f+=Et(o.clientWidth,r.clientWidth)-s),{width:s,height:c,x:f,y:d}}const i0=25;function fC(t,o){const a=Ut(t),r=Yn(t),s=a.visualViewport;let c=r.clientWidth,f=r.clientHeight,d=0,p=0;if(s){c=s.width,f=s.height;const v=Ks();(!v||v&&o==="fixed")&&(d=s.offsetLeft,p=s.offsetTop)}const h=Js(r);if(h<=0){const v=r.ownerDocument,y=v.body,x=getComputedStyle(y),C=v.compatMode==="CSS1Compat"&&parseFloat(x.marginLeft)+parseFloat(x.marginRight)||0,T=Math.abs(r.clientWidth-y.clientWidth-C);T<=i0&&(c-=T)}else h<=i0&&(c+=h);return{width:c,height:f,x:d,y:p}}const dC=new Set(["absolute","fixed"]);function mC(t,o){const a=Sl(t,!0,o==="fixed"),r=a.top+t.clientTop,s=a.left+t.clientLeft,c=Wt(t)?ya(t):Un(1),f=t.clientWidth*c.x,d=t.clientHeight*c.y,p=s*c.x,h=r*c.y;return{width:f,height:d,x:p,y:h}}function s0(t,o,a){let r;if(o==="viewport")r=fC(t,a);else if(o==="document")r=uC(Yn(t));else if(Ye(o))r=mC(o,a);else{const s=Bv(t);r={x:o.x-s.x,y:o.y-s.y,width:o.width,height:o.height}}return ba(r)}function $v(t,o){const a=vo(t);return a===o||!Ye(a)||ho(a)?!1:hn(a).position==="fixed"||$v(a,o)}function pC(t,o){const a=o.get(t);if(a)return a;let r=go(t,[],!1).filter(d=>Ye(d)&&Sa(d)!=="body"),s=null;const c=hn(t).position==="fixed";let f=c?vo(t):t;for(;Ye(f)&&!ho(f);){const d=hn(f),p=Gd(f);!p&&d.position==="fixed"&&(s=null),(c?!p&&!s:!p&&d.position==="static"&&!!s&&dC.has(s.position)||kr(f)&&!p&&$v(t,f))?r=r.filter(v=>v!==f):s=d,f=vo(f)}return o.set(t,r),r}function hC(t){let{element:o,boundary:a,rootBoundary:r,strategy:s}=t;const f=[...a==="clippingAncestors"?Is(o)?[]:pC(o,this._c):[].concat(a),r],d=f[0],p=f.reduce((h,v)=>{const y=s0(o,v,s);return h.top=Et(y.top,h.top),h.right=Tn(y.right,h.right),h.bottom=Tn(y.bottom,h.bottom),h.left=Et(y.left,h.left),h},s0(o,d,s));return{width:p.right-p.left,height:p.bottom-p.top,x:p.left,y:p.top}}function gC(t){const{width:o,height:a}=kv(t);return{width:o,height:a}}function vC(t,o,a){const r=Wt(o),s=Yn(o),c=a==="fixed",f=Sl(t,!0,c,o);let d={scrollLeft:0,scrollTop:0};const p=Un(0);function h(){p.x=Js(s)}if(r||!r&&!c)if((Sa(o)!=="body"||kr(s))&&(d=Fs(o)),r){const C=Sl(o,!0,c,o);p.x=C.x+o.clientLeft,p.y=C.y+o.clientTop}else s&&h();c&&!r&&s&&h();const v=s&&!r&&!c?Uv(s,d):Un(0),y=f.left+d.scrollLeft-p.x-v.x,x=f.top+d.scrollTop-p.y-v.y;return{x:y,y:x,width:f.width,height:f.height}}function Wf(t){return hn(t).position==="static"}function c0(t,o){if(!Wt(t)||hn(t).position==="fixed")return null;if(o)return o(t);let a=t.offsetParent;return Yn(t)===a&&(a=a.ownerDocument.body),a}function Gv(t,o){const a=Ut(t);if(Is(t))return a;if(!Wt(t)){let s=vo(t);for(;s&&!ho(s);){if(Ye(s)&&!Wf(s))return s;s=vo(s)}return a}let r=c0(t,o);for(;r&&W4(r)&&Wf(r);)r=c0(r,o);return r&&ho(r)&&Wf(r)&&!Gd(r)?a:r||lC(t)||a}const yC=async function(t){const o=this.getOffsetParent||Gv,a=this.getDimensions,r=await a(t.floating);return{reference:vC(t.reference,await o(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function bC(t){return hn(t).direction==="rtl"}const xC={convertOffsetParentRelativeRectToViewportRelativeRect:sC,getDocumentElement:Yn,getClippingRect:hC,getOffsetParent:Gv,getElementRects:yC,getClientRects:cC,getDimensions:gC,getScale:ya,isElement:Ye,isRTL:bC};function Zv(t,o){return t.x===o.x&&t.y===o.y&&t.width===o.width&&t.height===o.height}function SC(t,o){let a=null,r;const s=Yn(t);function c(){var d;clearTimeout(r),(d=a)==null||d.disconnect(),a=null}function f(d,p){d===void 0&&(d=!1),p===void 0&&(p=1),c();const h=t.getBoundingClientRect(),{left:v,top:y,width:x,height:C}=h;if(d||o(),!x||!C)return;const T=fs(y),w=fs(s.clientWidth-(v+x)),M=fs(s.clientHeight-(y+C)),R=fs(v),N={rootMargin:-T+"px "+-w+"px "+-M+"px "+-R+"px",threshold:Et(0,Tn(1,p))||1};let A=!0;function H(L){const Z=L[0].intersectionRatio;if(Z!==p){if(!A)return f();Z?f(!1,Z):r=setTimeout(()=>{f(!1,1e-7)},1e3)}Z===1&&!Zv(h,t.getBoundingClientRect())&&f(),A=!1}try{a=new IntersectionObserver(H,{...N,root:s.ownerDocument})}catch{a=new IntersectionObserver(H,N)}a.observe(t)}return f(!0),c}function js(t,o,a,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:c=!0,elementResize:f=typeof ResizeObserver=="function",layoutShift:d=typeof IntersectionObserver=="function",animationFrame:p=!1}=r,h=Zd(t),v=s||c?[...h?go(h):[],...go(o)]:[];v.forEach(R=>{s&&R.addEventListener("scroll",a,{passive:!0}),c&&R.addEventListener("resize",a)});const y=h&&d?SC(h,a):null;let x=-1,C=null;f&&(C=new ResizeObserver(R=>{let[_]=R;_&&_.target===h&&C&&(C.unobserve(o),cancelAnimationFrame(x),x=requestAnimationFrame(()=>{var N;(N=C)==null||N.observe(o)})),a()}),h&&!p&&C.observe(h),C.observe(o));let T,w=p?Sl(t):null;p&&M();function M(){const R=Sl(t);w&&!Zv(w,R)&&a(),w=R,T=requestAnimationFrame(M)}return a(),()=>{var R;v.forEach(_=>{s&&_.removeEventListener("scroll",a),c&&_.removeEventListener("resize",a)}),y?.(),(R=C)==null||R.disconnect(),C=null,p&&cancelAnimationFrame(T)}}const CC=P4,wC=$4,TC=Q4,EC=G4,MC=K4,RC=Z4,u0=B4,jC=Y4,_C=I4,OC=(t,o,a)=>{const r=new Map,s={platform:xC,...a},c={...s.platform,_c:r};return k4(t,o,{...s,platform:c})};var NC=typeof document<"u",AC=function(){},Ss=NC?S.useLayoutEffect:AC;function _s(t,o){if(t===o)return!0;if(typeof t!=typeof o)return!1;if(typeof t=="function"&&t.toString()===o.toString())return!0;let a,r,s;if(t&&o&&typeof t=="object"){if(Array.isArray(t)){if(a=t.length,a!==o.length)return!1;for(r=a;r--!==0;)if(!_s(t[r],o[r]))return!1;return!0}if(s=Object.keys(t),a=s.length,a!==Object.keys(o).length)return!1;for(r=a;r--!==0;)if(!{}.hasOwnProperty.call(o,s[r]))return!1;for(r=a;r--!==0;){const c=s[r];if(!(c==="_owner"&&t.$$typeof)&&!_s(t[c],o[c]))return!1}return!0}return t!==t&&o!==o}function qv(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function f0(t,o){const a=qv(t);return Math.round(o*a)/a}function ed(t){const o=S.useRef(t);return Ss(()=>{o.current=t}),o}function DC(t){t===void 0&&(t={});const{placement:o="bottom",strategy:a="absolute",middleware:r=[],platform:s,elements:{reference:c,floating:f}={},transform:d=!0,whileElementsMounted:p,open:h}=t,[v,y]=S.useState({x:0,y:0,strategy:a,placement:o,middlewareData:{},isPositioned:!1}),[x,C]=S.useState(r);_s(x,r)||C(r);const[T,w]=S.useState(null),[M,R]=S.useState(null),_=S.useCallback(V=>{V!==L.current&&(L.current=V,w(V))},[]),N=S.useCallback(V=>{V!==Z.current&&(Z.current=V,R(V))},[]),A=c||T,H=f||M,L=S.useRef(null),Z=S.useRef(null),I=S.useRef(v),J=p!=null,P=ed(p),ee=ed(s),oe=ed(h),te=S.useCallback(()=>{if(!L.current||!Z.current)return;const V={placement:o,strategy:a,middleware:x};ee.current&&(V.platform=ee.current),OC(L.current,Z.current,V).then(K=>{const W={...K,isPositioned:oe.current!==!1};B.current&&!_s(I.current,W)&&(I.current=W,Zn.flushSync(()=>{y(W)}))})},[x,o,a,ee,oe]);Ss(()=>{h===!1&&I.current.isPositioned&&(I.current.isPositioned=!1,y(V=>({...V,isPositioned:!1})))},[h]);const B=S.useRef(!1);Ss(()=>(B.current=!0,()=>{B.current=!1}),[]),Ss(()=>{if(A&&(L.current=A),H&&(Z.current=H),A&&H){if(P.current)return P.current(A,H,te);te()}},[A,H,te,P,J]);const ne=S.useMemo(()=>({reference:L,floating:Z,setReference:_,setFloating:N}),[_,N]),D=S.useMemo(()=>({reference:A,floating:H}),[A,H]),U=S.useMemo(()=>{const V={position:a,left:0,top:0};if(!D.floating)return V;const K=f0(D.floating,v.x),W=f0(D.floating,v.y);return d?{...V,transform:"translate("+K+"px, "+W+"px)",...qv(D.floating)>=1.5&&{willChange:"transform"}}:{position:a,left:K,top:W}},[a,d,D.floating,v.x,v.y]);return S.useMemo(()=>({...v,update:te,refs:ne,elements:D,floatingStyles:U}),[v,te,ne,D,U])}const HC=t=>{function o(a){return{}.hasOwnProperty.call(a,"current")}return{name:"arrow",options:t,fn(a){const{element:r,padding:s}=typeof t=="function"?t(a):t;return r&&o(r)?r.current!=null?u0({element:r.current,padding:s}).fn(a):{}:r?u0({element:r,padding:s}).fn(a):{}}}},mn=(t,o)=>({...CC(t),options:[t,o]}),Io=(t,o)=>({...TC(t),options:[t,o]}),d0=(t,o)=>({..._C(t),options:[t,o]}),yo=(t,o)=>({...EC(t),options:[t,o]}),Dr=(t,o)=>({...MC(t),options:[t,o]}),Yv=(t,o)=>({...wC(t),options:[t,o]}),zC=(t,o)=>({...RC(t),options:[t,o]}),jr=(t,o)=>({...jC(t),options:[t,o]}),Xv=(t,o)=>({...HC(t),options:[t,o]}),LC="modulepreload",VC=function(t){return"/"+t},m0={},Os=function(o,a,r){let s=Promise.resolve();if(a&&a.length>0){let p=function(h){return Promise.all(h.map(v=>Promise.resolve(v).then(y=>({status:"fulfilled",value:y}),y=>({status:"rejected",reason:y}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),d=f?.nonce||f?.getAttribute("nonce");s=p(a.map(h=>{if(h=VC(h),h in m0)return;m0[h]=!0;const v=h.endsWith(".css"),y=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${y}`))return;const x=document.createElement("link");if(x.rel=v?"stylesheet":LC,v||(x.as="script"),x.crossOrigin="",x.href=h,d&&x.setAttribute("nonce",d),document.head.appendChild(x),v)return new Promise((C,T)=>{x.addEventListener("load",C),x.addEventListener("error",()=>T(new Error(`Unable to preload CSS for ${h}`)))})}))}function c(f){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=f,window.dispatchEvent(d),!d.defaultPrevented)throw f}return s.then(f=>{for(const d of f||[])d.status==="rejected"&&c(d.reason);return o().catch(c)})};var kC=Object.defineProperty,BC=(t,o,a)=>o in t?kC(t,o,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[o]=a,p0=(t,o,a)=>BC(t,typeof o!="symbol"?o+"":o,a);const h0=sS.create({name:"comment",excludes:"",inclusive:!1,keepOnSplit:!0,addAttributes(){return{orphan:{parseHTML:t=>!!t.getAttribute("data-orphan"),renderHTML:t=>t.orphan?{"data-orphan":"true"}:{},default:!1},threadId:{parseHTML:t=>t.getAttribute("data-bn-thread-id"),renderHTML:t=>({"data-bn-thread-id":t.threadId}),default:""}}},renderHTML({HTMLAttributes:t}){return["span",cS(t,{class:"bn-thread-mark"})]},parseHTML(){return[{tag:"span.bn-thread-mark"}]},extendMarkSchema(t){return t.name==="comment"?{blocknoteIgnore:!0}:{}}});let UC=class extends uS{constructor(o){super(),p0(this,"userCache",new Map),p0(this,"loadingUsers",new Set),this.resolveUsers=o}async loadUsers(o){const a=o.filter(r=>!this.userCache.has(r)&&!this.loadingUsers.has(r));if(a.length!==0){for(const r of a)this.loadingUsers.add(r);try{const r=await this.resolveUsers(a);for(const s of r)this.userCache.set(s.id,s);this.emit("update",this.userCache)}finally{for(const r of a)this.loadingUsers.delete(r)}}}getUser(o){return this.userCache.get(o)}subscribe(o){return this.on("update",o)}};const ds=new oS("blocknote-comments");function $C(t,o){const a=new Map;return t.descendants((r,s)=>{r.marks.forEach(c=>{if(c.type.name===o){const f=c.attrs.threadId;if(!f)return;const d=s,p=d+r.nodeSize,h=a.get(f)??{from:1/0,to:0};a.set(f,{from:Math.min(d,h.from),to:Math.max(p,h.to)})}})}),a}const gn=tS(({editor:t,options:{schema:o,threadStore:a,resolveUsers:r}})=>{if(!r)throw new Error("resolveUsers is required to be defined when using comments");if(!a)throw new Error("threadStore is required to be defined when using comments");const s=h0.name,c=new UC(r),f=nS({pendingComment:!1,selectedThreadId:void 0,threadPositions:new Map},{onUpdate(){f.state.selectedThreadId!==f.prevState.selectedThreadId&&t.transact(p=>p.setMeta(ds,!0))}}),d=p=>{t.transact(h=>{h.doc.descendants((v,y)=>{v.marks.forEach(x=>{if(x.type.name===s){const C=x.type,T=x.attrs.threadId,w=p.get(T),M=!!(!w||w.resolved||w.deletedAt);if(M!==x.attrs.orphan){const R=Math.max(y,0),_=Math.min(y+v.nodeSize,h.doc.content.size-1,h.doc.content.size-1);h.removeMark(R,_,x),h.addMark(R,_,C.create({...x.attrs,orphan:M})),M&&f.state.selectedThreadId===T&&f.setState(N=>({...N,selectedThreadId:void 0}))}}})})})};return{key:"comments",store:f,prosemirrorPlugins:[new lS({key:ds,state:{init(){return{decorations:Uf.empty}},apply(p,h){const v=p.getMeta(ds);if(!p.docChanged&&!v)return h;const y=p.docChanged?$C(p.doc,s):f.state.threadPositions;(y.size>0||f.state.threadPositions.size>0)&&f.setState(C=>({...C,threadPositions:y}));const x=[];if(f.state.selectedThreadId){const C=y.get(f.state.selectedThreadId);C&&x.push(iS.inline(C.from,C.to,{class:"bn-thread-mark-selected"}))}return{decorations:Uf.create(p.doc,x)}}},props:{decorations(p){var h;return((h=ds.getState(p))==null?void 0:h.decorations)??Uf.empty},handleClick:(p,h,v)=>{if(v.button!==0)return;const y=p.state.doc.nodeAt(h);if(!y){f.setState(T=>({...T,selectedThreadId:void 0}));return}const x=y.marks.find(T=>T.type.name===s&&T.attrs.orphan!==!0),C=x?.attrs.threadId;C!==f.state.selectedThreadId&&f.setState(T=>({...T,selectedThreadId:C}))}}})],threadStore:a,mount(){const p=a.subscribe(d);d(a.getThreads());const h=t.onSelectionChange(()=>{f.state.pendingComment&&f.setState(v=>({...v,pendingComment:!1}))});return()=>{p(),h()}},selectThread(p,h=!0){var v,y;if(f.state.selectedThreadId!==p&&(f.setState(x=>({...x,pendingComment:!1,selectedThreadId:p})),p&&h)){const x=f.state.threadPositions.get(p);if(!x)return;(y=(v=t.prosemirrorView)==null?void 0:v.domAtPos(x.from).node)==null||y.scrollIntoView({behavior:"smooth",block:"center"})}},startPendingComment(){var p;f.setState(h=>({...h,selectedThreadId:void 0,pendingComment:!0})),(p=t.getExtension(Td))==null||p.showSelection(!0,"comments")},stopPendingComment(){var p;f.setState(h=>({...h,selectedThreadId:void 0,pendingComment:!1})),(p=t.getExtension(Td))==null||p.showSelection(!1,"comments")},async createThread(p){const h=await a.createThread(p);if(a.addThreadToDocument){const v=t.prosemirrorView,y=v.state.selection,x=aS.getState(v.state),C={prosemirror:{head:y.head,anchor:y.anchor},yjs:x?rS(x.binding,v.state):void 0};await a.addThreadToDocument({threadId:h.id,selection:C})}else t._tiptapEditor.commands.setMark(s,{orphan:!1,threadId:h.id})},userStore:c,commentEditorSchema:o,tiptapExtensions:[h0]}});let td;async function GC(){return td||(td=(async()=>{const[t,o]=await Promise.all([Os(()=>import("./module-RjUF93sV.js"),[]),Os(()=>import("./native-48B9X9Wg.js"),[])]),a="default"in t?t.default:t,r="default"in o?o.default:o;return await a.init({data:r}),{emojiMart:a,emojiData:r}})(),td)}async function ZC(t,o){if(!("text"in t.schema.inlineContentSchema)||t.schema.inlineContentSchema.text!==fS.text)return[];const{emojiData:a,emojiMart:r}=await GC();return(o.trim()===""?Object.values(a.emojis):await r.SearchIndex.search(o)).map(s=>({id:s.skins[0].native,onItemClick:()=>t.insertInlineContent(s.skins[0].native+" ")}))}function qC(){const t=navigator.userAgentData;return t!=null&&t.platform?t.platform:navigator.platform}function YC(){const t=navigator.userAgentData;return t&&Array.isArray(t.brands)?t.brands.map(o=>{let{brand:a,version:r}=o;return a+"/"+r}).join(" "):navigator.userAgent}function XC(){return/apple/i.test(navigator.vendor)}function PC(){return qC().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function QC(){return YC().includes("jsdom/")}const g0="data-floating-ui-focusable",IC="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function v0(t){let o=t.activeElement;for(;((a=o)==null||(a=a.shadowRoot)==null?void 0:a.activeElement)!=null;){var a;o=o.shadowRoot.activeElement}return o}function Hr(t,o){if(!t||!o)return!1;const a=o.getRootNode==null?void 0:o.getRootNode();if(t.contains(o))return!0;if(a&&Rs(a)){let r=o;for(;r;){if(t===r)return!0;r=r.parentNode||r.host}}return!1}function ga(t){return"composedPath"in t?t.composedPath()[0]:t.target}function nd(t,o){if(o==null)return!1;if("composedPath"in t)return t.composedPath().includes(o);const a=t;return a.target!=null&&o.contains(a.target)}function KC(t){return t.matches("html,body")}function bl(t){return t?.ownerDocument||document}function FC(t){return Wt(t)&&t.matches(IC)}function JC(t){if(!t||QC())return!0;try{return t.matches(":focus-visible")}catch{return!0}}function WC(t){return t?t.hasAttribute(g0)?t:t.querySelector("["+g0+"]")||t:null}function Cs(t,o,a){return a===void 0&&(a=!0),t.filter(s=>{var c;return s.parentId===o&&(!a||((c=s.context)==null?void 0:c.open))}).flatMap(s=>[s,...Cs(t,s.id,a)])}function e5(t){return"nativeEvent"in t}function Od(t,o){const a=["mouse","pen"];return a.push("",void 0),a.includes(t)}var t5=typeof document<"u",n5=function(){},pn=t5?S.useLayoutEffect:n5;const o5={...hv};function Po(t){const o=S.useRef(t);return pn(()=>{o.current=t}),o}const l5=o5.useInsertionEffect,a5=l5||(t=>t());function kn(t){const o=S.useRef(()=>{});return a5(()=>{o.current=t}),S.useCallback(function(){for(var a=arguments.length,r=new Array(a),s=0;s<a;s++)r[s]=arguments[s];return o.current==null?void 0:o.current(...r)},[])}function r5(t){const o=S.useRef(void 0),a=S.useCallback(r=>{const s=t.map(c=>{if(c!=null){if(typeof c=="function"){const f=c,d=f(r);return typeof d=="function"?d:()=>{f(null)}}return c.current=r,()=>{c.current=null}}});return()=>{s.forEach(c=>c?.())}},t);return S.useMemo(()=>t.every(r=>r==null)?null:r=>{o.current&&(o.current(),o.current=void 0),r!=null&&(o.current=a(r))},t)}const i5="data-floating-ui-focusable",y0="active",b0="selected",s5={...hv};let x0=!1,c5=0;const S0=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+c5++;function u5(){const[t,o]=S.useState(()=>x0?S0():void 0);return pn(()=>{t==null&&o(S0())},[]),S.useEffect(()=>{x0=!0},[]),t}const f5=s5.useId,Pv=f5||u5;function d5(){const t=new Map;return{emit(o,a){var r;(r=t.get(o))==null||r.forEach(s=>s(a))},on(o,a){t.has(o)||t.set(o,new Set),t.get(o).add(a)},off(o,a){var r;(r=t.get(o))==null||r.delete(a)}}}const m5=S.createContext(null),p5=S.createContext(null),qd=()=>{var t;return((t=S.useContext(m5))==null?void 0:t.id)||null},Yd=()=>S.useContext(p5);function Xd(t){return"data-floating-ui-"+t}function Vt(t){t.current!==-1&&(clearTimeout(t.current),t.current=-1)}const C0=Xd("safe-polygon");function ws(t,o,a){if(a&&!Od(a))return 0;if(typeof t=="number")return t;if(typeof t=="function"){const r=t();return typeof r=="number"?r:r?.[o]}return t?.[o]}function od(t){return typeof t=="function"?t():t}function Qv(t,o){o===void 0&&(o={});const{open:a,onOpenChange:r,dataRef:s,events:c,elements:f}=t,{enabled:d=!0,delay:p=0,handleClose:h=null,mouseOnly:v=!1,restMs:y=0,move:x=!0}=o,C=Yd(),T=qd(),w=Po(h),M=Po(p),R=Po(a),_=Po(y),N=S.useRef(),A=S.useRef(-1),H=S.useRef(),L=S.useRef(-1),Z=S.useRef(!0),I=S.useRef(!1),J=S.useRef(()=>{}),P=S.useRef(!1),ee=kn(()=>{var U;const V=(U=s.current.openEvent)==null?void 0:U.type;return V?.includes("mouse")&&V!=="mousedown"});S.useEffect(()=>{if(!d)return;function U(V){let{open:K}=V;K||(Vt(A),Vt(L),Z.current=!0,P.current=!1)}return c.on("openchange",U),()=>{c.off("openchange",U)}},[d,c]),S.useEffect(()=>{if(!d||!w.current||!a)return;function U(K){ee()&&r(!1,K,"hover")}const V=bl(f.floating).documentElement;return V.addEventListener("mouseleave",U),()=>{V.removeEventListener("mouseleave",U)}},[f.floating,a,r,d,w,ee]);const oe=S.useCallback(function(U,V,K){V===void 0&&(V=!0),K===void 0&&(K="hover");const W=ws(M.current,"close",N.current);W&&!H.current?(Vt(A),A.current=window.setTimeout(()=>r(!1,U,K),W)):V&&(Vt(A),r(!1,U,K))},[M,r]),te=kn(()=>{J.current(),H.current=void 0}),B=kn(()=>{if(I.current){const U=bl(f.floating).body;U.style.pointerEvents="",U.removeAttribute(C0),I.current=!1}}),ne=kn(()=>s.current.openEvent?["click","mousedown"].includes(s.current.openEvent.type):!1);S.useEffect(()=>{if(!d)return;function U(le){if(Vt(A),Z.current=!1,v&&!Od(N.current)||od(_.current)>0&&!ws(M.current,"open"))return;const ae=ws(M.current,"open",N.current);ae?A.current=window.setTimeout(()=>{R.current||r(!0,le,"hover")},ae):a||r(!0,le,"hover")}function V(le){if(ne()){B();return}J.current();const ae=bl(f.floating);if(Vt(L),P.current=!1,w.current&&s.current.floatingContext){a||Vt(A),H.current=w.current({...s.current.floatingContext,tree:C,x:le.clientX,y:le.clientY,onClose(){B(),te(),ne()||oe(le,!0,"safe-polygon")}});const ge=H.current;ae.addEventListener("mousemove",ge),J.current=()=>{ae.removeEventListener("mousemove",ge)};return}(N.current!=="touch"||!Hr(f.floating,le.relatedTarget))&&oe(le)}function K(le){ne()||s.current.floatingContext&&(w.current==null||w.current({...s.current.floatingContext,tree:C,x:le.clientX,y:le.clientY,onClose(){B(),te(),ne()||oe(le)}})(le))}function W(){Vt(A)}function de(le){ne()||oe(le,!1)}if(Ye(f.domReference)){const le=f.domReference,ae=f.floating;return a&&le.addEventListener("mouseleave",K),x&&le.addEventListener("mousemove",U,{once:!0}),le.addEventListener("mouseenter",U),le.addEventListener("mouseleave",V),ae&&(ae.addEventListener("mouseleave",K),ae.addEventListener("mouseenter",W),ae.addEventListener("mouseleave",de)),()=>{a&&le.removeEventListener("mouseleave",K),x&&le.removeEventListener("mousemove",U),le.removeEventListener("mouseenter",U),le.removeEventListener("mouseleave",V),ae&&(ae.removeEventListener("mouseleave",K),ae.removeEventListener("mouseenter",W),ae.removeEventListener("mouseleave",de))}}},[f,d,t,v,x,oe,te,B,r,a,R,C,M,w,s,ne,_]),pn(()=>{var U;if(d&&a&&(U=w.current)!=null&&(U=U.__options)!=null&&U.blockPointerEvents&&ee()){I.current=!0;const K=f.floating;if(Ye(f.domReference)&&K){var V;const W=bl(f.floating).body;W.setAttribute(C0,"");const de=f.domReference,le=C==null||(V=C.nodesRef.current.find(ae=>ae.id===T))==null||(V=V.context)==null?void 0:V.elements.floating;return le&&(le.style.pointerEvents=""),W.style.pointerEvents="none",de.style.pointerEvents="auto",K.style.pointerEvents="auto",()=>{W.style.pointerEvents="",de.style.pointerEvents="",K.style.pointerEvents=""}}}},[d,a,T,f,C,w,ee]),pn(()=>{a||(N.current=void 0,P.current=!1,te(),B())},[a,te,B]),S.useEffect(()=>()=>{te(),Vt(A),Vt(L),B()},[d,f.domReference,te,B]);const D=S.useMemo(()=>{function U(V){N.current=V.pointerType}return{onPointerDown:U,onPointerEnter:U,onMouseMove(V){const{nativeEvent:K}=V;function W(){!Z.current&&!R.current&&r(!0,K,"hover")}v&&!Od(N.current)||a||od(_.current)===0||P.current&&V.movementX**2+V.movementY**2<2||(Vt(L),N.current==="touch"?W():(P.current=!0,L.current=window.setTimeout(W,od(_.current))))}}},[v,r,a,R,_]);return S.useMemo(()=>d?{reference:D}:{},[d,D])}const Nd=()=>{},Iv=S.createContext({delay:0,initialDelay:0,timeoutMs:0,currentId:null,setCurrentId:Nd,setState:Nd,isInstantPhase:!1}),h5=()=>S.useContext(Iv);function g5(t){const{children:o,delay:a,timeoutMs:r=0}=t,[s,c]=S.useReducer((p,h)=>({...p,...h}),{delay:a,timeoutMs:r,initialDelay:a,currentId:null,isInstantPhase:!1}),f=S.useRef(null),d=S.useCallback(p=>{c({currentId:p})},[]);return pn(()=>{s.currentId?f.current===null?f.current=s.currentId:s.isInstantPhase||c({isInstantPhase:!0}):(s.isInstantPhase&&c({isInstantPhase:!1}),f.current=null)},[s.currentId,s.isInstantPhase]),g.jsx(Iv.Provider,{value:S.useMemo(()=>({...s,setState:c,setCurrentId:d}),[s,d]),children:o})}function v5(t,o){o===void 0&&(o={});const{open:a,onOpenChange:r,floatingId:s}=t,{id:c,enabled:f=!0}=o,d=c??s,p=h5(),{currentId:h,setCurrentId:v,initialDelay:y,setState:x,timeoutMs:C}=p;return pn(()=>{f&&h&&(x({delay:{open:1,close:ws(y,"close")}}),h!==d&&r(!1))},[f,d,r,x,h,y]),pn(()=>{function T(){r(!1),x({delay:y,currentId:null})}if(f&&h&&!a&&h===d){if(C){const w=window.setTimeout(T,C);return()=>{clearTimeout(w)}}T()}},[f,a,x,h,d,r,y,C]),pn(()=>{f&&(v===Nd||!a||v(d))},[f,a,v,d]),p}function ld(t,o){if(!t||!o)return!1;const a=o.getRootNode==null?void 0:o.getRootNode();if(t.contains(o))return!0;if(a&&Rs(a)){let r=o;for(;r;){if(t===r)return!0;r=r.parentNode||r.host}}return!1}function y5(t){return"composedPath"in t?t.composedPath()[0]:t.target}const b5={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},x5={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},w0=t=>{var o,a;return{escapeKey:typeof t=="boolean"?t:(o=t?.escapeKey)!=null?o:!1,outsidePress:typeof t=="boolean"?t:(a=t?.outsidePress)!=null?a:!0}};function Kv(t,o){o===void 0&&(o={});const{open:a,onOpenChange:r,elements:s,dataRef:c}=t,{enabled:f=!0,escapeKey:d=!0,outsidePress:p=!0,outsidePressEvent:h="pointerdown",referencePress:v=!1,referencePressEvent:y="pointerdown",ancestorScroll:x=!1,bubbles:C,capture:T}=o,w=Yd(),M=kn(typeof p=="function"?p:()=>!1),R=typeof p=="function"?M:p,_=S.useRef(!1),{escapeKey:N,outsidePress:A}=w0(C),{escapeKey:H,outsidePress:L}=w0(T),Z=S.useRef(!1),I=kn(B=>{var ne;if(!a||!f||!d||B.key!=="Escape"||Z.current)return;const D=(ne=c.current.floatingContext)==null?void 0:ne.nodeId,U=w?Cs(w.nodesRef.current,D):[];if(!N&&(B.stopPropagation(),U.length>0)){let V=!0;if(U.forEach(K=>{var W;if((W=K.context)!=null&&W.open&&!K.context.dataRef.current.__escapeKeyBubbles){V=!1;return}}),!V)return}r(!1,e5(B)?B.nativeEvent:B,"escape-key")}),J=kn(B=>{var ne;const D=()=>{var U;I(B),(U=ga(B))==null||U.removeEventListener("keydown",D)};(ne=ga(B))==null||ne.addEventListener("keydown",D)}),P=kn(B=>{var ne;const D=c.current.insideReactTree;c.current.insideReactTree=!1;const U=_.current;if(_.current=!1,h==="click"&&U||D||typeof R=="function"&&!R(B))return;const V=ga(B),K="["+Xd("inert")+"]",W=bl(s.floating).querySelectorAll(K);let de=Ye(V)?V:null;for(;de&&!ho(de);){const ge=vo(de);if(ho(ge)||!Ye(ge))break;de=ge}if(W.length&&Ye(V)&&!KC(V)&&!Hr(V,s.floating)&&Array.from(W).every(ge=>!Hr(de,ge)))return;if(Wt(V)&&te){const ge=ho(V),Ne=hn(V),Pe=/auto|scroll/,Ee=ge||Pe.test(Ne.overflowX),ve=ge||Pe.test(Ne.overflowY),We=Ee&&V.clientWidth>0&&V.scrollWidth>V.clientWidth,rt=ve&&V.clientHeight>0&&V.scrollHeight>V.clientHeight,et=Ne.direction==="rtl",ze=rt&&(et?B.offsetX<=V.offsetWidth-V.clientWidth:B.offsetX>V.clientWidth),ot=We&&B.offsetY>V.clientHeight;if(ze||ot)return}const le=(ne=c.current.floatingContext)==null?void 0:ne.nodeId,ae=w&&Cs(w.nodesRef.current,le).some(ge=>{var Ne;return nd(B,(Ne=ge.context)==null?void 0:Ne.elements.floating)});if(nd(B,s.floating)||nd(B,s.domReference)||ae)return;const ye=w?Cs(w.nodesRef.current,le):[];if(ye.length>0){let ge=!0;if(ye.forEach(Ne=>{var Pe;if((Pe=Ne.context)!=null&&Pe.open&&!Ne.context.dataRef.current.__outsidePressBubbles){ge=!1;return}}),!ge)return}r(!1,B,"outside-press")}),ee=kn(B=>{var ne;const D=()=>{var U;P(B),(U=ga(B))==null||U.removeEventListener(h,D)};(ne=ga(B))==null||ne.addEventListener(h,D)});S.useEffect(()=>{if(!a||!f)return;c.current.__escapeKeyBubbles=N,c.current.__outsidePressBubbles=A;let B=-1;function ne(W){r(!1,W,"ancestor-scroll")}function D(){window.clearTimeout(B),Z.current=!0}function U(){B=window.setTimeout(()=>{Z.current=!1},Ks()?5:0)}const V=bl(s.floating);d&&(V.addEventListener("keydown",H?J:I,H),V.addEventListener("compositionstart",D),V.addEventListener("compositionend",U)),R&&V.addEventListener(h,L?ee:P,L);let K=[];return x&&(Ye(s.domReference)&&(K=go(s.domReference)),Ye(s.floating)&&(K=K.concat(go(s.floating))),!Ye(s.reference)&&s.reference&&s.reference.contextElement&&(K=K.concat(go(s.reference.contextElement)))),K=K.filter(W=>{var de;return W!==((de=V.defaultView)==null?void 0:de.visualViewport)}),K.forEach(W=>{W.addEventListener("scroll",ne,{passive:!0})}),()=>{d&&(V.removeEventListener("keydown",H?J:I,H),V.removeEventListener("compositionstart",D),V.removeEventListener("compositionend",U)),R&&V.removeEventListener(h,L?ee:P,L),K.forEach(W=>{W.removeEventListener("scroll",ne)}),window.clearTimeout(B)}},[c,s,d,R,h,a,r,x,f,N,A,I,H,J,P,L,ee]),S.useEffect(()=>{c.current.insideReactTree=!1},[c,R,h]);const oe=S.useMemo(()=>({onKeyDown:I,...v&&{[b5[y]]:B=>{r(!1,B.nativeEvent,"reference-press")},...y!=="click"&&{onClick(B){r(!1,B.nativeEvent,"reference-press")}}}}),[I,r,v,y]),te=S.useMemo(()=>({onKeyDown:I,onMouseDown(){_.current=!0},onMouseUp(){_.current=!0},[x5[h]]:()=>{c.current.insideReactTree=!0}}),[I,h,c]);return S.useMemo(()=>f?{reference:oe,floating:te}:{},[f,oe,te])}function S5(t){const{open:o=!1,onOpenChange:a,elements:r}=t,s=Pv(),c=S.useRef({}),[f]=S.useState(()=>d5()),d=qd()!=null,[p,h]=S.useState(r.reference),v=kn((C,T,w)=>{c.current.openEvent=C?T:void 0,f.emit("openchange",{open:C,event:T,reason:w,nested:d}),a?.(C,T,w)}),y=S.useMemo(()=>({setPositionReference:h}),[]),x=S.useMemo(()=>({reference:p||r.reference||null,floating:r.floating||null,domReference:r.reference}),[p,r.reference,r.floating]);return S.useMemo(()=>({dataRef:c,open:o,onOpenChange:v,elements:x,events:f,floatingId:s,refs:y}),[o,v,x,f,s,y])}function Ws(t){t===void 0&&(t={});const{nodeId:o}=t,a=S5({...t,elements:{reference:null,floating:null,...t.elements}}),r=t.rootContext||a,s=r.elements,[c,f]=S.useState(null),[d,p]=S.useState(null),v=s?.domReference||c,y=S.useRef(null),x=Yd();pn(()=>{v&&(y.current=v)},[v]);const C=DC({...t,elements:{...s,...d&&{reference:d}}}),T=S.useCallback(N=>{const A=Ye(N)?{getBoundingClientRect:()=>N.getBoundingClientRect(),getClientRects:()=>N.getClientRects(),contextElement:N}:N;p(A),C.refs.setReference(A)},[C.refs]),w=S.useCallback(N=>{(Ye(N)||N===null)&&(y.current=N,f(N)),(Ye(C.refs.reference.current)||C.refs.reference.current===null||N!==null&&!Ye(N))&&C.refs.setReference(N)},[C.refs]),M=S.useMemo(()=>({...C.refs,setReference:w,setPositionReference:T,domReference:y}),[C.refs,w,T]),R=S.useMemo(()=>({...C.elements,domReference:v}),[C.elements,v]),_=S.useMemo(()=>({...C,...r,refs:M,elements:R,nodeId:o}),[C,M,R,o,r]);return pn(()=>{r.dataRef.current.floatingContext=_;const N=x?.nodesRef.current.find(A=>A.id===o);N&&(N.context=_)}),S.useMemo(()=>({...C,context:_,refs:M,elements:R}),[C,M,R,_])}function ad(){return PC()&&XC()}function C5(t,o){o===void 0&&(o={});const{open:a,onOpenChange:r,events:s,dataRef:c,elements:f}=t,{enabled:d=!0,visibleOnly:p=!0}=o,h=S.useRef(!1),v=S.useRef(-1),y=S.useRef(!0);S.useEffect(()=>{if(!d)return;const C=Ut(f.domReference);function T(){!a&&Wt(f.domReference)&&f.domReference===v0(bl(f.domReference))&&(h.current=!0)}function w(){y.current=!0}function M(){y.current=!1}return C.addEventListener("blur",T),ad()&&(C.addEventListener("keydown",w,!0),C.addEventListener("pointerdown",M,!0)),()=>{C.removeEventListener("blur",T),ad()&&(C.removeEventListener("keydown",w,!0),C.removeEventListener("pointerdown",M,!0))}},[f.domReference,a,d]),S.useEffect(()=>{if(!d)return;function C(T){let{reason:w}=T;(w==="reference-press"||w==="escape-key")&&(h.current=!0)}return s.on("openchange",C),()=>{s.off("openchange",C)}},[s,d]),S.useEffect(()=>()=>{Vt(v)},[]);const x=S.useMemo(()=>({onMouseLeave(){h.current=!1},onFocus(C){if(h.current)return;const T=ga(C.nativeEvent);if(p&&Ye(T)){if(ad()&&!C.relatedTarget){if(!y.current&&!FC(T))return}else if(!JC(T))return}r(!0,C.nativeEvent,"focus")},onBlur(C){h.current=!1;const T=C.relatedTarget,w=C.nativeEvent,M=Ye(T)&&T.hasAttribute(Xd("focus-guard"))&&T.getAttribute("data-type")==="outside";v.current=window.setTimeout(()=>{var R;const _=v0(f.domReference?f.domReference.ownerDocument:document);!T&&_===f.domReference||Hr((R=c.current.floatingContext)==null?void 0:R.refs.floating.current,_)||Hr(f.domReference,_)||M||r(!1,w,"focus")})}}),[c,f.domReference,r,p]);return S.useMemo(()=>d?{reference:x}:{},[d,x])}function rd(t,o,a){const r=new Map,s=a==="item";let c=t;if(s&&t){const{[y0]:f,[b0]:d,...p}=t;c=p}return{...a==="floating"&&{tabIndex:-1,[i5]:""},...c,...o.map(f=>{const d=f?f[a]:null;return typeof d=="function"?t?d(t):null:d}).concat(t).reduce((f,d)=>(d&&Object.entries(d).forEach(p=>{let[h,v]=p;if(!(s&&[y0,b0].includes(h)))if(h.indexOf("on")===0){if(r.has(h)||r.set(h,[]),typeof v=="function"){var y;(y=r.get(h))==null||y.push(v),f[h]=function(){for(var x,C=arguments.length,T=new Array(C),w=0;w<C;w++)T[w]=arguments[w];return(x=r.get(h))==null?void 0:x.map(M=>M(...T)).find(M=>M!==void 0)}}}else f[h]=v}),f),{})}}function Fv(t){t===void 0&&(t=[]);const o=t.map(d=>d?.reference),a=t.map(d=>d?.floating),r=t.map(d=>d?.item),s=S.useCallback(d=>rd(d,t,"reference"),o),c=S.useCallback(d=>rd(d,t,"floating"),a),f=S.useCallback(d=>rd(d,t,"item"),r);return S.useMemo(()=>({getReferenceProps:s,getFloatingProps:c,getItemProps:f}),[s,c,f])}const w5=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function T5(t,o){var a,r;o===void 0&&(o={});const{open:s,elements:c,floatingId:f}=t,{enabled:d=!0,role:p="dialog"}=o,h=Pv(),v=((a=c.domReference)==null?void 0:a.id)||h,y=S.useMemo(()=>{var _;return((_=WC(c.floating))==null?void 0:_.id)||f},[c.floating,f]),x=(r=w5.get(p))!=null?r:p,T=qd()!=null,w=S.useMemo(()=>x==="tooltip"||p==="label"?{["aria-"+(p==="label"?"labelledby":"describedby")]:s?y:void 0}:{"aria-expanded":s?"true":"false","aria-haspopup":x==="alertdialog"?"dialog":x,"aria-controls":s?y:void 0,...x==="listbox"&&{role:"combobox"},...x==="menu"&&{id:v},...x==="menu"&&T&&{role:"menuitem"},...p==="select"&&{"aria-autocomplete":"none"},...p==="combobox"&&{"aria-autocomplete":"list"}},[x,y,T,s,v,p]),M=S.useMemo(()=>{const _={id:y,...x&&{role:x}};return x==="tooltip"||p==="label"?_:{..._,...x==="menu"&&{"aria-labelledby":v}}},[x,y,v,p]),R=S.useCallback(_=>{let{active:N,selected:A}=_;const H={role:"option",...N&&{id:y+"-fui-option"}};switch(p){case"select":case"combobox":return{...H,"aria-selected":A}}return{}},[y,p]);return S.useMemo(()=>d?{reference:w,floating:M,item:R}:{},[d,w,M,R])}const T0=t=>t.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(o,a)=>(a?"-":"")+o.toLowerCase());function da(t,o){return typeof t=="function"?t(o):t}function E5(t,o){const[a,r]=S.useState(t);return t&&!a&&r(!0),S.useEffect(()=>{if(!t&&a){const s=setTimeout(()=>r(!1),o);return()=>clearTimeout(s)}},[t,a,o]),a}function Jv(t,o){o===void 0&&(o={});const{open:a,elements:{floating:r}}=t,{duration:s=250}=o,f=(typeof s=="number"?s:s.close)||0,[d,p]=S.useState("unmounted"),h=E5(a,f);return!h&&d==="close"&&p("unmounted"),pn(()=>{if(r){if(a){p("initial");const v=requestAnimationFrame(()=>{Zn.flushSync(()=>{p("open")})});return()=>{cancelAnimationFrame(v)}}p("close")}},[a,r]),{isMounted:h,status:d}}function M5(t,o){o===void 0&&(o={});const{initial:a={opacity:0},open:r,close:s,common:c,duration:f=250}=o,d=t.placement,p=d.split("-")[0],h=S.useMemo(()=>({side:p,placement:d}),[p,d]),v=typeof f=="number",y=(v?f:f.open)||0,x=(v?f:f.close)||0,[C,T]=S.useState(()=>({...da(c,h),...da(a,h)})),{isMounted:w,status:M}=Jv(t,{duration:f}),R=Po(a),_=Po(r),N=Po(s),A=Po(c);return pn(()=>{const H=da(R.current,h),L=da(N.current,h),Z=da(A.current,h),I=da(_.current,h)||Object.keys(H).reduce((J,P)=>(J[P]="",J),{});if(M==="initial"&&T(J=>({transitionProperty:J.transitionProperty,...Z,...H})),M==="open"&&T({transitionProperty:Object.keys(I).map(T0).join(","),transitionDuration:y+"ms",...Z,...I}),M==="close"){const J=L||H;T({transitionProperty:Object.keys(J).map(T0).join(","),transitionDuration:x+"ms",...Z,...J})}},[x,N,R,_,A,y,M,h]),{isMounted:w,styles:C}}function Wv(t,o,a){return a===void 0&&(a=!0),t.filter(s=>{var c;return s.parentId===o&&(!a||((c=s.context)==null?void 0:c.open))}).flatMap(s=>[s,...Wv(t,s.id,a)])}function E0(t,o){const[a,r]=t;let s=!1;const c=o.length;for(let f=0,d=c-1;f<c;d=f++){const[p,h]=o[f]||[0,0],[v,y]=o[d]||[0,0];h>=r!=y>=r&&a<=(v-p)*(r-h)/(y-h)+p&&(s=!s)}return s}function R5(t,o){return t[0]>=o.x&&t[0]<=o.x+o.width&&t[1]>=o.y&&t[1]<=o.y+o.height}function j5(t){t===void 0&&(t={});const{buffer:o=.5,blockPointerEvents:a=!1,requireIntent:r=!0}=t,s={current:-1};let c=!1,f=null,d=null,p=typeof performance<"u"?performance.now():0;function h(y,x){const C=performance.now(),T=C-p;if(f===null||d===null||T===0)return f=y,d=x,p=C,null;const w=y-f,M=x-d,_=Math.sqrt(w*w+M*M)/T;return f=y,d=x,p=C,_}const v=y=>{let{x,y:C,placement:T,elements:w,onClose:M,nodeId:R,tree:_}=y;return function(A){function H(){Vt(s),M()}if(Vt(s),!w.domReference||!w.floating||T==null||x==null||C==null)return;const{clientX:L,clientY:Z}=A,I=[L,Z],J=y5(A),P=A.type==="mouseleave",ee=ld(w.floating,J),oe=ld(w.domReference,J),te=w.domReference.getBoundingClientRect(),B=w.floating.getBoundingClientRect(),ne=T.split("-")[0],D=x>B.right-B.width/2,U=C>B.bottom-B.height/2,V=R5(I,te),K=B.width>te.width,W=B.height>te.height,de=(K?te:B).left,le=(K?te:B).right,ae=(W?te:B).top,ye=(W?te:B).bottom;if(ee&&(c=!0,!P))return;if(oe&&(c=!1),oe&&!P){c=!0;return}if(P&&Ye(A.relatedTarget)&&ld(w.floating,A.relatedTarget)||_&&Wv(_.nodesRef.current,R).length)return;if(ne==="top"&&C>=te.bottom-1||ne==="bottom"&&C<=te.top+1||ne==="left"&&x>=te.right-1||ne==="right"&&x<=te.left+1)return H();let ge=[];switch(ne){case"top":ge=[[de,te.top+1],[de,B.bottom-1],[le,B.bottom-1],[le,te.top+1]];break;case"bottom":ge=[[de,B.top+1],[de,te.bottom-1],[le,te.bottom-1],[le,B.top+1]];break;case"left":ge=[[B.right-1,ye],[B.right-1,ae],[te.left+1,ae],[te.left+1,ye]];break;case"right":ge=[[te.right-1,ye],[te.right-1,ae],[B.left+1,ae],[B.left+1,ye]];break}function Ne(Pe){let[Ee,ve]=Pe;switch(ne){case"top":{const We=[K?Ee+o/2:D?Ee+o*4:Ee-o*4,ve+o+1],rt=[K?Ee-o/2:D?Ee+o*4:Ee-o*4,ve+o+1],et=[[B.left,D||K?B.bottom-o:B.top],[B.right,D?K?B.bottom-o:B.top:B.bottom-o]];return[We,rt,...et]}case"bottom":{const We=[K?Ee+o/2:D?Ee+o*4:Ee-o*4,ve-o],rt=[K?Ee-o/2:D?Ee+o*4:Ee-o*4,ve-o],et=[[B.left,D||K?B.top+o:B.bottom],[B.right,D?K?B.top+o:B.bottom:B.top+o]];return[We,rt,...et]}case"left":{const We=[Ee+o+1,W?ve+o/2:U?ve+o*4:ve-o*4],rt=[Ee+o+1,W?ve-o/2:U?ve+o*4:ve-o*4];return[...[[U||W?B.right-o:B.left,B.top],[U?W?B.right-o:B.left:B.right-o,B.bottom]],We,rt]}case"right":{const We=[Ee-o,W?ve+o/2:U?ve+o*4:ve-o*4],rt=[Ee-o,W?ve-o/2:U?ve+o*4:ve-o*4],et=[[U||W?B.left+o:B.right,B.top],[U?W?B.left+o:B.right:B.left+o,B.bottom]];return[We,rt,...et]}}}if(!E0([L,Z],ge)){if(c&&!V)return H();if(!P&&r){const Pe=h(A.clientX,A.clientY);if(Pe!==null&&Pe<.1)return H()}E0([L,Z],Ne([x,C]))?!c&&r&&(s.current=window.setTimeout(H,40)):H()}}};return v.__options={blockPointerEvents:a},v}function _5(t,o=a=>a){return qS.useSyncExternalStoreWithSelector(t.subscribe,()=>t.state,()=>t.state,o,O5)}function O5(t,o){if(Object.is(t,o))return!0;if(typeof t!="object"||t===null||typeof o!="object"||o===null)return!1;if(t instanceof Map&&o instanceof Map){if(t.size!==o.size)return!1;for(const[r,s]of t)if(!o.has(r)||!Object.is(s,o.get(r)))return!1;return!0}if(t instanceof Set&&o instanceof Set){if(t.size!==o.size)return!1;for(const r of t)if(!o.has(r))return!1;return!0}if(t instanceof Date&&o instanceof Date)return t.getTime()===o.getTime();const a=M0(t);if(a.length!==M0(o).length)return!1;for(let r=0;r<a.length;r++)if(!Object.prototype.hasOwnProperty.call(o,a[r])||!Object.is(t[a[r]],o[a[r]]))return!1;return!0}function M0(t){return Object.keys(t).concat(Object.getOwnPropertySymbols(t))}var N5=Cv(),A5=(...t)=>o=>{t.forEach(a=>{typeof a=="function"?a(o):a&&(a.current=o)})},D5=({contentComponent:t})=>{const o=N5.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return g.jsx(g.Fragment,{children:Object.values(o)})};function H5(){const t=new Set;let o={};return{subscribe(a){return t.add(a),()=>{t.delete(a)}},getSnapshot(){return o},getServerSnapshot(){return o},setRenderer(a,r){o={...o,[a]:wv.createPortal(r.reactElement,r.element,a)},t.forEach(s=>s())},removeRenderer(a){const r={...o};delete r[a],o=r,t.forEach(s=>s())}}}var z5=class extends Ve.Component{constructor(t){var o;super(t),this.editorContentRef=Ve.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((o=t.editor)!=null&&o.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var t;const o=this.props.editor;if(o&&!o.isDestroyed&&((t=o.view.dom)!=null&&t.parentNode)){if(o.contentComponent)return;const a=this.editorContentRef.current;a.append(...o.view.dom.parentNode.childNodes),o.setOptions({element:a}),o.contentComponent=H5(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=o.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),o.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var t;const o=this.props.editor;if(o){this.initialized=!1,o.isDestroyed||o.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),o.contentComponent=null;try{if(!((t=o.view.dom)!=null&&t.parentNode))return;const a=document.createElement("div");a.append(...o.view.dom.parentNode.childNodes),o.setOptions({element:a})}catch{}}}render(){const{editor:t,innerRef:o,...a}=this.props;return g.jsxs(g.Fragment,{children:[g.jsx("div",{ref:A5(o,this.editorContentRef),...a}),t?.contentComponent&&g.jsx(D5,{contentComponent:t.contentComponent})]})}},L5=S.forwardRef((t,o)=>{const a=Ve.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return Ve.createElement(z5,{key:a,innerRef:o,...t})}),V5=Ve.memo(L5),ey=S.createContext({editor:null});ey.Consumer;var ty=S.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),Pd=()=>S.useContext(ty),ny=Ve.forwardRef((t,o)=>{const{onDragStart:a}=Pd(),r=t.as||"div";return g.jsx(r,{...t,ref:o,"data-node-view-wrapper":"",onDragStart:a,style:{whiteSpace:"normal",...t.style}})});function R0(t){return!!(typeof t=="function"&&t.prototype&&t.prototype.isReactComponent)}function j0(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.forward_ref)"||t.$$typeof.description==="react.forward_ref"))}function k5(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.memo)"||t.$$typeof.description==="react.memo"))}function B5(t){if(R0(t)||j0(t))return!0;if(k5(t)){const o=t.type;if(o)return R0(o)||j0(o)}return!1}function U5(){try{if(S.version)return parseInt(S.version.split(".")[0],10)>=19}catch{}return!1}var $5=class{constructor(t,{editor:o,props:a={},as:r="div",className:s=""}){this.ref=null,this.destroyed=!1,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=t,this.editor=o,this.props=a,this.element=document.createElement(r),this.element.classList.add("react-renderer"),s&&this.element.classList.add(...s.split(" ")),this.editor.isInitialized?Zn.flushSync(()=>{this.render()}):queueMicrotask(()=>{this.destroyed||this.render()})}render(){var t;if(this.destroyed)return;const o=this.component,a=this.props,r=this.editor,s=U5(),c=B5(o),f={...a};f.ref&&!(s||c)&&delete f.ref,!f.ref&&(s||c)&&(f.ref=d=>{this.ref=d}),this.reactElement=g.jsx(o,{...f}),(t=r?.contentComponent)==null||t.setRenderer(this.id,this)}updateProps(t={}){this.destroyed||(this.props={...this.props,...t},this.render())}destroy(){var t;this.destroyed=!0;const o=this.editor;(t=o?.contentComponent)==null||t.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(t){Object.keys(t).forEach(o=>{this.element.setAttribute(o,t[o])})}};Ve.createContext({markViewContentRef:()=>{}});var G5=class extends dS{constructor(t,o,a){if(super(t,o,a),this.selectionRafId=null,this.cachedExtensionWithSyncedStorage=null,!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const r=this.dom.querySelector("[data-node-view-content]");if(!r)return;r.appendChild(this.contentDOMElement)}}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){const t=this.editor,o=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(o,{get(a,r,s){var c;return r==="storage"?(c=t.storage[o.name])!=null?c:{}:Reflect.get(a,r,s)}})}return this.cachedExtensionWithSyncedStorage}mount(){const t={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extensionWithSyncedStorage,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(p={})=>this.updateAttributes(p),deleteNode:()=>this.deleteNode(),ref:S.createRef()};if(!this.component.displayName){const p=h=>h.charAt(0).toUpperCase()+h.substring(1);this.component.displayName=p(this.extension.name)}const r={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:p=>{p&&this.contentDOMElement&&p.firstChild!==this.contentDOMElement&&(p.hasAttribute("data-node-view-wrapper")&&p.removeAttribute("data-node-view-wrapper"),p.appendChild(this.contentDOMElement))}},s=this.component,c=S.memo(p=>g.jsx(ty.Provider,{value:r,children:S.createElement(s,p)}));c.displayName="ReactNodeView";let f=this.node.isInline?"span":"div";this.options.as&&(f=this.options.as);const{className:d=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new $5(c,{editor:this.editor,props:t,as:f,className:`node-${this.node.type.name} ${d}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes()}get dom(){var t;if(this.renderer.element.firstElementChild&&!((t=this.renderer.element.firstElementChild)!=null&&t.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null),this.selectionRafId=requestAnimationFrame(()=>{this.selectionRafId=null;const{from:t,to:o}=this.editor.state.selection,a=this.getPos();if(typeof a=="number")if(t<=a&&o>=a+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}})}update(t,o,a){const r=s=>{this.renderer.updateProps(s),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(t.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const s=this.node,c=this.decorations,f=this.innerDecorations;return this.node=t,this.decorations=o,this.innerDecorations=a,this.options.update({oldNode:s,oldDecorations:c,newNode:t,newDecorations:o,oldInnerDecorations:f,innerDecorations:a,updateProps:()=>r({node:t,decorations:o,innerDecorations:a,extension:this.extensionWithSyncedStorage})})}return t===this.node&&this.decorations===o&&this.innerDecorations===a||(this.node=t,this.decorations=o,this.innerDecorations=a,r({node:t,decorations:o,innerDecorations:a,extension:this.extensionWithSyncedStorage})),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.contentDOMElement=null,this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null)}updateElementAttributes(){if(this.options.attrs){let t={};if(typeof this.options.attrs=="function"){const o=this.editor.extensionManager.attributes,a=mS(this.node,o);t=this.options.attrs({node:this.node,HTMLAttributes:a})}else t=this.options.attrs;this.renderer.updateAttributes(t)}}};function oy(t,o){return a=>a.editor.contentComponent?new G5(t,a,o):{}}var Qd=S.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});Qd.displayName="TiptapContext";var Z5=()=>S.useContext(Qd);function ly({editor:t,instance:o,children:a}){const r=t??o;if(!r)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const s=S.useMemo(()=>({editor:r}),[r]),c=S.useMemo(()=>({editor:r}),[r]);return g.jsx(ey.Provider,{value:c,children:g.jsx(Qd.Provider,{value:s,children:a})})}ly.displayName="Tiptap";function ay({...t}){const{editor:o}=Z5();return g.jsx(V5,{editor:o,...t})}ay.displayName="Tiptap.Content";Object.assign(ly,{Content:ay});var q5=Object.defineProperty,Y5=(t,o,a)=>o in t?q5(t,o,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[o]=a,Er=(t,o,a)=>Y5(t,typeof o!="symbol"?o+"":o,a);const ry=S.createContext(void 0);function Mn(t){return S.useContext(ry)}const iy=S.createContext(void 0);function ue(){return S.useContext(iy)}function pe(t){const o=Mn();if(!(o!=null&&o.editor))throw new Error("useBlockNoteEditor was called outside of a BlockNoteContext provider or BlockNoteView component");return o.editor}function Se(){return Mn().editor.dictionary}const X5=t=>{const o=ue(),a=Se(),r=pe(),s=r.getBlock(t.blockId),[c,f]=S.useState(""),d=S.useCallback(v=>{f(v.currentTarget.value)},[]),p=S.useCallback(v=>{v.key==="Enter"&&!v.nativeEvent.isComposing&&(v.preventDefault(),r.updateBlock(s.id,{props:{name:Lg(c),url:c}}))},[r,s.id,c]),h=S.useCallback(()=>{r.updateBlock(s.id,{props:{name:Lg(c),url:c}})},[r,s.id,c]);return g.jsxs(o.FilePanel.TabPanel,{className:"bn-tab-panel",children:[g.jsx(o.FilePanel.TextInput,{className:"bn-text-input",placeholder:a.file_panel.embed.url_placeholder,value:c,onChange:d,onKeyDown:p,"data-test":"embed-input"}),g.jsx(o.FilePanel.Button,{className:"bn-button",onClick:h,"data-test":"embed-input-button",children:a.file_panel.embed.embed_button[s.type]||a.file_panel.embed.embed_button.file})]})},P5=t=>{var o,a;const r=ue(),s=Se(),{setLoading:c}=t,f=pe(),d=f.getBlock(t.blockId),[p,h]=S.useState(!1);S.useEffect(()=>{p&&setTimeout(()=>{h(!1)},3e3)},[p]);const v=S.useCallback(C=>{if(C===null)return;async function T(w){if(c(!0),f.uploadFile!==void 0)try{let M=await f.uploadFile(w,t.blockId);typeof M=="string"&&(M={props:{name:w.name,url:M}}),f.updateBlock(t.blockId,M)}catch{h(!0)}finally{c(!1)}}T(C)},[t.blockId,f,c]),y=f.schema.blockSpecs[d.type],x=(a=(o=y.implementation.meta)==null?void 0:o.fileBlockAccept)!=null&&a.length?y.implementation.meta.fileBlockAccept.join(","):"*/*";return g.jsxs(r.FilePanel.TabPanel,{className:"bn-tab-panel",children:[g.jsx(r.FilePanel.FileInput,{className:"bn-file-input","data-test":"upload-input",accept:x,placeholder:s.file_panel.upload.file_placeholder[d.type]||s.file_panel.upload.file_placeholder.file,value:null,onChange:v}),p&&g.jsx("div",{className:"bn-error-text",children:s.file_panel.upload.upload_error})]})},sy=t=>{const o=ue(),a=Se(),r=pe(),[s,c]=S.useState(!1),f=t.tabs??[...r.uploadFile!==void 0?[{name:a.file_panel.upload.title,tabPanel:g.jsx(P5,{blockId:t.blockId,setLoading:c})}]:[],{name:a.file_panel.embed.title,tabPanel:g.jsx(X5,{blockId:t.blockId})}],[d,p]=S.useState(t.defaultOpenTab||f[0].name);return g.jsx(o.FilePanel.Root,{className:"bn-panel",defaultOpenTab:d,openTab:d,setOpenTab:p,tabs:f,loading:s})};function Q5(t){let o=new DOMRect;const a="getBoundingClientRect"in t?()=>t.getBoundingClientRect():()=>t.element.getBoundingClientRect();return()=>"element"in t&&(t.cacheMountedBoundingClientRect??!0)?(t.element.isConnected&&(o=a()),o):a()}const Bn=t=>{var o,a,r;const{refs:s,floatingStyles:c,context:f}=Ws({whileElementsMounted:js,...t.useFloatingOptions}),{isMounted:d,styles:p}=M5(f,t.useTransitionStylesProps),{status:h}=Jv(f,t.useTransitionStatusProps),v=Kv(f,t.useDismissProps),y=Qv(f,{enabled:!1,...t.useHoverProps}),{getFloatingProps:x}=Fv([v,y]),C=S.useRef(""),T=S.useRef(null),w=r5([T,s.setFloating]);if(S.useEffect(()=>{if(t.reference){const R="element"in t.reference?t.reference.element:void 0;R!==void 0&&s.setReference(R),s.setPositionReference({getBoundingClientRect:Q5(t.reference),contextElement:R})}},[t.reference,s]),S.useEffect(()=>{var R;(h==="initial"||h==="open")&&(R=T.current)!=null&&R.innerHTML&&(C.current=T.current.innerHTML)},[h,t.reference,t.children]),!d)return!1;const M={...t.elementProps,style:{display:"flex",...(o=t.elementProps)==null?void 0:o.style,zIndex:`calc(var(--bn-ui-base-z-index) + ${((r=(a=t.elementProps)==null?void 0:a.style)==null?void 0:r.zIndex)||0})`,...c,...p},...x()};return h==="close"?g.jsx("div",{ref:w,...M,dangerouslySetInnerHTML:{__html:C.current}}):g.jsx("div",{ref:w,...M,children:t.children})},cy=t=>{const{blockId:o,children:a,...r}=t,s=pe(),c=S.useMemo(()=>s.transact(f=>{if(!o)return;const d=gv(o,f.doc);if(!d)return;const{node:p}=s.prosemirrorView.domAtPos(d.posBeforeNode+1);if(p instanceof Element)return{element:p}}),[s,o]);return g.jsx(Bn,{reference:c,...r,children:o!==void 0&&a})};function Ae(t,o){const a=(o?.editor??pe()).getExtension(t);if(!a)throw new Error("Extension not found",{cause:{plugin:t}});return a}function qe(t,o){const{store:a}=Ae(t,o);if(!a)throw new Error("Store not found on plugin",{cause:{plugin:t}});return _5(a,o?.selector)}const I5=t=>{const o=pe(),a=Ae(Ed),r=qe(Ed),s=S.useMemo(()=>{var f,d;return{...t.floatingUIOptions,useFloatingOptions:{open:!!r,onOpenChange:(p,h,v)=>{p||a.closeMenu(),v==="escape-key"&&o.focus()},middleware:[mn(10),yo()],...(f=t.floatingUIOptions)==null?void 0:f.useFloatingOptions},elementProps:{style:{zIndex:90},...(d=t.floatingUIOptions)==null?void 0:d.elementProps}}},[r,o,a,t.floatingUIOptions]),c=t.filePanel||sy;return g.jsx(cy,{blockId:r,...s,children:r&&g.jsx(c,{blockId:r})})};function K5(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var F5=function t(o,a){if(o===a)return!0;if(o&&a&&typeof o=="object"&&typeof a=="object"){if(o.constructor!==a.constructor)return!1;var r,s,c;if(Array.isArray(o)){if(r=o.length,r!=a.length)return!1;for(s=r;s--!==0;)if(!t(o[s],a[s]))return!1;return!0}if(o instanceof Map&&a instanceof Map){if(o.size!==a.size)return!1;for(s of o.entries())if(!a.has(s[0]))return!1;for(s of o.entries())if(!t(s[1],a.get(s[0])))return!1;return!0}if(o instanceof Set&&a instanceof Set){if(o.size!==a.size)return!1;for(s of o.entries())if(!a.has(s[0]))return!1;return!0}if(ArrayBuffer.isView(o)&&ArrayBuffer.isView(a)){if(r=o.length,r!=a.length)return!1;for(s=r;s--!==0;)if(o[s]!==a[s])return!1;return!0}if(o.constructor===RegExp)return o.source===a.source&&o.flags===a.flags;if(o.valueOf!==Object.prototype.valueOf)return o.valueOf()===a.valueOf();if(o.toString!==Object.prototype.toString)return o.toString()===a.toString();if(c=Object.keys(o),r=c.length,r!==Object.keys(a).length)return!1;for(s=r;s--!==0;)if(!Object.prototype.hasOwnProperty.call(a,c[s]))return!1;for(s=r;s--!==0;){var f=c[s];if(!(f==="_owner"&&o.$$typeof)&&!t(o[f],a[f]))return!1}return!0}return o!==o&&a!==a};const J5=K5(F5);var uy={exports:{}},id={},_0={exports:{}},sd={};var O0;function W5(){if(O0)return sd;O0=1;var t=Ve;function o(y,x){return y===x&&(y!==0||1/y===1/x)||y!==y&&x!==x}var a=typeof Object.is=="function"?Object.is:o,r=t.useState,s=t.useEffect,c=t.useLayoutEffect,f=t.useDebugValue;function d(y,x){var C=x(),T=r({inst:{value:C,getSnapshot:x}}),w=T[0].inst,M=T[1];return c(function(){w.value=C,w.getSnapshot=x,p(w)&&M({inst:w})},[y,C,x]),s(function(){return p(w)&&M({inst:w}),y(function(){p(w)&&M({inst:w})})},[y]),f(C),C}function p(y){var x=y.getSnapshot;y=y.value;try{var C=x();return!a(y,C)}catch{return!0}}function h(y,x){return x()}var v=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:d;return sd.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:v,sd}var N0;function e3(){return N0||(N0=1,_0.exports=W5()),_0.exports}var A0;function t3(){if(A0)return id;A0=1;var t=Ve,o=e3();function a(h,v){return h===v&&(h!==0||1/h===1/v)||h!==h&&v!==v}var r=typeof Object.is=="function"?Object.is:a,s=o.useSyncExternalStore,c=t.useRef,f=t.useEffect,d=t.useMemo,p=t.useDebugValue;return id.useSyncExternalStoreWithSelector=function(h,v,y,x,C){var T=c(null);if(T.current===null){var w={hasValue:!1,value:null};T.current=w}else w=T.current;T=d(function(){function R(L){if(!_){if(_=!0,N=L,L=x(L),C!==void 0&&w.hasValue){var Z=w.value;if(C(Z,L))return A=Z}return A=L}if(Z=A,r(N,L))return Z;var I=x(L);return C!==void 0&&C(Z,I)?(N=L,Z):(N=L,A=I)}var _=!1,N,A,H=y===void 0?null:y;return[function(){return R(v())},H===null?void 0:function(){return R(H())}]},[v,y,x,C]);var M=s(h,T[0],T[1]);return f(function(){w.hasValue=!0,w.value=M},[M]),p(M),M},id}uy.exports=t3();var n3=uy.exports;const o3=typeof window<"u"?S.useLayoutEffect:S.useEffect;class l3{constructor(o){Er(this,"transactionNumber",0),Er(this,"lastTransactionNumber",0),Er(this,"lastSnapshot"),Er(this,"editor"),Er(this,"subscribers",new Set),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,a){if(this.editor=o,this.editor){const r=()=>{this.transactionNumber+=1,this.subscribers.forEach(f=>f())},s=this.editor._tiptapEditor,c={all:"transaction",selection:"selectionUpdate",change:"update"};return s.on(c[a],r),()=>{s.off(c[a],r)}}}}function gt(t){const o=Mn(),a=t.editor||o?.editor||null,r=t.on||"all",[s]=S.useState(()=>new l3(a)),c=n3.useSyncExternalStoreWithSelector(s.subscribe,s.getSnapshot,s.getServerSnapshot,t.selector,t.equalityFn??J5);return o3(()=>s.watch(a,r),[a,s,r]),S.useDebugValue(c),c}const Id=t=>{const{position:o,children:a,...r}=t,{from:s,to:c}=o||{},f=pe(),d=S.useMemo(()=>{var p;if(!(s===void 0||c===void 0))return{element:((p=f.domElement)==null?void 0:p.firstElementChild)||void 0,getBoundingClientRect:()=>wS(f.prosemirrorView,s,c??s)}},[f,s,c]);return g.jsx(Bn,{reference:d,...r,children:o!==void 0&&a})};var fy={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},D0=Ve.createContext&&Ve.createContext(fy),a3=["attr","size","title"];function r3(t,o){if(t==null)return{};var a=i3(t,o),r,s;if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(t);for(s=0;s<c.length;s++)r=c[s],!(o.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(a[r]=t[r])}return a}function i3(t,o){if(t==null)return{};var a={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(o.indexOf(r)>=0)continue;a[r]=t[r]}return a}function Ns(){return Ns=Object.assign?Object.assign.bind():function(t){for(var o=1;o<arguments.length;o++){var a=arguments[o];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(t[r]=a[r])}return t},Ns.apply(this,arguments)}function H0(t,o){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);o&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),a.push.apply(a,r)}return a}function As(t){for(var o=1;o<arguments.length;o++){var a=arguments[o]!=null?arguments[o]:{};o%2?H0(Object(a),!0).forEach(function(r){s3(t,r,a[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):H0(Object(a)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(a,r))})}return t}function s3(t,o,a){return o=c3(o),o in t?Object.defineProperty(t,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[o]=a,t}function c3(t){var o=u3(t,"string");return typeof o=="symbol"?o:o+""}function u3(t,o){if(typeof t!="object"||!t)return t;var a=t[Symbol.toPrimitive];if(a!==void 0){var r=a.call(t,o);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(o==="string"?String:Number)(t)}function dy(t){return t&&t.map((o,a)=>Ve.createElement(o.tag,As({key:a},o.attr),dy(o.child)))}function fe(t){return o=>Ve.createElement(f3,Ns({attr:As({},t.attr)},o),dy(t.child))}function f3(t){var o=a=>{var{attr:r,size:s,title:c}=t,f=r3(t,a3),d=s||a.size||"1em",p;return a.className&&(p=a.className),t.className&&(p=(p?p+" ":"")+t.className),Ve.createElement("svg",Ns({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},a.attr,r,f,{className:p,style:As(As({color:t.color||a.color},a.style),t.style),height:d,width:d,xmlns:"http://www.w3.org/2000/svg"}),c&&Ve.createElement("title",null,c),t.children)};return D0!==void 0?Ve.createElement(D0.Consumer,null,a=>o(a)):o(fy)}function d3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8 7V11L2 6L8 1V5H13C17.4183 5 21 8.58172 21 13C21 17.4183 17.4183 21 13 21H4V19H13C16.3137 19 19 16.3137 19 13C19 9.68629 16.3137 7 13 7H8Z"},child:[]}]})(t)}function my(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M7.29117 20.8242L2 22L3.17581 16.7088C2.42544 15.3056 2 13.7025 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C10.2975 22 8.6944 21.5746 7.29117 20.8242ZM7.58075 18.711L8.23428 19.0605C9.38248 19.6745 10.6655 20 12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 13.3345 4.32549 14.6175 4.93949 15.7657L5.28896 16.4192L4.63416 19.3658L7.58075 18.711Z"},child:[]}]})(t)}function m3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M7.24264 17.9967H3V13.754L14.435 2.319C14.8256 1.92848 15.4587 1.92848 15.8492 2.319L18.6777 5.14743C19.0682 5.53795 19.0682 6.17112 18.6777 6.56164L7.24264 17.9967ZM3 19.9967H21V21.9967H3V19.9967Z"},child:[]}]})(t)}function p3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M23 12L15.9289 19.0711L14.5147 17.6569L20.1716 12L14.5147 6.34317L15.9289 4.92896L23 12ZM3.82843 12L9.48528 17.6569L8.07107 19.0711L1 12L8.07107 4.92896L9.48528 6.34317L3.82843 12Z"},child:[]}]})(t)}function h3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 8L9.00319 2H19.9978C20.5513 2 21 2.45531 21 2.9918V21.0082C21 21.556 20.5551 22 20.0066 22H3.9934C3.44476 22 3 21.5501 3 20.9932V8ZM10 4V9H5V20H19V4H10Z"},child:[]}]})(t)}function g3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 4H21V6H3V4ZM5 19H19V21H5V19ZM3 14H21V16H3V14ZM5 9H19V11H5V9Z"},child:[]}]})(t)}function v3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 4H21V6H3V4ZM3 19H21V21H3V19ZM3 14H21V16H3V14ZM3 9H21V11H3V9Z"},child:[]}]})(t)}function y3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 4H21V6H3V4ZM3 19H17V21H3V19ZM3 14H21V16H3V14ZM3 9H17V11H3V9Z"},child:[]}]})(t)}function b3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 4H21V6H3V4ZM7 19H21V21H7V19ZM3 14H21V16H3V14ZM7 9H21V11H7V9Z"},child:[]}]})(t)}function x3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8 11H12.5C13.8807 11 15 9.88071 15 8.5C15 7.11929 13.8807 6 12.5 6H8V11ZM18 15.5C18 17.9853 15.9853 20 13.5 20H6V4H12.5C14.9853 4 17 6.01472 17 8.5C17 9.70431 16.5269 10.7981 15.7564 11.6058C17.0979 12.3847 18 13.837 18 15.5ZM8 13V18H13.5C14.8807 18 16 16.8807 16 15.5C16 14.1193 14.8807 13 13.5 13H8Z"},child:[]}]})(t)}function S3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3.41436 5.99995L5.70726 3.70706L4.29304 2.29285L0.585938 5.99995L4.29304 9.70706L5.70726 8.29285L3.41436 5.99995ZM9.58594 5.99995L7.29304 3.70706L8.70726 2.29285L12.4144 5.99995L8.70726 9.70706L7.29304 8.29285L9.58594 5.99995ZM14.0002 2.99995H21.0002C21.5524 2.99995 22.0002 3.44767 22.0002 3.99995V20C22.0002 20.5522 21.5524 21 21.0002 21H3.00015C2.44787 21 2.00015 20.5522 2.00015 20V12H4.00015V19H20.0002V4.99995H14.0002V2.99995Z"},child:[]}]})(t)}function z0(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M5.55397 22H3.3999L10.9999 3H12.9999L20.5999 22H18.4458L16.0458 16H7.95397L5.55397 22ZM8.75397 14H15.2458L11.9999 5.88517L8.75397 14Z"},child:[]}]})(t)}function Ds(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M13 20H11V13H4V20H2V4H4V11H11V4H13V20ZM21.0005 8V20H19.0005L19 10.204L17 10.74V8.67L19.5005 8H21.0005Z"},child:[]}]})(t)}function Hs(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M4 4V11H11V4H13V20H11V13H4V20H2V4H4ZM18.5 8C20.5711 8 22.25 9.67893 22.25 11.75C22.25 12.6074 21.9623 13.3976 21.4781 14.0292L21.3302 14.2102L18.0343 18H22V20H15L14.9993 18.444L19.8207 12.8981C20.0881 12.5908 20.25 12.1893 20.25 11.75C20.25 10.7835 19.4665 10 18.5 10C17.5818 10 16.8288 10.7071 16.7558 11.6065L16.75 11.75H14.75C14.75 9.67893 16.4289 8 18.5 8Z"},child:[]}]})(t)}function zs(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M22 8L21.9984 10L19.4934 12.883C21.0823 13.3184 22.25 14.7728 22.25 16.5C22.25 18.5711 20.5711 20.25 18.5 20.25C16.674 20.25 15.1528 18.9449 14.8184 17.2166L16.7821 16.8352C16.9384 17.6413 17.6481 18.25 18.5 18.25C19.4665 18.25 20.25 17.4665 20.25 16.5C20.25 15.5335 19.4665 14.75 18.5 14.75C18.214 14.75 17.944 14.8186 17.7056 14.9403L16.3992 13.3932L19.3484 10H15V8H22ZM4 4V11H11V4H13V20H11V13H4V20H2V4H4Z"},child:[]}]})(t)}function py(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M13 20H11V13H4V20H2V4H4V11H11V4H13V20ZM22 8V16H23.5V18H22V20H20V18H14.5V16.66L19.5 8H22ZM20 11.133L17.19 16H20V11.133Z"},child:[]}]})(t)}function hy(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M22 8V10H17.6769L17.2126 12.6358C17.5435 12.5472 17.8912 12.5 18.25 12.5C20.4591 12.5 22.25 14.2909 22.25 16.5C22.25 18.7091 20.4591 20.5 18.25 20.5C16.4233 20.5 14.8827 19.2756 14.4039 17.6027L16.3271 17.0519C16.5667 17.8881 17.3369 18.5 18.25 18.5C19.3546 18.5 20.25 17.6046 20.25 16.5C20.25 15.3954 19.3546 14.5 18.25 14.5C17.6194 14.5 17.057 14.7918 16.6904 15.2478L14.8803 14.3439L16 8H22ZM4 4V11H11V4H13V20H11V13H4V20H2V4H4Z"},child:[]}]})(t)}function gy(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M21.097 8L18.499 12.5C20.7091 12.5 22.5 14.2909 22.5 16.5C22.5 18.7091 20.7091 20.5 18.5 20.5C16.2909 20.5 14.5 18.7091 14.5 16.5C14.5 15.7636 14.699 15.0737 15.0461 14.4811L18.788 8H21.097ZM4 4V11H11V4H13V20H11V13H4V20H2V4H4ZM18.5 14.5C17.3954 14.5 16.5 15.3954 16.5 16.5C16.5 17.6046 17.3954 18.5 18.5 18.5C19.6046 18.5 20.5 17.6046 20.5 16.5C20.5 15.3954 19.6046 14.5 18.5 14.5Z"},child:[]}]})(t)}function C3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 4H21V6H3V4ZM3 19H21V21H3V19ZM11 14H21V16H11V14ZM11 9H21V11H11V9ZM3 12.5L7 9V16L3 12.5Z"},child:[]}]})(t)}function w3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 4H21V6H3V4ZM3 19H21V21H3V19ZM11 14H21V16H11V14ZM11 9H21V11H11V9ZM7 12.5L3 16V9L7 12.5Z"},child:[]}]})(t)}function L0(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8 5H11V19H8V21H16V19H13V5H16V3H8V5ZM2 7C1.44772 7 1 7.44772 1 8V16C1 16.5523 1.44772 17 2 17H8V15H3V9H8V7H2ZM16 9H21V15H16V17H22C22.5523 17 23 16.5523 23 16V8C23 7.44772 22.5523 7 22 7H16V9Z"},child:[]}]})(t)}function T3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M15 20H7V18H9.92661L12.0425 6H9V4H17V6H14.0734L11.9575 18H15V20Z"},child:[]}]})(t)}function E3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M17 17H22V19H19V22H17V17ZM7 7H2V5H5V2H7V7ZM18.364 15.5355L16.9497 14.1213L18.364 12.7071C20.3166 10.7545 20.3166 7.58866 18.364 5.63604C16.4113 3.68342 13.2455 3.68342 11.2929 5.63604L9.87868 7.05025L8.46447 5.63604L9.87868 4.22183C12.6123 1.48816 17.0445 1.48816 19.7782 4.22183C22.5118 6.9555 22.5118 11.3877 19.7782 14.1213L18.364 15.5355ZM15.5355 18.364L14.1213 19.7782C11.3877 22.5118 6.9555 22.5118 4.22183 19.7782C1.48816 17.0445 1.48816 12.6123 4.22183 9.87868L5.63604 8.46447L7.05025 9.87868L5.63604 11.2929C3.68342 13.2455 3.68342 16.4113 5.63604 18.364C7.58866 20.3166 10.7545 20.3166 12.7071 18.364L14.1213 16.9497L15.5355 18.364ZM14.8284 7.75736L16.2426 9.17157L9.17157 16.2426L7.75736 14.8284L14.8284 7.75736Z"},child:[]}]})(t)}function vy(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M18.3638 15.5355L16.9496 14.1213L18.3638 12.7071C20.3164 10.7545 20.3164 7.58866 18.3638 5.63604C16.4112 3.68341 13.2453 3.68341 11.2927 5.63604L9.87849 7.05025L8.46428 5.63604L9.87849 4.22182C12.6122 1.48815 17.0443 1.48815 19.778 4.22182C22.5117 6.95549 22.5117 11.3876 19.778 14.1213L18.3638 15.5355ZM15.5353 18.364L14.1211 19.7782C11.3875 22.5118 6.95531 22.5118 4.22164 19.7782C1.48797 17.0445 1.48797 12.6123 4.22164 9.87868L5.63585 8.46446L7.05007 9.87868L5.63585 11.2929C3.68323 13.2455 3.68323 16.4113 5.63585 18.364C7.58847 20.3166 10.7543 20.3166 12.7069 18.364L14.1211 16.9497L15.5353 18.364ZM14.8282 7.75736L16.2425 9.17157L9.17139 16.2426L7.75717 14.8284L14.8282 7.75736Z"},child:[]}]})(t)}function yy(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8.00008 6V9H5.00008V6H8.00008ZM3.00008 4V11H10.0001V4H3.00008ZM13.0001 4H21.0001V6H13.0001V4ZM13.0001 11H21.0001V13H13.0001V11ZM13.0001 18H21.0001V20H13.0001V18ZM10.7072 16.2071L9.29297 14.7929L6.00008 18.0858L4.20718 16.2929L2.79297 17.7071L6.00008 20.9142L10.7072 16.2071Z"},child:[]}]})(t)}function by(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8 4H21V6H8V4ZM5 3V6H6V7H3V6H4V4H3V3H5ZM3 14V11.5H5V11H3V10H6V12.5H4V13H6V14H3ZM5 19.5H3V18.5H5V18H3V17H6V21H3V20H5V19.5ZM8 11H21V13H8V11ZM8 18H21V20H8V18Z"},child:[]}]})(t)}function xy(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8 4H21V6H8V4ZM4.5 6.5C3.67157 6.5 3 5.82843 3 5C3 4.17157 3.67157 3.5 4.5 3.5C5.32843 3.5 6 4.17157 6 5C6 5.82843 5.32843 6.5 4.5 6.5ZM4.5 13.5C3.67157 13.5 3 12.8284 3 12C3 11.1716 3.67157 10.5 4.5 10.5C5.32843 10.5 6 11.1716 6 12C6 12.8284 5.32843 13.5 4.5 13.5ZM4.5 20.4C3.67157 20.4 3 19.7284 3 18.9C3 18.0716 3.67157 17.4 4.5 17.4C5.32843 17.4 6 18.0716 6 18.9C6 19.7284 5.32843 20.4 4.5 20.4ZM8 11H21V13H8V11ZM8 18H21V20H8V18Z"},child:[]}]})(t)}function M3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M20 3C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3H20ZM11 5H5V10.999H7V9L10 12L7 15V13H5V19H11V17H13V19H19V13H17V15L14 12L17 9V10.999H19V5H13V7H11V5ZM13 13V15H11V13H13ZM13 9V11H11V9H13Z"},child:[]}]})(t)}function R3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M21 20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3H20C20.5523 3 21 3.44772 21 4V20ZM19 11V5H13.001V7H15L12 10L9 7H11V5H5V11H7V13H5V19H11V17H9L12 14L15 17H13.001V19H19V13H17V11H19ZM11 13H9V11H11V13ZM15 13H13V11H15V13Z"},child:[]}]})(t)}function Sy(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M21 4H3V6H21V4ZM21 11H8V13H21V11ZM21 18H8V20H21V18ZM5 11H3V20H5V11Z"},child:[]}]})(t)}function j3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M17.1538 14C17.3846 14.5161 17.5 15.0893 17.5 15.7196C17.5 17.0625 16.9762 18.1116 15.9286 18.867C14.8809 19.6223 13.4335 20 11.5862 20C9.94674 20 8.32335 19.6185 6.71592 18.8555V16.6009C8.23538 17.4783 9.7908 17.917 11.3822 17.917C13.9333 17.917 15.2128 17.1846 15.2208 15.7196C15.2208 15.0939 15.0049 14.5598 14.5731 14.1173C14.5339 14.0772 14.4939 14.0381 14.4531 14H3V12H21V14H17.1538ZM13.076 11H7.62908C7.4566 10.8433 7.29616 10.6692 7.14776 10.4778C6.71592 9.92084 6.5 9.24559 6.5 8.45207C6.5 7.21602 6.96583 6.165 7.89749 5.299C8.82916 4.43299 10.2706 4 12.2219 4C13.6934 4 15.1009 4.32808 16.4444 4.98426V7.13591C15.2448 6.44921 13.9293 6.10587 12.4978 6.10587C10.0187 6.10587 8.77917 6.88793 8.77917 8.45207C8.77917 8.87172 8.99709 9.23796 9.43293 9.55079C9.86878 9.86362 10.4066 10.1135 11.0463 10.3004C11.6665 10.4816 12.3431 10.7148 13.076 11H13.076Z"},child:[]}]})(t)}function _3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M13 10V14H19V10H13ZM11 10H5V14H11V10ZM13 19H19V16H13V19ZM11 19V16H5V19H11ZM13 5V8H19V5H13ZM11 5H5V8H11V5ZM4 3H20C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3Z"},child:[]}]})(t)}function Kd(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M13 6V21H11V6H5V4H19V6H13Z"},child:[]}]})(t)}function O3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8 3V12C8 14.2091 9.79086 16 12 16C14.2091 16 16 14.2091 16 12V3H18V12C18 15.3137 15.3137 18 12 18C8.68629 18 6 15.3137 6 12V3H8ZM4 20H20V22H4V20Z"},child:[]}]})(t)}function N3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M2 3.9934C2 3.44476 2.45531 3 2.9918 3H21.0082C21.556 3 22 3.44495 22 3.9934V20.0066C22 20.5552 21.5447 21 21.0082 21H2.9918C2.44405 21 2 20.5551 2 20.0066V3.9934ZM8 5V19H16V5H8ZM4 5V7H6V5H4ZM18 5V7H20V5H18ZM4 9V11H6V9H4ZM18 9V11H20V9H18ZM4 13V15H6V13H4ZM18 13V15H20V13H18ZM4 17V19H6V17H4ZM18 17V19H20V17H18Z"},child:[]}]})(t)}function A3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M5 11.1005L7 9.1005L12.5 14.6005L16 11.1005L19 14.1005V5H5V11.1005ZM4 3H20C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3ZM15.5 10C14.6716 10 14 9.32843 14 8.5C14 7.67157 14.6716 7 15.5 7C16.3284 7 17 7.67157 17 8.5C17 9.32843 16.3284 10 15.5 10Z"},child:[]}]})(t)}function D3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M21 15V18H24V20H21V23H19V20H16V18H19V15H21ZM21.0082 3C21.556 3 22 3.44495 22 3.9934L22.0007 13.3417C21.3749 13.1204 20.7015 13 20 13V5H4L4.001 19L13.2929 9.70715C13.6528 9.34604 14.22 9.31823 14.6123 9.62322L14.7065 9.70772L18.2521 13.2586C15.791 14.0069 14 16.2943 14 19C14 19.7015 14.1204 20.3749 14.3417 21.0007L2.9918 21C2.44405 21 2 20.5551 2 20.0066V3.9934C2 3.44476 2.45531 3 2.9918 3H21.0082ZM8 7C9.10457 7 10 7.89543 10 9C10 10.1046 9.10457 11 8 11C6.89543 11 6 10.1046 6 9C6 7.89543 6.89543 7 8 7Z"},child:[]}]})(t)}function H3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M20 3C20.5523 3 21 3.44772 21 4V5.757L19 7.757V5H5V13.1L9 9.1005L13.328 13.429L12.0012 14.7562L11.995 18.995L16.2414 19.0012L17.571 17.671L18.8995 19H19V16.242L21 14.242V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3H20ZM21.7782 7.80761L23.1924 9.22183L15.4142 17L13.9979 16.9979L14 15.5858L21.7782 7.80761ZM15.5 7C16.3284 7 17 7.67157 17 8.5C17 9.32843 16.3284 10 15.5 10C14.6716 10 14 9.32843 14 8.5C14 7.67157 14.6716 7 15.5 7Z"},child:[]}]})(t)}function Cy(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M22 18V20H2V18H22ZM2 3.5L10 8.5L2 13.5V3.5ZM22 11V13H12V11H22ZM22 4V6H12V4H22Z"},child:[]}]})(t)}function z3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M2 16.0001H5.88889L11.1834 20.3319C11.2727 20.405 11.3846 20.4449 11.5 20.4449C11.7761 20.4449 12 20.2211 12 19.9449V4.05519C12 3.93977 11.9601 3.8279 11.887 3.73857C11.7121 3.52485 11.3971 3.49335 11.1834 3.66821L5.88889 8.00007H2C1.44772 8.00007 1 8.44778 1 9.00007V15.0001C1 15.5524 1.44772 16.0001 2 16.0001ZM23 12C23 15.292 21.5539 18.2463 19.2622 20.2622L17.8445 18.8444C19.7758 17.1937 21 14.7398 21 12C21 9.26016 19.7758 6.80629 17.8445 5.15557L19.2622 3.73779C21.5539 5.75368 23 8.70795 23 12ZM18 12C18 10.0883 17.106 8.38548 15.7133 7.28673L14.2842 8.71584C15.3213 9.43855 16 10.64 16 12C16 13.36 15.3213 14.5614 14.2842 15.2841L15.7133 16.7132C17.106 15.6145 18 13.9116 18 12Z"},child:[]}]})(t)}function L3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M11 11V5H13V11H19V13H13V19H11V13H5V11H11Z"},child:[]}]})(t)}function V3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M9.9997 15.1709L19.1921 5.97852L20.6063 7.39273L9.9997 17.9993L3.63574 11.6354L5.04996 10.2212L9.9997 15.1709Z"},child:[]}]})(t)}function k3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M17 6H22V8H20V21C20 21.5523 19.5523 22 19 22H5C4.44772 22 4 21.5523 4 21V8H2V6H7V3C7 2.44772 7.44772 2 8 2H16C16.5523 2 17 2.44772 17 3V6ZM18 8H6V20H18V8ZM9 4V6H15V4H9Z"},child:[]}]})(t)}function B3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M17 6H22V8H20V21C20 21.5523 19.5523 22 19 22H5C4.44772 22 4 21.5523 4 21V8H2V6H7V3C7 2.44772 7.44772 2 8 2H16C16.5523 2 17 2.44772 17 3V6ZM9 11V17H11V11H9ZM13 11V17H15V11H13ZM9 4V6H15V4H9Z"},child:[]}]})(t)}function U3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M4 19H20V12H22V20C22 20.5523 21.5523 21 21 21H3C2.44772 21 2 20.5523 2 20V12H4V19ZM14 9H19L12 16L5 9H10V3H14V9Z"},child:[]}]})(t)}function $3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M10 6V8H5V19H16V14H18V20C18 20.5523 17.5523 21 17 21H4C3.44772 21 3 20.5523 3 20V7C3 6.44772 3.44772 6 4 6H10ZM21 3V12L17.206 8.207L11.2071 14.2071L9.79289 12.7929L15.792 6.793L12 3H21Z"},child:[]}]})(t)}function G3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M5 10C3.9 10 3 10.9 3 12C3 13.1 3.9 14 5 14C6.1 14 7 13.1 7 12C7 10.9 6.1 10 5 10ZM19 10C17.9 10 17 10.9 17 12C17 13.1 17.9 14 19 14C20.1 14 21 13.1 21 12C21 10.9 20.1 10 19 10ZM12 10C10.9 10 10 10.9 10 12C10 13.1 10.9 14 12 14C13.1 14 14 13.1 14 12C14 10.9 13.1 10 12 10Z"},child:[]}]})(t)}function Z3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M5 11V13H19V11H5Z"},child:[]}]})(t)}function q3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM8 13C8 15.2091 9.79086 17 12 17C14.2091 17 16 15.2091 16 13H8ZM8 11C8.82843 11 9.5 10.3284 9.5 9.5C9.5 8.67157 8.82843 8 8 8C7.17157 8 6.5 8.67157 6.5 9.5C6.5 10.3284 7.17157 11 8 11ZM16 11C16.8284 11 17.5 10.3284 17.5 9.5C17.5 8.67157 16.8284 8 16 8C15.1716 8 14.5 8.67157 14.5 9.5C14.5 10.3284 15.1716 11 16 11Z"},child:[]}]})(t)}function V0(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM8 13H16C16 15.2091 14.2091 17 12 17C9.79086 17 8 15.2091 8 13ZM8 11C7.17157 11 6.5 10.3284 6.5 9.5C6.5 8.67157 7.17157 8 8 8C8.82843 8 9.5 8.67157 9.5 9.5C9.5 10.3284 8.82843 11 8 11ZM16 11C15.1716 11 14.5 10.3284 14.5 9.5C14.5 8.67157 15.1716 8 16 8C16.8284 8 17.5 8.67157 17.5 9.5C17.5 10.3284 16.8284 11 16 11Z"},child:[]}]})(t)}const Y3={bold:x3,italic:T3,underline:O3,strike:j3,code:p3};function X3(t,o){return t in o.schema.styleSchema&&o.schema.styleSchema[t].type===t&&o.schema.styleSchema[t].propSchema==="boolean"}const ms=t=>{const o=Se(),a=ue(),r=pe(),s=gt({editor:r,selector:({editor:d})=>{var p;if(!(!d.isEditable||!X3(t.basicTextStyle,d)||!(((p=d.getSelection())==null?void 0:p.blocks)||[d.getTextCursorPosition().block]).find(h=>h.content!==void 0)))return t.basicTextStyle in d.getActiveStyles()?{active:!0}:{active:!1}}}),c=S.useCallback(d=>{r.focus(),r.toggleStyles({[d]:!0})},[r,t]);if(s===void 0)return null;const f=Y3[t.basicTextStyle];return g.jsx(a.FormattingToolbar.Button,{className:"bn-button","data-test":t.basicTextStyle,onClick:()=>c(t.basicTextStyle),isSelected:s.active,label:o.formatting_toolbar[t.basicTextStyle].tooltip,mainTooltip:o.formatting_toolbar[t.basicTextStyle].tooltip,secondaryTooltip:Ys(o.formatting_toolbar[t.basicTextStyle].secondary_tooltip,o.generic.ctrl_shortcut),icon:g.jsx(f,{})})},Ad=t=>{const o=t.textColor||"default",a=t.backgroundColor||"default",r=t.size||16,s=S.useMemo(()=>({pointerEvents:"none",fontSize:(r*.75).toString()+"px",height:r.toString()+"px",lineHeight:r.toString()+"px",textAlign:"center",width:r.toString()+"px"}),[r]);return g.jsx("div",{className:"bn-color-icon","data-background-color":a,"data-text-color":o,style:s,children:"A"})},k0=["default","gray","brown","red","orange","yellow","green","blue","purple","pink"],ec=t=>{const o=ue(),a=Se();return g.jsxs(g.Fragment,{children:[g.jsx(()=>t.text?g.jsxs(g.Fragment,{children:[g.jsx(o.Generic.Menu.Label,{children:a.color_picker.text_title}),k0.map(r=>g.jsx(o.Generic.Menu.Item,{onClick:()=>{t.onClick&&t.onClick(),t.text.setColor(r)},"data-test":"text-color-"+r,icon:g.jsx(Ad,{textColor:r,size:t.iconSize}),checked:t.text.color===r,children:a.color_picker.colors[r]},"text-color-"+r))]}):null,{}),g.jsx(()=>t.background?g.jsxs(g.Fragment,{children:[g.jsx(o.Generic.Menu.Label,{children:a.color_picker.background_title}),k0.map(r=>g.jsx(o.Generic.Menu.Item,{onClick:()=>{t.onClick&&t.onClick(),t.background.setColor(r)},"data-test":"background-color-"+r,icon:g.jsx(Ad,{backgroundColor:r,size:t.iconSize}),checked:t.background.color===r,children:a.color_picker.colors[r]},"background-color-"+r))]}):null,{})]})};function ps(t,o){return`${t}Color`in o.schema.styleSchema&&o.schema.styleSchema[`${t}Color`].type===`${t}Color`&&o.schema.styleSchema[`${t}Color`].propSchema==="string"}const P3=()=>{const t=ue(),o=Se(),a=pe(),r=ps("text",a),s=ps("background",a),c=gt({editor:a,selector:({editor:p})=>{var h;if(!p.isEditable||!(((h=p.getSelection())==null?void 0:h.blocks)||[p.getTextCursorPosition().block]).find(x=>x.content!==void 0))return;const v=ps("text",p),y=ps("background",p);if(!(!v&&!y))return{textColor:v?p.getActiveStyles().textColor||"default":void 0,backgroundColor:y?p.getActiveStyles().backgroundColor||"default":void 0}}}),f=S.useCallback(p=>{if(!r)throw Error("Tried to set text color, but style does not exist in editor schema.");p==="default"?a.removeStyles({textColor:p}):a.addStyles({textColor:p}),setTimeout(()=>{a.focus()})},[a,r]),d=S.useCallback(p=>{if(!s)throw Error("Tried to set background color, but style does not exist in editor schema.");p==="default"?a.removeStyles({backgroundColor:p}):a.addStyles({backgroundColor:p}),setTimeout(()=>{a.focus()})},[s,a]);return c===void 0?null:g.jsxs(t.Generic.Menu.Root,{children:[g.jsx(t.Generic.Menu.Trigger,{children:g.jsx(t.FormattingToolbar.Button,{className:"bn-button","data-test":"colors",label:o.formatting_toolbar.colors.tooltip,mainTooltip:o.formatting_toolbar.colors.tooltip,icon:g.jsx(Ad,{textColor:c.textColor,backgroundColor:c.backgroundColor,size:20})})}),g.jsx(t.Generic.Menu.Dropdown,{className:"bn-menu-dropdown bn-color-picker-dropdown",children:g.jsx(ec,{text:c.textColor?{color:c.textColor,setColor:f}:void 0,background:c.backgroundColor?{color:c.backgroundColor,setColor:d}:void 0})})]})},B0=t=>{for(const o of ES)if(t.startsWith(o))return t;return`${MS}://${t}`},wy=t=>{const o=ue(),a=Se(),{editLink:r}=Ae(Xs),{url:s,text:c,showTextField:f}=t,[d,p]=S.useState(s),[h,v]=S.useState(c);S.useEffect(()=>{p(s),v(c)},[c,s]);const y=S.useCallback(w=>{var M,R;w.key==="Enter"&&!w.nativeEvent.isComposing&&(w.preventDefault(),r(B0(d),h,t.range.from),(M=t.setToolbarOpen)==null||M.call(t,!1),(R=t.setToolbarPositionFrozen)==null||R.call(t,!1))},[r,d,h,t]),x=S.useCallback(w=>p(w.currentTarget.value),[]),C=S.useCallback(w=>v(w.currentTarget.value),[]),T=S.useCallback(()=>{var w,M;r(B0(d),h,t.range.from),(w=t.setToolbarOpen)==null||w.call(t,!1),(M=t.setToolbarPositionFrozen)==null||M.call(t,!1)},[r,d,h,t]);return g.jsxs(o.Generic.Form.Root,{children:[g.jsx(o.Generic.Form.TextInput,{className:"bn-text-input",name:"url",icon:g.jsx(vy,{}),autoFocus:!0,placeholder:a.link_toolbar.form.url_placeholder,value:d,onKeyDown:y,onChange:x,onSubmit:T}),f!==!1&&g.jsx(o.Generic.Form.TextInput,{className:"bn-text-input",name:"title",icon:g.jsx(Kd,{}),placeholder:a.link_toolbar.form.title_placeholder,value:h,onKeyDown:y,onChange:C,onSubmit:T})]})};function Q3(t){return"link"in t.schema.inlineContentSchema&&t.schema.inlineContentSchema.link==="link"}const I3=()=>{const t=pe(),o=ue(),a=Se(),r=Ae(Or),{showSelection:s}=Ae(Td),[c,f]=S.useState(!1);S.useEffect(()=>(s(c,"createLinkButton"),()=>s(!1,"createLinkButton")),[c,s]);const d=gt({editor:t,selector:({editor:p})=>{var h;if(!(!p.isEditable||!Q3(p)||TS(p.prosemirrorState.selection)||!(((h=p.getSelection())==null?void 0:h.blocks)||[p.getTextCursorPosition().block]).find(v=>v.content!==void 0)))return{url:p.getSelectedLinkUrl(),text:p.getSelectedText(),range:{from:p.prosemirrorState.selection.from,to:p.prosemirrorState.selection.to}}}});return S.useEffect(()=>{f(!1)},[d]),S.useEffect(()=>{const p=v=>{(v.ctrlKey||v.metaKey)&&v.key==="k"&&(f(!0),v.preventDefault())},h=t.domElement;return h?.addEventListener("keydown",p),()=>{h?.removeEventListener("keydown",p)}},[t.domElement]),d===void 0?null:g.jsxs(o.Generic.Popover.Root,{open:c,onOpenChange:f,children:[g.jsx(o.Generic.Popover.Trigger,{children:g.jsx(o.FormattingToolbar.Button,{className:"bn-button","data-test":"createLink",label:a.formatting_toolbar.link.tooltip,mainTooltip:a.formatting_toolbar.link.tooltip,secondaryTooltip:Ys(a.formatting_toolbar.link.secondary_tooltip,a.generic.ctrl_shortcut),icon:g.jsx(vy,{}),onClick:()=>f(p=>!p)})}),g.jsx(o.Generic.Popover.Content,{className:"bn-popover-content bn-form-popover",variant:"form-popover",children:g.jsx(wy,{url:d.url||"",text:d.text,range:d.range,showTextField:!1,setToolbarOpen:p=>r.store.setState(p)})})]})},K3=()=>{const t=Se(),o=ue(),a=pe(),r=gt({editor:a,selector:({editor:p})=>{var h;if(!p.isEditable)return;const v=((h=p.getSelection())==null?void 0:h.blocks)||[p.getTextCursorPosition().block];if(v.length!==1)return;const y=v[0];if(kt(y,p,y.type,{url:"string",caption:"string"}))return y}}),[s,c]=S.useState();S.useEffect(()=>{r!==void 0&&c(r.props.caption)},[r]);const f=S.useCallback(p=>c(p.currentTarget.value),[]),d=S.useCallback(p=>{r!==void 0&&xl(a,r.type,{caption:"string"})&&p.key==="Enter"&&!p.nativeEvent.isComposing&&(p.preventDefault(),a.updateBlock(r.id,{props:{caption:s}}))},[r,s,a]);return r===void 0?null:g.jsxs(o.Generic.Popover.Root,{children:[g.jsx(o.Generic.Popover.Trigger,{children:g.jsx(o.FormattingToolbar.Button,{className:"bn-button",label:t.formatting_toolbar.file_caption.tooltip,mainTooltip:t.formatting_toolbar.file_caption.tooltip,icon:g.jsx(L0,{})})}),g.jsx(o.Generic.Popover.Content,{className:"bn-popover-content bn-form-popover",variant:"form-popover",children:g.jsx(o.Generic.Form.Root,{children:g.jsx(o.Generic.Form.TextInput,{name:"file-caption",icon:g.jsx(L0,{}),value:s||"",autoFocus:!0,placeholder:t.formatting_toolbar.file_caption.input_placeholder,onKeyDown:d,onChange:f})})})]})},F3=()=>{const t=Se(),o=ue(),a=pe(),r=gt({editor:a,selector:({editor:c})=>{var f;if(!c.isEditable)return;const d=((f=c.getSelection())==null?void 0:f.blocks)||[c.getTextCursorPosition().block];if(d.length!==1)return;const p=d[0];if(kt(p,c,p.type,{url:"string"}))return p}}),s=S.useCallback(()=>{r!==void 0&&(a.focus(),a.removeBlocks([r.id]))},[r,a]);return r===void 0?null:g.jsx(o.FormattingToolbar.Button,{className:"bn-button",label:t.formatting_toolbar.file_delete.tooltip[r.type]||t.formatting_toolbar.file_delete.tooltip.file,mainTooltip:t.formatting_toolbar.file_delete.tooltip[r.type]||t.formatting_toolbar.file_delete.tooltip.file,icon:g.jsx(k3,{}),onClick:s})},J3=()=>{const t=Se(),o=ue(),a=pe(),r=gt({editor:a,selector:({editor:p})=>{var h;if(!p.isEditable)return;const v=((h=p.getSelection())==null?void 0:h.blocks)||[p.getTextCursorPosition().block];if(v.length!==1)return;const y=v[0];if(kt(y,p,y.type,{url:"string",name:"string"}))return y}}),[s,c]=S.useState();S.useEffect(()=>{r!==void 0&&c(r.props.name)},[r]);const f=S.useCallback(p=>c(p.currentTarget.value),[]),d=S.useCallback(p=>{r!==void 0&&xl(a,r.type,{name:"string"})&&p.key==="Enter"&&!p.nativeEvent.isComposing&&(p.preventDefault(),a.updateBlock(r.id,{props:{name:s}}))},[r,s,a]);return r===void 0?null:g.jsxs(o.Generic.Popover.Root,{children:[g.jsx(o.Generic.Popover.Trigger,{children:g.jsx(o.FormattingToolbar.Button,{className:"bn-button",label:t.formatting_toolbar.file_rename.tooltip[r.type]||t.formatting_toolbar.file_rename.tooltip.file,mainTooltip:t.formatting_toolbar.file_rename.tooltip[r.type]||t.formatting_toolbar.file_rename.tooltip.file,icon:g.jsx(z0,{})})}),g.jsx(o.Generic.Popover.Content,{className:"bn-popover-content bn-form-popover",variant:"form-popover",children:g.jsx(o.Generic.Form.Root,{children:g.jsx(o.Generic.Form.TextInput,{name:"file-name",icon:g.jsx(z0,{}),value:s||"",autoFocus:!0,placeholder:t.formatting_toolbar.file_rename.input_placeholder[r.type]||t.formatting_toolbar.file_rename.input_placeholder.file,onKeyDown:d,onChange:f})})})]})},W3=()=>{const t=Se(),o=ue(),a=pe(),r=gt({editor:a,selector:({editor:s})=>{var c;if(!s.isEditable)return;const f=((c=s.getSelection())==null?void 0:c.blocks)||[s.getTextCursorPosition().block];if(f.length!==1)return;const d=f[0];if(kt(d,s,d.type,{url:"string"}))return d}});return r===void 0?null:g.jsxs(o.Generic.Popover.Root,{position:"bottom",children:[g.jsx(o.Generic.Popover.Trigger,{children:g.jsx(o.FormattingToolbar.Button,{className:"bn-button",mainTooltip:t.formatting_toolbar.file_replace.tooltip[r.type]||t.formatting_toolbar.file_replace.tooltip.file,label:t.formatting_toolbar.file_replace.tooltip[r.type]||t.formatting_toolbar.file_replace.tooltip.file,icon:g.jsx(H3,{})})}),g.jsx(o.Generic.Popover.Content,{className:"bn-popover-content bn-panel-popover",variant:"panel-popover",children:g.jsx(sy,{blockId:r.id})})]})},e8=()=>{const t=Se(),o=ue(),a=pe(),r=gt({editor:a,selector:({editor:c})=>{var f;if(!(!c.isEditable||!(((f=c.getSelection())==null?void 0:f.blocks)||[c.getTextCursorPosition().block]).find(d=>d.content!==void 0)))return{canNestBlock:c.canNestBlock()}}}),s=S.useCallback(()=>{r!==void 0&&r.canNestBlock&&(a.focus(),a.nestBlock())},[a,r]);return r===void 0?null:g.jsx(o.FormattingToolbar.Button,{className:"bn-button","data-test":"nestBlock",onClick:s,isDisabled:!r.canNestBlock,label:t.formatting_toolbar.nest.tooltip,mainTooltip:t.formatting_toolbar.nest.tooltip,secondaryTooltip:Ys(t.formatting_toolbar.nest.secondary_tooltip,t.generic.ctrl_shortcut),icon:g.jsx(w3,{})})},t8=()=>{const t=Se(),o=ue(),a=pe(),r=gt({editor:a,selector:({editor:c})=>{var f;if(!(!c.isEditable||!(((f=c.getSelection())==null?void 0:f.blocks)||[c.getTextCursorPosition().block]).find(d=>d.content!==void 0)))return{canUnnestBlock:c.canUnnestBlock()}}}),s=S.useCallback(()=>{r!==void 0&&r.canUnnestBlock&&(a.focus(),a.unnestBlock())},[a,r]);return r===void 0?null:g.jsx(o.FormattingToolbar.Button,{className:"bn-button","data-test":"unnestBlock",onClick:s,isDisabled:!r.canUnnestBlock,label:t.formatting_toolbar.unnest.tooltip,mainTooltip:t.formatting_toolbar.unnest.tooltip,secondaryTooltip:Ys(t.formatting_toolbar.unnest.secondary_tooltip,t.generic.ctrl_shortcut),icon:g.jsx(C3,{})})},n8=t=>[{name:t.slash_menu.paragraph.title,type:"paragraph",icon:Kd},{name:t.slash_menu.heading.title,type:"heading",props:{level:1,isToggleable:!1},icon:Ds},{name:t.slash_menu.heading_2.title,type:"heading",props:{level:2,isToggleable:!1},icon:Hs},{name:t.slash_menu.heading_3.title,type:"heading",props:{level:3,isToggleable:!1},icon:zs},{name:t.slash_menu.heading_4.title,type:"heading",props:{level:4,isToggleable:!1},icon:py},{name:t.slash_menu.heading_5.title,type:"heading",props:{level:5,isToggleable:!1},icon:hy},{name:t.slash_menu.heading_6.title,type:"heading",props:{level:6,isToggleable:!1},icon:gy},{name:t.slash_menu.toggle_heading.title,type:"heading",props:{level:1,isToggleable:!0},icon:Ds},{name:t.slash_menu.toggle_heading_2.title,type:"heading",props:{level:2,isToggleable:!0},icon:Hs},{name:t.slash_menu.toggle_heading_3.title,type:"heading",props:{level:3,isToggleable:!0},icon:zs},{name:t.slash_menu.quote.title,type:"quote",icon:Sy},{name:t.slash_menu.toggle_list.title,type:"toggleListItem",icon:Cy},{name:t.slash_menu.bullet_list.title,type:"bulletListItem",icon:xy},{name:t.slash_menu.numbered_list.title,type:"numberedListItem",icon:by},{name:t.slash_menu.check_list.title,type:"checkListItem",icon:yy}],o8=t=>{const o=ue(),a=pe(),r=gt({editor:a,selector:({editor:d})=>{var p;return((p=d.getSelection())==null?void 0:p.blocks)||[d.getTextCursorPosition().block]}}),s=r[0],c=S.useMemo(()=>(t.items||n8(a.dictionary)).filter(d=>xl(a,d.type,Object.fromEntries(Object.entries(d.props||{}).map(([p,h])=>[p,typeof h])))),[a,t.items]),f=S.useMemo(()=>c.map(d=>{const p=d.icon,h=d.type===s.type,v=Object.entries(d.props||{}).filter(([y,x])=>x!==s.props[y]).length===0;return{text:d.name,icon:g.jsx(p,{size:16}),onClick:()=>{a.focus(),a.transact(()=>{for(const y of r)a.updateBlock(y,{type:d.type,props:d.props})})},isSelected:h&&v}}),[a,c,s.props,s.type,r]);return!S.useMemo(()=>f.find(d=>d.isSelected)!==void 0,[f])||!a.isEditable?null:g.jsx(o.FormattingToolbar.Select,{className:"bn-select",items:f})},l8=()=>{const t=Se(),o=ue(),a=Ae("comments"),{store:r}=Ae(Or),s=S.useCallback(()=>{a.startPendingComment(),r.setState(!1)},[a,r]);return g.jsx(o.FormattingToolbar.Button,{className:"bn-button",label:t.formatting_toolbar.comment.tooltip,mainTooltip:t.formatting_toolbar.comment.tooltip,icon:g.jsx(my,{}),onClick:s})},a8=()=>pe().getExtension("comments")?g.jsx(l8,{}):null,r8=()=>{const t=Se(),o=ue(),a=pe(),r=S.useCallback(()=>{a._tiptapEditor.chain().focus().addPendingComment().run()},[a]);return!a._tiptapEditor.commands.addPendingComment||!a.isEditable?null:g.jsx(o.FormattingToolbar.Button,{className:"bn-button",label:t.formatting_toolbar.comment.tooltip,mainTooltip:t.formatting_toolbar.comment.tooltip,icon:g.jsx(my,{}),onClick:r})};function Dd(t,o){try{const a=new URL(t,o);if(a.protocol!=="javascript:")return a.href}catch{}return"#"}const i8=()=>{const t=Se(),o=ue(),a=pe(),r=gt({editor:a,selector:({editor:c})=>{var f;const d=((f=c.getSelection())==null?void 0:f.blocks)||[c.getTextCursorPosition().block];if(d.length!==1)return;const p=d[0];if(kt(p,c,p.type,{url:"string"}))return p}}),s=S.useCallback(()=>{r!==void 0&&(a.focus(),a.resolveFileUrl?a.resolveFileUrl(r.props.url).then(c=>window.open(Dd(c,window.location.href))):window.open(Dd(r.props.url,window.location.href)))},[r,a]);return r===void 0?null:g.jsx(o.FormattingToolbar.Button,{className:"bn-button",label:t.formatting_toolbar.file_download.tooltip[r.type]||t.formatting_toolbar.file_download.tooltip.file,mainTooltip:t.formatting_toolbar.file_download.tooltip[r.type]||t.formatting_toolbar.file_download.tooltip.file,icon:g.jsx(U3,{}),onClick:s})},s8=()=>{const t=Se(),o=ue(),a=pe(),r=gt({editor:a,selector:({editor:c})=>{var f;if(!c.isEditable)return;const d=((f=c.getSelection())==null?void 0:f.blocks)||[c.getTextCursorPosition().block];if(d.length!==1)return;const p=d[0];if(kt(p,c,p.type,{url:"string",showPreview:"boolean"}))return p}}),s=S.useCallback(()=>{r!==void 0&&xl(a,r.type,{showPreview:"boolean"})&&a.updateBlock(r.id,{props:{showPreview:!r.props.showPreview}})},[r,a]);return r===void 0?null:g.jsx(o.FormattingToolbar.Button,{className:"bn-button",label:"Toggle preview",mainTooltip:t.formatting_toolbar.file_preview_toggle.tooltip,icon:g.jsx(D3,{}),isSelected:r.props.showPreview,onClick:s})},c8=()=>{const t=Se(),o=ue(),a=pe(),r=Ae(Fe),s=gt({editor:a,selector:({editor:f})=>{var d;if(!f.isEditable||!f.settings.tables.splitCells)return;const p=((d=f.getSelection())==null?void 0:d.blocks)||[f.getTextCursorPosition().block];if(p.length!==1)return;const h=p[0];if(h.type==="table")return{mergeDirection:r.getMergeDirection(h)}}}),c=S.useCallback(()=>{r?.mergeCells()},[r]);return s===void 0?null:g.jsx(o.FormattingToolbar.Button,{className:"bn-button",label:t.formatting_toolbar.table_cell_merge.tooltip,mainTooltip:t.formatting_toolbar.table_cell_merge.tooltip,icon:s.mergeDirection==="horizontal"?g.jsx(M3,{}):g.jsx(R3,{}),onClick:c})},u8=()=>pe().getExtension(Fe)?g.jsx(c8,{}):null,f8={left:y3,center:g3,right:b3,justify:v3},cd=t=>{const o=ue(),a=Se(),r=pe(),s=gt({editor:r,selector:({editor:d})=>{var p,h;if(!d.isEditable)return;const v=((p=d.getSelection())==null?void 0:p.blocks)||[d.getTextCursorPosition().block],y=v[0];if(kt(y,d,y.type,{textAlignment:ys.textAlignment}))return{textAlignment:y.props.textAlignment,blocks:v};if(v.length===1&&kt(y,d,"table"))return(h=d.getExtension(Fe))!=null&&h.getCellSelection()?{textAlignment:Nr(y.content.rows[0].cells[0]).props.textAlignment,blocks:[y]}:void 0}}),c=S.useCallback(d=>{var p;if(s!==void 0){r.focus();for(const h of s.blocks)if(kt(h,r,h.type,{textAlignment:ys.textAlignment})&&xl(r,h.type,{textAlignment:ys.textAlignment}))r.updateBlock(h,{props:{textAlignment:d}});else if(h.type==="table"){const v=(p=r.getExtension(Fe))==null?void 0:p.getCellSelection();if(!v)continue;const y=h.content.rows.map(x=>({...x,cells:x.cells.map(C=>Nr(C))}));v.cells.forEach(({row:x,col:C})=>{y[x].cells[C].props.textAlignment=d}),r.updateBlock(h,{type:"table",content:{...h.content,type:"tableContent",rows:y}}),r.setTextCursorPosition(h)}}},[r,s]);if(s===void 0)return null;const f=f8[t.textAlignment];return g.jsx(o.FormattingToolbar.Button,{className:"bn-button","data-test":`alignText${t.textAlignment.slice(0,1).toUpperCase()+t.textAlignment.slice(1)}`,onClick:()=>c(t.textAlignment),isSelected:s.textAlignment===t.textAlignment,label:a.formatting_toolbar[`align_${t.textAlignment}`].tooltip,mainTooltip:a.formatting_toolbar[`align_${t.textAlignment}`].tooltip,icon:g.jsx(f,{})})},Ty=t=>[g.jsx(o8,{items:t},"blockTypeSelect"),g.jsx(u8,{},"tableCellMergeButton"),g.jsx(K3,{},"fileCaptionButton"),g.jsx(W3,{},"replaceFileButton"),g.jsx(J3,{},"fileRenameButton"),g.jsx(F3,{},"fileDeleteButton"),g.jsx(i8,{},"fileDownloadButton"),g.jsx(s8,{},"filePreviewButton"),g.jsx(ms,{basicTextStyle:"bold"},"boldStyleButton"),g.jsx(ms,{basicTextStyle:"italic"},"italicStyleButton"),g.jsx(ms,{basicTextStyle:"underline"},"underlineStyleButton"),g.jsx(ms,{basicTextStyle:"strike"},"strikeStyleButton"),g.jsx(cd,{textAlignment:"left"},"textAlignLeftButton"),g.jsx(cd,{textAlignment:"center"},"textAlignCenterButton"),g.jsx(cd,{textAlignment:"right"},"textAlignRightButton"),g.jsx(P3,{},"colorStyleButton"),g.jsx(e8,{},"nestBlockButton"),g.jsx(t8,{},"unnestBlockButton"),g.jsx(I3,{},"createLinkButton"),g.jsx(a8,{},"addCommentButton"),g.jsx(r8,{},"addTiptapCommentButton")],Ey=t=>{const o=ue();return g.jsx(o.FormattingToolbar.Root,{className:"bn-toolbar bn-formatting-toolbar",children:t.children||Ty(t.blockTypeSelectItems)})},d8=t=>{switch(t){case"left":return"top-start";case"center":return"top";case"right":return"top-end";default:return"top-start"}},My=t=>{const o=pe(),a=Ae(Or,{editor:o}),r=qe(Or,{editor:o}),s=gt({editor:o,selector:({editor:p})=>a.store.state?{from:p.prosemirrorState.selection.from,to:p.prosemirrorState.selection.to}:void 0}),c=gt({editor:o,selector:({editor:p})=>{const h=p.getTextCursorPosition().block;return kt(h,p,h.type,{textAlignment:ys.textAlignment})?d8(h.props.textAlignment):"top-start"}}),f=S.useMemo(()=>{var p,h;return{...t.floatingUIOptions,useFloatingOptions:{open:r,onOpenChange:(v,y,x)=>{a.store.setState(v),x==="escape-key"&&o.focus()},placement:c,middleware:[mn(10),Io(),yo()],...(p=t.floatingUIOptions)==null?void 0:p.useFloatingOptions},elementProps:{style:{zIndex:40},...(h=t.floatingUIOptions)==null?void 0:h.elementProps}}},[r,c,t.floatingUIOptions,a.store,o]),d=t.formattingToolbar||Ey;return g.jsx(Id,{position:s,...f,children:r&&g.jsx(d,{})})},m8=t=>{const o=ue(),a=Se(),{deleteLink:r}=Ae(Xs);return g.jsx(o.LinkToolbar.Button,{className:"bn-button",label:a.link_toolbar.delete.tooltip,mainTooltip:a.link_toolbar.delete.tooltip,isSelected:!1,onClick:()=>{var s;r(t.range.from),(s=t.setToolbarOpen)==null||s.call(t,!1)},icon:g.jsx(E3,{})})},p8=t=>{const o=ue(),a=Se();return g.jsxs(o.Generic.Popover.Root,{onOpenChange:t.setToolbarPositionFrozen,children:[g.jsx(o.Generic.Popover.Trigger,{children:g.jsx(o.LinkToolbar.Button,{className:"bn-button",mainTooltip:a.link_toolbar.edit.tooltip,isSelected:!1,children:a.link_toolbar.edit.text})}),g.jsx(o.Generic.Popover.Content,{className:"bn-popover-content bn-form-popover",variant:"form-popover",children:g.jsx(wy,{url:t.url,text:t.text,range:t.range,setToolbarOpen:t.setToolbarOpen,setToolbarPositionFrozen:t.setToolbarPositionFrozen})})]})},h8=t=>{const o=ue(),a=Se();return g.jsx(o.LinkToolbar.Button,{className:"bn-button",mainTooltip:a.link_toolbar.open.tooltip,label:a.link_toolbar.open.tooltip,isSelected:!1,onClick:()=>{window.open(Dd(t.url,window.location.href),"_blank")},icon:g.jsx($3,{})})},g8=t=>{const o=ue();return g.jsx(o.LinkToolbar.Root,{className:"bn-toolbar bn-link-toolbar",children:t.children||g.jsxs(g.Fragment,{children:[g.jsx(p8,{url:t.url,text:t.text,range:t.range,setToolbarOpen:t.setToolbarOpen,setToolbarPositionFrozen:t.setToolbarPositionFrozen}),g.jsx(h8,{url:t.url}),g.jsx(m8,{range:t.range,setToolbarOpen:t.setToolbarOpen})]})})},v8=t=>{const o=pe(),[a,r]=S.useState(!1),[s,c]=S.useState(!1),f=Ae(Xs),[d,p]=S.useState(void 0);S.useEffect(()=>{const x=()=>{const R=f.getLinkAtSelection();if(!R){p(void 0),s||r(!1);return}p({cursorType:"text",url:R.mark.attrs.href,text:R.text,range:R.range,element:f.getLinkElementAtPos(R.range.from)}),s||r(!0)},C=R=>{if(d!==void 0&&d.cursorType==="text"||!(R.target instanceof HTMLElement))return;const _=f.getLinkAtElement(R.target);_&&p({cursorType:"mouse",url:_.mark.attrs.href,text:_.text,range:_.range,element:f.getLinkElementAtPos(_.range.from)})},T=o.onChange(x),w=o.onSelectionChange(x),M=o.domElement;return M?.addEventListener("mouseover",C),()=>{T(),w(),M?.removeEventListener("mouseover",C)}},[o,o.domElement,f,d,s]);const h=S.useMemo(()=>{var x,C,T;return{...t.floatingUIOptions,useFloatingOptions:{open:a,onOpenChange:(w,M,R)=>{s||d!==void 0&&d.cursorType==="text"&&R==="hover"||(R==="escape-key"&&o.focus(),r(w))},placement:"top-start",middleware:[mn(10),yo()],...(x=t.floatingUIOptions)==null?void 0:x.useFloatingOptions},useHoverProps:{enabled:d!==void 0&&d.cursorType==="mouse",delay:{open:250,close:250},handleClose:j5(),...(C=t.floatingUIOptions)==null?void 0:C.useHoverProps},elementProps:{style:{zIndex:50},...(T=t.floatingUIOptions)==null?void 0:T.elementProps}}},[o,d,t.floatingUIOptions,a,s]),v=S.useMemo(()=>d!=null&&d.element?{element:d.element}:void 0,[d?.element]);if(!o.isEditable)return null;const y=t.linkToolbar||g8;return g.jsx(Bn,{reference:v,...h,children:d&&g.jsx(y,{url:d.url,text:d.text,range:d.range,setToolbarOpen:r,setToolbarPositionFrozen:c})})};function y8(t){return fe({attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8Z"},child:[]},{tag:"path",attr:{d:"M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8Z"},child:[]}]})(t)}const b8=()=>{const t=ue(),o=Se(),a=pe(),r=Ae(po),s=qe(Gn,{editor:a,selector:f=>f?.block}),c=S.useCallback(()=>{if(s===void 0)return;const f=s.content;if(f!==void 0&&Array.isArray(f)&&f.length===0)a.setTextCursorPosition(s),r.openSuggestionMenu("/");else{const d=a.insertBlocks([{type:"paragraph"}],s,"after")[0];a.setTextCursorPosition(d),r.openSuggestionMenu("/")}},[s,a,r]);return s===void 0?null:g.jsx(t.SideMenu.Button,{className:"bn-button",label:o.side_menu.add_block_label,icon:g.jsx(y8,{size:24,onClick:c,"data-test":"dragHandleAdd"})})};function Ry(t){return fe({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"},child:[]}]})(t)}function x8(t){return fe({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"m7 10 5 5 5-5z"},child:[]}]})(t)}const S8=t=>{const o=ue(),a=pe(),r=qe(Gn,{editor:a,selector:s=>s?.block});return r===void 0||!kt(r,a,r.type,{textColor:"string"})&&!kt(r,a,r.type,{backgroundColor:"string"})?null:g.jsxs(o.Generic.Menu.Root,{position:"right",sub:!0,children:[g.jsx(o.Generic.Menu.Trigger,{sub:!0,children:g.jsx(o.Generic.Menu.Item,{className:"bn-menu-item",subTrigger:!0,children:t.children})}),g.jsx(o.Generic.Menu.Dropdown,{sub:!0,className:"bn-menu-dropdown bn-color-picker-dropdown",children:g.jsx(ec,{iconSize:18,text:kt(r,a,r.type,{textColor:"string"})&&xl(a,r.type,{textColor:"string"})?{color:r.props.textColor,setColor:s=>a.updateBlock(r,{type:r.type,props:{textColor:s}})}:void 0,background:kt(r,a,r.type,{backgroundColor:"string"})&&xl(a,r.type,{backgroundColor:"string"})?{color:r.props.backgroundColor,setColor:s=>a.updateBlock(r,{props:{backgroundColor:s}})}:void 0})})]})},C8=t=>{const o=ue(),a=pe(),r=qe(Gn,{editor:a,selector:s=>s?.block});return r===void 0?null:g.jsx(o.Generic.Menu.Item,{className:"bn-menu-item",onClick:()=>a.removeBlocks([r]),children:t.children})},w8=t=>{const o=ue(),a=pe(),r=qe(Gn,{editor:a,selector:c=>c?.block});if(r===void 0||r.type!=="table"||!a.settings.tables.headers)return null;const s=!!r.content.headerRows;return g.jsx(o.Generic.Menu.Item,{className:"bn-menu-item",checked:s,onClick:()=>{a.updateBlock(r,{content:{...r.content,headerRows:s?void 0:1}})},children:t.children})},T8=t=>{const o=ue(),a=pe(),r=qe(Gn,{editor:a,selector:c=>c?.block});if(r===void 0||r.type!=="table"||!a.settings.tables.headers)return null;const s=!!r.content.headerCols;return g.jsx(o.Generic.Menu.Item,{className:"bn-menu-item",checked:s,onClick:()=>{a.updateBlock(r,{content:{...r.content,headerCols:s?void 0:1}})},children:t.children})},E8=t=>{const o=ue(),a=Se();return g.jsx(o.Generic.Menu.Dropdown,{className:"bn-menu-dropdown bn-drag-handle-menu",children:t.children||g.jsxs(g.Fragment,{children:[g.jsx(C8,{children:a.drag_handle.delete_menuitem}),g.jsx(S8,{children:a.drag_handle.colors_menuitem}),g.jsx(w8,{children:a.drag_handle.header_row_menuitem}),g.jsx(T8,{children:a.drag_handle.header_column_menuitem})]})})},M8=t=>{const o=ue(),a=Se(),r=Ae(Gn),s=qe(Gn,{selector:f=>f?.block});if(s===void 0)return null;const c=t.dragHandleMenu||E8;return g.jsxs(o.Generic.Menu.Root,{onOpenChange:f=>{f?r.freezeMenu():r.unfreezeMenu()},position:"left",children:[g.jsx(o.Generic.Menu.Trigger,{children:g.jsx(o.SideMenu.Button,{label:a.side_menu.drag_handle_label,draggable:!0,onDragStart:f=>r.blockDragStart(f,s),onDragEnd:r.blockDragEnd,className:"bn-button",icon:g.jsx(Ry,{size:24,"data-test":"dragHandle"})})}),g.jsx(c,{children:t.children})]})},R8=t=>{const o=ue(),a=pe(),r=qe(Gn,{editor:a,selector:c=>c?.block}),s=S.useMemo(()=>{var c;if(r===void 0)return{};const f={"data-block-type":r.type};return r.type==="heading"&&(f["data-level"]=r.props.level.toString()),(c=a.schema.blockSpecs[r.type].implementation.meta)!=null&&c.fileBlockAccept&&(r.props.url?f["data-url"]="true":f["data-url"]="false"),f},[r,a.schema.blockSpecs]);return g.jsx(o.SideMenu.Root,{className:"bn-side-menu",...s,children:t.children||g.jsxs(g.Fragment,{children:[g.jsx(b8,{}),g.jsx(M8,{dragHandleMenu:t.dragHandleMenu})]})})},j8=t=>{const o=qe(Gn,{selector:f=>f!==void 0?{show:f.show,block:f.block}:void 0}),{show:a,block:r}=o||{},s=S.useMemo(()=>{var f,d,p;return{...t.floatingUIOptions,useFloatingOptions:{open:a,placement:"left-start",...(f=t.floatingUIOptions)==null?void 0:f.useFloatingOptions},useDismissProps:{enabled:!1,...(d=t.floatingUIOptions)==null?void 0:d.useDismissProps},elementProps:{style:{zIndex:20},...(p=t.floatingUIOptions)==null?void 0:p.elementProps}}},[t.floatingUIOptions,a]),c=t.sideMenu||R8;return g.jsx(cy,{blockId:a?r?.id:void 0,...s,children:r?.id&&g.jsx(c,{})})};async function _8(t,o){return(await ZC(t,o)).map(({id:a,onItemClick:r})=>({id:a,onItemClick:r,icon:a}))}function O8(t){const o=ue(),a=Se(),{items:r,loadingState:s,selectedIndex:c,onItemClick:f,columns:d}=t,p=s==="loading-initial"||s==="loading"?g.jsx(o.GridSuggestionMenu.Loader,{className:"bn-grid-suggestion-menu-loader",columns:d}):null,h=S.useMemo(()=>{const v=[];for(let y=0;y<r.length;y++){const x=r[y];v.push(g.jsx(o.GridSuggestionMenu.Item,{className:"bn-grid-suggestion-menu-item",item:x,id:`bn-grid-suggestion-menu-item-${y}`,isSelected:y===c,onClick:()=>f?.(x)},x.id))}return v},[o,r,f,c]);return g.jsxs(o.GridSuggestionMenu.Root,{id:"bn-grid-suggestion-menu",columns:d,className:"bn-grid-suggestion-menu",children:[p,h,h.length===0&&t.loadingState==="loaded"&&g.jsx(o.GridSuggestionMenu.EmptyItem,{className:"bn-grid-suggestion-menu-empty-item",columns:d,children:a.suggestion_menu.no_items_title})]})}function jy(t,o,a,r=3){const s=S.useRef(0);S.useEffect(()=>{o!==void 0&&(t.length>0?s.current=o.length:o.length-s.current>r&&a())},[a,r,t.length,o])}function _y(t,o){const[a,r]=S.useState([]),[s,c]=S.useState(!1),f=S.useRef(void 0),d=S.useRef(void 0);return S.useEffect(()=>{const p=t;f.current=t,c(!0),o(t).then(h=>{f.current===p&&(r(h),c(!1),d.current=p)})},[t,o]),{items:a||[],usedQuery:d.current,loadingState:d.current===void 0?"loading-initial":s?"loading":"loaded"}}function N8(t,o,a,r,s){const[c,f]=S.useState(0),d=r!==void 0&&r>1;return S.useEffect(()=>{const p=v=>(v.key==="ArrowLeft"&&(v.preventDefault(),a.length&&f((c-1+a.length)%a.length)),v.key==="ArrowRight"&&(v.preventDefault(),a.length&&f((c+1+a.length)%a.length)),v.key==="ArrowUp"?(v.preventDefault(),a.length&&f((c-r+a.length)%a.length),!0):v.key==="ArrowDown"?(v.preventDefault(),a.length&&f((c+r)%a.length),!0):v.key==="Enter"&&!v.isComposing?(v.stopPropagation(),v.preventDefault(),a.length&&s?.(a[c]),!0):!1),h=t.domElement;return h?.addEventListener("keydown",p,!0),()=>{h?.removeEventListener("keydown",p,!0)}},[t.domElement,a,c,s,r,d]),S.useEffect(()=>{f(0)},[o]),{selectedIndex:a.length===0?void 0:c}}function A8(t){const o=Mn().setContentEditableProps,a=pe(),{getItems:r,gridSuggestionMenuComponent:s,query:c,clearQuery:f,closeMenu:d,onItemClick:p,columns:h}=t,v=S.useCallback(w=>{d(),f(),p?.(w)},[p,d,f]),{items:y,usedQuery:x,loadingState:C}=_y(c,r);jy(y,x,d);const{selectedIndex:T}=N8(a,c,y,h,v);return S.useEffect(()=>(o(w=>({...w,"aria-expanded":!0,"aria-controls":"bn-suggestion-menu"})),()=>{o(w=>({...w,"aria-expanded":!1,"aria-controls":void 0}))}),[o]),S.useEffect(()=>(o(w=>({...w,"aria-activedescendant":T?"bn-suggestion-menu-item-"+T:void 0})),()=>{o(w=>({...w,"aria-activedescendant":void 0}))}),[o,T]),g.jsx(s,{items:y,onItemClick:v,loadingState:C,selectedIndex:T,columns:h})}function D8(t){const o=pe(),{triggerCharacter:a,gridSuggestionMenuComponent:r,columns:s,minQueryLength:c,onItemClick:f,getItems:d}=t,p=S.useMemo(()=>f||(T=>{T.onItemClick(o)}),[o,f]),h=S.useMemo(()=>d||(async T=>await _8(o,T)),[o,d]),v=Ae(po);S.useEffect(()=>{v.addTriggerCharacter(a)},[v,a]);const y=qe(po),x=qe(po,{selector:T=>{var w;return{element:((w=o.domElement)==null?void 0:w.firstChild)||void 0,getBoundingClientRect:()=>T?.referencePos||new DOMRect}}}),C=S.useMemo(()=>{var T,w;return{...t.floatingUIOptions,useFloatingOptions:{open:y?.show&&y?.triggerCharacter===a,onOpenChange:M=>{M||v.closeMenu()},placement:"bottom-start",middleware:[mn(10),Yv({allowedPlacements:["bottom-start","top-start"],padding:10}),Io(),Dr({apply({elements:M,availableHeight:R}){M.floating.style.maxHeight=`${Math.max(0,R)}px`},padding:10})],...(T=t.floatingUIOptions)==null?void 0:T.useFloatingOptions},elementProps:{onMouseDownCapture:M=>M.preventDefault(),style:{zIndex:70},...(w=t.floatingUIOptions)==null?void 0:w.elementProps}}},[t.floatingUIOptions,y?.show,y?.triggerCharacter,v,a]);return!y||!y.ignoreQueryLength&&c&&(y.query.startsWith(" ")||y.query.length<c)?null:g.jsx(Bn,{reference:x,...C,children:a&&g.jsx(A8,{query:y.query,closeMenu:v.closeMenu,clearQuery:v.clearQuery,getItems:h,columns:s,gridSuggestionMenuComponent:r||O8,onItemClick:p})})}function H8(t){const o=ue(),a=Se(),{items:r,loadingState:s,selectedIndex:c,onItemClick:f}=t,d=s==="loading-initial"||s==="loading"?g.jsx(o.SuggestionMenu.Loader,{className:"bn-suggestion-menu-loader"}):null,p=S.useMemo(()=>{let h;const v=[];for(let y=0;y<r.length;y++){const x=r[y];x.group!==h&&(h=x.group,v.push(g.jsx(o.SuggestionMenu.Label,{className:"bn-suggestion-menu-label",children:h},h))),v.push(g.jsx(o.SuggestionMenu.Item,{className:ht("bn-suggestion-menu-item",x.size==="small"?"bn-suggestion-menu-item-small":""),item:x,id:`bn-suggestion-menu-item-${y}`,isSelected:y===c,onClick:()=>f?.(x)},x.title))}return v},[o,r,f,c]);return g.jsxs(o.SuggestionMenu.Root,{id:"bn-suggestion-menu",className:"bn-suggestion-menu",children:[p,p.length===0&&(t.loadingState==="loading"||t.loadingState==="loaded")&&g.jsx(o.SuggestionMenu.EmptyItem,{className:"bn-suggestion-menu-item",children:a.suggestion_menu.no_items_title}),d]})}function z8(t,o){const[a,r]=S.useState(0);return{selectedIndex:a,setSelectedIndex:r,handler:s=>{if(s.key==="ArrowUp")return s.preventDefault(),t.length&&r((a-1+t.length)%t.length),!0;if(s.key==="ArrowDown")return s.preventDefault(),t.length&&r((a+1)%t.length),!0;if(s.key==="PageUp")return s.preventDefault(),t.length&&r(0),!0;if(s.key==="PageDown")return s.preventDefault(),t.length&&r(t.length-1),!0;const c=L8(s)?s.nativeEvent.isComposing:s.isComposing;return s.key==="Enter"&&!c?(s.preventDefault(),s.stopPropagation(),t.length&&o?.(t[a]),!0):!1}}}function L8(t){return t.nativeEvent!==void 0}function V8(t,o,a,r,s){const{selectedIndex:c,setSelectedIndex:f,handler:d}=z8(a,r);return S.useEffect(()=>{const p=t.domElement;return p?.addEventListener("keydown",d,!0),()=>{p?.removeEventListener("keydown",d,!0)}},[t.domElement,a,c,r,s,d]),S.useEffect(()=>{f(0)},[o,f]),{selectedIndex:a.length===0?void 0:c}}function k8(t){const o=Mn().setContentEditableProps,a=pe(),{getItems:r,suggestionMenuComponent:s,query:c,clearQuery:f,closeMenu:d,onItemClick:p}=t,h=S.useCallback(T=>{d(),f(),p?.(T)},[p,d,f]),{items:v,usedQuery:y,loadingState:x}=_y(c,r);jy(v,y,d);const{selectedIndex:C}=V8(a,c,v,h);return S.useEffect(()=>(o(T=>({...T,"aria-expanded":!0,"aria-controls":"bn-suggestion-menu"})),()=>{o(T=>({...T,"aria-expanded":!1,"aria-controls":void 0}))}),[o]),S.useEffect(()=>(o(T=>({...T,"aria-activedescendant":C?"bn-suggestion-menu-item-"+C:void 0})),()=>{o(T=>({...T,"aria-activedescendant":void 0}))}),[o,C]),g.jsx(s,{items:v,onItemClick:h,loadingState:x,selectedIndex:C})}const B8={heading:Ds,heading_2:Hs,heading_3:zs,heading_4:py,heading_5:hy,heading_6:gy,toggle_heading:Ds,toggle_heading_2:Hs,toggle_heading_3:zs,quote:Sy,toggle_list:Cy,numbered_list:by,bullet_list:xy,check_list:yy,paragraph:Kd,table:_3,image:A3,video:N3,audio:z3,file:h3,emoji:q3,code_block:S3,divider:Z3};function U8(t){return gS(t).map(o=>{const a=B8[o.key];return{...o,icon:g.jsx(a,{size:18})}})}function $8(t){const o=pe(),{triggerCharacter:a,suggestionMenuComponent:r,minQueryLength:s,onItemClick:c,getItems:f}=t,d=S.useMemo(()=>c||(C=>{C.onItemClick(o)}),[o,c]),p=S.useMemo(()=>f||(async C=>hS(U8(o),C)),[o,f]),h=Ae(po);S.useEffect(()=>{h.addTriggerCharacter(a)},[h,a]);const v=qe(po),y=qe(po,{selector:C=>{var T;return{element:((T=o.domElement)==null?void 0:T.firstChild)||void 0,getBoundingClientRect:()=>C?.referencePos||new DOMRect}}}),x=S.useMemo(()=>{var C,T;return{...t.floatingUIOptions,useFloatingOptions:{open:v?.show&&v?.triggerCharacter===a,onOpenChange:w=>{w||h.closeMenu()},placement:"bottom-start",middleware:[mn(10),Yv({allowedPlacements:["bottom-start","top-start"],padding:10}),Io(),Dr({apply({elements:w,availableHeight:M}){w.floating.style.maxHeight=`${Math.max(0,M)}px`},padding:10})],...(C=t.floatingUIOptions)==null?void 0:C.useFloatingOptions},elementProps:{onMouseDownCapture:w=>w.preventDefault(),style:{zIndex:80},...(T=t.floatingUIOptions)==null?void 0:T.elementProps}}},[t.floatingUIOptions,v?.show,v?.triggerCharacter,h,a]);return!v||!v.ignoreQueryLength&&s&&(v.query.startsWith(" ")||v.query.length<s)?null:g.jsx(Bn,{reference:y,...x,children:a&&g.jsx(k8,{query:v.query,closeMenu:h.closeMenu,clearQuery:h.clearQuery,getItems:p,suggestionMenuComponent:r||H8,onItemClick:d})})}const G8=(t,o=.3)=>{const a=Math.floor(t)+o,r=Math.ceil(t)-o;return t>=a&&t<=r?Math.round(t):t<a?Math.floor(t):Math.ceil(t)},Z8=t=>{const o=ue(),a=pe(),r=Ae(Fe),s=qe(Fe,{selector:v=>v?.block}),c=S.useRef(!1),[f,d]=S.useState(),p=S.useCallback(v=>{r.freezeHandles(),t.hideOtherElements(!0),s&&(d({originalContent:s.content,originalCroppedContent:{rows:r.cropEmptyRowsOrColumns(s,t.orientation==="addOrRemoveColumns"?"columns":"rows")},startPos:t.orientation==="addOrRemoveColumns"?v.clientX:v.clientY}),c.current=!1,v.preventDefault())},[s,t,r]),h=S.useCallback(()=>{!s||c.current||a.updateBlock(s,{type:"table",content:{...s.content,rows:t.orientation==="addOrRemoveColumns"?r.addRowsOrColumns(s,"columns",1):r.addRowsOrColumns(s,"rows",1)}})},[s,a,t.orientation,r]);return S.useEffect(()=>{const v=y=>{var x,C;if(!s)return;if(!f)throw new Error("editingState is undefined");c.current=!0;const T=(t.orientation==="addOrRemoveColumns"?y.clientX:y.clientY)-f.startPos,w=t.orientation==="addOrRemoveColumns"?((x=f.originalCroppedContent.rows[0])==null?void 0:x.cells.length)??0:f.originalCroppedContent.rows.length,M=t.orientation==="addOrRemoveColumns"?((C=f.originalContent.rows[0])==null?void 0:C.cells.length)??0:f.originalContent.rows.length,R=t.orientation==="addOrRemoveColumns"?s.content.rows[0].cells.length:s.content.rows.length,_=M+G8(T/(t.orientation==="addOrRemoveColumns"?RS:jS),.3);_>=w&&_>0&&_!==R&&(a.updateBlock(s,{type:"table",content:{...s.content,rows:t.orientation==="addOrRemoveColumns"?r.addRowsOrColumns({type:"table",content:f.originalCroppedContent},"columns",_-w):r.addRowsOrColumns({type:"table",content:f.originalCroppedContent},"rows",_-w)}}),s.content&&a.setTextCursorPosition(s))};return f&&window.addEventListener("mousemove",v),()=>{window.removeEventListener("mousemove",v)}},[s,f,a,t.orientation,r]),S.useEffect(()=>{const v=()=>{t.hideOtherElements(!1),r.unfreezeHandles(),d(void 0)};return f&&window.addEventListener("mouseup",v),()=>{window.removeEventListener("mouseup",v)}},[f,t,r]),a.isEditable?g.jsx(o.TableHandle.ExtendButton,{className:ht("bn-extend-button",t.orientation==="addOrRemoveColumns"?"bn-extend-button-add-remove-columns":"bn-extend-button-add-remove-rows",f!==null?"bn-extend-button-editing":""),onClick:h,onMouseDown:p,children:t.children||g.jsx(L3,{size:18,"data-test":"extendButton"})}):null},U0=t=>{const o=ue(),a=Se(),r=Ae(Fe),s=qe(Fe,{selector:c=>t.orientation==="column"?c?.colIndex:c?.rowIndex});return r===void 0||s===void 0?null:g.jsx(o.Generic.Menu.Item,{onClick:()=>{r.addRowOrColumn(s,t.orientation==="row"?{orientation:"row",side:t.side}:{orientation:"column",side:t.side})},children:a.table_handle[`add_${t.side}_menuitem`]})},q8=t=>{const o=ue(),a=Se(),r=Ae(Fe),s=qe(Fe,{selector:c=>t.orientation==="column"?c?.colIndex:c?.rowIndex});return r===void 0||s===void 0?null:g.jsx(o.Generic.Menu.Item,{onClick:()=>r.removeRowOrColumn(s,t.orientation),children:t.orientation==="row"?a.table_handle.delete_row_menuitem:a.table_handle.delete_column_menuitem})},Y8=t=>{const o=ue(),a=Se(),r=pe(),s=Ae(Fe),{block:c,index:f}=qe(Fe,{selector:v=>({block:v?.block,index:t.orientation==="column"?v?.colIndex:v?.rowIndex})}),d=S.useMemo(()=>s===void 0||c===void 0||f===void 0?[]:t.orientation==="row"?s.getCellsAtRowHandle(c,f):s.getCellsAtColumnHandle(c,f),[c,f,t.orientation,s]),p=(v,y)=>{if(c===void 0)return;const x=c.content.rows.map(C=>({...C,cells:C.cells.map(T=>Nr(T))}));d.forEach(({row:C,col:T})=>{y==="text"?x[C].cells[T].props.textColor=v:x[C].cells[T].props.backgroundColor=v}),r.updateBlock(c,{type:"table",content:{...c.content,rows:x}}),r.setTextCursorPosition(c)};if(!d||!d[0]||!s||r.settings.tables.cellTextColor===!1&&r.settings.tables.cellBackgroundColor===!1)return null;const h=Nr(d[0].cell);return g.jsxs(o.Generic.Menu.Root,{position:"right",sub:!0,children:[g.jsx(o.Generic.Menu.Trigger,{sub:!0,children:g.jsx(o.Generic.Menu.Item,{className:"bn-menu-item",subTrigger:!0,children:t.children||a.drag_handle.colors_menuitem})}),g.jsx(o.Generic.Menu.Dropdown,{sub:!0,className:"bn-menu-dropdown bn-color-picker-dropdown",children:g.jsx(ec,{iconSize:18,text:r.settings.tables.cellTextColor?{color:d.every(({cell:v})=>Ar(v)&&v.props.textColor===h.props.textColor)?h.props.textColor:"default",setColor:v=>{p(v,"text")}}:void 0,background:r.settings.tables.cellBackgroundColor?{color:d.every(({cell:v})=>Ar(v)&&v.props.backgroundColor===h.props.backgroundColor)?h.props.backgroundColor:"default",setColor:v=>p(v,"background")}:void 0})})]})},X8=t=>{const o=ue(),a=Se(),r=pe(),s=Ae(Fe),{block:c,index:f}=qe(Fe,{selector:p=>({block:p?.block,index:t.orientation==="column"?p?.colIndex:p?.rowIndex})});if(s===void 0||c===void 0||f!==0||t.orientation!=="row"||!r.settings.tables.headers)return null;const d=!!c.content.headerRows;return g.jsx(o.Generic.Menu.Item,{className:"bn-menu-item",checked:d,onClick:()=>{r.updateBlock(c,{...c,content:{...c.content,headerRows:d?void 0:1}})},children:a.drag_handle.header_row_menuitem})},P8=t=>{const o=ue(),a=Se(),r=pe(),s=Ae(Fe),c=qe(Fe,{selector:p=>p?.block}),f=qe(Fe,{selector:p=>t.orientation==="column"?p?.colIndex:p?.rowIndex});if(!s||f!==0||!c||t.orientation!=="column"||!r.settings.tables.headers)return null;const d=!!c.content.headerCols;return g.jsx(o.Generic.Menu.Item,{className:"bn-menu-item",checked:d,onClick:()=>{r.updateBlock(c,{...c,content:{...c.content,headerCols:d?void 0:1}})},children:a.drag_handle.header_column_menuitem})},Q8=t=>{const o=ue();return g.jsx(o.Generic.Menu.Dropdown,{className:"bn-table-handle-menu",children:t.children||g.jsxs(g.Fragment,{children:[g.jsx(q8,{orientation:t.orientation}),g.jsx(U0,{orientation:t.orientation,side:t.orientation==="row"?"above":"left"}),g.jsx(U0,{orientation:t.orientation,side:t.orientation==="row"?"below":"right"}),g.jsx(X8,{orientation:t.orientation}),g.jsx(P8,{orientation:t.orientation}),g.jsx(Y8,{orientation:t.orientation})]})})},I8=t=>{const o=pe(),a=ue(),[r,s]=S.useState(!1),c=t.tableHandleMenu||Q8,f=Ae(Fe),d=qe(Fe),p=S.useMemo(()=>!f||!d||!d.block||d.block.type!=="table"?!1:t.orientation==="column"?f.getCellsAtColumnHandle(d.block,d.colIndex).every(({cell:h})=>vv(h)===1):f.getCellsAtRowHandle(d.block,d.rowIndex).every(({cell:h})=>yv(h)===1),[t.orientation,d,f]);return d?g.jsxs(a.Generic.Menu.Root,{onOpenChange:h=>{h?(f.freezeHandles(),t.hideOtherElements(!0)):(f.unfreezeHandles(),t.hideOtherElements(!1),o.focus())},position:"right",children:[g.jsx(a.Generic.Menu.Trigger,{children:g.jsx(a.TableHandle.Root,{className:ht("bn-table-handle",r?"bn-table-handle-dragging":"",p?"":"bn-table-handle-not-draggable"),draggable:p,onDragStart:h=>{s(!0),t.hideOtherElements(!0),t.orientation==="column"?f.colDragStart(h):f.rowDragStart(h)},onDragEnd:()=>{f.dragEnd(),t.hideOtherElements(!1),s(!1)},style:t.orientation==="column"?{transform:"rotate(0.25turn)"}:void 0,children:t.children||g.jsx(Ry,{size:24,"data-test":"tableHandle"})})}),g.jsx(c,{orientation:t.orientation})]}):null},K8=t=>{var o,a;const r=ue(),s=Se(),c=pe(),{block:f,colIndex:d,rowIndex:p}=qe(Fe,{selector:y=>({block:y?.block,colIndex:y?.colIndex,rowIndex:y?.rowIndex})}),h=(y,x)=>{if(f===void 0||d===void 0||p===void 0)return;const C=f.content.rows.map(T=>({...T,cells:T.cells.map(w=>Nr(w))}));x==="text"?C[p].cells[d].props.textColor=y:C[p].cells[d].props.backgroundColor=y,c.updateBlock(f,{type:"table",content:{...f.content,rows:C}}),c.setTextCursorPosition(f)};if(f===void 0||d===void 0||p===void 0)return null;const v=(a=(o=f.content.rows[p])==null?void 0:o.cells)==null?void 0:a[d];return!v||c.settings.tables.cellTextColor===!1&&c.settings.tables.cellBackgroundColor===!1?null:g.jsxs(r.Generic.Menu.Root,{position:"right",sub:!0,children:[g.jsx(r.Generic.Menu.Trigger,{sub:!0,children:g.jsx(r.Generic.Menu.Item,{className:"bn-menu-item",subTrigger:!0,children:t.children||s.drag_handle.colors_menuitem})}),g.jsx(r.Generic.Menu.Dropdown,{sub:!0,className:"bn-menu-dropdown bn-color-picker-dropdown",children:g.jsx(ec,{iconSize:18,text:c.settings.tables.cellTextColor?{color:Ar(v)?v.props.textColor:"default",setColor:y=>h(y,"text")}:void 0,background:c.settings.tables.cellBackgroundColor?{color:Ar(v)?v.props.backgroundColor:"default",setColor:y=>h(y,"background")}:void 0})})]})},F8=()=>{var t,o;const a=ue(),r=Se(),s=pe(),c=Ae(Fe),{block:f,colIndex:d,rowIndex:p}=qe(Fe,{selector:v=>({block:v?.block,colIndex:v?.colIndex,rowIndex:v?.rowIndex})});if(f===void 0||d===void 0||p===void 0)return null;const h=(o=(t=f.content.rows[p])==null?void 0:t.cells)==null?void 0:o[d];return!h||!Ar(h)||yv(h)===1&&vv(h)===1||!s.settings.tables.splitCells?null:g.jsx(a.Generic.Menu.Item,{onClick:()=>{c.splitCell({row:p,col:d})},children:r.table_handle.split_cell_menuitem})},J8=t=>{const o=ue();return g.jsx(o.Generic.Menu.Dropdown,{className:"bn-menu-dropdown bn-table-handle-menu",children:t.children||g.jsxs(g.Fragment,{children:[g.jsx(F8,{}),g.jsx(K8,{})]})})},W8=t=>{const o=ue(),a=pe(),r=Ae(Fe),s=t.tableCellMenu||J8;return!a.settings.tables.splitCells&&!a.settings.tables.cellBackgroundColor&&!a.settings.tables.cellTextColor?null:g.jsxs(o.Generic.Menu.Root,{onOpenChange:c=>{c?(r.freezeHandles(),t.hideOtherElements(!0)):(r.unfreezeHandles(),t.hideOtherElements(!1),a.focus())},position:"right",children:[g.jsx(o.Generic.Menu.Trigger,{children:g.jsx(o.Generic.Menu.Button,{className:"bn-table-cell-handle",children:t.children||g.jsx(x8,{size:12,"data-test":"tableCellHandle"})})}),g.jsx(s,{})]})},e7=t=>{const o=pe(),[a,r]=S.useState(),s=qe(Fe),c=S.useMemo(()=>{const v={};if(s===void 0)return{};const y=gv(s.block.id,o.prosemirrorState.doc);if(!y)return{};const x=y.posBeforeNode+1,C=o.prosemirrorView.domAtPos(x+1).node;if(!(C instanceof Element))return{};if(v.tableReference={element:C},s.rowIndex===void 0||s.colIndex===void 0)return v;const T=o.prosemirrorState.doc.resolve(x+1).posAtIndex(s.rowIndex),w=o.prosemirrorState.doc.resolve(T+1).posAtIndex(s.colIndex),M=o.prosemirrorView.domAtPos(w+1).node;return M instanceof Element?(v.cellReference={element:M},v.rowReference={element:C,getBoundingClientRect:()=>{const R=C.getBoundingClientRect(),_=M.getBoundingClientRect();return new DOMRect(R.x,s.draggingState&&s.draggingState.draggedCellOrientation==="row"?s.draggingState.mousePos-_.height/2:_.y,R.width,_.height)}},v.columnReference={element:C,getBoundingClientRect:()=>{const R=C.getBoundingClientRect(),_=M.getBoundingClientRect();return new DOMRect(s.draggingState&&s.draggingState.draggedCellOrientation==="col"?s.draggingState.mousePos-_.width/2:_.x,R.y,_.width,R.height)}},v):{}},[o,s]),f=S.useMemo(()=>s!==void 0?{rowTableHandle:{useFloatingOptions:{open:s.show&&s.rowIndex!==void 0&&(!a||a==="rowTableHandle"),placement:"left",middleware:[mn(-10)]},elementProps:{style:{zIndex:10}}},columnTableHandle:{useFloatingOptions:{open:s.show&&s.colIndex!==void 0&&(!a||a==="columnTableHandle"),placement:"top",middleware:[mn(-12)]},elementProps:{style:{zIndex:10}}},tableCellHandle:{useFloatingOptions:{open:s.show&&s.rowIndex!==void 0&&s.colIndex!==void 0&&(!a||a==="tableCellHandle"),placement:"top-end",middleware:[mn({mainAxis:-15,crossAxis:-1})]},elementProps:{style:{zIndex:10}}},extendRowsButton:{useFloatingOptions:{open:s.show&&s.showAddOrRemoveRowsButton&&(!a||a==="extendRowsButton"),placement:"bottom",middleware:[Dr({apply({rects:v,elements:y}){Object.assign(y.floating.style,{width:`${v.reference.width}px`})}})]},elementProps:{style:{zIndex:10}}},extendColumnsButton:{useFloatingOptions:{open:s.show&&s.showAddOrRemoveColumnsButton&&(!a||a==="extendColumnsButton"),placement:"right",middleware:[Dr({apply({rects:v,elements:y}){Object.assign(y.floating.style,{height:`${v.reference.height}px`})}})]},elementProps:{style:{zIndex:10}}}}:void 0,[a,s]);if(!s)return null;const d=t.tableHandle||I8,p=t.extendButton||Z8,h=t.tableCellHandle||W8;return g.jsxs(g.Fragment,{children:[g.jsx(Bn,{reference:c?.rowReference,...f?.rowTableHandle,children:s.show&&s.rowIndex!==void 0&&(!a||a==="rowTableHandle")&&g.jsx(d,{orientation:"row",hideOtherElements:v=>r(v?"rowTableHandle":void 0)})}),g.jsx(Bn,{reference:c?.columnReference,...f?.columnTableHandle,children:s.show&&s.colIndex!==void 0&&(!a||a==="columnTableHandle")&&g.jsx(d,{orientation:"column",hideOtherElements:v=>r(v?"columnTableHandle":void 0)})}),g.jsx(Bn,{reference:c?.cellReference,...f?.tableCellHandle,children:s.show&&s.rowIndex!==void 0&&s.colIndex!==void 0&&(!a||a==="tableCellHandle")&&g.jsx(h,{hideOtherElements:v=>r(v?"tableCellHandle":void 0)})}),g.jsx(Bn,{reference:c?.tableReference,...f?.extendRowsButton,children:s.show&&s.showAddOrRemoveRowsButton&&(!a||a==="extendRowsButton")&&g.jsx(p,{orientation:"addOrRemoveRows",hideOtherElements:v=>r(v?"extendRowsButton":void 0)})}),g.jsx(Bn,{reference:c?.tableReference,...f?.extendColumnsButton,children:s.show&&s.showAddOrRemoveColumnsButton&&(!a||a==="extendColumnsButton")&&g.jsx(p,{orientation:"addOrRemoveColumns",hideOtherElements:v=>r(v?"extendColumnsButton":void 0)})})]})},t7=S.lazy(()=>Promise.resolve().then(()=>T7)),n7=S.lazy(()=>Promise.resolve().then(()=>R7));function o7(t){const o=pe();if(!o)throw new Error("BlockNoteDefaultUI must be used within a BlockNoteContext.Provider");return g.jsxs(g.Fragment,{children:[o.getExtension(Or)&&t.formattingToolbar!==!1&&g.jsx(My,{}),o.getExtension(Xs)&&t.linkToolbar!==!1&&g.jsx(v8,{}),o.getExtension(po)&&t.slashMenu!==!1&&g.jsx($8,{triggerCharacter:"/"}),o.getExtension(po)&&t.emojiPicker!==!1&&g.jsx(D8,{triggerCharacter:":",columns:10,minQueryLength:2}),o.getExtension(Gn)&&t.sideMenu!==!1&&g.jsx(j8,{}),o.getExtension(Ed)&&t.filePanel!==!1&&g.jsx(I5,{}),o.getExtension(Fe)&&t.tableHandles!==!1&&g.jsx(e7,{}),o.getExtension(gn)&&t.comments!==!1&&g.jsxs(S.Suspense,{children:[g.jsx(t7,{}),g.jsx(n7,{})]})]})}function l7(t,o){const a=Mn();o||(o=a?.editor),S.useEffect(()=>{if(!o)throw new Error("'editor' is required, either from BlockNoteContext or as a function argument");return o.onChange(t)},[t,o])}function a7(t,o,a){const r=Mn();o||(o=r?.editor),S.useEffect(()=>{if(!o)throw new Error("'editor' is required, either from BlockNoteContext or as a function argument");return o.onSelectionChange(t,a)},[t,o,a])}const Oy=()=>{const t=S.useMemo(()=>{var f;return(f=window.matchMedia)==null?void 0:f.call(window,"(prefers-color-scheme: dark)")},[]),o=S.useMemo(()=>{var f;return(f=window.matchMedia)==null?void 0:f.call(window,"(prefers-color-scheme: light)")},[]),a=t?.matches,r=o?.matches,[s,c]=S.useState(a?"dark":r?"light":"no-preference");return S.useEffect(()=>{c(a?"dark":r?"light":"no-preference")},[a,r]),S.useEffect(()=>{if(typeof t?.addEventListener=="function"){const f=({matches:p})=>p&&c("dark"),d=({matches:p})=>p&&c("light");return t?.addEventListener("change",f),o?.addEventListener("change",d),()=>{t?.removeEventListener("change",f),o?.removeEventListener("change",d)}}else{const f=()=>c(t.matches?"dark":o.matches?"light":"no-preference");return t?.addEventListener("change",f),o?.addEventListener("change",f),()=>{t?.removeEventListener("change",f),o?.removeEventListener("change",f)}}},[t,o]),s},Ny=S.createContext(void 0);function r7(){return S.useContext(Ny)}function i7(){const t=new Set;let o={};return{subscribe(a){return t.add(a),()=>{t.delete(a)}},getSnapshot(){return o},getServerSnapshot(){return o},setRenderer(a,r){o={...o,[a]:Zn.createPortal(r.reactElement,r.element,a)},t.forEach(s=>s())},removeRenderer(a){const r={...o};delete r[a],o=r,t.forEach(s=>s())}}}const s7=({contentComponent:t})=>{const o=S.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return g.jsx(g.Fragment,{children:Object.values(o)})},c7=S.forwardRef((t,o)=>{const[a,r]=S.useState();return S.useImperativeHandle(o,()=>(s,c)=>{Zn.flushSync(()=>{r({node:s,container:c})}),r(void 0)},[]),g.jsx(g.Fragment,{children:a&&Zn.createPortal(a.node,a.container)})}),$0=()=>{};function u7(t,o){const{editor:a,className:r,theme:s,children:c,editable:f,onSelectionChange:d,onChange:p,formattingToolbar:h,linkToolbar:v,slashMenu:y,emojiPicker:x,sideMenu:C,filePanel:T,tableHandles:w,comments:M,autoFocus:R,renderEditor:_=!0,...N}=t,[A,H]=S.useState(),L=Mn(),Z=Oy(),I=L?.colorSchemePreference||Z,J=s||(I==="dark"?"dark":"light");l7(p||$0,a),a7(d||$0,a);const P=S.useCallback(te=>{a.elementRenderer=te},[a]),ee=S.useMemo(()=>({...L,editor:a,setContentEditableProps:H,colorSchemePreference:J}),[L,a,J]),oe=S.useMemo(()=>({editorProps:{autoFocus:R,contentEditableProps:A,editable:f},defaultUIProps:{formattingToolbar:h,linkToolbar:v,slashMenu:y,emojiPicker:x,sideMenu:C,filePanel:T,tableHandles:w,comments:M}}),[R,A,f,h,v,y,x,C,T,w,M]);return g.jsx(ry.Provider,{value:ee,children:g.jsxs(Ny.Provider,{value:oe,children:[g.jsx(c7,{ref:P}),g.jsx(f7,{className:r,renderEditor:_,editorColorScheme:J,ref:o,...N,children:c})]})})}const f7=Ve.forwardRef(({className:t,renderEditor:o,editorColorScheme:a,children:r,...s},c)=>g.jsx("div",{className:ht("bn-container",a,t),"data-color-scheme":a,...s,ref:c,children:o?g.jsx(m7,{children:r}):r})),d7=Ve.forwardRef(u7),m7=t=>{const o=r7(),a=pe(),r=S.useMemo(()=>i7(),[]),s=S.useCallback(c=>{a.isEditable=o.editorProps.editable!==!1,a._tiptapEditor.contentComponent=r,c?a.mount(c):a.unmount()},[o.editorProps.editable,a,r]);return g.jsxs(g.Fragment,{children:[g.jsx(s7,{contentComponent:r}),g.jsx(p7,{...o.editorProps,...t,mount:s}),g.jsx(o7,{...o.defaultUIProps}),t.children]})},p7=t=>{const{autoFocus:o,mount:a,contentEditableProps:r}=t;return g.jsx("div",{"aria-autocomplete":"list","aria-haspopup":"listbox","data-bn-autofocus":o,ref:a,...r})};function _r(t,o){let a;const r=document.createElement("div");let s;if(o!=null&&o.elementRenderer)o.elementRenderer(t(p=>a=p||void 0),r);else{if(!(o!=null&&o.headless))throw new Error("elementRenderer not available, expected headless editor");s=Sv.createRoot(r),Zn.flushSync(()=>{s.render(t(p=>a=p||void 0))})}if(!r.childElementCount)return console.warn("ReactInlineContentSpec: renderHTML() failed"),{dom:document.createElement("span")};a?.setAttribute("data-tmp-find","true");const c=r.cloneNode(!0),f=c.firstElementChild,d=c.querySelector("[data-tmp-find]");return d?.removeAttribute("data-tmp-find"),s?.unmount(),{dom:f,contentDOM:d||void 0}}function ud(t){var o;return g.jsx(ny,{onDragOver:a=>a.preventDefault(),...Object.fromEntries(Object.entries(t.domAttributes||{}).filter(([a])=>a!=="class")),className:ht("bn-block-content",((o=t.domAttributes)==null?void 0:o.class)||""),"data-content-type":t.blockType,...Object.fromEntries(Object.entries(t.blockProps).filter(([a,r])=>{const s=t.propSchema[a];return r!==s.default}).map(([a,r])=>[bv(a),r])),"data-file-block":t.isFileBlock===!0||void 0,children:t.children})}function rE(t,o,a){return(r={})=>{const s=typeof t=="function"?t(r):t,c=typeof o=="function"?o(r):o,f=a?typeof a=="function"?a(r):a:void 0;return{config:s,implementation:{...c,toExternalHTML(d,p,h){const v=c.toExternalHTML||c.render;return _r(y=>g.jsx(ud,{blockType:d.type,blockProps:d.props,propSchema:s.propSchema,domAttributes:this.blockContentDOMAttributes,children:g.jsx(v,{block:d,editor:p,contentRef:x=>{y(x),x&&(x.className=ht("bn-inline-content",x.className))},context:h})}),p)},render(d,p){if(this.renderType==="nodeView")return oy(h=>{var v;const y=AS(h.getPos,p,h.editor,s.type),x=Pd().nodeViewContentRef;if(!x)throw new Error("nodeViewContentRef is not set");const C=c.render;return g.jsx(ud,{blockType:y.type,blockProps:y.props,propSchema:s.propSchema,isFileBlock:!!((v=c.meta)!=null&&v.fileBlockAccept),domAttributes:this.blockContentDOMAttributes,children:g.jsx(C,{block:y,editor:p,contentRef:T=>{x(T),T&&(T.className=ht("bn-inline-content",T.className),T.dataset.nodeViewContent="")}})})},{className:"bn-react-node-view-renderer"})(this.props);{const h=c.render;return _r(v=>g.jsx(ud,{blockType:d.type,blockProps:d.props,propSchema:s.propSchema,domAttributes:this.blockContentDOMAttributes,children:g.jsx(h,{block:d,editor:p,contentRef:y=>{v(y),y&&(y.className=ht("bn-inline-content",y.className))}})}),p)}}},extensions:f}}}const Fd=(t={},o=[])=>S.useMemo(()=>{const a=pS.create(t);return window&&(window.ProseMirror=a._tiptapEditor),a},o),Jd=t=>{const[o,a]=S.useState(!1),r=gt({editor:t.editor,selector:({editor:d})=>d.isEmpty}),s=ue(),c=S.useCallback(()=>{a(!0)},[]),f=S.useCallback(()=>{a(!1)},[]);return S.useEffect(()=>{t.editable&&t.autoFocus&&t.editor.focus()},[t.autoFocus,t.editable,t.editor]),g.jsxs(g.Fragment,{children:[g.jsx(s.Comments.Editor,{autoFocus:t.autoFocus,className:"bn-comment-editor",editor:t.editor,onFocus:c,onBlur:f,editable:t.editable}),t.actions&&g.jsx("div",{className:"bn-comment-actions-wrapper",children:g.jsx(t.actions,{isFocused:o,isEmpty:r})})]})};let fd;async function h7(){return fd||(fd=(async()=>{const[t,o]=await Promise.all([Os(()=>import("./module-RjUF93sV.js"),[]),Os(()=>import("./native-48B9X9Wg.js"),[])]),a="default"in t?t.default:t,r="default"in o?o.default:o;return await a.init({data:r}),{emojiMart:a,emojiData:r}})(),fd)}function g7(t){const o=S.useRef(null),a=S.useRef(null);return a.current&&a.current.update(t),S.useEffect(()=>((async()=>{const{emojiMart:r}=await h7();a.current=new r.Picker({...t,ref:o})})(),()=>{a.current=null}),[]),Ve.createElement("div",{ref:o})}const G0=t=>{var o;const[a,r]=S.useState(!1),s=ue(),c=pe(),f=Mn();return g.jsxs(s.Generic.Popover.Root,{open:a,children:[g.jsx(s.Generic.Popover.Trigger,{children:g.jsx("div",{onClick:d=>{var p;d.preventDefault(),d.stopPropagation(),r(!a),(p=t.onOpenChange)==null||p.call(t,!a)},style:{display:"flex",justifyContent:"center",alignItems:"center"},children:t.children})}),((o=c.domElement)==null?void 0:o.parentElement)&&Zn.createPortal(g.jsx(s.Generic.Popover.Content,{className:"bn-emoji-picker-popover",variant:"panel-popover",children:g.jsx(g7,{perLine:7,onClickOutside:()=>{var d;r(!1),(d=t.onOpenChange)==null||d.call(t,!1)},onEmojiSelect:d=>{var p;t.onEmojiSelect(d),r(!1),(p=t.onOpenChange)==null||p.call(t,!1)},theme:f?.colorSchemePreference})}),c.domElement.parentElement)]})};function v7(t){return Wd([t]).get(t)}function Wd(t){const o=Ae(gn).userStore,a=S.useCallback(()=>{const c=new Map;for(const f of t){const d=o.getUser(f);d&&c.set(f,d)}return c},[o,t]),r=S.useMemo(()=>({current:a()}),[a]),s=S.useCallback(c=>{const f=o.subscribe(d=>{r.current=a(),c()});return o.loadUsers(t),f},[o,a,t,r]);return S.useSyncExternalStore(s,()=>r.current)}const y7=t=>{const o=ue(),a=Se(),r=Ae(gn),s=t.comment.reactions.find(p=>p.emoji===t.emoji);if(!s)throw new Error("Trying to render reaction badge for non-existing reaction");const[c,f]=S.useState([]),d=Wd(c);return g.jsx(o.Generic.Badge.Root,{className:ht("bn-badge","bn-comment-reaction"),text:s.userIds.length.toString(),icon:s.emoji,isSelected:r.threadStore.auth.canDeleteReaction(t.comment,s.emoji),onClick:()=>t.onReactionSelect(s.emoji),onMouseEnter:()=>f(s.userIds),mainTooltip:a.comments.reactions.reacted_by,secondaryTooltip:`${Array.from(d.values()).map(p=>p.username).join(`
|
|
50
|
-
`)}`},s.emoji)},{textColor:iE,backgroundColor:sE,...b7}=OS,em=_S.create({blockSpecs:{paragraph:NS()},styleSpecs:b7}),x7=({comment:t,thread:o,showResolveButton:a})=>{const r=Ae(gn),s=Se(),c=Fd({initialContent:t.body,trailingBlock:!1,dictionary:{...s,placeholders:{emptyDocument:s.placeholders.edit_comment}},schema:r.commentEditorSchema||em}),f=ue(),[d,p]=S.useState(!1),[h,v]=S.useState(!1),y=r.threadStore,x=S.useCallback(()=>{p(!0)},[]),C=S.useCallback(()=>{c.replaceBlocks(c.document,t.body),p(!1)},[c,t.body]),T=S.useCallback(async P=>{await y.updateComment({commentId:t.id,comment:{body:c.document},threadId:o.id}),p(!1)},[t,o.id,c,y]),w=S.useCallback(async()=>{await y.deleteComment({commentId:t.id,threadId:o.id})},[t,o.id,y]),M=S.useCallback(async P=>{y.auth.canAddReaction(t,P)?await y.addReaction({threadId:o.id,commentId:t.id,emoji:P}):y.auth.canDeleteReaction(t,P)&&await y.deleteReaction({threadId:o.id,commentId:t.id,emoji:P})},[y,t,o.id]),R=S.useCallback(async()=>{await y.resolveThread({threadId:o.id})},[o.id,y]),_=S.useCallback(async()=>{await y.unresolveThread({threadId:o.id})},[o.id,y]),N=v7(t.userId);if(!t.body)return null;let A;const H=y.auth.canAddReaction(t),L=y.auth.canDeleteComment(t),Z=y.auth.canUpdateComment(t),I=a&&(o.resolved?y.auth.canUnresolveThread(o):y.auth.canResolveThread(o));d||(A=g.jsxs(f.Generic.Toolbar.Root,{className:ht("bn-action-toolbar","bn-comment-actions"),variant:"action-toolbar",children:[H&&g.jsx(G0,{onEmojiSelect:P=>M(P.native),onOpenChange:v,children:g.jsx(f.Generic.Toolbar.Button,{mainTooltip:s.comments.actions.add_reaction,variant:"compact",children:g.jsx(V0,{size:16})},"add-reaction")}),I&&(o.resolved?g.jsx(f.Generic.Toolbar.Button,{mainTooltip:"Re-open",variant:"compact",onClick:_,children:g.jsx(d3,{size:16})},"reopen"):g.jsx(f.Generic.Toolbar.Button,{mainTooltip:s.comments.actions.resolve,variant:"compact",onClick:R,children:g.jsx(V3,{size:16})},"resolve")),(L||Z)&&g.jsxs(f.Generic.Menu.Root,{position:"bottom-start",children:[g.jsx(f.Generic.Menu.Trigger,{children:g.jsx(f.Generic.Toolbar.Button,{mainTooltip:s.comments.actions.more_actions,variant:"compact",children:g.jsx(G3,{size:16})},"more-actions")}),g.jsxs(f.Generic.Menu.Dropdown,{className:"bn-menu-dropdown",children:[Z&&g.jsx(f.Generic.Menu.Item,{icon:g.jsx(m3,{}),onClick:x,children:s.comments.actions.edit_comment},"edit-comment"),L&&g.jsx(f.Generic.Menu.Item,{icon:g.jsx(B3,{}),onClick:w,children:s.comments.actions.delete_comment},"delete-comment")]})]})]}));const J=t.createdAt.toLocaleDateString(void 0,{month:"short",day:"numeric"});if(!t.body)throw new Error("soft deletes are not yet supported");return g.jsx(f.Comments.Comment,{authorInfo:N??"loading",timeString:J,edited:t.updatedAt.getTime()!==t.createdAt.getTime(),showActions:"hover",actions:A,className:"bn-thread-comment",emojiPickerOpen:h,children:g.jsx(Jd,{autoFocus:d,editor:c,editable:d,actions:t.reactions.length>0||d?({isEmpty:P})=>g.jsxs(g.Fragment,{children:[t.reactions.length>0&&!d&&g.jsxs(f.Generic.Badge.Group,{className:ht("bn-badge-group","bn-comment-reactions"),children:[t.reactions.map(ee=>g.jsx(y7,{comment:t,emoji:ee.emoji,onReactionSelect:M},ee.emoji)),H&&g.jsx(G0,{onEmojiSelect:ee=>M(ee.native),onOpenChange:v,children:g.jsx(f.Generic.Badge.Root,{className:ht("bn-badge","bn-comment-add-reaction"),text:"+",icon:g.jsx(V0,{size:16}),mainTooltip:s.comments.actions.add_reaction})})]}),d&&g.jsxs(f.Generic.Toolbar.Root,{variant:"action-toolbar",className:ht("bn-action-toolbar","bn-comment-actions"),children:[g.jsx(f.Generic.Toolbar.Button,{mainTooltip:s.comments.save_button_text,variant:"compact",onClick:T,isDisabled:P,children:s.comments.save_button_text}),g.jsx(f.Generic.Toolbar.Button,{className:"bn-button",mainTooltip:s.comments.cancel_button_text,variant:"compact",onClick:C,children:s.comments.cancel_button_text})]})]}):void 0})})},S7=({thread:t,maxCommentsBeforeCollapse:o})=>{const a=ue(),r=Se(),s=Wd(t.resolvedBy?[t.resolvedBy]:[]),c=t.comments.map((f,d)=>g.jsx(x7,{thread:t,comment:f,showResolveButton:d===0},f.id+JSON.stringify(f.body||"{}")));if(t.resolved&&t.resolvedUpdatedAt&&t.resolvedBy){if(!s.get(t.resolvedBy))throw new Error(`User ${t.resolvedBy} resolved thread ${t.id}, but their data could not be found.`);const f=t.comments.findLastIndex(d=>t.resolvedUpdatedAt.getTime()>d.createdAt.getTime())+1;c.splice(f,0,g.jsx(a.Comments.Comment,{className:"bn-thread-comment",authorInfo:t.resolvedBy&&s.get(t.resolvedBy)||"loading",timeString:t.resolvedUpdatedAt.toLocaleDateString(void 0,{month:"short",day:"numeric"}),edited:!1,showActions:!1,children:g.jsx("div",{className:"bn-resolved-text",children:r.comments.sidebar.marked_as_resolved})},"resolved-comment"))}return o&&c.length>o&&c.splice(1,c.length-2,g.jsx(a.Comments.ExpandSectionsPrompt,{className:"bn-thread-expand-prompt",children:r.comments.sidebar.more_replies(t.comments.length-2)},"expand-prompt")),c};function C7(){const t=Ae(gn),o=ue(),a=Se(),r=Fd({trailingBlock:!1,dictionary:{...a,placeholders:{emptyDocument:a.placeholders.new_comment}},schema:t.commentEditorSchema||em});return g.jsx(o.Comments.Card,{className:"bn-thread",children:g.jsx(Jd,{autoFocus:!0,editable:!0,editor:r,actions:({isEmpty:s})=>g.jsx(o.Generic.Toolbar.Root,{className:ht("bn-action-toolbar","bn-comment-actions"),variant:"action-toolbar",children:g.jsx(o.Generic.Toolbar.Button,{className:"bn-button",mainTooltip:"Save",variant:"compact",isDisabled:s,onClick:async()=>{await t.createThread({initialComment:{body:r.document}}),t.stopPendingComment()},children:"Save"})})})})}function w7(t){const o=pe(),a=Ae(gn),r=qe(gn,{editor:o,selector:d=>d.pendingComment}),s=gt({editor:o,selector:({editor:d})=>r?{from:d.prosemirrorState.selection.from,to:d.prosemirrorState.selection.to}:void 0}),c=S.useMemo(()=>{var d,p;return{...t.floatingUIOptions,useFloatingOptions:{open:!!r,onOpenChange:h=>{h||(a.stopPendingComment(),o.focus())},placement:"bottom",middleware:[mn(10),Io(),yo()],...(d=t.floatingUIOptions)==null?void 0:d.useFloatingOptions},elementProps:{style:{zIndex:60},...(p=t.floatingUIOptions)==null?void 0:p.elementProps}}},[a,o,r,t.floatingUIOptions]),f=t.floatingComposer||C7;return g.jsx(Id,{position:s,...c,children:g.jsx(f,{})})}const T7=Object.freeze(Object.defineProperty({__proto__:null,default:w7},Symbol.toStringTag,{value:"Module"})),Ay=({thread:t,selected:o,referenceText:a,maxCommentsBeforeCollapse:r,onFocus:s,onBlur:c,tabIndex:f})=>{const d=ue(),p=Se(),h=Ae(gn),v=Fd({trailingBlock:!1,dictionary:{...p,placeholders:{emptyDocument:p.placeholders.comment_reply}},schema:h.commentEditorSchema||em}),y=S.useCallback(async()=>{await h.threadStore.addComment({comment:{body:v.document},threadId:t.id}),v.removeBlocks(v.document)},[h,v,t.id]);return g.jsxs(d.Comments.Card,{className:"bn-thread",headerText:a,onFocus:s,onBlur:c,selected:o,tabIndex:f,children:[g.jsx(d.Comments.CardSection,{className:"bn-thread-comments",children:g.jsx(S7,{thread:t,maxCommentsBeforeCollapse:o?void 0:r||5})}),o&&g.jsx(d.Comments.CardSection,{className:"bn-thread-composer",children:g.jsx(Jd,{autoFocus:!1,editable:!0,editor:v,actions:({isEmpty:x})=>x?null:g.jsx(d.Generic.Toolbar.Root,{variant:"action-toolbar",className:ht("bn-action-toolbar","bn-comment-actions"),children:g.jsx(d.Generic.Toolbar.Button,{mainTooltip:p.comments.save_button_text,variant:"compact",isDisabled:x,onClick:y,children:p.comments.save_button_text})})})})]})};function E7(){const t=Ae(gn).threadStore,o=S.useRef(void 0);o.current||(o.current=t.getThreads());const a=S.useCallback(r=>t.subscribe(s=>{o.current=s,r()}),[t]);return S.useSyncExternalStore(a,()=>o.current)}function M7(t){const o=pe(),a=Ae(gn),r=qe(gn,{editor:o,selector:p=>p.selectedThreadId?{id:p.selectedThreadId,position:p.threadPositions.get(p.selectedThreadId)}:void 0}),s=E7(),c=S.useMemo(()=>r?s.get(r.id):void 0,[r,s]),f=S.useMemo(()=>{var p,h;return{...t.floatingUIOptions,useFloatingOptions:{open:!!r,onOpenChange:(v,y,x)=>{x==="escape-key"&&o.focus(),v||a.selectThread(void 0)},placement:"bottom",middleware:[mn(10),Io(),yo()],...(p=t.floatingUIOptions)==null?void 0:p.useFloatingOptions},elementProps:{style:{zIndex:30},...(h=t.floatingUIOptions)==null?void 0:h.elementProps}}},[a,o,t.floatingUIOptions,r]),d=t.floatingThread||Ay;return g.jsx(Id,{position:r?.position,...f,children:c&&g.jsx(d,{thread:c,selected:!0})})}const R7=Object.freeze(Object.defineProperty({__proto__:null,default:M7},Symbol.toStringTag,{value:"Module"}));Ve.memo(({thread:t,selectedThreadId:o,maxCommentsBeforeCollapse:a,referenceText:r})=>{const s=Ae(gn),c=S.useCallback(d=>{d.target.closest(".bn-action-toolbar")||s.selectThread(t.id)},[s,t.id]),f=S.useCallback(d=>{if(!d.relatedTarget||d.relatedTarget.closest(".bn-action-toolbar"))return;const p=d.target instanceof Node?d.target:null,h=d.relatedTarget instanceof Node?d.relatedTarget.closest(".bn-thread"):null;(!p||!h||!h.contains(p))&&s.selectThread(void 0)},[s]);return g.jsx(Ay,{thread:t,selected:t.id===o,referenceText:r,maxCommentsBeforeCollapse:a,onFocus:c,onBlur:f,tabIndex:0})});function dd(t){return g.jsx(ny,{as:"span",className:"bn-inline-content-section","data-inline-content-type":t.inlineContentType,...Object.fromEntries(Object.entries(t.inlineContentProps).filter(([o,a])=>{const r=t.propSchema[o];return a!==r.default}).map(([o,a])=>[bv(o),a])),children:t.children})}function cE(t,o){var a;const r=vS.create({name:t.type,inline:!0,group:"inline",selectable:t.content==="styled",atom:t.content==="none",draggable:(a=o.meta)==null?void 0:a.draggable,content:t.content==="styled"?"inline*":"",addAttributes(){return SS(t.propSchema)},addKeyboardShortcuts(){return xS(t)},parseHTML(){return bS(t,o.parse)},renderHTML({node:s}){const c=this.options.editor,f=zg(s,c.schema.inlineContentSchema,c.schema.styleSchema),d=o.toExternalHTML||o.render,p=_r(h=>g.jsx(d,{contentRef:v=>{h(v),v&&(v.dataset.editable="")},inlineContent:f,updateInlineContent:()=>{},editor:c}),c);return yS(p,t.type,s.attrs,t.propSchema)},addNodeView(){const s=this.options.editor;return c=>oy(f=>{const d=Pd().nodeViewContentRef;if(!d)throw new Error("nodeViewContentRef is not set");const p=o.render;return g.jsx(dd,{inlineContentProps:f.node.attrs,inlineContentType:t.type,propSchema:t.propSchema,children:g.jsx(p,{contentRef:h=>{d(h),h&&(h.dataset.editable="")},editor:s,inlineContent:zg(f.node,s.schema.inlineContentSchema,s.schema.styleSchema),updateInlineContent:h=>{const v=DS([h],s.pmSchema),y=f.getPos();y!==void 0&&s.transact(x=>x.replaceWith(y,y+f.node.nodeSize,v))}})})},{className:"bn-ic-react-node-view-renderer",as:"span"})(c)}});return CS(t,{...o,node:r,render(s,c,f){const d=o.render;return _r(p=>g.jsx(dd,{inlineContentProps:s.props,inlineContentType:t.type,propSchema:t.propSchema,children:g.jsx(d,{contentRef:h=>{p(h),h&&(h.dataset.editable="")},editor:f,inlineContent:s,updateInlineContent:c})}),f)},toExternalHTML(s,c){const f=o.toExternalHTML||o.render;return _r(d=>g.jsx(dd,{inlineContentProps:s.props,inlineContentType:t.type,propSchema:t.propSchema,children:g.jsx(f,{contentRef:p=>{d(p),p&&(p.dataset.editable="")},editor:c,inlineContent:s,updateInlineContent:()=>{}})}),c)}})}function Dy(t,o){const a=t.getBoundingClientRect(),r=o.getBoundingClientRect(),s=a.top<r.top,c=a.bottom>r.bottom;return s&&c?"both":s?"top":c?"bottom":"none"}function j7(t){return o=>{t.forEach(a=>{typeof a=="function"?a(o):a!=null&&(a.current=o)})}}function $n(t){return Object.keys(t)}function md(t){return t&&typeof t=="object"&&!Array.isArray(t)}function tm(t,o){const a={...t},r=o;return md(t)&&md(o)&&Object.keys(o).forEach(s=>{md(r[s])&&s in t?a[s]=tm(a[s],r[s]):a[s]=r[s]}),a}function _7(t){return t.replace(/[A-Z]/g,o=>`-${o.toLowerCase()}`)}function O7(t){return typeof t!="string"||!t.includes("var(--mantine-scale)")?t:t.match(/^calc\((.*?)\)$/)?.[1].split("*")[0].trim()}function N7(t){const o=O7(t);return typeof o=="number"?o:typeof o=="string"?o.includes("calc")||o.includes("var")?o:o.includes("px")?Number(o.replace("px","")):o.includes("rem")?Number(o.replace("rem",""))*16:o.includes("em")?Number(o.replace("em",""))*16:Number(o):NaN}function Z0(t){return t==="0rem"?"0rem":`calc(${t} * var(--mantine-scale))`}function Hy(t,{shouldScale:o=!1}={}){function a(r){if(r===0||r==="0")return`0${t}`;if(typeof r=="number"){const s=`${r/16}${t}`;return o?Z0(s):s}if(typeof r=="string"){if(r===""||r.startsWith("calc(")||r.startsWith("clamp(")||r.includes("rgba("))return r;if(r.includes(","))return r.split(",").map(c=>a(c)).join(",");if(r.includes(" "))return r.split(" ").map(c=>a(c)).join(" ");const s=r.replace("px","");if(!Number.isNaN(Number(s))){const c=`${Number(s)/16}${t}`;return o?Z0(c):c}}return r}return a}const F=Hy("rem",{shouldScale:!0}),q0=Hy("em");function tc(t){return Object.keys(t).reduce((o,a)=>(t[a]!==void 0&&(o[a]=t[a]),o),{})}function zy(t){if(typeof t=="number")return!0;if(typeof t=="string"){if(t.startsWith("calc(")||t.startsWith("var(")||t.includes(" ")&&t.trim()!=="")return!0;const o=/^[+-]?[0-9]+(\.[0-9]+)?(px|em|rem|ex|ch|lh|rlh|vw|vh|vmin|vmax|vb|vi|svw|svh|lvw|lvh|dvw|dvh|cm|mm|in|pt|pc|q|cqw|cqh|cqi|cqb|cqmin|cqmax|%)?$/;return t.trim().split(/\s+/).every(r=>o.test(r))}return!1}function Ly(t){return Array.isArray(t)||t===null?!1:typeof t=="object"?t.type!==S.Fragment:!1}function nc(t){const o=S.createContext(null);return[({children:s,value:c})=>g.jsx(o.Provider,{value:c,children:s}),()=>{const s=S.useContext(o);if(s===null)throw new Error(t);return s}]}function oc(t=null){const o=S.createContext(t);return[({children:s,value:c})=>g.jsx(o.Provider,{value:c,children:s}),()=>S.useContext(o)]}function Y0(t,o){return a=>{if(typeof a!="string"||a.trim().length===0)throw new Error(o);return`${t}-${a}`}}function Ls(t,o){let a=t;for(;(a=a.parentElement)&&!a.matches(o););return a}function A7(t,o,a){for(let r=t-1;r>=0;r-=1)if(!o[r].disabled)return r;if(a){for(let r=o.length-1;r>-1;r-=1)if(!o[r].disabled)return r}return t}function D7(t,o,a){for(let r=t+1;r<o.length;r+=1)if(!o[r].disabled)return r;if(a){for(let r=0;r<o.length;r+=1)if(!o[r].disabled)return r}return t}function H7(t,o,a){return Ls(t,a)===Ls(o,a)}function nm({parentSelector:t,siblingSelector:o,onKeyDown:a,loop:r=!0,activateOnFocus:s=!1,dir:c="rtl",orientation:f}){return d=>{a?.(d);const p=Array.from(Ls(d.currentTarget,t)?.querySelectorAll(o)||[]).filter(T=>H7(d.currentTarget,T,t)),h=p.findIndex(T=>d.currentTarget===T),v=D7(h,p,r),y=A7(h,p,r),x=c==="rtl"?y:v,C=c==="rtl"?v:y;switch(d.key){case"ArrowRight":{f==="horizontal"&&(d.stopPropagation(),d.preventDefault(),p[x].focus(),s&&p[x].click());break}case"ArrowLeft":{f==="horizontal"&&(d.stopPropagation(),d.preventDefault(),p[C].focus(),s&&p[C].click());break}case"ArrowUp":{f==="vertical"&&(d.stopPropagation(),d.preventDefault(),p[y].focus(),s&&p[y].click());break}case"ArrowDown":{f==="vertical"&&(d.stopPropagation(),d.preventDefault(),p[v].focus(),s&&p[v].click());break}case"Home":{d.stopPropagation(),d.preventDefault(),!p[0].disabled&&p[0].focus();break}case"End":{d.stopPropagation(),d.preventDefault();const T=p.length-1;!p[T].disabled&&p[T].focus();break}}}}const z7={app:100,modal:200,popover:300,overlay:400,max:9999};function Br(t){return z7[t]}const L7=()=>{};function V7(t,o={active:!0}){return typeof t!="function"||!o.active?o.onKeyDown||L7:a=>{a.key==="Escape"&&(t(a),o.onTrigger?.())}}function Xe(t,o="size",a=!0){if(t!==void 0)return zy(t)?a?F(t):t:`var(--${o}-${t})`}function Ur(t){return Xe(t,"mantine-spacing")}function Mt(t){return t===void 0?"var(--mantine-radius-default)":Xe(t,"mantine-radius")}function $t(t){return Xe(t,"mantine-font-size")}function k7(t){return Xe(t,"mantine-line-height",!1)}function Vy(t){if(t)return Xe(t,"mantine-shadow",!1)}function Bt(t,o){return a=>{t?.(a),o?.(a)}}function B7(t,o,a){return a?Array.from(Ls(a,o)?.querySelectorAll(t)||[]).findIndex(r=>r===a):null}function U7(t="mantine-"){return`${t}${Math.random().toString(36).slice(2,11)}`}function X0(t){const o=S.useRef(t);return S.useEffect(()=>{o.current=t}),S.useMemo(()=>((...a)=>o.current?.(...a)),[])}const $7=["mousedown","touchstart"];function G7(t,o,a){const r=S.useRef(null),s=o||$7;return S.useEffect(()=>{const c=f=>{const{target:d}=f??{};if(Array.isArray(a)){const p=!document.body.contains(d)&&d?.tagName!=="HTML";a.every(v=>!!v&&!f.composedPath().includes(v))&&!p&&t(f)}else r.current&&!r.current.contains(d)&&t(f)};return s.forEach(f=>document.addEventListener(f,c)),()=>{s.forEach(f=>document.removeEventListener(f,c))}},[r,t,a]),r}function Z7(t,o){try{return t.addEventListener("change",o),()=>t.removeEventListener("change",o)}catch{return t.addListener(o),()=>t.removeListener(o)}}function q7(t,o){return typeof window<"u"&&"matchMedia"in window?window.matchMedia(t).matches:!1}function Y7(t,o,{getInitialValueInEffect:a}={getInitialValueInEffect:!0}){const[r,s]=S.useState(a?o:q7(t));return S.useEffect(()=>{try{const c=window.matchMedia(t);return s(c.matches),Z7(c,f=>s(f.matches))}catch{return}},[t]),r||!1}const $r=typeof document<"u"?S.useLayoutEffect:S.useEffect;function zr(t,o){const a=S.useRef(!1);S.useEffect(()=>()=>{a.current=!1},[]),S.useEffect(()=>{if(a.current)return t();a.current=!0},o)}function X7({opened:t,shouldReturnFocus:o=!0}){const a=S.useRef(null),r=()=>{a.current&&"focus"in a.current&&typeof a.current.focus=="function"&&a.current?.focus({preventScroll:!0})};return zr(()=>{let s=-1;const c=f=>{f.key==="Tab"&&window.clearTimeout(s)};return document.addEventListener("keydown",c),t?a.current=document.activeElement:o&&(s=window.setTimeout(r,10)),()=>{window.clearTimeout(s),document.removeEventListener("keydown",c)}},[t,o]),r}const P7=/input|select|textarea|button|object/,ky="a, input, select, textarea, button, object, [tabindex]";function Q7(t){return t.style.display==="none"}function I7(t){if(t.getAttribute("aria-hidden")||t.getAttribute("hidden")||t.getAttribute("type")==="hidden")return!1;let a=t;for(;a&&!(a===document.body||a.nodeType===11);){if(Q7(a))return!1;a=a.parentNode}return!0}function By(t){let o=t.getAttribute("tabindex");return o===null&&(o=void 0),parseInt(o,10)}function Hd(t){const o=t.nodeName.toLowerCase(),a=!Number.isNaN(By(t));return(P7.test(o)&&!t.disabled||t instanceof HTMLAnchorElement&&t.href||a)&&I7(t)}function Uy(t){const o=By(t);return(Number.isNaN(o)||o>=0)&&Hd(t)}function K7(t){return Array.from(t.querySelectorAll(ky)).filter(Uy)}function F7(t,o){const a=K7(t);if(!a.length){o.preventDefault();return}const r=a[o.shiftKey?0:a.length-1],s=t.getRootNode();let c=r===s.activeElement||t===s.activeElement;const f=s.activeElement;if(f.tagName==="INPUT"&&f.getAttribute("type")==="radio"&&(c=a.filter(v=>v.getAttribute("type")==="radio"&&v.getAttribute("name")===f.getAttribute("name")).includes(r)),!c)return;o.preventDefault();const p=a[o.shiftKey?a.length-1:0];p&&p.focus()}function $y(t=!0){const o=S.useRef(null),a=s=>{let c=s.querySelector("[data-autofocus]");if(!c){const f=Array.from(s.querySelectorAll(ky));c=f.find(Uy)||f.find(Hd)||null,!c&&Hd(s)&&(c=s)}c&&c.focus({preventScroll:!0})},r=S.useCallback(s=>{t&&s!==null&&o.current!==s&&(s?(setTimeout(()=>{s.getRootNode()&&a(s)}),o.current=s):o.current=null)},[t]);return S.useEffect(()=>{if(!t)return;o.current&&setTimeout(()=>a(o.current));const s=c=>{c.key==="Tab"&&o.current&&F7(o.current,c)};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[t]),r}const J7=Ve.useId||(()=>{});function W7(){const t=J7();return t?`mantine-${t.replace(/:/g,"")}`:""}function Ca(t){const o=W7(),[a,r]=S.useState(o);return $r(()=>{r(U7())},[]),typeof t=="string"?t:typeof window>"u"?o:a}function Vs(t,o){if(typeof t=="function")return t(o);typeof t=="object"&&t!==null&&"current"in t&&(t.current=o)}function lc(...t){const o=new Map;return a=>{if(t.forEach(r=>{const s=Vs(r,a);s&&o.set(r,s)}),o.size>0)return()=>{t.forEach(r=>{const s=o.get(r);s&&typeof s=="function"?s():Vs(r,null)}),o.clear()}}}function Rn(...t){return S.useCallback(lc(...t),t)}function wa({value:t,defaultValue:o,finalValue:a,onChange:r=()=>{}}){const[s,c]=S.useState(o!==void 0?o:a),f=(d,...p)=>{c(d),r?.(d,...p)};return t!==void 0?[t,r,!0]:[s,f,!1]}function e9(t,o){return Y7("(prefers-reduced-motion: reduce)",t,o)}function t9(){const[t,o]=S.useState(!1),a=S.useRef(null),r=S.useCallback(()=>{o(!0)},[]),s=S.useCallback(()=>{o(!1)},[]);return{ref:S.useCallback(f=>{a.current&&(a.current.removeEventListener("mouseenter",r),a.current.removeEventListener("mouseleave",s)),f&&(f.addEventListener("mouseenter",r),f.addEventListener("mouseleave",s)),a.current=f},[r,s]),hovered:t}}function n9(t=!1,o={}){const[a,r]=S.useState(t),s=S.useCallback(()=>{r(d=>d||(o.onOpen?.(),!0))},[o.onOpen]),c=S.useCallback(()=>{r(d=>d&&(o.onClose?.(),!1))},[o.onClose]),f=S.useCallback(()=>{a?c():s()},[c,s,a]);return[a,{open:s,close:c,toggle:f}]}function o9(t){return t.currentTarget instanceof HTMLElement&&t.relatedTarget instanceof HTMLElement?t.currentTarget.contains(t.relatedTarget):!1}function l9({onBlur:t,onFocus:o}={}){const[a,r]=S.useState(!1),s=S.useRef(!1),c=S.useRef(null),f=X0(o),d=X0(t),p=S.useCallback(x=>{r(x),s.current=x},[]),h=S.useCallback(x=>{s.current||(p(!0),f(x))},[]),v=S.useCallback(x=>{s.current&&!o9(x)&&(p(!1),d(x))},[]),y=S.useCallback(x=>{x&&(c.current&&(c.current.removeEventListener("focusin",h),c.current.removeEventListener("focusout",v)),x.addEventListener("focusin",h),x.addEventListener("focusout",v),c.current=x)},[h,v]);return S.useEffect(()=>()=>{c.current&&(c.current.removeEventListener("focusin",h),c.current.removeEventListener("focusout",v))},[]),{ref:y,focused:a}}function om(t){const o=Ve.version;return typeof Ve.version!="string"||o.startsWith("18.")?t?.ref:t?.props?.ref}function Gr(t){const o=S.Children.toArray(t);return o.length!==1||!Ly(o[0])?null:o[0]}const a9={};function r9(t){const o={};return t.forEach(a=>{Object.entries(a).forEach(([r,s])=>{o[r]?o[r]=xo(o[r],s):o[r]=s})}),o}function ac({theme:t,classNames:o,props:a,stylesCtx:r}){const c=(Array.isArray(o)?o:[o]).map(f=>typeof f=="function"?f(t,a,r):f||a9);return r9(c)}function ks({theme:t,styles:o,props:a,stylesCtx:r}){return(Array.isArray(o)?o:[o]).reduce((c,f)=>typeof f=="function"?{...c,...f(t,a,r)}:{...c,...f},{})}const lm=S.createContext(null);function Ko(){const t=S.useContext(lm);if(!t)throw new Error("[@mantine/core] MantineProvider was not found in tree");return t}function i9(){return Ko().cssVariablesResolver}function s9(){return Ko().classNamesPrefix}function am(){return Ko().getStyleNonce}function c9(){return Ko().withStaticClasses}function u9(){return Ko().headless}function f9(){return Ko().stylesTransform?.sx}function d9(){return Ko().stylesTransform?.styles}function rc(){return Ko().env||"default"}function m9(t){return/^#?([0-9A-F]{3}){1,2}([0-9A-F]{2})?$/i.test(t)}function p9(t){let o=t.replace("#","");if(o.length===3){const f=o.split("");o=[f[0],f[0],f[1],f[1],f[2],f[2]].join("")}if(o.length===8){const f=parseInt(o.slice(6,8),16)/255;return{r:parseInt(o.slice(0,2),16),g:parseInt(o.slice(2,4),16),b:parseInt(o.slice(4,6),16),a:f}}const a=parseInt(o,16),r=a>>16&255,s=a>>8&255,c=a&255;return{r,g:s,b:c,a:1}}function h9(t){const[o,a,r,s]=t.replace(/[^0-9,./]/g,"").split(/[/,]/).map(Number);return{r:o,g:a,b:r,a:s===void 0?1:s}}function g9(t){const o=/^hsla?\(\s*(\d+)\s*,\s*(\d+%)\s*,\s*(\d+%)\s*(,\s*(0?\.\d+|\d+(\.\d+)?))?\s*\)$/i,a=t.match(o);if(!a)return{r:0,g:0,b:0,a:1};const r=parseInt(a[1],10),s=parseInt(a[2],10)/100,c=parseInt(a[3],10)/100,f=a[5]?parseFloat(a[5]):void 0,d=(1-Math.abs(2*c-1))*s,p=r/60,h=d*(1-Math.abs(p%2-1)),v=c-d/2;let y,x,C;return p>=0&&p<1?(y=d,x=h,C=0):p>=1&&p<2?(y=h,x=d,C=0):p>=2&&p<3?(y=0,x=d,C=h):p>=3&&p<4?(y=0,x=h,C=d):p>=4&&p<5?(y=h,x=0,C=d):(y=d,x=0,C=h),{r:Math.round((y+v)*255),g:Math.round((x+v)*255),b:Math.round((C+v)*255),a:f||1}}function rm(t){return m9(t)?p9(t):t.startsWith("rgb")?h9(t):t.startsWith("hsl")?g9(t):{r:0,g:0,b:0,a:1}}function hs(t,o){if(t.startsWith("var("))return`color-mix(in srgb, ${t}, black ${o*100}%)`;const{r:a,g:r,b:s,a:c}=rm(t),f=1-o,d=p=>Math.round(p*f);return`rgba(${d(a)}, ${d(r)}, ${d(s)}, ${c})`}function Lr(t,o){return typeof t.primaryShade=="number"?t.primaryShade:o==="dark"?t.primaryShade.dark:t.primaryShade.light}function pd(t){return t<=.03928?t/12.92:((t+.055)/1.055)**2.4}function v9(t){const o=t.match(/oklch\((.*?)%\s/);return o?parseFloat(o[1]):null}function y9(t){if(t.startsWith("oklch("))return(v9(t)||0)/100;const{r:o,g:a,b:r}=rm(t),s=o/255,c=a/255,f=r/255,d=pd(s),p=pd(c),h=pd(f);return .2126*d+.7152*p+.0722*h}function Mr(t,o=.179){return t.startsWith("var(")?!1:y9(t)>o}function Cl({color:t,theme:o,colorScheme:a}){if(typeof t!="string")throw new Error(`[@mantine/core] Failed to parse color. Expected color to be a string, instead got ${typeof t}`);if(t==="bright")return{color:t,value:a==="dark"?o.white:o.black,shade:void 0,isThemeColor:!1,isLight:Mr(a==="dark"?o.white:o.black,o.luminanceThreshold),variable:"--mantine-color-bright"};if(t==="dimmed")return{color:t,value:a==="dark"?o.colors.dark[2]:o.colors.gray[7],shade:void 0,isThemeColor:!1,isLight:Mr(a==="dark"?o.colors.dark[2]:o.colors.gray[6],o.luminanceThreshold),variable:"--mantine-color-dimmed"};if(t==="white"||t==="black")return{color:t,value:t==="white"?o.white:o.black,shade:void 0,isThemeColor:!1,isLight:Mr(t==="white"?o.white:o.black,o.luminanceThreshold),variable:`--mantine-color-${t}`};const[r,s]=t.split("."),c=s?Number(s):void 0,f=r in o.colors;if(f){const d=c!==void 0?o.colors[r][c]:o.colors[r][Lr(o,a||"light")];return{color:r,value:d,shade:c,isThemeColor:f,isLight:Mr(d,o.luminanceThreshold),variable:s?`--mantine-color-${r}-${c}`:`--mantine-color-${r}-filled`}}return{color:t,value:t,isThemeColor:f,isLight:Mr(t,o.luminanceThreshold),shade:c,variable:void 0}}function bo(t,o){const a=Cl({color:t||o.primaryColor,theme:o});return a.variable?`var(${a.variable})`:t}function zd(t,o){const a={from:t?.from||o.defaultGradient.from,to:t?.to||o.defaultGradient.to,deg:t?.deg??o.defaultGradient.deg??0},r=bo(a.from,o),s=bo(a.to,o);return`linear-gradient(${a.deg}deg, ${r} 0%, ${s} 100%)`}function Ln(t,o){if(typeof t!="string"||o>1||o<0)return"rgba(0, 0, 0, 1)";if(t.startsWith("var(")){const c=(1-o)*100;return`color-mix(in srgb, ${t}, transparent ${c}%)`}if(t.startsWith("oklch"))return t.includes("/")?t.replace(/\/\s*[\d.]+\s*\)/,`/ ${o})`):t.replace(")",` / ${o})`);const{r:a,g:r,b:s}=rm(t);return`rgba(${a}, ${r}, ${s}, ${o})`}const ma=Ln,b9=({color:t,theme:o,variant:a,gradient:r,autoContrast:s})=>{const c=Cl({color:t,theme:o}),f=typeof s=="boolean"?s:o.autoContrast;if(a==="none")return{background:"transparent",hover:"transparent",color:"inherit",border:"none"};if(a==="filled"){const d=f&&c.isLight?"var(--mantine-color-black)":"var(--mantine-color-white)";return c.isThemeColor?c.shade===void 0?{background:`var(--mantine-color-${t}-filled)`,hover:`var(--mantine-color-${t}-filled-hover)`,color:d,border:`${F(1)} solid transparent`}:{background:`var(--mantine-color-${c.color}-${c.shade})`,hover:`var(--mantine-color-${c.color}-${c.shade===9?8:c.shade+1})`,color:d,border:`${F(1)} solid transparent`}:{background:t,hover:hs(t,.1),color:d,border:`${F(1)} solid transparent`}}if(a==="light"){if(c.isThemeColor){if(c.shade===void 0)return{background:`var(--mantine-color-${t}-light)`,hover:`var(--mantine-color-${t}-light-hover)`,color:`var(--mantine-color-${t}-light-color)`,border:`${F(1)} solid transparent`};const d=o.colors[c.color][c.shade];return{background:Ln(d,.1),hover:Ln(d,.12),color:`var(--mantine-color-${c.color}-${Math.min(c.shade,6)})`,border:`${F(1)} solid transparent`}}return{background:Ln(t,.1),hover:Ln(t,.12),color:t,border:`${F(1)} solid transparent`}}if(a==="outline")return c.isThemeColor?c.shade===void 0?{background:"transparent",hover:`var(--mantine-color-${t}-outline-hover)`,color:`var(--mantine-color-${t}-outline)`,border:`${F(1)} solid var(--mantine-color-${t}-outline)`}:{background:"transparent",hover:Ln(o.colors[c.color][c.shade],.05),color:`var(--mantine-color-${c.color}-${c.shade})`,border:`${F(1)} solid var(--mantine-color-${c.color}-${c.shade})`}:{background:"transparent",hover:Ln(t,.05),color:t,border:`${F(1)} solid ${t}`};if(a==="subtle"){if(c.isThemeColor){if(c.shade===void 0)return{background:"transparent",hover:`var(--mantine-color-${t}-light-hover)`,color:`var(--mantine-color-${t}-light-color)`,border:`${F(1)} solid transparent`};const d=o.colors[c.color][c.shade];return{background:"transparent",hover:Ln(d,.12),color:`var(--mantine-color-${c.color}-${Math.min(c.shade,6)})`,border:`${F(1)} solid transparent`}}return{background:"transparent",hover:Ln(t,.12),color:t,border:`${F(1)} solid transparent`}}return a==="transparent"?c.isThemeColor?c.shade===void 0?{background:"transparent",hover:"transparent",color:`var(--mantine-color-${t}-light-color)`,border:`${F(1)} solid transparent`}:{background:"transparent",hover:"transparent",color:`var(--mantine-color-${c.color}-${Math.min(c.shade,6)})`,border:`${F(1)} solid transparent`}:{background:"transparent",hover:"transparent",color:t,border:`${F(1)} solid transparent`}:a==="white"?c.isThemeColor?c.shade===void 0?{background:"var(--mantine-color-white)",hover:hs(o.white,.01),color:`var(--mantine-color-${t}-filled)`,border:`${F(1)} solid transparent`}:{background:"var(--mantine-color-white)",hover:hs(o.white,.01),color:`var(--mantine-color-${c.color}-${c.shade})`,border:`${F(1)} solid transparent`}:{background:"var(--mantine-color-white)",hover:hs(o.white,.01),color:t,border:`${F(1)} solid transparent`}:a==="gradient"?{background:zd(r,o),hover:zd(r,o),color:"var(--mantine-color-white)",border:"none"}:a==="default"?{background:"var(--mantine-color-default)",hover:"var(--mantine-color-default-hover)",color:"var(--mantine-color-default-color)",border:`${F(1)} solid var(--mantine-color-default-border)`}:{}},x9={dark:["#C9C9C9","#b8b8b8","#828282","#696969","#424242","#3b3b3b","#2e2e2e","#242424","#1f1f1f","#141414"],gray:["#f8f9fa","#f1f3f5","#e9ecef","#dee2e6","#ced4da","#adb5bd","#868e96","#495057","#343a40","#212529"],red:["#fff5f5","#ffe3e3","#ffc9c9","#ffa8a8","#ff8787","#ff6b6b","#fa5252","#f03e3e","#e03131","#c92a2a"],pink:["#fff0f6","#ffdeeb","#fcc2d7","#faa2c1","#f783ac","#f06595","#e64980","#d6336c","#c2255c","#a61e4d"],grape:["#f8f0fc","#f3d9fa","#eebefa","#e599f7","#da77f2","#cc5de8","#be4bdb","#ae3ec9","#9c36b5","#862e9c"],violet:["#f3f0ff","#e5dbff","#d0bfff","#b197fc","#9775fa","#845ef7","#7950f2","#7048e8","#6741d9","#5f3dc4"],indigo:["#edf2ff","#dbe4ff","#bac8ff","#91a7ff","#748ffc","#5c7cfa","#4c6ef5","#4263eb","#3b5bdb","#364fc7"],blue:["#e7f5ff","#d0ebff","#a5d8ff","#74c0fc","#4dabf7","#339af0","#228be6","#1c7ed6","#1971c2","#1864ab"],cyan:["#e3fafc","#c5f6fa","#99e9f2","#66d9e8","#3bc9db","#22b8cf","#15aabf","#1098ad","#0c8599","#0b7285"],teal:["#e6fcf5","#c3fae8","#96f2d7","#63e6be","#38d9a9","#20c997","#12b886","#0ca678","#099268","#087f5b"],green:["#ebfbee","#d3f9d8","#b2f2bb","#8ce99a","#69db7c","#51cf66","#40c057","#37b24d","#2f9e44","#2b8a3e"],lime:["#f4fce3","#e9fac8","#d8f5a2","#c0eb75","#a9e34b","#94d82d","#82c91e","#74b816","#66a80f","#5c940d"],yellow:["#fff9db","#fff3bf","#ffec99","#ffe066","#ffd43b","#fcc419","#fab005","#f59f00","#f08c00","#e67700"],orange:["#fff4e6","#ffe8cc","#ffd8a8","#ffc078","#ffa94d","#ff922b","#fd7e14","#f76707","#e8590c","#d9480f"]},P0="-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji",im={scale:1,fontSmoothing:!0,focusRing:"auto",white:"#fff",black:"#000",colors:x9,primaryShade:{light:6,dark:8},primaryColor:"blue",variantColorResolver:b9,autoContrast:!1,luminanceThreshold:.3,fontFamily:P0,fontFamilyMonospace:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace",respectReducedMotion:!1,cursorType:"default",defaultGradient:{from:"blue",to:"cyan",deg:45},defaultRadius:"sm",activeClassName:"mantine-active",focusClassName:"",headings:{fontFamily:P0,fontWeight:"700",textWrap:"wrap",sizes:{h1:{fontSize:F(34),lineHeight:"1.3"},h2:{fontSize:F(26),lineHeight:"1.35"},h3:{fontSize:F(22),lineHeight:"1.4"},h4:{fontSize:F(18),lineHeight:"1.45"},h5:{fontSize:F(16),lineHeight:"1.5"},h6:{fontSize:F(14),lineHeight:"1.5"}}},fontSizes:{xs:F(12),sm:F(14),md:F(16),lg:F(18),xl:F(20)},lineHeights:{xs:"1.4",sm:"1.45",md:"1.55",lg:"1.6",xl:"1.65"},radius:{xs:F(2),sm:F(4),md:F(8),lg:F(16),xl:F(32)},spacing:{xs:F(10),sm:F(12),md:F(16),lg:F(20),xl:F(32)},breakpoints:{xs:"36em",sm:"48em",md:"62em",lg:"75em",xl:"88em"},shadows:{xs:`0 ${F(1)} ${F(3)} rgba(0, 0, 0, 0.05), 0 ${F(1)} ${F(2)} rgba(0, 0, 0, 0.1)`,sm:`0 ${F(1)} ${F(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${F(10)} ${F(15)} ${F(-5)}, rgba(0, 0, 0, 0.04) 0 ${F(7)} ${F(7)} ${F(-5)}`,md:`0 ${F(1)} ${F(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${F(20)} ${F(25)} ${F(-5)}, rgba(0, 0, 0, 0.04) 0 ${F(10)} ${F(10)} ${F(-5)}`,lg:`0 ${F(1)} ${F(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${F(28)} ${F(23)} ${F(-7)}, rgba(0, 0, 0, 0.04) 0 ${F(12)} ${F(12)} ${F(-7)}`,xl:`0 ${F(1)} ${F(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${F(36)} ${F(28)} ${F(-7)}, rgba(0, 0, 0, 0.04) 0 ${F(17)} ${F(17)} ${F(-7)}`},other:{},components:{}};function Q0(t){return t==="auto"||t==="dark"||t==="light"}function S9({key:t="mantine-color-scheme-value"}={}){let o;return{get:a=>{if(typeof window>"u")return a;try{const r=window.localStorage.getItem(t);return Q0(r)?r:a}catch{return a}},set:a=>{try{window.localStorage.setItem(t,a)}catch(r){console.warn("[@mantine/core] Local storage color scheme manager was unable to save color scheme.",r)}},subscribe:a=>{o=r=>{r.storageArea===window.localStorage&&r.key===t&&Q0(r.newValue)&&a(r.newValue)},window.addEventListener("storage",o)},unsubscribe:()=>{window.removeEventListener("storage",o)},clear:()=>{window.localStorage.removeItem(t)}}}const C9="[@mantine/core] MantineProvider: Invalid theme.primaryColor, it accepts only key of theme.colors, learn more – https://mantine.dev/theming/colors/#primary-color",I0="[@mantine/core] MantineProvider: Invalid theme.primaryShade, it accepts only 0-9 integers or an object { light: 0-9, dark: 0-9 }";function hd(t){return t<0||t>9?!1:parseInt(t.toString(),10)===t}function K0(t){if(!(t.primaryColor in t.colors))throw new Error(C9);if(typeof t.primaryShade=="object"&&(!hd(t.primaryShade.dark)||!hd(t.primaryShade.light)))throw new Error(I0);if(typeof t.primaryShade=="number"&&!hd(t.primaryShade))throw new Error(I0)}function w9(t,o){if(!o)return K0(t),t;const a=tm(t,o);return o.fontFamily&&!o.headings?.fontFamily&&(a.headings.fontFamily=o.fontFamily),K0(a),a}const sm=S.createContext(null),T9=()=>S.useContext(sm)||im;function Gt(){const t=S.useContext(sm);if(!t)throw new Error("@mantine/core: MantineProvider was not found in component tree, make sure you have it in your app");return t}function Gy({theme:t,children:o,inherit:a=!0}){const r=T9(),s=S.useMemo(()=>w9(a?r:im,t),[t,r,a]);return g.jsx(sm.Provider,{value:s,children:o})}Gy.displayName="@mantine/core/MantineThemeProvider";function E9(){const t=Gt(),o=am(),a=$n(t.breakpoints).reduce((r,s)=>{const c=t.breakpoints[s].includes("px"),f=N7(t.breakpoints[s]),d=c?`${f-.1}px`:q0(f-.1),p=c?`${f}px`:q0(f);return`${r}@media (max-width: ${d}) {.mantine-visible-from-${s} {display: none !important;}}@media (min-width: ${p}) {.mantine-hidden-from-${s} {display: none !important;}}`},"");return g.jsx("style",{"data-mantine-styles":"classes",nonce:o?.(),dangerouslySetInnerHTML:{__html:a}})}function gd(t){return Object.entries(t).map(([o,a])=>`${o}: ${a};`).join("")}function Zy(t,o){const a=o?[o]:[":root",":host"],r=gd(t.variables),s=r?`${a.join(", ")}{${r}}`:"",c=gd(t.dark),f=gd(t.light),d=v=>a.map(y=>y===":host"?`${y}([data-mantine-color-scheme="${v}"])`:`${y}[data-mantine-color-scheme="${v}"]`).join(", "),p=c?`${d("dark")}{${c}}`:"",h=f?`${d("light")}{${f}}`:"";return`${s}
|
|
49
|
+
`)},w4=0,fa=[];function T4(t){var o=S.useRef([]),a=S.useRef([0,0]),r=S.useRef(),s=S.useState(w4++)[0],c=S.useState(jv)[0],f=S.useRef(t);S.useEffect(function(){f.current=t},[t]),S.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(s));var w=YS([t.lockRef.current],(t.shards||[]).map(Wg),!0).filter(Boolean);return w.forEach(function(M){return M.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),w.forEach(function(M){return M.classList.remove("allow-interactivity-".concat(s))})}}},[t.inert,t.lockRef.current,t.shards]);var d=S.useCallback(function(w,M){if("touches"in w&&w.touches.length===2||w.type==="wheel"&&w.ctrlKey)return!f.current.allowPinchZoom;var R=us(w),_=a.current,N="deltaX"in w?w.deltaX:_[0]-R[0],A="deltaY"in w?w.deltaY:_[1]-R[1],H,L=w.target,Z=Math.abs(N)>Math.abs(A)?"h":"v";if("touches"in w&&Z==="h"&&L.type==="range")return!1;var I=window.getSelection(),J=I&&I.anchorNode,P=J?J===L||J.contains(L):!1;if(P)return!1;var ee=Fg(Z,L);if(!ee)return!0;if(ee?H=Z:(H=Z==="v"?"h":"v",ee=Fg(Z,L)),!ee)return!1;if(!r.current&&"changedTouches"in w&&(N||A)&&(r.current=H),!H)return!0;var oe=r.current||H;return x4(oe,M,w,oe==="h"?N:A)},[]),p=S.useCallback(function(w){var M=w;if(!(!fa.length||fa[fa.length-1]!==c)){var R="deltaY"in M?Jg(M):us(M),_=o.current.filter(function(H){return H.name===M.type&&(H.target===M.target||M.target===H.shadowParent)&&S4(H.delta,R)})[0];if(_&&_.should){M.cancelable&&M.preventDefault();return}if(!_){var N=(f.current.shards||[]).map(Wg).filter(Boolean).filter(function(H){return H.contains(M.target)}),A=N.length>0?d(M,N[0]):!f.current.noIsolation;A&&M.cancelable&&M.preventDefault()}}},[]),h=S.useCallback(function(w,M,R,_){var N={name:w,delta:M,target:R,should:_,shadowParent:E4(R)};o.current.push(N),setTimeout(function(){o.current=o.current.filter(function(A){return A!==N})},1)},[]),v=S.useCallback(function(w){a.current=us(w),r.current=void 0},[]),y=S.useCallback(function(w){h(w.type,Jg(w),w.target,d(w,t.lockRef.current))},[]),x=S.useCallback(function(w){h(w.type,us(w),w.target,d(w,t.lockRef.current))},[]);S.useEffect(function(){return fa.push(c),t.setCallbacks({onScrollCapture:y,onWheelCapture:y,onTouchMoveCapture:x}),document.addEventListener("wheel",p,ua),document.addEventListener("touchmove",p,ua),document.addEventListener("touchstart",v,ua),function(){fa=fa.filter(function(w){return w!==c}),document.removeEventListener("wheel",p,ua),document.removeEventListener("touchmove",p,ua),document.removeEventListener("touchstart",v,ua)}},[]);var C=t.removeScrollBar,T=t.inert;return S.createElement(S.Fragment,null,T?S.createElement(c,{styles:C4(s)}):null,C?S.createElement(m4,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function E4(t){for(var o=null;t!==null;)t instanceof ShadowRoot&&(o=t.host,t=t.host),t=t.parentNode;return o}const M4=e4(Rv,T4);var R4=S.forwardRef(function(t,o){return S.createElement(Ps,Vn({},t,{ref:o,sideCar:M4}))});R4.classNames=Ps.classNames;const Av=["top","right","bottom","left"],e0=["start","end"],t0=Av.reduce((t,o)=>t.concat(o,o+"-"+e0[0],o+"-"+e0[1]),[]),Tn=Math.min,Et=Math.max,Ts=Math.round,fs=Math.floor,Un=t=>({x:t,y:t}),j4={left:"right",right:"left",bottom:"top",top:"bottom"},_4={start:"end",end:"start"};function jd(t,o,a){return Et(t,Tn(o,a))}function En(t,o){return typeof t=="function"?t(o):t}function Jt(t){return t.split("-")[0]}function wn(t){return t.split("-")[1]}function kd(t){return t==="x"?"y":"x"}function Bd(t){return t==="y"?"height":"width"}const O4=new Set(["top","bottom"]);function Sn(t){return O4.has(Jt(t))?"y":"x"}function Ud(t){return kd(Sn(t))}function Dv(t,o,a){a===void 0&&(a=!1);const r=wn(t),s=Ud(t),c=Bd(s);let f=s==="x"?r===(a?"end":"start")?"right":"left":r==="start"?"bottom":"top";return o.reference[c]>o.floating[c]&&(f=Ms(f)),[f,Ms(f)]}function N4(t){const o=Ms(t);return[Es(t),o,Es(o)]}function Es(t){return t.replace(/start|end/g,o=>_4[o])}const n0=["left","right"],o0=["right","left"],A4=["top","bottom"],D4=["bottom","top"];function H4(t,o,a){switch(t){case"top":case"bottom":return a?o?o0:n0:o?n0:o0;case"left":case"right":return o?A4:D4;default:return[]}}function z4(t,o,a,r){const s=wn(t);let c=H4(Jt(t),a==="start",r);return s&&(c=c.map(f=>f+"-"+s),o&&(c=c.concat(c.map(Es)))),c}function Ms(t){return t.replace(/left|right|bottom|top/g,o=>j4[o])}function L4(t){return{top:0,right:0,bottom:0,left:0,...t}}function $d(t){return typeof t!="number"?L4(t):{top:t,right:t,bottom:t,left:t}}function ba(t){const{x:o,y:a,width:r,height:s}=t;return{width:r,height:s,top:a,left:o,right:o+r,bottom:a+s,x:o,y:a}}function l0(t,o,a){let{reference:r,floating:s}=t;const c=Sn(o),f=Ud(o),d=Bd(f),p=Jt(o),h=c==="y",v=r.x+r.width/2-s.width/2,y=r.y+r.height/2-s.height/2,x=r[d]/2-s[d]/2;let C;switch(p){case"top":C={x:v,y:r.y-s.height};break;case"bottom":C={x:v,y:r.y+r.height};break;case"right":C={x:r.x+r.width,y};break;case"left":C={x:r.x-s.width,y};break;default:C={x:r.x,y:r.y}}switch(wn(o)){case"start":C[f]-=x*(a&&h?-1:1);break;case"end":C[f]+=x*(a&&h?-1:1);break}return C}async function V4(t,o){var a;o===void 0&&(o={});const{x:r,y:s,platform:c,rects:f,elements:d,strategy:p}=t,{boundary:h="clippingAncestors",rootBoundary:v="viewport",elementContext:y="floating",altBoundary:x=!1,padding:C=0}=En(o,t),T=$d(C),M=d[x?y==="floating"?"reference":"floating":y],R=ba(await c.getClippingRect({element:(a=await(c.isElement==null?void 0:c.isElement(M)))==null||a?M:M.contextElement||await(c.getDocumentElement==null?void 0:c.getDocumentElement(d.floating)),boundary:h,rootBoundary:v,strategy:p})),_=y==="floating"?{x:r,y:s,width:f.floating.width,height:f.floating.height}:f.reference,N=await(c.getOffsetParent==null?void 0:c.getOffsetParent(d.floating)),A=await(c.isElement==null?void 0:c.isElement(N))?await(c.getScale==null?void 0:c.getScale(N))||{x:1,y:1}:{x:1,y:1},H=ba(c.convertOffsetParentRelativeRectToViewportRelativeRect?await c.convertOffsetParentRelativeRectToViewportRelativeRect({elements:d,rect:_,offsetParent:N,strategy:p}):_);return{top:(R.top-H.top+T.top)/A.y,bottom:(H.bottom-R.bottom+T.bottom)/A.y,left:(R.left-H.left+T.left)/A.x,right:(H.right-R.right+T.right)/A.x}}const k4=async(t,o,a)=>{const{placement:r="bottom",strategy:s="absolute",middleware:c=[],platform:f}=a,d=c.filter(Boolean),p=await(f.isRTL==null?void 0:f.isRTL(o));let h=await f.getElementRects({reference:t,floating:o,strategy:s}),{x:v,y}=l0(h,r,p),x=r,C={},T=0;for(let M=0;M<d.length;M++){var w;const{name:R,fn:_}=d[M],{x:N,y:A,data:H,reset:L}=await _({x:v,y,initialPlacement:r,placement:x,strategy:s,middlewareData:C,rects:h,platform:{...f,detectOverflow:(w=f.detectOverflow)!=null?w:V4},elements:{reference:t,floating:o}});v=N??v,y=A??y,C={...C,[R]:{...C[R],...H}},L&&T<=50&&(T++,typeof L=="object"&&(L.placement&&(x=L.placement),L.rects&&(h=L.rects===!0?await f.getElementRects({reference:t,floating:o,strategy:s}):L.rects),{x:v,y}=l0(h,x,p)),M=-1)}return{x:v,y,placement:x,strategy:s,middlewareData:C}},B4=t=>({name:"arrow",options:t,async fn(o){const{x:a,y:r,placement:s,rects:c,platform:f,elements:d,middlewareData:p}=o,{element:h,padding:v=0}=En(t,o)||{};if(h==null)return{};const y=$d(v),x={x:a,y:r},C=Ud(s),T=Bd(C),w=await f.getDimensions(h),M=C==="y",R=M?"top":"left",_=M?"bottom":"right",N=M?"clientHeight":"clientWidth",A=c.reference[T]+c.reference[C]-x[C]-c.floating[T],H=x[C]-c.reference[C],L=await(f.getOffsetParent==null?void 0:f.getOffsetParent(h));let Z=L?L[N]:0;(!Z||!await(f.isElement==null?void 0:f.isElement(L)))&&(Z=d.floating[N]||c.floating[T]);const I=A/2-H/2,J=Z/2-w[T]/2-1,P=Tn(y[R],J),ee=Tn(y[_],J),oe=P,te=Z-w[T]-ee,B=Z/2-w[T]/2+I,ne=jd(oe,B,te),D=!p.arrow&&wn(s)!=null&&B!==ne&&c.reference[T]/2-(B<oe?P:ee)-w[T]/2<0,U=D?B<oe?B-oe:B-te:0;return{[C]:x[C]+U,data:{[C]:ne,centerOffset:B-ne-U,...D&&{alignmentOffset:U}},reset:D}}});function U4(t,o,a){return(t?[...a.filter(s=>wn(s)===t),...a.filter(s=>wn(s)!==t)]:a.filter(s=>Jt(s)===s)).filter(s=>t?wn(s)===t||(o?Es(s)!==s:!1):!0)}const $4=function(t){return t===void 0&&(t={}),{name:"autoPlacement",options:t,async fn(o){var a,r,s;const{rects:c,middlewareData:f,placement:d,platform:p,elements:h}=o,{crossAxis:v=!1,alignment:y,allowedPlacements:x=t0,autoAlignment:C=!0,...T}=En(t,o),w=y!==void 0||x===t0?U4(y||null,C,x):x,M=await p.detectOverflow(o,T),R=((a=f.autoPlacement)==null?void 0:a.index)||0,_=w[R];if(_==null)return{};const N=Dv(_,c,await(p.isRTL==null?void 0:p.isRTL(h.floating)));if(d!==_)return{reset:{placement:w[0]}};const A=[M[Jt(_)],M[N[0]],M[N[1]]],H=[...((r=f.autoPlacement)==null?void 0:r.overflows)||[],{placement:_,overflows:A}],L=w[R+1];if(L)return{data:{index:R+1,overflows:H},reset:{placement:L}};const Z=H.map(P=>{const ee=wn(P.placement);return[P.placement,ee&&v?P.overflows.slice(0,2).reduce((oe,te)=>oe+te,0):P.overflows[0],P.overflows]}).sort((P,ee)=>P[1]-ee[1]),J=((s=Z.filter(P=>P[2].slice(0,wn(P[0])?2:3).every(ee=>ee<=0))[0])==null?void 0:s[0])||Z[0][0];return J!==d?{data:{index:R+1,overflows:H},reset:{placement:J}}:{}}}},G4=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(o){var a,r;const{placement:s,middlewareData:c,rects:f,initialPlacement:d,platform:p,elements:h}=o,{mainAxis:v=!0,crossAxis:y=!0,fallbackPlacements:x,fallbackStrategy:C="bestFit",fallbackAxisSideDirection:T="none",flipAlignment:w=!0,...M}=En(t,o);if((a=c.arrow)!=null&&a.alignmentOffset)return{};const R=Jt(s),_=Sn(d),N=Jt(d)===d,A=await(p.isRTL==null?void 0:p.isRTL(h.floating)),H=x||(N||!w?[Ms(d)]:N4(d)),L=T!=="none";!x&&L&&H.push(...z4(d,w,T,A));const Z=[d,...H],I=await p.detectOverflow(o,M),J=[];let P=((r=c.flip)==null?void 0:r.overflows)||[];if(v&&J.push(I[R]),y){const B=Dv(s,f,A);J.push(I[B[0]],I[B[1]])}if(P=[...P,{placement:s,overflows:J}],!J.every(B=>B<=0)){var ee,oe;const B=(((ee=c.flip)==null?void 0:ee.index)||0)+1,ne=Z[B];if(ne&&(!(y==="alignment"?_!==Sn(ne):!1)||P.every(V=>Sn(V.placement)===_?V.overflows[0]>0:!0)))return{data:{index:B,overflows:P},reset:{placement:ne}};let D=(oe=P.filter(U=>U.overflows[0]<=0).sort((U,V)=>U.overflows[1]-V.overflows[1])[0])==null?void 0:oe.placement;if(!D)switch(C){case"bestFit":{var te;const U=(te=P.filter(V=>{if(L){const K=Sn(V.placement);return K===_||K==="y"}return!0}).map(V=>[V.placement,V.overflows.filter(K=>K>0).reduce((K,W)=>K+W,0)]).sort((V,K)=>V[1]-K[1])[0])==null?void 0:te[0];U&&(D=U);break}case"initialPlacement":D=d;break}if(s!==D)return{reset:{placement:D}}}return{}}}};function a0(t,o){return{top:t.top-o.height,right:t.right-o.width,bottom:t.bottom-o.height,left:t.left-o.width}}function r0(t){return Av.some(o=>t[o]>=0)}const Z4=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(o){const{rects:a,platform:r}=o,{strategy:s="referenceHidden",...c}=En(t,o);switch(s){case"referenceHidden":{const f=await r.detectOverflow(o,{...c,elementContext:"reference"}),d=a0(f,a.reference);return{data:{referenceHiddenOffsets:d,referenceHidden:r0(d)}}}case"escaped":{const f=await r.detectOverflow(o,{...c,altBoundary:!0}),d=a0(f,a.floating);return{data:{escapedOffsets:d,escaped:r0(d)}}}default:return{}}}}};function Hv(t){const o=Tn(...t.map(c=>c.left)),a=Tn(...t.map(c=>c.top)),r=Et(...t.map(c=>c.right)),s=Et(...t.map(c=>c.bottom));return{x:o,y:a,width:r-o,height:s-a}}function q4(t){const o=t.slice().sort((s,c)=>s.y-c.y),a=[];let r=null;for(let s=0;s<o.length;s++){const c=o[s];!r||c.y-r.y>r.height/2?a.push([c]):a[a.length-1].push(c),r=c}return a.map(s=>ba(Hv(s)))}const Y4=function(t){return t===void 0&&(t={}),{name:"inline",options:t,async fn(o){const{placement:a,elements:r,rects:s,platform:c,strategy:f}=o,{padding:d=2,x:p,y:h}=En(t,o),v=Array.from(await(c.getClientRects==null?void 0:c.getClientRects(r.reference))||[]),y=q4(v),x=ba(Hv(v)),C=$d(d);function T(){if(y.length===2&&y[0].left>y[1].right&&p!=null&&h!=null)return y.find(M=>p>M.left-C.left&&p<M.right+C.right&&h>M.top-C.top&&h<M.bottom+C.bottom)||x;if(y.length>=2){if(Sn(a)==="y"){const P=y[0],ee=y[y.length-1],oe=Jt(a)==="top",te=P.top,B=ee.bottom,ne=oe?P.left:ee.left,D=oe?P.right:ee.right,U=D-ne,V=B-te;return{top:te,bottom:B,left:ne,right:D,width:U,height:V,x:ne,y:te}}const M=Jt(a)==="left",R=Et(...y.map(P=>P.right)),_=Tn(...y.map(P=>P.left)),N=y.filter(P=>M?P.left===_:P.right===R),A=N[0].top,H=N[N.length-1].bottom,L=_,Z=R,I=Z-L,J=H-A;return{top:A,bottom:H,left:L,right:Z,width:I,height:J,x:L,y:A}}return x}const w=await c.getElementRects({reference:{getBoundingClientRect:T},floating:r.floating,strategy:f});return s.reference.x!==w.reference.x||s.reference.y!==w.reference.y||s.reference.width!==w.reference.width||s.reference.height!==w.reference.height?{reset:{rects:w}}:{}}}},zv=new Set(["left","top"]);async function X4(t,o){const{placement:a,platform:r,elements:s}=t,c=await(r.isRTL==null?void 0:r.isRTL(s.floating)),f=Jt(a),d=wn(a),p=Sn(a)==="y",h=zv.has(f)?-1:1,v=c&&p?-1:1,y=En(o,t);let{mainAxis:x,crossAxis:C,alignmentAxis:T}=typeof y=="number"?{mainAxis:y,crossAxis:0,alignmentAxis:null}:{mainAxis:y.mainAxis||0,crossAxis:y.crossAxis||0,alignmentAxis:y.alignmentAxis};return d&&typeof T=="number"&&(C=d==="end"?T*-1:T),p?{x:C*v,y:x*h}:{x:x*h,y:C*v}}const P4=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(o){var a,r;const{x:s,y:c,placement:f,middlewareData:d}=o,p=await X4(o,t);return f===((a=d.offset)==null?void 0:a.placement)&&(r=d.arrow)!=null&&r.alignmentOffset?{}:{x:s+p.x,y:c+p.y,data:{...p,placement:f}}}}},Q4=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(o){const{x:a,y:r,placement:s,platform:c}=o,{mainAxis:f=!0,crossAxis:d=!1,limiter:p={fn:R=>{let{x:_,y:N}=R;return{x:_,y:N}}},...h}=En(t,o),v={x:a,y:r},y=await c.detectOverflow(o,h),x=Sn(Jt(s)),C=kd(x);let T=v[C],w=v[x];if(f){const R=C==="y"?"top":"left",_=C==="y"?"bottom":"right",N=T+y[R],A=T-y[_];T=jd(N,T,A)}if(d){const R=x==="y"?"top":"left",_=x==="y"?"bottom":"right",N=w+y[R],A=w-y[_];w=jd(N,w,A)}const M=p.fn({...o,[C]:T,[x]:w});return{...M,data:{x:M.x-a,y:M.y-r,enabled:{[C]:f,[x]:d}}}}}},I4=function(t){return t===void 0&&(t={}),{options:t,fn(o){const{x:a,y:r,placement:s,rects:c,middlewareData:f}=o,{offset:d=0,mainAxis:p=!0,crossAxis:h=!0}=En(t,o),v={x:a,y:r},y=Sn(s),x=kd(y);let C=v[x],T=v[y];const w=En(d,o),M=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(p){const N=x==="y"?"height":"width",A=c.reference[x]-c.floating[N]+M.mainAxis,H=c.reference[x]+c.reference[N]-M.mainAxis;C<A?C=A:C>H&&(C=H)}if(h){var R,_;const N=x==="y"?"width":"height",A=zv.has(Jt(s)),H=c.reference[y]-c.floating[N]+(A&&((R=f.offset)==null?void 0:R[y])||0)+(A?0:M.crossAxis),L=c.reference[y]+c.reference[N]+(A?0:((_=f.offset)==null?void 0:_[y])||0)-(A?M.crossAxis:0);T<H?T=H:T>L&&(T=L)}return{[x]:C,[y]:T}}}},K4=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(o){var a,r;const{placement:s,rects:c,platform:f,elements:d}=o,{apply:p=()=>{},...h}=En(t,o),v=await f.detectOverflow(o,h),y=Jt(s),x=wn(s),C=Sn(s)==="y",{width:T,height:w}=c.floating;let M,R;y==="top"||y==="bottom"?(M=y,R=x===(await(f.isRTL==null?void 0:f.isRTL(d.floating))?"start":"end")?"left":"right"):(R=y,M=x==="end"?"top":"bottom");const _=w-v.top-v.bottom,N=T-v.left-v.right,A=Tn(w-v[M],_),H=Tn(T-v[R],N),L=!o.middlewareData.shift;let Z=A,I=H;if((a=o.middlewareData.shift)!=null&&a.enabled.x&&(I=N),(r=o.middlewareData.shift)!=null&&r.enabled.y&&(Z=_),L&&!x){const P=Et(v.left,0),ee=Et(v.right,0),oe=Et(v.top,0),te=Et(v.bottom,0);C?I=T-2*(P!==0||ee!==0?P+ee:Et(v.left,v.right)):Z=w-2*(oe!==0||te!==0?oe+te:Et(v.top,v.bottom))}await p({...o,availableWidth:I,availableHeight:Z});const J=await f.getDimensions(d.floating);return T!==J.width||w!==J.height?{reset:{rects:!0}}:{}}}};function Qs(){return typeof window<"u"}function Sa(t){return Lv(t)?(t.nodeName||"").toLowerCase():"#document"}function Ut(t){var o;return(t==null||(o=t.ownerDocument)==null?void 0:o.defaultView)||window}function Yn(t){var o;return(o=(Lv(t)?t.ownerDocument:t.document)||window.document)==null?void 0:o.documentElement}function Lv(t){return Qs()?t instanceof Node||t instanceof Ut(t).Node:!1}function Ye(t){return Qs()?t instanceof Element||t instanceof Ut(t).Element:!1}function Wt(t){return Qs()?t instanceof HTMLElement||t instanceof Ut(t).HTMLElement:!1}function Rs(t){return!Qs()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Ut(t).ShadowRoot}const F4=new Set(["inline","contents"]);function kr(t){const{overflow:o,overflowX:a,overflowY:r,display:s}=hn(t);return/auto|scroll|overlay|hidden|clip/.test(o+r+a)&&!F4.has(s)}const J4=new Set(["table","td","th"]);function W4(t){return J4.has(Sa(t))}const eC=[":popover-open",":modal"];function Is(t){return eC.some(o=>{try{return t.matches(o)}catch{return!1}})}const tC=["transform","translate","scale","rotate","perspective"],nC=["transform","translate","scale","rotate","perspective","filter"],oC=["paint","layout","strict","content"];function Gd(t){const o=Ks(),a=Ye(t)?hn(t):t;return tC.some(r=>a[r]?a[r]!=="none":!1)||(a.containerType?a.containerType!=="normal":!1)||!o&&(a.backdropFilter?a.backdropFilter!=="none":!1)||!o&&(a.filter?a.filter!=="none":!1)||nC.some(r=>(a.willChange||"").includes(r))||oC.some(r=>(a.contain||"").includes(r))}function lC(t){let o=vo(t);for(;Wt(o)&&!ho(o);){if(Gd(o))return o;if(Is(o))return null;o=vo(o)}return null}function Ks(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const aC=new Set(["html","body","#document"]);function ho(t){return aC.has(Sa(t))}function hn(t){return Ut(t).getComputedStyle(t)}function Fs(t){return Ye(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function vo(t){if(Sa(t)==="html")return t;const o=t.assignedSlot||t.parentNode||Rs(t)&&t.host||Yn(t);return Rs(o)?o.host:o}function Vv(t){const o=vo(t);return ho(o)?t.ownerDocument?t.ownerDocument.body:t.body:Wt(o)&&kr(o)?o:Vv(o)}function go(t,o,a){var r;o===void 0&&(o=[]),a===void 0&&(a=!0);const s=Vv(t),c=s===((r=t.ownerDocument)==null?void 0:r.body),f=Ut(s);if(c){const d=_d(f);return o.concat(f,f.visualViewport||[],kr(s)?s:[],d&&a?go(d):[])}return o.concat(s,go(s,[],a))}function _d(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function kv(t){const o=hn(t);let a=parseFloat(o.width)||0,r=parseFloat(o.height)||0;const s=Wt(t),c=s?t.offsetWidth:a,f=s?t.offsetHeight:r,d=Ts(a)!==c||Ts(r)!==f;return d&&(a=c,r=f),{width:a,height:r,$:d}}function Zd(t){return Ye(t)?t:t.contextElement}function ya(t){const o=Zd(t);if(!Wt(o))return Un(1);const a=o.getBoundingClientRect(),{width:r,height:s,$:c}=kv(o);let f=(c?Ts(a.width):a.width)/r,d=(c?Ts(a.height):a.height)/s;return(!f||!Number.isFinite(f))&&(f=1),(!d||!Number.isFinite(d))&&(d=1),{x:f,y:d}}const rC=Un(0);function Bv(t){const o=Ut(t);return!Ks()||!o.visualViewport?rC:{x:o.visualViewport.offsetLeft,y:o.visualViewport.offsetTop}}function iC(t,o,a){return o===void 0&&(o=!1),!a||o&&a!==Ut(t)?!1:o}function Sl(t,o,a,r){o===void 0&&(o=!1),a===void 0&&(a=!1);const s=t.getBoundingClientRect(),c=Zd(t);let f=Un(1);o&&(r?Ye(r)&&(f=ya(r)):f=ya(t));const d=iC(c,a,r)?Bv(c):Un(0);let p=(s.left+d.x)/f.x,h=(s.top+d.y)/f.y,v=s.width/f.x,y=s.height/f.y;if(c){const x=Ut(c),C=r&&Ye(r)?Ut(r):r;let T=x,w=_d(T);for(;w&&r&&C!==T;){const M=ya(w),R=w.getBoundingClientRect(),_=hn(w),N=R.left+(w.clientLeft+parseFloat(_.paddingLeft))*M.x,A=R.top+(w.clientTop+parseFloat(_.paddingTop))*M.y;p*=M.x,h*=M.y,v*=M.x,y*=M.y,p+=N,h+=A,T=Ut(w),w=_d(T)}}return ba({width:v,height:y,x:p,y:h})}function Js(t,o){const a=Fs(t).scrollLeft;return o?o.left+a:Sl(Yn(t)).left+a}function Uv(t,o){const a=t.getBoundingClientRect(),r=a.left+o.scrollLeft-Js(t,a),s=a.top+o.scrollTop;return{x:r,y:s}}function sC(t){let{elements:o,rect:a,offsetParent:r,strategy:s}=t;const c=s==="fixed",f=Yn(r),d=o?Is(o.floating):!1;if(r===f||d&&c)return a;let p={scrollLeft:0,scrollTop:0},h=Un(1);const v=Un(0),y=Wt(r);if((y||!y&&!c)&&((Sa(r)!=="body"||kr(f))&&(p=Fs(r)),Wt(r))){const C=Sl(r);h=ya(r),v.x=C.x+r.clientLeft,v.y=C.y+r.clientTop}const x=f&&!y&&!c?Uv(f,p):Un(0);return{width:a.width*h.x,height:a.height*h.y,x:a.x*h.x-p.scrollLeft*h.x+v.x+x.x,y:a.y*h.y-p.scrollTop*h.y+v.y+x.y}}function cC(t){return Array.from(t.getClientRects())}function uC(t){const o=Yn(t),a=Fs(t),r=t.ownerDocument.body,s=Et(o.scrollWidth,o.clientWidth,r.scrollWidth,r.clientWidth),c=Et(o.scrollHeight,o.clientHeight,r.scrollHeight,r.clientHeight);let f=-a.scrollLeft+Js(t);const d=-a.scrollTop;return hn(r).direction==="rtl"&&(f+=Et(o.clientWidth,r.clientWidth)-s),{width:s,height:c,x:f,y:d}}const i0=25;function fC(t,o){const a=Ut(t),r=Yn(t),s=a.visualViewport;let c=r.clientWidth,f=r.clientHeight,d=0,p=0;if(s){c=s.width,f=s.height;const v=Ks();(!v||v&&o==="fixed")&&(d=s.offsetLeft,p=s.offsetTop)}const h=Js(r);if(h<=0){const v=r.ownerDocument,y=v.body,x=getComputedStyle(y),C=v.compatMode==="CSS1Compat"&&parseFloat(x.marginLeft)+parseFloat(x.marginRight)||0,T=Math.abs(r.clientWidth-y.clientWidth-C);T<=i0&&(c-=T)}else h<=i0&&(c+=h);return{width:c,height:f,x:d,y:p}}const dC=new Set(["absolute","fixed"]);function mC(t,o){const a=Sl(t,!0,o==="fixed"),r=a.top+t.clientTop,s=a.left+t.clientLeft,c=Wt(t)?ya(t):Un(1),f=t.clientWidth*c.x,d=t.clientHeight*c.y,p=s*c.x,h=r*c.y;return{width:f,height:d,x:p,y:h}}function s0(t,o,a){let r;if(o==="viewport")r=fC(t,a);else if(o==="document")r=uC(Yn(t));else if(Ye(o))r=mC(o,a);else{const s=Bv(t);r={x:o.x-s.x,y:o.y-s.y,width:o.width,height:o.height}}return ba(r)}function $v(t,o){const a=vo(t);return a===o||!Ye(a)||ho(a)?!1:hn(a).position==="fixed"||$v(a,o)}function pC(t,o){const a=o.get(t);if(a)return a;let r=go(t,[],!1).filter(d=>Ye(d)&&Sa(d)!=="body"),s=null;const c=hn(t).position==="fixed";let f=c?vo(t):t;for(;Ye(f)&&!ho(f);){const d=hn(f),p=Gd(f);!p&&d.position==="fixed"&&(s=null),(c?!p&&!s:!p&&d.position==="static"&&!!s&&dC.has(s.position)||kr(f)&&!p&&$v(t,f))?r=r.filter(v=>v!==f):s=d,f=vo(f)}return o.set(t,r),r}function hC(t){let{element:o,boundary:a,rootBoundary:r,strategy:s}=t;const f=[...a==="clippingAncestors"?Is(o)?[]:pC(o,this._c):[].concat(a),r],d=f[0],p=f.reduce((h,v)=>{const y=s0(o,v,s);return h.top=Et(y.top,h.top),h.right=Tn(y.right,h.right),h.bottom=Tn(y.bottom,h.bottom),h.left=Et(y.left,h.left),h},s0(o,d,s));return{width:p.right-p.left,height:p.bottom-p.top,x:p.left,y:p.top}}function gC(t){const{width:o,height:a}=kv(t);return{width:o,height:a}}function vC(t,o,a){const r=Wt(o),s=Yn(o),c=a==="fixed",f=Sl(t,!0,c,o);let d={scrollLeft:0,scrollTop:0};const p=Un(0);function h(){p.x=Js(s)}if(r||!r&&!c)if((Sa(o)!=="body"||kr(s))&&(d=Fs(o)),r){const C=Sl(o,!0,c,o);p.x=C.x+o.clientLeft,p.y=C.y+o.clientTop}else s&&h();c&&!r&&s&&h();const v=s&&!r&&!c?Uv(s,d):Un(0),y=f.left+d.scrollLeft-p.x-v.x,x=f.top+d.scrollTop-p.y-v.y;return{x:y,y:x,width:f.width,height:f.height}}function Wf(t){return hn(t).position==="static"}function c0(t,o){if(!Wt(t)||hn(t).position==="fixed")return null;if(o)return o(t);let a=t.offsetParent;return Yn(t)===a&&(a=a.ownerDocument.body),a}function Gv(t,o){const a=Ut(t);if(Is(t))return a;if(!Wt(t)){let s=vo(t);for(;s&&!ho(s);){if(Ye(s)&&!Wf(s))return s;s=vo(s)}return a}let r=c0(t,o);for(;r&&W4(r)&&Wf(r);)r=c0(r,o);return r&&ho(r)&&Wf(r)&&!Gd(r)?a:r||lC(t)||a}const yC=async function(t){const o=this.getOffsetParent||Gv,a=this.getDimensions,r=await a(t.floating);return{reference:vC(t.reference,await o(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function bC(t){return hn(t).direction==="rtl"}const xC={convertOffsetParentRelativeRectToViewportRelativeRect:sC,getDocumentElement:Yn,getClippingRect:hC,getOffsetParent:Gv,getElementRects:yC,getClientRects:cC,getDimensions:gC,getScale:ya,isElement:Ye,isRTL:bC};function Zv(t,o){return t.x===o.x&&t.y===o.y&&t.width===o.width&&t.height===o.height}function SC(t,o){let a=null,r;const s=Yn(t);function c(){var d;clearTimeout(r),(d=a)==null||d.disconnect(),a=null}function f(d,p){d===void 0&&(d=!1),p===void 0&&(p=1),c();const h=t.getBoundingClientRect(),{left:v,top:y,width:x,height:C}=h;if(d||o(),!x||!C)return;const T=fs(y),w=fs(s.clientWidth-(v+x)),M=fs(s.clientHeight-(y+C)),R=fs(v),N={rootMargin:-T+"px "+-w+"px "+-M+"px "+-R+"px",threshold:Et(0,Tn(1,p))||1};let A=!0;function H(L){const Z=L[0].intersectionRatio;if(Z!==p){if(!A)return f();Z?f(!1,Z):r=setTimeout(()=>{f(!1,1e-7)},1e3)}Z===1&&!Zv(h,t.getBoundingClientRect())&&f(),A=!1}try{a=new IntersectionObserver(H,{...N,root:s.ownerDocument})}catch{a=new IntersectionObserver(H,N)}a.observe(t)}return f(!0),c}function js(t,o,a,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:c=!0,elementResize:f=typeof ResizeObserver=="function",layoutShift:d=typeof IntersectionObserver=="function",animationFrame:p=!1}=r,h=Zd(t),v=s||c?[...h?go(h):[],...go(o)]:[];v.forEach(R=>{s&&R.addEventListener("scroll",a,{passive:!0}),c&&R.addEventListener("resize",a)});const y=h&&d?SC(h,a):null;let x=-1,C=null;f&&(C=new ResizeObserver(R=>{let[_]=R;_&&_.target===h&&C&&(C.unobserve(o),cancelAnimationFrame(x),x=requestAnimationFrame(()=>{var N;(N=C)==null||N.observe(o)})),a()}),h&&!p&&C.observe(h),C.observe(o));let T,w=p?Sl(t):null;p&&M();function M(){const R=Sl(t);w&&!Zv(w,R)&&a(),w=R,T=requestAnimationFrame(M)}return a(),()=>{var R;v.forEach(_=>{s&&_.removeEventListener("scroll",a),c&&_.removeEventListener("resize",a)}),y?.(),(R=C)==null||R.disconnect(),C=null,p&&cancelAnimationFrame(T)}}const CC=P4,wC=$4,TC=Q4,EC=G4,MC=K4,RC=Z4,u0=B4,jC=Y4,_C=I4,OC=(t,o,a)=>{const r=new Map,s={platform:xC,...a},c={...s.platform,_c:r};return k4(t,o,{...s,platform:c})};var NC=typeof document<"u",AC=function(){},Ss=NC?S.useLayoutEffect:AC;function _s(t,o){if(t===o)return!0;if(typeof t!=typeof o)return!1;if(typeof t=="function"&&t.toString()===o.toString())return!0;let a,r,s;if(t&&o&&typeof t=="object"){if(Array.isArray(t)){if(a=t.length,a!==o.length)return!1;for(r=a;r--!==0;)if(!_s(t[r],o[r]))return!1;return!0}if(s=Object.keys(t),a=s.length,a!==Object.keys(o).length)return!1;for(r=a;r--!==0;)if(!{}.hasOwnProperty.call(o,s[r]))return!1;for(r=a;r--!==0;){const c=s[r];if(!(c==="_owner"&&t.$$typeof)&&!_s(t[c],o[c]))return!1}return!0}return t!==t&&o!==o}function qv(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function f0(t,o){const a=qv(t);return Math.round(o*a)/a}function ed(t){const o=S.useRef(t);return Ss(()=>{o.current=t}),o}function DC(t){t===void 0&&(t={});const{placement:o="bottom",strategy:a="absolute",middleware:r=[],platform:s,elements:{reference:c,floating:f}={},transform:d=!0,whileElementsMounted:p,open:h}=t,[v,y]=S.useState({x:0,y:0,strategy:a,placement:o,middlewareData:{},isPositioned:!1}),[x,C]=S.useState(r);_s(x,r)||C(r);const[T,w]=S.useState(null),[M,R]=S.useState(null),_=S.useCallback(V=>{V!==L.current&&(L.current=V,w(V))},[]),N=S.useCallback(V=>{V!==Z.current&&(Z.current=V,R(V))},[]),A=c||T,H=f||M,L=S.useRef(null),Z=S.useRef(null),I=S.useRef(v),J=p!=null,P=ed(p),ee=ed(s),oe=ed(h),te=S.useCallback(()=>{if(!L.current||!Z.current)return;const V={placement:o,strategy:a,middleware:x};ee.current&&(V.platform=ee.current),OC(L.current,Z.current,V).then(K=>{const W={...K,isPositioned:oe.current!==!1};B.current&&!_s(I.current,W)&&(I.current=W,Zn.flushSync(()=>{y(W)}))})},[x,o,a,ee,oe]);Ss(()=>{h===!1&&I.current.isPositioned&&(I.current.isPositioned=!1,y(V=>({...V,isPositioned:!1})))},[h]);const B=S.useRef(!1);Ss(()=>(B.current=!0,()=>{B.current=!1}),[]),Ss(()=>{if(A&&(L.current=A),H&&(Z.current=H),A&&H){if(P.current)return P.current(A,H,te);te()}},[A,H,te,P,J]);const ne=S.useMemo(()=>({reference:L,floating:Z,setReference:_,setFloating:N}),[_,N]),D=S.useMemo(()=>({reference:A,floating:H}),[A,H]),U=S.useMemo(()=>{const V={position:a,left:0,top:0};if(!D.floating)return V;const K=f0(D.floating,v.x),W=f0(D.floating,v.y);return d?{...V,transform:"translate("+K+"px, "+W+"px)",...qv(D.floating)>=1.5&&{willChange:"transform"}}:{position:a,left:K,top:W}},[a,d,D.floating,v.x,v.y]);return S.useMemo(()=>({...v,update:te,refs:ne,elements:D,floatingStyles:U}),[v,te,ne,D,U])}const HC=t=>{function o(a){return{}.hasOwnProperty.call(a,"current")}return{name:"arrow",options:t,fn(a){const{element:r,padding:s}=typeof t=="function"?t(a):t;return r&&o(r)?r.current!=null?u0({element:r.current,padding:s}).fn(a):{}:r?u0({element:r,padding:s}).fn(a):{}}}},mn=(t,o)=>({...CC(t),options:[t,o]}),Io=(t,o)=>({...TC(t),options:[t,o]}),d0=(t,o)=>({..._C(t),options:[t,o]}),yo=(t,o)=>({...EC(t),options:[t,o]}),Dr=(t,o)=>({...MC(t),options:[t,o]}),Yv=(t,o)=>({...wC(t),options:[t,o]}),zC=(t,o)=>({...RC(t),options:[t,o]}),jr=(t,o)=>({...jC(t),options:[t,o]}),Xv=(t,o)=>({...HC(t),options:[t,o]}),LC="modulepreload",VC=function(t){return"/"+t},m0={},Os=function(o,a,r){let s=Promise.resolve();if(a&&a.length>0){let p=function(h){return Promise.all(h.map(v=>Promise.resolve(v).then(y=>({status:"fulfilled",value:y}),y=>({status:"rejected",reason:y}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),d=f?.nonce||f?.getAttribute("nonce");s=p(a.map(h=>{if(h=VC(h),h in m0)return;m0[h]=!0;const v=h.endsWith(".css"),y=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${y}`))return;const x=document.createElement("link");if(x.rel=v?"stylesheet":LC,v||(x.as="script"),x.crossOrigin="",x.href=h,d&&x.setAttribute("nonce",d),document.head.appendChild(x),v)return new Promise((C,T)=>{x.addEventListener("load",C),x.addEventListener("error",()=>T(new Error(`Unable to preload CSS for ${h}`)))})}))}function c(f){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=f,window.dispatchEvent(d),!d.defaultPrevented)throw f}return s.then(f=>{for(const d of f||[])d.status==="rejected"&&c(d.reason);return o().catch(c)})};var kC=Object.defineProperty,BC=(t,o,a)=>o in t?kC(t,o,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[o]=a,p0=(t,o,a)=>BC(t,typeof o!="symbol"?o+"":o,a);const h0=sS.create({name:"comment",excludes:"",inclusive:!1,keepOnSplit:!0,addAttributes(){return{orphan:{parseHTML:t=>!!t.getAttribute("data-orphan"),renderHTML:t=>t.orphan?{"data-orphan":"true"}:{},default:!1},threadId:{parseHTML:t=>t.getAttribute("data-bn-thread-id"),renderHTML:t=>({"data-bn-thread-id":t.threadId}),default:""}}},renderHTML({HTMLAttributes:t}){return["span",cS(t,{class:"bn-thread-mark"})]},parseHTML(){return[{tag:"span.bn-thread-mark"}]},extendMarkSchema(t){return t.name==="comment"?{blocknoteIgnore:!0}:{}}});let UC=class extends uS{constructor(o){super(),p0(this,"userCache",new Map),p0(this,"loadingUsers",new Set),this.resolveUsers=o}async loadUsers(o){const a=o.filter(r=>!this.userCache.has(r)&&!this.loadingUsers.has(r));if(a.length!==0){for(const r of a)this.loadingUsers.add(r);try{const r=await this.resolveUsers(a);for(const s of r)this.userCache.set(s.id,s);this.emit("update",this.userCache)}finally{for(const r of a)this.loadingUsers.delete(r)}}}getUser(o){return this.userCache.get(o)}subscribe(o){return this.on("update",o)}};const ds=new oS("blocknote-comments");function $C(t,o){const a=new Map;return t.descendants((r,s)=>{r.marks.forEach(c=>{if(c.type.name===o){const f=c.attrs.threadId;if(!f)return;const d=s,p=d+r.nodeSize,h=a.get(f)??{from:1/0,to:0};a.set(f,{from:Math.min(d,h.from),to:Math.max(p,h.to)})}})}),a}const gn=tS(({editor:t,options:{schema:o,threadStore:a,resolveUsers:r}})=>{if(!r)throw new Error("resolveUsers is required to be defined when using comments");if(!a)throw new Error("threadStore is required to be defined when using comments");const s=h0.name,c=new UC(r),f=nS({pendingComment:!1,selectedThreadId:void 0,threadPositions:new Map},{onUpdate(){f.state.selectedThreadId!==f.prevState.selectedThreadId&&t.transact(p=>p.setMeta(ds,!0))}}),d=p=>{t.transact(h=>{h.doc.descendants((v,y)=>{v.marks.forEach(x=>{if(x.type.name===s){const C=x.type,T=x.attrs.threadId,w=p.get(T),M=!!(!w||w.resolved||w.deletedAt);if(M!==x.attrs.orphan){const R=Math.max(y,0),_=Math.min(y+v.nodeSize,h.doc.content.size-1,h.doc.content.size-1);h.removeMark(R,_,x),h.addMark(R,_,C.create({...x.attrs,orphan:M})),M&&f.state.selectedThreadId===T&&f.setState(N=>({...N,selectedThreadId:void 0}))}}})})})};return{key:"comments",store:f,prosemirrorPlugins:[new lS({key:ds,state:{init(){return{decorations:Uf.empty}},apply(p,h){const v=p.getMeta(ds);if(!p.docChanged&&!v)return h;const y=p.docChanged?$C(p.doc,s):f.state.threadPositions;(y.size>0||f.state.threadPositions.size>0)&&f.setState(C=>({...C,threadPositions:y}));const x=[];if(f.state.selectedThreadId){const C=y.get(f.state.selectedThreadId);C&&x.push(iS.inline(C.from,C.to,{class:"bn-thread-mark-selected"}))}return{decorations:Uf.create(p.doc,x)}}},props:{decorations(p){var h;return((h=ds.getState(p))==null?void 0:h.decorations)??Uf.empty},handleClick:(p,h,v)=>{if(v.button!==0)return;const y=p.state.doc.nodeAt(h);if(!y){f.setState(T=>({...T,selectedThreadId:void 0}));return}const x=y.marks.find(T=>T.type.name===s&&T.attrs.orphan!==!0),C=x?.attrs.threadId;C!==f.state.selectedThreadId&&f.setState(T=>({...T,selectedThreadId:C}))}}})],threadStore:a,mount(){const p=a.subscribe(d);d(a.getThreads());const h=t.onSelectionChange(()=>{f.state.pendingComment&&f.setState(v=>({...v,pendingComment:!1}))});return()=>{p(),h()}},selectThread(p,h=!0){var v,y;if(f.state.selectedThreadId!==p&&(f.setState(x=>({...x,pendingComment:!1,selectedThreadId:p})),p&&h)){const x=f.state.threadPositions.get(p);if(!x)return;(y=(v=t.prosemirrorView)==null?void 0:v.domAtPos(x.from).node)==null||y.scrollIntoView({behavior:"smooth",block:"center"})}},startPendingComment(){var p;f.setState(h=>({...h,selectedThreadId:void 0,pendingComment:!0})),(p=t.getExtension(Td))==null||p.showSelection(!0,"comments")},stopPendingComment(){var p;f.setState(h=>({...h,selectedThreadId:void 0,pendingComment:!1})),(p=t.getExtension(Td))==null||p.showSelection(!1,"comments")},async createThread(p){const h=await a.createThread(p);if(a.addThreadToDocument){const v=t.prosemirrorView,y=v.state.selection,x=aS.getState(v.state),C={prosemirror:{head:y.head,anchor:y.anchor},yjs:x?rS(x.binding,v.state):void 0};await a.addThreadToDocument({threadId:h.id,selection:C})}else t._tiptapEditor.commands.setMark(s,{orphan:!1,threadId:h.id})},userStore:c,commentEditorSchema:o,tiptapExtensions:[h0]}});let td;async function GC(){return td||(td=(async()=>{const[t,o]=await Promise.all([Os(()=>import("./module-RjUF93sV.js"),[]),Os(()=>import("./native-48B9X9Wg.js"),[])]),a="default"in t?t.default:t,r="default"in o?o.default:o;return await a.init({data:r}),{emojiMart:a,emojiData:r}})(),td)}async function ZC(t,o){if(!("text"in t.schema.inlineContentSchema)||t.schema.inlineContentSchema.text!==fS.text)return[];const{emojiData:a,emojiMart:r}=await GC();return(o.trim()===""?Object.values(a.emojis):await r.SearchIndex.search(o)).map(s=>({id:s.skins[0].native,onItemClick:()=>t.insertInlineContent(s.skins[0].native+" ")}))}function qC(){const t=navigator.userAgentData;return t!=null&&t.platform?t.platform:navigator.platform}function YC(){const t=navigator.userAgentData;return t&&Array.isArray(t.brands)?t.brands.map(o=>{let{brand:a,version:r}=o;return a+"/"+r}).join(" "):navigator.userAgent}function XC(){return/apple/i.test(navigator.vendor)}function PC(){return qC().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function QC(){return YC().includes("jsdom/")}const g0="data-floating-ui-focusable",IC="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function v0(t){let o=t.activeElement;for(;((a=o)==null||(a=a.shadowRoot)==null?void 0:a.activeElement)!=null;){var a;o=o.shadowRoot.activeElement}return o}function Hr(t,o){if(!t||!o)return!1;const a=o.getRootNode==null?void 0:o.getRootNode();if(t.contains(o))return!0;if(a&&Rs(a)){let r=o;for(;r;){if(t===r)return!0;r=r.parentNode||r.host}}return!1}function ga(t){return"composedPath"in t?t.composedPath()[0]:t.target}function nd(t,o){if(o==null)return!1;if("composedPath"in t)return t.composedPath().includes(o);const a=t;return a.target!=null&&o.contains(a.target)}function KC(t){return t.matches("html,body")}function bl(t){return t?.ownerDocument||document}function FC(t){return Wt(t)&&t.matches(IC)}function JC(t){if(!t||QC())return!0;try{return t.matches(":focus-visible")}catch{return!0}}function WC(t){return t?t.hasAttribute(g0)?t:t.querySelector("["+g0+"]")||t:null}function Cs(t,o,a){return a===void 0&&(a=!0),t.filter(s=>{var c;return s.parentId===o&&(!a||((c=s.context)==null?void 0:c.open))}).flatMap(s=>[s,...Cs(t,s.id,a)])}function e5(t){return"nativeEvent"in t}function Od(t,o){const a=["mouse","pen"];return a.push("",void 0),a.includes(t)}var t5=typeof document<"u",n5=function(){},pn=t5?S.useLayoutEffect:n5;const o5={...hv};function Po(t){const o=S.useRef(t);return pn(()=>{o.current=t}),o}const l5=o5.useInsertionEffect,a5=l5||(t=>t());function kn(t){const o=S.useRef(()=>{});return a5(()=>{o.current=t}),S.useCallback(function(){for(var a=arguments.length,r=new Array(a),s=0;s<a;s++)r[s]=arguments[s];return o.current==null?void 0:o.current(...r)},[])}function r5(t){const o=S.useRef(void 0),a=S.useCallback(r=>{const s=t.map(c=>{if(c!=null){if(typeof c=="function"){const f=c,d=f(r);return typeof d=="function"?d:()=>{f(null)}}return c.current=r,()=>{c.current=null}}});return()=>{s.forEach(c=>c?.())}},t);return S.useMemo(()=>t.every(r=>r==null)?null:r=>{o.current&&(o.current(),o.current=void 0),r!=null&&(o.current=a(r))},t)}const i5="data-floating-ui-focusable",y0="active",b0="selected",s5={...hv};let x0=!1,c5=0;const S0=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+c5++;function u5(){const[t,o]=S.useState(()=>x0?S0():void 0);return pn(()=>{t==null&&o(S0())},[]),S.useEffect(()=>{x0=!0},[]),t}const f5=s5.useId,Pv=f5||u5;function d5(){const t=new Map;return{emit(o,a){var r;(r=t.get(o))==null||r.forEach(s=>s(a))},on(o,a){t.has(o)||t.set(o,new Set),t.get(o).add(a)},off(o,a){var r;(r=t.get(o))==null||r.delete(a)}}}const m5=S.createContext(null),p5=S.createContext(null),qd=()=>{var t;return((t=S.useContext(m5))==null?void 0:t.id)||null},Yd=()=>S.useContext(p5);function Xd(t){return"data-floating-ui-"+t}function Vt(t){t.current!==-1&&(clearTimeout(t.current),t.current=-1)}const C0=Xd("safe-polygon");function ws(t,o,a){if(a&&!Od(a))return 0;if(typeof t=="number")return t;if(typeof t=="function"){const r=t();return typeof r=="number"?r:r?.[o]}return t?.[o]}function od(t){return typeof t=="function"?t():t}function Qv(t,o){o===void 0&&(o={});const{open:a,onOpenChange:r,dataRef:s,events:c,elements:f}=t,{enabled:d=!0,delay:p=0,handleClose:h=null,mouseOnly:v=!1,restMs:y=0,move:x=!0}=o,C=Yd(),T=qd(),w=Po(h),M=Po(p),R=Po(a),_=Po(y),N=S.useRef(),A=S.useRef(-1),H=S.useRef(),L=S.useRef(-1),Z=S.useRef(!0),I=S.useRef(!1),J=S.useRef(()=>{}),P=S.useRef(!1),ee=kn(()=>{var U;const V=(U=s.current.openEvent)==null?void 0:U.type;return V?.includes("mouse")&&V!=="mousedown"});S.useEffect(()=>{if(!d)return;function U(V){let{open:K}=V;K||(Vt(A),Vt(L),Z.current=!0,P.current=!1)}return c.on("openchange",U),()=>{c.off("openchange",U)}},[d,c]),S.useEffect(()=>{if(!d||!w.current||!a)return;function U(K){ee()&&r(!1,K,"hover")}const V=bl(f.floating).documentElement;return V.addEventListener("mouseleave",U),()=>{V.removeEventListener("mouseleave",U)}},[f.floating,a,r,d,w,ee]);const oe=S.useCallback(function(U,V,K){V===void 0&&(V=!0),K===void 0&&(K="hover");const W=ws(M.current,"close",N.current);W&&!H.current?(Vt(A),A.current=window.setTimeout(()=>r(!1,U,K),W)):V&&(Vt(A),r(!1,U,K))},[M,r]),te=kn(()=>{J.current(),H.current=void 0}),B=kn(()=>{if(I.current){const U=bl(f.floating).body;U.style.pointerEvents="",U.removeAttribute(C0),I.current=!1}}),ne=kn(()=>s.current.openEvent?["click","mousedown"].includes(s.current.openEvent.type):!1);S.useEffect(()=>{if(!d)return;function U(le){if(Vt(A),Z.current=!1,v&&!Od(N.current)||od(_.current)>0&&!ws(M.current,"open"))return;const ae=ws(M.current,"open",N.current);ae?A.current=window.setTimeout(()=>{R.current||r(!0,le,"hover")},ae):a||r(!0,le,"hover")}function V(le){if(ne()){B();return}J.current();const ae=bl(f.floating);if(Vt(L),P.current=!1,w.current&&s.current.floatingContext){a||Vt(A),H.current=w.current({...s.current.floatingContext,tree:C,x:le.clientX,y:le.clientY,onClose(){B(),te(),ne()||oe(le,!0,"safe-polygon")}});const ge=H.current;ae.addEventListener("mousemove",ge),J.current=()=>{ae.removeEventListener("mousemove",ge)};return}(N.current!=="touch"||!Hr(f.floating,le.relatedTarget))&&oe(le)}function K(le){ne()||s.current.floatingContext&&(w.current==null||w.current({...s.current.floatingContext,tree:C,x:le.clientX,y:le.clientY,onClose(){B(),te(),ne()||oe(le)}})(le))}function W(){Vt(A)}function de(le){ne()||oe(le,!1)}if(Ye(f.domReference)){const le=f.domReference,ae=f.floating;return a&&le.addEventListener("mouseleave",K),x&&le.addEventListener("mousemove",U,{once:!0}),le.addEventListener("mouseenter",U),le.addEventListener("mouseleave",V),ae&&(ae.addEventListener("mouseleave",K),ae.addEventListener("mouseenter",W),ae.addEventListener("mouseleave",de)),()=>{a&&le.removeEventListener("mouseleave",K),x&&le.removeEventListener("mousemove",U),le.removeEventListener("mouseenter",U),le.removeEventListener("mouseleave",V),ae&&(ae.removeEventListener("mouseleave",K),ae.removeEventListener("mouseenter",W),ae.removeEventListener("mouseleave",de))}}},[f,d,t,v,x,oe,te,B,r,a,R,C,M,w,s,ne,_]),pn(()=>{var U;if(d&&a&&(U=w.current)!=null&&(U=U.__options)!=null&&U.blockPointerEvents&&ee()){I.current=!0;const K=f.floating;if(Ye(f.domReference)&&K){var V;const W=bl(f.floating).body;W.setAttribute(C0,"");const de=f.domReference,le=C==null||(V=C.nodesRef.current.find(ae=>ae.id===T))==null||(V=V.context)==null?void 0:V.elements.floating;return le&&(le.style.pointerEvents=""),W.style.pointerEvents="none",de.style.pointerEvents="auto",K.style.pointerEvents="auto",()=>{W.style.pointerEvents="",de.style.pointerEvents="",K.style.pointerEvents=""}}}},[d,a,T,f,C,w,ee]),pn(()=>{a||(N.current=void 0,P.current=!1,te(),B())},[a,te,B]),S.useEffect(()=>()=>{te(),Vt(A),Vt(L),B()},[d,f.domReference,te,B]);const D=S.useMemo(()=>{function U(V){N.current=V.pointerType}return{onPointerDown:U,onPointerEnter:U,onMouseMove(V){const{nativeEvent:K}=V;function W(){!Z.current&&!R.current&&r(!0,K,"hover")}v&&!Od(N.current)||a||od(_.current)===0||P.current&&V.movementX**2+V.movementY**2<2||(Vt(L),N.current==="touch"?W():(P.current=!0,L.current=window.setTimeout(W,od(_.current))))}}},[v,r,a,R,_]);return S.useMemo(()=>d?{reference:D}:{},[d,D])}const Nd=()=>{},Iv=S.createContext({delay:0,initialDelay:0,timeoutMs:0,currentId:null,setCurrentId:Nd,setState:Nd,isInstantPhase:!1}),h5=()=>S.useContext(Iv);function g5(t){const{children:o,delay:a,timeoutMs:r=0}=t,[s,c]=S.useReducer((p,h)=>({...p,...h}),{delay:a,timeoutMs:r,initialDelay:a,currentId:null,isInstantPhase:!1}),f=S.useRef(null),d=S.useCallback(p=>{c({currentId:p})},[]);return pn(()=>{s.currentId?f.current===null?f.current=s.currentId:s.isInstantPhase||c({isInstantPhase:!0}):(s.isInstantPhase&&c({isInstantPhase:!1}),f.current=null)},[s.currentId,s.isInstantPhase]),g.jsx(Iv.Provider,{value:S.useMemo(()=>({...s,setState:c,setCurrentId:d}),[s,d]),children:o})}function v5(t,o){o===void 0&&(o={});const{open:a,onOpenChange:r,floatingId:s}=t,{id:c,enabled:f=!0}=o,d=c??s,p=h5(),{currentId:h,setCurrentId:v,initialDelay:y,setState:x,timeoutMs:C}=p;return pn(()=>{f&&h&&(x({delay:{open:1,close:ws(y,"close")}}),h!==d&&r(!1))},[f,d,r,x,h,y]),pn(()=>{function T(){r(!1),x({delay:y,currentId:null})}if(f&&h&&!a&&h===d){if(C){const w=window.setTimeout(T,C);return()=>{clearTimeout(w)}}T()}},[f,a,x,h,d,r,y,C]),pn(()=>{f&&(v===Nd||!a||v(d))},[f,a,v,d]),p}function ld(t,o){if(!t||!o)return!1;const a=o.getRootNode==null?void 0:o.getRootNode();if(t.contains(o))return!0;if(a&&Rs(a)){let r=o;for(;r;){if(t===r)return!0;r=r.parentNode||r.host}}return!1}function y5(t){return"composedPath"in t?t.composedPath()[0]:t.target}const b5={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},x5={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},w0=t=>{var o,a;return{escapeKey:typeof t=="boolean"?t:(o=t?.escapeKey)!=null?o:!1,outsidePress:typeof t=="boolean"?t:(a=t?.outsidePress)!=null?a:!0}};function Kv(t,o){o===void 0&&(o={});const{open:a,onOpenChange:r,elements:s,dataRef:c}=t,{enabled:f=!0,escapeKey:d=!0,outsidePress:p=!0,outsidePressEvent:h="pointerdown",referencePress:v=!1,referencePressEvent:y="pointerdown",ancestorScroll:x=!1,bubbles:C,capture:T}=o,w=Yd(),M=kn(typeof p=="function"?p:()=>!1),R=typeof p=="function"?M:p,_=S.useRef(!1),{escapeKey:N,outsidePress:A}=w0(C),{escapeKey:H,outsidePress:L}=w0(T),Z=S.useRef(!1),I=kn(B=>{var ne;if(!a||!f||!d||B.key!=="Escape"||Z.current)return;const D=(ne=c.current.floatingContext)==null?void 0:ne.nodeId,U=w?Cs(w.nodesRef.current,D):[];if(!N&&(B.stopPropagation(),U.length>0)){let V=!0;if(U.forEach(K=>{var W;if((W=K.context)!=null&&W.open&&!K.context.dataRef.current.__escapeKeyBubbles){V=!1;return}}),!V)return}r(!1,e5(B)?B.nativeEvent:B,"escape-key")}),J=kn(B=>{var ne;const D=()=>{var U;I(B),(U=ga(B))==null||U.removeEventListener("keydown",D)};(ne=ga(B))==null||ne.addEventListener("keydown",D)}),P=kn(B=>{var ne;const D=c.current.insideReactTree;c.current.insideReactTree=!1;const U=_.current;if(_.current=!1,h==="click"&&U||D||typeof R=="function"&&!R(B))return;const V=ga(B),K="["+Xd("inert")+"]",W=bl(s.floating).querySelectorAll(K);let de=Ye(V)?V:null;for(;de&&!ho(de);){const ge=vo(de);if(ho(ge)||!Ye(ge))break;de=ge}if(W.length&&Ye(V)&&!KC(V)&&!Hr(V,s.floating)&&Array.from(W).every(ge=>!Hr(de,ge)))return;if(Wt(V)&&te){const ge=ho(V),Ne=hn(V),Pe=/auto|scroll/,Ee=ge||Pe.test(Ne.overflowX),ve=ge||Pe.test(Ne.overflowY),We=Ee&&V.clientWidth>0&&V.scrollWidth>V.clientWidth,rt=ve&&V.clientHeight>0&&V.scrollHeight>V.clientHeight,et=Ne.direction==="rtl",ze=rt&&(et?B.offsetX<=V.offsetWidth-V.clientWidth:B.offsetX>V.clientWidth),ot=We&&B.offsetY>V.clientHeight;if(ze||ot)return}const le=(ne=c.current.floatingContext)==null?void 0:ne.nodeId,ae=w&&Cs(w.nodesRef.current,le).some(ge=>{var Ne;return nd(B,(Ne=ge.context)==null?void 0:Ne.elements.floating)});if(nd(B,s.floating)||nd(B,s.domReference)||ae)return;const ye=w?Cs(w.nodesRef.current,le):[];if(ye.length>0){let ge=!0;if(ye.forEach(Ne=>{var Pe;if((Pe=Ne.context)!=null&&Pe.open&&!Ne.context.dataRef.current.__outsidePressBubbles){ge=!1;return}}),!ge)return}r(!1,B,"outside-press")}),ee=kn(B=>{var ne;const D=()=>{var U;P(B),(U=ga(B))==null||U.removeEventListener(h,D)};(ne=ga(B))==null||ne.addEventListener(h,D)});S.useEffect(()=>{if(!a||!f)return;c.current.__escapeKeyBubbles=N,c.current.__outsidePressBubbles=A;let B=-1;function ne(W){r(!1,W,"ancestor-scroll")}function D(){window.clearTimeout(B),Z.current=!0}function U(){B=window.setTimeout(()=>{Z.current=!1},Ks()?5:0)}const V=bl(s.floating);d&&(V.addEventListener("keydown",H?J:I,H),V.addEventListener("compositionstart",D),V.addEventListener("compositionend",U)),R&&V.addEventListener(h,L?ee:P,L);let K=[];return x&&(Ye(s.domReference)&&(K=go(s.domReference)),Ye(s.floating)&&(K=K.concat(go(s.floating))),!Ye(s.reference)&&s.reference&&s.reference.contextElement&&(K=K.concat(go(s.reference.contextElement)))),K=K.filter(W=>{var de;return W!==((de=V.defaultView)==null?void 0:de.visualViewport)}),K.forEach(W=>{W.addEventListener("scroll",ne,{passive:!0})}),()=>{d&&(V.removeEventListener("keydown",H?J:I,H),V.removeEventListener("compositionstart",D),V.removeEventListener("compositionend",U)),R&&V.removeEventListener(h,L?ee:P,L),K.forEach(W=>{W.removeEventListener("scroll",ne)}),window.clearTimeout(B)}},[c,s,d,R,h,a,r,x,f,N,A,I,H,J,P,L,ee]),S.useEffect(()=>{c.current.insideReactTree=!1},[c,R,h]);const oe=S.useMemo(()=>({onKeyDown:I,...v&&{[b5[y]]:B=>{r(!1,B.nativeEvent,"reference-press")},...y!=="click"&&{onClick(B){r(!1,B.nativeEvent,"reference-press")}}}}),[I,r,v,y]),te=S.useMemo(()=>({onKeyDown:I,onMouseDown(){_.current=!0},onMouseUp(){_.current=!0},[x5[h]]:()=>{c.current.insideReactTree=!0}}),[I,h,c]);return S.useMemo(()=>f?{reference:oe,floating:te}:{},[f,oe,te])}function S5(t){const{open:o=!1,onOpenChange:a,elements:r}=t,s=Pv(),c=S.useRef({}),[f]=S.useState(()=>d5()),d=qd()!=null,[p,h]=S.useState(r.reference),v=kn((C,T,w)=>{c.current.openEvent=C?T:void 0,f.emit("openchange",{open:C,event:T,reason:w,nested:d}),a?.(C,T,w)}),y=S.useMemo(()=>({setPositionReference:h}),[]),x=S.useMemo(()=>({reference:p||r.reference||null,floating:r.floating||null,domReference:r.reference}),[p,r.reference,r.floating]);return S.useMemo(()=>({dataRef:c,open:o,onOpenChange:v,elements:x,events:f,floatingId:s,refs:y}),[o,v,x,f,s,y])}function Ws(t){t===void 0&&(t={});const{nodeId:o}=t,a=S5({...t,elements:{reference:null,floating:null,...t.elements}}),r=t.rootContext||a,s=r.elements,[c,f]=S.useState(null),[d,p]=S.useState(null),v=s?.domReference||c,y=S.useRef(null),x=Yd();pn(()=>{v&&(y.current=v)},[v]);const C=DC({...t,elements:{...s,...d&&{reference:d}}}),T=S.useCallback(N=>{const A=Ye(N)?{getBoundingClientRect:()=>N.getBoundingClientRect(),getClientRects:()=>N.getClientRects(),contextElement:N}:N;p(A),C.refs.setReference(A)},[C.refs]),w=S.useCallback(N=>{(Ye(N)||N===null)&&(y.current=N,f(N)),(Ye(C.refs.reference.current)||C.refs.reference.current===null||N!==null&&!Ye(N))&&C.refs.setReference(N)},[C.refs]),M=S.useMemo(()=>({...C.refs,setReference:w,setPositionReference:T,domReference:y}),[C.refs,w,T]),R=S.useMemo(()=>({...C.elements,domReference:v}),[C.elements,v]),_=S.useMemo(()=>({...C,...r,refs:M,elements:R,nodeId:o}),[C,M,R,o,r]);return pn(()=>{r.dataRef.current.floatingContext=_;const N=x?.nodesRef.current.find(A=>A.id===o);N&&(N.context=_)}),S.useMemo(()=>({...C,context:_,refs:M,elements:R}),[C,M,R,_])}function ad(){return PC()&&XC()}function C5(t,o){o===void 0&&(o={});const{open:a,onOpenChange:r,events:s,dataRef:c,elements:f}=t,{enabled:d=!0,visibleOnly:p=!0}=o,h=S.useRef(!1),v=S.useRef(-1),y=S.useRef(!0);S.useEffect(()=>{if(!d)return;const C=Ut(f.domReference);function T(){!a&&Wt(f.domReference)&&f.domReference===v0(bl(f.domReference))&&(h.current=!0)}function w(){y.current=!0}function M(){y.current=!1}return C.addEventListener("blur",T),ad()&&(C.addEventListener("keydown",w,!0),C.addEventListener("pointerdown",M,!0)),()=>{C.removeEventListener("blur",T),ad()&&(C.removeEventListener("keydown",w,!0),C.removeEventListener("pointerdown",M,!0))}},[f.domReference,a,d]),S.useEffect(()=>{if(!d)return;function C(T){let{reason:w}=T;(w==="reference-press"||w==="escape-key")&&(h.current=!0)}return s.on("openchange",C),()=>{s.off("openchange",C)}},[s,d]),S.useEffect(()=>()=>{Vt(v)},[]);const x=S.useMemo(()=>({onMouseLeave(){h.current=!1},onFocus(C){if(h.current)return;const T=ga(C.nativeEvent);if(p&&Ye(T)){if(ad()&&!C.relatedTarget){if(!y.current&&!FC(T))return}else if(!JC(T))return}r(!0,C.nativeEvent,"focus")},onBlur(C){h.current=!1;const T=C.relatedTarget,w=C.nativeEvent,M=Ye(T)&&T.hasAttribute(Xd("focus-guard"))&&T.getAttribute("data-type")==="outside";v.current=window.setTimeout(()=>{var R;const _=v0(f.domReference?f.domReference.ownerDocument:document);!T&&_===f.domReference||Hr((R=c.current.floatingContext)==null?void 0:R.refs.floating.current,_)||Hr(f.domReference,_)||M||r(!1,w,"focus")})}}),[c,f.domReference,r,p]);return S.useMemo(()=>d?{reference:x}:{},[d,x])}function rd(t,o,a){const r=new Map,s=a==="item";let c=t;if(s&&t){const{[y0]:f,[b0]:d,...p}=t;c=p}return{...a==="floating"&&{tabIndex:-1,[i5]:""},...c,...o.map(f=>{const d=f?f[a]:null;return typeof d=="function"?t?d(t):null:d}).concat(t).reduce((f,d)=>(d&&Object.entries(d).forEach(p=>{let[h,v]=p;if(!(s&&[y0,b0].includes(h)))if(h.indexOf("on")===0){if(r.has(h)||r.set(h,[]),typeof v=="function"){var y;(y=r.get(h))==null||y.push(v),f[h]=function(){for(var x,C=arguments.length,T=new Array(C),w=0;w<C;w++)T[w]=arguments[w];return(x=r.get(h))==null?void 0:x.map(M=>M(...T)).find(M=>M!==void 0)}}}else f[h]=v}),f),{})}}function Fv(t){t===void 0&&(t=[]);const o=t.map(d=>d?.reference),a=t.map(d=>d?.floating),r=t.map(d=>d?.item),s=S.useCallback(d=>rd(d,t,"reference"),o),c=S.useCallback(d=>rd(d,t,"floating"),a),f=S.useCallback(d=>rd(d,t,"item"),r);return S.useMemo(()=>({getReferenceProps:s,getFloatingProps:c,getItemProps:f}),[s,c,f])}const w5=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function T5(t,o){var a,r;o===void 0&&(o={});const{open:s,elements:c,floatingId:f}=t,{enabled:d=!0,role:p="dialog"}=o,h=Pv(),v=((a=c.domReference)==null?void 0:a.id)||h,y=S.useMemo(()=>{var _;return((_=WC(c.floating))==null?void 0:_.id)||f},[c.floating,f]),x=(r=w5.get(p))!=null?r:p,T=qd()!=null,w=S.useMemo(()=>x==="tooltip"||p==="label"?{["aria-"+(p==="label"?"labelledby":"describedby")]:s?y:void 0}:{"aria-expanded":s?"true":"false","aria-haspopup":x==="alertdialog"?"dialog":x,"aria-controls":s?y:void 0,...x==="listbox"&&{role:"combobox"},...x==="menu"&&{id:v},...x==="menu"&&T&&{role:"menuitem"},...p==="select"&&{"aria-autocomplete":"none"},...p==="combobox"&&{"aria-autocomplete":"list"}},[x,y,T,s,v,p]),M=S.useMemo(()=>{const _={id:y,...x&&{role:x}};return x==="tooltip"||p==="label"?_:{..._,...x==="menu"&&{"aria-labelledby":v}}},[x,y,v,p]),R=S.useCallback(_=>{let{active:N,selected:A}=_;const H={role:"option",...N&&{id:y+"-fui-option"}};switch(p){case"select":case"combobox":return{...H,"aria-selected":A}}return{}},[y,p]);return S.useMemo(()=>d?{reference:w,floating:M,item:R}:{},[d,w,M,R])}const T0=t=>t.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(o,a)=>(a?"-":"")+o.toLowerCase());function da(t,o){return typeof t=="function"?t(o):t}function E5(t,o){const[a,r]=S.useState(t);return t&&!a&&r(!0),S.useEffect(()=>{if(!t&&a){const s=setTimeout(()=>r(!1),o);return()=>clearTimeout(s)}},[t,a,o]),a}function Jv(t,o){o===void 0&&(o={});const{open:a,elements:{floating:r}}=t,{duration:s=250}=o,f=(typeof s=="number"?s:s.close)||0,[d,p]=S.useState("unmounted"),h=E5(a,f);return!h&&d==="close"&&p("unmounted"),pn(()=>{if(r){if(a){p("initial");const v=requestAnimationFrame(()=>{Zn.flushSync(()=>{p("open")})});return()=>{cancelAnimationFrame(v)}}p("close")}},[a,r]),{isMounted:h,status:d}}function M5(t,o){o===void 0&&(o={});const{initial:a={opacity:0},open:r,close:s,common:c,duration:f=250}=o,d=t.placement,p=d.split("-")[0],h=S.useMemo(()=>({side:p,placement:d}),[p,d]),v=typeof f=="number",y=(v?f:f.open)||0,x=(v?f:f.close)||0,[C,T]=S.useState(()=>({...da(c,h),...da(a,h)})),{isMounted:w,status:M}=Jv(t,{duration:f}),R=Po(a),_=Po(r),N=Po(s),A=Po(c);return pn(()=>{const H=da(R.current,h),L=da(N.current,h),Z=da(A.current,h),I=da(_.current,h)||Object.keys(H).reduce((J,P)=>(J[P]="",J),{});if(M==="initial"&&T(J=>({transitionProperty:J.transitionProperty,...Z,...H})),M==="open"&&T({transitionProperty:Object.keys(I).map(T0).join(","),transitionDuration:y+"ms",...Z,...I}),M==="close"){const J=L||H;T({transitionProperty:Object.keys(J).map(T0).join(","),transitionDuration:x+"ms",...Z,...J})}},[x,N,R,_,A,y,M,h]),{isMounted:w,styles:C}}function Wv(t,o,a){return a===void 0&&(a=!0),t.filter(s=>{var c;return s.parentId===o&&(!a||((c=s.context)==null?void 0:c.open))}).flatMap(s=>[s,...Wv(t,s.id,a)])}function E0(t,o){const[a,r]=t;let s=!1;const c=o.length;for(let f=0,d=c-1;f<c;d=f++){const[p,h]=o[f]||[0,0],[v,y]=o[d]||[0,0];h>=r!=y>=r&&a<=(v-p)*(r-h)/(y-h)+p&&(s=!s)}return s}function R5(t,o){return t[0]>=o.x&&t[0]<=o.x+o.width&&t[1]>=o.y&&t[1]<=o.y+o.height}function j5(t){t===void 0&&(t={});const{buffer:o=.5,blockPointerEvents:a=!1,requireIntent:r=!0}=t,s={current:-1};let c=!1,f=null,d=null,p=typeof performance<"u"?performance.now():0;function h(y,x){const C=performance.now(),T=C-p;if(f===null||d===null||T===0)return f=y,d=x,p=C,null;const w=y-f,M=x-d,_=Math.sqrt(w*w+M*M)/T;return f=y,d=x,p=C,_}const v=y=>{let{x,y:C,placement:T,elements:w,onClose:M,nodeId:R,tree:_}=y;return function(A){function H(){Vt(s),M()}if(Vt(s),!w.domReference||!w.floating||T==null||x==null||C==null)return;const{clientX:L,clientY:Z}=A,I=[L,Z],J=y5(A),P=A.type==="mouseleave",ee=ld(w.floating,J),oe=ld(w.domReference,J),te=w.domReference.getBoundingClientRect(),B=w.floating.getBoundingClientRect(),ne=T.split("-")[0],D=x>B.right-B.width/2,U=C>B.bottom-B.height/2,V=R5(I,te),K=B.width>te.width,W=B.height>te.height,de=(K?te:B).left,le=(K?te:B).right,ae=(W?te:B).top,ye=(W?te:B).bottom;if(ee&&(c=!0,!P))return;if(oe&&(c=!1),oe&&!P){c=!0;return}if(P&&Ye(A.relatedTarget)&&ld(w.floating,A.relatedTarget)||_&&Wv(_.nodesRef.current,R).length)return;if(ne==="top"&&C>=te.bottom-1||ne==="bottom"&&C<=te.top+1||ne==="left"&&x>=te.right-1||ne==="right"&&x<=te.left+1)return H();let ge=[];switch(ne){case"top":ge=[[de,te.top+1],[de,B.bottom-1],[le,B.bottom-1],[le,te.top+1]];break;case"bottom":ge=[[de,B.top+1],[de,te.bottom-1],[le,te.bottom-1],[le,B.top+1]];break;case"left":ge=[[B.right-1,ye],[B.right-1,ae],[te.left+1,ae],[te.left+1,ye]];break;case"right":ge=[[te.right-1,ye],[te.right-1,ae],[B.left+1,ae],[B.left+1,ye]];break}function Ne(Pe){let[Ee,ve]=Pe;switch(ne){case"top":{const We=[K?Ee+o/2:D?Ee+o*4:Ee-o*4,ve+o+1],rt=[K?Ee-o/2:D?Ee+o*4:Ee-o*4,ve+o+1],et=[[B.left,D||K?B.bottom-o:B.top],[B.right,D?K?B.bottom-o:B.top:B.bottom-o]];return[We,rt,...et]}case"bottom":{const We=[K?Ee+o/2:D?Ee+o*4:Ee-o*4,ve-o],rt=[K?Ee-o/2:D?Ee+o*4:Ee-o*4,ve-o],et=[[B.left,D||K?B.top+o:B.bottom],[B.right,D?K?B.top+o:B.bottom:B.top+o]];return[We,rt,...et]}case"left":{const We=[Ee+o+1,W?ve+o/2:U?ve+o*4:ve-o*4],rt=[Ee+o+1,W?ve-o/2:U?ve+o*4:ve-o*4];return[...[[U||W?B.right-o:B.left,B.top],[U?W?B.right-o:B.left:B.right-o,B.bottom]],We,rt]}case"right":{const We=[Ee-o,W?ve+o/2:U?ve+o*4:ve-o*4],rt=[Ee-o,W?ve-o/2:U?ve+o*4:ve-o*4],et=[[U||W?B.left+o:B.right,B.top],[U?W?B.left+o:B.right:B.left+o,B.bottom]];return[We,rt,...et]}}}if(!E0([L,Z],ge)){if(c&&!V)return H();if(!P&&r){const Pe=h(A.clientX,A.clientY);if(Pe!==null&&Pe<.1)return H()}E0([L,Z],Ne([x,C]))?!c&&r&&(s.current=window.setTimeout(H,40)):H()}}};return v.__options={blockPointerEvents:a},v}function _5(t,o=a=>a){return qS.useSyncExternalStoreWithSelector(t.subscribe,()=>t.state,()=>t.state,o,O5)}function O5(t,o){if(Object.is(t,o))return!0;if(typeof t!="object"||t===null||typeof o!="object"||o===null)return!1;if(t instanceof Map&&o instanceof Map){if(t.size!==o.size)return!1;for(const[r,s]of t)if(!o.has(r)||!Object.is(s,o.get(r)))return!1;return!0}if(t instanceof Set&&o instanceof Set){if(t.size!==o.size)return!1;for(const r of t)if(!o.has(r))return!1;return!0}if(t instanceof Date&&o instanceof Date)return t.getTime()===o.getTime();const a=M0(t);if(a.length!==M0(o).length)return!1;for(let r=0;r<a.length;r++)if(!Object.prototype.hasOwnProperty.call(o,a[r])||!Object.is(t[a[r]],o[a[r]]))return!1;return!0}function M0(t){return Object.keys(t).concat(Object.getOwnPropertySymbols(t))}var N5=Cv(),A5=(...t)=>o=>{t.forEach(a=>{typeof a=="function"?a(o):a&&(a.current=o)})},D5=({contentComponent:t})=>{const o=N5.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return g.jsx(g.Fragment,{children:Object.values(o)})};function H5(){const t=new Set;let o={};return{subscribe(a){return t.add(a),()=>{t.delete(a)}},getSnapshot(){return o},getServerSnapshot(){return o},setRenderer(a,r){o={...o,[a]:wv.createPortal(r.reactElement,r.element,a)},t.forEach(s=>s())},removeRenderer(a){const r={...o};delete r[a],o=r,t.forEach(s=>s())}}}var z5=class extends Ve.Component{constructor(t){var o;super(t),this.editorContentRef=Ve.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((o=t.editor)!=null&&o.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var t;const o=this.props.editor;if(o&&!o.isDestroyed&&((t=o.view.dom)!=null&&t.parentNode)){if(o.contentComponent)return;const a=this.editorContentRef.current;a.append(...o.view.dom.parentNode.childNodes),o.setOptions({element:a}),o.contentComponent=H5(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=o.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),o.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var t;const o=this.props.editor;if(o){this.initialized=!1,o.isDestroyed||o.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),o.contentComponent=null;try{if(!((t=o.view.dom)!=null&&t.parentNode))return;const a=document.createElement("div");a.append(...o.view.dom.parentNode.childNodes),o.setOptions({element:a})}catch{}}}render(){const{editor:t,innerRef:o,...a}=this.props;return g.jsxs(g.Fragment,{children:[g.jsx("div",{ref:A5(o,this.editorContentRef),...a}),t?.contentComponent&&g.jsx(D5,{contentComponent:t.contentComponent})]})}},L5=S.forwardRef((t,o)=>{const a=Ve.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return Ve.createElement(z5,{key:a,innerRef:o,...t})}),V5=Ve.memo(L5),ey=S.createContext({editor:null});ey.Consumer;var ty=S.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),Pd=()=>S.useContext(ty),ny=Ve.forwardRef((t,o)=>{const{onDragStart:a}=Pd(),r=t.as||"div";return g.jsx(r,{...t,ref:o,"data-node-view-wrapper":"",onDragStart:a,style:{whiteSpace:"normal",...t.style}})});function R0(t){return!!(typeof t=="function"&&t.prototype&&t.prototype.isReactComponent)}function j0(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.forward_ref)"||t.$$typeof.description==="react.forward_ref"))}function k5(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.memo)"||t.$$typeof.description==="react.memo"))}function B5(t){if(R0(t)||j0(t))return!0;if(k5(t)){const o=t.type;if(o)return R0(o)||j0(o)}return!1}function U5(){try{if(S.version)return parseInt(S.version.split(".")[0],10)>=19}catch{}return!1}var $5=class{constructor(t,{editor:o,props:a={},as:r="div",className:s=""}){this.ref=null,this.destroyed=!1,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=t,this.editor=o,this.props=a,this.element=document.createElement(r),this.element.classList.add("react-renderer"),s&&this.element.classList.add(...s.split(" ")),this.editor.isInitialized?Zn.flushSync(()=>{this.render()}):queueMicrotask(()=>{this.destroyed||this.render()})}render(){var t;if(this.destroyed)return;const o=this.component,a=this.props,r=this.editor,s=U5(),c=B5(o),f={...a};f.ref&&!(s||c)&&delete f.ref,!f.ref&&(s||c)&&(f.ref=d=>{this.ref=d}),this.reactElement=g.jsx(o,{...f}),(t=r?.contentComponent)==null||t.setRenderer(this.id,this)}updateProps(t={}){this.destroyed||(this.props={...this.props,...t},this.render())}destroy(){var t;this.destroyed=!0;const o=this.editor;(t=o?.contentComponent)==null||t.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(t){Object.keys(t).forEach(o=>{this.element.setAttribute(o,t[o])})}};Ve.createContext({markViewContentRef:()=>{}});var G5=class extends dS{constructor(t,o,a){if(super(t,o,a),this.selectionRafId=null,this.cachedExtensionWithSyncedStorage=null,!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const r=this.dom.querySelector("[data-node-view-content]");if(!r)return;r.appendChild(this.contentDOMElement)}}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){const t=this.editor,o=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(o,{get(a,r,s){var c;return r==="storage"?(c=t.storage[o.name])!=null?c:{}:Reflect.get(a,r,s)}})}return this.cachedExtensionWithSyncedStorage}mount(){const t={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extensionWithSyncedStorage,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(p={})=>this.updateAttributes(p),deleteNode:()=>this.deleteNode(),ref:S.createRef()};if(!this.component.displayName){const p=h=>h.charAt(0).toUpperCase()+h.substring(1);this.component.displayName=p(this.extension.name)}const r={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:p=>{p&&this.contentDOMElement&&p.firstChild!==this.contentDOMElement&&(p.hasAttribute("data-node-view-wrapper")&&p.removeAttribute("data-node-view-wrapper"),p.appendChild(this.contentDOMElement))}},s=this.component,c=S.memo(p=>g.jsx(ty.Provider,{value:r,children:S.createElement(s,p)}));c.displayName="ReactNodeView";let f=this.node.isInline?"span":"div";this.options.as&&(f=this.options.as);const{className:d=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new $5(c,{editor:this.editor,props:t,as:f,className:`node-${this.node.type.name} ${d}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes()}get dom(){var t;if(this.renderer.element.firstElementChild&&!((t=this.renderer.element.firstElementChild)!=null&&t.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null),this.selectionRafId=requestAnimationFrame(()=>{this.selectionRafId=null;const{from:t,to:o}=this.editor.state.selection,a=this.getPos();if(typeof a=="number")if(t<=a&&o>=a+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}})}update(t,o,a){const r=s=>{this.renderer.updateProps(s),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(t.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const s=this.node,c=this.decorations,f=this.innerDecorations;return this.node=t,this.decorations=o,this.innerDecorations=a,this.options.update({oldNode:s,oldDecorations:c,newNode:t,newDecorations:o,oldInnerDecorations:f,innerDecorations:a,updateProps:()=>r({node:t,decorations:o,innerDecorations:a,extension:this.extensionWithSyncedStorage})})}return t===this.node&&this.decorations===o&&this.innerDecorations===a||(this.node=t,this.decorations=o,this.innerDecorations=a,r({node:t,decorations:o,innerDecorations:a,extension:this.extensionWithSyncedStorage})),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.contentDOMElement=null,this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null)}updateElementAttributes(){if(this.options.attrs){let t={};if(typeof this.options.attrs=="function"){const o=this.editor.extensionManager.attributes,a=mS(this.node,o);t=this.options.attrs({node:this.node,HTMLAttributes:a})}else t=this.options.attrs;this.renderer.updateAttributes(t)}}};function oy(t,o){return a=>a.editor.contentComponent?new G5(t,a,o):{}}var Qd=S.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});Qd.displayName="TiptapContext";var Z5=()=>S.useContext(Qd);function ly({editor:t,instance:o,children:a}){const r=t??o;if(!r)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const s=S.useMemo(()=>({editor:r}),[r]),c=S.useMemo(()=>({editor:r}),[r]);return g.jsx(ey.Provider,{value:c,children:g.jsx(Qd.Provider,{value:s,children:a})})}ly.displayName="Tiptap";function ay({...t}){const{editor:o}=Z5();return g.jsx(V5,{editor:o,...t})}ay.displayName="Tiptap.Content";Object.assign(ly,{Content:ay});var q5=Object.defineProperty,Y5=(t,o,a)=>o in t?q5(t,o,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[o]=a,Er=(t,o,a)=>Y5(t,typeof o!="symbol"?o+"":o,a);const ry=S.createContext(void 0);function Mn(t){return S.useContext(ry)}const iy=S.createContext(void 0);function ue(){return S.useContext(iy)}function pe(t){const o=Mn();if(!(o!=null&&o.editor))throw new Error("useBlockNoteEditor was called outside of a BlockNoteContext provider or BlockNoteView component");return o.editor}function Se(){return Mn().editor.dictionary}const X5=t=>{const o=ue(),a=Se(),r=pe(),s=r.getBlock(t.blockId),[c,f]=S.useState(""),d=S.useCallback(v=>{f(v.currentTarget.value)},[]),p=S.useCallback(v=>{v.key==="Enter"&&!v.nativeEvent.isComposing&&(v.preventDefault(),r.updateBlock(s.id,{props:{name:zg(c),url:c}}))},[r,s.id,c]),h=S.useCallback(()=>{r.updateBlock(s.id,{props:{name:zg(c),url:c}})},[r,s.id,c]);return g.jsxs(o.FilePanel.TabPanel,{className:"bn-tab-panel",children:[g.jsx(o.FilePanel.TextInput,{className:"bn-text-input",placeholder:a.file_panel.embed.url_placeholder,value:c,onChange:d,onKeyDown:p,"data-test":"embed-input"}),g.jsx(o.FilePanel.Button,{className:"bn-button",onClick:h,"data-test":"embed-input-button",children:a.file_panel.embed.embed_button[s.type]||a.file_panel.embed.embed_button.file})]})},P5=t=>{var o,a;const r=ue(),s=Se(),{setLoading:c}=t,f=pe(),d=f.getBlock(t.blockId),[p,h]=S.useState(!1);S.useEffect(()=>{p&&setTimeout(()=>{h(!1)},3e3)},[p]);const v=S.useCallback(C=>{if(C===null)return;async function T(w){if(c(!0),f.uploadFile!==void 0)try{let M=await f.uploadFile(w,t.blockId);typeof M=="string"&&(M={props:{name:w.name,url:M}}),f.updateBlock(t.blockId,M)}catch{h(!0)}finally{c(!1)}}T(C)},[t.blockId,f,c]),y=f.schema.blockSpecs[d.type],x=(a=(o=y.implementation.meta)==null?void 0:o.fileBlockAccept)!=null&&a.length?y.implementation.meta.fileBlockAccept.join(","):"*/*";return g.jsxs(r.FilePanel.TabPanel,{className:"bn-tab-panel",children:[g.jsx(r.FilePanel.FileInput,{className:"bn-file-input","data-test":"upload-input",accept:x,placeholder:s.file_panel.upload.file_placeholder[d.type]||s.file_panel.upload.file_placeholder.file,value:null,onChange:v}),p&&g.jsx("div",{className:"bn-error-text",children:s.file_panel.upload.upload_error})]})},sy=t=>{const o=ue(),a=Se(),r=pe(),[s,c]=S.useState(!1),f=t.tabs??[...r.uploadFile!==void 0?[{name:a.file_panel.upload.title,tabPanel:g.jsx(P5,{blockId:t.blockId,setLoading:c})}]:[],{name:a.file_panel.embed.title,tabPanel:g.jsx(X5,{blockId:t.blockId})}],[d,p]=S.useState(t.defaultOpenTab||f[0].name);return g.jsx(o.FilePanel.Root,{className:"bn-panel",defaultOpenTab:d,openTab:d,setOpenTab:p,tabs:f,loading:s})};function Q5(t){let o=new DOMRect;const a="getBoundingClientRect"in t?()=>t.getBoundingClientRect():()=>t.element.getBoundingClientRect();return()=>"element"in t&&(t.cacheMountedBoundingClientRect??!0)?(t.element.isConnected&&(o=a()),o):a()}const Bn=t=>{var o,a,r;const{refs:s,floatingStyles:c,context:f}=Ws({whileElementsMounted:js,...t.useFloatingOptions}),{isMounted:d,styles:p}=M5(f,t.useTransitionStylesProps),{status:h}=Jv(f,t.useTransitionStatusProps),v=Kv(f,t.useDismissProps),y=Qv(f,{enabled:!1,...t.useHoverProps}),{getFloatingProps:x}=Fv([v,y]),C=S.useRef(""),T=S.useRef(null),w=r5([T,s.setFloating]);if(S.useEffect(()=>{if(t.reference){const R="element"in t.reference?t.reference.element:void 0;R!==void 0&&s.setReference(R),s.setPositionReference({getBoundingClientRect:Q5(t.reference),contextElement:R})}},[t.reference,s]),S.useEffect(()=>{var R;(h==="initial"||h==="open")&&(R=T.current)!=null&&R.innerHTML&&(C.current=T.current.innerHTML)},[h,t.reference,t.children]),!d)return!1;const M={...t.elementProps,style:{display:"flex",...(o=t.elementProps)==null?void 0:o.style,zIndex:`calc(var(--bn-ui-base-z-index) + ${((r=(a=t.elementProps)==null?void 0:a.style)==null?void 0:r.zIndex)||0})`,...c,...p},...x()};return h==="close"?g.jsx("div",{ref:w,...M,dangerouslySetInnerHTML:{__html:C.current}}):g.jsx("div",{ref:w,...M,children:t.children})},cy=t=>{const{blockId:o,children:a,...r}=t,s=pe(),c=S.useMemo(()=>s.transact(f=>{if(!o)return;const d=gv(o,f.doc);if(!d)return;const{node:p}=s.prosemirrorView.domAtPos(d.posBeforeNode+1);if(p instanceof Element)return{element:p}}),[s,o]);return g.jsx(Bn,{reference:c,...r,children:o!==void 0&&a})};function Ae(t,o){const a=(o?.editor??pe()).getExtension(t);if(!a)throw new Error("Extension not found",{cause:{plugin:t}});return a}function qe(t,o){const{store:a}=Ae(t,o);if(!a)throw new Error("Store not found on plugin",{cause:{plugin:t}});return _5(a,o?.selector)}const I5=t=>{const o=pe(),a=Ae(Ed),r=qe(Ed),s=S.useMemo(()=>{var f,d;return{...t.floatingUIOptions,useFloatingOptions:{open:!!r,onOpenChange:(p,h,v)=>{p||a.closeMenu(),v==="escape-key"&&o.focus()},middleware:[mn(10),yo()],...(f=t.floatingUIOptions)==null?void 0:f.useFloatingOptions},elementProps:{style:{zIndex:90},...(d=t.floatingUIOptions)==null?void 0:d.elementProps}}},[r,o,a,t.floatingUIOptions]),c=t.filePanel||sy;return g.jsx(cy,{blockId:r,...s,children:r&&g.jsx(c,{blockId:r})})};function K5(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var F5=function t(o,a){if(o===a)return!0;if(o&&a&&typeof o=="object"&&typeof a=="object"){if(o.constructor!==a.constructor)return!1;var r,s,c;if(Array.isArray(o)){if(r=o.length,r!=a.length)return!1;for(s=r;s--!==0;)if(!t(o[s],a[s]))return!1;return!0}if(o instanceof Map&&a instanceof Map){if(o.size!==a.size)return!1;for(s of o.entries())if(!a.has(s[0]))return!1;for(s of o.entries())if(!t(s[1],a.get(s[0])))return!1;return!0}if(o instanceof Set&&a instanceof Set){if(o.size!==a.size)return!1;for(s of o.entries())if(!a.has(s[0]))return!1;return!0}if(ArrayBuffer.isView(o)&&ArrayBuffer.isView(a)){if(r=o.length,r!=a.length)return!1;for(s=r;s--!==0;)if(o[s]!==a[s])return!1;return!0}if(o.constructor===RegExp)return o.source===a.source&&o.flags===a.flags;if(o.valueOf!==Object.prototype.valueOf)return o.valueOf()===a.valueOf();if(o.toString!==Object.prototype.toString)return o.toString()===a.toString();if(c=Object.keys(o),r=c.length,r!==Object.keys(a).length)return!1;for(s=r;s--!==0;)if(!Object.prototype.hasOwnProperty.call(a,c[s]))return!1;for(s=r;s--!==0;){var f=c[s];if(!(f==="_owner"&&o.$$typeof)&&!t(o[f],a[f]))return!1}return!0}return o!==o&&a!==a};const J5=K5(F5);var uy={exports:{}},id={},_0={exports:{}},sd={};var O0;function W5(){if(O0)return sd;O0=1;var t=Ve;function o(y,x){return y===x&&(y!==0||1/y===1/x)||y!==y&&x!==x}var a=typeof Object.is=="function"?Object.is:o,r=t.useState,s=t.useEffect,c=t.useLayoutEffect,f=t.useDebugValue;function d(y,x){var C=x(),T=r({inst:{value:C,getSnapshot:x}}),w=T[0].inst,M=T[1];return c(function(){w.value=C,w.getSnapshot=x,p(w)&&M({inst:w})},[y,C,x]),s(function(){return p(w)&&M({inst:w}),y(function(){p(w)&&M({inst:w})})},[y]),f(C),C}function p(y){var x=y.getSnapshot;y=y.value;try{var C=x();return!a(y,C)}catch{return!0}}function h(y,x){return x()}var v=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:d;return sd.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:v,sd}var N0;function e3(){return N0||(N0=1,_0.exports=W5()),_0.exports}var A0;function t3(){if(A0)return id;A0=1;var t=Ve,o=e3();function a(h,v){return h===v&&(h!==0||1/h===1/v)||h!==h&&v!==v}var r=typeof Object.is=="function"?Object.is:a,s=o.useSyncExternalStore,c=t.useRef,f=t.useEffect,d=t.useMemo,p=t.useDebugValue;return id.useSyncExternalStoreWithSelector=function(h,v,y,x,C){var T=c(null);if(T.current===null){var w={hasValue:!1,value:null};T.current=w}else w=T.current;T=d(function(){function R(L){if(!_){if(_=!0,N=L,L=x(L),C!==void 0&&w.hasValue){var Z=w.value;if(C(Z,L))return A=Z}return A=L}if(Z=A,r(N,L))return Z;var I=x(L);return C!==void 0&&C(Z,I)?(N=L,Z):(N=L,A=I)}var _=!1,N,A,H=y===void 0?null:y;return[function(){return R(v())},H===null?void 0:function(){return R(H())}]},[v,y,x,C]);var M=s(h,T[0],T[1]);return f(function(){w.hasValue=!0,w.value=M},[M]),p(M),M},id}uy.exports=t3();var n3=uy.exports;const o3=typeof window<"u"?S.useLayoutEffect:S.useEffect;class l3{constructor(o){Er(this,"transactionNumber",0),Er(this,"lastTransactionNumber",0),Er(this,"lastSnapshot"),Er(this,"editor"),Er(this,"subscribers",new Set),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,a){if(this.editor=o,this.editor){const r=()=>{this.transactionNumber+=1,this.subscribers.forEach(f=>f())},s=this.editor._tiptapEditor,c={all:"transaction",selection:"selectionUpdate",change:"update"};return s.on(c[a],r),()=>{s.off(c[a],r)}}}}function gt(t){const o=Mn(),a=t.editor||o?.editor||null,r=t.on||"all",[s]=S.useState(()=>new l3(a)),c=n3.useSyncExternalStoreWithSelector(s.subscribe,s.getSnapshot,s.getServerSnapshot,t.selector,t.equalityFn??J5);return o3(()=>s.watch(a,r),[a,s,r]),S.useDebugValue(c),c}const Id=t=>{const{position:o,children:a,...r}=t,{from:s,to:c}=o||{},f=pe(),d=S.useMemo(()=>{var p;if(!(s===void 0||c===void 0))return{element:((p=f.domElement)==null?void 0:p.firstElementChild)||void 0,getBoundingClientRect:()=>vS(f.prosemirrorView,s,c??s)}},[f,s,c]);return g.jsx(Bn,{reference:d,...r,children:o!==void 0&&a})};var fy={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},D0=Ve.createContext&&Ve.createContext(fy),a3=["attr","size","title"];function r3(t,o){if(t==null)return{};var a=i3(t,o),r,s;if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(t);for(s=0;s<c.length;s++)r=c[s],!(o.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(a[r]=t[r])}return a}function i3(t,o){if(t==null)return{};var a={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(o.indexOf(r)>=0)continue;a[r]=t[r]}return a}function Ns(){return Ns=Object.assign?Object.assign.bind():function(t){for(var o=1;o<arguments.length;o++){var a=arguments[o];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(t[r]=a[r])}return t},Ns.apply(this,arguments)}function H0(t,o){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);o&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),a.push.apply(a,r)}return a}function As(t){for(var o=1;o<arguments.length;o++){var a=arguments[o]!=null?arguments[o]:{};o%2?H0(Object(a),!0).forEach(function(r){s3(t,r,a[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):H0(Object(a)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(a,r))})}return t}function s3(t,o,a){return o=c3(o),o in t?Object.defineProperty(t,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[o]=a,t}function c3(t){var o=u3(t,"string");return typeof o=="symbol"?o:o+""}function u3(t,o){if(typeof t!="object"||!t)return t;var a=t[Symbol.toPrimitive];if(a!==void 0){var r=a.call(t,o);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(o==="string"?String:Number)(t)}function dy(t){return t&&t.map((o,a)=>Ve.createElement(o.tag,As({key:a},o.attr),dy(o.child)))}function fe(t){return o=>Ve.createElement(f3,Ns({attr:As({},t.attr)},o),dy(t.child))}function f3(t){var o=a=>{var{attr:r,size:s,title:c}=t,f=r3(t,a3),d=s||a.size||"1em",p;return a.className&&(p=a.className),t.className&&(p=(p?p+" ":"")+t.className),Ve.createElement("svg",Ns({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},a.attr,r,f,{className:p,style:As(As({color:t.color||a.color},a.style),t.style),height:d,width:d,xmlns:"http://www.w3.org/2000/svg"}),c&&Ve.createElement("title",null,c),t.children)};return D0!==void 0?Ve.createElement(D0.Consumer,null,a=>o(a)):o(fy)}function d3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8 7V11L2 6L8 1V5H13C17.4183 5 21 8.58172 21 13C21 17.4183 17.4183 21 13 21H4V19H13C16.3137 19 19 16.3137 19 13C19 9.68629 16.3137 7 13 7H8Z"},child:[]}]})(t)}function my(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M7.29117 20.8242L2 22L3.17581 16.7088C2.42544 15.3056 2 13.7025 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C10.2975 22 8.6944 21.5746 7.29117 20.8242ZM7.58075 18.711L8.23428 19.0605C9.38248 19.6745 10.6655 20 12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 13.3345 4.32549 14.6175 4.93949 15.7657L5.28896 16.4192L4.63416 19.3658L7.58075 18.711Z"},child:[]}]})(t)}function m3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M7.24264 17.9967H3V13.754L14.435 2.319C14.8256 1.92848 15.4587 1.92848 15.8492 2.319L18.6777 5.14743C19.0682 5.53795 19.0682 6.17112 18.6777 6.56164L7.24264 17.9967ZM3 19.9967H21V21.9967H3V19.9967Z"},child:[]}]})(t)}function p3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M23 12L15.9289 19.0711L14.5147 17.6569L20.1716 12L14.5147 6.34317L15.9289 4.92896L23 12ZM3.82843 12L9.48528 17.6569L8.07107 19.0711L1 12L8.07107 4.92896L9.48528 6.34317L3.82843 12Z"},child:[]}]})(t)}function h3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 8L9.00319 2H19.9978C20.5513 2 21 2.45531 21 2.9918V21.0082C21 21.556 20.5551 22 20.0066 22H3.9934C3.44476 22 3 21.5501 3 20.9932V8ZM10 4V9H5V20H19V4H10Z"},child:[]}]})(t)}function g3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 4H21V6H3V4ZM5 19H19V21H5V19ZM3 14H21V16H3V14ZM5 9H19V11H5V9Z"},child:[]}]})(t)}function v3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 4H21V6H3V4ZM3 19H21V21H3V19ZM3 14H21V16H3V14ZM3 9H21V11H3V9Z"},child:[]}]})(t)}function y3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 4H21V6H3V4ZM3 19H17V21H3V19ZM3 14H21V16H3V14ZM3 9H17V11H3V9Z"},child:[]}]})(t)}function b3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 4H21V6H3V4ZM7 19H21V21H7V19ZM3 14H21V16H3V14ZM7 9H21V11H7V9Z"},child:[]}]})(t)}function x3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8 11H12.5C13.8807 11 15 9.88071 15 8.5C15 7.11929 13.8807 6 12.5 6H8V11ZM18 15.5C18 17.9853 15.9853 20 13.5 20H6V4H12.5C14.9853 4 17 6.01472 17 8.5C17 9.70431 16.5269 10.7981 15.7564 11.6058C17.0979 12.3847 18 13.837 18 15.5ZM8 13V18H13.5C14.8807 18 16 16.8807 16 15.5C16 14.1193 14.8807 13 13.5 13H8Z"},child:[]}]})(t)}function S3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3.41436 5.99995L5.70726 3.70706L4.29304 2.29285L0.585938 5.99995L4.29304 9.70706L5.70726 8.29285L3.41436 5.99995ZM9.58594 5.99995L7.29304 3.70706L8.70726 2.29285L12.4144 5.99995L8.70726 9.70706L7.29304 8.29285L9.58594 5.99995ZM14.0002 2.99995H21.0002C21.5524 2.99995 22.0002 3.44767 22.0002 3.99995V20C22.0002 20.5522 21.5524 21 21.0002 21H3.00015C2.44787 21 2.00015 20.5522 2.00015 20V12H4.00015V19H20.0002V4.99995H14.0002V2.99995Z"},child:[]}]})(t)}function z0(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M5.55397 22H3.3999L10.9999 3H12.9999L20.5999 22H18.4458L16.0458 16H7.95397L5.55397 22ZM8.75397 14H15.2458L11.9999 5.88517L8.75397 14Z"},child:[]}]})(t)}function Ds(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M13 20H11V13H4V20H2V4H4V11H11V4H13V20ZM21.0005 8V20H19.0005L19 10.204L17 10.74V8.67L19.5005 8H21.0005Z"},child:[]}]})(t)}function Hs(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M4 4V11H11V4H13V20H11V13H4V20H2V4H4ZM18.5 8C20.5711 8 22.25 9.67893 22.25 11.75C22.25 12.6074 21.9623 13.3976 21.4781 14.0292L21.3302 14.2102L18.0343 18H22V20H15L14.9993 18.444L19.8207 12.8981C20.0881 12.5908 20.25 12.1893 20.25 11.75C20.25 10.7835 19.4665 10 18.5 10C17.5818 10 16.8288 10.7071 16.7558 11.6065L16.75 11.75H14.75C14.75 9.67893 16.4289 8 18.5 8Z"},child:[]}]})(t)}function zs(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M22 8L21.9984 10L19.4934 12.883C21.0823 13.3184 22.25 14.7728 22.25 16.5C22.25 18.5711 20.5711 20.25 18.5 20.25C16.674 20.25 15.1528 18.9449 14.8184 17.2166L16.7821 16.8352C16.9384 17.6413 17.6481 18.25 18.5 18.25C19.4665 18.25 20.25 17.4665 20.25 16.5C20.25 15.5335 19.4665 14.75 18.5 14.75C18.214 14.75 17.944 14.8186 17.7056 14.9403L16.3992 13.3932L19.3484 10H15V8H22ZM4 4V11H11V4H13V20H11V13H4V20H2V4H4Z"},child:[]}]})(t)}function py(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M13 20H11V13H4V20H2V4H4V11H11V4H13V20ZM22 8V16H23.5V18H22V20H20V18H14.5V16.66L19.5 8H22ZM20 11.133L17.19 16H20V11.133Z"},child:[]}]})(t)}function hy(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M22 8V10H17.6769L17.2126 12.6358C17.5435 12.5472 17.8912 12.5 18.25 12.5C20.4591 12.5 22.25 14.2909 22.25 16.5C22.25 18.7091 20.4591 20.5 18.25 20.5C16.4233 20.5 14.8827 19.2756 14.4039 17.6027L16.3271 17.0519C16.5667 17.8881 17.3369 18.5 18.25 18.5C19.3546 18.5 20.25 17.6046 20.25 16.5C20.25 15.3954 19.3546 14.5 18.25 14.5C17.6194 14.5 17.057 14.7918 16.6904 15.2478L14.8803 14.3439L16 8H22ZM4 4V11H11V4H13V20H11V13H4V20H2V4H4Z"},child:[]}]})(t)}function gy(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M21.097 8L18.499 12.5C20.7091 12.5 22.5 14.2909 22.5 16.5C22.5 18.7091 20.7091 20.5 18.5 20.5C16.2909 20.5 14.5 18.7091 14.5 16.5C14.5 15.7636 14.699 15.0737 15.0461 14.4811L18.788 8H21.097ZM4 4V11H11V4H13V20H11V13H4V20H2V4H4ZM18.5 14.5C17.3954 14.5 16.5 15.3954 16.5 16.5C16.5 17.6046 17.3954 18.5 18.5 18.5C19.6046 18.5 20.5 17.6046 20.5 16.5C20.5 15.3954 19.6046 14.5 18.5 14.5Z"},child:[]}]})(t)}function C3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 4H21V6H3V4ZM3 19H21V21H3V19ZM11 14H21V16H11V14ZM11 9H21V11H11V9ZM3 12.5L7 9V16L3 12.5Z"},child:[]}]})(t)}function w3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 4H21V6H3V4ZM3 19H21V21H3V19ZM11 14H21V16H11V14ZM11 9H21V11H11V9ZM7 12.5L3 16V9L7 12.5Z"},child:[]}]})(t)}function L0(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8 5H11V19H8V21H16V19H13V5H16V3H8V5ZM2 7C1.44772 7 1 7.44772 1 8V16C1 16.5523 1.44772 17 2 17H8V15H3V9H8V7H2ZM16 9H21V15H16V17H22C22.5523 17 23 16.5523 23 16V8C23 7.44772 22.5523 7 22 7H16V9Z"},child:[]}]})(t)}function T3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M15 20H7V18H9.92661L12.0425 6H9V4H17V6H14.0734L11.9575 18H15V20Z"},child:[]}]})(t)}function E3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M17 17H22V19H19V22H17V17ZM7 7H2V5H5V2H7V7ZM18.364 15.5355L16.9497 14.1213L18.364 12.7071C20.3166 10.7545 20.3166 7.58866 18.364 5.63604C16.4113 3.68342 13.2455 3.68342 11.2929 5.63604L9.87868 7.05025L8.46447 5.63604L9.87868 4.22183C12.6123 1.48816 17.0445 1.48816 19.7782 4.22183C22.5118 6.9555 22.5118 11.3877 19.7782 14.1213L18.364 15.5355ZM15.5355 18.364L14.1213 19.7782C11.3877 22.5118 6.9555 22.5118 4.22183 19.7782C1.48816 17.0445 1.48816 12.6123 4.22183 9.87868L5.63604 8.46447L7.05025 9.87868L5.63604 11.2929C3.68342 13.2455 3.68342 16.4113 5.63604 18.364C7.58866 20.3166 10.7545 20.3166 12.7071 18.364L14.1213 16.9497L15.5355 18.364ZM14.8284 7.75736L16.2426 9.17157L9.17157 16.2426L7.75736 14.8284L14.8284 7.75736Z"},child:[]}]})(t)}function vy(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M18.3638 15.5355L16.9496 14.1213L18.3638 12.7071C20.3164 10.7545 20.3164 7.58866 18.3638 5.63604C16.4112 3.68341 13.2453 3.68341 11.2927 5.63604L9.87849 7.05025L8.46428 5.63604L9.87849 4.22182C12.6122 1.48815 17.0443 1.48815 19.778 4.22182C22.5117 6.95549 22.5117 11.3876 19.778 14.1213L18.3638 15.5355ZM15.5353 18.364L14.1211 19.7782C11.3875 22.5118 6.95531 22.5118 4.22164 19.7782C1.48797 17.0445 1.48797 12.6123 4.22164 9.87868L5.63585 8.46446L7.05007 9.87868L5.63585 11.2929C3.68323 13.2455 3.68323 16.4113 5.63585 18.364C7.58847 20.3166 10.7543 20.3166 12.7069 18.364L14.1211 16.9497L15.5353 18.364ZM14.8282 7.75736L16.2425 9.17157L9.17139 16.2426L7.75717 14.8284L14.8282 7.75736Z"},child:[]}]})(t)}function yy(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8.00008 6V9H5.00008V6H8.00008ZM3.00008 4V11H10.0001V4H3.00008ZM13.0001 4H21.0001V6H13.0001V4ZM13.0001 11H21.0001V13H13.0001V11ZM13.0001 18H21.0001V20H13.0001V18ZM10.7072 16.2071L9.29297 14.7929L6.00008 18.0858L4.20718 16.2929L2.79297 17.7071L6.00008 20.9142L10.7072 16.2071Z"},child:[]}]})(t)}function by(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8 4H21V6H8V4ZM5 3V6H6V7H3V6H4V4H3V3H5ZM3 14V11.5H5V11H3V10H6V12.5H4V13H6V14H3ZM5 19.5H3V18.5H5V18H3V17H6V21H3V20H5V19.5ZM8 11H21V13H8V11ZM8 18H21V20H8V18Z"},child:[]}]})(t)}function xy(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8 4H21V6H8V4ZM4.5 6.5C3.67157 6.5 3 5.82843 3 5C3 4.17157 3.67157 3.5 4.5 3.5C5.32843 3.5 6 4.17157 6 5C6 5.82843 5.32843 6.5 4.5 6.5ZM4.5 13.5C3.67157 13.5 3 12.8284 3 12C3 11.1716 3.67157 10.5 4.5 10.5C5.32843 10.5 6 11.1716 6 12C6 12.8284 5.32843 13.5 4.5 13.5ZM4.5 20.4C3.67157 20.4 3 19.7284 3 18.9C3 18.0716 3.67157 17.4 4.5 17.4C5.32843 17.4 6 18.0716 6 18.9C6 19.7284 5.32843 20.4 4.5 20.4ZM8 11H21V13H8V11ZM8 18H21V20H8V18Z"},child:[]}]})(t)}function M3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M20 3C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3H20ZM11 5H5V10.999H7V9L10 12L7 15V13H5V19H11V17H13V19H19V13H17V15L14 12L17 9V10.999H19V5H13V7H11V5ZM13 13V15H11V13H13ZM13 9V11H11V9H13Z"},child:[]}]})(t)}function R3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M21 20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3H20C20.5523 3 21 3.44772 21 4V20ZM19 11V5H13.001V7H15L12 10L9 7H11V5H5V11H7V13H5V19H11V17H9L12 14L15 17H13.001V19H19V13H17V11H19ZM11 13H9V11H11V13ZM15 13H13V11H15V13Z"},child:[]}]})(t)}function Sy(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M21 4H3V6H21V4ZM21 11H8V13H21V11ZM21 18H8V20H21V18ZM5 11H3V20H5V11Z"},child:[]}]})(t)}function j3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M17.1538 14C17.3846 14.5161 17.5 15.0893 17.5 15.7196C17.5 17.0625 16.9762 18.1116 15.9286 18.867C14.8809 19.6223 13.4335 20 11.5862 20C9.94674 20 8.32335 19.6185 6.71592 18.8555V16.6009C8.23538 17.4783 9.7908 17.917 11.3822 17.917C13.9333 17.917 15.2128 17.1846 15.2208 15.7196C15.2208 15.0939 15.0049 14.5598 14.5731 14.1173C14.5339 14.0772 14.4939 14.0381 14.4531 14H3V12H21V14H17.1538ZM13.076 11H7.62908C7.4566 10.8433 7.29616 10.6692 7.14776 10.4778C6.71592 9.92084 6.5 9.24559 6.5 8.45207C6.5 7.21602 6.96583 6.165 7.89749 5.299C8.82916 4.43299 10.2706 4 12.2219 4C13.6934 4 15.1009 4.32808 16.4444 4.98426V7.13591C15.2448 6.44921 13.9293 6.10587 12.4978 6.10587C10.0187 6.10587 8.77917 6.88793 8.77917 8.45207C8.77917 8.87172 8.99709 9.23796 9.43293 9.55079C9.86878 9.86362 10.4066 10.1135 11.0463 10.3004C11.6665 10.4816 12.3431 10.7148 13.076 11H13.076Z"},child:[]}]})(t)}function _3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M13 10V14H19V10H13ZM11 10H5V14H11V10ZM13 19H19V16H13V19ZM11 19V16H5V19H11ZM13 5V8H19V5H13ZM11 5H5V8H11V5ZM4 3H20C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3Z"},child:[]}]})(t)}function Kd(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M13 6V21H11V6H5V4H19V6H13Z"},child:[]}]})(t)}function O3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8 3V12C8 14.2091 9.79086 16 12 16C14.2091 16 16 14.2091 16 12V3H18V12C18 15.3137 15.3137 18 12 18C8.68629 18 6 15.3137 6 12V3H8ZM4 20H20V22H4V20Z"},child:[]}]})(t)}function N3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M2 3.9934C2 3.44476 2.45531 3 2.9918 3H21.0082C21.556 3 22 3.44495 22 3.9934V20.0066C22 20.5552 21.5447 21 21.0082 21H2.9918C2.44405 21 2 20.5551 2 20.0066V3.9934ZM8 5V19H16V5H8ZM4 5V7H6V5H4ZM18 5V7H20V5H18ZM4 9V11H6V9H4ZM18 9V11H20V9H18ZM4 13V15H6V13H4ZM18 13V15H20V13H18ZM4 17V19H6V17H4ZM18 17V19H20V17H18Z"},child:[]}]})(t)}function A3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M5 11.1005L7 9.1005L12.5 14.6005L16 11.1005L19 14.1005V5H5V11.1005ZM4 3H20C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3ZM15.5 10C14.6716 10 14 9.32843 14 8.5C14 7.67157 14.6716 7 15.5 7C16.3284 7 17 7.67157 17 8.5C17 9.32843 16.3284 10 15.5 10Z"},child:[]}]})(t)}function D3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M21 15V18H24V20H21V23H19V20H16V18H19V15H21ZM21.0082 3C21.556 3 22 3.44495 22 3.9934L22.0007 13.3417C21.3749 13.1204 20.7015 13 20 13V5H4L4.001 19L13.2929 9.70715C13.6528 9.34604 14.22 9.31823 14.6123 9.62322L14.7065 9.70772L18.2521 13.2586C15.791 14.0069 14 16.2943 14 19C14 19.7015 14.1204 20.3749 14.3417 21.0007L2.9918 21C2.44405 21 2 20.5551 2 20.0066V3.9934C2 3.44476 2.45531 3 2.9918 3H21.0082ZM8 7C9.10457 7 10 7.89543 10 9C10 10.1046 9.10457 11 8 11C6.89543 11 6 10.1046 6 9C6 7.89543 6.89543 7 8 7Z"},child:[]}]})(t)}function H3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M20 3C20.5523 3 21 3.44772 21 4V5.757L19 7.757V5H5V13.1L9 9.1005L13.328 13.429L12.0012 14.7562L11.995 18.995L16.2414 19.0012L17.571 17.671L18.8995 19H19V16.242L21 14.242V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3H20ZM21.7782 7.80761L23.1924 9.22183L15.4142 17L13.9979 16.9979L14 15.5858L21.7782 7.80761ZM15.5 7C16.3284 7 17 7.67157 17 8.5C17 9.32843 16.3284 10 15.5 10C14.6716 10 14 9.32843 14 8.5C14 7.67157 14.6716 7 15.5 7Z"},child:[]}]})(t)}function Cy(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M22 18V20H2V18H22ZM2 3.5L10 8.5L2 13.5V3.5ZM22 11V13H12V11H22ZM22 4V6H12V4H22Z"},child:[]}]})(t)}function z3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M2 16.0001H5.88889L11.1834 20.3319C11.2727 20.405 11.3846 20.4449 11.5 20.4449C11.7761 20.4449 12 20.2211 12 19.9449V4.05519C12 3.93977 11.9601 3.8279 11.887 3.73857C11.7121 3.52485 11.3971 3.49335 11.1834 3.66821L5.88889 8.00007H2C1.44772 8.00007 1 8.44778 1 9.00007V15.0001C1 15.5524 1.44772 16.0001 2 16.0001ZM23 12C23 15.292 21.5539 18.2463 19.2622 20.2622L17.8445 18.8444C19.7758 17.1937 21 14.7398 21 12C21 9.26016 19.7758 6.80629 17.8445 5.15557L19.2622 3.73779C21.5539 5.75368 23 8.70795 23 12ZM18 12C18 10.0883 17.106 8.38548 15.7133 7.28673L14.2842 8.71584C15.3213 9.43855 16 10.64 16 12C16 13.36 15.3213 14.5614 14.2842 15.2841L15.7133 16.7132C17.106 15.6145 18 13.9116 18 12Z"},child:[]}]})(t)}function L3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M11 11V5H13V11H19V13H13V19H11V13H5V11H11Z"},child:[]}]})(t)}function V3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M9.9997 15.1709L19.1921 5.97852L20.6063 7.39273L9.9997 17.9993L3.63574 11.6354L5.04996 10.2212L9.9997 15.1709Z"},child:[]}]})(t)}function k3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M17 6H22V8H20V21C20 21.5523 19.5523 22 19 22H5C4.44772 22 4 21.5523 4 21V8H2V6H7V3C7 2.44772 7.44772 2 8 2H16C16.5523 2 17 2.44772 17 3V6ZM18 8H6V20H18V8ZM9 4V6H15V4H9Z"},child:[]}]})(t)}function B3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M17 6H22V8H20V21C20 21.5523 19.5523 22 19 22H5C4.44772 22 4 21.5523 4 21V8H2V6H7V3C7 2.44772 7.44772 2 8 2H16C16.5523 2 17 2.44772 17 3V6ZM9 11V17H11V11H9ZM13 11V17H15V11H13ZM9 4V6H15V4H9Z"},child:[]}]})(t)}function U3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M4 19H20V12H22V20C22 20.5523 21.5523 21 21 21H3C2.44772 21 2 20.5523 2 20V12H4V19ZM14 9H19L12 16L5 9H10V3H14V9Z"},child:[]}]})(t)}function $3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M10 6V8H5V19H16V14H18V20C18 20.5523 17.5523 21 17 21H4C3.44772 21 3 20.5523 3 20V7C3 6.44772 3.44772 6 4 6H10ZM21 3V12L17.206 8.207L11.2071 14.2071L9.79289 12.7929L15.792 6.793L12 3H21Z"},child:[]}]})(t)}function G3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M5 10C3.9 10 3 10.9 3 12C3 13.1 3.9 14 5 14C6.1 14 7 13.1 7 12C7 10.9 6.1 10 5 10ZM19 10C17.9 10 17 10.9 17 12C17 13.1 17.9 14 19 14C20.1 14 21 13.1 21 12C21 10.9 20.1 10 19 10ZM12 10C10.9 10 10 10.9 10 12C10 13.1 10.9 14 12 14C13.1 14 14 13.1 14 12C14 10.9 13.1 10 12 10Z"},child:[]}]})(t)}function Z3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M5 11V13H19V11H5Z"},child:[]}]})(t)}function q3(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM8 13C8 15.2091 9.79086 17 12 17C14.2091 17 16 15.2091 16 13H8ZM8 11C8.82843 11 9.5 10.3284 9.5 9.5C9.5 8.67157 8.82843 8 8 8C7.17157 8 6.5 8.67157 6.5 9.5C6.5 10.3284 7.17157 11 8 11ZM16 11C16.8284 11 17.5 10.3284 17.5 9.5C17.5 8.67157 16.8284 8 16 8C15.1716 8 14.5 8.67157 14.5 9.5C14.5 10.3284 15.1716 11 16 11Z"},child:[]}]})(t)}function V0(t){return fe({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM8 13H16C16 15.2091 14.2091 17 12 17C9.79086 17 8 15.2091 8 13ZM8 11C7.17157 11 6.5 10.3284 6.5 9.5C6.5 8.67157 7.17157 8 8 8C8.82843 8 9.5 8.67157 9.5 9.5C9.5 10.3284 8.82843 11 8 11ZM16 11C15.1716 11 14.5 10.3284 14.5 9.5C14.5 8.67157 15.1716 8 16 8C16.8284 8 17.5 8.67157 17.5 9.5C17.5 10.3284 16.8284 11 16 11Z"},child:[]}]})(t)}const Y3={bold:x3,italic:T3,underline:O3,strike:j3,code:p3};function X3(t,o){return t in o.schema.styleSchema&&o.schema.styleSchema[t].type===t&&o.schema.styleSchema[t].propSchema==="boolean"}const ms=t=>{const o=Se(),a=ue(),r=pe(),s=gt({editor:r,selector:({editor:d})=>{var p;if(!(!d.isEditable||!X3(t.basicTextStyle,d)||!(((p=d.getSelection())==null?void 0:p.blocks)||[d.getTextCursorPosition().block]).find(h=>h.content!==void 0)))return t.basicTextStyle in d.getActiveStyles()?{active:!0}:{active:!1}}}),c=S.useCallback(d=>{r.focus(),r.toggleStyles({[d]:!0})},[r,t]);if(s===void 0)return null;const f=Y3[t.basicTextStyle];return g.jsx(a.FormattingToolbar.Button,{className:"bn-button","data-test":t.basicTextStyle,onClick:()=>c(t.basicTextStyle),isSelected:s.active,label:o.formatting_toolbar[t.basicTextStyle].tooltip,mainTooltip:o.formatting_toolbar[t.basicTextStyle].tooltip,secondaryTooltip:Ys(o.formatting_toolbar[t.basicTextStyle].secondary_tooltip,o.generic.ctrl_shortcut),icon:g.jsx(f,{})})},Ad=t=>{const o=t.textColor||"default",a=t.backgroundColor||"default",r=t.size||16,s=S.useMemo(()=>({pointerEvents:"none",fontSize:(r*.75).toString()+"px",height:r.toString()+"px",lineHeight:r.toString()+"px",textAlign:"center",width:r.toString()+"px"}),[r]);return g.jsx("div",{className:"bn-color-icon","data-background-color":a,"data-text-color":o,style:s,children:"A"})},k0=["default","gray","brown","red","orange","yellow","green","blue","purple","pink"],ec=t=>{const o=ue(),a=Se();return g.jsxs(g.Fragment,{children:[g.jsx(()=>t.text?g.jsxs(g.Fragment,{children:[g.jsx(o.Generic.Menu.Label,{children:a.color_picker.text_title}),k0.map(r=>g.jsx(o.Generic.Menu.Item,{onClick:()=>{t.onClick&&t.onClick(),t.text.setColor(r)},"data-test":"text-color-"+r,icon:g.jsx(Ad,{textColor:r,size:t.iconSize}),checked:t.text.color===r,children:a.color_picker.colors[r]},"text-color-"+r))]}):null,{}),g.jsx(()=>t.background?g.jsxs(g.Fragment,{children:[g.jsx(o.Generic.Menu.Label,{children:a.color_picker.background_title}),k0.map(r=>g.jsx(o.Generic.Menu.Item,{onClick:()=>{t.onClick&&t.onClick(),t.background.setColor(r)},"data-test":"background-color-"+r,icon:g.jsx(Ad,{backgroundColor:r,size:t.iconSize}),checked:t.background.color===r,children:a.color_picker.colors[r]},"background-color-"+r))]}):null,{})]})};function ps(t,o){return`${t}Color`in o.schema.styleSchema&&o.schema.styleSchema[`${t}Color`].type===`${t}Color`&&o.schema.styleSchema[`${t}Color`].propSchema==="string"}const P3=()=>{const t=ue(),o=Se(),a=pe(),r=ps("text",a),s=ps("background",a),c=gt({editor:a,selector:({editor:p})=>{var h;if(!p.isEditable||!(((h=p.getSelection())==null?void 0:h.blocks)||[p.getTextCursorPosition().block]).find(x=>x.content!==void 0))return;const v=ps("text",p),y=ps("background",p);if(!(!v&&!y))return{textColor:v?p.getActiveStyles().textColor||"default":void 0,backgroundColor:y?p.getActiveStyles().backgroundColor||"default":void 0}}}),f=S.useCallback(p=>{if(!r)throw Error("Tried to set text color, but style does not exist in editor schema.");p==="default"?a.removeStyles({textColor:p}):a.addStyles({textColor:p}),setTimeout(()=>{a.focus()})},[a,r]),d=S.useCallback(p=>{if(!s)throw Error("Tried to set background color, but style does not exist in editor schema.");p==="default"?a.removeStyles({backgroundColor:p}):a.addStyles({backgroundColor:p}),setTimeout(()=>{a.focus()})},[s,a]);return c===void 0?null:g.jsxs(t.Generic.Menu.Root,{children:[g.jsx(t.Generic.Menu.Trigger,{children:g.jsx(t.FormattingToolbar.Button,{className:"bn-button","data-test":"colors",label:o.formatting_toolbar.colors.tooltip,mainTooltip:o.formatting_toolbar.colors.tooltip,icon:g.jsx(Ad,{textColor:c.textColor,backgroundColor:c.backgroundColor,size:20})})}),g.jsx(t.Generic.Menu.Dropdown,{className:"bn-menu-dropdown bn-color-picker-dropdown",children:g.jsx(ec,{text:c.textColor?{color:c.textColor,setColor:f}:void 0,background:c.backgroundColor?{color:c.backgroundColor,setColor:d}:void 0})})]})},B0=t=>{for(const o of bS)if(t.startsWith(o))return t;return`${xS}://${t}`},wy=t=>{const o=ue(),a=Se(),{editLink:r}=Ae(Xs),{url:s,text:c,showTextField:f}=t,[d,p]=S.useState(s),[h,v]=S.useState(c);S.useEffect(()=>{p(s),v(c)},[c,s]);const y=S.useCallback(w=>{var M,R;w.key==="Enter"&&!w.nativeEvent.isComposing&&(w.preventDefault(),r(B0(d),h,t.range.from),(M=t.setToolbarOpen)==null||M.call(t,!1),(R=t.setToolbarPositionFrozen)==null||R.call(t,!1))},[r,d,h,t]),x=S.useCallback(w=>p(w.currentTarget.value),[]),C=S.useCallback(w=>v(w.currentTarget.value),[]),T=S.useCallback(()=>{var w,M;r(B0(d),h,t.range.from),(w=t.setToolbarOpen)==null||w.call(t,!1),(M=t.setToolbarPositionFrozen)==null||M.call(t,!1)},[r,d,h,t]);return g.jsxs(o.Generic.Form.Root,{children:[g.jsx(o.Generic.Form.TextInput,{className:"bn-text-input",name:"url",icon:g.jsx(vy,{}),autoFocus:!0,placeholder:a.link_toolbar.form.url_placeholder,value:d,onKeyDown:y,onChange:x,onSubmit:T}),f!==!1&&g.jsx(o.Generic.Form.TextInput,{className:"bn-text-input",name:"title",icon:g.jsx(Kd,{}),placeholder:a.link_toolbar.form.title_placeholder,value:h,onKeyDown:y,onChange:C,onSubmit:T})]})};function Q3(t){return"link"in t.schema.inlineContentSchema&&t.schema.inlineContentSchema.link==="link"}const I3=()=>{const t=pe(),o=ue(),a=Se(),r=Ae(Or),{showSelection:s}=Ae(Td),[c,f]=S.useState(!1);S.useEffect(()=>(s(c,"createLinkButton"),()=>s(!1,"createLinkButton")),[c,s]);const d=gt({editor:t,selector:({editor:p})=>{var h;if(!(!p.isEditable||!Q3(p)||yS(p.prosemirrorState.selection)||!(((h=p.getSelection())==null?void 0:h.blocks)||[p.getTextCursorPosition().block]).find(v=>v.content!==void 0)))return{url:p.getSelectedLinkUrl(),text:p.getSelectedText(),range:{from:p.prosemirrorState.selection.from,to:p.prosemirrorState.selection.to}}}});return S.useEffect(()=>{f(!1)},[d]),S.useEffect(()=>{const p=v=>{(v.ctrlKey||v.metaKey)&&v.key==="k"&&(f(!0),v.preventDefault())},h=t.domElement;return h?.addEventListener("keydown",p),()=>{h?.removeEventListener("keydown",p)}},[t.domElement]),d===void 0?null:g.jsxs(o.Generic.Popover.Root,{open:c,onOpenChange:f,children:[g.jsx(o.Generic.Popover.Trigger,{children:g.jsx(o.FormattingToolbar.Button,{className:"bn-button","data-test":"createLink",label:a.formatting_toolbar.link.tooltip,mainTooltip:a.formatting_toolbar.link.tooltip,secondaryTooltip:Ys(a.formatting_toolbar.link.secondary_tooltip,a.generic.ctrl_shortcut),icon:g.jsx(vy,{}),onClick:()=>f(p=>!p)})}),g.jsx(o.Generic.Popover.Content,{className:"bn-popover-content bn-form-popover",variant:"form-popover",children:g.jsx(wy,{url:d.url||"",text:d.text,range:d.range,showTextField:!1,setToolbarOpen:p=>r.store.setState(p)})})]})},K3=()=>{const t=Se(),o=ue(),a=pe(),r=gt({editor:a,selector:({editor:p})=>{var h;if(!p.isEditable)return;const v=((h=p.getSelection())==null?void 0:h.blocks)||[p.getTextCursorPosition().block];if(v.length!==1)return;const y=v[0];if(kt(y,p,y.type,{url:"string",caption:"string"}))return y}}),[s,c]=S.useState();S.useEffect(()=>{r!==void 0&&c(r.props.caption)},[r]);const f=S.useCallback(p=>c(p.currentTarget.value),[]),d=S.useCallback(p=>{r!==void 0&&xl(a,r.type,{caption:"string"})&&p.key==="Enter"&&!p.nativeEvent.isComposing&&(p.preventDefault(),a.updateBlock(r.id,{props:{caption:s}}))},[r,s,a]);return r===void 0?null:g.jsxs(o.Generic.Popover.Root,{children:[g.jsx(o.Generic.Popover.Trigger,{children:g.jsx(o.FormattingToolbar.Button,{className:"bn-button",label:t.formatting_toolbar.file_caption.tooltip,mainTooltip:t.formatting_toolbar.file_caption.tooltip,icon:g.jsx(L0,{})})}),g.jsx(o.Generic.Popover.Content,{className:"bn-popover-content bn-form-popover",variant:"form-popover",children:g.jsx(o.Generic.Form.Root,{children:g.jsx(o.Generic.Form.TextInput,{name:"file-caption",icon:g.jsx(L0,{}),value:s||"",autoFocus:!0,placeholder:t.formatting_toolbar.file_caption.input_placeholder,onKeyDown:d,onChange:f})})})]})},F3=()=>{const t=Se(),o=ue(),a=pe(),r=gt({editor:a,selector:({editor:c})=>{var f;if(!c.isEditable)return;const d=((f=c.getSelection())==null?void 0:f.blocks)||[c.getTextCursorPosition().block];if(d.length!==1)return;const p=d[0];if(kt(p,c,p.type,{url:"string"}))return p}}),s=S.useCallback(()=>{r!==void 0&&(a.focus(),a.removeBlocks([r.id]))},[r,a]);return r===void 0?null:g.jsx(o.FormattingToolbar.Button,{className:"bn-button",label:t.formatting_toolbar.file_delete.tooltip[r.type]||t.formatting_toolbar.file_delete.tooltip.file,mainTooltip:t.formatting_toolbar.file_delete.tooltip[r.type]||t.formatting_toolbar.file_delete.tooltip.file,icon:g.jsx(k3,{}),onClick:s})},J3=()=>{const t=Se(),o=ue(),a=pe(),r=gt({editor:a,selector:({editor:p})=>{var h;if(!p.isEditable)return;const v=((h=p.getSelection())==null?void 0:h.blocks)||[p.getTextCursorPosition().block];if(v.length!==1)return;const y=v[0];if(kt(y,p,y.type,{url:"string",name:"string"}))return y}}),[s,c]=S.useState();S.useEffect(()=>{r!==void 0&&c(r.props.name)},[r]);const f=S.useCallback(p=>c(p.currentTarget.value),[]),d=S.useCallback(p=>{r!==void 0&&xl(a,r.type,{name:"string"})&&p.key==="Enter"&&!p.nativeEvent.isComposing&&(p.preventDefault(),a.updateBlock(r.id,{props:{name:s}}))},[r,s,a]);return r===void 0?null:g.jsxs(o.Generic.Popover.Root,{children:[g.jsx(o.Generic.Popover.Trigger,{children:g.jsx(o.FormattingToolbar.Button,{className:"bn-button",label:t.formatting_toolbar.file_rename.tooltip[r.type]||t.formatting_toolbar.file_rename.tooltip.file,mainTooltip:t.formatting_toolbar.file_rename.tooltip[r.type]||t.formatting_toolbar.file_rename.tooltip.file,icon:g.jsx(z0,{})})}),g.jsx(o.Generic.Popover.Content,{className:"bn-popover-content bn-form-popover",variant:"form-popover",children:g.jsx(o.Generic.Form.Root,{children:g.jsx(o.Generic.Form.TextInput,{name:"file-name",icon:g.jsx(z0,{}),value:s||"",autoFocus:!0,placeholder:t.formatting_toolbar.file_rename.input_placeholder[r.type]||t.formatting_toolbar.file_rename.input_placeholder.file,onKeyDown:d,onChange:f})})})]})},W3=()=>{const t=Se(),o=ue(),a=pe(),r=gt({editor:a,selector:({editor:s})=>{var c;if(!s.isEditable)return;const f=((c=s.getSelection())==null?void 0:c.blocks)||[s.getTextCursorPosition().block];if(f.length!==1)return;const d=f[0];if(kt(d,s,d.type,{url:"string"}))return d}});return r===void 0?null:g.jsxs(o.Generic.Popover.Root,{position:"bottom",children:[g.jsx(o.Generic.Popover.Trigger,{children:g.jsx(o.FormattingToolbar.Button,{className:"bn-button",mainTooltip:t.formatting_toolbar.file_replace.tooltip[r.type]||t.formatting_toolbar.file_replace.tooltip.file,label:t.formatting_toolbar.file_replace.tooltip[r.type]||t.formatting_toolbar.file_replace.tooltip.file,icon:g.jsx(H3,{})})}),g.jsx(o.Generic.Popover.Content,{className:"bn-popover-content bn-panel-popover",variant:"panel-popover",children:g.jsx(sy,{blockId:r.id})})]})},e8=()=>{const t=Se(),o=ue(),a=pe(),r=gt({editor:a,selector:({editor:c})=>{var f;if(!(!c.isEditable||!(((f=c.getSelection())==null?void 0:f.blocks)||[c.getTextCursorPosition().block]).find(d=>d.content!==void 0)))return{canNestBlock:c.canNestBlock()}}}),s=S.useCallback(()=>{r!==void 0&&r.canNestBlock&&(a.focus(),a.nestBlock())},[a,r]);return r===void 0?null:g.jsx(o.FormattingToolbar.Button,{className:"bn-button","data-test":"nestBlock",onClick:s,isDisabled:!r.canNestBlock,label:t.formatting_toolbar.nest.tooltip,mainTooltip:t.formatting_toolbar.nest.tooltip,secondaryTooltip:Ys(t.formatting_toolbar.nest.secondary_tooltip,t.generic.ctrl_shortcut),icon:g.jsx(w3,{})})},t8=()=>{const t=Se(),o=ue(),a=pe(),r=gt({editor:a,selector:({editor:c})=>{var f;if(!(!c.isEditable||!(((f=c.getSelection())==null?void 0:f.blocks)||[c.getTextCursorPosition().block]).find(d=>d.content!==void 0)))return{canUnnestBlock:c.canUnnestBlock()}}}),s=S.useCallback(()=>{r!==void 0&&r.canUnnestBlock&&(a.focus(),a.unnestBlock())},[a,r]);return r===void 0?null:g.jsx(o.FormattingToolbar.Button,{className:"bn-button","data-test":"unnestBlock",onClick:s,isDisabled:!r.canUnnestBlock,label:t.formatting_toolbar.unnest.tooltip,mainTooltip:t.formatting_toolbar.unnest.tooltip,secondaryTooltip:Ys(t.formatting_toolbar.unnest.secondary_tooltip,t.generic.ctrl_shortcut),icon:g.jsx(C3,{})})},n8=t=>[{name:t.slash_menu.paragraph.title,type:"paragraph",icon:Kd},{name:t.slash_menu.heading.title,type:"heading",props:{level:1,isToggleable:!1},icon:Ds},{name:t.slash_menu.heading_2.title,type:"heading",props:{level:2,isToggleable:!1},icon:Hs},{name:t.slash_menu.heading_3.title,type:"heading",props:{level:3,isToggleable:!1},icon:zs},{name:t.slash_menu.heading_4.title,type:"heading",props:{level:4,isToggleable:!1},icon:py},{name:t.slash_menu.heading_5.title,type:"heading",props:{level:5,isToggleable:!1},icon:hy},{name:t.slash_menu.heading_6.title,type:"heading",props:{level:6,isToggleable:!1},icon:gy},{name:t.slash_menu.toggle_heading.title,type:"heading",props:{level:1,isToggleable:!0},icon:Ds},{name:t.slash_menu.toggle_heading_2.title,type:"heading",props:{level:2,isToggleable:!0},icon:Hs},{name:t.slash_menu.toggle_heading_3.title,type:"heading",props:{level:3,isToggleable:!0},icon:zs},{name:t.slash_menu.quote.title,type:"quote",icon:Sy},{name:t.slash_menu.toggle_list.title,type:"toggleListItem",icon:Cy},{name:t.slash_menu.bullet_list.title,type:"bulletListItem",icon:xy},{name:t.slash_menu.numbered_list.title,type:"numberedListItem",icon:by},{name:t.slash_menu.check_list.title,type:"checkListItem",icon:yy}],o8=t=>{const o=ue(),a=pe(),r=gt({editor:a,selector:({editor:d})=>{var p;return((p=d.getSelection())==null?void 0:p.blocks)||[d.getTextCursorPosition().block]}}),s=r[0],c=S.useMemo(()=>(t.items||n8(a.dictionary)).filter(d=>xl(a,d.type,Object.fromEntries(Object.entries(d.props||{}).map(([p,h])=>[p,typeof h])))),[a,t.items]),f=S.useMemo(()=>c.map(d=>{const p=d.icon,h=d.type===s.type,v=Object.entries(d.props||{}).filter(([y,x])=>x!==s.props[y]).length===0;return{text:d.name,icon:g.jsx(p,{size:16}),onClick:()=>{a.focus(),a.transact(()=>{for(const y of r)a.updateBlock(y,{type:d.type,props:d.props})})},isSelected:h&&v}}),[a,c,s.props,s.type,r]);return!S.useMemo(()=>f.find(d=>d.isSelected)!==void 0,[f])||!a.isEditable?null:g.jsx(o.FormattingToolbar.Select,{className:"bn-select",items:f})},l8=()=>{const t=Se(),o=ue(),a=Ae("comments"),{store:r}=Ae(Or),s=S.useCallback(()=>{a.startPendingComment(),r.setState(!1)},[a,r]);return g.jsx(o.FormattingToolbar.Button,{className:"bn-button",label:t.formatting_toolbar.comment.tooltip,mainTooltip:t.formatting_toolbar.comment.tooltip,icon:g.jsx(my,{}),onClick:s})},a8=()=>pe().getExtension("comments")?g.jsx(l8,{}):null,r8=()=>{const t=Se(),o=ue(),a=pe(),r=S.useCallback(()=>{a._tiptapEditor.chain().focus().addPendingComment().run()},[a]);return!a._tiptapEditor.commands.addPendingComment||!a.isEditable?null:g.jsx(o.FormattingToolbar.Button,{className:"bn-button",label:t.formatting_toolbar.comment.tooltip,mainTooltip:t.formatting_toolbar.comment.tooltip,icon:g.jsx(my,{}),onClick:r})};function Dd(t,o){try{const a=new URL(t,o);if(a.protocol!=="javascript:")return a.href}catch{}return"#"}const i8=()=>{const t=Se(),o=ue(),a=pe(),r=gt({editor:a,selector:({editor:c})=>{var f;const d=((f=c.getSelection())==null?void 0:f.blocks)||[c.getTextCursorPosition().block];if(d.length!==1)return;const p=d[0];if(kt(p,c,p.type,{url:"string"}))return p}}),s=S.useCallback(()=>{r!==void 0&&(a.focus(),a.resolveFileUrl?a.resolveFileUrl(r.props.url).then(c=>window.open(Dd(c,window.location.href))):window.open(Dd(r.props.url,window.location.href)))},[r,a]);return r===void 0?null:g.jsx(o.FormattingToolbar.Button,{className:"bn-button",label:t.formatting_toolbar.file_download.tooltip[r.type]||t.formatting_toolbar.file_download.tooltip.file,mainTooltip:t.formatting_toolbar.file_download.tooltip[r.type]||t.formatting_toolbar.file_download.tooltip.file,icon:g.jsx(U3,{}),onClick:s})},s8=()=>{const t=Se(),o=ue(),a=pe(),r=gt({editor:a,selector:({editor:c})=>{var f;if(!c.isEditable)return;const d=((f=c.getSelection())==null?void 0:f.blocks)||[c.getTextCursorPosition().block];if(d.length!==1)return;const p=d[0];if(kt(p,c,p.type,{url:"string",showPreview:"boolean"}))return p}}),s=S.useCallback(()=>{r!==void 0&&xl(a,r.type,{showPreview:"boolean"})&&a.updateBlock(r.id,{props:{showPreview:!r.props.showPreview}})},[r,a]);return r===void 0?null:g.jsx(o.FormattingToolbar.Button,{className:"bn-button",label:"Toggle preview",mainTooltip:t.formatting_toolbar.file_preview_toggle.tooltip,icon:g.jsx(D3,{}),isSelected:r.props.showPreview,onClick:s})},c8=()=>{const t=Se(),o=ue(),a=pe(),r=Ae(Fe),s=gt({editor:a,selector:({editor:f})=>{var d;if(!f.isEditable||!f.settings.tables.splitCells)return;const p=((d=f.getSelection())==null?void 0:d.blocks)||[f.getTextCursorPosition().block];if(p.length!==1)return;const h=p[0];if(h.type==="table")return{mergeDirection:r.getMergeDirection(h)}}}),c=S.useCallback(()=>{r?.mergeCells()},[r]);return s===void 0?null:g.jsx(o.FormattingToolbar.Button,{className:"bn-button",label:t.formatting_toolbar.table_cell_merge.tooltip,mainTooltip:t.formatting_toolbar.table_cell_merge.tooltip,icon:s.mergeDirection==="horizontal"?g.jsx(M3,{}):g.jsx(R3,{}),onClick:c})},u8=()=>pe().getExtension(Fe)?g.jsx(c8,{}):null,f8={left:y3,center:g3,right:b3,justify:v3},cd=t=>{const o=ue(),a=Se(),r=pe(),s=gt({editor:r,selector:({editor:d})=>{var p,h;if(!d.isEditable)return;const v=((p=d.getSelection())==null?void 0:p.blocks)||[d.getTextCursorPosition().block],y=v[0];if(kt(y,d,y.type,{textAlignment:ys.textAlignment}))return{textAlignment:y.props.textAlignment,blocks:v};if(v.length===1&&kt(y,d,"table"))return(h=d.getExtension(Fe))!=null&&h.getCellSelection()?{textAlignment:Nr(y.content.rows[0].cells[0]).props.textAlignment,blocks:[y]}:void 0}}),c=S.useCallback(d=>{var p;if(s!==void 0){r.focus();for(const h of s.blocks)if(kt(h,r,h.type,{textAlignment:ys.textAlignment})&&xl(r,h.type,{textAlignment:ys.textAlignment}))r.updateBlock(h,{props:{textAlignment:d}});else if(h.type==="table"){const v=(p=r.getExtension(Fe))==null?void 0:p.getCellSelection();if(!v)continue;const y=h.content.rows.map(x=>({...x,cells:x.cells.map(C=>Nr(C))}));v.cells.forEach(({row:x,col:C})=>{y[x].cells[C].props.textAlignment=d}),r.updateBlock(h,{type:"table",content:{...h.content,type:"tableContent",rows:y}}),r.setTextCursorPosition(h)}}},[r,s]);if(s===void 0)return null;const f=f8[t.textAlignment];return g.jsx(o.FormattingToolbar.Button,{className:"bn-button","data-test":`alignText${t.textAlignment.slice(0,1).toUpperCase()+t.textAlignment.slice(1)}`,onClick:()=>c(t.textAlignment),isSelected:s.textAlignment===t.textAlignment,label:a.formatting_toolbar[`align_${t.textAlignment}`].tooltip,mainTooltip:a.formatting_toolbar[`align_${t.textAlignment}`].tooltip,icon:g.jsx(f,{})})},Ty=t=>[g.jsx(o8,{items:t},"blockTypeSelect"),g.jsx(u8,{},"tableCellMergeButton"),g.jsx(K3,{},"fileCaptionButton"),g.jsx(W3,{},"replaceFileButton"),g.jsx(J3,{},"fileRenameButton"),g.jsx(F3,{},"fileDeleteButton"),g.jsx(i8,{},"fileDownloadButton"),g.jsx(s8,{},"filePreviewButton"),g.jsx(ms,{basicTextStyle:"bold"},"boldStyleButton"),g.jsx(ms,{basicTextStyle:"italic"},"italicStyleButton"),g.jsx(ms,{basicTextStyle:"underline"},"underlineStyleButton"),g.jsx(ms,{basicTextStyle:"strike"},"strikeStyleButton"),g.jsx(cd,{textAlignment:"left"},"textAlignLeftButton"),g.jsx(cd,{textAlignment:"center"},"textAlignCenterButton"),g.jsx(cd,{textAlignment:"right"},"textAlignRightButton"),g.jsx(P3,{},"colorStyleButton"),g.jsx(e8,{},"nestBlockButton"),g.jsx(t8,{},"unnestBlockButton"),g.jsx(I3,{},"createLinkButton"),g.jsx(a8,{},"addCommentButton"),g.jsx(r8,{},"addTiptapCommentButton")],Ey=t=>{const o=ue();return g.jsx(o.FormattingToolbar.Root,{className:"bn-toolbar bn-formatting-toolbar",children:t.children||Ty(t.blockTypeSelectItems)})},d8=t=>{switch(t){case"left":return"top-start";case"center":return"top";case"right":return"top-end";default:return"top-start"}},My=t=>{const o=pe(),a=Ae(Or,{editor:o}),r=qe(Or,{editor:o}),s=gt({editor:o,selector:({editor:p})=>a.store.state?{from:p.prosemirrorState.selection.from,to:p.prosemirrorState.selection.to}:void 0}),c=gt({editor:o,selector:({editor:p})=>{const h=p.getTextCursorPosition().block;return kt(h,p,h.type,{textAlignment:ys.textAlignment})?d8(h.props.textAlignment):"top-start"}}),f=S.useMemo(()=>{var p,h;return{...t.floatingUIOptions,useFloatingOptions:{open:r,onOpenChange:(v,y,x)=>{a.store.setState(v),x==="escape-key"&&o.focus()},placement:c,middleware:[mn(10),Io(),yo()],...(p=t.floatingUIOptions)==null?void 0:p.useFloatingOptions},elementProps:{style:{zIndex:40},...(h=t.floatingUIOptions)==null?void 0:h.elementProps}}},[r,c,t.floatingUIOptions,a.store,o]),d=t.formattingToolbar||Ey;return g.jsx(Id,{position:s,...f,children:r&&g.jsx(d,{})})},m8=t=>{const o=ue(),a=Se(),{deleteLink:r}=Ae(Xs);return g.jsx(o.LinkToolbar.Button,{className:"bn-button",label:a.link_toolbar.delete.tooltip,mainTooltip:a.link_toolbar.delete.tooltip,isSelected:!1,onClick:()=>{var s;r(t.range.from),(s=t.setToolbarOpen)==null||s.call(t,!1)},icon:g.jsx(E3,{})})},p8=t=>{const o=ue(),a=Se();return g.jsxs(o.Generic.Popover.Root,{onOpenChange:t.setToolbarPositionFrozen,children:[g.jsx(o.Generic.Popover.Trigger,{children:g.jsx(o.LinkToolbar.Button,{className:"bn-button",mainTooltip:a.link_toolbar.edit.tooltip,isSelected:!1,children:a.link_toolbar.edit.text})}),g.jsx(o.Generic.Popover.Content,{className:"bn-popover-content bn-form-popover",variant:"form-popover",children:g.jsx(wy,{url:t.url,text:t.text,range:t.range,setToolbarOpen:t.setToolbarOpen,setToolbarPositionFrozen:t.setToolbarPositionFrozen})})]})},h8=t=>{const o=ue(),a=Se();return g.jsx(o.LinkToolbar.Button,{className:"bn-button",mainTooltip:a.link_toolbar.open.tooltip,label:a.link_toolbar.open.tooltip,isSelected:!1,onClick:()=>{window.open(Dd(t.url,window.location.href),"_blank")},icon:g.jsx($3,{})})},g8=t=>{const o=ue();return g.jsx(o.LinkToolbar.Root,{className:"bn-toolbar bn-link-toolbar",children:t.children||g.jsxs(g.Fragment,{children:[g.jsx(p8,{url:t.url,text:t.text,range:t.range,setToolbarOpen:t.setToolbarOpen,setToolbarPositionFrozen:t.setToolbarPositionFrozen}),g.jsx(h8,{url:t.url}),g.jsx(m8,{range:t.range,setToolbarOpen:t.setToolbarOpen})]})})},v8=t=>{const o=pe(),[a,r]=S.useState(!1),[s,c]=S.useState(!1),f=Ae(Xs),[d,p]=S.useState(void 0);S.useEffect(()=>{const x=()=>{const R=f.getLinkAtSelection();if(!R){p(void 0),s||r(!1);return}p({cursorType:"text",url:R.mark.attrs.href,text:R.text,range:R.range,element:f.getLinkElementAtPos(R.range.from)}),s||r(!0)},C=R=>{if(d!==void 0&&d.cursorType==="text"||!(R.target instanceof HTMLElement))return;const _=f.getLinkAtElement(R.target);_&&p({cursorType:"mouse",url:_.mark.attrs.href,text:_.text,range:_.range,element:f.getLinkElementAtPos(_.range.from)})},T=o.onChange(x),w=o.onSelectionChange(x),M=o.domElement;return M?.addEventListener("mouseover",C),()=>{T(),w(),M?.removeEventListener("mouseover",C)}},[o,o.domElement,f,d,s]);const h=S.useMemo(()=>{var x,C,T;return{...t.floatingUIOptions,useFloatingOptions:{open:a,onOpenChange:(w,M,R)=>{s||d!==void 0&&d.cursorType==="text"&&R==="hover"||(R==="escape-key"&&o.focus(),r(w))},placement:"top-start",middleware:[mn(10),yo()],...(x=t.floatingUIOptions)==null?void 0:x.useFloatingOptions},useHoverProps:{enabled:d!==void 0&&d.cursorType==="mouse",delay:{open:250,close:250},handleClose:j5(),...(C=t.floatingUIOptions)==null?void 0:C.useHoverProps},elementProps:{style:{zIndex:50},...(T=t.floatingUIOptions)==null?void 0:T.elementProps}}},[o,d,t.floatingUIOptions,a,s]),v=S.useMemo(()=>d!=null&&d.element?{element:d.element}:void 0,[d?.element]);if(!o.isEditable)return null;const y=t.linkToolbar||g8;return g.jsx(Bn,{reference:v,...h,children:d&&g.jsx(y,{url:d.url,text:d.text,range:d.range,setToolbarOpen:r,setToolbarPositionFrozen:c})})};function y8(t){return fe({attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8Z"},child:[]},{tag:"path",attr:{d:"M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8Z"},child:[]}]})(t)}const b8=()=>{const t=ue(),o=Se(),a=pe(),r=Ae(po),s=qe(Gn,{editor:a,selector:f=>f?.block}),c=S.useCallback(()=>{if(s===void 0)return;const f=s.content;if(f!==void 0&&Array.isArray(f)&&f.length===0)a.setTextCursorPosition(s),r.openSuggestionMenu("/");else{const d=a.insertBlocks([{type:"paragraph"}],s,"after")[0];a.setTextCursorPosition(d),r.openSuggestionMenu("/")}},[s,a,r]);return s===void 0?null:g.jsx(t.SideMenu.Button,{className:"bn-button",label:o.side_menu.add_block_label,icon:g.jsx(y8,{size:24,onClick:c,"data-test":"dragHandleAdd"})})};function Ry(t){return fe({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"},child:[]}]})(t)}function x8(t){return fe({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"m7 10 5 5 5-5z"},child:[]}]})(t)}const S8=t=>{const o=ue(),a=pe(),r=qe(Gn,{editor:a,selector:s=>s?.block});return r===void 0||!kt(r,a,r.type,{textColor:"string"})&&!kt(r,a,r.type,{backgroundColor:"string"})?null:g.jsxs(o.Generic.Menu.Root,{position:"right",sub:!0,children:[g.jsx(o.Generic.Menu.Trigger,{sub:!0,children:g.jsx(o.Generic.Menu.Item,{className:"bn-menu-item",subTrigger:!0,children:t.children})}),g.jsx(o.Generic.Menu.Dropdown,{sub:!0,className:"bn-menu-dropdown bn-color-picker-dropdown",children:g.jsx(ec,{iconSize:18,text:kt(r,a,r.type,{textColor:"string"})&&xl(a,r.type,{textColor:"string"})?{color:r.props.textColor,setColor:s=>a.updateBlock(r,{type:r.type,props:{textColor:s}})}:void 0,background:kt(r,a,r.type,{backgroundColor:"string"})&&xl(a,r.type,{backgroundColor:"string"})?{color:r.props.backgroundColor,setColor:s=>a.updateBlock(r,{props:{backgroundColor:s}})}:void 0})})]})},C8=t=>{const o=ue(),a=pe(),r=qe(Gn,{editor:a,selector:s=>s?.block});return r===void 0?null:g.jsx(o.Generic.Menu.Item,{className:"bn-menu-item",onClick:()=>a.removeBlocks([r]),children:t.children})},w8=t=>{const o=ue(),a=pe(),r=qe(Gn,{editor:a,selector:c=>c?.block});if(r===void 0||r.type!=="table"||!a.settings.tables.headers)return null;const s=!!r.content.headerRows;return g.jsx(o.Generic.Menu.Item,{className:"bn-menu-item",checked:s,onClick:()=>{a.updateBlock(r,{content:{...r.content,headerRows:s?void 0:1}})},children:t.children})},T8=t=>{const o=ue(),a=pe(),r=qe(Gn,{editor:a,selector:c=>c?.block});if(r===void 0||r.type!=="table"||!a.settings.tables.headers)return null;const s=!!r.content.headerCols;return g.jsx(o.Generic.Menu.Item,{className:"bn-menu-item",checked:s,onClick:()=>{a.updateBlock(r,{content:{...r.content,headerCols:s?void 0:1}})},children:t.children})},E8=t=>{const o=ue(),a=Se();return g.jsx(o.Generic.Menu.Dropdown,{className:"bn-menu-dropdown bn-drag-handle-menu",children:t.children||g.jsxs(g.Fragment,{children:[g.jsx(C8,{children:a.drag_handle.delete_menuitem}),g.jsx(S8,{children:a.drag_handle.colors_menuitem}),g.jsx(w8,{children:a.drag_handle.header_row_menuitem}),g.jsx(T8,{children:a.drag_handle.header_column_menuitem})]})})},M8=t=>{const o=ue(),a=Se(),r=Ae(Gn),s=qe(Gn,{selector:f=>f?.block});if(s===void 0)return null;const c=t.dragHandleMenu||E8;return g.jsxs(o.Generic.Menu.Root,{onOpenChange:f=>{f?r.freezeMenu():r.unfreezeMenu()},position:"left",children:[g.jsx(o.Generic.Menu.Trigger,{children:g.jsx(o.SideMenu.Button,{label:a.side_menu.drag_handle_label,draggable:!0,onDragStart:f=>r.blockDragStart(f,s),onDragEnd:r.blockDragEnd,className:"bn-button",icon:g.jsx(Ry,{size:24,"data-test":"dragHandle"})})}),g.jsx(c,{children:t.children})]})},R8=t=>{const o=ue(),a=pe(),r=qe(Gn,{editor:a,selector:c=>c?.block}),s=S.useMemo(()=>{var c;if(r===void 0)return{};const f={"data-block-type":r.type};return r.type==="heading"&&(f["data-level"]=r.props.level.toString()),(c=a.schema.blockSpecs[r.type].implementation.meta)!=null&&c.fileBlockAccept&&(r.props.url?f["data-url"]="true":f["data-url"]="false"),f},[r,a.schema.blockSpecs]);return g.jsx(o.SideMenu.Root,{className:"bn-side-menu",...s,children:t.children||g.jsxs(g.Fragment,{children:[g.jsx(b8,{}),g.jsx(M8,{dragHandleMenu:t.dragHandleMenu})]})})},j8=t=>{const o=qe(Gn,{selector:f=>f!==void 0?{show:f.show,block:f.block}:void 0}),{show:a,block:r}=o||{},s=S.useMemo(()=>{var f,d,p;return{...t.floatingUIOptions,useFloatingOptions:{open:a,placement:"left-start",...(f=t.floatingUIOptions)==null?void 0:f.useFloatingOptions},useDismissProps:{enabled:!1,...(d=t.floatingUIOptions)==null?void 0:d.useDismissProps},elementProps:{style:{zIndex:20},...(p=t.floatingUIOptions)==null?void 0:p.elementProps}}},[t.floatingUIOptions,a]),c=t.sideMenu||R8;return g.jsx(cy,{blockId:a?r?.id:void 0,...s,children:r?.id&&g.jsx(c,{})})};async function _8(t,o){return(await ZC(t,o)).map(({id:a,onItemClick:r})=>({id:a,onItemClick:r,icon:a}))}function O8(t){const o=ue(),a=Se(),{items:r,loadingState:s,selectedIndex:c,onItemClick:f,columns:d}=t,p=s==="loading-initial"||s==="loading"?g.jsx(o.GridSuggestionMenu.Loader,{className:"bn-grid-suggestion-menu-loader",columns:d}):null,h=S.useMemo(()=>{const v=[];for(let y=0;y<r.length;y++){const x=r[y];v.push(g.jsx(o.GridSuggestionMenu.Item,{className:"bn-grid-suggestion-menu-item",item:x,id:`bn-grid-suggestion-menu-item-${y}`,isSelected:y===c,onClick:()=>f?.(x)},x.id))}return v},[o,r,f,c]);return g.jsxs(o.GridSuggestionMenu.Root,{id:"bn-grid-suggestion-menu",columns:d,className:"bn-grid-suggestion-menu",children:[p,h,h.length===0&&t.loadingState==="loaded"&&g.jsx(o.GridSuggestionMenu.EmptyItem,{className:"bn-grid-suggestion-menu-empty-item",columns:d,children:a.suggestion_menu.no_items_title})]})}function jy(t,o,a,r=3){const s=S.useRef(0);S.useEffect(()=>{o!==void 0&&(t.length>0?s.current=o.length:o.length-s.current>r&&a())},[a,r,t.length,o])}function _y(t,o){const[a,r]=S.useState([]),[s,c]=S.useState(!1),f=S.useRef(void 0),d=S.useRef(void 0);return S.useEffect(()=>{const p=t;f.current=t,c(!0),o(t).then(h=>{f.current===p&&(r(h),c(!1),d.current=p)})},[t,o]),{items:a||[],usedQuery:d.current,loadingState:d.current===void 0?"loading-initial":s?"loading":"loaded"}}function N8(t,o,a,r,s){const[c,f]=S.useState(0),d=r!==void 0&&r>1;return S.useEffect(()=>{const p=v=>(v.key==="ArrowLeft"&&(v.preventDefault(),a.length&&f((c-1+a.length)%a.length)),v.key==="ArrowRight"&&(v.preventDefault(),a.length&&f((c+1+a.length)%a.length)),v.key==="ArrowUp"?(v.preventDefault(),a.length&&f((c-r+a.length)%a.length),!0):v.key==="ArrowDown"?(v.preventDefault(),a.length&&f((c+r)%a.length),!0):v.key==="Enter"&&!v.isComposing?(v.stopPropagation(),v.preventDefault(),a.length&&s?.(a[c]),!0):!1),h=t.domElement;return h?.addEventListener("keydown",p,!0),()=>{h?.removeEventListener("keydown",p,!0)}},[t.domElement,a,c,s,r,d]),S.useEffect(()=>{f(0)},[o]),{selectedIndex:a.length===0?void 0:c}}function A8(t){const o=Mn().setContentEditableProps,a=pe(),{getItems:r,gridSuggestionMenuComponent:s,query:c,clearQuery:f,closeMenu:d,onItemClick:p,columns:h}=t,v=S.useCallback(w=>{d(),f(),p?.(w)},[p,d,f]),{items:y,usedQuery:x,loadingState:C}=_y(c,r);jy(y,x,d);const{selectedIndex:T}=N8(a,c,y,h,v);return S.useEffect(()=>(o(w=>({...w,"aria-expanded":!0,"aria-controls":"bn-suggestion-menu"})),()=>{o(w=>({...w,"aria-expanded":!1,"aria-controls":void 0}))}),[o]),S.useEffect(()=>(o(w=>({...w,"aria-activedescendant":T?"bn-suggestion-menu-item-"+T:void 0})),()=>{o(w=>({...w,"aria-activedescendant":void 0}))}),[o,T]),g.jsx(s,{items:y,onItemClick:v,loadingState:C,selectedIndex:T,columns:h})}function D8(t){const o=pe(),{triggerCharacter:a,gridSuggestionMenuComponent:r,columns:s,minQueryLength:c,onItemClick:f,getItems:d}=t,p=S.useMemo(()=>f||(T=>{T.onItemClick(o)}),[o,f]),h=S.useMemo(()=>d||(async T=>await _8(o,T)),[o,d]),v=Ae(po);S.useEffect(()=>{v.addTriggerCharacter(a)},[v,a]);const y=qe(po),x=qe(po,{selector:T=>{var w;return{element:((w=o.domElement)==null?void 0:w.firstChild)||void 0,getBoundingClientRect:()=>T?.referencePos||new DOMRect}}}),C=S.useMemo(()=>{var T,w;return{...t.floatingUIOptions,useFloatingOptions:{open:y?.show&&y?.triggerCharacter===a,onOpenChange:M=>{M||v.closeMenu()},placement:"bottom-start",middleware:[mn(10),Yv({allowedPlacements:["bottom-start","top-start"],padding:10}),Io(),Dr({apply({elements:M,availableHeight:R}){M.floating.style.maxHeight=`${Math.max(0,R)}px`},padding:10})],...(T=t.floatingUIOptions)==null?void 0:T.useFloatingOptions},elementProps:{onMouseDownCapture:M=>M.preventDefault(),style:{zIndex:70},...(w=t.floatingUIOptions)==null?void 0:w.elementProps}}},[t.floatingUIOptions,y?.show,y?.triggerCharacter,v,a]);return!y||!y.ignoreQueryLength&&c&&(y.query.startsWith(" ")||y.query.length<c)?null:g.jsx(Bn,{reference:x,...C,children:a&&g.jsx(A8,{query:y.query,closeMenu:v.closeMenu,clearQuery:v.clearQuery,getItems:h,columns:s,gridSuggestionMenuComponent:r||O8,onItemClick:p})})}function H8(t){const o=ue(),a=Se(),{items:r,loadingState:s,selectedIndex:c,onItemClick:f}=t,d=s==="loading-initial"||s==="loading"?g.jsx(o.SuggestionMenu.Loader,{className:"bn-suggestion-menu-loader"}):null,p=S.useMemo(()=>{let h;const v=[];for(let y=0;y<r.length;y++){const x=r[y];x.group!==h&&(h=x.group,v.push(g.jsx(o.SuggestionMenu.Label,{className:"bn-suggestion-menu-label",children:h},h))),v.push(g.jsx(o.SuggestionMenu.Item,{className:ht("bn-suggestion-menu-item",x.size==="small"?"bn-suggestion-menu-item-small":""),item:x,id:`bn-suggestion-menu-item-${y}`,isSelected:y===c,onClick:()=>f?.(x)},x.title))}return v},[o,r,f,c]);return g.jsxs(o.SuggestionMenu.Root,{id:"bn-suggestion-menu",className:"bn-suggestion-menu",children:[p,p.length===0&&(t.loadingState==="loading"||t.loadingState==="loaded")&&g.jsx(o.SuggestionMenu.EmptyItem,{className:"bn-suggestion-menu-item",children:a.suggestion_menu.no_items_title}),d]})}function z8(t,o){const[a,r]=S.useState(0);return{selectedIndex:a,setSelectedIndex:r,handler:s=>{if(s.key==="ArrowUp")return s.preventDefault(),t.length&&r((a-1+t.length)%t.length),!0;if(s.key==="ArrowDown")return s.preventDefault(),t.length&&r((a+1)%t.length),!0;if(s.key==="PageUp")return s.preventDefault(),t.length&&r(0),!0;if(s.key==="PageDown")return s.preventDefault(),t.length&&r(t.length-1),!0;const c=L8(s)?s.nativeEvent.isComposing:s.isComposing;return s.key==="Enter"&&!c?(s.preventDefault(),s.stopPropagation(),t.length&&o?.(t[a]),!0):!1}}}function L8(t){return t.nativeEvent!==void 0}function V8(t,o,a,r,s){const{selectedIndex:c,setSelectedIndex:f,handler:d}=z8(a,r);return S.useEffect(()=>{const p=t.domElement;return p?.addEventListener("keydown",d,!0),()=>{p?.removeEventListener("keydown",d,!0)}},[t.domElement,a,c,r,s,d]),S.useEffect(()=>{f(0)},[o,f]),{selectedIndex:a.length===0?void 0:c}}function k8(t){const o=Mn().setContentEditableProps,a=pe(),{getItems:r,suggestionMenuComponent:s,query:c,clearQuery:f,closeMenu:d,onItemClick:p}=t,h=S.useCallback(T=>{d(),f(),p?.(T)},[p,d,f]),{items:v,usedQuery:y,loadingState:x}=_y(c,r);jy(v,y,d);const{selectedIndex:C}=V8(a,c,v,h);return S.useEffect(()=>(o(T=>({...T,"aria-expanded":!0,"aria-controls":"bn-suggestion-menu"})),()=>{o(T=>({...T,"aria-expanded":!1,"aria-controls":void 0}))}),[o]),S.useEffect(()=>(o(T=>({...T,"aria-activedescendant":C?"bn-suggestion-menu-item-"+C:void 0})),()=>{o(T=>({...T,"aria-activedescendant":void 0}))}),[o,C]),g.jsx(s,{items:v,onItemClick:h,loadingState:x,selectedIndex:C})}const B8={heading:Ds,heading_2:Hs,heading_3:zs,heading_4:py,heading_5:hy,heading_6:gy,toggle_heading:Ds,toggle_heading_2:Hs,toggle_heading_3:zs,quote:Sy,toggle_list:Cy,numbered_list:by,bullet_list:xy,check_list:yy,paragraph:Kd,table:_3,image:A3,video:N3,audio:z3,file:h3,emoji:q3,code_block:S3,divider:Z3};function U8(t){return gS(t).map(o=>{const a=B8[o.key];return{...o,icon:g.jsx(a,{size:18})}})}function $8(t){const o=pe(),{triggerCharacter:a,suggestionMenuComponent:r,minQueryLength:s,onItemClick:c,getItems:f}=t,d=S.useMemo(()=>c||(C=>{C.onItemClick(o)}),[o,c]),p=S.useMemo(()=>f||(async C=>hS(U8(o),C)),[o,f]),h=Ae(po);S.useEffect(()=>{h.addTriggerCharacter(a)},[h,a]);const v=qe(po),y=qe(po,{selector:C=>{var T;return{element:((T=o.domElement)==null?void 0:T.firstChild)||void 0,getBoundingClientRect:()=>C?.referencePos||new DOMRect}}}),x=S.useMemo(()=>{var C,T;return{...t.floatingUIOptions,useFloatingOptions:{open:v?.show&&v?.triggerCharacter===a,onOpenChange:w=>{w||h.closeMenu()},placement:"bottom-start",middleware:[mn(10),Yv({allowedPlacements:["bottom-start","top-start"],padding:10}),Io(),Dr({apply({elements:w,availableHeight:M}){w.floating.style.maxHeight=`${Math.max(0,M)}px`},padding:10})],...(C=t.floatingUIOptions)==null?void 0:C.useFloatingOptions},elementProps:{onMouseDownCapture:w=>w.preventDefault(),style:{zIndex:80},...(T=t.floatingUIOptions)==null?void 0:T.elementProps}}},[t.floatingUIOptions,v?.show,v?.triggerCharacter,h,a]);return!v||!v.ignoreQueryLength&&s&&(v.query.startsWith(" ")||v.query.length<s)?null:g.jsx(Bn,{reference:y,...x,children:a&&g.jsx(k8,{query:v.query,closeMenu:h.closeMenu,clearQuery:h.clearQuery,getItems:p,suggestionMenuComponent:r||H8,onItemClick:d})})}const G8=(t,o=.3)=>{const a=Math.floor(t)+o,r=Math.ceil(t)-o;return t>=a&&t<=r?Math.round(t):t<a?Math.floor(t):Math.ceil(t)},Z8=t=>{const o=ue(),a=pe(),r=Ae(Fe),s=qe(Fe,{selector:v=>v?.block}),c=S.useRef(!1),[f,d]=S.useState(),p=S.useCallback(v=>{r.freezeHandles(),t.hideOtherElements(!0),s&&(d({originalContent:s.content,originalCroppedContent:{rows:r.cropEmptyRowsOrColumns(s,t.orientation==="addOrRemoveColumns"?"columns":"rows")},startPos:t.orientation==="addOrRemoveColumns"?v.clientX:v.clientY}),c.current=!1,v.preventDefault())},[s,t,r]),h=S.useCallback(()=>{!s||c.current||a.updateBlock(s,{type:"table",content:{...s.content,rows:t.orientation==="addOrRemoveColumns"?r.addRowsOrColumns(s,"columns",1):r.addRowsOrColumns(s,"rows",1)}})},[s,a,t.orientation,r]);return S.useEffect(()=>{const v=y=>{var x,C;if(!s)return;if(!f)throw new Error("editingState is undefined");c.current=!0;const T=(t.orientation==="addOrRemoveColumns"?y.clientX:y.clientY)-f.startPos,w=t.orientation==="addOrRemoveColumns"?((x=f.originalCroppedContent.rows[0])==null?void 0:x.cells.length)??0:f.originalCroppedContent.rows.length,M=t.orientation==="addOrRemoveColumns"?((C=f.originalContent.rows[0])==null?void 0:C.cells.length)??0:f.originalContent.rows.length,R=t.orientation==="addOrRemoveColumns"?s.content.rows[0].cells.length:s.content.rows.length,_=M+G8(T/(t.orientation==="addOrRemoveColumns"?SS:CS),.3);_>=w&&_>0&&_!==R&&(a.updateBlock(s,{type:"table",content:{...s.content,rows:t.orientation==="addOrRemoveColumns"?r.addRowsOrColumns({type:"table",content:f.originalCroppedContent},"columns",_-w):r.addRowsOrColumns({type:"table",content:f.originalCroppedContent},"rows",_-w)}}),s.content&&a.setTextCursorPosition(s))};return f&&window.addEventListener("mousemove",v),()=>{window.removeEventListener("mousemove",v)}},[s,f,a,t.orientation,r]),S.useEffect(()=>{const v=()=>{t.hideOtherElements(!1),r.unfreezeHandles(),d(void 0)};return f&&window.addEventListener("mouseup",v),()=>{window.removeEventListener("mouseup",v)}},[f,t,r]),a.isEditable?g.jsx(o.TableHandle.ExtendButton,{className:ht("bn-extend-button",t.orientation==="addOrRemoveColumns"?"bn-extend-button-add-remove-columns":"bn-extend-button-add-remove-rows",f!==null?"bn-extend-button-editing":""),onClick:h,onMouseDown:p,children:t.children||g.jsx(L3,{size:18,"data-test":"extendButton"})}):null},U0=t=>{const o=ue(),a=Se(),r=Ae(Fe),s=qe(Fe,{selector:c=>t.orientation==="column"?c?.colIndex:c?.rowIndex});return r===void 0||s===void 0?null:g.jsx(o.Generic.Menu.Item,{onClick:()=>{r.addRowOrColumn(s,t.orientation==="row"?{orientation:"row",side:t.side}:{orientation:"column",side:t.side})},children:a.table_handle[`add_${t.side}_menuitem`]})},q8=t=>{const o=ue(),a=Se(),r=Ae(Fe),s=qe(Fe,{selector:c=>t.orientation==="column"?c?.colIndex:c?.rowIndex});return r===void 0||s===void 0?null:g.jsx(o.Generic.Menu.Item,{onClick:()=>r.removeRowOrColumn(s,t.orientation),children:t.orientation==="row"?a.table_handle.delete_row_menuitem:a.table_handle.delete_column_menuitem})},Y8=t=>{const o=ue(),a=Se(),r=pe(),s=Ae(Fe),{block:c,index:f}=qe(Fe,{selector:v=>({block:v?.block,index:t.orientation==="column"?v?.colIndex:v?.rowIndex})}),d=S.useMemo(()=>s===void 0||c===void 0||f===void 0?[]:t.orientation==="row"?s.getCellsAtRowHandle(c,f):s.getCellsAtColumnHandle(c,f),[c,f,t.orientation,s]),p=(v,y)=>{if(c===void 0)return;const x=c.content.rows.map(C=>({...C,cells:C.cells.map(T=>Nr(T))}));d.forEach(({row:C,col:T})=>{y==="text"?x[C].cells[T].props.textColor=v:x[C].cells[T].props.backgroundColor=v}),r.updateBlock(c,{type:"table",content:{...c.content,rows:x}}),r.setTextCursorPosition(c)};if(!d||!d[0]||!s||r.settings.tables.cellTextColor===!1&&r.settings.tables.cellBackgroundColor===!1)return null;const h=Nr(d[0].cell);return g.jsxs(o.Generic.Menu.Root,{position:"right",sub:!0,children:[g.jsx(o.Generic.Menu.Trigger,{sub:!0,children:g.jsx(o.Generic.Menu.Item,{className:"bn-menu-item",subTrigger:!0,children:t.children||a.drag_handle.colors_menuitem})}),g.jsx(o.Generic.Menu.Dropdown,{sub:!0,className:"bn-menu-dropdown bn-color-picker-dropdown",children:g.jsx(ec,{iconSize:18,text:r.settings.tables.cellTextColor?{color:d.every(({cell:v})=>Ar(v)&&v.props.textColor===h.props.textColor)?h.props.textColor:"default",setColor:v=>{p(v,"text")}}:void 0,background:r.settings.tables.cellBackgroundColor?{color:d.every(({cell:v})=>Ar(v)&&v.props.backgroundColor===h.props.backgroundColor)?h.props.backgroundColor:"default",setColor:v=>p(v,"background")}:void 0})})]})},X8=t=>{const o=ue(),a=Se(),r=pe(),s=Ae(Fe),{block:c,index:f}=qe(Fe,{selector:p=>({block:p?.block,index:t.orientation==="column"?p?.colIndex:p?.rowIndex})});if(s===void 0||c===void 0||f!==0||t.orientation!=="row"||!r.settings.tables.headers)return null;const d=!!c.content.headerRows;return g.jsx(o.Generic.Menu.Item,{className:"bn-menu-item",checked:d,onClick:()=>{r.updateBlock(c,{...c,content:{...c.content,headerRows:d?void 0:1}})},children:a.drag_handle.header_row_menuitem})},P8=t=>{const o=ue(),a=Se(),r=pe(),s=Ae(Fe),c=qe(Fe,{selector:p=>p?.block}),f=qe(Fe,{selector:p=>t.orientation==="column"?p?.colIndex:p?.rowIndex});if(!s||f!==0||!c||t.orientation!=="column"||!r.settings.tables.headers)return null;const d=!!c.content.headerCols;return g.jsx(o.Generic.Menu.Item,{className:"bn-menu-item",checked:d,onClick:()=>{r.updateBlock(c,{...c,content:{...c.content,headerCols:d?void 0:1}})},children:a.drag_handle.header_column_menuitem})},Q8=t=>{const o=ue();return g.jsx(o.Generic.Menu.Dropdown,{className:"bn-table-handle-menu",children:t.children||g.jsxs(g.Fragment,{children:[g.jsx(q8,{orientation:t.orientation}),g.jsx(U0,{orientation:t.orientation,side:t.orientation==="row"?"above":"left"}),g.jsx(U0,{orientation:t.orientation,side:t.orientation==="row"?"below":"right"}),g.jsx(X8,{orientation:t.orientation}),g.jsx(P8,{orientation:t.orientation}),g.jsx(Y8,{orientation:t.orientation})]})})},I8=t=>{const o=pe(),a=ue(),[r,s]=S.useState(!1),c=t.tableHandleMenu||Q8,f=Ae(Fe),d=qe(Fe),p=S.useMemo(()=>!f||!d||!d.block||d.block.type!=="table"?!1:t.orientation==="column"?f.getCellsAtColumnHandle(d.block,d.colIndex).every(({cell:h})=>vv(h)===1):f.getCellsAtRowHandle(d.block,d.rowIndex).every(({cell:h})=>yv(h)===1),[t.orientation,d,f]);return d?g.jsxs(a.Generic.Menu.Root,{onOpenChange:h=>{h?(f.freezeHandles(),t.hideOtherElements(!0)):(f.unfreezeHandles(),t.hideOtherElements(!1),o.focus())},position:"right",children:[g.jsx(a.Generic.Menu.Trigger,{children:g.jsx(a.TableHandle.Root,{className:ht("bn-table-handle",r?"bn-table-handle-dragging":"",p?"":"bn-table-handle-not-draggable"),draggable:p,onDragStart:h=>{s(!0),t.hideOtherElements(!0),t.orientation==="column"?f.colDragStart(h):f.rowDragStart(h)},onDragEnd:()=>{f.dragEnd(),t.hideOtherElements(!1),s(!1)},style:t.orientation==="column"?{transform:"rotate(0.25turn)"}:void 0,children:t.children||g.jsx(Ry,{size:24,"data-test":"tableHandle"})})}),g.jsx(c,{orientation:t.orientation})]}):null},K8=t=>{var o,a;const r=ue(),s=Se(),c=pe(),{block:f,colIndex:d,rowIndex:p}=qe(Fe,{selector:y=>({block:y?.block,colIndex:y?.colIndex,rowIndex:y?.rowIndex})}),h=(y,x)=>{if(f===void 0||d===void 0||p===void 0)return;const C=f.content.rows.map(T=>({...T,cells:T.cells.map(w=>Nr(w))}));x==="text"?C[p].cells[d].props.textColor=y:C[p].cells[d].props.backgroundColor=y,c.updateBlock(f,{type:"table",content:{...f.content,rows:C}}),c.setTextCursorPosition(f)};if(f===void 0||d===void 0||p===void 0)return null;const v=(a=(o=f.content.rows[p])==null?void 0:o.cells)==null?void 0:a[d];return!v||c.settings.tables.cellTextColor===!1&&c.settings.tables.cellBackgroundColor===!1?null:g.jsxs(r.Generic.Menu.Root,{position:"right",sub:!0,children:[g.jsx(r.Generic.Menu.Trigger,{sub:!0,children:g.jsx(r.Generic.Menu.Item,{className:"bn-menu-item",subTrigger:!0,children:t.children||s.drag_handle.colors_menuitem})}),g.jsx(r.Generic.Menu.Dropdown,{sub:!0,className:"bn-menu-dropdown bn-color-picker-dropdown",children:g.jsx(ec,{iconSize:18,text:c.settings.tables.cellTextColor?{color:Ar(v)?v.props.textColor:"default",setColor:y=>h(y,"text")}:void 0,background:c.settings.tables.cellBackgroundColor?{color:Ar(v)?v.props.backgroundColor:"default",setColor:y=>h(y,"background")}:void 0})})]})},F8=()=>{var t,o;const a=ue(),r=Se(),s=pe(),c=Ae(Fe),{block:f,colIndex:d,rowIndex:p}=qe(Fe,{selector:v=>({block:v?.block,colIndex:v?.colIndex,rowIndex:v?.rowIndex})});if(f===void 0||d===void 0||p===void 0)return null;const h=(o=(t=f.content.rows[p])==null?void 0:t.cells)==null?void 0:o[d];return!h||!Ar(h)||yv(h)===1&&vv(h)===1||!s.settings.tables.splitCells?null:g.jsx(a.Generic.Menu.Item,{onClick:()=>{c.splitCell({row:p,col:d})},children:r.table_handle.split_cell_menuitem})},J8=t=>{const o=ue();return g.jsx(o.Generic.Menu.Dropdown,{className:"bn-menu-dropdown bn-table-handle-menu",children:t.children||g.jsxs(g.Fragment,{children:[g.jsx(F8,{}),g.jsx(K8,{})]})})},W8=t=>{const o=ue(),a=pe(),r=Ae(Fe),s=t.tableCellMenu||J8;return!a.settings.tables.splitCells&&!a.settings.tables.cellBackgroundColor&&!a.settings.tables.cellTextColor?null:g.jsxs(o.Generic.Menu.Root,{onOpenChange:c=>{c?(r.freezeHandles(),t.hideOtherElements(!0)):(r.unfreezeHandles(),t.hideOtherElements(!1),a.focus())},position:"right",children:[g.jsx(o.Generic.Menu.Trigger,{children:g.jsx(o.Generic.Menu.Button,{className:"bn-table-cell-handle",children:t.children||g.jsx(x8,{size:12,"data-test":"tableCellHandle"})})}),g.jsx(s,{})]})},e7=t=>{const o=pe(),[a,r]=S.useState(),s=qe(Fe),c=S.useMemo(()=>{const v={};if(s===void 0)return{};const y=gv(s.block.id,o.prosemirrorState.doc);if(!y)return{};const x=y.posBeforeNode+1,C=o.prosemirrorView.domAtPos(x+1).node;if(!(C instanceof Element))return{};if(v.tableReference={element:C},s.rowIndex===void 0||s.colIndex===void 0)return v;const T=o.prosemirrorState.doc.resolve(x+1).posAtIndex(s.rowIndex),w=o.prosemirrorState.doc.resolve(T+1).posAtIndex(s.colIndex),M=o.prosemirrorView.domAtPos(w+1).node;return M instanceof Element?(v.cellReference={element:M},v.rowReference={element:C,getBoundingClientRect:()=>{const R=C.getBoundingClientRect(),_=M.getBoundingClientRect();return new DOMRect(R.x,s.draggingState&&s.draggingState.draggedCellOrientation==="row"?s.draggingState.mousePos-_.height/2:_.y,R.width,_.height)}},v.columnReference={element:C,getBoundingClientRect:()=>{const R=C.getBoundingClientRect(),_=M.getBoundingClientRect();return new DOMRect(s.draggingState&&s.draggingState.draggedCellOrientation==="col"?s.draggingState.mousePos-_.width/2:_.x,R.y,_.width,R.height)}},v):{}},[o,s]),f=S.useMemo(()=>s!==void 0?{rowTableHandle:{useFloatingOptions:{open:s.show&&s.rowIndex!==void 0&&(!a||a==="rowTableHandle"),placement:"left",middleware:[mn(-10)]},elementProps:{style:{zIndex:10}}},columnTableHandle:{useFloatingOptions:{open:s.show&&s.colIndex!==void 0&&(!a||a==="columnTableHandle"),placement:"top",middleware:[mn(-12)]},elementProps:{style:{zIndex:10}}},tableCellHandle:{useFloatingOptions:{open:s.show&&s.rowIndex!==void 0&&s.colIndex!==void 0&&(!a||a==="tableCellHandle"),placement:"top-end",middleware:[mn({mainAxis:-15,crossAxis:-1})]},elementProps:{style:{zIndex:10}}},extendRowsButton:{useFloatingOptions:{open:s.show&&s.showAddOrRemoveRowsButton&&(!a||a==="extendRowsButton"),placement:"bottom",middleware:[Dr({apply({rects:v,elements:y}){Object.assign(y.floating.style,{width:`${v.reference.width}px`})}})]},elementProps:{style:{zIndex:10}}},extendColumnsButton:{useFloatingOptions:{open:s.show&&s.showAddOrRemoveColumnsButton&&(!a||a==="extendColumnsButton"),placement:"right",middleware:[Dr({apply({rects:v,elements:y}){Object.assign(y.floating.style,{height:`${v.reference.height}px`})}})]},elementProps:{style:{zIndex:10}}}}:void 0,[a,s]);if(!s)return null;const d=t.tableHandle||I8,p=t.extendButton||Z8,h=t.tableCellHandle||W8;return g.jsxs(g.Fragment,{children:[g.jsx(Bn,{reference:c?.rowReference,...f?.rowTableHandle,children:s.show&&s.rowIndex!==void 0&&(!a||a==="rowTableHandle")&&g.jsx(d,{orientation:"row",hideOtherElements:v=>r(v?"rowTableHandle":void 0)})}),g.jsx(Bn,{reference:c?.columnReference,...f?.columnTableHandle,children:s.show&&s.colIndex!==void 0&&(!a||a==="columnTableHandle")&&g.jsx(d,{orientation:"column",hideOtherElements:v=>r(v?"columnTableHandle":void 0)})}),g.jsx(Bn,{reference:c?.cellReference,...f?.tableCellHandle,children:s.show&&s.rowIndex!==void 0&&s.colIndex!==void 0&&(!a||a==="tableCellHandle")&&g.jsx(h,{hideOtherElements:v=>r(v?"tableCellHandle":void 0)})}),g.jsx(Bn,{reference:c?.tableReference,...f?.extendRowsButton,children:s.show&&s.showAddOrRemoveRowsButton&&(!a||a==="extendRowsButton")&&g.jsx(p,{orientation:"addOrRemoveRows",hideOtherElements:v=>r(v?"extendRowsButton":void 0)})}),g.jsx(Bn,{reference:c?.tableReference,...f?.extendColumnsButton,children:s.show&&s.showAddOrRemoveColumnsButton&&(!a||a==="extendColumnsButton")&&g.jsx(p,{orientation:"addOrRemoveColumns",hideOtherElements:v=>r(v?"extendColumnsButton":void 0)})})]})},t7=S.lazy(()=>Promise.resolve().then(()=>T7)),n7=S.lazy(()=>Promise.resolve().then(()=>R7));function o7(t){const o=pe();if(!o)throw new Error("BlockNoteDefaultUI must be used within a BlockNoteContext.Provider");return g.jsxs(g.Fragment,{children:[o.getExtension(Or)&&t.formattingToolbar!==!1&&g.jsx(My,{}),o.getExtension(Xs)&&t.linkToolbar!==!1&&g.jsx(v8,{}),o.getExtension(po)&&t.slashMenu!==!1&&g.jsx($8,{triggerCharacter:"/"}),o.getExtension(po)&&t.emojiPicker!==!1&&g.jsx(D8,{triggerCharacter:":",columns:10,minQueryLength:2}),o.getExtension(Gn)&&t.sideMenu!==!1&&g.jsx(j8,{}),o.getExtension(Ed)&&t.filePanel!==!1&&g.jsx(I5,{}),o.getExtension(Fe)&&t.tableHandles!==!1&&g.jsx(e7,{}),o.getExtension(gn)&&t.comments!==!1&&g.jsxs(S.Suspense,{children:[g.jsx(t7,{}),g.jsx(n7,{})]})]})}function l7(t,o){const a=Mn();o||(o=a?.editor),S.useEffect(()=>{if(!o)throw new Error("'editor' is required, either from BlockNoteContext or as a function argument");return o.onChange(t)},[t,o])}function a7(t,o,a){const r=Mn();o||(o=r?.editor),S.useEffect(()=>{if(!o)throw new Error("'editor' is required, either from BlockNoteContext or as a function argument");return o.onSelectionChange(t,a)},[t,o,a])}const Oy=()=>{const t=S.useMemo(()=>{var f;return(f=window.matchMedia)==null?void 0:f.call(window,"(prefers-color-scheme: dark)")},[]),o=S.useMemo(()=>{var f;return(f=window.matchMedia)==null?void 0:f.call(window,"(prefers-color-scheme: light)")},[]),a=t?.matches,r=o?.matches,[s,c]=S.useState(a?"dark":r?"light":"no-preference");return S.useEffect(()=>{c(a?"dark":r?"light":"no-preference")},[a,r]),S.useEffect(()=>{if(typeof t?.addEventListener=="function"){const f=({matches:p})=>p&&c("dark"),d=({matches:p})=>p&&c("light");return t?.addEventListener("change",f),o?.addEventListener("change",d),()=>{t?.removeEventListener("change",f),o?.removeEventListener("change",d)}}else{const f=()=>c(t.matches?"dark":o.matches?"light":"no-preference");return t?.addEventListener("change",f),o?.addEventListener("change",f),()=>{t?.removeEventListener("change",f),o?.removeEventListener("change",f)}}},[t,o]),s},Ny=S.createContext(void 0);function r7(){return S.useContext(Ny)}function i7(){const t=new Set;let o={};return{subscribe(a){return t.add(a),()=>{t.delete(a)}},getSnapshot(){return o},getServerSnapshot(){return o},setRenderer(a,r){o={...o,[a]:Zn.createPortal(r.reactElement,r.element,a)},t.forEach(s=>s())},removeRenderer(a){const r={...o};delete r[a],o=r,t.forEach(s=>s())}}}const s7=({contentComponent:t})=>{const o=S.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return g.jsx(g.Fragment,{children:Object.values(o)})},c7=S.forwardRef((t,o)=>{const[a,r]=S.useState();return S.useImperativeHandle(o,()=>(s,c)=>{Zn.flushSync(()=>{r({node:s,container:c})}),r(void 0)},[]),g.jsx(g.Fragment,{children:a&&Zn.createPortal(a.node,a.container)})}),$0=()=>{};function u7(t,o){const{editor:a,className:r,theme:s,children:c,editable:f,onSelectionChange:d,onChange:p,formattingToolbar:h,linkToolbar:v,slashMenu:y,emojiPicker:x,sideMenu:C,filePanel:T,tableHandles:w,comments:M,autoFocus:R,renderEditor:_=!0,...N}=t,[A,H]=S.useState(),L=Mn(),Z=Oy(),I=L?.colorSchemePreference||Z,J=s||(I==="dark"?"dark":"light");l7(p||$0,a),a7(d||$0,a);const P=S.useCallback(te=>{a.elementRenderer=te},[a]),ee=S.useMemo(()=>({...L,editor:a,setContentEditableProps:H,colorSchemePreference:J}),[L,a,J]),oe=S.useMemo(()=>({editorProps:{autoFocus:R,contentEditableProps:A,editable:f},defaultUIProps:{formattingToolbar:h,linkToolbar:v,slashMenu:y,emojiPicker:x,sideMenu:C,filePanel:T,tableHandles:w,comments:M}}),[R,A,f,h,v,y,x,C,T,w,M]);return g.jsx(ry.Provider,{value:ee,children:g.jsxs(Ny.Provider,{value:oe,children:[g.jsx(c7,{ref:P}),g.jsx(f7,{className:r,renderEditor:_,editorColorScheme:J,ref:o,...N,children:c})]})})}const f7=Ve.forwardRef(({className:t,renderEditor:o,editorColorScheme:a,children:r,...s},c)=>g.jsx("div",{className:ht("bn-container",a,t),"data-color-scheme":a,...s,ref:c,children:o?g.jsx(m7,{children:r}):r})),d7=Ve.forwardRef(u7),m7=t=>{const o=r7(),a=pe(),r=S.useMemo(()=>i7(),[]),s=S.useCallback(c=>{a.isEditable=o.editorProps.editable!==!1,a._tiptapEditor.contentComponent=r,c?a.mount(c):a.unmount()},[o.editorProps.editable,a,r]);return g.jsxs(g.Fragment,{children:[g.jsx(s7,{contentComponent:r}),g.jsx(p7,{...o.editorProps,...t,mount:s}),g.jsx(o7,{...o.defaultUIProps}),t.children]})},p7=t=>{const{autoFocus:o,mount:a,contentEditableProps:r}=t;return g.jsx("div",{"aria-autocomplete":"list","aria-haspopup":"listbox","data-bn-autofocus":o,ref:a,...r})};function _r(t,o){let a;const r=document.createElement("div");let s;if(o!=null&&o.elementRenderer)o.elementRenderer(t(p=>a=p||void 0),r);else{if(!(o!=null&&o.headless))throw new Error("elementRenderer not available, expected headless editor");s=Sv.createRoot(r),Zn.flushSync(()=>{s.render(t(p=>a=p||void 0))})}if(!r.childElementCount)return console.warn("ReactInlineContentSpec: renderHTML() failed"),{dom:document.createElement("span")};a?.setAttribute("data-tmp-find","true");const c=r.cloneNode(!0),f=c.firstElementChild,d=c.querySelector("[data-tmp-find]");return d?.removeAttribute("data-tmp-find"),s?.unmount(),{dom:f,contentDOM:d||void 0}}function ud(t){var o;return g.jsx(ny,{onDragOver:a=>a.preventDefault(),...Object.fromEntries(Object.entries(t.domAttributes||{}).filter(([a])=>a!=="class")),className:ht("bn-block-content",((o=t.domAttributes)==null?void 0:o.class)||""),"data-content-type":t.blockType,...Object.fromEntries(Object.entries(t.blockProps).filter(([a,r])=>{const s=t.propSchema[a];return r!==s.default}).map(([a,r])=>[bv(a),r])),"data-file-block":t.isFileBlock===!0||void 0,children:t.children})}function rE(t,o,a){return(r={})=>{const s=typeof t=="function"?t(r):t,c=typeof o=="function"?o(r):o,f=a?typeof a=="function"?a(r):a:void 0;return{config:s,implementation:{...c,toExternalHTML(d,p,h){const v=c.toExternalHTML||c.render;return _r(y=>g.jsx(ud,{blockType:d.type,blockProps:d.props,propSchema:s.propSchema,domAttributes:this.blockContentDOMAttributes,children:g.jsx(v,{block:d,editor:p,contentRef:x=>{y(x),x&&(x.className=ht("bn-inline-content",x.className))},context:h})}),p)},render(d,p){if(this.renderType==="nodeView")return oy(h=>{var v;const y=MS(h.getPos,p,h.editor,s.type),x=Pd().nodeViewContentRef;if(!x)throw new Error("nodeViewContentRef is not set");const C=c.render;return g.jsx(ud,{blockType:y.type,blockProps:y.props,propSchema:s.propSchema,isFileBlock:!!((v=c.meta)!=null&&v.fileBlockAccept),domAttributes:this.blockContentDOMAttributes,children:g.jsx(C,{block:y,editor:p,contentRef:T=>{x(T),T&&(T.className=ht("bn-inline-content",T.className),T.dataset.nodeViewContent="")}})})},{className:"bn-react-node-view-renderer"})(this.props);{const h=c.render;return _r(v=>g.jsx(ud,{blockType:d.type,blockProps:d.props,propSchema:s.propSchema,domAttributes:this.blockContentDOMAttributes,children:g.jsx(h,{block:d,editor:p,contentRef:y=>{v(y),y&&(y.className=ht("bn-inline-content",y.className))}})}),p)}}},extensions:f}}}const Fd=(t={},o=[])=>S.useMemo(()=>{const a=pS.create(t);return window&&(window.ProseMirror=a._tiptapEditor),a},o),Jd=t=>{const[o,a]=S.useState(!1),r=gt({editor:t.editor,selector:({editor:d})=>d.isEmpty}),s=ue(),c=S.useCallback(()=>{a(!0)},[]),f=S.useCallback(()=>{a(!1)},[]);return S.useEffect(()=>{t.editable&&t.autoFocus&&t.editor.focus()},[t.autoFocus,t.editable,t.editor]),g.jsxs(g.Fragment,{children:[g.jsx(s.Comments.Editor,{autoFocus:t.autoFocus,className:"bn-comment-editor",editor:t.editor,onFocus:c,onBlur:f,editable:t.editable}),t.actions&&g.jsx("div",{className:"bn-comment-actions-wrapper",children:g.jsx(t.actions,{isFocused:o,isEmpty:r})})]})};let fd;async function h7(){return fd||(fd=(async()=>{const[t,o]=await Promise.all([Os(()=>import("./module-RjUF93sV.js"),[]),Os(()=>import("./native-48B9X9Wg.js"),[])]),a="default"in t?t.default:t,r="default"in o?o.default:o;return await a.init({data:r}),{emojiMart:a,emojiData:r}})(),fd)}function g7(t){const o=S.useRef(null),a=S.useRef(null);return a.current&&a.current.update(t),S.useEffect(()=>((async()=>{const{emojiMart:r}=await h7();a.current=new r.Picker({...t,ref:o})})(),()=>{a.current=null}),[]),Ve.createElement("div",{ref:o})}const G0=t=>{var o;const[a,r]=S.useState(!1),s=ue(),c=pe(),f=Mn();return g.jsxs(s.Generic.Popover.Root,{open:a,children:[g.jsx(s.Generic.Popover.Trigger,{children:g.jsx("div",{onClick:d=>{var p;d.preventDefault(),d.stopPropagation(),r(!a),(p=t.onOpenChange)==null||p.call(t,!a)},style:{display:"flex",justifyContent:"center",alignItems:"center"},children:t.children})}),((o=c.domElement)==null?void 0:o.parentElement)&&Zn.createPortal(g.jsx(s.Generic.Popover.Content,{className:"bn-emoji-picker-popover",variant:"panel-popover",children:g.jsx(g7,{perLine:7,onClickOutside:()=>{var d;r(!1),(d=t.onOpenChange)==null||d.call(t,!1)},onEmojiSelect:d=>{var p;t.onEmojiSelect(d),r(!1),(p=t.onOpenChange)==null||p.call(t,!1)},theme:f?.colorSchemePreference})}),c.domElement.parentElement)]})};function v7(t){return Wd([t]).get(t)}function Wd(t){const o=Ae(gn).userStore,a=S.useCallback(()=>{const c=new Map;for(const f of t){const d=o.getUser(f);d&&c.set(f,d)}return c},[o,t]),r=S.useMemo(()=>({current:a()}),[a]),s=S.useCallback(c=>{const f=o.subscribe(d=>{r.current=a(),c()});return o.loadUsers(t),f},[o,a,t,r]);return S.useSyncExternalStore(s,()=>r.current)}const y7=t=>{const o=ue(),a=Se(),r=Ae(gn),s=t.comment.reactions.find(p=>p.emoji===t.emoji);if(!s)throw new Error("Trying to render reaction badge for non-existing reaction");const[c,f]=S.useState([]),d=Wd(c);return g.jsx(o.Generic.Badge.Root,{className:ht("bn-badge","bn-comment-reaction"),text:s.userIds.length.toString(),icon:s.emoji,isSelected:r.threadStore.auth.canDeleteReaction(t.comment,s.emoji),onClick:()=>t.onReactionSelect(s.emoji),onMouseEnter:()=>f(s.userIds),mainTooltip:a.comments.reactions.reacted_by,secondaryTooltip:`${Array.from(d.values()).map(p=>p.username).join(`
|
|
50
|
+
`)}`},s.emoji)},{textColor:iE,backgroundColor:sE,...b7}=TS,em=wS.create({blockSpecs:{paragraph:ES()},styleSpecs:b7}),x7=({comment:t,thread:o,showResolveButton:a})=>{const r=Ae(gn),s=Se(),c=Fd({initialContent:t.body,trailingBlock:!1,dictionary:{...s,placeholders:{emptyDocument:s.placeholders.edit_comment}},schema:r.commentEditorSchema||em}),f=ue(),[d,p]=S.useState(!1),[h,v]=S.useState(!1),y=r.threadStore,x=S.useCallback(()=>{p(!0)},[]),C=S.useCallback(()=>{c.replaceBlocks(c.document,t.body),p(!1)},[c,t.body]),T=S.useCallback(async P=>{await y.updateComment({commentId:t.id,comment:{body:c.document},threadId:o.id}),p(!1)},[t,o.id,c,y]),w=S.useCallback(async()=>{await y.deleteComment({commentId:t.id,threadId:o.id})},[t,o.id,y]),M=S.useCallback(async P=>{y.auth.canAddReaction(t,P)?await y.addReaction({threadId:o.id,commentId:t.id,emoji:P}):y.auth.canDeleteReaction(t,P)&&await y.deleteReaction({threadId:o.id,commentId:t.id,emoji:P})},[y,t,o.id]),R=S.useCallback(async()=>{await y.resolveThread({threadId:o.id})},[o.id,y]),_=S.useCallback(async()=>{await y.unresolveThread({threadId:o.id})},[o.id,y]),N=v7(t.userId);if(!t.body)return null;let A;const H=y.auth.canAddReaction(t),L=y.auth.canDeleteComment(t),Z=y.auth.canUpdateComment(t),I=a&&(o.resolved?y.auth.canUnresolveThread(o):y.auth.canResolveThread(o));d||(A=g.jsxs(f.Generic.Toolbar.Root,{className:ht("bn-action-toolbar","bn-comment-actions"),variant:"action-toolbar",children:[H&&g.jsx(G0,{onEmojiSelect:P=>M(P.native),onOpenChange:v,children:g.jsx(f.Generic.Toolbar.Button,{mainTooltip:s.comments.actions.add_reaction,variant:"compact",children:g.jsx(V0,{size:16})},"add-reaction")}),I&&(o.resolved?g.jsx(f.Generic.Toolbar.Button,{mainTooltip:"Re-open",variant:"compact",onClick:_,children:g.jsx(d3,{size:16})},"reopen"):g.jsx(f.Generic.Toolbar.Button,{mainTooltip:s.comments.actions.resolve,variant:"compact",onClick:R,children:g.jsx(V3,{size:16})},"resolve")),(L||Z)&&g.jsxs(f.Generic.Menu.Root,{position:"bottom-start",children:[g.jsx(f.Generic.Menu.Trigger,{children:g.jsx(f.Generic.Toolbar.Button,{mainTooltip:s.comments.actions.more_actions,variant:"compact",children:g.jsx(G3,{size:16})},"more-actions")}),g.jsxs(f.Generic.Menu.Dropdown,{className:"bn-menu-dropdown",children:[Z&&g.jsx(f.Generic.Menu.Item,{icon:g.jsx(m3,{}),onClick:x,children:s.comments.actions.edit_comment},"edit-comment"),L&&g.jsx(f.Generic.Menu.Item,{icon:g.jsx(B3,{}),onClick:w,children:s.comments.actions.delete_comment},"delete-comment")]})]})]}));const J=t.createdAt.toLocaleDateString(void 0,{month:"short",day:"numeric"});if(!t.body)throw new Error("soft deletes are not yet supported");return g.jsx(f.Comments.Comment,{authorInfo:N??"loading",timeString:J,edited:t.updatedAt.getTime()!==t.createdAt.getTime(),showActions:"hover",actions:A,className:"bn-thread-comment",emojiPickerOpen:h,children:g.jsx(Jd,{autoFocus:d,editor:c,editable:d,actions:t.reactions.length>0||d?({isEmpty:P})=>g.jsxs(g.Fragment,{children:[t.reactions.length>0&&!d&&g.jsxs(f.Generic.Badge.Group,{className:ht("bn-badge-group","bn-comment-reactions"),children:[t.reactions.map(ee=>g.jsx(y7,{comment:t,emoji:ee.emoji,onReactionSelect:M},ee.emoji)),H&&g.jsx(G0,{onEmojiSelect:ee=>M(ee.native),onOpenChange:v,children:g.jsx(f.Generic.Badge.Root,{className:ht("bn-badge","bn-comment-add-reaction"),text:"+",icon:g.jsx(V0,{size:16}),mainTooltip:s.comments.actions.add_reaction})})]}),d&&g.jsxs(f.Generic.Toolbar.Root,{variant:"action-toolbar",className:ht("bn-action-toolbar","bn-comment-actions"),children:[g.jsx(f.Generic.Toolbar.Button,{mainTooltip:s.comments.save_button_text,variant:"compact",onClick:T,isDisabled:P,children:s.comments.save_button_text}),g.jsx(f.Generic.Toolbar.Button,{className:"bn-button",mainTooltip:s.comments.cancel_button_text,variant:"compact",onClick:C,children:s.comments.cancel_button_text})]})]}):void 0})})},S7=({thread:t,maxCommentsBeforeCollapse:o})=>{const a=ue(),r=Se(),s=Wd(t.resolvedBy?[t.resolvedBy]:[]),c=t.comments.map((f,d)=>g.jsx(x7,{thread:t,comment:f,showResolveButton:d===0},f.id+JSON.stringify(f.body||"{}")));if(t.resolved&&t.resolvedUpdatedAt&&t.resolvedBy){if(!s.get(t.resolvedBy))throw new Error(`User ${t.resolvedBy} resolved thread ${t.id}, but their data could not be found.`);const f=t.comments.findLastIndex(d=>t.resolvedUpdatedAt.getTime()>d.createdAt.getTime())+1;c.splice(f,0,g.jsx(a.Comments.Comment,{className:"bn-thread-comment",authorInfo:t.resolvedBy&&s.get(t.resolvedBy)||"loading",timeString:t.resolvedUpdatedAt.toLocaleDateString(void 0,{month:"short",day:"numeric"}),edited:!1,showActions:!1,children:g.jsx("div",{className:"bn-resolved-text",children:r.comments.sidebar.marked_as_resolved})},"resolved-comment"))}return o&&c.length>o&&c.splice(1,c.length-2,g.jsx(a.Comments.ExpandSectionsPrompt,{className:"bn-thread-expand-prompt",children:r.comments.sidebar.more_replies(t.comments.length-2)},"expand-prompt")),c};function C7(){const t=Ae(gn),o=ue(),a=Se(),r=Fd({trailingBlock:!1,dictionary:{...a,placeholders:{emptyDocument:a.placeholders.new_comment}},schema:t.commentEditorSchema||em});return g.jsx(o.Comments.Card,{className:"bn-thread",children:g.jsx(Jd,{autoFocus:!0,editable:!0,editor:r,actions:({isEmpty:s})=>g.jsx(o.Generic.Toolbar.Root,{className:ht("bn-action-toolbar","bn-comment-actions"),variant:"action-toolbar",children:g.jsx(o.Generic.Toolbar.Button,{className:"bn-button",mainTooltip:"Save",variant:"compact",isDisabled:s,onClick:async()=>{await t.createThread({initialComment:{body:r.document}}),t.stopPendingComment()},children:"Save"})})})})}function w7(t){const o=pe(),a=Ae(gn),r=qe(gn,{editor:o,selector:d=>d.pendingComment}),s=gt({editor:o,selector:({editor:d})=>r?{from:d.prosemirrorState.selection.from,to:d.prosemirrorState.selection.to}:void 0}),c=S.useMemo(()=>{var d,p;return{...t.floatingUIOptions,useFloatingOptions:{open:!!r,onOpenChange:h=>{h||(a.stopPendingComment(),o.focus())},placement:"bottom",middleware:[mn(10),Io(),yo()],...(d=t.floatingUIOptions)==null?void 0:d.useFloatingOptions},elementProps:{style:{zIndex:60},...(p=t.floatingUIOptions)==null?void 0:p.elementProps}}},[a,o,r,t.floatingUIOptions]),f=t.floatingComposer||C7;return g.jsx(Id,{position:s,...c,children:g.jsx(f,{})})}const T7=Object.freeze(Object.defineProperty({__proto__:null,default:w7},Symbol.toStringTag,{value:"Module"})),Ay=({thread:t,selected:o,referenceText:a,maxCommentsBeforeCollapse:r,onFocus:s,onBlur:c,tabIndex:f})=>{const d=ue(),p=Se(),h=Ae(gn),v=Fd({trailingBlock:!1,dictionary:{...p,placeholders:{emptyDocument:p.placeholders.comment_reply}},schema:h.commentEditorSchema||em}),y=S.useCallback(async()=>{await h.threadStore.addComment({comment:{body:v.document},threadId:t.id}),v.removeBlocks(v.document)},[h,v,t.id]);return g.jsxs(d.Comments.Card,{className:"bn-thread",headerText:a,onFocus:s,onBlur:c,selected:o,tabIndex:f,children:[g.jsx(d.Comments.CardSection,{className:"bn-thread-comments",children:g.jsx(S7,{thread:t,maxCommentsBeforeCollapse:o?void 0:r||5})}),o&&g.jsx(d.Comments.CardSection,{className:"bn-thread-composer",children:g.jsx(Jd,{autoFocus:!1,editable:!0,editor:v,actions:({isEmpty:x})=>x?null:g.jsx(d.Generic.Toolbar.Root,{variant:"action-toolbar",className:ht("bn-action-toolbar","bn-comment-actions"),children:g.jsx(d.Generic.Toolbar.Button,{mainTooltip:p.comments.save_button_text,variant:"compact",isDisabled:x,onClick:y,children:p.comments.save_button_text})})})})]})};function E7(){const t=Ae(gn).threadStore,o=S.useRef(void 0);o.current||(o.current=t.getThreads());const a=S.useCallback(r=>t.subscribe(s=>{o.current=s,r()}),[t]);return S.useSyncExternalStore(a,()=>o.current)}function M7(t){const o=pe(),a=Ae(gn),r=qe(gn,{editor:o,selector:p=>p.selectedThreadId?{id:p.selectedThreadId,position:p.threadPositions.get(p.selectedThreadId)}:void 0}),s=E7(),c=S.useMemo(()=>r?s.get(r.id):void 0,[r,s]),f=S.useMemo(()=>{var p,h;return{...t.floatingUIOptions,useFloatingOptions:{open:!!r,onOpenChange:(v,y,x)=>{x==="escape-key"&&o.focus(),v||a.selectThread(void 0)},placement:"bottom",middleware:[mn(10),Io(),yo()],...(p=t.floatingUIOptions)==null?void 0:p.useFloatingOptions},elementProps:{style:{zIndex:30},...(h=t.floatingUIOptions)==null?void 0:h.elementProps}}},[a,o,t.floatingUIOptions,r]),d=t.floatingThread||Ay;return g.jsx(Id,{position:r?.position,...f,children:c&&g.jsx(d,{thread:c,selected:!0})})}const R7=Object.freeze(Object.defineProperty({__proto__:null,default:M7},Symbol.toStringTag,{value:"Module"}));Ve.memo(({thread:t,selectedThreadId:o,maxCommentsBeforeCollapse:a,referenceText:r})=>{const s=Ae(gn),c=S.useCallback(d=>{d.target.closest(".bn-action-toolbar")||s.selectThread(t.id)},[s,t.id]),f=S.useCallback(d=>{if(!d.relatedTarget||d.relatedTarget.closest(".bn-action-toolbar"))return;const p=d.target instanceof Node?d.target:null,h=d.relatedTarget instanceof Node?d.relatedTarget.closest(".bn-thread"):null;(!p||!h||!h.contains(p))&&s.selectThread(void 0)},[s]);return g.jsx(Ay,{thread:t,selected:t.id===o,referenceText:r,maxCommentsBeforeCollapse:a,onFocus:c,onBlur:f,tabIndex:0})});function dd(t){return g.jsx(ny,{as:"span",className:"bn-inline-content-section","data-inline-content-type":t.inlineContentType,...Object.fromEntries(Object.entries(t.inlineContentProps).filter(([o,a])=>{const r=t.propSchema[o];return a!==r.default}).map(([o,a])=>[bv(o),a])),children:t.children})}function cE(t,o){var a;const r=RS.create({name:t.type,inline:!0,group:"inline",selectable:t.content==="styled",atom:t.content==="none",draggable:(a=o.meta)==null?void 0:a.draggable,content:t.content==="styled"?"inline*":"",addAttributes(){return AS(t.propSchema)},addKeyboardShortcuts(){return NS(t)},parseHTML(){return OS(t,o.parse)},renderHTML({node:s}){const c=this.options.editor,f=Lg(s,c.schema.inlineContentSchema,c.schema.styleSchema),d=o.toExternalHTML||o.render,p=_r(h=>g.jsx(d,{contentRef:v=>{h(v),v&&(v.dataset.editable="")},inlineContent:f,updateInlineContent:()=>{},editor:c}),c);return _S(p,t.type,s.attrs,t.propSchema)},addNodeView(){const s=this.options.editor;return c=>oy(f=>{const d=Pd().nodeViewContentRef;if(!d)throw new Error("nodeViewContentRef is not set");const p=o.render;return g.jsx(dd,{inlineContentProps:f.node.attrs,inlineContentType:t.type,propSchema:t.propSchema,children:g.jsx(p,{contentRef:h=>{d(h),h&&(h.dataset.editable="")},editor:s,inlineContent:Lg(f.node,s.schema.inlineContentSchema,s.schema.styleSchema),updateInlineContent:h=>{const v=jS([h],s.pmSchema),y=f.getPos();y!==void 0&&s.transact(x=>x.replaceWith(y,y+f.node.nodeSize,v))}})})},{className:"bn-ic-react-node-view-renderer",as:"span"})(c)}});return DS(t,{...o,node:r,render(s,c,f){const d=o.render;return _r(p=>g.jsx(dd,{inlineContentProps:s.props,inlineContentType:t.type,propSchema:t.propSchema,children:g.jsx(d,{contentRef:h=>{p(h),h&&(h.dataset.editable="")},editor:f,inlineContent:s,updateInlineContent:c})}),f)},toExternalHTML(s,c){const f=o.toExternalHTML||o.render;return _r(d=>g.jsx(dd,{inlineContentProps:s.props,inlineContentType:t.type,propSchema:t.propSchema,children:g.jsx(f,{contentRef:p=>{d(p),p&&(p.dataset.editable="")},editor:c,inlineContent:s,updateInlineContent:()=>{}})}),c)}})}function Dy(t,o){const a=t.getBoundingClientRect(),r=o.getBoundingClientRect(),s=a.top<r.top,c=a.bottom>r.bottom;return s&&c?"both":s?"top":c?"bottom":"none"}function j7(t){return o=>{t.forEach(a=>{typeof a=="function"?a(o):a!=null&&(a.current=o)})}}function $n(t){return Object.keys(t)}function md(t){return t&&typeof t=="object"&&!Array.isArray(t)}function tm(t,o){const a={...t},r=o;return md(t)&&md(o)&&Object.keys(o).forEach(s=>{md(r[s])&&s in t?a[s]=tm(a[s],r[s]):a[s]=r[s]}),a}function _7(t){return t.replace(/[A-Z]/g,o=>`-${o.toLowerCase()}`)}function O7(t){return typeof t!="string"||!t.includes("var(--mantine-scale)")?t:t.match(/^calc\((.*?)\)$/)?.[1].split("*")[0].trim()}function N7(t){const o=O7(t);return typeof o=="number"?o:typeof o=="string"?o.includes("calc")||o.includes("var")?o:o.includes("px")?Number(o.replace("px","")):o.includes("rem")?Number(o.replace("rem",""))*16:o.includes("em")?Number(o.replace("em",""))*16:Number(o):NaN}function Z0(t){return t==="0rem"?"0rem":`calc(${t} * var(--mantine-scale))`}function Hy(t,{shouldScale:o=!1}={}){function a(r){if(r===0||r==="0")return`0${t}`;if(typeof r=="number"){const s=`${r/16}${t}`;return o?Z0(s):s}if(typeof r=="string"){if(r===""||r.startsWith("calc(")||r.startsWith("clamp(")||r.includes("rgba("))return r;if(r.includes(","))return r.split(",").map(c=>a(c)).join(",");if(r.includes(" "))return r.split(" ").map(c=>a(c)).join(" ");const s=r.replace("px","");if(!Number.isNaN(Number(s))){const c=`${Number(s)/16}${t}`;return o?Z0(c):c}}return r}return a}const F=Hy("rem",{shouldScale:!0}),q0=Hy("em");function tc(t){return Object.keys(t).reduce((o,a)=>(t[a]!==void 0&&(o[a]=t[a]),o),{})}function zy(t){if(typeof t=="number")return!0;if(typeof t=="string"){if(t.startsWith("calc(")||t.startsWith("var(")||t.includes(" ")&&t.trim()!=="")return!0;const o=/^[+-]?[0-9]+(\.[0-9]+)?(px|em|rem|ex|ch|lh|rlh|vw|vh|vmin|vmax|vb|vi|svw|svh|lvw|lvh|dvw|dvh|cm|mm|in|pt|pc|q|cqw|cqh|cqi|cqb|cqmin|cqmax|%)?$/;return t.trim().split(/\s+/).every(r=>o.test(r))}return!1}function Ly(t){return Array.isArray(t)||t===null?!1:typeof t=="object"?t.type!==S.Fragment:!1}function nc(t){const o=S.createContext(null);return[({children:s,value:c})=>g.jsx(o.Provider,{value:c,children:s}),()=>{const s=S.useContext(o);if(s===null)throw new Error(t);return s}]}function oc(t=null){const o=S.createContext(t);return[({children:s,value:c})=>g.jsx(o.Provider,{value:c,children:s}),()=>S.useContext(o)]}function Y0(t,o){return a=>{if(typeof a!="string"||a.trim().length===0)throw new Error(o);return`${t}-${a}`}}function Ls(t,o){let a=t;for(;(a=a.parentElement)&&!a.matches(o););return a}function A7(t,o,a){for(let r=t-1;r>=0;r-=1)if(!o[r].disabled)return r;if(a){for(let r=o.length-1;r>-1;r-=1)if(!o[r].disabled)return r}return t}function D7(t,o,a){for(let r=t+1;r<o.length;r+=1)if(!o[r].disabled)return r;if(a){for(let r=0;r<o.length;r+=1)if(!o[r].disabled)return r}return t}function H7(t,o,a){return Ls(t,a)===Ls(o,a)}function nm({parentSelector:t,siblingSelector:o,onKeyDown:a,loop:r=!0,activateOnFocus:s=!1,dir:c="rtl",orientation:f}){return d=>{a?.(d);const p=Array.from(Ls(d.currentTarget,t)?.querySelectorAll(o)||[]).filter(T=>H7(d.currentTarget,T,t)),h=p.findIndex(T=>d.currentTarget===T),v=D7(h,p,r),y=A7(h,p,r),x=c==="rtl"?y:v,C=c==="rtl"?v:y;switch(d.key){case"ArrowRight":{f==="horizontal"&&(d.stopPropagation(),d.preventDefault(),p[x].focus(),s&&p[x].click());break}case"ArrowLeft":{f==="horizontal"&&(d.stopPropagation(),d.preventDefault(),p[C].focus(),s&&p[C].click());break}case"ArrowUp":{f==="vertical"&&(d.stopPropagation(),d.preventDefault(),p[y].focus(),s&&p[y].click());break}case"ArrowDown":{f==="vertical"&&(d.stopPropagation(),d.preventDefault(),p[v].focus(),s&&p[v].click());break}case"Home":{d.stopPropagation(),d.preventDefault(),!p[0].disabled&&p[0].focus();break}case"End":{d.stopPropagation(),d.preventDefault();const T=p.length-1;!p[T].disabled&&p[T].focus();break}}}}const z7={app:100,modal:200,popover:300,overlay:400,max:9999};function Br(t){return z7[t]}const L7=()=>{};function V7(t,o={active:!0}){return typeof t!="function"||!o.active?o.onKeyDown||L7:a=>{a.key==="Escape"&&(t(a),o.onTrigger?.())}}function Xe(t,o="size",a=!0){if(t!==void 0)return zy(t)?a?F(t):t:`var(--${o}-${t})`}function Ur(t){return Xe(t,"mantine-spacing")}function Mt(t){return t===void 0?"var(--mantine-radius-default)":Xe(t,"mantine-radius")}function $t(t){return Xe(t,"mantine-font-size")}function k7(t){return Xe(t,"mantine-line-height",!1)}function Vy(t){if(t)return Xe(t,"mantine-shadow",!1)}function Bt(t,o){return a=>{t?.(a),o?.(a)}}function B7(t,o,a){return a?Array.from(Ls(a,o)?.querySelectorAll(t)||[]).findIndex(r=>r===a):null}function U7(t="mantine-"){return`${t}${Math.random().toString(36).slice(2,11)}`}function X0(t){const o=S.useRef(t);return S.useEffect(()=>{o.current=t}),S.useMemo(()=>((...a)=>o.current?.(...a)),[])}const $7=["mousedown","touchstart"];function G7(t,o,a){const r=S.useRef(null),s=o||$7;return S.useEffect(()=>{const c=f=>{const{target:d}=f??{};if(Array.isArray(a)){const p=!document.body.contains(d)&&d?.tagName!=="HTML";a.every(v=>!!v&&!f.composedPath().includes(v))&&!p&&t(f)}else r.current&&!r.current.contains(d)&&t(f)};return s.forEach(f=>document.addEventListener(f,c)),()=>{s.forEach(f=>document.removeEventListener(f,c))}},[r,t,a]),r}function Z7(t,o){try{return t.addEventListener("change",o),()=>t.removeEventListener("change",o)}catch{return t.addListener(o),()=>t.removeListener(o)}}function q7(t,o){return typeof window<"u"&&"matchMedia"in window?window.matchMedia(t).matches:!1}function Y7(t,o,{getInitialValueInEffect:a}={getInitialValueInEffect:!0}){const[r,s]=S.useState(a?o:q7(t));return S.useEffect(()=>{try{const c=window.matchMedia(t);return s(c.matches),Z7(c,f=>s(f.matches))}catch{return}},[t]),r||!1}const $r=typeof document<"u"?S.useLayoutEffect:S.useEffect;function zr(t,o){const a=S.useRef(!1);S.useEffect(()=>()=>{a.current=!1},[]),S.useEffect(()=>{if(a.current)return t();a.current=!0},o)}function X7({opened:t,shouldReturnFocus:o=!0}){const a=S.useRef(null),r=()=>{a.current&&"focus"in a.current&&typeof a.current.focus=="function"&&a.current?.focus({preventScroll:!0})};return zr(()=>{let s=-1;const c=f=>{f.key==="Tab"&&window.clearTimeout(s)};return document.addEventListener("keydown",c),t?a.current=document.activeElement:o&&(s=window.setTimeout(r,10)),()=>{window.clearTimeout(s),document.removeEventListener("keydown",c)}},[t,o]),r}const P7=/input|select|textarea|button|object/,ky="a, input, select, textarea, button, object, [tabindex]";function Q7(t){return t.style.display==="none"}function I7(t){if(t.getAttribute("aria-hidden")||t.getAttribute("hidden")||t.getAttribute("type")==="hidden")return!1;let a=t;for(;a&&!(a===document.body||a.nodeType===11);){if(Q7(a))return!1;a=a.parentNode}return!0}function By(t){let o=t.getAttribute("tabindex");return o===null&&(o=void 0),parseInt(o,10)}function Hd(t){const o=t.nodeName.toLowerCase(),a=!Number.isNaN(By(t));return(P7.test(o)&&!t.disabled||t instanceof HTMLAnchorElement&&t.href||a)&&I7(t)}function Uy(t){const o=By(t);return(Number.isNaN(o)||o>=0)&&Hd(t)}function K7(t){return Array.from(t.querySelectorAll(ky)).filter(Uy)}function F7(t,o){const a=K7(t);if(!a.length){o.preventDefault();return}const r=a[o.shiftKey?0:a.length-1],s=t.getRootNode();let c=r===s.activeElement||t===s.activeElement;const f=s.activeElement;if(f.tagName==="INPUT"&&f.getAttribute("type")==="radio"&&(c=a.filter(v=>v.getAttribute("type")==="radio"&&v.getAttribute("name")===f.getAttribute("name")).includes(r)),!c)return;o.preventDefault();const p=a[o.shiftKey?a.length-1:0];p&&p.focus()}function $y(t=!0){const o=S.useRef(null),a=s=>{let c=s.querySelector("[data-autofocus]");if(!c){const f=Array.from(s.querySelectorAll(ky));c=f.find(Uy)||f.find(Hd)||null,!c&&Hd(s)&&(c=s)}c&&c.focus({preventScroll:!0})},r=S.useCallback(s=>{t&&s!==null&&o.current!==s&&(s?(setTimeout(()=>{s.getRootNode()&&a(s)}),o.current=s):o.current=null)},[t]);return S.useEffect(()=>{if(!t)return;o.current&&setTimeout(()=>a(o.current));const s=c=>{c.key==="Tab"&&o.current&&F7(o.current,c)};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[t]),r}const J7=Ve.useId||(()=>{});function W7(){const t=J7();return t?`mantine-${t.replace(/:/g,"")}`:""}function Ca(t){const o=W7(),[a,r]=S.useState(o);return $r(()=>{r(U7())},[]),typeof t=="string"?t:typeof window>"u"?o:a}function Vs(t,o){if(typeof t=="function")return t(o);typeof t=="object"&&t!==null&&"current"in t&&(t.current=o)}function lc(...t){const o=new Map;return a=>{if(t.forEach(r=>{const s=Vs(r,a);s&&o.set(r,s)}),o.size>0)return()=>{t.forEach(r=>{const s=o.get(r);s&&typeof s=="function"?s():Vs(r,null)}),o.clear()}}}function Rn(...t){return S.useCallback(lc(...t),t)}function wa({value:t,defaultValue:o,finalValue:a,onChange:r=()=>{}}){const[s,c]=S.useState(o!==void 0?o:a),f=(d,...p)=>{c(d),r?.(d,...p)};return t!==void 0?[t,r,!0]:[s,f,!1]}function e9(t,o){return Y7("(prefers-reduced-motion: reduce)",t,o)}function t9(){const[t,o]=S.useState(!1),a=S.useRef(null),r=S.useCallback(()=>{o(!0)},[]),s=S.useCallback(()=>{o(!1)},[]);return{ref:S.useCallback(f=>{a.current&&(a.current.removeEventListener("mouseenter",r),a.current.removeEventListener("mouseleave",s)),f&&(f.addEventListener("mouseenter",r),f.addEventListener("mouseleave",s)),a.current=f},[r,s]),hovered:t}}function n9(t=!1,o={}){const[a,r]=S.useState(t),s=S.useCallback(()=>{r(d=>d||(o.onOpen?.(),!0))},[o.onOpen]),c=S.useCallback(()=>{r(d=>d&&(o.onClose?.(),!1))},[o.onClose]),f=S.useCallback(()=>{a?c():s()},[c,s,a]);return[a,{open:s,close:c,toggle:f}]}function o9(t){return t.currentTarget instanceof HTMLElement&&t.relatedTarget instanceof HTMLElement?t.currentTarget.contains(t.relatedTarget):!1}function l9({onBlur:t,onFocus:o}={}){const[a,r]=S.useState(!1),s=S.useRef(!1),c=S.useRef(null),f=X0(o),d=X0(t),p=S.useCallback(x=>{r(x),s.current=x},[]),h=S.useCallback(x=>{s.current||(p(!0),f(x))},[]),v=S.useCallback(x=>{s.current&&!o9(x)&&(p(!1),d(x))},[]),y=S.useCallback(x=>{x&&(c.current&&(c.current.removeEventListener("focusin",h),c.current.removeEventListener("focusout",v)),x.addEventListener("focusin",h),x.addEventListener("focusout",v),c.current=x)},[h,v]);return S.useEffect(()=>()=>{c.current&&(c.current.removeEventListener("focusin",h),c.current.removeEventListener("focusout",v))},[]),{ref:y,focused:a}}function om(t){const o=Ve.version;return typeof Ve.version!="string"||o.startsWith("18.")?t?.ref:t?.props?.ref}function Gr(t){const o=S.Children.toArray(t);return o.length!==1||!Ly(o[0])?null:o[0]}const a9={};function r9(t){const o={};return t.forEach(a=>{Object.entries(a).forEach(([r,s])=>{o[r]?o[r]=xo(o[r],s):o[r]=s})}),o}function ac({theme:t,classNames:o,props:a,stylesCtx:r}){const c=(Array.isArray(o)?o:[o]).map(f=>typeof f=="function"?f(t,a,r):f||a9);return r9(c)}function ks({theme:t,styles:o,props:a,stylesCtx:r}){return(Array.isArray(o)?o:[o]).reduce((c,f)=>typeof f=="function"?{...c,...f(t,a,r)}:{...c,...f},{})}const lm=S.createContext(null);function Ko(){const t=S.useContext(lm);if(!t)throw new Error("[@mantine/core] MantineProvider was not found in tree");return t}function i9(){return Ko().cssVariablesResolver}function s9(){return Ko().classNamesPrefix}function am(){return Ko().getStyleNonce}function c9(){return Ko().withStaticClasses}function u9(){return Ko().headless}function f9(){return Ko().stylesTransform?.sx}function d9(){return Ko().stylesTransform?.styles}function rc(){return Ko().env||"default"}function m9(t){return/^#?([0-9A-F]{3}){1,2}([0-9A-F]{2})?$/i.test(t)}function p9(t){let o=t.replace("#","");if(o.length===3){const f=o.split("");o=[f[0],f[0],f[1],f[1],f[2],f[2]].join("")}if(o.length===8){const f=parseInt(o.slice(6,8),16)/255;return{r:parseInt(o.slice(0,2),16),g:parseInt(o.slice(2,4),16),b:parseInt(o.slice(4,6),16),a:f}}const a=parseInt(o,16),r=a>>16&255,s=a>>8&255,c=a&255;return{r,g:s,b:c,a:1}}function h9(t){const[o,a,r,s]=t.replace(/[^0-9,./]/g,"").split(/[/,]/).map(Number);return{r:o,g:a,b:r,a:s===void 0?1:s}}function g9(t){const o=/^hsla?\(\s*(\d+)\s*,\s*(\d+%)\s*,\s*(\d+%)\s*(,\s*(0?\.\d+|\d+(\.\d+)?))?\s*\)$/i,a=t.match(o);if(!a)return{r:0,g:0,b:0,a:1};const r=parseInt(a[1],10),s=parseInt(a[2],10)/100,c=parseInt(a[3],10)/100,f=a[5]?parseFloat(a[5]):void 0,d=(1-Math.abs(2*c-1))*s,p=r/60,h=d*(1-Math.abs(p%2-1)),v=c-d/2;let y,x,C;return p>=0&&p<1?(y=d,x=h,C=0):p>=1&&p<2?(y=h,x=d,C=0):p>=2&&p<3?(y=0,x=d,C=h):p>=3&&p<4?(y=0,x=h,C=d):p>=4&&p<5?(y=h,x=0,C=d):(y=d,x=0,C=h),{r:Math.round((y+v)*255),g:Math.round((x+v)*255),b:Math.round((C+v)*255),a:f||1}}function rm(t){return m9(t)?p9(t):t.startsWith("rgb")?h9(t):t.startsWith("hsl")?g9(t):{r:0,g:0,b:0,a:1}}function hs(t,o){if(t.startsWith("var("))return`color-mix(in srgb, ${t}, black ${o*100}%)`;const{r:a,g:r,b:s,a:c}=rm(t),f=1-o,d=p=>Math.round(p*f);return`rgba(${d(a)}, ${d(r)}, ${d(s)}, ${c})`}function Lr(t,o){return typeof t.primaryShade=="number"?t.primaryShade:o==="dark"?t.primaryShade.dark:t.primaryShade.light}function pd(t){return t<=.03928?t/12.92:((t+.055)/1.055)**2.4}function v9(t){const o=t.match(/oklch\((.*?)%\s/);return o?parseFloat(o[1]):null}function y9(t){if(t.startsWith("oklch("))return(v9(t)||0)/100;const{r:o,g:a,b:r}=rm(t),s=o/255,c=a/255,f=r/255,d=pd(s),p=pd(c),h=pd(f);return .2126*d+.7152*p+.0722*h}function Mr(t,o=.179){return t.startsWith("var(")?!1:y9(t)>o}function Cl({color:t,theme:o,colorScheme:a}){if(typeof t!="string")throw new Error(`[@mantine/core] Failed to parse color. Expected color to be a string, instead got ${typeof t}`);if(t==="bright")return{color:t,value:a==="dark"?o.white:o.black,shade:void 0,isThemeColor:!1,isLight:Mr(a==="dark"?o.white:o.black,o.luminanceThreshold),variable:"--mantine-color-bright"};if(t==="dimmed")return{color:t,value:a==="dark"?o.colors.dark[2]:o.colors.gray[7],shade:void 0,isThemeColor:!1,isLight:Mr(a==="dark"?o.colors.dark[2]:o.colors.gray[6],o.luminanceThreshold),variable:"--mantine-color-dimmed"};if(t==="white"||t==="black")return{color:t,value:t==="white"?o.white:o.black,shade:void 0,isThemeColor:!1,isLight:Mr(t==="white"?o.white:o.black,o.luminanceThreshold),variable:`--mantine-color-${t}`};const[r,s]=t.split("."),c=s?Number(s):void 0,f=r in o.colors;if(f){const d=c!==void 0?o.colors[r][c]:o.colors[r][Lr(o,a||"light")];return{color:r,value:d,shade:c,isThemeColor:f,isLight:Mr(d,o.luminanceThreshold),variable:s?`--mantine-color-${r}-${c}`:`--mantine-color-${r}-filled`}}return{color:t,value:t,isThemeColor:f,isLight:Mr(t,o.luminanceThreshold),shade:c,variable:void 0}}function bo(t,o){const a=Cl({color:t||o.primaryColor,theme:o});return a.variable?`var(${a.variable})`:t}function zd(t,o){const a={from:t?.from||o.defaultGradient.from,to:t?.to||o.defaultGradient.to,deg:t?.deg??o.defaultGradient.deg??0},r=bo(a.from,o),s=bo(a.to,o);return`linear-gradient(${a.deg}deg, ${r} 0%, ${s} 100%)`}function Ln(t,o){if(typeof t!="string"||o>1||o<0)return"rgba(0, 0, 0, 1)";if(t.startsWith("var(")){const c=(1-o)*100;return`color-mix(in srgb, ${t}, transparent ${c}%)`}if(t.startsWith("oklch"))return t.includes("/")?t.replace(/\/\s*[\d.]+\s*\)/,`/ ${o})`):t.replace(")",` / ${o})`);const{r:a,g:r,b:s}=rm(t);return`rgba(${a}, ${r}, ${s}, ${o})`}const ma=Ln,b9=({color:t,theme:o,variant:a,gradient:r,autoContrast:s})=>{const c=Cl({color:t,theme:o}),f=typeof s=="boolean"?s:o.autoContrast;if(a==="none")return{background:"transparent",hover:"transparent",color:"inherit",border:"none"};if(a==="filled"){const d=f&&c.isLight?"var(--mantine-color-black)":"var(--mantine-color-white)";return c.isThemeColor?c.shade===void 0?{background:`var(--mantine-color-${t}-filled)`,hover:`var(--mantine-color-${t}-filled-hover)`,color:d,border:`${F(1)} solid transparent`}:{background:`var(--mantine-color-${c.color}-${c.shade})`,hover:`var(--mantine-color-${c.color}-${c.shade===9?8:c.shade+1})`,color:d,border:`${F(1)} solid transparent`}:{background:t,hover:hs(t,.1),color:d,border:`${F(1)} solid transparent`}}if(a==="light"){if(c.isThemeColor){if(c.shade===void 0)return{background:`var(--mantine-color-${t}-light)`,hover:`var(--mantine-color-${t}-light-hover)`,color:`var(--mantine-color-${t}-light-color)`,border:`${F(1)} solid transparent`};const d=o.colors[c.color][c.shade];return{background:Ln(d,.1),hover:Ln(d,.12),color:`var(--mantine-color-${c.color}-${Math.min(c.shade,6)})`,border:`${F(1)} solid transparent`}}return{background:Ln(t,.1),hover:Ln(t,.12),color:t,border:`${F(1)} solid transparent`}}if(a==="outline")return c.isThemeColor?c.shade===void 0?{background:"transparent",hover:`var(--mantine-color-${t}-outline-hover)`,color:`var(--mantine-color-${t}-outline)`,border:`${F(1)} solid var(--mantine-color-${t}-outline)`}:{background:"transparent",hover:Ln(o.colors[c.color][c.shade],.05),color:`var(--mantine-color-${c.color}-${c.shade})`,border:`${F(1)} solid var(--mantine-color-${c.color}-${c.shade})`}:{background:"transparent",hover:Ln(t,.05),color:t,border:`${F(1)} solid ${t}`};if(a==="subtle"){if(c.isThemeColor){if(c.shade===void 0)return{background:"transparent",hover:`var(--mantine-color-${t}-light-hover)`,color:`var(--mantine-color-${t}-light-color)`,border:`${F(1)} solid transparent`};const d=o.colors[c.color][c.shade];return{background:"transparent",hover:Ln(d,.12),color:`var(--mantine-color-${c.color}-${Math.min(c.shade,6)})`,border:`${F(1)} solid transparent`}}return{background:"transparent",hover:Ln(t,.12),color:t,border:`${F(1)} solid transparent`}}return a==="transparent"?c.isThemeColor?c.shade===void 0?{background:"transparent",hover:"transparent",color:`var(--mantine-color-${t}-light-color)`,border:`${F(1)} solid transparent`}:{background:"transparent",hover:"transparent",color:`var(--mantine-color-${c.color}-${Math.min(c.shade,6)})`,border:`${F(1)} solid transparent`}:{background:"transparent",hover:"transparent",color:t,border:`${F(1)} solid transparent`}:a==="white"?c.isThemeColor?c.shade===void 0?{background:"var(--mantine-color-white)",hover:hs(o.white,.01),color:`var(--mantine-color-${t}-filled)`,border:`${F(1)} solid transparent`}:{background:"var(--mantine-color-white)",hover:hs(o.white,.01),color:`var(--mantine-color-${c.color}-${c.shade})`,border:`${F(1)} solid transparent`}:{background:"var(--mantine-color-white)",hover:hs(o.white,.01),color:t,border:`${F(1)} solid transparent`}:a==="gradient"?{background:zd(r,o),hover:zd(r,o),color:"var(--mantine-color-white)",border:"none"}:a==="default"?{background:"var(--mantine-color-default)",hover:"var(--mantine-color-default-hover)",color:"var(--mantine-color-default-color)",border:`${F(1)} solid var(--mantine-color-default-border)`}:{}},x9={dark:["#C9C9C9","#b8b8b8","#828282","#696969","#424242","#3b3b3b","#2e2e2e","#242424","#1f1f1f","#141414"],gray:["#f8f9fa","#f1f3f5","#e9ecef","#dee2e6","#ced4da","#adb5bd","#868e96","#495057","#343a40","#212529"],red:["#fff5f5","#ffe3e3","#ffc9c9","#ffa8a8","#ff8787","#ff6b6b","#fa5252","#f03e3e","#e03131","#c92a2a"],pink:["#fff0f6","#ffdeeb","#fcc2d7","#faa2c1","#f783ac","#f06595","#e64980","#d6336c","#c2255c","#a61e4d"],grape:["#f8f0fc","#f3d9fa","#eebefa","#e599f7","#da77f2","#cc5de8","#be4bdb","#ae3ec9","#9c36b5","#862e9c"],violet:["#f3f0ff","#e5dbff","#d0bfff","#b197fc","#9775fa","#845ef7","#7950f2","#7048e8","#6741d9","#5f3dc4"],indigo:["#edf2ff","#dbe4ff","#bac8ff","#91a7ff","#748ffc","#5c7cfa","#4c6ef5","#4263eb","#3b5bdb","#364fc7"],blue:["#e7f5ff","#d0ebff","#a5d8ff","#74c0fc","#4dabf7","#339af0","#228be6","#1c7ed6","#1971c2","#1864ab"],cyan:["#e3fafc","#c5f6fa","#99e9f2","#66d9e8","#3bc9db","#22b8cf","#15aabf","#1098ad","#0c8599","#0b7285"],teal:["#e6fcf5","#c3fae8","#96f2d7","#63e6be","#38d9a9","#20c997","#12b886","#0ca678","#099268","#087f5b"],green:["#ebfbee","#d3f9d8","#b2f2bb","#8ce99a","#69db7c","#51cf66","#40c057","#37b24d","#2f9e44","#2b8a3e"],lime:["#f4fce3","#e9fac8","#d8f5a2","#c0eb75","#a9e34b","#94d82d","#82c91e","#74b816","#66a80f","#5c940d"],yellow:["#fff9db","#fff3bf","#ffec99","#ffe066","#ffd43b","#fcc419","#fab005","#f59f00","#f08c00","#e67700"],orange:["#fff4e6","#ffe8cc","#ffd8a8","#ffc078","#ffa94d","#ff922b","#fd7e14","#f76707","#e8590c","#d9480f"]},P0="-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji",im={scale:1,fontSmoothing:!0,focusRing:"auto",white:"#fff",black:"#000",colors:x9,primaryShade:{light:6,dark:8},primaryColor:"blue",variantColorResolver:b9,autoContrast:!1,luminanceThreshold:.3,fontFamily:P0,fontFamilyMonospace:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace",respectReducedMotion:!1,cursorType:"default",defaultGradient:{from:"blue",to:"cyan",deg:45},defaultRadius:"sm",activeClassName:"mantine-active",focusClassName:"",headings:{fontFamily:P0,fontWeight:"700",textWrap:"wrap",sizes:{h1:{fontSize:F(34),lineHeight:"1.3"},h2:{fontSize:F(26),lineHeight:"1.35"},h3:{fontSize:F(22),lineHeight:"1.4"},h4:{fontSize:F(18),lineHeight:"1.45"},h5:{fontSize:F(16),lineHeight:"1.5"},h6:{fontSize:F(14),lineHeight:"1.5"}}},fontSizes:{xs:F(12),sm:F(14),md:F(16),lg:F(18),xl:F(20)},lineHeights:{xs:"1.4",sm:"1.45",md:"1.55",lg:"1.6",xl:"1.65"},radius:{xs:F(2),sm:F(4),md:F(8),lg:F(16),xl:F(32)},spacing:{xs:F(10),sm:F(12),md:F(16),lg:F(20),xl:F(32)},breakpoints:{xs:"36em",sm:"48em",md:"62em",lg:"75em",xl:"88em"},shadows:{xs:`0 ${F(1)} ${F(3)} rgba(0, 0, 0, 0.05), 0 ${F(1)} ${F(2)} rgba(0, 0, 0, 0.1)`,sm:`0 ${F(1)} ${F(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${F(10)} ${F(15)} ${F(-5)}, rgba(0, 0, 0, 0.04) 0 ${F(7)} ${F(7)} ${F(-5)}`,md:`0 ${F(1)} ${F(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${F(20)} ${F(25)} ${F(-5)}, rgba(0, 0, 0, 0.04) 0 ${F(10)} ${F(10)} ${F(-5)}`,lg:`0 ${F(1)} ${F(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${F(28)} ${F(23)} ${F(-7)}, rgba(0, 0, 0, 0.04) 0 ${F(12)} ${F(12)} ${F(-7)}`,xl:`0 ${F(1)} ${F(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${F(36)} ${F(28)} ${F(-7)}, rgba(0, 0, 0, 0.04) 0 ${F(17)} ${F(17)} ${F(-7)}`},other:{},components:{}};function Q0(t){return t==="auto"||t==="dark"||t==="light"}function S9({key:t="mantine-color-scheme-value"}={}){let o;return{get:a=>{if(typeof window>"u")return a;try{const r=window.localStorage.getItem(t);return Q0(r)?r:a}catch{return a}},set:a=>{try{window.localStorage.setItem(t,a)}catch(r){console.warn("[@mantine/core] Local storage color scheme manager was unable to save color scheme.",r)}},subscribe:a=>{o=r=>{r.storageArea===window.localStorage&&r.key===t&&Q0(r.newValue)&&a(r.newValue)},window.addEventListener("storage",o)},unsubscribe:()=>{window.removeEventListener("storage",o)},clear:()=>{window.localStorage.removeItem(t)}}}const C9="[@mantine/core] MantineProvider: Invalid theme.primaryColor, it accepts only key of theme.colors, learn more – https://mantine.dev/theming/colors/#primary-color",I0="[@mantine/core] MantineProvider: Invalid theme.primaryShade, it accepts only 0-9 integers or an object { light: 0-9, dark: 0-9 }";function hd(t){return t<0||t>9?!1:parseInt(t.toString(),10)===t}function K0(t){if(!(t.primaryColor in t.colors))throw new Error(C9);if(typeof t.primaryShade=="object"&&(!hd(t.primaryShade.dark)||!hd(t.primaryShade.light)))throw new Error(I0);if(typeof t.primaryShade=="number"&&!hd(t.primaryShade))throw new Error(I0)}function w9(t,o){if(!o)return K0(t),t;const a=tm(t,o);return o.fontFamily&&!o.headings?.fontFamily&&(a.headings.fontFamily=o.fontFamily),K0(a),a}const sm=S.createContext(null),T9=()=>S.useContext(sm)||im;function Gt(){const t=S.useContext(sm);if(!t)throw new Error("@mantine/core: MantineProvider was not found in component tree, make sure you have it in your app");return t}function Gy({theme:t,children:o,inherit:a=!0}){const r=T9(),s=S.useMemo(()=>w9(a?r:im,t),[t,r,a]);return g.jsx(sm.Provider,{value:s,children:o})}Gy.displayName="@mantine/core/MantineThemeProvider";function E9(){const t=Gt(),o=am(),a=$n(t.breakpoints).reduce((r,s)=>{const c=t.breakpoints[s].includes("px"),f=N7(t.breakpoints[s]),d=c?`${f-.1}px`:q0(f-.1),p=c?`${f}px`:q0(f);return`${r}@media (max-width: ${d}) {.mantine-visible-from-${s} {display: none !important;}}@media (min-width: ${p}) {.mantine-hidden-from-${s} {display: none !important;}}`},"");return g.jsx("style",{"data-mantine-styles":"classes",nonce:o?.(),dangerouslySetInnerHTML:{__html:a}})}function gd(t){return Object.entries(t).map(([o,a])=>`${o}: ${a};`).join("")}function Zy(t,o){const a=o?[o]:[":root",":host"],r=gd(t.variables),s=r?`${a.join(", ")}{${r}}`:"",c=gd(t.dark),f=gd(t.light),d=v=>a.map(y=>y===":host"?`${y}([data-mantine-color-scheme="${v}"])`:`${y}[data-mantine-color-scheme="${v}"]`).join(", "),p=c?`${d("dark")}{${c}}`:"",h=f?`${d("light")}{${f}}`:"";return`${s}
|
|
51
51
|
|
|
52
52
|
${p}
|
|
53
53
|
|