efficient-shell 15.6.0 → 15.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/README.md +12 -6
  2. package/dist/{Browser-MBT76EKF.js → Browser-FEZ2X7B5.js} +13 -13
  3. package/dist/Calculator-MBHZSFJ6.js +29 -0
  4. package/dist/CurrencyConverter-7FPB7WJE.js +21 -0
  5. package/dist/{Files-G5VBN3GD.js → Files-DHTF6LGF.js} +61 -61
  6. package/dist/Notepad-KS37VSPL.js +24 -0
  7. package/dist/{PdfViewer-AIAVQYZ6.js → PdfViewer-KS2BCFSA.js} +1 -1
  8. package/dist/PomodoroTimer-TYSJOYDJ.js +91 -0
  9. package/dist/{Preview-4VKAQ4TY.js → Preview-NXCA3X4S.js} +24 -24
  10. package/dist/Sidebar-IU4EG3D3.js +44 -0
  11. package/dist/{Stock-6YYK6VWP.js → Stock-Y74YC25V.js} +6 -6
  12. package/dist/{Weather-2OU3LEWQ.js → Weather-EO4LYAPA.js} +22 -22
  13. package/dist/{WorldClock-PYJ4762U.js → WorldClock-3E3KLHSD.js} +7 -7
  14. package/dist/ai/index.js +35 -35
  15. package/dist/apps/ImageAnnotator.js +1 -1
  16. package/dist/apps/index.js +1 -1
  17. package/dist/bin/browser-check.js +1 -1
  18. package/dist/bin/media-host-check.js +1 -1
  19. package/dist/bin/ui-check.js +1 -1
  20. package/dist/brand.css +1 -1
  21. package/dist/charts/FlowChart.js +1 -1
  22. package/dist/{chunk-LFUXWZV7.js → chunk-2EBHJGMM.js} +1 -1
  23. package/dist/chunk-37FQVY2O.js +2 -0
  24. package/dist/chunk-3AUPCKBR.js +1 -0
  25. package/dist/{chunk-VHBRVW5O.js → chunk-3OK5VZOU.js} +3 -3
  26. package/dist/{chunk-UYM7562M.js → chunk-43YU7YWL.js} +2 -2
  27. package/dist/{chunk-XYVFJLAU.js → chunk-452LT77I.js} +1 -1
  28. package/dist/chunk-4YH7U7WL.js +1 -0
  29. package/dist/{chunk-KERCZSIA.js → chunk-54WCVNJJ.js} +1 -1
  30. package/dist/{chunk-OK2J6WSC.js → chunk-6ZQC6XFU.js} +1 -1
  31. package/dist/{chunk-A3RD7AQ2.js → chunk-7AF5JGRM.js} +1 -1
  32. package/dist/{chunk-RIA6KKIB.js → chunk-7EPCBDS5.js} +6 -6
  33. package/dist/{chunk-4NTAZLT3.js → chunk-7KUHILEA.js} +3 -3
  34. package/dist/{chunk-N3T5BE2T.js → chunk-ATTQTQJI.js} +9 -9
  35. package/dist/chunk-AYTGYEOI.js +8 -0
  36. package/dist/{chunk-S6C7X6CR.js → chunk-AZANUXJT.js} +16 -16
  37. package/dist/{chunk-QSFQTMWV.js → chunk-BGLUOC7W.js} +1 -1
  38. package/dist/{chunk-D7MRZZVV.js → chunk-BYTQRQ5P.js} +1 -1
  39. package/dist/{chunk-DVKOVZJ2.js → chunk-DFI5EHSV.js} +12 -12
  40. package/dist/{chunk-GUUBFQ6L.js → chunk-DYJQIZX2.js} +2 -2
  41. package/dist/{chunk-KTI4ZJVX.js → chunk-GNB6KUCT.js} +1 -1
  42. package/dist/chunk-GURLMAZM.js +3 -0
  43. package/dist/{chunk-NICH2O4C.js → chunk-GYY7GS2I.js} +1 -1
  44. package/dist/chunk-GZ4AMXEU.js +1 -0
  45. package/dist/{chunk-GUOAPXUY.js → chunk-GZ57F6PN.js} +4 -4
  46. package/dist/{chunk-OQAGCYR7.js → chunk-HPDNKHIO.js} +3 -3
  47. package/dist/chunk-IDH323EU.js +6 -0
  48. package/dist/{chunk-5OXQ5M5S.js → chunk-JKO4JZPO.js} +1 -1
  49. package/dist/{chunk-YEDAXZYO.js → chunk-JU6VBLTU.js} +1 -1
  50. package/dist/{chunk-ZVKUOJNS.js → chunk-JUGRSO5J.js} +1 -1
  51. package/dist/{chunk-PCNFY6EK.js → chunk-LH7ZKPHJ.js} +12 -12
  52. package/dist/{chunk-5QHNDAZ6.js → chunk-LLXI57MB.js} +1 -1
  53. package/dist/chunk-LRASKGEZ.js +4 -0
  54. package/dist/chunk-LYGIOJ3J.js +1 -0
  55. package/dist/{chunk-V62FEHS4.js → chunk-MDXZ7YAC.js} +1 -1
  56. package/dist/{chunk-62UNBUTU.js → chunk-NO5BMPT5.js} +1 -1
  57. package/dist/{chunk-3AVXNZY5.js → chunk-NPBRNEMR.js} +1 -1
  58. package/dist/chunk-OHRKENEP.js +69 -0
  59. package/dist/{chunk-JRKD7SD3.js → chunk-OLXUMB2V.js} +16 -16
  60. package/dist/chunk-ONUNFTZD.js +11 -0
  61. package/dist/{chunk-KIIZNION.js → chunk-OX7Q5PPR.js} +5 -5
  62. package/dist/{chunk-ASNRA3ZL.js → chunk-P7X4PWJJ.js} +1 -1
  63. package/dist/chunk-PLJB4H3G.js +1 -0
  64. package/dist/{chunk-UMIRPFQJ.js → chunk-QD7IODP2.js} +1 -1
  65. package/dist/{chunk-NM7U42KL.js → chunk-QO2CN2ND.js} +8 -8
  66. package/dist/{chunk-QSOBETAI.js → chunk-QY2DGLCJ.js} +6 -6
  67. package/dist/chunk-R7OZ2AQD.js +6 -0
  68. package/dist/{chunk-U7PA4KNZ.js → chunk-RBOGLXMV.js} +8 -8
  69. package/dist/{chunk-OEWBWKKD.js → chunk-SWH3IEUT.js} +9 -9
  70. package/dist/{chunk-LGVVXYW7.js → chunk-SYASK4QG.js} +1 -1
  71. package/dist/{chunk-YXMXATYP.js → chunk-THVE54FN.js} +1 -1
  72. package/dist/{chunk-TEYG2W7A.js → chunk-TM5NQTFA.js} +2 -2
  73. package/dist/{chunk-FQ3SYDKI.js → chunk-US7F3NC3.js} +1 -1
  74. package/dist/{chunk-OZNCUWYB.js → chunk-V77UETV3.js} +1 -1
  75. package/dist/{chunk-I2NVBDKH.js → chunk-VLT4ZEHT.js} +1 -1
  76. package/dist/chunk-WUNZBM53.js +28 -0
  77. package/dist/chunk-XNPCOWOO.js +89 -0
  78. package/dist/{chunk-EULBBS5L.js → chunk-XOEYCDWT.js} +1 -1
  79. package/dist/{chunk-QJ3X2PHY.js → chunk-YCA2XXAB.js} +1 -1
  80. package/dist/{chunk-AKEED2BC.js → chunk-YQKNRT7L.js} +1 -1
  81. package/dist/{chunk-QYOIS4BN.js → chunk-ZKWAWQ74.js} +3 -3
  82. package/dist/chunk-ZLB5GRL6.js +1 -0
  83. package/dist/{chunk-3C2VY2VF.js → chunk-ZV2ZAHZV.js} +1 -1
  84. package/dist/data/EntityList.js +1 -1
  85. package/dist/data/ListLoadError.js +1 -1
  86. package/dist/format/index.d.ts +15 -1
  87. package/dist/format/index.js +1 -1
  88. package/dist/forms/BorderInput.js +1 -1
  89. package/dist/forms/BrandAssetEditor.js +1 -1
  90. package/dist/forms/Button.d.ts +1 -0
  91. package/dist/forms/Button.js +1 -1
  92. package/dist/forms/ColorPicker.js +1 -1
  93. package/dist/forms/ComposerAttachments.js +1 -1
  94. package/dist/forms/CornersInput.js +1 -1
  95. package/dist/forms/DateRangePicker.js +1 -1
  96. package/dist/forms/IconButton.js +1 -1
  97. package/dist/forms/IconPicker.js +1 -1
  98. package/dist/forms/Input.js +1 -1
  99. package/dist/forms/InputNumber.js +1 -1
  100. package/dist/forms/LinkPicker.js +1 -1
  101. package/dist/forms/MediaLibrary.js +1 -1
  102. package/dist/forms/MediaUsedInList.js +1 -1
  103. package/dist/forms/NumericKeypad.js +1 -1
  104. package/dist/forms/PositionInput.js +1 -1
  105. package/dist/forms/RenameField.js +1 -1
  106. package/dist/forms/SearchInput.js +1 -1
  107. package/dist/forms/SidesInput.js +1 -1
  108. package/dist/forms/Slider.js +1 -1
  109. package/dist/forms/Snippet.js +1 -1
  110. package/dist/forms/SplitButton.js +1 -1
  111. package/dist/forms/TextToolbar.js +1 -1
  112. package/dist/forms/WidthsBar.js +1 -1
  113. package/dist/forms/buttonStyles.d.ts +8 -1
  114. package/dist/forms/buttonStyles.js +1 -1
  115. package/dist/hooks/index.d.ts +42 -1
  116. package/dist/hooks/index.js +1 -1
  117. package/dist/index.d.ts +117 -75
  118. package/dist/index.js +662 -662
  119. package/dist/map/index.js +3 -3
  120. package/dist/motion.css +9 -4
  121. package/dist/page-tabs/index.js +5 -5
  122. package/dist/pdf/index.js +1 -1
  123. package/dist/routine-index.json +1 -1
  124. package/dist/shell/AppUpdateBanner.js +1 -1
  125. package/dist/shell/ConfirmDialog.js +1 -1
  126. package/dist/shell/Dialog.js +1 -1
  127. package/dist/shell/Drawer.js +1 -1
  128. package/dist/shell/HelpCenter.js +1 -1
  129. package/dist/shell/ImageLightbox.js +1 -1
  130. package/dist/shell/Markdown.js +1 -1
  131. package/dist/shell/Popover.js +1 -1
  132. package/dist/shell/SearchableSelect.js +1 -1
  133. package/dist/shell/discardGuard.js +1 -1
  134. package/dist/shell/toast.js +1 -1
  135. package/dist/telemetry/index.js +1 -1
  136. package/dist/templates/AuthScreen.js +1 -1
  137. package/dist/templates/ChatTemplate.js +1 -1
  138. package/dist/templates/CheckoutTemplate.js +1 -1
  139. package/dist/templates/DashboardTemplate.js +1 -1
  140. package/dist/templates/DataTablePage.js +1 -1
  141. package/dist/templates/EmailTemplate.js +1 -1
  142. package/dist/templates/ErrorBoundary.js +1 -1
  143. package/dist/templates/FormLayoutPage.js +1 -1
  144. package/dist/templates/GalleryTemplate.js +1 -1
  145. package/dist/ui/index.js +1 -1
  146. package/dist/value-index.json +1 -1
  147. package/dist/version.js +1 -1
  148. package/package.json +1 -1
  149. package/dist/Calculator-PAMITD4N.js +0 -29
  150. package/dist/CurrencyConverter-UAZYLLHT.js +0 -21
  151. package/dist/Notepad-23YBRLDH.js +0 -24
  152. package/dist/PomodoroTimer-QFF2FTAG.js +0 -91
  153. package/dist/Sidebar-KAALEIIX.js +0 -44
  154. package/dist/chunk-345FP3IX.js +0 -4
  155. package/dist/chunk-5RCKE4X2.js +0 -6
  156. package/dist/chunk-6ZNJ6JU5.js +0 -28
  157. package/dist/chunk-A4ROXNUF.js +0 -2
  158. package/dist/chunk-APFDZ2HG.js +0 -1
  159. package/dist/chunk-DEV3ZHPP.js +0 -8
  160. package/dist/chunk-IN36HWJK.js +0 -1
  161. package/dist/chunk-MQNSKFZY.js +0 -11
  162. package/dist/chunk-QXEZBS3H.js +0 -6
  163. package/dist/chunk-R6YVKP6D.js +0 -3
  164. package/dist/chunk-TDUOBP55.js +0 -69
  165. package/dist/chunk-UQYNPYF4.js +0 -1
  166. package/dist/chunk-XRWUNOI3.js +0 -92
  167. /package/dist/{chunk-TEQ5ZPAL.js → chunk-NQWORKZD.js} +0 -0
