efficient-shell 8.35.1 → 8.39.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 (193) hide show
  1. package/README.md +13 -2
  2. package/dist/{Browser-F67PEY2U.js → Browser-BIGK2F75.js} +14 -14
  3. package/dist/Calculator-7O7HXEKH.js +29 -0
  4. package/dist/{CurrencyConverter-Z6L7QAZU.js → CurrencyConverter-IVJJCYZ7.js} +12 -12
  5. package/dist/{Documents-MQDSI27F.js → Documents-UHTD6M24.js} +22 -22
  6. package/dist/Files-PWYUTAQW.js +87 -0
  7. package/dist/{Notepad-2IRVJ7MB.js → Notepad-54N54RYN.js} +11 -11
  8. package/dist/PdfViewer-KJCJ6EPG.js +1 -0
  9. package/dist/{PomodoroTimer-TRGMI4YT.js → PomodoroTimer-ZCJBTFV5.js} +19 -19
  10. package/dist/{Preview-PXOEKXSR.js → Preview-3LOY6L4G.js} +33 -33
  11. package/dist/Sidebar-6I4FC5AK.js +43 -0
  12. package/dist/{Spreadsheet-WROI4P6D.js → Spreadsheet-ANBJSAHB.js} +12 -12
  13. package/dist/{Stock-SUDCDSUL.js → Stock-PHY6Z26A.js} +1 -1
  14. package/dist/{Weather-WQE4ZQAL.js → Weather-YQA5CAFQ.js} +19 -19
  15. package/dist/{WorldClock-2AGEYLZP.js → WorldClock-J6L7FWI2.js} +6 -6
  16. package/dist/ai/index.d.ts +118 -3
  17. package/dist/ai/index.js +53 -43
  18. package/dist/ai.css +1 -1
  19. package/dist/apps/index.js +1 -1
  20. package/dist/bin/media-host-check.js +1 -1
  21. package/dist/bin/ui-check.js +1 -1
  22. package/dist/{chunk-ZRHQGFO5.js → chunk-3CST4ZDP.js} +2 -2
  23. package/dist/chunk-454DAGYG.js +19 -0
  24. package/dist/{chunk-TRD22FC7.js → chunk-45S6M77O.js} +6 -6
  25. package/dist/chunk-4IVT244O.js +8 -0
  26. package/dist/{chunk-G2MJTE6X.js → chunk-4OFD6ICH.js} +10 -10
  27. package/dist/{chunk-5N5DBTTF.js → chunk-4SZDP3JF.js} +12 -12
  28. package/dist/{chunk-FMKTVZAO.js → chunk-4Y4PWKMM.js} +1 -1
  29. package/dist/{chunk-DIN3EFOM.js → chunk-5BZMSSOV.js} +8 -8
  30. package/dist/chunk-5JYBYMZT.js +29 -0
  31. package/dist/{chunk-64ZHCEZN.js → chunk-5TFTSYOD.js} +1 -1
  32. package/dist/{chunk-GK3QH63P.js → chunk-63EK6S3W.js} +1 -1
  33. package/dist/{chunk-ECCUEG3J.js → chunk-6BCFVOG7.js} +1 -1
  34. package/dist/{chunk-M2KV4WKR.js → chunk-6GWZ5UPX.js} +1 -1
  35. package/dist/{chunk-EBC4XFL2.js → chunk-6SMQNPWS.js} +1 -1
  36. package/dist/{chunk-EW6FRPFJ.js → chunk-6WWAQC5V.js} +1 -1
  37. package/dist/{chunk-TTY62G5D.js → chunk-7C56GLLI.js} +16 -16
  38. package/dist/{chunk-MICWRC72.js → chunk-7MSFHQAY.js} +7 -7
  39. package/dist/{chunk-XZL3HCWH.js → chunk-7OCNF4AI.js} +1 -1
  40. package/dist/chunk-AAW27HJY.js +3 -0
  41. package/dist/{chunk-WME5DFB6.js → chunk-BIJ7ADTZ.js} +1 -1
  42. package/dist/{chunk-SEXLHFMR.js → chunk-BMPBVI7P.js} +1 -1
  43. package/dist/{chunk-TOVHLONK.js → chunk-BT3XDH3L.js} +4 -4
  44. package/dist/{chunk-JVIOAZHW.js → chunk-BUGAWNOC.js} +4 -4
  45. package/dist/{chunk-R4C3GGCS.js → chunk-BVW5U7QQ.js} +3 -3
  46. package/dist/{chunk-AF7R2MV4.js → chunk-CKZ6ZDU5.js} +1 -1
  47. package/dist/{chunk-IHEEJO5S.js → chunk-CPK7JTN3.js} +1 -1
  48. package/dist/{chunk-EVB35JP5.js → chunk-DOCUM3K7.js} +1 -1
  49. package/dist/{chunk-FKZEGBLK.js → chunk-DXTKNHWG.js} +11 -11
  50. package/dist/chunk-EEHK4IIK.js +14 -0
  51. package/dist/chunk-EGDJEY4K.js +27 -0
  52. package/dist/{chunk-G2V2ADJQ.js → chunk-EIWTOEWV.js} +2 -2
  53. package/dist/{chunk-2U2GJCSP.js → chunk-EL2RLUT6.js} +7 -7
  54. package/dist/{chunk-4GVH4ZUH.js → chunk-ET2EF5CI.js} +1 -1
  55. package/dist/{chunk-MC43PRTL.js → chunk-EXWGPXOS.js} +1 -1
  56. package/dist/{chunk-2SHYR3RA.js → chunk-FSPFV4MI.js} +9 -4
  57. package/dist/{chunk-YBB56N6X.js → chunk-G63BCOQ6.js} +1 -1
  58. package/dist/{chunk-3RPIPYLU.js → chunk-GCGKPDPN.js} +1 -1
  59. package/dist/chunk-GNPTNAZH.js +4 -0
  60. package/dist/{chunk-DG2WU3BU.js → chunk-GSBIJLTD.js} +2 -2
  61. package/dist/{chunk-ZXSMSVLU.js → chunk-I7HDD4IM.js} +1 -1
  62. package/dist/{chunk-JE6TBZGY.js → chunk-J47HXHSL.js} +7 -7
  63. package/dist/{chunk-RB2F65YJ.js → chunk-JPRJQ6B7.js} +11 -11
  64. package/dist/{chunk-PAB2ZU4F.js → chunk-KJY57QPT.js} +49 -49
  65. package/dist/{chunk-M2LLVSBR.js → chunk-KWX6NAOR.js} +1 -1
  66. package/dist/{chunk-OFKWTOXK.js → chunk-L7FDYGGF.js} +3 -3
  67. package/dist/{chunk-6ANFVX4M.js → chunk-L7IKTEOC.js} +11 -11
  68. package/dist/{chunk-EZY4CO4A.js → chunk-LGAN7DNC.js} +5 -5
  69. package/dist/{chunk-PCKYNZ5Y.js → chunk-LGLZTJ2W.js} +6 -6
  70. package/dist/{chunk-7ACSSYEZ.js → chunk-MEJK6PBN.js} +1 -1
  71. package/dist/{chunk-IUCIYWTT.js → chunk-NDO24PK6.js} +8 -8
  72. package/dist/{chunk-XDDTFV32.js → chunk-NESJOC3R.js} +1 -1
  73. package/dist/{chunk-BYCOB6WT.js → chunk-NGBT7AHL.js} +6 -6
  74. package/dist/chunk-PCQPV6MS.js +6 -0
  75. package/dist/{chunk-CCPNMYCK.js → chunk-Q23EHOXW.js} +1 -1
  76. package/dist/{chunk-ACW3J77L.js → chunk-Q7HN6T3H.js} +1 -1
  77. package/dist/{chunk-XNJMLHGK.js → chunk-QDLGU62M.js} +1 -1
  78. package/dist/{chunk-NUSSZJF2.js → chunk-REVC6YPT.js} +5 -5
  79. package/dist/{chunk-EM6BEHAD.js → chunk-RWGSMZGS.js} +1 -1
  80. package/dist/{chunk-4MO375G3.js → chunk-S2OIRC5H.js} +3 -3
  81. package/dist/{chunk-FTKKGGOQ.js → chunk-SR4XAYLC.js} +1 -1
  82. package/dist/{chunk-RPJ2GC3K.js → chunk-SRKSGUGT.js} +20 -20
  83. package/dist/{chunk-2F7ZOMKK.js → chunk-SZIENHKR.js} +1 -1
  84. package/dist/{chunk-UZ3CZQA4.js → chunk-TGLHJS3M.js} +1 -1
  85. package/dist/{chunk-O2YAB6WK.js → chunk-TIQKDAON.js} +6 -6
  86. package/dist/{chunk-TANR67XF.js → chunk-TVJRENCQ.js} +9 -9
  87. package/dist/{chunk-RJZYORCR.js → chunk-U4BMS5EV.js} +1 -1
  88. package/dist/chunk-UJOWORTR.js +1 -0
  89. package/dist/{chunk-MY755PTJ.js → chunk-UZMZ2EDW.js} +1 -1
  90. package/dist/{chunk-S4J4B7LY.js → chunk-WCKZHEFC.js} +5 -5
  91. package/dist/{chunk-AZU7YOES.js → chunk-WRORJNS5.js} +8 -8
  92. package/dist/{chunk-XB2YPUKR.js → chunk-XLD53X4P.js} +8 -8
  93. package/dist/{chunk-4HCRZHIX.js → chunk-XSPDPN5O.js} +1 -1
  94. package/dist/{chunk-TZHWF3P5.js → chunk-Y6IQYQYN.js} +2 -2
  95. package/dist/chunk-YALPQIBR.js +7 -0
  96. package/dist/{chunk-HAIMJAI4.js → chunk-ZCHBOAPA.js} +2 -2
  97. package/dist/{chunk-M2AIC7IK.js → chunk-ZEKM6HAA.js} +2 -2
  98. package/dist/{chunk-5YELPBUT.js → chunk-ZK2SULCA.js} +1 -1
  99. package/dist/{chunk-BHMUOWAE.js → chunk-ZSFUNXRD.js} +4 -4
  100. package/dist/{chunk-JDKRQG7X.js → chunk-ZWAVSUWT.js} +2 -2
  101. package/dist/data/ListLoadError.js +1 -1
  102. package/dist/format/index.js +1 -1
  103. package/dist/forms/BorderInput.js +1 -1
  104. package/dist/forms/BrandAssetEditor.js +1 -1
  105. package/dist/forms/Calendar.js +1 -1
  106. package/dist/forms/ColorPicker.js +1 -1
  107. package/dist/forms/ComposerAttachments.js +1 -1
  108. package/dist/forms/CornersInput.js +1 -1
  109. package/dist/forms/DatePicker.js +1 -1
  110. package/dist/forms/DateRangePicker.js +1 -1
  111. package/dist/forms/DisplayChips.js +1 -1
  112. package/dist/forms/FilePicker.js +1 -1
  113. package/dist/forms/IconPicker.js +1 -1
  114. package/dist/forms/InputNumber.js +1 -1
  115. package/dist/forms/LinkPicker.js +1 -1
  116. package/dist/forms/MediaLibrary.d.ts +31 -1
  117. package/dist/forms/MediaLibrary.js +1 -1
  118. package/dist/forms/MediaUploadField.js +1 -1
  119. package/dist/forms/MediaUploadGrid.d.ts +7 -1
  120. package/dist/forms/MediaUploadGrid.js +1 -1
  121. package/dist/forms/MediaUsedInList.js +1 -1
  122. package/dist/forms/PositionInput.js +1 -1
  123. package/dist/forms/Select.js +1 -1
  124. package/dist/forms/SidesInput.js +1 -1
  125. package/dist/forms/Slider.js +1 -1
  126. package/dist/forms/Snippet.js +1 -1
  127. package/dist/forms/SplitButton.js +1 -1
  128. package/dist/forms/TagInput.js +1 -1
  129. package/dist/forms/TextToolbar.js +1 -1
  130. package/dist/forms/WidthsBar.js +1 -1
  131. package/dist/forms/mediaLibraryMenu.js +1 -1
  132. package/dist/forms/textAlign.js +1 -1
  133. package/dist/icons/index.js +1 -1
  134. package/dist/index.d.ts +1 -1
  135. package/dist/index.js +162 -162
  136. package/dist/map/index.js +3 -3
  137. package/dist/markdown/index.js +1 -1
  138. package/dist/page-tabs/index.js +5 -5
  139. package/dist/pdf/index.js +1 -1
  140. package/dist/shell/Accordion.js +1 -1
  141. package/dist/shell/AppUpdateBanner.js +1 -1
  142. package/dist/shell/Banner.js +1 -1
  143. package/dist/shell/Breadcrumbs.js +1 -1
  144. package/dist/shell/ColoredBadge.js +1 -1
  145. package/dist/shell/ConfirmDialog.js +1 -1
  146. package/dist/shell/ContextMenu.js +1 -1
  147. package/dist/shell/Dialog.d.ts +13 -3
  148. package/dist/shell/Dialog.js +1 -1
  149. package/dist/shell/Drawer.js +1 -1
  150. package/dist/shell/DropdownMenu.js +1 -1
  151. package/dist/shell/EmptyState.js +1 -1
  152. package/dist/shell/HelpCenter.js +1 -1
  153. package/dist/shell/ImageLightbox.js +1 -1
  154. package/dist/shell/LanguageSelect.js +1 -1
  155. package/dist/shell/Markdown.js +1 -1
  156. package/dist/shell/PageHeader.js +1 -1
  157. package/dist/shell/PopupMenu.js +1 -1
  158. package/dist/shell/ProductionTimeline.js +1 -1
  159. package/dist/shell/Result.js +1 -1
  160. package/dist/shell/SearchableSelect.js +1 -1
  161. package/dist/shell/SettingReset.js +1 -1
  162. package/dist/shell/SettingRow.js +1 -1
  163. package/dist/shell/SidebarLayout.js +1 -1
  164. package/dist/shell/SidebarNav.js +1 -1
  165. package/dist/shell/SortableList.js +1 -1
  166. package/dist/shell/StepChain.js +1 -1
  167. package/dist/shell/Stepper.js +1 -1
  168. package/dist/shell/TopNav.js +1 -1
  169. package/dist/shell/Tree.js +1 -1
  170. package/dist/telemetry/index.js +1 -1
  171. package/dist/templates/ChatTemplate.js +1 -1
  172. package/dist/templates/CheckoutTemplate.js +1 -1
  173. package/dist/templates/DataTablePage.js +1 -1
  174. package/dist/templates/EmailTemplate.js +1 -1
  175. package/dist/templates/FormLayoutPage.js +1 -1
  176. package/dist/ui/index.d.ts +1 -1
  177. package/dist/ui/index.js +1 -1
  178. package/dist/version.js +1 -1
  179. package/package.json +1 -1
  180. package/dist/Calculator-6ZU5MKTQ.js +0 -29
  181. package/dist/Files-DEC4KVQM.js +0 -87
  182. package/dist/PdfViewer-KSLOYXMD.js +0 -1
  183. package/dist/Sidebar-QQFJJWE2.js +0 -43
  184. package/dist/chunk-2EOQDYGM.js +0 -29
  185. package/dist/chunk-2PWZNFFP.js +0 -19
  186. package/dist/chunk-5FCEBKT2.js +0 -7
  187. package/dist/chunk-F2AEP37B.js +0 -4
  188. package/dist/chunk-HMHL27AU.js +0 -6
  189. package/dist/chunk-JBQWR4SX.js +0 -8
  190. package/dist/chunk-MOD4PGVF.js +0 -27
  191. package/dist/chunk-NKZNPYDB.js +0 -3
  192. package/dist/chunk-WAZTGEMG.js +0 -1
  193. package/dist/chunk-WKRFD4E4.js +0 -14
