@themartiancompany/opfs 2.0.3 → 2.0.5
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/AUTHORS.rst +35 -0
- package/COPYING +67 -80
- package/README.md +18 -20
- package/fs-worker +38 -0
- package/fs-worker.js +1 -0
- package/fs-worker.webpack.config.cjs +49 -0
- package/opfs +75 -6
- package/package.json +18 -8
package/AUTHORS.rst
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
..
|
|
2
|
+
SPDX-License-Identifier: AGPL-3.0-or-later
|
|
3
|
+
|
|
4
|
+
-------------------------------------------------------
|
|
5
|
+
Copyright © 2024, 2025, 2026
|
|
6
|
+
Pellegrino Prevete
|
|
7
|
+
|
|
8
|
+
All rights reserved
|
|
9
|
+
-------------------------------------------------------
|
|
10
|
+
|
|
11
|
+
This program is free software: you can redistribute it
|
|
12
|
+
and/or modify it under the terms of the
|
|
13
|
+
GNU Affero General Public License as published by
|
|
14
|
+
the Free Software Foundation, either version 3 of the
|
|
15
|
+
License, or (at your option) any later version.
|
|
16
|
+
|
|
17
|
+
This program is distributed in the hope that it will
|
|
18
|
+
be useful, but WITHOUT ANY WARRANTY; without even the
|
|
19
|
+
implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
20
|
+
PARTICULAR PURPOSE.
|
|
21
|
+
See the GNU Affero General Public License
|
|
22
|
+
for more details.
|
|
23
|
+
|
|
24
|
+
You should have received a copy of the
|
|
25
|
+
GNU Affero General Public License
|
|
26
|
+
along with this program.
|
|
27
|
+
If not, see <https://www.gnu.org/licenses/>.
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
=====================================
|
|
31
|
+
OPFS Authors
|
|
32
|
+
=====================================
|
|
33
|
+
|
|
34
|
+
* Pellegrino Prevete <pellegrinoprevete@gmail.com>
|
|
35
|
+
* Truocolo <truocolo@aol.com>
|
package/COPYING
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
GNU GENERAL PUBLIC LICENSE
|
|
2
|
-
Version 3,
|
|
1
|
+
GNU AFFERO GENERAL PUBLIC LICENSE
|
|
2
|
+
Version 3, 19 November 2007
|
|
3
3
|
|
|
4
4
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
|
5
5
|
Everyone is permitted to copy and distribute verbatim copies
|
|
@@ -7,17 +7,15 @@
|
|
|
7
7
|
|
|
8
8
|
Preamble
|
|
9
9
|
|
|
10
|
-
The GNU General Public License is a free, copyleft license for
|
|
11
|
-
software and other kinds of works
|
|
10
|
+
The GNU Affero General Public License is a free, copyleft license for
|
|
11
|
+
software and other kinds of works, specifically designed to ensure
|
|
12
|
+
cooperation with the community in the case of network server software.
|
|
12
13
|
|
|
13
14
|
The licenses for most software and other practical works are designed
|
|
14
15
|
to take away your freedom to share and change the works. By contrast,
|
|
15
|
-
|
|
16
|
+
our General Public Licenses are intended to guarantee your freedom to
|
|
16
17
|
share and change all versions of a program--to make sure it remains free
|
|
17
|
-
software for all its users.
|
|
18
|
-
GNU General Public License for most of our software; it applies also to
|
|
19
|
-
any other work released this way by its authors. You can apply it to
|
|
20
|
-
your programs, too.
|
|
18
|
+
software for all its users.
|
|
21
19
|
|
|
22
20
|
When we speak of free software, we are referring to freedom, not
|
|
23
21
|
price. Our General Public Licenses are designed to make sure that you
|
|
@@ -26,44 +24,34 @@ them if you wish), that you receive source code or can get it if you
|
|
|
26
24
|
want it, that you can change the software or use pieces of it in new
|
|
27
25
|
free programs, and that you know you can do these things.
|
|
28
26
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
that
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
products. If such problems arise substantially in other domains, we
|
|
58
|
-
stand ready to extend this provision to those domains in future versions
|
|
59
|
-
of the GPL, as needed to protect the freedom of users.
|
|
60
|
-
|
|
61
|
-
Finally, every program is threatened constantly by software patents.
|
|
62
|
-
States should not allow patents to restrict development and use of
|
|
63
|
-
software on general-purpose computers, but in those that do, we wish to
|
|
64
|
-
avoid the special danger that patents applied to a free program could
|
|
65
|
-
make it effectively proprietary. To prevent this, the GPL assures that
|
|
66
|
-
patents cannot be used to render the program non-free.
|
|
27
|
+
Developers that use our General Public Licenses protect your rights
|
|
28
|
+
with two steps: (1) assert copyright on the software, and (2) offer
|
|
29
|
+
you this License which gives you legal permission to copy, distribute
|
|
30
|
+
and/or modify the software.
|
|
31
|
+
|
|
32
|
+
A secondary benefit of defending all users' freedom is that
|
|
33
|
+
improvements made in alternate versions of the program, if they
|
|
34
|
+
receive widespread use, become available for other developers to
|
|
35
|
+
incorporate. Many developers of free software are heartened and
|
|
36
|
+
encouraged by the resulting cooperation. However, in the case of
|
|
37
|
+
software used on network servers, this result may fail to come about.
|
|
38
|
+
The GNU General Public License permits making a modified version and
|
|
39
|
+
letting the public access it on a server without ever releasing its
|
|
40
|
+
source code to the public.
|
|
41
|
+
|
|
42
|
+
The GNU Affero General Public License is designed specifically to
|
|
43
|
+
ensure that, in such cases, the modified source code becomes available
|
|
44
|
+
to the community. It requires the operator of a network server to
|
|
45
|
+
provide the source code of the modified version running there to the
|
|
46
|
+
users of that server. Therefore, public use of a modified version, on
|
|
47
|
+
a publicly accessible server, gives the public access to the source
|
|
48
|
+
code of the modified version.
|
|
49
|
+
|
|
50
|
+
An older license, called the Affero General Public License and
|
|
51
|
+
published by Affero, was designed to accomplish similar goals. This is
|
|
52
|
+
a different license, not a version of the Affero GPL, but Affero has
|
|
53
|
+
released a new version of the Affero GPL which permits relicensing under
|
|
54
|
+
this license.
|
|
67
55
|
|
|
68
56
|
The precise terms and conditions for copying, distribution and
|
|
69
57
|
modification follow.
|
|
@@ -72,7 +60,7 @@ modification follow.
|
|
|
72
60
|
|
|
73
61
|
0. Definitions.
|
|
74
62
|
|
|
75
|
-
"This License" refers to version 3 of the GNU General Public License.
|
|
63
|
+
"This License" refers to version 3 of the GNU Affero General Public License.
|
|
76
64
|
|
|
77
65
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
|
78
66
|
works, such as semiconductor masks.
|
|
@@ -549,35 +537,45 @@ to collect a royalty for further conveying from those to whom you convey
|
|
|
549
537
|
the Program, the only way you could satisfy both those terms and this
|
|
550
538
|
License would be to refrain entirely from conveying the Program.
|
|
551
539
|
|
|
552
|
-
13. Use with the GNU
|
|
540
|
+
13. Remote Network Interaction; Use with the GNU General Public License.
|
|
541
|
+
|
|
542
|
+
Notwithstanding any other provision of this License, if you modify the
|
|
543
|
+
Program, your modified version must prominently offer all users
|
|
544
|
+
interacting with it remotely through a computer network (if your version
|
|
545
|
+
supports such interaction) an opportunity to receive the Corresponding
|
|
546
|
+
Source of your version by providing access to the Corresponding Source
|
|
547
|
+
from a network server at no charge, through some standard or customary
|
|
548
|
+
means of facilitating copying of software. This Corresponding Source
|
|
549
|
+
shall include the Corresponding Source for any work covered by version 3
|
|
550
|
+
of the GNU General Public License that is incorporated pursuant to the
|
|
551
|
+
following paragraph.
|
|
553
552
|
|
|
554
553
|
Notwithstanding any other provision of this License, you have
|
|
555
554
|
permission to link or combine any covered work with a work licensed
|
|
556
|
-
under version 3 of the GNU
|
|
555
|
+
under version 3 of the GNU General Public License into a single
|
|
557
556
|
combined work, and to convey the resulting work. The terms of this
|
|
558
557
|
License will continue to apply to the part which is the covered work,
|
|
559
|
-
but the
|
|
560
|
-
|
|
561
|
-
combination as such.
|
|
558
|
+
but the work with which it is combined will remain governed by version
|
|
559
|
+
3 of the GNU General Public License.
|
|
562
560
|
|
|
563
561
|
14. Revised Versions of this License.
|
|
564
562
|
|
|
565
563
|
The Free Software Foundation may publish revised and/or new versions of
|
|
566
|
-
the GNU General Public License from time to time. Such new versions
|
|
567
|
-
be similar in spirit to the present version, but may differ in detail to
|
|
564
|
+
the GNU Affero General Public License from time to time. Such new versions
|
|
565
|
+
will be similar in spirit to the present version, but may differ in detail to
|
|
568
566
|
address new problems or concerns.
|
|
569
567
|
|
|
570
568
|
Each version is given a distinguishing version number. If the
|
|
571
|
-
Program specifies that a certain numbered version of the GNU General
|
|
569
|
+
Program specifies that a certain numbered version of the GNU Affero General
|
|
572
570
|
Public License "or any later version" applies to it, you have the
|
|
573
571
|
option of following the terms and conditions either of that numbered
|
|
574
572
|
version or of any later version published by the Free Software
|
|
575
573
|
Foundation. If the Program does not specify a version number of the
|
|
576
|
-
GNU General Public License, you may choose any version ever published
|
|
574
|
+
GNU Affero General Public License, you may choose any version ever published
|
|
577
575
|
by the Free Software Foundation.
|
|
578
576
|
|
|
579
577
|
If the Program specifies that a proxy can decide which future
|
|
580
|
-
versions of the GNU General Public License can be used, that proxy's
|
|
578
|
+
versions of the GNU Affero General Public License can be used, that proxy's
|
|
581
579
|
public statement of acceptance of a version permanently authorizes you
|
|
582
580
|
to choose that version for the Program.
|
|
583
581
|
|
|
@@ -635,40 +633,29 @@ the "copyright" line and a pointer to where the full notice is found.
|
|
|
635
633
|
Copyright (C) <year> <name of author>
|
|
636
634
|
|
|
637
635
|
This program is free software: you can redistribute it and/or modify
|
|
638
|
-
it under the terms of the GNU General Public License as published by
|
|
636
|
+
it under the terms of the GNU Affero General Public License as published by
|
|
639
637
|
the Free Software Foundation, either version 3 of the License, or
|
|
640
638
|
(at your option) any later version.
|
|
641
639
|
|
|
642
640
|
This program is distributed in the hope that it will be useful,
|
|
643
641
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
644
642
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
645
|
-
GNU General Public License for more details.
|
|
643
|
+
GNU Affero General Public License for more details.
|
|
646
644
|
|
|
647
|
-
You should have received a copy of the GNU General Public License
|
|
645
|
+
You should have received a copy of the GNU Affero General Public License
|
|
648
646
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
649
647
|
|
|
650
648
|
Also add information on how to contact you by electronic and paper mail.
|
|
651
649
|
|
|
652
|
-
If
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
The hypothetical commands `show w' and `show c' should show the appropriate
|
|
661
|
-
parts of the General Public License. Of course, your program's commands
|
|
662
|
-
might be different; for a GUI interface, you would use an "about box".
|
|
650
|
+
If your software can interact with users remotely through a computer
|
|
651
|
+
network, you should also make sure that it provides a way for users to
|
|
652
|
+
get its source. For example, if your program is a web application, its
|
|
653
|
+
interface could display a "Source" link that leads users to an archive
|
|
654
|
+
of the code. There are many ways you could offer source, and different
|
|
655
|
+
solutions will be better for different programs; see section 13 for the
|
|
656
|
+
specific requirements.
|
|
663
657
|
|
|
664
658
|
You should also get your employer (if you work as a programmer) or school,
|
|
665
659
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
|
666
|
-
For more information on this, and how to apply and follow the GNU
|
|
660
|
+
For more information on this, and how to apply and follow the GNU AGPL, see
|
|
667
661
|
<https://www.gnu.org/licenses/>.
|
|
668
|
-
|
|
669
|
-
The GNU General Public License does not permit incorporating your program
|
|
670
|
-
into proprietary programs. If your program is a subroutine library, you
|
|
671
|
-
may consider it more useful to permit linking proprietary applications with
|
|
672
|
-
the library. If this is what you want to do, use the GNU Lesser General
|
|
673
|
-
Public License instead of this License. But first, please read
|
|
674
|
-
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
package/README.md
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
|
+
|
|
1
2
|
[comment]: <> (SPDX-License-Identifier: AGPL-3.0)
|
|
2
3
|
|
|
3
|
-
[comment]: <> (
|
|
4
|
-
[comment]: <> (Copyright © 2024, 2025
|
|
4
|
+
[comment]: <> (----------------------------------------------------)
|
|
5
|
+
[comment]: <> (Copyright © 2024, 2025, 2026)
|
|
6
|
+
[comment]: <> ( Pellegrino Prevete)
|
|
5
7
|
[comment]: <> (All rights reserved)
|
|
6
|
-
[comment]: <> (
|
|
8
|
+
[comment]: <> (----------------------------------------------------)
|
|
7
9
|
|
|
8
10
|
[comment]: <> (This program is free software: you can redistribute)
|
|
9
|
-
[comment]: <> (it and/or modify it under the terms of the
|
|
10
|
-
[comment]: <> (General Public License as published
|
|
11
|
-
[comment]: <> (Software Foundation, either version
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
[comment]: <> (
|
|
15
|
-
[comment]: <> (
|
|
16
|
-
[comment]: <> (
|
|
17
|
-
|
|
18
|
-
[comment]: <> (
|
|
19
|
-
[comment]: <> (
|
|
20
|
-
[comment]: <> (If not, see <https://www.gnu.org/licenses/>.)
|
|
11
|
+
[comment]: <> (it and/or modify it under the terms of the)
|
|
12
|
+
[comment]: <> (GNU Affero General Public License as published)
|
|
13
|
+
[comment]: <> (by the Free Software Foundation, either version)
|
|
14
|
+
[comment]: <> (3 of the License.)
|
|
15
|
+
|
|
16
|
+
[comment]: <> (This program is distributed in the hope that it)
|
|
17
|
+
[comment]: <> (will be useful, but WITHOUT ANY WARRANTY;)
|
|
18
|
+
[comment]: <> (without even the implied warranty of)
|
|
19
|
+
[comment]: <> (MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.)
|
|
20
|
+
[comment]: <> (See the GNU Affero General Public License)
|
|
21
|
+
[comment]: <> (for more details.)
|
|
21
22
|
|
|
22
23
|
# OPFS Module (`@themartiancompany/opfs`)
|
|
23
24
|
|
|
@@ -25,16 +26,13 @@
|
|
|
25
26
|
https://img.shields.io/npm/v/@themartiancompany/opfs.svg)](
|
|
26
27
|
https://npmjs.org/package/@themartiancompany/opfs)
|
|
27
28
|
|
|
28
|
-
[](
|
|
30
|
-
README.cn.md)
|
|
31
|
-
|
|
32
29
|
Browser-compatible `fs` module obtained combining the
|
|
33
30
|
[Happy OPFS](
|
|
34
31
|
https://github.com/themartiancompany/happy-opfs)
|
|
35
32
|
and the
|
|
36
33
|
[OPFS Tools](
|
|
37
|
-
https://github.com/hughfenghen/opfs-tools)
|
|
34
|
+
https://github.com/hughfenghen/opfs-tools)
|
|
35
|
+
modules.
|
|
38
36
|
|
|
39
37
|
OPFS stands for *origin private file system*
|
|
40
38
|
and it is a file system API for manipulating local
|
package/fs-worker
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
4
|
+
|
|
5
|
+
/** ----------------------------------------------------------------------
|
|
6
|
+
* Copyright ©
|
|
7
|
+
* Pellegrino Prevete
|
|
8
|
+
* 2025, 2026
|
|
9
|
+
*
|
|
10
|
+
* All rights reserved
|
|
11
|
+
* ----------------------------------------------------------------------
|
|
12
|
+
*
|
|
13
|
+
* This program is free software: you can redistribute it and/or modify
|
|
14
|
+
* it under the terms of the GNU General Public License as published by
|
|
15
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
16
|
+
* (at your option) any later version.
|
|
17
|
+
*
|
|
18
|
+
* This program is distributed in the hope that it will be useful,
|
|
19
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
20
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
21
|
+
* GNU General Public License for more details.
|
|
22
|
+
*
|
|
23
|
+
* You should have received a copy of the GNU General Public License
|
|
24
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
const
|
|
28
|
+
_fs =
|
|
29
|
+
require("opfs");
|
|
30
|
+
_sync_agent =
|
|
31
|
+
_fs.startSyncAgent;
|
|
32
|
+
|
|
33
|
+
module.exports = {
|
|
34
|
+
_sync_agent:
|
|
35
|
+
_sync_agent
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
_sync_agent();
|
package/fs-worker.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(()=>{var e={234(e,r,t){const n=t(210);_sync_agent=n.startSyncAgent,e.exports={_sync_agent},_sync_agent()},210(e,r,t){const n=t(744),a=t(597),i=t(12);function o(e){let r;return void 0===e&&(e="fs-worker.js"),r=new a(e),r}_file=i.file,_read_stream_create=function(e,r){return _file(e).createReader()},e.exports=n,e.exports.fsWorkerNew=o,e.exports.fsWorkerStart=async function(e,r,t){let n,a,i,s;return void 0===e&&(e="fs-worker.js"),"Number"!=typeof r&&(r=10485760),"Number"!=typeof r&&(t=10485760),a=_fs.connectSyncAgent,s=o(e),i={worker:s,bufferLength:r,opTimeout:t},n=a(i),n},e.exports.createReadStream=_read_stream_create,e.exports.createWriteStream=function(e,r){return _file(e).createWriter()},e.exports.mkdtemp=n.mkTemp},12(e,r){!function(e){"use strict";var r,t,n,a,i,o,s,c,l,u,f,y,h=e=>{throw TypeError(e)},d=(e,r,t)=>r.has(e)||h("Cannot "+t),w=(e,r,t)=>(d(e,r,"read from private field"),t?t.call(e):r.get(e)),p=(e,r,t)=>r.has(e)?h("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(e):r.set(e,t),m=(e,r,t,n)=>(d(e,r,"write to private field"),n?n.call(e,t):r.set(e,t),t);const g="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIHUobil7aWYobj09PSIvIilyZXR1cm57cGFyZW50Om51bGwsbmFtZToiIn07Y29uc3QgZT1uLnNwbGl0KCIvIikuZmlsdGVyKGk9PmkubGVuZ3RoPjApO2lmKGUubGVuZ3RoPT09MCl0aHJvdyBFcnJvcigiSW52YWxpZCBwYXRoIik7Y29uc3QgYT1lW2UubGVuZ3RoLTFdLHI9Ii8iK2Uuc2xpY2UoMCwtMSkuam9pbigiLyIpO3JldHVybntuYW1lOmEscGFyZW50OnJ9fWFzeW5jIGZ1bmN0aW9uIHcobixlKXtjb25zdHtwYXJlbnQ6YSxuYW1lOnJ9PXUobik7aWYoYT09bnVsbClyZXR1cm4gYXdhaXQgbmF2aWdhdG9yLnN0b3JhZ2UuZ2V0RGlyZWN0b3J5KCk7Y29uc3QgaT1hLnNwbGl0KCIvIikuZmlsdGVyKHQ9PnQubGVuZ3RoPjApO3RyeXtsZXQgdD1hd2FpdCBuYXZpZ2F0b3Iuc3RvcmFnZS5nZXREaXJlY3RvcnkoKTtmb3IoY29uc3QgcyBvZiBpKXQ9YXdhaXQgdC5nZXREaXJlY3RvcnlIYW5kbGUocyx7Y3JlYXRlOmUuY3JlYXRlfSk7aWYoZS5pc0ZpbGUpcmV0dXJuIGF3YWl0IHQuZ2V0RmlsZUhhbmRsZShyLHtjcmVhdGU6ZS5jcmVhdGV9KX1jYXRjaCh0KXtpZih0Lm5hbWU9PT0iTm90Rm91bmRFcnJvciIpcmV0dXJuIG51bGw7dGhyb3cgdH19Y29uc3QgZj17fTtzZWxmLm9ubWVzc2FnZT1hc3luYyBuPT57dmFyIGk7Y29uc3R7ZXZ0VHlwZTplLGFyZ3M6YX09bi5kYXRhO2xldCByPWZbYS5maWxlSWRdO3RyeXtsZXQgdDtjb25zdCBzPVtdO2lmKGU9PT0icmVnaXN0ZXIiKXtjb25zdCBsPWF3YWl0IHcoYS5maWxlUGF0aCx7Y3JlYXRlOiEwLGlzRmlsZTohMH0pO2lmKGw9PW51bGwpdGhyb3cgRXJyb3IoYG5vdCBmb3VuZCBmaWxlOiAke2EuZmlsZUlkfWApO3I9YXdhaXQgbC5jcmVhdGVTeW5jQWNjZXNzSGFuZGxlKHttb2RlOmEubW9kZX0pLGZbYS5maWxlSWRdPXJ9ZWxzZSBpZihlPT09ImNsb3NlIilhd2FpdCByLmNsb3NlKCksZGVsZXRlIGZbYS5maWxlSWRdO2Vsc2UgaWYoZT09PSJ0cnVuY2F0ZSIpYXdhaXQgci50cnVuY2F0ZShhLm5ld1NpemUpO2Vsc2UgaWYoZT09PSJ3cml0ZSIpe2NvbnN0e2RhdGE6bCxvcHRzOm99PW4uZGF0YS5hcmdzO3Q9YXdhaXQgci53cml0ZShsLG8pfWVsc2UgaWYoZT09PSJyZWFkIil7Y29uc3R7b2Zmc2V0Omwsc2l6ZTpvfT1uLmRhdGEuYXJncyxnPW5ldyBVaW50OEFycmF5KG8pLGQ9YXdhaXQgci5yZWFkKGcse2F0Omx9KSxjPWcuYnVmZmVyO3Q9ZD09PW8/YzooKGk9Yy50cmFuc2Zlcik9PW51bGw/dm9pZCAwOmkuY2FsbChjLGQpKT8/Yy5zbGljZSgwLGQpLHMucHVzaCh0KX1lbHNlIGU9PT0iZ2V0U2l6ZSI/dD1hd2FpdCByLmdldFNpemUoKTplPT09ImZsdXNoIiYmYXdhaXQgci5mbHVzaCgpO3NlbGYucG9zdE1lc3NhZ2Uoe2V2dFR5cGU6ImNhbGxiYWNrIixjYklkOm4uZGF0YS5jYklkLHJldHVyblZhbDp0fSxzKX1jYXRjaCh0KXtjb25zdCBzPXQ7c2VsZi5wb3N0TWVzc2FnZSh7ZXZ0VHlwZToidGhyb3dFcnJvciIsY2JJZDpuLmRhdGEuY2JJZCxlcnJNc2c6cy5uYW1lKyI6ICIrcy5tZXNzYWdlK2AKYCtKU09OLnN0cmluZ2lmeShuLmRhdGEpfSl9fX0pKCk7Ci8vIyBzb3VyY2VNYXBwaW5nVVJMPW9wZnMtd29ya2VyLUY0UldscWNfLmpzLm1hcAo=",v=typeof self<"u"&&self.Blob&&new Blob([(b=g,Uint8Array.from(atob(b),e=>e.charCodeAt(0)))],{type:"text/javascript;charset=utf-8"});var b;function E(e){let r;try{if(r=v&&(self.URL||self.webkitURL).createObjectURL(v),!r)throw"";const t=new Worker(r,{name:null==e?void 0:e.name});return t.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(r)}),t}catch{return new Worker("data:text/javascript;base64,"+g,{name:null==e?void 0:e.name})}finally{r&&(self.URL||self.webkitURL).revokeObjectURL(r)}}async function T(e,r,t){const n=function(){if(S.length<3){const r=e();return S.push(r),r}{const e=S[k];return k=(k+1)%S.length,e}function e(){const e=new E;let r=0,t={};return e.onmessage=({data:e})=>{var r,n;"callback"===e.evtType?null==(r=t[e.cbId])||r.resolve(e.returnVal):"throwError"===e.evtType&&(null==(n=t[e.cbId])||n.reject(Error(e.errMsg))),delete t[e.cbId]},async function(n,a,i=[]){r+=1;const o=new Promise((e,n)=>{t[r]={resolve:e,reject:n}});return e.postMessage({cbId:r,evtType:n,args:a},i),o}}}();return await n("register",{fileId:e,filePath:r,mode:t}),{read:async(r,t)=>await n("read",{fileId:e,offset:r,size:t}),write:async(r,t)=>await n("write",{fileId:e,data:r,opts:t},[ArrayBuffer.isView(r)?r.buffer:r]),close:async()=>await n("close",{fileId:e}),truncate:async r=>await n("truncate",{fileId:e,newSize:r}),getSize:async()=>await n("getSize",{fileId:e}),flush:async()=>await n("flush",{fileId:e})}}const S=[];let k=0;function A(e){if("/"===e)return{parent:null,name:""};const r=e.split("/").filter(e=>e.length>0);if(0===r.length)throw Error("Invalid path");return{name:r[r.length-1],parent:"/"+r.slice(0,-1).join("/")}}async function O(e,r){const{parent:t,name:n}=A(e);if(null==t)return await navigator.storage.getDirectory();const a=t.split("/").filter(e=>e.length>0);try{let e=await navigator.storage.getDirectory();for(const t of a)e=await e.getDirectoryHandle(t,{create:r.create});return r.isFile?await e.getFileHandle(n,{create:r.create}):await e.getDirectoryHandle(n,{create:r.create})}catch(e){if("NotFoundError"===e.name)return null;throw e}}async function F(e){const{parent:r,name:t}=A(e);if(null==r){const e=await navigator.storage.getDirectory();for await(const r of e.keys())await e.removeEntry(r,{recursive:!0});return}const n=await O(r,{create:!1,isFile:!1});if(null!=n)try{await n.removeEntry(t,{recursive:!0})}catch(e){if("NotFoundError"===e.name)return;throw e}}function R(e,r){return`${e}/${r}`.replace("//","/")}function x(e){return new W(e)}r=new WeakMap,t=new WeakMap,n=new WeakMap;let W=class e{constructor(e){p(this,r),p(this,t),p(this,n),m(this,r,e);const{parent:a,name:i}=A(e);m(this,t,i),m(this,n,a)}get kind(){return"dir"}get name(){return w(this,t)}get path(){return w(this,r)}get parent(){return null==w(this,n)?null:x(w(this,n))}async create(){return await O(w(this,r),{create:!0,isFile:!1}),x(w(this,r))}async exists(){return await O(w(this,r),{create:!1,isFile:!1})instanceof FileSystemDirectoryHandle}async remove(e={}){for(const r of await this.children())try{await r.remove(e)}catch(e){console.warn(e)}try{await F(w(this,r))}catch(e){console.warn(e)}}async children(){const e=await O(w(this,r),{create:!1,isFile:!1});if(null==e)return[];const t=[];for await(const n of e.values())t.push(("file"===n.kind?L:x)(R(w(this,r),n.name)));return t}async copyTo(r){if(!await this.exists())throw Error(`dir ${this.path} not exists`);if(r instanceof e){const e=await r.exists()?x(R(r.path,this.name)):r;return await e.create(),await Promise.all((await this.children()).map(r=>r.copyTo(e))),e}if(r instanceof FileSystemDirectoryHandle)return await Promise.all((await this.children()).map(async e=>{"file"===e.kind?await e.copyTo(await r.getFileHandle(e.name,{create:!0})):await e.copyTo(await r.getDirectoryHandle(e.name,{create:!0}))})),null;throw Error("Illegal target type")}async moveTo(e){const r=await this.copyTo(e);return await this.remove(),r}};const Z=new Map;function L(e,r="rw"){if("rw"===r){const t=Z.get(e)??new z(e,r);return Z.set(e,t),t}return new z(e,r)}async function P(e,r,t={overwrite:!0}){if(r instanceof z)return void await P(e,await r.stream(),t);const n=await(e instanceof z?e:L(e,"rw")).createWriter();try{if(t.overwrite&&await n.truncate(0),r instanceof ReadableStream){const e=r.getReader();for(;;){const{done:r,value:t}=await e.read();if(r)break;await n.write(t)}}else await n.write(r)}catch(e){throw e}finally{await n.close()}}let I=0;a=new WeakMap,i=new WeakMap,o=new WeakMap,s=new WeakMap,c=new WeakMap,l=new WeakMap,u=new WeakMap,f=new WeakMap,y=new WeakMap;let z=class e{constructor(e,r){p(this,a),p(this,i),p(this,o),p(this,s),p(this,c),p(this,l,0),p(this,u,async()=>{}),p(this,f,(()=>{let e=null;return()=>(m(this,l,w(this,l)+1),null!=e||(e=new Promise(async(r,t)=>{try{const t=await T(w(this,c),w(this,a),w(this,s));m(this,u,async()=>{null!=e&&(e=null,m(this,l,0),await t.close().catch(console.error))}),r([t,async()=>{m(this,l,w(this,l)-1),!(w(this,l)>0)&&(e=null,await t.close())}])}catch(e){t(e)}})),e)})()),p(this,y,!1),m(this,c,++I),m(this,a,e),m(this,s,{r:"read-only",rw:"readwrite","rw-unsafe":"readwrite-unsafe"}[r]);const{parent:t,name:n}=A(e);if(null==t)throw Error("Invalid path");m(this,o,n),m(this,i,t)}get kind(){return"file"}get path(){return w(this,a)}get name(){return w(this,o)}get parent(){return null==w(this,i)?null:x(w(this,i))}async createWriter(){if("read-only"===w(this,s))throw Error("file is read-only");if(w(this,y))throw Error("Other writer have not been closed");m(this,y,!0);try{const e=new TextEncoder,[r,t]=await w(this,f).call(this);let n=await r.getSize(),a=!1;return{write:async(t,i={})=>{if(a)throw Error("Writer is closed");const o="string"==typeof t?e.encode(t):t,s=i.at??n,c=o.byteLength;return n=s+c,await r.write(o,{at:s})},truncate:async e=>{if(a)throw Error("Writer is closed");await r.truncate(e),n>e&&(n=e)},flush:async()=>{if(a)throw Error("Writer is closed");await r.flush()},close:async()=>{if(a)throw Error("Writer is closed");a=!0,m(this,y,!1),await t()}}}catch(e){throw m(this,y,!1),e}}async createReader(){const[e,r]=await w(this,f).call(this);let t=!1,n=0;return{read:async(r,a={})=>{if(t)throw Error("Reader is closed");const i=a.at??n,o=await e.read(i,r);return n=i+o.byteLength,o},getSize:async()=>{if(t)throw Error("Reader is closed");return await e.getSize()},close:async()=>{t||(t=!0,await r())}}}async text(){return(new TextDecoder).decode(await this.arrayBuffer())}async arrayBuffer(){const e=await O(w(this,a),{create:!1,isFile:!0});return null==e?new ArrayBuffer(0):(await e.getFile()).arrayBuffer()}async stream(){const e=await this.getOriginFile();return null==e?new ReadableStream({pull:e=>{e.close()}}):e.stream()}async getOriginFile(){var e;return null==(e=await O(w(this,a),{create:!1,isFile:!0}))?void 0:e.getFile()}async getSize(){const e=await O(w(this,a),{create:!1,isFile:!0});return null==e?0:(await e.getFile()).size}async exists(){return await O(w(this,a),{create:!1,isFile:!0})instanceof FileSystemFileHandle}async remove(e={}){if(!0===e.force)return await w(this,u).call(this),await F(w(this,a)),void Z.delete(w(this,a));if(w(this,l)>0)throw Error("exists unclosed reader/writer");await F(w(this,a))}async copyTo(r){if(r instanceof e)return r.path===this.path?this:(await P(r,this),r);if(r instanceof W){if(!await this.exists())throw Error(`file ${this.path} not exists`);return await this.copyTo(L(R(r.path,this.name)))}if(r instanceof FileSystemFileHandle)return await(await this.stream()).pipeTo(await r.createWritable()),null;throw Error("Illegal target type")}async moveTo(e){const r=await this.copyTo(e);return await this.remove(),r}};const U="/.opfs-tools-temp-dir";async function Y(e){try{if("file"===e.kind){if(!await e.exists())return!0;const r=await e.createWriter();await r.truncate(0),await r.close(),await e.remove()}else await e.remove();return!0}catch(e){return console.warn(e),!1}}const C=[];let M=!1;(async function(){var e;!0!==globalThis.__opfs_tools_tmpfile_init__&&(globalThis.__opfs_tools_tmpfile_init__=!0,null!=globalThis.FileSystemDirectoryHandle&&null!=globalThis.FileSystemFileHandle&&null!=(null==(e=globalThis.navigator)?void 0:e.storage.getDirectory)&&(setInterval(async()=>{for(const e of await x(U).children()){const r=/^\d+-(\d+)$/.exec(e.name);(null==r||Date.now()-Number(r[1])>2592e5)&&await Y(e)}},6e4),await async function(){if(null==globalThis.localStorage)return;const e="OPFS_TOOLS_EXPIRES_TMP_FILES";M||(M=!0,globalThis.addEventListener("unload",()=>{0!==C.length&&localStorage.setItem(e,`${localStorage.getItem(e)??""},${C.join(",")}`)}));let r=localStorage.getItem(e)??"";for(const e of r.split(","))0!==e.length&&await Y(L(`${U}/${e}`))&&(r=r.replace(e,""));localStorage.setItem(e,r.replace(/,{2,}/g,","))}()))})(),e.dir=x,e.file=L,e.rollfile=function(e,r){let t=L(e),n=0,a=t.createWriter(),i=t.createReader();return{append:async e=>{const t=await a;n+=await t.write(e),n>=r&&await(async e=>{const r=await(await i).read(n,{at:Math.round(.3*n)});n=await e.write(r,{at:0}),await e.truncate(n)})(t)},text:t.text.bind(t),remove:async()=>{await(await i).close(),await(await a).close(),await t.remove()},getSize:async()=>n}},e.tmpfile=function(){const e=`${Math.random().toString().slice(2)}-${Date.now()}`;return C.push(e),L(`${U}/${e}`)},e.write=P,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}(r)},744(e,r,t){"use strict";t.r(r),t.d(r,{ABORT_ERROR:()=>O,CURRENT_DIR:()=>Je,NOT_FOUND_ERROR:()=>_e,ROOT_DIR:()=>He,TIMEOUT_ERROR:()=>F,TMP_DIR:()=>Ke,appendFile:()=>Ar,appendFileSync:()=>gt,assertAbsolutePath:()=>Qe,assertFileUrl:()=>qe,connectSyncAgent:()=>it,copy:()=>Or,copySync:()=>vt,createFile:()=>wr,createFileSync:()=>lt,deleteTemp:()=>Ir,deleteTempSync:()=>Tt,downloadFile:()=>Tr,emptyDir:()=>Fr,emptyDirSync:()=>bt,exists:()=>Rr,existsSync:()=>Et,generateTempPath:()=>cr,getFileDataByHandle:()=>dr,getSyncMessenger:()=>ot,isDirectoryHandle:()=>yr,isFileHandle:()=>fr,isFileHandleLike:()=>hr,isOPFSSupported:()=>Xr,isTempPath:()=>lr,mkTemp:()=>Pr,mkTempSync:()=>St,mkdir:()=>pr,mkdirSync:()=>ut,move:()=>xr,moveSync:()=>ft,pruneTemp:()=>zr,pruneTempSync:()=>kt,readBlobFile:()=>Wr,readBlobFileSync:()=>At,readDir:()=>mr,readDirSync:()=>yt,readFile:()=>gr,readFileSync:()=>ht,readJsonFile:()=>Zr,readJsonFileSync:()=>Ot,readTextFile:()=>Lr,readTextFileSync:()=>Ft,remove:()=>vr,removeSync:()=>dt,setSyncMessenger:()=>st,startSyncAgent:()=>at,stat:()=>br,statSync:()=>wt,toFileSystemHandleLike:()=>ur,unzip:()=>Yr,unzipFromUrl:()=>Cr,unzipSync:()=>Rt,uploadFile:()=>Mr,writeFile:()=>Er,writeFileSync:()=>mt,zip:()=>jr,zipFromUrl:()=>Gr,zipSync:()=>xt});function n(e,r){if(!e)throw new Error("Invariant failed")}function a(e){if("string"!=typeof e)throw new TypeError(`Path must be a string, received "${JSON.stringify(e)}"`)}function i(e,r){if(e.length<=1)return e;let t=e.length;for(let n=e.length-1;n>0&&r(e.charCodeAt(n));n--)t=n;return e.slice(0,t)}function o(e){return 47===e}function s(e){return e=function(e){if("file:"!==(e=e instanceof URL?e:new URL(e)).protocol)throw new TypeError(`URL must be a file URL: received "${e.protocol}"`);return e}(e),decodeURIComponent(e.pathname.replace(/%(?![0-9A-Fa-f]{2})/g,"%25"))}function c(e){e instanceof URL&&(e=s(e)),function(e){a(e),e.length}(e);let r=-1,t=!1;for(let n=e.length-1;n>=1;--n)if(o(e.charCodeAt(n))){if(t){r=n;break}}else t=!0;return-1===r?o(e.charCodeAt(0))?"/":".":i(e.slice(0,r),o)}function l(e,r=""){e instanceof URL&&(e=s(e)),function(e,r){if(a(e),0===e.length)return e;if("string"!=typeof r)throw new TypeError(`Suffix must be a string, received "${JSON.stringify(r)}"`)}(e,r);const t=function(e,r,t=0){let n=!1,a=e.length;for(let i=e.length-1;i>=t;--i)if(r(e.charCodeAt(i))){if(n){t=i+1;break}}else n||(n=!0,a=i+1);return e.slice(t,a)}(e,o),n=i(t,o);return r?function(e,r){if(r.length>=e.length)return e;const t=e.length-r.length;for(let n=r.length-1;n>=0;--n)if(e.charCodeAt(t+n)!==r.charCodeAt(n))return e;return e.slice(0,-r.length)}(n,r):n}function u(e,...r){if(void 0===e)return".";e instanceof URL&&(e=s(e)),(r=e?[e,...r]:r).forEach(e=>a(e));const t=r.filter(e=>e.length>0).join("/");return""===t?".":function(e){e instanceof URL&&(e=s(e)),function(e){a(e),e.length}(e);const r=o(e.charCodeAt(0)),t=o(e.charCodeAt(e.length-1));return e=function(e,r,t,n){let a,i="",o=0,s=-1,c=0;for(let l=0;l<=e.length;++l){if(l<e.length)a=e.charCodeAt(l);else{if(n(a))break;a=47}if(n(a)){if(s===l-1||1===c);else if(s!==l-1&&2===c){if(i.length<2||2!==o||46!==i.charCodeAt(i.length-1)||46!==i.charCodeAt(i.length-2)){if(i.length>2){const e=i.lastIndexOf(t);-1===e?(i="",o=0):(i=i.slice(0,e),o=i.length-1-i.lastIndexOf(t)),s=l,c=0;continue}if(2===i.length||1===i.length){i="",o=0,s=l,c=0;continue}}r&&(i.length>0?i+=`${t}..`:i="..",o=2)}else i.length>0?i+=t+e.slice(s+1,l):i=e.slice(s+1,l),o=l-s-1;s=l,c=0}else 46===a&&-1!==c?++c:c=-1}return i}(e,!r,"/",o),0!==e.length||r||(e="."),e.length>0&&t&&(e+="/"),r?`/${e}`:e}(t)}function f(e){e instanceof URL&&(e=s(e)),a(e);let r=-1,t=0,n=-1,i=!0,c=0;for(let a=e.length-1;a>=0;--a){const s=e.charCodeAt(a);if(o(s)){if(!i){t=a+1;break}}else-1===n&&(i=!1,n=a+1),46===s?-1===r?r=a:1!==c&&(c=1):-1!==r&&(c=-1)}return-1===r||-1===n||0===c||1===c&&r===n-1&&r===t+1?"":e.slice(r,n)}const y=Symbol("Option kind"),h=Symbol("Result kind"),d=Promise.resolve(!0),w=Promise.resolve(!1);function p(e){const r=Object.freeze({[Symbol.toStringTag]:"Option",[y]:"Some",*[Symbol.iterator](){yield e},toString:()=>`Some(${e})`,isSome:()=>!0,isNone:()=>!1,isSomeAnd:r=>r(e),isSomeAndAsync:r=>Promise.resolve(r(e)),isNoneOr:r=>r(e),isNoneOrAsync:r=>Promise.resolve(r(e)),expect:r=>e,unwrap:()=>e,unwrapOr:r=>e,unwrapOrElse:r=>e,unwrapOrElseAsync:r=>Promise.resolve(e),okOr:r=>v(e),okOrElse:r=>v(e),transpose:()=>(S(e),e.isOk()?v(p(e.unwrap())):b(e.unwrapErr())),filter:t=>t(e)?r:m,flatten:()=>(T(e),e),map:r=>p(r(e)),mapOr:(r,t)=>t(e),mapOrElse:(r,t)=>t(e),zip:r=>(T(r),r.isSome()?p([e,r.unwrap()]):m),zipWith:(r,t)=>(T(r),r.isSome()?p(t(e,r.unwrap())):m),unzip(){const r=e;if(!Array.isArray(r)||2!==r.length)throw new TypeError("Option::unzip() requires a 2-element tuple, received "+(Array.isArray(r)?`array with ${r.length} elements`:typeof r));const[t,n]=r;return[p(t),p(n)]},reduce:(t,n)=>(T(t),t.isSome()?p(n(e,t.unwrap())):r),and:e=>(T(e),e),andThen:r=>r(e),andThenAsync:r=>Promise.resolve(r(e)),or:e=>r,orElse:e=>r,orElseAsync:e=>Promise.resolve(r),xor:e=>(T(e),e.isSome()?m:r),inspect:t=>(t(e),r),eq:r=>(T(r),r.isSome()&&r.unwrap()===e)});return r}const m=Object.freeze({[Symbol.toStringTag]:"Option",[y]:"None",*[Symbol.iterator](){},toString:()=>"None",isSome:()=>!1,isNone:()=>!0,isSomeAnd:e=>!1,isSomeAndAsync:e=>w,isNoneOr:e=>!0,isNoneOrAsync:e=>d,expect(e){throw new TypeError(e)},unwrap(){throw new TypeError("Option::unwrap() called on a `None` value")},unwrapOr:e=>e,unwrapOrElse:e=>e(),unwrapOrElseAsync:e=>Promise.resolve(e()),okOr:e=>b(e),okOrElse:e=>b(e()),transpose:()=>v(m),filter:e=>m,flatten:()=>m,map:e=>m,mapOr:(e,r)=>e,mapOrElse:(e,r)=>e(),zip:e=>m,zipWith:(e,r)=>m,unzip:()=>[m,m],reduce:(e,r)=>(T(e),e),and:e=>m,andThen:e=>m,andThenAsync:e=>g,or:e=>(T(e),e),orElse:e=>e(),orElseAsync:e=>Promise.resolve(e()),xor:e=>(T(e),e.isSome()?e:m),inspect:e=>m,eq:e=>(T(e),e===m)}),g=Promise.resolve(m);function v(e){const r=Object.freeze({[Symbol.toStringTag]:"Result",[h]:"Ok",*[Symbol.iterator](){yield e},toString:()=>`Ok(${e})`,isOk:()=>!0,isErr:()=>!1,isOkAnd:r=>r(e),isOkAndAsync:r=>Promise.resolve(r(e)),isErrAnd:e=>!1,isErrAndAsync:e=>w,expect:r=>e,unwrap:()=>e,unwrapOr:r=>e,unwrapOrElse:r=>e,unwrapOrElseAsync:r=>Promise.resolve(e),expectErr(r){throw new TypeError(`${r}: ${e}`)},unwrapErr(){throw new TypeError("Result::unwrapErr() called on an `Ok` value")},intoOk:()=>e,intoErr(){throw new TypeError("Result::intoErr() called on an `Ok` value")},ok:()=>p(e),err:()=>m,transpose:()=>(T(e),e.isSome()?p(v(e.unwrap())):m),map:r=>v(r(e)),mapErr:e=>r,mapOr:(r,t)=>t(e),mapOrElse:(r,t)=>t(e),flatten:()=>(S(e),e),and:e=>(S(e),e),or:e=>r,andThen:r=>r(e),andThenAsync:r=>Promise.resolve(r(e)),orElse:e=>r,orElseAsync:e=>Promise.resolve(r),inspect:t=>(t(e),r),inspectErr:e=>r,eq:r=>(S(r),r.isOk()&&r.unwrap()===e),asOk:()=>r,asErr(){throw new TypeError("Result::asErr() called on an `Ok` value")},andTryAsync(r){try{const t=r(e);return Promise.resolve(t).then(v,b)}catch(e){return Promise.resolve(b(e))}},orTryAsync:e=>Promise.resolve(r)});return r}function b(e){const r=Object.freeze({[Symbol.toStringTag]:"Result",[h]:"Err",*[Symbol.iterator](){},toString:()=>`Err(${e})`,isOk:()=>!1,isErr:()=>!0,isOkAnd:e=>!1,isOkAndAsync:e=>w,isErrAnd:r=>r(e),isErrAndAsync:r=>Promise.resolve(r(e)),expect(r){throw new TypeError(`${r}: ${e}`)},unwrap(){throw new TypeError("Result::unwrap() called on an `Err` value")},unwrapOr:e=>e,unwrapOrElse:r=>r(e),unwrapOrElseAsync:r=>Promise.resolve(r(e)),expectErr:r=>e,unwrapErr:()=>e,intoOk(){throw new TypeError("Result::intoOk() called on an `Err` value")},intoErr:()=>e,ok:()=>m,err:()=>p(e),transpose:()=>p(r),map:e=>r,mapErr:r=>b(r(e)),mapOr:(e,r)=>e,mapOrElse:(r,t)=>r(e),flatten:()=>r,and:e=>r,or:e=>(S(e),e),andThen:e=>r,andThenAsync:e=>Promise.resolve(r),orElse:r=>r(e),orElseAsync:r=>Promise.resolve(r(e)),inspect:e=>r,inspectErr:t=>(t(e),r),eq:r=>(S(r),r.isErr()&&r.unwrapErr()===e),asOk(){throw new TypeError("Result::asOk() called on an `Err` value")},asErr:()=>r,andTryAsync:e=>Promise.resolve(r),orTryAsync(r){try{const t=r(e);return Promise.resolve(t).then(v,b)}catch(e){return Promise.resolve(b(e))}}});return r}function E(e){try{return null===e?"null":void 0===e?"undefined":"object"==typeof e?Object.prototype.toString.call(e):String(e)}catch{return"[unable to stringify]"}}function T(e){if(!function(e){return null!=e&&"object"==typeof e&&y in e}(e))throw new TypeError(`Expected an Option, but received: ${E(e)}`)}function S(e){if(!function(e){return null!=e&&"object"==typeof e&&h in e}(e))throw new TypeError(`Expected a Result, but received: ${E(e)}`)}const k=v(!1),A=v(),O="AbortError",F="TimeoutError";var R=class extends Error{name="FetchError";status;constructor(e,r){super(e),this.status=r}};function x(e,r){const t=function(e){if(e instanceof URL)return e;try{return new URL(e,"undefined"!=typeof location?location.href:void 0)}catch{throw new TypeError(`Invalid URL: ${e}`)}}(e),n=r??{},{retries:a,delay:i,when:o,onRetry:s}=function(e){const{responseType:r,timeout:t,retry:n=0,onProgress:a,onChunk:i}=e;if(null!=r){const e=["text","arraybuffer","blob","json","bytes","stream"];if(!e.includes(r))throw new TypeError(`responseType must be one of ${e.join(", ")} but received ${r}`)}if(null!=t){if("number"!=typeof t)throw new TypeError("timeout must be a number but received "+typeof t);if(t<=0)throw new Error(`timeout must be a number greater than 0 but received ${t}`)}if(null!=a&&"function"!=typeof a)throw new TypeError("onProgress callback must be a function but received "+typeof a);if(null!=i&&"function"!=typeof i)throw new TypeError("onChunk callback must be a function but received "+typeof i);let o,s,c=0,l=0;if("number"==typeof n?c=n:n&&"object"==typeof n&&(c=n.retries??0,l=n.delay??0,o=n.when,s=n.onRetry),!Number.isInteger(c))throw new TypeError(`Retry count must be an integer but received ${c}`);if(c<0)throw new Error(`Retry count must be non-negative but received ${c}`);if("number"==typeof l){if(l<0)throw new Error(`Retry delay must be a non-negative number but received ${l}`)}else if("function"!=typeof l)throw new TypeError("Retry delay must be a number or a function but received "+typeof l);if(null!=o&&!Array.isArray(o)&&"function"!=typeof o)throw new TypeError("Retry when condition must be an array of status codes or a function but received "+typeof o);if(null!=s&&"function"!=typeof s)throw new TypeError("Retry onRetry callback must be a function but received "+typeof s);return{retries:c,delay:l,when:o,onRetry:s}}(n),{abortable:c=!1,responseType:l,timeout:u,onProgress:f,onChunk:y,...h}=n,d=h.signal;let w;c&&(w=new AbortController);const p=(e,r)=>"AbortError"!==e.name&&(o?Array.isArray(o)?e instanceof R&&o.includes(e.status):o(e,r):!(e instanceof R)),m=e=>"function"==typeof i?i(e):i,g=()=>{const e=[];d&&e.push(d),w&&e.push(w.signal),"number"==typeof u&&e.push(function(e){if("function"==typeof AbortSignal.timeout)return AbortSignal.timeout(e);const r=new AbortController,t=function(){const e="The operation timed out.";try{return new DOMException(e,F)}catch{const r=new Error(e);return r.name=F,r}}(),n=setTimeout(()=>{r.abort(t)},e);return"function"==typeof n?.unref&&n.unref(),r.signal}(u)),e.length>0&&(h.signal=1===e.length?e[0]:function(e){if("function"==typeof AbortSignal.any)return AbortSignal.any(e);const r=new AbortController;for(const t of e)if(t.aborted)return r.abort(t.reason),r.signal;const t=e=>{r.abort(e.target.reason)};for(const r of e)r.addEventListener("abort",t);return r.signal.addEventListener("abort",()=>{for(const r of e)r.removeEventListener("abort",t)}),r.signal}(e))},E=async()=>{g();try{const e=await fetch(t,h);return e.ok?await T(e):(e.body?.cancel().catch(()=>{}),b(new R(e.statusText,e.status)))}catch(e){return b(e instanceof Error?e:Z(e))}},T=async e=>{switch(e.body&&(f||y)&&(async e=>{let r,t=0;if(f){const t=e.headers.get("content-length");if(null==t)try{f(b(new Error("No content-length in response headers")))}catch{}else r=Number.parseInt(t,10)}const n=e.clone().body;try{for await(const e of n){if(y)try{y(e)}catch{}if(f&&null!=r){t+=e.byteLength;try{f(v({totalByteLength:r,completedByteLength:t}))}catch{}}}}catch{}})(e),l){case"json":if(null==e.body)return v(null);try{return v(await e.json())}catch{return b(new Error("Response is invalid json while responseType is json"))}case"text":return v(await e.text());case"bytes":return"function"==typeof e.bytes?v(await e.bytes()):v(new Uint8Array(await e.arrayBuffer()));case"arraybuffer":return v(await e.arrayBuffer());case"blob":return v(await e.blob());case"stream":return v(e.body);default:return v(e)}},S=(async()=>{let e,r=0;do{if(r>0){if(w?.signal.aborted)return b(w.signal.reason);const t=m(r);if(t>0&&(await W(t),w?.signal.aborted))return b(w.signal.reason);try{s?.(e,r)}catch{}}const t=await E();if(t.isOk())return t;e=t.unwrapErr(),r++}while(r<=a&&p(e,r));return b(e)})();return c&&w?{abort(e){e instanceof Error?w.abort(e):null!=e?w.abort(Z(e)):w.abort()},get aborted(){return w.signal.aborted},get result(){return S}}:S}function W(e){return new Promise(r=>setTimeout(r,e))}function Z(e){const r=new Error("string"==typeof e?e:String(e));return r.name=O,r.cause=e,r}var L={},P=Uint8Array,I=Uint16Array,z=Int32Array,U=new P([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Y=new P([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),C=new P([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),M=function(e,r){for(var t=new I(31),n=0;n<31;++n)t[n]=r+=1<<e[n-1];var a=new z(t[30]);for(n=1;n<30;++n)for(var i=t[n];i<t[n+1];++i)a[i]=i-t[n]<<5|n;return{b:t,r:a}},D=M(U,2),j=D.b,G=D.r;j[28]=258,G[258]=28;for(var X=M(Y,0),N=X.b,$=X.r,B=new I(32768),V=0;V<32768;++V){var _=(43690&V)>>1|(21845&V)<<1;_=(61680&(_=(52428&_)>>2|(13107&_)<<2))>>4|(3855&_)<<4,B[V]=((65280&_)>>8|(255&_)<<8)>>1}var H=function(e,r,t){for(var n=e.length,a=0,i=new I(r);a<n;++a)e[a]&&++i[e[a]-1];var o,s=new I(r);for(a=1;a<r;++a)s[a]=s[a-1]+i[a-1]<<1;if(t){o=new I(1<<r);var c=15-r;for(a=0;a<n;++a)if(e[a])for(var l=a<<4|e[a],u=r-e[a],f=s[e[a]-1]++<<u,y=f|(1<<u)-1;f<=y;++f)o[B[f]>>c]=l}else for(o=new I(n),a=0;a<n;++a)e[a]&&(o[a]=B[s[e[a]-1]++]>>15-e[a]);return o},J=new P(288);for(V=0;V<144;++V)J[V]=8;for(V=144;V<256;++V)J[V]=9;for(V=256;V<280;++V)J[V]=7;for(V=280;V<288;++V)J[V]=8;var K=new P(32);for(V=0;V<32;++V)K[V]=5;var Q=H(J,9,0),q=H(J,9,1),ee=H(K,5,0),re=H(K,5,1),te=function(e){for(var r=e[0],t=1;t<e.length;++t)e[t]>r&&(r=e[t]);return r},ne=function(e,r,t){var n=r/8|0;return(e[n]|e[n+1]<<8)>>(7&r)&t},ae=function(e,r){var t=r/8|0;return(e[t]|e[t+1]<<8|e[t+2]<<16)>>(7&r)},ie=function(e){return(e+7)/8|0},oe=function(e,r,t){return(null==r||r<0)&&(r=0),(null==t||t>e.length)&&(t=e.length),new P(e.subarray(r,t))},se=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],ce=function(e,r,t){var n=new Error(r||se[e]);if(n.code=e,Error.captureStackTrace&&Error.captureStackTrace(n,ce),!t)throw n;return n},le=function(e,r,t,n){var a=e.length,i=n?n.length:0;if(!a||r.f&&!r.l)return t||new P(0);var o=!t,s=o||2!=r.i,c=r.i;o&&(t=new P(3*a));var l=function(e){var r=t.length;if(e>r){var n=new P(Math.max(2*r,e));n.set(t),t=n}},u=r.f||0,f=r.p||0,y=r.b||0,h=r.l,d=r.d,w=r.m,p=r.n,m=8*a;do{if(!h){u=ne(e,f,1);var g=ne(e,f+1,3);if(f+=3,!g){var v=e[(W=ie(f)+4)-4]|e[W-3]<<8,b=W+v;if(b>a){c&&ce(0);break}s&&l(y+v),t.set(e.subarray(W,b),y),r.b=y+=v,r.p=f=8*b,r.f=u;continue}if(1==g)h=q,d=re,w=9,p=5;else if(2==g){var E=ne(e,f,31)+257,T=ne(e,f+10,15)+4,S=E+ne(e,f+5,31)+1;f+=14;for(var k=new P(S),A=new P(19),O=0;O<T;++O)A[C[O]]=ne(e,f+3*O,7);f+=3*T;var F=te(A),R=(1<<F)-1,x=H(A,F,1);for(O=0;O<S;){var W,Z=x[ne(e,f,R)];if(f+=15&Z,(W=Z>>4)<16)k[O++]=W;else{var L=0,I=0;for(16==W?(I=3+ne(e,f,3),f+=2,L=k[O-1]):17==W?(I=3+ne(e,f,7),f+=3):18==W&&(I=11+ne(e,f,127),f+=7);I--;)k[O++]=L}}var z=k.subarray(0,E),M=k.subarray(E);w=te(z),p=te(M),h=H(z,w,1),d=H(M,p,1)}else ce(1);if(f>m){c&&ce(0);break}}s&&l(y+131072);for(var D=(1<<w)-1,G=(1<<p)-1,X=f;;X=f){var $=(L=h[ae(e,f)&D])>>4;if((f+=15&L)>m){c&&ce(0);break}if(L||ce(2),$<256)t[y++]=$;else{if(256==$){X=f,h=null;break}var B=$-254;if($>264){var V=U[O=$-257];B=ne(e,f,(1<<V)-1)+j[O],f+=V}var _=d[ae(e,f)&G],J=_>>4;if(_||ce(3),f+=15&_,M=N[J],J>3&&(V=Y[J],M+=ae(e,f)&(1<<V)-1,f+=V),f>m){c&&ce(0);break}s&&l(y+131072);var K=y+B;if(y<M){var Q=i-M,ee=Math.min(M,K);for(Q+y<0&&ce(3);y<ee;++y)t[y]=n[Q+y]}for(;y<K;++y)t[y]=t[y-M]}}r.l=h,r.p=X,r.b=y,r.f=u,h&&(u=1,r.m=w,r.d=d,r.n=p)}while(!u);return y!=t.length&&o?oe(t,0,y):t.subarray(0,y)},ue=function(e,r,t){t<<=7&r;var n=r/8|0;e[n]|=t,e[n+1]|=t>>8},fe=function(e,r,t){t<<=7&r;var n=r/8|0;e[n]|=t,e[n+1]|=t>>8,e[n+2]|=t>>16},ye=function(e,r){for(var t=[],n=0;n<e.length;++n)e[n]&&t.push({s:n,f:e[n]});var a=t.length,i=t.slice();if(!a)return{t:ve,l:0};if(1==a){var o=new P(t[0].s+1);return o[t[0].s]=1,{t:o,l:1}}t.sort(function(e,r){return e.f-r.f}),t.push({s:-1,f:25001});var s=t[0],c=t[1],l=0,u=1,f=2;for(t[0]={s:-1,f:s.f+c.f,l:s,r:c};u!=a-1;)s=t[t[l].f<t[f].f?l++:f++],c=t[l!=u&&t[l].f<t[f].f?l++:f++],t[u++]={s:-1,f:s.f+c.f,l:s,r:c};var y=i[0].s;for(n=1;n<a;++n)i[n].s>y&&(y=i[n].s);var h=new I(y+1),d=he(t[u-1],h,0);if(d>r){n=0;var w=0,p=d-r,m=1<<p;for(i.sort(function(e,r){return h[r.s]-h[e.s]||e.f-r.f});n<a;++n){var g=i[n].s;if(!(h[g]>r))break;w+=m-(1<<d-h[g]),h[g]=r}for(w>>=p;w>0;){var v=i[n].s;h[v]<r?w-=1<<r-h[v]++-1:++n}for(;n>=0&&w;--n){var b=i[n].s;h[b]==r&&(--h[b],++w)}d=r}return{t:new P(h),l:d}},he=function(e,r,t){return-1==e.s?Math.max(he(e.l,r,t+1),he(e.r,r,t+1)):r[e.s]=t},de=function(e){for(var r=e.length;r&&!e[--r];);for(var t=new I(++r),n=0,a=e[0],i=1,o=function(e){t[n++]=e},s=1;s<=r;++s)if(e[s]==a&&s!=r)++i;else{if(!a&&i>2){for(;i>138;i-=138)o(32754);i>2&&(o(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(o(a),--i;i>6;i-=6)o(8304);i>2&&(o(i-3<<5|8208),i=0)}for(;i--;)o(a);i=1,a=e[s]}return{c:t.subarray(0,n),n:r}},we=function(e,r){for(var t=0,n=0;n<r.length;++n)t+=e[n]*r[n];return t},pe=function(e,r,t){var n=t.length,a=ie(r+2);e[a]=255&n,e[a+1]=n>>8,e[a+2]=255^e[a],e[a+3]=255^e[a+1];for(var i=0;i<n;++i)e[a+i+4]=t[i];return 8*(a+4+n)},me=function(e,r,t,n,a,i,o,s,c,l,u){ue(r,u++,t),++a[256];for(var f=ye(a,15),y=f.t,h=f.l,d=ye(i,15),w=d.t,p=d.l,m=de(y),g=m.c,v=m.n,b=de(w),E=b.c,T=b.n,S=new I(19),k=0;k<g.length;++k)++S[31&g[k]];for(k=0;k<E.length;++k)++S[31&E[k]];for(var A=ye(S,7),O=A.t,F=A.l,R=19;R>4&&!O[C[R-1]];--R);var x,W,Z,L,P=l+5<<3,z=we(a,J)+we(i,K)+o,M=we(a,y)+we(i,w)+o+14+3*R+we(S,O)+2*S[16]+3*S[17]+7*S[18];if(c>=0&&P<=z&&P<=M)return pe(r,u,e.subarray(c,c+l));if(ue(r,u,1+(M<z)),u+=2,M<z){x=H(y,h,0),W=y,Z=H(w,p,0),L=w;var D=H(O,F,0);for(ue(r,u,v-257),ue(r,u+5,T-1),ue(r,u+10,R-4),u+=14,k=0;k<R;++k)ue(r,u+3*k,O[C[k]]);u+=3*R;for(var j=[g,E],G=0;G<2;++G){var X=j[G];for(k=0;k<X.length;++k){var N=31&X[k];ue(r,u,D[N]),u+=O[N],N>15&&(ue(r,u,X[k]>>5&127),u+=X[k]>>12)}}}else x=Q,W=J,Z=ee,L=K;for(k=0;k<s;++k){var $=n[k];if($>255){fe(r,u,x[257+(N=$>>18&31)]),u+=W[N+257],N>7&&(ue(r,u,$>>23&31),u+=U[N]);var B=31&$;fe(r,u,Z[B]),u+=L[B],B>3&&(fe(r,u,$>>5&8191),u+=Y[B])}else fe(r,u,x[$]),u+=W[$]}return fe(r,u,x[256]),u+W[256]},ge=new z([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ve=new P(0),be=function(e,r,t,n,a,i){var o=i.z||e.length,s=new P(n+o+5*(1+Math.ceil(o/7e3))+a),c=s.subarray(n,s.length-a),l=i.l,u=7&(i.r||0);if(r){u&&(c[0]=i.r>>3);for(var f=ge[r-1],y=f>>13,h=8191&f,d=(1<<t)-1,w=i.p||new I(32768),p=i.h||new I(d+1),m=Math.ceil(t/3),g=2*m,v=function(r){return(e[r]^e[r+1]<<m^e[r+2]<<g)&d},b=new z(25e3),E=new I(288),T=new I(32),S=0,k=0,A=i.i||0,O=0,F=i.w||0,R=0;A+2<o;++A){var x=v(A),W=32767&A,Z=p[x];if(w[W]=Z,p[x]=W,F<=A){var L=o-A;if((S>7e3||O>24576)&&(L>423||!l)){u=me(e,c,0,b,E,T,k,O,R,A-R,u),O=S=k=0,R=A;for(var C=0;C<286;++C)E[C]=0;for(C=0;C<30;++C)T[C]=0}var M=2,D=0,j=h,X=W-Z&32767;if(L>2&&x==v(A-X))for(var N=Math.min(y,L)-1,B=Math.min(32767,A),V=Math.min(258,L);X<=B&&--j&&W!=Z;){if(e[A+M]==e[A+M-X]){for(var _=0;_<V&&e[A+_]==e[A+_-X];++_);if(_>M){if(M=_,D=X,_>N)break;var H=Math.min(X,_-2),J=0;for(C=0;C<H;++C){var K=A-X+C&32767,Q=K-w[K]&32767;Q>J&&(J=Q,Z=K)}}}X+=(W=Z)-(Z=w[W])&32767}if(D){b[O++]=268435456|G[M]<<18|$[D];var q=31&G[M],ee=31&$[D];k+=U[q]+Y[ee],++E[257+q],++T[ee],F=A+M,++S}else b[O++]=e[A],++E[e[A]]}}for(A=Math.max(A,F);A<o;++A)b[O++]=e[A],++E[e[A]];u=me(e,c,l,b,E,T,k,O,R,A-R,u),l||(i.r=7&u|c[u/8|0]<<3,u-=7,i.h=p,i.p=w,i.i=A,i.w=F)}else{for(A=i.w||0;A<o+l;A+=65535){var re=A+65535;re>=o&&(c[u/8|0]=l,re=o),u=pe(c,u+1,e.subarray(A,re))}i.i=o}return oe(s,0,n+ie(u)+a)},Ee=function(){for(var e=new Int32Array(256),r=0;r<256;++r){for(var t=r,n=9;--n;)t=(1&t&&-306674912)^t>>>1;e[r]=t}return e}(),Te=function(e,r,t,n,a){if(!a&&(a={l:1},r.dictionary)){var i=r.dictionary.subarray(-32768),o=new P(i.length+e.length);o.set(i),o.set(e,i.length),e=o,a.w=i.length}return be(e,null==r.level?6:r.level,null==r.mem?a.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):20:12+r.mem,t,n,a)},Se=function(e,r){var t={};for(var n in e)t[n]=e[n];for(var n in r)t[n]=r[n];return t},ke=function(e,r,t){for(var n=e(),a=e.toString(),i=a.slice(a.indexOf("[")+1,a.lastIndexOf("]")).replace(/\s+/g,"").split(","),o=0;o<n.length;++o){var s=n[o],c=i[o];if("function"==typeof s){r+=";"+c+"=";var l=s.toString();if(s.prototype)if(-1!=l.indexOf("[native code]")){var u=l.indexOf(" ",8)+1;r+=l.slice(u,l.indexOf("(",u))}else for(var f in r+=l,s.prototype)r+=";"+c+".prototype."+f+"="+s.prototype[f].toString();else r+=l}else t[c]=s}return r},Ae=[],Oe=function(){return[P,I,z,U,Y,C,j,N,q,re,B,se,H,te,ne,ae,ie,oe,ce,le,Ue,Re,xe]},Fe=function(){return[P,I,z,U,Y,C,G,$,Q,J,ee,K,B,ge,ve,H,ue,fe,ye,he,de,we,pe,me,ie,oe,be,Te,ze,Re]},Re=function(e){return postMessage(e,[e.buffer])},xe=function(e){return e&&{out:e.size&&new P(e.size),dictionary:e.dictionary}},We=function(e,r,t,n,a,i){var o=function(e,r,t,n){if(!Ae[t]){for(var a="",i={},o=e.length-1,s=0;s<o;++s)a=ke(e[s],a,i);Ae[t]={c:ke(e[o],a,i),e:i}}var c=Se({},Ae[t].e);return function(e,r,t,n,a){var i=new Worker(L[r]||(L[r]=URL.createObjectURL(new Blob([e+';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'],{type:"text/javascript"}))));return i.onmessage=function(e){var r=e.data,t=r.$e$;if(t){var n=new Error(t[0]);n.code=t[1],n.stack=t[2],a(n,null)}else a(null,r)},i.postMessage(t,n),i}(Ae[t].c+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+r.toString()+"}",t,c,function(e){var r=[];for(var t in e)e[t].buffer&&r.push((e[t]=new e[t].constructor(e[t])).buffer);return r}(c),n)}(t,n,a,function(e,r){o.terminate(),i(e,r)});return o.postMessage([e,r],r.consume?[e.buffer]:[]),function(){o.terminate()}},Ze=function(e,r){return e[r]|e[r+1]<<8},Le=function(e,r){return(e[r]|e[r+1]<<8|e[r+2]<<16|e[r+3]<<24)>>>0},Pe=function(e,r){return Le(e,r)+4294967296*Le(e,r+4)},Ie=function(e,r,t){for(;t;++r)e[r]=t,t>>>=8};function ze(e,r){return Te(e,r||{},0,0)}function Ue(e,r){return le(e,{i:2},r&&r.out,r&&r.dictionary)}var Ye=function(e,r,t,n){for(var a in e){var i=e[a],o=r+a,s=n;Array.isArray(i)&&(s=Se(n,i[1]),i=i[0]),ArrayBuffer.isView(i)?t[o]=[i,s]:(t[o+="/"]=[new P(0),s],Ye(i,o,t,n))}},Ce="undefined"!=typeof TextEncoder&&new TextEncoder,Me="undefined"!=typeof TextDecoder&&new TextDecoder;try{Me.decode(ve,{stream:!0})}catch(e){}function De(e,r){if(r){for(var t=new P(e.length),n=0;n<e.length;++n)t[n]=e.charCodeAt(n);return t}if(Ce)return Ce.encode(e);var a=e.length,i=new P(e.length+(e.length>>1)),o=0,s=function(e){i[o++]=e};for(n=0;n<a;++n){if(o+5>i.length){var c=new P(o+8+(a-n<<1));c.set(i),i=c}var l=e.charCodeAt(n);l<128||r?s(l):l<2048?(s(192|l>>6),s(128|63&l)):l>55295&&l<57344?(s(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++n))>>18),s(128|l>>12&63),s(128|l>>6&63),s(128|63&l)):(s(224|l>>12),s(128|l>>6&63),s(128|63&l))}return oe(i,0,o)}function je(e,r){if(r){for(var t="",n=0;n<e.length;n+=16384)t+=String.fromCharCode.apply(null,e.subarray(n,n+16384));return t}if(Me)return Me.decode(e);var a=function(e){for(var r="",t=0;;){var n=e[t++],a=(n>127)+(n>223)+(n>239);if(t+a>e.length)return{s:r,r:oe(e,t-1)};a?3==a?(n=((15&n)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,r+=String.fromCharCode(55296|n>>10,56320|1023&n)):r+=1&a?String.fromCharCode((31&n)<<6|63&e[t++]):String.fromCharCode((15&n)<<12|(63&e[t++])<<6|63&e[t++]):r+=String.fromCharCode(n)}}(e),i=a.s;return(t=a.r).length&&ce(8),i}var Ge=function(e,r,t,n,a,i,o){var s=4294967295==a,c=4294967295==i,l=4294967295==o,u=r+t;if(n&&s+c+l){for(;r+4<u;r+=4+Ze(e,r+2))if(1==Ze(e,r))return[s?Pe(e,r+4+8*c):a,c?Pe(e,r+4):i,l?Pe(e,r+4+8*(c+s)):o,1];n<2&&ce(13)}return[a,i,o,0]},Xe=function(e){var r=0;if(e)for(var t in e){var n=e[t].length;n>65535&&ce(9),r+=n+4}return r},Ne=function(e,r,t,n,a,i,o,s){var c=n.length,l=t.extra,u=s&&s.length,f=Xe(l);Ie(e,r,null!=o?33639248:67324752),r+=4,null!=o&&(e[r++]=20,e[r++]=t.os),e[r]=20,r+=2,e[r++]=t.flag<<1|(i<0&&8),e[r++]=a&&8,e[r++]=255&t.compression,e[r++]=t.compression>>8;var y=new Date(null==t.mtime?Date.now():t.mtime),h=y.getFullYear()-1980;if((h<0||h>119)&&ce(10),Ie(e,r,h<<25|y.getMonth()+1<<21|y.getDate()<<16|y.getHours()<<11|y.getMinutes()<<5|y.getSeconds()>>1),r+=4,-1!=i&&(Ie(e,r,t.crc),Ie(e,r+4,i<0?-i-2:i),Ie(e,r+8,t.size)),Ie(e,r+12,c),Ie(e,r+14,f),r+=16,null!=o&&(Ie(e,r,u),Ie(e,r+6,t.attrs),Ie(e,r+10,o),r+=14),e.set(n,r),r+=c,f)for(var d in l){var w=l[d],p=w.length;Ie(e,r,+d),Ie(e,r+2,p),e.set(w,r+4),r+=4+p}return u&&(e.set(s,r),r+=u),r};function $e(e,r,t){t||(t=r,r={}),"function"!=typeof t&&ce(7);var n={};Ye(e,"",n,r);var a=Object.keys(n),i=a.length,o=0,s=0,c=i,l=new Array(i),u=[],f=function(){for(var e=0;e<u.length;++e)u[e]()},y=function(e,r){Be(function(){t(e,r)})};Be(function(){y=t});var h=function(){var e=new P(s+22),r=o,t=s-o;s=0;for(var n=0;n<c;++n){var a=l[n];try{var i=a.c.length;Ne(e,s,a,a.f,a.u,i);var u=30+a.f.length+Xe(a.extra),f=s+u;e.set(a.c,f),Ne(e,o,a,a.f,a.u,i,s,a.m),o+=16+u+(a.m?a.m.length:0),s=f+i}catch(e){return y(e,null)}}(function(e,r,t,n,a){Ie(e,r,101010256),Ie(e,r+8,t),Ie(e,r+10,t),Ie(e,r+12,n),Ie(e,r+16,a)})(e,o,l.length,t,r),y(null,e)};i||h();for(var d=function(e){var r=a[e],t=n[r],c=t[0],d=t[1],w=function(){var e=-1;return{p:function(r){for(var t=e,n=0;n<r.length;++n)t=Ee[255&t^r[n]]^t>>>8;e=t},d:function(){return~e}}}(),p=c.length;w.p(c);var m=De(r),g=m.length,v=d.comment,b=v&&De(v),E=b&&b.length,T=Xe(d.extra),S=0==d.level?0:8,k=function(t,n){if(t)f(),y(t,null);else{var a=n.length;l[e]=Se(d,{size:p,crc:w.d(),c:n,f:m,m:b,u:g!=r.length||b&&v.length!=E,compression:S}),o+=30+g+T+a,s+=76+2*(g+T)+(E||0)+a,--i||h()}};if(g>65535&&k(ce(11,0,1),null),S)if(p<16e4)try{k(null,ze(c,d))}catch(e){k(e,null)}else u.push(function(e,r,t){return t||(t=r,r={}),"function"!=typeof t&&ce(7),We(e,r,[Fe],function(e){return Re(ze(e.data[0],e.data[1]))},0,t)}(c,d,k));else k(null,c)},w=0;w<c;++w)d(w);return f}var Be="function"==typeof queueMicrotask?queueMicrotask:"function"==typeof setTimeout?setTimeout:function(e){e()};class Ve{resolve;reject;promise;constructor(){if("function"==typeof Promise.withResolvers){const{promise:e,resolve:r,reject:t}=Promise.withResolvers();this.promise=e,this.resolve=r,this.reject=t}else this.promise=new Promise((e,r)=>{this.resolve=e,this.reject=r})}}const _e="NotFoundError",He="/",Je=".",Ke="/tmp";function Qe(e){n("string"==typeof e),n(e[0]===He)}function qe(e){n("string"==typeof e)}let er;function rr(e){return e===He}async function tr(e,r,t){try{return v(await e.getDirectoryHandle(r,t))}catch(t){const n=t,a=new Error(`${n.name}: ${n.message} When get child directory '${r}' from directory '${e.name||He}'.`);return a.name=n.name,b(a)}}async function nr(e,r){let t=await async function(){return er??=await navigator.storage.getDirectory(),er}();if(rr(e))return v(t);let n=e.slice(1);for(;n;){let e="";const a=n.indexOf("/");if(-1===a)e=n,n="";else if(e=n.slice(0,a),n=n.slice(a+1),0===a)continue;const i=await tr(t,e,r);if(i.isErr())return i;t=i.unwrap()}return v(t)}async function ar(e,r){const t=r?.create??!1,n=c(e),a=l(e);return(await nr(n,{create:t})).andThenAsync(e=>async function(e,r,t){try{return v(await e.getFileHandle(r,t))}catch(t){const n=t,a=new Error(`${n.name}: ${n.message} When get child file '${r}' from directory '${e.name||He}'.`);return a.name=n.name,b(a)}}(e,a,{create:t}))}function ir(e){return e.name===_e}async function or(e){const r=(await Promise.all(e)).find(e=>e.isErr());return r??A}function sr(){const e=new Error;return e.name=O,e}function cr(e){const{isDirectory:r=!1,basename:t="tmp",extname:n=""}=e??{},a=r?"":n;return u(Ke,`${t?`${t}-`:""}${crypto.randomUUID()}${a}`)}function lr(e){return e.startsWith(`${Ke}/`)}async function ur(e){const{name:r,kind:t}=e;if(fr(e)){const n=await e.getFile(),{size:a,lastModified:i,type:o}=n;return{name:r,kind:t,type:o,size:a,lastModified:i}}return{name:r,kind:t}}function fr(e){return"file"===e.kind}function yr(e){return"directory"===e.kind}function hr(e){return"file"===e.kind}async function dr(e){const r=await e.getFile(),t=await r.arrayBuffer();return new Uint8Array(t)}async function wr(e){return Qe(e),(await ar(e,{create:!0})).and(A)}async function pr(e){return Qe(e),(await nr(e,{create:!0})).and(A)}async function mr(e,r){async function*t(n,a){const i=n.entries();for await(const[o,s]of i){const i=a===e?o:u(a,o);yield{path:i,handle:s},yr(s)&&r?.recursive&&(yield*t(await n.getDirectoryHandle(o),i))}}return Qe(e),(await nr(e)).andThen(r=>v(t(r,e)))}async function gr(e,r){return Qe(e),(await ar(e)).andThenAsync(async e=>{const t=await e.getFile();switch(r?.encoding){case"blob":return v(t);case"utf8":return v(await t.text());default:return v(await t.arrayBuffer())}})}async function vr(e){Qe(e);const r=c(e),t=l(e),n=await nr(r);return(await n.andThenAsync(async e=>{try{rr(r)&&rr(t)?await e.remove({recursive:!0}):await e.removeEntry(t,{recursive:!0})}catch(e){return b(e)}return A})).orElse(e=>ir(e)?A:b(e))}async function br(e){Qe(e);const r=c(e),t=l(e),n=await nr(r);return t?n.andThenAsync(async r=>{for await(const[e,n]of r.entries())if(e===t)return v(n);const n=new Error(`${_e}: '${t}' does not exist. Full path is '${e}'.`);return n.name=_e,b(n)}):n}async function Er(e,r,t){Qe(e);const{append:n=!1,create:a=!0}=t??{};return(await ar(e,{create:a})).andThenAsync(async e=>{const t=await e.createWritable({keepExistingData:n}),a={type:"write",data:r};if(n){const{size:r}=await e.getFile();a.position=r}return await t.write(a),await t.close(),A})}function Tr(e,r,t){let n,a;qe(e),a=!1,"string"==typeof r?Qe(r):(t=r,r=cr({extname:f(e)}),a=!0),n=!1;const i=x(e,{redirect:"follow",...t,abortable:!0}),o=(async()=>(await i.response).andThenAsync(async e=>{const t=await e.blob();return n?b(sr()):(await Er(r,t)).and(v(e))}))();return{abort(e){n=!0,i.abort(e)},get aborted(){return n},get response(){return a?o.then(e=>e.map(e=>({tempFilePath:r,rawResponse:e}))):o}}}async function Sr(e,r){const t=c(r);return(await nr(t,{create:!0})).andThenAsync(async t=>{const n=l(r);try{return await e.move(t,n),A}catch(e){return b(e)}})}async function kr(e,r,t,n=!0){return Qe(r),(await br(e)).andThenAsync(async a=>{let i;i=!1;const o=await br(r);if(o.isErr()){if(!ir(o.unwrapErr()))return o.asErr()}else{i=!0;const e=o.unwrap();if(!(fr(a)&&fr(e)||yr(a)&&yr(e)))return b(new Error("Both 'srcPath' and 'destPath' must both be a file or directory."))}return fr(a)?n||!i?await t(a,r):A:(await mr(e,{recursive:!0})).andThenAsync(async e=>{const a=[pr(r)];for await(const{path:o,handle:s}of e){const e=u(r,o);let c=!1;if(i){const r=await Rr(e);if(r.isErr()){a.push(Promise.resolve(r.asErr()));continue}c=r.unwrap()}const l=fr(s)?n||!c?t(s,e):Promise.resolve(A):pr(e);a.push(l)}return or(a)})})}function Ar(e,r){return Er(e,r,{append:!0})}async function Or(e,r,t){const{overwrite:n=!0}=t??{};return kr(e,r,async(e,r)=>await Er(r,await e.getFile()),n)}async function Fr(e){const r=await mr(e);if(r.isErr())return ir(r.unwrapErr())?pr(e):r.asErr();const t=[];for await(const{path:n}of r.unwrap())t.push(vr(u(e,n)));return or(t)}async function Rr(e,r){const{isDirectory:t=!1,isFile:a=!1}=r??{};n(!(t&&a));const i=await br(e);return i.andThen(e=>v(!(t&&fr(e)||a&&yr(e)))).orElse(e=>ir(e)?k:i.asErr())}async function xr(e,r,t){const{overwrite:n=!0}=t??{};return(await kr(e,r,Sr,n)).andThenAsync(()=>vr(e))}function Wr(e){return gr(e,{encoding:"blob"})}async function Zr(e){return(await Lr(e)).andThenAsync(async e=>{try{return v(JSON.parse(e))}catch(e){return b(e)}})}function Lr(e){return gr(e,{encoding:"utf8"})}async function Pr(e){const{isDirectory:r=!1}=e??{},t=cr(e);return(await(r?pr:wr)(t)).and(v(t))}function Ir(){return vr(Ke)}async function zr(e){return n(e instanceof Date),(await mr(Ke,{recursive:!0})).andThenAsync(async r=>{try{for await(const{handle:t}of r)fr(t)&&(await t.getFile()).lastModified<=e.getTime()&&await t.remove()}catch(e){return b(e)}return A})}async function Ur(e,r){const t=new Uint8Array(e),n=new Ve;return function(e,r,t){t||(t=r,r={}),"function"!=typeof t&&ce(7);var n=[],a=function(){for(var e=0;e<n.length;++e)n[e]()},i={},o=function(e,r){Be(function(){t(e,r)})};Be(function(){o=t});for(var s=e.length-22;101010256!=Le(e,s);--s)if(!s||e.length-s>65558)return o(ce(13,0,1),null),a;var c=Ze(e,s+8);if(c){var l=c,u=Le(e,s+16),f=117853008==Le(e,s-20);if(f){var y=Le(e,s-12);(f=101075792==Le(e,y))&&(l=c=Le(e,y+32),u=Le(e,y+48))}for(var h=r&&r.filter,d=function(r){var t=function(e,r,t){var n=Ze(e,r+28),a=Ze(e,r+30),i=je(e.subarray(r+46,r+46+n),!(2048&Ze(e,r+8))),o=r+46+n,s=Ge(e,o,a,t,Le(e,r+20),Le(e,r+24),Le(e,r+42)),c=s[0],l=s[1],u=s[2];return[Ze(e,r+10),c,l,i,o+a+Ze(e,r+32),u]}(e,u,f),s=t[0],l=t[1],y=t[2],d=t[3],w=t[4],p=t[5],m=function(e,r){return r+30+Ze(e,r+26)+Ze(e,r+28)}(e,p);u=w;var g=function(e,r){e?(a(),o(e,null)):(r&&(i[d]=r),--c||o(null,i))};if(!h||h({name:d,size:l,originalSize:y,compression:s}))if(s)if(8==s){var v=e.subarray(m,m+l);if(y<524288||l>.8*y)try{g(null,Ue(v,{out:new P(y)}))}catch(e){g(e,null)}else n.push(function(e,r,t){return t||(t=r,r={}),"function"!=typeof t&&ce(7),We(e,r,[Oe],function(e){return Re(Ue(e.data[0],xe(e.data[1])))},1,t)}(v,{size:y},g))}else g(ce(14,"unknown compression type "+s,1),null);else g(null,oe(e,m,m+l));else g(null,null)},w=0;w<l;++w)d()}else o(null,{})}(t,async(e,t)=>{if(e)return void n.resolve(b(e));const a=[];for(const e in t)"/"!==e.at(-1)&&a.push(Er(u(r,e),t[e]));n.resolve(or(a))}),await n.promise}async function Yr(e,r){return Qe(r),(await gr(e)).andThenAsync(e=>Ur(e,r))}async function Cr(e,r,t){return qe(e),Qe(r),(await x(e,{redirect:"follow",...t,responseType:"arraybuffer",abortable:!1})).andThenAsync(e=>Ur(e,r))}function Mr(e,r,t){let n,a;qe(r),n=!1;const i=(async()=>(await Wr(e)).andThenAsync(async i=>{if(n)return b(sr());const{filename:o=l(e),...s}=t??{},c=new FormData;return c.append(o,i,o),a=x(r,{method:"POST",...s,abortable:!0,body:c}),a.response}))();return{abort(e){n=!0,a?.abort(e)},get aborted(){return n},get response(){return i}}}async function Dr(e,r){const t=new Ve;return $e(e,{consume:!0},async(e,n)=>{if(e)t.resolve(b(e));else if(r){const e=await Er(r,n);t.resolve(e)}else t.resolve(v(n))}),await t.promise}async function jr(e,r,t){return"string"==typeof r?Qe(r):(t=r,r=void 0),(await br(e)).andThenAsync(async n=>{const a=l(e),i={};if(fr(n)){const e=await dr(n);i[a]=e}else{const r=await mr(e,{recursive:!0});if(r.isErr())return r.asErr();const n=t?.preserveRoot??!0;for await(const{path:e,handle:t}of r.unwrap())if(fr(t)){const r=n?u(a,e):e,o=await dr(t);i[r]=o}}return Dr(i,r)})}async function Gr(e,r,t){return qe(e),"string"==typeof r?Qe(r):(t=r,r=void 0),(await x(e,{redirect:"follow",...t,responseType:"arraybuffer",abortable:!1})).andThenAsync(t=>{const n={};return n[l(e)]=new Uint8Array(t),Dr(n,r)})}function Xr(){return"function"==typeof navigator?.storage?.getDirectory}function Nr(e){return e?{name:e.name,message:e.message}:e}async function $r(e){const r=await e.arrayBuffer();return{name:e.name,type:e.type,lastModified:e.lastModified,size:r.byteLength,data:r}}let Br=1e3;var Vr=(e=>(e[e.createFile=0]="createFile",e[e.mkdir=1]="mkdir",e[e.move=2]="move",e[e.readDir=3]="readDir",e[e.remove=4]="remove",e[e.stat=5]="stat",e[e.writeFile=6]="writeFile",e[e.appendFile=7]="appendFile",e[e.copy=8]="copy",e[e.emptyDir=9]="emptyDir",e[e.exists=10]="exists",e[e.deleteTemp=11]="deleteTemp",e[e.mkTemp=12]="mkTemp",e[e.pruneTemp=13]="pruneTemp",e[e.readBlobFile=14]="readBlobFile",e[e.unzip=15]="unzip",e[e.zip=16]="zip",e))(Vr||{});let _r,Hr;function Jr(e){const r=JSON.stringify(e);return(_r??=new TextEncoder,_r).encode(r)}function Kr(e){const r=Qr(e);return JSON.parse(r)}function Qr(e){return(Hr??=new TextDecoder,Hr).decode(e)}class qr{i32a;u8a;headerLength=16;maxDataLength;constructor(e){this.i32a=new Int32Array(e),this.u8a=new Uint8Array(e),this.maxDataLength=e.byteLength-this.headerLength}}async function et(e,r){const{i32a:t,u8a:n,headerLength:a,maxDataLength:i}=e;for(;1!==Atomics.load(t,1););const o=t[2],s=n.slice(a,a+o);let c=await r(s);const l=c.byteLength;if(l>i){const e=`Response is too large: ${l} > ${i}. Consider grow the size of SharedArrayBuffer.`;if(c=Jr([{name:"RangeError",message:e}]),c.byteLength>i)throw Atomics.store(t,1,0),new RangeError(e)}t[2]=c.byteLength,n.set(c,a),Atomics.store(t,1,0),Atomics.store(t,0,0)}const rt={[Vr.createFile]:wr,[Vr.mkdir]:pr,[Vr.move]:xr,[Vr.readDir]:mr,[Vr.remove]:vr,[Vr.stat]:br,[Vr.writeFile]:Er,[Vr.appendFile]:Ar,[Vr.copy]:Or,[Vr.emptyDir]:Fr,[Vr.exists]:Rr,[Vr.deleteTemp]:Ir,[Vr.mkTemp]:Pr,[Vr.pruneTemp]:zr,[Vr.readBlobFile]:Wr,[Vr.unzip]:Yr,[Vr.zip]:jr};let tt,nt;function at(){if("undefined"!=typeof window)throw new Error("Only can use in worker");if(tt)throw new Error("Worker messenger already started");addEventListener("message",e=>{const r=e.data;if(!(r instanceof SharedArrayBuffer))throw new TypeError("Only can post SharedArrayBuffer to Worker");tt=new qr(r),postMessage(!0),async function(){for(;;)try{await et(tt,async e=>{const[r,...t]=Kr(e);let n;r===Vr.writeFile||r===Vr.appendFile?Array.isArray(t[1])&&(t[1]=new Uint8Array(t[1])):r===Vr.pruneTemp&&(t[0]=new Date(t[0]));const a=rt[r];try{const e=await a(...t);if(e.isErr())n=Jr([Nr(e.unwrapErr())]);else{let t;if(r===Vr.readBlobFile){const r=e.unwrap(),n=await $r(r);t={...n,data:[...new Uint8Array(n.data)]}}else if(r===Vr.readDir){const r=e.unwrap(),n=[];for await(const{path:e,handle:t}of r){const r=await ur(t);n.push({path:e,handle:r})}t=n}else if(r===Vr.stat){const r=e.unwrap();t=await ur(r)}else if(r===Vr.zip){const r=e.unwrap();t=r instanceof Uint8Array?[...r]:r}else t=e.unwrap();n=Jr([null,t])}}catch(e){n=Jr([Nr(e)])}return n})}catch(e){console.error(e instanceof Error?e.stack:e)}}()})}function it(e){if("undefined"==typeof window)throw new Error("Only can use in main thread");if(nt)throw new Error("Main messenger already started");return new Promise(r=>{const{worker:t,bufferLength:a=1048576,opTimeout:i=1e3}=e;n(t instanceof Worker||t instanceof URL||"string"==typeof t&&t),n(a>16&&a%4==0),n(Number.isInteger(i)&&i>0),Br=i;const o=t instanceof Worker?t:new Worker(t),s=new SharedArrayBuffer(a);o.addEventListener("message",e=>{e.data&&(nt=new qr(s),r())}),o.postMessage(s)})}function ot(){return nt}function st(e){n(null!=e),nt=e}function ct(e,...r){if(!nt)return b(new Error("Worker not initialized. Come back later."));const t=Jr([e,...r]);try{const e=Kr(function(e,r){const{i32a:t,u8a:n,headerLength:a,maxDataLength:i}=e,o=r.byteLength;if(o>i)throw new RangeError(`Request is too large: ${o} > ${i}. Consider grow the size of SharedArrayBuffer.`);Atomics.store(t,0,1),t[2]=o,n.set(r,a),Atomics.store(t,1,1),function(e){const r=Date.now();for(;!e();)if(Date.now()-r>Br){const e=new Error("Operating Timeout");throw e.name=F,e}}(()=>0===Atomics.load(t,0));const s=t[2];return n.slice(a,a+s)}(nt,t)),r=e[0],n=r?b(function(e){const r=new Error(e.message);return r.name=e.name,r}(r)):v(e[1]??void 0);return n}catch(e){return b(e)}}function lt(e){return ct(Vr.createFile,e)}function ut(e){return ct(Vr.mkdir,e)}function ft(e,r,t){return ct(Vr.move,e,r,t)}function yt(e,r){return ct(Vr.readDir,e,r)}function ht(e,r){return ct(Vr.readBlobFile,e).map(e=>{const t=new Uint8Array(e.data);switch(e.data=t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength),r?.encoding){case"blob":return e;case"utf8":return Qr(new Uint8Array(e.data));default:return e.data}})}function dt(e){return ct(Vr.remove,e)}function wt(e){return ct(Vr.stat,e)}function pt(e){return e instanceof ArrayBuffer?[...new Uint8Array(e)]:ArrayBuffer.isView(e)?[...new Uint8Array(e.buffer)]:e}function mt(e,r,t){return ct(Vr.writeFile,e,pt(r),t)}function gt(e,r){return ct(Vr.appendFile,e,pt(r))}function vt(e,r,t){return ct(Vr.copy,e,r,t)}function bt(e){return ct(Vr.emptyDir,e)}function Et(e,r){return ct(Vr.exists,e,r)}function Tt(){return ct(Vr.deleteTemp)}function St(e){return ct(Vr.mkTemp,e)}function kt(e){return ct(Vr.pruneTemp,e)}function At(e){return ht(e,{encoding:"blob"})}function Ot(e){return Ft(e).andThen(e=>{try{return v(JSON.parse(e))}catch(e){return b(e)}})}function Ft(e){return ht(e,{encoding:"utf8"})}function Rt(e,r){return ct(Vr.unzip,e,r)}function xt(e,r,t){return ct(Vr.zip,e,r,t).map(e=>e?new Uint8Array(e):e)}},597(e,r,t){"use strict";t.r(r),t.d(r,{default:()=>n});const n="undefined"!=typeof Worker?Worker:void 0}},r={};function t(n){var a=r[n];if(void 0!==a)return a.exports;var i=r[n]={exports:{}};return e[n].call(i.exports,i,i.exports,t),i.exports}t.d=(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},t.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t(234)})();
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
const
|
|
2
|
+
_path =
|
|
3
|
+
require(
|
|
4
|
+
'path');
|
|
5
|
+
const
|
|
6
|
+
_output_dir =
|
|
7
|
+
_path.resolve(
|
|
8
|
+
__dirname);
|
|
9
|
+
const
|
|
10
|
+
_input_file_name =
|
|
11
|
+
"fs-worker";
|
|
12
|
+
const
|
|
13
|
+
_output_file_name =
|
|
14
|
+
`${_input_file_name}.js`;
|
|
15
|
+
const
|
|
16
|
+
_output_file = {
|
|
17
|
+
path:
|
|
18
|
+
_output_dir,
|
|
19
|
+
filename:
|
|
20
|
+
_output_file_name
|
|
21
|
+
};
|
|
22
|
+
const
|
|
23
|
+
_input_file =
|
|
24
|
+
`./${_input_file_name}`;
|
|
25
|
+
module.exports = {
|
|
26
|
+
entry:
|
|
27
|
+
_input_file,
|
|
28
|
+
output:
|
|
29
|
+
_output_file,
|
|
30
|
+
optimization: {
|
|
31
|
+
moduleIds: 'deterministic',
|
|
32
|
+
},
|
|
33
|
+
resolve: {
|
|
34
|
+
fallback: {
|
|
35
|
+
"fs":
|
|
36
|
+
false,
|
|
37
|
+
"opfs":
|
|
38
|
+
_path.resolve(
|
|
39
|
+
__dirname,
|
|
40
|
+
'./opfs'),
|
|
41
|
+
"path":
|
|
42
|
+
false,
|
|
43
|
+
"@std/path":
|
|
44
|
+
_path.resolve(
|
|
45
|
+
__dirname,
|
|
46
|
+
'node_modules/@std/path/mod.js'),
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
package/opfs
CHANGED
|
@@ -4,10 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
/** ----------------------------------------------------------------------
|
|
6
6
|
* Copyright ©
|
|
7
|
-
* Jiang Jie
|
|
8
|
-
* 2024, 2025
|
|
9
7
|
* Pellegrino Prevete
|
|
10
|
-
* 2025
|
|
8
|
+
* 2025, 2026
|
|
11
9
|
*
|
|
12
10
|
* All rights reserved
|
|
13
11
|
* ----------------------------------------------------------------------
|
|
@@ -26,9 +24,14 @@
|
|
|
26
24
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
27
25
|
*/
|
|
28
26
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
const
|
|
28
|
+
_happy_opfs =
|
|
29
|
+
require(
|
|
30
|
+
"happy-opfs");
|
|
31
|
+
const
|
|
32
|
+
_worker =
|
|
33
|
+
require(
|
|
34
|
+
"web-worker");
|
|
32
35
|
const
|
|
33
36
|
_opfs_tools =
|
|
34
37
|
require(
|
|
@@ -64,9 +67,75 @@ function
|
|
|
64
67
|
return _writer;
|
|
65
68
|
}
|
|
66
69
|
|
|
70
|
+
function
|
|
71
|
+
_fs_worker_new(
|
|
72
|
+
_url) {
|
|
73
|
+
let
|
|
74
|
+
_fs_worker;
|
|
75
|
+
if ( typeof _url === 'undefined' ) {
|
|
76
|
+
_url =
|
|
77
|
+
"fs-worker.js";
|
|
78
|
+
}
|
|
79
|
+
_fs_worker =
|
|
80
|
+
new _worker(
|
|
81
|
+
_url);
|
|
82
|
+
return _fs_worker;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
async function
|
|
86
|
+
_fs_worker_start(
|
|
87
|
+
_worker_path,
|
|
88
|
+
_buffer_length,
|
|
89
|
+
_op_timeout) {
|
|
90
|
+
let
|
|
91
|
+
_agent,
|
|
92
|
+
_agent_connect,
|
|
93
|
+
_connect_opts,
|
|
94
|
+
_fs_worker;
|
|
95
|
+
if ( typeof _worker_path === 'undefined' ) {
|
|
96
|
+
_worker_path =
|
|
97
|
+
"fs-worker.js";
|
|
98
|
+
}
|
|
99
|
+
if ( typeof _buffer_length !== 'Number' ) {
|
|
100
|
+
// SharedArrayBuffer size between
|
|
101
|
+
// main thread and worker
|
|
102
|
+
_buffer_length =
|
|
103
|
+
10 * 1024 * 1024;
|
|
104
|
+
}
|
|
105
|
+
if ( typeof _buffer_length !== 'Number' ) {
|
|
106
|
+
// SharedArrayBuffer size between
|
|
107
|
+
// main thread and worker
|
|
108
|
+
_op_timeout =
|
|
109
|
+
10 * 1024 * 1024;
|
|
110
|
+
}
|
|
111
|
+
_agent_connect =
|
|
112
|
+
_fs.connectSyncAgent;
|
|
113
|
+
_fs_worker =
|
|
114
|
+
_fs_worker_new(
|
|
115
|
+
_worker_path);
|
|
116
|
+
_connect_opts = {
|
|
117
|
+
worker:
|
|
118
|
+
_fs_worker,
|
|
119
|
+
bufferLength:
|
|
120
|
+
_buffer_length,
|
|
121
|
+
opTimeout:
|
|
122
|
+
_op_timeout
|
|
123
|
+
}
|
|
124
|
+
_agent =
|
|
125
|
+
_agent_connect(
|
|
126
|
+
_connect_opts);
|
|
127
|
+
return _agent;
|
|
128
|
+
}
|
|
129
|
+
|
|
67
130
|
module.exports =
|
|
68
131
|
_happy_opfs;
|
|
132
|
+
module.exports.fsWorkerNew =
|
|
133
|
+
_fs_worker_new;
|
|
134
|
+
module.exports.fsWorkerStart =
|
|
135
|
+
_fs_worker_start;
|
|
69
136
|
module.exports.createReadStream =
|
|
70
137
|
_read_stream_create;
|
|
71
138
|
module.exports.createWriteStream =
|
|
72
139
|
_write_stream_create;
|
|
140
|
+
module.exports.mkdtemp =
|
|
141
|
+
_happy_opfs.mkTemp;
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"description":
|
|
5
5
|
"Browser-compatible (OPFS) Node/Deno 'fs' module.",
|
|
6
6
|
"version":
|
|
7
|
-
"2.0.
|
|
7
|
+
"2.0.5",
|
|
8
8
|
"homepage":
|
|
9
9
|
"https://github.com/themartiancompany/opfs",
|
|
10
10
|
"license":
|
|
@@ -40,19 +40,23 @@
|
|
|
40
40
|
"type":
|
|
41
41
|
"module",
|
|
42
42
|
"files": [
|
|
43
|
+
"AUTHORS.rst",
|
|
43
44
|
"COPYING",
|
|
44
45
|
"README.md",
|
|
46
|
+
"fs-worker",
|
|
47
|
+
"fs-worker.js",
|
|
48
|
+
"fs-worker.webpack.config.cjs",
|
|
45
49
|
"opfs",
|
|
46
50
|
"package.json"
|
|
47
51
|
],
|
|
48
52
|
"source":
|
|
49
|
-
"
|
|
53
|
+
"./opfs",
|
|
50
54
|
"man":
|
|
51
55
|
"man/opfs.1",
|
|
52
56
|
"main":
|
|
53
|
-
"opfs",
|
|
57
|
+
"./opfs",
|
|
54
58
|
"module":
|
|
55
|
-
"opfs",
|
|
59
|
+
"./opfs",
|
|
56
60
|
"sideEffects":
|
|
57
61
|
false,
|
|
58
62
|
"scripts": {
|
|
@@ -60,10 +64,10 @@
|
|
|
60
64
|
"npx eslint .",
|
|
61
65
|
"prebuild":
|
|
62
66
|
"npm run lint",
|
|
67
|
+
"build-fs-worker":
|
|
68
|
+
"npx webpack --mode 'production' --config 'fs-worker.webpack.config.cjs' --stats-error-details",
|
|
63
69
|
"build":
|
|
64
|
-
"npm install --save-dev"
|
|
65
|
-
"docs":
|
|
66
|
-
"typedoc"
|
|
70
|
+
"npm install --save-dev && npm run build-fs-worker"
|
|
67
71
|
},
|
|
68
72
|
"repository": {
|
|
69
73
|
"type": "git",
|
|
@@ -73,7 +77,13 @@
|
|
|
73
77
|
"@eslint/js":
|
|
74
78
|
"^9.32.0",
|
|
75
79
|
"eslint":
|
|
76
|
-
"^9.32.0"
|
|
80
|
+
"^9.32.0",
|
|
81
|
+
"webpack":
|
|
82
|
+
"^5.102.1",
|
|
83
|
+
"webpack-cli":
|
|
84
|
+
"^6.0.1",
|
|
85
|
+
"web-worker":
|
|
86
|
+
"1.5.0"
|
|
77
87
|
},
|
|
78
88
|
"dependencies": {
|
|
79
89
|
"happy-opfs":
|