efficient-shell 4.134.0 → 4.137.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (171) hide show
  1. package/LICENSE +6 -17
  2. package/README.md +84 -8
  3. package/dist/Browser-ZX5OTOKK.js +43 -0
  4. package/dist/Calculator-4SQGOQFQ.js +29 -0
  5. package/dist/ConfirmDialog-NPKW2XHM.js +1 -0
  6. package/dist/CurrencyConverter-2KOM7L6V.js +21 -0
  7. package/dist/Documents-IZTIQYPG.js +52 -0
  8. package/dist/Files-B63KKXGZ.js +89 -0
  9. package/dist/Notepad-WA77V45J.js +25 -0
  10. package/dist/PdfViewer-RBRGEKWF.js +1 -0
  11. package/dist/PomodoroTimer-SDUBKXUS.js +99 -0
  12. package/dist/Preview-D4KOA4OI.js +187 -0
  13. package/dist/Sidebar-Y57LYXXI.js +23 -0
  14. package/dist/Spreadsheet-JX5E6WH6.js +37 -0
  15. package/dist/Stock-XAQ5WMUZ.js +16 -0
  16. package/dist/Weather-HLAGJ5LV.js +60 -0
  17. package/dist/WorldClock-IRI4VCTA.js +32 -0
  18. package/dist/apps/index.js +1 -151
  19. package/dist/brand.css +1 -1
  20. package/dist/chunk-3A46NCXK.js +29 -0
  21. package/dist/chunk-44UO7FYU.js +11 -0
  22. package/dist/chunk-466CM2TJ.js +1 -0
  23. package/dist/chunk-57MIENLJ.js +1 -0
  24. package/dist/chunk-5CRAF2AD.js +2 -0
  25. package/dist/chunk-A2OQLLYK.js +6 -0
  26. package/dist/chunk-B43AGQET.js +4 -0
  27. package/dist/chunk-BR22X7E5.js +1 -0
  28. package/dist/chunk-BUTSU7FO.js +1 -0
  29. package/dist/chunk-D65T4H6J.js +1 -0
  30. package/dist/chunk-ESL5TDNA.js +1 -0
  31. package/dist/chunk-FBDZGO3V.js +1 -0
  32. package/dist/chunk-FHTLC7HH.js +1 -0
  33. package/dist/chunk-FQLMX3IE.js +948 -0
  34. package/dist/chunk-H562R4GX.js +34 -0
  35. package/dist/chunk-JN4WXTWJ.js +106 -0
  36. package/dist/chunk-LVDRBRYU.js +1 -0
  37. package/dist/chunk-LWLCNQY7.js +1 -0
  38. package/dist/chunk-MAIHBBWT.js +1 -0
  39. package/dist/chunk-NPJH5MD7.js +13 -0
  40. package/dist/chunk-OCSOMMY2.js +1 -0
  41. package/dist/chunk-OQDWLHZI.js +1 -0
  42. package/dist/chunk-OWSAMA3I.js +23 -0
  43. package/dist/chunk-PH3PRIFP.js +5 -0
  44. package/dist/chunk-TAWKWSPN.js +9 -0
  45. package/dist/chunk-U4GTZPXP.js +1 -0
  46. package/dist/chunk-UB4JIOLD.js +2 -0
  47. package/dist/chunk-UZAJ5BF6.js +9 -0
  48. package/dist/chunk-VEGMDXT4.js +1 -0
  49. package/dist/chunk-VTVSMRFX.js +1 -0
  50. package/dist/chunk-VVAGSKW7.js +1 -0
  51. package/dist/chunk-XO43FJRM.js +19 -0
  52. package/dist/chunk-Y7BOLDRM.js +69 -0
  53. package/dist/file-intake/index.js +1 -4
  54. package/dist/{index-DZ7E7bCl.d.ts → index-DVI9DMSu.d.ts} +189 -18
  55. package/dist/index.d.ts +2 -2
  56. package/dist/index.js +639 -7473
  57. package/dist/map/index.js +20 -540
  58. package/dist/markdown/index.js +6 -184
  59. package/dist/markup/index.js +1 -135
  60. package/dist/page-tabs/index.js +21 -709
  61. package/dist/sounds-OMHXVVQ4.js +1 -0
  62. package/dist/ui/index.d.ts +1 -1
  63. package/dist/ui/index.js +1 -19
  64. package/dist/ui.css +78 -10
  65. package/package.json +4 -3
  66. package/dist/Browser-O3QZGUF2.js +0 -482
  67. package/dist/Browser-O3QZGUF2.js.map +0 -1
  68. package/dist/Calculator-L6N5X3KU.js +0 -192
  69. package/dist/Calculator-L6N5X3KU.js.map +0 -1
  70. package/dist/ConfirmDialog-LYSSZSUD.js +0 -4
  71. package/dist/ConfirmDialog-LYSSZSUD.js.map +0 -1
  72. package/dist/CurrencyConverter-64MKXB3D.js +0 -236
  73. package/dist/CurrencyConverter-64MKXB3D.js.map +0 -1
  74. package/dist/Documents-5WXXYCLI.js +0 -441
  75. package/dist/Documents-5WXXYCLI.js.map +0 -1
  76. package/dist/Files-AUURUUDN.js +0 -805
  77. package/dist/Files-AUURUUDN.js.map +0 -1
  78. package/dist/Notepad-GPXJVPB7.js +0 -410
  79. package/dist/Notepad-GPXJVPB7.js.map +0 -1
  80. package/dist/PdfViewer-HKO6P4SR.js +0 -5
  81. package/dist/PdfViewer-HKO6P4SR.js.map +0 -1
  82. package/dist/PomodoroTimer-4TQBWLP2.js +0 -633
  83. package/dist/PomodoroTimer-4TQBWLP2.js.map +0 -1
  84. package/dist/Preview-FOZYPKM2.js +0 -2959
  85. package/dist/Preview-FOZYPKM2.js.map +0 -1
  86. package/dist/Sidebar-BPU7RCZP.js +0 -291
  87. package/dist/Sidebar-BPU7RCZP.js.map +0 -1
  88. package/dist/Spreadsheet-3C66BBBF.js +0 -519
  89. package/dist/Spreadsheet-3C66BBBF.js.map +0 -1
  90. package/dist/Stock-IF4IHYLU.js +0 -158
  91. package/dist/Stock-IF4IHYLU.js.map +0 -1
  92. package/dist/Weather-725PFR7T.js +0 -431
  93. package/dist/Weather-725PFR7T.js.map +0 -1
  94. package/dist/WorldClock-UU4NZIQ7.js +0 -202
  95. package/dist/WorldClock-UU4NZIQ7.js.map +0 -1
  96. package/dist/apps/index.js.map +0 -1
  97. package/dist/chunk-2TPTHAKI.js +0 -316
  98. package/dist/chunk-2TPTHAKI.js.map +0 -1
  99. package/dist/chunk-4P44JXDS.js +0 -195
  100. package/dist/chunk-4P44JXDS.js.map +0 -1
  101. package/dist/chunk-5O42JXQE.js +0 -26
  102. package/dist/chunk-5O42JXQE.js.map +0 -1
  103. package/dist/chunk-72CQWN7O.js +0 -547
  104. package/dist/chunk-72CQWN7O.js.map +0 -1
  105. package/dist/chunk-7CCHEEYC.js +0 -94
  106. package/dist/chunk-7CCHEEYC.js.map +0 -1
  107. package/dist/chunk-BE7FZOFU.js +0 -17
  108. package/dist/chunk-BE7FZOFU.js.map +0 -1
  109. package/dist/chunk-D276EMXS.js +0 -57
  110. package/dist/chunk-D276EMXS.js.map +0 -1
  111. package/dist/chunk-D7PYW2QS.js +0 -265
  112. package/dist/chunk-D7PYW2QS.js.map +0 -1
  113. package/dist/chunk-DVZWYWSD.js +0 -26
  114. package/dist/chunk-DVZWYWSD.js.map +0 -1
  115. package/dist/chunk-ET6ID4LP.js +0 -102
  116. package/dist/chunk-ET6ID4LP.js.map +0 -1
  117. package/dist/chunk-GA35NEND.js +0 -56
  118. package/dist/chunk-GA35NEND.js.map +0 -1
  119. package/dist/chunk-GIGV2ZRW.js +0 -70
  120. package/dist/chunk-GIGV2ZRW.js.map +0 -1
  121. package/dist/chunk-IPXN646P.js +0 -14
  122. package/dist/chunk-IPXN646P.js.map +0 -1
  123. package/dist/chunk-IRWSRJ4K.js +0 -48
  124. package/dist/chunk-IRWSRJ4K.js.map +0 -1
  125. package/dist/chunk-IULP5BCD.js +0 -79
  126. package/dist/chunk-IULP5BCD.js.map +0 -1
  127. package/dist/chunk-MGGY74RY.js +0 -14
  128. package/dist/chunk-MGGY74RY.js.map +0 -1
  129. package/dist/chunk-OLJDJYSU.js +0 -13678
  130. package/dist/chunk-OLJDJYSU.js.map +0 -1
  131. package/dist/chunk-PIGDNN5F.js +0 -46
  132. package/dist/chunk-PIGDNN5F.js.map +0 -1
  133. package/dist/chunk-Q2MJVSJT.js +0 -7
  134. package/dist/chunk-Q2MJVSJT.js.map +0 -1
  135. package/dist/chunk-Q3LT745N.js +0 -3710
  136. package/dist/chunk-Q3LT745N.js.map +0 -1
  137. package/dist/chunk-QAGQRNKI.js +0 -145
  138. package/dist/chunk-QAGQRNKI.js.map +0 -1
  139. package/dist/chunk-QRL64J5F.js +0 -503
  140. package/dist/chunk-QRL64J5F.js.map +0 -1
  141. package/dist/chunk-QSKCQUZE.js +0 -1103
  142. package/dist/chunk-QSKCQUZE.js.map +0 -1
  143. package/dist/chunk-R4OQIQYX.js +0 -153
  144. package/dist/chunk-R4OQIQYX.js.map +0 -1
  145. package/dist/chunk-RT6DSB5Y.js +0 -143
  146. package/dist/chunk-RT6DSB5Y.js.map +0 -1
  147. package/dist/chunk-SHQM5CK3.js +0 -549
  148. package/dist/chunk-SHQM5CK3.js.map +0 -1
  149. package/dist/chunk-T4VQHMG4.js +0 -822
  150. package/dist/chunk-T4VQHMG4.js.map +0 -1
  151. package/dist/chunk-TRCWINHF.js +0 -105
  152. package/dist/chunk-TRCWINHF.js.map +0 -1
  153. package/dist/chunk-TW7LPMVR.js +0 -16
  154. package/dist/chunk-TW7LPMVR.js.map +0 -1
  155. package/dist/chunk-W622KQTD.js +0 -465
  156. package/dist/chunk-W622KQTD.js.map +0 -1
  157. package/dist/chunk-X4Q6G253.js +0 -416
  158. package/dist/chunk-X4Q6G253.js.map +0 -1
  159. package/dist/chunk-YNKK7NE3.js +0 -171
  160. package/dist/chunk-YNKK7NE3.js.map +0 -1
  161. package/dist/chunk-YPO6RDMX.js +0 -20
  162. package/dist/chunk-YPO6RDMX.js.map +0 -1
  163. package/dist/file-intake/index.js.map +0 -1
  164. package/dist/index.js.map +0 -1
  165. package/dist/map/index.js.map +0 -1
  166. package/dist/markdown/index.js.map +0 -1
  167. package/dist/markup/index.js.map +0 -1
  168. package/dist/page-tabs/index.js.map +0 -1
  169. package/dist/sounds-NT4DEZGD.js +0 -3
  170. package/dist/sounds-NT4DEZGD.js.map +0 -1
  171. package/dist/ui/index.js.map +0 -1
