your-ai-workflow-firebase-os 2.0.8 → 2.0.9

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 (139) hide show
  1. package/dist/{Assets-Dd_96avv.js → Assets-COH4Ji57.js} +5 -5
  2. package/dist/{Assets-CBBNIHrw.cjs → Assets-D7fDckSi.cjs} +1 -1
  3. package/dist/{Attachments-C6QrTcNt.cjs → Attachments-BMuQ0CD4.cjs} +1 -1
  4. package/dist/{Attachments-YyjQmhBx.js → Attachments-Co1UkdWB.js} +2 -2
  5. package/dist/{Billing-B6f49cGH.cjs → Billing-DkuJdls5.cjs} +1 -1
  6. package/dist/{Billing-BZafAizg.js → Billing-kk4ZMd3z.js} +4 -4
  7. package/dist/{BookingCalendar-DYsA71vl.cjs → BookingCalendar-BcvJiyaq.cjs} +1 -1
  8. package/dist/{BookingCalendar-_xoRa2tL.js → BookingCalendar-Bej__mIs.js} +1 -1
  9. package/dist/{Button-DSldWACF.js → Button-BGN6q7lY.js} +1 -1
  10. package/dist/{Button-PyTaaoyu.cjs → Button-Ccy4wFZ1.cjs} +1 -1
  11. package/dist/{ConfirmModal-CQ73WYUg.cjs → ConfirmModal-BUNtss4a.cjs} +1 -1
  12. package/dist/{ConfirmModal-C1dM-bzk.js → ConfirmModal-BW9e6Y7d.js} +3 -3
  13. package/dist/{ContactPopup-D5Hh0bfE.cjs → ContactPopup-D8aSSlmS.cjs} +1 -1
  14. package/dist/{ContactPopup-CL4AMwK9.js → ContactPopup-Fs7wzrOX.js} +7 -7
  15. package/dist/{CopyLink-BnYpVy6H.cjs → CopyLink-C5lKLyOU.cjs} +1 -1
  16. package/dist/{CopyLink-rLr_5eNM.js → CopyLink-CNjDLzOl.js} +2 -2
  17. package/dist/{DashboardNav-B0G943ux.js → DashboardNav-CEd8gGPm.js} +3 -3
  18. package/dist/{DashboardNav-DOl9gJuu.cjs → DashboardNav-GgEUpyTa.cjs} +1 -1
  19. package/dist/{EmailAdmin-CWHMMybh.cjs → EmailAdmin-d_gWd48U.cjs} +1 -1
  20. package/dist/{EmailAdmin-humrSTzI.js → EmailAdmin-pbQ-f9Ge.js} +9 -9
  21. package/dist/{EventCard-CrPswwyG.js → EventCard-BSGLYD64.js} +2 -2
  22. package/dist/{EventCard-6eCfvOA-.cjs → EventCard-DAsGsicK.cjs} +1 -1
  23. package/dist/{FileViewerPopup-DQmhXMSg.cjs → FileViewerPopup-CkLUYCNo.cjs} +1 -1
  24. package/dist/{FileViewerPopup-Dnl3td2o.js → FileViewerPopup-gqhRT22v.js} +2 -2
  25. package/dist/{FormNote-BWGLs9lx.js → FormNote-DJ9HBokL.js} +1 -1
  26. package/dist/{FormNote-CX2rSBDB.cjs → FormNote-DP0GK9ya.cjs} +1 -1
  27. package/dist/{FormsAdmin-Tg20B0iA.cjs → FormsAdmin-5KTTp6zo.cjs} +1 -1
  28. package/dist/{FormsAdmin-CHwmKnYU.js → FormsAdmin-BNI63vEk.js} +9 -9
  29. package/dist/{Inbox-Cgq4MALU.js → Inbox-D9Y5K8Se.js} +9 -9
  30. package/dist/{Inbox-BPwIiThg.cjs → Inbox-DjslBakx.cjs} +1 -1
  31. package/dist/{Loader-DP_dL5qC.js → Loader-CVoz1Zf0.js} +1 -1
  32. package/dist/{Loader-p3eNQDUU.cjs → Loader-QHqQsXLr.cjs} +1 -1
  33. package/dist/{ManagePlanButton-BRW7Sevd.cjs → ManagePlanButton-Buwfs2bU.cjs} +1 -1
  34. package/dist/{ManagePlanButton-CNLCxK-o.js → ManagePlanButton-CE4uyh_7.js} +2 -2
  35. package/dist/{MyBookings-C_pqsSEk.js → MyBookings-B4DndHV6.js} +7 -7
  36. package/dist/{MyBookings-BC5sn_fE.cjs → MyBookings-CkEioQIj.cjs} +1 -1
  37. package/dist/{PageTitle-DFGW71q8.js → PageTitle-DCoUQWw6.js} +2 -2
  38. package/dist/{PageTitle-BWmE74WQ.cjs → PageTitle-DQkvCB11.cjs} +1 -1
  39. package/dist/PagesAdmin-D0qgoZtW.js +3 -0
  40. package/dist/{PagesAdmin-jjnDLYmF.js → PagesAdmin-DzLJWKBJ.js} +21 -21
  41. package/dist/PagesAdmin-KUxCI1Mr.cjs +1 -0
  42. package/dist/{PagesAdmin-BZZ3by92.cjs → PagesAdmin-YdYgmuEB.cjs} +1 -1
  43. package/dist/{PaymentsAdmin-CI0zXraR.cjs → PaymentsAdmin-B5l-f0mp.cjs} +1 -1
  44. package/dist/{PaymentsAdmin-DeBMmFFo.js → PaymentsAdmin-C3cEOeIs.js} +15 -15
  45. package/dist/{Popup-DmPEk98h.js → Popup-Bi63lzoS.js} +1 -1
  46. package/dist/{Popup-nq7YNM4N.cjs → Popup-COnHpbrY.cjs} +1 -1
  47. package/dist/{ProviderMark-DJ5mYjYn.cjs → ProviderMark--adeeajP.cjs} +1 -1
  48. package/dist/{ProviderMark-CAeOnBsB.js → ProviderMark-BvEMlZAm.js} +1 -1
  49. package/dist/{PublishApp-mMMwf_in.js → PublishApp-B9Fo6xN0.js} +7 -7
  50. package/dist/{PublishApp-DI96gX9b.cjs → PublishApp-Bc82Ijkq.cjs} +1 -1
  51. package/dist/{Said-DAD7Ctp_.js → Said-BvSRaEfZ.js} +1 -1
  52. package/dist/{Said-DlJOjNMN.cjs → Said-W3KFi5uX.cjs} +1 -1
  53. package/dist/{ScheduleAdmin-dWj_N_tf.cjs → ScheduleAdmin-Dh_hW6p4.cjs} +1 -1
  54. package/dist/{ScheduleAdmin-C4W8Ls0D.js → ScheduleAdmin-bk3GgxKP.js} +14 -14
  55. package/dist/{SchedulePicker-CwKId9JF.cjs → SchedulePicker-CN0755Ek.cjs} +1 -1
  56. package/dist/{SchedulePicker-BOSJEcfL.js → SchedulePicker-DO4PewPJ.js} +2 -2
  57. package/dist/{Setup-DcZzh6Xd.cjs → Setup-R4r6_tbV.cjs} +1 -1
  58. package/dist/{Setup-NOvtplUS.js → Setup-_G-s5y5Q.js} +3 -3
  59. package/dist/{SetupPayments-DrXK0LQa.js → SetupPayments-CkolcOtv.js} +5 -5
  60. package/dist/{SetupPayments-CZ0KqXdR.cjs → SetupPayments-CuFk9REC.cjs} +1 -1
  61. package/dist/{SignInAdmin-CwIUAJrv.cjs → SignInAdmin-B1yLLaQu.cjs} +1 -1
  62. package/dist/{SignInAdmin-Cb65ChHL.js → SignInAdmin-BLEn0rId.js} +9 -9
  63. package/dist/{SupportBar-528kXe-Z.js → SupportBar-DI_XbEsG.js} +4 -4
  64. package/dist/{SupportBar-CNVXSYwT.cjs → SupportBar-DLWruzQb.cjs} +1 -1
  65. package/dist/{SystemTabContent-EegzTuLd.cjs → SystemTabContent-BWhRHoXx.cjs} +1 -1
  66. package/dist/{SystemTabContent-C4azXKMs.js → SystemTabContent-CMyT7mDN.js} +2 -2
  67. package/dist/{TemplateDrive-XDRPkxIj.cjs → TemplateDrive-BJN-ReA_.cjs} +1 -1
  68. package/dist/{TemplateDrive-CfPXKMKX.js → TemplateDrive-DNBwL0oy.js} +10 -10
  69. package/dist/{ThemeAdmin-XLbC9fX7.js → ThemeAdmin-Cnqefrz6.js} +6 -6
  70. package/dist/ThemeAdmin-CoE_c5-P.cjs +1 -0
  71. package/dist/ThemeAdmin-DI7QaZ-0.js +2 -0
  72. package/dist/{ThemeAdmin-BrEozdpZ.cjs → ThemeAdmin-DkgmjW3g.cjs} +1 -1
  73. package/dist/TimeZoneField-Ckn1pKAL.cjs +11 -0
  74. package/dist/{TimeZoneField-Dv389mAe.js → TimeZoneField-oIMwb5_X.js} +119 -107
  75. package/dist/{TransactionsAdmin-X-NjI4NB.js → TransactionsAdmin-Brs-CEcG.js} +11 -11
  76. package/dist/{TransactionsAdmin-DgsG629u.cjs → TransactionsAdmin-C5wQRR1g.cjs} +1 -1
  77. package/dist/{Trouble-qjWYeKzC.js → Trouble-CtFq7tjk.js} +1 -1
  78. package/dist/{Trouble-DokPNHQZ.cjs → Trouble-KQZyf6aY.cjs} +1 -1
  79. package/dist/{Users-BEjl_Vjc.cjs → Users-B16L9cKI.cjs} +1 -1
  80. package/dist/{Users-BUGb7-Kz.js → Users-CbI4K_Le.js} +15 -15
  81. package/dist/{VideoPlayer-BVOkrJBR.cjs → VideoPlayer-CggwpVXH.cjs} +1 -1
  82. package/dist/{VideoPlayer-DB0oz6lM.js → VideoPlayer-QI1Jc3bS.js} +1 -1
  83. package/dist/appIcons-C90OKlV5.cjs +130 -0
  84. package/dist/{appIcons-CUXAX_gJ.js → appIcons-CCArfCDe.js} +761 -735
  85. package/dist/{arrivalRoads-BZk39p8Z.js → arrivalRoads-CGXm9Ntm.js} +0 -0
  86. package/dist/{arrivalRoads-CD7pt03E.cjs → arrivalRoads-Cc6AZM-d.cjs} +0 -0
  87. package/dist/{bookingPages-BxqkyZ-M.js → bookingPages-BFSY3Riv.js} +1 -1
  88. package/dist/{bookingPages-2fn9xPiA.cjs → bookingPages-Dx1ViiwW.cjs} +1 -1
  89. package/dist/{contentFallback-C6xLwXTs.js → contentFallback-BGGpI1Ts.js} +2 -2
  90. package/dist/{contentFallback-DLm_iHo9.cjs → contentFallback-DVCrIUvK.cjs} +1 -1
  91. package/dist/{email-DxxovRtf.js → email-PBHbXXgR.js} +1 -1
  92. package/dist/{email-DD48BP42.cjs → email-Sya6gl4F.cjs} +1 -1
  93. package/dist/lib/basket.d.ts +29 -9
  94. package/dist/lib/recordPrice.d.ts +1 -1
  95. package/dist/{notices-Cwon5Q0Y.cjs → notices-CKm9-Pqt.cjs} +1 -1
  96. package/dist/{notices-C4yqYzBw.js → notices-CysS7BLF.js} +1 -1
  97. package/dist/{ownerMail-CGmDk7aP.cjs → ownerMail-BS9SjJ2u.cjs} +1 -1
  98. package/dist/{ownerMail-Chzy5Ehy.js → ownerMail-DepG5-Qw.js} +2 -2
  99. package/dist/{pageFiles-BClshvXs.cjs → pageFiles-Cn0YQ4Ur.cjs} +1 -1
  100. package/dist/{pageFiles-D-GYqRgZ.js → pageFiles-ZFPSCDZz.js} +1 -1
  101. package/dist/{paidInFull-KuStok9_.cjs → paidInFull-CZywIs-V.cjs} +1 -1
  102. package/dist/{paidInFull-D14Eh0QV.js → paidInFull-mBOh9iwN.js} +1 -1
  103. package/dist/{paidSessions-Cr_93LGa.js → paidSessions-B8e5RHi4.js} +7 -7
  104. package/dist/{paidSessions-QXv7SHeb.cjs → paidSessions-D-zHC4oG.cjs} +1 -1
  105. package/dist/{people-D8nPPMlM.cjs → people-BwWVVLfy.cjs} +1 -1
  106. package/dist/{people-sk2DcHPi.js → people-Wk2opW4G.js} +1 -1
  107. package/dist/{publishSteps-DB1Hxr6H.js → publishSteps-Cf5pSB_H.js} +1 -1
  108. package/dist/{publishSteps-CaZRpC3C.cjs → publishSteps-DvWlF0p_.cjs} +1 -1
  109. package/dist/{recordLock-Dnz61J-_.js → recordLock-CMOiezNC.js} +1 -1
  110. package/dist/{recordLock-CLUp3QNh.cjs → recordLock-CiulizO1.cjs} +1 -1
  111. package/dist/{recordsKey-R5BjLoGQ.cjs → recordsKey-C4E2vOti.cjs} +1 -1
  112. package/dist/{recordsKey-DHJJWWOo.js → recordsKey-Cd216nq1.js} +2 -2
  113. package/dist/{registrationFields-COv8jW4n.cjs → registrationFields-DHHTptcl.cjs} +1 -1
  114. package/dist/{registrationFields-CeTZSerx.js → registrationFields-DdHoMPAQ.js} +1 -1
  115. package/dist/renderer.cjs.js +1 -1
  116. package/dist/renderer.es.js +1 -1
  117. package/dist/{roles-5juCr5sY.cjs → roles-BBDIJzox.cjs} +1 -1
  118. package/dist/{roles-hzcMnn_M.js → roles-DiwP6-WQ.js} +3 -3
  119. package/dist/{scheduleData-BpkfnBjP.cjs → scheduleData-BXjNXVHY.cjs} +1 -1
  120. package/dist/{scheduleData-BLCUm84s.js → scheduleData-DR6A-Q7Z.js} +1 -1
  121. package/dist/server.cjs.js +1 -1
  122. package/dist/server.es.js +1 -1
  123. package/dist/{serviceStatus-5sk8MPjW.js → serviceStatus-C9izcuQz.js} +2 -2
  124. package/dist/{serviceStatus-1pGLLilF.cjs → serviceStatus-Cde96_OO.cjs} +1 -1
  125. package/dist/{serviceSwitches-BWnZBooS.js → serviceSwitches-CZHwvVfP.js} +1 -1
  126. package/dist/{serviceSwitches-Do_pkFCu.cjs → serviceSwitches-mhJbQBrV.cjs} +1 -1
  127. package/dist/vite.cjs.js +1 -1
  128. package/dist/vite.es.js +1 -1
  129. package/dist/your-ai-workflow-firebase-os.cjs.js +8 -8
  130. package/dist/your-ai-workflow-firebase-os.css +1 -1
  131. package/dist/your-ai-workflow-firebase-os.es.js +358 -316
  132. package/package.json +1 -1
  133. package/src/index.css +41 -6
  134. package/dist/PagesAdmin-B-XopEi9.js +0 -3
  135. package/dist/PagesAdmin-nL5ZltFn.cjs +0 -1
  136. package/dist/ThemeAdmin-CwCiTp2I.js +0 -2
  137. package/dist/ThemeAdmin-Db5edTYj.cjs +0 -1
  138. package/dist/TimeZoneField-zR8N2Fj0.cjs +0 -11
  139. package/dist/appIcons-BNovDw6_.cjs +0 -130