@@ -1,91 +0,0 @@
1
- import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-3C2VY2VF.js";import{subscribePomo as o,getPomoSnapshot as n,setPomoDurations as a,setPomoAlarm as r,setPomoAlarmConfig as s,setPomoBehaviour as i,setPomoFocusSound as l,useTodoTasks as c,pomodoroToday as u,migratePomodoroTasksOnce as m,pomoSwitchMode as d,pomoPause as h,pomoStart as p,ALARM_OPTIONS as g,playAlarm as k,FOCUS_SOUND_OPTIONS as f,previewFocusSound as b}from"./chunk-GUUBFQ6L.js";import{PLACEHOLDER_INK as x}from"./chunk-AYZY3YNC.js";import{formatTime as v}from"./chunk-NHKT5IH6.js";import"./chunk-36BRD5J3.js";import"./chunk-JRQMX4PK.js";import{pad2 as y}from"./chunk-LF27WIN2.js";import{useWidgetSettings as N}from"./chunk-XRWUNOI3.js";import"./chunk-4LXCCZDM.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-PSVGB7KT.js";import"./chunk-YI4T5I5D.js";import"./chunk-TTD2M6RF.js";import"./chunk-5A7MWTXX.js";import"./chunk-TJ5YMXVB.js";import"./chunk-JRKD7SD3.js";import"./chunk-5RCKE4X2.js";import"./chunk-EIFNESXS.js";import"./chunk-PO2KNVCC.js";import"./chunk-CJ4OEY3T.js";import"./chunk-5QHNDAZ6.js";import"./chunk-TEQ5ZPAL.js";import"./chunk-VWGWZY7A.js";import"./chunk-DBQNYJZ6.js";import"./chunk-L2WQOJ3T.js";import"./chunk-5VJVEKVM.js";import"./chunk-YPXONNBV.js";import"./chunk-4PJFL26P.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import{useShellPrefs as C}from"./chunk-POBVGDZP.js";import"./chunk-F3ZOO23R.js";import"./chunk-NJY4HPNB.js";import"./chunk-PM6HY5BH.js";import"./chunk-DWGYC7OD.js";import"./chunk-APFDZ2HG.js";import"./chunk-ABIWAS5K.js";import"./chunk-P56YLT73.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import"./chunk-A4ROXNUF.js";import"./chunk-TSZPGDU3.js";import{Icon as j}from"./chunk-ISVODSRP.js";import"./chunk-J75ZT2JQ.js";import"./chunk-R2VKEMZH.js";import"./chunk-BWJZTHZ6.js";import"./chunk-FAPZFMS3.js";import"./chunk-CIZAUBWA.js";import"./chunk-PGN5ME7B.js";import"./chunk-5QRHQCRG.js";import"./chunk-62LW225J.js";import"./chunk-TAHHZGRH.js";import"./chunk-KEFNQEXZ.js";import"./chunk-PU2GJVMG.js";import"./chunk-3FININUU.js";import"./chunk-STKJA4PV.js";import"./chunk-M6UKCZHT.js";import"./chunk-I2NVBDKH.js";import"./chunk-UQYNPYF4.js";import"./chunk-MRJKZWWV.js";import"./chunk-TWVUQUUD.js";import"./chunk-5FYDNH4Y.js";import"./chunk-LNXBTK7Q.js";import"./chunk-MAFUXCPZ.js";import"./chunk-NRHG4R2Q.js";import"./chunk-C3QOHMR6.js";import{useSyncExternalStore as S,useEffect as w,useMemo as B,useState as M,useRef as T,useCallback as P}from"react";import{jsxs as I,Fragment as A,jsx as V}from"react/jsx-runtime";var D="pomodoro_appearance",R="pomodoro_active_task_id",F={focus:"Pomodoro",short:"Short Break",long:"Long Break"},L={focus:"#0f172a",short:"#508a52",long:"#5b7898"};var H=25,W=5,U=15,Z=!1,$=!1,J=4,Y=!0,E=!0,K="bell",Q=100,G=1,O="none",X=50,_=(e,t,o,n)=>"number"==typeof e&&isFinite(e)?Math.max(t,Math.min(o,Math.round(e))):n;function z(){const t=S(o,n,n),{prefs:k,save:b}=C(),x=function(e){const t=e&&"object"==typeof e?e:{};return{focusMinutes:_(t.focusMinutes,1,120,H),shortBreakMinutes:_(t.shortBreakMinutes,1,120,W),longBreakMinutes:_(t.longBreakMinutes,1,120,U),autoStartBreaks:"boolean"==typeof t.autoStartBreaks?t.autoStartBreaks:Z,autoStartPomodoros:"boolean"==typeof t.autoStartPomodoros?t.autoStartPomodoros:$,longBreakInterval:_(t.longBreakInterval,1,20,J),autoCheckTasks:"boolean"==typeof t.autoCheckTasks?t.autoCheckTasks:Y,checkToBottom:"boolean"==typeof t.checkToBottom?t.checkToBottom:E,alarmSound:g.some(e=>e.id===t.alarmSound)?t.alarmSound:K,alarmVolume:_(t.alarmVolume,0,100,Q),alarmRepeat:_(t.alarmRepeat,1,5,G),focusSound:f.some(e=>e.id===t.focusSound)?t.focusSound:O,focusVolume:_(t.focusVolume,0,100,X)}}(k.pomodoro_settings);w(()=>{a({focus:60*x.focusMinutes,short:60*x.shortBreakMinutes,long:60*x.longBreakMinutes})},[x.focusMinutes,x.shortBreakMinutes,x.longBreakMinutes]),w(()=>{r(x.alarmSound),s(x.alarmVolume,x.alarmRepeat)},[x.alarmSound,x.alarmVolume,x.alarmRepeat]),w(()=>{i({autoStartBreaks:x.autoStartBreaks,autoStartPomodoros:x.autoStartPomodoros,longBreakInterval:x.longBreakInterval})},[x.autoStartBreaks,x.autoStartPomodoros,x.longBreakInterval]),w(()=>{l(x.focusSound,x.focusVolume)},[x.focusSound,x.focusVolume]),w(()=>{if("undefined"!=typeof Notification&&"default"===Notification.permission)try{Notification.requestPermission()}catch{}},[]);const z=c(),ee=z.tasks,te=B(()=>u(),[]),oe=function(e,t){return B(()=>t?(e=>{const t=[],o=[];for(const n of e)(n.done?o:t).push(n);return[...t,...o]})(e):e,[e,t])}(B(()=>ee.filter(e=>!!e.dueDate&&(e.dueDate===te||e.dueDate<te&&!e.done)),[ee,te]),x.checkToBottom),[ne,ae]=M(()=>localStorage.getItem(R)),[re,se]=M(!1),[ie,le]=M(null),ce=T(!1);w(()=>{ce.current||(ce.current=!0,m(ee,z.setAllTasks))},[]),w(()=>{try{ne?localStorage.setItem(R,ne):localStorage.removeItem(R)}catch{}},[ne]),w(()=>{if(!ie)return;const e=()=>le(null),t=setTimeout(()=>document.addEventListener("click",e),0);return()=>{clearTimeout(t),document.removeEventListener("click",e)}},[ie]);const ue=T(t.streak);w(()=>{if(t.streak>ue.current&&ne){const e=ee.find(e=>e.id===ne);if(e){const t=(e.completed??0)+1,o=e.estimated??0,n=x.autoCheckTasks&&o>0&&t>=o;z.updateTask(ne,{completed:t,done:e.done||n})}}ue.current=t.streak},[t.streak,ne,x.autoCheckTasks,ee,z]);const de=oe.reduce((e,t)=>e+(t.completed??0),0),he=oe.reduce((e,t)=>e+Math.max(t.estimated??0,t.completed??0),0),pe=oe.reduce((e,t)=>t.done?e:e+Math.max(0,(t.estimated??0)-(t.completed??0)),0),ge=t.running&&"focus"===t.mode?t.remaining:0,ke=pe*x.focusMinutes*60+ge,fe=new Date(Date.now()+1e3*ke),be=v(fe.toISOString(),{clock:{hour:"2-digit",minute:"2-digit",hourCycle:"h23"}}),xe=(ke/3600).toFixed(1),ve=ne?ee.find(e=>e.id===ne)??null:null,ye=y(Math.floor(t.remaining/60)),Ne=y(t.remaining%60),[Ce,je]=M(()=>e(D)),[Se,we]=M(!1),[Be,Me]=M(Ce),[Te,Pe]=M(x);N(P(()=>{Me({...Ce}),Pe({...x}),we(!0)},[Ce,x]));const Ie="focus"!==t.mode,Ae=L[t.mode],Ve=Ie?(De=Ae,Re=Ce.activeOpacity/100,`rgba(${parseInt(De.slice(1,3),16)}, ${parseInt(De.slice(3,5),16)}, ${parseInt(De.slice(5,7),16)}, ${Re})`):`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${Ce.activeOpacity/100})`;var De,Re;const Fe={primary:Ie?"text-white":"text-gray-900",secondary:Ie?"text-white/85":"text-gray-700",muted:Ie?"text-white/65":"text-gray-500",tabActive:Ie?"bg-white/15 text-white":"bg-gray-200 text-gray-900",tabInactive:Ie?"text-white/75 hover:bg-white/10":"text-gray-500 hover:bg-gray-200",divider:Ie?"border-white/30":"border-gray-200",softDivider:Ie?"border-white/20":"border-gray-200",iconBtn:Ie?"bg-black/15 hover:bg-black/25 text-white/85":"bg-gray-200 hover:bg-gray-300 text-gray-600",addTaskBtn:Ie?"border-white/45 text-white/90 hover:bg-white/[0.06]":"border-gray-300 text-gray-500 hover:bg-gray-200/50"},Le=Ie?Ae:"#0f172a";/* @__PURE__ */
2
- return I(A,{children:[
3
- /* @__PURE__ */I("div",{className:`flex flex-col h-full select-none transition-colors duration-300 ${Fe.primary}`,style:{backgroundColor:Ve,backdropFilter:Ce.activeBlur>0?`blur(${Ce.activeBlur}px)`:void 0},children:[
4
- /* @__PURE__ */V("div",{className:"px-3 pt-3 flex justify-center gap-2",children:["focus","short","long"].map(e=>/* @__PURE__ */V("button",{onClick:()=>d(e),className:`px-3 py-1 text-sm font-bold rounded transition-colors ${t.mode===e?Fe.tabActive:Fe.tabInactive}`,children:F[e]},e))}),
5
- /* @__PURE__ */I("div",{className:"text-center font-bold tabular-nums leading-none tracking-tight mt-3",style:{fontSize:"4.5rem"},children:[ye,":",Ne]}),
6
- /* @__PURE__ */V("div",{className:"flex justify-center mt-3 mb-2",children:/* @__PURE__ */V("button",{onClick:()=>t.running?h():p(),className:"bg-surface px-12 py-3 rounded-md font-bold text-base shadow-[0_4px_0_rgba(0,0,0,0.12)] hover:shadow-[0_3px_0_rgba(0,0,0,0.12)] active:translate-y-1 active:shadow-none transition-all",style:{color:Le,letterSpacing:"0.08em"},children:t.running?"PAUSE":"START"})}),
7
- /* @__PURE__ */V("div",{className:"px-3 py-3 text-center",children:ve?/* @__PURE__ */I(A,{children:[
8
- /* @__PURE__ */I("div",{className:`text-xs leading-tight ${Fe.muted}`,children:["#",(ve.completed??0)+1]}),
9
- /* @__PURE__ */V("div",{className:`text-base font-medium leading-tight truncate mt-0.5 ${Fe.primary}`,children:ve.name})]}):/* @__PURE__ */V("div",{className:`text-xs italic ${Fe.muted}`,children:"No task selected"})}),
10
- /* @__PURE__ */I("div",{className:"px-3 mt-1 flex items-center justify-between",children:[
11
- /* @__PURE__ */V("h3",{className:`text-base font-bold tracking-tight ${Fe.primary}`,children:"Tasks"}),
12
- /* @__PURE__ */V("button",{className:`rounded p-1 transition-colors ${Fe.iconBtn}`,"aria-label":"Tasks menu",tabIndex:-1,children:/* @__PURE__ */V(j,{name:"more-vertical",look:"solid",className:"h-4 w-4"})})]}),
13
- /* @__PURE__ */V("div",{className:`border-t mx-3 mt-2 ${Fe.divider}`}),
14
- /* @__PURE__ */I("div",{className:"flex-1 px-3 py-3 space-y-2 overflow-y-auto",children:[oe.map(e=>{const t=e.id===ne;/* @__PURE__ */
15
- return I("div",{onClick:()=>ae(e.id),className:"bg-surface text-ink-strong rounded-md flex items-center pr-2 py-3 shadow-sm cursor-pointer transition-shadow hover:shadow-(--elevation-panel) "+(t?"border-l-4 border-gray-700 pl-2":"pl-3 border-l-4 border-transparent"),children:[
16
- /* @__PURE__ */V("button",{onClick:t=>{var o;t.stopPropagation(),o=e.id,z.toggleDone(o)},className:"shrink-0",children:e.done?/* @__PURE__ */V("svg",{className:"h-5 w-5",fill:"currentColor",viewBox:"0 0 20 20",style:{color:Le},children:/* @__PURE__ */V("path",{d:"M10 0a10 10 0 100 20 10 10 0 000-20zm-1 14.5l-4.5-4.5 1.4-1.4 3.1 3.1 6.1-6.1 1.4 1.4z"})}):/* @__PURE__ */V("svg",{className:"h-5 w-5 text-gray-300",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24",children:/* @__PURE__ */V("circle",{cx:"12",cy:"12",r:"10"})})}),
17
- /* @__PURE__ */V("span",{className:"ml-3 flex-1 font-semibold truncate "+(e.done?"line-through text-gray-400":"text-gray-800"),children:e.name}),
18
- /* @__PURE__ */I("span",{className:"text-sm tabular-nums mr-2 shrink-0",children:[
19
- /* @__PURE__ */V("span",{className:"font-bold text-gray-500",children:e.completed??0}),
20
- /* @__PURE__ */V("span",{className:"text-gray-400",children:" / "}),
21
- /* @__PURE__ */V("span",{className:"text-gray-400",children:e.estimated??"–"})]}),
22
- /* @__PURE__ */I("div",{className:"relative",children:[
23
- /* @__PURE__ */V("button",{onClick:t=>{t.stopPropagation(),le(ie===e.id?null:e.id)},className:"rounded p-1 bg-gray-100 hover:bg-gray-200",children:/* @__PURE__ */V(j,{name:"more-vertical",look:"solid",className:"h-4 w-4 text-ink-faint"})}),ie===e.id&&/* @__PURE__ */V("div",{className:"absolute right-0 top-full mt-1 bg-white text-gray-800 rounded shadow-lg border border-gray-200 z-10 min-w-[110px] overflow-hidden",onClick:e=>e.stopPropagation(),children:/* @__PURE__ */V("button",{onClick:t=>{var o;t.stopPropagation(),o=e.id,z.removeTask(o),ne===o&&ae(null),le(null)},className:"block w-full px-3 h-8 text-sm text-left hover:bg-red-50 text-red-600",children:"Delete"})})]})]},e.id)}),re?/* @__PURE__ */V(me,{onSubmit:(e,t)=>{const o=e.trim();if(!o)return;const n=z.addTask({name:o,estimated:t,completed:0,dueDate:te});ne||ae(n),se(!1)},onCancel:()=>se(!1),accentColor:Le}):/* @__PURE__ */I("button",{onClick:()=>se(!0),className:`w-full border-2 border-dashed rounded-md py-3 font-semibold flex items-center justify-center gap-2 transition-colors ${Fe.addTaskBtn}`,children:[
24
- /* @__PURE__ */V(j,{name:"add-circle",className:"h-5 w-5",strokeWidth:2}),"Add Task"]})]}),
25
- /* @__PURE__ */I("div",{className:`border-t px-3 py-3 flex items-center justify-center gap-5 text-sm ${Fe.softDivider}`,children:[
26
- /* @__PURE__ */I("span",{className:Fe.secondary,children:["Pomos: ",
27
- /* @__PURE__ */V("span",{className:`font-bold ${Fe.primary}`,children:de}),
28
- /* @__PURE__ */V("span",{className:Fe.muted,children:" / "}),
29
- /* @__PURE__ */V("span",{className:`font-bold ${Fe.primary}`,children:he})]}),ke>0&&/* @__PURE__ */I("span",{className:Fe.secondary,children:["Finish At: ",
30
- /* @__PURE__ */V("span",{className:`font-bold ${Fe.primary}`,children:be}),
31
- /* @__PURE__ */I("span",{className:Fe.muted,children:[" (",xe,"h)"]})]})]})]}),
32
- /* @__PURE__ */V(q,{open:Se,onClose:()=>we(!1),onSave:()=>{je(Be),localStorage.setItem(D,JSON.stringify(Be)),b({pomodoro_settings:Te}),we(!1)},configAppearance:Be,setConfigAppearance:Me,configPrefs:Te,setConfigPrefs:Pe})]})}function q({open:e,onClose:o,onSave:n,configAppearance:a,setConfigAppearance:r,configPrefs:s,setConfigPrefs:i}){const l=(e,t)=>i(o=>({...o,[e]:t}));/* @__PURE__ */
33
- return I(t,{open:e,onClose:o,title:"Pomodoro Settings",appearance:a,onAppearanceChange:r,onSave:n,children:[
34
- /* @__PURE__ */I(ee,{icon:/* @__PURE__ */V(le,{}),label:"TIMER",children:[
35
- /* @__PURE__ */I("div",{children:[
36
- /* @__PURE__ */V("p",{className:"text-sm font-bold text-gray-800 mb-2",children:"Time (minutes)"}),
37
- /* @__PURE__ */I("div",{className:"grid grid-cols-3 gap-3",children:[
38
- /* @__PURE__ */V(ne,{label:"Pomodoro",value:s.focusMinutes,onChange:e=>l("focusMinutes",e),max:120}),
39
- /* @__PURE__ */V(ne,{label:"Short Break",value:s.shortBreakMinutes,onChange:e=>l("shortBreakMinutes",e),max:120}),
40
- /* @__PURE__ */V(ne,{label:"Long Break",value:s.longBreakMinutes,onChange:e=>l("longBreakMinutes",e),max:120})]})]}),
41
- /* @__PURE__ */V(te,{label:"Auto Start Breaks",children:/* @__PURE__ */V(se,{checked:s.autoStartBreaks,onChange:e=>l("autoStartBreaks",e)})}),
42
- /* @__PURE__ */V(te,{label:"Auto Start Pomodoros",children:/* @__PURE__ */V(se,{checked:s.autoStartPomodoros,onChange:e=>l("autoStartPomodoros",e)})}),
43
- /* @__PURE__ */V(te,{label:"Long Break interval",children:/* @__PURE__ */V(ae,{value:s.longBreakInterval,onChange:e=>l("longBreakInterval",e),min:1,max:20,className:"w-14 text-center"})})]}),
44
- /* @__PURE__ */I(ee,{icon:/* @__PURE__ */V(ce,{}),label:"TASK",children:[
45
- /* @__PURE__ */V(te,{label:"Auto Check Tasks",info:'If you enable "Auto Check Tasks", the active task will be automatically checked when the actual pomodoro count reaches the estimated count.',children:/* @__PURE__ */V(se,{checked:s.autoCheckTasks,onChange:e=>l("autoCheckTasks",e)})}),
46
- /* @__PURE__ */V(te,{label:"Check to Bottom",info:'If you enable "Check to Bottom", the checked task will be automatically moved to the bottom of the task list.',children:/* @__PURE__ */V(se,{checked:s.checkToBottom,onChange:e=>l("checkToBottom",e)})})]}),
47
- /* @__PURE__ */I(ee,{icon:/* @__PURE__ */V(ue,{}),label:"SOUND",children:[
48
- /* @__PURE__ */V(te,{label:"Alarm Sound",children:/* @__PURE__ */I("div",{className:"flex items-center gap-2",children:[
49
- /* @__PURE__ */V(re,{value:s.alarmSound,onChange:e=>l("alarmSound",e),options:g.map(e=>({id:e.id,label:e.label}))}),"off"!==s.alarmSound&&/* @__PURE__ */V("button",{type:"button",onClick:()=>k(s.alarmSound,{volume:s.alarmVolume,repeat:1}),className:"px-2 py-1 text-2xs rounded border border-line-strong text-gray-600 hover:bg-gray-100",children:"Play"})]})}),
50
- /* @__PURE__ */V(oe,{value:s.alarmVolume,onChange:e=>l("alarmVolume",e)}),
51
- /* @__PURE__ */V(te,{label:"repeat",children:/* @__PURE__ */V(ae,{value:s.alarmRepeat,onChange:e=>l("alarmRepeat",e),min:1,max:5,className:"w-14 text-center"})}),
52
- /* @__PURE__ */V(te,{label:"Focus Sound",children:/* @__PURE__ */I("div",{className:"flex items-center gap-2",children:[
53
- /* @__PURE__ */V(re,{value:s.focusSound,onChange:e=>l("focusSound",e),options:f}),"none"!==s.focusSound&&/* @__PURE__ */V("button",{type:"button",onClick:()=>b(s.focusSound,s.focusVolume),className:"px-2 py-1 text-2xs rounded border border-line-strong text-gray-600 hover:bg-gray-100",children:"Play"})]})}),
54
- /* @__PURE__ */V(oe,{value:s.focusVolume,onChange:e=>l("focusVolume",e)})]})]})}function ee({icon:e,label:t,children:o}){/* @__PURE__ */
55
- return I("div",{className:"border-t border-gray-200 pt-3 first:border-0 first:pt-0",children:[
56
- /* @__PURE__ */I("div",{className:"flex items-center gap-2 mb-3 text-ink-faintest",children:[e,
57
- /* @__PURE__ */V("span",{className:"text-xs font-bold tracking-[0.15em]",children:t})]}),
58
- /* @__PURE__ */V("div",{className:"space-y-3",children:o})]})}function te({label:e,info:t,children:o}){/* @__PURE__ */
59
- return I("div",{className:"flex items-center justify-between gap-3",children:[
60
- /* @__PURE__ */I("div",{className:"flex items-center gap-2 min-w-0",children:[
61
- /* @__PURE__ */V("span",{className:"text-sm font-semibold text-gray-800",children:e}),t&&/* @__PURE__ */V(ie,{title:t})]}),
62
- /* @__PURE__ */V("div",{className:"shrink-0",children:o})]})}function oe({value:e,onChange:t}){/* @__PURE__ */
63
- return I("div",{className:"flex items-center justify-end gap-3",children:[
64
- /* @__PURE__ */V("span",{className:"text-xs text-gray-400 w-7 text-right tabular-nums",children:e}),
65
- /* @__PURE__ */V("input",{type:"range",min:0,max:100,value:e,onChange:e=>t(parseInt(e.target.value,10)),className:"w-40 accent-blue-500"})]})}function ne({label:e,value:t,onChange:o,min:n=1,max:a=99}){/* @__PURE__ */
66
- return I("label",{className:"flex flex-col",children:[
67
- /* @__PURE__ */V("span",{className:"text-xs font-semibold text-gray-500 mb-1",children:e}),
68
- /* @__PURE__ */V(ae,{value:t,onChange:o,min:n,max:a})]})}function ae({value:e,onChange:t,min:o=1,max:n=99,className:a=""}){/* @__PURE__ */
69
- return V("input",{type:"number",min:o,max:n,value:e,onChange:e=>t(Math.max(o,Math.min(n,parseInt(e.target.value,10)||o))),className:`bg-gray-100 border-0 rounded-md px-2 h-8 text-sm font-medium text-ink-strong focus:outline-none focus:ring-2 focus:ring-blue-500 w-full ${a}`})}function re({value:e,onChange:t,options:o}){/* @__PURE__ */
70
- return I("div",{className:"relative",children:[
71
- /* @__PURE__ */V("select",{value:e,onChange:e=>t(e.target.value),className:"appearance-none bg-gray-100 border-0 rounded-md pl-3 pr-8 h-8 text-sm font-medium text-ink-strong focus:outline-none focus:ring-2 focus:ring-blue-500 cursor-pointer",children:o.map(e=>/* @__PURE__ */V("option",{value:e.id,children:e.label},e.id))}),
72
- /* @__PURE__ */V(j,{name:"chevron-down",className:`absolute right-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 pointer-events-none ${x}`,strokeWidth:2.5})]})}function se({checked:e,onChange:t}){/* @__PURE__ */
73
- return V("button",{type:"button",role:"switch","aria-checked":e,onClick:()=>t(!e),className:"relative inline-flex h-6 w-11 items-center rounded-full transition-colors "+(e?"bg-emerald-500":"bg-gray-300"),children:/* @__PURE__ */V("span",{className:"absolute h-5 w-5 rounded-full bg-white shadow transition-transform "+(e?"translate-x-[22px]":"translate-x-0.5")})})}function ie({title:e}){/* @__PURE__ */
74
- return V("span",{title:e,className:"inline-flex items-center justify-center w-4 h-4 rounded-full bg-gray-300 text-on-accent text-3xs font-bold cursor-help",children:"i"})}function le(){/* @__PURE__ */
75
- return I("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[
76
- /* @__PURE__ */V("circle",{cx:"12",cy:"12",r:"9"}),
77
- /* @__PURE__ */V("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 7v5l3 2"})]})}function ce(){/* @__PURE__ */
78
- return I("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[
79
- /* @__PURE__ */V("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"}),
80
- /* @__PURE__ */V("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12l2 2 4-4"})]})}function ue(){/* @__PURE__ */
81
- return I("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[
82
- /* @__PURE__ */V("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 5L6 9H2v6h4l5 4V5z"}),
83
- /* @__PURE__ */V("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.5 8.5a5 5 0 010 7M19 5a9 9 0 010 14"})]})}function me({onSubmit:e,onCancel:t,accentColor:o}){const[n,a]=M(""),[r,s]=M(1),i=()=>e(n,r);/* @__PURE__ */
84
- return I("div",{className:"bg-surface text-ink-strong rounded-md p-3 shadow-(--elevation-panel)",children:[
85
- /* @__PURE__ */V("input",{autoFocus:!0,value:n,onChange:e=>a(e.target.value),placeholder:"What are you working on?",onKeyDown:e=>{"Enter"===e.key&&i(),"Escape"===e.key&&t()},className:"w-full text-base font-medium bg-transparent border-0 outline-none placeholder-gray-400"}),
86
- /* @__PURE__ */I("div",{className:"flex items-center justify-between mt-2",children:[
87
- /* @__PURE__ */V("span",{className:"text-xs font-semibold text-gray-500",children:"Est Pomodoros"}),
88
- /* @__PURE__ */V("input",{type:"number",min:1,max:20,value:r,onChange:e=>s(Math.max(1,Math.min(20,parseInt(e.target.value,10)||1))),className:"w-16 bg-gray-100 rounded px-2 py-1 text-sm text-right border-0 focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),
89
- /* @__PURE__ */I("div",{className:"flex gap-2 mt-3 justify-end",children:[
90
- /* @__PURE__ */V("button",{onClick:t,className:"px-3 py-1 text-sm text-gray-500 hover:bg-gray-100 rounded",children:"Cancel"}),
91
- /* @__PURE__ */V("button",{onClick:i,className:"px-4 py-1 text-sm font-semibold text-white rounded shadow-sm",style:{backgroundColor:o},children:"Save"})]})]})}export{z as default};
@@ -1,44 +0,0 @@
1
- import{useAuth as e,parseOpenSections as t,readStored as r,RAIL_OPEN_SECTIONS_KEY as n,RAIL_WIDTH_KEY as i,toggleOpenSection as a,writeStored as o}from"./chunk-AQH6MAYK.js";import{ResizeHandle as l}from"./chunk-WNHDYTTI.js";import{openGlobalSearch as s}from"./chunk-HU5FTTW2.js";import{partitionNav as c,visibleNavChildren as d,visibleSectionItems as m,rowsContainRoute as u}from"./chunk-HGOWQO63.js";import{BrandMark as h}from"./chunk-MI67DI3H.js";import{RAIL_MENU_GAP as p,navSections as b,startMenuCategories as f,RAIL_W as g,TAB_STRIP_H as k,RAIL_COLLAPSED_INSET as x,RAIL_MAX_W as y,RAIL_MIN_W as v,navIcons as N,sectionIcons as j}from"./chunk-4LXCCZDM.js";import"./chunk-5A7MWTXX.js";import{CloseButton as w}from"./chunk-5QHNDAZ6.js";import"./chunk-DBQNYJZ6.js";import"./chunk-2QY5BJLA.js";import"./chunk-APFDZ2HG.js";import{PopupMenu as C,PopupMenuItem as S,PopupMenuDivider as $}from"./chunk-P56YLT73.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import"./chunk-TSZPGDU3.js";import{Icon as A}from"./chunk-ISVODSRP.js";import"./chunk-J75ZT2JQ.js";import"./chunk-R2VKEMZH.js";import"./chunk-CIZAUBWA.js";import"./chunk-PGN5ME7B.js";import"./chunk-5QRHQCRG.js";import"./chunk-62LW225J.js";import"./chunk-TAHHZGRH.js";import"./chunk-KEFNQEXZ.js";import"./chunk-PU2GJVMG.js";import"./chunk-3FININUU.js";import"./chunk-UQYNPYF4.js";import"./chunk-MRJKZWWV.js";import"./chunk-TWVUQUUD.js";import"./chunk-5FYDNH4Y.js";import"./chunk-LNXBTK7Q.js";import{useShellStrings as H}from"./chunk-NRHG4R2Q.js";import"./chunk-C3QOHMR6.js";import{useMemo as L,useState as T,useRef as W,useEffect as z,isValidElement as I,cloneElement as Q}from"react";import{jsx as R,jsxs as D,Fragment as K}from"react/jsx-runtime";var M="undefined"!=typeof navigator&&/Mac|iPhone|iPad/.test(navigator.platform),P=150,U=250;function Z(e,t,r){const n=Math.max(8,r-t.bottom);return{left:e+p,bottom:n,maxHeight:r-n-8,overflowY:"auto"}}var G=(e,t)=>["flex h-(--row-height-menu) w-full items-center gap-3 rounded-md px-3 text-left text-sm font-medium transition-colors",t?"justify-center px-0":"",e?"bg-gray-100 text-gray-900":"text-gray-600 hover:bg-gray-100 hover:text-gray-900"].join(" "),Y="flex size-8 shrink-0 items-center justify-center rounded-md text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-900",F="flex size-[18px] shrink-0 items-center justify-center [&>svg]:size-[18px]";function O({open:e,children:t}){const r=W(null);return z(()=>{r.current?.toggleAttribute("inert",!e)},[e]),/* @__PURE__ */R("div",{ref:r,className:"grid transition-[grid-template-rows,opacity] duration-200 ease-out motion-reduce:transition-none",style:{gridTemplateRows:e?"1fr":"0fr",opacity:e?1:0},"aria-hidden":!e,"data-fold":e?"open":"closed",children:/* @__PURE__ */R("div",{className:"min-h-0 overflow-hidden",children:t})})}function B({open:e}){/* @__PURE__ */
2
- return R(A,{name:"chevron-down",className:"size-4 shrink-0 transition-transform "+(e?"rotate-180":""),strokeWidth:2,"aria-hidden":"true"})}function E({dir:e}){/* @__PURE__ */
3
- return R(A,"left"===e?{name:"chevron-double-left",className:"size-[18px] shrink-0",strokeWidth:1.5,"aria-hidden":"true"}:{name:"chevron-double-right",className:"size-[18px] shrink-0",strokeWidth:1.5,"aria-hidden":"true"})}function J({className:e}){/* @__PURE__ */
4
- return R(A,{name:"search",className:e,strokeWidth:2,"aria-hidden":"true"})}var X=e=>.75+1.75*e+"rem";function _({width:p,openWidth:P=g,collapsed:U,onToggleCollapsed:_,onResize:V,onHome:q,onOpen:ee,activeRoute:te,profile:re,user:ne,onLogout:ie,onSwitchToDesktop:ae,onReportBug:oe,onClose:le,navSections:se=b,navIcons:ce=N,sectionIcons:de=j,categories:me=f,productName:ue,productIcon:he,tagline:pe,adaptiveLogo:be=!1,logoHasAlpha:fe=null,logoIsLight:ge=null}){const ke=H().layout,{hasAnyPerm:xe}=e(),ye=L(()=>c(se,me,xe),[se,me,xe]),[ve,Ne]=T(()=>t(r(n))),je=L(()=>[...ye.topItems.filter(e=>d(e,xe).length>0).map(e=>`child:${e.to}`),...[...ye.erpSections,...ye.systemSections,...ye.virtualSections,...ye.footerSections].map(e=>e.label)],[ye,xe]),we=(e,t=je)=>Ne(r=>{const i=a(r,e,t);return o(n,JSON.stringify([...i])),i}),[Ce,Se]=T(!1),$e=W(null),Ae=U&&!le,[He,Le]=T(!1),Te=W("pointer"),We=W(void 0),ze=W(!1),Ie=W(null),Qe=()=>{clearTimeout(We.current),We.current=void 0},Re=e=>{Qe(),Te.current=e,Le(!0)},De=()=>{Qe(),Le(!1)};z(()=>{Qe(),Le(!1)},[U]),z(()=>()=>Qe(),[]),z(()=>{if(!He)return;const e=e=>{const t=e.target;t&&(Ie.current?.contains(t)||t.closest?.('[data-popup-menu-tree], [role="menu"]'))||(Qe(),Le(!1))};return document.addEventListener("pointerdown",e,!0),()=>document.removeEventListener("pointerdown",e,!0)},[He]);const Ke=U&&!He,Me=U&&He?P:p,Pe=(e,t)=>{De(),e.onSelect?e.onSelect():ee(e.to,!!t&&(e=>e.metaKey||e.ctrlKey||1===e.button)(t))},Ue=(e,t)=>{const r=t[e];/* @__PURE__ */
5
- return R("span",{className:F,"aria-hidden":"true",children:r&&I(r)?Q(r,{className:"size-[18px]"}):r})},Ze=e=>e.filter(e=>d(e,xe).length>0).map(e=>`child:${e.to}`),Ge=(e,t,r=je)=>{const n=d(e,xe),i=e.menuLabel??e.label;if(n.length>0){const a=`child:${e.to}`,o=ve.has(a),l=!o&&u(n,te,xe);/* @__PURE__ */
6
- return D("div",{children:[
7
- /* @__PURE__ */D("button",{type:"button",onClick:()=>we(a,r),"aria-expanded":o,className:G(l,!1),style:t>0?{paddingLeft:X(t)}:void 0,children:[0===t&&Ue(e.to,ce),
8
- /* @__PURE__ */R("span",{className:"min-w-0 flex-1 truncate",children:i}),
9
- /* @__PURE__ */R(B,{open:o})]}),
10
- /* @__PURE__ */R(O,{open:o,children:/* @__PURE__ */R("div",{className:"space-y-0.5 pt-0.5",children:n.map(e=>Ge(e,t+1,Ze(n)))})}),e.dividerAfter&&/* @__PURE__ */R("div",{className:"mx-2 my-2 border-t border-gray-200",style:{marginLeft:X(t)},"aria-hidden":"true"})]},e.to)}const a=e.to===te;/* @__PURE__ */
11
- return D("div",{children:[
12
- /* @__PURE__ */D("button",{type:"button",onClick:t=>Pe(e,t),onAuxClick:t=>{1===t.button&&Pe(e,t)},"aria-current":a?"page":void 0,className:G(a,!1),style:t>0?{paddingLeft:X(t)}:void 0,children:[0===t&&Ue(e.to,ce),
13
- /* @__PURE__ */R("span",{className:"min-w-0 flex-1 truncate",children:i})]}),e.dividerAfter&&/* @__PURE__ */R("div",{className:"mx-2 my-2 border-t border-gray-200",style:{marginLeft:X(t)},"aria-hidden":"true"})]},e.to)},Ye=(e,t)=>{const r=t?e.items:m(e,xe);if(0===r.length)return null;const n="icon"in e&&e.icon?/* @__PURE__ */R("span",{className:F,"aria-hidden":"true",children:e.icon}):Ue(e.label,de),i=e.menuLabel??e.label,a=u(r,te,xe),o="dividerAfter"in e&&e.dividerAfter;if(Ke)/* @__PURE__ */
14
- return D("div",{children:[
15
- /* @__PURE__ */R("button",{type:"button",title:i,"aria-label":i,"aria-expanded":!1,onClick:()=>{ve.has(e.label)||we(e.label),Re("tap")},className:G(a,!0),children:n}),o&&/* @__PURE__ */R("div",{className:"mx-2 my-2 border-t border-line","aria-hidden":"true"})]},e.label);const l=ve.has(e.label),s=`rosh-rail-${e.label.replace(/[^a-z0-9]+/gi,"-").toLowerCase()}`;/* @__PURE__ */
16
- return D("div",{children:[
17
- /* @__PURE__ */D("button",{type:"button",onClick:()=>we(e.label),"aria-expanded":l,"aria-controls":s,className:G(!l&&a,!1),children:[n,
18
- /* @__PURE__ */R("span",{className:"min-w-0 flex-1 truncate",children:i}),
19
- /* @__PURE__ */R(B,{open:l})]}),
20
- /* @__PURE__ */R(O,{open:l,children:/* @__PURE__ */R("div",{id:s,role:"group","aria-label":i,className:"space-y-0.5 pt-0.5",children:r.map(e=>Ge(e,1,Ze(r)))})}),o&&/* @__PURE__ */R("div",{className:"mx-2 my-2 border-t border-line","aria-hidden":"true"})]},e.label)},Fe=re?.first_name?`${re.first_name} ${re.last_name||""}`.trim():ne?.email||"",Oe=(re?.first_name?.charAt(0)||ne?.email?.charAt(0)||"?").toUpperCase(),Be=re?.avatar_url?/* @__PURE__ */R("img",{src:re.avatar_url,alt:"",className:"size-8 shrink-0 rounded-full object-cover"}):/* @__PURE__ */R("span",{className:"flex size-8 shrink-0 items-center justify-center rounded-full bg-blue-600 text-xs font-semibold text-white",children:Oe}),Ee=Ce?$e.current?.getBoundingClientRect():void 0,Je=Ke?"":"px-3",Xe=Ke?{paddingInline:x}:void 0,_e=`${U?ke.expandSidebar:ke.collapseSidebar} (${M?"⌘":"Ctrl"} .)`,Ve=q?{run:q,label:ke.goHome,title:ke.goHome}:le?null:{run:_,label:U?ke.expandSidebar:ke.collapseSidebar,title:_e},qe=/* @__PURE__ */D(K,{children:[he&&/* @__PURE__ */R(h,{src:he,alt:"",slot:"compact",surface:"light",adaptive:be,hasAlpha:fe,isLight:ge,size:28,decorative:!0}),!Ke&&/* @__PURE__ */D("span",{className:"min-w-0 text-left leading-tight",children:[
21
- /* @__PURE__ */R("span",{className:"block truncate text-base font-bold tracking-wide text-gray-900",children:ue??"Apps"}),pe&&/* @__PURE__ */R("span",{className:"block truncate text-2xs font-medium text-gray-500",children:pe})]})]}),et=ye.erpSections.length>0||ye.systemSections.length>0||ye.virtualSections.length>0;/* @__PURE__ */
22
- return D("aside",{ref:Ie,"aria-label":ke.navLabel,"data-rail-peek":He?"":void 0,className:`fixed left-0 top-0 z-(--z-sidebar) flex h-dvh flex-col border-r border-line bg-surface text-ink-strong ${U?"overflow-hidden transition-[width] duration-150 ease-out motion-reduce:transition-none":""} ${He?"rounded-r-(--radius-panel)":""}`,style:{width:Me,boxShadow:He?"var(--elevation-popup)":void 0},onPointerEnter:e=>{"touch"!==e.pointerType&&(ze.current=!0,Ae&&(He?Qe():(Qe(),We.current=setTimeout(()=>Re("pointer"),150))))},onPointerLeave:e=>{"touch"!==e.pointerType&&(ze.current=!1,Ae&&(Qe(),He&&!Ce&&"pointer"===Te.current&&(We.current=setTimeout(De,250))))},onFocus:e=>{Ae&&!He&&(e=>{try{return e.matches(":focus-visible")}catch{return!1}})(e.target)&&Re("focus")},onBlur:e=>{if(!He||"focus"!==Te.current)return;const t=e.relatedTarget;t&&Ie.current?.contains(t)||Ce||ze.current||De()},onKeyDown:e=>{"Escape"===e.key&&He&&De()},children:[
23
- /* @__PURE__ */D("div",{className:"flex shrink-0 items-center border-b border-gray-200 "+(Ke?"justify-center":"justify-between gap-2 pl-4 pr-2"),style:{height:k},children:[Ve?/* @__PURE__ */R("button",{type:"button",onClick:Ve.run,"aria-label":Ve.label,title:Ve.title,className:"flex min-w-0 items-center gap-2 rounded-md transition-colors hover:bg-gray-100 "+(Ke?"justify-center p-0.5":"-ml-1 p-1"),children:qe}):/* @__PURE__ */R("span",{className:"flex min-w-0 items-center gap-2",children:qe}),le?/* @__PURE__ */R(w,{onClose:le,label:ke.closeMenu}):U?He&&
24
- /* @__PURE__ */R("button",{type:"button",onClick:()=>{De(),_()},"aria-label":ke.keepSidebarOpen,title:`${ke.keepSidebarOpen} (${M?"⌘":"Ctrl"} .)`,className:Y,children:/* @__PURE__ */R(E,{dir:"right"})}):/* @__PURE__ */R("button",{type:"button",onClick:_,"aria-label":ke.collapseSidebar,title:`${ke.collapseSidebar} (${M?"⌘":"Ctrl"} .)`,className:Y,children:/* @__PURE__ */R(E,{dir:"left"})})]}),
25
- /* @__PURE__ */R("div",{className:`shrink-0 pt-3 ${Je}`,style:Xe,children:Ke?/* @__PURE__ */R("button",{type:"button",onClick:s,"aria-label":ke.search,title:`${ke.search} (${M?"⌘K":"Ctrl K"})`,className:G(!1,!0),children:/* @__PURE__ */R(J,{className:"size-[18px] shrink-0"})}):/* @__PURE__ */D("button",{type:"button",onClick:s,className:"flex h-(--row-height-menu) w-full items-center gap-2 rounded-md border border-line bg-surface px-3 text-left transition-colors hover:bg-gray-100",children:[
26
- /* @__PURE__ */R(J,{className:"size-3.5 text-gray-500"}),
27
- /* @__PURE__ */R("span",{className:"min-w-0 flex-1 truncate text-sm text-ink-faint",children:ke.search}),
28
- /* @__PURE__ */R("kbd",{className:"rounded border border-line bg-gray-100 px-2 py-0.5 font-mono text-2xs font-semibold text-ink-faint",children:M?"⌘K":"Ctrl K"})]})}),
29
- /* @__PURE__ */D("nav",{"aria-label":ke.navLabel,className:`min-h-0 flex-1 overflow-y-auto pb-4 pt-3 ${Je} ${Ke?"space-y-1":"space-y-0.5"}`,style:Xe,children:[Ke&&/* @__PURE__ */R("button",{type:"button",onClick:_,"aria-label":ke.expandSidebar,title:`${ke.expandSidebar} (${M?"⌘":"Ctrl"} .)`,className:`${G(!1,!0)} mb-3`,children:/* @__PURE__ */R(E,{dir:"right"})}),ye.topItems.map(e=>{if(!Ke)return Ge(e,0);const t=d(e,xe),r=e.to===te||u(t,te,xe),n=e.menuLabel??e.label;/* @__PURE__ */
30
- return D("div",{children:[
31
- /* @__PURE__ */R("button",{type:"button",title:n,"aria-label":n,onClick:r=>{if(0===t.length)return void Pe(e,r);const n=`child:${e.to}`;ve.has(n)||we(n),Re("tap")},className:G(r,!0),children:Ue(e.to,ce)}),e.dividerAfter&&/* @__PURE__ */R("div",{className:"mx-2 my-2 border-t border-line","aria-hidden":"true"})]},e.to)}),ye.topItems.length>0&&et&&!ye.topItems[ye.topItems.length-1].dividerAfter&&/* @__PURE__ */R("div",{className:"mx-2 my-2 border-t border-line","aria-hidden":"true"}),ye.erpSections.map(e=>Ye(e,!1)),ye.systemSections.map(e=>Ye(e,!1)),ye.virtualSections.map(e=>Ye(e,!0)),ye.footerSections.length>0&&/* @__PURE__ */R("div",{className:"mx-2 my-2 border-t border-line","aria-hidden":"true"}),ye.footerSections.map(e=>Ye(e,!1))]}),
32
- /* @__PURE__ */R("div",{className:`shrink-0 border-t border-gray-200 py-2 ${Je}`,style:Xe,children:/* @__PURE__ */D("button",{ref:$e,type:"button",onClick:()=>Se(e=>!e),"aria-haspopup":"menu","aria-expanded":Ce,"aria-label":Ke?ke.accountMenu(Fe):void 0,className:"flex w-full items-center gap-3 rounded-md hover:bg-gray-100 "+(Ke?"justify-center py-2":"px-2 py-2"),children:[Be,!Ke&&/* @__PURE__ */D("span",{className:"min-w-0 flex-1 text-left",children:[
33
- /* @__PURE__ */R("span",{className:"block truncate text-sm font-semibold text-ink-strong",children:Fe}),ne?.email&&Fe!==ne.email&&/* @__PURE__ */R("span",{className:"block truncate text-2xs text-ink-faint",children:ne.email})]})]})}),V&&!U&&!le&&/* @__PURE__ */R(l,{side:"left",width:p,onResize:V,min:v,max:y,defaultWidth:g,storageKey:i,label:ke.resizeSidebar}),Ce&&Ee&&/* @__PURE__ */D(C,{portal:!0,minWidth:224,onClose:()=>{Se(!1),He&&"pointer"===Te.current&&!ze.current&&De()},style:Z(Me,Ee,window.innerHeight),children:[Ke&&/* @__PURE__ */D("div",{className:"border-b border-line px-3 py-3",children:[
34
- /* @__PURE__ */R("p",{className:"truncate text-sm font-semibold text-gray-800",children:Fe}),ne?.email&&/* @__PURE__ */R("p",{className:"truncate text-xs text-gray-500",children:ne.email})]}),
35
- /* @__PURE__ */D(S,{onClick:()=>{Se(!1),De(),ee("/profile",!1)},children:[
36
- /* @__PURE__ */R(A,{name:"account",className:"h-4 w-4",strokeWidth:1.5,"aria-hidden":"true"}),ke.profile]}),ye.footerItems.map(e=>/* @__PURE__ */D(S,{onClick:()=>{Se(!1),Pe(e)},children:[
37
- /* @__PURE__ */R("span",{className:"h-4 w-4 [&>svg]:size-4","aria-hidden":"true",children:ce[e.to]}),e.menuLabel??e.label]},e.to)),oe&&/* @__PURE__ */D(S,{onClick:()=>{Se(!1),De(),oe()},children:[
38
- /* @__PURE__ */R(A,{name:"error",className:"h-4 w-4",strokeWidth:1.5,"aria-hidden":"true"}),ke.reportIssue]}),
39
- /* @__PURE__ */R($,{}),ae&&/* @__PURE__ */D(K,{children:[
40
- /* @__PURE__ */D(S,{onClick:()=>{Se(!1),De(),ae()},children:[
41
- /* @__PURE__ */R(A,{name:"desktop",className:"h-4 w-4",strokeWidth:1.5,"aria-hidden":"true"}),ke.switchToDesktop]}),
42
- /* @__PURE__ */R($,{})]}),
43
- /* @__PURE__ */D(S,{danger:!0,onClick:()=>{Se(!1),De(),ie()},children:[
44
- /* @__PURE__ */R(A,{name:"logout",className:"h-4 w-4",strokeWidth:1.5,"aria-hidden":"true"}),ke.signOut]})]})]})}export{U as RAIL_PEEK_CLOSE_MS,P as RAIL_PEEK_OPEN_MS,Z as accountMenuPosition,_ as default};
@@ -1,4 +0,0 @@
1
- import{useTabLayer as e,focusableIn as t,stopAfter as r}from"./chunk-DWGYC7OD.js";import{DESCRIPTION_TEXT as n}from"./chunk-BWJZTHZ6.js";import{onOverlayOpen as i}from"./chunk-PGN5ME7B.js";import{createShellPortal as o}from"./chunk-5QRHQCRG.js";import{Z_LAYERS as a}from"./chunk-62LW225J.js";import{popupBounds as c,VIEWPORT_MARGIN as s,placeMenu as u,followAnchor as l}from"./chunk-TAHHZGRH.js";import{useHydrated as d}from"./chunk-KEFNQEXZ.js";import{useBrowserLayoutEffect as m}from"./chunk-PU2GJVMG.js";import{buttonClasses as p}from"./chunk-UQYNPYF4.js";import{registerModalEscapeInterceptor as f}from"./chunk-TWVUQUUD.js";import{useState as h,useRef as g,useId as v,useCallback as b,useEffect as w}from"react";import{jsxs as x,jsx as y}from"react/jsx-runtime";var k=/(^|[\s:])!?z-/;function C({trigger:C,children:N,title:j,description:E,"aria-label":H,align:D="start",side:T="bottom",open:O,defaultOpen:$=!1,onOpenChange:P,matchTriggerWidth:W=!1,maxHeight:G,initialFocus:L,id:M,triggerLabel:R,"aria-describedby":K,disabled:Q,className:S="",triggerClassName:U,panelClassName:z=""}){const[F,Y]=h($),Z=(O??F)&&!Q,B=d(),J=g(null),I=g(null),V=g(null),A=g(null),X=v(),q=M??X,_=v(),ee=v(),te=v(),re=g(null),ne=g(!1),ie=g({openProp:O,onOpenChange:P});ie.current={openProp:O,onOpenChange:P};const oe=b(e=>{void 0===ie.current.openProp&&Y(e),ie.current.onOpenChange?.(e)},[]),ae=b((e=!1)=>{ne.current=e,oe(!1)},[oe]),ce=e=>{re.current=e.nativeEvent},se=b(()=>{const e=V.current,t=I.current;if(!e||!t)return;const r=t.getBoundingClientRect(),n=c(t),i=Math.max(0,n.right-n.left-2*s),o=e.style;o.left="0px",o.top="0px",o.maxWidth=`${i}px`,o.maxHeight="none",o.width=W?`${Math.min(r.width,i)}px`:"";const a={width:e.offsetWidth,height:e.offsetHeight},l=G??1/0,d=u({trigger:r,menu:{width:a.width,height:Math.min(a.height,l)},bounds:n,align:D,side:T}),m=Math.min(d.maxHeight,l);o.left=`${d.left}px`,o.top=`${d.top}px`,o.maxHeight=`${m}px`,o.overflowY=a.height>m?"auto":"",e.dataset.side=d.side,e.dataset.align=D},[D,T,W,G]);m(()=>{Z&&B&&se()}),w(()=>{if(!Z||!B)return;const e=l(()=>I.current,se),t=A.current;if(!t||"undefined"==typeof ResizeObserver)return e;const r=new ResizeObserver(()=>se());return r.observe(t),()=>{e(),r.disconnect()}},[Z,B,se]),w(()=>{if(!Z)return;const e=e=>{let t=null,r=0;const n=e=>{t===e&&(t=null,window.clearTimeout(r),(e=>{if(re.current===e)return!1;const t=e.target;return!(t&&(J.current?.contains(t)||V.current?.contains(t)))})(e)&&ae(!0))},i=e=>{t=e,r=window.setTimeout(()=>n(e),0)},o=e=>n(e);return document.addEventListener(e,i,!0),window.addEventListener(e,o),()=>{window.clearTimeout(r),document.removeEventListener(e,i,!0),window.removeEventListener(e,o)}},t=e("pointerdown"),r=e("focusin"),n=i(()=>ae()),o=f(e=>"Escape"===e.key&&(ae(),I.current?.focus(),!0),()=>V.current);return()=>{t(),r(),n(),o()}},[Z,ae]),e(V,Z&&B),m(()=>{if(!Z||!B)return;const e=V.current;return()=>{if(ne.current)return;const t=document.activeElement;t&&t!==document.body&&!e?.contains(t)||I.current?.focus({preventScroll:!0})}},[Z,B]),w(()=>{if(!Z||!B)return;const e=V.current;e&&(ne.current=!1,(L?.current??t(e)[0]??e).focus({preventScroll:!0}))},[Z,B]);const ue="function"==typeof N?N({close:()=>ae()}):N,le=j?{"aria-labelledby":ee}:H?{"aria-label":H}:{"aria-labelledby":q};/* @__PURE__ */
2
- return x("div",{ref:J,className:`relative inline-flex ${S}`.trim(),children:[
3
- /* @__PURE__ */y("button",{ref:I,id:q,type:"button","aria-haspopup":"dialog","aria-expanded":Z,"aria-controls":Z&&B?_:void 0,"aria-label":R,"aria-describedby":K,disabled:Q,onClick:()=>Z?ae():oe(!0),onKeyDown:e=>{if("Tab"!==e.key||e.shiftKey||!Z)return;const r=(()=>{const e=V.current;return e?t(e)[0]??e:null})();r&&(e.preventDefault(),r.focus({preventScroll:!0}))},className:U??p({variant:"secondary"}),children:C}),Z&&B&&o(
4
- /* @__PURE__ */y("div",{ref:V,id:_,role:"dialog",...le,"aria-describedby":E?te:void 0,tabIndex:-1,"data-popover-panel":"",onPointerDownCapture:ce,onFocusCapture:ce,onKeyDown:e=>{const n=V.current,i=I.current;if("Tab"!==e.key||!n||!i||!n.contains(e.target))return;const o=t(n),a=document.activeElement;if(e.shiftKey){if(o.length>0&&a!==o[0]&&a!==n)return;return e.preventDefault(),void i.focus({preventScroll:!0})}if(o.length>0&&a!==o[o.length-1])return;e.preventDefault();const c=r(i,n);ae(!!c),(c??i).focus({preventScroll:!0})},className:`fixed rounded-xl border border-gray-200 bg-white p-3 shadow-lg ${z}`.trim(),style:k.test(z)?void 0:{zIndex:a.popup},children:/* @__PURE__ */x("div",{ref:A,children:[j&&/* @__PURE__ */y("h2",{id:ee,className:"text-sm font-semibold text-gray-900",children:j}),E&&/* @__PURE__ */y("p",{id:te,className:`mt-1 ${n}`,children:E}),j||E?/* @__PURE__ */y("div",{className:"mt-3",children:ue}):ue]})}),document.body)]})}export{C as Popover};
@@ -1,6 +0,0 @@
1
- import{useOverlayTarget as e,usePopupAnchor as r,usePanelPosition as l,usePopupLevel as t,usePopupLevelBindings as i,windowScrimStyle as a,OverlayLayerProvider as o,scrimHasCorners as n,popupLayerStyle as s,POPUP_GUTTER as d}from"./chunk-CJ4OEY3T.js";import{CloseButton as c}from"./chunk-5QHNDAZ6.js";import{useDiscardGuard as m}from"./chunk-TEQ5ZPAL.js";import{dialogA11y as p}from"./chunk-VWGWZY7A.js";import{useDismissPopupsOnOpen as u}from"./chunk-DBQNYJZ6.js";import{useFocusTrap as f,useScrollLock as h}from"./chunk-DWGYC7OD.js";import{HEADING_TEXT as x,DESCRIPTION_TEXT as v,PANEL_SURFACE as b}from"./chunk-BWJZTHZ6.js";import{createShellPortal as w}from"./chunk-5QRHQCRG.js";import{useHydrated as y}from"./chunk-KEFNQEXZ.js";import{registerModalEscapeInterceptor as $}from"./chunk-TWVUQUUD.js";import{useShellStrings as g}from"./chunk-NRHG4R2Q.js";import{useRef as N,useId as j,useState as k,useEffect as C}from"react";import{jsxs as Q,Fragment as Z,jsx as E}from"react/jsx-runtime";var D=`calc(100% - ${2*d}px)`,H="grid grid-cols-[minmax(0,1fr)_auto]",T="bg-black/30 backdrop-blur-sm",W={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-4xl","2xl":"max-w-6xl",full:"max-w-none"};function A({open:d,onClose:A,title:B,description:G,role:R="dialog",children:Y,footer:J,headerActions:U,blocking:_=!1,size:F="md",aside:O=!1,dirty:V=!1,initialFocus:z,"aria-label":I,"aria-labelledby":K,"aria-describedby":L,className:P=""}){const X=N(null),q=j(),M=j(),S=!_,ee="full"===F,re=ee||null!=U,le=Boolean(B||G),te=j();g().dialog;const ie=e(y()),[ae,oe]=k(null),ne=m({open:d,dirty:V,onClose:A,title:B,layer:ae}),se=N(null),de=r(d&&null!==ie,se),ce=l(de,X),me=t(d&&null!==ie,se),pe=i(me,ae),ue=a(me),fe=null!==me.host;if(u(d),f(X,d&&null!==ie,z,pe),h(d),C(()=>{if(d)return $(()=>!pe.current?.(document.activeElement)&&(_||ne(),!0),()=>X.current)},[d,_,ne,pe]),!d||!ie)return null;/* @__PURE__ */
2
- return Q(Z,{children:[/* @__PURE__ */E("span",{ref:se,hidden:!0,"data-popup-anchor":""}),w(
3
- /* @__PURE__ */E(o,{value:ae,children:/* @__PURE__ */Q("div",{ref:oe,className:"fixed inset-0"+(O?" pointer-events-none opacity-0":fe?" pointer-events-none":""),style:s(me),role:"presentation","data-overlay-layer":"","data-aside":O?"":void 0,children:[!fe&&/* @__PURE__ */E("div",{className:`fixed inset-0 ${T}`,"aria-hidden":"true","data-popup-scrim":"system"}),ue&&/* @__PURE__ */E("div",{className:`fixed ${T}${O?"":" pointer-events-auto"}${n(me)?" rounded-(--radius-window)":""}`,style:ue,onClick:_?void 0:ne,"aria-hidden":"true","data-popup-scrim":"window"}),
4
- /* @__PURE__ */E("div",{className:de?"fixed inset-0":"fixed inset-0 flex items-center justify-center p-4",onClick:_||fe?void 0:e=>{e.target===e.currentTarget&&ne()},children:/* @__PURE__ */Q("div",{ref:X,"data-popup-panel":"",style:de?{left:ce?.left??0,top:ce?.top??0,visibility:ce?void 0:"hidden",width:D,[ee?"height":"maxHeight"]:D}:void 0,...p({role:R,modal:!0,titleId:B?te:void 0,labelledBy:K,label:I}),"aria-describedby":L??(G?M:Y?q:void 0),className:(ee?`${de?"absolute":"relative h-full w-full max-h-full"} ${W[F]} ${H} grid-rows-[auto_minmax(0,1fr)_auto] overflow-hidden rounded-(--radius-popup) ${b}`:`${de?"absolute":"relative max-h-full w-full"} ${W[F]}${re?` ${H} content-start gap-x-2`:""} overflow-y-auto overscroll-contain rounded-(--radius-card) ${b} p-6`)+`${fe&&!O?" pointer-events-auto":""} ${P}`.trimEnd(),children:[ee?le&&
5
- /* @__PURE__ */Q("div",{className:"col-start-1 row-start-1 flex min-h-(--row-height-window-bar) flex-col justify-center border-b border-line py-2 pl-6 pr-4",children:[B&&/* @__PURE__ */E("h2",{id:te,className:x,children:B}),G&&/* @__PURE__ */E("p",{id:M,className:`${B?"mt-1 ":""}${v}`,children:G})]}):B&&/* @__PURE__ */E("h2",{id:te,className:`${re?"col-start-1 row-start-1 ":S?"pr-8 ":""}${x}`,children:B}),!ee&&G&&/* @__PURE__ */E("p",{id:M,className:`${re?"col-start-1 ":""}${B?"mt-1":S&&!re?"pr-8":""} ${v}`.trim(),children:G}),Y&&/* @__PURE__ */E("div",{id:q,className:ee?"col-span-2 row-start-2 min-h-0 overflow-auto":(re?"col-span-2 ":"")+"mt-2 text-sm text-gray-600",children:Y}),J&&/* @__PURE__ */E("div",{className:ee?"col-span-2 row-start-3 flex flex-wrap justify-end gap-3 border-t border-line px-6 py-4":(re?"col-span-2 ":"")+"mt-6 flex flex-wrap justify-end gap-3",children:J}),re?
6
- /* @__PURE__ */Q("div",{className:"col-start-2 row-start-1 flex items-center gap-1 "+(ee?(le?"border-b border-line ":"")+"pr-3":"-mr-3 -mt-3 self-start"),children:[U,S&&/* @__PURE__ */E(c,{onClose:ne})]}):S&&/* @__PURE__ */E(c,{onClose:ne,className:"absolute right-3 top-3"})]})})]})}),ie)]})}export{A as Dialog};
@@ -1,28 +0,0 @@
1
- import{Tree as e,TreeRow as n,TreeGroup as l}from"./chunk-BTMZ5MUY.js";import{ImageLightbox as r}from"./chunk-MQNSKFZY.js";import{MarqueeBox as a}from"./chunk-IC72MGON.js";import{Drawer as i}from"./chunk-DEV3ZHPP.js";import{EmptyState as t}from"./chunk-W3454ZES.js";import{DescriptionList as o}from"./chunk-SACUSHVN.js";import{Breadcrumbs as d}from"./chunk-WREUA43Q.js";import{ROOT_KEY as s,mediaLibraryMenu as c}from"./chunk-UFJR63AO.js";import{useMediaMoveItems as u}from"./chunk-GRAFJD3L.js";import{RenameField as m}from"./chunk-OK2J6WSC.js";import{MediaUploadGrid as p}from"./chunk-B4Y5NGHR.js";import{MediaUsedInList as h}from"./chunk-EULBBS5L.js";import{NativeSelect as f}from"./chunk-W7HTHKN2.js";import{useGridSelection as g}from"./chunk-VLKDWKVR.js";import{useMarquee as v}from"./chunk-OLFYNMTD.js";import{copyToClipboard as k}from"./chunk-XYVFJLAU.js";import{Checkbox_default as y}from"./chunk-CGZBDI6C.js";import{Segmented as b}from"./chunk-TALQMTCE.js";import{useContextMenu as w,ContextMenu as N}from"./chunk-MF7OELXP.js";import{Banner as x}from"./chunk-OSMRYND3.js";import{Input_default as C}from"./chunk-D7MRZZVV.js";import{useFileIntake as I,FileIntakeAlert as D}from"./chunk-TNGIXSTM.js";import{setModalDragAside as S,modalIdHolding as j}from"./chunk-EIFNESXS.js";import{ColoredBadge as L}from"./chunk-L2WQOJ3T.js";import{DropdownMenu as T}from"./chunk-NJY4HPNB.js";import{IconButton_default as z}from"./chunk-APFDZ2HG.js";import{Button_default as F}from"./chunk-A4ROXNUF.js";import{Icon as O}from"./chunk-ISVODSRP.js";import{Tooltip as E}from"./chunk-CIZAUBWA.js";import{buttonClasses as A}from"./chunk-UQYNPYF4.js";import{usePlotWidth as P}from"./chunk-MAFUXCPZ.js";import{useShellStrings as M}from"./chunk-NRHG4R2Q.js";import{useRef as R,useMemo as U,useCallback as B,useState as K,useEffect as H}from"react";import{jsxs as J,Fragment as V,jsx as W}from"react/jsx-runtime";var Z="application/x-efficient-media-files",G="application/x-efficient-media-folder",Y="application/x-efficient-media-file";function Q(e){if(!e||!Array.from(e.types).includes(Y))return null;try{const n=JSON.parse(e.getData(Y));if(n&&"string"==typeof n.id&&"string"==typeof n.url&&"string"==typeof n.name&&("image"===n.kind||"video"===n.kind))return{id:n.id,url:n.url,kind:n.kind,name:n.name}}catch{}return null}var $={type:"all",use:"any",sort:"newest"},X={lock:/* @__PURE__ */W(O,{name:"lock","aria-hidden":"true",className:"h-4 w-4"}),folder:/* @__PURE__ */W(O,{name:"folder","aria-hidden":"true",className:"h-4 w-4"}),folderOpen:/* @__PURE__ */W(O,{name:"folder-open","aria-hidden":"true",className:"h-4 w-4"}),folderPlus:/* @__PURE__ */W(O,{name:"folder-plus","aria-hidden":"true",className:"h-4 w-4"}),trash:/* @__PURE__ */W(O,{name:"trash","aria-hidden":"true",className:"h-4 w-4"}),upload:/* @__PURE__ */W(O,{name:"upload","aria-hidden":"true",className:"h-4 w-4"}),search:/* @__PURE__ */W(O,{name:"search","aria-hidden":"true",className:"h-4 w-4"}),grid:/* @__PURE__ */W(O,{name:"grid","aria-hidden":"true",className:"h-4 w-4"}),list:/* @__PURE__ */W(O,{name:"list","aria-hidden":"true",className:"h-4 w-4"}),more:/* @__PURE__ */W(O,{name:"more","aria-hidden":"true",className:"h-4 w-4"}),copy:/* @__PURE__ */W(O,{name:"copy","aria-hidden":"true",className:"h-4 w-4"}),edit:/* @__PURE__ */W(O,{name:"edit","aria-hidden":"true",className:"h-4 w-4"}),swap:/* @__PURE__ */W(O,{name:"swap","aria-hidden":"true",className:"h-4 w-4"}),crop:/* @__PURE__ */W(O,{name:"crop","aria-hidden":"true",className:"h-4 w-4"}),external:/* @__PURE__ */W(O,{name:"external","aria-hidden":"true",className:"h-4 w-4"}),undo:/* @__PURE__ */W(O,{name:"undo","aria-hidden":"true",className:"h-4 w-4"})},q={link:/* @__PURE__ */W(O,{name:"link","aria-hidden":"true",className:"h-3 w-3"}),email:/* @__PURE__ */W(O,{name:"email","aria-hidden":"true",className:"h-3 w-3"}),lock:/* @__PURE__ */W(O,{name:"lock","aria-hidden":"true",className:"h-3 w-3"}),clock:/* @__PURE__ */W(O,{name:"clock","aria-hidden":"true",className:"h-3 w-3"})};function _(O){const{mode:Q="manage",layout:_="auto",location:ee,onLocationChange:ne,folders:le,products:re,allFilesCount:ae,trashCount:ie,files:te,query:oe,onQueryChange:de,filters:se=$,onFiltersChange:ce,extraFilters:ue,view:me="grid",onViewChange:pe,selectedIds:he,onSelectionChange:fe,usedIn:ge,denied:ve={},accept:ke="image/*,video/*",maxSizeBytes:ye,busy:be,progress:we,onUpload:Ne,onNewFolder:xe,onRename:Ce,onMove:Ie,onTrash:De,onDeleteFolder:Se,onRestore:je,onDeleteForever:Le,onEmptyTrash:Te,onReplace:ze,onCropEdit:Fe,onOpenInDesign:Oe,onChoose:Ee,onCancel:Ae,pickNote:Pe,onDragOut:Me,className:Re=""}=O,Ue=M().mediaLibrary,Be=M().media,Ke="pick"===Q,He=!Ke,Je=R(null),Ve=P(Je,"phone"===_?343:1200),We="phone"===_||"auto"===_&&Ve<640,Ze=U(()=>function(e=[]){const n=/* @__PURE__ */new Map,l=(e,r)=>{for(const a of e){const e=[...r,a];n.set(a.id,{node:a,path:e}),a.children&&l(a.children,e)}};return l(e,[]),n}(re),[re]),Ge=U(()=>new Map(le.map(e=>[e.id,e])),[le]),Ye=U(()=>{const e=/* @__PURE__ */new Map;for(const n of le){const l=n.parentId&&Ge.has(n.parentId)?n.parentId:null;e.set(l,[...e.get(l)??[],n])}return e},[le,Ge]),Qe=B(e=>{const n=[];for(let l=e?Ge.get(e):void 0;l&&(n.unshift(l),!(n.length>le.length));l=l.parentId?Ge.get(l.parentId):void 0);return n},[Ge,le.length]),$e=B((e,n)=>Qe(e).some(e=>e.id===n),[Qe]),[Xe,qe]=K(()=>/* @__PURE__ */new Set(["@files"])),_e=e=>qe(n=>{const l=new Set(n);return l.has(e)?l.delete(e):l.add(e),l}),en=B(e=>{qe(n=>e.every(e=>n.has(e))?n:/* @__PURE__ */new Set([...n,...e]))},[]),nn="files"===(ln=ee).place?`files:${ln.folderId??""}`:"products"===ln.place?`products:${ln.nodeId??""}`:"trash";var ln;H(()=>{if("files"===ee.place)en(["@files",...Qe(ee.folderId).slice(0,-1).map(e=>e.id)]);else if("products"===ee.place){const e=ee.nodeId?Ze.get(ee.nodeId)?.path??[]:[];en(["@products",...e.slice(0,-1).map(e=>`p:${e.id}`)])}},[nn]);const rn="products"===ee.place,an="trash"===ee.place,tn="files"===ee.place,on=tn?ee.folderId:null,dn=rn&&ee.nodeId?Ze.get(ee.nodeId)?.path[0]:void 0,sn=e=>e?.sharedFrom?`${Ue.readOnly} ${Ue.editedAtHq(e.sharedFrom)}`:Ue.readOnly,cn=U(()=>te.map(e=>e.id),[te]),un=U(()=>new Map(te.map(e=>[e.id,e])),[te]),mn=g(cn),pn=U(()=>cn.filter(e=>mn.selected.has(e)),[cn,mn.selected]),hn=1===pn.length?un.get(pn[0]):void 0,fn=R(!0);H(()=>{fn.current?fn.current=!1:mn.clear()},[nn]);const gn=he?.join("\0");H(()=>{he&&mn.setSelection(he)},[gn]);const vn=R(gn??""),kn=pn.join("\0");H(()=>{vn.current!==kn&&(vn.current=kn,fe?.(pn))},[kn]);const yn=(e,n={})=>{Ke?mn.select(e):mn.select(e,{ctrl:!(!n.ctrlKey&&!n.metaKey),shift:!!n.shiftKey})},[bn,wn]=K(null),Nn=e=>{const n=bn;if(wn(null),!n||null==e)return;e!==("folder"===n.kind?Ge.get(n.id)?.name:un.get(n.id)?.name)&&Ce?.(n,e)},xn=async e=>{if(!xe)return;const n=await xe(e);en(["@files",...e?[e]:[]]),"string"==typeof n&&wn({kind:"folder",id:n})},Cn=B(e=>{const n=[],l=n=>{if("files"===e.kind)return n===on&&tn?Ue.alreadyHere:void 0;const l=Ge.get(e.id);return n===e.id||n&&$e(n,e.id)?Ue.notIntoItself:(l?.parentId??null)===n?Ue.folderAlreadyHere:void 0};n.push({key:s,label:Ue.allFiles,disabledReason:l(null)});const r=(e,a)=>{for(const i of Ye.get(e)??[])n.push({key:i.id,label:i.name,depth:a,disabledReason:l(i.id)}),r(i.id,a+1)};return r(null,1),n},[Ye,Ge,tn,$e,on,Ue]),In=B(e=>{const n=new Set(e.map(e=>un.get(e)?.kind??"image"));return 1===n.size?[...n][0]:"file"},[un]),[Dn,Sn]=K(null),jn={words:Ue,media:Be,denied:ve,moveTargets:Cn,kindOf:In,urlOf:e=>un.get(e)?.url,newSubfolder:xe&&He?e=>{xn(e)}:void 0,rename:Ce&&He?e=>{"file"!==e.kind||mn.isSelected(e.id)||mn.select(e.id),wn(e)}:void 0,move:Ie&&He?Ie:void 0,trash:De&&He?De:void 0,deleteFolder:Se&&He?Se:void 0,folderNotEmpty:e=>!!Ge.get(e)?.notEmpty,replace:ze&&He?ze:void 0,copyUrl:e=>{const n=un.get(e)?.url;n&&k(Ue.urlLabel,n)},openInDesign:Oe,restore:je,deleteForever:Le},Ln=e=>c(e,jn),Tn=w(),zn=(e,n)=>{Ke||(mn.isSelected(e)||mn.select(e),Tn.open(n,(e=>{const n=mn.isSelected(e)?pn:[e];return rn?{kind:"render",id:e}:an?{kind:"trashed",ids:n}:{kind:"files",ids:n}})(e)))},[Fn,On]=K(null),[En,An]=K(null),[Pn,Mn]=K(null);H(()=>{if(!En&&!Fn)return;const e=()=>{An(null),On(null)};return window.addEventListener("dragend",e),window.addEventListener("drop",e),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",e)}},[En,Fn]);const Rn=(e,n)=>Array.from(e.dataTransfer?.types??[]).includes(n),Un=(e,n)=>!(!Ie||ve.move||Ke)&&(!!Rn(e,Z)||!(!Rn(e,G)||!Pn)&&(n!==Pn&&!(n&&$e(n,Pn)))),Bn=(e,n)=>({onDragEnter:l=>{Un(l,n)&&(l.preventDefault(),On(e))},onDragOver:l=>{Un(l,n)&&(l.preventDefault(),l.dataTransfer.dropEffect="move",Fn!==e&&On(e))},onDragLeave:n=>{const l=n.relatedTarget;l&&n.currentTarget.contains(l)||On(n=>n===e?null:n)},onDrop:e=>{if(Un(e,n))if(e.preventDefault(),On(null),Rn(e,Z)){let l;try{l=JSON.parse(e.dataTransfer.getData(Z))}catch{l=null}Array.isArray(l)&&l.length&&Ie({kind:"files",ids:l.map(String)},n)}else Pn&&(Ie({kind:"folder",id:Pn},n),Mn(null))}}),Kn=e=>{const n=e=>Rn(e,Z)||Rn(e,G)||Rn(e,"Files");return{onDragEnter:l=>{n(l)&&An(e)},onDragOver:l=>{n(l)&&En!==e&&An(e)},onDragLeave:n=>{const l=n.relatedTarget;l&&n.currentTarget.contains(l)||An(n=>n===e?null:n)}}},Hn=(e,n,l)=>/* @__PURE__ */W(E,{side:"right",content:En===e?Ue.noDropProducts:sn(l),open:En===e||!En&&void 0,children:/* @__PURE__ */W("span",{children:n})}),Jn=e=>({onContextMenu:n=>{Tn.open(n,e)}}),Vn=(e,r,a)=>e.map(e=>{const i=`p:${e.id}`,t=a??e,o=Xe.has(i),d=e.children?.length?e.children:null;/* @__PURE__ */
2
- return J("div",{role:"none",className:"contents",children:[
3
- /* @__PURE__ */W(n,{label:Hn(i,e.name,t),level:r,icon:d&&o?X.folderOpen:X.folder,count:e.count,countLabel:null!=e.count?e.countLabel??Ue.fileCount(e.count):void 0,selected:rn&&ee.nodeId===e.id,expanded:d?o:void 0,onToggle:d?()=>_e(i):void 0,onSelect:()=>ne({place:"products",nodeId:e.id}),rowProps:{"data-media-row":i,...Kn(i),...He?Jn({kind:"product-node",id:e.id}):{}}}),d&&o&&/* @__PURE__ */W(l,{children:Vn(d,r+1,t)})]},e.id)}),Wn=(e,r)=>(Ye.get(e)??[]).map(e=>{const a=Ye.get(e.id),i=Xe.has(e.id),t="folder"===bn?.kind&&bn.id===e.id,o=Ln({kind:"folder",id:e.id});/* @__PURE__ */
4
- return J("div",{role:"none",className:"contents",children:[
5
- /* @__PURE__ */W(n,{label:e.name,level:r,icon:a&&i?X.folderOpen:X.folder,count:e.count,countLabel:null!=e.count?e.countLabel??Ue.fileCount(e.count):void 0,selected:t||tn&&ee.folderId===e.id,expanded:a?i:void 0,onToggle:a?()=>_e(e.id):void 0,onSelect:()=>ne({place:"files",folderId:e.id}),drop:Fn===e.id?"into":void 0,dragging:Pn===e.id,draggable:He&&!!Ie&&!ve.move,rename:t?/* @__PURE__ */W(m,{value:e.name,label:Ue.folderName,onDone:Nn}):void 0,actions:He&&o.length?/* @__PURE__ */W(T,{align:"end","aria-label":Ue.folderActions,trigger:X.more,items:o}):void 0,rowProps:{"data-media-row":e.id,...Bn(e.id,e.id),...He?Jn({kind:"folder",id:e.id}):{},...He&&Ie&&!ve.move?{draggable:!0,onDragStart:n=>{n.dataTransfer.effectAllowed="move",n.dataTransfer.setData(G,e.id),Mn(e.id)},onDragEnd:()=>{Mn(null),On(null)}}:{}}}),a&&i&&/* @__PURE__ */W(l,{children:Wn(e.id,r+1)})]},e.id)}),Zn=Xe.has("@files"),Gn=Xe.has("@products"),Yn=/* @__PURE__ */J(e,{"aria-label":Ue.folders,children:[re&&/* @__PURE__ */J(V,{children:[
6
- /* @__PURE__ */W(n,{label:Hn("@products",Ue.products),level:1,icon:X.lock,badge:{label:Ue.readOnlyBadge,tone:"neutral"},expanded:re.length?Gn:void 0,onToggle:()=>_e("@products"),selected:rn&&null==ee.nodeId,onSelect:()=>ne({place:"products",nodeId:null}),rowProps:{"data-media-row":"@products",...Kn("@products")}}),Gn&&re.length>0&&/* @__PURE__ */W(l,{children:Vn(re,2)})]}),
7
- /* @__PURE__ */W(n,{label:Ue.allFiles,level:1,icon:Zn?X.folderOpen:X.folder,count:ae,countLabel:null!=ae?Ue.fileCount(ae):void 0,expanded:Ye.get(null)?.length?Zn:void 0,onToggle:()=>_e("@files"),selected:tn&&null==ee.folderId,onSelect:()=>ne({place:"files",folderId:null}),drop:"@files"===Fn?"into":void 0,rowProps:{"data-media-row":"@files",...Bn("@files",null)}}),Zn&&(Ye.get(null)?.length??0)>0&&/* @__PURE__ */W(l,{children:Wn(null,2)}),He&&/* @__PURE__ */W(n,{label:Ue.trash,level:1,icon:X.trash,count:ie,countLabel:null!=ie?Ue.fileCount(ie):void 0,selected:an,onSelect:()=>ne({place:"trash"}),rowProps:{"data-media-row":"@trash"}})]}),Qn=(()=>{if(an)return[{label:Ue.trash}];if(rn){const e=ee.nodeId?Ze.get(ee.nodeId)?.path??[]:[];return[{label:Ue.products,onClick:e.length?()=>ne({place:"products",nodeId:null}):void 0},...e.map((n,l)=>({label:n.name,onClick:l<e.length-1?()=>ne({place:"products",nodeId:n.id}):void 0}))]}const e=Qe(on);return[{label:Ue.allFiles,onClick:e.length?()=>ne({place:"files",folderId:null}):void 0},...e.map((n,l)=>({label:n.name,onClick:l<e.length-1?()=>ne({place:"files",folderId:n.id}):void 0}))]})(),$n=rn?Ue.readOnly:ve.upload,Xn=!!Ne&&!an&&!$n,qn=I({accept:ke,maxSizeBytes:ye,multiple:!0,disabled:!Xn,onAccept:e=>Ne?.(e,on)}),_n=rn?Ue.noProductFolder:ve.newFolder,el=e=>e?{"aria-disabled":!0,disabledReason:e}:{},nl=/* @__PURE__ */J("div",{className:"flex flex-wrap items-center gap-2",children:[He&&xe&&!an&&/* @__PURE__ */W(F,{variant:"secondary",size:"sm",leftIcon:X.folderPlus,onClick:()=>{xn(on)},...el(_n),children:Ue.newFolder}),Ne&&!an&&/* @__PURE__ */W(F,{variant:"primary",size:"sm",leftIcon:X.upload,onClick:()=>qn.open(),...el($n),children:Ue.upload}),He&&an&&Te&&te.length>0&&/* @__PURE__ */W(F,{variant:"danger",size:"sm",onClick:Te,...el(ve.deleteForever),children:Ue.emptyTrash})]}),ll=(e,n,l,r,a)=>/* @__PURE__ */W("div",{style:{width:We?void 0:a,flex:We?"1 1 120px":"0 0 auto",minWidth:0},children:/* @__PURE__ */W(f,{size:"sm","aria-label":e,value:n,onChange:r,options:l})},e),rl=e=>n=>ce?.({...se,[e]:n}),al=/* @__PURE__ */J("div",{className:"flex flex-wrap items-center gap-2",children:[de&&/* @__PURE__ */W("div",{style:{flex:"1 1 200px",minWidth:0},children:/* @__PURE__ */W(C,{size:"sm",type:"search",leftIcon:X.search,placeholder:rn?Ue.searchProducts:Ue.search,"aria-label":rn?Ue.searchProducts:Ue.search,value:oe??"",onChange:e=>de(e.target.value)})}),ce&&ll(Ue.mediaType,se.type,[{value:"all",label:Ue.allTypes},{value:"image",label:Ue.images},{value:"video",label:Ue.videos},{value:"svg",label:"SVG"},{value:"gif",label:"GIF"}],rl("type"),130),ce&&!rn&&!an&&ll(Ue.use,se.use,[{value:"any",label:Ue.anyUse},{value:"email",label:Ue.emailOnly},{value:"website",label:Ue.websiteOnly},{value:"unused",label:Ue.notUsed}],rl("use"),130),ce&&He&&ll(Ue.sort,se.sort,[{value:"newest",label:Ue.newest},{value:"name",label:Ue.byName},{value:"size",label:Ue.bySize}],rl("sort"),110),ue?.map(e=>ll(e.label,e.value,e.options,e.onChange,120)),pe&&/* @__PURE__ */W(b,{size:"sm",label:Ue.view,value:me,onChange:pe,options:[{value:"grid",label:Ue.grid,icon:X.grid},{value:"list",label:Ue.list,icon:X.list}]})]}),il=e=>{const n=[];return null!=e.trashedDaysAgo&&n.push({key:"t",label:Ue.daysAgo(e.trashedDaysAgo),count:e.trashedDaysAgo,icon:q.clock,tone:"neutral"}),e.usedCount&&n.push({key:"u",label:Ue.used(e.usedCount),count:e.usedCount,icon:q.link,tone:"active"}),e.email&&n.push({key:"e",label:Ue.email,icon:q.email,tone:"queued"}),e.private&&n.push({key:"p",label:Ue.private,icon:q.lock,tone:"neutral"}),n},tl=e=>il(e).map(e=>/* @__PURE__ */W(L,{tone:e.tone,size:"xs",children:e.label},e.key)),ol=He&&tn&&!!Ie&&!ve.move,dl=!!Me&&!an,sl=R(""),cl=R(null),ul=()=>cl.current?.dropped?"dropped":"cancelled",ml=R(Me);ml.current=Me;const pl=B(e=>{const n=cl.current;n&&(cl.current=null,n.stop(),S(sl.current,!1),e&&ml.current?.(e))},[]),hl=B(e=>{pl(ul());const n=Je.current?.ownerDocument;if(!n)return;sl.current=j(Je.current);const l=Je.current?.closest("[data-modal-panel]"),r=e=>{sl.current&&!l?.contains(e.target)&&S(sl.current,!0)},a=()=>!!e&&!e.isConnected,i=()=>{const e=cl.current;if(e){if(a())return pl("dropped");e.dropped=!0,S(sl.current,!1)}},t=e=>{const n=e.dataTransfer?.dropEffect;pl(n&&"none"!==n?"dropped":a()?ul():"cancelled")},o=()=>{a()&&pl(ul())},d=["pointermove","pointerdown","mousemove","mousedown"];n.addEventListener("dragover",r,!0),n.addEventListener("drop",i,!0),n.addEventListener("dragend",t,!0);for(const e of d)n.addEventListener(e,o,!0);cl.current={dropped:!1,stop:()=>{n.removeEventListener("dragover",r,!0),n.removeEventListener("drop",i,!0),n.removeEventListener("dragend",t,!0);for(const e of d)n.removeEventListener(e,o,!0)}}},[pl]);H(()=>()=>pl(ul()),[pl]);const fl=(e,n,l)=>{if("start"!==e)return;const r=un.get(n);r&&gl(r)&&(hl(l??null),Me(e))},gl=e=>!dl||e.private||e.pickDisabledReason?void 0:JSON.stringify({id:e.id,url:e.url,kind:"video"===e.kind?"video":"image",name:e.name}),vl=te.map(e=>({id:e.id,url:e.thumbUrl??e.url,name:e.name,kind:e.kind,caption:e.name,badges:il(e),dragData:ol?JSON.stringify(mn.isSelected(e.id)?pn:[e.id]):gl(e),...ol&&gl(e)?{dragAlso:{[Y]:gl(e)}}:{}})),kl=We?Math.max(72,Math.floor((Ve-24-16-1)/3)):112,yl=R(null),bl=v({containerRef:yl,enabled:He&&!We&&te.length>0,selected:mn.selected,setSelection:e=>mn.setSelection(e),clearSelection:mn.clear}),wl=e=>{if(Ke){const n=un.get(e);return void(!n||n.private||n.pickDisabledReason||Ee?.(n))}const n=cn.indexOf(e);n>=0&&Sn(n)},Nl=te.length?null:oe?/* @__PURE__ */W(t,{variant:"dashed",title:Ue.noMatches}):rn?/* @__PURE__ */W(t,{variant:"dashed",title:Ue.emptyProducts,description:sn(dn)}):an?/* @__PURE__ */W(t,{variant:"dashed",title:Ue.trashEmpty}):!Xn||Ke?/* @__PURE__ */W(t,{variant:"dashed",title:Ue.emptyFolder}):null,xl="list"===me&&te.length>0,Cl=Nl??(xl?/* @__PURE__ */W("ul",{role:"listbox","aria-multiselectable":He||void 0,"aria-label":Ue.folders,className:"flex flex-col gap-1",children:te.map(e=>/* @__PURE__ */J("li",{role:"option","aria-selected":mn.isSelected(e.id),tabIndex:0,"data-grid-item":"","data-grid-id":e.id,onClick:n=>yn(e.id,n),onDoubleClick:()=>wl(e.id),onContextMenu:n=>zn(e.id,n),draggable:!!gl(e)||void 0,onDragStart:gl(e)?n=>{n.dataTransfer.effectAllowed="link",n.dataTransfer.setData(Y,gl(e)),fl("start",e.id,n.currentTarget)}:void 0,onKeyDown:n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),yn(e.id,n))},className:"flex h-12 cursor-pointer items-center gap-3 rounded-md px-2 text-sm rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)] "+(mn.isSelected(e.id)?"bg-accent-tint text-blue-700":"text-ink hover:bg-gray-100"),children:[
8
- /* @__PURE__ */W("img",{src:e.thumbUrl??e.url,alt:"",className:"h-10 w-10 shrink-0 rounded bg-gray-100 object-contain"}),
9
- /* @__PURE__ */W("span",{className:"min-w-0 flex-1 truncate",children:e.name}),
10
- /* @__PURE__ */W("span",{className:"flex shrink-0 items-center gap-1",children:tl(e)}),e.sizeLabel&&/* @__PURE__ */W("span",{className:"w-16 shrink-0 text-right text-xs text-ink-faint",children:e.sizeLabel})]},e.id))}):/* @__PURE__ */W(p,{items:vl,readOnly:!Xn||Ke,onFiles:Xn&&!Ke?e=>Ne(e,on):void 0,accept:ke,maxSizeBytes:ye,busy:be,progress:we,fit:"contain",thumbSize:kl,dragType:ol?Z:dl?Y:void 0,onDragOutChange:dl?(e,n,l)=>fl(e,n,l):void 0,selected:mn.selected,onItemClick:yn,onItemDoubleClick:wl,onItemContextMenu:He?zn:void 0,menuOnMedia:He})),Il=u({count:pn.length,kind:In(pn),targets:Cn({kind:"files",ids:pn}),onPick:e=>Ie?.({kind:"files",ids:pn},e.key===s?null:e.key)}),Dl=A({variant:"secondary",size:"sm"}),Sl=/* @__PURE__ */W(T,{align:"start",triggerClassName:Dl,trigger:/* @__PURE__ */J(V,{children:[X.folder,Ue.moveTo]}),items:Il,disabled:!!ve.move}),jl=He&&pn.length>1&&!rn?/* @__PURE__ */J("div",{"data-media-bulk":"",className:"flex flex-wrap items-center gap-2 rounded-lg border border-line px-3 py-2",children:[
11
- /* @__PURE__ */W(y,{checked:pn.length===te.length,indeterminate:pn.length<te.length,onChange:e=>e?mn.selectAll():mn.clear(),label:Ue.selected(pn.length)}),/* @__PURE__ */J(V,an?{children:[je&&/* @__PURE__ */W(F,{variant:"secondary",size:"sm",leftIcon:X.undo,onClick:()=>je(pn),...el(ve.restore),children:Ue.restore}),Le&&/* @__PURE__ */W(F,{variant:"secondary-danger",size:"sm",onClick:()=>Le(pn),...el(ve.deleteForever),children:Ue.deleteForever})]}:{children:[Ie&&Sl,Ce&&/* @__PURE__ */W(F,{variant:"secondary",size:"sm",leftIcon:X.edit,disabled:!0,children:Ue.rename}),De&&/* @__PURE__ */W(F,{variant:"secondary",size:"sm",leftIcon:X.trash,onClick:()=>De({kind:"files",ids:pn}),...el(ve.trash),children:Ue.moveFilesToTrash(pn.length)})]}),
12
- /* @__PURE__ */W(F,{variant:"ghost",size:"sm",onClick:mn.clear,children:Ue.clearSelection})]}):null,Ll=e=>{const n=[],l=(e,l,r)=>{null!=r&&""!==r&&n.push({key:e,label:l,value:r})},r="file"===bn?.kind&&bn.id===e.id;l("name",Ue.name,r?/* @__PURE__ */W(m,{value:e.name,label:Ue.fileName,onDone:Nn}):e.name),l("type",Ue.type,e.typeLabel),l("size",Ue.size,e.sizeLabel),l("resolution",Ue.resolution,e.resolution),rn?(l("design",Ue.design,e.design),l("finish",Ue.finish,e.finish),l("angle",Ue.angleLug,e.angleLug),l("owner",Ue.owner,e.owner)):(l("added",Ue.addedBy,e.addedBy),l("folder",Ue.folder,e.folderPath)),l("used",Ue.usedIn,null!=e.usedCount?Ue.places(e.usedCount):void 0);const a=c({kind:"files",ids:[e.id]},jn).find(e=>"submenu"===e.type);/* @__PURE__ */
13
- return J("div",{"data-media-details":"",className:"flex flex-col gap-3",children:[
14
- /* @__PURE__ */W("img",{src:e.url,alt:e.name,className:"aspect-square w-full rounded-lg bg-gray-100 object-contain"}),rn&&/* @__PURE__ */W(x,{tone:"neutral",title:Ue.readOnlyBadge,children:sn(dn)}),
15
- /* @__PURE__ */W(o,{size:"sm",columns:1,items:n}),!an&&/* @__PURE__ */J("div",{className:"flex gap-2",children:[
16
- /* @__PURE__ */W("div",{style:{flex:"1 1 0",minWidth:0},children:/* @__PURE__ */W(C,{size:"sm",readOnly:!0,value:e.url,"aria-label":Ue.fileUrl,onFocus:e=>e.currentTarget.select()})}),
17
- /* @__PURE__ */W(F,{variant:"secondary",size:"sm",leftIcon:X.copy,onClick:()=>jn.copyUrl(e.id),children:Ue.copyUrl})]}),tn&&He&&/* @__PURE__ */J("div",{className:"flex flex-wrap gap-2",children:[ze&&/* @__PURE__ */W(F,{variant:"secondary",size:"sm",leftIcon:X.swap,onClick:()=>ze(e.id),...el(ve.replace),children:Ue.replace}),Fe&&/* @__PURE__ */W(F,{variant:"secondary",size:"sm",leftIcon:X.crop,onClick:()=>Fe(e.id),children:Ue.cropEdit}),Ie&&"submenu"===a?.type&&/* @__PURE__ */W(T,{align:"start",triggerClassName:Dl,trigger:/* @__PURE__ */J(V,{children:[X.folder,Ue.moveTo]}),items:a.items,disabled:!!ve.move}),Ce&&/* @__PURE__ */W(F,{variant:"secondary",size:"sm",leftIcon:X.edit,onClick:()=>wn({kind:"file",id:e.id}),...el(ve.rename),children:Ue.rename}),De&&/* @__PURE__ */W(z,{"aria-label":Ue.moveToTrash,size:"sm",onClick:()=>De({kind:"files",ids:[e.id]}),disabledReason:ve.trash,"aria-disabled":!!ve.trash||void 0,children:X.trash})]}),an&&He&&/* @__PURE__ */J("div",{className:"flex flex-wrap gap-2",children:[je&&/* @__PURE__ */W(F,{variant:"primary",size:"sm",leftIcon:X.undo,onClick:()=>je([e.id]),...el(ve.restore),children:Ue.restore}),Le&&/* @__PURE__ */W(F,{variant:"danger",size:"sm",onClick:()=>Le([e.id]),...el(ve.deleteForever),children:Ue.deleteForever})]}),rn&&Oe&&/* @__PURE__ */W(F,{variant:"secondary",size:"sm",leftIcon:X.external,onClick:()=>Oe({kind:"render",id:e.id}),children:Ue.openInDesign}),ge&&/* @__PURE__ */W(h,{items:ge})]})},Tl=hn?hn.private?Ue.privateNoPick:hn.pickDisabledReason:void 0,zl=Ke?/* @__PURE__ */J("div",{"data-media-picker-footer":"",className:"flex flex-wrap items-center justify-between gap-2 border-t border-line px-3 py-2",children:[
18
- /* @__PURE__ */W("span",{className:"min-w-0 truncate text-sm text-ink-faint",children:hn?Ue.oneChosen(hn.name):Ue.noneChosen}),
19
- /* @__PURE__ */J("div",{className:"flex gap-2",children:[Ae&&/* @__PURE__ */W(F,{variant:"secondary",size:"sm",onClick:Ae,children:Ue.cancel}),
20
- /* @__PURE__ */W(F,{variant:"primary",size:"sm",disabled:!hn,...el(Tl),onClick:()=>{hn&&!Tl&&Ee?.(hn)},children:Ue.chooseImage})]})]}):null,Fl=He&&!!hn,Ol=/* @__PURE__ */J("div",{className:"flex min-w-0 flex-col gap-3",children:[Pe&&/* @__PURE__ */W(x,{tone:"neutral",children:Pe}),
21
- /* @__PURE__ */J("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[
22
- /* @__PURE__ */W(d,{items:Qn}),nl]}),al,jl,
23
- /* @__PURE__ */J("div",{ref:yl,className:"relative",onPointerDown:bl.onPointerDown,onKeyDown:e=>{He&&(e.ctrlKey||e.metaKey)&&"a"===e.key.toLowerCase()?(e.preventDefault(),mn.selectAll()):"Escape"===e.key&&mn.size&&mn.clear()},children:[Cl,
24
- /* @__PURE__ */W(a,{rect:bl.rect})]}),Xn&&/* @__PURE__ */W("input",{...qn.inputProps}),
25
- /* @__PURE__ */W(D,{rejections:qn.rejections})]});/* @__PURE__ */
26
- return J("div",{ref:Je,"data-media-library":"","data-layout":We?"phone":"wide",className:`flex h-full min-h-0 min-w-0 flex-col ${Re}`.trim(),children:[/* @__PURE__ */J("div",We?{className:"flex flex-col gap-3 p-3",children:[Yn,Ol]}:{className:"flex min-h-0 min-w-0 flex-1",children:[
27
- /* @__PURE__ */W("div",{className:"shrink-0 overflow-y-auto border-r border-line p-3",style:{width:280,"--rosh-tree-ground":"var(--surface)"},children:Yn}),
28
- /* @__PURE__ */W("div",{className:"min-w-0 flex-1 overflow-y-auto p-3",children:Ol}),Fl&&/* @__PURE__ */W("div",{className:"shrink-0 overflow-y-auto border-l border-line p-3",style:{width:300},children:Ll(hn)})]}),zl,We&&/* @__PURE__ */W(i,{open:Fl,onClose:mn.clear,side:"bottom",title:hn?.name,children:hn&&Ll(hn)}),Tn.state&&/* @__PURE__ */W(N,{...Tn.props,items:Ln(Tn.state.data)}),null!=Dn&&te.length>0&&/* @__PURE__ */W(r,{images:te.map(e=>({url:e.url,caption:e.name})),startIndex:Math.min(Dn,te.length-1),onClose:()=>Sn(null)})]})}export{Z as MEDIA_FILES_DRAG_TYPE,Y as MEDIA_FILE_DRAG_TYPE,G as MEDIA_FOLDER_DRAG_TYPE,_ as MediaLibrary,Q as readMediaFileDrag};
@@ -1,2 +0,0 @@
1
- import{isAriaDisabled as e,swallowPress as a,describedByWith as r,OffWithReason as i}from"./chunk-TSZPGDU3.js";import{SpinnerRing as s}from"./chunk-R2VKEMZH.js";import{useRowControlSize as l}from"./chunk-3FININUU.js";import{buttonClasses as d}from"./chunk-UQYNPYF4.js";import{forwardRef as n,useId as o}from"react";import{jsxs as t,jsx as c}from"react/jsx-runtime";var m=n(function({variant:n="primary",size:m="md",loading:p=!1,leftIcon:b,rightIcon:f,block:u=!1,disabled:h,type:k="button",children:x,className:N="",disabledReason:y,onClick:j,pressed:v,"aria-disabled":g,"aria-describedby":I,...U},w){const z=l(m)??"md",C=o(),F=h||p,P=null!=y&&""!==y,R=F&&P,Y=!F&&e(g),Z=Y&&P,D=R||Z?C:void 0,E=/* @__PURE__ */t("button",{ref:w,type:k,disabled:F,"aria-busy":p||void 0,"aria-disabled":!!Y||g,"aria-describedby":r(I,D),onClick:Y?a:j,className:d({variant:n,size:z,block:u,pressed:v??(!0===U["aria-pressed"]||"true"===U["aria-pressed"]),className:N}),...U,children:[p?/* @__PURE__ */c(s,{className:"h-3.5 w-3.5",ink:""}):b,x,!p&&f]});return Z?/* @__PURE__ */c(i,{reason:y,id:C,block:u,children:E}):R?/* @__PURE__ */t("span",{className:u?"flex w-full flex-col gap-1":"inline-flex flex-col items-start gap-1",children:[E,
2
- /* @__PURE__ */c("span",{id:D,className:"text-xs text-red-600",children:y})]}):E});export{m as Button_default};
@@ -1 +0,0 @@
1
- import{isAriaDisabled as e,swallowPress as r,describedByWith as i,OffWithReason as a}from"./chunk-TSZPGDU3.js";import{useRowControlSize as s}from"./chunk-3FININUU.js";import{iconButtonClasses as d}from"./chunk-UQYNPYF4.js";import{forwardRef as o,useId as n}from"react";import{jsx as t}from"react/jsx-runtime";var c=o(function({children:o,variant:c="ghost",size:l="md",type:m="button",className:p="",pressed:b,disabledReason:u,ink:f,disabled:h,onClick:k,"aria-disabled":N,"aria-describedby":v,...j},y){const U=s(l)??"md",x=n(),z=(Boolean(h)||e(N))&&null!=u&&""!==u,C=z||e(N),F=/* @__PURE__ */t("button",{ref:y,type:m,className:d({variant:c,size:U,pressed:b??(!0===j["aria-pressed"]||"true"===j["aria-pressed"]),ink:f,className:p}),...j,disabled:z?void 0:h,"aria-disabled":!!C||N,"aria-describedby":i(v,z?x:void 0),onClick:C?r:k,children:o});return z?/* @__PURE__ */t(a,{reason:u,id:x,children:F}):F});export{c as IconButton_default};
@@ -1,8 +0,0 @@
1
- import{useOverlayTarget as e,usePopupAnchor as i,usePopupLevel as r,usePopupLevelBindings as t,windowScrimStyle as o,OverlayLayerProvider as n,scrimHasCorners as l,popupLayerStyle as a}from"./chunk-CJ4OEY3T.js";import{CloseButton as d}from"./chunk-5QHNDAZ6.js";import{useDiscardGuard as s}from"./chunk-TEQ5ZPAL.js";import{dialogA11y as c}from"./chunk-VWGWZY7A.js";import{useDismissPopupsOnOpen as m}from"./chunk-DBQNYJZ6.js";import{useFocusTrap as p,useScrollLock as u}from"./chunk-DWGYC7OD.js";import{HEADING_TEXT as h,DESCRIPTION_TEXT as f,PANEL_SURFACE as b}from"./chunk-BWJZTHZ6.js";import{createShellPortal as v}from"./chunk-5QRHQCRG.js";import{useHydrated as y}from"./chunk-KEFNQEXZ.js";import{registerModalEscapeInterceptor as x}from"./chunk-TWVUQUUD.js";import{useRef as k,useId as N,useState as j,useEffect as w}from"react";import{jsxs as g,Fragment as C,jsx as Q}from"react/jsx-runtime";function Z({open:Z,onClose:D,side:E="bottom",title:H,description:W,footer:B,children:T,blocking:Y=!1,dirty:$=!1,initialFocus:A,"aria-label":G,"aria-labelledby":J,"aria-describedby":U,className:F=""}){const O=k(null),R=N(),V=N(),z=N(),I=e(y()),[K,L]=j(null),P=s({open:Z,dirty:$,onClose:D,title:H,layer:K}),X=k(null),q=i(Z&&null!==I,X),M=r(Z&&null!==I,X),S=t(M,K),_=o(M),ee=null!==M.host;if(m(Z),p(O,Z&&null!==I,A,S),u(Z),w(()=>{if(Z)return x(()=>!S.current?.(document.activeElement)&&(Y||P(),!0),()=>O.current)},[Z,Y,P,S]),!Z||!I)return null;const ie={maxHeight:"85vh",...q?(re=q,{left:re.left,width:re.width,bottom:window.innerHeight-(re.top+re.height)}):{}};var re;/* @__PURE__ */
2
- return g(C,{children:[/* @__PURE__ */Q("span",{ref:X,hidden:!0,"data-popup-anchor":""}),v(
3
- /* @__PURE__ */Q(n,{value:K,children:/* @__PURE__ */g("div",{ref:L,className:ee?"fixed inset-0 pointer-events-none":"fixed inset-0",style:a(M),role:"presentation","data-overlay-layer":"",children:[
4
- /* @__PURE__ */Q("div",{className:"fixed bg-black/30 backdrop-blur-sm "+(ee?"pointer-events-auto"+(l(M)?" rounded-(--radius-window)":""):"inset-0"),style:_??void 0,hidden:ee&&!_,onClick:Y?void 0:P,"aria-hidden":"true","data-popup-scrim":ee?"window":"system"}),
5
- /* @__PURE__ */g("div",{ref:O,...c({modal:!0,titleId:H?z:void 0,labelledBy:J,label:G}),"aria-describedby":U??(W?V:T?R:void 0),"data-drawer-side":E,"data-popup-panel":"",style:ie,className:[`fixed flex flex-col ${b}`,ee?"pointer-events-auto":"",q?"":"inset-x-0 bottom-0","rounded-t-xl",F].filter(Boolean).join(" "),children:[H?/* @__PURE__ */g("div",{className:"flex shrink-0 items-center justify-between gap-4 border-b border-gray-100 px-4 py-3",children:[
6
- /* @__PURE__ */g("div",{className:"min-w-0",children:[
7
- /* @__PURE__ */Q("h2",{id:z,className:h,children:H}),W&&/* @__PURE__ */Q("p",{id:V,className:`mt-0.5 ${f}`,children:W})]}),!Y&&/* @__PURE__ */Q(d,{onClose:P})]}):!Y&&/* @__PURE__ */Q("div",{className:"absolute right-2 top-2 z-10",children:/* @__PURE__ */Q(d,{onClose:P})}),
8
- /* @__PURE__ */g("div",{id:R,className:"min-h-0 flex-1 overflow-y-auto px-4 py-4",children:[W&&!H&&/* @__PURE__ */Q("p",{id:V,className:`mb-3 ${f} ${Y?"":"pr-8"}`.trim(),children:W}),T]}),B&&/* @__PURE__ */Q("div",{className:"flex shrink-0 justify-end gap-3 border-t border-gray-100 px-4 py-3",children:B})]})]})}),I)]})}export{Z as Drawer};
@@ -1 +0,0 @@
1
- var r="15.6.0",a=r;export{a as APP_VERSION,r as VERSION};
@@ -1,11 +0,0 @@
1
- import{LIGHTBOX_PICTURE_FIT as e,ZoomableImage as t}from"./chunk-CGUMJZUB.js";import{isVideoUrl as n,mediaFileName as r}from"./chunk-TAIH2VIW.js";import{dialogA11y as o}from"./chunk-VWGWZY7A.js";import{useDismissPopupsOnOpen as a}from"./chunk-DBQNYJZ6.js";import{useFocusTrap as l,useScrollLock as i}from"./chunk-DWGYC7OD.js";import{Button_default as s}from"./chunk-A4ROXNUF.js";import{Icon as c}from"./chunk-ISVODSRP.js";import{createShellPortal as m}from"./chunk-5QRHQCRG.js";import{Z_LAYERS as u}from"./chunk-62LW225J.js";import{useHydrated as d}from"./chunk-KEFNQEXZ.js";import{buttonClasses as f}from"./chunk-UQYNPYF4.js";import{registerModalEscapeInterceptor as h}from"./chunk-TWVUQUUD.js";import{useShellStrings as p}from"./chunk-NRHG4R2Q.js";import{useRef as x,useState as k,useCallback as b,useEffect as g}from"react";import{jsx as v,jsxs as N,Fragment as w}from"react/jsx-runtime";var y=/\.(pdf|docx?|xlsx?|pptx?|csv|txt|zip|rar|7z|dwg|dxf|stp|step|igs|iges)(?:[?#]|$)/i;function j(e){return e.kind?e.kind:n(e.url)?"video":y.test(e.url)?"file":"image"}var C="flex items-center justify-center rounded-full bg-black/60 text-on-accent hover:bg-black/80 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",R=e=>e.stopPropagation();function I({images:n,startIndex:y=0,onClose:I,onIndexChange:Q,onOpenFile:U}){const A=p().lightbox,D=d(),F=x(null),W=x(null),[$,z]=k(y),G=n.length,O=D&&G>0,Y=b(e=>{if(G<2)return;const t=(($+e)%G+G)%G;z(t),Q?.(t)},[$,G,Q]);if(a(O),l(F,O,W),i(O),g(()=>{if(O)return h(()=>(I(),!0),()=>F.current)},[O,I]),g(()=>{if(!O)return;const e=e=>{"ArrowLeft"!==e.key&&"ArrowRight"!==e.key||e.target?.closest?.("video")||(e.preventDefault(),Y("ArrowRight"===e.key?1:-1))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[O,Y]),!O)return null;const E=n[Math.min($,G-1)],L=j(E),V=E.caption||r(E.url);let Z;return Z="video"===L?/* @__PURE__ */v("video",{src:E.url,controls:!0,playsInline:!0,"aria-label":V,onClick:R,className:`${e} rounded-lg bg-black`}):"file"===L?/* @__PURE__ */N("div",{onClick:R,className:"flex max-w-[calc(100vw-144px)] flex-col items-center gap-3 rounded-lg bg-surface px-10 py-8 text-center text-ink-faint",children:[
2
- /* @__PURE__ */v(c,{name:"document","aria-hidden":"true",className:"h-10 w-10"}),
3
- /* @__PURE__ */v("span",{className:"max-w-[60ch] break-all text-sm font-medium text-ink",children:V}),U?/* @__PURE__ */v(s,{size:"sm",onClick:()=>U(E),children:A.openFile}):/* @__PURE__ */v("a",{href:E.url,target:"_blank",rel:"noopener noreferrer",className:f({size:"sm"}),children:A.openFile})]}):/* @__PURE__ */v(t,{src:E.url,alt:V,className:`${e} object-contain`,frameClassName:"rounded-lg"}),m(
4
- /* @__PURE__ */N("div",{ref:F,...o({role:"dialog",modal:!0,label:A.label}),"data-lightbox-backdrop":"",className:"fixed inset-0 flex items-center justify-center bg-black/80",style:{zIndex:u.overlay},onClick:I,children:[Z,
5
- /* @__PURE__ */N("div",{className:"absolute right-4 top-4 flex items-center gap-2",onClick:R,children:[
6
- /* @__PURE__ */v("span",{className:"rounded bg-black/60 px-2 py-1 text-xs text-on-accent tabular-nums",children:A.counter($+1,G)}),
7
- /* @__PURE__ */v("button",{ref:W,type:"button",onClick:I,"aria-label":A.close,className:`${C} h-8 w-8`,children:/* @__PURE__ */v(c,{name:"close","aria-hidden":"true",className:"h-4 w-4"})})]}),G>1&&/* @__PURE__ */N(w,{children:[
8
- /* @__PURE__ */v("button",{type:"button",onClick:e=>{R(e),Y(-1)},"aria-label":A.previous,className:`${C} absolute left-4 top-1/2 h-10 w-10 -translate-y-1/2`,children:/* @__PURE__ */v(c,{name:"chevron-left","aria-hidden":"true",className:"h-5 w-5"})}),
9
- /* @__PURE__ */v("button",{type:"button",onClick:e=>{R(e),Y(1)},"aria-label":A.next,className:`${C} absolute right-4 top-1/2 h-10 w-10 -translate-y-1/2`,children:/* @__PURE__ */v(c,{name:"chevron-right","aria-hidden":"true",className:"h-5 w-5"})})]}),
10
- /* @__PURE__ */N("div",{className:"absolute inset-x-18 bottom-4 flex items-center justify-center gap-3",onClick:R,children:[
11
- /* @__PURE__ */v("span",{className:"min-w-0 break-words text-center text-sm text-on-accent/85",children:V}),"file"!==L&&/* @__PURE__ */v("a",{href:E.url,target:"_blank",rel:"noopener noreferrer",className:"flex-none text-xs font-medium text-on-accent/70 underline decoration-on-accent/30 underline-offset-2 hover:text-on-accent",children:A.openOriginal})]})]}),document.body)}export{I as ImageLightbox,j as lightboxKind};
@@ -1,6 +0,0 @@
1
- import{TEXT_ALIGNS as e,textAlignWords as l,textAlignIcon as r}from"./chunk-72UHB4JU.js";import{IconButton_default as a}from"./chunk-APFDZ2HG.js";import{Icon as o}from"./chunk-ISVODSRP.js";import{Tooltip as n}from"./chunk-CIZAUBWA.js";import{useShellStrings as s}from"./chunk-NRHG4R2Q.js";import{jsx as i,jsxs as t,Fragment as d}from"react/jsx-runtime";var c=e=>e.preventDefault(),u=e=>null!=e&&!1!==e,h=["bold","italic","underline","strike","link","sup","sub","code"];function p(e,l,r){const a={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1,Home:"first",End:"last"}[e.key];if(void 0===a||0===l.length)return;const o=[...e.currentTarget.querySelectorAll('[role="radio"]')],n=o.findIndex(l=>l===e.target||l.contains(e.target));if(n<0)return;e.preventDefault();const s=o.length,i="first"===a?0:"last"===a?s-1:(n+a+s)%s;o[i].disabled||(r(l[i]),o[i].focus())}function b(e,l){const r=["bold","italic","underline","strike"].filter(l=>e.has(l)).length;return{color:r,link:r+(l?1:0)}}function m(e,l,r,a){const o=h.filter(l=>"link"!==l&&e.has(l)).length+(l?1:0);return r&&0!==o?a>0?"paragraph":"words":null}function w({offered:l,color:r,last:a,alignment:o,list:n,letterCase:s,clear:i}){let t=h.filter(e=>l.has(e)).length+(r?1:0)+(u(a)?1:0),d=(o?e.filter(e=>o.allow.includes(e)).length:0)+(n&&l.has("bullet")?1:0)+(n&&l.has("number")?1:0)+(l.has("quote")?1:0)+(s?3:0);const c=m(l,r,i,d);return"paragraph"===c&&(d+=1),"words"===c&&(t+=1),{words:t>0,paragraph:d>0,oneRow:t>0&&d>0&&t+1+d<=9,flow:t>0&&d>0&&t+1+d>9&&t<=7,cells:{words:t,paragraph:d}}}function g(e,l){/* @__PURE__ */
2
- return i(n,{content:e,children:l},l.key??void 0)}function f({offered:n,pressed:h,onMark:f,color:k,linkOpen:v=!1,last:N,alignment:C,list:D,letterCase:M,clear:x,disabled:y=!1,"aria-label":A,windows:R,className:j="",layout:B="grid"}){const I=s().textToolbar,S=w({offered:n,color:k,last:N,alignment:C,list:D,letterCase:M,clear:x});if(!S.words&&!S.paragraph)return null;const U=m(n,k,x,S.cells.paragraph),q=(e,l="")=>`rosh-tb-btn${e?" is-on":""}${l?` ${l}`:""}`,$=(e,l,r,o)=>n.has(e)?g(l,/* @__PURE__ */i(a,"link"===e?{pressed:v,className:q(v),"aria-label":l,"aria-haspopup":"dialog","aria-expanded":v,"aria-keyshortcuts":o,disabled:y,onMouseDown:c,onClick:()=>f(e),children:r}:{className:q(Boolean(h[e])),"aria-label":l,"aria-pressed":Boolean(h[e]),"aria-keyshortcuts":o,disabled:y,onMouseDown:c,onClick:()=>f(e),children:r},e)):null,H=l(I),L=e.map(e=>[e,H[e],r(e)]),K=C?e.filter(e=>C.allow.includes(e)):[],T=C&&K.includes(C.value)?C.value:K[0],G=[["none",I.caseNone,/* @__PURE__ */i(o,{name:"case-normal"})],["upper",I.caseUpper,/* @__PURE__ */i(o,{name:"case-upper"})],["lower",I.caseLower,/* @__PURE__ */i(o,{name:"case-lower"})]],O=x&&U?g(I.clear,/* @__PURE__ */i(a,{className:q(!1),"aria-label":I.clear,disabled:y,onMouseDown:c,onClick:x.onClear,children:/* @__PURE__ */i(o,{name:"revert"})},"clear")):null,P=/* @__PURE__ */t(d,{children:[$("bold",I.bold,/* @__PURE__ */i(o,{name:"bold"}),"Meta+B"),$("italic",I.italic,/* @__PURE__ */i(o,{name:"italic"}),"Meta+I"),$("underline",I.underline,/* @__PURE__ */i(o,{name:"underline"}),"Meta+U"),$("strike",I.strike,/* @__PURE__ */i(o,{name:"strike"})),k?g(I.color,/* @__PURE__ */i(a,{pressed:k.open,className:q(k.open,"rosh-tb-color"),"aria-label":I.color,"aria-haspopup":"dialog","aria-expanded":k.open,disabled:y,style:k.run?{"--rosh-tb-run":k.run}:void 0,onMouseDown:c,onClick:k.onToggle,children:/* @__PURE__ */i(o,{name:"text-color"})},"color")):null,$("link",I.link,/* @__PURE__ */i(o,{name:"link"}),"Meta+K"),$("sup",I.sup,/* @__PURE__ */i(o,{name:"superscript"})),$("sub",I.sub,/* @__PURE__ */i(o,{name:"subscript"})),$("code",I.code,/* @__PURE__ */i(o,{name:"code"})),u(N)?N:null,"words"===U?O:null]}),Z=/* @__PURE__ */t(d,{children:[C&&K.length>0?/* @__PURE__ */i("div",{className:"rosh-tb-group",role:"radiogroup","aria-label":I.alignment,onKeyDown:e=>p(e,K,e=>C.onChange(e)),children:L.map(([e,l,r])=>C.allow.includes(e)?g(l,/* @__PURE__ */i(a,{role:"radio",pressed:C.value===e,className:q(C.value===e),"aria-checked":C.value===e,"aria-label":l,tabIndex:e===T?0:-1,disabled:y||C.disabled,onMouseDown:c,onClick:()=>C.onChange(e),children:r},e)):null)}):null,D&&n.has("bullet")?g(I.bullet,/* @__PURE__ */i(a,{className:q("bullet"===D.pressed),"aria-label":I.bullet,"aria-pressed":"bullet"===D.pressed,disabled:y,onMouseDown:c,onClick:()=>D.onList("bullet"),children:/* @__PURE__ */i(o,{name:"list"})},"bullet")):null,D&&n.has("number")?g(I.number,/* @__PURE__ */i(a,{className:q("number"===D.pressed),"aria-label":I.number,"aria-pressed":"number"===D.pressed,disabled:y,onMouseDown:c,onClick:()=>D.onList("number"),children:/* @__PURE__ */i(o,{name:"numbered-list"})},"number")):null,$("quote",I.quote,/* @__PURE__ */i(o,{name:"quote"})),M?/* @__PURE__ */i("div",{className:"rosh-tb-group",role:"radiogroup","aria-label":I.letterCase,onKeyDown:e=>p(e,G.map(([e])=>e),e=>M.onChange(e)),children:G.map(([e,l,r])=>g(l,/* @__PURE__ */i(a,{role:"radio",pressed:M.value===e,className:q(M.value===e),"aria-checked":M.value===e,"aria-label":l,tabIndex:e===(M.value||"none")?0:-1,disabled:y||M.disabled,onMouseDown:c,onClick:()=>M.onChange(M.value===e?"":e),children:r},e)))}):null,"paragraph"===U?O:null]}),E="row"===B,F=E?" is-row":S.flow?" is-flow":S.oneRow?" is-one-row":S.words&&void 0===N&&"words"!==U?" is-eight":"",J=b(n,Boolean(k)),Q={"--rosh-tb-color-col":String(J.color),"--rosh-tb-link-col":String(J.link),...E?{"--rosh-tb-cells":String(S.cells.words+S.cells.paragraph),"--rosh-tb-groupgap":S.words&&S.paragraph?"var(--space-8, 0.5rem)":"0px"}:{}};let V;return V=E?/* @__PURE__ */t("div",{className:"rosh-tb-row is-row",children:[S.words?/* @__PURE__ */i("div",{className:"rosh-tb-words",children:P}):null,S.paragraph?/* @__PURE__ */i("div",{className:"rosh-tb-para",children:Z}):null]}):S.flow?/* @__PURE__ */t("div",{className:"rosh-tb-row is-flow",children:[P,
3
- /* @__PURE__ */i("span",{className:"rosh-tb-flowgap","aria-hidden":"true"}),Z]}):S.oneRow?/* @__PURE__ */t("div",{className:"rosh-tb-row is-one-row",children:[
4
- /* @__PURE__ */i("div",{className:"rosh-tb-words",children:P}),
5
- /* @__PURE__ */i("div",{className:"rosh-tb-para",children:Z})]}):/* @__PURE__ */t(d,{children:[S.words?/* @__PURE__ */i("div",{className:"rosh-tb-row"+(void 0===N&&"words"!==U?" is-eight":""),children:P}):null,S.paragraph?/* @__PURE__ */i("div",{className:"rosh-tb-row",children:Z}):null]}),/* @__PURE__ */t("div",{className:`rosh-tb-wrap${F} ${j}`.trim(),style:Q,children:[
6
- /* @__PURE__ */i("div",{className:"rosh-tb",role:"toolbar","aria-label":A??I.formatting,children:V}),R]})}export{f as TextToolbar,w as textToolbarRows,b as textToolbarWindowColumns};
@@ -1,3 +0,0 @@
1
- import{DropdownMenu as e}from"./chunk-NJY4HPNB.js";import{Button_default as i}from"./chunk-A4ROXNUF.js";import{Icon as n}from"./chunk-ISVODSRP.js";import{Tooltip as r}from"./chunk-CIZAUBWA.js";import{iconButtonClasses as a}from"./chunk-UQYNPYF4.js";import{forwardRef as l,useId as o}from"react";import{jsxs as s,jsx as t}from"react/jsx-runtime";var d="relative focus-visible:z-10",m={secondary:"border-l-0",primary:"border-l border-white/30",warning:"border-l border-white/30"},c=l(function({children:l,onClick:c,type:b="button",items:h,menuLabel:u,variant:f="primary",size:p="md",loading:v=!1,leftIcon:k,disabled:N=!1,disabledReason:g,tooltip:w,menuDisabled:x=!1,menuDisabledReason:j,onMenuOpenChange:y,menuFooter:C,menuFooterLabel:A,align:R="end",side:W="bottom",menuMinWidth:z,linkAs:F,block:I=!1,className:O=""},B){const D=N&&(null!=g&&""!==g&&!1!==g)&&!v,L=x&&null!=j&&""!==j&&!1!==j,P=o(),U=/* @__PURE__ */t(i,{ref:B,type:b,variant:f,size:p,loading:v,leftIcon:k,block:I,disabled:N&&!D,"aria-disabled":!!D||void 0,disabledReason:D?g:void 0,onClick:c,className:`rounded-r-none ${d}`,children:l}),Y=I?"relative flex min-w-0 flex-1":"relative inline-flex",$=p.startsWith("touch")?"h-5 w-5":"h-4 w-4";/* @__PURE__ */
2
- return s("div",{className:[I?"flex w-full":"inline-flex","items-stretch",O].filter(Boolean).join(" "),children:[null==w||""===w||D?U:/* @__PURE__ */t(r,{content:w,className:Y,children:U}),
3
- /* @__PURE__ */t(r,{content:L?j:u,describe:!1,className:"relative inline-flex shrink-0",children:/* @__PURE__ */t(e,{"aria-label":u,"aria-describedby":L?P:void 0,items:h,align:R,side:W,minWidth:z,linkAs:F,disabled:x&&!L,"aria-disabled":L,onOpenChange:y,footer:C,footerLabel:A,triggerClassName:a({variant:f,size:p,className:`rounded-l-none ${m[f]} ${d}`}),trigger:/* @__PURE__ */t(n,{name:"chevron-down",className:$,strokeWidth:2,"aria-hidden":"true"})})}),L&&/* @__PURE__ */t("span",{id:P,className:"sr-only",children:j})]})});export{c as SplitButton_default};
@@ -1,69 +0,0 @@
1
- import{fitBoxScale as e}from"./chunk-M6UKCZHT.js";import{toast_default as t}from"./chunk-I2NVBDKH.js";import{useShellStrings as r}from"./chunk-NRHG4R2Q.js";import{forwardRef as n,useRef as o,useState as i,useMemo as a,useEffect as l,useImperativeHandle as s}from"react";import{jsx as c,jsxs as d,Fragment as h}from"react/jsx-runtime";var u=["#ef4444","#f97316","#eab308","#22c55e","#3b82f6","#8b5cf6","#000000","#ffffff"],p=[{id:"system",name:"fontSystem",css:"-apple-system, system-ui, sans-serif"},{id:"serif",name:"fontSerif",css:'Georgia, "Times New Roman", serif'},{id:"mono",name:"fontMono",css:'ui-monospace, "SF Mono", Menlo, monospace'},{id:"cursive",name:"fontCursive",css:'"Brush Script MT", "Comic Sans MS", cursive'}],y=()=>Math.random().toString(36).slice(2,9),x=n(function({src:n,filename:x,onApply:g,onCancel:w},C){const z=o(null),D=o(null),P=o(null),$=o(null),E=r().annotator,I=o(E);I.current=E;const[S,W]=i("select"),[B,R]=i(u[0]),[j,H]=i(4),[T,F]=i(24),[U,A]=i(p[0].id),[K,O]=i(!0),[V,Z]=i(!1),[G,X]=i(!1),[q,Y]=i(null),[_,Q]=i(null),[J,ee]=i(6),[te,re]=i(12),[ne,oe]=i([]),[ie,ae]=i(null),[le,se]=i(null),[ce,de]=i(null),[he,ue]=i(1),[pe,ye]=i(null),[xe,me]=i(null),[ge,we]=i(null),fe=o(null),[ve,be]=i(!1),ke=a(()=>ce?{w:ce.w*he,h:ce.h*he}:null,[ce,he]),Me=ke&&le?ke.w/le.w:1,Ne=a(()=>ne.find(e=>e.id===ie)??null,[ne,ie]);l(()=>{"select"===S&&Ne&&("color"in Ne&&R(Ne.color),"stroke"in Ne&&H(Ne.stroke),"rect"===Ne.type&&re(Ne.radius),"text"===Ne.type&&(F(Ne.size),A(Ne.font),O(Ne.bold),Z(Ne.italic),X(Ne.underline),Y(Ne.borderColor),Q(Ne.background),ee(Ne.padding)))},[ie]),l(()=>{const e=new Image;e.crossOrigin="anonymous",e.onload=()=>{$.current=e,se({w:e.naturalWidth,h:e.naturalHeight}),oe([]),ae(null)},e.onerror=()=>t.error(I.current.loadFailed),e.src=n},[n]),l(()=>{if(!le)return;const t=()=>{const t=z.current;if(!t)return;const r=t.getBoundingClientRect(),n=Math.max(0,r.width-32),o=Math.max(0,r.height-32);if(0===n||0===o)return;const i=e({width:n,height:o},{width:le.w,height:le.h},1);de({w:le.w*i,h:le.h*i})};t();const r=new ResizeObserver(t);return z.current&&r.observe(z.current),()=>r.disconnect()},[le]);const Ce=a(()=>ne.filter(e=>"mosaic"===e.type),[ne]);l(()=>{const e=$.current,t=D.current;if(!e||!t||!le)return;t.width=le.w,t.height=le.h;const r=t.getContext("2d");r.drawImage(e,0,0);for(const e of Ce)L(r,e)},[le,Ce,ce]);const Le=e=>{const t=P.current;if(!t)return{x:0,y:0};const r=t.createSVGPoint();r.x=e.clientX,r.y=e.clientY;const n=t.getScreenCTM();if(!n)return{x:0,y:0};const o=r.matrixTransform(n.inverse());return{x:o.x,y:o.y}},ze=e=>{fe.current=e,be(!0)};l(()=>{if(!ve)return;const e=e=>{const t=fe.current;if(!t)return;const r=Le(e);if("draw"===t.kind)ye(b(S,t.start,r,B,j,te));else if("pen"===t.kind){const e=t.points[t.points.length-1];(Math.abs(r.x-e.x)>1||Math.abs(r.y-e.y)>1)&&(t.points.push(r),ye({id:"",type:"draw",points:t.points.slice(),color:B,stroke:j}))}else if("crop"===t.kind)we(N(t.start,r));else if("move"===t.kind){const e=r.x-t.start.x,n=r.y-t.start.y;oe(r=>r.map(r=>r.id===t.id?k(t.original,e,n):r))}else"resize"===t.kind&&oe(e=>e.map(e=>e.id===t.id?function(e,t,r){if("arrow"===e.type)return"start"===t?{...e,x1:r.x,y1:r.y}:"end"===t?{...e,x2:r.x,y2:r.y}:e;if("text"===e.type||"draw"===e.type)return e;const n=e.x,o=e.x+e.w,i=e.y,a=e.y+e.h;let l=n,s=i,c=o,d=a;"nw"===t&&(l=r.x,s=r.y);"ne"===t&&(c=r.x,s=r.y);"se"===t&&(c=r.x,d=r.y);"sw"===t&&(l=r.x,d=r.y);const h=N({x:l,y:s},{x:c,y:d});return{...e,x:h.x,y:h.y,w:h.w,h:h.h}}(t.original,t.corner,r):e))},t=()=>{const e=fe.current;if(fe.current=null,be(!1),"draw"===e?.kind)ye(e=>{if(!e||("arrow"===(t=e).type?Math.abs(t.x2-t.x1)<4&&Math.abs(t.y2-t.y1)<4:"draw"===t.type?t.points.length<2:"w"in t&&"h"in t&&(t.w<4||t.h<4)))return null;var t;const r={...e,id:y()};return oe(e=>[...e,r]),ae(r.id),W("select"),null});else if("pen"===e?.kind){if(e.points.length<2)return void ye(null);const t={id:y(),type:"draw",points:e.points,color:B,stroke:j};oe(e=>[...e,t]),ae(t.id),W("select"),ye(null)}};return window.addEventListener("pointermove",e),window.addEventListener("pointerup",t),window.addEventListener("pointercancel",t),()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",t),window.removeEventListener("pointercancel",t)}},[ve,S,B,j,te]);l(()=>{const e=e=>{if(!document.activeElement||!/^(INPUT|TEXTAREA)$/.test(document.activeElement.tagName))return!e.metaKey&&!e.ctrlKey||"z"!==e.key&&"Z"!==e.key||e.shiftKey?void(ie&&("Delete"===e.key||"Backspace"===e.key?(e.preventDefault(),oe(e=>e.filter(e=>e.id!==ie)),ae(null)):"Escape"===e.key&&ae(null))):(e.preventDefault(),oe(e=>e.slice(0,-1)),void ae(null))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[ie]);const De=e=>{const t=!{bold:K,italic:V,underline:G}[e];"bold"===e&&O(t),"italic"===e&&Z(t),"underline"===e&&X(t),ie&&oe(r=>r.map(r=>r.id===ie&&"text"===r.type?{...r,[e]:t}:r))},Pe=e=>{Y(e),ie&&oe(t=>t.map(t=>t.id===ie&&"text"===t.type?{...t,borderColor:e}:t))},$e=e=>{Q(e),ie&&oe(t=>t.map(t=>t.id===ie&&"text"===t.type?{...t,background:e}:t))},Ee=e=>{if(!xe)return;const t=e??xe.value;if(!t.trim())return xe.editingId&&oe(e=>e.filter(e=>e.id!==xe.editingId)),void me(null);if(xe.editingId)oe(e=>e.map(e=>e.id===xe.editingId&&"text"===e.type?{...e,text:t}:e));else{const e={id:y(),type:"text",x:xe.x,y:xe.y,text:t,color:B,size:T,font:U,bold:K,italic:V,underline:G,borderColor:q,background:_,padding:J};oe(t=>[...t,e]),ae(e.id),W("select")}me(null)},Ie=async()=>{const e=D.current,t=P.current;if(!e||!t||!le)return null;const r=document.createElement("canvas");r.width=le.w,r.height=le.h;const n=r.getContext("2d");n.drawImage(e,0,0);const o=t.cloneNode(!0);o.querySelectorAll("[data-chrome]").forEach(e=>e.remove());const i=(new XMLSerializer).serializeToString(o),a=new Blob([i],{type:"image/svg+xml;charset=utf-8"}),l=URL.createObjectURL(a),s=new Image;return await new Promise(e=>{s.onload=()=>e(),s.onerror=()=>e(),s.src=l}),n.drawImage(s,0,0,le.w,le.h),URL.revokeObjectURL(l),r};s(C,()=>({save:async()=>{const e=await Ie();e&&e.toBlob(e=>{if(!e)return void t.error(I.current.exportFailed);const r=URL.createObjectURL(e),n=document.createElement("a");n.href=r;const o=x.replace(/\.[^.]+$/,"");n.download=`${o}-annotated.png`,n.click(),URL.revokeObjectURL(r)},"image/png")},copy:async()=>{if(!("clipboard"in navigator)||"undefined"==typeof ClipboardItem)return void t.error(I.current.clipboardUnsupported);const e=await Ie();e&&e.toBlob(async e=>{if(e)try{await navigator.clipboard.write([new ClipboardItem({"image/png":e})]),t.success(I.current.copied)}catch{t.error(I.current.copyRefused)}else t.error(I.current.copyFailed)},"image/png")}}),[le,x]);const Se=a(()=>[{id:"select",label:E.toolSelect,icon:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 3l7 17 2-7 7-2L5 3z"})})},{id:"draw",label:E.toolDraw,icon:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L6.832 19.82a4.5 4.5 0 01-1.897 1.13l-2.685.8.8-2.685a4.5 4.5 0 011.13-1.897L16.863 4.487z"})})},{id:"rect",label:E.toolRect,icon:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */c("rect",{x:"4",y:"6",width:"16",height:"12",rx:"3"})})},{id:"circle",label:E.toolEllipse,icon:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */c("ellipse",{cx:"12",cy:"12",rx:"8",ry:"6"})})},{id:"arrow",label:E.toolArrow,icon:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 19L19 5m0 0h-7m7 0v7"})})},{id:"mosaic",label:E.toolMosaic,icon:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4h6v6H4zM14 4h6v6h-6zM4 14h6v6H4zM14 14h6v6h-6z"})})},{id:"text",label:E.toolText,icon:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M12 6v14M9 20h6"})})},{id:"crop",label:E.toolCrop,icon:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 2v15a1 1 0 001 1h15M2 6h15a1 1 0 011 1v15"})})}],[E]),We=e=>"p-2 rounded transition-colors "+(e?"bg-blue-500 text-on-accent":"text-ink hover:bg-gray-200"),Be=Ne?.type??("select"===S?null:S),Re="rect"===Be||"circle"===Be||"arrow"===Be||"draw"===Be,je="rect"===Be,He="text"===Be;/* @__PURE__ */
2
- return d("div",{className:"flex flex-col h-full bg-gray-100",children:[
3
- /* @__PURE__ */d("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-line bg-surface shrink-0 flex-wrap text-xs",children:[Se.map(e=>/* @__PURE__ */c("button",{onClick:()=>{W(e.id),ae(null)},title:e.label,className:We(S===e.id),children:e.icon},e.id)),
4
- /* @__PURE__ */c("div",{className:"h-5 w-px bg-gray-300 mx-1"}),
5
- /* @__PURE__ */c("div",{className:"flex items-center gap-1",children:u.map(e=>/* @__PURE__ */c("button",{onClick:()=>(e=>{R(e),ie&&oe(t=>t.map(t=>t.id!==ie||"mosaic"===t.type?t:{...t,color:e}))})(e),title:e,className:"h-5 w-5 rounded-full border "+(B===e?"ring-2 ring-blue-500 ring-offset-1":"border-gray-300"),style:{background:e}},e))}),Re&&/* @__PURE__ */d(h,{children:[
6
- /* @__PURE__ */c("div",{className:"h-5 w-px bg-gray-300 mx-1"}),
7
- /* @__PURE__ */d("label",{className:"flex items-center gap-2 text-gray-600",children:[
8
- /* @__PURE__ */c("span",{children:E.weight}),
9
- /* @__PURE__ */c("input",{type:"range",min:1,max:20,step:1,value:j,onChange:e=>{return t=Number(e.target.value),H(t),void(ie&&oe(e=>e.map(e=>e.id!==ie?e:"rect"===e.type||"circle"===e.type||"arrow"===e.type||"draw"===e.type?{...e,stroke:t}:e)));var t},className:"w-16 accent-blue-500"}),
10
- /* @__PURE__ */c("span",{className:"tabular-nums w-5 text-right",children:j})]})]}),je&&/* @__PURE__ */d(h,{children:[
11
- /* @__PURE__ */c("div",{className:"h-5 w-px bg-gray-300 mx-1"}),
12
- /* @__PURE__ */d("label",{className:"flex items-center gap-2 text-gray-600",children:[
13
- /* @__PURE__ */c("span",{children:E.radius}),
14
- /* @__PURE__ */c("input",{type:"range",min:0,max:48,step:1,value:te,onChange:e=>{return t=Number(e.target.value),re(t),void(ie&&oe(e=>e.map(e=>e.id===ie&&"rect"===e.type?{...e,radius:t}:e)));var t},className:"w-16 accent-blue-500"}),
15
- /* @__PURE__ */c("span",{className:"tabular-nums w-6 text-right",children:te})]})]}),He&&/* @__PURE__ */d(h,{children:[
16
- /* @__PURE__ */c("div",{className:"h-5 w-px bg-gray-300 mx-1"}),
17
- /* @__PURE__ */c("select",{value:U,onChange:e=>{return t=e.target.value,A(t),void(ie&&oe(e=>e.map(e=>e.id===ie&&"text"===e.type?{...e,font:t}:e)));var t},className:"text-xs border border-gray-300 rounded px-1 py-0.5 bg-white",children:p.map(e=>/* @__PURE__ */c("option",{value:e.id,children:E[e.name]},e.id))}),
18
- /* @__PURE__ */c("button",{onClick:()=>De("bold"),className:We(K),title:E.bold,children:/* @__PURE__ */c("span",{className:"font-bold",children:E.boldLetter})}),
19
- /* @__PURE__ */c("button",{onClick:()=>De("italic"),className:We(V),title:E.italic,children:/* @__PURE__ */c("span",{className:"italic",children:E.italicLetter})}),
20
- /* @__PURE__ */c("button",{onClick:()=>De("underline"),className:We(G),title:E.underline,children:/* @__PURE__ */c("span",{className:"underline",children:E.underlineLetter})}),
21
- /* @__PURE__ */d("label",{className:"flex items-center gap-2 text-gray-600",children:[
22
- /* @__PURE__ */c("span",{children:E.size}),
23
- /* @__PURE__ */c("input",{type:"range",min:10,max:96,step:1,value:T,onChange:e=>{return t=Number(e.target.value),F(t),void(ie&&oe(e=>e.map(e=>e.id===ie&&"text"===e.type?{...e,size:t}:e)));var t},className:"w-16 accent-blue-500"}),
24
- /* @__PURE__ */c("span",{className:"tabular-nums w-7 text-right",children:T})]}),
25
- /* @__PURE__ */d("label",{className:"flex items-center gap-1 text-gray-600",children:[
26
- /* @__PURE__ */c("span",{children:E.border}),q?/* @__PURE__ */d(h,{children:[
27
- /* @__PURE__ */c("input",{type:"color",value:q,onChange:e=>Pe(e.target.value),title:E.borderColor,className:"h-5 w-6 rounded border border-gray-300 bg-white p-0 cursor-pointer"}),
28
- /* @__PURE__ */c("button",{onClick:()=>Pe(null),title:E.removeBorder,className:"px-0.5 text-gray-400 hover:text-gray-700",children:"✕"})]}):/* @__PURE__ */c("button",{onClick:()=>Pe(B),title:E.addBorder,className:"px-2 py-0.5 rounded border border-line-strong text-gray-600 hover:bg-gray-100",children:E.add})]}),
29
- /* @__PURE__ */d("label",{className:"flex items-center gap-1 text-gray-600",children:[
30
- /* @__PURE__ */c("span",{children:E.fill}),_?/* @__PURE__ */d(h,{children:[
31
- /* @__PURE__ */c("input",{type:"color",value:_,onChange:e=>$e(e.target.value),title:E.fillColor,className:"h-5 w-6 rounded border border-gray-300 bg-white p-0 cursor-pointer"}),
32
- /* @__PURE__ */c("button",{onClick:()=>$e(null),title:E.removeFill,className:"px-0.5 text-gray-400 hover:text-gray-700",children:"✕"})]}):/* @__PURE__ */c("button",{onClick:()=>$e("#ffffff"),title:E.addFill,className:"px-2 py-0.5 rounded border border-line-strong text-gray-600 hover:bg-gray-100",children:E.add})]}),
33
- /* @__PURE__ */d("label",{className:"flex items-center gap-2 text-gray-600",children:[
34
- /* @__PURE__ */c("span",{children:E.padding}),
35
- /* @__PURE__ */c("input",{type:"range",min:0,max:40,step:1,value:J,onChange:e=>{return t=Number(e.target.value),ee(t),void(ie&&oe(e=>e.map(e=>e.id===ie&&"text"===e.type?{...e,padding:t}:e)));var t},className:"w-14 accent-blue-500"}),
36
- /* @__PURE__ */c("span",{className:"tabular-nums w-6 text-right",children:J})]})]}),
37
- /* @__PURE__ */c("div",{className:"h-5 w-px bg-gray-300 mx-1"}),
38
- /* @__PURE__ */c("button",{onClick:()=>ue(e=>Math.max(.25,Math.round(100*(e-.25))/100)),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-700",title:E.zoomOut,children:"−"}),
39
- /* @__PURE__ */d("span",{className:"text-gray-600 tabular-nums w-10 text-center",children:[Math.round(100*he),"%"]}),
40
- /* @__PURE__ */c("button",{onClick:()=>ue(e=>Math.min(4,Math.round(100*(e+.25))/100)),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-700",title:E.zoomIn,children:"+"}),
41
- /* @__PURE__ */c("button",{onClick:()=>ue(1),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-700",title:E.fitHint,children:E.fit}),
42
- /* @__PURE__ */c("div",{className:"h-5 w-px bg-gray-300 mx-1"}),
43
- /* @__PURE__ */c("button",{onClick:()=>{oe(e=>e.slice(0,-1)),ae(null)},disabled:0===ne.length,className:"px-2 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-700",children:E.undo}),
44
- /* @__PURE__ */d("div",{className:"ml-auto flex items-center gap-2",children:[ge&&/* @__PURE__ */d(h,{children:[
45
- /* @__PURE__ */c("button",{onClick:()=>{if(!ge||!$.current||!le)return;const e=ge,t=document.createElement("canvas");t.width=Math.round(e.w),t.height=Math.round(e.h);const r=t.getContext("2d"),n=document.createElement("canvas");n.width=le.w,n.height=le.h;const o=n.getContext("2d");o.drawImage($.current,0,0);for(const e of Ce)L(o,e);r.drawImage(n,e.x,e.y,e.w,e.h,0,0,e.w,e.h);const i=new Image;i.onload=()=>{$.current=i,se({w:i.naturalWidth,h:i.naturalHeight}),oe(t=>t.filter(e=>"mosaic"!==e.type).map(t=>k(t,-e.x,-e.y)).filter(e=>function(e,t,r){const n=M(e);return n.x+n.w>0&&n.y+n.h>0&&n.x<t&&n.y<r}(e,i.naturalWidth,i.naturalHeight))),we(null)},i.src=t.toDataURL("image/png")},className:"px-2 py-1 rounded bg-blue-500 text-white hover:bg-blue-600",children:E.applyCrop}),
46
- /* @__PURE__ */c("button",{onClick:()=>we(null),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-700",children:E.cancel})]}),g&&!ge&&/* @__PURE__ */d(h,{children:[w&&/* @__PURE__ */c("button",{onClick:w,className:"px-3 py-1 rounded hover:bg-gray-200 text-gray-700 text-xs font-medium",children:E.cancel}),
47
- /* @__PURE__ */c("button",{onClick:async()=>{const e=await Ie();e?e.toBlob(e=>{e?g(e):t.error(I.current.exportFailed)},"image/png"):t.error(I.current.exportFailed)},className:"px-3 py-1 rounded bg-blue-500 text-white hover:bg-blue-600 text-xs font-medium",children:E.apply})]})]})]}),
48
- /* @__PURE__ */c("div",{ref:z,className:"flex-1 overflow-auto bg-gray-200 flex items-center justify-center p-4 relative",children:ke&&le&&/* @__PURE__ */d("div",{className:"relative shadow-lg rounded overflow-hidden bg-white shrink-0",style:{width:ke.w,height:ke.h},children:[
49
- /* @__PURE__ */c("canvas",{ref:D,style:{position:"absolute",inset:0,width:"100%",height:"100%",display:"block"}}),
50
- /* @__PURE__ */d("svg",{ref:P,viewBox:`0 0 ${le.w} ${le.h}`,preserveAspectRatio:"none",style:{position:"absolute",inset:0,width:"100%",height:"100%",touchAction:"none",cursor:"select"===S?"default":"text"===S?"text":"crosshair"},onPointerDown:e=>{if("select"===S)return void ae(null);if("text"===S){if(xe)return void Ee();const t=Le(e);return void me({x:t.x,y:t.y,value:""})}const t=Le(e);if("crop"!==S){if("draw"===S)return ze({kind:"pen",points:[t]}),void ye({id:"",type:"draw",points:[t],color:B,stroke:j});ye(b(S,t,t,B,j,te)),ze({kind:"draw",start:t})}else ze({kind:"crop",start:t})},children:[ne.map(e=>/* @__PURE__ */c(m,{anno:e,selected:ie===e.id,zoom:he,onPointerDown:t=>((e,t)=>{"select"===S&&(e.stopPropagation(),ae(t.id),ze({kind:"move",id:t.id,start:Le(e),original:t}))})(t,e),onDoubleClick:()=>{var t;"text"===(t=e).type&&me({x:t.x,y:t.y,value:t.text,editingId:t.id})},onHandlePointerDown:(t,r)=>((e,t,r)=>{e.stopPropagation(),ze({kind:"resize",id:t.id,corner:r,start:Le(e),original:t})})(t,e,r)},e.id)),pe&&/* @__PURE__ */c(m,{anno:{...pe,id:"__preview"},preview:!0}),ge&&/* @__PURE__ */c(f,{rect:ge,imageSize:le})]}),xe&&/* @__PURE__ */c(v,{pendingText:xe,color:B,size:T,font:p.find(e=>e.id===U)?.css??p[0].css,bold:K,italic:V,underline:G,borderColor:q,background:_,padding:J,scale:Me,onChange:e=>me({...xe,value:e}),onCommit:Ee,onCancel:()=>me(null)})]})}),
51
- /* @__PURE__ */c("div",{className:"px-3 py-2 border-t border-line bg-surface text-2xs text-ink-faint shrink-0",children:"select"===S?ie?E.hintSelected:E.hintSelect:"text"===S?E.hintText:"crop"===S?E.hintCrop:"draw"===S?E.hintDraw:E.hintShape})]})});function m({anno:e,selected:t,preview:r,zoom:n=1,onPointerDown:o,onDoubleClick:i,onHandlePointerDown:a}){const l=M(e),s=o?{onPointerDown:o,pointerEvents:"all",style:{cursor:"move"}}:{},u=i?{onDoubleClick:i}:{};let y;if("rect"===e.type)y=/* @__PURE__ */c("rect",{x:e.x,y:e.y,width:e.w,height:e.h,rx:e.radius,ry:e.radius,fill:"none",stroke:e.color,strokeWidth:e.stroke,strokeLinecap:"round",strokeLinejoin:"round",...s});else if("circle"===e.type)y=/* @__PURE__ */c("ellipse",{cx:e.x+e.w/2,cy:e.y+e.h/2,rx:e.w/2,ry:e.h/2,fill:"none",stroke:e.color,strokeWidth:e.stroke,...s});else if("arrow"===e.type)y=/* @__PURE__ */c(w,{anno:e,interactive:s});else if("draw"===e.type)y=/* @__PURE__ */c("path",{d:C(e.points),fill:"none",stroke:e.color,strokeWidth:e.stroke,strokeLinecap:"round",strokeLinejoin:"round",...s});else if("mosaic"===e.type)y=/* @__PURE__ */c("rect",{x:e.x,y:e.y,width:e.w,height:e.h,fill:"rgba(0,0,0,0.001)",stroke:"none",strokeWidth:t?2:0,strokeDasharray:t?"6,4":void 0,...s,style:t?{...s.style,stroke:"var(--rosh-annotator-selection)"}:s.style});else{const t=p.find(t=>t.id===e.font)?.css??p[0].css,r=e.padding??0,n=!!e.borderColor||!!e.background,o=M(e),i=e.borderColor?Math.max(1,Math.round(e.size/12)):0;y=/* @__PURE__ */d("g",{...s,...u,children:[n&&/* @__PURE__ */c("rect",{x:o.x-r,y:o.y-r,width:Math.max(0,o.w)+2*r,height:Math.max(0,o.h)+2*r,rx:Math.min(8,r),ry:Math.min(8,r),fill:e.background??"none",stroke:e.borderColor??"none",strokeWidth:i}),
52
- /* @__PURE__ */c("text",{x:e.x,y:e.y+e.size,fill:e.color,fontSize:e.size,fontWeight:e.bold?700:400,fontStyle:e.italic?"italic":"normal",textDecoration:e.underline?"underline":void 0,fontFamily:t,style:{userSelect:"none"},children:e.text.split("\n").map((t,r)=>/* @__PURE__ */c("tspan",{x:e.x,dy:0===r?0:1.2*e.size,children:t},r))})]})}/* @__PURE__ */
53
- return d("g",{children:[y,t&&!r&&/* @__PURE__ */d(h,{children:[
54
- /* @__PURE__ */c("rect",{"data-chrome":"selection",x:l.x-4,y:l.y-4,width:l.w+8,height:l.h+8,fill:"none",strokeWidth:2/n,strokeDasharray:`${6/n},${4/n}`,pointerEvents:"none",style:{stroke:"var(--rosh-annotator-selection)"}}),a&&/* @__PURE__ */c(g,{anno:e,zoom:n,onHandlePointerDown:a})]})]})}function g({anno:e,zoom:t,onHandlePointerDown:r}){const n=6/t,o=1.5/t,i=e=>({fill:"white",strokeWidth:o,pointerEvents:"all",style:{cursor:e,stroke:"var(--rosh-annotator-selection)"},"data-chrome":"handle"});if("arrow"===e.type)/* @__PURE__ */
55
- return d(h,{children:[
56
- /* @__PURE__ */c("circle",{cx:e.x1,cy:e.y1,r:n,...i("grab"),onPointerDown:e=>r(e,"start")}),
57
- /* @__PURE__ */c("circle",{cx:e.x2,cy:e.y2,r:n,...i("grab"),onPointerDown:e=>r(e,"end")})]});if("text"===e.type||"draw"===e.type)return null;const a=e.x,l=e.y,s=e.w,u=e.h;/* @__PURE__ */
58
- return d(h,{children:[
59
- /* @__PURE__ */c("circle",{cx:a,cy:l,r:n,...i("nwse-resize"),onPointerDown:e=>r(e,"nw")}),
60
- /* @__PURE__ */c("circle",{cx:a+s,cy:l,r:n,...i("nesw-resize"),onPointerDown:e=>r(e,"ne")}),
61
- /* @__PURE__ */c("circle",{cx:a+s,cy:l+u,r:n,...i("nwse-resize"),onPointerDown:e=>r(e,"se")}),
62
- /* @__PURE__ */c("circle",{cx:a,cy:l+u,r:n,...i("nesw-resize"),onPointerDown:e=>r(e,"sw")})]})}function w({anno:e,interactive:t}){const r=Math.max(12,4*e.stroke),n=Math.atan2(e.y2-e.y1,e.x2-e.x1),o=n+Math.PI-Math.PI/7,i=n+Math.PI+Math.PI/7,a=`M${e.x2},${e.y2} L${e.x2+r*Math.cos(o)},${e.y2+r*Math.sin(o)} L${e.x2+r*Math.cos(i)},${e.y2+r*Math.sin(i)} Z`;/* @__PURE__ */
63
- return d("g",{...t,children:[
64
- /* @__PURE__ */c("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stroke:e.color,strokeWidth:e.stroke,strokeLinecap:"round"}),
65
- /* @__PURE__ */c("path",{d:a,fill:e.color})]})}function f({rect:e,imageSize:t}){/* @__PURE__ */
66
- return d("g",{pointerEvents:"none",children:[
67
- /* @__PURE__ */c("path",{d:`M0,0 H${t.w} V${t.h} H0 Z M${e.x},${e.y} V${e.y+e.h} H${e.x+e.w} V${e.y} Z`,fillRule:"evenodd",style:{fill:"var(--rosh-annotator-crop-scrim)"}}),
68
- /* @__PURE__ */c("rect",{x:e.x,y:e.y,width:e.w,height:e.h,fill:"none",stroke:"white",strokeWidth:2,strokeDasharray:"8,6"})]})}function v({pendingText:e,color:t,size:n,font:i,bold:a,italic:s,underline:d,borderColor:h,background:u,padding:p,scale:y,onChange:x,onCommit:m,onCancel:g}){const w=o(null),f=r().annotator;l(()=>{const e=requestAnimationFrame(()=>{w.current?.focus(),w.current?.select?.()});return()=>cancelAnimationFrame(e)},[]);const v=()=>m(w.current?.value),b=h?Math.max(1,Math.round(n/12)):0;/* @__PURE__ */
69
- return c("div",{style:{position:"absolute",left:e.x*y+"px",top:e.y*y+"px",transform:"translateY(-2px)",zIndex:5},onPointerDown:e=>e.stopPropagation(),children:/* @__PURE__ */c("textarea",{ref:w,value:e.value,onChange:e=>x(e.target.value),onBlur:v,onKeyDown:e=>{"Escape"===e.key?(e.preventDefault(),g()):"Enter"!==e.key||e.shiftKey||(e.preventDefault(),v())},placeholder:f.textPlaceholder,rows:1,className:"rosh-focus-ring resize-none shadow-(--elevation-panel)",style:{color:t,fontSize:n*y+"px",fontFamily:i,fontWeight:a?700:400,fontStyle:s?"italic":"normal",textDecoration:d?"underline":void 0,minWidth:80,padding:p*y+"px",borderRadius:Math.min(8,p)*y+"px",border:h?`${b*y}px solid ${h}`:"1px dashed var(--rosh-annotator-edit-hint)",background:u??"var(--rosh-annotator-edit-surface)"}})})}function b(e,t,r,n,o,i){if("rect"===e){const e=N(t,r);return{id:"",type:"rect",x:e.x,y:e.y,w:e.w,h:e.h,color:n,stroke:o,radius:i}}if("circle"===e){const e=N(t,r);return{id:"",type:"circle",x:e.x,y:e.y,w:e.w,h:e.h,color:n,stroke:o}}if("arrow"===e)return{id:"",type:"arrow",x1:t.x,y1:t.y,x2:r.x,y2:r.y,color:n,stroke:o};if("mosaic"===e){const e=N(t,r);return{id:"",type:"mosaic",x:e.x,y:e.y,w:e.w,h:e.h}}return null}function k(e,t,r){return"arrow"===e.type?{...e,x1:e.x1+t,y1:e.y1+r,x2:e.x2+t,y2:e.y2+r}:"draw"===e.type?{...e,points:e.points.map(e=>({x:e.x+t,y:e.y+r}))}:(e.type,{...e,x:e.x+t,y:e.y+r})}function M(e){if("arrow"===e.type){return{x:Math.min(e.x1,e.x2),y:Math.min(e.y1,e.y2),w:Math.abs(e.x2-e.x1),h:Math.abs(e.y2-e.y1)}}if("draw"===e.type){if(0===e.points.length)return{x:0,y:0,w:0,h:0};let t=e.points[0].x,r=e.points[0].x,n=e.points[0].y,o=e.points[0].y;for(const i of e.points)i.x<t&&(t=i.x),i.x>r&&(r=i.x),i.y<n&&(n=i.y),i.y>o&&(o=i.y);return{x:t,y:n,w:r-t,h:o-n}}if("text"===e.type){const t=e.text.split("\n"),r=t.reduce((e,t)=>Math.max(e,t.length),0);return{x:e.x,y:e.y,w:r*e.size*.55,h:t.length*e.size*1.2}}return{x:e.x,y:e.y,w:e.w,h:e.h}}function N(e,t){return{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),w:Math.abs(e.x-t.x),h:Math.abs(e.y-t.y)}}function C(e){if(0===e.length)return"";let t=`M ${e[0].x} ${e[0].y}`;for(let r=1;r<e.length;r++)t+=` L ${e[r].x} ${e[r].y}`;return t}function L(e,t){const r=Math.round(Math.max(0,t.x)),n=Math.round(Math.max(0,t.y)),o=Math.round(Math.min(e.canvas.width-r,t.w)),i=Math.round(Math.min(e.canvas.height-n,t.h));if(o<2||i<2)return;const a=e.getImageData(r,n,o,i);for(let e=0;e<i;e+=12)for(let t=0;t<o;t+=12){let r=0,n=0,l=0,s=0,c=0;const d=Math.min(12,o-t),h=Math.min(12,i-e);for(let i=0;i<h;i++)for(let h=0;h<d;h++){const d=4*((e+i)*o+(t+h));r+=a.data[d],n+=a.data[d+1],l+=a.data[d+2],s+=a.data[d+3],c++}r=Math.round(r/c),n=Math.round(n/c),l=Math.round(l/c),s=Math.round(s/c);for(let i=0;i<h;i++)for(let c=0;c<d;c++){const d=4*((e+i)*o+(t+c));a.data[d]=r,a.data[d+1]=n,a.data[d+2]=l,a.data[d+3]=s}}e.putImageData(a,r,n)}export{x as ImageAnnotator_default};
@@ -1 +0,0 @@
1
- var o="aria-disabled:cursor-not-allowed aria-disabled:opacity-60",r="inline-flex items-center justify-center rounded-(--radius-control) font-medium transition-colors rosh-focus-ring focus-visible:ring-2 disabled:cursor-not-allowed disabled:opacity-60 "+o,e={primary:"bg-accent-fill text-on-accent shadow-sm not-disabled:not-aria-disabled:hover:bg-accent-fill-hover focus-visible:ring-[color:var(--rosh-focus-ring-strong)]",secondary:"border border-line-strong bg-surface text-ink shadow-sm not-disabled:not-aria-disabled:hover:bg-row-hover focus-visible:ring-[color:var(--rosh-focus-ring)]","secondary-danger":"border border-red-300 bg-surface text-red-600 shadow-sm not-disabled:not-aria-disabled:hover:bg-red-50 focus-visible:ring-[color:var(--rosh-focus-ring-invalid)]",ghost:"text-ink not-disabled:not-aria-disabled:hover:bg-gray-100 focus-visible:ring-[color:var(--rosh-focus-ring)]","ghost-danger":"text-red-600 not-disabled:not-aria-disabled:hover:bg-red-50 focus-visible:ring-[color:var(--rosh-focus-ring-invalid)]",danger:"bg-red-600 text-on-accent shadow-sm not-disabled:not-aria-disabled:hover:bg-red-700 focus-visible:ring-[color:var(--rosh-focus-ring-invalid-strong)]",warning:"bg-amber-700 text-on-accent shadow-sm not-disabled:not-aria-disabled:hover:bg-amber-800 focus-visible:ring-[color:var(--rosh-focus-ring-strong)]",link:"text-blue-600 underline-offset-4 not-disabled:not-aria-disabled:hover:underline focus-visible:ring-[color:var(--rosh-focus-ring)]"},s={sm:"gap-1 h-6 px-2 text-xs",md:"gap-2 h-8 px-3 text-sm",lg:"gap-2 h-10 px-4 text-sm","touch-sm":"gap-2 h-11 px-4 text-base",touch:"gap-2 h-14 px-5 text-base","touch-lg":"gap-2 h-16 px-6 text-lg","touch-xl":"gap-3 h-20 px-8 text-2xl"},i="inline-flex items-center font-medium transition-colors rosh-focus-ring focus-visible:ring-2 disabled:cursor-not-allowed disabled:opacity-60 "+o,t={sm:"gap-1 text-xs",md:"gap-2 text-sm",lg:"gap-2 text-sm","touch-sm":"gap-2 text-base",touch:"gap-2 text-base","touch-lg":"gap-2 text-lg","touch-xl":"gap-3 text-2xl"},a={sm:"h-6 w-6",md:"h-8 w-8",lg:"h-10 w-10","touch-sm":"h-11 w-11",touch:"h-14 w-14","touch-lg":"h-16 w-16","touch-xl":"h-20 w-20"},n="bg-accent-tint text-blue-700 not-disabled:not-aria-disabled:hover:bg-blue-100 focus-visible:ring-[color:var(--rosh-focus-ring)]";function l({variant:o="primary",size:a="md",block:l=!1,pressed:d=!1,className:c=""}={}){const g="link"===o;return[g?i:r,d&&"secondary"===o?"border border-blue-200 bg-accent-tint text-blue-700 shadow-sm not-disabled:not-aria-disabled:hover:bg-blue-100 focus-visible:ring-[color:var(--rosh-focus-ring)]":d&&"ghost"===o?n:e[o],g?t[a]:s[a],l?"w-full":"",c].filter(Boolean).join(" ")}function d({variant:o="ghost",size:s="md",pressed:i=!1,ink:t="own",className:l=""}={}){return[r,!i||"ghost"!==o&&"secondary"!==o?"inherit"===t&&"ghost"===o?"text-inherit not-disabled:not-aria-disabled:hover:bg-gray-100 focus-visible:ring-[color:var(--rosh-focus-ring)]":e[o]:n,a[s],"shrink-0 p-0",l].filter(Boolean).join(" ")}export{l as buttonClasses,d as iconButtonClasses};