@@ -0,0 +1,23 @@
1
+ import{useAuth as e}from"./chunk-LVDRBRYU.js";import{startMenuCategories as t,navVisible as r,navSections as n,isSection as a,isReachable as o,navIcons as l,sectionIcons as s,visibleChildren as i}from"./chunk-UB4JIOLD.js";import{BrandMark as c}from"./chunk-OCSOMMY2.js";import{glassStyle as d,GLASS_INPUT_BG as h}from"./chunk-57MIENLJ.js";import"./chunk-MAIHBBWT.js";import{useState as m,useRef as u,useMemo as p,useEffect as f,isValidElement as v,cloneElement as x}from"react";import{jsxs as b,jsx as g,Fragment as N}from"react/jsx-runtime";function k({width:k,openPage:w,profile:y,user:L,onLogout:A,onNavigate:C,navSections:j=n,navIcons:S=l,sectionIcons:M=s,categories:I=t,productName:B,productIcon:E,adaptiveLogo:$=!1,logoHasAlpha:_=null,logoIsLight:W=null}){const{hasAnyPerm:O}=e(),P=new Set(I.erp),T=new Set(I.system),U=new Set(I.footer??[]),z=(I.footerItems??[]).filter(e=>r(e,O)),D=I.virtual??[],[H,R]=m(""),[V,J]=m(/* @__PURE__ */new Set),Y=u(null),X=e=>{J(t=>{const r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r})},q=j.filter(e=>!a(e)).filter(e=>r(e,O)&&o(e,O)),F=j.filter(e=>a(e)&&P.has(e.label)),G=j.filter(e=>a(e)&&T.has(e.label)),K=j.filter(e=>a(e)&&U.has(e.label)),Q=e=>r(e,O)?e.items.filter(e=>r(e,O)).filter(e=>o(e,O)):[],Z=(e,t)=>{if(!r(e,O))return[];if(!o(e,O))return[];const n=[];e.label.toLowerCase().includes(t)&&n.push(e);for(const r of i(e,O))n.push(...Z(r,t));return n},ee=p(()=>{if(H.length<2)return[];const e=H.toLowerCase();return[...j.flatMap(t=>a(t)?Q(t).flatMap(t=>Z(t,e)):Z(t,e)),...z.flatMap(t=>Z(t,e))]},[H,j,z,O]);f(()=>{const e=e=>{"Escape"===e.key?(J(/* @__PURE__ */new Set),R("")):"/"===e.key&&"INPUT"!==document.activeElement?.tagName&&"TEXTAREA"!==document.activeElement?.tagName&&(e.preventDefault(),Y.current?.focus())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]);const te=e=>{C(e),ne()},re=e=>{if(e.onSelect)return e.onSelect(),void ne();te(e.to)},ne=()=>{R("")},ae="w-full flex items-center gap-2 rounded-lg px-3 py-2 text-sm",oe=d(),le=e=>{const t=S[e];return t&&v(t)?x(t,{className:"h-4 w-4 shrink-0 text-gray-500"}):/* @__PURE__ */g("span",{className:"h-4 w-4 shrink-0"})},se=e=>{const t=M[e];return t&&v(t)?x(t,{className:"h-4 w-4 shrink-0 text-gray-500"}):/* @__PURE__ */g("span",{className:"h-4 w-4 shrink-0"})},ie=e=>/* @__PURE__ */b("div",{children:[
2
+ /* @__PURE__ */b("button",{onClick:()=>re(e),className:`${ae} text-gray-700 hover:bg-blue-50 hover:text-blue-700 transition-colors`,children:[le(e.to),
3
+ /* @__PURE__ */g("span",{className:"truncate",children:e.label})]}),e.dividerAfter&&/* @__PURE__ */g("div",{className:"border-t border-white/20 my-1.5 mx-2"})]},e.to),ce=e=>{const t=i(e,O).filter(e=>o(e,O));if(0===t.length)return ie(e);const r=`child:${e.to}`,n=V.has(r);/* @__PURE__ */
4
+ return b("div",{children:[
5
+ /* @__PURE__ */b("button",{onClick:()=>X(r),"aria-expanded":n,className:`${ae} text-gray-700 hover:bg-blue-50 hover:text-blue-700 transition-colors`,children:[le(e.to),
6
+ /* @__PURE__ */g("span",{className:"truncate",children:e.label}),
7
+ /* @__PURE__ */g("svg",{className:"h-3.5 w-3.5 ml-auto text-gray-500 transition-transform "+(n?"rotate-90":""),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 4.5l7.5 7.5-7.5 7.5"})})]}),n&&/* @__PURE__ */g("div",{className:"pl-4 mt-0.5 mb-1 space-y-0.5",children:t.map(e=>ce(e))}),e.dividerAfter&&/* @__PURE__ */g("div",{className:"border-t border-white/20 my-1.5 mx-2"})]},e.to)},de=(e,t,r=!1)=>{const n=r?e.items:Q(e);if(0===n.length)return null;const a=V.has(e.label);/* @__PURE__ */
8
+ return b("div",{children:[
9
+ /* @__PURE__ */b("button",{onClick:()=>X(e.label),"aria-expanded":a,className:`${ae} text-gray-700 hover:bg-blue-50 hover:text-blue-700 transition-colors`,children:["icon"in e&&e.icon?e.icon:se(e.label),
10
+ /* @__PURE__ */g("span",{className:"truncate "+(t?"font-medium":""),children:e.label}),
11
+ /* @__PURE__ */g("svg",{className:"h-3.5 w-3.5 ml-auto text-gray-500 transition-transform "+(a?"rotate-90":""),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 4.5l7.5 7.5-7.5 7.5"})})]}),a&&/* @__PURE__ */g("div",{className:"pl-4 mt-0.5 mb-1 space-y-0.5",children:n.map(e=>ce(e))}),"dividerAfter"in e&&e.dividerAfter&&/* @__PURE__ */g("div",{className:"border-t border-white/20 my-1.5 mx-2"})]},e.label)};/* @__PURE__ */
12
+ return b("div",{className:"fixed top-0 left-0 bottom-0 z-[260] flex flex-col rounded-r-2xl overflow-hidden",style:{width:k,...oe},children:[
13
+ /* @__PURE__ */b("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-white/15 shrink-0",children:[E&&/* @__PURE__ */g(c,{src:E,alt:"",slot:"compact",surface:"light",adaptive:$,hasAlpha:_,isLight:W,size:20,decorative:!0,className:"opacity-80"}),
14
+ /* @__PURE__ */g("span",{className:"text-sm font-semibold text-gray-800 truncate",children:B??"Apps"})]}),
15
+ /* @__PURE__ */g("div",{className:"px-3 pt-3 pb-2 shrink-0",children:/* @__PURE__ */b("div",{className:`flex items-center gap-2 ${h} rounded-lg px-2.5 py-1.5`,children:[
16
+ /* @__PURE__ */g("svg",{className:"h-3.5 w-3.5 text-gray-400 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z"})}),
17
+ /* @__PURE__ */g("input",{ref:Y,value:H,onChange:e=>R(e.target.value),placeholder:"Search...",className:"flex-1 bg-transparent text-xs outline-none placeholder-gray-400"}),H&&/* @__PURE__ */g("button",{onClick:()=>R(""),className:"text-gray-400 hover:text-gray-600 text-xs",children:"×"})]})}),
18
+ /* @__PURE__ */g("div",{className:"flex-1 overflow-y-auto px-1 pb-1",children:H.length>=2?
19
+ /* @__PURE__ */g("div",{children:0===ee.length?/* @__PURE__ */g("div",{className:"px-3 py-6 text-center text-xs text-gray-400",children:"No matches"}):ee.map(e=>/* @__PURE__ */b("button",{onClick:()=>re(e),className:`${ae} text-gray-700 hover:bg-blue-50 hover:text-blue-700 transition-colors`,children:[le(e.to),
20
+ /* @__PURE__ */g("span",{className:"truncate",children:e.label})]},e.to))}):/* @__PURE__ */b(N,{children:[q.map(ie),q.length>0&&(F.length>0||G.length>0||D.length>0)&&/* @__PURE__ */g("div",{className:"border-t border-white/15 my-1.5 mx-2"}),F.map(e=>de(e,!0)),G.map(e=>de(e,!1)),D.map(e=>de(e,!1,!0)),(K.length>0||z.length>0)&&/* @__PURE__ */g("div",{className:"border-t border-white/15 my-1.5 mx-2"}),K.map(e=>de(e,!1)),z.map(ie)]})}),
21
+ /* @__PURE__ */g("div",{className:"border-t border-white/15 p-1 shrink-0",children:/* @__PURE__ */b("div",{onClick:()=>te("/profile"),className:"rounded-lg px-2 py-1.5 flex items-center gap-2.5 hover:bg-blue-50 hover:text-blue-700 transition-colors cursor-pointer",children:[y?.avatar_url?/* @__PURE__ */g("img",{src:y.avatar_url,alt:"",className:"h-8 w-8 rounded-full object-cover border border-white/20 shrink-0"}):/* @__PURE__ */g("div",{className:"h-8 w-8 rounded-full bg-blue-100 flex items-center justify-center text-sm font-bold text-blue-700 shrink-0",children:(y?.first_name?.charAt(0)||L?.email?.charAt(0)||"?").toUpperCase()}),
22
+ /* @__PURE__ */g("p",{className:"flex-1 min-w-0 text-sm font-medium text-gray-900 truncate",children:y?.first_name?`${y.first_name} ${y.last_name||""}`.trim():L?.email}),
23
+ /* @__PURE__ */g("button",{onClick:e=>{e.stopPropagation(),A()},title:"Sign Out",className:"shrink-0 p-1.5 rounded-md text-gray-500 hover:text-red-600 hover:bg-red-50 transition-colors",children:/* @__PURE__ */g("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 9V5.25A2.25 2.25 0 0013.5 3h-6a2.25 2.25 0 00-2.25 2.25v13.5A2.25 2.25 0 007.5 21h6a2.25 2.25 0 002.25-2.25V15m3 0l3-3m0 0l-3-3m3 3H9"})})})]})})]})}export{k as default};
@@ -0,0 +1,37 @@
1
+ import{AboutApp as e}from"./chunk-TAWKWSPN.js";import{peekSpreadsheetPreviewStage as t,claimSpreadsheetPreviewStage as r,SPREADSHEET_PREVIEW_UPDATE_EVENT as n}from"./chunk-VTVSMRFX.js";import{WindowTitle as o}from"./chunk-JN4WXTWJ.js";import"./chunk-UB4JIOLD.js";import{EditableGrid as a}from"./chunk-XO43FJRM.js";import"./chunk-BR22X7E5.js";import"./chunk-U4GTZPXP.js";import"./chunk-44UO7FYU.js";import"./chunk-PH3PRIFP.js";import"./chunk-UZAJ5BF6.js";import"./chunk-3A46NCXK.js";import"./chunk-57MIENLJ.js";import"./chunk-OQDWLHZI.js";import"./chunk-MAIHBBWT.js";import"./chunk-D65T4H6J.js";import{useRef as l,useState as s,useEffect as c,useCallback as i}from"react";import{jsxs as u,jsx as d,Fragment as h}from"react/jsx-runtime";var m="ABCDEFGHIJKLMNOPQRSTUVWXYZ",p=10,x=30;function g(e){return e<26?m[e]:m[Math.floor(e/26)-1]+m[e%26]}function y(e){return Array.from({length:e},(e,t)=>({key:`col_${t}`,title:g(t),width:100}))}function b(e,t){return Array.from({length:e},()=>Array(t).fill(""))}function f(e){return{id:crypto.randomUUID(),name:e,columns:y(p),data:b(x,p),cellStyles:{}}}function v(e){return e.split("\n").map(e=>{if(e.includes("\t"))return e.split("\t").map(e=>e.trim());const t=[];let r="",n=!1;for(const o of e)'"'!==o?","!==o||n?r+=o:(t.push(r.trim()),r=""):n=!n;return t.push(r.trim()),t}).filter(e=>e.some(e=>e.trim()))}function w(e,t){const r=v(e);if(0===r.length)return null;const n=Math.max(p,r.reduce((e,t)=>Math.max(e,t.length),0)),o=r.map(e=>{for(;e.length<n;)e.push("");return e});for(;o.length<x;)o.push(Array(n).fill(""));return{id:crypto.randomUUID(),name:t,columns:y(n),data:o,cellStyles:{}}}function k(){const m=l(null),g=l(void 0);void 0===g.current&&(g.current=t());const k=l(g.current?.data??null),N=(()=>{const e=g.current;if(!e)return null;const t=w(e.data.csv,"Sheet 1");if(!t)return null;return{sheet:t,title:e.data.filename.replace(/\.(csv|tsv|txt)$/i,"")}})(),[C,S]=s(N?[N.sheet]:[f("Sheet 1")]),[j,U]=s(0),$=l([]),M=l(C),A=l(!1);c(()=>{A.current?A.current=!1:M.current!==C&&($.current.push(M.current),$.current.length>50&&$.current.shift()),M.current=C},[C]);const E=i(()=>{const e=$.current.pop();e&&(A.current=!0,S(e))},[]);c(()=>{const e=e=>{if(!m.current?.contains(document.activeElement)&&!m.current?.matches(":focus-within"))return;(e.ctrlKey||e.metaKey)&&!e.shiftKey&&("z"===e.key||"Z"===e.key)&&(e.preventDefault(),E())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[E]);const[L,D]=s(N?.title??"Untitled"),[F,I]=s(()=>g.current?.data.onEmail),B=i(e=>{const t=w(e.csv,"Sheet 1");t&&(S([t]),U(0),D(e.filename.replace(/\.(csv|tsv|txt)$/i,"")),I(()=>e.onEmail))},[]);c(()=>{const e=g.current;null!=e&&(r(e),e.data!==k.current&&B(e.data))},[]),c(()=>{const e=g.current?.token;if(null==e)return;const t=t=>{const r=t.detail;r&&r.token===e&&B(r.data)};return window.addEventListener(n,t),()=>window.removeEventListener(n,t)},[]);const[R,J]=s(!1),[K,O]=s(null),[P,X]=s(""),T=l(null),[W,H]=s("1"),[Z,z]=s("10"),V=C[j]||C[0],_=V.data,G=V.columns,Q=V.cellStyles??{},[Y,q]=s(null),[ee,te]=s(null),re=i(()=>{if(ee){const e=Math.min(ee.anchor.row,ee.end.row),t=Math.max(ee.anchor.row,ee.end.row),r=Math.min(ee.anchor.col,ee.end.col),n=Math.max(ee.anchor.col,ee.end.col),o=[];for(let a=e;a<=t;a++)for(let e=r;e<=n;e++)o.push({row:a,col:e});return o}return Y?[Y]:[]},[ee,Y]),ne=i((e,t)=>{const r=re();0!==r.length&&S(n=>n.map((n,o)=>{if(o!==j)return n;const a={...n.cellStyles??{}},l=`${r[0].row}:${r[0].col}`,s=void 0!==t?t:!(a[l]??{})[e];for(const{row:t,col:n}of r){const r=`${t}:${n}`;a[r]={...a[r]??{},[e]:s}}return{...n,cellStyles:a}}))},[re,j]),oe=ee?{row:ee.anchor.row,col:ee.anchor.col}:Y,ae=oe?Q[`${oe.row}:${oe.col}`]??{}:{},le=!!oe,se=i(e=>{S(t=>t.map((t,r)=>r===j?{...t,...e}:t))},[j]),ce=i(e=>{const t=e.reduce((e,t)=>Math.max(e,t.length),0);t!==G.length?se({data:e,columns:y(t)}):se({data:e})},[se,G.length]),ie=(e,t)=>{S(r=>r.map((r,n)=>n===e?{...r,name:t}:r)),O(null)},ue=()=>_.filter(e=>e.some(e=>e.trim())).map(e=>e.map(e=>e.includes(",")||e.includes('"')||e.includes("\n")?`"${e.replace(/"/g,'""')}"`:e).join(",")).join("\n"),de=[];_.forEach(e=>e.forEach(e=>{const t=parseFloat(e);!isNaN(t)&&e.trim()&&de.push(t)}));const he=_.reduce((e,t)=>e+t.filter(e=>e.trim()).length,0);/* @__PURE__ */
2
+ return u("div",{ref:m,className:"flex flex-col h-full",children:[
3
+ /* @__PURE__ */d(o,{title:`${me=L||"Untitled",me.length>24?`${me.slice(0,23)}…`:me} - Spreadsheets`}),
4
+ /* @__PURE__ */d(e,{app:"spreadsheet"}),
5
+ /* @__PURE__ */u("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-gray-200 bg-gray-50 shrink-0",children:[R?/* @__PURE__ */d("input",{type:"text",value:L,onChange:e=>D(e.target.value),onBlur:()=>J(!1),onKeyDown:e=>{"Enter"===e.key&&J(!1)},autoFocus:!0,className:"text-sm font-medium text-gray-900 border border-gray-300 rounded px-2 py-0.5 w-40 focus:border-blue-500 focus:ring-blue-500"}):/* @__PURE__ */d("button",{onClick:()=>J(!0),className:"text-sm font-medium text-gray-900 hover:text-blue-600 truncate max-w-[200px]",title:"Click to rename",children:L||"Untitled"}),
6
+ /* @__PURE__ */d("div",{className:"h-4 w-px bg-gray-300"}),
7
+ /* @__PURE__ */d("input",{ref:T,type:"file",accept:".csv,.tsv,.txt,.xlsx,.xls,.ods",onChange:async e=>{const t=e.target.files?.[0];if(!t)return;const r=t.name.replace(/\.(csv|tsv|txt|xlsx|xls|ods)$/i,"");if(/\.(xlsx|xls|ods)$/i.test(t.name)){const e=new Uint8Array(await t.arrayBuffer()),n=await(import("xlsx")),o=n.read(e,{type:"array"}),a=o.SheetNames.map(e=>{const t=n.utils.sheet_to_json(o.Sheets[e],{header:1,defval:""}),r=Math.max(p,t.reduce((e,t)=>Math.max(e,t.length),0)),a=t.map(e=>{const t=e.map(e=>String(e??""));for(;t.length<r;)t.push("");return t});for(;a.length<x;)a.push(Array(r).fill(""));return{id:crypto.randomUUID(),name:e,columns:y(r),data:a}});S(a),U(0),D(r)}else{const e=v(await t.text());if(0===e.length)return;const n=Math.max(p,e.reduce((e,t)=>Math.max(e,t.length),0)),o=e.map(e=>{for(;e.length<n;)e.push("");return e});for(;o.length<x;)o.push(Array(n).fill(""));se({columns:y(n),data:o}),D(r)}T.current&&(T.current.value="")},className:"hidden"}),
8
+ /* @__PURE__ */d("button",{onClick:()=>T.current?.click(),className:"text-xs text-gray-600 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"Open"}),
9
+ /* @__PURE__ */d("button",{onClick:()=>{const e=new Blob([ue()],{type:"text/csv"}),t=URL.createObjectURL(e),r=document.createElement("a");r.href=t,r.download=`${L||"spreadsheet"}.csv`,r.click(),URL.revokeObjectURL(t)},className:"text-xs text-gray-600 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"Save CSV"}),F&&/* @__PURE__ */d("button",{onClick:()=>F(ue(),`${L||"spreadsheet"}.csv`),className:"text-xs text-gray-600 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"Email"}),
10
+ /* @__PURE__ */d("div",{className:"h-4 w-px bg-gray-300"}),
11
+ /* @__PURE__ */u("div",{className:"flex items-center gap-1",children:[
12
+ /* @__PURE__ */d("input",{type:"number",min:"1",max:"50",value:W,onChange:e=>H(e.target.value),className:"w-10 text-xs text-center border border-gray-300 rounded px-1 py-0.5 focus:border-blue-500 focus:ring-blue-500"}),
13
+ /* @__PURE__ */d("button",{onClick:()=>(e=>{const t=G.length+e;se({columns:y(t),data:_.map(t=>[...t,...Array(e).fill("")])})})(parseInt(W)||1),className:"text-xs text-gray-600 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"+ Col"})]}),
14
+ /* @__PURE__ */u("div",{className:"flex items-center gap-1",children:[
15
+ /* @__PURE__ */d("input",{type:"number",min:"1",max:"500",value:Z,onChange:e=>z(e.target.value),className:"w-10 text-xs text-center border border-gray-300 rounded px-1 py-0.5 focus:border-blue-500 focus:ring-blue-500"}),
16
+ /* @__PURE__ */d("button",{onClick:()=>{return e=parseInt(Z)||10,void se({data:[..._,...Array.from({length:e},()=>Array(G.length).fill(""))]});var e},className:"text-xs text-gray-600 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"+ Row"})]}),
17
+ /* @__PURE__ */d("div",{className:"h-4 w-px bg-gray-300"}),
18
+ /* @__PURE__ */d("button",{onClick:()=>{se({columns:y(p),data:b(x,p)})},className:"text-xs text-gray-600 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"Clear"}),
19
+ /* @__PURE__ */d("div",{className:"h-4 w-px bg-gray-300"}),
20
+ /* @__PURE__ */u("div",{className:"flex items-center gap-0.5",title:le?"":"Click a cell first",children:[
21
+ /* @__PURE__ */d("button",{onClick:()=>ne("bold"),disabled:!le,className:`px-2 py-1 text-xs rounded transition-colors font-bold ${ae.bold?"bg-blue-100 text-blue-700":"text-gray-600 hover:bg-gray-200"} disabled:opacity-40 disabled:cursor-not-allowed`,children:"B"}),
22
+ /* @__PURE__ */d("button",{onClick:()=>ne("italic"),disabled:!le,className:`px-2 py-1 text-xs rounded transition-colors italic ${ae.italic?"bg-blue-100 text-blue-700":"text-gray-600 hover:bg-gray-200"} disabled:opacity-40 disabled:cursor-not-allowed`,children:"I"}),
23
+ /* @__PURE__ */d("button",{onClick:()=>ne("underline"),disabled:!le,className:`px-2 py-1 text-xs rounded transition-colors underline ${ae.underline?"bg-blue-100 text-blue-700":"text-gray-600 hover:bg-gray-200"} disabled:opacity-40 disabled:cursor-not-allowed`,children:"U"}),
24
+ /* @__PURE__ */u("select",{value:ae.fontSize??"base",onChange:e=>ne("fontSize",e.target.value),disabled:!le,className:"ml-1 text-xs border border-gray-300 rounded px-1 py-0.5 bg-white disabled:opacity-40 disabled:cursor-not-allowed",children:[
25
+ /* @__PURE__ */d("option",{value:"sm",children:"XS"}),
26
+ /* @__PURE__ */d("option",{value:"base",children:"S"}),
27
+ /* @__PURE__ */d("option",{value:"lg",children:"M"}),
28
+ /* @__PURE__ */d("option",{value:"xl",children:"L"})]})]})]}),
29
+ /* @__PURE__ */d("div",{className:"flex-1 min-h-0",children:/* @__PURE__ */d(a,{columns:G,data:_,onChange:ce,onColumnsChange:e=>se({columns:e}),cellStyles:Q,onFocusChange:q,onSelectionChange:te,minRows:x,maxHeight:"100%"})}),
30
+ /* @__PURE__ */u("div",{className:"flex items-center border-t border-gray-200 bg-gray-50 shrink-0",children:[
31
+ /* @__PURE__ */u("div",{className:"flex items-center gap-0.5 px-1 py-1 overflow-x-auto flex-1 min-w-0",children:[C.map((e,t)=>/* @__PURE__ */d("button",{onClick:()=>U(t),onDoubleClick:()=>{O(t),X(e.name)},onContextMenu:e=>{e.preventDefault(),C.length>1&&(e=>{C.length<=1||(S(t=>t.filter((t,r)=>r!==e)),j>=e&&j>0&&U(j-1))})(t)},className:"px-3 py-1 text-xs font-medium rounded-b whitespace-nowrap transition-colors "+(t===j?"bg-white text-blue-700 border border-t-0 border-gray-300 -mt-px relative z-10":"text-gray-500 hover:text-gray-700 hover:bg-gray-100"),children:K===t?/* @__PURE__ */d("input",{type:"text",value:P,onChange:e=>X(e.target.value),onBlur:()=>ie(t,P||e.name),onKeyDown:r=>{"Enter"===r.key&&ie(t,P||e.name),"Escape"===r.key&&O(null)},onClick:e=>e.stopPropagation(),autoFocus:!0,className:"w-20 text-xs border border-blue-400 rounded px-1 py-0 focus:ring-0 focus:outline-none"}):e.name},e.id)),
32
+ /* @__PURE__ */d("button",{onClick:()=>{const e=`Sheet ${C.length+1}`;S(t=>[...t,f(e)]),U(C.length)},className:"px-2 py-1 text-xs text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded",title:"Add sheet",children:"+"})]}),
33
+ /* @__PURE__ */u("div",{className:"flex items-center gap-4 px-3 py-1 text-xs text-gray-500 shrink-0 border-l border-gray-200",children:[
34
+ /* @__PURE__ */u("span",{children:[he," cells"]}),de.length>0&&/* @__PURE__ */u(h,{children:[
35
+ /* @__PURE__ */u("span",{children:["Sum: ",de.reduce((e,t)=>e+t,0).toLocaleString(void 0,{maximumFractionDigits:2})]}),
36
+ /* @__PURE__ */u("span",{children:["Avg: ",(de.reduce((e,t)=>e+t,0)/de.length).toLocaleString(void 0,{maximumFractionDigits:2})]})]}),
37
+ /* @__PURE__ */u("span",{children:[_.length," × ",G.length]})]})]})]});var me}export{k as default};
@@ -0,0 +1,16 @@
1
+ import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-H562R4GX.js";import{useWidgetSettings as a}from"./chunk-JN4WXTWJ.js";import"./chunk-UB4JIOLD.js";import"./chunk-44UO7FYU.js";import"./chunk-PH3PRIFP.js";import"./chunk-UZAJ5BF6.js";import"./chunk-3A46NCXK.js";import"./chunk-57MIENLJ.js";import"./chunk-OQDWLHZI.js";import"./chunk-MAIHBBWT.js";import"./chunk-D65T4H6J.js";import{useState as r,useCallback as n}from"react";import{jsxs as c,Fragment as s,jsx as i}from"react/jsx-runtime";var l=["AAPL","MSFT","GOOGL","TSLA","NVDA"],o="stock_symbols",m="stock_appearance",d={AAPL:{price:229.87,change:1.42,changePct:.62},MSFT:{price:451.16,change:-2.31,changePct:-.51},GOOGL:{price:178.34,change:.89,changePct:.5},AMZN:{price:201.45,change:-1.08,changePct:-.53},TSLA:{price:248.92,change:6.74,changePct:2.78},NVDA:{price:134.81,change:-3.12,changePct:-2.26},META:{price:563.27,change:4.55,changePct:.81}},g=Object.keys(d);function p(){try{const e=JSON.parse(localStorage.getItem(o)||"");if(Array.isArray(e)&&e.length)return e.slice(0,8)}catch{}return l}var h=e=>`${e>=0?"+":""}${e.toFixed(2)}`;function x(){const[l,x]=r(p),[u,y]=r(()=>e(m)),[b,f]=r(!1),[N,v]=r([]),[k,A]=r(u),[j,S]=r(""),P=n(()=>{v([...l]),A({...u}),S(""),f(!0)},[l,u]);a(P);const O=()=>{const e=j.trim().toUpperCase();!e||N.includes(e)||N.length>=8||(v(t=>[...t,e]),S(""))},C=g.filter(e=>!N.includes(e));/* @__PURE__ */
2
+ return c(s,{children:[
3
+ /* @__PURE__ */i("div",{style:{backgroundColor:`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${u.activeOpacity/100})`,backdropFilter:u.activeBlur>0?`blur(${u.activeBlur}px)`:void 0},children:/* @__PURE__ */i("div",{className:"px-4 py-3",children:0===l.length?/* @__PURE__ */i("div",{className:"text-xs text-gray-500 text-center py-6",children:"No symbols yet — add some in settings."}):/* @__PURE__ */i("div",{className:"space-y-0.5",children:l.map(e=>{const t=d[e],a=(t?.change??0)>=0,r=t?t.change>0?"text-green-600":t.change<0?"text-red-600":"text-gray-500":"text-gray-400";/* @__PURE__ */
4
+ return c("div",{className:"flex items-center justify-between px-2 py-2 border-b border-gray-200 last:border-0",children:[
5
+ /* @__PURE__ */i("span",{className:"text-sm font-bold text-gray-800 tracking-tight",children:e}),t?/* @__PURE__ */c("div",{className:"flex flex-col items-end leading-tight",children:[
6
+ /* @__PURE__ */i("span",{className:"text-sm font-mono font-semibold text-gray-900 tabular-nums",children:(n=t.price,`$${n.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`)}),
7
+ /* @__PURE__ */c("span",{className:`text-[11px] font-medium tabular-nums ${r}`,children:[a?"▲":"▼"," ",h(t.change)," (",h(t.changePct),"%)"]})]}):/* @__PURE__ */i("span",{className:"text-sm font-mono text-gray-400 tabular-nums",children:"—"})]},e);var n})})})}),
8
+ /* @__PURE__ */i(t,{open:b,onClose:()=>f(!1),title:"Stock Settings",appearance:k,onAppearanceChange:A,onSave:()=>{const e=N.map(e=>e.toUpperCase()).slice(0,8);x(e),y(k),localStorage.setItem(o,JSON.stringify(e)),localStorage.setItem(m,JSON.stringify(k)),f(!1)},children:/* @__PURE__ */c("div",{children:[
9
+ /* @__PURE__ */c("h3",{className:"text-sm font-semibold text-gray-700 mb-2",children:["Symbols ",
10
+ /* @__PURE__ */c("span",{className:"text-[11px] font-normal text-gray-400",children:["(",N.length,"/",8,")"]})]}),
11
+ /* @__PURE__ */c("div",{className:"space-y-1 mb-2",children:[N.map((e,t)=>/* @__PURE__ */c("div",{className:"flex items-center justify-between py-1 px-2 bg-gray-50 rounded",children:[
12
+ /* @__PURE__ */i("span",{className:"text-sm font-semibold text-gray-700",children:e}),
13
+ /* @__PURE__ */i("button",{onClick:()=>v(e=>e.filter((e,a)=>a!==t)),className:"text-red-400 hover:text-red-600",children:"×"})]},t)),0===N.length&&/* @__PURE__ */i("p",{className:"text-[11px] text-gray-400 italic",children:"No symbols — add a ticker below."})]}),N.length<8?/* @__PURE__ */c("div",{className:"flex items-center gap-2",children:[
14
+ /* @__PURE__ */i("input",{value:j,onChange:e=>S(e.target.value),onKeyDown:e=>{"Enter"===e.key&&O()},placeholder:"e.g. NVDA",className:"flex-1 bg-gray-50 border border-gray-200 rounded px-2 py-1 text-sm uppercase focus:outline-none focus:ring-1 focus:ring-blue-500"}),
15
+ /* @__PURE__ */i("button",{onClick:O,className:"text-sm font-medium text-blue-600 hover:text-blue-800 px-2",children:"+ Add"})]}):/* @__PURE__ */c("p",{className:"text-[11px] text-gray-400 italic",children:["Max ",8," symbols — remove one to add another."]}),C.length>0&&N.length<8&&/* @__PURE__ */i("div",{className:"flex flex-wrap gap-1.5 mt-2",children:C.map(e=>/* @__PURE__ */i("button",{onClick:()=>v(t=>t.length<8?[...t,e]:t),className:"text-[11px] font-medium text-gray-600 bg-gray-100 hover:bg-gray-200 rounded px-2 py-0.5 transition-colors",children:e},e))}),
16
+ /* @__PURE__ */i("p",{className:"text-[11px] text-gray-400 mt-2",children:"Demo prices — static sample data, no live feed."})]})})]})}export{x as default};
@@ -0,0 +1,60 @@
1
+ import{fetchCityWeather as e,getCondition as t,AVAILABLE_CITIES as a,toFahrenheit as r}from"./chunk-FBDZGO3V.js";import{loadAppearance as n,WidgetSettingsModal as i}from"./chunk-H562R4GX.js";import{useWidgetSettings as s}from"./chunk-JN4WXTWJ.js";import"./chunk-UB4JIOLD.js";import{useShellPrefs as o}from"./chunk-44UO7FYU.js";import"./chunk-PH3PRIFP.js";import"./chunk-UZAJ5BF6.js";import"./chunk-3A46NCXK.js";import"./chunk-57MIENLJ.js";import"./chunk-OQDWLHZI.js";import"./chunk-MAIHBBWT.js";import"./chunk-D65T4H6J.js";import{useState as l,useEffect as c,useCallback as d}from"react";import{jsx as m,jsxs as p,Fragment as h}from"react/jsx-runtime";var f="weather_city",u="weather_appearance",y={useFahrenheit:!1,showLocalTime:!0,use24Hour:!1};function g(){const e="undefined"!=typeof localStorage?localStorage.getItem(f):null;if(e&&a[e])return e;try{const e=JSON.parse(localStorage.getItem("weather_cities")||"");if(Array.isArray(e)&&e[0]&&a[e[0]])return localStorage.setItem(f,e[0]),e[0]}catch{}return function(){try{const e=Intl.DateTimeFormat().resolvedOptions().timeZone;for(const[t,r]of Object.entries(a))if(r.tz===e)return t}catch{}return"London"}()}var x=r;function b(e,t=!1){try{if(t){const t=new Intl.DateTimeFormat("en-US",{timeZone:e,hour:"numeric",minute:"2-digit",hour12:!1}).formatToParts(/* @__PURE__ */new Date),a=parseInt(t.find(e=>"hour"===e.type)?.value||"0"),r=parseInt(t.find(e=>"minute"===e.type)?.value||"0");return`${String(a).padStart(2,"0")}:${String(r).padStart(2,"0")}`}const a=new Intl.DateTimeFormat("en-US",{timeZone:e,hour:"numeric",minute:"2-digit",hour12:!0}).formatToParts(/* @__PURE__ */new Date),r=parseInt(a.find(e=>"hour"===e.type)?.value||"12"),n=parseInt(a.find(e=>"minute"===e.type)?.value||"0"),i=a.find(e=>"dayPeriod"===e.type)?.value||"";return`${r}:${String(n).padStart(2,"0")} ${i}`}catch{return""}}function w(){/* @__PURE__ */
2
+ return p("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[
3
+ /* @__PURE__ */m("div",{className:"absolute -top-5 -right-5 w-24 h-24",style:{animation:"wx-sun-rays 70s linear infinite"},children:/* @__PURE__ */m("svg",{viewBox:"0 0 100 100",className:"w-full h-full",children:Array.from({length:12}).map((e,t)=>/* @__PURE__ */m("rect",{x:49,y:3,width:2,height:14,rx:1,fill:"rgba(255, 232, 130, 0.55)",transform:`rotate(${30*t} 50 50)`},t))})}),
4
+ /* @__PURE__ */m("div",{className:"absolute top-1 right-1 w-10 h-10 rounded-full",style:{background:"radial-gradient(circle at 35% 35%, #fff8cc 0%, #ffd84a 55%, #ff9e2a 100%)",boxShadow:"0 0 18px 5px rgba(255, 200, 80, 0.55)",animation:"wx-sun-pulse 4.5s ease-in-out infinite"}})]})}function v(){const e=Array.from({length:16}).map((e,t)=>({left:(53*t+11)%95+"%",top:(37*t+9)%78+"%",size:1+13*t%3,delay:.41*t%4+"s",duration:2.5+7*t%5*.6+"s"}));/* @__PURE__ */
5
+ return p("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[
6
+ /* @__PURE__ */m("div",{className:"absolute top-1 right-1",children:/* @__PURE__ */p("svg",{viewBox:"0 0 40 40",className:"w-9 h-9",style:{filter:"drop-shadow(0 0 6px rgba(255,250,220,0.4))"},children:[
7
+ /* @__PURE__ */m("defs",{children:/* @__PURE__ */p("radialGradient",{id:"wx-moon-grad",cx:"35%",cy:"35%",children:[
8
+ /* @__PURE__ */m("stop",{offset:"0",stopColor:"#fffae0"}),
9
+ /* @__PURE__ */m("stop",{offset:"1",stopColor:"#d4c98a"})]})}),
10
+ /* @__PURE__ */m("circle",{cx:20,cy:20,r:13,fill:"url(#wx-moon-grad)"}),
11
+ /* @__PURE__ */m("circle",{cx:26,cy:16,r:11,fill:"rgba(15,23,42,1)"})]})}),e.map((e,t)=>/* @__PURE__ */m("div",{className:"absolute rounded-full bg-white",style:{left:e.left,top:e.top,width:e.size,height:e.size,animation:`wx-twinkle ${e.duration} ease-in-out ${e.delay} infinite`}},t)),
12
+ /* @__PURE__ */m("div",{className:"absolute",style:{left:"15%",top:"20%",animation:"wx-shooting-star 12s ease-out infinite"},children:/* @__PURE__ */m("div",{className:"w-12 h-px",style:{background:"linear-gradient(to right, transparent, rgba(255,255,255,0.95))",boxShadow:"0 0 4px rgba(255,255,255,0.8)"}})})]})}function N({tone:e="light"}){const t="light"===e?"rgba(255,255,255,0.78)":"rgba(220,228,240,0.45)",a=({scale:e=1})=>/* @__PURE__ */p("svg",{viewBox:"0 0 120 50",className:"w-32 h-12",style:{transform:`scale(${e})`,filter:"blur(0.6px)"},children:[
13
+ /* @__PURE__ */m("ellipse",{cx:28,cy:36,rx:18,ry:11,fill:t}),
14
+ /* @__PURE__ */m("ellipse",{cx:50,cy:28,rx:22,ry:15,fill:t}),
15
+ /* @__PURE__ */m("ellipse",{cx:75,cy:32,rx:20,ry:12,fill:t}),
16
+ /* @__PURE__ */m("ellipse",{cx:95,cy:38,rx:15,ry:9,fill:t})]});/* @__PURE__ */
17
+ return p("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[
18
+ /* @__PURE__ */m("div",{className:"absolute",style:{top:"8%",animation:"wx-drift-cloud 42s linear infinite"},children:/* @__PURE__ */m(a,{scale:.9})}),
19
+ /* @__PURE__ */m("div",{className:"absolute",style:{top:"40%",animation:"wx-drift-cloud 60s linear -22s infinite",opacity:.85},children:/* @__PURE__ */m(a,{scale:1.25})}),
20
+ /* @__PURE__ */m("div",{className:"absolute",style:{top:"68%",animation:"wx-drift-cloud 78s linear -45s infinite",opacity:.7},children:/* @__PURE__ */m(a,{scale:.75})})]})}function k({heavy:e=!1}){const t=e?26:16,a=["wx-rain-a","wx-rain-b","wx-rain-c"],r=Array.from({length:t}).map((e,r)=>({left:(100*r/t+11*r%7)%100+"%",delay:.087*r%1.3+"s",height:12+r%4*5+"px",duration:.7+r%3*.18+"s",variant:a[r%a.length]}));/* @__PURE__ */
21
+ return m("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:r.map((e,t)=>/* @__PURE__ */m("div",{className:"absolute",style:{left:e.left,top:"-20px",width:"1px",height:e.height,background:"linear-gradient(180deg, rgba(180,210,255,0) 0%, rgba(220,235,255,0.85) 90%, rgba(255,255,255,0.95) 100%)",transform:"rotate(8deg)",animation:`${e.variant} ${e.duration} linear ${e.delay} infinite`,transformOrigin:"top"}},t))})}function S(){const e=["wx-snow-a","wx-snow-b","wx-snow-c"],t=Array.from({length:16}).map((t,a)=>({left:(100*a/16+13*a%5)%100+"%",delay:.43*a%5+"s",duration:4.5+a%5+"s",size:3+a%4*1.4,opacity:.65+7*a%4*.08,variant:e[a%e.length]}));/* @__PURE__ */
22
+ return m("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:t.map((e,t)=>/* @__PURE__ */m("div",{className:"absolute rounded-full bg-white",style:{left:e.left,top:"-12px",width:e.size,height:e.size,opacity:e.opacity,boxShadow:"0 0 4px rgba(255,255,255,0.65)",animation:`${e.variant} ${e.duration} linear ${e.delay} infinite`}},t))})}function $(){/* @__PURE__ */
23
+ return p("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[
24
+ /* @__PURE__ */m(k,{heavy:!0}),
25
+ /* @__PURE__ */m("div",{className:"absolute inset-0 bg-white",style:{animation:"wx-flash 6s ease-out infinite"}}),
26
+ /* @__PURE__ */m("div",{className:"absolute inset-y-0 right-1/3 flex items-center justify-center pointer-events-none",style:{animation:"wx-bolt 6s ease-out infinite"},children:/* @__PURE__ */m("svg",{viewBox:"0 0 18 60",className:"h-4/5",style:{filter:"drop-shadow(0 0 6px rgba(255, 240, 150, 0.95)) drop-shadow(0 0 14px rgba(255, 220, 90, 0.7))"},children:/* @__PURE__ */m("path",{d:"M11 0 L2 28 L8 30 L4 60 L16 24 L9 22 Z",fill:"rgba(255, 250, 200, 0.98)",stroke:"rgba(255, 255, 255, 0.9)",strokeWidth:.3})})})]})}function j(){/* @__PURE__ */
27
+ return m("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:Array.from({length:4}).map((e,t)=>/* @__PURE__ */m("div",{className:"absolute left-0 right-0",style:{top:10+22*t+"%",height:"14px",background:"linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.55) 50%, rgba(255,255,255,0) 100%)",filter:"blur(2px)",animation:`wx-fog-drift ${10+3*t}s ease-in-out ${.7*t}s infinite alternate`}},t))})}function I({code:e,isDay:t}){return 0===e||1===e?/* @__PURE__ */m(t?w:v,{}):2===e?/* @__PURE__ */p(h,{children:[/* @__PURE__ */m(t?w:v,{}),
28
+ /* @__PURE__ */m(N,{tone:t?"light":"dark"})]}):3===e?/* @__PURE__ */m(N,{tone:t?"light":"dark"}):45===e||48===e?/* @__PURE__ */m(j,{}):[51,53,61,80,81].includes(e)?/* @__PURE__ */m(k,{}):[55,63,65,82].includes(e)?/* @__PURE__ */m(k,{heavy:!0}):[71,73,75].includes(e)?/* @__PURE__ */m(S,{}):[95,96,99].includes(e)?/* @__PURE__ */m($,{}):null}function F(){const[r,w]=l(g),[v,N]=l(()=>n(u)),[k,S]=l(null),[$,j]=l(!0),[,F]=l(0);c(()=>{const e=setInterval(()=>F(e=>e+1),6e4);return()=>clearInterval(e)},[]);const[L,D]=l(!1),[T,A]=l(r),[C,H]=l(v),{prefs:B,save:O}=o(),z={...y,...B.weather_prefs??{}},[J,P]=l(z);s(d(()=>{A(r),H({...v}),P({...z}),D(!0)},[r,v,z])),c(()=>{let t=!1;return j(!0),e(r).then(e=>{t||(S(e),j(!1))}),()=>{t=!0}},[r]);const X=e=>z.useFahrenheit?`${x(e)}°F`:`${e}°`;if($&&!k)/* @__PURE__ */
29
+ return m("div",{className:"flex items-center justify-center h-full bg-gradient-to-b from-sky-400 to-blue-500 rounded-lg text-white/80 text-xs",style:{minHeight:110},children:"Loading…"});if(!k)/* @__PURE__ */
30
+ return m("div",{className:"flex items-center justify-center h-full bg-slate-700 rounded-lg text-white/80 text-xs",style:{minHeight:110},children:"Couldn't load weather"});const[Z,U,W]=t(k.code,k.isDay);/* @__PURE__ */
31
+ return p(h,{children:[
32
+ /* @__PURE__ */m("style",{children:"\n@keyframes wx-rain-a { 0% { transform: translate(0,-20px); opacity: 0; } 10% { opacity: 0.95; } 100% { transform: translate(8px,140px); opacity: 0; } }\n@keyframes wx-rain-b { 0% { transform: translate(0,-20px); opacity: 0; } 12% { opacity: 0.85; } 100% { transform: translate(12px,140px); opacity: 0; } }\n@keyframes wx-rain-c { 0% { transform: translate(0,-20px); opacity: 0; } 10% { opacity: 1; } 100% { transform: translate(5px,140px); opacity: 0; } }\n@keyframes wx-snow-a { 0% { transform: translate(0,-12px) rotate(0deg); opacity: 0; } 10% { opacity: 0.9; } 50% { transform: translate(10px,55px) rotate(180deg); } 100% { transform: translate(-4px,140px) rotate(360deg); opacity: 0; } }\n@keyframes wx-snow-b { 0% { transform: translate(0,-12px) rotate(0deg); opacity: 0; } 10% { opacity: 0.85; } 50% { transform: translate(-12px,55px) rotate(-180deg); } 100% { transform: translate(6px,140px) rotate(-360deg); opacity: 0; } }\n@keyframes wx-snow-c { 0% { transform: translate(0,-12px); opacity: 0; } 10% { opacity: 0.7; } 100% { transform: translate(2px,140px); opacity: 0; } }\n@keyframes wx-drift-cloud { 0% { transform: translateX(-40%); } 100% { transform: translateX(140%); } }\n@keyframes wx-twinkle { 0%, 100% { opacity: 0.25; transform: scale(1); } 50% { opacity: 1; transform: scale(1.6); } }\n@keyframes wx-flash { 0%, 86%, 100% { opacity: 0; } 87% { opacity: 0.95; } 88% { opacity: 0.15; } 89% { opacity: 0.85; } 90% { opacity: 0; } }\n@keyframes wx-bolt { 0%, 86%, 90%, 100% { opacity: 0; } 87% { opacity: 1; } 89% { opacity: 0.85; } }\n@keyframes wx-sun-pulse { 0%, 100% { transform: scale(1); opacity: 0.65; } 50% { transform: scale(1.12); opacity: 0.95; } }\n@keyframes wx-sun-rays { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }\n@keyframes wx-fog-drift { 0% { transform: translateX(-25%); opacity: 0.3; } 50% { opacity: 0.65; } 100% { transform: translateX(25%); opacity: 0.3; } }\n@keyframes wx-shooting-star { 0%, 95% { opacity: 0; transform: translate(0,0) scale(0); } 96% { opacity: 1; transform: translate(0,0) scale(1); } 100% { opacity: 0; transform: translate(40px,30px) scale(1); } }\n"}),
33
+ /* @__PURE__ */m("div",{className:"rounded-lg overflow-hidden",style:{backgroundColor:`rgba(15, 23, 42, ${v.activeOpacity/100})`,backdropFilter:v.activeBlur>0?`blur(${v.activeBlur}px)`:void 0},children:/* @__PURE__ */p("div",{className:`relative rounded-lg overflow-hidden text-white bg-gradient-to-br ${W}`,style:{height:110},children:[
34
+ /* @__PURE__ */m(I,{code:k.code,isDay:k.isDay}),
35
+ /* @__PURE__ */p("div",{className:"relative z-10 px-3 py-2.5 flex flex-col h-full justify-between",children:[
36
+ /* @__PURE__ */p("div",{className:"flex items-start justify-between gap-2",children:[
37
+ /* @__PURE__ */p("div",{className:"min-w-0 flex-1",children:[
38
+ /* @__PURE__ */m("div",{className:"text-base font-semibold leading-tight truncate drop-shadow-sm",children:k.city}),z.showLocalTime&&/* @__PURE__ */m("div",{className:"text-[10px] opacity-90 leading-tight tabular-nums drop-shadow-sm",children:b(k.timezone,z.use24Hour)})]}),
39
+ /* @__PURE__ */m("div",{className:"text-3xl font-extralight leading-none tracking-tight tabular-nums shrink-0 drop-shadow-sm",children:X(k.temp)})]}),
40
+ /* @__PURE__ */p("div",{className:"flex items-end justify-between gap-2",children:[
41
+ /* @__PURE__ */p("div",{className:"flex items-center gap-1.5 min-w-0",children:[
42
+ /* @__PURE__ */m("span",{className:"text-lg leading-none drop-shadow-sm",children:U}),
43
+ /* @__PURE__ */m("span",{className:"text-[11px] font-medium drop-shadow-sm truncate",children:Z})]}),
44
+ /* @__PURE__ */p("span",{className:"text-[10px] opacity-90 tabular-nums drop-shadow-sm shrink-0",children:["H:",X(k.high)," L:",X(k.low)]})]})]})]})}),
45
+ /* @__PURE__ */p(i,{open:L,onClose:()=>D(!1),title:"Weather Settings",appearance:C,onAppearanceChange:H,onSave:()=>{w(T),N(C),O({weather_prefs:J}),localStorage.setItem(f,T),localStorage.setItem(u,JSON.stringify(C)),D(!1)},children:[
46
+ /* @__PURE__ */m("div",{className:"space-y-3",children:/* @__PURE__ */p("div",{children:[
47
+ /* @__PURE__ */m("h3",{className:"text-sm font-semibold text-gray-700 mb-2",children:"Display"}),
48
+ /* @__PURE__ */p("div",{className:"flex items-center gap-3 mb-2",children:[
49
+ /* @__PURE__ */m("span",{className:"text-sm text-gray-600 w-24",children:"Temperature"}),
50
+ /* @__PURE__ */m("div",{className:"flex gap-1",children:[{key:!1,label:"°C"},{key:!0,label:"°F"}].map(e=>/* @__PURE__ */m("button",{onClick:()=>P(t=>({...t,useFahrenheit:e.key})),className:"px-3 py-1 text-xs font-medium rounded-lg border transition-colors "+(J.useFahrenheit===e.key?"bg-blue-600 text-white border-blue-600":"bg-white text-gray-700 border-gray-300 hover:bg-gray-50"),children:e.label},String(e.key)))})]}),
51
+ /* @__PURE__ */p("div",{className:"flex items-center gap-3 mb-2",children:[
52
+ /* @__PURE__ */m("span",{className:"text-sm text-gray-600 w-24",children:"Time Format"}),
53
+ /* @__PURE__ */m("div",{className:"flex gap-1",children:[{key:!1,label:"AM/PM"},{key:!0,label:"24H"}].map(e=>/* @__PURE__ */m("button",{onClick:()=>P(t=>({...t,use24Hour:e.key})),className:"px-3 py-1 text-xs font-medium rounded-lg border transition-colors "+(J.use24Hour===e.key?"bg-blue-600 text-white border-blue-600":"bg-white text-gray-700 border-gray-300 hover:bg-gray-50"),children:e.label},String(e.key)))})]}),
54
+ /* @__PURE__ */p("label",{className:"flex items-center gap-2 cursor-pointer",children:[
55
+ /* @__PURE__ */m("input",{type:"checkbox",checked:J.showLocalTime,onChange:e=>P(t=>({...t,showLocalTime:e.target.checked})),className:"rounded border-gray-300 text-blue-600 h-3.5 w-3.5"}),
56
+ /* @__PURE__ */m("span",{className:"text-sm text-gray-600",children:"Show local time"})]})]})}),
57
+ /* @__PURE__ */p("div",{children:[
58
+ /* @__PURE__ */m("h3",{className:"text-sm font-semibold text-gray-700 mb-2",children:"City"}),
59
+ /* @__PURE__ */m("select",{value:T,onChange:e=>A(e.target.value),className:"w-full bg-gray-50 border border-gray-200 rounded px-2 py-1.5 text-sm focus:outline-none focus:ring-1 focus:ring-blue-500",children:Object.keys(a).map(e=>/* @__PURE__ */m("option",{value:e,children:e},e))}),
60
+ /* @__PURE__ */m("p",{className:"mt-1 text-[10px] text-gray-400",children:"Auto-detected from your timezone; change if needed."})]})]})]})}export{F as default};
@@ -0,0 +1,32 @@
1
+ import{AVAILABLE_CITIES as e,fetchCityWeather as t,getCondition as a,toFahrenheit as r}from"./chunk-FBDZGO3V.js";import{loadAppearance as n,WidgetSettingsModal as i}from"./chunk-H562R4GX.js";import{useWidgetSettings as s}from"./chunk-JN4WXTWJ.js";import"./chunk-UB4JIOLD.js";import{useShellPrefs as c}from"./chunk-44UO7FYU.js";import"./chunk-PH3PRIFP.js";import"./chunk-UZAJ5BF6.js";import"./chunk-3A46NCXK.js";import"./chunk-57MIENLJ.js";import"./chunk-OQDWLHZI.js";import"./chunk-MAIHBBWT.js";import"./chunk-D65T4H6J.js";import{useState as l,useEffect as o,useCallback as m}from"react";import{jsxs as h,Fragment as d,jsx as p}from"react/jsx-runtime";var u="world_clock_appearance",g=["London","Shanghai","New York"];function x(){const{prefs:x,save:y}=c(),[b,f]=l(()=>n(u)),[k,N]=l(!1),[v,w]=l([]),[j,F]=l(b),C={useFahrenheit:!!x.weather_prefs?.useFahrenheit},[D,I]=l(C),[O,S]=l(()=>/* @__PURE__ */new Date);o(()=>{const e=setInterval(()=>S(/* @__PURE__ */new Date),3e4);return()=>clearInterval(e)},[]);const B=Object.fromEntries(Object.entries(e).map(([e,t])=>[t.tz,e])),J=x.world_clocks,L=(()=>{if(!Array.isArray(J)||0===J.length)return g;const t=[];for(const a of J){const r=e[a]?a:B[a];r&&!t.includes(r)&&t.push(r)}return t.length?t:g})(),[T,U]=l({}),[_,A]=l(!0);o(()=>{let e=!1;return A(!0),(async()=>{const a={};await Promise.all(L.map(async e=>{const r=await t(e);r&&(a[e]=r)})),e||(U(a),A(!1))})(),()=>{e=!0}},[L.join(",")]),s(m(()=>{w([...L]),F({...b}),I({...C}),N(!0)},[L.join(","),b,C.useFahrenheit]));const H=e=>C.useFahrenheit?`${r(e)}°`:`${e}°`;/* @__PURE__ */
2
+ return h(d,{children:[
3
+ /* @__PURE__ */p("div",{style:{backgroundColor:`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${b.activeOpacity/100})`,backdropFilter:b.activeBlur>0?`blur(${b.activeBlur}px)`:void 0},children:/* @__PURE__ */h("div",{className:"divide-y divide-gray-200",children:[_&&L.every(e=>!T[e])&&/* @__PURE__ */p("div",{className:"px-3 py-6 text-center text-xs text-gray-500",children:"Loading…"}),L.map(t=>{const r=T[t],n=e[t]?.tz??"UTC",{time:i,ampm:s}=function(e,t){try{const a=new Intl.DateTimeFormat("en-US",{timeZone:e,hour:"numeric",minute:"2-digit",hour12:!0}).formatToParts(t),r=a.find(e=>"hour"===e.type)?.value||"12";return{time:`${r}:${a.find(e=>"minute"===e.type)?.value||"00"}`,ampm:(a.find(e=>"dayPeriod"===e.type)?.value||"").toUpperCase()}}catch{return{time:"",ampm:""}}}(n,O);if(!r)/* @__PURE__ */
4
+ return h("div",{className:"px-4 py-3",children:[
5
+ /* @__PURE__ */h("div",{className:"flex items-baseline justify-between gap-2",children:[
6
+ /* @__PURE__ */p("span",{className:"text-[15px] font-semibold tracking-tight text-gray-900 truncate",children:t}),
7
+ /* @__PURE__ */h("span",{className:"tabular-nums text-[13px] font-medium text-gray-500",children:[i,
8
+ /* @__PURE__ */p("span",{className:"text-[9px] ml-0.5 opacity-70",children:s})]})]}),
9
+ /* @__PURE__ */p("div",{className:"text-[11px] text-gray-400 mt-1",children:"Loading weather…"})]},t);const[c,l]=a(r.code,r.isDay);/* @__PURE__ */
10
+ return h("div",{className:"px-4 py-3",children:[
11
+ /* @__PURE__ */h("div",{className:"flex items-baseline justify-between gap-2",children:[
12
+ /* @__PURE__ */p("span",{className:"text-[15px] font-semibold tracking-tight text-gray-900 truncate",children:t}),
13
+ /* @__PURE__ */p("span",{className:"text-[26px] font-extralight leading-none tabular-nums tracking-tight text-gray-900 shrink-0",children:H(r.temp)})]}),
14
+ /* @__PURE__ */h("div",{className:"flex items-center justify-between gap-2 mt-1.5 text-[11px]",children:[
15
+ /* @__PURE__ */h("div",{className:"flex items-center gap-1.5 min-w-0 text-gray-500",children:[
16
+ /* @__PURE__ */p("span",{className:"text-base leading-none shrink-0",children:l}),
17
+ /* @__PURE__ */h("span",{className:"tabular-nums font-semibold text-gray-700 shrink-0",children:[i,
18
+ /* @__PURE__ */p("span",{className:"text-[9px] font-medium ml-0.5 opacity-70",children:s})]}),
19
+ /* @__PURE__ */p("span",{className:"text-gray-300 shrink-0",children:"·"}),
20
+ /* @__PURE__ */p("span",{className:"truncate",children:c})]}),
21
+ /* @__PURE__ */h("span",{className:"tabular-nums text-gray-500 shrink-0",children:["H:",H(r.high)," L:",H(r.low)]})]})]},t)})]})}),
22
+ /* @__PURE__ */h(i,{open:k,onClose:()=>N(!1),title:"World Clock Settings",appearance:j,onAppearanceChange:F,onSave:()=>{0!==v.length&&(y({world_clocks:v,weather_prefs:{...x.weather_prefs??{},useFahrenheit:D.useFahrenheit}}),f(j),localStorage.setItem(u,JSON.stringify(j)),N(!1))},children:[
23
+ /* @__PURE__ */h("div",{children:[
24
+ /* @__PURE__ */p("h3",{className:"text-sm font-semibold text-gray-700 mb-2",children:"Display"}),
25
+ /* @__PURE__ */h("div",{className:"flex items-center gap-3 mb-2",children:[
26
+ /* @__PURE__ */p("span",{className:"text-sm text-gray-600 w-24",children:"Temperature"}),
27
+ /* @__PURE__ */p("div",{className:"flex gap-1",children:[{key:!1,label:"°C"},{key:!0,label:"°F"}].map(e=>/* @__PURE__ */p("button",{onClick:()=>I(t=>({...t,useFahrenheit:e.key})),className:"px-3 py-1 text-xs font-medium rounded-lg border transition-colors "+(D.useFahrenheit===e.key?"bg-blue-600 text-white border-blue-600":"bg-white text-gray-700 border-gray-300 hover:bg-gray-50"),children:e.label},String(e.key)))})]}),
28
+ /* @__PURE__ */p("p",{className:"text-[10px] text-gray-400 mt-1",children:"Shared with the Weather widget."})]}),
29
+ /* @__PURE__ */h("div",{children:[
30
+ /* @__PURE__ */p("h3",{className:"text-sm font-semibold text-gray-700 mb-2",children:"Cities"}),
31
+ /* @__PURE__ */p("div",{className:"grid grid-cols-2 gap-1 max-h-56 overflow-y-auto",children:Object.keys(e).map(e=>/* @__PURE__ */h("label",{className:"flex items-center gap-2 text-sm py-1 cursor-pointer hover:bg-gray-50 rounded px-2",children:[
32
+ /* @__PURE__ */p("input",{type:"checkbox",checked:v.includes(e),onChange:()=>w(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),className:"rounded border-gray-300 text-blue-600 focus:ring-blue-500 h-3.5 w-3.5"}),e]},e))})]})]})]})}export{x as default};
@@ -1,152 +1,2 @@
1
1
  "use client";
2
- export { openFilesInTrashMode, setFilesDemoTree } from '../chunk-BE7FZOFU.js';
3
- export { setBrowserStartUrl } from '../chunk-TW7LPMVR.js';
4
- export { BUILTIN_APP_INFO } from '../chunk-IULP5BCD.js';
5
- import '../chunk-YNKK7NE3.js';
6
- import { setPdfPreview } from '../chunk-DVZWYWSD.js';
7
- export { setPdfPreview } from '../chunk-DVZWYWSD.js';
8
- import { setSpreadsheetPreview } from '../chunk-5O42JXQE.js';
9
- export { setSpreadsheetPreview } from '../chunk-5O42JXQE.js';
10
- import '../chunk-Q3LT745N.js';
11
- import '../chunk-GA35NEND.js';
12
- import '../chunk-Q2MJVSJT.js';
13
- import { toast_default } from '../chunk-4P44JXDS.js';
14
- import '../chunk-2TPTHAKI.js';
15
- import '../chunk-RT6DSB5Y.js';
16
- import '../chunk-QRL64J5F.js';
17
- import '../chunk-W622KQTD.js';
18
- import '../chunk-D276EMXS.js';
19
- import '../chunk-72CQWN7O.js';
20
- import '../chunk-IRWSRJ4K.js';
21
- import '../chunk-IPXN646P.js';
22
- import { lazy } from 'react';
23
-
24
- // src/apps/openAttachment.ts
25
- function extOf(name) {
26
- const m = /\.([a-z0-9]+)(?:[?#].*)?$/i.exec((name || "").trim());
27
- return m ? m[1].toLowerCase() : "";
28
- }
29
- var DELIMITED_TEXT_EXT = /* @__PURE__ */ new Set(["csv", "tsv"]);
30
- var BINARY_WORKBOOK_EXT = /* @__PURE__ */ new Set(["xlsx", "xls", "xlsm", "ods"]);
31
- var IMAGE_EXT = /* @__PURE__ */ new Set(["png", "jpg", "jpeg", "gif", "webp", "bmp", "svg", "avif"]);
32
- var THREED_EXT = /* @__PURE__ */ new Set(["step", "stp", "stl", "obj", "gltf", "glb", "3mf", "iges", "igs"]);
33
- function attachmentKind(nameOrUrl) {
34
- const ext = extOf(nameOrUrl);
35
- if (ext === "pdf") return "pdf";
36
- if (ext === "dxf") return "dxf";
37
- if (DELIMITED_TEXT_EXT.has(ext)) return "csv";
38
- if (IMAGE_EXT.has(ext)) return "image";
39
- if (THREED_EXT.has(ext)) return "3d";
40
- return null;
41
- }
42
- function openInNewTab(url) {
43
- window.open(url, "_blank", "noopener,noreferrer");
44
- }
45
- async function readText(url, opts, att) {
46
- if (opts.fetchBlob) return (await opts.fetchBlob(att)).text();
47
- const res = await fetch(url);
48
- if (!res.ok) throw new Error(`fetch failed: ${res.status}`);
49
- return res.text();
50
- }
51
- function errorText(err, fallback) {
52
- const message = err instanceof Error ? err.message : "";
53
- return message || fallback;
54
- }
55
- async function openAttachment(att, openPage, opts = {}) {
56
- const url = att?.url || "";
57
- const filename = att?.filename || "attachment";
58
- if (!url && !opts.fetchBlob) {
59
- toast_default.error("This attachment has no download link.");
60
- return;
61
- }
62
- const kind = attachmentKind(filename) ?? attachmentKind(url);
63
- if (kind === "csv") {
64
- try {
65
- setSpreadsheetPreview({ csv: await readText(url, opts, att), filename });
66
- openPage("/spreadsheet");
67
- } catch {
68
- toast_default.error("Could not open the spreadsheet \u2014 opening the file instead.");
69
- if (url) openInNewTab(url);
70
- }
71
- return;
72
- }
73
- if (BINARY_WORKBOOK_EXT.has(extOf(filename) || extOf(url))) {
74
- toast_default.error("Spreadsheet preview is unavailable for this file type. Opening the file instead.");
75
- if (url) openInNewTab(url);
76
- return;
77
- }
78
- if (!kind) {
79
- if (!url) {
80
- toast_default.error("This attachment has no download link.");
81
- return;
82
- }
83
- toast_default.info("Opening this file outside the app \u2014 no viewer can show it here.");
84
- openInNewTab(url);
85
- return;
86
- }
87
- if (!opts.fetchBlob) {
88
- setPdfPreview({ url, filename, kind });
89
- openPage("/preview");
90
- return;
91
- }
92
- const handle = setPdfPreview({
93
- filename,
94
- kind,
95
- converting: true,
96
- convertingMessage: opts.loadingMessage || "LOADING FILE"
97
- });
98
- openPage("/preview");
99
- try {
100
- const blob = await opts.fetchBlob(att);
101
- handle.update({ url: URL.createObjectURL(blob), filename, kind });
102
- } catch (err) {
103
- handle.update({
104
- filename,
105
- kind,
106
- converting: false,
107
- convertingMessage: errorText(err, "Failed to load this file.")
108
- });
109
- }
110
- }
111
-
112
- // src/apps/index.ts
113
- var Calculator = lazy(() => import('../Calculator-L6N5X3KU.js'));
114
- var Spreadsheet = lazy(() => import('../Spreadsheet-3C66BBBF.js'));
115
- var Weather = lazy(() => import('../Weather-725PFR7T.js'));
116
- var CurrencyConverter = lazy(() => import('../CurrencyConverter-64MKXB3D.js'));
117
- var PomodoroTimer = lazy(() => import('../PomodoroTimer-4TQBWLP2.js'));
118
- var Notepad = lazy(() => import('../Notepad-GPXJVPB7.js'));
119
- var WorldClock = lazy(() => import('../WorldClock-UU4NZIQ7.js'));
120
- var Stock = lazy(() => import('../Stock-IF4IHYLU.js'));
121
- var Preview = lazy(() => import('../Preview-FOZYPKM2.js'));
122
- var PdfViewer = lazy(() => import('../PdfViewer-HKO6P4SR.js'));
123
- var Documents = lazy(() => import('../Documents-5WXXYCLI.js'));
124
- var Files = lazy(() => import('../Files-AUURUUDN.js'));
125
- var Browser = lazy(() => import('../Browser-O3QZGUF2.js'));
126
- var utilityApps = {
127
- "/calculator": { component: Calculator, label: "Calculator", size: "sm", allowPinOnTop: true, utility: true, widget: true, dimensions: [280, 420] },
128
- "/spreadsheet": { component: Spreadsheet, label: "Spreadsheets", size: "2xl", appStyle: true, multiInstance: true },
129
- "/notepad": { component: Notepad, label: "Notepad", size: "lg", allowPinOnTop: true, flushBody: true },
130
- "/weather": { component: Weather, label: "Weather", size: "sm", utility: true, widget: true, autoHeight: true, dimensions: [320, 400] },
131
- "/currency": { component: CurrencyConverter, label: "Currency Converter", size: "sm", utility: true, widget: true, autoHeight: true, dimensions: [320, 480] },
132
- "/pomodoro": { component: PomodoroTimer, label: "Pomodoro Timer", size: "sm", utility: true, widget: true, dimensions: [320, 600] },
133
- "/world-clock": { component: WorldClock, label: "World Clock", size: "sm", utility: true, widget: true, autoHeight: true, dimensions: [320, 480] },
134
- "/stock": { component: Stock, label: "Stocks", size: "sm", utility: true, widget: true, autoHeight: true, dimensions: [320, 360] }
135
- };
136
- var documentApps = {
137
- "/preview": { component: Preview, label: "Preview", size: "2xl", appStyle: true, multiInstance: true },
138
- "/documents": { component: Documents, label: "Documents", size: "xl", appStyle: true, multiInstance: true },
139
- "/files": { component: Files, label: "Files", size: "xl", appStyle: true }
140
- };
141
- var webApps = {
142
- "/browser": { component: Browser, label: "Browser", size: "2xl", appStyle: true, multiInstance: true }
143
- };
144
- var bundledApps = {
145
- ...utilityApps,
146
- ...documentApps,
147
- ...webApps
148
- };
149
-
150
- export { Browser, Calculator, CurrencyConverter, Documents, Files, Notepad, PdfViewer, PomodoroTimer, Preview, Spreadsheet, Stock, Weather, WorldClock, attachmentKind, bundledApps, documentApps, openAttachment, utilityApps, webApps };
151
- //# sourceMappingURL=index.js.map
152
- //# sourceMappingURL=index.js.map
2
+ export{openFilesInTrashMode,setFilesDemoTree}from"../chunk-FHTLC7HH.js";export{setBrowserStartUrl}from"../chunk-LWLCNQY7.js";export{BUILTIN_APP_INFO}from"../chunk-TAWKWSPN.js";import"../chunk-NPJH5MD7.js";import{setPdfPreview as e}from"../chunk-ESL5TDNA.js";export{setPdfPreview}from"../chunk-ESL5TDNA.js";import{setSpreadsheetPreview as t}from"../chunk-VTVSMRFX.js";export{setSpreadsheetPreview}from"../chunk-VTVSMRFX.js";import"../chunk-JN4WXTWJ.js";import"../chunk-UB4JIOLD.js";import"../chunk-U4GTZPXP.js";import{toast_default as o}from"../chunk-VEGMDXT4.js";import"../chunk-44UO7FYU.js";import"../chunk-PH3PRIFP.js";import"../chunk-UZAJ5BF6.js";import"../chunk-3A46NCXK.js";import"../chunk-57MIENLJ.js";import"../chunk-OQDWLHZI.js";import"../chunk-MAIHBBWT.js";import"../chunk-D65T4H6J.js";import{lazy as i}from"react";function n(e){const t=/\.([a-z0-9]+)(?:[?#].*)?$/i.exec((e||"").trim());return t?t[1].toLowerCase():""}var r=/* @__PURE__ */new Set(["csv","tsv"]),s=/* @__PURE__ */new Set(["xlsx","xls","xlsm","ods"]),a=/* @__PURE__ */new Set(["png","jpg","jpeg","gif","webp","bmp","svg","avif"]),l=/* @__PURE__ */new Set(["step","stp","stl","obj","gltf","glb","3mf","iges","igs"]);function c(e){const t=n(e);return"pdf"===t?"pdf":"dxf"===t?"dxf":r.has(t)?"csv":a.has(t)?"image":l.has(t)?"3d":null}function p(e){window.open(e,"_blank","noopener,noreferrer")}async function m(e,t,o){if(t.fetchBlob)return(await t.fetchBlob(o)).text();const i=await fetch(e);if(!i.ok)throw new Error(`fetch failed: ${i.status}`);return i.text()}function u(e,t){return(e instanceof Error?e.message:"")||t}async function h(i,r,a={}){const l=i?.url||"",h=i?.filename||"attachment";if(!l&&!a.fetchBlob)return void o.error("This attachment has no download link.");const d=c(h)??c(l);if("csv"===d){try{t({csv:await m(l,a,i),filename:h}),r("/spreadsheet")}catch{o.error("Could not open the spreadsheet — opening the file instead."),l&&p(l)}return}if(s.has(n(h)||n(l)))return o.error("Spreadsheet preview is unavailable for this file type. Opening the file instead."),void(l&&p(l));if(!d)return l?(o.info("Opening this file outside the app — no viewer can show it here."),void p(l)):void o.error("This attachment has no download link.");if(!a.fetchBlob)return e({url:l,filename:h,kind:d}),void r("/preview");const f=e({filename:h,kind:d,converting:!0,convertingMessage:a.loadingMessage||"LOADING FILE"});r("/preview");try{const e=await a.fetchBlob(i);f.update({url:URL.createObjectURL(e),filename:h,kind:d})}catch(e){f.update({filename:h,kind:d,converting:!1,convertingMessage:u(e,"Failed to load this file.")})}}var d=i(()=>import("../Calculator-4SQGOQFQ.js")),f=i(()=>import("../Spreadsheet-JX5E6WH6.js")),w=i(()=>import("../Weather-HLAGJ5LV.js")),j=i(()=>import("../CurrencyConverter-2KOM7L6V.js")),k=i(()=>import("../PomodoroTimer-SDUBKXUS.js")),g=i(()=>import("../Notepad-WA77V45J.js")),v=i(()=>import("../WorldClock-IRI4VCTA.js")),b=i(()=>import("../Stock-XAQ5WMUZ.js")),S=i(()=>import("../Preview-D4KOA4OI.js")),T=i(()=>import("../PdfViewer-RBRGEKWF.js")),x=i(()=>import("../Documents-IZTIQYPG.js")),y=i(()=>import("../Files-B63KKXGZ.js")),I=i(()=>import("../Browser-ZX5OTOKK.js")),P={"/calculator":{component:d,label:"Calculator",size:"sm",allowPinOnTop:!0,utility:!0,widget:!0,dimensions:[280,420]},"/spreadsheet":{component:f,label:"Spreadsheets",size:"2xl",appStyle:!0,multiInstance:!0},"/notepad":{component:g,label:"Notepad",size:"lg",allowPinOnTop:!0,flushBody:!0},"/weather":{component:w,label:"Weather",size:"sm",utility:!0,widget:!0,autoHeight:!0,dimensions:[320,400]},"/currency":{component:j,label:"Currency Converter",size:"sm",utility:!0,widget:!0,autoHeight:!0,dimensions:[320,480]},"/pomodoro":{component:k,label:"Pomodoro Timer",size:"sm",utility:!0,widget:!0,dimensions:[320,600]},"/world-clock":{component:v,label:"World Clock",size:"sm",utility:!0,widget:!0,autoHeight:!0,dimensions:[320,480]},"/stock":{component:b,label:"Stocks",size:"sm",utility:!0,widget:!0,autoHeight:!0,dimensions:[320,360]}},B={"/preview":{component:S,label:"Preview",size:"2xl",appStyle:!0,multiInstance:!0},"/documents":{component:x,label:"Documents",size:"xl",appStyle:!0,multiInstance:!0},"/files":{component:y,label:"Files",size:"xl",appStyle:!0}},L={"/browser":{component:I,label:"Browser",size:"2xl",appStyle:!0,multiInstance:!0}},O={...P,...B,...L};export{I as Browser,d as Calculator,j as CurrencyConverter,x as Documents,y as Files,g as Notepad,T as PdfViewer,k as PomodoroTimer,S as Preview,f as Spreadsheet,b as Stock,w as Weather,v as WorldClock,c as attachmentKind,O as bundledApps,B as documentApps,h as openAttachment,P as utilityApps,L as webApps};