coursekit-lms 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +1 -1
  3. package/dist/cli/index.js +8 -4
  4. package/dist/cli/index.js.map +1 -1
  5. package/dist/server/index.js +8 -4
  6. package/dist/server/index.js.map +1 -1
  7. package/dist/types/server/config.d.ts +9 -9
  8. package/dist/types/server/context.d.ts +1 -1
  9. package/dist/types/server/db/index.d.ts +2 -4
  10. package/dist/types/server/db/types.d.ts +4 -0
  11. package/dist/types/server/index.d.ts +10 -4
  12. package/dist/types/server/seed/demo.d.ts +3 -3
  13. package/dist/types/server/services/access.d.ts +1 -1
  14. package/dist/types/server/services/courses.d.ts +1 -1
  15. package/dist/types/server/services/notify.d.ts +1 -1
  16. package/dist/types/server/services/progress.d.ts +1 -1
  17. package/dist/types/server/services/quiz.d.ts +1 -1
  18. package/dist/types/server/services/settings.d.ts +1 -1
  19. package/dist/types/server/services/users.d.ts +5 -5
  20. package/dist/web/assets/{ActivityEditor-LKK0d5Mb.js → ActivityEditor-BVSZUV8l.js} +1 -1
  21. package/dist/web/assets/{ActivityPage-BhRtXLwW.js → ActivityPage-DPmSV_mU.js} +1 -1
  22. package/dist/web/assets/{AdminCoursesPage-BT9AQTuZ.js → AdminCoursesPage-uaSHNtzf.js} +1 -1
  23. package/dist/web/assets/{AdminLayout-ChXLxrl_.js → AdminLayout-DqoShZGn.js} +1 -1
  24. package/dist/web/assets/{AdminOverviewPage-BGsUzMXN.js → AdminOverviewPage-DnTrdGbr.js} +1 -1
  25. package/dist/web/assets/{AdminSettingsPage-B4ZeIbVO.js → AdminSettingsPage-B82cX8xU.js} +1 -1
  26. package/dist/web/assets/{AdminUsersPage-BmBSnct8.js → AdminUsersPage-3d2F9AEl.js} +1 -1
  27. package/dist/web/assets/{AnnouncementsPage-KJUA3o7v.js → AnnouncementsPage-BKW30k0Z.js} +1 -1
  28. package/dist/web/assets/{CalendarPage-DQdBEQN-.js → CalendarPage-CLRWyTNT.js} +1 -1
  29. package/dist/web/assets/{CatalogPage-CIFyefBY.js → CatalogPage-BiMgSSBR.js} +1 -1
  30. package/dist/web/assets/{CourseContentPage-CZEP3VMH.js → CourseContentPage-BIDH0UbG.js} +1 -1
  31. package/dist/web/assets/{CourseLayout-CwpWuS7V.js → CourseLayout-ql01LEmj.js} +1 -1
  32. package/dist/web/assets/{CourseSettingsPage-DwEIXO2s.js → CourseSettingsPage-CReoPqOa.js} +1 -1
  33. package/dist/web/assets/{CreateCoursePage-BDfIRStx.js → CreateCoursePage-DFCHlq5M.js} +1 -1
  34. package/dist/web/assets/{DiscussionPage-Dyt0qgUe.js → DiscussionPage-CWwVpFQV.js} +1 -1
  35. package/dist/web/assets/{GradesPage-Brj-Wqu1.js → GradesPage-Bu5vphcG.js} +1 -1
  36. package/dist/web/assets/{MyCoursesPage-GCdSHlYs.js → MyCoursesPage-Dd-Oaygv.js} +1 -1
  37. package/dist/web/assets/{NotFoundPage-CJIpDg1F.js → NotFoundPage-BRquC7-l.js} +1 -1
  38. package/dist/web/assets/{NotificationsPage-Y3shIm5z.js → NotificationsPage-LJvqb6Dj.js} +1 -1
  39. package/dist/web/assets/{ParticipantsPage-OHnKj_8Z.js → ParticipantsPage-wFxiphna.js} +1 -1
  40. package/dist/web/assets/{ProfilePage-Dgj-HYPS.js → ProfilePage-CzfhacAX.js} +1 -1
  41. package/dist/web/assets/{QuizAttemptPage-CiW3E3K0.js → QuizAttemptPage-CEAV6wAL.js} +1 -1
  42. package/dist/web/assets/{QuizEditorPage-bT0jpSFE.js → QuizEditorPage-DS_czQVM.js} +1 -1
  43. package/dist/web/assets/{SubmissionsPage-DXZGSqup.js → SubmissionsPage-CQjcx09G.js} +1 -1
  44. package/dist/web/assets/{context-B5ZaAO90.js → context-BLVW7NB7.js} +1 -1
  45. package/dist/web/assets/{frame-BjgJqbS9.js → frame-CGabirLa.js} +1 -1
  46. package/dist/web/assets/{index-DkBZ18Ts.js → index-B29bTBiJ.js} +2 -2
  47. package/dist/web/assets/{markdown-C1oaAmMK.js → markdown-ykrkPMbn.js} +1 -1
  48. package/dist/web/index.html +1 -1
  49. package/package.json +8 -5
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MyCoursesPage-GCdSHlYs.js","assets/hooks-BBARn-DA.js","assets/misc-DvgDEI3I.js","assets/CatalogPage-CIFyefBY.js","assets/chevron-left-D6IMQD6N.js","assets/CalendarPage-DQdBEQN-.js","assets/NotificationsPage-Y3shIm5z.js","assets/ProfilePage-Dgj-HYPS.js","assets/key-round-B_KI-brR.js","assets/CreateCoursePage-BDfIRStx.js","assets/CourseSettingsPage-DwEIXO2s.js","assets/constants-DLDWTvvN.js","assets/markdown-C1oaAmMK.js","assets/context-B5ZaAO90.js","assets/CourseLayout-CwpWuS7V.js","assets/lock-BjbqwA_0.js","assets/pencil-p0GQmIMo.js","assets/settings-DRKWzSHN.js","assets/NotFoundPage-CJIpDg1F.js","assets/CourseContentPage-CZEP3VMH.js","assets/arrow-up-LHDup5m4.js","assets/ActivityEditor-LKK0d5Mb.js","assets/ellipsis-c2POIN-Y.js","assets/AnnouncementsPage-KJUA3o7v.js","assets/send-mxSHcdcD.js","assets/ParticipantsPage-OHnKj_8Z.js","assets/ban-D3Vsxg_g.js","assets/GradesPage-Brj-Wqu1.js","assets/message-square-text-fe24gbEU.js","assets/ActivityPage-BhRtXLwW.js","assets/trophy-Cch2iF1m.js","assets/frame-BjgJqbS9.js","assets/pin-DlYC3uec.js","assets/SubmissionsPage-DXZGSqup.js","assets/QuizEditorPage-bT0jpSFE.js","assets/copy-Bxxjq6zo.js","assets/QuizAttemptPage-CiW3E3K0.js","assets/DiscussionPage-Dyt0qgUe.js","assets/AdminLayout-ChXLxrl_.js","assets/library-3WG9oLCb.js","assets/AdminOverviewPage-BGsUzMXN.js","assets/AdminUsersPage-BmBSnct8.js","assets/AdminCoursesPage-BT9AQTuZ.js","assets/AdminSettingsPage-B4ZeIbVO.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MyCoursesPage-Dd-Oaygv.js","assets/hooks-BBARn-DA.js","assets/misc-DvgDEI3I.js","assets/CatalogPage-BiMgSSBR.js","assets/chevron-left-D6IMQD6N.js","assets/CalendarPage-CLRWyTNT.js","assets/NotificationsPage-LJvqb6Dj.js","assets/ProfilePage-CzfhacAX.js","assets/key-round-B_KI-brR.js","assets/CreateCoursePage-DFCHlq5M.js","assets/CourseSettingsPage-CReoPqOa.js","assets/constants-DLDWTvvN.js","assets/markdown-ykrkPMbn.js","assets/context-BLVW7NB7.js","assets/CourseLayout-ql01LEmj.js","assets/lock-BjbqwA_0.js","assets/pencil-p0GQmIMo.js","assets/settings-DRKWzSHN.js","assets/NotFoundPage-BRquC7-l.js","assets/CourseContentPage-BIDH0UbG.js","assets/arrow-up-LHDup5m4.js","assets/ActivityEditor-BVSZUV8l.js","assets/ellipsis-c2POIN-Y.js","assets/AnnouncementsPage-BKW30k0Z.js","assets/send-mxSHcdcD.js","assets/ParticipantsPage-wFxiphna.js","assets/ban-D3Vsxg_g.js","assets/GradesPage-Bu5vphcG.js","assets/message-square-text-fe24gbEU.js","assets/ActivityPage-DPmSV_mU.js","assets/trophy-Cch2iF1m.js","assets/frame-CGabirLa.js","assets/pin-DlYC3uec.js","assets/SubmissionsPage-CQjcx09G.js","assets/QuizEditorPage-DS_czQVM.js","assets/copy-Bxxjq6zo.js","assets/QuizAttemptPage-CEAV6wAL.js","assets/DiscussionPage-CWwVpFQV.js","assets/AdminLayout-DqoShZGn.js","assets/library-3WG9oLCb.js","assets/AdminOverviewPage-DnTrdGbr.js","assets/AdminUsersPage-3d2F9AEl.js","assets/AdminCoursesPage-uaSHNtzf.js","assets/AdminSettingsPage-B82cX8xU.js"])))=>i.map(i=>d[i]);
2
2
  import{$ as e,A as t,B as n,C as r,D as i,E as a,G as o,H as s,I as c,J as l,K as u,L as d,R as f,S as p,U as m,W as h,X as g,Y as _,Z as v,_ as y,a as b,at as x,c as S,ct as C,d as w,dt as T,et as E,f as D,ft as O,g as k,h as A,it as j,j as M,l as N,lt as ee,m as P,mt as te,nt as ne,o as F,ot as re,p as ie,pt as ae,q as oe,r as se,rt as ce,s as le,st as ue,t as de,tt as fe,ut as I,v as L,x as pe,z as me}from"./hooks-BBARn-DA.js";import{C as he,E as ge,S as R,T as _e,_ as z,a as ve,b as ye,c as be,d as xe,f as Se,g as Ce,h as we,i as Te,l as Ee,m as De,n as Oe,p as ke,r as Ae,t as je,u as Me,v as B,w as Ne,x as Pe,y as Fe}from"./misc-DvgDEI3I.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var Ie=class extends oe{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Le(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.#n.has(this)&&this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=o({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}this.state.isPaused&&r.canStart()&&t();let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),l.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Le(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Re=class extends C{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new Ie({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=ze(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){e.destroy();let t=ze(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}has(e){return this.#e.has(e)}canRun(e){let t=ze(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=ze(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){l.batch(()=>{let e=this.getAll();this.#e.clear(),this.#t.clear(),e.forEach(e=>e.destroy()),e.forEach(e=>{this.notify({type:`removed`,mutation:e})})})}getAll(){return Array.from(this.#e)}find(t){let n={exact:!0,...t};return this.getAll().find(t=>e(n,t))}findAll(t={}){return this.getAll().filter(n=>e(t,n))}notify(e){l.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return l.batch(()=>Promise.all(e.map(e=>e.continue().catch(fe))))}};function ze(e){return e.options.scope?.id}var Be=class extends C{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),j(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&g(t.mutationKey)!==g(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??Le();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){l.batch(()=>{let t=this.#r;if(t&&this.hasListeners()){let n=this.#t.variables,r=this.#t.context,i={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{t.onSuccess?.(e.data,n,r,i)}catch(e){Promise.reject(e)}try{t.onSettled?.(e.data,null,n,r,i)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{t.onError?.(e.error,n,r,i)}catch(e){Promise.reject(e)}try{t.onSettled?.(void 0,e.error,n,r,i)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},Ve=class extends C{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??v(r,t),a=this.get(i);return a||(a=new h({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){this.#e.get(e.queryHash)===e&&(e.destroy(),this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){l.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>E(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>E(e,t)):t}notify(e){l.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){l.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){l.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},He=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Ve,this.#t=e.mutationCache||new Re,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=ue.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=u.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(ce(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=_(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return l.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;l.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return l.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=l.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(fe).catch(fe)}invalidateQueries(e,t={}){return l.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=l.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n),r=e.state.fetchStatus===`paused`;return(!n.throwOnError||r)&&(t=t.catch(fe)),r?Promise.resolve():t}));return Promise.all(r).then(fe)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(ce(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(ce(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(fe).catch(fe)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(fe).catch(fe)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return u.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(g(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{ne(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(g(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{ne(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=v(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===re&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},V=te(O(),1);function Ue(e,t){let n=I(t),[r]=V.useState(()=>new Be(n,e));V.useEffect(()=>{r.setOptions(e)},[r,e]);let i=V.useSyncExternalStore(V.useCallback(e=>r.subscribe(l.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=V.useCallback((...e)=>{r.mutate(e[0],e[1]).catch(fe)},[r]);if(i.error&&x(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var We=ae((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Ge=ae(((e,t)=>{t.exports=We()})),Ke=ae((e=>{var t=Ge(),n=O(),r=ge();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){for(var t=e,n=t;n&&!n.alternate;)t=n,t.flags&4098&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}function f(e,t,n,r,i,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,r,i,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&f(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function p(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function m(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),e.tag!==3&&e.tag!==5&&e.tag!==27);)e=e.return;return t}function h(e){var t=[null,null],n=p(e);return n===null||g(t,e,n.child,{foundSelf:!1}),t}function g(e,t,n,r){for(;n!==null;){if(n===t)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&g(e,t,n.child,r))return!0;n=n.sibling}return!1}function _(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(i(559))}}var v=null,y=null;function b(e,t,n){return e===n||e===t&&(v=e,!0)}function x(e,t,n){return e===n?(y=e,!1):e===t&&(y!==null&&(v=e),!0)}function S(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function C(e,t,n){for(var r=0,i=e;i;i=n(i))r++;i=0;for(var a=t;a;a=n(a))i++;for(;0<r-i;)e=n(e),r--;for(;0<i-r;)t=n(t),i--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var w=Object.assign,T=Symbol.for(`react.element`),E=Symbol.for(`react.transitional.element`),D=Symbol.for(`react.portal`),k=Symbol.for(`react.fragment`),A=Symbol.for(`react.strict_mode`),j=Symbol.for(`react.profiler`),M=Symbol.for(`react.consumer`),N=Symbol.for(`react.context`),ee=Symbol.for(`react.forward_ref`),P=Symbol.for(`react.suspense`),te=Symbol.for(`react.suspense_list`),ne=Symbol.for(`react.memo`),F=Symbol.for(`react.lazy`),re=Symbol.for(`react.activity`),ie=Symbol.for(`react.legacy_hidden`),ae=Symbol.for(`react.memo_cache_sentinel`),oe=Symbol.for(`react.view_transition`),se=Symbol.for(`react.recoverable`),ce=Symbol.iterator;function le(e){return typeof e!=`object`||!e?null:(e=ce&&e[ce]||e[`@@iterator`],typeof e==`function`?e:null)}var ue=Symbol.for(`react.client.reference`);function de(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===ue?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case k:return`Fragment`;case j:return`Profiler`;case A:return`StrictMode`;case P:return`Suspense`;case te:return`SuspenseList`;case re:return`Activity`;case oe:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case D:return`Portal`;case N:return e.displayName||`Context`;case M:return(e._context.displayName||`Context`)+`.Consumer`;case ee:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case ne:return t=e.displayName||null,t===null?de(e.type)||`Memo`:t;case F:t=e._payload,e=e._init;try{return de(e(t))}catch{}}return null}var fe=Array.isArray,I=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,pe={pending:!1,data:null,method:null,action:null},me=[],he=-1;function R(e){return{current:e}}function _e(e){0>he||(e.current=me[he],me[he]=null,he--)}function z(e,t){he++,me[he]=e.current,e.current=t}var ve=R(null),ye=R(null),be=R(null),xe=R(null);function Se(e,t){switch(z(be,t),z(ye,e),z(ve,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?dp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=dp(t),e=fp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}_e(ve),z(ve,e)}function Ce(){_e(ve),_e(ye),_e(be)}function we(e){var t=e.memoizedState;t!==null&&(sh._currentValue=t.memoizedState,z(xe,e)),t=ve.current;var n=fp(t,e.type);t!==n&&(z(ye,e),z(ve,n))}function Te(e){ye.current===e&&(_e(ve),_e(ye)),xe.current===e&&(_e(xe),sh._currentValue=pe)}var Ee,De;function Oe(e){if(Ee===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Ee=t&&t[1]||``,De=-1<e.stack.indexOf(`
3
3
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
4
  `+Ee+e+De}var ke=!1;function Ae(e,t){if(!e||ke)return``;ke=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}n=!1;try{var i=Object.getOwnPropertyDescriptor(e.prototype,`props`);Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),n=!0,new e}finally{n&&(i===void 0?delete e.prototype.props:Object.defineProperty(e.prototype,"props",i))}}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
@@ -47,4 +47,4 @@ Error generating stack: `+e.message+`
47
47
  `},Sl=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},Cl=function(){V.useEffect(function(){return document.body.setAttribute(bl,(Sl()+1).toString()),function(){var e=Sl()-1;e<=0?document.body.removeAttribute(bl):document.body.setAttribute(bl,e.toString())}},[])},wl=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;Cl();var a=V.useMemo(function(){return vl(i)},[i]);return V.createElement(yl,{styles:xl(a,!t,i,n?``:`!important`)})},Tl=!1;if(typeof window<`u`)try{var El=Object.defineProperty({},"passive",{get:function(){return Tl=!0,!0}});window.addEventListener(`test`,El,El),window.removeEventListener(`test`,El,El)}catch{Tl=!1}var Dl=Tl?{passive:!1}:!1,Ol=function(e){return e.tagName===`TEXTAREA`},kl=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!Ol(e)&&n[t]===`visible`)},Al=function(e){return kl(e,`overflowY`)},jl=function(e){return kl(e,`overflowX`)},Ml=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),Fl(e,r)){var i=Il(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Nl=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},Pl=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},Fl=function(e,t){return e===`v`?Al(t):jl(t)},Il=function(e,t){return e===`v`?Nl(t):Pl(t)},Ll=function(e,t){return e===`h`&&t===`rtl`?-1:1},Rl=function(e,t,n,r,i){var a=Ll(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=Il(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&Fl(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},zl=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Bl=function(e){return[e.deltaX,e.deltaY]},Vl=function(e){return e&&`current`in e?e.current:e},Hl=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Ul=function(e){return`
48
48
  .block-interactivity-${e} {pointer-events: none;}
49
49
  .allow-interactivity-${e} {pointer-events: all;}
50
- `},Wl=0,Gl=[];function Kl(e){var t=V.useRef([]),n=V.useRef([0,0]),r=V.useRef(),i=V.useState(Wl++)[0],a=V.useState(ml)[0],o=V.useRef(e);V.useEffect(function(){o.current=e},[e]),V.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Wc([e.lockRef.current],(e.shards||[]).map(Vl),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=V.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=zl(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=Ml(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Ml(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return Rl(h,t,e,h===`h`?s:c,!0)},[]),c=V.useCallback(function(e){var n=e;if(Gl.length&&Gl[Gl.length-1]===a){var r=`deltaY`in n?Bl(n):zl(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Hl(e.delta,r)})[0];if(i&&i.should)n.cancelable&&n.preventDefault();else if(!i){var c=(o.current.shards||[]).map(Vl).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=V.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:ql(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=V.useCallback(function(e){n.current=zl(e),r.current=void 0},[]),d=V.useCallback(function(t){l(t.type,Bl(t),t.target,s(t,e.lockRef.current))},[]),f=V.useCallback(function(t){l(t.type,zl(t),t.target,s(t,e.lockRef.current))},[]);V.useEffect(function(){return Gl.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,Dl),document.addEventListener(`touchmove`,c,Dl),document.addEventListener(`touchstart`,u,Dl),function(){Gl=Gl.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,Dl),document.removeEventListener(`touchmove`,c,Dl),document.removeEventListener(`touchstart`,u,Dl)}},[]);var p=e.removeScrollBar,m=e.inert;return V.createElement(V.Fragment,null,m?V.createElement(a,{styles:Ul(i)}):null,p?V.createElement(wl,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function ql(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Jl=il(al,Kl),Yl=V.forwardRef(function(e,t){return V.createElement(sl,Hc({},e,{ref:t,sideCar:Jl}))});Yl.classNames=sl.classNames;var Xl=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Zl=new WeakMap,Ql=new WeakMap,$l={},eu=0,tu=function(e){return e&&(e.host||tu(e.parentNode))},nu=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=tu(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},q=function(e,t,n,r){var i=nu(t,Array.isArray(e)?e:[e]);$l[n]||($l[n]=new WeakMap);var a=$l[n],o=[],s=new Set,c=new Set(i),l=function(e){e&&!s.has(e)&&(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){e&&!c.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(Zl.get(e)||0)+1,l=(a.get(e)||0)+1;Zl.set(e,c),a.set(e,l),o.push(e),c===1&&i&&Ql.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),eu++,function(){o.forEach(function(e){var t=Zl.get(e)-1,i=a.get(e)-1;Zl.set(e,t),a.set(e,i),t||(Ql.has(e)||e.removeAttribute(r),Ql.delete(e)),i||e.removeAttribute(n)}),eu--,eu||(Zl=new WeakMap,Zl=new WeakMap,Ql=new WeakMap,$l={})}},ru=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Xl(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),q(r,i,n,`aria-hidden`)):function(){return null}},iu=Object.defineProperty,au=(e,t)=>iu(e,`name`,{value:t,configurable:!0}),ou=`Dialog`,[su,cu]=Pe(ou),[lu,uu]=su(ou),du=au(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=V.useRef(null),c=V.useRef(null),{nodes:l,registry:u}=yc(),[d,f]=z({prop:r,defaultProp:i??!1,onChange:a,caller:ou}),[p,m]=V.useState(0),[h,g]=V.useState(0);return(0,K.jsx)(lu,{scope:t,triggerRef:s,contentRef:c,contentId:we(),titleId:we(),descriptionId:we(),titlePresent:p>0,descriptionPresent:h>0,setTitleCount:m,setDescriptionCount:g,open:d,onOpenChange:f,onOpenToggle:V.useCallback(()=>f(e=>!e),[f]),modal:o,branchNodes:l,branchRegistry:u,children:n})},`Dialog`),fu=`DialogTrigger`,pu=V.forwardRef(au(function(e,t){let{__scopeDialog:r,...i}=e,a=uu(fu,r),o=n(t,a.triggerRef);return(0,K.jsx)(R.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":Mu(a.open),...i,ref:o,onClick:B(e.onClick,a.onOpenToggle)})},`DialogTrigger`)),mu=`DialogPortal`,[hu,gu]=su(mu,{forceMount:void 0}),_u=au(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=uu(mu,t);return(0,K.jsx)(hu,{scope:t,forceMount:n,children:V.Children.map(r,e=>(0,K.jsx)(Ce,{present:n||a.open,children:(0,K.jsx)(Pc,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),vu=`DialogOverlay`,yu=V.forwardRef(au(function(e,t){let n=gu(vu,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=uu(vu,e.__scopeDialog);return a.modal?(0,K.jsx)(Ce,{present:r||a.open,children:(0,K.jsx)(xu,{...i,ref:t})}):null},`DialogOverlay`)),bu=d(`DialogOverlay.RemoveScroll`),xu=V.forwardRef(au(function(e,t){let{__scopeDialog:r,...i}=e,a=uu(vu,r),o=ac(),s=n(t,o);return(0,K.jsx)(Yl,{as:bu,allowPinchZoom:!0,shards:V.useMemo(()=>[a.contentRef,...a.branchNodes.map(e=>({current:e}))],[a.contentRef,a.branchNodes]),children:(0,K.jsx)(R.div,{"data-state":Mu(a.open),...i,ref:s,style:{pointerEvents:`auto`,...i.style}})})},`DialogOverlayImpl`)),Su=`DialogContent`,Cu=V.forwardRef(au(function(e,t){let n=gu(Su,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=uu(Su,e.__scopeDialog);return(0,K.jsx)(Ce,{present:r||a.open,children:a.modal?(0,K.jsx)(wu,{...i,ref:t}):(0,K.jsx)(Tu,{...i,ref:t})})},`DialogContent`)),wu=V.forwardRef(au(function(e,t){let r=uu(Su,e.__scopeDialog),i=V.useRef(null),a=n(t,r.contentRef,i);return V.useEffect(()=>{let e=i.current;if(e)return ru(e)},[]),(0,K.jsx)(Eu,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:r.open,onCloseAutoFocus:B(e.onCloseAutoFocus,e=>{e.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:B(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:B(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),Tu=V.forwardRef(au(function(e,t){let n=uu(Su,e.__scopeDialog),r=V.useRef(!1),i=V.useRef(!1);return(0,K.jsx)(Eu,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),Eu=V.forwardRef(au(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,"aria-describedby":o,children:s,...c}=e,l=uu(Su,n);return Bc(),(0,K.jsx)(vc,{registry:l.branchRegistry,children:(0,K.jsx)(gc,{asChild:!0,loop:!0,trapped:r,branches:l.branchNodes,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,K.jsx)(ic,{role:`dialog`,id:l.contentId,"aria-labelledby":l.titlePresent?l.titleId:void 0,"aria-describedby":l.descriptionPresent?ju(o,l.descriptionId):o,"data-state":Mu(l.open),...c,ref:t,deferPointerDownOutside:!0,onDismiss:()=>l.onOpenChange(!1),children:s})})})},`DialogContentImpl`)),Du=V.forwardRef(au(function(e,t){let{__scopeDialog:n,...r}=e,i=uu(`DialogTitle`,n),{setTitleCount:a}=i;return ye(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,K.jsx)(R.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),Ou=V.forwardRef(au(function(e,t){let{__scopeDialog:n,...r}=e,i=uu(`DialogDescription`,n),{setDescriptionCount:a}=i;return ye(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,K.jsx)(R.p,{id:i.descriptionId,...r,ref:t})},`DialogDescription`)),ku=`DialogClose`,Au=V.forwardRef(au(function(e,t){let{__scopeDialog:n,...r}=e,i=uu(ku,n);return(0,K.jsx)(R.button,{type:`button`,...r,ref:t,onClick:B(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function ju(...e){let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of String(n).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(` `):void 0}au(ju,`concatAriaDescribedby`);function Mu(e){return e?`open`:`closed`}au(Mu,`getState`);var Nu=Object.defineProperty,Pu=(e,t)=>Nu(e,`name`,{value:t,configurable:!0}),[Fu,Iu]=Pe(`AlertDialog`,[cu]),Lu=cu(),Ru=Pu(e=>{let{__scopeAlertDialog:t,...n}=e,r=Lu(t);return(0,K.jsx)(du,{...r,...n,modal:!0})},`AlertDialog`);V.forwardRef(Pu(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Lu(n);return(0,K.jsx)(pu,{...i,...r,ref:t})},`AlertDialogTrigger`));var zu=Pu(e=>{let{__scopeAlertDialog:t,...n}=e,r=Lu(t);return(0,K.jsx)(_u,{...r,...n})},`AlertDialogPortal`),Bu=V.forwardRef(Pu(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Lu(n);return(0,K.jsx)(yu,{...i,...r,ref:t})},`AlertDialogOverlay`)),[Vu,Hu]=Fu(`AlertDialogContent`),Uu=V.forwardRef(Pu(function(e,t){let{__scopeAlertDialog:r,children:i,...a}=e,o=Lu(r),s=V.useRef(null),c=n(t,s),l=V.useRef(null);return(0,K.jsx)(Vu,{scope:r,cancelRef:l,children:(0,K.jsx)(Cu,{role:`alertdialog`,...o,...a,ref:c,onOpenAutoFocus:B(a.onOpenAutoFocus,e=>{e.preventDefault(),l.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:i})})},`AlertDialogContent`)),Wu=V.forwardRef(Pu(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Lu(n);return(0,K.jsx)(Du,{...i,...r,ref:t})},`AlertDialogTitle`)),Gu=V.forwardRef(Pu(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Lu(n);return(0,K.jsx)(Ou,{...i,...r,ref:t})},`AlertDialogDescription`)),Ku=V.forwardRef(Pu(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Lu(n);return(0,K.jsx)(Au,{...i,...r,ref:t})},`AlertDialogAction`)),qu=`AlertDialogCancel`,Ju=V.forwardRef(Pu(function(e,t){let{__scopeAlertDialog:r,...i}=e,{cancelRef:a}=Hu(qu,r),o=Lu(r),s=n(t,a);return(0,K.jsx)(Au,{...o,...i,ref:s})},`AlertDialogCancel`)),Yu=Object.defineProperty,Xu=(e,t)=>Yu(e,`name`,{value:t,configurable:!0});function Zu(e){let[t,n]=V.useState(void 0);return ye(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=0,r=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;let i=r[0];window.cancelAnimationFrame(t),t=window.requestAnimationFrame(()=>{let t,r;if(`borderBoxSize`in i){let e=i.borderBoxSize,n=Array.isArray(e)?e[0]:e;t=n.inlineSize,r=n.blockSize}else t=e.offsetWidth,r=e.offsetHeight;n({width:t,height:r})})});return r.observe(e,{box:`border-box`}),()=>{window.cancelAnimationFrame(t),r.unobserve(e)}}n(void 0)},[e]),t}Xu(Zu,`useSize`);var J=Object.defineProperty,Y=(e,t)=>J(e,`name`,{value:t,configurable:!0}),X=`Checkbox`,[Z,Qu]=Pe(X),[$u,ed]=Z(X);function td(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=z({prop:n,defaultProp:i??!1,onChange:c,caller:X}),[m,h]=V.useState(null),[g,_]=V.useState(null),[v,y]=V.useState(null),b=!m||!!o||!!m.closest(`form`),x={checked:f,disabled:a,setChecked:p,control:m,setControl:h,name:s,form:o,value:u,userClick:v,onUserClick:y,required:l,defaultChecked:!ud(i)&&i,isFormControl:b,bubbleInput:g,setBubbleInput:_};return(0,K.jsx)($u,{scope:t,...x,children:ld(d)?d(x):r})}Y(td,`CheckboxProvider`);var nd=`CheckboxTrigger`,rd=V.forwardRef(Y(function({__scopeCheckbox:e,onKeyDown:t,onClick:r,...i},a){let{control:o,value:s,disabled:c,checked:l,required:u,setControl:d,setChecked:f,onUserClick:p,isFormControl:m,bubbleInput:h}=ed(nd,e),g=n(a,d),_=V.useRef(l);return V.useEffect(()=>{let e=o?.form;if(e){let t=Y(()=>f(_.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[o,f]),(0,K.jsx)(R.button,{type:`button`,role:`checkbox`,"aria-checked":ud(l)?`mixed`:l,"aria-required":u,"data-state":dd(l),"data-disabled":c?``:void 0,disabled:c,value:s,...i,ref:g,onKeyDown:B(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:B(r,e=>{let t=e.isPropagationStopped();p({requestedChecked:ud(l)?!0:!l,hasConsumerStoppedPropagation:t}),f(e=>ud(e)?!0:!e),h&&m&&(t||e.stopPropagation())})})},`CheckboxTrigger`)),id=V.forwardRef(Y(function(e,t){let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,K.jsx)(td,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(rd,{...d,ref:t,__scopeCheckbox:n}),e&&(0,K.jsx)(cd,{__scopeCheckbox:n})]})})},`Checkbox`)),ad=`CheckboxIndicator`,od=V.forwardRef(Y(function(e,t){let{__scopeCheckbox:n,forceMount:r,...i}=e,a=ed(ad,n);return(0,K.jsx)(Ce,{present:r||ud(a.checked)||a.checked===!0,children:(0,K.jsx)(R.span,{"data-state":dd(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})},`CheckboxIndicator`)),sd=`CheckboxBubbleInput`,cd=V.forwardRef(Y(function({__scopeCheckbox:e,onClick:t,...r},i){let{control:a,userClick:o,checked:s,defaultChecked:c,required:l,disabled:u,name:d,value:f,form:p,bubbleInput:m,setBubbleInput:h}=ed(sd,e),g=n(i,h),_=Zu(a),v=V.useRef(!1),y=V.useRef(s),b=V.useRef(o),x=V.useRef(null);V.useEffect(()=>{let e=m;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set;if(!n)return;let r=y.current!==s;y.current=s;let i=o!==null&&o!==b.current;if(b.current=o,i)x.current=r?null:o,r&&(e.indeterminate=ud(s),n.call(e,!ud(s)&&s)),e.dispatchEvent(new Event(`click`,{bubbles:!o.hasConsumerStoppedPropagation}));else if(r){let t=x.current;x.current=null;let r=t?.requestedChecked===s;v.current=!0,e.indeterminate=ud(s),n.call(e,!ud(s)&&s),e.dispatchEvent(new Event(`click`,{bubbles:!(r&&t.hasConsumerStoppedPropagation)})),v.current=!1}},[m,s,o]);let S=V.useRef(!ud(s)&&s);return(0,K.jsx)(R.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:c??S.current,required:l,disabled:u,name:d,value:f,form:p,...r,tabIndex:-1,ref:g,onClick:B(t,e=>{v.current&&e.stopPropagation()}),style:{...r.style,..._,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`CheckboxBubbleInput`));function ld(e){return typeof e==`function`}Y(ld,`isFunction`);function ud(e){return e===`indeterminate`}Y(ud,`isIndeterminate`);function dd(e){return ud(e)?`indeterminate`:e?`checked`:`unchecked`}Y(dd,`getState`);var fd=[`top`,`right`,`bottom`,`left`],pd=Math.min,md=Math.max,hd=Math.round,gd=Math.floor,_d=e=>({x:e,y:e}),vd={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function yd(e,t,n){return md(e,pd(t,n))}function bd(e,t){return typeof e==`function`?e(t):e}function xd(e){return e.split(`-`)[0]}function Sd(e){return e.split(`-`)[1]}function Cd(e){return e===`x`?`y`:`x`}function wd(e){return e===`y`?`height`:`width`}function Td(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Ed(e){return Cd(Td(e))}function Dd(e,t,n){n===void 0&&(n=!1);let r=Sd(e),i=Ed(e),a=wd(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Id(o)),[o,Id(o)]}function Od(e){let t=Id(e);return[kd(e),t,kd(t)]}function kd(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Ad=[`left`,`right`],jd=[`right`,`left`],Md=[`top`,`bottom`],Nd=[`bottom`,`top`];function Pd(e,t,n){switch(e){case`top`:case`bottom`:return n?t?jd:Ad:t?Ad:jd;case`left`:case`right`:return t?Md:Nd;default:return[]}}function Fd(e,t,n,r){let i=Sd(e),a=Pd(xd(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(kd)))),a}function Id(e){let t=xd(e);return vd[t]+e.slice(t.length)}function Ld(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function Rd(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Ld(e)}function zd(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Bd(e,t,n){let{reference:r,floating:i}=e,a=Td(t),o=Ed(t),s=wd(o),c=xd(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=Sd(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function Vd(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=bd(t,e),p=Rd(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=zd(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=zd(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Hd=50,Ud=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Vd},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Bd(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<Hd&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=Bd(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Wd=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=bd(e,t)||{};if(l==null)return{};let d=Rd(u),f={x:n,y:r},p=Ed(i),m=wd(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;C&&await(o.isElement==null?void 0:o.isElement(S))||(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=pd(d[_],T),D=pd(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=yd(E,k,O),j=!c.arrow&&Sd(i)!=null&&k!==A&&a.reference[m]/2-(k<E?E:D)-h[m]/2<0,M=j?k<E?k-E:k-O:0;return{[p]:f[p]+M,data:{[p]:A,centerOffset:k-A-M,...j&&{alignmentOffset:M}},reset:j}}}),Gd=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=bd(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=xd(r),_=Td(o),v=xd(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Id(o)]:Od(o)),x=p!==`none`;!d&&x&&b.push(...Fd(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Dd(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===Td(t)||T.every(e=>Td(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Td(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}};function Kd(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function qd(e){return fd.some(t=>e[t]>=0)}var Jd=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=bd(e,t);switch(i){case`referenceHidden`:{let e=Kd(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:qd(e)}}}case`escaped`:{let e=Kd(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:qd(e)}}}default:return{}}}}},Yd=new Set([`left`,`top`]);async function Xd(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=xd(n),s=Sd(n),c=Td(n)===`y`,l=Yd.has(o)?-1:1,u=a&&c?-1:1,d=bd(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Zd=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Xd(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Qd=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=bd(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Td(i),p=Cd(f),m=u[p],h=u[f],g=(e,t)=>yd(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},$d=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=bd(e,t),u={x:n,y:r},d=Td(i),f=Cd(d),p=u[f],m=u[d],h=bd(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Yd.has(xd(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},ef=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=bd(e,t),c=await i.detectOverflow(t,s),l=xd(n),u=Sd(n),d=Td(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=pd(p-c[m],g),y=pd(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*md(c.left,c.right):S=p-2*md(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function tf(){return typeof window<`u`}function nf(e){return of(e)?(e.nodeName||``).toLowerCase():`#document`}function rf(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function af(e){return((of(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function of(e){return tf()?e instanceof Node||e instanceof rf(e).Node:!1}function sf(e){return tf()?e instanceof Element||e instanceof rf(e).Element:!1}function cf(e){return tf()?e instanceof HTMLElement||e instanceof rf(e).HTMLElement:!1}function lf(e){return!tf()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof rf(e).ShadowRoot}function uf(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=xf(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function df(e){return/^(table|td|th)$/.test(nf(e))}function ff(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var pf=/transform|translate|scale|rotate|perspective|filter/,mf=/paint|layout|strict|content/,hf=e=>!!e&&e!==`none`,gf;function _f(e){let t=sf(e)?xf(e):e;return hf(t.transform)||hf(t.translate)||hf(t.scale)||hf(t.rotate)||hf(t.perspective)||!yf()&&(hf(t.backdropFilter)||hf(t.filter))||pf.test(t.willChange||``)||mf.test(t.contain||``)}function vf(e){let t=Cf(e);for(;cf(t)&&!bf(t);){if(_f(t))return t;if(ff(t))return null;t=Cf(t)}return null}function yf(){return gf??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),gf}function bf(e){return/^(html|body|#document)$/.test(nf(e))}function xf(e){return rf(e).getComputedStyle(e)}function Sf(e){return sf(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Cf(e){if(nf(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||lf(e)&&e.host||af(e);return lf(t)?t.host:t}function wf(e){let t=Cf(e);return bf(t)?(e.ownerDocument||e).body:cf(t)&&uf(t)?t:wf(t)}function Tf(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=wf(e),i=r===e.ownerDocument?.body,a=rf(r);if(i){let e=Ef(a);return t.concat(a,a.visualViewport||[],uf(r)?r:[],e&&n?Tf(e):[])}return t.concat(r,Tf(r,[],n))}function Ef(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Df(e){let t=xf(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=cf(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=hd(n)!==a||hd(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Of(e){return sf(e)?e:e.contextElement}function kf(e){let t=Of(e);if(!cf(t))return _d(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Df(t),o=(a?hd(n.width):n.width)/r,s=(a?hd(n.height):n.height)/i;return o&&Number.isFinite(o)||(o=1),s&&Number.isFinite(s)||(s=1),{x:o,y:s}}var Af=_d(0);function jf(e){let t=rf(e);return!yf()||!t.visualViewport?Af:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Mf(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===rf(e)}function Nf(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Of(e),o=_d(1);t&&(r?sf(r)&&(o=kf(r)):o=kf(e));let s=Mf(a,n,r)?jf(a):_d(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=rf(a),t=sf(r)?rf(r):r,n=e,i=Ef(n);for(;i&&t!==n;){let e=kf(i),t=i.getBoundingClientRect(),r=xf(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=rf(i),i=Ef(n)}}return zd({width:u,height:d,x:c,y:l})}function Pf(e,t){let n=Sf(e).scrollLeft;return t?t.left+n:Nf(af(e)).left+n}function Ff(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Pf(e,n),y:n.top+t.scrollTop}}function If(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=af(r),s=t?ff(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=_d(1),u=_d(0),d=cf(r);if((d||!a)&&((nf(r)!==`body`||uf(o))&&(c=Sf(r)),d)){let e=Nf(r);l=kf(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Ff(o,c):_d(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Lf(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Rf(e){let t=Sf(e),n=e.ownerDocument.body,r=md(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=md(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+Pf(e),o=-t.scrollTop;return xf(n).direction===`rtl`&&(a+=md(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var zf=25;function Bf(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=rf(e),a=af(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!yf()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(Pf(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=zf&&(s-=o)}return{width:s,height:c,x:l,y:u}}function Vf(e,t){let n=Nf(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=kf(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Q(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Bf(e,n,t);else if(t===`document`)r=Rf(af(e));else if(sf(t))r=Vf(t,n);else{let n=jf(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return zd(r)}function Hf(e,t){let n=t.get(e);if(n)return n;let r=Tf(e,[],!1).filter(e=>sf(e)&&nf(e)!==`body`),i=null,a=xf(e).position===`fixed`,o=a?Cf(e):e;for(;sf(o)&&!bf(o);){let e=xf(o),t=_f(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=Cf(o)}return t.set(e,r),r}function Uf(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?ff(t)?[]:Hf(t,this._c):[].concat(n),r],o=Q(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Q(t,a[e],i);s=md(n.top,s),c=pd(n.right,c),l=pd(n.bottom,l),u=md(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Wf(e){let{width:t,height:n}=Df(e);return{width:t,height:n}}function Gf(e,t,n){let r=cf(t),i=af(t),a=n===`fixed`,o=Nf(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=_d(0);if((r||!a)&&((nf(t)!==`body`||uf(i))&&(s=Sf(t)),r)){let e=Nf(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=Pf(i));let l=i&&!r&&!a?Ff(i,s):_d(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function Kf(e){return xf(e).position===`static`}function qf(e,t){if(!cf(e)||xf(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return af(e)===n&&(n=n.ownerDocument.body),n}function Jf(e,t){let n=rf(e);if(ff(e))return n;if(!cf(e)){let t=Cf(e);for(;t&&!bf(t);){if(sf(t)&&!Kf(t))return t;t=Cf(t)}return n}let r=qf(e,t);for(;r&&df(r)&&Kf(r);)r=qf(r,t);return r&&bf(r)&&Kf(r)&&!_f(r)?n:r||vf(e)||n}var Yf=async function(e){let t=this.getOffsetParent||Jf,n=this.getDimensions,r=await n(e.floating);return{reference:Gf(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Xf(e){return xf(e).direction===`rtl`}var Zf={convertOffsetParentRelativeRectToViewportRelativeRect:If,getDocumentElement:af,getClippingRect:Uf,getOffsetParent:Jf,getElementRects:Yf,getClientRects:Lf,getDimensions:Wf,getScale:kf,isElement:sf,isRTL:Xf};function Qf(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function $f(e,t,n){let r=null,i,a=af(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=gd(d),h=gd(a.clientWidth-(u+f)),g=gd(a.clientHeight-(d+p)),_=gd(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:md(0,pd(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!Qf(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=rf(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function ep(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Of(e),u=i||a?[...l?Tf(l):[],...t?Tf(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?$f(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Nf(e):null;c&&g();function g(){let t=Nf(e);h&&!Qf(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var tp=Zd,np=Qd,rp=Gd,ip=ef,ap=Jd,op=Wd,sp=$d,cp=(e,t,n)=>{let r=new Map,i=n??{},a={...Zf,...i.platform,_c:r};return Ud(e,t,{...i,platform:a})},lp=typeof document<`u`?V.useLayoutEffect:function(){};function up(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!up(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!up(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function dp(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function fp(e,t){let n=dp(e);return Math.round(t*n)/n}function pp(e){let t=V.useRef(e);return lp(()=>{t.current=e}),t}function mp(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=V.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=V.useState(r);up(f,r)||p(r);let[m,h]=V.useState(null),[g,_]=V.useState(null),v=V.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=V.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=V.useRef(null),C=V.useRef(null),w=V.useRef(u),T=c!=null,E=pp(c),D=pp(i),O=pp(l),k=V.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),cp(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!up(w.current,t)&&(w.current=t,Mc.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);lp(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=V.useRef(!1);lp(()=>(A.current=!0,()=>{A.current=!1}),[]),lp(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=V.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=V.useMemo(()=>({reference:b,floating:x}),[b,x]),N=V.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=fp(M.floating,u.x),r=fp(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...dp(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return V.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var hp=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:op({element:r.current,padding:i}).fn(n):r?op({element:r,padding:i}).fn(n):{}}}},gp=(e,t)=>{let n=tp(e);return{name:n.name,fn:n.fn,options:[e,t]}},_p=(e,t)=>{let n=np(e);return{name:n.name,fn:n.fn,options:[e,t]}},vp=(e,t)=>({fn:sp(e).fn,options:[e,t]}),yp=(e,t)=>{let n=rp(e);return{name:n.name,fn:n.fn,options:[e,t]}},bp=(e,t)=>{let n=ip(e);return{name:n.name,fn:n.fn,options:[e,t]}},xp=(e,t)=>{let n=ap(e);return{name:n.name,fn:n.fn,options:[e,t]}},Sp=(e,t)=>{let n=hp(e);return{name:n.name,fn:n.fn,options:[e,t]}},Cp=Object.defineProperty,wp=(e,t)=>Cp(e,`name`,{value:t,configurable:!0}),Tp={Partial:`partial`,Always:`always`},Ep={Optimized:`optimized`,Always:`always`},Dp=`Popper`,[Op,kp]=Pe(Dp),[Ap,jp]=Op(Dp),Mp=wp(e=>{let{__scopePopper:t,children:n}=e,[r,i]=V.useState(null),[a,o]=V.useState(void 0);return(0,K.jsx)(Ap,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})},`Popper`),Np=`PopperAnchor`,Pp=V.forwardRef(wp(function(e,t){let{__scopePopper:r,virtualRef:i,...a}=e,o=jp(Np,r),s=V.useRef(null),c=o.onAnchorChange,l=V.useCallback(e=>{s.current=e,e&&c(e)},[c]),u=n(t,l),d=V.useRef(null);V.useEffect(()=>{if(!i)return;let e=d.current;d.current=i.current,e!==d.current&&c(d.current)});let f=o.placementState&&Vp(o.placementState),p=f?.[0],m=f?.[1];return i?null:(0,K.jsx)(R.div,{"data-radix-popper-side":p,"data-radix-popper-align":m,...a,ref:u})},`PopperAnchor`)),Fp=`PopperContent`,[Ip,Lp]=Op(Fp),Rp=V.forwardRef(wp(function(e,t){let{__scopePopper:r,side:i=`bottom`,sideOffset:a=0,align:o=`center`,alignOffset:s=0,arrowPadding:c=0,avoidCollisions:l=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:f=Tp.Partial,hideWhenDetached:p=!1,updatePositionStrategy:m=Ep.Optimized,onPlaced:h,...g}=e,_=jp(Fp,r),[v,y]=V.useState(null),b=n(t,y),[x,S]=V.useState(null),C=Zu(x),w=C?.width??0,T=C?.height??0,E=i+(o===`center`?``:`-`+o),D=typeof d==`number`?d:{top:0,right:0,bottom:0,left:0,...d},O=Array.isArray(u)?u:[u],k=O.length>0,A={padding:D,boundary:O.filter(zp),altBoundary:k},{refs:j,floatingStyles:M,placement:N,isPositioned:ee,middlewareData:P}=mp({strategy:`fixed`,placement:E,whileElementsMounted:wp((...e)=>ep(...e,{animationFrame:m===Ep.Always}),`whileElementsMounted`),elements:{reference:_.anchor},middleware:[gp({mainAxis:a+T,alignmentAxis:s}),l&&_p({mainAxis:!0,crossAxis:!1,...f===Tp.Partial?{limiter:vp()}:{},...A}),l&&yp({...A}),bp({...A,apply:wp(({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)},`apply`)}),x&&Sp({element:x,padding:c}),Bp({arrowWidth:w,arrowHeight:T}),p&&xp(k?{strategy:`referenceHidden`,...A}:{strategy:`referenceHidden`,padding:A.padding,altBoundary:A.altBoundary})]}),te=_.setPlacementState;ye(()=>(te(N),()=>{te(void 0)}),[N,te]);let[ne,F]=Vp(N),re=ke(h);ye(()=>{ee&&re?.()},[ee,re]);let ie=P.arrow?.x,ae=P.arrow?.y,oe=P.arrow?.centerOffset!==0,[se,ce]=V.useState();return ye(()=>{v&&ce(window.getComputedStyle(v).zIndex)},[v]),(0,K.jsx)(`div`,{ref:j.setFloating,"data-radix-popper-content-wrapper":``,style:{...M,transform:ee?M.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:se,"--radix-popper-transform-origin":[P.transformOrigin?.x,P.transformOrigin?.y].join(` `),...P.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,K.jsx)(Ip,{scope:r,placedSide:ne,placedAlign:F,onArrowChange:S,arrowX:ie,arrowY:ae,shouldHideArrow:oe,children:(0,K.jsx)(R.div,{"data-side":ne,"data-align":F,...g,ref:b,style:{...g.style,animation:ee?g.style?.animation:`none`}})})})},`PopperContent`));function zp(e){return e!==null}wp(zp,`isNotNull`);var Bp=wp(e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=Vp(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}}),`transformOrigin`);function Vp(e){let[t,n=`center`]=e.split(`-`);return[t,n]}wp(Vp,`getSideAndAlignFromPlacement`);var Hp=Object.defineProperty,$=(e,t)=>Hp(e,`name`,{value:t,configurable:!0}),Up={LTR:`ltr`,RTL:`rtl`},Wp=[`Enter`,` `],Gp=[`ArrowDown`,`PageUp`,`Home`],Kp=[`ArrowUp`,`PageDown`,`End`],qp=[...Gp,...Kp],Jp={ltr:[...Wp,`ArrowRight`],rtl:[...Wp,`ArrowLeft`]},Yp={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},Xp=`Menu`,[Zp,Qp,$p]=Fe(Xp),[em,tm]=Pe(Xp,[$p,kp,Se]),nm=kp(),rm=Se(),[im,am]=em(Xp),[om,sm]=em(Xp),cm=$(e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=nm(t),[c,l]=V.useState(null),u=V.useRef(!1),d=ke(a),f=De(i);return V.useEffect(()=>{let e=$(()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},`handleKeyDown`),t=$(()=>u.current=!1,`handlePointer`);return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),V.useEffect(()=>{if(!n)return;let e=$(()=>d(!1),`handleBlur`);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,d]),(0,K.jsx)(Mp,{...s,children:(0,K.jsx)(im,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,K.jsx)(om,{scope:t,onClose:V.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})},`Menu`),lm=V.forwardRef($(function(e,t){let{__scopeMenu:n,...r}=e,i=nm(n);return(0,K.jsx)(Pp,{...i,...r,ref:t})},`MenuAnchor`)),um=`MenuPortal`,[dm,fm]=em(um,{forceMount:void 0}),pm=$(e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=am(um,t);return(0,K.jsx)(dm,{scope:t,forceMount:n,children:(0,K.jsx)(Ce,{present:n||a.open,children:(0,K.jsx)(Pc,{asChild:!0,container:i,children:r})})})},`MenuPortal`),mm=`MenuContent`,[hm,gm]=em(mm),_m=V.forwardRef($(function(e,t){let n=fm(mm,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=am(mm,e.__scopeMenu),o=sm(mm,e.__scopeMenu);return(0,K.jsx)(Zp.Provider,{scope:e.__scopeMenu,children:(0,K.jsx)(Ce,{present:r||a.open,children:(0,K.jsx)(Zp.Slot,{scope:e.__scopeMenu,children:o.modal?(0,K.jsx)(vm,{...i,ref:t}):(0,K.jsx)(ym,{...i,ref:t})})})})},`MenuContent`)),vm=V.forwardRef($(function(e,t){let r=am(mm,e.__scopeMenu),i=V.useRef(null),a=n(t,i);return V.useEffect(()=>{let e=i.current;if(e)return ru(e)},[]),(0,K.jsx)(xm,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:B(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})},`MenuRootContentModal`)),ym=V.forwardRef($(function(e,t){let n=am(mm,e.__scopeMenu);return(0,K.jsx)(xm,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentNonModal`)),bm=d(`MenuContent.ScrollLock`),xm=V.forwardRef($(function(e,t){let{__scopeMenu:r,loop:i=!1,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:c,onEntryFocus:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:p,onDismiss:m,disableOutsideScroll:h,...g}=e,_=am(mm,r),v=sm(mm,r),y=nm(r),b=rm(r),x=Qp(r),[S,C]=V.useState(null),w=V.useRef(null),[T,E]=V.useState(null);bc(T);let{nodes:D,registry:O}=yc(),k=!!(a||h),A=n(t,w,_.onContentChange,E),j=V.useRef(0),M=V.useRef(``),N=V.useRef(0),ee=V.useRef(null),P=V.useRef(`right`),te=V.useRef(0),ne=V.useMemo(()=>h?[w,...D.map(e=>({current:e}))]:[],[w,D,h]),F=h?Yl:V.Fragment,re=h?{as:bm,allowPinchZoom:!0,shards:ne}:void 0,ie=$(e=>{let t=M.current+e,n=x().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=Gm(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;function s(e){M.current=e,window.clearTimeout(j.current),e!==``&&(j.current=window.setTimeout(()=>s(``),1e3))}$(s,`updateSearch`),s(t),o&&setTimeout(()=>o.focus())},`handleTypeaheadSearch`);V.useEffect(()=>()=>window.clearTimeout(j.current),[]),Bc();let ae=V.useCallback(e=>P.current===ee.current?.side&&qm(e,ee.current?.area),[]);return(0,K.jsx)(hm,{scope:r,searchRef:M,onItemEnter:V.useCallback(e=>{ae(e)&&e.preventDefault()},[ae]),onItemLeave:V.useCallback(e=>{ae(e)||(w.current?.focus(),C(null))},[ae]),onTriggerLeave:V.useCallback(e=>{ae(e)&&e.preventDefault()},[ae]),pointerGraceTimerRef:N,onPointerGraceIntentChange:V.useCallback(e=>{ee.current=e},[]),children:(0,K.jsx)(vc,{registry:k?O:null,children:(0,K.jsx)(F,{...re,children:(0,K.jsx)(gc,{asChild:!0,trapped:a,branches:D,onMountAutoFocus:B(o,e=>{e.preventDefault(),w.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:(0,K.jsx)(ic,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:p,onDismiss:m,children:(0,K.jsx)(Me,{asChild:!0,...b,dir:v.dir,orientation:`vertical`,loop:i,currentTabStopId:S,onCurrentTabStopIdChange:C,onEntryFocus:B(l,e=>{v.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,K.jsx)(Rp,{role:`menu`,"aria-orientation":`vertical`,"data-state":Bm(_.open),"data-radix-menu-content":``,dir:v.dir,...y,...g,ref:A,style:{outline:`none`,...g.style},onKeyDown:B(g.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&ie(e.key));let i=w.current;if(e.target!==i||!qp.includes(e.key))return;e.preventDefault();let a=x().filter(e=>!e.disabled).map(e=>e.ref.current);Kp.includes(e.key)&&a.reverse(),Um(a)}),onBlur:B(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(j.current),M.current=``)}),onPointerMove:B(e.onPointerMove,Jm(e=>{let t=e.target,n=te.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>te.current?`right`:`left`;P.current=t,te.current=e.clientX}}))})})})})})})})},`MenuContentImpl`)),Sm=V.forwardRef($(function(e,t){let{__scopeMenu:n,...r}=e;return(0,K.jsx)(R.div,{...r,ref:t})},`MenuLabel`)),Cm=`MenuItem`,wm=`menu.itemSelect`,Tm=V.forwardRef($(function(e,t){let{disabled:r=!1,onSelect:i,...a}=e,o=V.useRef(null),s=sm(Cm,e.__scopeMenu),c=gm(Cm,e.__scopeMenu),l=n(t,o),u=V.useRef(!1),d=$(()=>{let e=o.current;if(!r&&e){let t=new CustomEvent(wm,{bubbles:!0,cancelable:!0});e.addEventListener(wm,e=>i?.(e),{once:!0}),he(e,t),t.defaultPrevented?u.current=!1:s.onClose()}},`handleSelect`);return(0,K.jsx)(Em,{...a,ref:l,disabled:r,onClick:B(e.onClick,d),onPointerDown:t=>{e.onPointerDown?.(t),u.current=!0},onPointerUp:B(e.onPointerUp,e=>{u.current||e.currentTarget?.click()}),onKeyDown:B(e.onKeyDown,e=>{r||e.target!==e.currentTarget||(c.searchRef.current===``||e.key!==` `)&&Wp.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})},`MenuItem`)),Em=V.forwardRef($(function(e,t){let{__scopeMenu:r,disabled:i=!1,textValue:a,...o}=e,s=gm(Cm,r),c=rm(r),l=V.useRef(null),u=n(t,l),[d,f]=V.useState(!1),[p,m]=V.useState(``);return V.useEffect(()=>{let e=l.current;e&&m((e.textContent??``).trim())},[o.children]),(0,K.jsx)(Zp.ItemSlot,{scope:r,disabled:i,textValue:a??p,children:(0,K.jsx)(xe,{asChild:!0,...c,focusable:!i,children:(0,K.jsx)(R.div,{role:`menuitem`,"data-highlighted":d?``:void 0,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,...o,ref:u,onPointerMove:B(e.onPointerMove,Jm(e=>{i?s.onItemLeave(e):(s.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:B(e.onPointerLeave,Jm(e=>s.onItemLeave(e))),onFocus:B(e.onFocus,()=>f(!0)),onBlur:B(e.onBlur,()=>f(!1))})})})},`MenuItemImpl`)),[Dm,Om]=em(`MenuRadioGroup`,{value:void 0,onValueChange:$(()=>{},`onValueChange`)}),[km,Am]=em(`MenuItemIndicator`,{checked:!1}),jm=V.forwardRef($(function(e,t){let{__scopeMenu:n,...r}=e;return(0,K.jsx)(R.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})},`MenuSeparator`)),Mm=`MenuSub`,[Nm,Pm]=em(Mm),Fm=$(e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=am(Mm,t),o=nm(t),[s,c]=V.useState(null),[l,u]=V.useState(null),d=ke(i);return V.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,K.jsx)(Mp,{...o,children:(0,K.jsx)(im,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,K.jsx)(Nm,{scope:t,contentId:we(),triggerId:we(),trigger:s,onTriggerChange:c,children:n})})})},`MenuSub`),Im=`MenuSubTrigger`,Lm=V.forwardRef($(function(e,t){let r=am(Im,e.__scopeMenu),i=sm(Im,e.__scopeMenu),a=Pm(Im,e.__scopeMenu),o=gm(Im,e.__scopeMenu),s=V.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:l}=o,u={__scopeMenu:e.__scopeMenu},d=V.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);V.useEffect(()=>d,[d]),V.useEffect(()=>{let e=c.current;return()=>{window.clearTimeout(e),l(null)}},[c,l]);let f=n(t,a.onTriggerChange);return(0,K.jsx)(lm,{asChild:!0,...u,children:(0,K.jsx)(Em,{id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":r.open,"aria-controls":r.open?a.contentId:void 0,"data-state":Bm(r.open),...e,ref:f,onClick:t=>{e.onClick?.(t),e.disabled||t.defaultPrevented||(t.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:B(e.onPointerMove,Jm(t=>{o.onItemEnter(t),t.defaultPrevented||e.disabled||r.open||s.current||(o.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{r.onOpenChange(!0),d()},100))})),onPointerLeave:B(e.onPointerLeave,Jm(e=>{d();let t=r.content?.getBoundingClientRect();if(t){let n=r.content?.dataset.side,i=n===`right`,a=i?-5:5,s=t[i?`left`:`right`],l=t[i?`right`:`left`];o.onPointerGraceIntentChange({area:[{x:e.clientX+a,y:e.clientY},{x:s,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:s,y:t.bottom}],side:n}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(e),e.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:B(e.onKeyDown,t=>{e.disabled||t.target!==t.currentTarget||(o.searchRef.current===``||t.key!==` `)&&Jp[i.dir].includes(t.key)&&(r.onOpenChange(!0),r.content?.focus(),t.preventDefault())})})})},`MenuSubTrigger`)),Rm=`MenuSubContent`,zm=V.forwardRef($(function(e,t){let r=fm(mm,e.__scopeMenu),{forceMount:i=r.forceMount,align:a=`start`,...o}=e,s=am(mm,e.__scopeMenu),c=sm(mm,e.__scopeMenu),l=Pm(Rm,e.__scopeMenu),u=V.useRef(null),d=n(t,u);return(0,K.jsx)(Zp.Provider,{scope:e.__scopeMenu,children:(0,K.jsx)(Ce,{present:i||s.open,children:(0,K.jsx)(Zp.Slot,{scope:e.__scopeMenu,children:(0,K.jsx)(xm,{id:l.contentId,"aria-labelledby":l.triggerId,...o,ref:d,align:a,side:c.dir===Up.RTL?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{c.isUsingKeyboardRef.current&&u.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:B(e.onFocusOutside,e=>{e.target!==l.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:B(e.onEscapeKeyDown,e=>{c.onClose(),e.preventDefault()}),onKeyDown:B(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=Yp[c.dir].includes(e.key);t&&n&&(s.onOpenChange(!1),l.trigger?.focus(),e.preventDefault())})})})})})},`MenuSubContent`));function Bm(e){return e?`open`:`closed`}$(Bm,`getOpenState`);function Vm(e){return e===`indeterminate`}$(Vm,`isIndeterminate`);function Hm(e){return Vm(e)?`indeterminate`:e?`checked`:`unchecked`}$(Hm,`getCheckedState`);function Um(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}$(Um,`focusFirst`);function Wm(e,t){return e.map((n,r)=>e[(t+r)%e.length])}$(Wm,`wrapArray`);function Gm(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Wm(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}$(Gm,`getNextMatch`);function Km(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}$(Km,`isPointInPolygon`);function qm(e,t){return t?Km({x:e.clientX,y:e.clientY},t):!1}$(qm,`isPointerInGraceArea`);function Jm(e){return t=>t.pointerType===`mouse`?e(t):void 0}$(Jm,`whenMouse`);var Ym=Object.defineProperty,Xm=(e,t)=>Ym(e,`name`,{value:t,configurable:!0}),Zm=`DropdownMenu`,[Qm,$m]=Pe(Zm,[tm]),eh=tm(),[th,nh]=Qm(Zm),rh=Xm(e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=eh(t),l=V.useRef(null),[u,d]=z({prop:i,defaultProp:a??!1,onChange:o,caller:Zm});return(0,K.jsx)(th,{scope:t,triggerId:we(),triggerRef:l,contentId:we(),open:u,onOpenChange:d,onOpenToggle:V.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,K.jsx)(cm,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})},`DropdownMenu`),ih=`DropdownMenuTrigger`,ah=V.forwardRef(Xm(function(e,t){let{__scopeDropdownMenu:r,disabled:i=!1,...a}=e,o=nh(ih,r),s=eh(r),c=n(t,o.triggerRef);return(0,K.jsx)(lm,{asChild:!0,...s,children:(0,K.jsx)(R.button,{type:`button`,id:o.triggerId,"aria-haspopup":`menu`,"aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?`open`:`closed`,"data-disabled":i?``:void 0,disabled:i,...a,ref:c,onPointerDown:B(e.onPointerDown,e=>{!i&&e.button===0&&e.ctrlKey===!1&&(o.onOpenToggle(),o.open||e.preventDefault())}),onKeyDown:B(e.onKeyDown,e=>{i||([`Enter`,` `].includes(e.key)&&o.onOpenToggle(),e.key===`ArrowDown`&&o.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})},`DropdownMenuTrigger`)),oh=Xm(e=>{let{__scopeDropdownMenu:t,...n}=e,r=eh(t);return(0,K.jsx)(pm,{...r,...n})},`DropdownMenuPortal`),sh=`DropdownMenuContent`,ch=V.forwardRef(Xm(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=nh(sh,n),a=eh(n),o=V.useRef(!1);return(0,K.jsx)(_m,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:B(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:B(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`DropdownMenuContent`)),lh=V.forwardRef(Xm(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=eh(n);return(0,K.jsx)(Sm,{...i,...r,ref:t})},`DropdownMenuLabel`)),uh=V.forwardRef(Xm(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=eh(n);return(0,K.jsx)(Tm,{...i,...r,ref:t})},`DropdownMenuItem`)),dh=V.forwardRef(Xm(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=eh(n);return(0,K.jsx)(jm,{...i,...r,ref:t})},`DropdownMenuSeparator`)),fh=Xm(e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:a}=e,o=eh(t),[s,c]=z({prop:r,defaultProp:a??!1,onChange:i,caller:`DropdownMenuSub`});return(0,K.jsx)(Fm,{...o,open:s,onOpenChange:c,children:n})},`DropdownMenuSub`),ph=V.forwardRef(Xm(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=eh(n);return(0,K.jsx)(Lm,{...i,...r,ref:t})},`DropdownMenuSubTrigger`)),mh=V.forwardRef(Xm(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=eh(n);return(0,K.jsx)(zm,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`DropdownMenuSubContent`)),hh=Object.defineProperty,gh=(e,t)=>hh(e,`name`,{value:t,configurable:!0}),_h=`Popover`,[vh,yh]=Pe(_h,[kp]),bh=kp(),[xh,Sh]=vh(_h),Ch=gh(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=bh(t),c=V.useRef(null),[l,u]=V.useState(!1),[d,f]=V.useState(0),[p,m]=V.useState(0),[h,g]=z({prop:r,defaultProp:i??!1,onChange:a,caller:_h});return(0,K.jsx)(Mp,{...s,children:(0,K.jsx)(xh,{scope:t,contentId:we(),titleId:we(),descriptionId:we(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:m,triggerRef:c,open:h,onOpenChange:g,onOpenToggle:V.useCallback(()=>g(e=>!e),[g]),hasCustomAnchor:l,onCustomAnchorAdd:V.useCallback(()=>u(!0),[]),onCustomAnchorRemove:V.useCallback(()=>u(!1),[]),modal:o,children:n})})},`Popover`),wh=`PopoverTrigger`,Th=V.forwardRef(gh(function(e,t){let{__scopePopover:r,...i}=e,a=Sh(wh,r),o=bh(r),s=n(t,a.triggerRef),c=(0,K.jsx)(R.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":Ih(a.open),...i,ref:s,onClick:B(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?c:(0,K.jsx)(Pp,{asChild:!0,...o,children:c})},`PopoverTrigger`)),Eh=`PopoverPortal`,[Dh,Oh]=vh(Eh,{forceMount:void 0}),kh=gh(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=Sh(Eh,t);return(0,K.jsx)(Dh,{scope:t,forceMount:n,children:(0,K.jsx)(Ce,{present:n||a.open,children:(0,K.jsx)(Pc,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),Ah=`PopoverContent`,jh=V.forwardRef(gh(function(e,t){let n=Oh(Ah,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=Sh(Ah,e.__scopePopover);return(0,K.jsx)(Ce,{present:r||a.open,children:a.modal?(0,K.jsx)(Nh,{...i,ref:t}):(0,K.jsx)(Ph,{...i,ref:t})})},`PopoverContent`)),Mh=d(`PopoverContent.RemoveScroll`),Nh=V.forwardRef(gh(function(e,t){let r=Sh(Ah,e.__scopePopover),i=V.useRef(null),a=n(t,i),o=V.useRef(!1),{nodes:s,registry:c}=yc();return V.useEffect(()=>{let e=i.current;if(e)return ru(e)},[]),(0,K.jsx)(Yl,{as:Mh,allowPinchZoom:!0,shards:V.useMemo(()=>[i,...s.map(e=>({current:e}))],[i,s]),children:(0,K.jsx)(Fh,{...e,ref:a,branchNodes:s,branchRegistry:c,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:B(e.onCloseAutoFocus,e=>{e.preventDefault(),o.current||r.triggerRef.current?.focus()}),onPointerDownOutside:B(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;o.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:B(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),Ph=V.forwardRef(gh(function(e,t){let n=Sh(Ah,e.__scopePopover),r=V.useRef(!1),i=V.useRef(!1);return(0,K.jsx)(Fh,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`PopoverContentNonModal`)),Fh=V.forwardRef(gh(function(e,t){let{__scopePopover:r,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:d,"aria-describedby":f,branchNodes:p,branchRegistry:m,...h}=e,g=Sh(Ah,r),_=bh(r),[v,y]=V.useState(null),b=n(t,y);return bc(v),Bc(),(0,K.jsx)(vc,{registry:m,children:(0,K.jsx)(gc,{asChild:!0,loop:!0,trapped:i,branches:p,onMountAutoFocus:a,onUnmountAutoFocus:o,children:(0,K.jsx)(ic,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:d,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:u,onDismiss:()=>g.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,K.jsx)(Rp,{"data-state":Ih(g.open),role:`dialog`,id:g.contentId,"aria-labelledby":g.titlePresent?g.titleId:void 0,"aria-describedby":g.descriptionPresent?Lh(f,g.descriptionId):f,..._,...h,ref:b,style:{...h.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})})},`PopoverContentImpl`));function Ih(e){return e?`open`:`closed`}gh(Ih,`getState`);function Lh(...e){let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of String(n).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(` `):void 0}gh(Lh,`concatAriaDescribedby`);var Rh=Object.defineProperty,zh=(e,t)=>Rh(e,`name`,{value:t,configurable:!0}),Bh=`Switch`,[Vh,Hh]=Pe(Bh),[Uh,Wh]=Vh(Bh);function Gh(e){let{__scopeSwitch:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=z({prop:n,defaultProp:i??!1,onChange:c,caller:Bh}),[m,h]=V.useState(null),[g,_]=V.useState(null),[v,y]=V.useState(null),b={checked:f,setChecked:p,disabled:a,control:m,setControl:h,name:s,form:o,value:u,userClick:v,onUserClick:y,required:l,defaultChecked:i,isFormControl:!m||!!o||!!m.closest(`form`),bubbleInput:g,setBubbleInput:_};return(0,K.jsx)(Uh,{scope:t,...b,children:$h(d)?d(b):r})}zh(Gh,`SwitchProvider`);var Kh=`SwitchTrigger`,qh=V.forwardRef(zh(function({__scopeSwitch:e,onClick:t,...r},i){let{control:a,form:o,value:s,disabled:c,checked:l,required:u,setControl:d,setChecked:f,onUserClick:p,isFormControl:m,bubbleInput:h}=Wh(Kh,e),g=n(i,d),_=V.useRef(l);return V.useEffect(()=>{let e=o?a?.ownerDocument.getElementById(o):a?.form;if(e instanceof HTMLFormElement){let t=zh(()=>f(_.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,o,f]),(0,K.jsx)(R.button,{type:`button`,role:`switch`,"aria-checked":l,"aria-required":u,"data-state":eg(l),"data-disabled":c?``:void 0,disabled:c,value:s,...r,ref:g,onClick:B(t,e=>{let t=e.isPropagationStopped();p({requestedChecked:!l,hasConsumerStoppedPropagation:t}),f(e=>!e),h&&m&&(t||e.stopPropagation())})})},`SwitchTrigger`)),Jh=V.forwardRef(zh(function(e,t){let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,K.jsx)(Gh,{__scopeSwitch:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(qh,{...d,ref:t,__scopeSwitch:n}),e&&(0,K.jsx)(Qh,{__scopeSwitch:n})]})})},`Switch`)),Yh=`SwitchThumb`,Xh=V.forwardRef(zh(function(e,t){let{__scopeSwitch:n,...r}=e,i=Wh(Yh,n);return(0,K.jsx)(R.span,{"data-state":eg(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})},`SwitchThumb`)),Zh=`SwitchBubbleInput`,Qh=V.forwardRef(zh(function({__scopeSwitch:e,onClick:t,...r},i){let{control:a,userClick:o,checked:s,defaultChecked:c,required:l,disabled:u,name:d,value:f,form:p,bubbleInput:m,setBubbleInput:h}=Wh(Zh,e),g=n(i,h),_=Zu(a),v=V.useRef(!1),y=V.useRef(s),b=V.useRef(o),x=V.useRef(null);V.useEffect(()=>{let e=m;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set;if(!n)return;let r=y.current!==s;y.current=s;let i=o!==null&&o!==b.current;if(b.current=o,i)x.current=r?null:o,r&&n.call(e,s),e.dispatchEvent(new Event(`click`,{bubbles:!o.hasConsumerStoppedPropagation}));else if(r){let t=x.current;x.current=null;let r=t?.requestedChecked===s;v.current=!0,n.call(e,s),e.dispatchEvent(new Event(`click`,{bubbles:!(r&&t.hasConsumerStoppedPropagation)})),v.current=!1}},[m,s,o]);let S=V.useRef(s);return(0,K.jsx)(R.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:c??S.current,required:l,disabled:u,name:d,value:f,form:p,...r,tabIndex:-1,ref:g,onClick:B(t,e=>{v.current&&e.stopPropagation()}),style:{...r.style,..._,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`SwitchBubbleInput`));function $h(e){return typeof e==`function`}zh($h,`isFunction`);function eg(e){return e?`checked`:`unchecked`}zh(eg,`getState`);var tg=Object.defineProperty,ng=(e,t)=>tg(e,`name`,{value:t,configurable:!0}),[rg,ig]=Pe(`Tooltip`,[kp]),ag=kp(),og=`TooltipProvider`,sg=700,cg=`tooltip.open`,[lg,ug]=rg(og),dg=ng(e=>{let{__scopeTooltip:t,delayDuration:n=sg,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=V.useRef(!0),s=V.useRef(!1),c=V.useRef(0);return V.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,K.jsx)(lg,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:V.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:V.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:V.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})},`TooltipProvider`),fg=`Tooltip`,[pg,mg]=rg(fg),hg=ng(e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=ug(fg,e.__scopeTooltip),l=ag(t),[u,d]=V.useState(null),[f,p]=V.useState(void 0),m=we(),h=V.useRef(0),g=o??c.disableHoverableContent,_=s??c.delayDuration,v=V.useRef(!1),[y,b]=z({prop:r,defaultProp:i??!1,onChange:ng(e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(cg))):c.onClose(),a?.(e)},`onChange`),caller:fg}),x=V.useMemo(()=>y?v.current?`delayed-open`:`instant-open`:`closed`,[y]),S=V.useCallback(()=>{window.clearTimeout(h.current),h.current=0,v.current=!1,b(!0)},[b]),C=V.useCallback(()=>{window.clearTimeout(h.current),h.current=0,b(!1)},[b]),w=V.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{v.current=!0,b(!0),h.current=0},_)},[_,b]);V.useEffect(()=>()=>{h.current&&=(window.clearTimeout(h.current),0)},[]);let T=f??m;return(0,K.jsx)(Mp,{...l,children:(0,K.jsx)(pg,{scope:t,contentId:T,setContentId:p,open:y,stateAttribute:x,trigger:u,onTriggerChange:d,onTriggerEnter:V.useCallback(()=>{c.isOpenDelayedRef.current?w():S()},[c.isOpenDelayedRef,w,S]),onTriggerLeave:V.useCallback(()=>{g?C():(window.clearTimeout(h.current),h.current=0)},[C,g]),onOpen:S,onClose:C,disableHoverableContent:g,children:n})})},`Tooltip`),gg=`TooltipTrigger`,_g=V.forwardRef(ng(function(e,t){let{__scopeTooltip:r,"aria-describedby":i,...a}=e,o=mg(gg,r),s=ug(gg,r),c=ag(r),l=V.useRef(null),u=n(t,l,o.onTriggerChange),d=V.useRef(!1),f=V.useRef(!1),p=V.useCallback(()=>d.current=!1,[]);return V.useEffect(()=>()=>document.removeEventListener(`pointerup`,p),[p]),(0,K.jsx)(Pp,{asChild:!0,...c,children:(0,K.jsx)(R.button,{"aria-describedby":o.open?Ng(i,o.contentId):i,"data-state":o.stateAttribute,...a,ref:u,onPointerMove:B(e.onPointerMove,e=>{e.pointerType!==`touch`&&!f.current&&!s.isPointerInTransitRef.current&&(o.onTriggerEnter(),f.current=!0)}),onPointerLeave:B(e.onPointerLeave,()=>{o.onTriggerLeave(),f.current=!1}),onPointerDown:B(e.onPointerDown,()=>{o.open&&o.onClose(),d.current=!0,document.addEventListener(`pointerup`,p,{once:!0})}),onFocus:B(e.onFocus,()=>{d.current||o.onOpen()}),onBlur:B(e.onBlur,o.onClose),onClick:B(e.onClick,o.onClose)})})},`TooltipTrigger`)),vg=`TooltipPortal`,[yg,bg]=rg(vg,{forceMount:void 0}),xg=ng(e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=mg(vg,t);return(0,K.jsx)(yg,{scope:t,forceMount:n,children:(0,K.jsx)(Ce,{present:n||a.open,children:(0,K.jsx)(Pc,{asChild:!0,container:i,children:r})})})},`TooltipPortal`),Sg=`TooltipContent`,Cg=V.forwardRef(ng(function(e,t){let n=bg(Sg,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=mg(Sg,e.__scopeTooltip);return(0,K.jsx)(Ce,{present:r||o.open,children:o.disableHoverableContent?(0,K.jsx)(Eg,{side:i,...a,ref:t}):(0,K.jsx)(wg,{side:i,...a,ref:t})})},`TooltipContent`)),wg=V.forwardRef(ng(function(e,t){let r=mg(Sg,e.__scopeTooltip),i=ug(Sg,e.__scopeTooltip),a=V.useRef(null),o=n(t,a),[s,c]=V.useState(null),{trigger:l,onClose:u}=r,d=a.current,{onPointerInTransitChange:f}=i,p=V.useCallback(()=>{c(null),f(!1)},[f]),m=V.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=Og(r,Dg(r,n.getBoundingClientRect())),a=kg(t.getBoundingClientRect()),o=jg([...i,...a]);c(o),f(!0)},[f]);return V.useEffect(()=>()=>p(),[p]),V.useEffect(()=>{if(l&&d){let e=ng(e=>m(e,d),`handleTriggerLeave`),t=ng(e=>m(e,l),`handleContentLeave`);return l.addEventListener(`pointerleave`,e),d.addEventListener(`pointerleave`,t),()=>{l.removeEventListener(`pointerleave`,e),d.removeEventListener(`pointerleave`,t)}}},[l,d,m,p]),V.useEffect(()=>{if(s){let e=ng(e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=l?.contains(t)||d?.contains(t),i=!Ag(n,s);r?p():i&&(p(),u())},`handleTrackPointerGrace`);return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[l,d,s,u,p]),(0,K.jsx)(Eg,{...e,ref:o})},`TooltipContentHoverable`)),Tg=f(`TooltipContent`),Eg=V.forwardRef(ng(function(e,t){let{__scopeTooltip:r,children:i,"aria-label":a,id:o,onEscapeKeyDown:s,onPointerDownOutside:c,...l}=e,u=mg(Sg,r),d=ag(r),{onClose:f}=u,[p,m]=V.useState(null),h=n(t,m);bc(p),V.useEffect(()=>(document.addEventListener(cg,f),()=>document.removeEventListener(cg,f)),[f]),V.useEffect(()=>{if(u.trigger){let e=ng(e=>{e.target instanceof Node&&e.target.contains(u.trigger)&&f()},`handleScroll`);return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[u.trigger,f]);let{setContentId:g}=u;return ye(()=>(g(o),()=>{g(void 0)}),[o,g]),(0,K.jsx)(ic,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:e=>e.preventDefault(),onDismiss:f,children:(0,K.jsxs)(Rp,{"data-state":u.stateAttribute,role:a?void 0:`tooltip`,id:a?void 0:u.contentId,...d,...l,ref:h,style:{...l.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,K.jsx)(Tg,{children:i}),a?(0,K.jsx)(Ys,{id:u.contentId,role:`tooltip`,children:a}):null]})})},`TooltipContentImpl`));function Dg(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}ng(Dg,`getExitSideFromRect`);function Og(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n})}return r}ng(Og,`getPaddedExitPoints`);function kg(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}ng(kg,`getPointsFromRect`);function Ag(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}ng(Ag,`isPointInPolygon`);function jg(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),Mg(t)}ng(jg,`getHull`);function Mg(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}ng(Mg,`getHullPresorted`);function Ng(...e){let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of String(n).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(` `):void 0}ng(Ng,`concatAriaDescribedby`);var Pg=(0,V.createContext)(async()=>!1);function Fg(){return(0,V.useContext)(Pg)}function Ig({children:e}){let[t,n]=(0,V.useState)(null),r=(0,V.useRef)(()=>{}),i=(0,V.useCallback)(e=>(n(e),new Promise(e=>{r.current=e})),[]),a=e=>{r.current(e),n(null)};return(0,K.jsxs)(Pg.Provider,{value:i,children:[e,(0,K.jsx)(Ru,{open:!!t,onOpenChange:e=>!e&&a(!1),children:(0,K.jsxs)(zu,{children:[(0,K.jsx)(Bu,{className:`fixed inset-0 z-50 bg-black/40 backdrop-blur-[2px] data-[state=open]:animate-fade-in`}),(0,K.jsxs)(Uu,{className:`fixed top-1/2 left-1/2 z-50 w-[calc(100vw-2rem)] max-w-md -translate-x-1/2 -translate-y-1/2 rounded-2xl border bg-popover p-6 shadow-2xl data-[state=open]:animate-scale-in`,children:[(0,K.jsxs)(`div`,{className:`flex gap-4`,children:[t?.destructive&&(0,K.jsx)(`div`,{className:`grid size-10 shrink-0 place-items-center rounded-full bg-destructive/10 text-destructive`,children:(0,K.jsx)(Ns,{className:`size-5`})}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(Wu,{className:`text-base font-semibold`,children:t?.title}),(0,K.jsx)(Gu,{className:`mt-1.5 text-sm text-muted-foreground`,children:t?.description??`Are you sure?`})]})]}),(0,K.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,K.jsx)(Ju,{asChild:!0,children:(0,K.jsx)(k,{variant:`outline`,children:`Cancel`})}),(0,K.jsx)(Ku,{asChild:!0,children:(0,K.jsx)(k,{variant:t?.destructive?`destructive`:`default`,onClick:()=>a(!0),children:t?.confirmLabel??`Confirm`})})]})]})]})})]})}var Lg=rh,Rg=ah,zg=fh,Bg=`z-50 min-w-48 overflow-hidden rounded-xl border bg-popover p-1 text-popover-foreground shadow-xl animate-scale-in`;function Vg({className:e,sideOffset:t=6,align:n=`end`,...r}){return(0,K.jsx)(oh,{children:(0,K.jsx)(ch,{sideOffset:t,align:n,className:y(Bg,e),...r})})}var Hg=`relative flex cursor-default select-none items-center gap-2.5 rounded-md px-2.5 py-1.5 text-sm outline-none transition-colors data-[highlighted]:bg-accent data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:text-muted-foreground`;function Ug({className:e,destructive:t,...n}){return(0,K.jsx)(uh,{className:y(Hg,t&&`text-destructive data-[highlighted]:bg-destructive/10 [&_svg]:text-destructive`,e),...n})}function Wg({className:e,...t}){return(0,K.jsx)(lh,{className:y(`px-2.5 py-1.5 text-xs font-medium text-muted-foreground`,e),...t})}function Gg({className:e,...t}){return(0,K.jsx)(dh,{className:y(`-mx-1 my-1 h-px bg-border`,e),...t})}function Kg({className:e,children:t,...n}){return(0,K.jsxs)(ph,{className:y(Hg,`data-[state=open]:bg-accent`,e),...n,children:[t,(0,K.jsx)(Oo,{className:`ml-auto`})]})}function qg({className:e,...t}){return(0,K.jsx)(oh,{children:(0,K.jsx)(mh,{sideOffset:6,className:y(Bg,`min-w-36`,e),...t})})}function Jg({checked:e,children:t,...n}){return(0,K.jsxs)(uh,{className:Hg,...n,children:[(0,K.jsx)(`span`,{className:`grid size-4 place-items-center`,children:e&&(0,K.jsx)(Eo,{className:`!text-foreground`})}),t]})}var Yg=Ch,Xg=Th;function Zg({className:e,align:t=`center`,sideOffset:n=8,...r}){return(0,K.jsx)(kh,{children:(0,K.jsx)(jh,{align:t,sideOffset:n,className:y(`z-50 w-72 rounded-xl border bg-popover p-4 text-popover-foreground shadow-xl outline-none animate-scale-in`,e),...r})})}function Qg({content:e,children:t,side:n=`top`}){return(0,K.jsxs)(hg,{delayDuration:250,children:[(0,K.jsx)(_g,{asChild:!0,children:t}),(0,K.jsx)(xg,{children:(0,K.jsx)(Cg,{side:n,sideOffset:6,className:`z-50 max-w-xs rounded-md bg-foreground px-2 py-1 text-xs font-medium text-background shadow-lg animate-fade-in`,children:e})})]})}var $g=dg,e_=(0,V.createContext)({theme:`system`,resolved:`light`,setTheme:()=>{}});function t_(){try{let e=localStorage.getItem(`ck-theme`);return e===`light`||e===`dark`?e:`system`}catch{return`system`}}function n_({children:e}){let[t,n]=(0,V.useState)(t_),[r,i]=(0,V.useState)(()=>window.matchMedia(`(prefers-color-scheme: dark)`).matches);(0,V.useEffect)(()=>{let e=window.matchMedia(`(prefers-color-scheme: dark)`),t=()=>i(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let a=t===`system`?r?`dark`:`light`:t;(0,V.useEffect)(()=>{document.documentElement.classList.toggle(`dark`,a===`dark`)},[a]);let o=(0,V.useCallback)(e=>{n(e);try{e===`system`?localStorage.removeItem(`ck-theme`):localStorage.setItem(`ck-theme`,e)}catch{}},[]);return(0,K.jsx)(e_.Provider,{value:{theme:t,resolved:a,setTheme:o},children:e})}function r_(){return(0,V.useContext)(e_)}var i_={indigo:{from:`#6366f1`,to:`#8b5cf6`,label:`Indigo`},ocean:{from:`#0ea5e9`,to:`#6366f1`,label:`Ocean`},emerald:{from:`#10b981`,to:`#0d9488`,label:`Emerald`},sunset:{from:`#fb923c`,to:`#e11d48`,label:`Sunset`},rose:{from:`#f43f5e`,to:`#a855f7`,label:`Rose`},amber:{from:`#f59e0b`,to:`#ea580c`,label:`Amber`},teal:{from:`#2dd4bf`,to:`#0284c7`,label:`Teal`},fuchsia:{from:`#e879f9`,to:`#7c3aed`,label:`Fuchsia`},lime:{from:`#a3e635`,to:`#059669`,label:`Lime`},slate:{from:`#64748b`,to:`#1e293b`,label:`Slate`}};function a_(e){return i_[e]??i_.indigo}function o_(e,t){let n=a_(e);return t?{backgroundImage:`linear-gradient(180deg, rgb(0 0 0 / 0.05), rgb(0 0 0 / 0.45)), url("${t}")`,backgroundSize:`cover`,backgroundPosition:`center`}:{backgroundImage:[`radial-gradient(circle at 85% 15%, rgb(255 255 255 / 0.35), transparent 38%)`,`radial-gradient(rgb(255 255 255 / 0.14) 1px, transparent 1px)`,`linear-gradient(135deg, ${n.from} 0%, ${n.to} 100%)`].join(`, `),backgroundSize:`auto, 14px 14px, auto`}}function s_(e){let t=a_(e);return{backgroundImage:`linear-gradient(135deg, ${t.from}, ${t.to})`}}var c_={xs:`size-6 text-[10px]`,sm:`size-8 text-xs`,md:`size-9 text-[13px]`,lg:`size-12 text-base`,xl:`size-20 text-2xl`};function l_({user:e,size:t=`md`,className:n}){return(0,K.jsx)(`span`,{className:y(`relative inline-grid shrink-0 select-none place-items-center overflow-hidden rounded-full font-semibold text-white ring-2 ring-card`,c_[t],!e.avatarUrl&&L(e.id),n),title:e.name,children:e.avatarUrl?(0,K.jsx)(`img`,{src:e.avatarUrl,alt:``,className:`size-full object-cover`}):M(e.name)})}function u_({users:e,max:t=3,size:n=`xs`}){let r=e.slice(0,t),i=e.length-r.length;return(0,K.jsxs)(`span`,{className:`flex items-center -space-x-1.5`,children:[r.map(e=>(0,K.jsx)(l_,{user:e,size:n},e.id)),i>0&&(0,K.jsxs)(`span`,{className:y(`inline-grid place-items-center rounded-full bg-muted font-medium text-muted-foreground ring-2 ring-card`,c_[n]),children:[`+`,i]})]})}var d_=du;function f_({className:e,children:t,size:n=`md`,hideClose:r,...i}){return(0,K.jsxs)(_u,{children:[(0,K.jsx)(yu,{className:`fixed inset-0 z-50 bg-black/40 backdrop-blur-[2px] data-[state=open]:animate-fade-in`}),(0,K.jsxs)(Cu,{className:y(`fixed top-1/2 left-1/2 z-50 flex max-h-[calc(100dvh-2rem)] w-[calc(100vw-2rem)] -translate-x-1/2 -translate-y-1/2 flex-col rounded-2xl border bg-popover text-popover-foreground shadow-2xl outline-none data-[state=open]:animate-scale-in`,n===`sm`&&`max-w-md`,n===`md`&&`max-w-lg`,n===`lg`&&`max-w-2xl`,n===`xl`&&`max-w-4xl`,e),...i,children:[t,!r&&(0,K.jsxs)(Au,{className:`absolute top-4 right-4 rounded-md p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,children:[(0,K.jsx)(Gs,{className:`size-4`}),(0,K.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function p_({title:e,description:t,icon:n}){return(0,K.jsxs)(`div`,{className:`flex gap-3 px-6 pt-6 pb-4 pr-12`,children:[n&&(0,K.jsx)(`div`,{className:`grid size-10 shrink-0 place-items-center rounded-xl bg-primary/10 text-primary`,children:n}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(Du,{className:`text-lg font-semibold tracking-tight`,children:e}),t?(0,K.jsx)(Ou,{className:`mt-1 text-sm text-muted-foreground`,children:t}):(0,K.jsx)(Ou,{className:`sr-only`,children:e})]})]})}function m_({className:e,...t}){return(0,K.jsx)(`div`,{className:y(`ck-scrollbar min-h-0 flex-1 overflow-y-auto px-6 pb-2`,e),...t})}function h_({className:e,...t}){return(0,K.jsx)(`div`,{className:y(`flex flex-col-reverse gap-2 px-6 pt-4 pb-6 sm:flex-row sm:justify-end`,e),...t})}function g_({className:e,children:t,...n}){return(0,K.jsxs)(_u,{children:[(0,K.jsx)(yu,{className:`fixed inset-0 z-50 bg-black/40 data-[state=open]:animate-fade-in`}),(0,K.jsxs)(Cu,{className:y(`fixed inset-y-0 left-0 z-50 w-72 max-w-[85vw] bg-sidebar shadow-2xl outline-none data-[state=open]:animate-slide-in`,e),...n,children:[(0,K.jsx)(Du,{className:`sr-only`,children:`Navigation`}),(0,K.jsx)(Ou,{className:`sr-only`,children:`Main navigation`}),t]})]})}var __=1,v_=.9,y_=.8,b_=.17,x_=.1,S_=.999,C_=.9999,w_=.99,T_=/[\\\/_+.#"@\[\(\{&]/,E_=/[\\\/_+.#"@\[\(\{&]/g,D_=/[\s-]/,O_=/[\s-]/g;function k_(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?__:w_;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=k_(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=__:T_.test(e.charAt(l-1))?(d*=y_,p=e.slice(i,l-1).match(E_),p&&i>0&&(d*=S_**+p.length)):D_.test(e.charAt(l-1))?(d*=v_,m=e.slice(i,l-1).match(O_),m&&i>0&&(d*=S_**+m.length)):(d*=b_,i>0&&(d*=S_**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=C_)),(d<x_&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=k_(e,t,n,r,l+1,a+2,o),f*x_>d&&(d=f*x_)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function A_(e){return e.toLowerCase().replace(O_,` `)}function j_(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,k_(e,t,A_(e),A_(t),0,0,{})}var M_=`[cmdk-group=""]`,N_=`[cmdk-group-items=""]`,P_=`[cmdk-group-heading=""]`,F_=`[cmdk-item=""]`,I_=`${F_}:not([aria-disabled="true"])`,L_=`cmdk-item-select`,R_=`data-value`,z_=(e,t,n)=>j_(e,t,n),B_=V.createContext(void 0),V_=()=>V.useContext(B_),H_=V.createContext(void 0),U_=()=>V.useContext(H_),W_=V.createContext(void 0),G_=V.forwardRef((e,t)=>{let n=av(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=av(()=>new Set),i=av(()=>new Map),a=av(()=>new Map),o=av(()=>new Set),s=rv(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,..._}=e,v=we(),y=we(),b=we(),x=V.useRef(null),S=cv();iv(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,C.emit()}},[u]),iv(()=>{S(6,k)},[]);let C=V.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)O(),E(),S(1,D);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(b);e?e.focus():(i=document.getElementById(v))==null||i.focus()}if(S(7,()=>{n.current.selectedItemId=A()?.id,C.emit()}),r||S(5,k),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}C.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),w=V.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,T(t,r)),S(2,()=>{E(),C.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),S(3,()=>{O(),E(),n.current.value||D(),C.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=A();S(4,()=>{O(),t?.getAttribute(`id`)===e&&D(),C.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:v,inputId:b,labelId:y,listInnerRef:x}),[]);function T(e,t){let r=s.current?.filter??z_;return e?r(e,n.current.search,t):0}function E(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=x.current;j().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(N_);t?t.appendChild(e.parentElement===t?e:e.closest(`${N_} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${N_} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=x.current?.querySelector(`${M_}[${R_}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function D(){let e=j().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(R_);C.setState(`value`,e||void 0)}function O(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=T(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function k(){var e;let t=A();t&&(t.parentElement?.firstChild===t&&((e=t.closest(M_)?.querySelector(P_))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function A(){return x.current?.querySelector(`${F_}[aria-selected="true"]`)}function j(){return Array.from(x.current?.querySelectorAll(I_)||[])}function M(e){let t=j()[e];t&&C.setState(`value`,t.getAttribute(R_))}function N(e){var t;let n=A(),r=j(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&C.setState(`value`,a.getAttribute(R_))}function ee(e){let t=A()?.closest(M_),n;for(;t&&!n;)t=e>0?tv(t,M_):nv(t,M_),n=t?.querySelector(I_);n?C.setState(`value`,n.getAttribute(R_)):N(e)}let P=()=>M(j().length-1),te=e=>{e.preventDefault(),e.metaKey?P():e.altKey?ee(1):N(1)},ne=e=>{e.preventDefault(),e.metaKey?M(0):e.altKey?ee(-1):N(-1)};return V.createElement(R.div,{ref:t,tabIndex:-1,..._,"cmdk-root":``,onKeyDown:e=>{var t;(t=_.onKeyDown)==null||t.call(_,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:g&&e.ctrlKey&&te(e);break;case`ArrowDown`:te(e);break;case`p`:case`k`:g&&e.ctrlKey&&ne(e);break;case`ArrowUp`:ne(e);break;case`Home`:e.preventDefault(),M(0);break;case`End`:e.preventDefault(),P();break;case`Enter`:{e.preventDefault();let t=A();if(t){let e=new Event(L_);t.dispatchEvent(e)}}}}},V.createElement(`label`,{"cmdk-label":``,htmlFor:w.inputId,id:w.labelId,style:dv},c),uv(e,e=>V.createElement(H_.Provider,{value:C},V.createElement(B_.Provider,{value:w},e))))}),K_=V.forwardRef((e,t)=>{let n=we(),r=V.useRef(null),i=V.useContext(W_),a=V_(),o=rv(e),s=o.current?.forceMount??i?.forceMount;iv(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=sv(n,r,[e.value,e.children,r],e.keywords),l=U_(),u=ov(e=>e.value&&e.value===c.current),d=ov(e=>s||a.filter()===!1?!0:!e.search||e.filtered.items.get(n)>0);V.useEffect(()=>{let t=r.current;if(t&&!e.disabled)return t.addEventListener(L_,f),()=>t.removeEventListener(L_,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;p(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function p(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:m,value:h,onSelect:g,forceMount:_,keywords:v,...y}=e;return V.createElement(R.div,{ref:me(r,t),...y,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!m,"aria-selected":!!u,"data-disabled":!!m,"data-selected":!!u,onPointerMove:m||a.getDisablePointerSelection()?void 0:p,onClick:m?void 0:f},e.children)}),q_=V.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=we(),s=V.useRef(null),c=V.useRef(null),l=we(),u=V_(),d=ov(e=>i||u.filter()===!1?!0:!e.search||e.filtered.groups.has(o));iv(()=>u.group(o),[]),sv(o,s,[e.value,e.heading,c]);let f=V.useMemo(()=>({id:o,forceMount:i}),[i]);return V.createElement(R.div,{ref:me(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:!d||void 0},n&&V.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),uv(e,e=>V.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},V.createElement(W_.Provider,{value:f},e))))}),J_=V.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=V.useRef(null),a=ov(e=>!e.search);return!n&&!a?null:V.createElement(R.div,{ref:me(i,t),...r,"cmdk-separator":``,role:`separator`})}),Y_=V.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=U_(),o=ov(e=>e.search),s=ov(e=>e.selectedItemId),c=V_();return V.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),V.createElement(R.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),X_=V.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=V.useRef(null),o=V.useRef(null),s=ov(e=>e.selectedItemId),c=V_();return V.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),V.createElement(R.div,{ref:me(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},uv(e,e=>V.createElement(`div`,{ref:me(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),Z_=V.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return V.createElement(du,{open:n,onOpenChange:r},V.createElement(_u,{container:o},V.createElement(yu,{"cmdk-overlay":``,className:i}),V.createElement(Cu,{"aria-label":e.label,"cmdk-dialog":``,className:a},V.createElement(G_,{ref:t,...s}))))}),Q_=V.forwardRef((e,t)=>ov(e=>e.filtered.count===0)?V.createElement(R.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),$_=V.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return V.createElement(R.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},uv(e,e=>V.createElement(`div`,{"aria-hidden":!0},e)))}),ev=Object.assign(G_,{List:X_,Item:K_,Input:Y_,Group:q_,Separator:J_,Dialog:Z_,Empty:Q_,Loading:$_});function tv(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function nv(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function rv(e){let t=V.useRef(e);return iv(()=>{t.current=e}),t}var iv=typeof window>`u`?V.useEffect:V.useLayoutEffect;function av(e){let t=V.useRef();return t.current===void 0&&(t.current=e()),t}function ov(e){let t=U_(),n=()=>e(t.snapshot());return V.useSyncExternalStore(t.subscribe,n,n)}function sv(e,t,n,r=[]){let i=V.useRef(),a=V_();return iv(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(R_,s),i.current=s}),i}var cv=()=>{let[e,t]=V.useState(),n=av(()=>new Map);return iv(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function lv(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function uv({asChild:e,children:t},n){return e&&V.isValidElement(t)?V.cloneElement(lv(t),{ref:t.ref},n(t.props.children)):n(t)}var dv={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},fv={lesson:{icon:bo,label:`Lesson`,tint:`bg-sky-500/10 text-sky-600 dark:text-sky-400`,solid:`bg-sky-500`},resource:{icon:Yo,label:`Resource`,tint:`bg-slate-500/10 text-slate-600 dark:text-slate-300`,solid:`bg-slate-500`},assignment:{icon:Po,label:`Assignment`,tint:`bg-amber-500/10 text-amber-600 dark:text-amber-400`,solid:`bg-amber-500`},quiz:{icon:Zo,label:`Quiz`,tint:`bg-violet-500/10 text-violet-600 dark:text-violet-400`,solid:`bg-violet-500`},forum:{icon:ss,label:`Forum`,tint:`bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`,solid:`bg-emerald-500`}};function pv(e,t){return`/courses/${e}/activities/${t}`}var mv=c(`inline-flex items-center gap-1 whitespace-nowrap rounded-full px-2 py-0.5 text-xs font-medium [&_svg]:size-3 [&_svg]:shrink-0`,{variants:{variant:{default:`bg-primary/10 text-primary`,neutral:`bg-muted text-muted-foreground`,outline:`border text-muted-foreground`,success:`bg-emerald-500/12 text-emerald-700 dark:text-emerald-400`,warning:`bg-amber-500/15 text-amber-700 dark:text-amber-400`,danger:`bg-red-500/12 text-red-700 dark:text-red-400`,info:`bg-sky-500/12 text-sky-700 dark:text-sky-400`,violet:`bg-violet-500/12 text-violet-700 dark:text-violet-400`,solid:`bg-foreground text-background`}},defaultVariants:{variant:`neutral`}});function hv({className:e,variant:t,...n}){return(0,K.jsx)(`span`,{className:y(mv({variant:t}),e),...n})}function gv({color:e,imageUrl:t,title:n,className:r,children:i}){return(0,K.jsxs)(`div`,{className:y(`relative overflow-hidden`,r),style:o_(e,t),children:[n&&!t&&(0,K.jsx)(`span`,{className:`pointer-events-none absolute -right-2 -bottom-6 text-[96px] leading-none font-black tracking-tighter text-white/15 select-none`,children:n.split(/\s+/).slice(0,2).map(e=>e[0]).join(``)}),i]})}var _v={teacher:{label:`Teaching`,variant:`violet`},assistant:{label:`Assisting`,variant:`info`},student:{label:`Enrolled`,variant:`default`}};function vv({course:e,showProgress:t=!0}){let n=e.myRole?_v[e.myRole]:null;return(0,K.jsxs)(Qa,{to:`/courses/${e.slug}`,className:`group flex flex-col overflow-hidden rounded-xl border bg-card shadow-xs transition-all duration-200 hover:-translate-y-0.5 hover:shadow-lg hover:shadow-black/5 dark:hover:shadow-black/30`,children:[(0,K.jsx)(gv,{color:e.coverColor,imageUrl:e.coverImageUrl,title:e.title,className:`h-28`,children:(0,K.jsxs)(`div`,{className:`absolute inset-x-3 top-3 flex items-center justify-between gap-2`,children:[e.categoryName?(0,K.jsx)(`span`,{className:`rounded-full bg-black/20 px-2 py-0.5 text-[11px] font-medium text-white backdrop-blur-sm`,children:e.categoryName}):(0,K.jsx)(`span`,{}),e.visibility!==`published`&&(0,K.jsx)(`span`,{className:`rounded-full bg-white/90 px-2 py-0.5 text-[11px] font-semibold text-slate-800 capitalize`,children:e.visibility})]})}),(0,K.jsxs)(`div`,{className:`flex flex-1 flex-col p-4`,children:[(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,K.jsx)(`h3`,{className:`line-clamp-2 font-semibold leading-snug tracking-tight group-hover:text-primary`,children:e.title}),n&&(0,K.jsx)(hv,{variant:n.variant,className:`mt-0.5 shrink-0`,children:n.label})]}),(0,K.jsx)(`p`,{className:`mt-1.5 line-clamp-2 text-sm text-muted-foreground`,children:e.summary}),(0,K.jsx)(`div`,{className:`mt-auto pt-4`,children:t&&e.progress!=null?(0,K.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:`Progress`}),(0,K.jsxs)(`span`,{className:`font-semibold tabular-nums`,children:[e.progress,`%`]})]}),(0,K.jsx)(ve,{value:e.progress,tone:e.progress===100?`success`:`primary`})]}):(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-xs text-muted-foreground`,children:[(0,K.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(u_,{users:e.teachers,max:2}),(0,K.jsx)(`span`,{className:`truncate`,children:e.teachers.map(e=>e.name).join(`, `)||`No teacher yet`})]}),(0,K.jsxs)(`span`,{className:`flex shrink-0 items-center gap-3`,children:[(0,K.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(Us,{className:`size-3.5`}),e.studentCount]}),(0,K.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(bo,{className:`size-3.5`}),e.activityCount]})]})]})})]})]})}function yv(){return(0,K.jsxs)(`div`,{className:`overflow-hidden rounded-xl border bg-card`,children:[(0,K.jsx)(`div`,{className:`h-28 animate-pulse bg-muted`}),(0,K.jsxs)(`div`,{className:`space-y-2.5 p-4`,children:[(0,K.jsx)(`div`,{className:`h-4 w-3/4 animate-pulse rounded bg-muted`}),(0,K.jsx)(`div`,{className:`h-3 w-full animate-pulse rounded bg-muted`}),(0,K.jsx)(`div`,{className:`h-3 w-2/3 animate-pulse rounded bg-muted`})]})]})}function bv({type:e,className:t,size:n=`md`}){let r=fv[e],i=r.icon;return(0,K.jsx)(`span`,{className:y(`grid shrink-0 place-items-center rounded-lg`,r.tint,n===`sm`&&`size-7 [&_svg]:size-3.5`,n===`md`&&`size-9 [&_svg]:size-4`,n===`lg`&&`size-11 rounded-xl [&_svg]:size-5`,t),children:(0,K.jsx)(i,{})})}var xv=`flex cursor-pointer items-center gap-3 rounded-lg px-3 py-2 text-sm text-foreground data-[selected=true]:bg-accent [&_svg]:size-4 [&_svg]:shrink-0`,Sv=`[&_[cmdk-group-heading]]:px-3 [&_[cmdk-group-heading]]:pt-3 [&_[cmdk-group-heading]]:pb-1.5 [&_[cmdk-group-heading]]:text-[11px] [&_[cmdk-group-heading]]:font-semibold [&_[cmdk-group-heading]]:tracking-wider [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group-heading]]:uppercase`;function Cv({open:e,onOpenChange:t}){let[n,r]=(0,V.useState)(``),i=de(n.trim(),200),a=Mi(),o=le(),{resolved:s,setTheme:c}=r_();(0,V.useEffect)(()=>{e||r(``)},[e]);let{data:l,isFetching:u}=m({queryKey:[`search`,i],queryFn:()=>P.get(`/search?q=${encodeURIComponent(i)}`),enabled:e&&i.length>=2,placeholderData:e=>e}),d=e=>{t(!1),a(e)},f=[{label:`Dashboard`,icon:qo,path:`/`},{label:`My courses`,icon:bo,path:`/my-courses`},{label:`Explore courses`,icon:Io,path:`/catalog`},{label:`Calendar`,icon:wo,path:`/calendar`},{label:`Profile`,icon:Vs,path:`/profile`},{label:`Create a course`,icon:hs,path:`/courses/new`,show:D(o?.role)},{label:`Administration`,icon:Cs,path:`/admin`,show:o?.role===`admin`},{label:`Manage users`,icon:Us,path:`/admin/users`,show:o?.role===`admin`}],p=n.trim().toLowerCase(),h=f.filter(e=>e.show!==!1&&(!p||e.label.toLowerCase().includes(p))),g=i.length>=2,_=g?l:void 0;return(0,K.jsx)(d_,{open:e,onOpenChange:t,children:(0,K.jsx)(f_,{hideClose:!0,className:`top-[15%] max-w-xl translate-y-0 overflow-hidden p-0`,"aria-describedby":void 0,children:(0,K.jsxs)(ev,{shouldFilter:!1,label:`Search`,className:`flex flex-col`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-3 border-b px-4`,children:[(0,K.jsx)(xs,{className:`size-4.5 shrink-0 text-muted-foreground`}),(0,K.jsx)(ev.Input,{value:n,onValueChange:r,placeholder:`Search courses, activities and people…`,className:`h-13 flex-1 bg-transparent text-[15px] outline-none placeholder:text-muted-foreground`}),u&&(0,K.jsx)(Ee,{className:`size-4`})]}),(0,K.jsxs)(ev.List,{className:`ck-scrollbar max-h-[min(60vh,28rem)] overflow-y-auto p-2`,children:[(0,K.jsx)(ev.Empty,{className:`px-3 py-10 text-center text-sm text-muted-foreground`,children:g?`No matches. Try a different search.`:`Type to search.`}),_&&_.courses.length>0&&(0,K.jsx)(ev.Group,{heading:`Courses`,className:Sv,children:_.courses.map(e=>(0,K.jsxs)(ev.Item,{value:`course-${e.id}`,onSelect:()=>d(`/courses/${e.slug}`),className:xv,children:[(0,K.jsx)(`span`,{className:`size-6 shrink-0 rounded-md`,style:s_(e.coverColor)}),(0,K.jsx)(`span`,{className:`truncate`,children:e.title})]},e.id))}),_&&_.activities.length>0&&(0,K.jsx)(ev.Group,{heading:`Activities`,className:Sv,children:_.activities.map(e=>(0,K.jsxs)(ev.Item,{value:`activity-${e.id}`,onSelect:()=>d(pv(e.course.slug,e.id)),className:xv,children:[(0,K.jsx)(bv,{type:e.type,size:`sm`}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.title}),(0,K.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:e.course.title})]},e.id))}),_&&_.users.length>0&&(0,K.jsx)(ev.Group,{heading:`People`,className:Sv,children:_.users.map(e=>(0,K.jsxs)(ev.Item,{value:`user-${e.id}`,onSelect:()=>d(`/admin/users?q=${encodeURIComponent(e.email)}`),className:xv,children:[(0,K.jsx)(l_,{user:e,size:`xs`}),(0,K.jsx)(`span`,{className:`truncate`,children:e.name}),(0,K.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:e.email})]},e.id))}),h.length>0&&(0,K.jsxs)(ev.Group,{heading:`Go to`,className:Sv,children:[h.map(e=>(0,K.jsxs)(ev.Item,{value:`link-${e.path}`,onSelect:()=>d(e.path),className:xv,children:[(0,K.jsx)(e.icon,{className:`text-muted-foreground`}),e.label]},e.path)),(!p||`theme dark light`.includes(p))&&(0,K.jsxs)(ev.Item,{value:`toggle-theme`,onSelect:()=>{c(s===`dark`?`light`:`dark`),t(!1)},className:xv,children:[(0,K.jsx)(ls,{className:`text-muted-foreground`}),`Switch to `,s===`dark`?`light`:`dark`,` mode`]})]})]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-4 border-t bg-muted/40 px-4 py-2 text-[11px] text-muted-foreground`,children:[(0,K.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(Ae,{children:`↑`}),(0,K.jsx)(Ae,{children:`↓`}),` to navigate`]}),(0,K.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(Ae,{children:(0,K.jsx)(Ro,{className:`size-3`})}),`to open`]}),(0,K.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(Ae,{children:`esc`}),` to close`]})]})]})})})}function wv({name:e,className:t}){return(0,K.jsxs)(`span`,{className:y(`flex items-center gap-2.5`,t),children:[(0,K.jsx)(`span`,{className:`grid size-8 place-items-center rounded-[10px] bg-gradient-to-br from-primary to-primary/70 text-primary-foreground shadow-sm shadow-primary/30`,children:(0,K.jsx)(Go,{className:`size-[18px]`})}),(0,K.jsx)(`span`,{className:`truncate text-[15px] font-semibold tracking-tight`,children:e})]})}function Tv({to:e,icon:t,children:n,end:r,onNavigate:i}){return(0,K.jsx)(to,{to:e,end:r,onClick:i,className:({isActive:e})=>y(`group flex h-9 items-center gap-3 rounded-lg px-2.5 text-sm font-medium text-muted-foreground transition-colors hover:bg-foreground/[0.04] hover:text-foreground`,e&&`bg-card text-foreground shadow-xs ring-1 ring-border`),children:({isActive:e})=>(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(t,{className:y(`size-[18px] shrink-0`,e&&`text-primary`)}),(0,K.jsx)(`span`,{className:`truncate`,children:n})]})})}function Ev({course:e,onNavigate:t}){return(0,K.jsxs)(to,{to:`/courses/${e.slug}`,onClick:t,className:({isActive:e})=>y(`flex h-8 items-center gap-3 rounded-lg px-2.5 text-[13px] text-muted-foreground transition-colors hover:bg-foreground/[0.04] hover:text-foreground`,e&&`bg-foreground/[0.05] font-medium text-foreground`),children:[(0,K.jsx)(`span`,{className:`size-2.5 shrink-0 rounded-[4px]`,style:s_(e.coverColor)}),(0,K.jsx)(`span`,{className:`truncate`,children:e.title})]})}function Dv({onNavigate:e}){let{data:t}=S(),n=t?.user,{data:r}=m({queryKey:[`courses`,`mine`],queryFn:()=>P.get(`/courses/mine`),enabled:!!n}),i=(r??[]).filter(e=>e.myRole===`student`).slice(0,6),a=(r??[]).filter(e=>e.myRole&&e.myRole!==`student`).slice(0,6);return(0,K.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,K.jsx)(`div`,{className:`flex h-14 items-center px-4`,children:(0,K.jsx)(Qa,{to:`/`,onClick:e,className:`min-w-0`,children:(0,K.jsx)(wv,{name:t?.site.name??`Coursekit`})})}),(0,K.jsxs)(`nav`,{className:`ck-scrollbar flex-1 space-y-6 overflow-y-auto px-3 py-3`,children:[(0,K.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,K.jsx)(Tv,{to:`/`,end:!0,icon:qo,onNavigate:e,children:`Dashboard`}),(0,K.jsx)(Tv,{to:`/my-courses`,icon:bo,onNavigate:e,children:`My courses`}),(0,K.jsx)(Tv,{to:`/catalog`,icon:Io,onNavigate:e,children:`Explore`}),(0,K.jsx)(Tv,{to:`/calendar`,icon:wo,onNavigate:e,children:`Calendar`})]}),a.length>0&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`p`,{className:`mb-1.5 px-2.5 text-[11px] font-semibold tracking-wider text-muted-foreground/80 uppercase`,children:`Teaching`}),(0,K.jsx)(`div`,{className:`space-y-0.5`,children:a.map(t=>(0,K.jsx)(Ev,{course:t,onNavigate:e},t.id))})]}),i.length>0&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`p`,{className:`mb-1.5 px-2.5 text-[11px] font-semibold tracking-wider text-muted-foreground/80 uppercase`,children:`Learning`}),(0,K.jsx)(`div`,{className:`space-y-0.5`,children:i.map(t=>(0,K.jsx)(Ev,{course:t,onNavigate:e},t.id))})]}),n?.role===`admin`&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`p`,{className:`mb-1.5 px-2.5 text-[11px] font-semibold tracking-wider text-muted-foreground/80 uppercase`,children:`Site`}),(0,K.jsx)(Tv,{to:`/admin`,icon:Cs,onNavigate:e,children:`Administration`})]})]}),(0,K.jsxs)(`div`,{className:`space-y-3 border-t border-sidebar-border p-3`,children:[D(n?.role)&&(0,K.jsx)(k,{asChild:!0,variant:`outline`,className:`w-full justify-start`,size:`sm`,children:(0,K.jsxs)(Qa,{to:`/courses/new`,onClick:e,children:[(0,K.jsx)(hs,{}),` New course`]})}),n&&(0,K.jsxs)(Qa,{to:`/profile`,onClick:e,className:`flex items-center gap-3 rounded-lg p-1.5 transition-colors hover:bg-foreground/[0.04]`,children:[(0,K.jsx)(l_,{user:n,size:`sm`}),(0,K.jsxs)(`span`,{className:`min-w-0`,children:[(0,K.jsx)(`span`,{className:`block truncate text-sm font-medium`,children:n.name}),(0,K.jsx)(`span`,{className:`block truncate text-xs text-muted-foreground`,children:w[n.role]})]})]})]})]})}var Ov={grade:go,announcement:ts,forum:as,enrolment:zs};function kv({type:e}){let t=Ov[e]??vo;return(0,K.jsx)(`span`,{className:y(`grid size-8 shrink-0 place-items-center rounded-full`,e===`grade`?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`:e===`announcement`?`bg-amber-500/12 text-amber-600 dark:text-amber-400`:e===`forum`?`bg-sky-500/10 text-sky-600 dark:text-sky-400`:`bg-primary/10 text-primary`),children:(0,K.jsx)(t,{className:`size-4`})})}function Av(){return m({queryKey:[`notifications`],queryFn:()=>P.get(`/notifications`),refetchInterval:6e4})}function jv(){let{data:e}=Av(),t=I(),n=Mi(),[r,a]=(0,V.useState)(!1),o=e?.unreadCount??0,s=async e=>{await P.post(`/notifications/read`,e?{ids:e}:{}),await t.invalidateQueries({queryKey:[`notifications`]})};return(0,K.jsxs)(Yg,{open:r,onOpenChange:a,children:[(0,K.jsx)(Xg,{asChild:!0,children:(0,K.jsxs)(k,{variant:`ghost`,size:`icon`,className:`relative`,"aria-label":`Notifications${o?` (${o} unread)`:``}`,children:[(0,K.jsx)(vo,{className:`size-[18px]`}),o>0&&(0,K.jsx)(`span`,{className:`absolute top-1 right-1 grid h-4 min-w-4 place-items-center rounded-full bg-primary px-1 text-[10px] font-semibold text-primary-foreground ring-2 ring-background`,children:o>9?`9+`:o})]})}),(0,K.jsxs)(Zg,{align:`end`,className:`w-[min(24rem,calc(100vw-1.5rem))] p-0`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between border-b px-4 py-3`,children:[(0,K.jsx)(`p`,{className:`text-sm font-semibold`,children:`Notifications`}),o>0&&(0,K.jsx)(`button`,{className:`text-xs font-medium text-primary hover:underline`,onClick:()=>s(),children:`Mark all as read`})]}),(0,K.jsxs)(`div`,{className:`ck-scrollbar max-h-96 overflow-y-auto`,children:[(e?.items??[]).slice(0,8).map(e=>(0,K.jsxs)(`button`,{className:`flex w-full gap-3 border-b px-4 py-3 text-left transition-colors last:border-0 hover:bg-accent/60`,onClick:()=>{a(!1),e.readAt||s([e.id]),e.link&&n(e.link)},children:[(0,K.jsx)(kv,{type:e.type}),(0,K.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`span`,{className:y(`block text-sm leading-snug`,!e.readAt&&`font-semibold`),children:e.title}),e.body&&(0,K.jsx)(`span`,{className:`mt-0.5 line-clamp-2 block text-xs text-muted-foreground`,children:e.body}),(0,K.jsx)(`span`,{className:`mt-1 block text-[11px] text-muted-foreground`,children:i(e.createdAt)})]}),!e.readAt&&(0,K.jsx)(`span`,{className:`mt-1.5 size-2 shrink-0 rounded-full bg-primary`})]},e.id)),e&&e.items.length===0&&(0,K.jsx)(`p`,{className:`px-4 py-10 text-center text-sm text-muted-foreground`,children:`You're all caught up.`})]}),(0,K.jsx)(`div`,{className:`border-t p-2`,children:(0,K.jsx)(k,{asChild:!0,variant:`ghost`,size:`sm`,className:`w-full`,onClick:()=>a(!1),children:(0,K.jsx)(Qa,{to:`/notifications`,children:`View all notifications`})})})]})]})}function Mv(){let e=le(),{theme:t,setTheme:n}=r_(),r=I(),i=N(),a=Mi();return e?(0,K.jsxs)(Lg,{children:[(0,K.jsx)(Rg,{asChild:!0,children:(0,K.jsx)(`button`,{className:`rounded-full outline-offset-2`,"aria-label":`Account menu`,children:(0,K.jsx)(l_,{user:e,size:`sm`})})}),(0,K.jsxs)(Vg,{className:`w-60`,children:[(0,K.jsxs)(`div`,{className:`px-2.5 py-2`,children:[(0,K.jsx)(`p`,{className:`truncate text-sm font-semibold`,children:e.name}),(0,K.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:e.email})]}),(0,K.jsx)(Gg,{}),(0,K.jsx)(Ug,{asChild:!0,children:(0,K.jsxs)(Qa,{to:`/profile`,children:[(0,K.jsx)(Vs,{}),` Profile`]})}),(0,K.jsxs)(zg,{children:[(0,K.jsxs)(Kg,{children:[(0,K.jsx)(ds,{}),` Appearance`]}),(0,K.jsxs)(qg,{children:[(0,K.jsx)(Jg,{checked:t===`light`,onSelect:()=>n(`light`),children:`Light`}),(0,K.jsx)(Jg,{checked:t===`dark`,onSelect:()=>n(`dark`),children:`Dark`}),(0,K.jsx)(Jg,{checked:t===`system`,onSelect:()=>n(`system`),children:`System`})]})]}),e.role===`admin`&&(0,K.jsx)(Ug,{asChild:!0,children:(0,K.jsxs)(Qa,{to:`/admin`,children:[(0,K.jsx)(Cs,{}),` Administration`]})}),(0,K.jsx)(Gg,{}),(0,K.jsxs)(Ug,{onSelect:async()=>{try{await P.post(`/auth/logout`)}finally{let e=r.getQueryData([`session`]);r.clear(),e&&i({...e,user:null,impersonator:null}),a(`/login`)}},children:[(0,K.jsx)($o,{}),` Sign out`]})]})]}):null}function Nv(){let{data:e}=S(),t=I(),n=N(),r=Mi();return!e?.impersonator||!e.user?null:(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-x-3 gap-y-1 bg-amber-400 px-4 py-2 text-center text-[13px] font-medium text-amber-950`,children:[(0,K.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(Ls,{className:`size-4`}),` You're viewing the site as `,e.user.name,`.`]}),(0,K.jsxs)(`button`,{onClick:async()=>{try{let e=await P.post(`/auth/stop-impersonating`);t.clear(),n(e),r(`/admin/users`)}catch(e){_e.error(A(e))}},className:`font-semibold underline underline-offset-2`,children:[`Return to `,e.impersonator.name]})]})}function Pv(){let{resolved:e,setTheme:t}=r_();return(0,K.jsx)(k,{variant:`ghost`,size:`icon`,"aria-label":`Toggle dark mode`,onClick:()=>t(e===`dark`?`light`:`dark`),children:e===`dark`?(0,K.jsx)(Ds,{className:`size-[18px]`}):(0,K.jsx)(ls,{className:`size-[18px]`})})}function Fv(){let[e,t]=(0,V.useState)(!1),[n,r]=(0,V.useState)(!1),i=Ai();(0,V.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),r(e=>!e))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,V.useEffect)(()=>{window.scrollTo({top:0})},[i.pathname]);let a=typeof navigator<`u`&&/mac/i.test(navigator.platform);return(0,K.jsxs)(`div`,{className:`flex min-h-dvh`,children:[(0,K.jsx)(`aside`,{className:`sticky top-0 hidden h-dvh w-64 shrink-0 border-r border-sidebar-border bg-sidebar lg:block`,children:(0,K.jsx)(Dv,{})}),(0,K.jsx)(d_,{open:e,onOpenChange:t,children:(0,K.jsx)(g_,{children:(0,K.jsx)(Dv,{onNavigate:()=>t(!1)})})}),(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,K.jsx)(Nv,{}),(0,K.jsxs)(`header`,{className:`sticky top-0 z-30 flex h-14 items-center gap-2 border-b bg-background/80 px-3 backdrop-blur-lg sm:px-5`,children:[(0,K.jsx)(k,{variant:`ghost`,size:`icon`,className:`lg:hidden`,onClick:()=>t(!0),"aria-label":`Open navigation`,children:(0,K.jsx)(rs,{className:`size-5`})}),(0,K.jsxs)(`button`,{onClick:()=>r(!0),className:`flex h-9 min-w-0 flex-1 items-center gap-2.5 rounded-lg border bg-card px-3 text-sm text-muted-foreground shadow-xs transition-colors hover:border-foreground/20 sm:max-w-sm`,children:[(0,K.jsx)(xs,{className:`size-4 shrink-0`}),(0,K.jsx)(`span`,{className:`truncate`,children:`Search courses and activities…`}),(0,K.jsxs)(`span`,{className:`ml-auto hidden items-center gap-0.5 sm:flex`,children:[(0,K.jsx)(Ae,{children:a?`⌘`:`Ctrl`}),(0,K.jsx)(Ae,{children:`K`})]})]}),(0,K.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,K.jsx)(Pv,{}),(0,K.jsx)(jv,{}),(0,K.jsx)(`div`,{className:`ml-1.5`,children:(0,K.jsx)(Mv,{})})]})]}),(0,K.jsx)(`main`,{className:`flex-1`,children:(0,K.jsx)(ja,{})})]}),(0,K.jsx)(Cv,{open:n,onOpenChange:r})]})}function Iv({children:e,className:t,size:n=`default`}){return(0,K.jsx)(`div`,{className:y(`mx-auto w-full px-4 py-6 sm:px-6 lg:px-8 lg:py-8`,n==="default"&&`max-w-7xl`,n===`narrow`&&`max-w-3xl`,n===`wide`&&`max-w-[1600px]`,t),children:e})}var Lv=`w-full rounded-lg border border-input bg-card px-3 text-sm text-foreground shadow-xs transition-colors placeholder:text-muted-foreground/70 focus-visible:border-primary focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-primary/15 disabled:cursor-not-allowed disabled:opacity-60 aria-invalid:border-destructive`;function Rv({className:e,...t}){return(0,K.jsx)(`input`,{className:y(Lv,`h-9`,e),...t})}function zv({className:e,...t}){return(0,K.jsx)(`textarea`,{className:y(Lv,`min-h-24 py-2 leading-relaxed`,e),...t})}function Bv({className:e,children:t,...n}){return(0,K.jsx)(`select`,{className:y(Lv,`h-9 appearance-none bg-[length:16px] bg-[right_0.6rem_center] bg-no-repeat pr-9`,`bg-[url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")]`,e),...n,children:t})}function Vv({className:e,...t}){return(0,K.jsx)(`label`,{className:y(`text-sm font-medium leading-none text-foreground`,e),...t})}function Hv({label:e,hint:t,error:n,className:r,children:i,optional:a}){let o=(0,V.useId)(),s=`${o}-hint`;return(0,K.jsxs)(`div`,{className:y(`space-y-1.5`,r),children:[e&&(0,K.jsxs)(Vv,{htmlFor:o,className:`flex items-center gap-1.5`,children:[e,a&&(0,K.jsx)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:`Optional`})]}),i({id:o,"aria-invalid":n?!0:void 0,"aria-describedby":t||n?s:void 0}),(n||t)&&(0,K.jsx)(`p`,{id:s,className:y(`text-xs`,n?`text-destructive`:`text-muted-foreground`),children:n||t})]})}function Uv({className:e,...t}){return(0,K.jsx)(id,{className:y(`peer grid size-4.5 shrink-0 place-items-center rounded-[5px] border border-input bg-card shadow-xs transition-colors data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground disabled:opacity-50`,e),...t,children:(0,K.jsx)(od,{children:(0,K.jsx)(Eo,{className:`size-3.5`,strokeWidth:3})})})}function Wv({className:e,...t}){return(0,K.jsx)(Jh,{className:y(`relative inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent bg-input transition-colors data-[state=checked]:bg-primary disabled:opacity-50`,e),...t,children:(0,K.jsx)(Xh,{className:`pointer-events-none block size-4 translate-x-0.5 rounded-full bg-white shadow-sm ring-0 transition-transform data-[state=checked]:translate-x-[18px]`})})}function Gv({label:e,description:t,checked:n,onCheckedChange:r,disabled:i}){let a=(0,V.useId)();return(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-4 rounded-lg border bg-card px-3.5 py-3`,children:[(0,K.jsxs)(`label`,{htmlFor:a,className:`min-w-0 cursor-pointer`,children:[(0,K.jsx)(`span`,{className:`block text-sm font-medium`,children:e}),t&&(0,K.jsx)(`span`,{className:`mt-0.5 block text-xs text-muted-foreground`,children:t})]}),(0,K.jsx)(Wv,{id:a,checked:n,onCheckedChange:r,disabled:i,className:`mt-0.5`})]})}function Kv({value:e,onChange:t,options:n,columns:r=3}){let i=(0,V.useId)();return(0,K.jsx)(`div`,{role:`radiogroup`,className:y(`grid gap-2.5`,r===2&&`sm:grid-cols-2`,r===3&&`sm:grid-cols-3`,r===4&&`sm:grid-cols-4`),children:n.map(n=>{let r=n.value===e;return(0,K.jsxs)(`label`,{className:y(`relative flex cursor-pointer gap-3 rounded-xl border bg-card p-3.5 text-left transition-all hover:border-primary/40`,r&&`border-primary bg-primary/[0.04] ring-3 ring-primary/10`),children:[(0,K.jsx)(`input`,{type:`radio`,name:i,className:`sr-only`,checked:r,onChange:()=>t(n.value)}),n.icon&&(0,K.jsx)(`span`,{className:y(`mt-0.5 text-muted-foreground`,r&&`text-primary`),children:n.icon}),(0,K.jsxs)(`span`,{className:`min-w-0`,children:[(0,K.jsx)(`span`,{className:`block text-sm font-medium`,children:n.label}),n.description&&(0,K.jsx)(`span`,{className:`mt-0.5 block text-xs leading-snug text-muted-foreground`,children:n.description})]})]},n.value)})})}function qv({tagline:e}){return(0,K.jsxs)(`div`,{className:`relative hidden overflow-hidden lg:block`,style:{backgroundImage:`linear-gradient(150deg, var(--brand-light) 0%, color-mix(in oklab, var(--brand-light) 55%, #0b0d1a) 100%)`},children:[(0,K.jsx)(`div`,{className:`absolute inset-0 opacity-40`,style:{backgroundImage:`radial-gradient(rgb(255 255 255 / 0.18) 1px, transparent 1px)`,backgroundSize:`22px 22px`}}),(0,K.jsx)(`div`,{className:`absolute -top-32 -right-24 size-[28rem] rounded-full bg-white/15 blur-3xl`}),(0,K.jsx)(`div`,{className:`absolute -bottom-40 -left-20 size-[26rem] rounded-full bg-black/20 blur-3xl`}),(0,K.jsxs)(`div`,{className:`relative flex h-full flex-col justify-between p-12 text-white xl:p-16`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-2 rounded-full bg-white/15 px-3 py-1 text-xs font-medium backdrop-blur`,children:[(0,K.jsx)(Ts,{className:`size-3.5`}),` Open-source learning platform`]}),(0,K.jsx)(`h2`,{className:`mt-6 max-w-md text-4xl leading-[1.1] font-semibold tracking-tight text-balance xl:text-5xl`,children:e})]}),(0,K.jsxs)(`div`,{className:`relative my-10 max-w-md`,children:[(0,K.jsxs)(`div`,{className:`rounded-2xl bg-white/95 p-5 text-slate-900 shadow-2xl shadow-black/30`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,K.jsx)(`span`,{className:`grid size-10 place-items-center rounded-xl bg-gradient-to-br from-sky-400 to-indigo-500 text-white`,children:(0,K.jsx)(bo,{className:`size-5`})}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`p`,{className:`text-sm font-semibold`,children:`Modern Web Development`}),(0,K.jsx)(`p`,{className:`text-xs text-slate-500`,children:`Next: State and effects · 15 min`})]}),(0,K.jsx)(`span`,{className:`text-sm font-semibold text-indigo-600`,children:`72%`})]}),(0,K.jsx)(`div`,{className:`mt-4 h-1.5 overflow-hidden rounded-full bg-slate-100`,children:(0,K.jsx)(`div`,{className:`h-full w-[72%] rounded-full bg-indigo-500`})})]}),(0,K.jsxs)(`div`,{className:`absolute -right-6 -bottom-8 flex items-center gap-3 rounded-xl bg-white p-3 pr-4 text-slate-900 shadow-xl shadow-black/25`,children:[(0,K.jsx)(`span`,{className:`grid size-9 place-items-center rounded-full bg-emerald-100 text-emerald-600`,children:(0,K.jsx)(go,{className:`size-4.5`})}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`p`,{className:`text-xs font-semibold`,children:`Quiz graded`}),(0,K.jsx)(`p`,{className:`text-xs text-slate-500`,children:`You scored 9 / 10`})]})]})]}),(0,K.jsx)(`div`,{className:`grid max-w-lg grid-cols-2 gap-x-6 gap-y-5`,children:[{icon:bo,title:`Courses that flow`,text:`Lessons, files and links organised into clear sections.`},{icon:Mo,title:`Assignments with feedback`,text:`Collect work, grade it and reply in one place.`},{icon:Zo,title:`Auto-graded quizzes`,text:`Five question types, timers, attempts and review.`},{icon:ss,title:`Discussions`,text:`Forums and announcements keep everyone in the loop.`}].map(e=>(0,K.jsxs)(`div`,{className:`flex gap-3`,children:[(0,K.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-white/15`,children:(0,K.jsx)(e.icon,{className:`size-4`})}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`p`,{className:`text-sm font-semibold`,children:e.title}),(0,K.jsx)(`p`,{className:`mt-0.5 text-xs leading-relaxed text-white/75`,children:e.text})]})]},e.title))})]})]})}function Jv({title:e,subtitle:t,children:n}){let{data:r}=S();return(0,K.jsxs)(`div`,{className:`grid min-h-dvh bg-background lg:grid-cols-[minmax(0,1fr)_minmax(0,1.1fr)]`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col px-6 py-7 sm:px-12`,children:[(0,K.jsx)(wv,{name:r?.site.name??`Coursekit`}),(0,K.jsxs)(`div`,{className:`mx-auto flex w-full max-w-sm flex-1 flex-col justify-center py-12`,children:[(0,K.jsx)(`h1`,{className:`text-[26px] font-semibold tracking-tight`,children:e}),t&&(0,K.jsx)(`p`,{className:`mt-1.5 text-sm text-muted-foreground`,children:t}),(0,K.jsx)(`div`,{className:`mt-8`,children:n})]}),(0,K.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Powered by `,(0,K.jsx)(`span`,{className:`font-medium text-foreground`,children:`Coursekit`}),` `,r?.version&&`v${r.version}`]})]}),(0,K.jsx)(qv,{tagline:r?.site.tagline??`Learn anything, together.`})]})}function Yv(e){let[t,n]=(0,V.useState)(!1);return(0,K.jsxs)(`div`,{className:`relative`,children:[(0,K.jsx)(Rv,{type:t?`text`:`password`,className:`pr-10`,...e}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>n(e=>!e),className:`absolute inset-y-0 right-0 grid w-10 place-items-center text-muted-foreground hover:text-foreground`,"aria-label":t?`Hide password`:`Show password`,children:t?(0,K.jsx)(zo,{className:`size-4`}):(0,K.jsx)(Vo,{className:`size-4`})})]})}function Xv(e,t){return e instanceof ie?e.issues.find(e=>e.path===t)?.message:void 0}function Zv({error:e}){return e?(0,K.jsx)(`div`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2.5 text-sm text-destructive`,children:A(e)}):null}function Qv(){let[e]=io(),t=e.get(`next`);return t&&t.startsWith(`/`)&&!t.startsWith(`//`)?t:`/`}function $v(){let e=I(),t=N(),n=Mi(),r=Qv();return i=>{e.clear(),t(i),n(r,{replace:!0})}}function ey(){se(`Sign in`);let{data:e,isLoading:t}=S(),[n,r]=(0,V.useState)(``),[i,a]=(0,V.useState)(``),o=Ue({mutationFn:()=>P.post(`/auth/login`,{email:n,password:i}),onSuccess:$v()}),s=Qv();return t?(0,K.jsx)(Te,{}):e?.needsSetup?(0,K.jsx)(Aa,{to:`/setup`,replace:!0}):e?.user?(0,K.jsx)(Aa,{to:s,replace:!0}):(0,K.jsxs)(Jv,{title:`Welcome back`,subtitle:`Sign in to continue to ${e?.site.name??`Coursekit`}.`,children:[(0,K.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),o.mutate()},className:`space-y-4`,children:[(0,K.jsx)(Zv,{error:o.error}),(0,K.jsx)(Hv,{label:`Email`,children:e=>(0,K.jsx)(Rv,{...e,type:`email`,autoComplete:`email`,autoFocus:!0,required:!0,value:n,onChange:e=>r(e.target.value),placeholder:`you@school.edu`})}),(0,K.jsx)(Hv,{label:`Password`,children:e=>(0,K.jsx)(Yv,{...e,autoComplete:`current-password`,required:!0,value:i,onChange:e=>a(e.target.value)})}),(0,K.jsx)(k,{type:`submit`,size:`lg`,className:`w-full`,loading:o.isPending,children:`Sign in`})]}),e?.site.allowSignup&&(0,K.jsxs)(`p`,{className:`mt-6 text-center text-sm text-muted-foreground`,children:[`New here?`,` `,(0,K.jsx)(Qa,{to:`/register`,className:`font-medium text-primary hover:underline`,children:`Create an account`})]})]})}function ty(){se(`Create account`);let{data:e,isLoading:t}=S(),[n,r]=(0,V.useState)({name:``,email:``,password:``}),i=Ue({mutationFn:()=>P.post(`/auth/register`,n),onSuccess:$v()}),a=Qv();return t?(0,K.jsx)(Te,{}):e?.needsSetup?(0,K.jsx)(Aa,{to:`/setup`,replace:!0}):e?.user?(0,K.jsx)(Aa,{to:a,replace:!0}):e&&!e.site.allowSignup?(0,K.jsx)(Jv,{title:`Registration is closed`,subtitle:`Ask your administrator to create an account for you.`,children:(0,K.jsx)(k,{asChild:!0,variant:`outline`,className:`w-full`,children:(0,K.jsxs)(Qa,{to:`/login`,children:[(0,K.jsx)(fo,{}),` Back to sign in`]})})}):(0,K.jsxs)(Jv,{title:`Create your account`,subtitle:`Start learning in less than a minute.`,children:[(0,K.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),i.mutate()},className:`space-y-4`,children:[(0,K.jsx)(Zv,{error:i.error&&!Xv(i.error,`email`)&&!Xv(i.error,`password`)?i.error:null}),(0,K.jsx)(Hv,{label:`Full name`,error:Xv(i.error,`name`),children:e=>(0,K.jsx)(Rv,{...e,autoComplete:`name`,autoFocus:!0,required:!0,value:n.name,onChange:e=>r({...n,name:e.target.value})})}),(0,K.jsx)(Hv,{label:`Email`,error:Xv(i.error,`email`),children:e=>(0,K.jsx)(Rv,{...e,type:`email`,autoComplete:`email`,required:!0,value:n.email,onChange:e=>r({...n,email:e.target.value})})}),(0,K.jsx)(Hv,{label:`Password`,hint:`At least 8 characters.`,error:Xv(i.error,`password`),children:e=>(0,K.jsx)(Yv,{...e,autoComplete:`new-password`,required:!0,value:n.password,onChange:e=>r({...n,password:e.target.value})})}),(0,K.jsx)(k,{type:`submit`,size:`lg`,className:`w-full`,loading:i.isPending,children:`Create account`})]}),(0,K.jsxs)(`p`,{className:`mt-6 text-center text-sm text-muted-foreground`,children:[`Already have an account?`,` `,(0,K.jsx)(Qa,{to:`/login`,className:`font-medium text-primary hover:underline`,children:`Sign in`})]})]})}function ny(){se(`Set up`);let{data:e,isLoading:t}=S(),[n,r]=(0,V.useState)(0),[i,a]=(0,V.useState)({siteName:`Coursekit Academy`,name:``,email:``,password:``,demo:!0}),o=Ue({mutationFn:()=>P.post(`/auth/setup`,i),onSuccess:$v()});if(t)return(0,K.jsx)(Te,{});if(e&&!e.needsSetup)return(0,K.jsx)(Aa,{to:e.user?`/`:`/login`,replace:!0});let s=[`Your site`,`Admin account`,`Get started`],c=n===0?i.siteName.trim().length>0:n!==1||i.name&&i.email.includes(`@`)&&i.password.length>=8;return(0,K.jsxs)(Jv,{title:n===0?`Welcome to Coursekit 🎉`:n===1?`Create the administrator`:`How would you like to start?`,subtitle:n===0?`Let's set up your learning platform. It takes about a minute.`:n===1?`This account can manage the whole site. You can add more people later.`:`You can always remove demo content later by deleting the demo courses.`,children:[(0,K.jsxs)(`div`,{className:`mb-6 space-y-2`,children:[(0,K.jsx)(`div`,{className:`flex justify-between text-xs font-medium text-muted-foreground`,children:s.map((e,t)=>(0,K.jsxs)(`span`,{className:y(t<=n&&`text-foreground`),children:[t+1,`. `,e]},e))}),(0,K.jsx)(ve,{value:(n+1)/s.length*100})]}),(0,K.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),n<2?r(n+1):o.mutate()},className:`space-y-4`,children:[(0,K.jsx)(Zv,{error:o.error}),n===0&&(0,K.jsx)(Hv,{label:`Site name`,hint:`Shown in the sidebar, emails and browser tabs.`,children:e=>(0,K.jsx)(Rv,{...e,autoFocus:!0,value:i.siteName,onChange:e=>a({...i,siteName:e.target.value})})}),n===1&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Hv,{label:`Your name`,children:e=>(0,K.jsx)(Rv,{...e,autoFocus:!0,autoComplete:`name`,value:i.name,onChange:e=>a({...i,name:e.target.value})})}),(0,K.jsx)(Hv,{label:`Email`,children:e=>(0,K.jsx)(Rv,{...e,type:`email`,autoComplete:`email`,value:i.email,onChange:e=>a({...i,email:e.target.value})})}),(0,K.jsx)(Hv,{label:`Password`,hint:`At least 8 characters.`,children:e=>(0,K.jsx)(Yv,{...e,autoComplete:`new-password`,value:i.password,onChange:e=>a({...i,password:e.target.value})})})]}),n===2&&(0,K.jsx)(`div`,{className:`grid gap-3`,children:[{demo:!0,icon:Ts,title:`Explore with demo content`,text:`Six sample courses with teachers, students, quizzes, grades and discussions.`},{demo:!1,icon:ys,title:`Start fresh`,text:`An empty site, ready for your first course.`}].map(e=>(0,K.jsxs)(`button`,{type:`button`,onClick:()=>a({...i,demo:e.demo}),className:y(`flex items-start gap-3 rounded-xl border bg-card p-4 text-left transition-all hover:border-primary/40`,i.demo===e.demo&&`border-primary ring-3 ring-primary/10`),children:[(0,K.jsx)(`span`,{className:y(`grid size-9 shrink-0 place-items-center rounded-lg bg-muted`,i.demo===e.demo&&`bg-primary/10 text-primary`),children:(0,K.jsx)(e.icon,{className:`size-4.5`})}),(0,K.jsxs)(`span`,{className:`flex-1`,children:[(0,K.jsx)(`span`,{className:`block text-sm font-semibold`,children:e.title}),(0,K.jsx)(`span`,{className:`mt-0.5 block text-xs text-muted-foreground`,children:e.text})]}),i.demo===e.demo&&(0,K.jsx)(Eo,{className:`size-4 text-primary`})]},e.title))}),(0,K.jsxs)(`div`,{className:`flex gap-2 pt-2`,children:[n>0&&(0,K.jsx)(k,{type:`button`,variant:`outline`,size:`lg`,onClick:()=>r(n-1),children:(0,K.jsx)(fo,{})}),(0,K.jsx)(k,{type:`submit`,size:`lg`,className:`flex-1`,disabled:!c,loading:o.isPending,children:n<2?(0,K.jsxs)(K.Fragment,{children:[`Continue `,(0,K.jsx)(mo,{})]}):(0,K.jsxs)(K.Fragment,{children:[`Launch my site `,(0,K.jsx)(ys,{})]})})]})]})]})}function ry({title:e,description:t,actions:n,eyebrow:r,className:i}){return(0,K.jsxs)(`div`,{className:y(`mb-7 flex flex-col gap-4 sm:flex-row sm:items-end sm:justify-between`,i),children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[r&&(0,K.jsx)(`div`,{className:`mb-1.5 text-sm font-medium text-muted-foreground`,children:r}),(0,K.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight text-balance sm:text-[28px]`,children:e}),t&&(0,K.jsx)(`p`,{className:`mt-1.5 max-w-2xl text-[15px] text-muted-foreground`,children:t})]}),n&&(0,K.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:n})]})}function iy({icon:e,label:t,value:n,hint:r,tone:i=`primary`}){return(0,K.jsxs)(`div`,{className:`rounded-xl border bg-card p-4 shadow-xs`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsx)(`span`,{className:`text-[13px] font-medium text-muted-foreground`,children:t}),(0,K.jsx)(`span`,{className:y(`grid size-8 place-items-center rounded-lg`,{primary:`bg-primary/10 text-primary`,emerald:`bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`,amber:`bg-amber-500/12 text-amber-600 dark:text-amber-400`,violet:`bg-violet-500/10 text-violet-600 dark:text-violet-400`,sky:`bg-sky-500/10 text-sky-600 dark:text-sky-400`,rose:`bg-rose-500/10 text-rose-600 dark:text-rose-400`}[i]),children:(0,K.jsx)(e,{className:`size-4`})})]}),(0,K.jsx)(`div`,{className:`mt-2 text-2xl font-semibold tracking-tight`,children:n}),r&&(0,K.jsx)(`div`,{className:`mt-0.5 text-xs text-muted-foreground`,children:r})]})}function ay({children:e,action:t}){return(0,K.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-2`,children:[(0,K.jsx)(`h2`,{className:`text-[15px] font-semibold tracking-tight`,children:e}),t]})}function oy({file:e,onRemove:t}){return(0,K.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg border bg-card px-3 py-2`,children:[(0,K.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-md bg-muted text-muted-foreground`,children:(0,K.jsx)(Uo,{className:`size-4`})}),(0,K.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`min-w-0 flex-1 hover:underline`,children:[(0,K.jsx)(`span`,{className:`block truncate text-sm font-medium`,children:e.name}),(0,K.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:r(e.size)})]}),t&&(0,K.jsx)(k,{type:`button`,variant:`ghost`,size:`icon-xs`,onClick:t,"aria-label":`Remove ${e.name}`,children:(0,K.jsx)(ks,{})})]})}function sy({context:e,courseId:t,onUploaded:n,multiple:r=!1,disabled:i,accept:a,label:o=`Drop files here or click to upload`}){let s=(0,V.useRef)(null),[c,l]=(0,V.useState)(!1),[u,d]=(0,V.useState)(0),f=async r=>{for(let i of Array.from(r)){d(e=>e+1);try{n(await P.upload(i,{context:e,courseId:t}))}catch(e){_e.error(`${i.name}: ${A(e)}`)}finally{d(e=>e-1)}}};return(0,K.jsxs)(`button`,{type:`button`,disabled:i,onClick:()=>s.current?.click(),onDragOver:e=>{e.preventDefault(),l(!0)},onDragLeave:()=>l(!1),onDrop:e=>{e.preventDefault(),l(!1),!i&&e.dataTransfer.files.length&&f(r?e.dataTransfer.files:[e.dataTransfer.files[0]])},className:y(`flex w-full flex-col items-center justify-center gap-2 rounded-xl border-2 border-dashed px-4 py-6 text-center transition-colors hover:border-primary/50 hover:bg-primary/[0.03] disabled:pointer-events-none disabled:opacity-50`,c&&`border-primary bg-primary/5`),children:[(0,K.jsx)(`span`,{className:`grid size-10 place-items-center rounded-full bg-muted text-muted-foreground`,children:u>0?(0,K.jsx)(Ee,{}):(0,K.jsx)(Fs,{className:`size-4.5`})}),(0,K.jsx)(`span`,{className:`text-sm font-medium`,children:u>0?`Uploading…`:o}),(0,K.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-muted-foreground`,children:[(0,K.jsx)(ps,{className:`size-3`}),` Any file type, up to 50 MB`]}),(0,K.jsx)(`input`,{ref:s,type:`file`,hidden:!0,multiple:r,accept:a,onChange:e=>{e.target.files?.length&&f(e.target.files),e.target.value=``}})]})}function cy({className:e,...t}){return(0,K.jsx)(`div`,{className:y(`rounded-xl border bg-card text-card-foreground shadow-xs`,e),...t})}function ly({title:e,description:t,action:n,icon:r,className:i}){return(0,K.jsxs)(`div`,{className:y(`flex items-start justify-between gap-3 px-5 pt-5 pb-3`,i),children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[r&&(0,K.jsx)(`div`,{className:`mt-0.5 text-muted-foreground`,children:r}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`h3`,{className:`text-[15px] font-semibold tracking-tight`,children:e}),t&&(0,K.jsx)(`p`,{className:`mt-0.5 text-sm text-muted-foreground`,children:t})]})]}),n&&(0,K.jsx)(`div`,{className:`shrink-0`,children:n})]})}function uy(e){if(e.status===`overdue`)return`Overdue`;let t=new Date(e.dueAt),n=new Date;n.setHours(0,0,0,0);let r=Math.floor((t.getTime()-n.getTime())/864e5);return r<=0?`Today`:r===1?`Tomorrow`:r<7?`This week`:`Later`}var dy={todo:{label:`To do`,variant:`neutral`},overdue:{label:`Overdue`,variant:`danger`},submitted:{label:`Submitted`,variant:`info`},graded:{label:`Graded`,variant:`success`},done:{label:`Done`,variant:`success`}};function fy({items:e}){if(e.length===0)return(0,K.jsx)(`div`,{className:`px-5 pb-6`,children:(0,K.jsx)(je,{icon:So,title:`Nothing due soon`,description:`Deadlines from your courses will show up here.`,className:`py-8`})});let t=new Map;for(let n of e)t.set(uy(n),[...t.get(uy(n))??[],n]);return(0,K.jsx)(`div`,{className:`pb-2`,children:[`Overdue`,`Today`,`Tomorrow`,`This week`,`Later`].filter(e=>t.has(e)).map(e=>(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`p`,{className:y(`px-5 pt-2 pb-1 text-xs font-semibold`,e===`Overdue`?`text-destructive`:`text-muted-foreground`),children:e}),t.get(e).map(e=>{let t=e.status!==`todo`&&e.status!==`overdue`;return(0,K.jsxs)(Qa,{to:pv(e.course.slug,e.activityId),className:`flex items-center gap-3 px-5 py-2.5 transition-colors hover:bg-accent/50`,children:[(0,K.jsx)(bv,{type:e.type}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`p`,{className:y(`truncate text-sm font-medium`,t&&`text-muted-foreground line-through decoration-muted-foreground/40`),children:e.title}),(0,K.jsxs)(`p`,{className:`flex items-center gap-1.5 truncate text-xs text-muted-foreground`,children:[(0,K.jsx)(`span`,{className:`size-2 shrink-0 rounded-[3px]`,style:s_(e.course.coverColor)}),(0,K.jsx)(`span`,{className:`truncate`,children:e.course.title}),(0,K.jsx)(`span`,{children:`·`}),(0,K.jsx)(`span`,{className:y(`shrink-0`,e.status===`overdue`&&`text-destructive`),children:pe(e.dueAt,t)})]})]}),(0,K.jsx)(hv,{variant:dy[e.status].variant,className:`hidden sm:inline-flex`,children:dy[e.status].label})]},e.activityId)})]},e))})}function py(){return(0,K.jsxs)(`section`,{className:`mt-8`,children:[(0,K.jsx)(ay,{children:`Get started`}),(0,K.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-4`,children:[{to:`/courses/new`,icon:hs,title:`Create a course`,text:`Start a draft and add lessons, quizzes and assignments.`},{to:`/admin/users`,icon:zs,title:`Add people`,text:`Invite teachers and students, or log in as them.`},{to:`/admin/settings`,icon:ds,title:`Make it yours`,text:`Set the site name, tagline and brand colour.`},{to:`/catalog`,icon:Io,title:`Browse the catalog`,text:`See every published course the way students do.`}].map(e=>(0,K.jsxs)(Qa,{to:e.to,className:`group rounded-xl border bg-card p-5 shadow-xs transition-all hover:-translate-y-0.5 hover:border-primary/30 hover:shadow-md`,children:[(0,K.jsx)(`span`,{className:`grid size-10 place-items-center rounded-xl bg-primary/10 text-primary`,children:(0,K.jsx)(e.icon,{className:`size-5`})}),(0,K.jsxs)(`p`,{className:`mt-4 flex items-center gap-1.5 font-semibold group-hover:text-primary`,children:[e.title,` `,(0,K.jsx)(mo,{className:`size-3.5 opacity-0 transition-opacity group-hover:opacity-100`})]}),(0,K.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:e.text})]},e.to))})]})}function my(){return(0,K.jsxs)(`div`,{className:`space-y-8`,children:[(0,K.jsx)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:[0,1,2,3].map(e=>(0,K.jsx)(be,{className:`h-[104px] rounded-xl`},e))}),(0,K.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`,children:[0,1,2].map(e=>(0,K.jsx)(yv,{},e))})]})}function hy(){se(`Dashboard`);let e=le(),{data:n}=S(),{data:r,isLoading:o,error:s,refetch:c}=m({queryKey:[`dashboard`],queryFn:()=>P.get(`/dashboard`)}),l=e.name.split(` `)[0],u=[];if(r){let{stats:e}=r;if(e.enrolled>0&&u.push((0,K.jsx)(iy,{icon:bo,label:`Courses in progress`,value:e.enrolled,tone:`primary`},`enrolled`),(0,K.jsx)(iy,{icon:Ao,label:`Activities completed`,value:e.completedActivities,tone:`emerald`},`done`),(0,K.jsx)(iy,{icon:js,label:`Average grade`,value:e.averageGrade==null?`–`:`${a(e.averageGrade)}%`,tone:`violet`},`avg`),(0,K.jsx)(iy,{icon:So,label:`Due this week`,value:e.dueThisWeek,tone:`amber`},`due`)),e.teaching>0){let t=r.courses.filter(e=>e.myRole!==`student`).reduce((e,t)=>e+t.studentCount,0),n=r.toGrade.reduce((e,t)=>e+t.count,0);u.push((0,K.jsx)(iy,{icon:_s,label:`Courses teaching`,value:e.teaching,tone:`sky`},`teaching`),(0,K.jsx)(iy,{icon:Us,label:`Students`,value:t,tone:`primary`},`students`),(0,K.jsx)(iy,{icon:Mo,label:`Waiting for grading`,value:n,tone:`rose`},`grade`))}}let d=r?.courses??[];return(0,K.jsxs)(Iv,{children:[(0,K.jsx)(ry,{eyebrow:new Intl.DateTimeFormat(void 0,{weekday:`long`,month:`long`,day:`numeric`}).format(new Date),title:`${t()}, ${l}`,description:n?.site.welcomeMessage,actions:D(e.role)?(0,K.jsx)(k,{asChild:!0,variant:`outline`,children:(0,K.jsxs)(Qa,{to:`/courses/new`,children:[(0,K.jsx)(hs,{}),` New course`]})}):(0,K.jsx)(k,{asChild:!0,variant:`outline`,children:(0,K.jsxs)(Qa,{to:`/catalog`,children:[(0,K.jsx)(Io,{}),` Explore courses`]})})}),o?(0,K.jsx)(my,{}):s||!r?(0,K.jsx)(Oe,{error:s,onRetry:()=>c()}):(0,K.jsxs)(K.Fragment,{children:[u.length>0&&(0,K.jsx)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:u.slice(0,4)}),d.length===0&&e.role===`admin`?(0,K.jsx)(py,{}):d.length===0?(0,K.jsx)(je,{className:`mt-8`,icon:Io,title:`You're not enrolled in any courses yet`,description:`Browse the catalog to find something to learn, or create your own course.`,action:(0,K.jsx)(k,{asChild:!0,children:(0,K.jsxs)(Qa,{to:`/catalog`,children:[`Explore courses `,(0,K.jsx)(mo,{})]})})}):(0,K.jsxs)(`section`,{className:`mt-8`,children:[(0,K.jsx)(ay,{action:(0,K.jsxs)(Qa,{to:`/my-courses`,className:`flex items-center gap-1 text-sm font-medium text-primary hover:underline`,children:[`All courses `,(0,K.jsx)(mo,{className:`size-3.5`})]}),children:`Jump back in`}),(0,K.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`,children:d.slice(0,3).map(e=>(0,K.jsx)(vv,{course:e},e.id))})]}),(r.toGrade.length>0||r.stats.enrolled>0||r.announcements.length>0||r.recentGrades.length>0)&&(0,K.jsxs)(`div`,{className:`mt-8 grid items-start gap-6 lg:grid-cols-3`,children:[(0,K.jsxs)(`div`,{className:`space-y-6 lg:col-span-2`,children:[r.toGrade.length>0&&(0,K.jsxs)(cy,{children:[(0,K.jsx)(ly,{title:`Needs grading`,description:`Submissions waiting for your feedback.`,icon:(0,K.jsx)(Mo,{className:`size-4.5`})}),(0,K.jsx)(`div`,{className:`pb-2`,children:r.toGrade.map(e=>(0,K.jsxs)(`div`,{className:`flex items-center gap-3 px-5 py-2.5`,children:[(0,K.jsx)(bv,{type:`assignment`}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`p`,{className:`truncate text-sm font-medium`,children:e.title}),(0,K.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:e.course.title})]}),(0,K.jsxs)(hv,{variant:`warning`,children:[e.count,` to grade`]}),(0,K.jsx)(k,{asChild:!0,size:`sm`,variant:`outline`,children:(0,K.jsx)(Qa,{to:`${pv(e.course.slug,e.activityId)}/submissions`,children:`Grade`})})]},e.activityId))})]}),r.stats.enrolled>0&&(0,K.jsxs)(cy,{children:[(0,K.jsx)(ly,{title:`Upcoming`,description:`Deadlines across your courses.`,icon:(0,K.jsx)(So,{className:`size-4.5`})}),(0,K.jsx)(fy,{items:r.timeline})]})]}),(0,K.jsxs)(`div`,{className:`space-y-6`,children:[(0,K.jsxs)(cy,{children:[(0,K.jsx)(ly,{title:`Announcements`,icon:(0,K.jsx)(ts,{className:`size-4.5`})}),(0,K.jsxs)(`div`,{className:`space-y-1 px-2 pb-3`,children:[r.announcements.length===0&&(0,K.jsx)(`p`,{className:`px-3 pb-3 text-sm text-muted-foreground`,children:`No announcements yet.`}),r.announcements.slice(0,4).map(e=>(0,K.jsxs)(Qa,{to:`/courses/${e.course.slug}/announcements`,className:`block rounded-lg px-3 py-2.5 transition-colors hover:bg-accent/50`,children:[(0,K.jsxs)(`p`,{className:`flex items-center gap-1.5 text-[11px] font-medium text-muted-foreground`,children:[(0,K.jsx)(`span`,{className:`size-2 rounded-[3px]`,style:s_(e.course.coverColor)}),e.course.title]}),(0,K.jsx)(`p`,{className:`mt-1 text-sm font-medium`,children:e.title}),(0,K.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs text-muted-foreground`,children:p(e.body)}),(0,K.jsxs)(`p`,{className:`mt-1.5 flex items-center gap-1.5 text-[11px] text-muted-foreground`,children:[(0,K.jsx)(l_,{user:e.author,size:`xs`,className:`size-4 text-[7px] ring-1`}),e.author.name,` · `,i(e.createdAt)]})]},e.id))]})]}),r.recentGrades.length>0&&(0,K.jsxs)(cy,{children:[(0,K.jsx)(ly,{title:`Recent grades`,icon:(0,K.jsx)(go,{className:`size-4.5`})}),(0,K.jsx)(`div`,{className:`space-y-1 px-2 pb-3`,children:r.recentGrades.map(e=>{let t=e.maxGrade?Math.round(e.score/e.maxGrade*100):0;return(0,K.jsxs)(Qa,{to:pv(e.course.slug,e.activityId),className:`flex items-center gap-3 rounded-lg px-3 py-2 hover:bg-accent/50`,children:[(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`p`,{className:`truncate text-sm font-medium`,children:e.title}),(0,K.jsxs)(`p`,{className:`truncate text-xs text-muted-foreground`,children:[a(e.score),` / `,a(e.maxGrade),` · `,i(e.gradedAt)]})]}),(0,K.jsxs)(hv,{variant:t>=80?`success`:t>=50?`warning`:`danger`,children:[t,`%`]})]},e.activityId)})})]})]})]})]})]})}var gy=`modulepreload`,_y=function(e){return`/`+e},vy={},yy=function(e){return e.pathname.endsWith(`.css`)},by=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},xy=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=_y(t,n);let r=s(t),i=yy(r);return by(vy,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:gy,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{let i=a=>{t.removeEventListener(`load`,i),t.removeEventListener(`error`,i),a.type===`error`?n(Error(`Unable to preload CSS for ${r}`)):e(a)};t.addEventListener(`load`,i),t.addEventListener(`error`,i)})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};function Sy(e,t=`default`){let n=(0,V.lazy)(async()=>({default:(await e())[t]}));return(0,K.jsx)(V.Suspense,{fallback:(0,K.jsx)(Te,{}),children:(0,K.jsx)(n,{})})}function Cy({children:e}){let{data:t,isLoading:n,error:r}=S(),i=Ai();return n?(0,K.jsx)(Te,{}):r?(0,K.jsx)(wy,{}):t?.needsSetup?(0,K.jsx)(Aa,{to:`/setup`,replace:!0}):t?.user?e:(0,K.jsx)(Aa,{to:`/login?next=${encodeURIComponent(i.pathname+i.search)}`,replace:!0})}function wy(){let e=Qi();return(0,K.jsx)(`div`,{className:`grid min-h-dvh place-items-center p-6 text-center`,children:(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h1`,{className:`text-xl font-semibold`,children:`Something went wrong`}),(0,K.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:e?A(e):`We could not reach the server.`}),(0,K.jsx)(k,{className:`mt-6`,onClick:()=>window.location.reload(),children:`Reload`})]})})}var Ty=Ya([{path:`/setup`,element:(0,K.jsx)(ny,{}),errorElement:(0,K.jsx)(wy,{})},{path:`/login`,element:(0,K.jsx)(ey,{}),errorElement:(0,K.jsx)(wy,{})},{path:`/register`,element:(0,K.jsx)(ty,{}),errorElement:(0,K.jsx)(wy,{})},{element:(0,K.jsx)(Cy,{children:(0,K.jsx)(Fv,{})}),errorElement:(0,K.jsx)(wy,{}),children:[{index:!0,element:(0,K.jsx)(hy,{})},{path:`my-courses`,element:Sy(()=>xy(()=>import(`./MyCoursesPage-GCdSHlYs.js`),__vite__mapDeps([0,1,2])))},{path:`catalog`,element:Sy(()=>xy(()=>import(`./CatalogPage-CIFyefBY.js`),__vite__mapDeps([3,1,4,2])))},{path:`calendar`,element:Sy(()=>xy(()=>import(`./CalendarPage-DQdBEQN-.js`),__vite__mapDeps([5,1,4,2])))},{path:`notifications`,element:Sy(()=>xy(()=>import(`./NotificationsPage-Y3shIm5z.js`),__vite__mapDeps([6,1,2])))},{path:`profile`,element:Sy(()=>xy(()=>import(`./ProfilePage-Dgj-HYPS.js`),__vite__mapDeps([7,1,8,2])))},{path:`courses/new`,element:Sy(()=>xy(()=>import(`./CreateCoursePage-BDfIRStx.js`),__vite__mapDeps([9,1,2,10,8,11,12,13])))},{path:`courses/:slug`,element:Sy(()=>xy(()=>import(`./CourseLayout-CwpWuS7V.js`),__vite__mapDeps([14,1,8,15,16,17,2,12,18,13]))),children:[{index:!0,element:Sy(()=>xy(()=>import(`./CourseContentPage-CZEP3VMH.js`),__vite__mapDeps([19,1,20,21,2,12,13,11,22,16])))},{path:`announcements`,element:Sy(()=>xy(()=>import(`./AnnouncementsPage-KJUA3o7v.js`),__vite__mapDeps([23,1,24,2,12,13])))},{path:`participants`,element:Sy(()=>xy(()=>import(`./ParticipantsPage-OHnKj_8Z.js`),__vite__mapDeps([25,1,26,22,2,13])))},{path:`grades`,element:Sy(()=>xy(()=>import(`./GradesPage-Brj-Wqu1.js`),__vite__mapDeps([27,1,28,2,13])))},{path:`settings`,element:Sy(()=>xy(()=>import(`./CourseSettingsPage-DwEIXO2s.js`),__vite__mapDeps([10,1,8,2,11,12,13])))}]},{path:`courses/:slug/activities/:activityId`,element:Sy(()=>xy(()=>import(`./ActivityPage-BhRtXLwW.js`),__vite__mapDeps([29,28,1,12,2,18,30,16,24,13,31,21,11,15,32])))},{path:`courses/:slug/activities/:activityId/submissions`,element:Sy(()=>xy(()=>import(`./SubmissionsPage-DXZGSqup.js`),__vite__mapDeps([33,1,2,12,31,21,13,11,16])))},{path:`courses/:slug/activities/:activityId/questions`,element:Sy(()=>xy(()=>import(`./QuizEditorPage-bT0jpSFE.js`),__vite__mapDeps([34,1,20,35,2,13,31,21,12,11,16])))},{path:`courses/:slug/attempts/:attemptId`,element:Sy(()=>xy(()=>import(`./QuizAttemptPage-CiW3E3K0.js`),__vite__mapDeps([36,1,30,24,2,12,18,13])))},{path:`courses/:slug/discussions/:discussionId`,element:Sy(()=>xy(()=>import(`./DiscussionPage-Dyt0qgUe.js`),__vite__mapDeps([37,1,15,22,16,32,2,12,18])))},{path:`admin`,element:Sy(()=>xy(()=>import(`./AdminLayout-ChXLxrl_.js`),__vite__mapDeps([38,39,1,17]))),children:[{index:!0,element:Sy(()=>xy(()=>import(`./AdminOverviewPage-BGsUzMXN.js`),__vite__mapDeps([40,1,2])))},{path:`users`,element:Sy(()=>xy(()=>import(`./AdminUsersPage-BmBSnct8.js`),__vite__mapDeps([41,1,26,4,35,22,2])))},{path:`courses`,element:Sy(()=>xy(()=>import(`./AdminCoursesPage-BT9AQTuZ.js`),__vite__mapDeps([42,1,4,39,16,17,2])),`AdminCoursesPage`)},{path:`categories`,element:Sy(()=>xy(()=>import(`./AdminCoursesPage-BT9AQTuZ.js`),__vite__mapDeps([42,1,4,39,16,17,2])),`AdminCategoriesPage`)},{path:`settings`,element:Sy(()=>xy(()=>import(`./AdminSettingsPage-B4ZeIbVO.js`),__vite__mapDeps([43,1,2])))}]},{path:`*`,element:Sy(()=>xy(()=>import(`./NotFoundPage-CJIpDg1F.js`),__vite__mapDeps([18,1])))}]}]),Ey=new He({defaultOptions:{queries:{staleTime:2e4,refetchOnWindowFocus:!1,retry:(e,t)=>!(t instanceof ie&&t.status<500)&&e<2}},queryCache:new Ve({onError:(e,t)=>{e instanceof ie&&e.status===401&&t.queryKey[0]!==F[0]&&Ey.invalidateQueries({queryKey:F})}})});function Dy(){let{resolved:e}=r_();return(0,K.jsx)(Ne,{theme:e,position:`bottom-right`,richColors:!0,closeButton:!0})}(0,Xs.createRoot)(document.getElementById(`root`)).render((0,K.jsx)(V.StrictMode,{children:(0,K.jsx)(ee,{client:Ey,children:(0,K.jsx)(n_,{children:(0,K.jsx)($g,{children:(0,K.jsxs)(Ig,{children:[(0,K.jsx)(b,{}),(0,K.jsx)(Ea,{router:Ty}),(0,K.jsx)(Dy,{})]})})})})}));export{Gs as $,g_ as A,Qa as At,Vg as B,fv as C,Eo as Ct,f_ as D,go as Dt,m_ as E,bo as Et,s_ as F,Mi as Ft,qg as G,Wg as H,o_ as I,Fi as It,Yg as J,Kg as K,r_ as L,Li as Lt,u_ as M,io as Mt,i_ as N,Aa as Nt,h_ as O,mo as Ot,a_ as P,ja as Pt,Fg as Q,Lg as R,Ue as Rt,hv as S,Oo as St,d_ as T,So as Tt,Gg as U,Ug as V,zg as W,Xg as X,Zg as Y,Qg as Z,Av as _,zo as _t,ry as a,xs as at,yv as b,Mo as bt,Kv as c,ss as ct,Vv as d,Zo as dt,Us as et,Bv as f,Yo as ft,Iv as g,Vo as gt,kv as h,Uo as ht,sy as i,Ds as it,l_ as j,to as jt,p_ as k,fo as kt,Hv as l,as as lt,zv as m,Go as mt,ly as n,Fs as nt,iy as o,hs as ot,Gv as p,qo as pt,Rg as q,oy as r,ks as rt,Uv as s,ls as st,cy as t,zs as tt,Rv as u,ts as ut,bv as v,Io as vt,pv as w,wo as wt,gv as x,Ao as xt,vv as y,Po as yt,Jg as z};
50
+ `},Wl=0,Gl=[];function Kl(e){var t=V.useRef([]),n=V.useRef([0,0]),r=V.useRef(),i=V.useState(Wl++)[0],a=V.useState(ml)[0],o=V.useRef(e);V.useEffect(function(){o.current=e},[e]),V.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Wc([e.lockRef.current],(e.shards||[]).map(Vl),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=V.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=zl(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=Ml(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Ml(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return Rl(h,t,e,h===`h`?s:c,!0)},[]),c=V.useCallback(function(e){var n=e;if(Gl.length&&Gl[Gl.length-1]===a){var r=`deltaY`in n?Bl(n):zl(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Hl(e.delta,r)})[0];if(i&&i.should)n.cancelable&&n.preventDefault();else if(!i){var c=(o.current.shards||[]).map(Vl).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=V.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:ql(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=V.useCallback(function(e){n.current=zl(e),r.current=void 0},[]),d=V.useCallback(function(t){l(t.type,Bl(t),t.target,s(t,e.lockRef.current))},[]),f=V.useCallback(function(t){l(t.type,zl(t),t.target,s(t,e.lockRef.current))},[]);V.useEffect(function(){return Gl.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,Dl),document.addEventListener(`touchmove`,c,Dl),document.addEventListener(`touchstart`,u,Dl),function(){Gl=Gl.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,Dl),document.removeEventListener(`touchmove`,c,Dl),document.removeEventListener(`touchstart`,u,Dl)}},[]);var p=e.removeScrollBar,m=e.inert;return V.createElement(V.Fragment,null,m?V.createElement(a,{styles:Ul(i)}):null,p?V.createElement(wl,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function ql(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Jl=il(al,Kl),Yl=V.forwardRef(function(e,t){return V.createElement(sl,Hc({},e,{ref:t,sideCar:Jl}))});Yl.classNames=sl.classNames;var Xl=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Zl=new WeakMap,Ql=new WeakMap,$l={},eu=0,tu=function(e){return e&&(e.host||tu(e.parentNode))},nu=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=tu(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},q=function(e,t,n,r){var i=nu(t,Array.isArray(e)?e:[e]);$l[n]||($l[n]=new WeakMap);var a=$l[n],o=[],s=new Set,c=new Set(i),l=function(e){e&&!s.has(e)&&(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){e&&!c.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(Zl.get(e)||0)+1,l=(a.get(e)||0)+1;Zl.set(e,c),a.set(e,l),o.push(e),c===1&&i&&Ql.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),eu++,function(){o.forEach(function(e){var t=Zl.get(e)-1,i=a.get(e)-1;Zl.set(e,t),a.set(e,i),t||(Ql.has(e)||e.removeAttribute(r),Ql.delete(e)),i||e.removeAttribute(n)}),eu--,eu||(Zl=new WeakMap,Zl=new WeakMap,Ql=new WeakMap,$l={})}},ru=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Xl(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),q(r,i,n,`aria-hidden`)):function(){return null}},iu=Object.defineProperty,au=(e,t)=>iu(e,`name`,{value:t,configurable:!0}),ou=`Dialog`,[su,cu]=Pe(ou),[lu,uu]=su(ou),du=au(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=V.useRef(null),c=V.useRef(null),{nodes:l,registry:u}=yc(),[d,f]=z({prop:r,defaultProp:i??!1,onChange:a,caller:ou}),[p,m]=V.useState(0),[h,g]=V.useState(0);return(0,K.jsx)(lu,{scope:t,triggerRef:s,contentRef:c,contentId:we(),titleId:we(),descriptionId:we(),titlePresent:p>0,descriptionPresent:h>0,setTitleCount:m,setDescriptionCount:g,open:d,onOpenChange:f,onOpenToggle:V.useCallback(()=>f(e=>!e),[f]),modal:o,branchNodes:l,branchRegistry:u,children:n})},`Dialog`),fu=`DialogTrigger`,pu=V.forwardRef(au(function(e,t){let{__scopeDialog:r,...i}=e,a=uu(fu,r),o=n(t,a.triggerRef);return(0,K.jsx)(R.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":Mu(a.open),...i,ref:o,onClick:B(e.onClick,a.onOpenToggle)})},`DialogTrigger`)),mu=`DialogPortal`,[hu,gu]=su(mu,{forceMount:void 0}),_u=au(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=uu(mu,t);return(0,K.jsx)(hu,{scope:t,forceMount:n,children:V.Children.map(r,e=>(0,K.jsx)(Ce,{present:n||a.open,children:(0,K.jsx)(Pc,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),vu=`DialogOverlay`,yu=V.forwardRef(au(function(e,t){let n=gu(vu,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=uu(vu,e.__scopeDialog);return a.modal?(0,K.jsx)(Ce,{present:r||a.open,children:(0,K.jsx)(xu,{...i,ref:t})}):null},`DialogOverlay`)),bu=d(`DialogOverlay.RemoveScroll`),xu=V.forwardRef(au(function(e,t){let{__scopeDialog:r,...i}=e,a=uu(vu,r),o=ac(),s=n(t,o);return(0,K.jsx)(Yl,{as:bu,allowPinchZoom:!0,shards:V.useMemo(()=>[a.contentRef,...a.branchNodes.map(e=>({current:e}))],[a.contentRef,a.branchNodes]),children:(0,K.jsx)(R.div,{"data-state":Mu(a.open),...i,ref:s,style:{pointerEvents:`auto`,...i.style}})})},`DialogOverlayImpl`)),Su=`DialogContent`,Cu=V.forwardRef(au(function(e,t){let n=gu(Su,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=uu(Su,e.__scopeDialog);return(0,K.jsx)(Ce,{present:r||a.open,children:a.modal?(0,K.jsx)(wu,{...i,ref:t}):(0,K.jsx)(Tu,{...i,ref:t})})},`DialogContent`)),wu=V.forwardRef(au(function(e,t){let r=uu(Su,e.__scopeDialog),i=V.useRef(null),a=n(t,r.contentRef,i);return V.useEffect(()=>{let e=i.current;if(e)return ru(e)},[]),(0,K.jsx)(Eu,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:r.open,onCloseAutoFocus:B(e.onCloseAutoFocus,e=>{e.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:B(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:B(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),Tu=V.forwardRef(au(function(e,t){let n=uu(Su,e.__scopeDialog),r=V.useRef(!1),i=V.useRef(!1);return(0,K.jsx)(Eu,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),Eu=V.forwardRef(au(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,"aria-describedby":o,children:s,...c}=e,l=uu(Su,n);return Bc(),(0,K.jsx)(vc,{registry:l.branchRegistry,children:(0,K.jsx)(gc,{asChild:!0,loop:!0,trapped:r,branches:l.branchNodes,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,K.jsx)(ic,{role:`dialog`,id:l.contentId,"aria-labelledby":l.titlePresent?l.titleId:void 0,"aria-describedby":l.descriptionPresent?ju(o,l.descriptionId):o,"data-state":Mu(l.open),...c,ref:t,deferPointerDownOutside:!0,onDismiss:()=>l.onOpenChange(!1),children:s})})})},`DialogContentImpl`)),Du=V.forwardRef(au(function(e,t){let{__scopeDialog:n,...r}=e,i=uu(`DialogTitle`,n),{setTitleCount:a}=i;return ye(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,K.jsx)(R.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),Ou=V.forwardRef(au(function(e,t){let{__scopeDialog:n,...r}=e,i=uu(`DialogDescription`,n),{setDescriptionCount:a}=i;return ye(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,K.jsx)(R.p,{id:i.descriptionId,...r,ref:t})},`DialogDescription`)),ku=`DialogClose`,Au=V.forwardRef(au(function(e,t){let{__scopeDialog:n,...r}=e,i=uu(ku,n);return(0,K.jsx)(R.button,{type:`button`,...r,ref:t,onClick:B(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function ju(...e){let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of String(n).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(` `):void 0}au(ju,`concatAriaDescribedby`);function Mu(e){return e?`open`:`closed`}au(Mu,`getState`);var Nu=Object.defineProperty,Pu=(e,t)=>Nu(e,`name`,{value:t,configurable:!0}),[Fu,Iu]=Pe(`AlertDialog`,[cu]),Lu=cu(),Ru=Pu(e=>{let{__scopeAlertDialog:t,...n}=e,r=Lu(t);return(0,K.jsx)(du,{...r,...n,modal:!0})},`AlertDialog`);V.forwardRef(Pu(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Lu(n);return(0,K.jsx)(pu,{...i,...r,ref:t})},`AlertDialogTrigger`));var zu=Pu(e=>{let{__scopeAlertDialog:t,...n}=e,r=Lu(t);return(0,K.jsx)(_u,{...r,...n})},`AlertDialogPortal`),Bu=V.forwardRef(Pu(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Lu(n);return(0,K.jsx)(yu,{...i,...r,ref:t})},`AlertDialogOverlay`)),[Vu,Hu]=Fu(`AlertDialogContent`),Uu=V.forwardRef(Pu(function(e,t){let{__scopeAlertDialog:r,children:i,...a}=e,o=Lu(r),s=V.useRef(null),c=n(t,s),l=V.useRef(null);return(0,K.jsx)(Vu,{scope:r,cancelRef:l,children:(0,K.jsx)(Cu,{role:`alertdialog`,...o,...a,ref:c,onOpenAutoFocus:B(a.onOpenAutoFocus,e=>{e.preventDefault(),l.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:i})})},`AlertDialogContent`)),Wu=V.forwardRef(Pu(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Lu(n);return(0,K.jsx)(Du,{...i,...r,ref:t})},`AlertDialogTitle`)),Gu=V.forwardRef(Pu(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Lu(n);return(0,K.jsx)(Ou,{...i,...r,ref:t})},`AlertDialogDescription`)),Ku=V.forwardRef(Pu(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Lu(n);return(0,K.jsx)(Au,{...i,...r,ref:t})},`AlertDialogAction`)),qu=`AlertDialogCancel`,Ju=V.forwardRef(Pu(function(e,t){let{__scopeAlertDialog:r,...i}=e,{cancelRef:a}=Hu(qu,r),o=Lu(r),s=n(t,a);return(0,K.jsx)(Au,{...o,...i,ref:s})},`AlertDialogCancel`)),Yu=Object.defineProperty,Xu=(e,t)=>Yu(e,`name`,{value:t,configurable:!0});function Zu(e){let[t,n]=V.useState(void 0);return ye(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=0,r=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;let i=r[0];window.cancelAnimationFrame(t),t=window.requestAnimationFrame(()=>{let t,r;if(`borderBoxSize`in i){let e=i.borderBoxSize,n=Array.isArray(e)?e[0]:e;t=n.inlineSize,r=n.blockSize}else t=e.offsetWidth,r=e.offsetHeight;n({width:t,height:r})})});return r.observe(e,{box:`border-box`}),()=>{window.cancelAnimationFrame(t),r.unobserve(e)}}n(void 0)},[e]),t}Xu(Zu,`useSize`);var J=Object.defineProperty,Y=(e,t)=>J(e,`name`,{value:t,configurable:!0}),X=`Checkbox`,[Z,Qu]=Pe(X),[$u,ed]=Z(X);function td(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=z({prop:n,defaultProp:i??!1,onChange:c,caller:X}),[m,h]=V.useState(null),[g,_]=V.useState(null),[v,y]=V.useState(null),b=!m||!!o||!!m.closest(`form`),x={checked:f,disabled:a,setChecked:p,control:m,setControl:h,name:s,form:o,value:u,userClick:v,onUserClick:y,required:l,defaultChecked:!ud(i)&&i,isFormControl:b,bubbleInput:g,setBubbleInput:_};return(0,K.jsx)($u,{scope:t,...x,children:ld(d)?d(x):r})}Y(td,`CheckboxProvider`);var nd=`CheckboxTrigger`,rd=V.forwardRef(Y(function({__scopeCheckbox:e,onKeyDown:t,onClick:r,...i},a){let{control:o,value:s,disabled:c,checked:l,required:u,setControl:d,setChecked:f,onUserClick:p,isFormControl:m,bubbleInput:h}=ed(nd,e),g=n(a,d),_=V.useRef(l);return V.useEffect(()=>{let e=o?.form;if(e){let t=Y(()=>f(_.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[o,f]),(0,K.jsx)(R.button,{type:`button`,role:`checkbox`,"aria-checked":ud(l)?`mixed`:l,"aria-required":u,"data-state":dd(l),"data-disabled":c?``:void 0,disabled:c,value:s,...i,ref:g,onKeyDown:B(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:B(r,e=>{let t=e.isPropagationStopped();p({requestedChecked:ud(l)?!0:!l,hasConsumerStoppedPropagation:t}),f(e=>ud(e)?!0:!e),h&&m&&(t||e.stopPropagation())})})},`CheckboxTrigger`)),id=V.forwardRef(Y(function(e,t){let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,K.jsx)(td,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(rd,{...d,ref:t,__scopeCheckbox:n}),e&&(0,K.jsx)(cd,{__scopeCheckbox:n})]})})},`Checkbox`)),ad=`CheckboxIndicator`,od=V.forwardRef(Y(function(e,t){let{__scopeCheckbox:n,forceMount:r,...i}=e,a=ed(ad,n);return(0,K.jsx)(Ce,{present:r||ud(a.checked)||a.checked===!0,children:(0,K.jsx)(R.span,{"data-state":dd(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})},`CheckboxIndicator`)),sd=`CheckboxBubbleInput`,cd=V.forwardRef(Y(function({__scopeCheckbox:e,onClick:t,...r},i){let{control:a,userClick:o,checked:s,defaultChecked:c,required:l,disabled:u,name:d,value:f,form:p,bubbleInput:m,setBubbleInput:h}=ed(sd,e),g=n(i,h),_=Zu(a),v=V.useRef(!1),y=V.useRef(s),b=V.useRef(o),x=V.useRef(null);V.useEffect(()=>{let e=m;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set;if(!n)return;let r=y.current!==s;y.current=s;let i=o!==null&&o!==b.current;if(b.current=o,i)x.current=r?null:o,r&&(e.indeterminate=ud(s),n.call(e,!ud(s)&&s)),e.dispatchEvent(new Event(`click`,{bubbles:!o.hasConsumerStoppedPropagation}));else if(r){let t=x.current;x.current=null;let r=t?.requestedChecked===s;v.current=!0,e.indeterminate=ud(s),n.call(e,!ud(s)&&s),e.dispatchEvent(new Event(`click`,{bubbles:!(r&&t.hasConsumerStoppedPropagation)})),v.current=!1}},[m,s,o]);let S=V.useRef(!ud(s)&&s);return(0,K.jsx)(R.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:c??S.current,required:l,disabled:u,name:d,value:f,form:p,...r,tabIndex:-1,ref:g,onClick:B(t,e=>{v.current&&e.stopPropagation()}),style:{...r.style,..._,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`CheckboxBubbleInput`));function ld(e){return typeof e==`function`}Y(ld,`isFunction`);function ud(e){return e===`indeterminate`}Y(ud,`isIndeterminate`);function dd(e){return ud(e)?`indeterminate`:e?`checked`:`unchecked`}Y(dd,`getState`);var fd=[`top`,`right`,`bottom`,`left`],pd=Math.min,md=Math.max,hd=Math.round,gd=Math.floor,_d=e=>({x:e,y:e}),vd={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function yd(e,t,n){return md(e,pd(t,n))}function bd(e,t){return typeof e==`function`?e(t):e}function xd(e){return e.split(`-`)[0]}function Sd(e){return e.split(`-`)[1]}function Cd(e){return e===`x`?`y`:`x`}function wd(e){return e===`y`?`height`:`width`}function Td(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Ed(e){return Cd(Td(e))}function Dd(e,t,n){n===void 0&&(n=!1);let r=Sd(e),i=Ed(e),a=wd(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Id(o)),[o,Id(o)]}function Od(e){let t=Id(e);return[kd(e),t,kd(t)]}function kd(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Ad=[`left`,`right`],jd=[`right`,`left`],Md=[`top`,`bottom`],Nd=[`bottom`,`top`];function Pd(e,t,n){switch(e){case`top`:case`bottom`:return n?t?jd:Ad:t?Ad:jd;case`left`:case`right`:return t?Md:Nd;default:return[]}}function Fd(e,t,n,r){let i=Sd(e),a=Pd(xd(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(kd)))),a}function Id(e){let t=xd(e);return vd[t]+e.slice(t.length)}function Ld(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function Rd(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Ld(e)}function zd(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Bd(e,t,n){let{reference:r,floating:i}=e,a=Td(t),o=Ed(t),s=wd(o),c=xd(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=Sd(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function Vd(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=bd(t,e),p=Rd(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=zd(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=zd(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Hd=50,Ud=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Vd},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Bd(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<Hd&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=Bd(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Wd=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=bd(e,t)||{};if(l==null)return{};let d=Rd(u),f={x:n,y:r},p=Ed(i),m=wd(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;C&&await(o.isElement==null?void 0:o.isElement(S))||(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=pd(d[_],T),D=pd(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=yd(E,k,O),j=!c.arrow&&Sd(i)!=null&&k!==A&&a.reference[m]/2-(k<E?E:D)-h[m]/2<0,M=j?k<E?k-E:k-O:0;return{[p]:f[p]+M,data:{[p]:A,centerOffset:k-A-M,...j&&{alignmentOffset:M}},reset:j}}}),Gd=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=bd(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=xd(r),_=Td(o),v=xd(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Id(o)]:Od(o)),x=p!==`none`;!d&&x&&b.push(...Fd(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Dd(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===Td(t)||T.every(e=>Td(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Td(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}};function Kd(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function qd(e){return fd.some(t=>e[t]>=0)}var Jd=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=bd(e,t);switch(i){case`referenceHidden`:{let e=Kd(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:qd(e)}}}case`escaped`:{let e=Kd(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:qd(e)}}}default:return{}}}}},Yd=new Set([`left`,`top`]);async function Xd(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=xd(n),s=Sd(n),c=Td(n)===`y`,l=Yd.has(o)?-1:1,u=a&&c?-1:1,d=bd(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Zd=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Xd(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Qd=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=bd(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Td(i),p=Cd(f),m=u[p],h=u[f],g=(e,t)=>yd(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},$d=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=bd(e,t),u={x:n,y:r},d=Td(i),f=Cd(d),p=u[f],m=u[d],h=bd(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Yd.has(xd(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},ef=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=bd(e,t),c=await i.detectOverflow(t,s),l=xd(n),u=Sd(n),d=Td(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=pd(p-c[m],g),y=pd(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*md(c.left,c.right):S=p-2*md(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function tf(){return typeof window<`u`}function nf(e){return of(e)?(e.nodeName||``).toLowerCase():`#document`}function rf(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function af(e){return((of(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function of(e){return tf()?e instanceof Node||e instanceof rf(e).Node:!1}function sf(e){return tf()?e instanceof Element||e instanceof rf(e).Element:!1}function cf(e){return tf()?e instanceof HTMLElement||e instanceof rf(e).HTMLElement:!1}function lf(e){return!tf()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof rf(e).ShadowRoot}function uf(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=xf(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function df(e){return/^(table|td|th)$/.test(nf(e))}function ff(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var pf=/transform|translate|scale|rotate|perspective|filter/,mf=/paint|layout|strict|content/,hf=e=>!!e&&e!==`none`,gf;function _f(e){let t=sf(e)?xf(e):e;return hf(t.transform)||hf(t.translate)||hf(t.scale)||hf(t.rotate)||hf(t.perspective)||!yf()&&(hf(t.backdropFilter)||hf(t.filter))||pf.test(t.willChange||``)||mf.test(t.contain||``)}function vf(e){let t=Cf(e);for(;cf(t)&&!bf(t);){if(_f(t))return t;if(ff(t))return null;t=Cf(t)}return null}function yf(){return gf??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),gf}function bf(e){return/^(html|body|#document)$/.test(nf(e))}function xf(e){return rf(e).getComputedStyle(e)}function Sf(e){return sf(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Cf(e){if(nf(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||lf(e)&&e.host||af(e);return lf(t)?t.host:t}function wf(e){let t=Cf(e);return bf(t)?(e.ownerDocument||e).body:cf(t)&&uf(t)?t:wf(t)}function Tf(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=wf(e),i=r===e.ownerDocument?.body,a=rf(r);if(i){let e=Ef(a);return t.concat(a,a.visualViewport||[],uf(r)?r:[],e&&n?Tf(e):[])}return t.concat(r,Tf(r,[],n))}function Ef(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Df(e){let t=xf(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=cf(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=hd(n)!==a||hd(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Of(e){return sf(e)?e:e.contextElement}function kf(e){let t=Of(e);if(!cf(t))return _d(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Df(t),o=(a?hd(n.width):n.width)/r,s=(a?hd(n.height):n.height)/i;return o&&Number.isFinite(o)||(o=1),s&&Number.isFinite(s)||(s=1),{x:o,y:s}}var Af=_d(0);function jf(e){let t=rf(e);return!yf()||!t.visualViewport?Af:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Mf(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===rf(e)}function Nf(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Of(e),o=_d(1);t&&(r?sf(r)&&(o=kf(r)):o=kf(e));let s=Mf(a,n,r)?jf(a):_d(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=rf(a),t=sf(r)?rf(r):r,n=e,i=Ef(n);for(;i&&t!==n;){let e=kf(i),t=i.getBoundingClientRect(),r=xf(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=rf(i),i=Ef(n)}}return zd({width:u,height:d,x:c,y:l})}function Pf(e,t){let n=Sf(e).scrollLeft;return t?t.left+n:Nf(af(e)).left+n}function Ff(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Pf(e,n),y:n.top+t.scrollTop}}function If(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=af(r),s=t?ff(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=_d(1),u=_d(0),d=cf(r);if((d||!a)&&((nf(r)!==`body`||uf(o))&&(c=Sf(r)),d)){let e=Nf(r);l=kf(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Ff(o,c):_d(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Lf(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Rf(e){let t=Sf(e),n=e.ownerDocument.body,r=md(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=md(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+Pf(e),o=-t.scrollTop;return xf(n).direction===`rtl`&&(a+=md(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var zf=25;function Bf(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=rf(e),a=af(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!yf()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(Pf(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=zf&&(s-=o)}return{width:s,height:c,x:l,y:u}}function Vf(e,t){let n=Nf(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=kf(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Q(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Bf(e,n,t);else if(t===`document`)r=Rf(af(e));else if(sf(t))r=Vf(t,n);else{let n=jf(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return zd(r)}function Hf(e,t){let n=t.get(e);if(n)return n;let r=Tf(e,[],!1).filter(e=>sf(e)&&nf(e)!==`body`),i=null,a=xf(e).position===`fixed`,o=a?Cf(e):e;for(;sf(o)&&!bf(o);){let e=xf(o),t=_f(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=Cf(o)}return t.set(e,r),r}function Uf(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?ff(t)?[]:Hf(t,this._c):[].concat(n),r],o=Q(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Q(t,a[e],i);s=md(n.top,s),c=pd(n.right,c),l=pd(n.bottom,l),u=md(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Wf(e){let{width:t,height:n}=Df(e);return{width:t,height:n}}function Gf(e,t,n){let r=cf(t),i=af(t),a=n===`fixed`,o=Nf(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=_d(0);if((r||!a)&&((nf(t)!==`body`||uf(i))&&(s=Sf(t)),r)){let e=Nf(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=Pf(i));let l=i&&!r&&!a?Ff(i,s):_d(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function Kf(e){return xf(e).position===`static`}function qf(e,t){if(!cf(e)||xf(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return af(e)===n&&(n=n.ownerDocument.body),n}function Jf(e,t){let n=rf(e);if(ff(e))return n;if(!cf(e)){let t=Cf(e);for(;t&&!bf(t);){if(sf(t)&&!Kf(t))return t;t=Cf(t)}return n}let r=qf(e,t);for(;r&&df(r)&&Kf(r);)r=qf(r,t);return r&&bf(r)&&Kf(r)&&!_f(r)?n:r||vf(e)||n}var Yf=async function(e){let t=this.getOffsetParent||Jf,n=this.getDimensions,r=await n(e.floating);return{reference:Gf(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Xf(e){return xf(e).direction===`rtl`}var Zf={convertOffsetParentRelativeRectToViewportRelativeRect:If,getDocumentElement:af,getClippingRect:Uf,getOffsetParent:Jf,getElementRects:Yf,getClientRects:Lf,getDimensions:Wf,getScale:kf,isElement:sf,isRTL:Xf};function Qf(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function $f(e,t,n){let r=null,i,a=af(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=gd(d),h=gd(a.clientWidth-(u+f)),g=gd(a.clientHeight-(d+p)),_=gd(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:md(0,pd(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!Qf(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=rf(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function ep(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Of(e),u=i||a?[...l?Tf(l):[],...t?Tf(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?$f(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Nf(e):null;c&&g();function g(){let t=Nf(e);h&&!Qf(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var tp=Zd,np=Qd,rp=Gd,ip=ef,ap=Jd,op=Wd,sp=$d,cp=(e,t,n)=>{let r=new Map,i=n??{},a={...Zf,...i.platform,_c:r};return Ud(e,t,{...i,platform:a})},lp=typeof document<`u`?V.useLayoutEffect:function(){};function up(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!up(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!up(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function dp(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function fp(e,t){let n=dp(e);return Math.round(t*n)/n}function pp(e){let t=V.useRef(e);return lp(()=>{t.current=e}),t}function mp(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=V.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=V.useState(r);up(f,r)||p(r);let[m,h]=V.useState(null),[g,_]=V.useState(null),v=V.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=V.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=V.useRef(null),C=V.useRef(null),w=V.useRef(u),T=c!=null,E=pp(c),D=pp(i),O=pp(l),k=V.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),cp(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!up(w.current,t)&&(w.current=t,Mc.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);lp(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=V.useRef(!1);lp(()=>(A.current=!0,()=>{A.current=!1}),[]),lp(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=V.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=V.useMemo(()=>({reference:b,floating:x}),[b,x]),N=V.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=fp(M.floating,u.x),r=fp(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...dp(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return V.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var hp=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:op({element:r.current,padding:i}).fn(n):r?op({element:r,padding:i}).fn(n):{}}}},gp=(e,t)=>{let n=tp(e);return{name:n.name,fn:n.fn,options:[e,t]}},_p=(e,t)=>{let n=np(e);return{name:n.name,fn:n.fn,options:[e,t]}},vp=(e,t)=>({fn:sp(e).fn,options:[e,t]}),yp=(e,t)=>{let n=rp(e);return{name:n.name,fn:n.fn,options:[e,t]}},bp=(e,t)=>{let n=ip(e);return{name:n.name,fn:n.fn,options:[e,t]}},xp=(e,t)=>{let n=ap(e);return{name:n.name,fn:n.fn,options:[e,t]}},Sp=(e,t)=>{let n=hp(e);return{name:n.name,fn:n.fn,options:[e,t]}},Cp=Object.defineProperty,wp=(e,t)=>Cp(e,`name`,{value:t,configurable:!0}),Tp={Partial:`partial`,Always:`always`},Ep={Optimized:`optimized`,Always:`always`},Dp=`Popper`,[Op,kp]=Pe(Dp),[Ap,jp]=Op(Dp),Mp=wp(e=>{let{__scopePopper:t,children:n}=e,[r,i]=V.useState(null),[a,o]=V.useState(void 0);return(0,K.jsx)(Ap,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})},`Popper`),Np=`PopperAnchor`,Pp=V.forwardRef(wp(function(e,t){let{__scopePopper:r,virtualRef:i,...a}=e,o=jp(Np,r),s=V.useRef(null),c=o.onAnchorChange,l=V.useCallback(e=>{s.current=e,e&&c(e)},[c]),u=n(t,l),d=V.useRef(null);V.useEffect(()=>{if(!i)return;let e=d.current;d.current=i.current,e!==d.current&&c(d.current)});let f=o.placementState&&Vp(o.placementState),p=f?.[0],m=f?.[1];return i?null:(0,K.jsx)(R.div,{"data-radix-popper-side":p,"data-radix-popper-align":m,...a,ref:u})},`PopperAnchor`)),Fp=`PopperContent`,[Ip,Lp]=Op(Fp),Rp=V.forwardRef(wp(function(e,t){let{__scopePopper:r,side:i=`bottom`,sideOffset:a=0,align:o=`center`,alignOffset:s=0,arrowPadding:c=0,avoidCollisions:l=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:f=Tp.Partial,hideWhenDetached:p=!1,updatePositionStrategy:m=Ep.Optimized,onPlaced:h,...g}=e,_=jp(Fp,r),[v,y]=V.useState(null),b=n(t,y),[x,S]=V.useState(null),C=Zu(x),w=C?.width??0,T=C?.height??0,E=i+(o===`center`?``:`-`+o),D=typeof d==`number`?d:{top:0,right:0,bottom:0,left:0,...d},O=Array.isArray(u)?u:[u],k=O.length>0,A={padding:D,boundary:O.filter(zp),altBoundary:k},{refs:j,floatingStyles:M,placement:N,isPositioned:ee,middlewareData:P}=mp({strategy:`fixed`,placement:E,whileElementsMounted:wp((...e)=>ep(...e,{animationFrame:m===Ep.Always}),`whileElementsMounted`),elements:{reference:_.anchor},middleware:[gp({mainAxis:a+T,alignmentAxis:s}),l&&_p({mainAxis:!0,crossAxis:!1,...f===Tp.Partial?{limiter:vp()}:{},...A}),l&&yp({...A}),bp({...A,apply:wp(({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)},`apply`)}),x&&Sp({element:x,padding:c}),Bp({arrowWidth:w,arrowHeight:T}),p&&xp(k?{strategy:`referenceHidden`,...A}:{strategy:`referenceHidden`,padding:A.padding,altBoundary:A.altBoundary})]}),te=_.setPlacementState;ye(()=>(te(N),()=>{te(void 0)}),[N,te]);let[ne,F]=Vp(N),re=ke(h);ye(()=>{ee&&re?.()},[ee,re]);let ie=P.arrow?.x,ae=P.arrow?.y,oe=P.arrow?.centerOffset!==0,[se,ce]=V.useState();return ye(()=>{v&&ce(window.getComputedStyle(v).zIndex)},[v]),(0,K.jsx)(`div`,{ref:j.setFloating,"data-radix-popper-content-wrapper":``,style:{...M,transform:ee?M.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:se,"--radix-popper-transform-origin":[P.transformOrigin?.x,P.transformOrigin?.y].join(` `),...P.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,K.jsx)(Ip,{scope:r,placedSide:ne,placedAlign:F,onArrowChange:S,arrowX:ie,arrowY:ae,shouldHideArrow:oe,children:(0,K.jsx)(R.div,{"data-side":ne,"data-align":F,...g,ref:b,style:{...g.style,animation:ee?g.style?.animation:`none`}})})})},`PopperContent`));function zp(e){return e!==null}wp(zp,`isNotNull`);var Bp=wp(e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=Vp(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}}),`transformOrigin`);function Vp(e){let[t,n=`center`]=e.split(`-`);return[t,n]}wp(Vp,`getSideAndAlignFromPlacement`);var Hp=Object.defineProperty,$=(e,t)=>Hp(e,`name`,{value:t,configurable:!0}),Up={LTR:`ltr`,RTL:`rtl`},Wp=[`Enter`,` `],Gp=[`ArrowDown`,`PageUp`,`Home`],Kp=[`ArrowUp`,`PageDown`,`End`],qp=[...Gp,...Kp],Jp={ltr:[...Wp,`ArrowRight`],rtl:[...Wp,`ArrowLeft`]},Yp={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},Xp=`Menu`,[Zp,Qp,$p]=Fe(Xp),[em,tm]=Pe(Xp,[$p,kp,Se]),nm=kp(),rm=Se(),[im,am]=em(Xp),[om,sm]=em(Xp),cm=$(e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=nm(t),[c,l]=V.useState(null),u=V.useRef(!1),d=ke(a),f=De(i);return V.useEffect(()=>{let e=$(()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},`handleKeyDown`),t=$(()=>u.current=!1,`handlePointer`);return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),V.useEffect(()=>{if(!n)return;let e=$(()=>d(!1),`handleBlur`);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,d]),(0,K.jsx)(Mp,{...s,children:(0,K.jsx)(im,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,K.jsx)(om,{scope:t,onClose:V.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})},`Menu`),lm=V.forwardRef($(function(e,t){let{__scopeMenu:n,...r}=e,i=nm(n);return(0,K.jsx)(Pp,{...i,...r,ref:t})},`MenuAnchor`)),um=`MenuPortal`,[dm,fm]=em(um,{forceMount:void 0}),pm=$(e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=am(um,t);return(0,K.jsx)(dm,{scope:t,forceMount:n,children:(0,K.jsx)(Ce,{present:n||a.open,children:(0,K.jsx)(Pc,{asChild:!0,container:i,children:r})})})},`MenuPortal`),mm=`MenuContent`,[hm,gm]=em(mm),_m=V.forwardRef($(function(e,t){let n=fm(mm,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=am(mm,e.__scopeMenu),o=sm(mm,e.__scopeMenu);return(0,K.jsx)(Zp.Provider,{scope:e.__scopeMenu,children:(0,K.jsx)(Ce,{present:r||a.open,children:(0,K.jsx)(Zp.Slot,{scope:e.__scopeMenu,children:o.modal?(0,K.jsx)(vm,{...i,ref:t}):(0,K.jsx)(ym,{...i,ref:t})})})})},`MenuContent`)),vm=V.forwardRef($(function(e,t){let r=am(mm,e.__scopeMenu),i=V.useRef(null),a=n(t,i);return V.useEffect(()=>{let e=i.current;if(e)return ru(e)},[]),(0,K.jsx)(xm,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:B(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})},`MenuRootContentModal`)),ym=V.forwardRef($(function(e,t){let n=am(mm,e.__scopeMenu);return(0,K.jsx)(xm,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentNonModal`)),bm=d(`MenuContent.ScrollLock`),xm=V.forwardRef($(function(e,t){let{__scopeMenu:r,loop:i=!1,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:c,onEntryFocus:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:p,onDismiss:m,disableOutsideScroll:h,...g}=e,_=am(mm,r),v=sm(mm,r),y=nm(r),b=rm(r),x=Qp(r),[S,C]=V.useState(null),w=V.useRef(null),[T,E]=V.useState(null);bc(T);let{nodes:D,registry:O}=yc(),k=!!(a||h),A=n(t,w,_.onContentChange,E),j=V.useRef(0),M=V.useRef(``),N=V.useRef(0),ee=V.useRef(null),P=V.useRef(`right`),te=V.useRef(0),ne=V.useMemo(()=>h?[w,...D.map(e=>({current:e}))]:[],[w,D,h]),F=h?Yl:V.Fragment,re=h?{as:bm,allowPinchZoom:!0,shards:ne}:void 0,ie=$(e=>{let t=M.current+e,n=x().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=Gm(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;function s(e){M.current=e,window.clearTimeout(j.current),e!==``&&(j.current=window.setTimeout(()=>s(``),1e3))}$(s,`updateSearch`),s(t),o&&setTimeout(()=>o.focus())},`handleTypeaheadSearch`);V.useEffect(()=>()=>window.clearTimeout(j.current),[]),Bc();let ae=V.useCallback(e=>P.current===ee.current?.side&&qm(e,ee.current?.area),[]);return(0,K.jsx)(hm,{scope:r,searchRef:M,onItemEnter:V.useCallback(e=>{ae(e)&&e.preventDefault()},[ae]),onItemLeave:V.useCallback(e=>{ae(e)||(w.current?.focus(),C(null))},[ae]),onTriggerLeave:V.useCallback(e=>{ae(e)&&e.preventDefault()},[ae]),pointerGraceTimerRef:N,onPointerGraceIntentChange:V.useCallback(e=>{ee.current=e},[]),children:(0,K.jsx)(vc,{registry:k?O:null,children:(0,K.jsx)(F,{...re,children:(0,K.jsx)(gc,{asChild:!0,trapped:a,branches:D,onMountAutoFocus:B(o,e=>{e.preventDefault(),w.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:(0,K.jsx)(ic,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:p,onDismiss:m,children:(0,K.jsx)(Me,{asChild:!0,...b,dir:v.dir,orientation:`vertical`,loop:i,currentTabStopId:S,onCurrentTabStopIdChange:C,onEntryFocus:B(l,e=>{v.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,K.jsx)(Rp,{role:`menu`,"aria-orientation":`vertical`,"data-state":Bm(_.open),"data-radix-menu-content":``,dir:v.dir,...y,...g,ref:A,style:{outline:`none`,...g.style},onKeyDown:B(g.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&ie(e.key));let i=w.current;if(e.target!==i||!qp.includes(e.key))return;e.preventDefault();let a=x().filter(e=>!e.disabled).map(e=>e.ref.current);Kp.includes(e.key)&&a.reverse(),Um(a)}),onBlur:B(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(j.current),M.current=``)}),onPointerMove:B(e.onPointerMove,Jm(e=>{let t=e.target,n=te.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>te.current?`right`:`left`;P.current=t,te.current=e.clientX}}))})})})})})})})},`MenuContentImpl`)),Sm=V.forwardRef($(function(e,t){let{__scopeMenu:n,...r}=e;return(0,K.jsx)(R.div,{...r,ref:t})},`MenuLabel`)),Cm=`MenuItem`,wm=`menu.itemSelect`,Tm=V.forwardRef($(function(e,t){let{disabled:r=!1,onSelect:i,...a}=e,o=V.useRef(null),s=sm(Cm,e.__scopeMenu),c=gm(Cm,e.__scopeMenu),l=n(t,o),u=V.useRef(!1),d=$(()=>{let e=o.current;if(!r&&e){let t=new CustomEvent(wm,{bubbles:!0,cancelable:!0});e.addEventListener(wm,e=>i?.(e),{once:!0}),he(e,t),t.defaultPrevented?u.current=!1:s.onClose()}},`handleSelect`);return(0,K.jsx)(Em,{...a,ref:l,disabled:r,onClick:B(e.onClick,d),onPointerDown:t=>{e.onPointerDown?.(t),u.current=!0},onPointerUp:B(e.onPointerUp,e=>{u.current||e.currentTarget?.click()}),onKeyDown:B(e.onKeyDown,e=>{r||e.target!==e.currentTarget||(c.searchRef.current===``||e.key!==` `)&&Wp.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})},`MenuItem`)),Em=V.forwardRef($(function(e,t){let{__scopeMenu:r,disabled:i=!1,textValue:a,...o}=e,s=gm(Cm,r),c=rm(r),l=V.useRef(null),u=n(t,l),[d,f]=V.useState(!1),[p,m]=V.useState(``);return V.useEffect(()=>{let e=l.current;e&&m((e.textContent??``).trim())},[o.children]),(0,K.jsx)(Zp.ItemSlot,{scope:r,disabled:i,textValue:a??p,children:(0,K.jsx)(xe,{asChild:!0,...c,focusable:!i,children:(0,K.jsx)(R.div,{role:`menuitem`,"data-highlighted":d?``:void 0,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,...o,ref:u,onPointerMove:B(e.onPointerMove,Jm(e=>{i?s.onItemLeave(e):(s.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:B(e.onPointerLeave,Jm(e=>s.onItemLeave(e))),onFocus:B(e.onFocus,()=>f(!0)),onBlur:B(e.onBlur,()=>f(!1))})})})},`MenuItemImpl`)),[Dm,Om]=em(`MenuRadioGroup`,{value:void 0,onValueChange:$(()=>{},`onValueChange`)}),[km,Am]=em(`MenuItemIndicator`,{checked:!1}),jm=V.forwardRef($(function(e,t){let{__scopeMenu:n,...r}=e;return(0,K.jsx)(R.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})},`MenuSeparator`)),Mm=`MenuSub`,[Nm,Pm]=em(Mm),Fm=$(e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=am(Mm,t),o=nm(t),[s,c]=V.useState(null),[l,u]=V.useState(null),d=ke(i);return V.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,K.jsx)(Mp,{...o,children:(0,K.jsx)(im,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,K.jsx)(Nm,{scope:t,contentId:we(),triggerId:we(),trigger:s,onTriggerChange:c,children:n})})})},`MenuSub`),Im=`MenuSubTrigger`,Lm=V.forwardRef($(function(e,t){let r=am(Im,e.__scopeMenu),i=sm(Im,e.__scopeMenu),a=Pm(Im,e.__scopeMenu),o=gm(Im,e.__scopeMenu),s=V.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:l}=o,u={__scopeMenu:e.__scopeMenu},d=V.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);V.useEffect(()=>d,[d]),V.useEffect(()=>{let e=c.current;return()=>{window.clearTimeout(e),l(null)}},[c,l]);let f=n(t,a.onTriggerChange);return(0,K.jsx)(lm,{asChild:!0,...u,children:(0,K.jsx)(Em,{id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":r.open,"aria-controls":r.open?a.contentId:void 0,"data-state":Bm(r.open),...e,ref:f,onClick:t=>{e.onClick?.(t),e.disabled||t.defaultPrevented||(t.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:B(e.onPointerMove,Jm(t=>{o.onItemEnter(t),t.defaultPrevented||e.disabled||r.open||s.current||(o.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{r.onOpenChange(!0),d()},100))})),onPointerLeave:B(e.onPointerLeave,Jm(e=>{d();let t=r.content?.getBoundingClientRect();if(t){let n=r.content?.dataset.side,i=n===`right`,a=i?-5:5,s=t[i?`left`:`right`],l=t[i?`right`:`left`];o.onPointerGraceIntentChange({area:[{x:e.clientX+a,y:e.clientY},{x:s,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:s,y:t.bottom}],side:n}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(e),e.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:B(e.onKeyDown,t=>{e.disabled||t.target!==t.currentTarget||(o.searchRef.current===``||t.key!==` `)&&Jp[i.dir].includes(t.key)&&(r.onOpenChange(!0),r.content?.focus(),t.preventDefault())})})})},`MenuSubTrigger`)),Rm=`MenuSubContent`,zm=V.forwardRef($(function(e,t){let r=fm(mm,e.__scopeMenu),{forceMount:i=r.forceMount,align:a=`start`,...o}=e,s=am(mm,e.__scopeMenu),c=sm(mm,e.__scopeMenu),l=Pm(Rm,e.__scopeMenu),u=V.useRef(null),d=n(t,u);return(0,K.jsx)(Zp.Provider,{scope:e.__scopeMenu,children:(0,K.jsx)(Ce,{present:i||s.open,children:(0,K.jsx)(Zp.Slot,{scope:e.__scopeMenu,children:(0,K.jsx)(xm,{id:l.contentId,"aria-labelledby":l.triggerId,...o,ref:d,align:a,side:c.dir===Up.RTL?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{c.isUsingKeyboardRef.current&&u.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:B(e.onFocusOutside,e=>{e.target!==l.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:B(e.onEscapeKeyDown,e=>{c.onClose(),e.preventDefault()}),onKeyDown:B(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=Yp[c.dir].includes(e.key);t&&n&&(s.onOpenChange(!1),l.trigger?.focus(),e.preventDefault())})})})})})},`MenuSubContent`));function Bm(e){return e?`open`:`closed`}$(Bm,`getOpenState`);function Vm(e){return e===`indeterminate`}$(Vm,`isIndeterminate`);function Hm(e){return Vm(e)?`indeterminate`:e?`checked`:`unchecked`}$(Hm,`getCheckedState`);function Um(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}$(Um,`focusFirst`);function Wm(e,t){return e.map((n,r)=>e[(t+r)%e.length])}$(Wm,`wrapArray`);function Gm(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Wm(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}$(Gm,`getNextMatch`);function Km(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}$(Km,`isPointInPolygon`);function qm(e,t){return t?Km({x:e.clientX,y:e.clientY},t):!1}$(qm,`isPointerInGraceArea`);function Jm(e){return t=>t.pointerType===`mouse`?e(t):void 0}$(Jm,`whenMouse`);var Ym=Object.defineProperty,Xm=(e,t)=>Ym(e,`name`,{value:t,configurable:!0}),Zm=`DropdownMenu`,[Qm,$m]=Pe(Zm,[tm]),eh=tm(),[th,nh]=Qm(Zm),rh=Xm(e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=eh(t),l=V.useRef(null),[u,d]=z({prop:i,defaultProp:a??!1,onChange:o,caller:Zm});return(0,K.jsx)(th,{scope:t,triggerId:we(),triggerRef:l,contentId:we(),open:u,onOpenChange:d,onOpenToggle:V.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,K.jsx)(cm,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})},`DropdownMenu`),ih=`DropdownMenuTrigger`,ah=V.forwardRef(Xm(function(e,t){let{__scopeDropdownMenu:r,disabled:i=!1,...a}=e,o=nh(ih,r),s=eh(r),c=n(t,o.triggerRef);return(0,K.jsx)(lm,{asChild:!0,...s,children:(0,K.jsx)(R.button,{type:`button`,id:o.triggerId,"aria-haspopup":`menu`,"aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?`open`:`closed`,"data-disabled":i?``:void 0,disabled:i,...a,ref:c,onPointerDown:B(e.onPointerDown,e=>{!i&&e.button===0&&e.ctrlKey===!1&&(o.onOpenToggle(),o.open||e.preventDefault())}),onKeyDown:B(e.onKeyDown,e=>{i||([`Enter`,` `].includes(e.key)&&o.onOpenToggle(),e.key===`ArrowDown`&&o.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})},`DropdownMenuTrigger`)),oh=Xm(e=>{let{__scopeDropdownMenu:t,...n}=e,r=eh(t);return(0,K.jsx)(pm,{...r,...n})},`DropdownMenuPortal`),sh=`DropdownMenuContent`,ch=V.forwardRef(Xm(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=nh(sh,n),a=eh(n),o=V.useRef(!1);return(0,K.jsx)(_m,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:B(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:B(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`DropdownMenuContent`)),lh=V.forwardRef(Xm(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=eh(n);return(0,K.jsx)(Sm,{...i,...r,ref:t})},`DropdownMenuLabel`)),uh=V.forwardRef(Xm(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=eh(n);return(0,K.jsx)(Tm,{...i,...r,ref:t})},`DropdownMenuItem`)),dh=V.forwardRef(Xm(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=eh(n);return(0,K.jsx)(jm,{...i,...r,ref:t})},`DropdownMenuSeparator`)),fh=Xm(e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:a}=e,o=eh(t),[s,c]=z({prop:r,defaultProp:a??!1,onChange:i,caller:`DropdownMenuSub`});return(0,K.jsx)(Fm,{...o,open:s,onOpenChange:c,children:n})},`DropdownMenuSub`),ph=V.forwardRef(Xm(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=eh(n);return(0,K.jsx)(Lm,{...i,...r,ref:t})},`DropdownMenuSubTrigger`)),mh=V.forwardRef(Xm(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=eh(n);return(0,K.jsx)(zm,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`DropdownMenuSubContent`)),hh=Object.defineProperty,gh=(e,t)=>hh(e,`name`,{value:t,configurable:!0}),_h=`Popover`,[vh,yh]=Pe(_h,[kp]),bh=kp(),[xh,Sh]=vh(_h),Ch=gh(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=bh(t),c=V.useRef(null),[l,u]=V.useState(!1),[d,f]=V.useState(0),[p,m]=V.useState(0),[h,g]=z({prop:r,defaultProp:i??!1,onChange:a,caller:_h});return(0,K.jsx)(Mp,{...s,children:(0,K.jsx)(xh,{scope:t,contentId:we(),titleId:we(),descriptionId:we(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:m,triggerRef:c,open:h,onOpenChange:g,onOpenToggle:V.useCallback(()=>g(e=>!e),[g]),hasCustomAnchor:l,onCustomAnchorAdd:V.useCallback(()=>u(!0),[]),onCustomAnchorRemove:V.useCallback(()=>u(!1),[]),modal:o,children:n})})},`Popover`),wh=`PopoverTrigger`,Th=V.forwardRef(gh(function(e,t){let{__scopePopover:r,...i}=e,a=Sh(wh,r),o=bh(r),s=n(t,a.triggerRef),c=(0,K.jsx)(R.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":Ih(a.open),...i,ref:s,onClick:B(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?c:(0,K.jsx)(Pp,{asChild:!0,...o,children:c})},`PopoverTrigger`)),Eh=`PopoverPortal`,[Dh,Oh]=vh(Eh,{forceMount:void 0}),kh=gh(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=Sh(Eh,t);return(0,K.jsx)(Dh,{scope:t,forceMount:n,children:(0,K.jsx)(Ce,{present:n||a.open,children:(0,K.jsx)(Pc,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),Ah=`PopoverContent`,jh=V.forwardRef(gh(function(e,t){let n=Oh(Ah,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=Sh(Ah,e.__scopePopover);return(0,K.jsx)(Ce,{present:r||a.open,children:a.modal?(0,K.jsx)(Nh,{...i,ref:t}):(0,K.jsx)(Ph,{...i,ref:t})})},`PopoverContent`)),Mh=d(`PopoverContent.RemoveScroll`),Nh=V.forwardRef(gh(function(e,t){let r=Sh(Ah,e.__scopePopover),i=V.useRef(null),a=n(t,i),o=V.useRef(!1),{nodes:s,registry:c}=yc();return V.useEffect(()=>{let e=i.current;if(e)return ru(e)},[]),(0,K.jsx)(Yl,{as:Mh,allowPinchZoom:!0,shards:V.useMemo(()=>[i,...s.map(e=>({current:e}))],[i,s]),children:(0,K.jsx)(Fh,{...e,ref:a,branchNodes:s,branchRegistry:c,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:B(e.onCloseAutoFocus,e=>{e.preventDefault(),o.current||r.triggerRef.current?.focus()}),onPointerDownOutside:B(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;o.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:B(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),Ph=V.forwardRef(gh(function(e,t){let n=Sh(Ah,e.__scopePopover),r=V.useRef(!1),i=V.useRef(!1);return(0,K.jsx)(Fh,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`PopoverContentNonModal`)),Fh=V.forwardRef(gh(function(e,t){let{__scopePopover:r,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:d,"aria-describedby":f,branchNodes:p,branchRegistry:m,...h}=e,g=Sh(Ah,r),_=bh(r),[v,y]=V.useState(null),b=n(t,y);return bc(v),Bc(),(0,K.jsx)(vc,{registry:m,children:(0,K.jsx)(gc,{asChild:!0,loop:!0,trapped:i,branches:p,onMountAutoFocus:a,onUnmountAutoFocus:o,children:(0,K.jsx)(ic,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:d,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:u,onDismiss:()=>g.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,K.jsx)(Rp,{"data-state":Ih(g.open),role:`dialog`,id:g.contentId,"aria-labelledby":g.titlePresent?g.titleId:void 0,"aria-describedby":g.descriptionPresent?Lh(f,g.descriptionId):f,..._,...h,ref:b,style:{...h.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})})},`PopoverContentImpl`));function Ih(e){return e?`open`:`closed`}gh(Ih,`getState`);function Lh(...e){let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of String(n).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(` `):void 0}gh(Lh,`concatAriaDescribedby`);var Rh=Object.defineProperty,zh=(e,t)=>Rh(e,`name`,{value:t,configurable:!0}),Bh=`Switch`,[Vh,Hh]=Pe(Bh),[Uh,Wh]=Vh(Bh);function Gh(e){let{__scopeSwitch:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=z({prop:n,defaultProp:i??!1,onChange:c,caller:Bh}),[m,h]=V.useState(null),[g,_]=V.useState(null),[v,y]=V.useState(null),b={checked:f,setChecked:p,disabled:a,control:m,setControl:h,name:s,form:o,value:u,userClick:v,onUserClick:y,required:l,defaultChecked:i,isFormControl:!m||!!o||!!m.closest(`form`),bubbleInput:g,setBubbleInput:_};return(0,K.jsx)(Uh,{scope:t,...b,children:$h(d)?d(b):r})}zh(Gh,`SwitchProvider`);var Kh=`SwitchTrigger`,qh=V.forwardRef(zh(function({__scopeSwitch:e,onClick:t,...r},i){let{control:a,form:o,value:s,disabled:c,checked:l,required:u,setControl:d,setChecked:f,onUserClick:p,isFormControl:m,bubbleInput:h}=Wh(Kh,e),g=n(i,d),_=V.useRef(l);return V.useEffect(()=>{let e=o?a?.ownerDocument.getElementById(o):a?.form;if(e instanceof HTMLFormElement){let t=zh(()=>f(_.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,o,f]),(0,K.jsx)(R.button,{type:`button`,role:`switch`,"aria-checked":l,"aria-required":u,"data-state":eg(l),"data-disabled":c?``:void 0,disabled:c,value:s,...r,ref:g,onClick:B(t,e=>{let t=e.isPropagationStopped();p({requestedChecked:!l,hasConsumerStoppedPropagation:t}),f(e=>!e),h&&m&&(t||e.stopPropagation())})})},`SwitchTrigger`)),Jh=V.forwardRef(zh(function(e,t){let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,K.jsx)(Gh,{__scopeSwitch:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(qh,{...d,ref:t,__scopeSwitch:n}),e&&(0,K.jsx)(Qh,{__scopeSwitch:n})]})})},`Switch`)),Yh=`SwitchThumb`,Xh=V.forwardRef(zh(function(e,t){let{__scopeSwitch:n,...r}=e,i=Wh(Yh,n);return(0,K.jsx)(R.span,{"data-state":eg(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})},`SwitchThumb`)),Zh=`SwitchBubbleInput`,Qh=V.forwardRef(zh(function({__scopeSwitch:e,onClick:t,...r},i){let{control:a,userClick:o,checked:s,defaultChecked:c,required:l,disabled:u,name:d,value:f,form:p,bubbleInput:m,setBubbleInput:h}=Wh(Zh,e),g=n(i,h),_=Zu(a),v=V.useRef(!1),y=V.useRef(s),b=V.useRef(o),x=V.useRef(null);V.useEffect(()=>{let e=m;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set;if(!n)return;let r=y.current!==s;y.current=s;let i=o!==null&&o!==b.current;if(b.current=o,i)x.current=r?null:o,r&&n.call(e,s),e.dispatchEvent(new Event(`click`,{bubbles:!o.hasConsumerStoppedPropagation}));else if(r){let t=x.current;x.current=null;let r=t?.requestedChecked===s;v.current=!0,n.call(e,s),e.dispatchEvent(new Event(`click`,{bubbles:!(r&&t.hasConsumerStoppedPropagation)})),v.current=!1}},[m,s,o]);let S=V.useRef(s);return(0,K.jsx)(R.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:c??S.current,required:l,disabled:u,name:d,value:f,form:p,...r,tabIndex:-1,ref:g,onClick:B(t,e=>{v.current&&e.stopPropagation()}),style:{...r.style,..._,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`SwitchBubbleInput`));function $h(e){return typeof e==`function`}zh($h,`isFunction`);function eg(e){return e?`checked`:`unchecked`}zh(eg,`getState`);var tg=Object.defineProperty,ng=(e,t)=>tg(e,`name`,{value:t,configurable:!0}),[rg,ig]=Pe(`Tooltip`,[kp]),ag=kp(),og=`TooltipProvider`,sg=700,cg=`tooltip.open`,[lg,ug]=rg(og),dg=ng(e=>{let{__scopeTooltip:t,delayDuration:n=sg,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=V.useRef(!0),s=V.useRef(!1),c=V.useRef(0);return V.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,K.jsx)(lg,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:V.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:V.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:V.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})},`TooltipProvider`),fg=`Tooltip`,[pg,mg]=rg(fg),hg=ng(e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=ug(fg,e.__scopeTooltip),l=ag(t),[u,d]=V.useState(null),[f,p]=V.useState(void 0),m=we(),h=V.useRef(0),g=o??c.disableHoverableContent,_=s??c.delayDuration,v=V.useRef(!1),[y,b]=z({prop:r,defaultProp:i??!1,onChange:ng(e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(cg))):c.onClose(),a?.(e)},`onChange`),caller:fg}),x=V.useMemo(()=>y?v.current?`delayed-open`:`instant-open`:`closed`,[y]),S=V.useCallback(()=>{window.clearTimeout(h.current),h.current=0,v.current=!1,b(!0)},[b]),C=V.useCallback(()=>{window.clearTimeout(h.current),h.current=0,b(!1)},[b]),w=V.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{v.current=!0,b(!0),h.current=0},_)},[_,b]);V.useEffect(()=>()=>{h.current&&=(window.clearTimeout(h.current),0)},[]);let T=f??m;return(0,K.jsx)(Mp,{...l,children:(0,K.jsx)(pg,{scope:t,contentId:T,setContentId:p,open:y,stateAttribute:x,trigger:u,onTriggerChange:d,onTriggerEnter:V.useCallback(()=>{c.isOpenDelayedRef.current?w():S()},[c.isOpenDelayedRef,w,S]),onTriggerLeave:V.useCallback(()=>{g?C():(window.clearTimeout(h.current),h.current=0)},[C,g]),onOpen:S,onClose:C,disableHoverableContent:g,children:n})})},`Tooltip`),gg=`TooltipTrigger`,_g=V.forwardRef(ng(function(e,t){let{__scopeTooltip:r,"aria-describedby":i,...a}=e,o=mg(gg,r),s=ug(gg,r),c=ag(r),l=V.useRef(null),u=n(t,l,o.onTriggerChange),d=V.useRef(!1),f=V.useRef(!1),p=V.useCallback(()=>d.current=!1,[]);return V.useEffect(()=>()=>document.removeEventListener(`pointerup`,p),[p]),(0,K.jsx)(Pp,{asChild:!0,...c,children:(0,K.jsx)(R.button,{"aria-describedby":o.open?Ng(i,o.contentId):i,"data-state":o.stateAttribute,...a,ref:u,onPointerMove:B(e.onPointerMove,e=>{e.pointerType!==`touch`&&!f.current&&!s.isPointerInTransitRef.current&&(o.onTriggerEnter(),f.current=!0)}),onPointerLeave:B(e.onPointerLeave,()=>{o.onTriggerLeave(),f.current=!1}),onPointerDown:B(e.onPointerDown,()=>{o.open&&o.onClose(),d.current=!0,document.addEventListener(`pointerup`,p,{once:!0})}),onFocus:B(e.onFocus,()=>{d.current||o.onOpen()}),onBlur:B(e.onBlur,o.onClose),onClick:B(e.onClick,o.onClose)})})},`TooltipTrigger`)),vg=`TooltipPortal`,[yg,bg]=rg(vg,{forceMount:void 0}),xg=ng(e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=mg(vg,t);return(0,K.jsx)(yg,{scope:t,forceMount:n,children:(0,K.jsx)(Ce,{present:n||a.open,children:(0,K.jsx)(Pc,{asChild:!0,container:i,children:r})})})},`TooltipPortal`),Sg=`TooltipContent`,Cg=V.forwardRef(ng(function(e,t){let n=bg(Sg,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=mg(Sg,e.__scopeTooltip);return(0,K.jsx)(Ce,{present:r||o.open,children:o.disableHoverableContent?(0,K.jsx)(Eg,{side:i,...a,ref:t}):(0,K.jsx)(wg,{side:i,...a,ref:t})})},`TooltipContent`)),wg=V.forwardRef(ng(function(e,t){let r=mg(Sg,e.__scopeTooltip),i=ug(Sg,e.__scopeTooltip),a=V.useRef(null),o=n(t,a),[s,c]=V.useState(null),{trigger:l,onClose:u}=r,d=a.current,{onPointerInTransitChange:f}=i,p=V.useCallback(()=>{c(null),f(!1)},[f]),m=V.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=Og(r,Dg(r,n.getBoundingClientRect())),a=kg(t.getBoundingClientRect()),o=jg([...i,...a]);c(o),f(!0)},[f]);return V.useEffect(()=>()=>p(),[p]),V.useEffect(()=>{if(l&&d){let e=ng(e=>m(e,d),`handleTriggerLeave`),t=ng(e=>m(e,l),`handleContentLeave`);return l.addEventListener(`pointerleave`,e),d.addEventListener(`pointerleave`,t),()=>{l.removeEventListener(`pointerleave`,e),d.removeEventListener(`pointerleave`,t)}}},[l,d,m,p]),V.useEffect(()=>{if(s){let e=ng(e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=l?.contains(t)||d?.contains(t),i=!Ag(n,s);r?p():i&&(p(),u())},`handleTrackPointerGrace`);return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[l,d,s,u,p]),(0,K.jsx)(Eg,{...e,ref:o})},`TooltipContentHoverable`)),Tg=f(`TooltipContent`),Eg=V.forwardRef(ng(function(e,t){let{__scopeTooltip:r,children:i,"aria-label":a,id:o,onEscapeKeyDown:s,onPointerDownOutside:c,...l}=e,u=mg(Sg,r),d=ag(r),{onClose:f}=u,[p,m]=V.useState(null),h=n(t,m);bc(p),V.useEffect(()=>(document.addEventListener(cg,f),()=>document.removeEventListener(cg,f)),[f]),V.useEffect(()=>{if(u.trigger){let e=ng(e=>{e.target instanceof Node&&e.target.contains(u.trigger)&&f()},`handleScroll`);return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[u.trigger,f]);let{setContentId:g}=u;return ye(()=>(g(o),()=>{g(void 0)}),[o,g]),(0,K.jsx)(ic,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:e=>e.preventDefault(),onDismiss:f,children:(0,K.jsxs)(Rp,{"data-state":u.stateAttribute,role:a?void 0:`tooltip`,id:a?void 0:u.contentId,...d,...l,ref:h,style:{...l.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,K.jsx)(Tg,{children:i}),a?(0,K.jsx)(Ys,{id:u.contentId,role:`tooltip`,children:a}):null]})})},`TooltipContentImpl`));function Dg(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}ng(Dg,`getExitSideFromRect`);function Og(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n})}return r}ng(Og,`getPaddedExitPoints`);function kg(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}ng(kg,`getPointsFromRect`);function Ag(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}ng(Ag,`isPointInPolygon`);function jg(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),Mg(t)}ng(jg,`getHull`);function Mg(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}ng(Mg,`getHullPresorted`);function Ng(...e){let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of String(n).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(` `):void 0}ng(Ng,`concatAriaDescribedby`);var Pg=(0,V.createContext)(async()=>!1);function Fg(){return(0,V.useContext)(Pg)}function Ig({children:e}){let[t,n]=(0,V.useState)(null),r=(0,V.useRef)(()=>{}),i=(0,V.useCallback)(e=>(n(e),new Promise(e=>{r.current=e})),[]),a=e=>{r.current(e),n(null)};return(0,K.jsxs)(Pg.Provider,{value:i,children:[e,(0,K.jsx)(Ru,{open:!!t,onOpenChange:e=>!e&&a(!1),children:(0,K.jsxs)(zu,{children:[(0,K.jsx)(Bu,{className:`fixed inset-0 z-50 bg-black/40 backdrop-blur-[2px] data-[state=open]:animate-fade-in`}),(0,K.jsxs)(Uu,{className:`fixed top-1/2 left-1/2 z-50 w-[calc(100vw-2rem)] max-w-md -translate-x-1/2 -translate-y-1/2 rounded-2xl border bg-popover p-6 shadow-2xl data-[state=open]:animate-scale-in`,children:[(0,K.jsxs)(`div`,{className:`flex gap-4`,children:[t?.destructive&&(0,K.jsx)(`div`,{className:`grid size-10 shrink-0 place-items-center rounded-full bg-destructive/10 text-destructive`,children:(0,K.jsx)(Ns,{className:`size-5`})}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(Wu,{className:`text-base font-semibold`,children:t?.title}),(0,K.jsx)(Gu,{className:`mt-1.5 text-sm text-muted-foreground`,children:t?.description??`Are you sure?`})]})]}),(0,K.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,K.jsx)(Ju,{asChild:!0,children:(0,K.jsx)(k,{variant:`outline`,children:`Cancel`})}),(0,K.jsx)(Ku,{asChild:!0,children:(0,K.jsx)(k,{variant:t?.destructive?`destructive`:`default`,onClick:()=>a(!0),children:t?.confirmLabel??`Confirm`})})]})]})]})})]})}var Lg=rh,Rg=ah,zg=fh,Bg=`z-50 min-w-48 overflow-hidden rounded-xl border bg-popover p-1 text-popover-foreground shadow-xl animate-scale-in`;function Vg({className:e,sideOffset:t=6,align:n=`end`,...r}){return(0,K.jsx)(oh,{children:(0,K.jsx)(ch,{sideOffset:t,align:n,className:y(Bg,e),...r})})}var Hg=`relative flex cursor-default select-none items-center gap-2.5 rounded-md px-2.5 py-1.5 text-sm outline-none transition-colors data-[highlighted]:bg-accent data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:text-muted-foreground`;function Ug({className:e,destructive:t,...n}){return(0,K.jsx)(uh,{className:y(Hg,t&&`text-destructive data-[highlighted]:bg-destructive/10 [&_svg]:text-destructive`,e),...n})}function Wg({className:e,...t}){return(0,K.jsx)(lh,{className:y(`px-2.5 py-1.5 text-xs font-medium text-muted-foreground`,e),...t})}function Gg({className:e,...t}){return(0,K.jsx)(dh,{className:y(`-mx-1 my-1 h-px bg-border`,e),...t})}function Kg({className:e,children:t,...n}){return(0,K.jsxs)(ph,{className:y(Hg,`data-[state=open]:bg-accent`,e),...n,children:[t,(0,K.jsx)(Oo,{className:`ml-auto`})]})}function qg({className:e,...t}){return(0,K.jsx)(oh,{children:(0,K.jsx)(mh,{sideOffset:6,className:y(Bg,`min-w-36`,e),...t})})}function Jg({checked:e,children:t,...n}){return(0,K.jsxs)(uh,{className:Hg,...n,children:[(0,K.jsx)(`span`,{className:`grid size-4 place-items-center`,children:e&&(0,K.jsx)(Eo,{className:`!text-foreground`})}),t]})}var Yg=Ch,Xg=Th;function Zg({className:e,align:t=`center`,sideOffset:n=8,...r}){return(0,K.jsx)(kh,{children:(0,K.jsx)(jh,{align:t,sideOffset:n,className:y(`z-50 w-72 rounded-xl border bg-popover p-4 text-popover-foreground shadow-xl outline-none animate-scale-in`,e),...r})})}function Qg({content:e,children:t,side:n=`top`}){return(0,K.jsxs)(hg,{delayDuration:250,children:[(0,K.jsx)(_g,{asChild:!0,children:t}),(0,K.jsx)(xg,{children:(0,K.jsx)(Cg,{side:n,sideOffset:6,className:`z-50 max-w-xs rounded-md bg-foreground px-2 py-1 text-xs font-medium text-background shadow-lg animate-fade-in`,children:e})})]})}var $g=dg,e_=(0,V.createContext)({theme:`system`,resolved:`light`,setTheme:()=>{}});function t_(){try{let e=localStorage.getItem(`ck-theme`);return e===`light`||e===`dark`?e:`system`}catch{return`system`}}function n_({children:e}){let[t,n]=(0,V.useState)(t_),[r,i]=(0,V.useState)(()=>window.matchMedia(`(prefers-color-scheme: dark)`).matches);(0,V.useEffect)(()=>{let e=window.matchMedia(`(prefers-color-scheme: dark)`),t=()=>i(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let a=t===`system`?r?`dark`:`light`:t;(0,V.useEffect)(()=>{document.documentElement.classList.toggle(`dark`,a===`dark`)},[a]);let o=(0,V.useCallback)(e=>{n(e);try{e===`system`?localStorage.removeItem(`ck-theme`):localStorage.setItem(`ck-theme`,e)}catch{}},[]);return(0,K.jsx)(e_.Provider,{value:{theme:t,resolved:a,setTheme:o},children:e})}function r_(){return(0,V.useContext)(e_)}var i_={indigo:{from:`#6366f1`,to:`#8b5cf6`,label:`Indigo`},ocean:{from:`#0ea5e9`,to:`#6366f1`,label:`Ocean`},emerald:{from:`#10b981`,to:`#0d9488`,label:`Emerald`},sunset:{from:`#fb923c`,to:`#e11d48`,label:`Sunset`},rose:{from:`#f43f5e`,to:`#a855f7`,label:`Rose`},amber:{from:`#f59e0b`,to:`#ea580c`,label:`Amber`},teal:{from:`#2dd4bf`,to:`#0284c7`,label:`Teal`},fuchsia:{from:`#e879f9`,to:`#7c3aed`,label:`Fuchsia`},lime:{from:`#a3e635`,to:`#059669`,label:`Lime`},slate:{from:`#64748b`,to:`#1e293b`,label:`Slate`}};function a_(e){return i_[e]??i_.indigo}function o_(e,t){let n=a_(e);return t?{backgroundImage:`linear-gradient(180deg, rgb(0 0 0 / 0.05), rgb(0 0 0 / 0.45)), url("${t}")`,backgroundSize:`cover`,backgroundPosition:`center`}:{backgroundImage:[`radial-gradient(circle at 85% 15%, rgb(255 255 255 / 0.35), transparent 38%)`,`radial-gradient(rgb(255 255 255 / 0.14) 1px, transparent 1px)`,`linear-gradient(135deg, ${n.from} 0%, ${n.to} 100%)`].join(`, `),backgroundSize:`auto, 14px 14px, auto`}}function s_(e){let t=a_(e);return{backgroundImage:`linear-gradient(135deg, ${t.from}, ${t.to})`}}var c_={xs:`size-6 text-[10px]`,sm:`size-8 text-xs`,md:`size-9 text-[13px]`,lg:`size-12 text-base`,xl:`size-20 text-2xl`};function l_({user:e,size:t=`md`,className:n}){return(0,K.jsx)(`span`,{className:y(`relative inline-grid shrink-0 select-none place-items-center overflow-hidden rounded-full font-semibold text-white ring-2 ring-card`,c_[t],!e.avatarUrl&&L(e.id),n),title:e.name,children:e.avatarUrl?(0,K.jsx)(`img`,{src:e.avatarUrl,alt:``,className:`size-full object-cover`}):M(e.name)})}function u_({users:e,max:t=3,size:n=`xs`}){let r=e.slice(0,t),i=e.length-r.length;return(0,K.jsxs)(`span`,{className:`flex items-center -space-x-1.5`,children:[r.map(e=>(0,K.jsx)(l_,{user:e,size:n},e.id)),i>0&&(0,K.jsxs)(`span`,{className:y(`inline-grid place-items-center rounded-full bg-muted font-medium text-muted-foreground ring-2 ring-card`,c_[n]),children:[`+`,i]})]})}var d_=du;function f_({className:e,children:t,size:n=`md`,hideClose:r,...i}){return(0,K.jsxs)(_u,{children:[(0,K.jsx)(yu,{className:`fixed inset-0 z-50 bg-black/40 backdrop-blur-[2px] data-[state=open]:animate-fade-in`}),(0,K.jsxs)(Cu,{className:y(`fixed top-1/2 left-1/2 z-50 flex max-h-[calc(100dvh-2rem)] w-[calc(100vw-2rem)] -translate-x-1/2 -translate-y-1/2 flex-col rounded-2xl border bg-popover text-popover-foreground shadow-2xl outline-none data-[state=open]:animate-scale-in`,n===`sm`&&`max-w-md`,n===`md`&&`max-w-lg`,n===`lg`&&`max-w-2xl`,n===`xl`&&`max-w-4xl`,e),...i,children:[t,!r&&(0,K.jsxs)(Au,{className:`absolute top-4 right-4 rounded-md p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,children:[(0,K.jsx)(Gs,{className:`size-4`}),(0,K.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function p_({title:e,description:t,icon:n}){return(0,K.jsxs)(`div`,{className:`flex gap-3 px-6 pt-6 pb-4 pr-12`,children:[n&&(0,K.jsx)(`div`,{className:`grid size-10 shrink-0 place-items-center rounded-xl bg-primary/10 text-primary`,children:n}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(Du,{className:`text-lg font-semibold tracking-tight`,children:e}),t?(0,K.jsx)(Ou,{className:`mt-1 text-sm text-muted-foreground`,children:t}):(0,K.jsx)(Ou,{className:`sr-only`,children:e})]})]})}function m_({className:e,...t}){return(0,K.jsx)(`div`,{className:y(`ck-scrollbar min-h-0 flex-1 overflow-y-auto px-6 pb-2`,e),...t})}function h_({className:e,...t}){return(0,K.jsx)(`div`,{className:y(`flex flex-col-reverse gap-2 px-6 pt-4 pb-6 sm:flex-row sm:justify-end`,e),...t})}function g_({className:e,children:t,...n}){return(0,K.jsxs)(_u,{children:[(0,K.jsx)(yu,{className:`fixed inset-0 z-50 bg-black/40 data-[state=open]:animate-fade-in`}),(0,K.jsxs)(Cu,{className:y(`fixed inset-y-0 left-0 z-50 w-72 max-w-[85vw] bg-sidebar shadow-2xl outline-none data-[state=open]:animate-slide-in`,e),...n,children:[(0,K.jsx)(Du,{className:`sr-only`,children:`Navigation`}),(0,K.jsx)(Ou,{className:`sr-only`,children:`Main navigation`}),t]})]})}var __=1,v_=.9,y_=.8,b_=.17,x_=.1,S_=.999,C_=.9999,w_=.99,T_=/[\\\/_+.#"@\[\(\{&]/,E_=/[\\\/_+.#"@\[\(\{&]/g,D_=/[\s-]/,O_=/[\s-]/g;function k_(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?__:w_;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=k_(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=__:T_.test(e.charAt(l-1))?(d*=y_,p=e.slice(i,l-1).match(E_),p&&i>0&&(d*=S_**+p.length)):D_.test(e.charAt(l-1))?(d*=v_,m=e.slice(i,l-1).match(O_),m&&i>0&&(d*=S_**+m.length)):(d*=b_,i>0&&(d*=S_**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=C_)),(d<x_&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=k_(e,t,n,r,l+1,a+2,o),f*x_>d&&(d=f*x_)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function A_(e){return e.toLowerCase().replace(O_,` `)}function j_(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,k_(e,t,A_(e),A_(t),0,0,{})}var M_=`[cmdk-group=""]`,N_=`[cmdk-group-items=""]`,P_=`[cmdk-group-heading=""]`,F_=`[cmdk-item=""]`,I_=`${F_}:not([aria-disabled="true"])`,L_=`cmdk-item-select`,R_=`data-value`,z_=(e,t,n)=>j_(e,t,n),B_=V.createContext(void 0),V_=()=>V.useContext(B_),H_=V.createContext(void 0),U_=()=>V.useContext(H_),W_=V.createContext(void 0),G_=V.forwardRef((e,t)=>{let n=av(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=av(()=>new Set),i=av(()=>new Map),a=av(()=>new Map),o=av(()=>new Set),s=rv(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,..._}=e,v=we(),y=we(),b=we(),x=V.useRef(null),S=cv();iv(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,C.emit()}},[u]),iv(()=>{S(6,k)},[]);let C=V.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)O(),E(),S(1,D);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(b);e?e.focus():(i=document.getElementById(v))==null||i.focus()}if(S(7,()=>{n.current.selectedItemId=A()?.id,C.emit()}),r||S(5,k),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}C.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),w=V.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,T(t,r)),S(2,()=>{E(),C.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),S(3,()=>{O(),E(),n.current.value||D(),C.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=A();S(4,()=>{O(),t?.getAttribute(`id`)===e&&D(),C.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:v,inputId:b,labelId:y,listInnerRef:x}),[]);function T(e,t){let r=s.current?.filter??z_;return e?r(e,n.current.search,t):0}function E(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=x.current;j().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(N_);t?t.appendChild(e.parentElement===t?e:e.closest(`${N_} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${N_} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=x.current?.querySelector(`${M_}[${R_}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function D(){let e=j().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(R_);C.setState(`value`,e||void 0)}function O(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=T(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function k(){var e;let t=A();t&&(t.parentElement?.firstChild===t&&((e=t.closest(M_)?.querySelector(P_))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function A(){return x.current?.querySelector(`${F_}[aria-selected="true"]`)}function j(){return Array.from(x.current?.querySelectorAll(I_)||[])}function M(e){let t=j()[e];t&&C.setState(`value`,t.getAttribute(R_))}function N(e){var t;let n=A(),r=j(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&C.setState(`value`,a.getAttribute(R_))}function ee(e){let t=A()?.closest(M_),n;for(;t&&!n;)t=e>0?tv(t,M_):nv(t,M_),n=t?.querySelector(I_);n?C.setState(`value`,n.getAttribute(R_)):N(e)}let P=()=>M(j().length-1),te=e=>{e.preventDefault(),e.metaKey?P():e.altKey?ee(1):N(1)},ne=e=>{e.preventDefault(),e.metaKey?M(0):e.altKey?ee(-1):N(-1)};return V.createElement(R.div,{ref:t,tabIndex:-1,..._,"cmdk-root":``,onKeyDown:e=>{var t;(t=_.onKeyDown)==null||t.call(_,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:g&&e.ctrlKey&&te(e);break;case`ArrowDown`:te(e);break;case`p`:case`k`:g&&e.ctrlKey&&ne(e);break;case`ArrowUp`:ne(e);break;case`Home`:e.preventDefault(),M(0);break;case`End`:e.preventDefault(),P();break;case`Enter`:{e.preventDefault();let t=A();if(t){let e=new Event(L_);t.dispatchEvent(e)}}}}},V.createElement(`label`,{"cmdk-label":``,htmlFor:w.inputId,id:w.labelId,style:dv},c),uv(e,e=>V.createElement(H_.Provider,{value:C},V.createElement(B_.Provider,{value:w},e))))}),K_=V.forwardRef((e,t)=>{let n=we(),r=V.useRef(null),i=V.useContext(W_),a=V_(),o=rv(e),s=o.current?.forceMount??i?.forceMount;iv(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=sv(n,r,[e.value,e.children,r],e.keywords),l=U_(),u=ov(e=>e.value&&e.value===c.current),d=ov(e=>s||a.filter()===!1?!0:!e.search||e.filtered.items.get(n)>0);V.useEffect(()=>{let t=r.current;if(t&&!e.disabled)return t.addEventListener(L_,f),()=>t.removeEventListener(L_,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;p(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function p(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:m,value:h,onSelect:g,forceMount:_,keywords:v,...y}=e;return V.createElement(R.div,{ref:me(r,t),...y,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!m,"aria-selected":!!u,"data-disabled":!!m,"data-selected":!!u,onPointerMove:m||a.getDisablePointerSelection()?void 0:p,onClick:m?void 0:f},e.children)}),q_=V.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=we(),s=V.useRef(null),c=V.useRef(null),l=we(),u=V_(),d=ov(e=>i||u.filter()===!1?!0:!e.search||e.filtered.groups.has(o));iv(()=>u.group(o),[]),sv(o,s,[e.value,e.heading,c]);let f=V.useMemo(()=>({id:o,forceMount:i}),[i]);return V.createElement(R.div,{ref:me(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:!d||void 0},n&&V.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),uv(e,e=>V.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},V.createElement(W_.Provider,{value:f},e))))}),J_=V.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=V.useRef(null),a=ov(e=>!e.search);return!n&&!a?null:V.createElement(R.div,{ref:me(i,t),...r,"cmdk-separator":``,role:`separator`})}),Y_=V.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=U_(),o=ov(e=>e.search),s=ov(e=>e.selectedItemId),c=V_();return V.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),V.createElement(R.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),X_=V.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=V.useRef(null),o=V.useRef(null),s=ov(e=>e.selectedItemId),c=V_();return V.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),V.createElement(R.div,{ref:me(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},uv(e,e=>V.createElement(`div`,{ref:me(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),Z_=V.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return V.createElement(du,{open:n,onOpenChange:r},V.createElement(_u,{container:o},V.createElement(yu,{"cmdk-overlay":``,className:i}),V.createElement(Cu,{"aria-label":e.label,"cmdk-dialog":``,className:a},V.createElement(G_,{ref:t,...s}))))}),Q_=V.forwardRef((e,t)=>ov(e=>e.filtered.count===0)?V.createElement(R.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),$_=V.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return V.createElement(R.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},uv(e,e=>V.createElement(`div`,{"aria-hidden":!0},e)))}),ev=Object.assign(G_,{List:X_,Item:K_,Input:Y_,Group:q_,Separator:J_,Dialog:Z_,Empty:Q_,Loading:$_});function tv(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function nv(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function rv(e){let t=V.useRef(e);return iv(()=>{t.current=e}),t}var iv=typeof window>`u`?V.useEffect:V.useLayoutEffect;function av(e){let t=V.useRef();return t.current===void 0&&(t.current=e()),t}function ov(e){let t=U_(),n=()=>e(t.snapshot());return V.useSyncExternalStore(t.subscribe,n,n)}function sv(e,t,n,r=[]){let i=V.useRef(),a=V_();return iv(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(R_,s),i.current=s}),i}var cv=()=>{let[e,t]=V.useState(),n=av(()=>new Map);return iv(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function lv(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function uv({asChild:e,children:t},n){return e&&V.isValidElement(t)?V.cloneElement(lv(t),{ref:t.ref},n(t.props.children)):n(t)}var dv={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},fv={lesson:{icon:bo,label:`Lesson`,tint:`bg-sky-500/10 text-sky-600 dark:text-sky-400`,solid:`bg-sky-500`},resource:{icon:Yo,label:`Resource`,tint:`bg-slate-500/10 text-slate-600 dark:text-slate-300`,solid:`bg-slate-500`},assignment:{icon:Po,label:`Assignment`,tint:`bg-amber-500/10 text-amber-600 dark:text-amber-400`,solid:`bg-amber-500`},quiz:{icon:Zo,label:`Quiz`,tint:`bg-violet-500/10 text-violet-600 dark:text-violet-400`,solid:`bg-violet-500`},forum:{icon:ss,label:`Forum`,tint:`bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`,solid:`bg-emerald-500`}};function pv(e,t){return`/courses/${e}/activities/${t}`}var mv=c(`inline-flex items-center gap-1 whitespace-nowrap rounded-full px-2 py-0.5 text-xs font-medium [&_svg]:size-3 [&_svg]:shrink-0`,{variants:{variant:{default:`bg-primary/10 text-primary`,neutral:`bg-muted text-muted-foreground`,outline:`border text-muted-foreground`,success:`bg-emerald-500/12 text-emerald-700 dark:text-emerald-400`,warning:`bg-amber-500/15 text-amber-700 dark:text-amber-400`,danger:`bg-red-500/12 text-red-700 dark:text-red-400`,info:`bg-sky-500/12 text-sky-700 dark:text-sky-400`,violet:`bg-violet-500/12 text-violet-700 dark:text-violet-400`,solid:`bg-foreground text-background`}},defaultVariants:{variant:`neutral`}});function hv({className:e,variant:t,...n}){return(0,K.jsx)(`span`,{className:y(mv({variant:t}),e),...n})}function gv({color:e,imageUrl:t,title:n,className:r,children:i}){return(0,K.jsxs)(`div`,{className:y(`relative overflow-hidden`,r),style:o_(e,t),children:[n&&!t&&(0,K.jsx)(`span`,{className:`pointer-events-none absolute -right-2 -bottom-6 text-[96px] leading-none font-black tracking-tighter text-white/15 select-none`,children:n.split(/\s+/).slice(0,2).map(e=>e[0]).join(``)}),i]})}var _v={teacher:{label:`Teaching`,variant:`violet`},assistant:{label:`Assisting`,variant:`info`},student:{label:`Enrolled`,variant:`default`}};function vv({course:e,showProgress:t=!0}){let n=e.myRole?_v[e.myRole]:null;return(0,K.jsxs)(Qa,{to:`/courses/${e.slug}`,className:`group flex flex-col overflow-hidden rounded-xl border bg-card shadow-xs transition-all duration-200 hover:-translate-y-0.5 hover:shadow-lg hover:shadow-black/5 dark:hover:shadow-black/30`,children:[(0,K.jsx)(gv,{color:e.coverColor,imageUrl:e.coverImageUrl,title:e.title,className:`h-28`,children:(0,K.jsxs)(`div`,{className:`absolute inset-x-3 top-3 flex items-center justify-between gap-2`,children:[e.categoryName?(0,K.jsx)(`span`,{className:`rounded-full bg-black/20 px-2 py-0.5 text-[11px] font-medium text-white backdrop-blur-sm`,children:e.categoryName}):(0,K.jsx)(`span`,{}),e.visibility!==`published`&&(0,K.jsx)(`span`,{className:`rounded-full bg-white/90 px-2 py-0.5 text-[11px] font-semibold text-slate-800 capitalize`,children:e.visibility})]})}),(0,K.jsxs)(`div`,{className:`flex flex-1 flex-col p-4`,children:[(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,K.jsx)(`h3`,{className:`line-clamp-2 font-semibold leading-snug tracking-tight group-hover:text-primary`,children:e.title}),n&&(0,K.jsx)(hv,{variant:n.variant,className:`mt-0.5 shrink-0`,children:n.label})]}),(0,K.jsx)(`p`,{className:`mt-1.5 line-clamp-2 text-sm text-muted-foreground`,children:e.summary}),(0,K.jsx)(`div`,{className:`mt-auto pt-4`,children:t&&e.progress!=null?(0,K.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:`Progress`}),(0,K.jsxs)(`span`,{className:`font-semibold tabular-nums`,children:[e.progress,`%`]})]}),(0,K.jsx)(ve,{value:e.progress,tone:e.progress===100?`success`:`primary`})]}):(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-xs text-muted-foreground`,children:[(0,K.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(u_,{users:e.teachers,max:2}),(0,K.jsx)(`span`,{className:`truncate`,children:e.teachers.map(e=>e.name).join(`, `)||`No teacher yet`})]}),(0,K.jsxs)(`span`,{className:`flex shrink-0 items-center gap-3`,children:[(0,K.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(Us,{className:`size-3.5`}),e.studentCount]}),(0,K.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(bo,{className:`size-3.5`}),e.activityCount]})]})]})})]})]})}function yv(){return(0,K.jsxs)(`div`,{className:`overflow-hidden rounded-xl border bg-card`,children:[(0,K.jsx)(`div`,{className:`h-28 animate-pulse bg-muted`}),(0,K.jsxs)(`div`,{className:`space-y-2.5 p-4`,children:[(0,K.jsx)(`div`,{className:`h-4 w-3/4 animate-pulse rounded bg-muted`}),(0,K.jsx)(`div`,{className:`h-3 w-full animate-pulse rounded bg-muted`}),(0,K.jsx)(`div`,{className:`h-3 w-2/3 animate-pulse rounded bg-muted`})]})]})}function bv({type:e,className:t,size:n=`md`}){let r=fv[e],i=r.icon;return(0,K.jsx)(`span`,{className:y(`grid shrink-0 place-items-center rounded-lg`,r.tint,n===`sm`&&`size-7 [&_svg]:size-3.5`,n===`md`&&`size-9 [&_svg]:size-4`,n===`lg`&&`size-11 rounded-xl [&_svg]:size-5`,t),children:(0,K.jsx)(i,{})})}var xv=`flex cursor-pointer items-center gap-3 rounded-lg px-3 py-2 text-sm text-foreground data-[selected=true]:bg-accent [&_svg]:size-4 [&_svg]:shrink-0`,Sv=`[&_[cmdk-group-heading]]:px-3 [&_[cmdk-group-heading]]:pt-3 [&_[cmdk-group-heading]]:pb-1.5 [&_[cmdk-group-heading]]:text-[11px] [&_[cmdk-group-heading]]:font-semibold [&_[cmdk-group-heading]]:tracking-wider [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group-heading]]:uppercase`;function Cv({open:e,onOpenChange:t}){let[n,r]=(0,V.useState)(``),i=de(n.trim(),200),a=Mi(),o=le(),{resolved:s,setTheme:c}=r_();(0,V.useEffect)(()=>{e||r(``)},[e]);let{data:l,isFetching:u}=m({queryKey:[`search`,i],queryFn:()=>P.get(`/search?q=${encodeURIComponent(i)}`),enabled:e&&i.length>=2,placeholderData:e=>e}),d=e=>{t(!1),a(e)},f=[{label:`Dashboard`,icon:qo,path:`/`},{label:`My courses`,icon:bo,path:`/my-courses`},{label:`Explore courses`,icon:Io,path:`/catalog`},{label:`Calendar`,icon:wo,path:`/calendar`},{label:`Profile`,icon:Vs,path:`/profile`},{label:`Create a course`,icon:hs,path:`/courses/new`,show:D(o?.role)},{label:`Administration`,icon:Cs,path:`/admin`,show:o?.role===`admin`},{label:`Manage users`,icon:Us,path:`/admin/users`,show:o?.role===`admin`}],p=n.trim().toLowerCase(),h=f.filter(e=>e.show!==!1&&(!p||e.label.toLowerCase().includes(p))),g=i.length>=2,_=g?l:void 0;return(0,K.jsx)(d_,{open:e,onOpenChange:t,children:(0,K.jsx)(f_,{hideClose:!0,className:`top-[15%] max-w-xl translate-y-0 overflow-hidden p-0`,"aria-describedby":void 0,children:(0,K.jsxs)(ev,{shouldFilter:!1,label:`Search`,className:`flex flex-col`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-3 border-b px-4`,children:[(0,K.jsx)(xs,{className:`size-4.5 shrink-0 text-muted-foreground`}),(0,K.jsx)(ev.Input,{value:n,onValueChange:r,placeholder:`Search courses, activities and people…`,className:`h-13 flex-1 bg-transparent text-[15px] outline-none placeholder:text-muted-foreground`}),u&&(0,K.jsx)(Ee,{className:`size-4`})]}),(0,K.jsxs)(ev.List,{className:`ck-scrollbar max-h-[min(60vh,28rem)] overflow-y-auto p-2`,children:[(0,K.jsx)(ev.Empty,{className:`px-3 py-10 text-center text-sm text-muted-foreground`,children:g?`No matches. Try a different search.`:`Type to search.`}),_&&_.courses.length>0&&(0,K.jsx)(ev.Group,{heading:`Courses`,className:Sv,children:_.courses.map(e=>(0,K.jsxs)(ev.Item,{value:`course-${e.id}`,onSelect:()=>d(`/courses/${e.slug}`),className:xv,children:[(0,K.jsx)(`span`,{className:`size-6 shrink-0 rounded-md`,style:s_(e.coverColor)}),(0,K.jsx)(`span`,{className:`truncate`,children:e.title})]},e.id))}),_&&_.activities.length>0&&(0,K.jsx)(ev.Group,{heading:`Activities`,className:Sv,children:_.activities.map(e=>(0,K.jsxs)(ev.Item,{value:`activity-${e.id}`,onSelect:()=>d(pv(e.course.slug,e.id)),className:xv,children:[(0,K.jsx)(bv,{type:e.type,size:`sm`}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.title}),(0,K.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:e.course.title})]},e.id))}),_&&_.users.length>0&&(0,K.jsx)(ev.Group,{heading:`People`,className:Sv,children:_.users.map(e=>(0,K.jsxs)(ev.Item,{value:`user-${e.id}`,onSelect:()=>d(`/admin/users?q=${encodeURIComponent(e.email)}`),className:xv,children:[(0,K.jsx)(l_,{user:e,size:`xs`}),(0,K.jsx)(`span`,{className:`truncate`,children:e.name}),(0,K.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:e.email})]},e.id))}),h.length>0&&(0,K.jsxs)(ev.Group,{heading:`Go to`,className:Sv,children:[h.map(e=>(0,K.jsxs)(ev.Item,{value:`link-${e.path}`,onSelect:()=>d(e.path),className:xv,children:[(0,K.jsx)(e.icon,{className:`text-muted-foreground`}),e.label]},e.path)),(!p||`theme dark light`.includes(p))&&(0,K.jsxs)(ev.Item,{value:`toggle-theme`,onSelect:()=>{c(s===`dark`?`light`:`dark`),t(!1)},className:xv,children:[(0,K.jsx)(ls,{className:`text-muted-foreground`}),`Switch to `,s===`dark`?`light`:`dark`,` mode`]})]})]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-4 border-t bg-muted/40 px-4 py-2 text-[11px] text-muted-foreground`,children:[(0,K.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(Ae,{children:`↑`}),(0,K.jsx)(Ae,{children:`↓`}),` to navigate`]}),(0,K.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(Ae,{children:(0,K.jsx)(Ro,{className:`size-3`})}),`to open`]}),(0,K.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(Ae,{children:`esc`}),` to close`]})]})]})})})}function wv({name:e,className:t}){return(0,K.jsxs)(`span`,{className:y(`flex items-center gap-2.5`,t),children:[(0,K.jsx)(`span`,{className:`grid size-8 place-items-center rounded-[10px] bg-gradient-to-br from-primary to-primary/70 text-primary-foreground shadow-sm shadow-primary/30`,children:(0,K.jsx)(Go,{className:`size-[18px]`})}),(0,K.jsx)(`span`,{className:`truncate text-[15px] font-semibold tracking-tight`,children:e})]})}function Tv({to:e,icon:t,children:n,end:r,onNavigate:i}){return(0,K.jsx)(to,{to:e,end:r,onClick:i,className:({isActive:e})=>y(`group flex h-9 items-center gap-3 rounded-lg px-2.5 text-sm font-medium text-muted-foreground transition-colors hover:bg-foreground/[0.04] hover:text-foreground`,e&&`bg-card text-foreground shadow-xs ring-1 ring-border`),children:({isActive:e})=>(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(t,{className:y(`size-[18px] shrink-0`,e&&`text-primary`)}),(0,K.jsx)(`span`,{className:`truncate`,children:n})]})})}function Ev({course:e,onNavigate:t}){return(0,K.jsxs)(to,{to:`/courses/${e.slug}`,onClick:t,className:({isActive:e})=>y(`flex h-8 items-center gap-3 rounded-lg px-2.5 text-[13px] text-muted-foreground transition-colors hover:bg-foreground/[0.04] hover:text-foreground`,e&&`bg-foreground/[0.05] font-medium text-foreground`),children:[(0,K.jsx)(`span`,{className:`size-2.5 shrink-0 rounded-[4px]`,style:s_(e.coverColor)}),(0,K.jsx)(`span`,{className:`truncate`,children:e.title})]})}function Dv({onNavigate:e}){let{data:t}=S(),n=t?.user,{data:r}=m({queryKey:[`courses`,`mine`],queryFn:()=>P.get(`/courses/mine`),enabled:!!n}),i=(r??[]).filter(e=>e.myRole===`student`).slice(0,6),a=(r??[]).filter(e=>e.myRole&&e.myRole!==`student`).slice(0,6);return(0,K.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,K.jsx)(`div`,{className:`flex h-14 items-center px-4`,children:(0,K.jsx)(Qa,{to:`/`,onClick:e,className:`min-w-0`,children:(0,K.jsx)(wv,{name:t?.site.name??`Coursekit`})})}),(0,K.jsxs)(`nav`,{className:`ck-scrollbar flex-1 space-y-6 overflow-y-auto px-3 py-3`,children:[(0,K.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,K.jsx)(Tv,{to:`/`,end:!0,icon:qo,onNavigate:e,children:`Dashboard`}),(0,K.jsx)(Tv,{to:`/my-courses`,icon:bo,onNavigate:e,children:`My courses`}),(0,K.jsx)(Tv,{to:`/catalog`,icon:Io,onNavigate:e,children:`Explore`}),(0,K.jsx)(Tv,{to:`/calendar`,icon:wo,onNavigate:e,children:`Calendar`})]}),a.length>0&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`p`,{className:`mb-1.5 px-2.5 text-[11px] font-semibold tracking-wider text-muted-foreground/80 uppercase`,children:`Teaching`}),(0,K.jsx)(`div`,{className:`space-y-0.5`,children:a.map(t=>(0,K.jsx)(Ev,{course:t,onNavigate:e},t.id))})]}),i.length>0&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`p`,{className:`mb-1.5 px-2.5 text-[11px] font-semibold tracking-wider text-muted-foreground/80 uppercase`,children:`Learning`}),(0,K.jsx)(`div`,{className:`space-y-0.5`,children:i.map(t=>(0,K.jsx)(Ev,{course:t,onNavigate:e},t.id))})]}),n?.role===`admin`&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`p`,{className:`mb-1.5 px-2.5 text-[11px] font-semibold tracking-wider text-muted-foreground/80 uppercase`,children:`Site`}),(0,K.jsx)(Tv,{to:`/admin`,icon:Cs,onNavigate:e,children:`Administration`})]})]}),(0,K.jsxs)(`div`,{className:`space-y-3 border-t border-sidebar-border p-3`,children:[D(n?.role)&&(0,K.jsx)(k,{asChild:!0,variant:`outline`,className:`w-full justify-start`,size:`sm`,children:(0,K.jsxs)(Qa,{to:`/courses/new`,onClick:e,children:[(0,K.jsx)(hs,{}),` New course`]})}),n&&(0,K.jsxs)(Qa,{to:`/profile`,onClick:e,className:`flex items-center gap-3 rounded-lg p-1.5 transition-colors hover:bg-foreground/[0.04]`,children:[(0,K.jsx)(l_,{user:n,size:`sm`}),(0,K.jsxs)(`span`,{className:`min-w-0`,children:[(0,K.jsx)(`span`,{className:`block truncate text-sm font-medium`,children:n.name}),(0,K.jsx)(`span`,{className:`block truncate text-xs text-muted-foreground`,children:w[n.role]})]})]})]})]})}var Ov={grade:go,announcement:ts,forum:as,enrolment:zs};function kv({type:e}){let t=Ov[e]??vo;return(0,K.jsx)(`span`,{className:y(`grid size-8 shrink-0 place-items-center rounded-full`,e===`grade`?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`:e===`announcement`?`bg-amber-500/12 text-amber-600 dark:text-amber-400`:e===`forum`?`bg-sky-500/10 text-sky-600 dark:text-sky-400`:`bg-primary/10 text-primary`),children:(0,K.jsx)(t,{className:`size-4`})})}function Av(){return m({queryKey:[`notifications`],queryFn:()=>P.get(`/notifications`),refetchInterval:6e4})}function jv(){let{data:e}=Av(),t=I(),n=Mi(),[r,a]=(0,V.useState)(!1),o=e?.unreadCount??0,s=async e=>{await P.post(`/notifications/read`,e?{ids:e}:{}),await t.invalidateQueries({queryKey:[`notifications`]})};return(0,K.jsxs)(Yg,{open:r,onOpenChange:a,children:[(0,K.jsx)(Xg,{asChild:!0,children:(0,K.jsxs)(k,{variant:`ghost`,size:`icon`,className:`relative`,"aria-label":`Notifications${o?` (${o} unread)`:``}`,children:[(0,K.jsx)(vo,{className:`size-[18px]`}),o>0&&(0,K.jsx)(`span`,{className:`absolute top-1 right-1 grid h-4 min-w-4 place-items-center rounded-full bg-primary px-1 text-[10px] font-semibold text-primary-foreground ring-2 ring-background`,children:o>9?`9+`:o})]})}),(0,K.jsxs)(Zg,{align:`end`,className:`w-[min(24rem,calc(100vw-1.5rem))] p-0`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between border-b px-4 py-3`,children:[(0,K.jsx)(`p`,{className:`text-sm font-semibold`,children:`Notifications`}),o>0&&(0,K.jsx)(`button`,{className:`text-xs font-medium text-primary hover:underline`,onClick:()=>s(),children:`Mark all as read`})]}),(0,K.jsxs)(`div`,{className:`ck-scrollbar max-h-96 overflow-y-auto`,children:[(e?.items??[]).slice(0,8).map(e=>(0,K.jsxs)(`button`,{className:`flex w-full gap-3 border-b px-4 py-3 text-left transition-colors last:border-0 hover:bg-accent/60`,onClick:()=>{a(!1),e.readAt||s([e.id]),e.link&&n(e.link)},children:[(0,K.jsx)(kv,{type:e.type}),(0,K.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`span`,{className:y(`block text-sm leading-snug`,!e.readAt&&`font-semibold`),children:e.title}),e.body&&(0,K.jsx)(`span`,{className:`mt-0.5 line-clamp-2 block text-xs text-muted-foreground`,children:e.body}),(0,K.jsx)(`span`,{className:`mt-1 block text-[11px] text-muted-foreground`,children:i(e.createdAt)})]}),!e.readAt&&(0,K.jsx)(`span`,{className:`mt-1.5 size-2 shrink-0 rounded-full bg-primary`})]},e.id)),e&&e.items.length===0&&(0,K.jsx)(`p`,{className:`px-4 py-10 text-center text-sm text-muted-foreground`,children:`You're all caught up.`})]}),(0,K.jsx)(`div`,{className:`border-t p-2`,children:(0,K.jsx)(k,{asChild:!0,variant:`ghost`,size:`sm`,className:`w-full`,onClick:()=>a(!1),children:(0,K.jsx)(Qa,{to:`/notifications`,children:`View all notifications`})})})]})]})}function Mv(){let e=le(),{theme:t,setTheme:n}=r_(),r=I(),i=N(),a=Mi();return e?(0,K.jsxs)(Lg,{children:[(0,K.jsx)(Rg,{asChild:!0,children:(0,K.jsx)(`button`,{className:`rounded-full outline-offset-2`,"aria-label":`Account menu`,children:(0,K.jsx)(l_,{user:e,size:`sm`})})}),(0,K.jsxs)(Vg,{className:`w-60`,children:[(0,K.jsxs)(`div`,{className:`px-2.5 py-2`,children:[(0,K.jsx)(`p`,{className:`truncate text-sm font-semibold`,children:e.name}),(0,K.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:e.email})]}),(0,K.jsx)(Gg,{}),(0,K.jsx)(Ug,{asChild:!0,children:(0,K.jsxs)(Qa,{to:`/profile`,children:[(0,K.jsx)(Vs,{}),` Profile`]})}),(0,K.jsxs)(zg,{children:[(0,K.jsxs)(Kg,{children:[(0,K.jsx)(ds,{}),` Appearance`]}),(0,K.jsxs)(qg,{children:[(0,K.jsx)(Jg,{checked:t===`light`,onSelect:()=>n(`light`),children:`Light`}),(0,K.jsx)(Jg,{checked:t===`dark`,onSelect:()=>n(`dark`),children:`Dark`}),(0,K.jsx)(Jg,{checked:t===`system`,onSelect:()=>n(`system`),children:`System`})]})]}),e.role===`admin`&&(0,K.jsx)(Ug,{asChild:!0,children:(0,K.jsxs)(Qa,{to:`/admin`,children:[(0,K.jsx)(Cs,{}),` Administration`]})}),(0,K.jsx)(Gg,{}),(0,K.jsxs)(Ug,{onSelect:async()=>{try{await P.post(`/auth/logout`)}finally{let e=r.getQueryData([`session`]);r.clear(),e&&i({...e,user:null,impersonator:null}),a(`/login`)}},children:[(0,K.jsx)($o,{}),` Sign out`]})]})]}):null}function Nv(){let{data:e}=S(),t=I(),n=N(),r=Mi();return!e?.impersonator||!e.user?null:(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-x-3 gap-y-1 bg-amber-400 px-4 py-2 text-center text-[13px] font-medium text-amber-950`,children:[(0,K.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(Ls,{className:`size-4`}),` You're viewing the site as `,e.user.name,`.`]}),(0,K.jsxs)(`button`,{onClick:async()=>{try{let e=await P.post(`/auth/stop-impersonating`);t.clear(),n(e),r(`/admin/users`)}catch(e){_e.error(A(e))}},className:`font-semibold underline underline-offset-2`,children:[`Return to `,e.impersonator.name]})]})}function Pv(){let{resolved:e,setTheme:t}=r_();return(0,K.jsx)(k,{variant:`ghost`,size:`icon`,"aria-label":`Toggle dark mode`,onClick:()=>t(e===`dark`?`light`:`dark`),children:e===`dark`?(0,K.jsx)(Ds,{className:`size-[18px]`}):(0,K.jsx)(ls,{className:`size-[18px]`})})}function Fv(){let[e,t]=(0,V.useState)(!1),[n,r]=(0,V.useState)(!1),i=Ai();(0,V.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),r(e=>!e))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,V.useEffect)(()=>{window.scrollTo({top:0})},[i.pathname]);let a=typeof navigator<`u`&&/mac/i.test(navigator.platform);return(0,K.jsxs)(`div`,{className:`flex min-h-dvh`,children:[(0,K.jsx)(`aside`,{className:`sticky top-0 hidden h-dvh w-64 shrink-0 border-r border-sidebar-border bg-sidebar lg:block`,children:(0,K.jsx)(Dv,{})}),(0,K.jsx)(d_,{open:e,onOpenChange:t,children:(0,K.jsx)(g_,{children:(0,K.jsx)(Dv,{onNavigate:()=>t(!1)})})}),(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,K.jsx)(Nv,{}),(0,K.jsxs)(`header`,{className:`sticky top-0 z-30 flex h-14 items-center gap-2 border-b bg-background/80 px-3 backdrop-blur-lg sm:px-5`,children:[(0,K.jsx)(k,{variant:`ghost`,size:`icon`,className:`lg:hidden`,onClick:()=>t(!0),"aria-label":`Open navigation`,children:(0,K.jsx)(rs,{className:`size-5`})}),(0,K.jsxs)(`button`,{onClick:()=>r(!0),className:`flex h-9 min-w-0 flex-1 items-center gap-2.5 rounded-lg border bg-card px-3 text-sm text-muted-foreground shadow-xs transition-colors hover:border-foreground/20 sm:max-w-sm`,children:[(0,K.jsx)(xs,{className:`size-4 shrink-0`}),(0,K.jsx)(`span`,{className:`truncate`,children:`Search courses and activities…`}),(0,K.jsxs)(`span`,{className:`ml-auto hidden items-center gap-0.5 sm:flex`,children:[(0,K.jsx)(Ae,{children:a?`⌘`:`Ctrl`}),(0,K.jsx)(Ae,{children:`K`})]})]}),(0,K.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,K.jsx)(Pv,{}),(0,K.jsx)(jv,{}),(0,K.jsx)(`div`,{className:`ml-1.5`,children:(0,K.jsx)(Mv,{})})]})]}),(0,K.jsx)(`main`,{className:`flex-1`,children:(0,K.jsx)(ja,{})})]}),(0,K.jsx)(Cv,{open:n,onOpenChange:r})]})}function Iv({children:e,className:t,size:n=`default`}){return(0,K.jsx)(`div`,{className:y(`mx-auto w-full px-4 py-6 sm:px-6 lg:px-8 lg:py-8`,n==="default"&&`max-w-7xl`,n===`narrow`&&`max-w-3xl`,n===`wide`&&`max-w-[1600px]`,t),children:e})}var Lv=`ck-update-reloads`,Rv=3e5,zv=3,Bv=1e4,Vv=import.meta.url,Hv=!1;function Uv(){if(Hv)return!0;let e=Date.now();try{let t=Gv(sessionStorage.getItem(Lv),e);if(t.length>=zv||t.some(e=>e.build===Vv))return!1;sessionStorage.setItem(Lv,JSON.stringify([...t,{build:Vv,at:e}]))}catch{return!1}return Hv=!0,setTimeout(()=>Hv=!1,Bv),window.location.reload(),!0}function Wv(e){return new Promise((t,n)=>setTimeout(()=>n(e),Bv))}function Gv(e,t){let n;try{n=JSON.parse(e??`[]`)}catch{return[]}return Array.isArray(n)?n.filter(e=>typeof e?.build==`string`&&typeof e.at==`number`&&t-e.at<Rv):[]}var Kv=`w-full rounded-lg border border-input bg-card px-3 text-sm text-foreground shadow-xs transition-colors placeholder:text-muted-foreground/70 focus-visible:border-primary focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-primary/15 disabled:cursor-not-allowed disabled:opacity-60 aria-invalid:border-destructive`;function qv({className:e,...t}){return(0,K.jsx)(`input`,{className:y(Kv,`h-9`,e),...t})}function Jv({className:e,...t}){return(0,K.jsx)(`textarea`,{className:y(Kv,`min-h-24 py-2 leading-relaxed`,e),...t})}function Yv({className:e,children:t,...n}){return(0,K.jsx)(`select`,{className:y(Kv,`h-9 appearance-none bg-[length:16px] bg-[right_0.6rem_center] bg-no-repeat pr-9`,`bg-[url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")]`,e),...n,children:t})}function Xv({className:e,...t}){return(0,K.jsx)(`label`,{className:y(`text-sm font-medium leading-none text-foreground`,e),...t})}function Zv({label:e,hint:t,error:n,className:r,children:i,optional:a}){let o=(0,V.useId)(),s=`${o}-hint`;return(0,K.jsxs)(`div`,{className:y(`space-y-1.5`,r),children:[e&&(0,K.jsxs)(Xv,{htmlFor:o,className:`flex items-center gap-1.5`,children:[e,a&&(0,K.jsx)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:`Optional`})]}),i({id:o,"aria-invalid":n?!0:void 0,"aria-describedby":t||n?s:void 0}),(n||t)&&(0,K.jsx)(`p`,{id:s,className:y(`text-xs`,n?`text-destructive`:`text-muted-foreground`),children:n||t})]})}function Qv({className:e,...t}){return(0,K.jsx)(id,{className:y(`peer grid size-4.5 shrink-0 place-items-center rounded-[5px] border border-input bg-card shadow-xs transition-colors data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground disabled:opacity-50`,e),...t,children:(0,K.jsx)(od,{children:(0,K.jsx)(Eo,{className:`size-3.5`,strokeWidth:3})})})}function $v({className:e,...t}){return(0,K.jsx)(Jh,{className:y(`relative inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent bg-input transition-colors data-[state=checked]:bg-primary disabled:opacity-50`,e),...t,children:(0,K.jsx)(Xh,{className:`pointer-events-none block size-4 translate-x-0.5 rounded-full bg-white shadow-sm ring-0 transition-transform data-[state=checked]:translate-x-[18px]`})})}function ey({label:e,description:t,checked:n,onCheckedChange:r,disabled:i}){let a=(0,V.useId)();return(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-4 rounded-lg border bg-card px-3.5 py-3`,children:[(0,K.jsxs)(`label`,{htmlFor:a,className:`min-w-0 cursor-pointer`,children:[(0,K.jsx)(`span`,{className:`block text-sm font-medium`,children:e}),t&&(0,K.jsx)(`span`,{className:`mt-0.5 block text-xs text-muted-foreground`,children:t})]}),(0,K.jsx)($v,{id:a,checked:n,onCheckedChange:r,disabled:i,className:`mt-0.5`})]})}function ty({value:e,onChange:t,options:n,columns:r=3}){let i=(0,V.useId)();return(0,K.jsx)(`div`,{role:`radiogroup`,className:y(`grid gap-2.5`,r===2&&`sm:grid-cols-2`,r===3&&`sm:grid-cols-3`,r===4&&`sm:grid-cols-4`),children:n.map(n=>{let r=n.value===e;return(0,K.jsxs)(`label`,{className:y(`relative flex cursor-pointer gap-3 rounded-xl border bg-card p-3.5 text-left transition-all hover:border-primary/40`,r&&`border-primary bg-primary/[0.04] ring-3 ring-primary/10`),children:[(0,K.jsx)(`input`,{type:`radio`,name:i,className:`sr-only`,checked:r,onChange:()=>t(n.value)}),n.icon&&(0,K.jsx)(`span`,{className:y(`mt-0.5 text-muted-foreground`,r&&`text-primary`),children:n.icon}),(0,K.jsxs)(`span`,{className:`min-w-0`,children:[(0,K.jsx)(`span`,{className:`block text-sm font-medium`,children:n.label}),n.description&&(0,K.jsx)(`span`,{className:`mt-0.5 block text-xs leading-snug text-muted-foreground`,children:n.description})]})]},n.value)})})}function ny({tagline:e}){return(0,K.jsxs)(`div`,{className:`relative hidden overflow-hidden lg:block`,style:{backgroundImage:`linear-gradient(150deg, var(--brand-light) 0%, color-mix(in oklab, var(--brand-light) 55%, #0b0d1a) 100%)`},children:[(0,K.jsx)(`div`,{className:`absolute inset-0 opacity-40`,style:{backgroundImage:`radial-gradient(rgb(255 255 255 / 0.18) 1px, transparent 1px)`,backgroundSize:`22px 22px`}}),(0,K.jsx)(`div`,{className:`absolute -top-32 -right-24 size-[28rem] rounded-full bg-white/15 blur-3xl`}),(0,K.jsx)(`div`,{className:`absolute -bottom-40 -left-20 size-[26rem] rounded-full bg-black/20 blur-3xl`}),(0,K.jsxs)(`div`,{className:`relative flex h-full flex-col justify-between p-12 text-white xl:p-16`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-2 rounded-full bg-white/15 px-3 py-1 text-xs font-medium backdrop-blur`,children:[(0,K.jsx)(Ts,{className:`size-3.5`}),` Open-source learning platform`]}),(0,K.jsx)(`h2`,{className:`mt-6 max-w-md text-4xl leading-[1.1] font-semibold tracking-tight text-balance xl:text-5xl`,children:e})]}),(0,K.jsxs)(`div`,{className:`relative my-10 max-w-md`,children:[(0,K.jsxs)(`div`,{className:`rounded-2xl bg-white/95 p-5 text-slate-900 shadow-2xl shadow-black/30`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,K.jsx)(`span`,{className:`grid size-10 place-items-center rounded-xl bg-gradient-to-br from-sky-400 to-indigo-500 text-white`,children:(0,K.jsx)(bo,{className:`size-5`})}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`p`,{className:`text-sm font-semibold`,children:`Modern Web Development`}),(0,K.jsx)(`p`,{className:`text-xs text-slate-500`,children:`Next: State and effects · 15 min`})]}),(0,K.jsx)(`span`,{className:`text-sm font-semibold text-indigo-600`,children:`72%`})]}),(0,K.jsx)(`div`,{className:`mt-4 h-1.5 overflow-hidden rounded-full bg-slate-100`,children:(0,K.jsx)(`div`,{className:`h-full w-[72%] rounded-full bg-indigo-500`})})]}),(0,K.jsxs)(`div`,{className:`absolute -right-6 -bottom-8 flex items-center gap-3 rounded-xl bg-white p-3 pr-4 text-slate-900 shadow-xl shadow-black/25`,children:[(0,K.jsx)(`span`,{className:`grid size-9 place-items-center rounded-full bg-emerald-100 text-emerald-600`,children:(0,K.jsx)(go,{className:`size-4.5`})}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`p`,{className:`text-xs font-semibold`,children:`Quiz graded`}),(0,K.jsx)(`p`,{className:`text-xs text-slate-500`,children:`You scored 9 / 10`})]})]})]}),(0,K.jsx)(`div`,{className:`grid max-w-lg grid-cols-2 gap-x-6 gap-y-5`,children:[{icon:bo,title:`Courses that flow`,text:`Lessons, files and links organised into clear sections.`},{icon:Mo,title:`Assignments with feedback`,text:`Collect work, grade it and reply in one place.`},{icon:Zo,title:`Auto-graded quizzes`,text:`Five question types, timers, attempts and review.`},{icon:ss,title:`Discussions`,text:`Forums and announcements keep everyone in the loop.`}].map(e=>(0,K.jsxs)(`div`,{className:`flex gap-3`,children:[(0,K.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-white/15`,children:(0,K.jsx)(e.icon,{className:`size-4`})}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`p`,{className:`text-sm font-semibold`,children:e.title}),(0,K.jsx)(`p`,{className:`mt-0.5 text-xs leading-relaxed text-white/75`,children:e.text})]})]},e.title))})]})]})}function ry({title:e,subtitle:t,children:n}){let{data:r}=S();return(0,K.jsxs)(`div`,{className:`grid min-h-dvh bg-background lg:grid-cols-[minmax(0,1fr)_minmax(0,1.1fr)]`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col px-6 py-7 sm:px-12`,children:[(0,K.jsx)(wv,{name:r?.site.name??`Coursekit`}),(0,K.jsxs)(`div`,{className:`mx-auto flex w-full max-w-sm flex-1 flex-col justify-center py-12`,children:[(0,K.jsx)(`h1`,{className:`text-[26px] font-semibold tracking-tight`,children:e}),t&&(0,K.jsx)(`p`,{className:`mt-1.5 text-sm text-muted-foreground`,children:t}),(0,K.jsx)(`div`,{className:`mt-8`,children:n})]}),(0,K.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Powered by `,(0,K.jsx)(`span`,{className:`font-medium text-foreground`,children:`Coursekit`}),` `,r?.version&&`v${r.version}`]})]}),(0,K.jsx)(ny,{tagline:r?.site.tagline??`Learn anything, together.`})]})}function iy(e){let[t,n]=(0,V.useState)(!1);return(0,K.jsxs)(`div`,{className:`relative`,children:[(0,K.jsx)(qv,{type:t?`text`:`password`,className:`pr-10`,...e}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>n(e=>!e),className:`absolute inset-y-0 right-0 grid w-10 place-items-center text-muted-foreground hover:text-foreground`,"aria-label":t?`Hide password`:`Show password`,children:t?(0,K.jsx)(zo,{className:`size-4`}):(0,K.jsx)(Vo,{className:`size-4`})})]})}function ay(e,t){return e instanceof ie?e.issues.find(e=>e.path===t)?.message:void 0}function oy({error:e}){return e?(0,K.jsx)(`div`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2.5 text-sm text-destructive`,children:A(e)}):null}function sy(){let[e]=io(),t=e.get(`next`);return t&&t.startsWith(`/`)&&!t.startsWith(`//`)?t:`/`}function cy(){let e=I(),t=N(),n=Mi(),r=sy();return i=>{e.clear(),t(i),n(r,{replace:!0})}}function ly(){se(`Sign in`);let{data:e,isLoading:t}=S(),[n,r]=(0,V.useState)(``),[i,a]=(0,V.useState)(``),o=Ue({mutationFn:()=>P.post(`/auth/login`,{email:n,password:i}),onSuccess:cy()}),s=sy();return t?(0,K.jsx)(Te,{}):e?.needsSetup?(0,K.jsx)(Aa,{to:`/setup`,replace:!0}):e?.user?(0,K.jsx)(Aa,{to:s,replace:!0}):(0,K.jsxs)(ry,{title:`Welcome back`,subtitle:`Sign in to continue to ${e?.site.name??`Coursekit`}.`,children:[(0,K.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),o.mutate()},className:`space-y-4`,children:[(0,K.jsx)(oy,{error:o.error}),(0,K.jsx)(Zv,{label:`Email`,children:e=>(0,K.jsx)(qv,{...e,type:`email`,autoComplete:`email`,autoFocus:!0,required:!0,value:n,onChange:e=>r(e.target.value),placeholder:`you@school.edu`})}),(0,K.jsx)(Zv,{label:`Password`,children:e=>(0,K.jsx)(iy,{...e,autoComplete:`current-password`,required:!0,value:i,onChange:e=>a(e.target.value)})}),(0,K.jsx)(k,{type:`submit`,size:`lg`,className:`w-full`,loading:o.isPending,children:`Sign in`})]}),e?.site.allowSignup&&(0,K.jsxs)(`p`,{className:`mt-6 text-center text-sm text-muted-foreground`,children:[`New here?`,` `,(0,K.jsx)(Qa,{to:`/register`,className:`font-medium text-primary hover:underline`,children:`Create an account`})]})]})}function uy(){se(`Create account`);let{data:e,isLoading:t}=S(),[n,r]=(0,V.useState)({name:``,email:``,password:``}),i=Ue({mutationFn:()=>P.post(`/auth/register`,n),onSuccess:cy()}),a=sy();return t?(0,K.jsx)(Te,{}):e?.needsSetup?(0,K.jsx)(Aa,{to:`/setup`,replace:!0}):e?.user?(0,K.jsx)(Aa,{to:a,replace:!0}):e&&!e.site.allowSignup?(0,K.jsx)(ry,{title:`Registration is closed`,subtitle:`Ask your administrator to create an account for you.`,children:(0,K.jsx)(k,{asChild:!0,variant:`outline`,className:`w-full`,children:(0,K.jsxs)(Qa,{to:`/login`,children:[(0,K.jsx)(fo,{}),` Back to sign in`]})})}):(0,K.jsxs)(ry,{title:`Create your account`,subtitle:`Start learning in less than a minute.`,children:[(0,K.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),i.mutate()},className:`space-y-4`,children:[(0,K.jsx)(oy,{error:i.error&&!ay(i.error,`email`)&&!ay(i.error,`password`)?i.error:null}),(0,K.jsx)(Zv,{label:`Full name`,error:ay(i.error,`name`),children:e=>(0,K.jsx)(qv,{...e,autoComplete:`name`,autoFocus:!0,required:!0,value:n.name,onChange:e=>r({...n,name:e.target.value})})}),(0,K.jsx)(Zv,{label:`Email`,error:ay(i.error,`email`),children:e=>(0,K.jsx)(qv,{...e,type:`email`,autoComplete:`email`,required:!0,value:n.email,onChange:e=>r({...n,email:e.target.value})})}),(0,K.jsx)(Zv,{label:`Password`,hint:`At least 8 characters.`,error:ay(i.error,`password`),children:e=>(0,K.jsx)(iy,{...e,autoComplete:`new-password`,required:!0,value:n.password,onChange:e=>r({...n,password:e.target.value})})}),(0,K.jsx)(k,{type:`submit`,size:`lg`,className:`w-full`,loading:i.isPending,children:`Create account`})]}),(0,K.jsxs)(`p`,{className:`mt-6 text-center text-sm text-muted-foreground`,children:[`Already have an account?`,` `,(0,K.jsx)(Qa,{to:`/login`,className:`font-medium text-primary hover:underline`,children:`Sign in`})]})]})}function dy(){se(`Set up`);let{data:e,isLoading:t}=S(),[n,r]=(0,V.useState)(0),[i,a]=(0,V.useState)({siteName:`Coursekit Academy`,name:``,email:``,password:``,demo:!0}),o=Ue({mutationFn:()=>P.post(`/auth/setup`,i),onSuccess:cy()});if(t)return(0,K.jsx)(Te,{});if(e&&!e.needsSetup)return(0,K.jsx)(Aa,{to:e.user?`/`:`/login`,replace:!0});let s=[`Your site`,`Admin account`,`Get started`],c=n===0?i.siteName.trim().length>0:n!==1||i.name&&i.email.includes(`@`)&&i.password.length>=8;return(0,K.jsxs)(ry,{title:n===0?`Welcome to Coursekit 🎉`:n===1?`Create the administrator`:`How would you like to start?`,subtitle:n===0?`Let's set up your learning platform. It takes about a minute.`:n===1?`This account can manage the whole site. You can add more people later.`:`You can always remove demo content later by deleting the demo courses.`,children:[(0,K.jsxs)(`div`,{className:`mb-6 space-y-2`,children:[(0,K.jsx)(`div`,{className:`flex justify-between text-xs font-medium text-muted-foreground`,children:s.map((e,t)=>(0,K.jsxs)(`span`,{className:y(t<=n&&`text-foreground`),children:[t+1,`. `,e]},e))}),(0,K.jsx)(ve,{value:(n+1)/s.length*100})]}),(0,K.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),n<2?r(n+1):o.mutate()},className:`space-y-4`,children:[(0,K.jsx)(oy,{error:o.error}),n===0&&(0,K.jsx)(Zv,{label:`Site name`,hint:`Shown in the sidebar, emails and browser tabs.`,children:e=>(0,K.jsx)(qv,{...e,autoFocus:!0,value:i.siteName,onChange:e=>a({...i,siteName:e.target.value})})}),n===1&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Zv,{label:`Your name`,children:e=>(0,K.jsx)(qv,{...e,autoFocus:!0,autoComplete:`name`,value:i.name,onChange:e=>a({...i,name:e.target.value})})}),(0,K.jsx)(Zv,{label:`Email`,children:e=>(0,K.jsx)(qv,{...e,type:`email`,autoComplete:`email`,value:i.email,onChange:e=>a({...i,email:e.target.value})})}),(0,K.jsx)(Zv,{label:`Password`,hint:`At least 8 characters.`,children:e=>(0,K.jsx)(iy,{...e,autoComplete:`new-password`,value:i.password,onChange:e=>a({...i,password:e.target.value})})})]}),n===2&&(0,K.jsx)(`div`,{className:`grid gap-3`,children:[{demo:!0,icon:Ts,title:`Explore with demo content`,text:`Six sample courses with teachers, students, quizzes, grades and discussions.`},{demo:!1,icon:ys,title:`Start fresh`,text:`An empty site, ready for your first course.`}].map(e=>(0,K.jsxs)(`button`,{type:`button`,onClick:()=>a({...i,demo:e.demo}),className:y(`flex items-start gap-3 rounded-xl border bg-card p-4 text-left transition-all hover:border-primary/40`,i.demo===e.demo&&`border-primary ring-3 ring-primary/10`),children:[(0,K.jsx)(`span`,{className:y(`grid size-9 shrink-0 place-items-center rounded-lg bg-muted`,i.demo===e.demo&&`bg-primary/10 text-primary`),children:(0,K.jsx)(e.icon,{className:`size-4.5`})}),(0,K.jsxs)(`span`,{className:`flex-1`,children:[(0,K.jsx)(`span`,{className:`block text-sm font-semibold`,children:e.title}),(0,K.jsx)(`span`,{className:`mt-0.5 block text-xs text-muted-foreground`,children:e.text})]}),i.demo===e.demo&&(0,K.jsx)(Eo,{className:`size-4 text-primary`})]},e.title))}),(0,K.jsxs)(`div`,{className:`flex gap-2 pt-2`,children:[n>0&&(0,K.jsx)(k,{type:`button`,variant:`outline`,size:`lg`,onClick:()=>r(n-1),children:(0,K.jsx)(fo,{})}),(0,K.jsx)(k,{type:`submit`,size:`lg`,className:`flex-1`,disabled:!c,loading:o.isPending,children:n<2?(0,K.jsxs)(K.Fragment,{children:[`Continue `,(0,K.jsx)(mo,{})]}):(0,K.jsxs)(K.Fragment,{children:[`Launch my site `,(0,K.jsx)(ys,{})]})})]})]})]})}function fy({title:e,description:t,actions:n,eyebrow:r,className:i}){return(0,K.jsxs)(`div`,{className:y(`mb-7 flex flex-col gap-4 sm:flex-row sm:items-end sm:justify-between`,i),children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[r&&(0,K.jsx)(`div`,{className:`mb-1.5 text-sm font-medium text-muted-foreground`,children:r}),(0,K.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight text-balance sm:text-[28px]`,children:e}),t&&(0,K.jsx)(`p`,{className:`mt-1.5 max-w-2xl text-[15px] text-muted-foreground`,children:t})]}),n&&(0,K.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:n})]})}function py({icon:e,label:t,value:n,hint:r,tone:i=`primary`}){return(0,K.jsxs)(`div`,{className:`rounded-xl border bg-card p-4 shadow-xs`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsx)(`span`,{className:`text-[13px] font-medium text-muted-foreground`,children:t}),(0,K.jsx)(`span`,{className:y(`grid size-8 place-items-center rounded-lg`,{primary:`bg-primary/10 text-primary`,emerald:`bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`,amber:`bg-amber-500/12 text-amber-600 dark:text-amber-400`,violet:`bg-violet-500/10 text-violet-600 dark:text-violet-400`,sky:`bg-sky-500/10 text-sky-600 dark:text-sky-400`,rose:`bg-rose-500/10 text-rose-600 dark:text-rose-400`}[i]),children:(0,K.jsx)(e,{className:`size-4`})})]}),(0,K.jsx)(`div`,{className:`mt-2 text-2xl font-semibold tracking-tight`,children:n}),r&&(0,K.jsx)(`div`,{className:`mt-0.5 text-xs text-muted-foreground`,children:r})]})}function my({children:e,action:t}){return(0,K.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-2`,children:[(0,K.jsx)(`h2`,{className:`text-[15px] font-semibold tracking-tight`,children:e}),t]})}function hy({file:e,onRemove:t}){return(0,K.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg border bg-card px-3 py-2`,children:[(0,K.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-md bg-muted text-muted-foreground`,children:(0,K.jsx)(Uo,{className:`size-4`})}),(0,K.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`min-w-0 flex-1 hover:underline`,children:[(0,K.jsx)(`span`,{className:`block truncate text-sm font-medium`,children:e.name}),(0,K.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:r(e.size)})]}),t&&(0,K.jsx)(k,{type:`button`,variant:`ghost`,size:`icon-xs`,onClick:t,"aria-label":`Remove ${e.name}`,children:(0,K.jsx)(ks,{})})]})}function gy({context:e,courseId:t,onUploaded:n,multiple:r=!1,disabled:i,accept:a,label:o=`Drop files here or click to upload`}){let s=(0,V.useRef)(null),[c,l]=(0,V.useState)(!1),[u,d]=(0,V.useState)(0),f=async r=>{for(let i of Array.from(r)){d(e=>e+1);try{n(await P.upload(i,{context:e,courseId:t}))}catch(e){_e.error(`${i.name}: ${A(e)}`)}finally{d(e=>e-1)}}};return(0,K.jsxs)(`button`,{type:`button`,disabled:i,onClick:()=>s.current?.click(),onDragOver:e=>{e.preventDefault(),l(!0)},onDragLeave:()=>l(!1),onDrop:e=>{e.preventDefault(),l(!1),!i&&e.dataTransfer.files.length&&f(r?e.dataTransfer.files:[e.dataTransfer.files[0]])},className:y(`flex w-full flex-col items-center justify-center gap-2 rounded-xl border-2 border-dashed px-4 py-6 text-center transition-colors hover:border-primary/50 hover:bg-primary/[0.03] disabled:pointer-events-none disabled:opacity-50`,c&&`border-primary bg-primary/5`),children:[(0,K.jsx)(`span`,{className:`grid size-10 place-items-center rounded-full bg-muted text-muted-foreground`,children:u>0?(0,K.jsx)(Ee,{}):(0,K.jsx)(Fs,{className:`size-4.5`})}),(0,K.jsx)(`span`,{className:`text-sm font-medium`,children:u>0?`Uploading…`:o}),(0,K.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-muted-foreground`,children:[(0,K.jsx)(ps,{className:`size-3`}),` Any file type, up to 50 MB`]}),(0,K.jsx)(`input`,{ref:s,type:`file`,hidden:!0,multiple:r,accept:a,onChange:e=>{e.target.files?.length&&f(e.target.files),e.target.value=``}})]})}function _y({className:e,...t}){return(0,K.jsx)(`div`,{className:y(`rounded-xl border bg-card text-card-foreground shadow-xs`,e),...t})}function vy({title:e,description:t,action:n,icon:r,className:i}){return(0,K.jsxs)(`div`,{className:y(`flex items-start justify-between gap-3 px-5 pt-5 pb-3`,i),children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[r&&(0,K.jsx)(`div`,{className:`mt-0.5 text-muted-foreground`,children:r}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`h3`,{className:`text-[15px] font-semibold tracking-tight`,children:e}),t&&(0,K.jsx)(`p`,{className:`mt-0.5 text-sm text-muted-foreground`,children:t})]})]}),n&&(0,K.jsx)(`div`,{className:`shrink-0`,children:n})]})}function yy(e){if(e.status===`overdue`)return`Overdue`;let t=new Date(e.dueAt),n=new Date;n.setHours(0,0,0,0);let r=Math.floor((t.getTime()-n.getTime())/864e5);return r<=0?`Today`:r===1?`Tomorrow`:r<7?`This week`:`Later`}var by={todo:{label:`To do`,variant:`neutral`},overdue:{label:`Overdue`,variant:`danger`},submitted:{label:`Submitted`,variant:`info`},graded:{label:`Graded`,variant:`success`},done:{label:`Done`,variant:`success`}};function xy({items:e}){if(e.length===0)return(0,K.jsx)(`div`,{className:`px-5 pb-6`,children:(0,K.jsx)(je,{icon:So,title:`Nothing due soon`,description:`Deadlines from your courses will show up here.`,className:`py-8`})});let t=new Map;for(let n of e)t.set(yy(n),[...t.get(yy(n))??[],n]);return(0,K.jsx)(`div`,{className:`pb-2`,children:[`Overdue`,`Today`,`Tomorrow`,`This week`,`Later`].filter(e=>t.has(e)).map(e=>(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`p`,{className:y(`px-5 pt-2 pb-1 text-xs font-semibold`,e===`Overdue`?`text-destructive`:`text-muted-foreground`),children:e}),t.get(e).map(e=>{let t=e.status!==`todo`&&e.status!==`overdue`;return(0,K.jsxs)(Qa,{to:pv(e.course.slug,e.activityId),className:`flex items-center gap-3 px-5 py-2.5 transition-colors hover:bg-accent/50`,children:[(0,K.jsx)(bv,{type:e.type}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`p`,{className:y(`truncate text-sm font-medium`,t&&`text-muted-foreground line-through decoration-muted-foreground/40`),children:e.title}),(0,K.jsxs)(`p`,{className:`flex items-center gap-1.5 truncate text-xs text-muted-foreground`,children:[(0,K.jsx)(`span`,{className:`size-2 shrink-0 rounded-[3px]`,style:s_(e.course.coverColor)}),(0,K.jsx)(`span`,{className:`truncate`,children:e.course.title}),(0,K.jsx)(`span`,{children:`·`}),(0,K.jsx)(`span`,{className:y(`shrink-0`,e.status===`overdue`&&`text-destructive`),children:pe(e.dueAt,t)})]})]}),(0,K.jsx)(hv,{variant:by[e.status].variant,className:`hidden sm:inline-flex`,children:by[e.status].label})]},e.activityId)})]},e))})}function Sy(){return(0,K.jsxs)(`section`,{className:`mt-8`,children:[(0,K.jsx)(my,{children:`Get started`}),(0,K.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-4`,children:[{to:`/courses/new`,icon:hs,title:`Create a course`,text:`Start a draft and add lessons, quizzes and assignments.`},{to:`/admin/users`,icon:zs,title:`Add people`,text:`Invite teachers and students, or log in as them.`},{to:`/admin/settings`,icon:ds,title:`Make it yours`,text:`Set the site name, tagline and brand colour.`},{to:`/catalog`,icon:Io,title:`Browse the catalog`,text:`See every published course the way students do.`}].map(e=>(0,K.jsxs)(Qa,{to:e.to,className:`group rounded-xl border bg-card p-5 shadow-xs transition-all hover:-translate-y-0.5 hover:border-primary/30 hover:shadow-md`,children:[(0,K.jsx)(`span`,{className:`grid size-10 place-items-center rounded-xl bg-primary/10 text-primary`,children:(0,K.jsx)(e.icon,{className:`size-5`})}),(0,K.jsxs)(`p`,{className:`mt-4 flex items-center gap-1.5 font-semibold group-hover:text-primary`,children:[e.title,` `,(0,K.jsx)(mo,{className:`size-3.5 opacity-0 transition-opacity group-hover:opacity-100`})]}),(0,K.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:e.text})]},e.to))})]})}function Cy(){return(0,K.jsxs)(`div`,{className:`space-y-8`,children:[(0,K.jsx)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:[0,1,2,3].map(e=>(0,K.jsx)(be,{className:`h-[104px] rounded-xl`},e))}),(0,K.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`,children:[0,1,2].map(e=>(0,K.jsx)(yv,{},e))})]})}function wy(){se(`Dashboard`);let e=le(),{data:n}=S(),{data:r,isLoading:o,error:s,refetch:c}=m({queryKey:[`dashboard`],queryFn:()=>P.get(`/dashboard`)}),l=e.name.split(` `)[0],u=[];if(r){let{stats:e}=r;if(e.enrolled>0&&u.push((0,K.jsx)(py,{icon:bo,label:`Courses in progress`,value:e.enrolled,tone:`primary`},`enrolled`),(0,K.jsx)(py,{icon:Ao,label:`Activities completed`,value:e.completedActivities,tone:`emerald`},`done`),(0,K.jsx)(py,{icon:js,label:`Average grade`,value:e.averageGrade==null?`–`:`${a(e.averageGrade)}%`,tone:`violet`},`avg`),(0,K.jsx)(py,{icon:So,label:`Due this week`,value:e.dueThisWeek,tone:`amber`},`due`)),e.teaching>0){let t=r.courses.filter(e=>e.myRole!==`student`).reduce((e,t)=>e+t.studentCount,0),n=r.toGrade.reduce((e,t)=>e+t.count,0);u.push((0,K.jsx)(py,{icon:_s,label:`Courses teaching`,value:e.teaching,tone:`sky`},`teaching`),(0,K.jsx)(py,{icon:Us,label:`Students`,value:t,tone:`primary`},`students`),(0,K.jsx)(py,{icon:Mo,label:`Waiting for grading`,value:n,tone:`rose`},`grade`))}}let d=r?.courses??[];return(0,K.jsxs)(Iv,{children:[(0,K.jsx)(fy,{eyebrow:new Intl.DateTimeFormat(void 0,{weekday:`long`,month:`long`,day:`numeric`}).format(new Date),title:`${t()}, ${l}`,description:n?.site.welcomeMessage,actions:D(e.role)?(0,K.jsx)(k,{asChild:!0,variant:`outline`,children:(0,K.jsxs)(Qa,{to:`/courses/new`,children:[(0,K.jsx)(hs,{}),` New course`]})}):(0,K.jsx)(k,{asChild:!0,variant:`outline`,children:(0,K.jsxs)(Qa,{to:`/catalog`,children:[(0,K.jsx)(Io,{}),` Explore courses`]})})}),o?(0,K.jsx)(Cy,{}):s||!r?(0,K.jsx)(Oe,{error:s,onRetry:()=>c()}):(0,K.jsxs)(K.Fragment,{children:[u.length>0&&(0,K.jsx)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:u.slice(0,4)}),d.length===0&&e.role===`admin`?(0,K.jsx)(Sy,{}):d.length===0?(0,K.jsx)(je,{className:`mt-8`,icon:Io,title:`You're not enrolled in any courses yet`,description:`Browse the catalog to find something to learn, or create your own course.`,action:(0,K.jsx)(k,{asChild:!0,children:(0,K.jsxs)(Qa,{to:`/catalog`,children:[`Explore courses `,(0,K.jsx)(mo,{})]})})}):(0,K.jsxs)(`section`,{className:`mt-8`,children:[(0,K.jsx)(my,{action:(0,K.jsxs)(Qa,{to:`/my-courses`,className:`flex items-center gap-1 text-sm font-medium text-primary hover:underline`,children:[`All courses `,(0,K.jsx)(mo,{className:`size-3.5`})]}),children:`Jump back in`}),(0,K.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`,children:d.slice(0,3).map(e=>(0,K.jsx)(vv,{course:e},e.id))})]}),(r.toGrade.length>0||r.stats.enrolled>0||r.announcements.length>0||r.recentGrades.length>0)&&(0,K.jsxs)(`div`,{className:`mt-8 grid items-start gap-6 lg:grid-cols-3`,children:[(0,K.jsxs)(`div`,{className:`space-y-6 lg:col-span-2`,children:[r.toGrade.length>0&&(0,K.jsxs)(_y,{children:[(0,K.jsx)(vy,{title:`Needs grading`,description:`Submissions waiting for your feedback.`,icon:(0,K.jsx)(Mo,{className:`size-4.5`})}),(0,K.jsx)(`div`,{className:`pb-2`,children:r.toGrade.map(e=>(0,K.jsxs)(`div`,{className:`flex items-center gap-3 px-5 py-2.5`,children:[(0,K.jsx)(bv,{type:`assignment`}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`p`,{className:`truncate text-sm font-medium`,children:e.title}),(0,K.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:e.course.title})]}),(0,K.jsxs)(hv,{variant:`warning`,children:[e.count,` to grade`]}),(0,K.jsx)(k,{asChild:!0,size:`sm`,variant:`outline`,children:(0,K.jsx)(Qa,{to:`${pv(e.course.slug,e.activityId)}/submissions`,children:`Grade`})})]},e.activityId))})]}),r.stats.enrolled>0&&(0,K.jsxs)(_y,{children:[(0,K.jsx)(vy,{title:`Upcoming`,description:`Deadlines across your courses.`,icon:(0,K.jsx)(So,{className:`size-4.5`})}),(0,K.jsx)(xy,{items:r.timeline})]})]}),(0,K.jsxs)(`div`,{className:`space-y-6`,children:[(0,K.jsxs)(_y,{children:[(0,K.jsx)(vy,{title:`Announcements`,icon:(0,K.jsx)(ts,{className:`size-4.5`})}),(0,K.jsxs)(`div`,{className:`space-y-1 px-2 pb-3`,children:[r.announcements.length===0&&(0,K.jsx)(`p`,{className:`px-3 pb-3 text-sm text-muted-foreground`,children:`No announcements yet.`}),r.announcements.slice(0,4).map(e=>(0,K.jsxs)(Qa,{to:`/courses/${e.course.slug}/announcements`,className:`block rounded-lg px-3 py-2.5 transition-colors hover:bg-accent/50`,children:[(0,K.jsxs)(`p`,{className:`flex items-center gap-1.5 text-[11px] font-medium text-muted-foreground`,children:[(0,K.jsx)(`span`,{className:`size-2 rounded-[3px]`,style:s_(e.course.coverColor)}),e.course.title]}),(0,K.jsx)(`p`,{className:`mt-1 text-sm font-medium`,children:e.title}),(0,K.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs text-muted-foreground`,children:p(e.body)}),(0,K.jsxs)(`p`,{className:`mt-1.5 flex items-center gap-1.5 text-[11px] text-muted-foreground`,children:[(0,K.jsx)(l_,{user:e.author,size:`xs`,className:`size-4 text-[7px] ring-1`}),e.author.name,` · `,i(e.createdAt)]})]},e.id))]})]}),r.recentGrades.length>0&&(0,K.jsxs)(_y,{children:[(0,K.jsx)(vy,{title:`Recent grades`,icon:(0,K.jsx)(go,{className:`size-4.5`})}),(0,K.jsx)(`div`,{className:`space-y-1 px-2 pb-3`,children:r.recentGrades.map(e=>{let t=e.maxGrade?Math.round(e.score/e.maxGrade*100):0;return(0,K.jsxs)(Qa,{to:pv(e.course.slug,e.activityId),className:`flex items-center gap-3 rounded-lg px-3 py-2 hover:bg-accent/50`,children:[(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`p`,{className:`truncate text-sm font-medium`,children:e.title}),(0,K.jsxs)(`p`,{className:`truncate text-xs text-muted-foreground`,children:[a(e.score),` / `,a(e.maxGrade),` · `,i(e.gradedAt)]})]}),(0,K.jsxs)(hv,{variant:t>=80?`success`:t>=50?`warning`:`danger`,children:[t,`%`]})]},e.activityId)})})]})]})]})]})]})}var Ty=`modulepreload`,Ey=function(e){return`/`+e},Dy={},Oy=function(e){return e.pathname.endsWith(`.css`)},ky=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},Ay=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=Ey(t,n);let r=s(t),i=Oy(r);return ky(Dy,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:Ty,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{let i=a=>{t.removeEventListener(`load`,i),t.removeEventListener(`error`,i),a.type===`error`?n(Error(`Unable to preload CSS for ${r}`)):e(a)};t.addEventListener(`load`,i),t.addEventListener(`error`,i)})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};function jy(e,t=`default`){let n=(0,V.lazy)(async()=>{try{return{default:(await e())[t]}}catch(e){if(Uv())return Wv(e);throw e}});return(0,K.jsx)(V.Suspense,{fallback:(0,K.jsx)(Te,{}),children:(0,K.jsx)(n,{})})}function My({children:e}){let{data:t,isLoading:n,error:r}=S(),i=Ai();return n?(0,K.jsx)(Te,{}):r?(0,K.jsx)(Ny,{}):t?.needsSetup?(0,K.jsx)(Aa,{to:`/setup`,replace:!0}):t?.user?e:(0,K.jsx)(Aa,{to:`/login?next=${encodeURIComponent(i.pathname+i.search)}`,replace:!0})}function Ny(){let e=Qi();return(0,K.jsx)(`div`,{className:`grid min-h-dvh place-items-center p-6 text-center`,children:(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h1`,{className:`text-xl font-semibold`,children:`Something went wrong`}),(0,K.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:e?A(e):`We could not reach the server.`}),(0,K.jsx)(k,{className:`mt-6`,onClick:()=>window.location.reload(),children:`Reload`})]})})}var Py=Ya([{path:`/setup`,element:(0,K.jsx)(dy,{}),errorElement:(0,K.jsx)(Ny,{})},{path:`/login`,element:(0,K.jsx)(ly,{}),errorElement:(0,K.jsx)(Ny,{})},{path:`/register`,element:(0,K.jsx)(uy,{}),errorElement:(0,K.jsx)(Ny,{})},{element:(0,K.jsx)(My,{children:(0,K.jsx)(Fv,{})}),errorElement:(0,K.jsx)(Ny,{}),children:[{index:!0,element:(0,K.jsx)(wy,{})},{path:`my-courses`,element:jy(()=>Ay(()=>import(`./MyCoursesPage-Dd-Oaygv.js`),__vite__mapDeps([0,1,2])))},{path:`catalog`,element:jy(()=>Ay(()=>import(`./CatalogPage-BiMgSSBR.js`),__vite__mapDeps([3,1,4,2])))},{path:`calendar`,element:jy(()=>Ay(()=>import(`./CalendarPage-CLRWyTNT.js`),__vite__mapDeps([5,1,4,2])))},{path:`notifications`,element:jy(()=>Ay(()=>import(`./NotificationsPage-LJvqb6Dj.js`),__vite__mapDeps([6,1,2])))},{path:`profile`,element:jy(()=>Ay(()=>import(`./ProfilePage-CzfhacAX.js`),__vite__mapDeps([7,1,8,2])))},{path:`courses/new`,element:jy(()=>Ay(()=>import(`./CreateCoursePage-DFCHlq5M.js`),__vite__mapDeps([9,1,2,10,8,11,12,13])))},{path:`courses/:slug`,element:jy(()=>Ay(()=>import(`./CourseLayout-ql01LEmj.js`),__vite__mapDeps([14,1,8,15,16,17,2,12,18,13]))),children:[{index:!0,element:jy(()=>Ay(()=>import(`./CourseContentPage-BIDH0UbG.js`),__vite__mapDeps([19,1,20,21,2,12,13,11,22,16])))},{path:`announcements`,element:jy(()=>Ay(()=>import(`./AnnouncementsPage-BKW30k0Z.js`),__vite__mapDeps([23,1,24,2,12,13])))},{path:`participants`,element:jy(()=>Ay(()=>import(`./ParticipantsPage-wFxiphna.js`),__vite__mapDeps([25,1,26,22,2,13])))},{path:`grades`,element:jy(()=>Ay(()=>import(`./GradesPage-Bu5vphcG.js`),__vite__mapDeps([27,1,28,2,13])))},{path:`settings`,element:jy(()=>Ay(()=>import(`./CourseSettingsPage-CReoPqOa.js`),__vite__mapDeps([10,1,8,2,11,12,13])))}]},{path:`courses/:slug/activities/:activityId`,element:jy(()=>Ay(()=>import(`./ActivityPage-DPmSV_mU.js`),__vite__mapDeps([29,28,1,12,2,18,30,16,24,13,31,21,11,15,32])))},{path:`courses/:slug/activities/:activityId/submissions`,element:jy(()=>Ay(()=>import(`./SubmissionsPage-CQjcx09G.js`),__vite__mapDeps([33,1,2,12,31,21,13,11,16])))},{path:`courses/:slug/activities/:activityId/questions`,element:jy(()=>Ay(()=>import(`./QuizEditorPage-DS_czQVM.js`),__vite__mapDeps([34,1,20,35,2,13,31,21,12,11,16])))},{path:`courses/:slug/attempts/:attemptId`,element:jy(()=>Ay(()=>import(`./QuizAttemptPage-CEAV6wAL.js`),__vite__mapDeps([36,1,30,24,2,12,18,13])))},{path:`courses/:slug/discussions/:discussionId`,element:jy(()=>Ay(()=>import(`./DiscussionPage-CWwVpFQV.js`),__vite__mapDeps([37,1,15,22,16,32,2,12,18])))},{path:`admin`,element:jy(()=>Ay(()=>import(`./AdminLayout-DqoShZGn.js`),__vite__mapDeps([38,39,1,17]))),children:[{index:!0,element:jy(()=>Ay(()=>import(`./AdminOverviewPage-DnTrdGbr.js`),__vite__mapDeps([40,1,2])))},{path:`users`,element:jy(()=>Ay(()=>import(`./AdminUsersPage-3d2F9AEl.js`),__vite__mapDeps([41,1,26,4,35,22,2])))},{path:`courses`,element:jy(()=>Ay(()=>import(`./AdminCoursesPage-uaSHNtzf.js`),__vite__mapDeps([42,1,4,39,16,17,2])),`AdminCoursesPage`)},{path:`categories`,element:jy(()=>Ay(()=>import(`./AdminCoursesPage-uaSHNtzf.js`),__vite__mapDeps([42,1,4,39,16,17,2])),`AdminCategoriesPage`)},{path:`settings`,element:jy(()=>Ay(()=>import(`./AdminSettingsPage-B82cX8xU.js`),__vite__mapDeps([43,1,2])))}]},{path:`*`,element:jy(()=>Ay(()=>import(`./NotFoundPage-BRquC7-l.js`),__vite__mapDeps([18,1])))}]}]),Fy=new He({defaultOptions:{queries:{staleTime:2e4,refetchOnWindowFocus:!1,retry:(e,t)=>!(t instanceof ie&&t.status<500)&&e<2}},queryCache:new Ve({onError:(e,t)=>{e instanceof ie&&e.status===401&&t.queryKey[0]!==F[0]&&Fy.invalidateQueries({queryKey:F})}})});function Iy(){let{resolved:e}=r_();return(0,K.jsx)(Ne,{theme:e,position:`bottom-right`,richColors:!0,closeButton:!0})}(0,Xs.createRoot)(document.getElementById(`root`)).render((0,K.jsx)(V.StrictMode,{children:(0,K.jsx)(ee,{client:Fy,children:(0,K.jsx)(n_,{children:(0,K.jsx)($g,{children:(0,K.jsxs)(Ig,{children:[(0,K.jsx)(b,{}),(0,K.jsx)(Ea,{router:Py}),(0,K.jsx)(Iy,{})]})})})})}));export{Gs as $,g_ as A,Qa as At,Vg as B,fv as C,Eo as Ct,f_ as D,go as Dt,m_ as E,bo as Et,s_ as F,Mi as Ft,qg as G,Wg as H,o_ as I,Fi as It,Yg as J,Kg as K,r_ as L,Li as Lt,u_ as M,io as Mt,i_ as N,Aa as Nt,h_ as O,mo as Ot,a_ as P,ja as Pt,Fg as Q,Lg as R,Ue as Rt,hv as S,Oo as St,d_ as T,So as Tt,Gg as U,Ug as V,zg as W,Xg as X,Zg as Y,Qg as Z,Av as _,zo as _t,fy as a,xs as at,yv as b,Mo as bt,ty as c,ss as ct,Xv as d,Zo as dt,Us as et,Yv as f,Yo as ft,Iv as g,Vo as gt,kv as h,Uo as ht,gy as i,Ds as it,l_ as j,to as jt,p_ as k,fo as kt,Zv as l,as as lt,Jv as m,Go as mt,vy as n,Fs as nt,py as o,hs as ot,ey as p,qo as pt,Rg as q,hy as r,ks as rt,Qv as s,ls as st,_y as t,zs as tt,qv as u,ts as ut,bv as v,Io as vt,pv as w,wo as wt,gv as x,Ao as xt,vv as y,Po as yt,Jg as z};