@@ -1 +1 @@
1
- const e=require(`./chunk-CiTBaPhY.cjs`),t=require(`./PageTitle-BWmE74WQ.cjs`),n=require(`./TimeZoneField-zR8N2Fj0.cjs`),r=require(`./DashboardNav-DOl9gJuu.cjs`),i=require(`./schedule-BAea6q8_.cjs`),a=require(`./chevron-down-lyDK1rfL.cjs`),o=require(`./arrow-left-C39sNUA7.cjs`),s=require(`./FileViewerPopup-DQmhXMSg.cjs`),c=require(`./eye-DU2g57PD.cjs`),l=require(`./VideoPlayer-BVOkrJBR.cjs`),u=require(`./x-Ci8c5p6T.cjs`),d=require(`./plus-zsWFCu4F.cjs`),f=require(`./trash-D-CpYHCs.cjs`),p=require(`./contentFallback-DLm_iHo9.cjs`),m=require(`./Button-PyTaaoyu.cjs`),h=require(`./mediaKind-ButDya5f.cjs`),ee=require(`./ConfirmModal-CQ73WYUg.cjs`),g=require(`./pageFiles-BClshvXs.cjs`),_=require(`./recordLock-CLUp3QNh.cjs`),v=require(`./personName-BvH1NWNy.cjs`);let y=require(`react`);y=e.a(y,1);let b=require(`react/jsx-runtime`),x=require(`firebase/firestore`),S=require(`firebase/storage`),te=require(`react-router-dom`);var ne={name:`archive`,size:24,node:[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]};ne.node;var re=a.n(ne),C={name:`code`,size:24,node:[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]};C.node;var ie=a.n(C),w={name:`link`,size:24,node:[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]};w.node;var ae=a.n(w),oe={name:`video`,size:24,node:[[`path`,{d:`m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5`,key:`ftymec`}],[`rect`,{x:`2`,y:`6`,width:`14`,height:`12`,rx:`2`,key:`158x01`}]]};oe.node;var se=a.n(oe),T=e=>`uid:${String(e||``).trim()}`,ce=e=>`role:${i.Ln(String(e||``))}`,E=(e,t)=>[T(e),`role:${String(t||`user`)}`],D=e=>{let t=String(e||``).trim().toLowerCase();return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)?`email:${t}`:`email:`},O=`everyone`,k=e=>Array.isArray(e)?e.filter(e=>typeof e==`string`&&e):[],A=e=>k(e?.access).includes(O),j=(e,t)=>A(e)||k(e?.access).some(e=>t.includes(e)),le=(e,t)=>k(e?.editors).some(e=>t.includes(e));function ue(e,{uid:t,editors:n=!0}){let r=T(t),i=k(e.access),a=k(e.editors);return{...e,uid:e.uid||t,access:i.includes(r)?i:[...i,r],editors:n&&!a.includes(r)?[...a,r]:a}}var de=e=>{if(typeof e==`number`)return Number.isFinite(e)?e:0;if(e&&typeof e.toMillis==`function`){let t=e.toMillis();return Number.isFinite(t)?t:0}if(e&&typeof e.seconds==`number`)return e.seconds*1e3;if(typeof e==`string`){let t=Date.parse(e);return Number.isFinite(t)?t:0}return 0},fe=(e,t)=>de(t.createdAt)-de(e.createdAt)||e.id.localeCompare(t.id),M=(e,t)=>({...t,id:e,access:k(t?.access),editors:k(t?.editors)}),N=e=>e?.code===`permission-denied`?`These entries could not be read. The security rules may need pasting again from the Setup screen.`:`These entries could not be read just now.`;function pe(e,{max:t=200,mine:r=!1}={}){let{user:a,userRole:o,isAdmin:s,roleConfirmed:c}=n.Ft(),l=a?.uid||``,u=a?.emailVerified?D(a.email||``):`email:`,d=(0,y.useMemo)(()=>l?[...E(l,o),...u===`email:`?[]:[u]]:[],[l,o,u]),[f,p]=(0,y.useState)({loading:!0,records:[],error:``,forUid:``});return(0,y.useEffect)(()=>{if(!l||!c||!i.Tn(e))return;let a=!0,o=new Map,u=new Map,f=()=>{if(!a)return;let e=new Map;for(let t of o.values())for(let n of t)e.set(n.id,n);p({loading:!1,records:[...e.values()].sort(fe).slice(0,t),error:[...u.values()][0]||``,forUid:l})},m=e=>t=>{u.delete(e),o.set(e,t.docs.map(e=>M(e.id,e.data()))),f()},h=e=>t=>{e.startsWith(`email:`)||e.startsWith(`role:`)?o.set(e,[]):u.set(e,N(t)),f()},ee=s&&!r?[n.Zr(`${e}|all`,()=>(0,x.query)((0,x.collection)(n.ui,e)),m(`all`),h(`all`))]:d.map(t=>n.Zr(`${e}|${t}`,()=>(0,x.query)((0,x.collection)(n.ui,e),(0,x.where)(`access`,`array-contains`,t)),m(t),h(t)));return()=>{a=!1,ee.forEach(e=>e())}},[e,l,d,s,r,c,t]),(0,y.useMemo)(()=>!l||!i.Tn(e)?F(!1,[],``):!c||f.forUid!==l?F(!0,[],``):F(f.loading,f.records,f.error),[l,c,f,e])}var P=[`list`,`cases`,`entries`,`items`,`data`];function F(e,t,n){let r={loading:e,records:t,error:n};for(let e of P)Object.defineProperty(r,e,{value:t,enumerable:!1});return r}function I(e,{max:t=200}={}){let{user:r,roleConfirmed:a}=n.Ft(),o=r?.uid||``,[s,c]=(0,y.useState)({loading:!0,records:[],error:``,forUid:``});return(0,y.useEffect)(()=>{if(!o||!a||!i.Tn(e))return;let r=!0,s=n.Zr(`${e}|${O}`,()=>(0,x.query)((0,x.collection)(n.ui,e),(0,x.where)(`access`,`array-contains`,O)),e=>{r&&c({loading:!1,records:e.docs.map(e=>M(e.id,e.data())).sort(fe).slice(0,t),error:``,forUid:o})},e=>{r&&c({loading:!1,records:[],error:N(e),forUid:o})});return()=>{r=!1,s()}},[e,o,a,t]),(0,y.useMemo)(()=>!o||!i.Tn(e)?F(!1,[],``):!a||s.forUid!==o?F(!0,[],``):F(s.loading,s.records,s.error),[o,a,s,e])}function L(e,t){let{user:r,roleConfirmed:a}=n.Ft(),o=r?.uid||``,[s,c]=(0,y.useState)({loading:!0,record:null,error:``,forKey:``}),l=`${o}|${e}|${t}`;return(0,y.useEffect)(()=>{if(!o||!a||!i.Tn(e)||!t)return;let r=!0,s=(0,x.onSnapshot)((0,x.doc)(n.ui,e,t),e=>{r&&c({loading:!1,record:e.exists()?M(e.id,e.data()):null,error:``,forKey:l})},e=>{r&&c({loading:!1,record:null,error:me(e),forKey:l})});return()=>{r=!1,s()}},[e,t,o,a,l]),(0,y.useMemo)(()=>!o||!i.Tn(e)||!t?z(!1,null,``):!a||s.forKey!==l?z(!0,null,``):z(s.loading,s.record,s.error),[o,a,s,e,t,l])}var R=[`entry`,`item`,`thing`,`data`];function z(e,t,n){let r={loading:e,record:t,error:n};for(let e of R)Object.defineProperty(r,e,{value:t,enumerable:!1});return r}var me=e=>e?.code===`permission-denied`?`This one has not been shared with you.`:`This one could not be read just now.`,B=({people:e=[],roles:t=[]})=>{let n=[...e.map(T),...t.map(ce)].filter(e=>e!==`uid:`&&e!==`role:`);return[...new Set(n)]},V=`Entries can only be sent on a page where each entry says who sees it.`,H=e=>e?.code===`permission-denied`?`That entry is not yours to send on.`:`That entry could not be sent on just now.`;async function U(e,t,r){if(!i.Tn(e))return V;let a=B(r);if(!a.length||!t)return``;try{return await(0,x.updateDoc)((0,x.doc)(n.ui,e,t),{access:(0,x.arrayUnion)(...a),...r.canEdit===!1?{}:{editors:(0,x.arrayUnion)(...a)}}),``}catch(e){return H(e)}}async function he(e,t,r){if(!i.Tn(e))return V;let a=B(r);if(!a.length||!t)return``;try{return await(0,x.updateDoc)((0,x.doc)(n.ui,e,t),{access:(0,x.arrayRemove)(...a),editors:(0,x.arrayRemove)(...a)}),``}catch(e){return H(e)}}var W=`Only a page where each entry says who sees it can publish one.`,ge=e=>e?.code===`permission-denied`?`That one is not yours to publish.`:`That one could not be published just now.`;async function G(e,t){if(!i.Tn(e))return W;if(!t)return``;try{return await(0,x.updateDoc)((0,x.doc)(n.ui,e,t),{access:(0,x.arrayUnion)(O)}),``}catch(e){return ge(e)}}async function K(e,t){if(!i.Tn(e))return W;if(!t)return``;try{return await(0,x.updateDoc)((0,x.doc)(n.ui,e,t),{access:(0,x.arrayRemove)(O)}),``}catch(e){return ge(e)}}var q=[`waiting`,`uploading`],J=(e,t)=>t.aborted||e?.code===`storage/canceled`||e?.name===`AbortError`;async function _e(e,t,{customMetadata:r,onProgress:i,signal:a}={}){if(a?.aborted)throw Object.assign(Error(`The upload was stopped.`),{code:`storage/canceled`});let o=(0,S.ref)(n.fi,e),s=(0,S.uploadBytesResumable)(o,t,n.W(e,r)),c=()=>{s.cancel()};a?.addEventListener(`abort`,c,{once:!0});let l;try{await new Promise((e,t)=>{s.on(`state_changed`,e=>i?.(e.totalBytes?e.bytesTransferred/e.totalBytes:0),t,()=>e())}),i?.(1),l=await(0,S.getDownloadURL)(o)}catch(e){throw a?.aborted&&await Y(o),e}finally{a?.removeEventListener(`abort`,c)}if(a?.aborted)throw await Y(o),Object.assign(Error(`The upload was stopped.`),{code:`storage/canceled`});return l}var Y=async e=>{try{await(0,S.deleteObject)(e)}catch{}};function X(e,t){let n=e.flatMap((e,n)=>t.has(e)?[n]:[]),r=n.map(t=>e[t]).sort((e,n)=>t.get(e)-t.get(n)),i=[...e];return n.forEach((e,t)=>{i[e]=r[t]}),i}var Z=0,ve=class{items=[];running=new Map;listeners=new Set;options;constructor(e){this.options=e}configure(e){this.options=e}getItems=()=>this.items;subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});commit(e){this.items=e,xe(this,this.options.stopOnUnmount?e.filter(e=>q.includes(e.state)).length:0),this.listeners.forEach(e=>e())}patch(e,t){let n;return this.commit(this.items.map(r=>r.id===e?n={...r,...t}:r)),n}add(e,{start:t=!0}={}){let n=e.map(e=>({id:`upload_${++Z}`,seq:Z,file:e,name:e.name,state:t?`waiting`:`ready`,progress:0}));return n.length?(this.commit([...this.items,...n]),this.pump(),n):n}start(){this.items.some(e=>e.state===`ready`||e.state===`failed`)&&(this.commit(this.items.map(e=>e.state===`ready`||e.state===`failed`?{...e,state:`waiting`,progress:0,error:void 0}:e)),this.pump())}retry(e){this.items.find(t=>t.id===e)?.state===`failed`&&(this.patch(e,{state:`waiting`,progress:0,error:void 0}),this.pump())}rename(e,t){let n=this.items.find(t=>t.id===e);!n||n.state!==`ready`&&n.state!==`failed`||this.patch(e,{name:t})}remove(e){this.running.get(e)?.abort(),this.running.delete(e),this.commit(this.items.filter(t=>t.id!==e)),this.pump()}stopAll(){this.running.forEach(e=>e.abort()),this.running.clear(),this.commit(this.items.filter(e=>!q.includes(e.state)))}clear(){this.commit(this.items.filter(e=>q.includes(e.state)))}pump(){let e=Math.max(1,this.options.concurrency||4);for(let t of this.items){if(this.running.size>=e)break;t.state!==`waiting`||this.running.has(t.id)||this.run(t)}}run(e){let t=new AbortController;this.running.set(e.id,t);let r=this.patch(e.id,{state:`uploading`,progress:0}),i=0,a=e=>{if(t.signal.aborted)return;let n=Math.min(1,Math.max(0,Math.round(e*100)/100));n!==i&&(i=n,this.patch(r.id,{progress:n}))};Promise.resolve().then(()=>this.options.upload(r.file,{item:r,progress:a,signal:t.signal})).then(e=>{if(t.signal.aborted)return;let n=this.patch(r.id,{state:`done`,progress:1,result:e});if(n)try{this.options.onUploaded?.(e,n)}catch(e){console.warn(`${r.file.name}: onUploaded threw`,e)}},e=>{if(J(e,t.signal))return;console.warn(`${r.file.name}: the upload did not work (${e?.code||e?.message||e}).`);let i=this.patch(r.id,{state:`failed`,error:n.z(e)});if(i)try{this.options.onFailed?.(i)}catch(e){console.warn(`${r.file.name}: onFailed threw`,e)}}).finally(()=>{this.running.get(r.id)===t&&this.running.delete(r.id),this.pump(),!this.running.size&&!this.items.some(e=>q.includes(e.state))&&this.options.onSettled?.(this.items)})}},Q=new Map,ye=0,be=new Set;function xe(e,t){let n=Q.get(e)||0;n!==t&&(t?Q.set(e,t):Q.delete(e),ye+=t-n,be.forEach(e=>e()))}var Se=()=>ye;function Ce(e){return be.add(e),()=>{be.delete(e)}}var we=()=>(0,y.useSyncExternalStore)(Ce,Se,()=>0);function Te(e){let t=t=>e.filter(e=>e.state===t).length,n=e.filter(e=>q.includes(e.state)),r=e.filter(e=>e.state!==`ready`),i=r.reduce((e,t)=>e+(t.file.size||1),0),a=r.reduce((e,t)=>e+(t.file.size||1)*(t.state===`done`?1:t.progress),0);return{total:e.length,ready:t(`ready`),waiting:t(`waiting`),uploading:t(`uploading`),done:t(`done`),failed:t(`failed`),active:n.length,busy:n.length>0,progress:i?a/i:0}}function Ee(e){let[t]=(0,y.useState)(()=>new ve(e));(0,y.useLayoutEffect)(()=>{t.configure(e)});let n=!!e.stopOnUnmount;(0,y.useEffect)(()=>n?()=>t.stopAll():void 0,[t,n]);let r=(0,y.useSyncExternalStore)(t.subscribe,t.getItems,t.getItems),i=Te(r);return(0,y.useEffect)(()=>{if(!i.busy||typeof window>`u`)return;let e=e=>{e.preventDefault(),e.returnValue=``};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[i.busy]),{items:r,...i,add:(e,n)=>t.add(e,n),start:()=>t.start(),retry:e=>t.retry(e),rename:(e,n)=>t.rename(e,n),remove:e=>t.remove(e),clear:()=>t.clear()}}var De=`${n.M}/pages`,Oe=`${n.j}/pages`,ke=(0,y.createContext)(null),Ae=ke.Provider,je=()=>(0,y.useContext)(ke)||{prefix:``};function Me({prefix:e,shared:t=!1,internal:n=!1,collection:r=``,recordId:i=``}){return!e||e===`pub_`?Oe:t?n?De:Oe:e===`case_`?g.n(r,i):g.i(e)}var Ne=(e,t={})=>`${Date.now()}_${Math.random().toString(36).slice(2,8)}_${h.g(t.width,t.height)}${(e||`file`).replace(/[^a-zA-Z0-9.-]/g,`_`)}`;async function Pe(e,{prefix:t,shared:r=!1,user:i,onProgress:a,signal:o,collection:s=``,recordId:c=``}){let l=Me({prefix:t,shared:r,internal:!!i?.internal,collection:s,recordId:c});if(!l)throw Error(`This page keeps files with the entry they belong to, and no entry was named.`);if(!i&&l!==Oe)throw Error(`Sign in again before uploading.`);let u=await h._(e);if(!i?.admin&&u.size>=10485760)throw Error(`That file is over 10 MB. Try a smaller one.`);let d=await n.Y(u),f=`${l}/${Ne(u.name,d)}`,p=await _e(f,u,{customMetadata:i?{ownerId:i.uid}:void 0,onProgress:a,signal:o}),m=await n.R(f,u,i?{ownerId:i.uid}:void 0);return{url:p,storagePath:f,name:u.name,type:u.type||``,size:u.size,...d.width&&d.height?{width:d.width,height:d.height}:{},...m}}async function Fe(e){try{await(0,S.deleteObject)((0,S.ref)(n.fi,e)),await n.F(e)}catch(t){console.warn(`${e}: the upload was dropped but the file stayed (${t?.code||t}).`)}}var Ie=e=>e===i.pn;function Le(){let{user:e,userRole:t}=n.Ft(),r=e?.uid||``;return(0,y.useMemo)(()=>r?E(r,t):[],[r,t])}var Re=e=>{try{let t=(0,x.doc)((0,x.collection)(n.ui,e)).id;if(t)return t}catch{}return`rec_${Date.now()}_${Math.random().toString(36).slice(2,8)}`},ze=(e,t,n)=>Ie(e)?g.n(t,n||``):g.i(e);function Be(e,t){return ue({createdAt:Date.now(),...e},{uid:t})}function Ve(e,t,n,r=``){let i=t.find(e=>e.startsWith(`role:`))?.slice(5)||null,a=e=>n?i===`admin`||le(e,t):!0;return{sendTo:(t,n)=>U(e,t,n),takeBack:(t,n)=>he(e,t,n),keys:t,canEdit:a,canDelete:e=>a(e)&&_.d(e,i),canSend:e=>n&&a(e)&&_.f(e,i),publish:t=>G(e,t),unpublish:t=>K(e,t),isPublished:e=>n?A(e):!1,draftId:n?r:``}}var He=`user_profiles`,Ue=`Viewing`,We=`Everyone`,Ge=e=>{let t=[];return e.forEach(e=>{let n=e.data()||{};n.inactive===!0||n.removed===!0||t.push({uid:e.id,name:v.n(n)})}),t.sort((e,t)=>e.name.localeCompare(t.name))};function Ke(e){let{isAdmin:t,roleConfirmed:r}=n.Ft(),[i,a]=(0,y.useState)([]),o=e&&t&&r!==!1;return(0,y.useEffect)(()=>{if(!o)return;let e=!0,t=n.Zr(He,()=>(0,x.collection)(n.ui,He),t=>{e&&a(Ge(t))},()=>{e&&a([])});return()=>{e=!1,t()}},[o]),o?i:[]}var qe=`You are looking at somebody else’s page. Anything you add here is theirs, but a file would stay yours — so uploads are off until you switch back to your own.`;function Je({on:e,everyone:t=!0}){let{user:r,isAdmin:i}=n.Ft(),a=r?.uid||``,o=Ke(e),[s,c]=(0,y.useState)(``),l=e&&i&&o.length>0,u=s&&o.some(e=>e.uid===s),d=l&&(u||s===``&&t)?s:``,f=l&&t&&d===``,p=(0,y.useMemo)(()=>[...t?[{value:``,label:We}]:[],...o.map(e=>({value:e.uid,label:e.uid===a?`${e.name} (you)`:e.name}))],[t,o,a]);return{uid:f?``:d||a,everyone:f,someoneElse:!!d&&d!==a,control:l?(0,b.jsx)(n.Z,{dense:!0,compact:!0,portal:!0,direction:`auto`,className:`console-select`,ariaLabel:Ue,value:d||(t?``:a),options:p,onChange:e=>c(e)}):null}}function Ye({viewing:e}){return e.control?(0,b.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,b.jsx)(c.t,{className:`w-3.5 h-3.5 shrink-0 text-foreground/45`}),(0,b.jsx)(`span`,{className:`text-[12.5px] font-semibold text-foreground/50 select-none whitespace-nowrap max-sm:hidden`,children:Ue}),e.control]}):null}var Xe=`inline-flex items-center justify-center w-9 h-9 rounded-full border border-[var(--panel-border)] text-foreground/50 hover:text-accent hover:bg-foreground/5 transition-colors shrink-0 cursor-pointer`,Ze=({to:e})=>e?(0,b.jsx)(te.Link,{to:e,"aria-label":`Go back`,title:`Go back`,className:Xe,children:(0,b.jsx)(o.t,{className:`w-4 h-4`})}):(0,b.jsx)(`button`,{type:`button`,onClick:()=>window.history.back(),"aria-label":`Go back`,title:`Go back`,className:Xe,children:(0,b.jsx)(o.t,{className:`w-4 h-4`})});function Qe({file:e,className:t,alt:n=``}){let r=(0,y.useRef)(null);return(0,y.useEffect)(()=>{if(!r.current||typeof URL.createObjectURL!=`function`)return;let t=URL.createObjectURL(e);return r.current.src=t,()=>URL.revokeObjectURL(t)},[e]),(0,b.jsx)(`img`,{ref:r,alt:n,className:t,"data-fbos-own":!0})}var $e=e=>{if(!e)return`0 B`;let t=1024,n=[`B`,`KB`,`MB`,`GB`],r=Math.floor(Math.log(e)/Math.log(t));return parseFloat((e/t**+r).toFixed(2))+` `+n[r]},$=500;function et({title:e=`Drive`,subtitle:a=`/drive`,backUrl:o,filesCollection:c=`pub_files`,config:_,customContent:v,footer:ne,addition:C}){let{user:w,userRole:oe}=n.Ft(),T=!!_,ce=oe===`admin`,E=c,D=c.startsWith(`user_`),O=i.Tn(c),k=Le(),A=Je({on:c.startsWith(`user_`)&&!i.Tn(c)}),j=pe(c),[ue,de]=(0,y.useState)([]),[fe,M]=(0,y.useState)(!0),N=O?j.records.map(e=>({...e,_id:e.id})):ue,P=O?j.loading:fe,[F,I]=(0,y.useState)(null),[L,R]=(0,y.useState)(null),[z,me]=(0,y.useState)(!1),[B,V]=(0,y.useState)(null),[H,U]=(0,y.useState)(null),[he,W]=(0,y.useState)(!1),[ge,G]=(0,y.useState)(!1);(0,y.useEffect)(()=>{if(!(D&&!w)&&!O)return M(!0),(0,x.onSnapshot)(D&&!A.everyone?(0,x.query)((0,x.collection)(n.ui,c),(0,x.where)(`uid`,`==`,A.uid||w.uid),(0,x.limit)($)):(0,x.query)((0,x.collection)(n.ui,c),(0,x.orderBy)(`createdAt`,`desc`),(0,x.limit)($)),e=>{let t=e.docs.map(e=>({_id:e.id,...e.data()}));t.sort((e,t)=>(t.createdAt?.toMillis?.()||0)-(e.createdAt?.toMillis?.()||0)),de(t),M(!1)},e=>{console.warn(`Error listening to ${c}:`,e),M(!1)})},[c,D,w?.uid,O,A.uid,A.everyone]);let K=e=>O?le(e,k):!!w&&(e.uid===w.uid||ce),q=Ee({upload:async(e,t)=>{if(!w)throw Error(`Sign in again before uploading.`);let r=await h._(e),i=O?Re(c):``,a=`${O?g.n(c,i):E}/${Ne(r.name)}`,o=await _e(a,r,{customMetadata:{ownerId:w.uid},onProgress:t.progress,signal:t.signal}),s={fileName:t.item.name.trim()||r.name,fileType:r.type||`unknown`,fileSize:r.size,downloadURL:o,storagePath:a,uid:w.uid,uploaderEmail:w.email||``};O?await(0,x.setDoc)((0,x.doc)(n.ui,c,i),Be(s,w.uid)):await(0,x.addDoc)((0,x.collection)(n.ui,c),{...s,createdAt:(0,x.serverTimestamp)()})},onSettled:e=>{e.length&&e.every(e=>e.state===`done`)&&(W(!1),q.clear())}}),J=q.total-q.ready,Y=e=>{if(!e||!w||A.someoneElse)return;let t=Array.isArray(e)?e:`length`in e?Array.from(e):[e];t.length&&(q.add(t,{start:!1}),W(!0))},X=()=>{A.someoneElse||W(!0)},Z=()=>{q.clear(),W(!1)},ve=e=>{let t=Array.from(e.target.files||[]);e.target.value=``,Y(t)},Q=q.done?`${q.done} of ${J} uploaded`:`Uploading ${J===1?`your file`:`${J} files`}`,ye=q.ready?q.ready===1?`Upload`:`Upload ${q.ready} files`:q.busy?`${Q}…`:q.failed?`Try again`:`Uploaded`,be=async()=>{if(L){me(!0);try{await Promise.all([(0,S.deleteObject)((0,S.ref)(n.fi,L.storagePath||L.downloadURL)).catch(e=>console.warn(`Storage object missing:`,e)),n.F(L.storagePath||``),(0,x.deleteDoc)((0,x.doc)(n.ui,c,L._id))]),R(null)}catch(e){console.error(`Delete failed:`,e)}me(!1)}},xe=async()=>{if(!B||!B.name.trim()){V(null);return}try{await(0,x.updateDoc)((0,x.doc)(n.ui,c,B.id),{fileName:B.name.trim()})}catch(e){console.error(`Rename failed:`,e)}V(null)},Se=(e,t)=>{navigator.clipboard.writeText(e),U(t),setTimeout(()=>U(null),2e3)},Ce=(e,t=`row`)=>{let n=t===`card`?`w-16 h-16`:`w-10 h-10`,r=t===`card`?`w-8 h-8`:`w-5 h-5`;return e.includes(`video`)||e.includes(`audio`)?(0,b.jsx)(`div`,{className:`${n} flex items-center justify-center bg-accent/10 text-accent rounded-lg`,children:(0,b.jsx)(se,{className:r})}):e.includes(`pdf`)||e.includes(`word`)||e.includes(`text`)?(0,b.jsx)(`div`,{className:`${n} flex items-center justify-center bg-blue-500/10 text-blue-500 rounded-lg`,children:(0,b.jsx)(s.u,{className:r})}):e.includes(`zip`)||e.includes(`rar`)||e.includes(`archive`)?(0,b.jsx)(`div`,{className:`${n} flex items-center justify-center bg-yellow-500/10 text-yellow-500 rounded-lg`,children:(0,b.jsx)(re,{className:r})}):e.includes(`html`)||e.includes(`csv`)||e.includes(`json`)?(0,b.jsx)(`div`,{className:`${n} flex items-center justify-center bg-emerald-500/10 text-emerald-500 rounded-lg`,children:(0,b.jsx)(ie,{className:r})}):(0,b.jsx)(`div`,{className:`${n} flex items-center justify-center bg-foreground/5 text-foreground/40 rounded-lg`,children:(0,b.jsx)(s.l,{className:r})})};return(0,b.jsxs)(`main`,{className:`flex-1 w-full max-w-7xl mx-auto p-4 pt-2 md:p-8 md:pt-4 flex flex-col min-h-screen relative`,onDragOver:e=>{e.preventDefault(),G(!0)},onDragLeave:e=>{e.preventDefault(),G(!1)},onDrop:e=>{e.preventDefault(),G(!1),e.dataTransfer.files?.length&&Y(e.dataTransfer.files)},children:[(0,b.jsxs)(n.nt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:`mb-4 md:mb-6 flex items-center gap-3`,children:[!T&&(0,b.jsx)(Ze,{to:o}),(0,b.jsxs)(`div`,{className:`min-w-0`,children:[(0,b.jsx)(t.t,{children:e}),(0,b.jsxs)(`div`,{className:`max-sm:hidden sm:flex items-center gap-2 text-foreground/40 font-bold uppercase tracking-[0.2em] text-[11px]`,children:[(0,b.jsx)(`span`,{className:`w-8 h-[1px] bg-foreground/10`}),a]})]})]}),T&&(0,b.jsx)(`div`,{className:`mb-6`,children:(0,b.jsx)(r.t,{})}),C&&(0,b.jsx)(`div`,{className:`mb-6 empty:hidden`,children:C}),(0,b.jsxs)(`div`,{className:`glass-panel border border-[var(--panel-border)] rounded-2xl md:rounded-3xl overflow-hidden flex-1 shadow-2xl min-h-[420px] md:min-h-[520px] mb-16 bg-background flex flex-col`,children:[(0,b.jsxs)(`div`,{className:`p-4 md:p-8 flex items-center justify-between gap-3 md:gap-6 border-b border-[var(--panel-border)]/50 bg-background/50`,children:[(0,b.jsxs)(`div`,{className:`min-w-0`,children:[(0,b.jsx)(`h2`,{className:`text-lg md:text-2xl font-bold text-foreground tracking-tight`,children:`Files`}),(0,b.jsx)(`p`,{className:`max-sm:hidden text-[12px] md:text-[13px] mt-1 md:mt-2 text-foreground/60 font-medium`,children:A.someoneElse?qe:O?`A file here is seen by the people it is sent to, and nobody else.`:A.everyone?`You are seeing everybody’s files. Anything you add is your own.`:D?`Only you can see the files you upload here.`:`Everyone who can open this page can see these files.`})]}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,b.jsx)(Ye,{viewing:A}),!v&&!A.someoneElse&&(w?(0,b.jsxs)(m.t,{onClick:X,title:q.busy?Q:`Add files`,className:`flex items-center justify-center gap-2 w-9 h-9 p-0 sm:w-auto sm:h-auto sm:px-5 sm:py-2.5 rounded-xl text-[13px] font-bold shadow-md shrink-0`,children:[q.busy?(0,b.jsx)(u.r,{className:`w-4 h-4 animate-spin`}):(0,b.jsx)(d.t,{className:`w-4 h-4`}),(0,b.jsx)(`span`,{className:`max-sm:hidden`,children:q.busy?Q:`Add files`})]}):(0,b.jsxs)(te.Link,{to:`/login`,title:`Sign in to add files`,className:`btn-primary flex items-center justify-center gap-2 w-9 h-9 p-0 sm:w-auto sm:h-auto sm:px-5 sm:py-2.5 rounded-xl text-[13px] font-bold shadow-md shrink-0`,children:[(0,b.jsx)(d.t,{className:`w-4 h-4`}),` `,(0,b.jsx)(`span`,{className:`max-sm:hidden`,children:`Add files`})]}))]})]}),v?(0,b.jsx)(Ae,{value:{prefix:i.Mn(_||{}),collection:O?c:``,recordId:``},children:(0,b.jsx)(`div`,{className:`fbos-content-slot fbos-tab-fill p-4 md:p-8 flex-1`,children:(0,b.jsx)(p.p,{size:`part`,children:(0,b.jsx)(v,{files:N,loading:P,error:O?j.error:``,user:w,uploadFile:Y,deleteFile:R,openUploadModal:X,viewFile:I,config:_,...Ve(c,k,O)})})})}):(0,b.jsxs)(`div`,{className:`p-4 sm:p-6 md:p-8 flex-1 relative`,children:[P&&(0,b.jsx)(`div`,{className:`absolute inset-0 z-10 flex items-center justify-center bg-background/50 backdrop-blur-sm`,children:(0,b.jsx)(u.r,{className:`w-8 h-8 text-accent animate-spin`})}),N.length>0?(0,b.jsxs)(`div`,{className:`grid grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3 sm:gap-4`,children:[N.map(e=>(0,b.jsxs)(`div`,{className:`flex flex-col bg-background border border-[var(--panel-border)] rounded-2xl hover:border-accent/40 transition-all group overflow-hidden shadow-sm h-[190px] relative`,children:[(0,b.jsxs)(`div`,{className:`absolute top-2 right-2 flex flex-col gap-1 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 transition-opacity z-10 bg-background/90 backdrop-blur-md rounded-lg p-1 border border-[var(--panel-border)] shadow-xl`,children:[(0,b.jsx)(`a`,{href:e.downloadURL,download:!0,target:`_blank`,rel:`noreferrer`,className:`p-1.5 hover:bg-foreground/5 rounded-md text-foreground/60 hover:text-blue-500 transition-colors`,title:`Download`,children:(0,b.jsx)(s.d,{className:`w-4 h-4`})}),(0,b.jsx)(`button`,{onClick:t=>{t.stopPropagation(),Se(e.downloadURL,e._id)},className:`p-1.5 hover:bg-foreground/5 rounded-md text-foreground/60 hover:text-emerald-500 transition-colors`,title:`Copy link`,children:H===e._id?(0,b.jsx)(n.At,{className:`w-4 h-4 text-emerald-500`}):(0,b.jsx)(ae,{className:`w-4 h-4`})}),K(e)&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`button`,{onClick:t=>{t.stopPropagation(),V({id:e._id,name:e.fileName})},className:`p-1.5 hover:bg-foreground/5 rounded-md text-foreground/60 hover:text-accent transition-colors`,title:`Rename`,children:(0,b.jsx)(s.s,{className:`w-4 h-4`})}),(0,b.jsx)(`button`,{onClick:t=>{t.stopPropagation(),R(e)},className:`p-1.5 hover:bg-red-500/10 rounded-md text-foreground/60 hover:text-red-500 transition-colors`,title:`Delete`,children:(0,b.jsx)(f.t,{className:`w-4 h-4`})})]})]}),(0,b.jsx)(`div`,{className:`h-[120px] w-full border-b border-[var(--panel-border)]/50 bg-foreground/[0.02] flex items-center justify-center overflow-hidden relative cursor-pointer`,onClick:()=>I(e),children:e.fileType.startsWith(`image/`)?(0,b.jsx)(n.O,{src:e.downloadURL,small:e.smallURL,medium:e.mediumURL,alt:``,fit:`contain`,className:`absolute inset-0`,imgClassName:`p-2`}):Ce(e.fileType,`card`)}),(0,b.jsxs)(`div`,{className:`p-3 flex flex-col justify-center flex-1 min-w-0`,onClick:()=>!B&&I(e),children:[B?.id===e._id?(0,b.jsx)(`input`,{autoFocus:!0,type:`text`,value:B.name,onChange:e=>V({...B,name:e.target.value}),onBlur:xe,onKeyDown:e=>{e.key===`Enter`&&xe(),e.key===`Escape`&&V(null)},onClick:e=>e.stopPropagation(),className:`no-glow text-[12.5px] font-bold text-foreground bg-transparent border-b border-accent/30 outline-none pb-0.5 w-full`}):(0,b.jsx)(`span`,{className:`text-[12.5px] font-bold text-foreground truncate select-none group-hover:text-accent transition-colors`,title:e.fileName,children:e.fileName}),(0,b.jsx)(`span`,{className:`text-[11px] text-foreground/40 font-bold uppercase tracking-wider mt-1 select-none`,children:$e(e.fileSize)})]})]},e._id)),N.length>=$&&(0,b.jsxs)(`p`,{className:`col-span-full text-[12px] font-medium text-foreground/45 text-center pt-2`,children:[`Showing the `,$,` newest files. Older ones are still here — search or open them from a link.`]})]}):!P&&(0,b.jsxs)(`div`,{onClick:()=>w&&X(),className:`min-h-[320px] flex flex-col items-center justify-center text-center cursor-pointer group`,children:[(0,b.jsx)(t.v,{className:`w-12 h-12 text-foreground/15 mb-4`}),(0,b.jsx)(`p`,{className:`text-[20px] font-bold text-foreground/50 group-hover:text-foreground/70 transition-colors`,children:`No files yet`}),(0,b.jsx)(`p`,{className:`text-[13px] font-medium mt-1 text-foreground/40`,children:w?`Click here or drag files in to upload`:`Sign in to upload files`})]})]})]}),ne,(0,b.jsx)(n.rt,{children:he&&(0,b.jsxs)(`div`,{className:`fixed inset-0 z-[120] flex items-center justify-center p-4`,children:[(0,b.jsx)(n.nt.div,{onClick:Z,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:`absolute inset-0 bg-background/80 backdrop-blur-xl cursor-pointer`}),(0,b.jsxs)(n.nt.div,{role:`dialog`,"aria-modal":`true`,"aria-label":`Upload files`,initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:`w-full max-w-[520px] max-h-[calc(100dvh-2rem)] border-[var(--panel-border)] border rounded-3xl relative z-10 glass-panel shadow-2xl flex flex-col bg-background`,children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between p-4 md:p-6 border-b border-[var(--panel-border)]/50 shrink-0`,children:[(0,b.jsx)(`span`,{className:`text-[16px] font-extrabold text-foreground tracking-tight`,children:q.total>1?`Upload ${q.total} files`:`Upload files`}),(0,b.jsx)(`button`,{onClick:Z,"aria-label":`Close`,className:`text-foreground/40 hover:text-foreground transition-colors`,children:(0,b.jsx)(u.t,{className:`w-5 h-5`})})]}),q.total?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`ul`,{className:`flex flex-col gap-2 p-4 md:p-6 overflow-y-auto min-h-0`,children:q.items.map(e=>{let t=e.state===`waiting`||e.state===`uploading`,r=e.state===`ready`||e.state===`failed`;return(0,b.jsxs)(`li`,{className:`flex items-center gap-3 bg-foreground/[0.03] p-3 rounded-2xl border border-[var(--panel-border)]`,children:[e.file.type.startsWith(`image/`)?(0,b.jsx)(Qe,{file:e.file,className:`w-10 h-10 shrink-0 rounded-lg object-cover bg-foreground/5`}):Ce(e.file.type),(0,b.jsxs)(`div`,{className:`flex flex-col flex-1 min-w-0 gap-1`,children:[r?(0,b.jsx)(`input`,{type:`text`,value:e.name,onChange:t=>q.rename(e.id,t.target.value),"aria-label":`Name for ${e.file.name}`,className:`no-glow w-full bg-transparent border-b border-transparent hover:border-[var(--panel-border)] focus:border-accent/50 outline-none text-[13px] font-bold text-foreground pb-0.5 transition-colors`}):(0,b.jsx)(`span`,{className:`text-[13px] font-bold text-foreground truncate pb-0.5`,children:e.name}),t?(0,b.jsx)(`span`,{role:`progressbar`,"aria-label":`Uploading ${e.name}`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(e.progress*100),className:`block h-1.5 w-full rounded-full bg-foreground/10 overflow-hidden my-1`,children:(0,b.jsx)(`span`,{className:`block h-full rounded-full bg-accent transition-[width] duration-200`,style:{width:`${Math.max(e.state===`waiting`?0:4,e.progress*100)}%`}})}):e.state===`failed`?(0,b.jsx)(`span`,{className:`text-[11.5px] font-semibold text-red-500 truncate`,title:e.error,children:e.error}):(0,b.jsxs)(`span`,{className:`text-[11px] text-foreground/50 font-bold uppercase tracking-wider`,children:[$e(e.file.size),e.state===`done`?` · Uploaded`:``]})]}),e.state===`done`?(0,b.jsx)(n.At,{className:`w-4 h-4 mx-2 text-emerald-500 shrink-0`,"aria-hidden":!0}):(0,b.jsxs)(`div`,{className:`flex items-center shrink-0`,children:[e.state===`failed`&&(0,b.jsx)(`button`,{type:`button`,onClick:()=>q.retry(e.id),"aria-label":`Try ${e.name} again`,title:`Try again`,className:`w-8 h-8 flex items-center justify-center text-foreground/40 hover:text-accent rounded-xl hover:bg-accent/10 transition-colors`,children:(0,b.jsx)(l.n,{className:`w-4 h-4`})}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>q.remove(e.id),"aria-label":`${t?`Stop`:`Remove`} ${e.name}`,title:t?`Stop`:`Remove`,className:`w-8 h-8 flex items-center justify-center text-foreground/40 hover:text-red-500 rounded-xl hover:bg-red-500/10 transition-colors`,children:t?(0,b.jsx)(u.t,{className:`w-4 h-4`}):(0,b.jsx)(f.t,{className:`w-4 h-4`})})]})]},e.id)})}),(0,b.jsxs)(`div`,{className:`p-4 md:p-6 pt-3 md:pt-4 border-t border-[var(--panel-border)]/50 flex flex-col gap-3 shrink-0`,children:[q.failed>0&&(0,b.jsxs)(`p`,{className:`text-[13px] font-medium text-red-400 bg-red-500/10 border border-red-500/20 rounded-xl p-3`,children:[q.failed===1?`One file did not upload.`:`${q.failed} files did not upload.`,` Try again, or take it off the list.`]}),(0,b.jsxs)(`div`,{className:`flex items-stretch gap-2`,children:[(0,b.jsxs)(`label`,{title:`Add more files`,className:`btn-secondary flex items-center justify-center gap-2 px-4 rounded-xl text-[13px] font-bold cursor-pointer shrink-0`,children:[(0,b.jsx)(d.t,{className:`w-4 h-4`}),` `,(0,b.jsx)(`span`,{className:`max-sm:hidden`,children:`Add more`}),(0,b.jsx)(`input`,{type:`file`,multiple:!0,"aria-label":`Add more files`,onChange:ve,className:`sr-only`})]}),(0,b.jsxs)(m.t,{type:`button`,onClick:q.start,disabled:!q.ready&&!q.failed,className:`flex-1 py-4 rounded-xl text-[14px] font-bold shadow-lg`,children:[q.busy&&!q.ready&&(0,b.jsx)(u.r,{className:`w-4 h-4 animate-spin`}),ye]})]})]})]}):(0,b.jsx)(`div`,{className:`p-4 md:p-6`,children:(0,b.jsxs)(`label`,{className:`group flex flex-col items-center justify-center gap-1.5 px-6 py-12 rounded-2xl border-2 border-dashed border-[var(--panel-border)] bg-foreground/[0.015] hover:border-accent/50 hover:bg-accent/[0.03] cursor-pointer text-center transition-all`,children:[(0,b.jsx)(`span`,{className:`w-14 h-14 rounded-full bg-accent/10 text-accent flex items-center justify-center mb-2 group-hover:scale-105 transition-transform`,children:(0,b.jsx)(t.v,{className:`w-6 h-6`})}),(0,b.jsxs)(`p`,{className:`text-[15px] font-bold text-foreground`,children:[(0,b.jsx)(`span`,{className:`text-accent`,children:`Click to upload`}),` or drag files in`]}),(0,b.jsx)(`p`,{className:`text-[12.5px] text-foreground/45 font-medium`,children:`Pictures, documents, anything — as many as you like`}),(0,b.jsx)(`input`,{type:`file`,multiple:!0,"aria-label":`Choose files to upload`,onChange:ve,className:`sr-only`})]})})]})]})}),(0,b.jsx)(s.t,{open:!!F,onClose:()=>I(null),src:F?.downloadURL||``,name:F?.fileName,type:F?.fileType,actions:F&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`button`,{type:`button`,onClick:()=>Se(F.downloadURL,F._id),className:`h-9 w-9 shrink-0 rounded-xl flex items-center justify-center text-foreground/65 hover:text-emerald-500 hover:bg-foreground/[0.06] transition-colors cursor-pointer`,title:`Copy link`,"aria-label":`Copy link`,children:H===F._id?(0,b.jsx)(n.At,{className:`w-4 h-4 text-emerald-500`}):(0,b.jsx)(ae,{className:`w-4 h-4`})}),K(F)&&(0,b.jsx)(`button`,{type:`button`,onClick:()=>{let e=F;I(null),R(e)},className:`h-9 w-9 shrink-0 rounded-xl flex items-center justify-center text-foreground/65 hover:text-red-500 hover:bg-red-500/10 transition-colors cursor-pointer`,title:`Delete`,"aria-label":`Delete`,children:(0,b.jsx)(f.t,{className:`w-4 h-4`})})]})}),(0,b.jsx)(ee.t,{isOpen:!!L,title:`Delete file`,message:(0,b.jsxs)(b.Fragment,{children:[`Delete `,(0,b.jsx)(`strong`,{className:`text-foreground block my-1 break-words max-w-full text-center`,children:L?.fileName}),` This cannot be undone.`]}),onConfirm:be,onCancel:()=>R(null),isProcessing:z,confirmText:`Yes, delete`}),(0,b.jsx)(n.rt,{children:ge&&(0,b.jsx)(n.nt.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:`fixed inset-0 z-[1000] bg-background/60 backdrop-blur-md pointer-events-none flex items-center justify-center p-6`,children:(0,b.jsxs)(`div`,{className:`w-full max-w-lg aspect-video bg-background/80 border-2 border-dashed border-accent rounded-[40px] shadow-2xl flex flex-col items-center justify-center gap-6`,children:[(0,b.jsx)(`div`,{className:`w-20 h-20 rounded-full bg-accent/10 flex items-center justify-center text-accent`,children:(0,b.jsx)(t.v,{className:`w-10 h-10 animate-bounce`})}),(0,b.jsx)(`span`,{className:`text-[24px] font-extrabold text-foreground tracking-tight`,children:`Drop to upload`})]})})})]})}Object.defineProperty(exports,`A`,{enumerable:!0,get:function(){return G}}),Object.defineProperty(exports,`B`,{enumerable:!0,get:function(){return ie}}),Object.defineProperty(exports,`C`,{enumerable:!0,get:function(){return le}}),Object.defineProperty(exports,`D`,{enumerable:!0,get:function(){return ce}}),Object.defineProperty(exports,`E`,{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,`F`,{enumerable:!0,get:function(){return pe}}),Object.defineProperty(exports,`I`,{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,`L`,{enumerable:!0,get:function(){return ue}}),Object.defineProperty(exports,`M`,{enumerable:!0,get:function(){return he}}),Object.defineProperty(exports,`N`,{enumerable:!0,get:function(){return K}}),Object.defineProperty(exports,`O`,{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,`P`,{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,`R`,{enumerable:!0,get:function(){return se}}),Object.defineProperty(exports,`S`,{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,`T`,{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,`V`,{enumerable:!0,get:function(){return re}}),Object.defineProperty(exports,`_`,{enumerable:!0,get:function(){return je}}),Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return Ye}}),Object.defineProperty(exports,`b`,{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return Ie}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return ze}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return Le}}),Object.defineProperty(exports,`g`,{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(exports,`h`,{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return qe}}),Object.defineProperty(exports,`j`,{enumerable:!0,get:function(){return U}}),Object.defineProperty(exports,`k`,{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return Be}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return Fe}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return Qe}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return Je}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return Ze}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return Ve}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return et}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return Re}}),Object.defineProperty(exports,`v`,{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,`w`,{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,`x`,{enumerable:!0,get:function(){return we}}),Object.defineProperty(exports,`y`,{enumerable:!0,get:function(){return _e}}),Object.defineProperty(exports,`z`,{enumerable:!0,get:function(){return ae}});
1
+ const e=require(`./chunk-CiTBaPhY.cjs`),t=require(`./PageTitle-DQkvCB11.cjs`),n=require(`./TimeZoneField-Ckn1pKAL.cjs`),r=require(`./DashboardNav-GgEUpyTa.cjs`),i=require(`./schedule-BAea6q8_.cjs`),a=require(`./chevron-down-lyDK1rfL.cjs`),o=require(`./arrow-left-C39sNUA7.cjs`),s=require(`./FileViewerPopup-CkLUYCNo.cjs`),c=require(`./eye-DU2g57PD.cjs`),l=require(`./VideoPlayer-CggwpVXH.cjs`),u=require(`./x-Ci8c5p6T.cjs`),d=require(`./plus-zsWFCu4F.cjs`),f=require(`./trash-D-CpYHCs.cjs`),p=require(`./contentFallback-DVCrIUvK.cjs`),m=require(`./Button-Ccy4wFZ1.cjs`),h=require(`./mediaKind-ButDya5f.cjs`),ee=require(`./ConfirmModal-BUNtss4a.cjs`),g=require(`./pageFiles-Cn0YQ4Ur.cjs`),_=require(`./recordLock-CiulizO1.cjs`),v=require(`./personName-BvH1NWNy.cjs`);let y=require(`react`);y=e.a(y,1);let b=require(`react/jsx-runtime`),x=require(`firebase/firestore`),S=require(`firebase/storage`),te=require(`react-router-dom`);var ne={name:`archive`,size:24,node:[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]};ne.node;var re=a.n(ne),C={name:`code`,size:24,node:[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]};C.node;var ie=a.n(C),w={name:`link`,size:24,node:[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]};w.node;var ae=a.n(w),oe={name:`video`,size:24,node:[[`path`,{d:`m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5`,key:`ftymec`}],[`rect`,{x:`2`,y:`6`,width:`14`,height:`12`,rx:`2`,key:`158x01`}]]};oe.node;var se=a.n(oe),T=e=>`uid:${String(e||``).trim()}`,ce=e=>`role:${i.Ln(String(e||``))}`,E=(e,t)=>[T(e),`role:${String(t||`user`)}`],D=e=>{let t=String(e||``).trim().toLowerCase();return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)?`email:${t}`:`email:`},O=`everyone`,k=e=>Array.isArray(e)?e.filter(e=>typeof e==`string`&&e):[],A=e=>k(e?.access).includes(O),j=(e,t)=>A(e)||k(e?.access).some(e=>t.includes(e)),le=(e,t)=>k(e?.editors).some(e=>t.includes(e));function ue(e,{uid:t,editors:n=!0}){let r=T(t),i=k(e.access),a=k(e.editors);return{...e,uid:e.uid||t,access:i.includes(r)?i:[...i,r],editors:n&&!a.includes(r)?[...a,r]:a}}var de=e=>{if(typeof e==`number`)return Number.isFinite(e)?e:0;if(e&&typeof e.toMillis==`function`){let t=e.toMillis();return Number.isFinite(t)?t:0}if(e&&typeof e.seconds==`number`)return e.seconds*1e3;if(typeof e==`string`){let t=Date.parse(e);return Number.isFinite(t)?t:0}return 0},fe=(e,t)=>de(t.createdAt)-de(e.createdAt)||e.id.localeCompare(t.id),M=(e,t)=>({...t,id:e,access:k(t?.access),editors:k(t?.editors)}),N=e=>e?.code===`permission-denied`?`These entries could not be read. The security rules may need pasting again from the Setup screen.`:`These entries could not be read just now.`;function pe(e,{max:t=200,mine:r=!1}={}){let{user:a,userRole:o,isAdmin:s,roleConfirmed:c}=n.Ft(),l=a?.uid||``,u=a?.emailVerified?D(a.email||``):`email:`,d=(0,y.useMemo)(()=>l?[...E(l,o),...u===`email:`?[]:[u]]:[],[l,o,u]),[f,p]=(0,y.useState)({loading:!0,records:[],error:``,forUid:``});return(0,y.useEffect)(()=>{if(!l||!c||!i.Tn(e))return;let a=!0,o=new Map,u=new Map,f=()=>{if(!a)return;let e=new Map;for(let t of o.values())for(let n of t)e.set(n.id,n);p({loading:!1,records:[...e.values()].sort(fe).slice(0,t),error:[...u.values()][0]||``,forUid:l})},m=e=>t=>{u.delete(e),o.set(e,t.docs.map(e=>M(e.id,e.data()))),f()},h=e=>t=>{e.startsWith(`email:`)||e.startsWith(`role:`)?o.set(e,[]):u.set(e,N(t)),f()},ee=s&&!r?[n.Zr(`${e}|all`,()=>(0,x.query)((0,x.collection)(n.ui,e)),m(`all`),h(`all`))]:d.map(t=>n.Zr(`${e}|${t}`,()=>(0,x.query)((0,x.collection)(n.ui,e),(0,x.where)(`access`,`array-contains`,t)),m(t),h(t)));return()=>{a=!1,ee.forEach(e=>e())}},[e,l,d,s,r,c,t]),(0,y.useMemo)(()=>!l||!i.Tn(e)?F(!1,[],``):!c||f.forUid!==l?F(!0,[],``):F(f.loading,f.records,f.error),[l,c,f,e])}var P=[`list`,`cases`,`entries`,`items`,`data`];function F(e,t,n){let r={loading:e,records:t,error:n};for(let e of P)Object.defineProperty(r,e,{value:t,enumerable:!1});return r}function I(e,{max:t=200}={}){let{user:r,roleConfirmed:a}=n.Ft(),o=r?.uid||``,[s,c]=(0,y.useState)({loading:!0,records:[],error:``,forUid:``});return(0,y.useEffect)(()=>{if(!o||!a||!i.Tn(e))return;let r=!0,s=n.Zr(`${e}|${O}`,()=>(0,x.query)((0,x.collection)(n.ui,e),(0,x.where)(`access`,`array-contains`,O)),e=>{r&&c({loading:!1,records:e.docs.map(e=>M(e.id,e.data())).sort(fe).slice(0,t),error:``,forUid:o})},e=>{r&&c({loading:!1,records:[],error:N(e),forUid:o})});return()=>{r=!1,s()}},[e,o,a,t]),(0,y.useMemo)(()=>!o||!i.Tn(e)?F(!1,[],``):!a||s.forUid!==o?F(!0,[],``):F(s.loading,s.records,s.error),[o,a,s,e])}function L(e,t){let{user:r,roleConfirmed:a}=n.Ft(),o=r?.uid||``,[s,c]=(0,y.useState)({loading:!0,record:null,error:``,forKey:``}),l=`${o}|${e}|${t}`;return(0,y.useEffect)(()=>{if(!o||!a||!i.Tn(e)||!t)return;let r=!0,s=(0,x.onSnapshot)((0,x.doc)(n.ui,e,t),e=>{r&&c({loading:!1,record:e.exists()?M(e.id,e.data()):null,error:``,forKey:l})},e=>{r&&c({loading:!1,record:null,error:me(e),forKey:l})});return()=>{r=!1,s()}},[e,t,o,a,l]),(0,y.useMemo)(()=>!o||!i.Tn(e)||!t?z(!1,null,``):!a||s.forKey!==l?z(!0,null,``):z(s.loading,s.record,s.error),[o,a,s,e,t,l])}var R=[`entry`,`item`,`thing`,`data`];function z(e,t,n){let r={loading:e,record:t,error:n};for(let e of R)Object.defineProperty(r,e,{value:t,enumerable:!1});return r}var me=e=>e?.code===`permission-denied`?`This one has not been shared with you.`:`This one could not be read just now.`,B=({people:e=[],roles:t=[]})=>{let n=[...e.map(T),...t.map(ce)].filter(e=>e!==`uid:`&&e!==`role:`);return[...new Set(n)]},V=`Entries can only be sent on a page where each entry says who sees it.`,H=e=>e?.code===`permission-denied`?`That entry is not yours to send on.`:`That entry could not be sent on just now.`;async function U(e,t,r){if(!i.Tn(e))return V;let a=B(r);if(!a.length||!t)return``;try{return await(0,x.updateDoc)((0,x.doc)(n.ui,e,t),{access:(0,x.arrayUnion)(...a),...r.canEdit===!1?{}:{editors:(0,x.arrayUnion)(...a)}}),``}catch(e){return H(e)}}async function he(e,t,r){if(!i.Tn(e))return V;let a=B(r);if(!a.length||!t)return``;try{return await(0,x.updateDoc)((0,x.doc)(n.ui,e,t),{access:(0,x.arrayRemove)(...a),editors:(0,x.arrayRemove)(...a)}),``}catch(e){return H(e)}}var W=`Only a page where each entry says who sees it can publish one.`,ge=e=>e?.code===`permission-denied`?`That one is not yours to publish.`:`That one could not be published just now.`;async function G(e,t){if(!i.Tn(e))return W;if(!t)return``;try{return await(0,x.updateDoc)((0,x.doc)(n.ui,e,t),{access:(0,x.arrayUnion)(O)}),``}catch(e){return ge(e)}}async function K(e,t){if(!i.Tn(e))return W;if(!t)return``;try{return await(0,x.updateDoc)((0,x.doc)(n.ui,e,t),{access:(0,x.arrayRemove)(O)}),``}catch(e){return ge(e)}}var q=[`waiting`,`uploading`],J=(e,t)=>t.aborted||e?.code===`storage/canceled`||e?.name===`AbortError`;async function _e(e,t,{customMetadata:r,onProgress:i,signal:a}={}){if(a?.aborted)throw Object.assign(Error(`The upload was stopped.`),{code:`storage/canceled`});let o=(0,S.ref)(n.fi,e),s=(0,S.uploadBytesResumable)(o,t,n.W(e,r)),c=()=>{s.cancel()};a?.addEventListener(`abort`,c,{once:!0});let l;try{await new Promise((e,t)=>{s.on(`state_changed`,e=>i?.(e.totalBytes?e.bytesTransferred/e.totalBytes:0),t,()=>e())}),i?.(1),l=await(0,S.getDownloadURL)(o)}catch(e){throw a?.aborted&&await Y(o),e}finally{a?.removeEventListener(`abort`,c)}if(a?.aborted)throw await Y(o),Object.assign(Error(`The upload was stopped.`),{code:`storage/canceled`});return l}var Y=async e=>{try{await(0,S.deleteObject)(e)}catch{}};function X(e,t){let n=e.flatMap((e,n)=>t.has(e)?[n]:[]),r=n.map(t=>e[t]).sort((e,n)=>t.get(e)-t.get(n)),i=[...e];return n.forEach((e,t)=>{i[e]=r[t]}),i}var Z=0,ve=class{items=[];running=new Map;listeners=new Set;options;constructor(e){this.options=e}configure(e){this.options=e}getItems=()=>this.items;subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});commit(e){this.items=e,xe(this,this.options.stopOnUnmount?e.filter(e=>q.includes(e.state)).length:0),this.listeners.forEach(e=>e())}patch(e,t){let n;return this.commit(this.items.map(r=>r.id===e?n={...r,...t}:r)),n}add(e,{start:t=!0}={}){let n=e.map(e=>({id:`upload_${++Z}`,seq:Z,file:e,name:e.name,state:t?`waiting`:`ready`,progress:0}));return n.length?(this.commit([...this.items,...n]),this.pump(),n):n}start(){this.items.some(e=>e.state===`ready`||e.state===`failed`)&&(this.commit(this.items.map(e=>e.state===`ready`||e.state===`failed`?{...e,state:`waiting`,progress:0,error:void 0}:e)),this.pump())}retry(e){this.items.find(t=>t.id===e)?.state===`failed`&&(this.patch(e,{state:`waiting`,progress:0,error:void 0}),this.pump())}rename(e,t){let n=this.items.find(t=>t.id===e);!n||n.state!==`ready`&&n.state!==`failed`||this.patch(e,{name:t})}remove(e){this.running.get(e)?.abort(),this.running.delete(e),this.commit(this.items.filter(t=>t.id!==e)),this.pump()}stopAll(){this.running.forEach(e=>e.abort()),this.running.clear(),this.commit(this.items.filter(e=>!q.includes(e.state)))}clear(){this.commit(this.items.filter(e=>q.includes(e.state)))}pump(){let e=Math.max(1,this.options.concurrency||4);for(let t of this.items){if(this.running.size>=e)break;t.state!==`waiting`||this.running.has(t.id)||this.run(t)}}run(e){let t=new AbortController;this.running.set(e.id,t);let r=this.patch(e.id,{state:`uploading`,progress:0}),i=0,a=e=>{if(t.signal.aborted)return;let n=Math.min(1,Math.max(0,Math.round(e*100)/100));n!==i&&(i=n,this.patch(r.id,{progress:n}))};Promise.resolve().then(()=>this.options.upload(r.file,{item:r,progress:a,signal:t.signal})).then(e=>{if(t.signal.aborted)return;let n=this.patch(r.id,{state:`done`,progress:1,result:e});if(n)try{this.options.onUploaded?.(e,n)}catch(e){console.warn(`${r.file.name}: onUploaded threw`,e)}},e=>{if(J(e,t.signal))return;console.warn(`${r.file.name}: the upload did not work (${e?.code||e?.message||e}).`);let i=this.patch(r.id,{state:`failed`,error:n.z(e)});if(i)try{this.options.onFailed?.(i)}catch(e){console.warn(`${r.file.name}: onFailed threw`,e)}}).finally(()=>{this.running.get(r.id)===t&&this.running.delete(r.id),this.pump(),!this.running.size&&!this.items.some(e=>q.includes(e.state))&&this.options.onSettled?.(this.items)})}},Q=new Map,ye=0,be=new Set;function xe(e,t){let n=Q.get(e)||0;n!==t&&(t?Q.set(e,t):Q.delete(e),ye+=t-n,be.forEach(e=>e()))}var Se=()=>ye;function Ce(e){return be.add(e),()=>{be.delete(e)}}var we=()=>(0,y.useSyncExternalStore)(Ce,Se,()=>0);function Te(e){let t=t=>e.filter(e=>e.state===t).length,n=e.filter(e=>q.includes(e.state)),r=e.filter(e=>e.state!==`ready`),i=r.reduce((e,t)=>e+(t.file.size||1),0),a=r.reduce((e,t)=>e+(t.file.size||1)*(t.state===`done`?1:t.progress),0);return{total:e.length,ready:t(`ready`),waiting:t(`waiting`),uploading:t(`uploading`),done:t(`done`),failed:t(`failed`),active:n.length,busy:n.length>0,progress:i?a/i:0}}function Ee(e){let[t]=(0,y.useState)(()=>new ve(e));(0,y.useLayoutEffect)(()=>{t.configure(e)});let n=!!e.stopOnUnmount;(0,y.useEffect)(()=>n?()=>t.stopAll():void 0,[t,n]);let r=(0,y.useSyncExternalStore)(t.subscribe,t.getItems,t.getItems),i=Te(r);return(0,y.useEffect)(()=>{if(!i.busy||typeof window>`u`)return;let e=e=>{e.preventDefault(),e.returnValue=``};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[i.busy]),{items:r,...i,add:(e,n)=>t.add(e,n),start:()=>t.start(),retry:e=>t.retry(e),rename:(e,n)=>t.rename(e,n),remove:e=>t.remove(e),clear:()=>t.clear()}}var De=`${n.M}/pages`,Oe=`${n.j}/pages`,ke=(0,y.createContext)(null),Ae=ke.Provider,je=()=>(0,y.useContext)(ke)||{prefix:``};function Me({prefix:e,shared:t=!1,internal:n=!1,collection:r=``,recordId:i=``}){return!e||e===`pub_`?Oe:t?n?De:Oe:e===`case_`?g.n(r,i):g.i(e)}var Ne=(e,t={})=>`${Date.now()}_${Math.random().toString(36).slice(2,8)}_${h.g(t.width,t.height)}${(e||`file`).replace(/[^a-zA-Z0-9.-]/g,`_`)}`;async function Pe(e,{prefix:t,shared:r=!1,user:i,onProgress:a,signal:o,collection:s=``,recordId:c=``}){let l=Me({prefix:t,shared:r,internal:!!i?.internal,collection:s,recordId:c});if(!l)throw Error(`This page keeps files with the entry they belong to, and no entry was named.`);if(!i&&l!==Oe)throw Error(`Sign in again before uploading.`);let u=await h._(e);if(!i?.admin&&u.size>=10485760)throw Error(`That file is over 10 MB. Try a smaller one.`);let d=await n.Y(u),f=`${l}/${Ne(u.name,d)}`,p=await _e(f,u,{customMetadata:i?{ownerId:i.uid}:void 0,onProgress:a,signal:o}),m=await n.R(f,u,i?{ownerId:i.uid}:void 0);return{url:p,storagePath:f,name:u.name,type:u.type||``,size:u.size,...d.width&&d.height?{width:d.width,height:d.height}:{},...m}}async function Fe(e){try{await(0,S.deleteObject)((0,S.ref)(n.fi,e)),await n.F(e)}catch(t){console.warn(`${e}: the upload was dropped but the file stayed (${t?.code||t}).`)}}var Ie=e=>e===i.pn;function Le(){let{user:e,userRole:t}=n.Ft(),r=e?.uid||``;return(0,y.useMemo)(()=>r?E(r,t):[],[r,t])}var Re=e=>{try{let t=(0,x.doc)((0,x.collection)(n.ui,e)).id;if(t)return t}catch{}return`rec_${Date.now()}_${Math.random().toString(36).slice(2,8)}`},ze=(e,t,n)=>Ie(e)?g.n(t,n||``):g.i(e);function Be(e,t){return ue({createdAt:Date.now(),...e},{uid:t})}function Ve(e,t,n,r=``){let i=t.find(e=>e.startsWith(`role:`))?.slice(5)||null,a=e=>n?i===`admin`||le(e,t):!0;return{sendTo:(t,n)=>U(e,t,n),takeBack:(t,n)=>he(e,t,n),keys:t,canEdit:a,canDelete:e=>a(e)&&_.d(e,i),canSend:e=>n&&a(e)&&_.f(e,i),publish:t=>G(e,t),unpublish:t=>K(e,t),isPublished:e=>n?A(e):!1,draftId:n?r:``}}var He=`user_profiles`,Ue=`Viewing`,We=`Everyone`,Ge=e=>{let t=[];return e.forEach(e=>{let n=e.data()||{};n.inactive===!0||n.removed===!0||t.push({uid:e.id,name:v.n(n)})}),t.sort((e,t)=>e.name.localeCompare(t.name))};function Ke(e){let{isAdmin:t,roleConfirmed:r}=n.Ft(),[i,a]=(0,y.useState)([]),o=e&&t&&r!==!1;return(0,y.useEffect)(()=>{if(!o)return;let e=!0,t=n.Zr(He,()=>(0,x.collection)(n.ui,He),t=>{e&&a(Ge(t))},()=>{e&&a([])});return()=>{e=!1,t()}},[o]),o?i:[]}var qe=`You are looking at somebody else’s page. Anything you add here is theirs, but a file would stay yours — so uploads are off until you switch back to your own.`;function Je({on:e,everyone:t=!0}){let{user:r,isAdmin:i}=n.Ft(),a=r?.uid||``,o=Ke(e),[s,c]=(0,y.useState)(``),l=e&&i&&o.length>0,u=s&&o.some(e=>e.uid===s),d=l&&(u||s===``&&t)?s:``,f=l&&t&&d===``,p=(0,y.useMemo)(()=>[...t?[{value:``,label:We}]:[],...o.map(e=>({value:e.uid,label:e.uid===a?`${e.name} (you)`:e.name}))],[t,o,a]);return{uid:f?``:d||a,everyone:f,someoneElse:!!d&&d!==a,control:l?(0,b.jsx)(n.Z,{dense:!0,compact:!0,portal:!0,direction:`auto`,className:`console-select`,ariaLabel:Ue,value:d||(t?``:a),options:p,onChange:e=>c(e)}):null}}function Ye({viewing:e}){return e.control?(0,b.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,b.jsx)(c.t,{className:`w-3.5 h-3.5 shrink-0 text-foreground/45`}),(0,b.jsx)(`span`,{className:`text-[12.5px] font-semibold text-foreground/50 select-none whitespace-nowrap max-sm:hidden`,children:Ue}),e.control]}):null}var Xe=`inline-flex items-center justify-center w-9 h-9 rounded-full border border-[var(--panel-border)] text-foreground/50 hover:text-accent hover:bg-foreground/5 transition-colors shrink-0 cursor-pointer`,Ze=({to:e})=>e?(0,b.jsx)(te.Link,{to:e,"aria-label":`Go back`,title:`Go back`,className:Xe,children:(0,b.jsx)(o.t,{className:`w-4 h-4`})}):(0,b.jsx)(`button`,{type:`button`,onClick:()=>window.history.back(),"aria-label":`Go back`,title:`Go back`,className:Xe,children:(0,b.jsx)(o.t,{className:`w-4 h-4`})});function Qe({file:e,className:t,alt:n=``}){let r=(0,y.useRef)(null);return(0,y.useEffect)(()=>{if(!r.current||typeof URL.createObjectURL!=`function`)return;let t=URL.createObjectURL(e);return r.current.src=t,()=>URL.revokeObjectURL(t)},[e]),(0,b.jsx)(`img`,{ref:r,alt:n,className:t,"data-fbos-own":!0})}var $e=e=>{if(!e)return`0 B`;let t=1024,n=[`B`,`KB`,`MB`,`GB`],r=Math.floor(Math.log(e)/Math.log(t));return parseFloat((e/t**+r).toFixed(2))+` `+n[r]},$=500;function et({title:e=`Drive`,subtitle:a=`/drive`,backUrl:o,filesCollection:c=`pub_files`,config:_,customContent:v,footer:ne,addition:C}){let{user:w,userRole:oe}=n.Ft(),T=!!_,ce=oe===`admin`,E=c,D=c.startsWith(`user_`),O=i.Tn(c),k=Le(),A=Je({on:c.startsWith(`user_`)&&!i.Tn(c)}),j=pe(c),[ue,de]=(0,y.useState)([]),[fe,M]=(0,y.useState)(!0),N=O?j.records.map(e=>({...e,_id:e.id})):ue,P=O?j.loading:fe,[F,I]=(0,y.useState)(null),[L,R]=(0,y.useState)(null),[z,me]=(0,y.useState)(!1),[B,V]=(0,y.useState)(null),[H,U]=(0,y.useState)(null),[he,W]=(0,y.useState)(!1),[ge,G]=(0,y.useState)(!1);(0,y.useEffect)(()=>{if(!(D&&!w)&&!O)return M(!0),(0,x.onSnapshot)(D&&!A.everyone?(0,x.query)((0,x.collection)(n.ui,c),(0,x.where)(`uid`,`==`,A.uid||w.uid),(0,x.limit)($)):(0,x.query)((0,x.collection)(n.ui,c),(0,x.orderBy)(`createdAt`,`desc`),(0,x.limit)($)),e=>{let t=e.docs.map(e=>({_id:e.id,...e.data()}));t.sort((e,t)=>(t.createdAt?.toMillis?.()||0)-(e.createdAt?.toMillis?.()||0)),de(t),M(!1)},e=>{console.warn(`Error listening to ${c}:`,e),M(!1)})},[c,D,w?.uid,O,A.uid,A.everyone]);let K=e=>O?le(e,k):!!w&&(e.uid===w.uid||ce),q=Ee({upload:async(e,t)=>{if(!w)throw Error(`Sign in again before uploading.`);let r=await h._(e),i=O?Re(c):``,a=`${O?g.n(c,i):E}/${Ne(r.name)}`,o=await _e(a,r,{customMetadata:{ownerId:w.uid},onProgress:t.progress,signal:t.signal}),s={fileName:t.item.name.trim()||r.name,fileType:r.type||`unknown`,fileSize:r.size,downloadURL:o,storagePath:a,uid:w.uid,uploaderEmail:w.email||``};O?await(0,x.setDoc)((0,x.doc)(n.ui,c,i),Be(s,w.uid)):await(0,x.addDoc)((0,x.collection)(n.ui,c),{...s,createdAt:(0,x.serverTimestamp)()})},onSettled:e=>{e.length&&e.every(e=>e.state===`done`)&&(W(!1),q.clear())}}),J=q.total-q.ready,Y=e=>{if(!e||!w||A.someoneElse)return;let t=Array.isArray(e)?e:`length`in e?Array.from(e):[e];t.length&&(q.add(t,{start:!1}),W(!0))},X=()=>{A.someoneElse||W(!0)},Z=()=>{q.clear(),W(!1)},ve=e=>{let t=Array.from(e.target.files||[]);e.target.value=``,Y(t)},Q=q.done?`${q.done} of ${J} uploaded`:`Uploading ${J===1?`your file`:`${J} files`}`,ye=q.ready?q.ready===1?`Upload`:`Upload ${q.ready} files`:q.busy?`${Q}…`:q.failed?`Try again`:`Uploaded`,be=async()=>{if(L){me(!0);try{await Promise.all([(0,S.deleteObject)((0,S.ref)(n.fi,L.storagePath||L.downloadURL)).catch(e=>console.warn(`Storage object missing:`,e)),n.F(L.storagePath||``),(0,x.deleteDoc)((0,x.doc)(n.ui,c,L._id))]),R(null)}catch(e){console.error(`Delete failed:`,e)}me(!1)}},xe=async()=>{if(!B||!B.name.trim()){V(null);return}try{await(0,x.updateDoc)((0,x.doc)(n.ui,c,B.id),{fileName:B.name.trim()})}catch(e){console.error(`Rename failed:`,e)}V(null)},Se=(e,t)=>{navigator.clipboard.writeText(e),U(t),setTimeout(()=>U(null),2e3)},Ce=(e,t=`row`)=>{let n=t===`card`?`w-16 h-16`:`w-10 h-10`,r=t===`card`?`w-8 h-8`:`w-5 h-5`;return e.includes(`video`)||e.includes(`audio`)?(0,b.jsx)(`div`,{className:`${n} flex items-center justify-center bg-accent/10 text-accent rounded-lg`,children:(0,b.jsx)(se,{className:r})}):e.includes(`pdf`)||e.includes(`word`)||e.includes(`text`)?(0,b.jsx)(`div`,{className:`${n} flex items-center justify-center bg-blue-500/10 text-blue-500 rounded-lg`,children:(0,b.jsx)(s.u,{className:r})}):e.includes(`zip`)||e.includes(`rar`)||e.includes(`archive`)?(0,b.jsx)(`div`,{className:`${n} flex items-center justify-center bg-yellow-500/10 text-yellow-500 rounded-lg`,children:(0,b.jsx)(re,{className:r})}):e.includes(`html`)||e.includes(`csv`)||e.includes(`json`)?(0,b.jsx)(`div`,{className:`${n} flex items-center justify-center bg-emerald-500/10 text-emerald-500 rounded-lg`,children:(0,b.jsx)(ie,{className:r})}):(0,b.jsx)(`div`,{className:`${n} flex items-center justify-center bg-foreground/5 text-foreground/40 rounded-lg`,children:(0,b.jsx)(s.l,{className:r})})};return(0,b.jsxs)(`main`,{className:`flex-1 w-full max-w-7xl mx-auto p-4 pt-2 md:p-8 md:pt-4 flex flex-col min-h-screen relative`,onDragOver:e=>{e.preventDefault(),G(!0)},onDragLeave:e=>{e.preventDefault(),G(!1)},onDrop:e=>{e.preventDefault(),G(!1),e.dataTransfer.files?.length&&Y(e.dataTransfer.files)},children:[(0,b.jsxs)(n.nt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:`mb-4 md:mb-6 flex items-center gap-3`,children:[!T&&(0,b.jsx)(Ze,{to:o}),(0,b.jsxs)(`div`,{className:`min-w-0`,children:[(0,b.jsx)(t.t,{children:e}),(0,b.jsxs)(`div`,{className:`max-sm:hidden sm:flex items-center gap-2 text-foreground/40 font-bold uppercase tracking-[0.2em] text-[11px]`,children:[(0,b.jsx)(`span`,{className:`w-8 h-[1px] bg-foreground/10`}),a]})]})]}),T&&(0,b.jsx)(`div`,{className:`mb-6`,children:(0,b.jsx)(r.t,{})}),C&&(0,b.jsx)(`div`,{className:`mb-6 empty:hidden`,children:C}),(0,b.jsxs)(`div`,{className:`glass-panel border border-[var(--panel-border)] rounded-2xl md:rounded-3xl overflow-hidden flex-1 shadow-2xl min-h-[420px] md:min-h-[520px] mb-16 bg-background flex flex-col`,children:[(0,b.jsxs)(`div`,{className:`p-4 md:p-8 flex items-center justify-between gap-3 md:gap-6 border-b border-[var(--panel-border)]/50 bg-background/50`,children:[(0,b.jsxs)(`div`,{className:`min-w-0`,children:[(0,b.jsx)(`h2`,{className:`text-lg md:text-2xl font-bold text-foreground tracking-tight`,children:`Files`}),(0,b.jsx)(`p`,{className:`max-sm:hidden text-[12px] md:text-[13px] mt-1 md:mt-2 text-foreground/60 font-medium`,children:A.someoneElse?qe:O?`A file here is seen by the people it is sent to, and nobody else.`:A.everyone?`You are seeing everybody’s files. Anything you add is your own.`:D?`Only you can see the files you upload here.`:`Everyone who can open this page can see these files.`})]}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,b.jsx)(Ye,{viewing:A}),!v&&!A.someoneElse&&(w?(0,b.jsxs)(m.t,{onClick:X,title:q.busy?Q:`Add files`,className:`flex items-center justify-center gap-2 w-9 h-9 p-0 sm:w-auto sm:h-auto sm:px-5 sm:py-2.5 rounded-xl text-[13px] font-bold shadow-md shrink-0`,children:[q.busy?(0,b.jsx)(u.r,{className:`w-4 h-4 animate-spin`}):(0,b.jsx)(d.t,{className:`w-4 h-4`}),(0,b.jsx)(`span`,{className:`max-sm:hidden`,children:q.busy?Q:`Add files`})]}):(0,b.jsxs)(te.Link,{to:`/login`,title:`Sign in to add files`,className:`btn-primary flex items-center justify-center gap-2 w-9 h-9 p-0 sm:w-auto sm:h-auto sm:px-5 sm:py-2.5 rounded-xl text-[13px] font-bold shadow-md shrink-0`,children:[(0,b.jsx)(d.t,{className:`w-4 h-4`}),` `,(0,b.jsx)(`span`,{className:`max-sm:hidden`,children:`Add files`})]}))]})]}),v?(0,b.jsx)(Ae,{value:{prefix:i.Mn(_||{}),collection:O?c:``,recordId:``},children:(0,b.jsx)(`div`,{className:`fbos-content-slot fbos-tab-fill p-4 md:p-8 flex-1`,children:(0,b.jsx)(p.p,{size:`part`,children:(0,b.jsx)(v,{files:N,loading:P,error:O?j.error:``,user:w,uploadFile:Y,deleteFile:R,openUploadModal:X,viewFile:I,config:_,...Ve(c,k,O)})})})}):(0,b.jsxs)(`div`,{className:`p-4 sm:p-6 md:p-8 flex-1 relative`,children:[P&&(0,b.jsx)(`div`,{className:`absolute inset-0 z-10 flex items-center justify-center bg-background/50 backdrop-blur-sm`,children:(0,b.jsx)(u.r,{className:`w-8 h-8 text-accent animate-spin`})}),N.length>0?(0,b.jsxs)(`div`,{className:`grid grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3 sm:gap-4`,children:[N.map(e=>(0,b.jsxs)(`div`,{className:`flex flex-col bg-background border border-[var(--panel-border)] rounded-2xl hover:border-accent/40 transition-all group overflow-hidden shadow-sm h-[190px] relative`,children:[(0,b.jsxs)(`div`,{className:`absolute top-2 right-2 flex flex-col gap-1 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 transition-opacity z-10 bg-background/90 backdrop-blur-md rounded-lg p-1 border border-[var(--panel-border)] shadow-xl`,children:[(0,b.jsx)(`a`,{href:e.downloadURL,download:!0,target:`_blank`,rel:`noreferrer`,className:`p-1.5 hover:bg-foreground/5 rounded-md text-foreground/60 hover:text-blue-500 transition-colors`,title:`Download`,children:(0,b.jsx)(s.d,{className:`w-4 h-4`})}),(0,b.jsx)(`button`,{onClick:t=>{t.stopPropagation(),Se(e.downloadURL,e._id)},className:`p-1.5 hover:bg-foreground/5 rounded-md text-foreground/60 hover:text-emerald-500 transition-colors`,title:`Copy link`,children:H===e._id?(0,b.jsx)(n.At,{className:`w-4 h-4 text-emerald-500`}):(0,b.jsx)(ae,{className:`w-4 h-4`})}),K(e)&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`button`,{onClick:t=>{t.stopPropagation(),V({id:e._id,name:e.fileName})},className:`p-1.5 hover:bg-foreground/5 rounded-md text-foreground/60 hover:text-accent transition-colors`,title:`Rename`,children:(0,b.jsx)(s.s,{className:`w-4 h-4`})}),(0,b.jsx)(`button`,{onClick:t=>{t.stopPropagation(),R(e)},className:`p-1.5 hover:bg-red-500/10 rounded-md text-foreground/60 hover:text-red-500 transition-colors`,title:`Delete`,children:(0,b.jsx)(f.t,{className:`w-4 h-4`})})]})]}),(0,b.jsx)(`div`,{className:`h-[120px] w-full border-b border-[var(--panel-border)]/50 bg-foreground/[0.02] flex items-center justify-center overflow-hidden relative cursor-pointer`,onClick:()=>I(e),children:e.fileType.startsWith(`image/`)?(0,b.jsx)(n.O,{src:e.downloadURL,small:e.smallURL,medium:e.mediumURL,alt:``,fit:`contain`,className:`absolute inset-0`,imgClassName:`p-2`}):Ce(e.fileType,`card`)}),(0,b.jsxs)(`div`,{className:`p-3 flex flex-col justify-center flex-1 min-w-0`,onClick:()=>!B&&I(e),children:[B?.id===e._id?(0,b.jsx)(`input`,{autoFocus:!0,type:`text`,value:B.name,onChange:e=>V({...B,name:e.target.value}),onBlur:xe,onKeyDown:e=>{e.key===`Enter`&&xe(),e.key===`Escape`&&V(null)},onClick:e=>e.stopPropagation(),className:`no-glow text-[12.5px] font-bold text-foreground bg-transparent border-b border-accent/30 outline-none pb-0.5 w-full`}):(0,b.jsx)(`span`,{className:`text-[12.5px] font-bold text-foreground truncate select-none group-hover:text-accent transition-colors`,title:e.fileName,children:e.fileName}),(0,b.jsx)(`span`,{className:`text-[11px] text-foreground/40 font-bold uppercase tracking-wider mt-1 select-none`,children:$e(e.fileSize)})]})]},e._id)),N.length>=$&&(0,b.jsxs)(`p`,{className:`col-span-full text-[12px] font-medium text-foreground/45 text-center pt-2`,children:[`Showing the `,$,` newest files. Older ones are still here — search or open them from a link.`]})]}):!P&&(0,b.jsxs)(`div`,{onClick:()=>w&&X(),className:`min-h-[320px] flex flex-col items-center justify-center text-center cursor-pointer group`,children:[(0,b.jsx)(t.v,{className:`w-12 h-12 text-foreground/15 mb-4`}),(0,b.jsx)(`p`,{className:`text-[20px] font-bold text-foreground/50 group-hover:text-foreground/70 transition-colors`,children:`No files yet`}),(0,b.jsx)(`p`,{className:`text-[13px] font-medium mt-1 text-foreground/40`,children:w?`Click here or drag files in to upload`:`Sign in to upload files`})]})]})]}),ne,(0,b.jsx)(n.rt,{children:he&&(0,b.jsxs)(`div`,{className:`fixed inset-0 z-[120] flex items-center justify-center p-4`,children:[(0,b.jsx)(n.nt.div,{onClick:Z,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:`absolute inset-0 bg-background/80 backdrop-blur-xl cursor-pointer`}),(0,b.jsxs)(n.nt.div,{role:`dialog`,"aria-modal":`true`,"aria-label":`Upload files`,initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:`w-full max-w-[520px] max-h-[calc(100dvh-2rem)] border-[var(--panel-border)] border rounded-3xl relative z-10 glass-panel shadow-2xl flex flex-col bg-background`,children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between p-4 md:p-6 border-b border-[var(--panel-border)]/50 shrink-0`,children:[(0,b.jsx)(`span`,{className:`text-[16px] font-extrabold text-foreground tracking-tight`,children:q.total>1?`Upload ${q.total} files`:`Upload files`}),(0,b.jsx)(`button`,{onClick:Z,"aria-label":`Close`,className:`text-foreground/40 hover:text-foreground transition-colors`,children:(0,b.jsx)(u.t,{className:`w-5 h-5`})})]}),q.total?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`ul`,{className:`flex flex-col gap-2 p-4 md:p-6 overflow-y-auto min-h-0`,children:q.items.map(e=>{let t=e.state===`waiting`||e.state===`uploading`,r=e.state===`ready`||e.state===`failed`;return(0,b.jsxs)(`li`,{className:`flex items-center gap-3 bg-foreground/[0.03] p-3 rounded-2xl border border-[var(--panel-border)]`,children:[e.file.type.startsWith(`image/`)?(0,b.jsx)(Qe,{file:e.file,className:`w-10 h-10 shrink-0 rounded-lg object-cover bg-foreground/5`}):Ce(e.file.type),(0,b.jsxs)(`div`,{className:`flex flex-col flex-1 min-w-0 gap-1`,children:[r?(0,b.jsx)(`input`,{type:`text`,value:e.name,onChange:t=>q.rename(e.id,t.target.value),"aria-label":`Name for ${e.file.name}`,className:`no-glow w-full bg-transparent border-b border-transparent hover:border-[var(--panel-border)] focus:border-accent/50 outline-none text-[13px] font-bold text-foreground pb-0.5 transition-colors`}):(0,b.jsx)(`span`,{className:`text-[13px] font-bold text-foreground truncate pb-0.5`,children:e.name}),t?(0,b.jsx)(`span`,{role:`progressbar`,"aria-label":`Uploading ${e.name}`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(e.progress*100),className:`block h-1.5 w-full rounded-full bg-foreground/10 overflow-hidden my-1`,children:(0,b.jsx)(`span`,{className:`block h-full rounded-full bg-accent transition-[width] duration-200`,style:{width:`${Math.max(e.state===`waiting`?0:4,e.progress*100)}%`}})}):e.state===`failed`?(0,b.jsx)(`span`,{className:`text-[11.5px] font-semibold text-red-500 truncate`,title:e.error,children:e.error}):(0,b.jsxs)(`span`,{className:`text-[11px] text-foreground/50 font-bold uppercase tracking-wider`,children:[$e(e.file.size),e.state===`done`?` · Uploaded`:``]})]}),e.state===`done`?(0,b.jsx)(n.At,{className:`w-4 h-4 mx-2 text-emerald-500 shrink-0`,"aria-hidden":!0}):(0,b.jsxs)(`div`,{className:`flex items-center shrink-0`,children:[e.state===`failed`&&(0,b.jsx)(`button`,{type:`button`,onClick:()=>q.retry(e.id),"aria-label":`Try ${e.name} again`,title:`Try again`,className:`w-8 h-8 flex items-center justify-center text-foreground/40 hover:text-accent rounded-xl hover:bg-accent/10 transition-colors`,children:(0,b.jsx)(l.n,{className:`w-4 h-4`})}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>q.remove(e.id),"aria-label":`${t?`Stop`:`Remove`} ${e.name}`,title:t?`Stop`:`Remove`,className:`w-8 h-8 flex items-center justify-center text-foreground/40 hover:text-red-500 rounded-xl hover:bg-red-500/10 transition-colors`,children:t?(0,b.jsx)(u.t,{className:`w-4 h-4`}):(0,b.jsx)(f.t,{className:`w-4 h-4`})})]})]},e.id)})}),(0,b.jsxs)(`div`,{className:`p-4 md:p-6 pt-3 md:pt-4 border-t border-[var(--panel-border)]/50 flex flex-col gap-3 shrink-0`,children:[q.failed>0&&(0,b.jsxs)(`p`,{className:`text-[13px] font-medium text-red-400 bg-red-500/10 border border-red-500/20 rounded-xl p-3`,children:[q.failed===1?`One file did not upload.`:`${q.failed} files did not upload.`,` Try again, or take it off the list.`]}),(0,b.jsxs)(`div`,{className:`flex items-stretch gap-2`,children:[(0,b.jsxs)(`label`,{title:`Add more files`,className:`btn-secondary flex items-center justify-center gap-2 px-4 rounded-xl text-[13px] font-bold cursor-pointer shrink-0`,children:[(0,b.jsx)(d.t,{className:`w-4 h-4`}),` `,(0,b.jsx)(`span`,{className:`max-sm:hidden`,children:`Add more`}),(0,b.jsx)(`input`,{type:`file`,multiple:!0,"aria-label":`Add more files`,onChange:ve,className:`sr-only`})]}),(0,b.jsxs)(m.t,{type:`button`,onClick:q.start,disabled:!q.ready&&!q.failed,className:`flex-1 py-4 rounded-xl text-[14px] font-bold shadow-lg`,children:[q.busy&&!q.ready&&(0,b.jsx)(u.r,{className:`w-4 h-4 animate-spin`}),ye]})]})]})]}):(0,b.jsx)(`div`,{className:`p-4 md:p-6`,children:(0,b.jsxs)(`label`,{className:`group flex flex-col items-center justify-center gap-1.5 px-6 py-12 rounded-2xl border-2 border-dashed border-[var(--panel-border)] bg-foreground/[0.015] hover:border-accent/50 hover:bg-accent/[0.03] cursor-pointer text-center transition-all`,children:[(0,b.jsx)(`span`,{className:`w-14 h-14 rounded-full bg-accent/10 text-accent flex items-center justify-center mb-2 group-hover:scale-105 transition-transform`,children:(0,b.jsx)(t.v,{className:`w-6 h-6`})}),(0,b.jsxs)(`p`,{className:`text-[15px] font-bold text-foreground`,children:[(0,b.jsx)(`span`,{className:`text-accent`,children:`Click to upload`}),` or drag files in`]}),(0,b.jsx)(`p`,{className:`text-[12.5px] text-foreground/45 font-medium`,children:`Pictures, documents, anything — as many as you like`}),(0,b.jsx)(`input`,{type:`file`,multiple:!0,"aria-label":`Choose files to upload`,onChange:ve,className:`sr-only`})]})})]})]})}),(0,b.jsx)(s.t,{open:!!F,onClose:()=>I(null),src:F?.downloadURL||``,name:F?.fileName,type:F?.fileType,actions:F&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`button`,{type:`button`,onClick:()=>Se(F.downloadURL,F._id),className:`h-9 w-9 shrink-0 rounded-xl flex items-center justify-center text-foreground/65 hover:text-emerald-500 hover:bg-foreground/[0.06] transition-colors cursor-pointer`,title:`Copy link`,"aria-label":`Copy link`,children:H===F._id?(0,b.jsx)(n.At,{className:`w-4 h-4 text-emerald-500`}):(0,b.jsx)(ae,{className:`w-4 h-4`})}),K(F)&&(0,b.jsx)(`button`,{type:`button`,onClick:()=>{let e=F;I(null),R(e)},className:`h-9 w-9 shrink-0 rounded-xl flex items-center justify-center text-foreground/65 hover:text-red-500 hover:bg-red-500/10 transition-colors cursor-pointer`,title:`Delete`,"aria-label":`Delete`,children:(0,b.jsx)(f.t,{className:`w-4 h-4`})})]})}),(0,b.jsx)(ee.t,{isOpen:!!L,title:`Delete file`,message:(0,b.jsxs)(b.Fragment,{children:[`Delete `,(0,b.jsx)(`strong`,{className:`text-foreground block my-1 break-words max-w-full text-center`,children:L?.fileName}),` This cannot be undone.`]}),onConfirm:be,onCancel:()=>R(null),isProcessing:z,confirmText:`Yes, delete`}),(0,b.jsx)(n.rt,{children:ge&&(0,b.jsx)(n.nt.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:`fixed inset-0 z-[1000] bg-background/60 backdrop-blur-md pointer-events-none flex items-center justify-center p-6`,children:(0,b.jsxs)(`div`,{className:`w-full max-w-lg aspect-video bg-background/80 border-2 border-dashed border-accent rounded-[40px] shadow-2xl flex flex-col items-center justify-center gap-6`,children:[(0,b.jsx)(`div`,{className:`w-20 h-20 rounded-full bg-accent/10 flex items-center justify-center text-accent`,children:(0,b.jsx)(t.v,{className:`w-10 h-10 animate-bounce`})}),(0,b.jsx)(`span`,{className:`text-[24px] font-extrabold text-foreground tracking-tight`,children:`Drop to upload`})]})})})]})}Object.defineProperty(exports,`A`,{enumerable:!0,get:function(){return G}}),Object.defineProperty(exports,`B`,{enumerable:!0,get:function(){return ie}}),Object.defineProperty(exports,`C`,{enumerable:!0,get:function(){return le}}),Object.defineProperty(exports,`D`,{enumerable:!0,get:function(){return ce}}),Object.defineProperty(exports,`E`,{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,`F`,{enumerable:!0,get:function(){return pe}}),Object.defineProperty(exports,`I`,{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,`L`,{enumerable:!0,get:function(){return ue}}),Object.defineProperty(exports,`M`,{enumerable:!0,get:function(){return he}}),Object.defineProperty(exports,`N`,{enumerable:!0,get:function(){return K}}),Object.defineProperty(exports,`O`,{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,`P`,{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,`R`,{enumerable:!0,get:function(){return se}}),Object.defineProperty(exports,`S`,{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,`T`,{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,`V`,{enumerable:!0,get:function(){return re}}),Object.defineProperty(exports,`_`,{enumerable:!0,get:function(){return je}}),Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return Ye}}),Object.defineProperty(exports,`b`,{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return Ie}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return ze}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return Le}}),Object.defineProperty(exports,`g`,{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(exports,`h`,{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return qe}}),Object.defineProperty(exports,`j`,{enumerable:!0,get:function(){return U}}),Object.defineProperty(exports,`k`,{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return Be}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return Fe}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return Qe}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return Je}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return Ze}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return Ve}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return et}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return Re}}),Object.defineProperty(exports,`v`,{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,`w`,{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,`x`,{enumerable:!0,get:function(){return we}}),Object.defineProperty(exports,`y`,{enumerable:!0,get:function(){return _e}}),Object.defineProperty(exports,`z`,{enumerable:!0,get:function(){return ae}});
@@ -1,21 +1,21 @@
1
1
  import { _ as e, g as t } from "./mediaKind-BtaMpGy8.js";
2
- import { t as n, v as r } from "./PageTitle-DFGW71q8.js";
3
- import { At as i, F as a, Ft as o, M as s, O as c, R as l, W as u, Y as d, Z as f, Zr as p, fi as m, j as h, nt as g, rt as ee, ui as _, z as v } from "./TimeZoneField-Dv389mAe.js";
4
- import { t as te } from "./DashboardNav-B0G943ux.js";
2
+ import { t as n, v as r } from "./PageTitle-DCoUQWw6.js";
3
+ import { At as i, F as a, Ft as o, M as s, O as c, R as l, W as u, Y as d, Z as f, Zr as p, fi as m, j as h, nt as g, rt as ee, ui as _, z as v } from "./TimeZoneField-oIMwb5_X.js";
4
+ import { t as te } from "./DashboardNav-CEd8gGPm.js";
5
5
  import { Ln as ne, Mn as re, Tn as y, pn as ie } from "./schedule-C13m_kiO.js";
6
6
  import { n as b } from "./chevron-down--LwXEv9w.js";
7
7
  import { t as ae } from "./arrow-left-DdRja6es.js";
8
- import { d as oe, l as se, s as ce, t as le, u as ue } from "./FileViewerPopup-Dnl3td2o.js";
8
+ import { d as oe, l as se, s as ce, t as le, u as ue } from "./FileViewerPopup-gqhRT22v.js";
9
9
  import { t as x } from "./eye-DBR-sZWU.js";
10
- import { n as de } from "./VideoPlayer-DB0oz6lM.js";
10
+ import { n as de } from "./VideoPlayer-QI1Jc3bS.js";
11
11
  import { r as fe, t as pe } from "./x-hax8aKt8.js";
12
12
  import { t as me } from "./plus-BKrt0Qx5.js";
13
13
  import { t as he } from "./trash-6Wj66gJi.js";
14
- import { p as ge } from "./contentFallback-C6xLwXTs.js";
15
- import { t as _e } from "./Button-DSldWACF.js";
16
- import { t as ve } from "./ConfirmModal-C1dM-bzk.js";
17
- import { i as S, n as ye } from "./pageFiles-D-GYqRgZ.js";
18
- import { d as be, f as C } from "./recordLock-Dnz61J-_.js";
14
+ import { p as ge } from "./contentFallback-BGGpI1Ts.js";
15
+ import { t as _e } from "./Button-BGN6q7lY.js";
16
+ import { t as ve } from "./ConfirmModal-BW9e6Y7d.js";
17
+ import { i as S, n as ye } from "./pageFiles-ZFPSCDZz.js";
18
+ import { d as be, f as C } from "./recordLock-CMOiezNC.js";
19
19
  import { n as xe } from "./personName-DeDpef0M.js";
20
20
  import { createContext as Se, useContext as Ce, useEffect as w, useLayoutEffect as we, useMemo as T, useRef as E, useState as D, useSyncExternalStore as O } from "react";
21
21
  import { Fragment as Te, jsx as k, jsxs as A } from "react/jsx-runtime";
@@ -1,9 +1,9 @@
1
- import { a as e, i as t, o as n, r, t as i } from "./PageTitle-DFGW71q8.js";
2
- import { C as a, b as o, g as s, nt as c, o as l, y as u } from "./TimeZoneField-Dv389mAe.js";
3
- import { N as d, t as f } from "./DashboardNav-B0G943ux.js";
4
- import { t as p } from "./SupportBar-528kXe-Z.js";
5
- import { n as m } from "./VideoPlayer-DB0oz6lM.js";
6
- import { t as h } from "./ConfirmModal-C1dM-bzk.js";
1
+ import { a as e, i as t, o as n, r, t as i } from "./PageTitle-DCoUQWw6.js";
2
+ import { C as a, b as o, g as s, nt as c, o as l, y as u } from "./TimeZoneField-oIMwb5_X.js";
3
+ import { N as d, t as f } from "./DashboardNav-CEd8gGPm.js";
4
+ import { t as p } from "./SupportBar-DI_XbEsG.js";
5
+ import { n as m } from "./VideoPlayer-QI1Jc3bS.js";
6
+ import { t as h } from "./ConfirmModal-BW9e6Y7d.js";
7
7
  import { useState as g } from "react";
8
8
  import { jsx as _, jsxs as v } from "react/jsx-runtime";
9
9
  import { Link as y } from "react-router-dom";
@@ -0,0 +1 @@
1
+ require(`./chunk-CiTBaPhY.cjs`);const e=require(`./ThemeAdmin-DkgmjW3g.cjs`);exports.ThemeAdmin=e.r;
@@ -0,0 +1,2 @@
1
+ import { r as e } from "./ThemeAdmin-Cnqefrz6.js";
2
+ export { e as ThemeAdmin };
@@ -1,3 +1,3 @@
1
- const e=require(`./chunk-CiTBaPhY.cjs`),t=require(`./PageTitle-BWmE74WQ.cjs`),n=require(`./TimeZoneField-zR8N2Fj0.cjs`),r=require(`./DashboardNav-DOl9gJuu.cjs`),i=require(`./SupportBar-CNVXSYwT.cjs`),a=require(`./VideoPlayer-BVOkrJBR.cjs`),o=require(`./ConfirmModal-CQ73WYUg.cjs`);let s=require(`react`);s=e.a(s,1);let c=require(`react/jsx-runtime`),l=require(`react-router-dom`);var u=`fbos_theme_ai_draft`,d=u,f=()=>{try{return JSON.parse(localStorage.getItem(d)||`{}`)}catch{return{}}},p=e=>{let t=String(e?.defaultTheme||``).trim();return t===`light`||t===`dark`?t:null},m=`My logo is attached to this message as a picture. Read the colours straight out of that picture and build this look from them — that is what matching my logo means. If no picture reached you, say so and ask me for it, rather than picking colours of your own.`,h=`Do it all in one file: src/your-ai-workflow-firebase-os/configs/theme.config.ts — the colours, the typefaces and how rounded things are. Do not restyle by rewriting components, and do not put colours or a font of your own anywhere else.`,g=`Choose the typefaces too, in the same file: fonts: { display, body } — a display face for the headings and a body face for everything else, each a Google Fonts family name spelled exactly as Google Fonts spells it, since the app loads it from there. Pick them for THIS brief the way you picked the colours: a luxury label, a playful shop and a law firm do not share a face, and the pair should look chosen together — the display face may be a serif, a slab, a geometric or a light grotesque, whatever the brief is about, while the body face stays easy to read at small sizes in both modes. Leaving fonts empty gives Inter, the face the app shipped in, which is the one choice that looks like no design at all.`,_=`Use every colour the picture has, not just one. The accent is the one that stands out most — never one close to the accent the file holds now, so the change is plain to see — and the others go into the button fade, the heading gradient, the notification dot, the tint behind panels and the highlight behind selected text. Even the two backgrounds carry a faint wash of the logo instead of plain white or black. Read the exact shades off the picture; do not round them to the nearest colour you already know.`,v=`Mix a palette of your own for this brief — more than one colour. The accent is the colour my brief is most about — the one its words and its mood lead with, not simply the loudest, and never one close to the accent the file holds now, so the change is plain to see — and the others go into the button fade, the heading gradient, the notification dot, the tint behind panels and the highlight behind selected text. Even the two backgrounds carry a faint wash of the palette instead of plain white or black.`,y=`Be as bold as my brief allows and decide everything yourself: this is your design, and a look that could pass for a default is the one thing I do not want. Mix each shade for this look. A swatch you know by heart from Tailwind, Material or any other stock palette — #38bdf8, #0f172a, #f8fafc and their kind — means you did not look, so mix your own instead. Keep text readable on its background in both modes.`,b=`Every mode needs these five: background, backgroundSecondary, foreground, accent and buttonText. The other colours the file allows — the button fade and its hover, the quiet button, panel fill and edge, the focus glow, the notification dot, the heading gradient, and the highlight behind text someone selects together with the colour of that selected text — are yours to set wherever the look calls for them, and a colourful look wants the button fade, the heading gradient and the selection highlight at the least: selected text left in a colour from the look before is the first thing people notice. Where I have named a colour myself, use my exact value. Anything left in the file that you did not choose for this look, delete rather than keep: a colour left over from the look before is what makes a new theme come out wrong.`,x=`A colour I ask for is set in the dark colours and the light colours both, and where I name one, use my exact value. If the change touches the accent, the highlight behind selected text follows it. Mix any new shade; never a stock swatch.`,S=(e,t)=>String(e||``).trim()===String(t||``).trim(),C=(e,t)=>e===`light`||e===`dark`?t.defaultTheme===e&&t.showThemeToggle===!1:e===`system`?t.defaultTheme===`system`:!1,w=(e,t)=>{if(!t)return e;let n={...e};return S(e.appName,t.appName)&&delete n.appName,S(e.logoUrl,t.logoUrl)&&delete n.logoUrl,S(e.faviconUrl,t.faviconUrl)&&delete n.faviconUrl,C(String(e.defaultTheme||``).trim(),t)&&delete n.defaultTheme,n},T=`Before you tell me it is done, read the file back: if background, backgroundSecondary, foreground or accent is still the value it held when you started, in either mode, then you have not done what I asked — go and set it. And if every value you wrote is a stock swatch, you have not designed anything — go back and mix your own.`,E=e=>{let t=p(e),n=`That is ten values at the least — five in dark, five in light — and every one of them changes: the colours in that file now are the look I am replacing, so a colour you leave where it is is the mistake I am trying to avoid.`;if(t){let e=t===`light`?`dark`:`light`;return`My site is ${t} only, so the ${t} colours are the ones everyone sees — design those with the most care. Set the ${e} colours as well, the same look ${e===`dark`?`at night`:`by day`}, since the file needs both. ${n}`}return`Set the dark colours and the light colours both, so my site reads well either way — the same hues in both, dark mode being the same look at night, not a second palette. ${n}`},D=e=>{let t=String(e?.brief||``).trim(),n=String(e?.logoUrl||``).trim()!==``;return[...[`Design the look of my whole app. Here is what I am after: ${t||`___`}`,...n?[m]:[],h,E(e),n?_:v,y,g,b,...j(e),T],...M].join(`
1
+ const e=require(`./chunk-CiTBaPhY.cjs`),t=require(`./PageTitle-DQkvCB11.cjs`),n=require(`./TimeZoneField-Ckn1pKAL.cjs`),r=require(`./DashboardNav-GgEUpyTa.cjs`),i=require(`./SupportBar-DLWruzQb.cjs`),a=require(`./VideoPlayer-CggwpVXH.cjs`),o=require(`./ConfirmModal-BUNtss4a.cjs`);let s=require(`react`);s=e.a(s,1);let c=require(`react/jsx-runtime`),l=require(`react-router-dom`);var u=`fbos_theme_ai_draft`,d=u,f=()=>{try{return JSON.parse(localStorage.getItem(d)||`{}`)}catch{return{}}},p=e=>{let t=String(e?.defaultTheme||``).trim();return t===`light`||t===`dark`?t:null},m=`My logo is attached to this message as a picture. Read the colours straight out of that picture and build this look from them — that is what matching my logo means. If no picture reached you, say so and ask me for it, rather than picking colours of your own.`,h=`Do it all in one file: src/your-ai-workflow-firebase-os/configs/theme.config.ts — the colours, the typefaces and how rounded things are. Do not restyle by rewriting components, and do not put colours or a font of your own anywhere else.`,g=`Choose the typefaces too, in the same file: fonts: { display, body } — a display face for the headings and a body face for everything else, each a Google Fonts family name spelled exactly as Google Fonts spells it, since the app loads it from there. Pick them for THIS brief the way you picked the colours: a luxury label, a playful shop and a law firm do not share a face, and the pair should look chosen together — the display face may be a serif, a slab, a geometric or a light grotesque, whatever the brief is about, while the body face stays easy to read at small sizes in both modes. Leaving fonts empty gives Inter, the face the app shipped in, which is the one choice that looks like no design at all.`,_=`Use every colour the picture has, not just one. The accent is the one that stands out most — never one close to the accent the file holds now, so the change is plain to see — and the others go into the button fade, the heading gradient, the notification dot, the tint behind panels and the highlight behind selected text. Even the two backgrounds carry a faint wash of the logo instead of plain white or black. Read the exact shades off the picture; do not round them to the nearest colour you already know.`,v=`Mix a palette of your own for this brief — more than one colour. The accent is the colour my brief is most about — the one its words and its mood lead with, not simply the loudest, and never one close to the accent the file holds now, so the change is plain to see — and the others go into the button fade, the heading gradient, the notification dot, the tint behind panels and the highlight behind selected text. Even the two backgrounds carry a faint wash of the palette instead of plain white or black.`,y=`Be as bold as my brief allows and decide everything yourself: this is your design, and a look that could pass for a default is the one thing I do not want. Mix each shade for this look. A swatch you know by heart from Tailwind, Material or any other stock palette — #38bdf8, #0f172a, #f8fafc and their kind — means you did not look, so mix your own instead. Keep text readable on its background in both modes.`,b=`Every mode needs these five: background, backgroundSecondary, foreground, accent and buttonText. The other colours the file allows — the button fade and its hover, the quiet button, panel fill and edge, the focus glow, the notification dot, the heading gradient, and the highlight behind text someone selects together with the colour of that selected text — are yours to set wherever the look calls for them, and a colourful look wants the button fade, the heading gradient and the selection highlight at the least: selected text left in a colour from the look before is the first thing people notice. Where I have named a colour myself, use my exact value. Anything left in the file that you did not choose for this look, delete rather than keep: a colour left over from the look before is what makes a new theme come out wrong.`,x=`A colour I ask for is set in the dark colours and the light colours both, and where I name one, use my exact value. If the change touches the accent, the highlight behind selected text follows it. Mix any new shade; never a stock swatch.`,S=(e,t)=>String(e||``).trim()===String(t||``).trim(),C=(e,t)=>e===`light`||e===`dark`?t.defaultTheme===e&&t.showThemeToggle===!1:e===`system`?t.defaultTheme===`system`:!1,w=(e,t)=>{if(!t)return e;let n={...e};return S(e.appName,t.appName)&&delete n.appName,S(e.logoUrl,t.logoUrl)&&delete n.logoUrl,S(e.faviconUrl,t.faviconUrl)&&delete n.faviconUrl,C(String(e.defaultTheme||``).trim(),t)&&delete n.defaultTheme,n},T=`Before you tell me it is done, read the file back: if background, backgroundSecondary, foreground or accent is still the value it held when you started, in either mode, then you have not done what I asked — go and set it. And if every value you wrote is a stock swatch, you have not designed anything — go back and mix your own.`,E=e=>{let t=p(e),n=`That is ten values at the least — five in dark, five in light — and every one of them changes: the colours in that file now are the look I am replacing, so a colour you leave where it is is the mistake I am trying to avoid.`;if(t){let e=t===`light`?`dark`:`light`;return`My site is ${t} only, so the ${t} colours are the ones everyone sees — design those with the most care. Set the ${e} colours as well, the same look ${e===`dark`?`at night`:`by day`}, since the file needs both. ${n}`}return`Set the dark colours and the light colours both, so my site reads well either way — the same hues in both, dark mode being the same look at night, not a second palette. ${n}`},D=e=>{let t=String(e?.brief||``).trim(),n=String(e?.logoUrl||``).trim()!==``;return[...[`Design the look of my whole app. Here is what I am after: ${t||`___`}`,...n?[m]:[],h,E(e),n?_:v,y,g,b,...j(e),T],...M].join(`
2
2
  `)},O=(e,t)=>{let n=String(e?.changes||``).trim(),r=w(e||{},t);return[...[`My app already has a look I am happy with, in one file: src/your-ai-workflow-firebase-os/configs/theme.config.ts.`,`Change that one file, and change only what I ask for below — everything else in it stays exactly as it is: how rounded things are, fonts (unless my words are about the type), and every colour I have not mentioned. Do not tidy up, rebalance or improve anything I did not ask about, or restyle by rewriting components.`,x,`Here is what I would like changed: ${n||`___`}`,...j(r,`change`)],...M].join(`
3
3
  `)},k=e=>{let t=String(e?.defaultTheme||``).trim();return t===`light`||t===`dark`?`In that same file, set defaultTheme to '${t}' and showThemeToggle to false: my site is ${t} only, and visitors get no switch.`:t===`system`?`In that same file, set defaultTheme to 'system', so my site opens in whichever mode the visitor's device already uses, and leave showThemeToggle as it is.`:`Leave defaultTheme exactly as it is — how my site opens is not part of this job, and changing it is not a redesign.`},A=`The empty space round that picture has already been cut away, and the top bar shows it whole, sized to the bar. Wherever you draw it yourself, size and place it as you see fit — but always the whole picture (fit="contain"), never cropped, never padded out, never redrawn and never with any part of it cut off.`,j=(e,t=`design`)=>{let n=String(e?.appName||``).trim(),r=String(e?.logoUrl||``).trim(),i=String(e?.faviconUrl||``).trim(),a=[`light`,`dark`,`system`].includes(String(e?.defaultTheme||``).trim()),o=a||t===`design`?[k(e)]:[];if(n&&o.push(`In that same file, set appName to exactly: ${n}`),r&&(o.push(`In that same file, set logoUrl to exactly this link: ${r} — that is my logo for the top bar. Use my link character for character, and never swap it for a placeholder or a picture of your own.`),o.push(A)),i&&o.push(i===r?`Set faviconUrl to that same link — it is my browser tab icon too.`:`In that same file, set faviconUrl to exactly this link: ${i} — that is my browser tab icon. Use my link character for character.`),t===`change`){let e=[...r?[]:[`logoUrl`],...i?[]:[`faviconUrl`],...n?[]:[`appName`],...a?[]:[`defaultTheme and showThemeToggle`]];if(e.length){let t=e.length>1?`${e.slice(0,-1).join(`, `)} and ${e[e.length-1]}`:e[0];o.push(`Leave ${t} exactly as they are — not part of this change.`)}return o}return!r&&!i?o.push(`Leave logoUrl and faviconUrl exactly as they are. The logo and the browser tab icon are mine, and my Theme screen is the only place they change.`):r?i||o.push(`Leave faviconUrl exactly as it is — my browser tab icon is mine, and my Theme screen is the only place it changes.`):o.push(`Leave logoUrl exactly as it is — my logo is mine, and my Theme screen is the only place it changes.`),o},M=[`Tell me what you picked and why, in one short paragraph.`],N=(e,t=`design`)=>t===`change`?String(e?.changes||``).trim()?``:`Say what you would like changed, and this sentence is ready to copy.`:String(e?.brief||``).trim()?``:`Say what look you are after, and this sentence is ready to copy.`;function P(){let{activeConfig:e}=r.N(),[u,p]=(0,s.useState)(f),[m,h]=(0,s.useState)(()=>f().mode===`change`?`change`:`design`),g=e=>{h(e),p(t=>{let n={...t};e===`change`?n.mode=`change`:delete n.mode;try{localStorage.setItem(d,JSON.stringify(n))}catch{}return n})},_=(e,t)=>p(n=>{let r={...n,[e]:t};try{localStorage.setItem(d,JSON.stringify(r))}catch{}return r}),[v,y]=(0,s.useState)(!1),[b,x]=(0,s.useState)(null),[S,C]=(0,s.useState)(0),w=e=>C(t=>Math.max(0,t+(e?1:-1))),T=()=>{y(!0);try{localStorage.removeItem(d),localStorage.removeItem(`theme-mode`),localStorage.removeItem(`last-seen-default-theme`),localStorage.removeItem(`theme_saved_cache`)}catch{}p({}),h(`design`),setTimeout(()=>y(!1),600)};return(0,c.jsxs)(`main`,{className:`flex-1 w-full max-w-7xl mx-auto p-4 pt-2 md:p-8 md:pt-4 z-10 flex flex-col min-h-screen`,children:[(0,c.jsxs)(n.nt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:`mb-6`,children:[(0,c.jsx)(t.t,{children:`Theme`}),(0,c.jsxs)(`div`,{className:`flex items-center gap-2 text-foreground/40 font-bold uppercase tracking-[0.2em] text-[11px]`,children:[(0,c.jsx)(`span`,{className:`w-8 h-[1px] bg-foreground/10`}),`/theme`]})]}),(0,c.jsxs)(`div`,{className:`flex flex-col gap-6 flex-1 pb-16`,children:[(0,c.jsx)(r.t,{}),(0,c.jsx)(`div`,{className:`glass-panel border border-[var(--panel-border)] rounded-3xl p-4 sm:p-5 md:p-8 shadow-2xl relative bg-background flex flex-col fbos-tab-fill`,children:(0,c.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,c.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,c.jsxs)(`div`,{className:`min-w-0`,children:[(0,c.jsx)(`h2`,{className:`text-[17px] sm:text-xl font-bold text-foreground tracking-tight`,children:m===`change`?`Change it with your assistant`:`Design it with your assistant`}),(0,c.jsxs)(`p`,{className:`text-[12.5px] sm:text-[13.5px] font-medium text-foreground/55 mt-1 sm:mt-1.5`,children:[(0,c.jsx)(`span`,{className:`sm:hidden`,children:`Fill these in for your assistant.`}),(0,c.jsx)(`span`,{className:`max-sm:hidden`,children:m===`change`?`Say what to change, then copy the sentence below into your assistant’s chat. Nothing you do not mention is touched.`:`Fill these in, then copy the sentence below into your assistant’s chat. It designs the whole look — colours, corners, logo — and there is nothing to set by hand.`})]})]}),(0,c.jsxs)(`div`,{className:`shrink-0 flex items-center gap-2`,children:[(0,c.jsx)(n.C,{to:`/`,title:`View your app`,children:`View app`}),(0,c.jsx)(n.o,{icon:a.n,tone:`danger`,compact:!0,busy:v,title:`Start the whole look again`,onClick:()=>x({title:`Start the whole look again?`,message:`Your answers here clear and the sentence goes back to designing the whole look. Your theme file is not touched — copy the new sentence to your assistant to change it.`,apply:T}),children:`Start again`})]})]}),(0,c.jsx)(t.a,{label:`Logo`,hint:`The picture in the top bar. Attach this same picture in your assistant's chat — it cannot open the link, and the picture is where the colours come from.`,value:u.logoUrl||``,onChange:e=>_(`logoUrl`,e),tips:t.i,whole:!0,trim:!0,onBusyChange:w}),(0,c.jsx)(t.a,{label:`Browser tab icon`,hint:`The tiny picture on the browser tab.`,value:u.faviconUrl||``,onChange:e=>_(`faviconUrl`,e),tips:t.r,whole:!0,onBusyChange:w}),(0,c.jsx)(n.b,{label:`App name`,hint:`It goes in the top bar and on the browser tab.`,value:u.appName||``,onChange:e=>_(`appName`,e),placeholder:`Bright Studio`}),(0,c.jsx)(n.g,{label:`Light or dark`,hint:`Which one your app opens in. Always light or always dark means that one mode and no switch for visitors; otherwise whichever the visitor already uses on their device, with a switch.`,value:u.defaultTheme||``,onChange:e=>_(`defaultTheme`,e),placeholder:`Leave it as it is`,options:[{value:`system`,label:`Whatever their device uses`},{value:`light`,label:`Always light`},{value:`dark`,label:`Always dark`}]}),m===`change`?(0,c.jsx)(n.y,{label:`What would you like changed?`,hint:`Name just the parts you want moved. Everything else stays as it is.`,value:u.changes||``,onChange:e=>_(`changes`,e),placeholder:`Make the buttons a softer green, and warm up the page background a little. Leave the cards as they are.`}):(0,c.jsx)(n.y,{label:`What look would you like?`,hint:`What you do, who it is for, and the feeling you are after. Your assistant designs the rest — the more feeling you give it, the further it goes.`,value:u.brief||``,onChange:e=>_(`brief`,e),placeholder:`A calm, modern look for a small physiotherapy clinic. Soft greens, lots of white space, nothing shouty. Rounded corners.`}),(0,c.jsx)(t.o,{title:`Copy this to your assistant`,prompt:m===`change`?O(u,e):D(u),locked:!!N(u,m),busy:S>0,onCopied:m===`change`?void 0:()=>g(`change`)}),(0,c.jsxs)(`p`,{className:`text-[11.5px] text-foreground/45 font-medium leading-snug px-1`,children:[`That sentence is the only way the look changes — there is nothing to set by hand here. Uploads are kept on your`,` `,(0,c.jsx)(l.Link,{to:`/assets`,className:`text-accent font-bold hover:underline`,children:`Assets page`}),` `,`too; edit the fields and copy the sentence again any time.`]})]})})]}),(0,c.jsx)(i.t,{}),(0,c.jsx)(o.t,{isOpen:!!b,title:b?.title||``,message:b?.message||``,confirmText:`Start again`,cancelText:`Keep it`,isProcessing:v,onCancel:()=>x(null),onConfirm:()=>{b?.apply(),x(null)}})]})}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return A}});