@@ -1,19 +1,19 @@
1
- import{EditableGrid as e}from"./chunk-2RBWQVDC.js";import"./chunk-G6DKCCWH.js";import{AboutApp as t}from"./chunk-G2V2ADJQ.js";import{peekSpreadsheetPreviewStage as r,claimSpreadsheetPreviewStage as n,SPREADSHEET_PREVIEW_UPDATE_EVENT as o}from"./chunk-VTVSMRFX.js";import{WindowTitle as a}from"./chunk-PAB2ZU4F.js";import"./chunk-CY5N5OA3.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-SEXLHFMR.js";import"./chunk-5A7MWTXX.js";import"./chunk-Y53KNQKL.js";import"./chunk-EW6FRPFJ.js";import"./chunk-MOD4PGVF.js";import"./chunk-F2AEP37B.js";import"./chunk-4AJRHTTB.js";import"./chunk-VWGWZY7A.js";import"./chunk-PKXQDCNR.js";import"./chunk-4GVH4ZUH.js";import"./chunk-UGTRSRIW.js";import"./chunk-CDAJKLGL.js";import"./chunk-D323R2FT.js";import"./chunk-KC3EX26K.js";import"./chunk-WAZTGEMG.js";import"./chunk-FKZEGBLK.js";import"./chunk-5QFPTDQF.js";import"./chunk-QR4RM7PO.js";import"./chunk-4IU5BSVE.js";import"./chunk-K7U4RWXJ.js";import"./chunk-2SHYR3RA.js";import"./chunk-J75ZT2JQ.js";import"./chunk-VH6GB73Q.js";import"./chunk-Q5MD3VY6.js";import"./chunk-MRJKZWWV.js";import"./chunk-6KO5VTL7.js";import"./chunk-22S6LG6D.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-DTJRIWFR.js";import"./chunk-TWVUQUUD.js";import"./chunk-E6UCGCOC.js";import"./chunk-C3QOHMR6.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 k(e,t){const r=e.rows?e.rows.map(e=>e.map(e=>String(e??""))):v(e.csv??"");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 w(){const m=l(null),g=l(void 0);void 0===g.current&&(g.current=r());const w=l(g.current?.data??null),j=(()=>{const e=g.current;if(!e)return null;const t=k(e.data,"Sheet 1");if(!t)return null;return{sheet:t,title:e.data.filename.replace(/\.(csv|tsv|txt)$/i,"")}})(),[C,N]=s(j?[j.sheet]:[f("Sheet 1")]),[S,U]=s(0),M=l([]),R=l(C),D=l(!1);c(()=>{D.current?D.current=!1:R.current!==C&&(M.current.push(R.current),M.current.length>50&&M.current.shift()),R.current=C},[C]);const E=i(()=>{const e=M.current.pop();e&&(D.current=!0,N(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[A,L]=s(j?.title??"Untitled"),[$,F]=s(()=>g.current?.data.onEmail),K=i(e=>{const t=k(e,"Sheet 1");t&&(N([t]),U(0),L(e.filename.replace(/\.(csv|tsv|txt)$/i,"")),F(()=>e.onEmail))},[]);c(()=>{const e=g.current;null!=e&&(n(e),e.data!==w.current&&K(e.data))},[]),c(()=>{const e=g.current?.token;if(null==e)return;const t=t=>{const r=t.detail;r&&r.token===e&&K(r.data)};return window.addEventListener(o,t),()=>window.removeEventListener(o,t)},[]);const[G,B]=s(!1),[V,W]=s(null),[T,J]=s(""),Q=l(null),[H,O]=s("1"),[I,P]=s("10"),X=C[S]||C[0],Z=X.data,Y=X.columns,z=X.cellStyles??{},[_,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 _?[_]:[]},[ee,_]),ne=i((e,t)=>{const r=re();0!==r.length&&N(n=>n.map((n,o)=>{if(o!==S)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,S]),oe=ee?{row:ee.anchor.row,col:ee.anchor.col}:_,ae=oe?z[`${oe.row}:${oe.col}`]??{}:{},le=!!oe,se=i(e=>{N(t=>t.map((t,r)=>r===S?{...t,...e}:t))},[S]),ce=i(e=>{const t=e.reduce((e,t)=>Math.max(e,t.length),0);t!==Y.length?se({data:e,columns:y(t)}):se({data:e})},[se,Y.length]),ie=(e,t)=>{N(r=>r.map((r,n)=>n===e?{...r,name:t}:r)),W(null)},ue=()=>Z.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=[];Z.forEach(e=>e.forEach(e=>{const t=parseFloat(e);!isNaN(t)&&e.trim()&&de.push(t)}));const he=Z.reduce((e,t)=>e+t.filter(e=>e.trim()).length,0);/* @__PURE__ */
1
+ import{EditableGrid as e}from"./chunk-2RBWQVDC.js";import"./chunk-G6DKCCWH.js";import{AboutApp as t}from"./chunk-EIWTOEWV.js";import{peekSpreadsheetPreviewStage as r,claimSpreadsheetPreviewStage as n,SPREADSHEET_PREVIEW_UPDATE_EVENT as o}from"./chunk-VTVSMRFX.js";import{WindowTitle as a}from"./chunk-KJY57QPT.js";import"./chunk-CY5N5OA3.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-BMPBVI7P.js";import"./chunk-5A7MWTXX.js";import"./chunk-Y53KNQKL.js";import"./chunk-6WWAQC5V.js";import"./chunk-EGDJEY4K.js";import"./chunk-GNPTNAZH.js";import"./chunk-KC3EX26K.js";import"./chunk-4AJRHTTB.js";import"./chunk-VWGWZY7A.js";import"./chunk-PKXQDCNR.js";import"./chunk-UGTRSRIW.js";import"./chunk-ET2EF5CI.js";import"./chunk-CDAJKLGL.js";import"./chunk-UJOWORTR.js";import"./chunk-DXTKNHWG.js";import"./chunk-QR4RM7PO.js";import"./chunk-5QFPTDQF.js";import"./chunk-D323R2FT.js";import"./chunk-4IU5BSVE.js";import"./chunk-K7U4RWXJ.js";import"./chunk-VH6GB73Q.js";import"./chunk-FSPFV4MI.js";import"./chunk-J75ZT2JQ.js";import"./chunk-Q5MD3VY6.js";import"./chunk-MRJKZWWV.js";import"./chunk-6KO5VTL7.js";import"./chunk-22S6LG6D.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-DTJRIWFR.js";import"./chunk-TWVUQUUD.js";import"./chunk-E6UCGCOC.js";import"./chunk-C3QOHMR6.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 k(e,t){const r=e.rows?e.rows.map(e=>e.map(e=>String(e??""))):v(e.csv??"");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 w(){const m=l(null),g=l(void 0);void 0===g.current&&(g.current=r());const w=l(g.current?.data??null),j=(()=>{const e=g.current;if(!e)return null;const t=k(e.data,"Sheet 1");if(!t)return null;return{sheet:t,title:e.data.filename.replace(/\.(csv|tsv|txt)$/i,"")}})(),[C,N]=s(j?[j.sheet]:[f("Sheet 1")]),[S,U]=s(0),E=l([]),D=l(C),M=l(!1);c(()=>{M.current?M.current=!1:D.current!==C&&(E.current.push(D.current),E.current.length>50&&E.current.shift()),D.current=C},[C]);const R=i(()=>{const e=E.current.pop();e&&(M.current=!0,N(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(),R())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[R]);const[A,K]=s(j?.title??"Untitled"),[T,W]=s(()=>g.current?.data.onEmail),$=i(e=>{const t=k(e,"Sheet 1");t&&(N([t]),U(0),K(e.filename.replace(/\.(csv|tsv|txt)$/i,"")),W(()=>e.onEmail))},[]);c(()=>{const e=g.current;null!=e&&(n(e),e.data!==w.current&&$(e.data))},[]),c(()=>{const e=g.current?.token;if(null==e)return;const t=t=>{const r=t.detail;r&&r.token===e&&$(r.data)};return window.addEventListener(o,t),()=>window.removeEventListener(o,t)},[]);const[L,V]=s(!1),[B,F]=s(null),[G,J]=s(""),I=l(null),[Q,O]=s("1"),[P,H]=s("10"),X=C[S]||C[0],Y=X.data,Z=X.columns,z=X.cellStyles??{},[_,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 _?[_]:[]},[ee,_]),ne=i((e,t)=>{const r=re();0!==r.length&&N(n=>n.map((n,o)=>{if(o!==S)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,S]),oe=ee?{row:ee.anchor.row,col:ee.anchor.col}:_,ae=oe?z[`${oe.row}:${oe.col}`]??{}:{},le=!!oe,se=i(e=>{N(t=>t.map((t,r)=>r===S?{...t,...e}:t))},[S]),ce=i(e=>{const t=e.reduce((e,t)=>Math.max(e,t.length),0);t!==Z.length?se({data:e,columns:y(t)}):se({data:e})},[se,Z.length]),ie=(e,t)=>{N(r=>r.map((r,n)=>n===e?{...r,name:t}:r)),F(null)},ue=()=>Y.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=[];Y.forEach(e=>e.forEach(e=>{const t=parseFloat(e);!isNaN(t)&&e.trim()&&de.push(t)}));const he=Y.reduce((e,t)=>e+t.filter(e=>e.trim()).length,0);/* @__PURE__ */
2
2
  return u("div",{ref:m,className:"flex flex-col h-full",children:[
3
3
  /* @__PURE__ */d(a,{title:`${me=A||"Untitled",me.length>24?`${me.slice(0,23)}…`:me} - Spreadsheets`}),
4
4
  /* @__PURE__ */d(t,{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:[G?/* @__PURE__ */d("input",{type:"text",value:A,onChange:e=>L(e.target.value),onBlur:()=>B(!1),onKeyDown:e=>{"Enter"===e.key&&B(!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:()=>B(!0),className:"text-sm font-medium text-gray-900 hover:text-blue-600 truncate max-w-[200px]",title:"Click to rename",children:A||"Untitled"}),
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:[L?/* @__PURE__ */d("input",{type:"text",value:A,onChange:e=>K(e.target.value),onBlur:()=>V(!1),onKeyDown:e=>{"Enter"===e.key&&V(!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:()=>V(!0),className:"text-sm font-medium text-gray-900 hover:text-blue-600 truncate max-w-[200px]",title:"Click to rename",children:A||"Untitled"}),
6
6
  /* @__PURE__ */d("div",{className:"h-4 w-px bg-gray-300"}),
7
- /* @__PURE__ */d("input",{ref:Q,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}});N(a),U(0),L(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}),L(r)}Q.current&&(Q.current.value="")},className:"hidden"}),
8
- /* @__PURE__ */d("button",{onClick:()=>Q.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=`${A||"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"}),$&&/* @__PURE__ */d("button",{onClick:()=>$(ue(),`${A||"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"}),
7
+ /* @__PURE__ */d("input",{ref:I,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}});N(a),U(0),K(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}),K(r)}I.current&&(I.current.value="")},className:"hidden"}),
8
+ /* @__PURE__ */d("button",{onClick:()=>I.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=`${A||"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"}),T&&/* @__PURE__ */d("button",{onClick:()=>T(ue(),`${A||"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
10
  /* @__PURE__ */d("div",{className:"h-4 w-px bg-gray-300"}),
11
11
  /* @__PURE__ */u("div",{className:"flex items-center gap-1",children:[
12
- /* @__PURE__ */d("input",{type:"number",min:"1",max:"50",value:H,onChange:e=>O(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=Y.length+e;se({columns:y(t),data:Z.map(t=>[...t,...Array(e).fill("")])})})(parseInt(H)||1),className:"text-xs text-gray-600 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"+ Col"})]}),
12
+ /* @__PURE__ */d("input",{type:"number",min:"1",max:"50",value:Q,onChange:e=>O(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=Z.length+e;se({columns:y(t),data:Y.map(t=>[...t,...Array(e).fill("")])})})(parseInt(Q)||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
14
  /* @__PURE__ */u("div",{className:"flex items-center gap-1",children:[
15
- /* @__PURE__ */d("input",{type:"number",min:"1",max:"500",value:I,onChange:e=>P(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(I)||10,void se({data:[...Z,...Array.from({length:e},()=>Array(Y.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"})]}),
15
+ /* @__PURE__ */d("input",{type:"number",min:"1",max:"500",value:P,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"}),
16
+ /* @__PURE__ */d("button",{onClick:()=>{return e=parseInt(P)||10,void se({data:[...Y,...Array.from({length:e},()=>Array(Z.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
17
  /* @__PURE__ */d("div",{className:"h-4 w-px bg-gray-300"}),
18
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
19
  /* @__PURE__ */d("div",{className:"h-4 w-px bg-gray-300"}),
@@ -26,12 +26,12 @@ return u("div",{ref:m,className:"flex flex-col h-full",children:[
26
26
  /* @__PURE__ */d("option",{value:"base",children:"S"}),
27
27
  /* @__PURE__ */d("option",{value:"lg",children:"M"}),
28
28
  /* @__PURE__ */d("option",{value:"xl",children:"L"})]})]})]}),
29
- /* @__PURE__ */d("div",{className:"flex-1 min-h-0",children:/* @__PURE__ */d(e,{columns:Y,data:Z,onChange:ce,onColumnsChange:e=>se({columns:e}),cellStyles:z,onFocusChange:q,onSelectionChange:te,minRows:x,maxHeight:"100%"})}),
29
+ /* @__PURE__ */d("div",{className:"flex-1 min-h-0",children:/* @__PURE__ */d(e,{columns:Z,data:Y,onChange:ce,onColumnsChange:e=>se({columns:e}),cellStyles:z,onFocusChange:q,onSelectionChange:te,minRows:x,maxHeight:"100%"})}),
30
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:()=>{W(t),J(e.name)},onContextMenu:e=>{e.preventDefault(),C.length>1&&(e=>{C.length<=1||(N(t=>t.filter((t,r)=>r!==e)),S>=e&&S>0&&U(S-1))})(t)},className:"px-3 py-1 text-xs font-medium rounded-b whitespace-nowrap transition-colors "+(t===S?"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:V===t?/* @__PURE__ */d("input",{type:"text",value:T,onChange:e=>J(e.target.value),onBlur:()=>ie(t,T||e.name),onKeyDown:r=>{"Enter"===r.key&&ie(t,T||e.name),"Escape"===r.key&&W(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)),
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:()=>{F(t),J(e.name)},onContextMenu:e=>{e.preventDefault(),C.length>1&&(e=>{C.length<=1||(N(t=>t.filter((t,r)=>r!==e)),S>=e&&S>0&&U(S-1))})(t)},className:"px-3 py-1 text-xs font-medium rounded-b whitespace-nowrap transition-colors "+(t===S?"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:B===t?/* @__PURE__ */d("input",{type:"text",value:G,onChange:e=>J(e.target.value),onBlur:()=>ie(t,G||e.name),onKeyDown:r=>{"Enter"===r.key&&ie(t,G||e.name),"Escape"===r.key&&F(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
32
  /* @__PURE__ */d("button",{onClick:()=>{const e=`Sheet ${C.length+1}`;N(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
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
34
  /* @__PURE__ */u("span",{children:[he," cells"]}),de.length>0&&/* @__PURE__ */u(h,{children:[
35
35
  /* @__PURE__ */u("span",{children:["Sum: ",de.reduce((e,t)=>e+t,0).toLocaleString(void 0,{maximumFractionDigits:2})]}),
36
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:[Z.length," × ",Y.length]})]})]})]});var me}export{w as default};
37
+ /* @__PURE__ */u("span",{children:[Y.length," × ",Z.length]})]})]})]});var me}export{w as default};
@@ -1,4 +1,4 @@
1
- import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-RJZYORCR.js";import{useWidgetSettings as r}from"./chunk-PAB2ZU4F.js";import"./chunk-CY5N5OA3.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-SEXLHFMR.js";import"./chunk-5A7MWTXX.js";import"./chunk-Y53KNQKL.js";import"./chunk-EW6FRPFJ.js";import"./chunk-MOD4PGVF.js";import"./chunk-F2AEP37B.js";import"./chunk-4AJRHTTB.js";import"./chunk-VWGWZY7A.js";import"./chunk-PKXQDCNR.js";import"./chunk-4GVH4ZUH.js";import"./chunk-UGTRSRIW.js";import"./chunk-CDAJKLGL.js";import"./chunk-D323R2FT.js";import"./chunk-KC3EX26K.js";import"./chunk-FKZEGBLK.js";import"./chunk-5QFPTDQF.js";import"./chunk-QR4RM7PO.js";import"./chunk-4IU5BSVE.js";import"./chunk-K7U4RWXJ.js";import"./chunk-2SHYR3RA.js";import"./chunk-J75ZT2JQ.js";import"./chunk-VH6GB73Q.js";import"./chunk-Q5MD3VY6.js";import"./chunk-MRJKZWWV.js";import"./chunk-6KO5VTL7.js";import"./chunk-22S6LG6D.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-DTJRIWFR.js";import"./chunk-TWVUQUUD.js";import"./chunk-E6UCGCOC.js";import"./chunk-C3QOHMR6.js";import{useState as n,useCallback as c}from"react";import{jsxs as s,Fragment as a,jsx as i}from"react/jsx-runtime";var o=["AAPL","MSFT","GOOGL","TSLA","NVDA"],m="stock_symbols",l="stock_appearance",h={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}},p=Object.keys(h);function u(){try{const e=JSON.parse(localStorage.getItem(m)||"");if(Array.isArray(e)&&e.length)return e.slice(0,8)}catch{}return o}var d=e=>`${e>=0?"+":""}${e.toFixed(2)}`;function g(){const[o,g]=n(u),[x,k]=n(()=>e(l)),[y,j]=n(!1),[b,N]=n([]),[f,v]=n(x),[A,S]=n(""),R=c(()=>{N([...o]),v({...x}),S(""),j(!0)},[o,x]);r(R);const C=()=>{const e=A.trim().toUpperCase();!e||b.includes(e)||b.length>=8||(N(t=>[...t,e]),S(""))},D=p.filter(e=>!b.includes(e));/* @__PURE__ */
1
+ import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-U4BMS5EV.js";import{useWidgetSettings as r}from"./chunk-KJY57QPT.js";import"./chunk-CY5N5OA3.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-BMPBVI7P.js";import"./chunk-5A7MWTXX.js";import"./chunk-Y53KNQKL.js";import"./chunk-6WWAQC5V.js";import"./chunk-EGDJEY4K.js";import"./chunk-GNPTNAZH.js";import"./chunk-KC3EX26K.js";import"./chunk-4AJRHTTB.js";import"./chunk-VWGWZY7A.js";import"./chunk-PKXQDCNR.js";import"./chunk-UGTRSRIW.js";import"./chunk-ET2EF5CI.js";import"./chunk-CDAJKLGL.js";import"./chunk-DXTKNHWG.js";import"./chunk-QR4RM7PO.js";import"./chunk-5QFPTDQF.js";import"./chunk-D323R2FT.js";import"./chunk-4IU5BSVE.js";import"./chunk-K7U4RWXJ.js";import"./chunk-VH6GB73Q.js";import"./chunk-FSPFV4MI.js";import"./chunk-J75ZT2JQ.js";import"./chunk-Q5MD3VY6.js";import"./chunk-MRJKZWWV.js";import"./chunk-6KO5VTL7.js";import"./chunk-22S6LG6D.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-DTJRIWFR.js";import"./chunk-TWVUQUUD.js";import"./chunk-E6UCGCOC.js";import"./chunk-C3QOHMR6.js";import{useState as n,useCallback as c}from"react";import{jsxs as s,Fragment as a,jsx as i}from"react/jsx-runtime";var o=["AAPL","MSFT","GOOGL","TSLA","NVDA"],m="stock_symbols",l="stock_appearance",h={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}},p=Object.keys(h);function u(){try{const e=JSON.parse(localStorage.getItem(m)||"");if(Array.isArray(e)&&e.length)return e.slice(0,8)}catch{}return o}var d=e=>`${e>=0?"+":""}${e.toFixed(2)}`;function g(){const[o,g]=n(u),[x,k]=n(()=>e(l)),[y,j]=n(!1),[b,N]=n([]),[f,v]=n(x),[A,S]=n(""),T=c(()=>{N([...o]),v({...x}),S(""),j(!0)},[o,x]);r(T);const C=()=>{const e=A.trim().toUpperCase();!e||b.includes(e)||b.length>=8||(N(t=>[...t,e]),S(""))},D=p.filter(e=>!b.includes(e));/* @__PURE__ */
2
2
  return s(a,{children:[
3
3
  /* @__PURE__ */i("div",{style:{backgroundColor:`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${x.activeOpacity/100})`,backdropFilter:x.activeBlur>0?`blur(${x.activeBlur}px)`:void 0},children:/* @__PURE__ */i("div",{className:"px-4 py-3",children:0===o.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:o.map(e=>{const t=h[e],r=(t?.change??0)>=0,n=t?t.change>0?"text-green-600":t.change<0?"text-red-600":"text-gray-500":"text-gray-400";/* @__PURE__ */
4
4
  return s("div",{className:"flex items-center justify-between px-2 py-2 border-b border-gray-200 last:border-0",children:[
@@ -1,4 +1,4 @@
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-RJZYORCR.js";import{useWidgetSettings as s}from"./chunk-PAB2ZU4F.js";import"./chunk-CY5N5OA3.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-SEXLHFMR.js";import"./chunk-5A7MWTXX.js";import"./chunk-Y53KNQKL.js";import"./chunk-EW6FRPFJ.js";import"./chunk-MOD4PGVF.js";import"./chunk-F2AEP37B.js";import"./chunk-4AJRHTTB.js";import"./chunk-VWGWZY7A.js";import"./chunk-PKXQDCNR.js";import"./chunk-4GVH4ZUH.js";import"./chunk-UGTRSRIW.js";import"./chunk-CDAJKLGL.js";import"./chunk-D323R2FT.js";import{useShellPrefs as o}from"./chunk-KC3EX26K.js";import"./chunk-FKZEGBLK.js";import"./chunk-5QFPTDQF.js";import"./chunk-QR4RM7PO.js";import"./chunk-4IU5BSVE.js";import"./chunk-K7U4RWXJ.js";import"./chunk-2SHYR3RA.js";import"./chunk-J75ZT2JQ.js";import"./chunk-VH6GB73Q.js";import{LoadingSpinner as l}from"./chunk-Q5MD3VY6.js";import"./chunk-MRJKZWWV.js";import"./chunk-6KO5VTL7.js";import"./chunk-22S6LG6D.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-DTJRIWFR.js";import"./chunk-TWVUQUUD.js";import"./chunk-E6UCGCOC.js";import"./chunk-C3QOHMR6.js";import{useState as c,useEffect as d,useCallback as m}from"react";import{jsx as h,jsxs as p,Fragment as u}from"react/jsx-runtime";var f="weather_city",y="weather_appearance",g={useFahrenheit:!1,showLocalTime:!0,use24Hour:!1};function x(){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 b=r;function w(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 v(){/* @__PURE__ */
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-U4BMS5EV.js";import{useWidgetSettings as s}from"./chunk-KJY57QPT.js";import"./chunk-CY5N5OA3.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-BMPBVI7P.js";import"./chunk-5A7MWTXX.js";import"./chunk-Y53KNQKL.js";import"./chunk-6WWAQC5V.js";import"./chunk-EGDJEY4K.js";import"./chunk-GNPTNAZH.js";import{useShellPrefs as o}from"./chunk-KC3EX26K.js";import"./chunk-4AJRHTTB.js";import"./chunk-VWGWZY7A.js";import"./chunk-PKXQDCNR.js";import"./chunk-UGTRSRIW.js";import"./chunk-ET2EF5CI.js";import"./chunk-CDAJKLGL.js";import"./chunk-DXTKNHWG.js";import"./chunk-QR4RM7PO.js";import"./chunk-5QFPTDQF.js";import"./chunk-D323R2FT.js";import"./chunk-4IU5BSVE.js";import"./chunk-K7U4RWXJ.js";import"./chunk-VH6GB73Q.js";import"./chunk-FSPFV4MI.js";import"./chunk-J75ZT2JQ.js";import{LoadingSpinner as l}from"./chunk-Q5MD3VY6.js";import"./chunk-MRJKZWWV.js";import"./chunk-6KO5VTL7.js";import"./chunk-22S6LG6D.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-DTJRIWFR.js";import"./chunk-TWVUQUUD.js";import"./chunk-E6UCGCOC.js";import"./chunk-C3QOHMR6.js";import{useState as c,useEffect as d,useCallback as m}from"react";import{jsx as h,jsxs as p,Fragment as u}from"react/jsx-runtime";var f="weather_city",y="weather_appearance",g={useFahrenheit:!1,showLocalTime:!0,use24Hour:!1};function x(){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 b=r;function w(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 v(){/* @__PURE__ */
2
2
  return p("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[
3
3
  /* @__PURE__ */h("div",{className:"absolute -top-5 -right-5 w-24 h-24",style:{animation:"wx-sun-rays 70s linear infinite"},children:/* @__PURE__ */h("svg",{viewBox:"0 0 100 100",className:"w-full h-full",children:Array.from({length:12}).map((e,t)=>/* @__PURE__ */h("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
4
  /* @__PURE__ */h("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 k(){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__ */
@@ -19,42 +19,42 @@ return p("div",{className:"absolute inset-0 overflow-hidden pointer-events-none"
19
19
  /* @__PURE__ */h("div",{className:"absolute",style:{top:"40%",animation:"wx-drift-cloud 60s linear -22s infinite",opacity:.85},children:/* @__PURE__ */h(a,{scale:1.25})}),
20
20
  /* @__PURE__ */h("div",{className:"absolute",style:{top:"68%",animation:"wx-drift-cloud 78s linear -45s infinite",opacity:.7},children:/* @__PURE__ */h(a,{scale:.75})})]})}function j({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
21
  return h("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:r.map((e,t)=>/* @__PURE__ */h("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 h("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:t.map((e,t)=>/* @__PURE__ */h("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 F(){/* @__PURE__ */
22
+ return h("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:t.map((e,t)=>/* @__PURE__ */h("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 T(){/* @__PURE__ */
23
23
  return p("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[
24
24
  /* @__PURE__ */h(j,{heavy:!0}),
25
25
  /* @__PURE__ */h("div",{className:"absolute inset-0 bg-white",style:{animation:"wx-flash 6s ease-out infinite"}}),
26
- /* @__PURE__ */h("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__ */h("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__ */h("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 T(){/* @__PURE__ */
27
- return h("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:Array.from({length:4}).map((e,t)=>/* @__PURE__ */h("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 C({code:e,isDay:t}){return 0===e||1===e?/* @__PURE__ */h(t?v:k,{}):2===e?/* @__PURE__ */p(u,{children:[/* @__PURE__ */h(t?v:k,{}),
28
- /* @__PURE__ */h(N,{tone:t?"light":"dark"})]}):3===e?/* @__PURE__ */h(N,{tone:t?"light":"dark"}):45===e||48===e?/* @__PURE__ */h(T,{}):[51,53,61,80,81].includes(e)?/* @__PURE__ */h(j,{}):[55,63,65,82].includes(e)?/* @__PURE__ */h(j,{heavy:!0}):[71,73,75].includes(e)?/* @__PURE__ */h(S,{}):[95,96,99].includes(e)?/* @__PURE__ */h(F,{}):null}function D(){const[r,v]=c(x),[k,N]=c(()=>n(y)),[j,S]=c(null),[F,T]=c(!0),[,D]=c(0);d(()=>{const e=setInterval(()=>D(e=>e+1),6e4);return()=>clearInterval(e)},[]);const[$,L]=c(!1),[R,A]=c(r),[H,I]=c(k),{prefs:B,save:O}=o(),G={...g,...B.weather_prefs??{}},[J,U]=c(G);s(m(()=>{A(r),I({...k}),U({...G}),L(!0)},[r,k,G])),d(()=>{let t=!1;return T(!0),e(r).then(e=>{t||(S(e),T(!1))}),()=>{t=!0}},[r]);const W=e=>G.useFahrenheit?`${b(e)}°F`:`${e}°`;if(F&&!j)/* @__PURE__ */
26
+ /* @__PURE__ */h("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__ */h("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__ */h("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 C(){/* @__PURE__ */
27
+ return h("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:Array.from({length:4}).map((e,t)=>/* @__PURE__ */h("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 D({code:e,isDay:t}){return 0===e||1===e?/* @__PURE__ */h(t?v:k,{}):2===e?/* @__PURE__ */p(u,{children:[/* @__PURE__ */h(t?v:k,{}),
28
+ /* @__PURE__ */h(N,{tone:t?"light":"dark"})]}):3===e?/* @__PURE__ */h(N,{tone:t?"light":"dark"}):45===e||48===e?/* @__PURE__ */h(C,{}):[51,53,61,80,81].includes(e)?/* @__PURE__ */h(j,{}):[55,63,65,82].includes(e)?/* @__PURE__ */h(j,{heavy:!0}):[71,73,75].includes(e)?/* @__PURE__ */h(S,{}):[95,96,99].includes(e)?/* @__PURE__ */h(T,{}):null}function $(){const[r,v]=c(x),[k,N]=c(()=>n(y)),[j,S]=c(null),[T,C]=c(!0),[,$]=c(0);d(()=>{const e=setInterval(()=>$(e=>e+1),6e4);return()=>clearInterval(e)},[]);const[I,F]=c(!1),[L,A]=c(r),[B,W]=c(k),{prefs:G,save:H}=o(),J={...g,...G.weather_prefs??{}},[O,K]=c(J);s(m(()=>{A(r),W({...k}),K({...J}),F(!0)},[r,k,J])),d(()=>{let t=!1;return C(!0),e(r).then(e=>{t||(S(e),C(!1))}),()=>{t=!0}},[r]);const M=e=>J.useFahrenheit?`${b(e)}°F`:`${e}°`;if(T&&!j)/* @__PURE__ */
29
29
  return h("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:/* @__PURE__ */h(l,{size:"sm",padding:"",label:"Loading"})});if(!j)/* @__PURE__ */
30
- return h("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[K,M,P]=t(j.code,j.isDay);/* @__PURE__ */
30
+ return h("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[P,R,U]=t(j.code,j.isDay);/* @__PURE__ */
31
31
  return p(u,{children:[
32
32
  /* @__PURE__ */h("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__ */h("div",{className:"rounded-lg overflow-hidden",style:{backgroundColor:`rgba(15, 23, 42, ${k.activeOpacity/100})`,backdropFilter:k.activeBlur>0?`blur(${k.activeBlur}px)`:void 0},children:/* @__PURE__ */p("div",{className:`relative rounded-lg overflow-hidden text-white bg-gradient-to-br ${P}`,style:{height:110},children:[
34
- /* @__PURE__ */h(C,{code:j.code,isDay:j.isDay}),
33
+ /* @__PURE__ */h("div",{className:"rounded-lg overflow-hidden",style:{backgroundColor:`rgba(15, 23, 42, ${k.activeOpacity/100})`,backdropFilter:k.activeBlur>0?`blur(${k.activeBlur}px)`:void 0},children:/* @__PURE__ */p("div",{className:`relative rounded-lg overflow-hidden text-white bg-gradient-to-br ${U}`,style:{height:110},children:[
34
+ /* @__PURE__ */h(D,{code:j.code,isDay:j.isDay}),
35
35
  /* @__PURE__ */p("div",{className:"relative z-10 px-3 py-3 flex flex-col h-full justify-between",children:[
36
36
  /* @__PURE__ */p("div",{className:"flex items-start justify-between gap-2",children:[
37
37
  /* @__PURE__ */p("div",{className:"min-w-0 flex-1",children:[
38
- /* @__PURE__ */h("div",{className:"text-base font-semibold leading-tight truncate drop-shadow-sm",children:j.city}),G.showLocalTime&&/* @__PURE__ */h("div",{className:"text-2xs opacity-90 leading-tight tabular-nums drop-shadow-sm",children:w(j.timezone,G.use24Hour)})]}),
39
- /* @__PURE__ */h("div",{className:"text-3xl font-extralight leading-none tracking-tight tabular-nums shrink-0 drop-shadow-sm",children:W(j.temp)})]}),
38
+ /* @__PURE__ */h("div",{className:"text-base font-semibold leading-tight truncate drop-shadow-sm",children:j.city}),J.showLocalTime&&/* @__PURE__ */h("div",{className:"text-2xs opacity-90 leading-tight tabular-nums drop-shadow-sm",children:w(j.timezone,J.use24Hour)})]}),
39
+ /* @__PURE__ */h("div",{className:"text-3xl font-extralight leading-none tracking-tight tabular-nums shrink-0 drop-shadow-sm",children:M(j.temp)})]}),
40
40
  /* @__PURE__ */p("div",{className:"flex items-end justify-between gap-2",children:[
41
41
  /* @__PURE__ */p("div",{className:"flex items-center gap-2 min-w-0",children:[
42
- /* @__PURE__ */h("span",{className:"text-lg leading-none drop-shadow-sm",children:M}),
43
- /* @__PURE__ */h("span",{className:"text-2xs font-medium drop-shadow-sm truncate",children:K})]}),
44
- /* @__PURE__ */p("span",{className:"text-2xs opacity-90 tabular-nums drop-shadow-sm shrink-0",children:["H:",W(j.high)," L:",W(j.low)]})]})]})]})}),
45
- /* @__PURE__ */p(i,{open:$,onClose:()=>L(!1),title:"Weather Settings",appearance:H,onAppearanceChange:I,onSave:()=>{v(R),N(H),O({weather_prefs:J}),localStorage.setItem(f,R),localStorage.setItem(y,JSON.stringify(H)),L(!1)},children:[
42
+ /* @__PURE__ */h("span",{className:"text-lg leading-none drop-shadow-sm",children:R}),
43
+ /* @__PURE__ */h("span",{className:"text-2xs font-medium drop-shadow-sm truncate",children:P})]}),
44
+ /* @__PURE__ */p("span",{className:"text-2xs opacity-90 tabular-nums drop-shadow-sm shrink-0",children:["H:",M(j.high)," L:",M(j.low)]})]})]})]})}),
45
+ /* @__PURE__ */p(i,{open:I,onClose:()=>F(!1),title:"Weather Settings",appearance:B,onAppearanceChange:W,onSave:()=>{v(L),N(B),H({weather_prefs:O}),localStorage.setItem(f,L),localStorage.setItem(y,JSON.stringify(B)),F(!1)},children:[
46
46
  /* @__PURE__ */h("div",{className:"space-y-3",children:/* @__PURE__ */p("div",{children:[
47
47
  /* @__PURE__ */h("h3",{className:"text-sm font-semibold text-gray-700 mb-2",children:"Display"}),
48
48
  /* @__PURE__ */p("div",{className:"flex items-center gap-3 mb-2",children:[
49
49
  /* @__PURE__ */h("span",{className:"text-sm text-gray-600 w-24",children:"Temperature"}),
50
- /* @__PURE__ */h("div",{className:"flex gap-1",children:[{key:!1,label:"°C"},{key:!0,label:"°F"}].map(e=>/* @__PURE__ */h("button",{onClick:()=>U(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)))})]}),
50
+ /* @__PURE__ */h("div",{className:"flex gap-1",children:[{key:!1,label:"°C"},{key:!0,label:"°F"}].map(e=>/* @__PURE__ */h("button",{onClick:()=>K(t=>({...t,useFahrenheit:e.key})),className:"px-3 py-1 text-xs font-medium rounded-lg border transition-colors "+(O.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
51
  /* @__PURE__ */p("div",{className:"flex items-center gap-3 mb-2",children:[
52
52
  /* @__PURE__ */h("span",{className:"text-sm text-gray-600 w-24",children:"Time Format"}),
53
- /* @__PURE__ */h("div",{className:"flex gap-1",children:[{key:!1,label:"AM/PM"},{key:!0,label:"24H"}].map(e=>/* @__PURE__ */h("button",{onClick:()=>U(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)))})]}),
53
+ /* @__PURE__ */h("div",{className:"flex gap-1",children:[{key:!1,label:"AM/PM"},{key:!0,label:"24H"}].map(e=>/* @__PURE__ */h("button",{onClick:()=>K(t=>({...t,use24Hour:e.key})),className:"px-3 py-1 text-xs font-medium rounded-lg border transition-colors "+(O.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
54
  /* @__PURE__ */p("label",{className:"flex items-center gap-2 cursor-pointer",children:[
55
- /* @__PURE__ */h("input",{type:"checkbox",checked:J.showLocalTime,onChange:e=>U(t=>({...t,showLocalTime:e.target.checked})),className:"rounded border-gray-300 text-blue-600 h-3.5 w-3.5"}),
55
+ /* @__PURE__ */h("input",{type:"checkbox",checked:O.showLocalTime,onChange:e=>K(t=>({...t,showLocalTime:e.target.checked})),className:"rounded border-gray-300 text-blue-600 h-3.5 w-3.5"}),
56
56
  /* @__PURE__ */h("span",{className:"text-sm text-gray-600",children:"Show local time"})]})]})}),
57
57
  /* @__PURE__ */p("div",{children:[
58
58
  /* @__PURE__ */h("h3",{className:"text-sm font-semibold text-gray-700 mb-2",children:"City"}),
59
- /* @__PURE__ */h("select",{value:R,onChange:e=>A(e.target.value),className:"w-full bg-gray-50 border border-gray-200 rounded px-2 h-8 text-sm focus:outline-none focus:ring-1 focus:ring-blue-500",children:Object.keys(a).map(e=>/* @__PURE__ */h("option",{value:e,children:e},e))}),
60
- /* @__PURE__ */h("p",{className:"mt-1 text-2xs text-gray-400",children:"Auto-detected from your timezone; change if needed."})]})]})]})}export{D as default};
59
+ /* @__PURE__ */h("select",{value:L,onChange:e=>A(e.target.value),className:"w-full bg-gray-50 border border-gray-200 rounded px-2 h-8 text-sm focus:outline-none focus:ring-1 focus:ring-blue-500",children:Object.keys(a).map(e=>/* @__PURE__ */h("option",{value:e,children:e},e))}),
60
+ /* @__PURE__ */h("p",{className:"mt-1 text-2xs text-gray-400",children:"Auto-detected from your timezone; change if needed."})]})]})]})}export{$ as default};
@@ -1,6 +1,6 @@
1
- import{AVAILABLE_CITIES as e,fetchCityWeather as t,getCondition as r,toFahrenheit as n}from"./chunk-FBDZGO3V.js";import{loadAppearance as a,WidgetSettingsModal as s}from"./chunk-RJZYORCR.js";import{useWidgetSettings as i}from"./chunk-PAB2ZU4F.js";import"./chunk-CY5N5OA3.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-SEXLHFMR.js";import"./chunk-5A7MWTXX.js";import"./chunk-Y53KNQKL.js";import"./chunk-EW6FRPFJ.js";import"./chunk-MOD4PGVF.js";import"./chunk-F2AEP37B.js";import"./chunk-4AJRHTTB.js";import"./chunk-VWGWZY7A.js";import"./chunk-PKXQDCNR.js";import"./chunk-4GVH4ZUH.js";import"./chunk-UGTRSRIW.js";import"./chunk-CDAJKLGL.js";import"./chunk-D323R2FT.js";import{useShellPrefs as c}from"./chunk-KC3EX26K.js";import"./chunk-FKZEGBLK.js";import"./chunk-5QFPTDQF.js";import"./chunk-QR4RM7PO.js";import"./chunk-4IU5BSVE.js";import"./chunk-K7U4RWXJ.js";import"./chunk-2SHYR3RA.js";import"./chunk-J75ZT2JQ.js";import"./chunk-VH6GB73Q.js";import{LoadingSpinner as o}from"./chunk-Q5MD3VY6.js";import"./chunk-MRJKZWWV.js";import"./chunk-6KO5VTL7.js";import"./chunk-22S6LG6D.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-DTJRIWFR.js";import"./chunk-TWVUQUUD.js";import"./chunk-E6UCGCOC.js";import"./chunk-C3QOHMR6.js";import{useState as l,useEffect as m,useCallback as h}from"react";import{jsxs as p,Fragment as u,jsx as d}from"react/jsx-runtime";var k="world_clock_appearance",g=["London","Shanghai","New York"];function x(){const{prefs:x,save:y}=c(),[b,j]=l(()=>a(k)),[f,N]=l(!1),[v,w]=l([]),[F,C]=l(b),R={useFahrenheit:!!x.weather_prefs?.useFahrenheit},[D,T]=l(R),[U,G]=l(()=>/* @__PURE__ */new Date);m(()=>{const e=setInterval(()=>G(/* @__PURE__ */new Date),3e4);return()=>clearInterval(e)},[]);const J=Object.fromEntries(Object.entries(e).map(([e,t])=>[t.tz,e])),O=x.world_clocks,S=(()=>{if(!Array.isArray(O)||0===O.length)return g;const t=[];for(const r of O){const n=e[r]?r:J[r];n&&!t.includes(n)&&t.push(n)}return t.length?t:g})(),[W,L]=l({}),[A,B]=l(!0);m(()=>{let e=!1;return B(!0),(async()=>{const r={};await Promise.all(S.map(async e=>{const n=await t(e);n&&(r[e]=n)})),e||(L(r),B(!1))})(),()=>{e=!0}},[S.join(",")]),i(h(()=>{w([...S]),C({...b}),T({...R}),N(!0)},[S.join(","),b,R.useFahrenheit]));const K=e=>R.useFahrenheit?`${n(e)}°`:`${e}°`;/* @__PURE__ */
1
+ import{AVAILABLE_CITIES as e,fetchCityWeather as t,getCondition as r,toFahrenheit as n}from"./chunk-FBDZGO3V.js";import{loadAppearance as a,WidgetSettingsModal as s}from"./chunk-U4BMS5EV.js";import{useWidgetSettings as i}from"./chunk-KJY57QPT.js";import"./chunk-CY5N5OA3.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-BMPBVI7P.js";import"./chunk-5A7MWTXX.js";import"./chunk-Y53KNQKL.js";import"./chunk-6WWAQC5V.js";import"./chunk-EGDJEY4K.js";import"./chunk-GNPTNAZH.js";import{useShellPrefs as c}from"./chunk-KC3EX26K.js";import"./chunk-4AJRHTTB.js";import"./chunk-VWGWZY7A.js";import"./chunk-PKXQDCNR.js";import"./chunk-UGTRSRIW.js";import"./chunk-ET2EF5CI.js";import"./chunk-CDAJKLGL.js";import"./chunk-DXTKNHWG.js";import"./chunk-QR4RM7PO.js";import"./chunk-5QFPTDQF.js";import"./chunk-D323R2FT.js";import"./chunk-4IU5BSVE.js";import"./chunk-K7U4RWXJ.js";import"./chunk-VH6GB73Q.js";import"./chunk-FSPFV4MI.js";import"./chunk-J75ZT2JQ.js";import{LoadingSpinner as o}from"./chunk-Q5MD3VY6.js";import"./chunk-MRJKZWWV.js";import"./chunk-6KO5VTL7.js";import"./chunk-22S6LG6D.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-DTJRIWFR.js";import"./chunk-TWVUQUUD.js";import"./chunk-E6UCGCOC.js";import"./chunk-C3QOHMR6.js";import{useState as l,useEffect as m,useCallback as h}from"react";import{jsxs as p,Fragment as u,jsx as d}from"react/jsx-runtime";var k="world_clock_appearance",g=["London","Shanghai","New York"];function x(){const{prefs:x,save:y}=c(),[b,j]=l(()=>a(k)),[f,N]=l(!1),[v,w]=l([]),[C,T]=l(b),F={useFahrenheit:!!x.weather_prefs?.useFahrenheit},[D,W]=l(F),[G,J]=l(()=>/* @__PURE__ */new Date);m(()=>{const e=setInterval(()=>J(/* @__PURE__ */new Date),3e4);return()=>clearInterval(e)},[]);const S=Object.fromEntries(Object.entries(e).map(([e,t])=>[t.tz,e])),U=x.world_clocks,K=(()=>{if(!Array.isArray(U)||0===U.length)return g;const t=[];for(const r of U){const n=e[r]?r:S[r];n&&!t.includes(n)&&t.push(n)}return t.length?t:g})(),[R,V]=l({}),[B,O]=l(!0);m(()=>{let e=!1;return O(!0),(async()=>{const r={};await Promise.all(K.map(async e=>{const n=await t(e);n&&(r[e]=n)})),e||(V(r),O(!1))})(),()=>{e=!0}},[K.join(",")]),i(h(()=>{w([...K]),T({...b}),W({...F}),N(!0)},[K.join(","),b,F.useFahrenheit]));const P=e=>F.useFahrenheit?`${n(e)}°`:`${e}°`;/* @__PURE__ */
2
2
  return p(u,{children:[
3
- /* @__PURE__ */d("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__ */p("div",{className:"divide-y divide-gray-200",children:[A&&S.every(e=>!W[e])&&/* @__PURE__ */d(o,{size:"sm",padding:"py-6",label:"Loading"}),S.map(t=>{const n=W[t],a=e[t]?.tz??"UTC",{time:s,ampm:i}=function(e,t){try{const r=new Intl.DateTimeFormat("en-US",{timeZone:e,hour:"numeric",minute:"2-digit",hour12:!0}).formatToParts(t),n=r.find(e=>"hour"===e.type)?.value||"12";return{time:`${n}:${r.find(e=>"minute"===e.type)?.value||"00"}`,ampm:(r.find(e=>"dayPeriod"===e.type)?.value||"").toUpperCase()}}catch{return{time:"",ampm:""}}}(a,U);if(!n)/* @__PURE__ */
3
+ /* @__PURE__ */d("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__ */p("div",{className:"divide-y divide-gray-200",children:[B&&K.every(e=>!R[e])&&/* @__PURE__ */d(o,{size:"sm",padding:"py-6",label:"Loading"}),K.map(t=>{const n=R[t],a=e[t]?.tz??"UTC",{time:s,ampm:i}=function(e,t){try{const r=new Intl.DateTimeFormat("en-US",{timeZone:e,hour:"numeric",minute:"2-digit",hour12:!0}).formatToParts(t),n=r.find(e=>"hour"===e.type)?.value||"12";return{time:`${n}:${r.find(e=>"minute"===e.type)?.value||"00"}`,ampm:(r.find(e=>"dayPeriod"===e.type)?.value||"").toUpperCase()}}catch{return{time:"",ampm:""}}}(a,G);if(!n)/* @__PURE__ */
4
4
  return p("div",{className:"px-4 py-3",children:[
5
5
  /* @__PURE__ */p("div",{className:"flex items-baseline justify-between gap-2",children:[
6
6
  /* @__PURE__ */d("span",{className:"text-base font-semibold tracking-tight text-gray-900 truncate",children:t}),
@@ -10,7 +10,7 @@ return p("div",{className:"px-4 py-3",children:[
10
10
  return p("div",{className:"px-4 py-3",children:[
11
11
  /* @__PURE__ */p("div",{className:"flex items-baseline justify-between gap-2",children:[
12
12
  /* @__PURE__ */d("span",{className:"text-base font-semibold tracking-tight text-gray-900 truncate",children:t}),
13
- /* @__PURE__ */d("span",{className:"text-2xl font-extralight leading-none tabular-nums tracking-tight text-gray-900 shrink-0",children:K(n.temp)})]}),
13
+ /* @__PURE__ */d("span",{className:"text-2xl font-extralight leading-none tabular-nums tracking-tight text-gray-900 shrink-0",children:P(n.temp)})]}),
14
14
  /* @__PURE__ */p("div",{className:"flex items-center justify-between gap-2 mt-2 text-2xs",children:[
15
15
  /* @__PURE__ */p("div",{className:"flex items-center gap-2 min-w-0 text-gray-500",children:[
16
16
  /* @__PURE__ */d("span",{className:"text-base leading-none shrink-0",children:l}),
@@ -18,13 +18,13 @@ return p("div",{className:"px-4 py-3",children:[
18
18
  /* @__PURE__ */d("span",{className:"text-3xs font-medium ml-0.5 opacity-70",children:i})]}),
19
19
  /* @__PURE__ */d("span",{className:"text-gray-300 shrink-0",children:"·"}),
20
20
  /* @__PURE__ */d("span",{className:"truncate",children:c})]}),
21
- /* @__PURE__ */p("span",{className:"tabular-nums text-gray-500 shrink-0",children:["H:",K(n.high)," L:",K(n.low)]})]})]},t)})]})}),
22
- /* @__PURE__ */p(s,{open:f,onClose:()=>N(!1),title:"World Clock Settings",appearance:F,onAppearanceChange:C,onSave:()=>{0!==v.length&&(y({world_clocks:v,weather_prefs:{...x.weather_prefs??{},useFahrenheit:D.useFahrenheit}}),j(F),localStorage.setItem(k,JSON.stringify(F)),N(!1))},children:[
21
+ /* @__PURE__ */p("span",{className:"tabular-nums text-gray-500 shrink-0",children:["H:",P(n.high)," L:",P(n.low)]})]})]},t)})]})}),
22
+ /* @__PURE__ */p(s,{open:f,onClose:()=>N(!1),title:"World Clock Settings",appearance:C,onAppearanceChange:T,onSave:()=>{0!==v.length&&(y({world_clocks:v,weather_prefs:{...x.weather_prefs??{},useFahrenheit:D.useFahrenheit}}),j(C),localStorage.setItem(k,JSON.stringify(C)),N(!1))},children:[
23
23
  /* @__PURE__ */p("div",{children:[
24
24
  /* @__PURE__ */d("h3",{className:"text-sm font-semibold text-gray-700 mb-2",children:"Display"}),
25
25
  /* @__PURE__ */p("div",{className:"flex items-center gap-3 mb-2",children:[
26
26
  /* @__PURE__ */d("span",{className:"text-sm text-gray-600 w-24",children:"Temperature"}),
27
- /* @__PURE__ */d("div",{className:"flex gap-1",children:[{key:!1,label:"°C"},{key:!0,label:"°F"}].map(e=>/* @__PURE__ */d("button",{onClick:()=>T(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)))})]}),
27
+ /* @__PURE__ */d("div",{className:"flex gap-1",children:[{key:!1,label:"°C"},{key:!0,label:"°F"}].map(e=>/* @__PURE__ */d("button",{onClick:()=>W(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
28
  /* @__PURE__ */d("p",{className:"text-2xs text-gray-400 mt-1",children:"Shared with the Weather widget."})]}),
29
29
  /* @__PURE__ */p("div",{children:[
30
30
  /* @__PURE__ */d("h3",{className:"text-sm font-semibold text-gray-700 mb-2",children:"Cities"}),
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { UIMessage } from 'ai';
2
+ import { UIMessage, FileUIPart } from 'ai';
3
3
  import { b as IconName } from '../names-mX74Rrmy.js';
4
4
  import { MarkdownTableAction } from '../shell/Markdown.js';
5
5
  import 'react';
@@ -15,6 +15,34 @@ interface ConversationDataPart {
15
15
  id: string;
16
16
  guest_token?: string;
17
17
  }
18
+ /** A file the person attached to a question (efficient-backend
19
+ * `assistant.interactive.attachments`): what the host's `upload` resolves
20
+ * with, what a restored thread carries, and what `onOpen` is handed. */
21
+ interface AssistantAttachment {
22
+ id: string;
23
+ filename: string;
24
+ /** What the server serves it as: `text/csv`, the XLSX type, `application/pdf`. */
25
+ content_type: string;
26
+ /** Bytes. */
27
+ size: number;
28
+ }
29
+ /** A host's file attaching. With it, the composer has a paperclip (and takes a
30
+ * drop or a paste); each file is uploaded as soon as it is picked, and Send
31
+ * waits for the uploads. The chat itself never uploads or opens a file. */
32
+ interface AssistantAttachmentsConfig {
33
+ /** Native `accept` string, e.g. `.csv,.xlsx,.pdf`. */
34
+ accept: string;
35
+ maxSizeBytes: number;
36
+ /** Most files on one question. Default 5. */
37
+ maxFiles?: number;
38
+ /** Short kind hint for a type rejection, e.g. "CSV · XLSX · PDF". */
39
+ acceptHint?: string;
40
+ /** Store one file; resolve with what the server stored, or reject with an
41
+ * Error whose message is shown to the person. */
42
+ upload: (file: File) => Promise<AssistantAttachment>;
43
+ /** Open an attached file — the host's Preview window. */
44
+ onOpen: (attachment: AssistantAttachment) => void;
45
+ }
18
46
  /** Who wrote a restored message. `staff` is a teammate who took the thread over;
19
47
  * `system` is a notice the server wrote. Streamed messages carry no source. */
20
48
  type MessageSource = 'user' | 'assistant' | 'staff' | 'system';
@@ -106,12 +134,31 @@ interface ToolSummaryDataPart {
106
134
  rows: ToolSummaryRow[];
107
135
  truncated?: boolean;
108
136
  }
137
+ /** A `data-file` part: a file the assistant made for the person — an
138
+ * endpoint's own export or the answer as a PDF, CSV or workbook. The server
139
+ * keeps it, the person's alone; it rides in the message (and comes back with
140
+ * the thread on reload), and the chat draws it as a card the host opens
141
+ * (`onOpenFile`), in its own Preview window. */
142
+ interface FileDataPart {
143
+ id: string;
144
+ filename: string;
145
+ kind: 'pdf' | 'csv' | 'xlsx' | (string & {});
146
+ content_type: string;
147
+ /** Bytes. */
148
+ size: number;
149
+ /** `export` (an endpoint's own) or `answer` (the answer, rendered). */
150
+ source?: string;
151
+ created_at?: string;
152
+ /** The tool call that made it; absent on a restored thread. */
153
+ tool_call_id?: string;
154
+ }
109
155
  type AssistantUIMessage = UIMessage<AssistantMessageMetadata, {
110
156
  conversation: ConversationDataPart;
111
157
  plan: PlanDataPart;
112
158
  followups: FollowupsDataPart;
113
159
  'tool-summary': ToolSummaryDataPart;
114
160
  error: ErrorDataPart;
161
+ file: FileDataPart;
115
162
  }>;
116
163
  /** How a tool is named and narrated to the person using the chat. */
117
164
  interface ToolLabelSpec {
@@ -190,6 +237,20 @@ interface AssistantChatLabels {
190
237
  streamingRate: string;
191
238
  /** Names the row of suggested next questions under the last answer. */
192
239
  followups: string;
240
+ /** The composer's paperclip. */
241
+ attach: string;
242
+ /** On a file's chip while it uploads. */
243
+ attaching: string;
244
+ /** The chip's remove button: "{name}" is filled in. */
245
+ removeAttachment: string;
246
+ /** A file chip in the thread: "{name}" is filled in. */
247
+ openAttachment: string;
248
+ /** The button under a finished reply that copies it, formatted. */
249
+ copyAnswer: string;
250
+ /** Said on that button for a moment once the reply is on the clipboard. */
251
+ copied: string;
252
+ /** In place of the composer when the chat is `readOnly`. */
253
+ readOnly: string;
193
254
  /** Names the thumbs under an answer for assistive technology. */
194
255
  rateAnswer: string;
195
256
  rateUp: string;
@@ -201,6 +262,8 @@ interface AssistantChatLabels {
201
262
  /** Shown once a thumbs-down's note has been sent. */
202
263
  rateThanks: string;
203
264
  rateFailed: string;
265
+ /** A file card's action, for assistive technology: "{name}" is filled in. */
266
+ openFile: string;
204
267
  }
205
268
  type AssistantChatVariant = 'panel' | 'window' | 'bubble';
206
269
  /** A host's own action on a piece of the person's text — the admin portal's
@@ -213,6 +276,18 @@ interface AssistantTextAction {
213
276
  icon?: IconName;
214
277
  onSelect: (text: string) => void;
215
278
  }
279
+ /** A host's own action on one finished reply — the admin portal's "Email…".
280
+ * `id` is the server's message id when the thread was restored, else the
281
+ * chat's own; `text` is the reply's Markdown. */
282
+ interface AssistantAnswerAction {
283
+ key: string;
284
+ label: string;
285
+ icon?: IconName;
286
+ onSelect: (answer: {
287
+ id: string;
288
+ text: string;
289
+ }) => void;
290
+ }
216
291
  interface AssistantChatProps {
217
292
  /** Base URL of the API, without the trailing `assistant/chat/` ("/api/v1"). */
218
293
  apiBase: string;
@@ -282,6 +357,25 @@ interface AssistantChatProps {
282
357
  * Spreadsheet" and "Copy as CSV". The chat knows nothing of what they do.
283
358
  * None by default. */
284
359
  tableActions?: MarkdownTableAction[];
360
+ /** Let the person attach files to a question. None by default: no paperclip. */
361
+ attachments?: AssistantAttachmentsConfig;
362
+ /** Opens a file the assistant made (a `data-file` part), from its card
363
+ * under the answer: the admin portal fetches it and shows a PDF in its
364
+ * Preview window, a CSV or workbook in its Spreadsheet app. Without it the
365
+ * card is shown but cannot be opened. */
366
+ onOpenFile?: (file: FileDataPart) => void;
367
+ /** A Copy button under every finished reply, putting it on the clipboard
368
+ * as HTML (tables stay tables) with its Markdown as the plain text.
369
+ * Default: on in `window`, off in `panel` and `bubble`. */
370
+ showCopy?: boolean;
371
+ /** Buttons beside Copy under every finished reply, each handed that reply.
372
+ * None by default. */
373
+ answerActions?: AssistantAnswerAction[];
374
+ /** Read the conversation, never continue it: no composer, no suggested
375
+ * questions, no retry. For a chat someone shared with the reader; the
376
+ * server refuses a turn from them anyway. `labels.readOnly` stands where
377
+ * the composer was. */
378
+ readOnly?: boolean;
285
379
  /** Thumbs up and down under each finished answer the server says can be
286
380
  * rated, with a short "what was wrong" note after a thumbs-down. The chat
287
381
  * hands the host the rating and the host saves it (the admin portal's
@@ -314,11 +408,19 @@ interface MessageProps {
314
408
  userActions?: AssistantTextAction[];
315
409
  /** Controls under each table, once the reply has finished. */
316
410
  tableActions?: MarkdownTableAction[];
411
+ /** Opens a file the person attached; without it a file is named, not a link. */
412
+ onOpenAttachment?: (attachment: AssistantAttachment) => void;
413
+ /** Opens a file card's file (see AssistantChatProps). */
414
+ onOpenFile?: (file: FileDataPart) => void;
415
+ /** A Copy button under the reply, once it has finished. */
416
+ showCopy?: boolean;
417
+ /** The host's buttons beside Copy. */
418
+ answerActions?: AssistantAnswerAction[];
317
419
  /** Saves the person's rating of this answer; with it, a finished answer the
318
420
  * server named a run for shows thumbs. */
319
421
  onRate?: (runId: string, rating: AssistantAnswerRating | null) => Promise<void> | void;
320
422
  }
321
- declare function Message({ message, toolLabels, labels, showReasoning, showToolOutput, showUsage, live, onApprove, plans, userActions, tableActions, onLinkClick, onRate }: MessageProps): react_jsx_runtime.JSX.Element | null;
423
+ declare function Message({ message, toolLabels, labels, showReasoning, showToolOutput, showUsage, live, onApprove, plans, userActions, tableActions, onLinkClick, onOpenAttachment, onOpenFile, showCopy, answerActions, onRate }: MessageProps): react_jsx_runtime.JSX.Element | null;
322
424
 
323
425
  interface ApprovalDecision {
324
426
  approval_id: string;
@@ -329,6 +431,8 @@ interface AssistantChatRequestBody {
329
431
  conversation_id: string | null;
330
432
  text: string | null;
331
433
  approvals: ApprovalDecision[];
434
+ /** Ids of the files sent with `text`; absent when there are none. */
435
+ attachments?: string[];
332
436
  }
333
437
  /** The tool-part fields the chat reads, whatever the tool is called. */
334
438
  interface ToolPartView {
@@ -344,6 +448,13 @@ interface ToolPartView {
344
448
  /** Each read's account of its figures in `message`, by tool call id. A part
345
449
  * without rows is no account. */
346
450
  declare function toolSummariesOf(message: AssistantUIMessage): Map<string, ToolSummaryDataPart>;
451
+ /** The files in `message`, in order — one per file, the latest part winning. */
452
+ declare function filesOf(message: AssistantUIMessage): FileDataPart[];
453
+ /** The message part for a file the server stored. */
454
+ declare function attachmentPart(attachment: AssistantAttachment): FileUIPart;
455
+ /** The server's files among a message's parts, in order. Any other file part
456
+ * (one the chat did not make) is not an attachment and is left out. */
457
+ declare function attachmentsOf(message: AssistantUIMessage): AssistantAttachment[];
347
458
  /** The request body for the next turn. Throws when there is nothing to send,
348
459
  * so a bug cannot become an empty request the server has to reject. */
349
460
  declare function buildRequestBody(messages: AssistantUIMessage[], conversationId: string | null): AssistantChatRequestBody;
@@ -354,10 +465,14 @@ interface HistoryMessage {
354
465
  source?: MessageSource;
355
466
  text: string;
356
467
  created_at?: string;
468
+ /** Files sent with the person's question (staff servers only). */
469
+ attachments?: AssistantAttachment[];
357
470
  /** On an answer the caller can rate: the run that wrote it. */
358
471
  run_id?: string;
359
472
  /** The caller's own rating of it, `null` when none. */
360
473
  rating?: AssistantAnswerRating | null;
474
+ /** Files the assistant made with this answer (servers before files omit it). */
475
+ files?: FileDataPart[];
361
476
  }
362
477
  interface HistoryApproval {
363
478
  approval_id: string;
@@ -465,4 +580,4 @@ declare function finishedStats(usage: AssistantTurnUsage, labels: StatsLabels):
465
580
  /** The line under a reply being written: `elapsedMs` since the reply began. */
466
581
  declare function liveStats(text: string, elapsedMs: number, labels: StatsLabels): string;
467
582
 
468
- export { ApprovalCard, type ApprovalDecision, type AssistantAnswerRating, type AssistantAnswerVerdict, AssistantChat, type AssistantChatLabels, type AssistantChatProps, type AssistantChatRequestBody, type AssistantChatVariant, type AssistantConversation, type AssistantErrorCode, Message as AssistantMessage, type AssistantMessageMetadata, type AssistantRateRequest, type AssistantTextAction, type AssistantTurnUsage, type AssistantUIMessage, type ConversationHistory, DEFAULT_ASSISTANT_CHAT_LABELS, type ErrorDataPart, type FailureView, type MessageSource, PlanApprovalCard, PlanChecklist, type PlanDataPart, type PlanStatus, type PlanStepData, type ToolLabel, type ToolLabelSpec, type ToolLabels, ToolStep, type ToolSummaryDataPart, type ToolSummaryRow, buildRequestBody, estimateTokens, failureView, finishedStats, isDroppedConnection, liveStats, messagesFromHistory, pinnedPlan, plansOf, tokensPerSecond, toolSummariesOf };
583
+ export { ApprovalCard, type ApprovalDecision, type AssistantAnswerAction, type AssistantAnswerRating, type AssistantAnswerVerdict, type AssistantAttachment, type AssistantAttachmentsConfig, AssistantChat, type AssistantChatLabels, type AssistantChatProps, type AssistantChatRequestBody, type AssistantChatVariant, type AssistantConversation, type AssistantErrorCode, Message as AssistantMessage, type AssistantMessageMetadata, type AssistantRateRequest, type AssistantTextAction, type AssistantTurnUsage, type AssistantUIMessage, type ConversationHistory, DEFAULT_ASSISTANT_CHAT_LABELS, type ErrorDataPart, type FailureView, type FileDataPart, type MessageSource, PlanApprovalCard, PlanChecklist, type PlanDataPart, type PlanStatus, type PlanStepData, type ToolLabel, type ToolLabelSpec, type ToolLabels, ToolStep, type ToolSummaryDataPart, type ToolSummaryRow, attachmentPart, attachmentsOf, buildRequestBody, estimateTokens, failureView, filesOf, finishedStats, isDroppedConnection, liveStats, messagesFromHistory, pinnedPlan, plansOf, tokensPerSecond, toolSummariesOf };