efficient-shell 5.6.1 → 6.4.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.
- package/README.md +184 -44
- package/THIRD_PARTY_NOTICES.md +212 -0
- package/dist/Browser-USPZWDYH.js +43 -0
- package/dist/Calculator-FP5HUWCW.js +29 -0
- package/dist/ConfirmDialog-3TIHKJRT.js +1 -0
- package/dist/{CurrencyConverter-2IGOOR3I.js → CurrencyConverter-XD5LYOCD.js} +8 -8
- package/dist/Documents-ADFEHEUW.js +52 -0
- package/dist/Files-BVUVRNC5.js +87 -0
- package/dist/Notepad-WJI5ODGS.js +25 -0
- package/dist/PdfViewer-226I3LSD.js +1 -0
- package/dist/PomodoroTimer-GEMQHIPJ.js +91 -0
- package/dist/Preview-HNSEYNZL.js +182 -0
- package/dist/Sidebar-PVHZPNIY.js +44 -0
- package/dist/{Spreadsheet-SRAUU3OA.js → Spreadsheet-6Z5ACGTT.js} +14 -14
- package/dist/{Stock-7EKOAQ7C.js → Stock-X3LIU4ZX.js} +4 -4
- package/dist/{Weather-RWI6NKB2.js → Weather-BLO354GM.js} +14 -14
- package/dist/{WorldClock-CEHWDFEO.js → WorldClock-BAH7QFRG.js} +7 -7
- package/dist/apps/index.js +1 -1
- package/dist/bin/ui-check.js +1 -1
- package/dist/brand.css +1 -1
- package/dist/chunk-2SSRFEOZ.js +91 -0
- package/dist/{chunk-TFETN2GI.js → chunk-4JZZLUGG.js} +1 -1
- package/dist/{chunk-GG7AE6OC.js → chunk-5K76RQML.js} +1 -1
- package/dist/chunk-5LUN632W.js +5 -0
- package/dist/chunk-5MDQNFOG.js +9 -0
- package/dist/chunk-7IQ3B77H.js +1 -0
- package/dist/{chunk-SKB6L53D.js → chunk-7PGHRG6J.js} +9 -9
- package/dist/chunk-CXJQ42XT.js +21 -0
- package/dist/chunk-DBXZS7OA.js +29 -0
- package/dist/{chunk-X4FJ54PP.js → chunk-FIEA5CGB.js} +1 -1
- package/dist/chunk-GJ37JCC2.js +1 -0
- package/dist/{chunk-KXAUDC3A.js → chunk-GWDVD3VQ.js} +27 -27
- package/dist/chunk-HQLAISFX.js +11 -0
- package/dist/chunk-I2H2CKID.js +3 -0
- package/dist/{chunk-YIH6JLMV.js → chunk-I534M65N.js} +2 -2
- package/dist/{chunk-WWF2EQXF.js → chunk-IHZL3GJU.js} +1 -1
- package/dist/chunk-K6DKX55N.js +1 -0
- package/dist/chunk-KNUR2UEG.js +1 -0
- package/dist/{chunk-JXAAZGLJ.js → chunk-MORDXCV6.js} +1 -1
- package/dist/chunk-PFKMIPZH.js +1028 -0
- package/dist/chunk-PJPK2ADX.js +1 -0
- package/dist/chunk-Q5O5UMJY.js +6 -0
- package/dist/chunk-QJHWLDEN.js +108 -0
- package/dist/chunk-R5VRLW5Z.js +1 -0
- package/dist/chunk-S3LGKIZ3.js +12 -0
- package/dist/chunk-SBF5A6XV.js +1 -0
- package/dist/chunk-SK5DL6JX.js +24 -0
- package/dist/{chunk-CLPJDJH4.js → chunk-UUYPUKP7.js} +1 -1
- package/dist/{chunk-AFYQTVZO.js → chunk-UVBK6YSR.js} +1 -1
- package/dist/chunk-VR6TR575.js +13 -0
- package/dist/{chunk-7WC3EOFS.js → chunk-XO2AMGVU.js} +1 -1
- package/dist/{chunk-N3A3GWJI.js → chunk-YX2IMURA.js} +12 -12
- package/dist/chunk-ZEIKSMFR.js +10 -0
- package/dist/client-DLm3Fvbc.d.ts +65 -0
- package/dist/file-intake/index.js +1 -1
- package/dist/i18n/index.d.ts +1 -1
- package/dist/icons/efficient-looks.d.ts +1 -1
- package/dist/icons/efficient.d.ts +1 -1
- package/dist/icons/index.d.ts +12 -12
- package/dist/icons/index.js +1 -1
- package/dist/{index-ZI6vl2Wq.d.ts → index-D5bms_uA.d.ts} +186 -76
- package/dist/index.d.ts +6 -4
- package/dist/index.js +639 -639
- package/dist/locales/zh-Hans.d.ts +1 -1
- package/dist/locales/zh-Hans.js +1 -1
- package/dist/map/index.js +22 -22
- package/dist/markdown/index.js +6 -6
- package/dist/markup/index.d.ts +460 -36
- package/dist/markup/index.js +1 -1
- package/dist/page-tabs/index.js +5 -5
- package/dist/pdf/index.js +1 -1
- package/dist/{registry-J-TU7zKx.d.ts → registry-Dw6QO2Ch.d.ts} +12 -9
- package/dist/{strings-BVB64Nck.d.ts → strings-fYzxZPn4.d.ts} +5 -0
- package/dist/telemetry/index.d.ts +39 -0
- package/dist/telemetry/index.js +1 -0
- package/dist/ui/index.d.ts +4 -3
- package/dist/ui/index.js +1 -1
- package/dist/ui.css +62 -21
- package/package.json +7 -21
- package/dist/Browser-RXGEZ77D.js +0 -43
- package/dist/Calculator-MVPKTZZF.js +0 -29
- package/dist/ConfirmDialog-XOYCYFA7.js +0 -1
- package/dist/Documents-YBLR7WVX.js +0 -52
- package/dist/Files-7XNR5IL2.js +0 -87
- package/dist/Notepad-ZQYQXV75.js +0 -25
- package/dist/PdfViewer-SQVMMA7B.js +0 -1
- package/dist/PomodoroTimer-XIUN4M73.js +0 -91
- package/dist/Preview-YCOA5JPP.js +0 -182
- package/dist/Sidebar-VI7E3EKI.js +0 -44
- package/dist/chunk-3HJTOINK.js +0 -1
- package/dist/chunk-4SWPNARR.js +0 -5
- package/dist/chunk-5ABLFFC5.js +0 -24
- package/dist/chunk-6LTDJKIL.js +0 -138
- package/dist/chunk-F6B3J3GW.js +0 -6
- package/dist/chunk-HZZNJHRH.js +0 -1
- package/dist/chunk-IMMHJIV5.js +0 -29
- package/dist/chunk-OGXU7QFW.js +0 -12
- package/dist/chunk-P4CIOJHP.js +0 -3
- package/dist/chunk-RBDGN4YU.js +0 -9
- package/dist/chunk-RC2EG6P4.js +0 -1026
- package/dist/chunk-RL626E7Q.js +0 -13
- package/dist/chunk-RMJZOKHY.js +0 -10
- package/dist/chunk-SFCDHHQP.js +0 -1
- package/dist/chunk-TNBCUZVE.js +0 -1
- package/dist/chunk-VWBQ2P5G.js +0 -108
- package/dist/chunk-XWSWYMGM.js +0 -2
- package/dist/chunk-YGC7AX3X.js +0 -11
- package/dist/chunk-Z7D6Y5WA.js +0 -21
- package/dist/icons/heroicons.d.ts +0 -6
- package/dist/icons/heroicons.js +0 -1
- package/dist/icons/lucide.d.ts +0 -6
- package/dist/icons/lucide.js +0 -1
package/THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -30,3 +30,215 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
30
30
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
31
31
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
32
32
|
SOFTWARE.
|
|
33
|
+
|
|
34
|
+
## web-vitals
|
|
35
|
+
|
|
36
|
+
`efficient-shell/telemetry` (and the root entry, which re-exports it) bundles
|
|
37
|
+
web-vitals 6.2.3 (https://github.com/GoogleChrome/web-vitals), Copyright 2020
|
|
38
|
+
Google LLC, minified and without its source comments. It is licensed under the
|
|
39
|
+
Apache License, Version 2.0, reproduced in full below.
|
|
40
|
+
|
|
41
|
+
```text
|
|
42
|
+
|
|
43
|
+
Apache License
|
|
44
|
+
Version 2.0, January 2004
|
|
45
|
+
http://www.apache.org/licenses/
|
|
46
|
+
|
|
47
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
48
|
+
|
|
49
|
+
1. Definitions.
|
|
50
|
+
|
|
51
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
52
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
53
|
+
|
|
54
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
55
|
+
the copyright owner that is granting the License.
|
|
56
|
+
|
|
57
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
58
|
+
other entities that control, are controlled by, or are under common
|
|
59
|
+
control with that entity. For the purposes of this definition,
|
|
60
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
61
|
+
direction or management of such entity, whether by contract or
|
|
62
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
63
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
64
|
+
|
|
65
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
66
|
+
exercising permissions granted by this License.
|
|
67
|
+
|
|
68
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
69
|
+
including but not limited to software source code, documentation
|
|
70
|
+
source, and configuration files.
|
|
71
|
+
|
|
72
|
+
"Object" form shall mean any form resulting from mechanical
|
|
73
|
+
transformation or translation of a Source form, including but
|
|
74
|
+
not limited to compiled object code, generated documentation,
|
|
75
|
+
and conversions to other media types.
|
|
76
|
+
|
|
77
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
78
|
+
Object form, made available under the License, as indicated by a
|
|
79
|
+
copyright notice that is included in or attached to the work
|
|
80
|
+
(an example is provided in the Appendix below).
|
|
81
|
+
|
|
82
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
83
|
+
form, that is based on (or derived from) the Work and for which the
|
|
84
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
85
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
86
|
+
of this License, Derivative Works shall not include works that remain
|
|
87
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
88
|
+
the Work and Derivative Works thereof.
|
|
89
|
+
|
|
90
|
+
"Contribution" shall mean any work of authorship, including
|
|
91
|
+
the original version of the Work and any modifications or additions
|
|
92
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
93
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
94
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
95
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
96
|
+
means any form of electronic, verbal, or written communication sent
|
|
97
|
+
to the Licensor or its representatives, including but not limited to
|
|
98
|
+
communication on electronic mailing lists, source code control systems,
|
|
99
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
100
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
101
|
+
excluding communication that is conspicuously marked or otherwise
|
|
102
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
103
|
+
|
|
104
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
105
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
106
|
+
subsequently incorporated within the Work.
|
|
107
|
+
|
|
108
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
109
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
110
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
111
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
112
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
113
|
+
Work and such Derivative Works in Source or Object form.
|
|
114
|
+
|
|
115
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
116
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
117
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
118
|
+
(except as stated in this section) patent license to make, have made,
|
|
119
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
120
|
+
where such license applies only to those patent claims licensable
|
|
121
|
+
by such Contributor that are necessarily infringed by their
|
|
122
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
123
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
124
|
+
institute patent litigation against any entity (including a
|
|
125
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
126
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
127
|
+
or contributory patent infringement, then any patent licenses
|
|
128
|
+
granted to You under this License for that Work shall terminate
|
|
129
|
+
as of the date such litigation is filed.
|
|
130
|
+
|
|
131
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
132
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
133
|
+
modifications, and in Source or Object form, provided that You
|
|
134
|
+
meet the following conditions:
|
|
135
|
+
|
|
136
|
+
(a) You must give any other recipients of the Work or
|
|
137
|
+
Derivative Works a copy of this License; and
|
|
138
|
+
|
|
139
|
+
(b) You must cause any modified files to carry prominent notices
|
|
140
|
+
stating that You changed the files; and
|
|
141
|
+
|
|
142
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
143
|
+
that You distribute, all copyright, patent, trademark, and
|
|
144
|
+
attribution notices from the Source form of the Work,
|
|
145
|
+
excluding those notices that do not pertain to any part of
|
|
146
|
+
the Derivative Works; and
|
|
147
|
+
|
|
148
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
149
|
+
distribution, then any Derivative Works that You distribute must
|
|
150
|
+
include a readable copy of the attribution notices contained
|
|
151
|
+
within such NOTICE file, excluding those notices that do not
|
|
152
|
+
pertain to any part of the Derivative Works, in at least one
|
|
153
|
+
of the following places: within a NOTICE text file distributed
|
|
154
|
+
as part of the Derivative Works; within the Source form or
|
|
155
|
+
documentation, if provided along with the Derivative Works; or,
|
|
156
|
+
within a display generated by the Derivative Works, if and
|
|
157
|
+
wherever such third-party notices normally appear. The contents
|
|
158
|
+
of the NOTICE file are for informational purposes only and
|
|
159
|
+
do not modify the License. You may add Your own attribution
|
|
160
|
+
notices within Derivative Works that You distribute, alongside
|
|
161
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
162
|
+
that such additional attribution notices cannot be construed
|
|
163
|
+
as modifying the License.
|
|
164
|
+
|
|
165
|
+
You may add Your own copyright statement to Your modifications and
|
|
166
|
+
may provide additional or different license terms and conditions
|
|
167
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
168
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
169
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
170
|
+
the conditions stated in this License.
|
|
171
|
+
|
|
172
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
173
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
174
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
175
|
+
this License, without any additional terms or conditions.
|
|
176
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
177
|
+
the terms of any separate license agreement you may have executed
|
|
178
|
+
with Licensor regarding such Contributions.
|
|
179
|
+
|
|
180
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
181
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
182
|
+
except as required for reasonable and customary use in describing the
|
|
183
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
184
|
+
|
|
185
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
186
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
187
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
189
|
+
implied, including, without limitation, any warranties or conditions
|
|
190
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
191
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
192
|
+
appropriateness of using or redistributing the Work and assume any
|
|
193
|
+
risks associated with Your exercise of permissions under this License.
|
|
194
|
+
|
|
195
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
196
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
197
|
+
unless required by applicable law (such as deliberate and grossly
|
|
198
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
199
|
+
liable to You for damages, including any direct, indirect, special,
|
|
200
|
+
incidental, or consequential damages of any character arising as a
|
|
201
|
+
result of this License or out of the use or inability to use the
|
|
202
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
203
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
204
|
+
other commercial damages or losses), even if such Contributor
|
|
205
|
+
has been advised of the possibility of such damages.
|
|
206
|
+
|
|
207
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
208
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
209
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
210
|
+
or other liability obligations and/or rights consistent with this
|
|
211
|
+
License. However, in accepting such obligations, You may act only
|
|
212
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
213
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
214
|
+
defend, and hold each Contributor harmless for any liability
|
|
215
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
216
|
+
of your accepting any such warranty or additional liability.
|
|
217
|
+
|
|
218
|
+
END OF TERMS AND CONDITIONS
|
|
219
|
+
|
|
220
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
221
|
+
|
|
222
|
+
To apply the Apache License to your work, attach the following
|
|
223
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
224
|
+
replaced with your own identifying information. (Don't include
|
|
225
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
226
|
+
comment syntax for the file format. We also recommend that a
|
|
227
|
+
file or class name and description of purpose be included on the
|
|
228
|
+
same "printed page" as the copyright notice for easier
|
|
229
|
+
identification within third-party archives.
|
|
230
|
+
|
|
231
|
+
Copyright 2020 Google LLC
|
|
232
|
+
|
|
233
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
234
|
+
you may not use this file except in compliance with the License.
|
|
235
|
+
You may obtain a copy of the License at
|
|
236
|
+
|
|
237
|
+
https://www.apache.org/licenses/LICENSE-2.0
|
|
238
|
+
|
|
239
|
+
Unless required by applicable law or agreed to in writing, software
|
|
240
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
241
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
242
|
+
See the License for the specific language governing permissions and
|
|
243
|
+
limitations under the License.
|
|
244
|
+
```
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import{peekBrowserStartUrl as e,claimBrowserStartUrl as t}from"./chunk-LWLCNQY7.js";import{AboutApp as o}from"./chunk-5MDQNFOG.js";import{WindowTitle as r}from"./chunk-QJHWLDEN.js";import"./chunk-DSSLOQDW.js";import"./chunk-I2H2CKID.js";import"./chunk-HQLAISFX.js";import"./chunk-5A7MWTXX.js";import"./chunk-S3LGKIZ3.js";import{confirm as a}from"./chunk-DBXZS7OA.js";import"./chunk-ZEIKSMFR.js";import"./chunk-UVBK6YSR.js";import"./chunk-7IQ3B77H.js";import"./chunk-FIEA5CGB.js";import"./chunk-D65T4H6J.js";import"./chunk-SBF5A6XV.js";import"./chunk-KNUR2UEG.js";import"./chunk-K6DKX55N.js";import"./chunk-C3QOHMR6.js";import{Icon as n}from"./chunk-2SSRFEOZ.js";import{useRef as s,useEffect as l,useState as i}from"react";import{jsxs as c,jsx as m,Fragment as d}from"react/jsx-runtime";var u="react-os-shell:browser-bookmarks",h="react-os-shell:browser-homepage",p="https://en.wikipedia.org/wiki/Main_Page",g=[{label:"Wikipedia",url:"https://en.wikipedia.org/wiki/Main_Page"},{label:"DevDocs",url:"https://devdocs.io"},{label:"Example",url:"https://example.com"}],b=new Set(["ac ad ae af ag ai al am ao aq ar as at au aw ax az ba bb bd be bf bg bh bi","bj bm bn bo br bs bt bw by bz ca cc cd cf cg ch ci ck cl cm cn co cr cu cv","cw cx cy cz de dj dk dm do dz ec ee eg er es et eu fi fj fk fm fo fr ga gd","ge gf gg gh gi gl gm gn gp gq gr gs gt gu gw gy hk hm hn hr ht hu id ie il","im in io iq ir is it je jm jo jp ke kg kh ki km kn kp kr kw ky kz la lb lc","li lk lr ls lt lu lv ly ma mc md me mg mh mk ml mm mn mo mp mq mr ms mt mu","mv mw mx my mz na nc ne nf ng ni nl no np nr nu nz om pa pe pf pg ph pk pl","pm pn pr ps pt pw py qa re ro rs ru rw sa sb sc sd se sg sh si sk sl sm sn","so sr ss st su sv sx sy sz tc td tf tg th tj tk tl tm tn to tr tt tv tw tz","ua ug uk us uy uz va vc ve vg vi vn vu wf ws ye yt za zm zw","com net org edu gov mil int info biz name pro app dev xyz online site tech","store shop cloud design digital agency studio media news blog live life","world today email systems solutions services software page link space host","press wiki team group works careers finance capital energy academy"].join(" ").split(" "));function f(e){let t=e.trim();return t?/^[a-z][a-z0-9+.-]*:\/\//i.test(t)?t:function(e){const t=/^([\w-]+\.)+([a-z]{2,})(\/.*)?$/i.exec(e);return null!==t&&b.has(t[2].toLowerCase())}(t)?"https://"+t:"https://duckduckgo.com/?q="+encodeURIComponent(t):""}var k=["duckduckgo.com","developer.mozilla.org","google.com","gmail.com","youtube.com","facebook.com","instagram.com","whatsapp.com","twitter.com","x.com","github.com","gitlab.com","linkedin.com","reddit.com","pinterest.com","amazon.com","amazon.ca","amazon.co.uk","apple.com","icloud.com","microsoft.com","outlook.com","live.com","office.com","netflix.com","spotify.com","paypal.com","stripe.com","chat.openai.com","chatgpt.com","claude.ai"];function x(){if("undefined"==typeof window)return g;try{const e=localStorage.getItem(u);if(!e)return g;const t=JSON.parse(e);if(Array.isArray(t)&&t.every(e=>"string"==typeof e?.url))return t}catch{}return g}function w(){return"undefined"==typeof window?p:localStorage.getItem(h)||p}function y(){const d=s(void 0);void 0===d.current&&(d.current=e()),l(()=>{null!=d.current&&t(d.current)},[]);const p=d.current?f(d.current.url):"",[g,b]=i(w),[k,y]=i(p||g),[j,C]=i(k),[z,S]=i([k]),[R,W]=i(0),[L,D]=i(0),[E,H]=i(x),[I,O]=i(!1),[F,K]=i(null),U=s(null),A=s(null);l(()=>{try{localStorage.setItem(u,JSON.stringify(E))}catch{}},[E]);const B=e=>{const t=f(e);t&&(y(t),C(t),S(e=>{const o=e.slice(0,R+1);return o.push(t),o}),W(e=>e+1),O(!1))},M=()=>{"undefined"!=typeof window&&window.open(k,"_blank","noopener,noreferrer")},T=()=>{const e=F?.trim();e?(H(t=>[...t,{label:e,url:k}]),K(null)):K(null)};l(()=>{if(null===F)return;U.current?.focus(),U.current?.select();const e=e=>{const t=e.target;t?.closest("[data-bookmark-popover]")||K(null)},t=setTimeout(()=>document.addEventListener("mousedown",e),0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[null!==F]);const X=e=>{H(t=>t.filter((t,o)=>o!==e))},G=R>0,Q=R<z.length-1,q=E.some(e=>e.url===k),P="p-1.5 rounded hover:bg-gray-200 transition-colors text-gray-600 disabled:opacity-30";/* @__PURE__ */
|
|
2
|
+
return c("div",{className:"relative flex flex-col h-full bg-white",children:[
|
|
3
|
+
/* @__PURE__ */m(r,{title:`Browser - ${v(k)}`}),
|
|
4
|
+
/* @__PURE__ */m(o,{app:"browser"}),
|
|
5
|
+
/* @__PURE__ */c("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b border-gray-200 bg-gray-50 shrink-0",children:[
|
|
6
|
+
/* @__PURE__ */m("button",{onClick:()=>{if(R>0){const e=R-1;W(e),y(z[e]),C(z[e]),O(!1)}},disabled:!G,className:P,title:"Back",children:/* @__PURE__ */m(n,{name:"chevron-left",className:"h-4 w-4",strokeWidth:2})}),
|
|
7
|
+
/* @__PURE__ */m("button",{onClick:()=>{if(R<z.length-1){const e=R+1;W(e),y(z[e]),C(z[e]),O(!1)}},disabled:!Q,className:P,title:"Forward",children:/* @__PURE__ */m(n,{name:"chevron-right",className:"h-4 w-4",strokeWidth:2})}),
|
|
8
|
+
/* @__PURE__ */m("button",{onClick:()=>D(e=>e+1),className:P,title:"Refresh",children:/* @__PURE__ */m(n,{name:"refresh",className:"h-4 w-4",strokeWidth:1.8})}),
|
|
9
|
+
/* @__PURE__ */m("button",{onClick:()=>B(g),className:P,title:"Home",children:/* @__PURE__ */m(n,{name:"home",className:"h-4 w-4",strokeWidth:1.8})}),
|
|
10
|
+
/* @__PURE__ */m("form",{onSubmit:e=>{e.preventDefault(),B(j)},className:"flex-1 flex items-center mx-1",children:/* @__PURE__ */c("div",{className:"flex items-center w-full bg-white border border-gray-300 rounded focus-within:border-blue-400 focus-within:ring-1 focus-within:ring-blue-200",children:[
|
|
11
|
+
/* @__PURE__ */m("span",{className:"px-2 text-gray-400 text-xs",children:k.startsWith("https://")?"🔒":"⚠️"}),
|
|
12
|
+
/* @__PURE__ */m("input",{type:"text",value:j,onChange:e=>C(e.target.value),onFocus:e=>e.target.select(),className:"flex-1 px-1 py-1 text-sm bg-transparent outline-none font-mono",spellCheck:!1,placeholder:"Enter URL or search…"}),k!==j&&/* @__PURE__ */m("button",{type:"button",onClick:()=>C(k),className:"px-1.5 text-[10px] text-gray-400 hover:text-gray-700",title:"Reset to current URL",children:"×"})]})}),
|
|
13
|
+
/* @__PURE__ */m("button",{"data-bookmark-popover":!0,onClick:()=>q?X(E.findIndex(e=>e.url===k)):void K(v(k)),className:P+" "+(q?"text-yellow-500":""),title:q?"Remove bookmark":"Add bookmark",children:/* @__PURE__ */m(n,{name:"star",className:"h-4 w-4",fill:q?"currentColor":"none",strokeWidth:1.5})}),
|
|
14
|
+
/* @__PURE__ */m("button",{onClick:M,className:P,title:"Open in new tab",children:/* @__PURE__ */m(n,{name:"external",className:"h-4 w-4",strokeWidth:1.5})}),
|
|
15
|
+
/* @__PURE__ */m("button",{onClick:()=>O(e=>!e),className:P,title:"Embedding help",children:/* @__PURE__ */m(n,{name:"help",className:"h-4 w-4",strokeWidth:1.5})})]}),null!==F&&/* @__PURE__ */c("div",{"data-bookmark-popover":!0,className:"absolute right-3 top-12 z-30 w-72 bg-white border border-gray-200 rounded-md shadow-lg p-3",children:[
|
|
16
|
+
/* @__PURE__ */m("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-gray-500 mb-1",children:"Bookmark this page"}),
|
|
17
|
+
/* @__PURE__ */m("div",{className:"text-[11px] text-gray-400 truncate mb-2 font-mono",title:k,children:k}),
|
|
18
|
+
/* @__PURE__ */m("input",{ref:U,type:"text",value:F,onChange:e=>K(e.target.value),onKeyDown:e=>{"Enter"===e.key?T():"Escape"===e.key&&K(null)},placeholder:"Name",className:"w-full text-sm px-2 py-1.5 border border-gray-300 rounded focus:outline-none focus:border-blue-400 focus:ring-1 focus:ring-blue-200"}),
|
|
19
|
+
/* @__PURE__ */c("div",{className:"flex justify-end gap-1 mt-2",children:[
|
|
20
|
+
/* @__PURE__ */m("button",{onClick:()=>K(null),className:"px-2 py-1 text-xs text-gray-600 hover:bg-gray-100 rounded",children:"Cancel"}),
|
|
21
|
+
/* @__PURE__ */m("button",{onClick:T,disabled:!F.trim(),className:"px-2 py-1 text-xs bg-blue-500 text-white rounded hover:bg-blue-600 disabled:opacity-40",children:"Save"})]})]}),
|
|
22
|
+
/* @__PURE__ */c("div",{className:"flex items-center gap-0.5 px-2 py-1 border-b border-gray-200 bg-white shrink-0 overflow-x-auto",children:[0===E.length&&/* @__PURE__ */m("span",{className:"text-[11px] text-gray-400 italic px-2",children:"No bookmarks yet — star the address bar to add one."}),E.map((e,t)=>/* @__PURE__ */c("button",{onClick:()=>B(e.url),onContextMenu:async o=>{o.preventDefault();await a({title:"Remove bookmark",message:`"${e.label}" will be removed from your bookmarks.`,confirmLabel:"Remove",variant:"danger"})&&X(t)},className:"flex items-center gap-1.5 px-2 py-0.5 rounded text-[12px] text-gray-700 hover:bg-gray-100 whitespace-nowrap",title:`${e.url}\n(right-click to remove)`,children:[
|
|
23
|
+
/* @__PURE__ */m("img",{src:`https://icons.duckduckgo.com/ip3/${new URL(e.url).hostname}.ico`,alt:"",className:"h-3.5 w-3.5",onError:e=>{e.target.style.visibility="hidden"}}),e.label]},t)),
|
|
24
|
+
/* @__PURE__ */m("div",{className:"flex-1"}),
|
|
25
|
+
/* @__PURE__ */m("button",{onClick:()=>{b(k);try{localStorage.setItem(h,k)}catch{}},className:"px-2 py-0.5 text-[11px] text-gray-500 hover:text-gray-800",title:"Set current page as homepage",children:"Set as home"})]}),
|
|
26
|
+
/* @__PURE__ */m("div",{className:"flex-1 relative min-h-0 bg-gray-50",children:/* @__PURE__ */m(N,{url:k,iframeKey:L,iframeRef:A,openExternal:M,showHelp:I,dismissHelp:()=>O(!1)})})]})}function v(e){try{return new URL(e).hostname.replace(/^www\./,"")}catch{return e}}function N({url:e,iframeKey:t,iframeRef:o,openExternal:r,showHelp:a,dismissHelp:s}){const[u,h]=i(!1);l(()=>{h(!1)},[e]);return function(e){try{const t=new URL(e).hostname.toLowerCase();return k.some(e=>t===e||t.endsWith("."+e))}catch{return!1}}(e)&&!u?/* @__PURE__ */m("div",{className:"absolute inset-0 flex items-center justify-center bg-white p-8",children:/* @__PURE__ */c("div",{className:"max-w-md text-center",children:[
|
|
27
|
+
/* @__PURE__ */m(n,{name:"no-symbol",className:"h-14 w-14 mx-auto text-gray-300 mb-3",strokeWidth:1.2}),
|
|
28
|
+
/* @__PURE__ */c("h3",{className:"text-base font-semibold text-gray-800 mb-1",children:[v(e)," can't be embedded"]}),
|
|
29
|
+
/* @__PURE__ */c("p",{className:"text-sm text-gray-500 mb-4",children:["This site sends an ",
|
|
30
|
+
/* @__PURE__ */m("span",{className:"font-mono text-xs",children:"X-Frame-Options"})," ","or ",
|
|
31
|
+
/* @__PURE__ */m("span",{className:"font-mono text-xs",children:"Content-Security-Policy"})," header that refuses iframe embedding. The browser blocks the load before our app can do anything about it."]}),
|
|
32
|
+
/* @__PURE__ */c("div",{className:"flex flex-col items-center gap-2",children:[
|
|
33
|
+
/* @__PURE__ */c("button",{onClick:r,className:"px-4 py-2 bg-blue-500 text-white text-sm rounded hover:bg-blue-600 inline-flex items-center gap-2",children:[
|
|
34
|
+
/* @__PURE__ */m(n,{name:"external",className:"h-4 w-4",strokeWidth:1.5}),"Open in a new tab"]}),
|
|
35
|
+
/* @__PURE__ */m("button",{onClick:()=>h(!0),className:"text-xs text-gray-500 hover:text-gray-800 underline",children:"Try loading it here anyway"})]})]})}):/* @__PURE__ */c(d,{children:[
|
|
36
|
+
/* @__PURE__ */m("iframe",{ref:o,src:e,className:"absolute inset-0 w-full h-full bg-white",sandbox:"allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-modals",referrerPolicy:"no-referrer-when-downgrade"},t+e),a&&/* @__PURE__ */c("div",{className:"absolute top-2 right-2 max-w-sm bg-white border border-gray-200 rounded-md shadow-lg p-3 text-xs text-gray-700 z-10",children:[
|
|
37
|
+
/* @__PURE__ */m("div",{className:"font-medium text-gray-900 mb-1",children:"Why is this page blank?"}),
|
|
38
|
+
/* @__PURE__ */c("p",{className:"mb-2",children:["Most major sites (Google, GitHub, banks, news) refuse to be embedded in an iframe via ",
|
|
39
|
+
/* @__PURE__ */m("span",{className:"font-mono",children:"X-Frame-Options"})," or Content Security Policy. There's no workaround — the browser blocks the load before our app can do anything."]}),
|
|
40
|
+
/* @__PURE__ */c("p",{children:["Hit the ",
|
|
41
|
+
/* @__PURE__ */m("span",{className:"font-medium",children:"↗"})," button to open the page in a real new tab. Sites that ",
|
|
42
|
+
/* @__PURE__ */m("em",{children:"do"})," allow embedding (Wikipedia, DevDocs, your own apps) work fine in here."]}),
|
|
43
|
+
/* @__PURE__ */m("button",{onClick:s,className:"mt-2 text-[11px] text-blue-600 hover:underline",children:"Got it"})]})]})}export{y as default};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-XO2AMGVU.js";import{useWidgetSettings as n}from"./chunk-QJHWLDEN.js";import"./chunk-DSSLOQDW.js";import"./chunk-I2H2CKID.js";import"./chunk-HQLAISFX.js";import"./chunk-5A7MWTXX.js";import"./chunk-S3LGKIZ3.js";import"./chunk-DBXZS7OA.js";import"./chunk-ZEIKSMFR.js";import"./chunk-UVBK6YSR.js";import"./chunk-7IQ3B77H.js";import"./chunk-FIEA5CGB.js";import"./chunk-D65T4H6J.js";import"./chunk-KNUR2UEG.js";import"./chunk-K6DKX55N.js";import"./chunk-C3QOHMR6.js";import{Icon as l}from"./chunk-2SSRFEOZ.js";import{useState as r,useRef as c,useCallback as i,useEffect as a}from"react";import{jsxs as o,Fragment as s,jsx as u}from"react/jsx-runtime";var d="calc_appearance";function h(){const[h,m]=r("0"),[b,k]=r(null),[p,g]=r(null),[y,N]=r(!1),[x,f]=r(""),[v,C]=r([]),[$,j]=r(!1),[S,E]=r(()=>e(d)),[w,A]=r(!1),[D,F]=r(S),I=c(null);n(i(()=>{F({...S}),A(!0)},[S]));const T=i(e=>{f(""),m(t=>y||"0"===t?(N(!1),"."===e?"0.":e):"."===e&&t.includes(".")?t:t+e)},[y]),W=i(()=>{m("0"),k(null),g(null),N(!1)},[]),B=i((e,t,n)=>{switch(n){case"+":return e+t;case"-":return e-t;case"×":return e*t;case"÷":return 0===t?0:e/t;default:return t}},[]),K=i(e=>{const t=parseFloat(h);if(null!==b&&p&&!y){const e=B(b,t,p);m(String(e)),k(e),C(n=>[`${b} ${p} ${t} = ${e}`,...n].slice(0,20))}else k(t);g(e),N(!0)},[h,b,p,y,B]),L=i(()=>{if(null===b||!p)return;const e=parseFloat(h),t=B(b,e,p),n=`${b} ${p} ${e} =`;C(e=>[`${n} ${t}`,...e].slice(0,20)),f(n),m(String(t)),k(null),g(null),N(!0)},[h,b,p,B]),O=i(()=>{m(e=>String(parseFloat(e)/100))},[]),X=i(()=>{m(e=>e.startsWith("-")?e.slice(1):"0"===e?e:"-"+e)},[]);a(()=>{const e=e=>{const t=e.target.tagName;"INPUT"!==t&&"TEXTAREA"!==t&&"SELECT"!==t&&(e.key>="0"&&e.key<="9"?T(e.key):"."===e.key?T("."):"+"===e.key?K("+"):"-"===e.key?K("-"):"*"===e.key?K("×"):"/"===e.key?(e.preventDefault(),K("÷")):"Enter"===e.key||"="===e.key?("Enter"===e.key&&e.target instanceof Node&&I.current?.contains(e.target)&&e.preventDefault(),L()):"Escape"===e.key?W():"Backspace"===e.key?m(e=>e.length>1?e.slice(0,-1):"0"):"%"===e.key&&O())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[T,K,L,W,O]);const H="flex items-center justify-center rounded-lg text-sm font-medium transition-colors",R=`${H} bg-white border border-gray-200 text-gray-900 hover:bg-gray-50 active:bg-gray-100`,M=`${H} bg-blue-50 border border-blue-200 text-blue-700 hover:bg-blue-100 active:bg-blue-200`,Q=`${H} bg-gray-100 border border-gray-200 text-gray-600 hover:bg-gray-200 active:bg-gray-300`,U=`${H} bg-blue-600 text-white hover:bg-blue-700 active:bg-blue-800`;/* @__PURE__ */
|
|
2
|
+
return o(s,{children:[
|
|
3
|
+
/* @__PURE__ */o("div",{ref:I,className:"flex flex-col h-full",style:{opacity:S.activeOpacity/100,backdropFilter:S.activeBlur>0?`blur(${S.activeBlur}px)`:void 0},children:[
|
|
4
|
+
/* @__PURE__ */o("div",{className:"bg-slate-200 rounded-t-lg px-4 py-2 group/display relative flex flex-col justify-end min-h-[120px] border-b border-slate-300",children:[
|
|
5
|
+
/* @__PURE__ */u("div",{className:"flex flex-col justify-end flex-1 overflow-hidden",children:v.slice(0,3).reverse().map((e,t)=>/* @__PURE__ */u("div",{className:"text-[11px] text-slate-400 text-right font-mono truncate",children:e},t))}),(x||p&&null!==b)&&/* @__PURE__ */u("div",{className:"text-base text-slate-600 text-right font-mono",children:x||`${b} ${p} ${y?"":h}`}),
|
|
6
|
+
/* @__PURE__ */o("div",{className:"flex items-center gap-2",children:[
|
|
7
|
+
/* @__PURE__ */u("button",{onClick:()=>{navigator.clipboard.writeText(h),j(!0),setTimeout(()=>j(!1),1200)},title:"Copy result",className:"shrink-0 text-slate-300 hover:text-slate-500 transition-colors opacity-0 group-hover/display:opacity-100",children:/* @__PURE__ */u(l,$?{name:"check",className:"h-5 w-5 text-green-500",strokeWidth:2}:{name:"copy",className:"h-5 w-5",strokeWidth:2})}),
|
|
8
|
+
/* @__PURE__ */u("div",{className:"text-right text-4xl font-mono font-bold text-slate-800 truncate flex-1",children:(e=>{const t=parseFloat(e);return isNaN(t)||e.endsWith(".")||e.endsWith(".0")||Math.abs(t)<1e15&&e.length<16?e:t.toExponential(6)})(h)})]})]}),
|
|
9
|
+
/* @__PURE__ */o("div",{className:"grid grid-cols-4 grid-rows-5 gap-1.5 flex-1 min-h-0 p-2",children:[
|
|
10
|
+
/* @__PURE__ */u("button",{onClick:W,className:Q,children:"AC"}),
|
|
11
|
+
/* @__PURE__ */u("button",{onClick:X,className:Q,children:"+/−"}),
|
|
12
|
+
/* @__PURE__ */u("button",{onClick:O,className:Q,children:"%"}),
|
|
13
|
+
/* @__PURE__ */u("button",{onClick:()=>K("÷"),className:`${M} ${"÷"===p?"ring-2 ring-blue-400":""}`,children:"÷"}),
|
|
14
|
+
/* @__PURE__ */u("button",{onClick:()=>T("7"),className:R,children:"7"}),
|
|
15
|
+
/* @__PURE__ */u("button",{onClick:()=>T("8"),className:R,children:"8"}),
|
|
16
|
+
/* @__PURE__ */u("button",{onClick:()=>T("9"),className:R,children:"9"}),
|
|
17
|
+
/* @__PURE__ */u("button",{onClick:()=>K("×"),className:`${M} ${"×"===p?"ring-2 ring-blue-400":""}`,children:"×"}),
|
|
18
|
+
/* @__PURE__ */u("button",{onClick:()=>T("4"),className:R,children:"4"}),
|
|
19
|
+
/* @__PURE__ */u("button",{onClick:()=>T("5"),className:R,children:"5"}),
|
|
20
|
+
/* @__PURE__ */u("button",{onClick:()=>T("6"),className:R,children:"6"}),
|
|
21
|
+
/* @__PURE__ */u("button",{onClick:()=>K("-"),className:`${M} ${"-"===p?"ring-2 ring-blue-400":""}`,children:"−"}),
|
|
22
|
+
/* @__PURE__ */u("button",{onClick:()=>T("1"),className:R,children:"1"}),
|
|
23
|
+
/* @__PURE__ */u("button",{onClick:()=>T("2"),className:R,children:"2"}),
|
|
24
|
+
/* @__PURE__ */u("button",{onClick:()=>T("3"),className:R,children:"3"}),
|
|
25
|
+
/* @__PURE__ */u("button",{onClick:()=>K("+"),className:`${M} ${"+"===p?"ring-2 ring-blue-400":""}`,children:"+"}),
|
|
26
|
+
/* @__PURE__ */u("button",{onClick:()=>T("0"),className:`${R} col-span-2`,children:"0"}),
|
|
27
|
+
/* @__PURE__ */u("button",{onClick:()=>T("."),className:R,children:"."}),
|
|
28
|
+
/* @__PURE__ */u("button",{onClick:L,className:U,children:"="})]})]}),
|
|
29
|
+
/* @__PURE__ */u(t,{open:w,onClose:()=>A(!1),title:"Calculator Settings",appearance:D,onAppearanceChange:F,onSave:()=>{E(D),localStorage.setItem(d,JSON.stringify(D)),A(!1)}})]})}export{h as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{ConfirmProvider,confirm,confirmDestructive,prompt,useConfirm}from"./chunk-DBXZS7OA.js";import"./chunk-UVBK6YSR.js";import"./chunk-FIEA5CGB.js";import"./chunk-K6DKX55N.js";import"./chunk-C3QOHMR6.js";import"./chunk-2SSRFEOZ.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-
|
|
1
|
+
import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-XO2AMGVU.js";import{useWidgetSettings as r}from"./chunk-QJHWLDEN.js";import"./chunk-DSSLOQDW.js";import"./chunk-I2H2CKID.js";import"./chunk-HQLAISFX.js";import"./chunk-5A7MWTXX.js";import"./chunk-S3LGKIZ3.js";import"./chunk-DBXZS7OA.js";import"./chunk-ZEIKSMFR.js";import"./chunk-UVBK6YSR.js";import"./chunk-7IQ3B77H.js";import"./chunk-FIEA5CGB.js";import"./chunk-D65T4H6J.js";import"./chunk-KNUR2UEG.js";import"./chunk-K6DKX55N.js";import"./chunk-C3QOHMR6.js";import"./chunk-2SSRFEOZ.js";import{useState as n,useCallback as a,useEffect as s}from"react";import{jsxs as c,Fragment as o,jsx as i}from"react/jsx-runtime";var l=["USD","CNY","AUD","GBP","EUR","JPY","CAD","THB","NZD","SGD","HKD","CHF","KRW","INR","MXN","BRL"],m=[["USD","CNY"],["USD","AUD"],["GBP","USD"],["USD","JPY"]],u="currency_pairs",p="currency_appearance",d="currency_rates_cache";function h(e){try{const t=JSON.parse(localStorage.getItem(d)||"{}")[e];if(t&&Date.now()-t.timestamp<36e5)return t.rates}catch{}return null}function g(e,t){try{const r=JSON.parse(localStorage.getItem(d)||"{}");r[e]={rates:t,timestamp:Date.now()},localStorage.setItem(d,JSON.stringify(r))}catch{}}function x(){try{const e=JSON.parse(localStorage.getItem(u)||"");if(Array.isArray(e)&&e.length)return e.slice(0,4)}catch{}return m}var y={USD:"🇺🇸",CNY:"🇨🇳",AUD:"🇦🇺",GBP:"🇬🇧",JPY:"🇯🇵",CAD:"🇨🇦",EUR:"🇪🇺",THB:"🇹🇭",NZD:"🇳🇿",SGD:"🇸🇬",HKD:"🇭🇰",CHF:"🇨🇭",KRW:"🇰🇷",INR:"🇮🇳",MXN:"🇲🇽",BRL:"🇧🇷"};function f(){const[m,d]=n(x),[f,N]=n(()=>e(p)),[b,S]=n({}),[v,D]=n(!1),[k,j]=n(!1),[C,I]=n([]),[U,A]=n(f),[B,O]=n("USD"),[R,H]=n("CNY");r(a(()=>{I([...m]),A({...f}),j(!0)},[m,f])),s(()=>{const e=[...new Set(m.map(([e])=>e))];let t=!0;return async function(){D(!0);const r={};for(const t of e){const e=h(t);if(e)r[t]=e;else try{const e=await fetch(`https://open.er-api.com/v6/latest/${t}`),n=await e.json();n.rates&&(r[t]=n.rates,g(t,n.rates))}catch{}}t&&(S(r),D(!1))}(),()=>{t=!1}},[m]);/* @__PURE__ */
|
|
2
2
|
return c(o,{children:[
|
|
3
3
|
/* @__PURE__ */i("div",{style:{backgroundColor:`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${f.activeOpacity/100})`,backdropFilter:f.activeBlur>0?`blur(${f.activeBlur}px)`:void 0},children:/* @__PURE__ */c("div",{className:"px-4 py-3 space-y-1",children:[v&&/* @__PURE__ */i("div",{className:"text-xs text-gray-400 text-center py-4",children:"Loading rates..."}),m.map(([e,t],r)=>{const n=b[e]?.[t];/* @__PURE__ */
|
|
4
4
|
return c("button",{onClick:()=>{const e=m.map((e,t)=>t===r?[e[1],e[0]]:e);d(e),localStorage.setItem(u,JSON.stringify(e))},className:"flex items-center justify-between px-2 py-2 border-b border-gray-200 last:border-0 w-full hover:bg-gray-100 rounded transition-colors cursor-pointer",children:[
|
|
@@ -9,13 +9,13 @@ return c("button",{onClick:()=>{const e=m.map((e,t)=>t===r?[e[1],e[0]]:e);d(e),l
|
|
|
9
9
|
/* @__PURE__ */i("span",{className:"text-base",children:y[t]||""}),
|
|
10
10
|
/* @__PURE__ */i("span",{className:"text-sm font-semibold text-gray-700",children:t})]}),
|
|
11
11
|
/* @__PURE__ */i("div",{className:"text-base font-mono font-semibold text-gray-900 tabular-nums",children:null!=n?n.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:4}):"—"})]},`${e}-${t}-${r}`)})]})}),
|
|
12
|
-
/* @__PURE__ */i(t,{open:
|
|
12
|
+
/* @__PURE__ */i(t,{open:k,onClose:()=>j(!1),title:"Currency Settings",appearance:U,onAppearanceChange:A,onSave:()=>{if(0===C.length)return;const e=C.slice(0,4);d(e),N(U),localStorage.setItem(u,JSON.stringify(e)),localStorage.setItem(p,JSON.stringify(U)),j(!1)},children:/* @__PURE__ */c("div",{children:[
|
|
13
13
|
/* @__PURE__ */c("h3",{className:"text-sm font-semibold text-gray-700 mb-2",children:["Currency Pairs ",
|
|
14
|
-
/* @__PURE__ */c("span",{className:"text-[11px] font-normal text-gray-400",children:["(",
|
|
15
|
-
/* @__PURE__ */i("div",{className:"space-y-1 mb-2",children:
|
|
14
|
+
/* @__PURE__ */c("span",{className:"text-[11px] font-normal text-gray-400",children:["(",C.length,"/",4,")"]})]}),
|
|
15
|
+
/* @__PURE__ */i("div",{className:"space-y-1 mb-2",children:C.map(([e,t],r)=>/* @__PURE__ */c("div",{className:"flex items-center justify-between py-1 px-2 bg-gray-50 rounded",children:[
|
|
16
16
|
/* @__PURE__ */c("span",{className:"text-sm",children:[y[e]||""," ",e," → ",y[t]||""," ",t]}),
|
|
17
|
-
/* @__PURE__ */i("button",{onClick:()=>
|
|
18
|
-
/* @__PURE__ */i("select",{value:
|
|
17
|
+
/* @__PURE__ */i("button",{onClick:()=>I(e=>e.filter((e,t)=>t!==r)),className:"text-red-400 hover:text-red-600",children:"×"})]},r))}),C.length<4?/* @__PURE__ */c("div",{className:"flex items-center gap-2",children:[
|
|
18
|
+
/* @__PURE__ */i("select",{value:B,onChange:e=>O(e.target.value),className:"bg-gray-50 border border-gray-200 rounded px-2 py-1 text-sm focus:outline-none focus:ring-1 focus:ring-blue-500",children:l.map(e=>/* @__PURE__ */i("option",{children:e},e))}),
|
|
19
19
|
/* @__PURE__ */i("span",{className:"text-gray-400",children:"→"}),
|
|
20
|
-
/* @__PURE__ */i("select",{value:
|
|
21
|
-
/* @__PURE__ */i("button",{onClick:()=>{
|
|
20
|
+
/* @__PURE__ */i("select",{value:R,onChange:e=>H(e.target.value),className:"bg-gray-50 border border-gray-200 rounded px-2 py-1 text-sm focus:outline-none focus:ring-1 focus:ring-blue-500",children:l.map(e=>/* @__PURE__ */i("option",{children:e},e))}),
|
|
21
|
+
/* @__PURE__ */i("button",{onClick:()=>{B!==R&&C.length<4&&I(e=>[...e,[B,R]])},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 ",4," pairs — remove one to add another."]})]})})]})}export{f as default};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import{escapeHtml as e}from"./chunk-BR22X7E5.js";import{AboutApp as t}from"./chunk-5MDQNFOG.js";import{WindowTitle as n}from"./chunk-QJHWLDEN.js";import"./chunk-DSSLOQDW.js";import"./chunk-I2H2CKID.js";import{toast_default as r}from"./chunk-GJ37JCC2.js";import"./chunk-HQLAISFX.js";import"./chunk-5A7MWTXX.js";import"./chunk-S3LGKIZ3.js";import"./chunk-DBXZS7OA.js";import{PopupMenu as o,PopupMenuLabel as l,PopupMenuItem as a,PopupMenuDivider as i}from"./chunk-ZEIKSMFR.js";import"./chunk-UVBK6YSR.js";import"./chunk-7IQ3B77H.js";import"./chunk-FIEA5CGB.js";import"./chunk-D65T4H6J.js";import"./chunk-SBF5A6XV.js";import"./chunk-KNUR2UEG.js";import"./chunk-K6DKX55N.js";import"./chunk-C3QOHMR6.js";import{Icon as s}from"./chunk-2SSRFEOZ.js";import{useState as c,useRef as d}from"react";import{jsxs as m,jsx as h}from"react/jsx-runtime";var u=/* @__PURE__ */new Set(["txt","md","markdown","csv","tsv","log","json","xml","html","htm","css","js","jsx","ts","tsx","py","rb","go","rs","java","c","h","cpp","hpp","sh","bash","yml","yaml","toml","ini","conf","env","sql"]),p=/* @__PURE__ */new Set(["docx"]),g={filename:"Untitled",kind:"docx",content:"",ext:"docx"};function x(){const[x,f]=c(g),[y,v]=c(!1),[b,k]=c(!1),[w,N]=c(!1),[C,D]=c(null),j=d(null),L=d(null),M=d(null),R=(e,t)=>{M.current?.focus(),document.execCommand(e,!1,t),N(!0)},U=e=>{for(const t of e){if(!t.type.startsWith("image/"))continue;const e=new FileReader;e.onload=()=>{M.current?.focus(),document.execCommand("insertImage",!1,String(e.result)),N(!0)},e.readAsDataURL(t)}},S=e=>{C&&(C.el.removeAttribute("width"),C.el.removeAttribute("height"),C.el.style.width=e??"",C.el.style.height=e?"auto":"",N(!0),D(null))},B=async t=>{const n=(t.name.split(".").pop()||"").toLowerCase();v(!0);try{if(u.has(n)||!p.has(n)&&t.type.startsWith("text/")){const r=await t.text(),o=e(r).replace(/\n/g,"<br>");f({filename:t.name,kind:"text",content:o,ext:n}),N(!1)}else if(p.has(n))try{const e=await(import(
|
|
2
|
+
/* @vite-ignore */
|
|
3
|
+
"mammoth")),r=await t.arrayBuffer(),o=await e.convertToHtml({arrayBuffer:r});f({filename:t.name,kind:"docx",content:o.value||"<p><em>(empty document)</em></p>",ext:n}),N(!1)}catch(e){r.error('Install the optional "mammoth" peer dep to read .docx files.')}else"doc"===n?r.error(".doc is the legacy Word binary format — convert to .docx first."):r.error(`Unsupported file type: .${n||"unknown"}`)}finally{v(!1)}},I=x?.filename?(O=x.filename).length>24?`${O.slice(0,23)}…`:O:"Untitled";var O;/* @__PURE__ */
|
|
4
|
+
return m("div",{className:"relative flex flex-col h-full",onDragOver:e=>{e.preventDefault(),b||k(!0)},onDragLeave:e=>{e.currentTarget===e.target&&k(!1)},onDrop:e=>{e.preventDefault(),k(!1);const t=Array.from(e.dataTransfer.files??[]);0!==t.length&&(t.every(e=>e.type.startsWith("image/"))?U(t):B(t[0]))},children:[
|
|
5
|
+
/* @__PURE__ */h(n,{title:`${I}${w?" •":""} - Documents`}),
|
|
6
|
+
/* @__PURE__ */h(t,{app:"documents"}),
|
|
7
|
+
/* @__PURE__ */m("div",{className:"flex items-center flex-wrap gap-x-2 gap-y-1 px-3 py-2 border-b border-gray-200 bg-gray-50 shrink-0",children:[
|
|
8
|
+
/* @__PURE__ */h("input",{ref:j,type:"file",accept:".txt,.md,.csv,.tsv,.log,.json,.xml,.html,.htm,.css,.js,.jsx,.ts,.tsx,.py,.rb,.go,.rs,.java,.c,.h,.cpp,.hpp,.sh,.bash,.yml,.yaml,.toml,.ini,.conf,.env,.sql,.docx,text/*",onChange:e=>{const t=e.target.files?.[0];t&&B(t),j.current&&(j.current.value="")},className:"hidden"}),
|
|
9
|
+
/* @__PURE__ */m("button",{onClick:()=>j.current?.click(),className:"text-xs text-gray-700 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors flex items-center gap-1",children:[
|
|
10
|
+
/* @__PURE__ */h(s,{name:"folder-open",className:"h-3.5 w-3.5",strokeWidth:1.5}),"Open"]}),
|
|
11
|
+
/* @__PURE__ */h("button",{onClick:()=>{if(!x)return;const t=M.current?.innerHTML??"";if("text"===x.kind){if(/<(b|strong|i|em|u|font|span style|ul|ol|img)|style="[^"]*text-align/i.test(t)){const n=new Blob([`<!doctype html><meta charset="utf-8"><title>${e(x.filename)}</title><body style="font-family:ui-monospace,monospace;white-space:pre-wrap">${t}`],{type:"text/html"}),r=URL.createObjectURL(n),o=document.createElement("a");o.href=r,o.download=`${x.filename.replace(/\.[^.]+$/,"")}.html`,o.click(),URL.revokeObjectURL(r)}else{const e=M.current?.innerText??"",t=new Blob([e],{type:"text/plain"}),n=URL.createObjectURL(t),r=document.createElement("a");r.href=n,r.download=x.filename,r.click(),URL.revokeObjectURL(n)}}else{const n=new Blob([`<!doctype html><meta charset="utf-8"><title>${e(x.filename)}</title>${t}`],{type:"text/html"}),r=URL.createObjectURL(n),o=document.createElement("a");o.href=r,o.download=`${x.filename.replace(/\.docx$/i,"")}.html`,o.click(),URL.revokeObjectURL(r)}},className:"text-xs text-gray-700 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"Save"}),
|
|
12
|
+
/* @__PURE__ */h("span",{className:"text-[10px] text-gray-400 ml-1",children:"TXT · DOCX · Code"}),
|
|
13
|
+
/* @__PURE__ */h("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
14
|
+
/* @__PURE__ */m("span",{className:"text-xs font-medium text-gray-700 truncate max-w-[200px]",title:x.filename,children:[x.filename,w?" •":""]}),
|
|
15
|
+
/* @__PURE__ */h("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
16
|
+
/* @__PURE__ */m("div",{className:"flex items-center gap-0.5",children:[
|
|
17
|
+
/* @__PURE__ */h("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("bold"),className:"px-2 py-1 text-xs rounded font-bold text-gray-700 hover:bg-gray-200 transition-colors",title:"Bold",children:"B"}),
|
|
18
|
+
/* @__PURE__ */h("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("italic"),className:"px-2 py-1 text-xs rounded italic text-gray-700 hover:bg-gray-200 transition-colors",title:"Italic",children:"I"}),
|
|
19
|
+
/* @__PURE__ */h("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("underline"),className:"px-2 py-1 text-xs rounded underline text-gray-700 hover:bg-gray-200 transition-colors",title:"Underline",children:"U"}),
|
|
20
|
+
/* @__PURE__ */h("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("strikeThrough"),className:"px-2 py-1 text-xs rounded line-through text-gray-700 hover:bg-gray-200 transition-colors",title:"Strikethrough",children:"S"})]}),
|
|
21
|
+
/* @__PURE__ */h("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
22
|
+
/* @__PURE__ */m("select",{onMouseDown:e=>e.preventDefault(),onChange:e=>{R("fontSize",e.target.value),e.currentTarget.value=""},defaultValue:"",className:"text-xs border border-gray-300 rounded px-1 py-0.5 bg-white",children:[
|
|
23
|
+
/* @__PURE__ */h("option",{value:"",disabled:!0,children:"Size"}),
|
|
24
|
+
/* @__PURE__ */h("option",{value:"1",children:"XS"}),
|
|
25
|
+
/* @__PURE__ */h("option",{value:"2",children:"S"}),
|
|
26
|
+
/* @__PURE__ */h("option",{value:"3",children:"M"}),
|
|
27
|
+
/* @__PURE__ */h("option",{value:"4",children:"L"}),
|
|
28
|
+
/* @__PURE__ */h("option",{value:"5",children:"XL"}),
|
|
29
|
+
/* @__PURE__ */h("option",{value:"6",children:"2XL"})]}),
|
|
30
|
+
/* @__PURE__ */h("input",{type:"color",defaultValue:"#000000",onChange:e=>R("foreColor",e.target.value),className:"w-7 h-6 border border-gray-300 rounded cursor-pointer",title:"Text color"}),
|
|
31
|
+
/* @__PURE__ */h("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
32
|
+
/* @__PURE__ */h("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("insertUnorderedList"),className:"px-2 py-1 text-xs rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Bulleted list",children:"• List"}),
|
|
33
|
+
/* @__PURE__ */h("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("insertOrderedList"),className:"px-2 py-1 text-xs rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Numbered list",children:"1."}),
|
|
34
|
+
/* @__PURE__ */h("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
35
|
+
/* @__PURE__ */m("div",{className:"flex items-center gap-0.5",children:[
|
|
36
|
+
/* @__PURE__ */h("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("justifyLeft"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Align left",children:/* @__PURE__ */h("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */h("path",{strokeLinecap:"round",d:"M3.75 6h16.5M3.75 12h9.75M3.75 18h14.25"})})}),
|
|
37
|
+
/* @__PURE__ */h("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("justifyCenter"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Align center",children:/* @__PURE__ */h("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */h("path",{strokeLinecap:"round",d:"M3.75 6h16.5M7.125 12h9.75M4.875 18h14.25"})})}),
|
|
38
|
+
/* @__PURE__ */h("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("justifyRight"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Align right",children:/* @__PURE__ */h("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */h("path",{strokeLinecap:"round",d:"M3.75 6h16.5M10.5 12h9.75M6 18h14.25"})})}),
|
|
39
|
+
/* @__PURE__ */h("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("justifyFull"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Justify",children:/* @__PURE__ */h("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */h("path",{strokeLinecap:"round",d:"M3.75 6h16.5M3.75 12h16.5M3.75 18h16.5"})})})]}),
|
|
40
|
+
/* @__PURE__ */h("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
41
|
+
/* @__PURE__ */h("input",{ref:L,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&U(Array.from(e.target.files)),L.current&&(L.current.value="")}}),
|
|
42
|
+
/* @__PURE__ */m("button",{onClick:()=>L.current?.click(),className:"px-2 py-1 text-xs rounded text-gray-700 hover:bg-gray-200 transition-colors flex items-center gap-1",title:"Insert image (or paste / drop one)",children:[
|
|
43
|
+
/* @__PURE__ */h(s,{name:"image",className:"h-3.5 w-3.5",strokeWidth:1.5}),"Image"]})]}),
|
|
44
|
+
/* @__PURE__ */h("div",{className:"flex-1 min-h-0 overflow-hidden",children:/* @__PURE__ */h("div",y?{className:"flex items-center justify-center h-full text-sm text-gray-400",children:"Loading…"}:{className:"h-full overflow-auto "+("docx"===x.kind?"bg-gray-100 px-6 py-8":"bg-white"),children:/* @__PURE__ */h("div",{ref:M,contentEditable:!0,suppressContentEditableWarning:!0,spellCheck:!1,onInput:()=>N(!0),onPaste:e=>{const t=Array.from(e.clipboardData?.items??[]).filter(e=>"file"===e.kind&&e.type.startsWith("image/")).map(e=>e.getAsFile()).filter(e=>!!e);t.length&&(e.preventDefault(),U(t))},onClick:e=>{const t=e.target;"IMG"===t.tagName&&(e.preventDefault(),D({x:e.clientX,y:e.clientY,el:t}))},dangerouslySetInnerHTML:{__html:x.content},className:"docx"===x.kind?"docs-editor mx-auto w-[8.5in] min-h-[11in] bg-white p-[1in] shadow text-[14px] leading-relaxed text-gray-800 outline-none focus:ring-2 focus:ring-blue-400/40":"docs-editor block w-full min-h-full p-4 font-mono text-[13px] leading-relaxed text-gray-800 bg-white outline-none whitespace-pre-wrap"})})}),b&&/* @__PURE__ */h("div",{className:"absolute inset-0 bg-blue-500/15 border-4 border-dashed border-blue-500 pointer-events-none flex items-center justify-center z-20",children:/* @__PURE__ */h("div",{className:"px-4 py-2 rounded-md bg-blue-600 text-white text-sm font-medium shadow-lg",children:"Drop a document to open · images insert into the page"})}),C&&/* @__PURE__ */m(o,{minWidth:150,style:{left:C.x,top:C.y},onClose:()=>D(null),children:[
|
|
45
|
+
/* @__PURE__ */h(l,{children:"Image width"}),
|
|
46
|
+
/* @__PURE__ */h(a,{onClick:()=>S("25%"),children:"25%"}),
|
|
47
|
+
/* @__PURE__ */h(a,{onClick:()=>S("50%"),children:"50%"}),
|
|
48
|
+
/* @__PURE__ */h(a,{onClick:()=>S("75%"),children:"75%"}),
|
|
49
|
+
/* @__PURE__ */h(a,{onClick:()=>S("100%"),children:"100%"}),
|
|
50
|
+
/* @__PURE__ */h(a,{onClick:()=>S(null),children:"Original size"}),
|
|
51
|
+
/* @__PURE__ */h(i,{}),
|
|
52
|
+
/* @__PURE__ */h(a,{danger:!0,onClick:()=>{C?.el.remove(),N(!0),D(null)},children:"Remove image"})]})]})}export{x as default};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import{openPreviewFile as e}from"./chunk-4JZZLUGG.js";import{Breadcrumbs as t}from"./chunk-Q5O5UMJY.js";import{SidebarLayout as a}from"./chunk-5LUN632W.js";import{getFilesDemoTree as r}from"./chunk-MORDXCV6.js";import{AboutApp as n}from"./chunk-5MDQNFOG.js";import{peekFilesViewRequest as i,consumeFilesViewRequest as s,FILES_SHOW_TRASH_EVENT as l,FILES_OPEN_DESKTOP_FOLDER_EVENT as o,subscribeDesktopFolders as d,getDesktopFoldersSnapshot as c,FolderGlyph as m,DesktopItemMiniIcon as h,desktopItemTypeLabel as p}from"./chunk-VR6TR575.js";import"./chunk-ESL5TDNA.js";import"./chunk-VTVSMRFX.js";import{useWindowManager as u,WindowTitle as f}from"./chunk-QJHWLDEN.js";import"./chunk-DSSLOQDW.js";import"./chunk-I2H2CKID.js";import{toast_default as x}from"./chunk-GJ37JCC2.js";import"./chunk-HQLAISFX.js";import"./chunk-5A7MWTXX.js";import"./chunk-S3LGKIZ3.js";import{confirm as g,prompt as y}from"./chunk-DBXZS7OA.js";import"./chunk-ZEIKSMFR.js";import"./chunk-UVBK6YSR.js";import"./chunk-7IQ3B77H.js";import"./chunk-FIEA5CGB.js";import"./chunk-D65T4H6J.js";import"./chunk-SBF5A6XV.js";import"./chunk-KNUR2UEG.js";import{formatBytes as b}from"./chunk-W32SKK3D.js";import"./chunk-K6DKX55N.js";import"./chunk-C3QOHMR6.js";import{Icon as k}from"./chunk-2SSRFEOZ.js";import{useState as N,useEffect as w,useSyncExternalStore as v,useRef as j,useCallback as C}from"react";import{jsxs as $,jsx as D,Fragment as L}from"react/jsx-runtime";var E="undefined"!=typeof window&&window.__REACT_OS_SHELL_FILE_SERVER__||"http://localhost:4000",T={pdf:"pdf",dxf:"dxf",csv:"csv",jpg:"image",jpeg:"image",png:"image",gif:"image",webp:"image",svg:"image",avif:"image",bmp:"image",stp:"3d",step:"3d",stl:"3d",obj:"3d",gltf:"3d",glb:"3d","3mf":"3d",iges:"3d",igs:"3d",ply:"3d",fbx:"3d"};function R(e,t){return"/"===e||""===e?"/"+t:e.replace(/\/$/,"")+"/"+t}function S(e){if(!e)return"—";try{const t=new Date(e);return isNaN(t.getTime())?"—":t.toLocaleString(void 0,{dateStyle:"short",timeStyle:"short"})}catch{return e}}function F(){const F=E.replace(/\/$/,""),I=null!==r(),[O,W]=N("/"),[M,A]=N([]),[P,U]=N([]),[K,V]=N(null),[B,H]=N(!0),[z,J]=N(!1),[Q,X]=N(null),[_,G]=N(!1),[Z,Y]=N(()=>{const e=i();return"trash"===e?"trash":e?{desktopFolderId:e.folderId}:"files"});w(()=>{s()},[]);const[q,ee]=N([]);w(()=>{const e=()=>{s(),Y("trash")},t=e=>{s();const t=e.detail?.folderId;t&&Y({desktopFolderId:t})};return window.addEventListener(l,e),window.addEventListener(o,t),()=>{window.removeEventListener(l,e),window.removeEventListener(o,t)}},[]);const te=v(d,c,c),ae="object"==typeof Z?Z.desktopFolderId:null,re=ae?te?.folders.find(e=>e.id===ae)??null:null,ne=ae&&te?.itemsByFolder[ae]||[];w(()=>{ae&&te&&!te.folders.some(e=>e.id===ae)&&Y("files")},[ae,te]);const ie=j(0),se=j(null),{openPage:le,openEntity:oe}=u(),de=t=>{"preview-file"===t.entityType&&t.filePath&&t.fileKind?e({filePath:t.filePath,filename:t.label,kind:t.fileKind,onStaged:e=>le(e)}):"page"===t.entityType?le(t.entityId):oe(t.entityType,t.entityId,null,t.label)},ce=C((e,t={})=>fetch(e,{...t,credentials:"include"}),[]),me=C(async()=>{try{const e=await ce(`${F}/api/quota`);if(e.ok){const t=await e.json();X({used:t.used,limit:t.limit})}}catch{}},[ce,F]),he=C(async e=>{if(V(null),I){const t=function(e){const t=r();if(!t)return[];let a=t;for(const t of e.split("/").filter(Boolean)){const e=a.find(e=>"folder"===e.kind&&e.name===t);if(!e||!e.children)return[];a=e.children}return a.map(e=>({name:e.name,kind:e.kind,size:e.size??0,modifiedAt:e.modifiedAt??""}))}(e);return A(t),W(e),J(!1),H(!1),void("/"===e&&U(t.filter(e=>"folder"===e.kind).map(e=>e.name)))}H(!0);try{const t=await ce(`${F}/api/files?path=${encodeURIComponent(e)}`);if(!t.ok){const e=await t.json().catch(()=>({}));return void x.error(e.error||`Failed to list (${t.status})`)}const a=await t.json(),r=a.entries||[];A(r),W(a.path||e),J(!1),"/"===(a.path||e)&&U(r.filter(e=>"folder"===e.kind).map(e=>e.name))}catch(e){J(!0)}finally{H(!1)}me()},[ce,F,me,I]),pe=C(async()=>{if(I)return ee([]),void H(!1);H(!0),V(null);try{const e=await ce(`${F}/api/trash`);if(!e.ok){const t=await e.json().catch(()=>({}));return void x.error(t.error||`Failed to list trash (${e.status})`)}const t=await e.json();ee(t.entries||[]),J(!1)}catch{J(!0)}finally{H(!1)}me()},[ce,F,me,I]);w(()=>{"files"===Z?he(O):"trash"===Z&&pe()},[O,Z]);const ue=async e=>{const t=R(O,e.name);try{const a=await ce(`${F}/api/file?path=${encodeURIComponent(t)}`);if(!a.ok)return void x.error(`Download failed (${a.status})`);const r=await a.blob(),n=URL.createObjectURL(r),i=document.createElement("a");i.href=n,i.download=e.name,i.click(),setTimeout(()=>URL.revokeObjectURL(n),1e3)}catch(e){x.error(e?.message||"Download failed")}},fe=async e=>{const t=Array.from(e);for(const e of t){const t=new FormData;t.append("file",e);try{const a=await ce(`${F}/api/upload?path=${encodeURIComponent(O)}`,{method:"POST",body:t});if(!a.ok){const t=await a.json().catch(()=>({}));if(413===a.status){const a=Math.max(0,(t.limit||0)-(t.used||0));x.error(`Quota exceeded — ${b(a)} free, ${e.name} is ${b(t.attempted||e.size)}`)}else x.error(`Upload ${e.name}: ${t.error||a.status}`)}}catch(t){x.error(`Upload ${e.name}: ${t?.message||"failed"}`)}}he(O)},xe=()=>{ie.current=0,G(!1)};if(w(()=>{const e=()=>xe();return window.addEventListener("dragend",e),window.addEventListener("drop",e),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",e)}},[]),z)/* @__PURE__ */
|
|
2
|
+
return $("div",{className:"flex flex-col h-full bg-white",children:[
|
|
3
|
+
/* @__PURE__ */D(f,{title:"Files - offline"}),
|
|
4
|
+
/* @__PURE__ */D("div",{className:"flex-1 flex items-center justify-center p-8 text-center",children:/* @__PURE__ */$("div",{className:"max-w-md",children:[
|
|
5
|
+
/* @__PURE__ */D(k,{name:"close-circle",className:"h-12 w-12 mx-auto text-gray-300 mb-3",strokeWidth:1.4}),
|
|
6
|
+
/* @__PURE__ */D("h3",{className:"text-base font-semibold text-gray-800 mb-1",children:"Can't reach the file server"}),
|
|
7
|
+
/* @__PURE__ */$("p",{className:"text-sm text-gray-500 mb-3",children:["No response from ",
|
|
8
|
+
/* @__PURE__ */D("span",{className:"font-mono",children:F}),". Make sure the server is running — see ",
|
|
9
|
+
/* @__PURE__ */D("span",{className:"font-mono",children:"examples/file-server/README.md"}),"."]}),
|
|
10
|
+
/* @__PURE__ */D("button",{onClick:()=>he(O),className:"px-3 py-1.5 text-sm bg-blue-500 text-white rounded hover:bg-blue-600",children:"Retry"})]})})]});const ge="/"===O?[]:O.split("/").filter(Boolean),ye=Q&&Q.limit>0?Math.min(100,Math.round(Q.used/Q.limit*100)):0,be=ye>90?"bg-red-500":ye>75?"bg-amber-500":"bg-blue-500",ke=[{label:"My files",onClick:()=>W("/")},...ge.map((e,t)=>({label:e,onClick:()=>W("/"+ge.slice(0,t+1).join("/"))}))],Ne=e=>"flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-sm transition-colors "+(e?"bg-blue-50 font-medium text-blue-700":"text-gray-700 hover:bg-gray-100"),we=e=>/* @__PURE__ */D("svg",{className:"h-4 w-4 shrink-0 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.6,children:/* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:e})}),ve=/* @__PURE__ */$("nav",{className:"p-2",children:[
|
|
11
|
+
/* @__PURE__ */D("div",{className:"px-2 py-1.5 text-[11px] font-semibold uppercase tracking-wide text-gray-400",children:"Locations"}),
|
|
12
|
+
/* @__PURE__ */$("button",{onClick:()=>{Y("files"),W("/")},className:Ne("files"===Z&&"/"===O),children:[we("M2.25 12l8.954-8.955a1.5 1.5 0 012.122 0L21.75 12M4.5 9.75v9.75a.75.75 0 00.75.75H9V15a.75.75 0 01.75-.75h4.5A.75.75 0 0115 15v5.25h3.75a.75.75 0 00.75-.75V9.75"),"My files"]}),P.map(e=>/* @__PURE__ */$("button",{onClick:()=>{Y("files"),W("/"+e)},className:Ne("files"===Z&&O==="/"+e),children:[we("M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"),
|
|
13
|
+
/* @__PURE__ */D("span",{className:"truncate",children:e})]},e)),!I&&/* @__PURE__ */$("button",{onClick:()=>Y("trash"),className:Ne("trash"===Z),children:[we("M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79"),"Trash"]}),te&&te.folders.length>0&&/* @__PURE__ */$(L,{children:[
|
|
14
|
+
/* @__PURE__ */D("div",{className:"px-2 pt-3 pb-1.5 text-[11px] font-semibold uppercase tracking-wide text-gray-400",children:"Desktop"}),te.folders.map(e=>/* @__PURE__ */$("button",{onClick:()=>Y({desktopFolderId:e.id}),className:Ne(ae===e.id),children:[
|
|
15
|
+
/* @__PURE__ */D(m,{className:"h-4 w-4 shrink-0 text-amber-500"}),
|
|
16
|
+
/* @__PURE__ */D("span",{className:"truncate",children:e.name}),e.itemCount>0&&/* @__PURE__ */D("span",{className:"ml-auto text-[10px] text-gray-400 tabular-nums",children:e.itemCount})]},e.id))]})]});/* @__PURE__ */
|
|
17
|
+
return $("div",{className:"relative flex flex-col h-full bg-white",onDragEnter:e=>{I||"object"==typeof Z||e.dataTransfer?.types?.includes?.("Files")&&(e.preventDefault(),ie.current++,_||G(!0))},onDragOver:e=>{e.dataTransfer?.types?.includes?.("Files")&&e.preventDefault()},onDragLeave:()=>{ie.current>0&&ie.current--,0===ie.current&&G(!1)},onDrop:e=>{e.preventDefault(),xe(),I||"object"==typeof Z||e.dataTransfer.files?.length&&fe(e.dataTransfer.files)},children:[
|
|
18
|
+
/* @__PURE__ */D(f,{title:re?`Files - ${re.name}`:"Files"+("/"===O?"":" - "+O)}),
|
|
19
|
+
/* @__PURE__ */D(n,{app:"files"}),
|
|
20
|
+
/* @__PURE__ */D("input",{ref:se,type:"file",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&fe(e.target.files),se.current&&(se.current.value="")}}),
|
|
21
|
+
/* @__PURE__ */D("div",{className:"flex-1 min-h-0",children:/* @__PURE__ */D(a,{sidebar:ve,storageKey:"files.sidebarWidth",defaultWidth:200,minWidth:150,maxWidth:320,children:/* @__PURE__ */$("div",{className:"flex h-full min-w-0 flex-col",children:[
|
|
22
|
+
/* @__PURE__ */$("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b border-gray-200 bg-gray-50 shrink-0 text-xs",children:[/* @__PURE__ */$(L,"files"===Z?{children:[
|
|
23
|
+
/* @__PURE__ */D("button",{onClick:()=>W(function(e){if("/"===e||""===e)return"/";const t=e.replace(/\/$/,""),a=t.lastIndexOf("/");return a<=0?"/":t.slice(0,a)}(O)),disabled:"/"===O,className:"px-2 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-600",title:"Parent folder",children:/* @__PURE__ */D(k,{name:"arrow-left",className:"h-3.5 w-3.5",strokeWidth:2})}),
|
|
24
|
+
/* @__PURE__ */D("div",{className:"flex-1 min-w-0",children:/* @__PURE__ */D(t,{items:ke,maxItems:5})}),
|
|
25
|
+
/* @__PURE__ */D("button",{onClick:()=>he(O),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Refresh",children:/* @__PURE__ */D(k,{name:"refresh",className:"h-3.5 w-3.5",strokeWidth:1.8})}),!I&&/* @__PURE__ */$(L,{children:[
|
|
26
|
+
/* @__PURE__ */$("button",{onClick:()=>Y("trash"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600 flex items-center gap-1",title:"Open trash",children:[
|
|
27
|
+
/* @__PURE__ */D(k,{name:"trash",className:"h-3.5 w-3.5",strokeWidth:1.5}),"Trash"]}),
|
|
28
|
+
/* @__PURE__ */$("button",{onClick:async()=>{const e=await y({title:"New folder",placeholder:"Folder name",confirmLabel:"Create"});if(!e)return;if(/[\\/]/.test(e))return void x.error("Folder names cannot contain slashes");const t=R(O,e),a=await ce(`${F}/api/folder`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});if(!a.ok){const e=await a.json().catch(()=>({}));return void x.error(e.error||`Create folder failed (${a.status})`)}he(O)},className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600 flex items-center gap-1",children:[
|
|
29
|
+
/* @__PURE__ */D(k,{name:"folder-plus",className:"h-3.5 w-3.5",strokeWidth:1.5}),"New Folder"]}),
|
|
30
|
+
/* @__PURE__ */$("button",{onClick:()=>se.current?.click(),className:"px-2 py-1 rounded bg-blue-500 text-white hover:bg-blue-600 flex items-center gap-1",children:[
|
|
31
|
+
/* @__PURE__ */D(k,{name:"upload",className:"h-3.5 w-3.5",strokeWidth:1.8}),"Upload"]})]})]}:"trash"===Z?{children:[
|
|
32
|
+
/* @__PURE__ */D("button",{onClick:()=>Y("files"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Back to files",children:/* @__PURE__ */D(k,{name:"arrow-left",className:"h-3.5 w-3.5",strokeWidth:2})}),
|
|
33
|
+
/* @__PURE__ */D("span",{className:"flex-1 text-gray-700 font-medium px-2",children:"Trash"}),
|
|
34
|
+
/* @__PURE__ */D("button",{onClick:pe,className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Refresh",children:/* @__PURE__ */D(k,{name:"refresh",className:"h-3.5 w-3.5",strokeWidth:1.8})}),
|
|
35
|
+
/* @__PURE__ */D("button",{onClick:async()=>{if(0===q.length)return;if(!await g({title:"Empty trash",message:`${q.length} item${1===q.length?"":"s"} will be permanently removed. This can't be undone.`,confirmLabel:"Empty trash",variant:"danger"}))return;const e=await ce(`${F}/api/trash`,{method:"DELETE"});if(!e.ok){const t=await e.json().catch(()=>({}));return void x.error(t.error||`Empty trash failed (${e.status})`)}pe()},disabled:0===q.length,className:"px-2 py-1 rounded text-red-600 hover:bg-red-50 disabled:opacity-30 flex items-center gap-1",children:"Empty trash"})]}:{children:[
|
|
36
|
+
/* @__PURE__ */D("button",{onClick:()=>Y("files"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Back to files",children:/* @__PURE__ */D(k,{name:"arrow-left",className:"h-3.5 w-3.5",strokeWidth:2})}),
|
|
37
|
+
/* @__PURE__ */D(m,{className:"h-4 w-4 text-amber-500 ml-1"}),
|
|
38
|
+
/* @__PURE__ */D("span",{className:"flex-1 text-gray-700 font-medium px-1 truncate",children:re?.name??"Desktop folder"}),
|
|
39
|
+
/* @__PURE__ */D("span",{className:"text-[10px] text-gray-400 px-2",children:"Desktop shortcuts"})]}),Q&&/* @__PURE__ */$(L,{children:[
|
|
40
|
+
/* @__PURE__ */D("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
41
|
+
/* @__PURE__ */$("div",{className:"flex items-center gap-1.5",title:`${b(Q.used)} of ${b(Q.limit)} used`,children:[
|
|
42
|
+
/* @__PURE__ */D("div",{className:"w-20 h-1.5 rounded-full bg-gray-200 overflow-hidden",children:/* @__PURE__ */D("div",{className:`h-full ${be} transition-all`,style:{width:`${ye}%`}})}),
|
|
43
|
+
/* @__PURE__ */$("span",{className:"text-[10px] text-gray-500 tabular-nums whitespace-nowrap",children:[b(Q.used)," / ",b(Q.limit)]})]})]})]}),
|
|
44
|
+
/* @__PURE__ */D("div",{className:"flex-1 overflow-auto",children:"object"==typeof Z?0===ne.length?/* @__PURE__ */D("div",{className:"p-10 text-center text-sm text-gray-400",children:"This desktop folder is empty. Drag shortcuts onto it on the desktop."}):/* @__PURE__ */$("table",{className:"w-full text-sm",children:[
|
|
45
|
+
/* @__PURE__ */D("thead",{className:"bg-gray-50 text-[11px] uppercase tracking-wide text-gray-500",children:/* @__PURE__ */$("tr",{children:[
|
|
46
|
+
/* @__PURE__ */D("th",{className:"text-left font-medium px-3 py-1.5",children:"Name"}),
|
|
47
|
+
/* @__PURE__ */D("th",{className:"text-left font-medium px-3 py-1.5 w-28",children:"Type"}),
|
|
48
|
+
/* @__PURE__ */D("th",{className:"w-56"})]})}),
|
|
49
|
+
/* @__PURE__ */D("tbody",{children:ne.map(e=>{const t=`${e.entityType}|${e.entityId}`;/* @__PURE__ */
|
|
50
|
+
return $("tr",{onClick:()=>V(t),onDoubleClick:()=>de(e),className:"cursor-default border-b border-gray-100 "+(K===t?"bg-blue-50":"hover:bg-gray-50"),children:[
|
|
51
|
+
/* @__PURE__ */$("td",{className:"px-3 py-1.5 flex items-center gap-2",children:[
|
|
52
|
+
/* @__PURE__ */D(h,{item:e}),
|
|
53
|
+
/* @__PURE__ */D("span",{className:"truncate",title:e.label,children:e.label})]}),
|
|
54
|
+
/* @__PURE__ */D("td",{className:"px-3 py-1.5 text-xs text-gray-500",children:p(e)}),
|
|
55
|
+
/* @__PURE__ */$("td",{className:"px-3 py-1.5 text-right whitespace-nowrap",children:[
|
|
56
|
+
/* @__PURE__ */D("button",{onClick:t=>{t.stopPropagation(),de(e)},className:"px-1.5 py-0.5 rounded hover:bg-gray-200 text-blue-600 text-[11px]",children:"Open"}),
|
|
57
|
+
/* @__PURE__ */D("button",{onClick:t=>{t.stopPropagation(),te?.moveToDesktop([e])},className:"px-1.5 py-0.5 rounded hover:bg-gray-200 text-gray-500 text-[11px] ml-1",children:"Move to desktop"}),
|
|
58
|
+
/* @__PURE__ */D("button",{onClick:t=>{t.stopPropagation(),te?.removeShortcuts([e])},className:"px-1.5 py-0.5 rounded hover:bg-red-100 text-red-600 text-[11px] ml-1",children:"Remove"})]})]},t)})})]}):"trash"===Z?B&&0===q.length?/* @__PURE__ */D("div",{className:"p-6 text-center text-sm text-gray-400",children:"Loading…"}):0===q.length?/* @__PURE__ */D("div",{className:"p-10 text-center text-sm text-gray-400",children:"Trash is empty."}):/* @__PURE__ */$("table",{className:"w-full text-sm",children:[
|
|
59
|
+
/* @__PURE__ */D("thead",{className:"bg-gray-50 text-[11px] uppercase tracking-wide text-gray-500",children:/* @__PURE__ */$("tr",{children:[
|
|
60
|
+
/* @__PURE__ */D("th",{className:"text-left font-medium px-3 py-1.5",children:"Name"}),
|
|
61
|
+
/* @__PURE__ */D("th",{className:"text-left font-medium px-3 py-1.5",children:"Original location"}),
|
|
62
|
+
/* @__PURE__ */D("th",{className:"text-right font-medium px-3 py-1.5 w-24",children:"Size"}),
|
|
63
|
+
/* @__PURE__ */D("th",{className:"text-right font-medium px-3 py-1.5 w-40",children:"Deleted"}),
|
|
64
|
+
/* @__PURE__ */D("th",{className:"w-44"})]})}),
|
|
65
|
+
/* @__PURE__ */D("tbody",{children:q.map(e=>/* @__PURE__ */$("tr",{className:"border-b border-gray-100 hover:bg-gray-50",children:[
|
|
66
|
+
/* @__PURE__ */$("td",{className:"px-3 py-1.5 flex items-center gap-2",children:["folder"===e.kind?/* @__PURE__ */D(k,{name:"folder",look:"solid",className:"h-4 w-4 text-amber-500 shrink-0"}):/* @__PURE__ */D(k,{name:"page",className:"h-4 w-4 text-gray-400 shrink-0",strokeWidth:1.5}),
|
|
67
|
+
/* @__PURE__ */D("span",{className:"truncate",title:e.name,children:e.name})]}),
|
|
68
|
+
/* @__PURE__ */D("td",{className:"px-3 py-1.5 text-gray-500 text-xs font-mono truncate",title:e.originalPath,children:e.originalPath||"—"}),
|
|
69
|
+
/* @__PURE__ */D("td",{className:"px-3 py-1.5 text-right tabular-nums text-gray-500",children:b(e.size)}),
|
|
70
|
+
/* @__PURE__ */D("td",{className:"px-3 py-1.5 text-right text-gray-500 tabular-nums",children:e.deletedAt?S(e.deletedAt):"—"}),
|
|
71
|
+
/* @__PURE__ */$("td",{className:"px-3 py-1.5 text-right whitespace-nowrap",children:[
|
|
72
|
+
/* @__PURE__ */D("button",{onClick:()=>(async e=>{const t=await ce(`${F}/api/trash/restore`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e.id})});if(!t.ok){const e=await t.json().catch(()=>({}));return void x.error(e.error||`Restore failed (${t.status})`)}x.success(`Restored "${e.name}"`),pe()})(e),className:"px-1.5 py-0.5 rounded hover:bg-gray-200 text-blue-600 text-[11px]",children:"Restore"}),
|
|
73
|
+
/* @__PURE__ */D("button",{onClick:()=>(async e=>{if(!await g({title:"Permanently delete",message:`"${e.name}" will be permanently removed. This can't be undone.`,confirmLabel:"Delete forever",variant:"danger"}))return;const t=await ce(`${F}/api/trash/${encodeURIComponent(e.id)}`,{method:"DELETE"});if(!t.ok){const e=await t.json().catch(()=>({}));return void x.error(e.error||`Delete failed (${t.status})`)}pe()})(e),className:"px-1.5 py-0.5 rounded hover:bg-red-100 text-red-600 text-[11px] ml-1",children:"Delete forever"})]})]},e.id))})]}):B&&0===M.length?/* @__PURE__ */D("div",{className:"p-6 text-center text-sm text-gray-400",children:"Loading…"}):0===M.length?/* @__PURE__ */$("div",{className:"p-10 text-center text-sm text-gray-400",children:["Empty folder.",!I&&/* @__PURE__ */$(L,{children:[" Drop files here or click ",
|
|
74
|
+
/* @__PURE__ */D("span",{className:"font-medium",children:"Upload"}),"."]})]}):/* @__PURE__ */$("table",{className:"w-full text-sm",children:[
|
|
75
|
+
/* @__PURE__ */D("thead",{className:"bg-gray-50 text-[11px] uppercase tracking-wide text-gray-500",children:/* @__PURE__ */$("tr",{children:[
|
|
76
|
+
/* @__PURE__ */D("th",{className:"text-left font-medium px-3 py-1.5",children:"Name"}),
|
|
77
|
+
/* @__PURE__ */D("th",{className:"text-right font-medium px-3 py-1.5 w-24",children:"Size"}),
|
|
78
|
+
/* @__PURE__ */D("th",{className:"text-right font-medium px-3 py-1.5 w-40",children:"Modified"}),
|
|
79
|
+
/* @__PURE__ */D("th",{className:"w-32"})]})}),
|
|
80
|
+
/* @__PURE__ */D("tbody",{children:M.map(t=>/* @__PURE__ */$("tr",{onClick:()=>V(t.name),onDoubleClick:()=>{"folder"===t.kind?W(R(O,t.name)):(async t=>{if(I)return;const a=R(O,t.name),r=(t.name.split(".").pop()||"").toLowerCase(),n=T[r];n?await e({filePath:a,filename:t.name,kind:n,onStaged:e=>le(e)}):ue(t)})(t)},className:"cursor-default border-b border-gray-100 "+(K===t.name?"bg-blue-50":"hover:bg-gray-50"),children:[
|
|
81
|
+
/* @__PURE__ */$("td",{className:"px-3 py-1.5 flex items-center gap-2",children:["folder"===t.kind?/* @__PURE__ */D(k,{name:"folder",look:"solid",className:"h-4 w-4 text-amber-500 shrink-0"}):/* @__PURE__ */D(k,{name:"page",className:"h-4 w-4 text-gray-400 shrink-0",strokeWidth:1.5}),
|
|
82
|
+
/* @__PURE__ */D("span",{className:"truncate",title:t.name,children:t.name})]}),
|
|
83
|
+
/* @__PURE__ */D("td",{className:"px-3 py-1.5 text-right tabular-nums text-gray-500",children:"folder"===t.kind?"—":b(t.size)}),
|
|
84
|
+
/* @__PURE__ */D("td",{className:"px-3 py-1.5 text-right text-gray-500 tabular-nums",children:S(t.modifiedAt)}),
|
|
85
|
+
/* @__PURE__ */D("td",{className:"px-3 py-1.5 text-right whitespace-nowrap",children:!I&&/* @__PURE__ */$(L,{children:["file"===t.kind&&/* @__PURE__ */D("button",{onClick:e=>{e.stopPropagation(),ue(t)},className:"px-1.5 py-0.5 rounded hover:bg-gray-200 text-gray-500 text-[11px]",children:"Download"}),
|
|
86
|
+
/* @__PURE__ */D("button",{onClick:e=>{e.stopPropagation(),(async e=>{const t=await y({title:`Rename ${e.kind}`,defaultValue:e.name,confirmLabel:"Rename"});if(!t||t===e.name)return;if(/[\\/]/.test(t))return void x.error("Names cannot contain slashes");const a=R(O,e.name),r=R(O,t),n=await ce(`${F}/api/rename`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:a,to:r})});if(!n.ok){const e=await n.json().catch(()=>({}));return void x.error(e.error||`Rename failed (${n.status})`)}he(O)})(t)},className:"px-1.5 py-0.5 rounded hover:bg-gray-200 text-gray-500 text-[11px] ml-1",children:"Rename"}),
|
|
87
|
+
/* @__PURE__ */D("button",{onClick:e=>{e.stopPropagation(),(async e=>{if(!await g({title:`Delete ${e.kind}`,message:`"${e.name}"${"folder"===e.kind?" and everything inside":""} will be permanently removed.`,confirmLabel:"Delete",variant:"danger"}))return;const t=R(O,e.name),a=await ce(`${F}/api/files?path=${encodeURIComponent(t)}`,{method:"DELETE"});if(!a.ok){const e=await a.json().catch(()=>({}));return void x.error(e.error||`Delete failed (${a.status})`)}he(O)})(t)},className:"px-1.5 py-0.5 rounded hover:bg-red-100 text-red-600 text-[11px] ml-1",children:"Delete"})]})})]},t.name))})]})})]})})}),_&&/* @__PURE__ */D("div",{className:"absolute inset-0 bg-blue-500/15 border-4 border-dashed border-blue-500 pointer-events-none flex items-center justify-center z-20",children:/* @__PURE__ */D("div",{className:"px-4 py-2 rounded-md bg-blue-600 text-white text-sm font-medium shadow-lg",children:"Drop to upload"})})]})}export{F as default};
|