diff --git a/ohos/test_collection/.gitignore b/ohos/test_collection/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..24476c5d1eb55824c76d8b01a3965f94abad1ef8 --- /dev/null +++ b/ohos/test_collection/.gitignore @@ -0,0 +1,44 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.packages +.pub-cache/ +.pub/ +/build/ + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/ohos/test_collection/.metadata b/ohos/test_collection/.metadata new file mode 100644 index 0000000000000000000000000000000000000000..5e296a78a68d4f3bf758cae1171c0c2e71ad6edd --- /dev/null +++ b/ohos/test_collection/.metadata @@ -0,0 +1,30 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled. + +version: + revision: 840747ee91d7cfb95661ce7358b7256919075c2a + channel: master + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: 840747ee91d7cfb95661ce7358b7256919075c2a + base_revision: 840747ee91d7cfb95661ce7358b7256919075c2a + - platform: ohos + create_revision: 840747ee91d7cfb95661ce7358b7256919075c2a + base_revision: 840747ee91d7cfb95661ce7358b7256919075c2a + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/ohos/test_collection/README.md b/ohos/test_collection/README.md new file mode 100644 index 0000000000000000000000000000000000000000..fcd37edd990509e7266237e1f13f25f345b33a2c --- /dev/null +++ b/ohos/test_collection/README.md @@ -0,0 +1,16 @@ +# test_collection + +A new Flutter project. + +## Getting Started + +This project is a starting point for a Flutter application. + +A few resources to get you started if this is your first Flutter project: + +- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) +- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) + +For help getting started with Flutter development, view the +[online documentation](https://docs.flutter.dev/), which offers tutorials, +samples, guidance on mobile development, and a full API reference. diff --git a/ohos/test_collection/analysis_options.yaml b/ohos/test_collection/analysis_options.yaml new file mode 100644 index 0000000000000000000000000000000000000000..61b6c4de17c96863d24279f06b85e01b6ebbdb34 --- /dev/null +++ b/ohos/test_collection/analysis_options.yaml @@ -0,0 +1,29 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at + # https://dart-lang.github.io/linter/lints/index.html. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/ohos/test_collection/lib/base/base_page.dart b/ohos/test_collection/lib/base/base_page.dart new file mode 100644 index 0000000000000000000000000000000000000000..4e7696dd6aacb60c31d5f27aec4769a189efd686 --- /dev/null +++ b/ohos/test_collection/lib/base/base_page.dart @@ -0,0 +1,41 @@ +import 'package:flutter/material.dart'; + +import 'main_item_widget.dart'; +import 'test_route.dart'; + +/// 全局静态数据存储 +abstract class GlobalData { + static String appName = ''; +} + +/// app基本首页 +class BasePage extends StatefulWidget { + const BasePage({Key? key, required this.data}) : super(key: key); + + final List data; + + @override + State createState() => _BasePageState(); +} + +class _BasePageState extends State { + int get _itemCount => widget.data.length; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Center( + child: Text(GlobalData.appName, textAlign: TextAlign.center)), + ), + body: + ListView.builder(itemBuilder: _itemBuilder, itemCount: _itemCount)); + } + + Widget _itemBuilder(BuildContext context, int index) { + return MainItemWidget(widget.data[index], (MainItem item) { + Navigator.push( + context, MaterialPageRoute(builder: (content) => item.route)); + }); + } +} diff --git a/ohos/test_collection/lib/base/item_widget.dart b/ohos/test_collection/lib/base/item_widget.dart new file mode 100644 index 0000000000000000000000000000000000000000..64a3e8a5cf9e689e7a991b5d2efd49f0badf9646 --- /dev/null +++ b/ohos/test_collection/lib/base/item_widget.dart @@ -0,0 +1,112 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +import 'test_page.dart'; + +/// Item widget. +class ItemWidget extends StatefulWidget { + /// Item widget. + const ItemWidget( + {required this.item, required this.index, required this.getGroupRange, required this.runGroup, required this.onTap, this.summary, Key? key}) + : super(key: key); + + /// item summary. + final String? summary; + + /// item data. + final Item item; + + /// 当前下标 + final int index; + + /// 获取对应的组信息 + final GroupRange Function() getGroupRange; + + /// 获取对应的组信息 + final void Function(int start, int end) runGroup; + + /// Action when pressed (typically run). + final void Function(Item item) onTap; + + @override + ItemWidgetState createState() => ItemWidgetState(); +} + +class ItemWidgetState extends State { + @override + Widget build(BuildContext context) { + IconData? icon; + Color? color; + + switch (widget.item.state) { + case ItemState.none: + icon = Icons.arrow_forward_ios; + break; + case ItemState.running: + icon = Icons.more_horiz; + break; + case ItemState.success: + icon = Icons.check; + color = Colors.green; + break; + case ItemState.failure: + icon = Icons.close; + color = Colors.red; + break; + } + + final Widget listTile = ListTile( + leading: SizedBox( + child: IconButton( + icon: Icon(icon, color: color), + onPressed: null, + )), + title: Text(widget.item.name), + subtitle: widget.summary != null ? Text(widget.summary!) : null, + onTap: () { + widget.onTap(widget.item); + }); + + final data = widget.getGroupRange(); + + return Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (data.groupName.isNotEmpty && data.startIndex == widget.index) + GestureDetector( + onTap: () {}, + child: Container( + height: 35, + decoration: BoxDecoration(color: CupertinoColors.extraLightBackgroundGray), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + '测试组: ${data.groupName}', + style: TextStyle(fontSize: 18), + ), + FilledButton( + onPressed: () => widget.runGroup(data.startIndex, data.startIndex), + child: Text( + '整组测试', + style: TextStyle(fontSize: 16), + )) + ], + ), + ), + ), + Container( + margin: data.groupName.isNotEmpty && data.startIndex == widget.index ? EdgeInsets.only(bottom: 10) : null, + decoration: BoxDecoration( + border: data.groupName.isNotEmpty && data.endIndex == widget.index ? Border(bottom: BorderSide(color: Colors.grey)) : null, + ), + child: Padding( + padding: data.groupName.isNotEmpty && data.startIndex <= widget.index && data.endIndex >= widget.index ? EdgeInsets.only(left: 35) : EdgeInsets.zero, + child: listTile, + ), + ) + ], + ); + } +} diff --git a/ohos/test_collection/lib/base/main_item_widget.dart b/ohos/test_collection/lib/base/main_item_widget.dart new file mode 100644 index 0000000000000000000000000000000000000000..32f8261b736c517c5984710ec950be96470dacdc --- /dev/null +++ b/ohos/test_collection/lib/base/main_item_widget.dart @@ -0,0 +1,35 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'test_route.dart'; + +/// Main item widget. +class MainItemWidget extends StatefulWidget { + /// Main item widget. + const MainItemWidget(this.item, this.onTap, {Key? key}) : super(key: key); + + /// item data. + final MainItem item; + + /// onTap action (typically run or open). + final void Function(MainItem item) onTap; + + @override + MainItemWidgetState createState() => MainItemWidgetState(); +} + +class MainItemWidgetState extends State { + @override + Widget build(BuildContext context) { + return Container( + margin: const EdgeInsets.only(bottom: 10), + child: ListTile( + tileColor: CupertinoColors.extraLightBackgroundGray, + title: Text(widget.item.title), + onTap: _onTap), + ); + } + + void _onTap() { + widget.onTap(widget.item); + } +} diff --git a/ohos/test_collection/lib/base/test_model_app.dart b/ohos/test_collection/lib/base/test_model_app.dart new file mode 100644 index 0000000000000000000000000000000000000000..f565a5f8dab474f51e2a0c16cf745a6f7887b65b --- /dev/null +++ b/ohos/test_collection/lib/base/test_model_app.dart @@ -0,0 +1,36 @@ +import 'package:flutter/material.dart'; + +import 'base_page.dart'; +import 'test_route.dart'; + +/// 基础app框架 +class TestModelApp extends StatefulWidget { + TestModelApp({Key? key, required this.appName, required this.data}) : super(key: key) { + GlobalData.appName = appName; + } + + /// 测试包名称 + final String appName; + + /// 路由数据 + final List data; + + @override + State createState() => TestModelState(); +} + +class TestModelState extends State { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: widget.appName, + theme: ThemeData( + colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue), + appBarTheme: const AppBarTheme(backgroundColor: Colors.blue), + primarySwatch: Colors.blue, + useMaterial3: true, + ), + home: BasePage(data: widget.data), + ); + } +} diff --git a/ohos/test_collection/lib/base/test_page.dart b/ohos/test_collection/lib/base/test_page.dart new file mode 100644 index 0000000000000000000000000000000000000000..babcabaa7a2518f65dbfed58afa0017739ec540e --- /dev/null +++ b/ohos/test_collection/lib/base/test_page.dart @@ -0,0 +1,309 @@ +import 'dart:async'; + +import 'package:flutter/material.dart'; + +import 'item_widget.dart'; + +List contentList = []; + +class Test { + /// Test definition. + Test(this.name, this.fn, {bool? solo, bool? skip}) + : solo = solo == true, + skip = skip == true; + + /// Only run this test. + final bool solo; + + /// Skip this test. + final bool skip; + + /// Test name. + String name; + + /// Test body. + FutureOr Function() fn; +} + +/// Item states. +enum ItemState { + /// test not run yet. + none, + + /// test is running. + running, + + /// test succeeded. + success, + + /// test fails. + failure +} + +/// Menu item. +class Item { + /// Menu item. + Item(this.name); + + /// Menu item state. + ItemState state = ItemState.running; + + /// Menu item name/ + String name; +} + +class TestLength { + TestLength(this.oldLength, this.newLength); + + int oldLength; + int newLength; +} + +class GroupRange { + GroupRange(this.groupName, this.startIndex, this.endIndex); + + String groupName; + int startIndex; + int endIndex; +} + +/// 基础测试页面 +class TestPage extends StatefulWidget { + /// Base test page. + TestPage({required this.title, Key? key}) : super(key: key); + + /// The title. + final String title; + + /// Test list. + final List tests = []; + + /// 保存group的范围信息 + final Map groupTitle = {}; + + /// define a test. + void test(String name, FutureOr Function() fn) { + tests.add(Test(name, fn)); + } + + /// define a group test. + void group(String name, FutureOr Function() fn) { + int oldLength = tests.length; + fn(); + + int newLength = tests.length - 1; + groupTitle.addAll({name: TestLength(oldLength, newLength)}); + } + + /// Thrown an exception + void fail([String? message]) { + throw Exception(message ?? 'should fail'); + } + + @override + TestPageState createState() => TestPageState(); +} + +/// Group. +mixin Group { + /// List of tests. + List get tests { + throw UnimplementedError(); + } + + bool? _hasSolo; + final _tests = []; + + /// Add a test. + void add(Test test) { + if (!test.skip) { + if (test.solo) { + if (_hasSolo != true) { + _hasSolo = true; + _tests.clear(); + } + _tests.add(test); + } else if (_hasSolo != true) { + _tests.add(test); + } + } + } + + /// true if it has solo or contains item with solo feature + bool? get hasSolo => _hasSolo; +} + +class TestPageState extends State with Group { + List items = []; + + Future _run() async { + if (!mounted) { + return null; + } + + setState(() { + items.clear(); + }); + _tests.clear(); + for (var test in widget.tests) { + add(test); + } + for (var test in _tests) { + var item = Item(test.name); + contentList.add(Text(test.name, style: const TextStyle(fontSize: 18, color: Colors.green))); + + late int position; + setState(() { + position = items.length; + items.add(item); + }); + try { + await test.fn(); + item = Item(test.name)..state = ItemState.success; + print('ohFlutter: ${test.name}, result: success'); + } catch (e, st) { + contentList.add(Text('$e, $st', style: const TextStyle(fontSize: 18, color: Colors.red))); + print('ohFlutter: ${test.name}-error: $e, $st}'); + item = Item(test.name)..state = ItemState.failure; + } + + if (!mounted) { + return null; + } + + setState(() { + items[position] = item; + }); + } + } + + Future _runTest(int index) async { + if (!mounted) { + return null; + } + + final test = _tests[index]; + + var item = items[index]; + setState(() { + contentList = []; + item.state = ItemState.running; + }); + contentList.add(Text(test.name, style: const TextStyle(fontSize: 18, color: Colors.green))); + try { + await test.fn(); + + item = Item(test.name)..state = ItemState.success; + print('ohFlutter: ${test.name}, result: success'); + } catch (e, st) { + contentList.add(Text('$e, $st', style: const TextStyle(fontSize: 18, color: Colors.red))); + print('ohFlutter: ${test.name}-error: $e, $st}'); + try { + print(st); + } catch (_) {} + item = Item(test.name)..state = ItemState.failure; + } + + if (!mounted) { + return null; + } + + setState(() { + items[index] = item; + }); + } + + @override + void initState() { + super.initState(); + contentList = []; + _run(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar(title: Text(widget.title), actions: [ + IconButton( + icon: const Icon(Icons.search), + tooltip: 'Results', + onPressed: () { + showAlertDialog(context); + }, + ), + IconButton( + icon: const Icon(Icons.refresh), + tooltip: 'Run again', + onPressed: _run, + ), + ]), + body: ListView(children: [ + ...items.asMap().keys.map((e) => _itemBuilder(context, e)).toList(), + ])); + } + + Widget _itemBuilder(BuildContext context, int index) { + final item = getItem(index); + return ItemWidget( + item: item, + index: index, + getGroupRange: () { + GroupRange data = GroupRange('', 0, 0); + widget.groupTitle.forEach((key, value) { + if (value.oldLength <= index && value.newLength >= index) { + data = GroupRange(key, value.oldLength, value.newLength); + } + }); + return data; + }, + runGroup: (start, end) async { + for (var i = start; i <= end; i++) { + await _runTest(i); + print('\n'); + } + }, + onTap: (Item item) { + _runTest(index); + }); + } + + Item getItem(int index) { + return items[index]; + } + + @override + List get tests => widget.tests; +} + +void expect(var testModel, var object) { + try { + testModel; + contentList.add(Text('运行正常,输出参数为$testModel')); + } catch(e) { + contentList.add(Text('运行失败,错误信息为$e')); + print(e.toString()); + } +} + +void showAlertDialog(BuildContext context) { + showDialog( + context: context, + barrierDismissible: false, + builder: (BuildContext context) { + return AlertDialog( + content: SingleChildScrollView( + child: Column( + children: contentList, + ), + ), + actions: [ + MaterialButton( + child: const Text('确定'), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + ], + ); + }); +} \ No newline at end of file diff --git a/ohos/test_collection/lib/base/test_route.dart b/ohos/test_collection/lib/base/test_route.dart new file mode 100644 index 0000000000000000000000000000000000000000..dc37452a13174a378beda98af423a6c1717d1c57 --- /dev/null +++ b/ohos/test_collection/lib/base/test_route.dart @@ -0,0 +1,13 @@ +import 'package:flutter/cupertino.dart'; + +class MainItem { + /// Main item. + MainItem(this.title, this.route); + + /// Title. + String title; + + /// Page route. + Widget route; +} + diff --git a/ohos/test_collection/lib/main.dart b/ohos/test_collection/lib/main.dart new file mode 100644 index 0000000000000000000000000000000000000000..91a7b961837fd4302d55d82bfe2d1343fa3a5ca0 --- /dev/null +++ b/ohos/test_collection/lib/main.dart @@ -0,0 +1,50 @@ +import 'package:flutter/material.dart'; +import 'package:test_collection/page/algorithms_test.dart'; +import 'package:test_collection/page/boollist_test.dart'; +import 'package:test_collection/page/canonicalized_map_test.dart'; +import 'package:test_collection/page/comparators_test.dart'; +import 'package:test_collection/page/equality_map_test.dart'; +import 'package:test_collection/page/equality_set_test.dart'; +import 'package:test_collection/page/equality_test.dart'; +import 'package:test_collection/page/functions_test.dart'; +import 'package:test_collection/page/ignore_ascii_case_test.dart'; +import 'package:test_collection/page/iterable_test_page.dart'; +import 'package:test_collection/page/iterable_zip_test.dart'; +import 'package:test_collection/page/list_test.dart'; +import 'package:test_collection/page/map_test.dart'; +import 'package:test_collection/page/priority_queue_test.dart'; +import 'package:test_collection/page/queue_list_test.dart'; +import 'package:test_collection/page/union_set_controller_test.dart'; +import 'package:test_collection/page/union_set_test.dart'; +import 'package:test_collection/page/unmodifiable_collection_test.dart'; + +import 'base/test_model_app.dart'; +import 'base/test_route.dart'; + +void main() { + final app = [ + MainItem('CombinedIterableView', + CombinedIterableViewTestPage('CombinedIterableView')), + MainItem('CombinedListView', CombinedListViewTestPage('CombinedListView')), + MainItem('CombinedMapView', CombinedMapViewTestPage('CombinedMapView')), + MainItem('Algorithms', AlgorithmsTestPage('Algorithms')), + MainItem('BoolList', BoolListTestPage('BoolList')), + MainItem('CanonicalizedMap', CanonicalizedMapTestPage('CanonicalizedMap')), + MainItem('comparators', ComparatorsTestPage('comparators')), + MainItem('EqualityMap', EqualityMapTestPage('EqualityMap')), + MainItem('EqualitySet', EqualitySetTestPage('EqualitySet')), + MainItem('Equality', EqualityTestPage('Equality')), + MainItem('Functions', FunctionsTestPage('Functions')), + MainItem('IgnoreAsciiCase', IgnoreAsciiCaseTestPage('IgnoreAsciiCase')), + MainItem('IterableZip', IterableZipTestPage('IterableZip')), + MainItem('PriorityQueue', PriorityQueueTestPage('PriorityQueue')), + MainItem('QueueList', QueueListTestPage('QueueList')), + MainItem( + 'UnionSetController', UnionSetControllerTestPage('UnionSetController')), + MainItem('UnionSet', UnionSetTestPage('UnionSet')), + MainItem('UnmodifiableCollection', + UnmodifiableCollectionTestPage('UnmodifiableCollection')), + ]; + + runApp(TestModelApp(appName: 'collection', data: app)); +} diff --git a/ohos/test_collection/lib/page/algorithms_test.dart b/ohos/test_collection/lib/page/algorithms_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..d599c02fdaa3591a43d67ef248b8c5a4a135a5f4 --- /dev/null +++ b/ohos/test_collection/lib/page/algorithms_test.dart @@ -0,0 +1,355 @@ +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// Tests algorithm utilities. +import 'dart:math'; + +import 'package:collection/collection.dart'; +import 'package:collection/src/algorithms.dart'; +import 'package:flutter/material.dart'; +import 'package:test_collection/base/test_page.dart'; + +class AlgorithmsTestPage extends TestPage { + AlgorithmsTestPage(String title,{ Key? key}) : super(title: title, key: key) { + test('Shuffle[0]', () { + testShuffle([]); + }); + test('Shuffle[1]', () { + testShuffle([1]); + }); + test('Shuffle[1,2,3]', () { + testShuffle([1, 2, 3]); + }); + test('Shuffle[1, 2, 3, 4, 5, 1, 3, 5, 7, 9]', () { + testShuffle([1, 2, 3, 4, 5, 1, 3, 5, 7, 9]); + }); + test('Shuffle shuffles', () { + var l = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; + var c = l.toList(); + var count = 0; + for (;;) { + shuffle(l); + if (!const ListEquality().equals(c, l)) return; + // Odds of not changing the order should be one in ~ 16! ~= 2e+13. + // Repeat this 10 times, and the odds of accidentally shuffling to the + // same result every time is disappearingly tiny. + count++; + // If this happens even once, it's ok to report it. + print('Failed shuffle $count times'); + if (count == 10) fail("Shuffle didn't change order."); + } + }); + test('Shuffle 子列表', () { + var l = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; + var c = l.toList(); + shuffle(l, 4, 12); + const IterableEquality().equals(l.getRange(0, 4), c.getRange(0, 4)); + expect(const IterableEquality().equals(l.getRange(12, 16), c.getRange(12, 16)), true); + expect(const UnorderedIterableEquality().equals(l.getRange(4, 12), c.getRange(4, 12)), true); + }); + + test('binarySearch([], 2)', () { + expect(binarySearch([], 2), -1); + }); + + test('binarySearch([5], 2)', () { + binarySearch([5], 2); + }); + + test('binarySearch([0, 5, 10], -1)', () { + binarySearch([0, 5, 10], -1); + binarySearch([0, 5, 10], 0); + binarySearch([0, 5, 10], 2); + }); + + test('binarySearch([], C(2)', () { + binarySearch([], C(2), compare: compareC); + }); + + test('binarySearch(l1, C(2)', () { + var l1 = [C(5)]; + binarySearch(l1, C(2), compare: compareC); + }); + + test('binarySearch(l3, C(2)', () { + var l3 = [C(0), C(5), C(10)]; + binarySearch(l3, C(2), compare: compareC); + }); + + test('lowerBound([], 2)', () { + lowerBound([], 2); + }); + + test('lowerBound([5], 5)', () { + lowerBound([5], 5); + }); + + test('lowerBound([0, 5, 10], 2)', () { + lowerBound([0, 5, 10], 2); + }); + + test('lowerBound([0, 5, 5, 5, 10], 5)', () { + lowerBound([0, 5, 5, 5, 10], 5); + }); + + test('lowerBound([], C(2), compare: compareC)', () { + lowerBound([], C(2), compare: compareC); + }); + + test('lowerBound(l1, C(5), compare: compareC)', () { + var l1 = [C(5)]; + lowerBound(l1, C(5), compare: compareC); + }); + + test('lowerBound(l3, C(2), compare: compareC)', () { + var l3 = [C(0), C(5), C(10)]; + lowerBound(l3, C(2), compare: compareC); + }); + + test('lowerBound(l2, C(5), compare: compareC)', () { + var l2 = [C(0), C(5), C(5), C(5), C(10)]; + lowerBound(l2, C(5), compare: compareC); + }); + + void testSort(String name, void Function(List elements, [int? start, int? end]) sort) { + test('${name}Random', () { + var random = Random(); + for (var i = 0; i < 250; i += 10) { + var list = [ + for (var j = 0; j < i; j++) random.nextInt(25) // Expect some equal elements. + ]; + sort(list); + for (var j = 1; j < i; j++) { + expect(list[j - 1], list[j]); + } + } + }); + + test('list.sort()', () { + var list = [6, 5, 4, 3, 2, 1]; + sort(list, 2, 4); + print(list); + sort(list, 1, 1); + print(list); + sort(list, 4, 6); + print(list); + sort(list, 0, 2); + print(list); + sort(list, 0, 6); + print(list); + }); + } + + int intId(int x) => x; + int intCompare(int a, int b) => a - b; + testSort('insertionSortBy', (list, [start, end]) { + insertionSortBy(list, intId, intCompare, start ?? 0, end ?? list.length); + }); + testSort('mergeSort compare', (list, [start, end]) { + mergeSort(list, start: start ?? 0, end: end ?? list.length, compare: intCompare); + }); + testSort('mergeSort comparable', (list, [start, end]) { + mergeSort(list, start: start ?? 0, end: end ?? list.length); + }); + testSort('mergeSortBy', (list, [start, end]) { + mergeSortBy(list, intId, intCompare, start ?? 0, end ?? list.length); + }); + testSort('quickSort', (list, [start, end]) { + quickSort(list, intCompare, start ?? 0, end ?? list.length); + }); + testSort('quickSortBy', (list, [start, end]) { + quickSortBy(list, intId, intCompare, start ?? 0, end ?? list.length); + }); + test('MergeSortSpecialCases', () { + for (var size in [511, 512, 513]) { + // All equal. + var list = List.generate(size, (i) => OC(0, i)); + mergeSort(list); + for (var i = 0; i < size; i++) { + list[i].order; + } + // All but one equal, first. + list[0] = OC(1, 0); + for (var i = 1; i < size; i++) { + list[i] = OC(0, i); + } + mergeSort(list); + for (var i = 0; i < size - 1; i++) { + list[i].order; + } + list[size - 1].order; + + // All but one equal, last. + for (var i = 0; i < size - 1; i++) { + list[i] = OC(0, i); + } + list[size - 1] = OC(-1, size - 1); + mergeSort(list); + list[0].order; + for (var i = 1; i < size; i++) { + list[i].order; + } + + // Reversed. + for (var i = 0; i < size; i++) { + list[i] = OC(size - 1 - i, i); + } + mergeSort(list); + for (var i = 0; i < size; i++) { + list[i].id; + list[i].order; + } + } + }); + + void testSortBy( + String name, void Function(List elements, K Function(T element) keyOf, int Function(K a, K b) compare, [int start, int end]) sort) { + for (var n in [0, 1, 2, 10, 75, 250]) { + var name2 = name; + test('$name2: Same #$n', () { + var list = List.generate(n, (i) => OC(i, 0)); + // Should succeed. Bad implementations of, e.g., quicksort can diverge. + sort(list, ocOrder, compareInt); + }); + test('$name: Pre-sorted #$n', () { + var list = List.generate(n, (i) => OC(-i, i)); + var expected = list.toList(); + sort(list, ocOrder, compareInt); + // Elements have not moved. + expect(list, expected); + }); + test('$name: Reverse-sorted #$n', () { + var list = List.generate(n, (i) => OC(i, -i)); + sort(list, ocOrder, compareInt); + expectSorted(list, ocOrder, compareInt); + }); + test('$name: Random #$n', () { + var random = Random(); + var list = List.generate(n, (i) => OC(i, random.nextInt(n))); + sort(list, ocOrder, compareInt); + expectSorted(list, ocOrder, compareInt); + }); + test('$name: Sublist #$n', () { + var random = Random(); + var list = List.generate(n, (i) => OC(i, random.nextInt(n))); + var original = list.toList(); + var start = n ~/ 4; + var end = start * 3; + sort(list, ocOrder, compareInt, start, end); + expectSorted(list, ocOrder, compareInt, start, end); + expect(list.sublist(0, start), original.sublist(0, start)); + expect(list.sublist(end), original.sublist(end)); + }); + } + } + + testSortBy('insertionSort', insertionSortBy); + testSortBy('mergeSort', mergeSortBy); + testSortBy('quickSortBy', quickSortBy); + + test('MergeSortPreservesOrder', () { + var random = Random(); + // Small case where only insertion call is called, + // larger case where the internal moving insertion sort is used + // larger cases with multiple splittings, numbers just around a power of 2. + for (var size in [8, 50, 511, 512, 513]) { + // Class OC compares using id. + // With size elements with id's in the range 0..size/4, a number of + // collisions are guaranteed. These should be sorted so that the 'order' + // part of the objects are still in order. + var list = [for (var i = 0; i < size; i++) OC(random.nextInt(size >> 2), i)]; + mergeSort(list); + var prev = list[0]; + for (var i = 1; i < size; i++) { + var next = list[i]; + expect(prev.id, next.id); + if (next.id == prev.id) { + expect(prev.order, next.order); + } + prev = next; + } + // Reverse compare on part of list. + List copy = list.toList(); + var min = size >> 2; + var max = size - min; + mergeSort(list, start: min, end: max, compare: (a, b) => b.compareTo(a)); + prev = list[min]; + for (var i = min + 1; i < max; i++) { + var next = list[i]; + expect(prev.id, next.id); + if (next.id == prev.id) { + expect(prev.order, next.order); + } + prev = next; + } + // Equals on OC objects is identity, so this means the parts before min, + // and the parts after max, didn't change at all. + expect(list.sublist(0, min), copy.sublist(0, min)); + expect(list.sublist(max), copy.sublist(max)); + } + }); + + test('Reverse', () { + var l = [6, 5, 4, 3, 2, 1]; + reverse(l, 2, 4); + expect(l, [6, 5, 3, 4, 2, 1]); + reverse(l, 1, 1); + expect(l, [6, 5, 3, 4, 2, 1]); + reverse(l, 4, 6); + expect(l, [6, 5, 3, 4, 1, 2]); + reverse(l, 0, 2); + expect(l, [5, 6, 3, 4, 1, 2]); + reverse(l, 0, 6); + expect(l, [2, 1, 4, 3, 6, 5]); + }); + } + + int compareC(C one, C other) => one.id - other.id; + + int cId(C c) => c.id; + + int ocId(OC oc) => oc.id; + + int ocOrder(OC oc) => oc.order; + + int compareInt(int a, int b) => a - b; + + /// Check that a list is sorted according to [compare] of [keyOf] of elements. + void expectSorted(List list, K Function(T element) keyOf, int Function(K a, K b) compare, [int start = 0, int? end]) { + end ??= list.length; + if (start == end) return; + var prev = keyOf(list[start]); + for (var i = start + 1; i < end; i++) { + var next = keyOf(list[i]); + expect(compare(prev, next), null); + prev = next; + } + } + + void testShuffle(List list) { + var copy = list.toList(); + shuffle(list); + expect(UnorderedIterableEquality().equals(list, copy), true); + } +} + +class C { + final int id; + + C(this.id); +} + +/// Class naturally ordered by its first constructor argument. +class OC implements Comparable { + final int id; + final int order; + + OC(this.id, this.order); + + @override + int compareTo(OC other) => id - other.id; + + @override + String toString() => 'OC[$id,$order]'; +} diff --git a/ohos/test_collection/lib/page/boollist_test.dart b/ohos/test_collection/lib/page/boollist_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..d4d1b8eeb6e42dd3f71d136a7a0284be9bdf40d2 --- /dev/null +++ b/ohos/test_collection/lib/page/boollist_test.dart @@ -0,0 +1,122 @@ +// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +// Tests for BoolList. + +import 'package:collection/collection.dart'; +import 'package:flutter/material.dart'; +import 'package:test_collection/base/test_page.dart'; + +class BoolListTestPage extends TestPage { + BoolListTestPage(String title, {Key? key}) : super(title: title, key: key) { + test('BoolList()', () { + expect(BoolList(1024, fill: false), List.filled(1024, false)); + + expect(BoolList(1024, fill: true), List.filled(1024, true)); + }); + + test('BoolList.empty()', () { + expect(BoolList.empty(growable: true, capacity: 1024), []); + + expect(BoolList.empty(growable: false, capacity: 1024), []); + }); + + test('BoolList.generate()', () { + expect( + BoolList.generate(1024, generator), + List.generate(1024, generator), + ); + }); + + test('BoolList.of()', () { + var src = List.generate(1024, generator); + expect(BoolList.of(src), src); + }); + + group('BoolList参数批量测试', () { + test('长度获取错误, 此处应为X', () async { + var b = BoolList(1024, fill: false); + + b[-1]; + + b[1024]; + }); + }); + + test('BoolList.length', () { + var b = BoolList(1024, fill: true, growable: true); + + b.length = 768; + expect(b, List.filled(768, true)); + + b.length = 128; + expect(b, List.filled(128, true)); + + b.length = 0; + expect(b, []); + + b = BoolList(256, fill: true, growable: true); + + b.length = 384; + expect(b, List.filled(384, false)..fillRange(0, 256, true)); + + b.length = 2048; + expect(b, List.filled(2048, false)..fillRange(0, 256, true)); + + b = BoolList(0, growable: true); + expect(b.length, 0); + + b.length = 256; + expect(b, List.filled(256, false)); + + + + + }); + + test('BoolList.fillRange', () { + BoolList(1024)..fillRange(32, 64, true); + List.filled(1024, false)..fillRange(32, 64, true); + + BoolList.generate(1024, (i) => true)..fillRange(32, 64, false); + List.filled(1024, true)..fillRange(32, 64, false); + + BoolList(1024)..fillRange(32, 128, true); + List.filled(1024, false)..fillRange(32, 128, true); + + BoolList.generate(1024, (i) => true)..fillRange(32, 128, false); + List.filled(1024, true)..fillRange(32, 128, false); + expect(List.filled(1024, true)..fillRange(32, 128, false), null); + }); + + test('BoolList.iterator', () { + var b = BoolList.generate(1024, generator); + var iter = b.iterator; + + expect(iter.current, false); + for (var i = 0; i < 1024; i++) { + expect(iter.moveNext(), true); + + expect(iter.current, generator(i)); + } + + expect(iter.moveNext(), false); + expect(iter.current, false); + + b = BoolList(1024, fill: true, growable: true); + + iter = b.iterator; + + iter.moveNext(); + + }); + } + + bool generator(int index) { + if (index < 512) { + return index.isEven; + } + return false; + } +} diff --git a/ohos/test_collection/lib/page/canonicalized_map_test.dart b/ohos/test_collection/lib/page/canonicalized_map_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..da3cb020964061f2eb5f8c3998eab7b6b16937b9 --- /dev/null +++ b/ohos/test_collection/lib/page/canonicalized_map_test.dart @@ -0,0 +1,168 @@ +// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:collection/collection.dart'; +import 'package:flutter/material.dart'; +import 'package:test_collection/base/test_page.dart'; + +class CanonicalizedMapTestPage extends TestPage { + CanonicalizedMapTestPage(String title, {Key? key}) + : super(title: title, key: key) { + group('map的key有格式要求', () { + late CanonicalizedMap map; + + map = CanonicalizedMap(int.parse, isValidKey: RegExp(r'^\d+$').hasMatch); + + test("CanonicalizedMap[key] -> map['1'], map['01']", () { + map['1'] = 'value'; + final x = map['01']; + map['foo'] = 'value'; + expect(map['foo'], null); + expect(map.containsKey('foo'), true); + map.length; + expect(map['foo'], null); + }); + + test('CanonicalizedMap.addAll', () { + map.addAll({'1': 'value 1', '2': 'value 2', '3': 'value 3'}); + map['01']; + map['02']; + map['03']; + }); + + test('CanonicalizedMap.length', () { + map.addAll({'1': 'value 1', '01': 'value 2', '001': 'value 3'}); + map.length; + map['0001']; + }); + + test('CanonicalizedMap.clear()', () { + map.addAll({'1': 'value 1', '2': 'value 2', '3': 'value 3'}); + expect(map, null); + map.clear(); + map.isEmpty; + }); + + test('CanonicalizedMap.containsKey()', () { + map['1'] = 'value'; + expect(map.containsKey('01'), true); + expect(map.containsKey('2'), false); + + expect(map.containsKey('foo'), false); + }); + + test('CanonicalizedMap.putIfAbsent', () { + map['1'] = 'value'; + map.putIfAbsent('01', () => throw Exception("shouldn't run")); + map.putIfAbsent('2', () => 'new value'); + }); + + test('CanonicalizedMap.remove', () { + map['1'] = 'value'; + expect(map.remove('2'), null); + map.remove('01'); + map.isEmpty; + map.remove('foo'); + }); + + test('CanonicalizedMap.containsValue', () { + map['1'] = 'value'; + expect(map.containsValue('value'), true); + expect(map.containsValue('not value'), false); + }); + + test('CanonicalizedMap.isEmpty', () { + expect(map.isEmpty, true); + map['1'] = 'value'; + expect(map.isEmpty, false); + map.remove('01'); + expect(map.isEmpty, true); + }); + + test("CanonicalizedMap.isNotEmpty", () { + expect(map.isNotEmpty, false); + map['1'] = 'value'; + expect(map.isNotEmpty, true); + map.remove('01'); + expect(map.isNotEmpty, false); + }); + + test('CanonicalizedMap.length', () { + map.length; + map['1'] = 'value 1'; + map.length; + map['01'] = 'value 01'; + map.length; + map['02'] = 'value 02'; + map.length; + }); + + test('CanonicalizedMap.keys', () { + map['001'] = 'value 1'; + map['02'] = 'value 2'; + map.keys; + }); + + test('CanonicalizedMap.forEach', () { + map['001'] = 'value 1'; + map['02'] = 'value 2'; + + var keys = []; + map.forEach((key, value) => keys.add(key)); + expect(keys, ['001', '02']); + }); + + test('CanonicalizedMap.values', () { + map.addAll({ + '1': 'value 1', + '01': 'value 01', + '2': 'value 2', + '03': 'value 03' + }); + + expect(map.values, ['value 01', 'value 2', 'value 03']); + }); + + test('CanonicalizedMap.entries', () { + map.addAll({ + '1': 'value 1', + '01': 'value 01', + '2': 'value 2', + }); + + var entries = map.entries.toList(); + expect(entries[0].key, '01'); + expect(entries[0].value, 'value 01'); + expect(entries[1].key, '2'); + expect(entries[1].value, 'value 2'); + }); + + test('CanonicalizedMap.addEntries', () { + map.addEntries([ + MapEntry('1', 'value 1'), + MapEntry('01', 'value 01'), + MapEntry('2', 'value 2'), + ]); + expect(map, {'01': 'value 01', '2': 'value 2'}); + }); + + test('CanonicalizedMap.cast()', () { + expect(map.cast(), map); + }); + }); + + test('CanonicalizedMap.from', () { + var map = CanonicalizedMap.from( + {'1': 'value 1', '2': 'value 2', '3': 'value 3'}, int.parse); + expect(map['01'], ('value 1')); + expect(map['02'], ('value 2')); + expect(map['03'], ('value 3')); + + map = CanonicalizedMap.from( + {'1': 'value 1', '01': 'value 2', '001': 'value 3'}, int.parse); + expect(map.length, (1)); + expect(map['0001'], ('value 3')); + }); + } +} diff --git a/ohos/test_collection/lib/page/comparators_test.dart b/ohos/test_collection/lib/page/comparators_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..b517432b621d6b71c2613de51a8204b857203325 --- /dev/null +++ b/ohos/test_collection/lib/page/comparators_test.dart @@ -0,0 +1,124 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:collection/collection.dart'; +import 'package:flutter/material.dart'; +import 'package:test_collection/base/test_page.dart'; + +class ComparatorsTestPage extends TestPage { + ComparatorsTestPage(String title,{ Key? key}) : super(title: title, key: key) { + var strings = [ + '', + '\x00', + ' ', + '+', + '/', + '0', + '00', + '000', + '001', + '01', + '011', + '1', + '100', + '11', + '110', + '9', + ':', + '=', + '@', + 'A', + 'A0', + 'A000A', + 'A001A', + 'A00A', + 'A01A', + 'A0A', + 'A1A', + 'AA', + 'AAB', + 'AB', + 'Z', + '[', + '_', + '`', + 'a', + 'a0', + 'a000a', + 'a001a', + 'a00a', + 'a01a', + 'a0a', + 'a1a', + 'aa', + 'aab', + 'ab', + 'z', + '{', + '~' + ]; + + List sortedBy(int Function(String, String)? compare) => + strings.toList() + ..shuffle() + ..sort(compare); + + test('String.compareTo', () { + expect(sortedBy(null), strings); + }); + + test('compareAsciiLowerCase', () { + expect(sortedBy(compareAsciiLowerCase), sortedBy((a, b) { + var delta = a.toLowerCase().compareTo(b.toLowerCase()); + if (delta != 0) return delta; + if (a == b) return 0; + return a.compareTo(b); + })); + }); + + test('compareAsciiUpperCase', () { + expect(sortedBy(compareAsciiUpperCase), sortedBy((a, b) { + var delta = a.toUpperCase().compareTo(b.toUpperCase()); + if (delta != 0) return delta; + if (a == b) return 0; + return a.compareTo(b); + })); + }); + + // Replace any digit sequence by ("0", value, length) as char codes. + // This will sort alphabetically (by charcode) the way digits sort + // numerically, and the leading 0 means it sorts like a digit + // compared to non-digits. + String replaceNumbers(String string) => + string.replaceAllMapped(RegExp(r'\d+'), (m) { + var digits = m[0]!; + return String.fromCharCodes([0x30, int.parse(digits), digits.length]); + }); + + test('compareNatural', () { + expect(sortedBy(compareNatural), + sortedBy((a, b) => replaceNumbers(a).compareTo(replaceNumbers(b)))); + }); + + test('compareAsciiLowerCaseNatural', () { + expect(sortedBy(compareAsciiLowerCaseNatural), sortedBy((a, b) { + var delta = replaceNumbers(a.toLowerCase()) + .compareTo(replaceNumbers(b.toLowerCase())); + if (delta != 0) return delta; + if (a == b) return 0; + return a.compareTo(b); + })); + }); + + test('compareAsciiUpperCaseNatural', () { + expect(sortedBy(compareAsciiUpperCaseNatural), sortedBy((a, b) { + var delta = replaceNumbers(a.toUpperCase()) + .compareTo(replaceNumbers(b.toUpperCase())); + if (delta != 0) return delta; + if (a == b) return 0; + return a.compareTo(b); + })); + }); + } +} \ No newline at end of file diff --git a/ohos/test_collection/lib/page/equality_map_test.dart b/ohos/test_collection/lib/page/equality_map_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..1e76572baf4cd8aa00c2f13e02c97938510df88c --- /dev/null +++ b/ohos/test_collection/lib/page/equality_map_test.dart @@ -0,0 +1,39 @@ +// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:collection/collection.dart'; +import 'package:flutter/material.dart'; +import 'package:test_collection/base/test_page.dart'; + + +class EqualityMapTestPage extends TestPage { + EqualityMapTestPage(String title,{ Key? key}) : super(title: title, key: key) { + test('EqualityMap', () { + var map = EqualityMap(const IterableEquality()); + map.isEmpty; + + map[[1, 2, 3]] = 1; + map[[1, 2, 3]]; + + map[[1, 2, 3]] = 2; + map[[1, 2, 3]]; + + map[[2, 3, 4]] = 3; + map[[2, 3, 4]]; + }); + + test('EqualityMap.from()', () { + var map = EqualityMap.from(const IterableEquality(), { + [1, 2, 3]: 1, + [2, 3, 4]: 2, + [1, 2, 3]: 3, + [2, 3, 4]: 4, + [1, 2, 3]: 5, + [1, 2, 3]: 6, + }); + expect(map[[1, 2, 3]]== 1, true); + expect(map[[2, 3, 4]]== 2, true); + }); + } +} \ No newline at end of file diff --git a/ohos/test_collection/lib/page/equality_set_test.dart b/ohos/test_collection/lib/page/equality_set_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..b3483e88a25e3c1c741cd3d223298828223877ca --- /dev/null +++ b/ohos/test_collection/lib/page/equality_set_test.dart @@ -0,0 +1,52 @@ +// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:collection/collection.dart'; +import 'package:flutter/material.dart'; +import 'package:test_collection/base/test_page.dart'; + +class EqualitySetTestPage extends TestPage { + EqualitySetTestPage(String title, {Key? key}) + : super(title: title, key: key) { + test('EqualitySet.add EqualitySet.contains', () { + var set = EqualitySet(const IterableEquality()); + expect(set.isEmpty, true); + + var list1 = [1, 2, 3]; + expect(set.add(list1), true); + expect(set.contains([1, 2, 3]), true); + expect(set.contains((list1)), true); + + var list2 = [1, 2, 3]; + expect(set.add(list2), false); + expect(set.contains([1, 2, 3]), true); + expect(set.contains((list1)), true); + expect(set.contains((list2)), true); + + var list3 = [2, 3, 4]; + expect(set.add(list3), true); + expect(set.contains((list1)), true); + expect(set.contains((list3)), true); + }); + + test('EqualitySet.from().contains', () { + var list1 = [1, 2, 3]; + var list2 = [2, 3, 4]; + var list3 = [1, 2, 3]; + var list4 = [2, 3, 4]; + var list5 = [1, 2, 3]; + var list6 = [1, 2, 3]; + + var set = EqualitySet.from( + const IterableEquality(), [list1, list2, list3, list4, list5, list6]); + + expect(set.contains((list1)), true); + expect(set.contains((list2)), true); + expect(set.contains((list3)), true); + expect(set.contains((list4)), true); + expect(set.contains((list5)), true); + expect(set.contains((list6)), true); + }); + } +} diff --git a/ohos/test_collection/lib/page/equality_test.dart b/ohos/test_collection/lib/page/equality_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..65e5844e61e1d0799085899aadb736aa3a90289a --- /dev/null +++ b/ohos/test_collection/lib/page/equality_test.dart @@ -0,0 +1,286 @@ +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +// Tests equality utilities. + +import 'dart:collection'; + +import 'package:collection/collection.dart'; +import 'package:flutter/material.dart'; +import 'package:test_collection/base/test_page.dart'; + +class EqualityTestPage extends TestPage { + EqualityTestPage(String title, {Key? key}) : super(title: title, key: key) { + Element o(Comparable id) => Element(id); + + // Lists that are point-wise equal, but not identical. + var list1 = [o(1), o(2), o(3), o(4), o(5)]; + var list2 = [o(1), o(2), o(3), o(4), o(5)]; + // Similar length list with equal elements in different order. + var list3 = [o(1), o(3), o(5), o(4), o(2)]; + + test('IterableEquality.equals', () { + expect(const IterableEquality().equals(list1, list2), true); + Equality iterId = const IterableEquality(IdentityEquality()); + expect(iterId.equals(list1, list2), false); + }); + + test('LinkedHashSet.from().equals', () { + var l1 = LinkedHashSet.from(list1); + var l2 = LinkedHashSet.from(list2); + expect(const IterableEquality().equals(l1, l2), true); + Equality iterId = const IterableEquality(IdentityEquality()); + expect(iterId.equals(l1, l2), false); + }); + + test('ListEquality.equals', () { + expect(const ListEquality().equals(list1, list2), true); + Equality listId = const ListEquality(IdentityEquality()); + expect(listId.equals(list1, list2), false); + }); + + test('ListInequality length', () { + var list4 = [o(1), o(2), o(3), o(4), o(5), o(6)]; + expect(const ListEquality().equals(list1, list4), false); + expect( + const ListEquality(IdentityEquality()).equals(list1, list4), false); + }); + + test('ListInequality value', () { + var list5 = [o(1), o(2), o(3), o(4), o(6)]; + expect(const ListEquality().equals(list1, list5), false); + expect( + const ListEquality(IdentityEquality()).equals(list1, list5), false); + }); + + test('UnorderedIterableEquality.equals', () { + expect(const UnorderedIterableEquality().equals(list1, list3), true); + Equality uniterId = const UnorderedIterableEquality(IdentityEquality()); + expect(uniterId.equals(list1, list3), false); + }); + + test('UnorderedIterableInequality length', () { + var list6 = [o(1), o(3), o(5), o(4), o(2), o(1)]; + expect(const UnorderedIterableEquality().equals(list1, list6), false); + expect( + const UnorderedIterableEquality(IdentityEquality()) + .equals(list1, list6), + false); + }); + + test('UnorderedIterableInequality values', () { + var list7 = [o(1), o(3), o(5), o(4), o(6)]; + expect(const UnorderedIterableEquality().equals(list1, list7), false); + expect( + const UnorderedIterableEquality(IdentityEquality()) + .equals(list1, list7), + false); + }); + + test('SetEquality', () { + var set1 = HashSet.from(list1); + var set2 = LinkedHashSet.from(list3); + expect(const SetEquality().equals(set1, set2), true); + Equality setId = const SetEquality(IdentityEquality()); + expect(setId.equals(set1, set2), false); + }); + + test('SetInequality length', () { + var list8 = [o(1), o(3), o(5), o(4), o(2), o(6)]; + var set1 = HashSet.from(list1); + var set2 = LinkedHashSet.from(list8); + expect(const SetEquality().equals(set1, set2), false); + expect(const SetEquality(IdentityEquality()).equals(set1, set2), false); + }); + + test('SetInequality value', () { + var list7 = [o(1), o(3), o(5), o(4), o(6)]; + var set1 = HashSet.from(list1); + var set2 = LinkedHashSet.from(list7); + expect(const SetEquality().equals(set1, set2), false); + expect(const SetEquality(IdentityEquality()).equals(set1, set2), false); + }); + + var map1a = { + 'x': [o(1), o(2), o(3)], + 'y': [true, false, null] + }; + var map1b = { + 'x': [o(4), o(5), o(6)], + 'y': [false, true, null] + }; + var map2a = { + 'x': [o(3), o(2), o(1)], + 'y': [false, true, null] + }; + var map2b = { + 'x': [o(6), o(5), o(4)], + 'y': [null, false, true] + }; + var l1 = [map1a, map1b]; + var l2 = [map2a, map2b]; + var s1 = {...l1}; + var s2 = {map2b, map2a}; + + var i1 = Iterable.generate(l1.length, (i) => l1[i]); + + test('RecursiveEquality', () { + const unordered = UnorderedIterableEquality(); + expect(unordered.equals(map1a['x'], map2a['x']), true); + expect(unordered.equals(map1a['y'], map2a['y']), true); + expect(unordered.equals(map1b['x'], map2b['x']), true); + expect(unordered.equals(map1b['y'], map2b['y']), true); + const mapval = MapEquality(values: unordered); + expect(mapval.equals(map1a, map2a), true); + expect(mapval.equals(map1b, map2b), true); + const listmapval = ListEquality(mapval); + expect(listmapval.equals(l1, l2), true); + const setmapval = SetEquality(mapval); + expect(setmapval.equals(s1, s2), true); + }); + + test('DeepCollectionEquality.unordered', () { + var colleq = const DeepCollectionEquality.unordered(); + + + expect(colleq.equals(map1a['x'], map2a['x']), true); + expect(colleq.equals(map1a['y'], map2a['y']), true); + expect(colleq.equals(map1b['x'], map2b['x']), true); + expect(colleq.equals(map1b['y'], map2b['y']), true); + expect(colleq.equals(map1a, map2a), true); + expect(colleq.equals(map1b, map2b), true); + expect(colleq.equals(l1, l2), true); + expect(colleq.equals(s1, s2), true); + + + + expect(colleq.equals(l1, i1), false); + expect(colleq.equals(i1, l1), false); + expect(colleq.equals(s1, i1), false); + expect(colleq.equals(i1, s1), true); + + }); + + test('DeepCollectionEquality', () { + var colleq = const DeepCollectionEquality(); + + test('with identical collection types', () { + expect(colleq.equals(l1, l1.toList()), true); + expect(colleq.equals(s1, s1.toSet()), true); + expect(colleq.equals(map1b, map1b), true); + expect(colleq.equals(i1, i1.map((i) => i)), true); + expect(colleq.equals(map1a, map2a), false); + expect(colleq.equals(map1b, map2b), false); + expect(colleq.equals(l1, l2), false); + expect(colleq.equals(s1, s2), false); + }); + + test('comparing collections and iterables', () { + expect(colleq.equals(l1, i1), false); + expect(colleq.equals(i1, l1), true); + expect(colleq.equals(s1, i1), false); + expect(colleq.equals(i1, s1), true); + }); + }); + + + test('CaseInsensitiveEquality', () { + var equality = const CaseInsensitiveEquality(); + expect(equality.equals('foo', 'foo'), true); + expect(equality.equals('fOo', 'FoO'), true); + expect(equality.equals('FoO', 'fOo'), true); + expect(equality.equals('foo', 'bar'), false); + expect(equality.equals('fÕÕ', 'fõõ'), false); + + expect(equality.hash('foo'), (equality.hash('foo'))); + expect(equality.hash('fOo'), (equality.hash('FoO'))); + expect(equality.hash('FoO'), (equality.hash('fOo'))); + expect(equality.hash('foo'), ((equality.hash('bar')))); + expect(equality.hash('fÕÕ'), ((equality.hash('fõõ')))); + }); + + group('EqualityBy should use a derived value for ', () { + var firstEquality = EqualityBy, String>((e) => e.first); + var firstInsensitiveEquality = EqualityBy, String>( + (e) => e.first, const CaseInsensitiveEquality()); + var firstObjectEquality = EqualityBy, Object>( + (e) => e.first, const IterableEquality()); + + test('equality', () { + expect(firstEquality.equals(['foo', 'foo'], ['foo', 'bar']), true); + expect(firstEquality.equals(['foo', 'foo'], ['bar', 'bar']), false); + }); + + test('equality with an inner equality', () { + expect(firstInsensitiveEquality.equals(['fOo'], ['FoO']), true); + expect(firstInsensitiveEquality.equals(['foo'], ['ffõõ']), false); + }); + + test('hash', () { + expect(firstEquality.hash(['foo', 'bar']), 'foo'.hashCode); + }); + + test('hash with an inner equality', () { + expect(firstInsensitiveEquality.hash(['fOo']), + const CaseInsensitiveEquality().hash('foo')); + }); + + test('isValidKey', () { + expect(firstEquality.isValidKey(['foo']), true); + expect(firstEquality.isValidKey('foo'), false); + expect(firstEquality.isValidKey([1]), false); + }); + + test('isValidKey with an inner equality', () { + expect(firstObjectEquality.isValidKey([[]]), true); + expect(firstObjectEquality.isValidKey([{}]), false); + }); + }); + + test('Equality accepts null', () { + var ie = IterableEquality(); + var le = ListEquality(); + var se = SetEquality(); + var me = MapEquality(); + expect(ie.equals(null, null), true); + expect(ie.equals([], null), false); + expect(ie.equals(null, []), false); + expect(ie.hash(null), null.hashCode); + + expect(le.equals(null, null), true); + expect(le.equals([], null), false); + expect(le.equals(null, []), false); + expect(le.hash(null), null.hashCode); + + expect(se.equals(null, null), true); + expect(se.equals({}, null), false); + expect(se.equals(null, {}), false); + expect(se.hash(null), null.hashCode); + + expect(me.equals(null, null), true); + expect(me.equals({}, null), false); + expect(me.equals(null, {}), false); + expect(me.hash(null), null.hashCode); + }); + } +} + +/// Wrapper objects for an `id` value. +/// +/// Compares the `id` value by equality and for comparison. +/// Allows creating simple objects that are equal without being identical. +class Element implements Comparable { + final Comparable id; + + const Element(this.id); + + @override + int get hashCode => id.hashCode; + + @override + bool operator ==(Object other) => other is Element && id == other.id; + + @override + int compareTo(Element other) => id.compareTo(other.id); +} diff --git a/ohos/test_collection/lib/page/functions_test.dart b/ohos/test_collection/lib/page/functions_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..dec7778f2625228358e30f127143a9383ae71eae --- /dev/null +++ b/ohos/test_collection/lib/page/functions_test.dart @@ -0,0 +1,313 @@ +// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:collection/collection.dart'; +import 'package:flutter/material.dart'; +import 'package:test_collection/base/test_page.dart'; + +class FunctionsTestPage extends TestPage { + FunctionsTestPage(String title, {Key? key}) : super(title: title, key: key) { + group('mapMap()', () { + test('mapMap({},key: (_, __) {},value: (_, __) {})', () { + expect( + // ignore: deprecated_member_use_from_same_package + mapMap({}, key: (_, __) {}, value: (_, __) {}), + null); + }); + + test("mapMap({'foo': 1, 'bar': 2})['foo'] = 3", () { + var map = {'foo': 1, 'bar': 2}; + // ignore: deprecated_member_use_from_same_package + var result = mapMap(map); + expect(result, ({'foo': 1, 'bar': 2})); + + // The resulting map should be a copy. + result['foo'] = 3; + expect(map, ({'foo': 1, 'bar': 2})); + }); + + test("mapMap.keys", () { + expect( + // ignore: deprecated_member_use_from_same_package + mapMap({'foo': 1, 'bar': 2}, + key: (dynamic key, dynamic value) => key[value]), + ({'o': 1, 'r': 2})); + }); + + test("mapMap.values", () { + expect( + mapMap({'foo': 1, 'bar': 2}, + value: (dynamic key, dynamic value) => key[value]), + ({'foo': 'o', 'bar': 'r'})); + }); + + test("maps both the map's keys and values", () { + expect( + // ignore: deprecated_member_use_from_same_package + mapMap({'foo': 1, 'bar': 2}, + key: (dynamic key, dynamic value) => '$key$value', + value: (dynamic key, dynamic value) => key[value]), + ({'foo1': 'o', 'bar2': 'r'})); + }); + }); + + group('mergeMaps()', () { + test('mergeMaps({}, {},value: (dynamic _, dynamic __) {})', () { + expect(mergeMaps({}, {}, value: (dynamic _, dynamic __) {}), null); + }); + + test("mergeMaps({'foo': 1, 'bar': 2}, {'baz': 3, 'qux': 4})", () { + expect(mergeMaps({'foo': 1, 'bar': 2}, {'baz': 3, 'qux': 4}), + ({'foo': 1, 'bar': 2, 'baz': 3, 'qux': 4})); + }); + }); + + group('lastBy()', () { + test("lastBy([], (_) => fail('Must not be called for empty input'))", () { + expect( + lastBy([], (_) => fail('Must not be called for empty input')), + null, + ); + }); + + test( + "lastBy(['foo', 'bar', 'baz', 'bop', 'qux'],(String string) => string[1])", + () { + expect( + lastBy(['foo', 'bar', 'baz', 'bop', 'qux'], + (String string) => string[1]), + ({ + 'o': 'bop', + 'a': 'baz', + 'u': 'qux', + })); + }); + }); + + group('groupBy()', () { + test('groupBy([], (dynamic _) {})', () { + expect(groupBy([], (dynamic _) {}), null); + }); + + test( + "groupBy(['foo', 'bar', 'baz', 'bop', 'qux'],(dynamic string) => string[1])", + () { + expect( + groupBy(['foo', 'bar', 'baz', 'bop', 'qux'], + (dynamic string) => string[1]), + ({ + 'o': ['foo', 'bop'], + 'a': ['bar', 'baz'], + 'u': ['qux'] + })); + }); + }); + + group('minBy()', () { + test('minBy([], (dynamic _) {}, compare: (dynamic _, dynamic __) => -1)', + () { + expect( + minBy([], (dynamic _) {}, compare: (dynamic _, dynamic __) => -1), + null); + }); + + test( + "minBy([{'foo': 3},{'foo': 5}, {'foo': 4}, {'foo': 1}, {'foo': 2}], (dynamic map) => map['foo'])", + () { + expect( + minBy([ + {'foo': 3}, + {'foo': 5}, + {'foo': 4}, + {'foo': 1}, + {'foo': 2} + ], (dynamic map) => map['foo']), + ({'foo': 1})); + }); + }); + + group('maxBy()', () { + test('maxBy([], (dynamic _) {}, compare: (dynamic _, dynamic __) => 0)', () { + expect(maxBy([], (dynamic _) {}, compare: (dynamic _, dynamic __) => 0), + null); + }); + }); + + group('transitiveClosure()', () { + test('returns an empty map for an empty graph', () { + expect(transitiveClosure({}), null); + }); + + test('returns the input when there are no transitive connections', () { + expect( + transitiveClosure({ + 'foo': ['bar'], + 'bar': [], + 'bang': ['qux', 'zap'], + 'qux': [], + 'zap': [] + }), + ({ + 'foo': ['bar'], + 'bar': [], + 'bang': ['qux', 'zap'], + 'qux': [], + 'zap': [] + })); + }); + + test('flattens transitive connections', () { + expect( + transitiveClosure({ + 'qux': [], + 'bar': ['baz'], + 'baz': ['qux'], + 'foo': ['bar'] + }), + ({ + 'foo': ['bar', 'baz', 'qux'], + 'bar': ['baz', 'qux'], + 'baz': ['qux'], + 'qux': [] + })); + }); + + test('handles loops', () { + expect( + transitiveClosure({ + 'foo': ['bar'], + 'bar': ['baz'], + 'baz': ['foo'] + }), + ({ + 'foo': ['bar', 'baz', 'foo'], + 'bar': ['baz', 'foo', 'bar'], + 'baz': ['foo', 'bar', 'baz'] + })); + }); + }); + + group('stronglyConnectedComponents()', () { + test('returns an empty list for an empty graph', () { + expect(stronglyConnectedComponents({}), null); + }); + + test('returns one set for a singleton graph', () { + expect( + stronglyConnectedComponents({'a': []}), + ([ + {'a'} + ])); + }); + + test('returns two sets for a two-element tree', () { + expect( + stronglyConnectedComponents({ + 'a': ['b'], + 'b': [] + }), + ([ + {'a'}, + {'b'} + ])); + }); + + test('returns one set for a two-element loop', () { + expect( + stronglyConnectedComponents({ + 'a': ['b'], + 'b': ['a'] + }), + ([ + {'a', 'b'} + ])); + }); + + test('returns individual vertices for a tree', () { + expect( + stronglyConnectedComponents({ + 'foo': ['bar'], + 'bar': ['baz', 'bang'], + 'baz': ['qux'], + 'bang': ['zap'], + 'qux': [], + 'zap': [] + }), + ([ + // This is expected to return *a* topological ordering, but this isn't + // the only valid one. If the function implementation changes in the + // future, this test may need to be updated. + {'foo'}, + {'bar'}, + {'bang'}, + {'zap'}, + {'baz'}, + {'qux'} + ]), + ); + }); + + test('returns a single set for a fully cyclic graph', () { + expect( + stronglyConnectedComponents({ + 'foo': ['bar'], + 'bar': ['baz'], + 'baz': ['bang'], + 'bang': ['foo'] + }), + ([ + {'foo', 'bar', 'baz', 'bang'} + ])); + }); + + test('returns separate sets for each strongly connected component', () { + // https://en.wikipedia.org/wiki/Strongly_connected_component#/media/File:Scc.png + expect( + stronglyConnectedComponents({ + 'a': ['b'], + 'b': ['c', 'e', 'f'], + 'c': ['d', 'g'], + 'd': ['c', 'h'], + 'e': ['a', 'f'], + 'f': ['g'], + 'g': ['f'], + 'h': ['g', 'd'] + }), + ([ + // This is expected to return *a* topological ordering, but this isn't + // the only valid one. If the function implementation changes in the + // future, this test may need to be updated. + {'a', 'b', 'e'}, + {'c', 'd', 'h'}, + {'f', 'g'}, + ]), + ); + }); + + test('always returns components in topological order', () { + expect( + stronglyConnectedComponents({ + 'bar': ['baz', 'bang'], + 'zap': [], + 'baz': ['qux'], + 'qux': [], + 'foo': ['bar'], + 'bang': ['zap'] + }), + ([ + // This is expected to return *a* topological ordering, but this isn't + // the only valid one. If the function implementation changes in the + // future, this test may need to be updated. + {'foo'}, + {'bar'}, + {'bang'}, + {'zap'}, + {'baz'}, + {'qux'} + ]), + ); + }); + }); + } +} diff --git a/ohos/test_collection/lib/page/ignore_ascii_case_test.dart b/ohos/test_collection/lib/page/ignore_ascii_case_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..b8903d6f6d41ffcb5b42b5180c14a3f4a2448aae --- /dev/null +++ b/ohos/test_collection/lib/page/ignore_ascii_case_test.dart @@ -0,0 +1,62 @@ +// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// Tests case-ignoring compare and equality. + +import 'package:collection/collection.dart'; +import 'package:flutter/material.dart'; +import 'package:test_collection/base/test_page.dart'; + +class IgnoreAsciiCaseTestPage extends TestPage { + IgnoreAsciiCaseTestPage(String title,{ Key? key}) : super(title: title, key: key) { + test('equality ignore ASCII case', () { + var strings = [ + '0@`aopz[{', + '0@`aopz[{', + '0@`Aopz[{', + '0@`aOpz[{', + '0@`AOpz[{', + '0@`aoPz[{', + '0@`AoPz[{', + '0@`aOPz[{', + '0@`AOPz[{', + '0@`aopZ[{', + '0@`AopZ[{', + '0@`aOpZ[{', + '0@`AOpZ[{', + '0@`aoPZ[{', + '0@`AoPZ[{', + '0@`aOPZ[{', + '0@`AOPZ[{', + ]; + + for (var s1 in strings) { + for (var s2 in strings) { + var reason = '$s1 =?= $s2'; + expect(equalsIgnoreAsciiCase(s1, s2), true); + expect(hashIgnoreAsciiCase(s1), hashIgnoreAsciiCase(s2), + ); + } + } + + var upperCaseLetters = '@`abcdefghijklmnopqrstuvwxyz[{åÅ'; + var lowerCaseLetters = '@`ABCDEFGHIJKLMNOPQRSTUVWXYZ[{åÅ'; + expect(equalsIgnoreAsciiCase(upperCaseLetters, lowerCaseLetters), true); + + void testChars(String char1, String char2, bool areEqual) { + expect(equalsIgnoreAsciiCase(char1, char2), areEqual + ); + } + + for (var i = 0; i < upperCaseLetters.length; i++) { + for (var j = 0; i < upperCaseLetters.length; i++) { + testChars(upperCaseLetters[i], upperCaseLetters[j], i == j); + testChars(lowerCaseLetters[i], upperCaseLetters[j], i == j); + testChars(upperCaseLetters[i], lowerCaseLetters[j], i == j); + testChars(lowerCaseLetters[i], lowerCaseLetters[j], i == j); + } + } + }); + } +} \ No newline at end of file diff --git a/ohos/test_collection/lib/page/iterable_test_page.dart b/ohos/test_collection/lib/page/iterable_test_page.dart new file mode 100644 index 0000000000000000000000000000000000000000..49a8ceb74e04c496091259b69843afebc5e15214 --- /dev/null +++ b/ohos/test_collection/lib/page/iterable_test_page.dart @@ -0,0 +1,39 @@ +import 'package:collection/collection.dart'; +import 'package:flutter/foundation.dart'; +import 'package:test_collection/base/test_page.dart'; + +class CombinedIterableViewTestPage extends TestPage { + CombinedIterableViewTestPage(String title,{ Key? key}) : super(title: title, key: key) { + var iterable1 = Iterable.generate(3); + var iterable2 = Iterable.generate(3, (i) => i + 3); + var iterable3 = Iterable.generate(3, (i) => i + 6); + + test('CombinedIterableView()', () { + var combined = CombinedIterableView([iterable1, iterable2, iterable3]); + expect(combined, [0, 1, 2, 3, 4, 5, 6, 7, 8]); + + combined = CombinedIterableView([iterable1, [], iterable2, [], iterable3, []]); + expect(combined, [0, 1, 2, 3, 4, 5, 6, 7, 8]); + }); + + test('CombinedIterableView().isEmpty', () { + var empty = CombinedIterableView([]); + empty.isEmpty; + + empty = CombinedIterableView([[], [], []]); + expect(empty, null); + }); + + test('CombinedIterableView.last CombinedIterableView.first', () { + var list1 = []; + var list2 = []; + var combined = CombinedIterableView([list1, list2]); + expect(combined, null); + list1.addAll([1, 2]); + list2.addAll([3, 4]); + expect(combined, [1, 2, 3, 4]); + expect(combined.last, 4); + expect(combined.first, 1); + }); + } +} diff --git a/ohos/test_collection/lib/page/iterable_zip_test.dart b/ohos/test_collection/lib/page/iterable_zip_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..4572574be392d46818f443ea5b9356feece25501 --- /dev/null +++ b/ohos/test_collection/lib/page/iterable_zip_test.dart @@ -0,0 +1,181 @@ +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:collection/collection.dart'; +import 'package:flutter/material.dart'; +import 'package:test_collection/base/test_page.dart'; + +/// Iterable like [base] except that it throws when value [errorValue]. +Iterable iterError(Iterable base, int errorValue) { + // ignore: only_throw_errors + return base.map((x) => x == errorValue ? throw 'BAD' : x); +} + +class IterableZipTestPage extends TestPage { + IterableZipTestPage(String title, {Key? key}) + : super(title: title, key: key) { + test('IterableZip()', () { + expect( + IterableZip([ + [1, 2, 3], + [4, 5, 6], + [7, 8, 9] + ]), + ([ + [1, 4, 7], + [2, 5, 8], + [3, 6, 9] + ])); + + expect( + IterableZip([ + [1, 2, 3, 99, 100], + [4, 5, 6], + [7, 8, 9] + ]), + ([ + [1, 4, 7], + [2, 5, 8], + [3, 6, 9] + ])); + + expect( + IterableZip([ + [1, 2, 3], + [4, 5, 6, 99, 100], + [7, 8, 9] + ]), + ([ + [1, 4, 7], + [2, 5, 8], + [3, 6, 9] + ])); + + expect( + IterableZip([ + [1, 2, 3], + [4, 5, 6], + [7, 8, 9, 99, 100] + ]), + ([ + [1, 4, 7], + [2, 5, 8], + [3, 6, 9] + ])); + + expect( + IterableZip([ + [1, 2, 3, 98], + [4, 5, 6], + [7, 8, 9, 99, 100] + ]), + ([ + [1, 4, 7], + [2, 5, 8], + [3, 6, 9] + ])); + + expect( + IterableZip([ + [], + [4, 5, 6], + [7, 8, 9] + ]), + ([])); + + expect( + IterableZip([ + [1, 2, 3], + [], + [7, 8, 9] + ]), + ([])); + + expect( + IterableZip([ + [1, 2, 3], + [4, 5, 6], + [] + ]), + ([])); + + expect(IterableZip([]), ([])); + + expect( + IterableZip([ + [1, 2, 3] + ]), + ([ + [1], + [2], + [3] + ])); + }); + + test('复杂构造IterableZip', () { + // Use other iterables than list literals. + var it1 = [1, 2, 3, 4, 5, 6].where((x) => x < 4); + var it2 = {4, 5, 6}; + var it3 = {7: 0, 8: 0, 9: 0}.keys; + var allIts = Iterable.generate(3, (i) => [it1, it2, it3][i]); + expect( + IterableZip(allIts), + ([ + [1, 4, 7], + [2, 5, 8], + [3, 6, 9] + ])); + }); + + test('Error 1', () { + expect( + IterableZip([ + iterError([1, 2, 3], 2), + [4, 5, 6], + [7, 8, 9] + ]).toList(), + ('BAD')); + }); + + test('Error 2', () { + expect( + IterableZip([ + [1, 2, 3], + iterError([4, 5, 6], 5), + [7, 8, 9] + ]).toList(), + ('BAD')); + }); + + test('Error 3', () { + expect( + IterableZip([ + [1, 2, 3], + [4, 5, 6], + iterError([7, 8, 9], 8) + ]).toList(), + (('BAD'))); + }); + + test('Error at end', () { + expect( + IterableZip([ + [1, 2, 3], + iterError([4, 5, 6], 6), + [7, 8, 9] + ]).toList(), + (('BAD'))); + }); + + test('Error before first end', () { + expect( + IterableZip([ + iterError([1, 2, 3, 4], 4), + [4, 5, 6], + [7, 8, 9] + ]).toList(), + (('BAD'))); + }); + } +} diff --git a/ohos/test_collection/lib/page/list_test.dart b/ohos/test_collection/lib/page/list_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..b2dd717ad8c20e33e5c4f4b98fc2f90ac8c361a9 --- /dev/null +++ b/ohos/test_collection/lib/page/list_test.dart @@ -0,0 +1,607 @@ +// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:collection/collection.dart'; +import 'package:flutter/material.dart'; +import 'package:test_collection/base/test_page.dart'; + +class CombinedListViewTestPage extends TestPage { + CombinedListViewTestPage(String title,{ Key? key}) : super(title: title, key: key) { + var list1 = [1, 2, 3]; + var list2 = [4, 5, 6]; + var list3 = [7, 8, 9]; + var concat = [...list1, ...list2, ...list3]; + + // In every way possible this should test the same as an UnmodifiableListView. + testUnmodifiableList(concat, CombinedListView([list1, list2, list3]), 'combineLists'); + + testUnmodifiableList(concat, CombinedListView([list1, [], list2, [], list3, []]), 'combineLists'); + + test('CombinedListView().length', () { + var empty = CombinedListView([]); + expect(empty, null); + expect(empty.length, 0); + + empty = CombinedListView([[], [], []]); + expect(empty, null); + expect(empty.length, 0); + + }); + + test('CombinedListView([],[])', () { + var backing1 = []; + var backing2 = []; + var combined = CombinedListView([backing1, backing2]); + expect(combined, null); + backing1.addAll(list1); + expect(combined, list1); + backing2.addAll(list2); + expect(combined, backing1.toList()..addAll(backing2)); + var listOfLists = >[]; + combined = CombinedListView(listOfLists); + expect(combined, null); + listOfLists.add(list1); + expect(combined, list1); + listOfLists.add(list2); + expect(combined, [...list1, ...list2]); + listOfLists.clear(); + expect(combined, null); + backing1 = []; + combined = CombinedListView([backing1]); + expect(combined, null); + backing1.addAll(list1); + expect(combined, list1); + }); + } + + void testUnmodifiableList(List original, List wrapped, String name) { + name = 'unmodifiable-list-$name'; + testIterable(original, wrapped, name); + testReadList(original, wrapped, name); + testNoWriteList(original, wrapped, name); + testNoChangeLengthList(original, wrapped, name); + } + + void testNonGrowableList(List original, List wrapped, String name) { + name = 'nongrowable-list-$name'; + testIterable(original, wrapped, name); + testReadList(original, wrapped, name); + testWriteList(original, wrapped, name); + testNoChangeLengthList(original, wrapped, name); + } + + void testUnmodifiableSet(Set original, Set wrapped, String name) { + name = 'unmodifiable-set-$name'; + testIterable(original, wrapped, name); + testReadSet(original, wrapped, name); + testNoChangeSet(original, wrapped, name); + } + + void testIterable(Iterable original, Iterable wrapped, String name) { + test('$name - any', () { + expect(wrapped.any((x) => true), (original.any((x) => true))); + expect(wrapped.any((x) => false), (original.any((x) => false))); + }); + + test('$name - contains', () { + expect(wrapped.contains(0), (original.contains(0))); + }); + + test('$name - elementAt', () { + if (original.isEmpty) { + wrapped.elementAt(0); + } else { + expect(wrapped.elementAt(0), (original.elementAt(0))); + } + }); + + test('$name - every', () { + expect(wrapped.every((x) => true), (original.every((x) => true))); + expect(wrapped.every((x) => false), (original.every((x) => false))); + }); + + test('$name - expand', () { + expect(wrapped.expand((x) => [x, x]), (original.expand((x) => [x, x]))); + }); + + test('$name - first', () { + if (original.isEmpty) { + wrapped.first; + } else { + expect(wrapped.first, (original.first)); + } + }); + + test('$name - firstWhere', () { + if (original.isEmpty) { + wrapped.firstWhere((_) => true); + } else { + expect(wrapped.firstWhere((_) => true), (original.firstWhere((_) => true))); + } + }); + + test('$name - fold', () { + expect(wrapped.fold(0, (dynamic x, y) => x + y), (original.fold(0, (dynamic x, y) => x + y))); + }); + + test('$name - forEach', () { + var wrapCtr = 0; + var origCtr = 0; + // ignore: avoid_function_literals_in_foreach_calls + wrapped.forEach((x) { + wrapCtr += x; + }); + // ignore: avoid_function_literals_in_foreach_calls + original.forEach((x) { + origCtr += x; + }); + expect(wrapCtr, (origCtr)); + }); + + test('$name - isEmpty', () { + expect(wrapped.isEmpty, (original.isEmpty)); + }); + + test('$name - isNotEmpty', () { + expect(wrapped.isNotEmpty, (original.isNotEmpty)); + }); + + test('$name - iterator', () { + Iterator wrapIter = wrapped.iterator; + Iterator origIter = original.iterator; + while (origIter.moveNext()) { + expect(wrapIter.moveNext(), (true)); + expect(wrapIter.current, (origIter.current)); + } + expect(wrapIter.moveNext(), (false)); + }); + + test('$name - join', () { + expect(wrapped.join(''), (original.join(''))); + expect(wrapped.join('-'), (original.join('-'))); + }); + + test('$name - last', () { + if (original.isEmpty) { + wrapped.last; + } else { + expect(wrapped.last, (original.last)); + } + }); + + test('$name - lastWhere', () { + if (original.isEmpty) { + wrapped.lastWhere((_) => true); + } else { + expect(wrapped.lastWhere((_) => true), (original.lastWhere((_) => true))); + } + }); + + test('$name - length', () { + expect(wrapped.length, (original.length)); + }); + + test('$name - map', () { + expect(wrapped.map((x) => '[$x]'), (original.map((x) => '[$x]'))); + }); + + test('$name - reduce', () { + if (original.isEmpty) { + wrapped.reduce((x, y) => x + y); + } else { + expect(wrapped.reduce((x, y) => x + y), (original.reduce((x, y) => x + y))); + } + }); + + test('$name - single', () { + if (original.length == 1) { + expect(wrapped.single, (original.single)); + } + }); + + test('$name - singleWhere', () { + if (original.length == 1) { + expect(wrapped.singleWhere((_) => true), (original.singleWhere((_) => true))); + } + }); + + test('$name - skip', () { + expect(wrapped.skip(0), (original.skip(0))); + expect(wrapped.skip(1), (original.skip(1))); + expect(wrapped.skip(5), (original.skip(5))); + }); + + test('$name - skipWhile', () { + expect(wrapped.skipWhile((x) => true), (original.skipWhile((x) => true))); + expect(wrapped.skipWhile((x) => false), (original.skipWhile((x) => false))); + expect(wrapped.skipWhile((x) => x != 42), (original.skipWhile((x) => x != 42))); + }); + + test('$name - take', () { + expect(wrapped.take(0), (original.take(0))); + expect(wrapped.take(1), (original.take(1))); + expect(wrapped.take(5), (original.take(5))); + }); + + test('$name - takeWhile', () { + expect(wrapped.takeWhile((x) => true), (original.takeWhile((x) => true))); + expect(wrapped.takeWhile((x) => false), (original.takeWhile((x) => false))); + expect(wrapped.takeWhile((x) => x != 42), (original.takeWhile((x) => x != 42))); + }); + + test('$name - toList', () { + expect(wrapped.toList(), (original.toList())); + expect(wrapped.toList(growable: false), (original.toList(growable: false))); + }); + + test('$name - toSet', () { + expect(wrapped.toSet(), (original.toSet())); + }); + + test('$name - where', () { + expect(wrapped.where((x) => true), (original.where((x) => true))); + expect(wrapped.where((x) => false), (original.where((x) => false))); + expect(wrapped.where((x) => x != 42), (original.where((x) => x != 42))); + }); + } + + void testReadList(List original, List wrapped, String name) { + test('$name - length', () { + expect(wrapped.length, (original.length)); + }); + + test('$name - isEmpty', () { + expect(wrapped.isEmpty, (original.isEmpty)); + }); + + test('$name - isNotEmpty', () { + expect(wrapped.isNotEmpty, (original.isNotEmpty)); + }); + + test('$name - []', () { + if (original.isEmpty) { + + wrapped[0]; + + } else { + expect(wrapped[0], (original[0])); + } + }); + + test('$name - indexOf', () { + expect(wrapped.indexOf(42), (original.indexOf(42))); + }); + + test('$name - lastIndexOf', () { + expect(wrapped.lastIndexOf(42), (original.lastIndexOf(42))); + }); + + test('$name - getRange', () { + var len = original.length; + expect(wrapped.getRange(0, len), (original.getRange(0, len))); + expect(wrapped.getRange(len ~/ 2, len), (original.getRange(len ~/ 2, len))); + expect(wrapped.getRange(0, len ~/ 2), (original.getRange(0, len ~/ 2))); + }); + + test('$name - sublist', () { + var len = original.length; + expect(wrapped.sublist(0), (original.sublist(0))); + expect(wrapped.sublist(len ~/ 2), (original.sublist(len ~/ 2))); + expect(wrapped.sublist(0, len ~/ 2), (original.sublist(0, len ~/ 2))); + }); + + test('$name - asMap', () { + expect(wrapped.asMap(), (original.asMap())); + }); + } + + void testNoWriteList(List original, List wrapped, String name) { + var copy = List.of(original); + + void testThrows(name, thunk) { + test(name, () { + thunk; + // No modifications happened. + expect(original, (copy)); + }); + } + + testThrows('$name - []= throws', () { + wrapped[0] = 42; + }); + + testThrows('$name - sort throws', () { + wrapped.sort(); + }); + + testThrows('$name - fillRange throws', () { + wrapped.fillRange(0, wrapped.length, 42); + }); + + testThrows('$name - setRange throws', () { + wrapped.setRange(0, wrapped.length, Iterable.generate(wrapped.length, (i) => i)); + }); + + testThrows('$name - setAll throws', () { + wrapped.setAll(0, Iterable.generate(wrapped.length, (i) => i)); + }); + } + + void testWriteList(List original, List wrapped, String name) { + var copy = List.of(original); + + test('$name - []=', () { + if (original.isNotEmpty) { + var originalFirst = original[0]; + wrapped[0] = originalFirst + 1; + expect(original[0], (originalFirst + 1)); + original[0] = originalFirst; + } else { + + wrapped[0] = 42; + + } + }); + + test('$name - sort', () { + var sortCopy = List.of(original); + sortCopy.sort(); + wrapped.sort(); + expect(original, (sortCopy)); + original.setAll(0, copy); + }); + + test('$name - fillRange', () { + wrapped.fillRange(0, wrapped.length, 37); + for (var i = 0; i < original.length; i++) { + expect(original[i], (37)); + } + original.setAll(0, copy); + }); + + test('$name - setRange', () { + List reverseList = original.reversed.toList(); + wrapped.setRange(0, wrapped.length, reverseList); + expect(original, (reverseList)); + original.setAll(0, copy); + }); + + test('$name - setAll', () { + List reverseList = original.reversed.toList(); + wrapped.setAll(0, reverseList); + expect(original, (reverseList)); + original.setAll(0, copy); + }); + } + + void testNoChangeLengthList(List original, List wrapped, String name) { + var copy = List.of(original); + + void testThrows(String name, thunk) { + test(name, () { + thunk; + // No modifications happened. + expect(original, (copy)); + }); + } + + testThrows('$name - length= throws', () { + wrapped.length = 100; + }); + + testThrows('$name - add throws', () { + wrapped.add(42); + }); + + testThrows('$name - addAll throws', () { + wrapped.addAll([42]); + }); + + testThrows('$name - insert throws', () { + wrapped.insert(0, 42); + }); + + testThrows('$name - insertAll throws', () { + wrapped.insertAll(0, [42]); + }); + + testThrows('$name - remove throws', () { + wrapped.remove(42); + }); + + testThrows('$name - removeAt throws', () { + wrapped.removeAt(0); + }); + + testThrows('$name - removeLast throws', () { + wrapped.removeLast(); + }); + + testThrows('$name - removeWhere throws', () { + wrapped.removeWhere((element) => false); + }); + + testThrows('$name - retainWhere throws', () { + wrapped.retainWhere((element) => true); + }); + + testThrows('$name - removeRange throws', () { + wrapped.removeRange(0, wrapped.length); + }); + + testThrows('$name - replaceRange throws', () { + wrapped.replaceRange(0, wrapped.length, [42]); + }); + + testThrows('$name - clear throws', () { + wrapped.clear(); + }); + } + + void testReadSet(Set original, Set wrapped, String name) { + var copy = Set.of(original); + + test('$name - containsAll', () { + expect(wrapped.containsAll(copy), true); + expect(wrapped.containsAll(copy.toList()), true); + expect(wrapped.containsAll([]), true); + expect(wrapped.containsAll([42]), (original.containsAll([42]))); + }); + + test('$name - intersection', () { + expect(wrapped.intersection({}), null); + expect(wrapped.intersection(copy), (original)); + expect(wrapped.intersection({42}), Set.of(original.contains(42) ? [42] : [])); + }); + + test('$name - union', () { + expect(wrapped.union({}), (original)); + expect(wrapped.union(copy), (original)); + expect(wrapped.union({42}), (original.union({42}))); + }); + + test('$name - difference', () { + expect(wrapped.difference({}), (original)); + expect(wrapped.difference(copy), null); + expect(wrapped.difference({42}), (original.difference({42}))); + }); + } + + void testNoChangeSet(Set original, Set wrapped, String name) { + var originalElements = original.toList(); + + void testThrows(name, thunk) { + test(name, () { + thunk; + // No modifications happened. + expect(original.toList(), (originalElements)); + }); + } + + testThrows('$name - add throws', () { + wrapped.add(42); + }); + + testThrows('$name - addAll throws', () { + wrapped.addAll([42]); + }); + + testThrows('$name - addAll empty throws', () { + wrapped.addAll([]); + }); + + testThrows('$name - remove throws', () { + wrapped.remove(42); + }); + + testThrows('$name - removeAll throws', () { + wrapped.removeAll([42]); + }); + + testThrows('$name - removeAll empty throws', () { + wrapped.removeAll([]); + }); + + testThrows('$name - retainAll throws', () { + wrapped.retainAll([42]); + }); + + testThrows('$name - removeWhere throws', () { + wrapped.removeWhere((_) => false); + }); + + testThrows('$name - retainWhere throws', () { + wrapped.retainWhere((_) => true); + }); + + testThrows('$name - clear throws', () { + wrapped.clear(); + }); + } + + void testReadMap(Map original, Map wrapped, String name) { + test('$name length', () { + expect(wrapped.length, (original.length)); + }); + + test('$name isEmpty', () { + expect(wrapped.isEmpty, (original.isEmpty)); + }); + + test('$name isNotEmpty', () { + expect(wrapped.isNotEmpty, (original.isNotEmpty)); + }); + + test('$name operator[]', () { + expect(wrapped[0], (0)); + expect(wrapped[999], (999)); + }); + + test('$name containsKey', () { + expect(wrapped.containsKey(0), (original.containsKey(0))); + expect(wrapped.containsKey(999), (original.containsKey(999))); + }); + + test('$name containsValue', () { + expect(wrapped.containsValue(0), (original.containsValue(0))); + expect(wrapped.containsValue(999), (original.containsValue(999))); + }); + + test('$name forEach', () { + var origCnt = 0; + var wrapCnt = 0; + wrapped.forEach((k, v) { + wrapCnt += 1 << k + 3 * v; + }); + original.forEach((k, v) { + origCnt += 1 << k + 3 * v; + }); + expect(wrapCnt, (origCnt)); + }); + + test('$name keys', () { + expect(wrapped.keys, (original.keys)); + }); + + test('$name values', () { + expect(wrapped.values, (original.values)); + }); + } + + void testNoChangeMap(Map original, Map wrapped, String name) { + var copy = Map.of(original); + + void testThrows(name, thunk) { + test(name, () { + thunk; + // No modifications happened. + expect(original, (copy)); + }); + } + + testThrows('$name operator[]= throws', () { + wrapped[0] = 42; + }); + + testThrows('$name putIfAbsent throws', () { + wrapped.putIfAbsent(0, () => 42); + }); + + testThrows('$name addAll throws', () { + wrapped.addAll({42: 42}); + }); + + testThrows('$name addAll empty throws', () { + wrapped.addAll({}); + }); + + testThrows('$name remove throws', () { + wrapped.remove(0); + }); + + testThrows('$name clear throws', () { + wrapped.clear(); + }); + } +} diff --git a/ohos/test_collection/lib/page/map_test.dart b/ohos/test_collection/lib/page/map_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..eb811382b7aa9ed0e3a5c7f8318d3c4c2ea9d0ae --- /dev/null +++ b/ohos/test_collection/lib/page/map_test.dart @@ -0,0 +1,116 @@ +// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:collection'; +import 'package:collection/collection.dart'; +import 'package:flutter/material.dart'; +import 'package:test_collection/base/test_page.dart'; + +class CombinedMapViewTestPage extends TestPage { + CombinedMapViewTestPage(String title, {Key? key}) + : super(title: title, key: key) { + var map1 = const {1: 1, 2: 2, 3: 3}; + var map2 = const {4: 4, 5: 5, 6: 6}; + var map3 = const {7: 7, 8: 8, 9: 9}; + var map4 = const {1: -1, 2: -2, 3: -3}; + var concat = SplayTreeMap() + // The duplicates map appears first here but last in the CombinedMapView + // which has the opposite semantics of `concat`. Keys/values should be + // returned from the first map that contains them. + ..addAll(map4) + ..addAll(map1) + ..addAll(map2) + ..addAll(map3); + + // In every way possible this should test the same as an UnmodifiableMapView. + testReadMap( + concat, CombinedMapView([map1, map2, map3, map4]), 'CombinedMapView'); + + testReadMap( + concat, + CombinedMapView([map1, {}, map2, {}, map3, {}, map4, {}]), + 'CombinedMapView (some empty)'); + + test('CombinedMapView().length', () { + var empty = CombinedMapView([]); + expect(empty, null); + expect(empty.length, 0); + + empty = CombinedMapView([{}, {}, {}]); + expect(empty, null); + expect(empty.length, 0); + }); + + test('CombinedMapView合并map', () { + var backing1 = {}; + var backing2 = {}; + var combined = CombinedMapView([backing1, backing2]); + expect(combined, null); + backing1.addAll(map1); + expect(combined, map1); + backing2.addAll(map2); + expect(combined, Map.from(backing1)..addAll(backing2)); + backing1 = {}; + combined = CombinedMapView([backing1]); + expect(combined, null); + backing1.addAll(map1); + expect(combined, map1); + }); + + test('CombinedMapView.keys', () { + var combined = CombinedMapView([map1, map2, map3, map4]); + var keys = combined.keys; + expect(keys.toList(), keys.toList()); + }); + } + + void testReadMap(Map original, Map wrapped, String name) { + test('$name length', () { + expect(wrapped.length, (original.length)); + }); + + test('$name null', () { + expect(wrapped.isEmpty, (original.isEmpty)); + }); + + test('$name isNotEmpty', () { + expect(wrapped.isNotEmpty, (original.isNotEmpty)); + }); + + test('$name operator[]', () { + expect(wrapped[0], (0)); + expect(wrapped[999], (999)); + }); + + test('$name containsKey', () { + expect(wrapped.containsKey(0), (original.containsKey(0))); + expect(wrapped.containsKey(999), (original.containsKey(999))); + }); + + test('$name containsValue', () { + expect(wrapped.containsValue(0), (original.containsValue(0))); + expect(wrapped.containsValue(999), (original.containsValue(999))); + }); + + test('$name forEach', () { + var origCnt = 0; + var wrapCnt = 0; + wrapped.forEach((k, v) { + wrapCnt += 1 << k + 3 * v; + }); + original.forEach((k, v) { + origCnt += 1 << k + 3 * v; + }); + expect(wrapCnt, (origCnt)); + }); + + test('$name keys', () { + expect(wrapped.keys, (original.keys)); + }); + + test('$name values', () { + expect(wrapped.values, (original.values)); + }); + } +} diff --git a/ohos/test_collection/lib/page/priority_queue_test.dart b/ohos/test_collection/lib/page/priority_queue_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..196602fe77cdbac1ccbad48247b9199b6697550b --- /dev/null +++ b/ohos/test_collection/lib/page/priority_queue_test.dart @@ -0,0 +1,378 @@ +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// Tests priority queue implementations utilities. +import 'package:collection/src/priority_queue.dart'; +import 'package:flutter/material.dart'; +import 'package:test_collection/base/test_page.dart'; + +class PriorityQueueTestPage extends TestPage { + PriorityQueueTestPage(String title,{ Key? key}) : super(title: title, key: key) { + testDefault(); + testDuplicates(); + testNullable(); + testConcurrentModification(); + } + + + void testDefault() { + test('PriorityQueue() returns a HeapPriorityQueue', () { + PriorityQueue(); + }); + } + + void testInt(PriorityQueue Function() create) { + for (var count in [1, 5, 127, 128]) { + testQueue('int:$count', create, List.generate(count, (x) => x), count); + } + } + + void testCustom(PriorityQueue Function(int Function(C, C)? comparator) create) { + for (var count in [1, 5, 127, 128]) { + testQueue('Custom:$count/null', () => create(null), + List.generate(count, C as C Function(int index)), C(count)); + testQueue('Custom:$count/compare', () => create(compare), + List.generate(count, C as C Function(int index)), C(count)); + testQueue('Custom:$count/compareNeg', () => create(compareNeg), + List.generate(count, (x) => C(count - x)), C(0)); + } + } + + /// Test that a queue behaves correctly. + /// + /// The elements must be in priority order, from highest to lowest. + void testQueue(String name, + PriorityQueue Function() create, + List elements, + T notElement,) { + test(name, () => testQueueBody(create, elements, notElement)); + } + + void testQueueBody(PriorityQueue Function() create, List elements, T notElement) { + var q = create(); + expect(q.isEmpty, true); + expect(q, 0); + + q.first; + + + q.removeFirst(); + + + // Tests removeFirst, first, contains, toList and toSet. + void testElements() { + expect(q.isNotEmpty, true); + expect(q, elements.length); + + expect(q.toList(), (elements)); + expect(q.toSet().toList(), (elements)); + expect(q.toUnorderedList(), (elements)); + expect(q.unorderedElements, (elements)); + + var allElements = q.removeAll(); + q.addAll(allElements); + + for (var i = 0; i < elements.length; i++) { + expect(q.contains(elements[i]), true); + } + expect(q.contains(notElement), false); + + var all = []; + while (q.isNotEmpty) { + var expected = q.first; + var actual = q.removeFirst(); + expect(actual, expected); + all.add(actual); + } + + expect(all.length, elements.length); + for (var i = 0; i < all.length; i++) { + expect(all[i], elements[i]); + } + + expect(q.isEmpty, true); + } + + q.addAll(elements); + testElements(); + + q.addAll(elements.reversed); + testElements(); + + // Add elements in a non-linear order (gray order). + for (var i = 0, j = 0; i < elements.length; i++) { + int gray; + do { + gray = j ^ (j >> 1); + j++; + } while (gray >= elements.length); + q.add(elements[gray]); + } + testElements(); + + // Add elements by picking the middle element first, and then recursing + // on each side. + void addRec(int min, int max) { + var mid = min + ((max - min) >> 1); + q.add(elements[mid]); + if (mid + 1 < max) addRec(mid + 1, max); + if (mid > min) addRec(min, mid); + } + + addRec(0, elements.length); + testElements(); + + // Test removeAll. + q.addAll(elements); + expect(q, elements.length); + var all = q.removeAll(); + expect(q.isEmpty, true); + expect(all, elements.length); + for (var i = 0; i < elements.length; i++) { + expect(all, elements[i]); + } + + // Test the same element more than once in queue. + q.addAll(elements); + q.addAll(elements.reversed); + expect(q, elements.length * 2); + for (var i = 0; i < elements.length; i++) { + var element = elements[i]; + expect(q.contains(element), true); + expect(q.removeFirst(), element); + expect(q.removeFirst(), element); + } + + // Test queue with all same element. + var a = elements[0]; + for (var i = 0; i < elements.length; i++) { + q.add(a); + } + expect(q, elements.length); + expect(q.contains(a), true); + expect(q.contains(notElement), false); + q.removeAll().forEach((x) => expect(x, a)); + + // Test remove. + q.addAll(elements); + for (var element in elements.reversed) { + expect(q.remove(element), true); + } + expect(q.isEmpty, true); + } + + void testDuplicates() { + // Check how the heap handles duplicate, or equal-but-not-identical, values. + test('HeapPriorityQueue(compare)', () { + var q = HeapPriorityQueue(compare); + var c1 = C(0); + var c2 = C(0); + + // Can contain the same element more than once. + expect(c1, (c2)); + expect(c1, c2); + q.add(c1); + q.add(c1); + expect(q.length, 2); + expect(q.contains(c1), true); + expect(q.contains(c2), true); + expect(q.remove(c2), true); + expect(q.length, 1); + expect(q.removeFirst(), c1); + + // Can contain equal elements. + q.add(c1); + q.add(c2); + expect(q.length, 2); + expect(q.contains(c1), true); + expect(q.contains(c2), true); + expect(q.remove(c1), true); + expect(q.length, 1); + expect(q.first,c1); + }); + } + + void testNullable() { + // Check that the queue works with a nullable type, and a comparator + // which accepts `null`. + // Compares `null` before instances of `C`. + int nullCompareFirst(C? a, C? b) => + a == null + ? b == null + ? 0 + : -1 + : b == null + ? 1 + : compare(a, b); + + int nullCompareLast(C? a, C? b) => + a == null + ? b == null + ? 0 + : 1 + : b == null + ? -1 + : compare(a, b); + + var c1 = C(1); + var c2 = C(2); + var c3 = C(3); + + test('HeapPriorityQueue(nullCompareFirst', () { + var q = HeapPriorityQueue(nullCompareFirst); + q.add(c2); + q.add(c1); + q.add(null); + expect(q.length, 3); + expect(q.contains(null), true); + expect(q.contains(c1), true); + expect(q.contains(c3), false); + + expect(q.removeFirst(), null); + expect(q.length, 2); + expect(q.contains(null), false); + q.add(null); + expect(q.length, 3); + expect(q.contains(null), true); + q.add(null); + expect(q.length, 4); + expect(q.contains(null), true); + expect(q.remove(null), true); + expect(q.length, 3); + expect(q.toList(), [null, c1, c2]); + }); + + test('HeapPriorityQueue(nullCompareLast)', () { + var q = HeapPriorityQueue(nullCompareLast); + q.add(c2); + q.add(c1); + q.add(null); + expect(q.length, 3); + expect(q.contains(null), true); + expect(q.contains(c1), true); + expect(q.contains(c3), false); + expect(q.first, c1); + + q.add(null); + expect(q.length, 4); + expect(q.contains(null), true); + q.add(null); + expect(q.length, 5); + expect(q.contains(null), true); + expect(q.remove(null), true); + expect(q.length, 4); + expect(q.toList(), [c1, c2, null, null]); + }); + } + + void testConcurrentModification() { + group('HeapPriorityQueue 属性', () { + test('add', () { + var q = HeapPriorityQueue((a, b) => a - b) + ..addAll([6, 4, 2, 3, 5, 8]); + var e = q.unorderedElements; + q.add(12); // Modifiation before creating iterator is not a problem. + var it = e.iterator; + q.add(7); // Modification after creatig iterator is a problem. + it.moveNext; + + it = e.iterator; // New iterator is not affected. + expect(it.moveNext(), true); + expect(it.moveNext(), true); + q.add(9); // Modification during iteration is a problem. + it.moveNext; + }); + + test('addAll', () { + var q = HeapPriorityQueue((a, b) => a - b) + ..addAll([6, 4, 2, 3, 5, 8]); + var e = q.unorderedElements; + q.addAll([12]); // Modifiation before creating iterator is not a problem. + var it = e.iterator; + q.addAll([7]); // Modification after creatig iterator is a problem. + it.moveNext; + it = e.iterator; // New iterator is not affected. + expect(it.moveNext(), true); + q.addAll([]); // Adding nothing is not a modification. + expect(it.moveNext(), true); + q.addAll([9]); // Modification during iteration is a problem. + it.moveNext; + }); + + test('removeFirst', () { + var q = HeapPriorityQueue((a, b) => a - b) + ..addAll([6, 4, 2, 3, 5, 8]); + var e = q.unorderedElements; + expect(q.removeFirst(), + 2); // Modifiation before creating iterator is not a problem. + var it = e.iterator; + expect(q.removeFirst(), + 3); // Modification after creatig iterator is a problem. + it.moveNext; + + it = e.iterator; // New iterator is not affected. + expect(it.moveNext(), true); + expect(it.moveNext(), true); + expect(q.removeFirst(), 4); // Modification during iteration is a problem. + it.moveNext; + }); + + test('remove', () { + var q = HeapPriorityQueue((a, b) => a - b) + ..addAll([6, 4, 2, 3, 5, 8]); + var e = q.unorderedElements; + expect(q.remove(3), true); + var it = e.iterator; + expect(q.remove(2), true); + it.moveNext; + it = e.iterator; + expect(q.remove(99), false); + expect(it.moveNext(), true); + expect(it.moveNext(), true); + expect(q.remove(5), true); + it.moveNext; + }); + + test('removeAll', () { + var q = HeapPriorityQueue((a, b) => a - b) + ..addAll([6, 4, 2, 3, 5, 8]); + var e = q.unorderedElements; + var it = e.iterator; + expect(it.moveNext(), true); + expect(it.moveNext(),true); + expect(q.removeAll(), 6); + it.moveNext; + }); + + test('clear', () { + var q = HeapPriorityQueue((a, b) => a - b) + ..addAll([6, 4, 2, 3, 5, 8]); + var e = q.unorderedElements; + var it = e.iterator; + expect(it.moveNext(), true); + expect(it.moveNext(), true); + q.clear(); + it.moveNext; + }); + }); + } + +// Custom class. +// Class is comparable, comparators match normal and inverse order. + int compare(C c1, C c2) => c1.value - c2.value; + + int compareNeg(C c1, C c2) => c2.value - c1.value; +} +class C implements Comparable { + final int value; + const C(this.value); + @override + int get hashCode => value; + @override + bool operator ==(Object other) => other is C && value == other.value; + @override + int compareTo(C other) => value - other.value; + @override + String toString() => 'C($value)'; +} diff --git a/ohos/test_collection/lib/page/queue_list_test.dart b/ohos/test_collection/lib/page/queue_list_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..8e1e4944aee05057e1a2813f2ba14b1a444a8582 --- /dev/null +++ b/ohos/test_collection/lib/page/queue_list_test.dart @@ -0,0 +1,261 @@ +// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:collection/collection.dart'; +import 'package:flutter/material.dart'; +import 'package:test_collection/base/test_page.dart'; + +class QueueListTestPage extends TestPage { + QueueListTestPage(String title, {Key? key}) : super(title: title, key: key) { + group('QueueList()', () { + test('QueueList().isEmpty', () { + expect(QueueList().isEmpty, QueueList().isEmpty); + }); + + test('QueueList(100).isEmpty', () { + expect(QueueList(100).isEmpty, QueueList(100).isEmpty); + }); + }); + + test('QueueList.from() copies the contents of an iterable', () { + expect(QueueList.from([1, 2, 3].skip(1)), ([2, 3])); + }); + + test('QueueList.add()', () { + var queue = QueueList.from([1, 2, 3]); + queue.add(4); + expect(queue, ([1, 2, 3, 4])); + + var queue1 = atCapacity(); + queue1.add(8); + expect(queue1, ([1, 2, 3, 4, 5, 6, 7, 8])); + }); + + test('QueueList.addAll()', () { + var queue = QueueList.from([1, 2, 3]); + queue.addAll([4, 5, 6]); + expect(queue, ([1, 2, 3, 4, 5, 6])); + + var queue1 = atCapacity(); + queue1.addAll([8, 9]); + expect(queue1, ([1, 2, 3, 4, 5, 6, 7, 8, 9])); + }); + + test('QueueList.addFirst()', () { + var queue = QueueList.from([1, 2, 3]); + queue.addFirst(0); + expect(queue, ([0, 1, 2, 3])); + + var queue1 = atCapacity(); + queue1.addFirst(0); + expect(queue1, ([0, 1, 2, 3, 4, 5, 6, 7])); + }); + + test('QueueList.removeFirst()', () { + var queue = QueueList.from([1, 2, 3]); + expect(queue.removeFirst(), (1)); + expect(queue, ([2, 3])); + + var queue1 = withInternalGap(); + expect(queue1.removeFirst(), (1)); + expect(queue1, ([2, 3, 4, 5, 6, 7])); + + var queue2 = atCapacity(); + expect(queue2.removeFirst(), (1)); + expect(queue2, ([2, 3, 4, 5, 6, 7])); + + QueueList().removeFirst; + }); + + group('QueueList.removeLast()', () { + var queue = QueueList.from([1, 2, 3]); + expect(queue.removeLast(), (3)); + expect(queue, ([1, 2])); + + var queue1 = withInternalGap(); + expect(queue1.removeLast(), (7)); + expect(queue1, ([1, 2, 3, 4, 5, 6])); + + var queue2 = atCapacity(); + expect(queue2.removeLast(), (7)); + expect(queue2, ([1, 2, 3, 4, 5, 6])); + + QueueList().removeLast; + }); + + group('QueueList.length', () { + expect(QueueList.from([1, 2, 3]).length, (3)); + + expect(withInternalGap().length, (7)); + + expect(atCapacity().length, (7)); + + var queue = QueueList.from([1, 2, 3]); + queue.length = 1; + expect(queue, ([1])); + + var queue1 = QueueList.from([1, 2, 3]); + queue1.length = 5; + expect(queue1, ([1, 2, 3, null, null])); + }); + test('QueueList().length = -1 throws a RangeError', () { + QueueList().length = -1; + }); + + test('QueueList().length = 1 throws an UnsupportedError', () { + QueueList().length = 1; + }); + + group('[]', () { + test('QueueList.from([1, 2, 3])', () { + var queue = QueueList.from([1, 2, 3]); + expect(queue[0], (1)); + expect(queue[1], (2)); + expect(queue[2], (3)); + }); + + test('returns individual entries in a queue with an internal gap', () { + var queue = withInternalGap(); + expect(queue[0], (1)); + expect(queue[1], (2)); + expect(queue[2], (3)); + expect(queue[3], (4)); + expect(queue[4], (5)); + expect(queue[5], (6)); + expect(queue[6], (7)); + }); + + test('throws a RangeError if the index is less than 0', () { + var queue = QueueList.from([1, 2, 3]); + queue[-1]; + }); + + test( + 'throws a RangeError if the index is greater than or equal to the ' + 'length', () { + var queue = QueueList.from([1, 2, 3]); + queue[3]; + }); + }); + + group('[]=', () { + test('sets individual entries in the queue', () { + var queue = QueueList.from([1, 2, 3]); + queue[0] = 'a'; + queue[1] = 'b'; + queue[2] = 'c'; + expect(queue, (['a', 'b', 'c'])); + }); + + test('sets individual entries in a queue with an internal gap', () { + var queue = withInternalGap(); + queue[0] = 'a'; + queue[1] = 'b'; + queue[2] = 'c'; + queue[3] = 'd'; + queue[4] = 'e'; + queue[5] = 'f'; + queue[6] = 'g'; + expect(queue, (['a', 'b', 'c', 'd', 'e', 'f', 'g'])); + }); + + test('throws a RangeError if the index is less than 0', () { + var queue = QueueList.from([1, 2, 3]); + + queue[-1] = 0; + }); + + test( + 'throws a RangeError if the index is greater than or equal to the ' + 'length', () { + var queue = QueueList.from([1, 2, 3]); + + queue[3] = 4; + }); + }); + + group('throws a modification error for', () { + dynamic queue; + // setUp(() { + queue = QueueList.from([1, 2, 3]); + // }); + + test('add', () { + expect(() => queue.forEach((_) => queue.add(4)), + throwsConcurrentModificationError); + }); + + test('addAll', () { + expect(() => queue.forEach((_) => queue.addAll([4, 5, 6])), + throwsConcurrentModificationError); + }); + + test('addFirst', () { + expect(() => queue.forEach((_) => queue.addFirst(0)), + throwsConcurrentModificationError); + }); + + test('removeFirst', () { + expect(() => queue.forEach((_) => queue.removeFirst()), + throwsConcurrentModificationError); + }); + + test('removeLast', () { + expect(() => queue.forEach((_) => queue.removeLast()), + throwsConcurrentModificationError); + }); + + test('length=', () { + expect(() => queue.forEach((_) => queue.length = 1), + throwsConcurrentModificationError); + }); + }); + + test("QueueList()..addAll(['a', 'b']) patternQueue.cast()", () { + var patternQueue = QueueList()..addAll(['a', 'b']); + var stringQueue = patternQueue.cast(); + stringQueue.addAll(['c', 'd']); + stringQueue; + + expect(stringQueue, ['a', 'b', 'c', 'd']); + + expect(patternQueue, stringQueue); + }); + + test('QueueList().cast()', () { + QueueList stringQueue = QueueList(); + var numQueue = stringQueue.cast(); + numQueue; + }); + + test('QueueList().cast()', () { + var queue = QueueList(); + expect(queue.cast(), queue); + }); + } +} + +/// Returns a queue whose internal ring buffer is full enough that adding a new +/// element will expand it. +QueueList atCapacity() { + // Use addAll because `QueueList.from(list)` won't use the default initial + // capacity of 8. + return QueueList()..addAll([1, 2, 3, 4, 5, 6, 7]); +} + +/// Returns a queue whose internal tail has a lower index than its head. +QueueList withInternalGap() { + var queue = QueueList.from([null, null, null, null, 1, 2, 3, 4]); + for (var i = 0; i < 4; i++) { + queue.removeFirst(); + } + for (var i = 5; i < 8; i++) { + queue.addLast(i); + } + return queue; +} + +/// Returns a matcher that expects that a closure throws a +/// [ConcurrentModificationError]. +final throwsConcurrentModificationError = null; diff --git a/ohos/test_collection/lib/page/union_set_controller_test.dart b/ohos/test_collection/lib/page/union_set_controller_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..9b327a983e47865ab0f5181bd70478e0909e07fa --- /dev/null +++ b/ohos/test_collection/lib/page/union_set_controller_test.dart @@ -0,0 +1,36 @@ +// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:collection/collection.dart'; +import 'package:flutter/material.dart'; +import 'package:test_collection/base/test_page.dart'; + +class UnionSetControllerTestPage extends TestPage { + UnionSetControllerTestPage(String title, {Key? key}) + : super(title: title, key: key) { + late UnionSetController controller; + late Set innerSet; + + innerSet = {1, 2, 3}; + controller = UnionSetController()..add(innerSet); + + test('UnionSetController.set', () { + expect(controller.set, ([1, 2, 3])); + + controller.add({3, 4, 5}); + expect(controller.set, ([1, 2, 3, 4, 5])); + + controller.remove(innerSet); + expect(controller.set, ([3, 4, 5])); + + expect(controller.set, ([1, 2, 3])); + + controller.add({4, 5, 6}); + expect(controller.set, ([1, 2, 3, 4, 5, 6])); + + controller.remove(innerSet); + expect(controller.set, ([4, 5, 6])); + }); + } +} diff --git a/ohos/test_collection/lib/page/union_set_test.dart b/ohos/test_collection/lib/page/union_set_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..8a02f31376681aeabfde479d7e611c61d33fd739 --- /dev/null +++ b/ohos/test_collection/lib/page/union_set_test.dart @@ -0,0 +1,218 @@ +// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:collection/collection.dart'; +import 'package:flutter/material.dart'; +import 'package:test_collection/base/test_page.dart'; + +class UnionSetTestPage extends TestPage { + UnionSetTestPage(String title,{ Key? key}) : super(title: title, key: key) { + group('with an empty outer set', () { + dynamic set; + + set = UnionSet({}); + + + test('UnionSet({}).length returns 0', () { + expect(set.length, (0)); + }); + + test('UnionSet({}).contains() returns false', () { + expect(set.contains(0), false); + expect(set.contains(null), false); + expect(set.contains('foo'), false); + }); + + test('UnionSet({}).lookup() returns null', () { + expect(set.lookup(0), null); + expect(set.lookup(null), null); + expect(set.lookup('foo'), null); + }); + + test('UnionSet({}).toSet() returns an empty set', () { + expect(set.toSet(), set.toSet().isEmpty); + expect(set.toSet(), set); + }); + + test("UnionSet({}).map() doesn't run on any elements", () { + expect(set.map((dynamic _) {}), null); + }); + }); + + group('', () { + dynamic set; + set = UnionSet.from([ + {1, 2}, + {3, 4}, + {5}, + {}, + ], disjoint: true); + + test('UnionSet().length returns the total length', () { + expect(set.length, (5)); + }); + + test('UnionSet().contains() returns whether any set contains the element', () { + expect(set.contains(1), true); + expect(set.contains(4), true); + expect(set.contains(5), true); + expect(set.contains(6), false); + }); + + test('UnionSet().lookup() returns elements that are in any set', () { + expect(set.lookup(1), (1)); + expect(set.lookup(4), (4)); + expect(set.lookup(5), (5)); + expect(set.lookup(6), null); + }); + + test('UnionSet().toSet() returns the union of all the sets', () { + expect(set.toSet(), ([1, 2, 3, 4, 5])); + expect(set.toSet(), set); + }); + + test('UnionSet().map() maps the elements', () { + expect(set.map((i) => i * 2), ([2, 4, 6, 8, 10])); + }); + }); + + group('', () { + dynamic set; + set = UnionSet.from([ + {1, 2, 3}, + {3, 4}, + {5, 1}, + {}, + ]); + + test('UnionSet.from().length returns the total length', () { + expect(set.length, (5)); + }); + + test('UnionSet.from().contains() returns whether any set contains the element', () { + expect(set.contains(1), true); + expect(set.contains(4), true); + expect(set.contains(5), true); + expect(set.contains(6), false); + }); + + test('UnionSet.from().lookup() returns elements that are in any set', () { + expect(set.lookup(1), (1)); + expect(set.lookup(4), (4)); + expect(set.lookup(5), (5)); + expect(set.lookup(6), null); + }); + + test('UnionSet.from().lookup() returns the first element in an ordered context', () { + var duration1 = Duration(seconds: 0); + var duration2 = Duration(seconds: 0); + expect(duration1, (duration2)); + expect(duration1, duration2); + + var set = UnionSet.from([ + {duration1}, + {duration2} + ]); + + expect(set.lookup(Duration(seconds: 0)), duration1); + }); + + test('UnionSet.from().toSet() returns the union of all the sets', () { + expect(set.toSet(), ([1, 2, 3, 4, 5])); + expect(set.toSet(), set); + }); + + test('UnionSet.from().map() maps the elements', () { + expect(set.map((i) => i * 2), ([2, 4, 6, 8, 10])); + }); + }); + + group('', () { + dynamic set; + // setUp(() { + var innerSet = {3, 7}; + set = UnionSet.from([ + {1, 2}, + {5}, + innerSet + ]); + + innerSet.add(4); + innerSet.remove(7); + // }); + + test('UnionSet.from().length returns the total length', () { + expect(set.length, (5)); + }); + + test('UnionSet.from().contains() returns true for a new element', () { + expect(set.contains(4), true); + }); + + test('UnionSet.from().contains() returns false for a removed element', () { + expect(set.contains(7), false); + }); + + test('UnionSet.from().lookup() returns a new element', () { + expect(set.lookup(4), (4)); + }); + + test("UnionSet.from().lookup() doesn't returns a removed element", () { + expect(set.lookup(7), null); + }); + + test('UnionSet.from().toSet() returns the union of all the sets', () { + expect(set.toSet(), ([1, 2, 3, 4, 5])); + expect(set.toSet(), set); + }); + + test('UnionSet.from().map() maps the elements', () { + expect(set.map((i) => i * 2), ([2, 4, 6, 8, 10])); + }); + }); + + group('', () { + dynamic set; + var innerSet = {6}; + var outerSet = { + {1, 2}, + {5}, + innerSet + }; + + set = UnionSet(outerSet); + outerSet.remove(innerSet); + outerSet.add({3, 4}); + + test('UnionSet().length returns the total length', () { + expect(set.length, (5)); + }); + + test('UnionSet().contains() returns true for a new element', () { + expect(set.contains(4), true); + }); + + test('UnionSet().contains() returns false for a removed element', () { + expect(set.contains(6), false); + }); + + test('UnionSet().lookup() returns a new element', () { + expect(set.lookup(4), (4)); + }); + + test("UnionSet().lookup() doesn't returns a removed element", () { + expect(set.lookup(6), null); + }); + + test('UnionSet().toSet() returns the union of all the sets', () { + expect(set.toSet(), ([1, 2, 3, 4, 5])); + expect(set.toSet(), set); + }); + + test('UnionSet().map() maps the elements', () { + expect(set.map((i) => i * 2), ([2, 4, 6, 8, 10])); + }); + }); + } +} \ No newline at end of file diff --git a/ohos/test_collection/lib/page/unmodifiable_collection_test.dart b/ohos/test_collection/lib/page/unmodifiable_collection_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..d04105bf860682a5fabc96db9deef584962a451a --- /dev/null +++ b/ohos/test_collection/lib/page/unmodifiable_collection_test.dart @@ -0,0 +1,594 @@ +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:collection/collection.dart'; +import 'package:flutter/material.dart'; +import 'package:test_collection/base/test_page.dart'; + +class UnmodifiableCollectionTestPage extends TestPage { + UnmodifiableCollectionTestPage(String title, {Key? key}) + : super(title: title, key: key) { + var list = []; + testUnmodifiableList(list, UnmodifiableListView(list), 'empty'); + list = [42]; + testUnmodifiableList(list, UnmodifiableListView(list), 'single-42'); + list = [7]; + testUnmodifiableList(list, UnmodifiableListView(list), 'single!42'); + list = [1, 42, 10]; + testUnmodifiableList(list, UnmodifiableListView(list), 'three-42'); + list = [1, 7, 10]; + testUnmodifiableList(list, UnmodifiableListView(list), 'three!42'); + + list = []; + testNonGrowableList(list, NonGrowableListView(list), 'empty'); + list = [42]; + testNonGrowableList(list, NonGrowableListView(list), 'single-42'); + list = [7]; + testNonGrowableList(list, NonGrowableListView(list), 'single!42'); + list = [1, 42, 10]; + testNonGrowableList(list, NonGrowableListView(list), 'three-42'); + list = [1, 7, 10]; + testNonGrowableList(list, NonGrowableListView(list), 'three!42'); + + var aSet = {}; + testUnmodifiableSet(aSet, UnmodifiableSetView(aSet), 'empty'); + aSet = {}; + testUnmodifiableSet(aSet, const UnmodifiableSetView.empty(), 'const empty'); + aSet = {42}; + testUnmodifiableSet(aSet, UnmodifiableSetView(aSet), 'single-42'); + aSet = {7}; + testUnmodifiableSet(aSet, UnmodifiableSetView(aSet), 'single!42'); + aSet = {1, 42, 10}; + testUnmodifiableSet(aSet, UnmodifiableSetView(aSet), 'three-42'); + aSet = {1, 7, 10}; + testUnmodifiableSet(aSet, UnmodifiableSetView(aSet), 'three!42'); + } + + void testUnmodifiableList( + List original, List wrapped, String name) { + name = 'UnmodifiableListView-$name'; + testIterable(original, wrapped, name); + testReadList(original, wrapped, name); + testNoWriteList(original, wrapped, name); + testNoChangeLengthList(original, wrapped, name); + } + + void testNonGrowableList(List original, List wrapped, String name) { + name = 'NonGrowableListView-$name'; + testIterable(original, wrapped, name); + testReadList(original, wrapped, name); + testWriteList(original, wrapped, name); + testNoChangeLengthList(original, wrapped, name); + } + + void testUnmodifiableSet(Set original, Set wrapped, String name) { + name = 'UnmodifiableSetView-$name'; + testIterable(original, wrapped, name); + testReadSet(original, wrapped, name); + testNoChangeSet(original, wrapped, name); + } + + void testIterable( + Iterable original, Iterable wrapped, String name) { + test('$name - any', () { + expect(wrapped.any((x) => true), original.any((x) => true)); + expect(wrapped.any((x) => false), original.any((x) => false)); + }); + + test('$name - contains', () { + expect(wrapped.contains(0), original.contains(0)); + }); + + test('$name - elementAt', () { + if (original.isNotEmpty) { + expect(wrapped.elementAt(0), original.elementAt(0)); + } + }); + + test('$name - every', () { + expect(wrapped.every((x) => true), original.every((x) => true)); + expect(wrapped.every((x) => false), original.every((x) => false)); + }); + + test('$name - expand', () { + expect(wrapped.expand((x) => [x, x]), original.expand((x) => [x, x])); + }); + + test('$name - first', () { + if (original.isNotEmpty) { + expect(wrapped.first, original.first); + } + }); + + test('$name - firstWhere', () { + if (original.isNotEmpty) { + expect( + wrapped.firstWhere((_) => true), original.firstWhere((_) => true)); + } + }); + + test('$name - fold', () { + expect(wrapped.fold(0, (dynamic x, y) => x + y), + original.fold(0, (dynamic x, y) => x + y)); + }); + + test('$name - forEach', () { + var wrapCtr = 0; + var origCtr = 0; + wrapped.forEach((x) { + wrapCtr += x; + }); + original.forEach((x) { + origCtr += x; + }); + expect(wrapCtr, origCtr); + }); + + test('$name - isEmpty', () { + expect(wrapped.isEmpty, original.isEmpty); + }); + + test('$name - isNotEmpty', () { + expect(wrapped.isNotEmpty, (original.isNotEmpty)); + }); + + test('$name - iterator', () { + Iterator wrapIter = wrapped.iterator; + Iterator origIter = original.iterator; + while (origIter.moveNext()) { + expect(wrapIter.moveNext(), (true)); + expect(wrapIter.current, (origIter.current)); + } + expect(wrapIter.moveNext(), (false)); + }); + + test('$name - join', () { + expect(wrapped.join(''), (original.join(''))); + expect(wrapped.join('-'), (original.join('-'))); + }); + + test('$name - last', () { + if (original.isNotEmpty) { + wrapped.last; + } + }); + + test('$name - lastWhere', () { + if (original.isNotEmpty) { + expect( + wrapped.lastWhere((_) => true), (original.lastWhere((_) => true))); + } + }); + + test('$name - length', () { + expect(wrapped.length, (original.length)); + }); + + test('$name - map', () { + expect(wrapped.map((x) => '[$x]'), (original.map((x) => '[$x]'))); + }); + + test('$name - reduce', () { + if (original.isNotEmpty) { + expect(wrapped.reduce((x, y) => x + y), + (original.reduce((x, y) => x + y))); + } + }); + + test('$name - single', () { + if (original.length == 1) { + expect(wrapped.single, (original.single)); + } + }); + + test('$name - singleWhere', () { + if (original.length == 1) { + expect(wrapped.singleWhere((_) => true), + (original.singleWhere((_) => true))); + } + }); + + test('$name - skip', () { + expect(wrapped.skip(0), (original.skip(0))); + expect(wrapped.skip(1), (original.skip(1))); + expect(wrapped.skip(5), (original.skip(5))); + }); + + test('$name - skipWhile', () { + expect(wrapped.skipWhile((x) => true), (original.skipWhile((x) => true))); + expect( + wrapped.skipWhile((x) => false), (original.skipWhile((x) => false))); + expect(wrapped.skipWhile((x) => x != 42), + (original.skipWhile((x) => x != 42))); + }); + + test('$name - take', () { + expect(wrapped.take(0), (original.take(0))); + expect(wrapped.take(1), (original.take(1))); + expect(wrapped.take(5), (original.take(5))); + }); + + test('$name - takeWhile', () { + expect(wrapped.takeWhile((x) => true), (original.takeWhile((x) => true))); + expect( + wrapped.takeWhile((x) => false), (original.takeWhile((x) => false))); + expect(wrapped.takeWhile((x) => x != 42), + (original.takeWhile((x) => x != 42))); + }); + + test('$name - toList', () { + expect(wrapped.toList(), (original.toList())); + expect( + wrapped.toList(growable: false), (original.toList(growable: false))); + }); + + test('$name - toSet', () { + expect(wrapped.toSet(), (original.toSet())); + }); + + test('$name - where', () { + expect(wrapped.where((x) => true), (original.where((x) => true))); + expect(wrapped.where((x) => false), (original.where((x) => false))); + expect(wrapped.where((x) => x != 42), (original.where((x) => x != 42))); + }); + } + + void testReadList(List original, List wrapped, String name) { + test('$name - length', () { + expect(wrapped.length, (original.length)); + }); + + test('$name - isEmpty', () { + expect(wrapped.isEmpty, (original.isEmpty)); + }); + + test('$name - isNotEmpty', () { + expect(wrapped.isNotEmpty, (original.isNotEmpty)); + }); + + test('$name - []', () { + if (original.isNotEmpty) { + expect(wrapped[0], (original[0])); + } + }); + + test('$name - indexOf', () { + expect(wrapped.indexOf(42), (original.indexOf(42))); + }); + + test('$name - lastIndexOf', () { + expect(wrapped.lastIndexOf(42), (original.lastIndexOf(42))); + }); + + test('$name - getRange', () { + var len = original.length; + expect(wrapped.getRange(0, len), (original.getRange(0, len))); + expect( + wrapped.getRange(len ~/ 2, len), (original.getRange(len ~/ 2, len))); + expect(wrapped.getRange(0, len ~/ 2), (original.getRange(0, len ~/ 2))); + }); + + test('$name - sublist', () { + var len = original.length; + expect(wrapped.sublist(0), (original.sublist(0))); + expect(wrapped.sublist(len ~/ 2), (original.sublist(len ~/ 2))); + expect(wrapped.sublist(0, len ~/ 2), (original.sublist(0, len ~/ 2))); + }); + + test('$name - asMap', () { + expect(wrapped.asMap(), (original.asMap())); + }); + } + + void testNoWriteList(List original, List wrapped, String name) { + var copy = List.of(original); + + void testThrows(name, thunk) { + test(name, () { + thunk; + // No modifications happened. + expect(original, (copy)); + }); + } + + testThrows('$name - []= throws', () { + wrapped[0] = 42; + }); + + testThrows('$name - sort throws', () { + wrapped.sort(); + }); + + testThrows('$name - fillRange throws', () { + wrapped.fillRange(0, wrapped.length, 42); + }); + + testThrows('$name - setRange throws', () { + wrapped.setRange( + 0, wrapped.length, Iterable.generate(wrapped.length, (i) => i)); + }); + + testThrows('$name - setAll throws', () { + wrapped.setAll(0, Iterable.generate(wrapped.length, (i) => i)); + }); + } + + void testWriteList(List original, List wrapped, String name) { + var copy = List.of(original); + + test('$name - []=', () { + if (original.isNotEmpty) { + var originalFirst = original[0]; + wrapped[0] = originalFirst + 1; + expect(original[0], (originalFirst + 1)); + original[0] = originalFirst; + } else { + wrapped[0] = 42; + } + }); + + test('$name - sort', () { + var sortCopy = List.of(original); + sortCopy.sort(); + wrapped.sort(); + expect(original, (sortCopy)); + original.setAll(0, copy); + }); + + test('$name - fillRange', () { + wrapped.fillRange(0, wrapped.length, 37); + for (var i = 0; i < original.length; i++) { + expect(original[i], (37)); + } + original.setAll(0, copy); + }); + + test('$name - setRange', () { + List reverseList = original.reversed.toList(); + wrapped.setRange(0, wrapped.length, reverseList); + expect(original, (reverseList)); + original.setAll(0, copy); + }); + + test('$name - setAll', () { + List reverseList = original.reversed.toList(); + wrapped.setAll(0, reverseList); + expect(original, (reverseList)); + original.setAll(0, copy); + }); + } + + void testNoChangeLengthList( + List original, List wrapped, String name) { + var copy = List.of(original); + + void testThrows(String name, thunk) { + test(name, () { + thunk; + // No modifications happened. + expect(original, (copy)); + }); + } + + testThrows('$name - length= throws', () { + wrapped.length = 100; + }); + + testThrows('$name - add throws', () { + wrapped.add(42); + }); + + testThrows('$name - addAll throws', () { + wrapped.addAll([42]); + }); + + testThrows('$name - insert throws', () { + wrapped.insert(0, 42); + }); + + testThrows('$name - insertAll throws', () { + wrapped.insertAll(0, [42]); + }); + + testThrows('$name - remove throws', () { + wrapped.remove(42); + }); + + testThrows('$name - removeAt throws', () { + wrapped.removeAt(0); + }); + + testThrows('$name - removeLast throws', () { + wrapped.removeLast(); + }); + + testThrows('$name - removeWhere throws', () { + wrapped.removeWhere((element) => false); + }); + + testThrows('$name - retainWhere throws', () { + wrapped.retainWhere((element) => true); + }); + + testThrows('$name - removeRange throws', () { + wrapped.removeRange(0, wrapped.length); + }); + + testThrows('$name - replaceRange throws', () { + wrapped.replaceRange(0, wrapped.length, [42]); + }); + + testThrows('$name - clear throws', () { + wrapped.clear(); + }); + } + + void testReadSet(Set original, Set wrapped, String name) { + var copy = Set.of(original); + + test('$name - containsAll', () { + expect(wrapped.containsAll(copy), true); + expect(wrapped.containsAll(copy.toList()), true); + expect(wrapped.containsAll([]), true); + expect(wrapped.containsAll([42]), (original.containsAll([42]))); + }); + + test('$name - intersection', () { + expect(wrapped.intersection({}), wrapped.intersection({}).isEmpty); + expect(wrapped.intersection(copy), (original)); + expect(wrapped.intersection({42}), + Set.of(original.contains(42) ? [42] : [])); + }); + + test('$name - union', () { + expect(wrapped.union({}), (original)); + expect(wrapped.union(copy), (original)); + expect(wrapped.union({42}), (original.union({42}))); + }); + + test('$name - difference', () { + expect(wrapped.difference({}), (original)); + expect(wrapped.difference(copy), wrapped.difference(copy).isEmpty); + expect(wrapped.difference({42}), (original.difference({42}))); + }); + } + + void testNoChangeSet(Set original, Set wrapped, String name) { + var originalElements = original.toList(); + + void testThrows(name, thunk) { + test(name, () { + thunk; + // No modifications happened. + expect(original.toList(), (originalElements)); + }); + } + + testThrows('$name - add throws', () { + wrapped.add(42); + }); + + testThrows('$name - addAll throws', () { + wrapped.addAll([42]); + }); + + testThrows('$name - addAll empty throws', () { + wrapped.addAll([]); + }); + + testThrows('$name - remove throws', () { + wrapped.remove(42); + }); + + testThrows('$name - removeAll throws', () { + wrapped.removeAll([42]); + }); + + testThrows('$name - removeAll empty throws', () { + wrapped.removeAll([]); + }); + + testThrows('$name - retainAll throws', () { + wrapped.retainAll([42]); + }); + + testThrows('$name - removeWhere throws', () { + wrapped.removeWhere((_) => false); + }); + + testThrows('$name - retainWhere throws', () { + wrapped.retainWhere((_) => true); + }); + + testThrows('$name - clear throws', () { + wrapped.clear(); + }); + } + + void testReadMap(Map original, Map wrapped, String name) { + test('$name length', () { + expect(wrapped.length, (original.length)); + }); + + test('$name isEmpty', () { + expect(wrapped.isEmpty, (original.isEmpty)); + }); + + test('$name isNotEmpty', () { + expect(wrapped.isNotEmpty, (original.isNotEmpty)); + }); + + test('$name operator[]', () { + expect(wrapped[0], (0)); + expect(wrapped[999], (999)); + }); + + test('$name containsKey', () { + expect(wrapped.containsKey(0), (original.containsKey(0))); + expect(wrapped.containsKey(999), (original.containsKey(999))); + }); + + test('$name containsValue', () { + expect(wrapped.containsValue(0), (original.containsValue(0))); + expect(wrapped.containsValue(999), (original.containsValue(999))); + }); + + test('$name forEach', () { + var origCnt = 0; + var wrapCnt = 0; + wrapped.forEach((k, v) { + wrapCnt += 1 << k + 3 * v; + }); + original.forEach((k, v) { + origCnt += 1 << k + 3 * v; + }); + expect(wrapCnt, (origCnt)); + }); + + test('$name keys', () { + expect(wrapped.keys, (original.keys)); + }); + + test('$name values', () { + expect(wrapped.values, (original.values)); + }); + } + + void testNoChangeMap( + Map original, Map wrapped, String name) { + var copy = Map.of(original); + + void testThrows(name, thunk) { + test(name, () { + thunk; + // No modifications happened. + expect(original, (copy)); + }); + } + + testThrows('$name operator[]= throws', () { + wrapped[0] = 42; + }); + + testThrows('$name putIfAbsent throws', () { + wrapped.putIfAbsent(0, () => 42); + }); + + testThrows('$name addAll throws', () { + wrapped.addAll({42: 42}); + }); + + testThrows('$name addAll empty throws', () { + wrapped.addAll({}); + }); + + testThrows('$name remove throws', () { + wrapped.remove(0); + }); + + testThrows('$name clear throws', () { + wrapped.clear(); + }); + } +} diff --git a/ohos/test_collection/ohos/.gitignore b/ohos/test_collection/ohos/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..fbabf771011fe78f9919db0b1195ab6cadffc2b0 --- /dev/null +++ b/ohos/test_collection/ohos/.gitignore @@ -0,0 +1,11 @@ +/node_modules +/oh_modules +/local.properties +/.idea +**/build +/.hvigor +.cxx +/.clangd +/.clang-format +/.clang-tidy +**/.test \ No newline at end of file diff --git a/ohos/test_collection/ohos/AppScope/app.json5 b/ohos/test_collection/ohos/AppScope/app.json5 new file mode 100644 index 0000000000000000000000000000000000000000..cea6afa891b8ae3bcbe1287ce55e4cb7fb0f5f72 --- /dev/null +++ b/ohos/test_collection/ohos/AppScope/app.json5 @@ -0,0 +1,10 @@ +{ + "app": { + "bundleName": "com.example.test_collection", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name" + } +} diff --git a/ohos/test_collection/ohos/AppScope/resources/base/element/string.json b/ohos/test_collection/ohos/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..3b13f372c50641375a42904890e0df5157384c8a --- /dev/null +++ b/ohos/test_collection/ohos/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "test_collection" + } + ] +} diff --git a/ohos/test_collection/ohos/AppScope/resources/base/media/app_icon.png b/ohos/test_collection/ohos/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ohos/test_collection/ohos/AppScope/resources/base/media/app_icon.png differ diff --git a/ohos/test_collection/ohos/build-profile.json5 b/ohos/test_collection/ohos/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..238b2d5bbf8b3a0c28dae746eaf5220737a944fe --- /dev/null +++ b/ohos/test_collection/ohos/build-profile.json5 @@ -0,0 +1,42 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +{ + "app": { + "signingConfigs": [], + "compileSdkVersion": 10, + "compatibleSdkVersion": 10, + "products": [ + { + "name": "default", + "signingConfig": "default", + } + ] + }, + "modules": [ + { + "name": "entry", + "srcPath": "./entry", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/ohos/test_collection/ohos/dta/icudtl.dat b/ohos/test_collection/ohos/dta/icudtl.dat new file mode 100644 index 0000000000000000000000000000000000000000..d1f10917ab52e3ebd251abd7f5377d7196b80d67 Binary files /dev/null and b/ohos/test_collection/ohos/dta/icudtl.dat differ diff --git a/ohos/test_collection/ohos/entry/.gitignore b/ohos/test_collection/ohos/entry/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..2795a1c5b1fe53659dd1b71d90ba0592eaf7e043 --- /dev/null +++ b/ohos/test_collection/ohos/entry/.gitignore @@ -0,0 +1,7 @@ + +/node_modules +/oh_modules +/.preview +/build +/.cxx +/.test \ No newline at end of file diff --git a/ohos/test_collection/ohos/entry/build-profile.json5 b/ohos/test_collection/ohos/entry/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..f02a52e08c8fa1c3a33b9faa4592e9f695cd1c54 --- /dev/null +++ b/ohos/test_collection/ohos/entry/build-profile.json5 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +{ + "apiType": 'stageMode', + "buildOption": { + }, + "targets": [ + { + "name": "default", + "runtimeOS": "OpenHarmony" + }, + { + "name": "ohosTest", + } + ] +} \ No newline at end of file diff --git a/ohos/test_collection/ohos/entry/hvigorfile.ts b/ohos/test_collection/ohos/entry/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..894fc15c6b793f085e6c8506e43d719af658e8ff --- /dev/null +++ b/ohos/test_collection/ohos/entry/hvigorfile.ts @@ -0,0 +1,17 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently. +export { hapTasks } from '@ohos/hvigor-ohos-plugin'; diff --git a/ohos/test_collection/ohos/entry/libs/arm64-v8a/libapp.so b/ohos/test_collection/ohos/entry/libs/arm64-v8a/libapp.so new file mode 100644 index 0000000000000000000000000000000000000000..c5c797a24ae7089593d4bac65f732a30f9016ec1 Binary files /dev/null and b/ohos/test_collection/ohos/entry/libs/arm64-v8a/libapp.so differ diff --git a/ohos/test_collection/ohos/entry/libs/arm64-v8a/libc++_shared.so b/ohos/test_collection/ohos/entry/libs/arm64-v8a/libc++_shared.so new file mode 100644 index 0000000000000000000000000000000000000000..831c9353702073d45889352a4dafb93103d67d20 Binary files /dev/null and b/ohos/test_collection/ohos/entry/libs/arm64-v8a/libc++_shared.so differ diff --git a/ohos/test_collection/ohos/entry/libs/arm64-v8a/libflutter.so b/ohos/test_collection/ohos/entry/libs/arm64-v8a/libflutter.so new file mode 100755 index 0000000000000000000000000000000000000000..488ebb753f1bf6ffadfc3329a7ef64f0265d20fd Binary files /dev/null and b/ohos/test_collection/ohos/entry/libs/arm64-v8a/libflutter.so differ diff --git a/ohos/test_collection/ohos/entry/oh-package.json5 b/ohos/test_collection/ohos/entry/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..ab756b7624a009a30db809d7d64c62d84dc7b153 --- /dev/null +++ b/ohos/test_collection/ohos/entry/oh-package.json5 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +{ + "name": "entry", + "version": "1.0.0", + "description": "Please describe the basic information.", + "main": "", + "author": "", + "license": "", + "dependencies": { + "@ohos/flutter_ohos": "file:../har/flutter_embedding.har" + } +} + diff --git a/ohos/test_collection/ohos/entry/src/main/ets/entryability/EntryAbility.ets b/ohos/test_collection/ohos/entry/src/main/ets/entryability/EntryAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..321a4eeaacd7b8079a876e25c4dafd498e4d9fb9 --- /dev/null +++ b/ohos/test_collection/ohos/entry/src/main/ets/entryability/EntryAbility.ets @@ -0,0 +1,22 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import { FlutterAbility } from '@ohos/flutter_ohos' + +export default class EntryAbility extends FlutterAbility { + onFlutterEngineReady(): void { + super.onFlutterEngineReady() + } +} diff --git a/ohos/test_collection/ohos/entry/src/main/ets/pages/Index.ets b/ohos/test_collection/ohos/entry/src/main/ets/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..d784c75ed9d16a6657bb6466a148752b1b20bd91 --- /dev/null +++ b/ohos/test_collection/ohos/entry/src/main/ets/pages/Index.ets @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import { FlutterPage } from '@ohos/flutter_ohos' + +@Entry +@Component +struct Index { + build() { + Column() { + FlutterPage() + } + } +} \ No newline at end of file diff --git a/ohos/test_collection/ohos/entry/src/main/module.json5 b/ohos/test_collection/ohos/entry/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..7bbf78b18f39991b1404061c7437538c7d532bb7 --- /dev/null +++ b/ohos/test_collection/ohos/entry/src/main/module.json5 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +{ + "module": { + "name": "entry", + "type": "entry", + "description": "$string:module_desc", + "mainElement": "EntryAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "EntryAbility", + "srcEntry": "./ets/entryability/EntryAbility.ets", + "description": "$string:EntryAbility_desc", + "icon": "$media:icon", + "label": "$string:EntryAbility_label", + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:start_window_background", + "exported": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ], + "requestPermissions": [ + {"name" : "ohos.permission.INTERNET"}, + ] + } +} \ No newline at end of file diff --git a/ohos/test_collection/ohos/entry/src/main/resources/base/element/color.json b/ohos/test_collection/ohos/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02 --- /dev/null +++ b/ohos/test_collection/ohos/entry/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/ohos/test_collection/ohos/entry/src/main/resources/base/element/string.json b/ohos/test_collection/ohos/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f94595515a99e0c828807e243494f57f09251930 --- /dev/null +++ b/ohos/test_collection/ohos/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ohos/test_collection/ohos/entry/src/main/resources/base/media/icon.png b/ohos/test_collection/ohos/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ohos/test_collection/ohos/entry/src/main/resources/base/media/icon.png differ diff --git a/ohos/test_collection/ohos/entry/src/main/resources/base/profile/main_pages.json b/ohos/test_collection/ohos/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce --- /dev/null +++ b/ohos/test_collection/ohos/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/Index" + ] +} diff --git a/ohos/test_collection/ohos/entry/src/main/resources/en_US/element/string.json b/ohos/test_collection/ohos/entry/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f94595515a99e0c828807e243494f57f09251930 --- /dev/null +++ b/ohos/test_collection/ohos/entry/src/main/resources/en_US/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ohos/test_collection/ohos/entry/src/main/resources/rawfile/flutter_assets/AssetManifest.json b/ohos/test_collection/ohos/entry/src/main/resources/rawfile/flutter_assets/AssetManifest.json new file mode 100644 index 0000000000000000000000000000000000000000..9e26dfeeb6e641a33dae4961196235bdb965b21b --- /dev/null +++ b/ohos/test_collection/ohos/entry/src/main/resources/rawfile/flutter_assets/AssetManifest.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/ohos/test_collection/ohos/entry/src/main/resources/rawfile/flutter_assets/FontManifest.json b/ohos/test_collection/ohos/entry/src/main/resources/rawfile/flutter_assets/FontManifest.json new file mode 100644 index 0000000000000000000000000000000000000000..3abf18c41c58c933308c244a875bf383856e103e --- /dev/null +++ b/ohos/test_collection/ohos/entry/src/main/resources/rawfile/flutter_assets/FontManifest.json @@ -0,0 +1 @@ +[{"family":"MaterialIcons","fonts":[{"asset":"fonts/MaterialIcons-Regular.otf"}]}] \ No newline at end of file diff --git a/ohos/test_collection/ohos/entry/src/main/resources/rawfile/flutter_assets/NOTICES.Z b/ohos/test_collection/ohos/entry/src/main/resources/rawfile/flutter_assets/NOTICES.Z new file mode 100644 index 0000000000000000000000000000000000000000..3f84d5998b235ccd89fccf4fb8066ed733216cbc Binary files /dev/null and b/ohos/test_collection/ohos/entry/src/main/resources/rawfile/flutter_assets/NOTICES.Z differ diff --git a/ohos/test_collection/ohos/entry/src/main/resources/rawfile/flutter_assets/fonts/MaterialIcons-Regular.otf b/ohos/test_collection/ohos/entry/src/main/resources/rawfile/flutter_assets/fonts/MaterialIcons-Regular.otf new file mode 100644 index 0000000000000000000000000000000000000000..8c99266130a89547b4344f47e08aacad473b14e0 Binary files /dev/null and b/ohos/test_collection/ohos/entry/src/main/resources/rawfile/flutter_assets/fonts/MaterialIcons-Regular.otf differ diff --git a/ohos/test_collection/ohos/entry/src/main/resources/rawfile/flutter_assets/icudtl.dat b/ohos/test_collection/ohos/entry/src/main/resources/rawfile/flutter_assets/icudtl.dat new file mode 100644 index 0000000000000000000000000000000000000000..d1f10917ab52e3ebd251abd7f5377d7196b80d67 Binary files /dev/null and b/ohos/test_collection/ohos/entry/src/main/resources/rawfile/flutter_assets/icudtl.dat differ diff --git a/ohos/test_collection/ohos/entry/src/main/resources/rawfile/flutter_assets/shaders/ink_sparkle.frag b/ohos/test_collection/ohos/entry/src/main/resources/rawfile/flutter_assets/shaders/ink_sparkle.frag new file mode 100644 index 0000000000000000000000000000000000000000..0bb5a14a220d223adde1e69eb1959332d6bd08c7 Binary files /dev/null and b/ohos/test_collection/ohos/entry/src/main/resources/rawfile/flutter_assets/shaders/ink_sparkle.frag differ diff --git a/ohos/test_collection/ohos/entry/src/main/resources/zh_CN/element/string.json b/ohos/test_collection/ohos/entry/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..597ecf95e61d7e30367c22fe2f8638008361b044 --- /dev/null +++ b/ohos/test_collection/ohos/entry/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "模块描述" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ohos/test_collection/ohos/entry/src/ohosTest/ets/test/Ability.test.ets b/ohos/test_collection/ohos/entry/src/ohosTest/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..25d4c71ff3cd584f5d64f6f8c0ac864928c234c4 --- /dev/null +++ b/ohos/test_collection/ohos/entry/src/ohosTest/ets/test/Ability.test.ets @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import hilog from '@ohos.hilog'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' + +export default function abilityTest() { + describe('ActsAbilityTest', function () { + // Defines a test suite. Two parameters are supported: test suite name and test suite function. + beforeAll(function () { + // Presets an action, which is performed only once before all test cases of the test suite start. + // This API supports only one parameter: preset action function. + }) + beforeEach(function () { + // Presets an action, which is performed before each unit test case starts. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: preset action function. + }) + afterEach(function () { + // Presets a clear action, which is performed after each unit test case ends. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: clear action function. + }) + afterAll(function () { + // Presets a clear action, which is performed after all test cases of the test suite end. + // This API supports only one parameter: clear action function. + }) + it('assertContain',0, function () { + // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. + hilog.info(0x0000, 'testTag', '%{public}s', 'it begin'); + let a = 'abc' + let b = 'b' + // Defines a variety of assertion methods, which are used to declare expected boolean conditions. + expect(a).assertContain(b) + expect(a).assertEqual(a) + }) + }) +} \ No newline at end of file diff --git a/ohos/test_collection/ohos/entry/src/ohosTest/ets/test/List.test.ets b/ohos/test_collection/ohos/entry/src/ohosTest/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..f4140030e65d20df6af30a6bf51e464dea8f8aa6 --- /dev/null +++ b/ohos/test_collection/ohos/entry/src/ohosTest/ets/test/List.test.ets @@ -0,0 +1,20 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import abilityTest from './Ability.test' + +export default function testsuite() { + abilityTest() +} \ No newline at end of file diff --git a/ohos/test_collection/ohos/entry/src/ohosTest/ets/testability/TestAbility.ets b/ohos/test_collection/ohos/entry/src/ohosTest/ets/testability/TestAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..4ca645e6013cfce8e7dbb728313cb8840c4da660 --- /dev/null +++ b/ohos/test_collection/ohos/entry/src/ohosTest/ets/testability/TestAbility.ets @@ -0,0 +1,63 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import UIAbility from '@ohos.app.ability.UIAbility'; +import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; +import hilog from '@ohos.hilog'; +import { Hypium } from '@ohos/hypium'; +import testsuite from '../test/List.test'; +import window from '@ohos.window'; + +export default class TestAbility extends UIAbility { + onCreate(want, launchParam) { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate'); + hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); + hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? ''); + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy'); + } + + onWindowStageCreate(windowStage: window.WindowStage) { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate'); + windowStage.loadContent('testability/pages/Index', (err, data) => { + if (err.code) { + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', + JSON.stringify(data) ?? ''); + }); + } + + onWindowStageDestroy() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy'); + } + + onForeground() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground'); + } + + onBackground() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground'); + } +} \ No newline at end of file diff --git a/ohos/test_collection/ohos/entry/src/ohosTest/ets/testability/pages/Index.ets b/ohos/test_collection/ohos/entry/src/ohosTest/ets/testability/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..cef0447cd2f137ef82d223ead2e156808878ab90 --- /dev/null +++ b/ohos/test_collection/ohos/entry/src/ohosTest/ets/testability/pages/Index.ets @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import hilog from '@ohos.hilog'; + +@Entry +@Component +struct Index { + aboutToAppear() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear'); + } + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } \ No newline at end of file diff --git a/ohos/test_collection/ohos/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts b/ohos/test_collection/ohos/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..1def08f2e9dcbfa3454a07b7a3b82b173bb90d02 --- /dev/null +++ b/ohos/test_collection/ohos/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import hilog from '@ohos.hilog'; +import TestRunner from '@ohos.application.testRunner'; +import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +async function onAbilityCreateCallback() { + hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); +} + +async function addAbilityMonitorCallback(err: any) { + hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); + } + + async onRun() { + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility' + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName + var debug = abilityDelegatorArguments.parameters['-D'] + if (debug == 'true') + { + cmd += ' -D' + } + hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd); + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? ''); + hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? ''); + hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? ''); + }) + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end'); + } +} \ No newline at end of file diff --git a/ohos/test_collection/ohos/entry/src/ohosTest/module.json5 b/ohos/test_collection/ohos/entry/src/ohosTest/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..fab77ce2e0c61e3ad010bab5b27ccbd15f9a8c96 --- /dev/null +++ b/ohos/test_collection/ohos/entry/src/ohosTest/module.json5 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +{ + "module": { + "name": "entry_test", + "type": "feature", + "description": "$string:module_test_desc", + "mainElement": "TestAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:test_pages", + "abilities": [ + { + "name": "TestAbility", + "srcEntry": "./ets/testability/TestAbility.ets", + "description": "$string:TestAbility_desc", + "icon": "$media:icon", + "label": "$string:TestAbility_label", + "exported": true, + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:start_window_background", + "skills": [ + { + "actions": [ + "action.system.home" + ], + "entities": [ + "entity.system.home" + ] + } + ] + } + ] + } +} diff --git a/ohos/test_collection/ohos/entry/src/ohosTest/resources/base/element/color.json b/ohos/test_collection/ohos/entry/src/ohosTest/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02 --- /dev/null +++ b/ohos/test_collection/ohos/entry/src/ohosTest/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/ohos/test_collection/ohos/entry/src/ohosTest/resources/base/element/string.json b/ohos/test_collection/ohos/entry/src/ohosTest/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..65d8fa5a7cf54aa3943dcd0214f58d1771bc1f6c --- /dev/null +++ b/ohos/test_collection/ohos/entry/src/ohosTest/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_test_desc", + "value": "test ability description" + }, + { + "name": "TestAbility_desc", + "value": "the test ability" + }, + { + "name": "TestAbility_label", + "value": "test label" + } + ] +} \ No newline at end of file diff --git a/ohos/test_collection/ohos/entry/src/ohosTest/resources/base/media/icon.png b/ohos/test_collection/ohos/entry/src/ohosTest/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ohos/test_collection/ohos/entry/src/ohosTest/resources/base/media/icon.png differ diff --git a/ohos/test_collection/ohos/entry/src/ohosTest/resources/base/profile/test_pages.json b/ohos/test_collection/ohos/entry/src/ohosTest/resources/base/profile/test_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..b7e7343cacb32ce982a45e76daad86e435e054fe --- /dev/null +++ b/ohos/test_collection/ohos/entry/src/ohosTest/resources/base/profile/test_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "testability/pages/Index" + ] +} diff --git a/ohos/test_collection/ohos/har/flutter_embedding.har b/ohos/test_collection/ohos/har/flutter_embedding.har new file mode 100644 index 0000000000000000000000000000000000000000..df4ad91a9a830bf776221dd2983cd02fc13a9e4f Binary files /dev/null and b/ohos/test_collection/ohos/har/flutter_embedding.har differ diff --git a/ohos/test_collection/ohos/har/flutter_embedding.har.debug.10 b/ohos/test_collection/ohos/har/flutter_embedding.har.debug.10 new file mode 100644 index 0000000000000000000000000000000000000000..b75cb4e20800111a17d237ff0bc22eb8fd3d5875 Binary files /dev/null and b/ohos/test_collection/ohos/har/flutter_embedding.har.debug.10 differ diff --git a/ohos/test_collection/ohos/har/flutter_embedding.har.debug.9 b/ohos/test_collection/ohos/har/flutter_embedding.har.debug.9 new file mode 100644 index 0000000000000000000000000000000000000000..f0df4ca0064821178bf4254b16e8d23d873827da Binary files /dev/null and b/ohos/test_collection/ohos/har/flutter_embedding.har.debug.9 differ diff --git a/ohos/test_collection/ohos/har/flutter_embedding.har.release.10 b/ohos/test_collection/ohos/har/flutter_embedding.har.release.10 new file mode 100644 index 0000000000000000000000000000000000000000..df4ad91a9a830bf776221dd2983cd02fc13a9e4f Binary files /dev/null and b/ohos/test_collection/ohos/har/flutter_embedding.har.release.10 differ diff --git a/ohos/test_collection/ohos/har/flutter_embedding.har.release.9 b/ohos/test_collection/ohos/har/flutter_embedding.har.release.9 new file mode 100644 index 0000000000000000000000000000000000000000..ba52754a80826e5614438b3faf931ed2f487eaab Binary files /dev/null and b/ohos/test_collection/ohos/har/flutter_embedding.har.release.9 differ diff --git a/ohos/test_collection/ohos/hvigor/hvigor-config.json5 b/ohos/test_collection/ohos/hvigor/hvigor-config.json5 new file mode 100644 index 0000000000000000000000000000000000000000..990085f6621b0d3e876a162e42eb2bc1bf441434 --- /dev/null +++ b/ohos/test_collection/ohos/hvigor/hvigor-config.json5 @@ -0,0 +1,21 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +{ + "hvigorVersion": "2.1.1", + "dependencies": { + "@ohos/hvigor-ohos-plugin": "2.1.1" + } +} diff --git a/ohos/test_collection/ohos/hvigor/hvigor-wrapper.js b/ohos/test_collection/ohos/hvigor/hvigor-wrapper.js new file mode 100644 index 0000000000000000000000000000000000000000..994f22987bd0739b9faa07c966b066c2d9218602 --- /dev/null +++ b/ohos/test_collection/ohos/hvigor/hvigor-wrapper.js @@ -0,0 +1,2 @@ +"use strict";var e=require("fs"),t=require("path"),n=require("os"),r=require("crypto"),u=require("child_process"),o=require("constants"),i=require("stream"),s=require("util"),c=require("assert"),a=require("tty"),l=require("zlib"),f=require("net");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var D=d(e),p=d(t),E=d(n),m=d(r),h=d(u),y=d(o),C=d(i),F=d(s),g=d(c),A=d(a),v=d(l),S=d(f),w="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},O={},b={},_={},B=w&&w.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(_,"__esModule",{value:!0}),_.isMac=_.isLinux=_.isWindows=void 0;const P=B(E.default),k="Windows_NT",x="Linux",N="Darwin";_.isWindows=function(){return P.default.type()===k},_.isLinux=function(){return P.default.type()===x},_.isMac=function(){return P.default.type()===N};var I={},T=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),R=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),M=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&T(t,e,n);return R(t,e),t};Object.defineProperty(I,"__esModule",{value:!0}),I.hash=void 0;const L=M(m.default);I.hash=function(e,t="md5"){return L.createHash(t).update(e,"utf-8").digest("hex")},function(e){var t=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),n=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var u in e)"default"!==u&&Object.prototype.hasOwnProperty.call(e,u)&&t(r,e,u);return n(r,e),r};Object.defineProperty(e,"__esModule",{value:!0}),e.HVIGOR_BOOT_JS_FILE_PATH=e.HVIGOR_PROJECT_DEPENDENCY_PACKAGE_JSON_PATH=e.HVIGOR_PROJECT_DEPENDENCIES_HOME=e.HVIGOR_PROJECT_WRAPPER_HOME=e.HVIGOR_PROJECT_NAME=e.HVIGOR_PROJECT_ROOT_DIR=e.HVIGOR_PROJECT_CACHES_HOME=e.HVIGOR_PNPM_STORE_PATH=e.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH=e.HVIGOR_WRAPPER_TOOLS_HOME=e.HVIGOR_USER_HOME=e.DEFAULT_PACKAGE_JSON=e.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME=e.PNPM=e.HVIGOR=e.NPM_TOOL=e.PNPM_TOOL=e.HVIGOR_ENGINE_PACKAGE_NAME=void 0;const u=r(p.default),o=r(E.default),i=_,s=I;e.HVIGOR_ENGINE_PACKAGE_NAME="@ohos/hvigor",e.PNPM_TOOL=(0,i.isWindows)()?"pnpm.cmd":"pnpm",e.NPM_TOOL=(0,i.isWindows)()?"npm.cmd":"npm",e.HVIGOR="hvigor",e.PNPM="pnpm",e.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME="hvigor-config.json5",e.DEFAULT_PACKAGE_JSON="package.json",e.HVIGOR_USER_HOME=u.resolve(o.homedir(),".hvigor"),e.HVIGOR_WRAPPER_TOOLS_HOME=u.resolve(e.HVIGOR_USER_HOME,"wrapper","tools"),e.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH=u.resolve(e.HVIGOR_WRAPPER_TOOLS_HOME,"node_modules",".bin",e.PNPM_TOOL),e.HVIGOR_PNPM_STORE_PATH=u.resolve(e.HVIGOR_USER_HOME,"caches"),e.HVIGOR_PROJECT_CACHES_HOME=u.resolve(e.HVIGOR_USER_HOME,"project_caches"),e.HVIGOR_PROJECT_ROOT_DIR=process.cwd(),e.HVIGOR_PROJECT_NAME=u.basename((0,s.hash)(e.HVIGOR_PROJECT_ROOT_DIR)),e.HVIGOR_PROJECT_WRAPPER_HOME=u.resolve(e.HVIGOR_PROJECT_ROOT_DIR,e.HVIGOR),e.HVIGOR_PROJECT_DEPENDENCIES_HOME=u.resolve(e.HVIGOR_PROJECT_CACHES_HOME,e.HVIGOR_PROJECT_NAME,"workspace"),e.HVIGOR_PROJECT_DEPENDENCY_PACKAGE_JSON_PATH=u.resolve(e.HVIGOR_PROJECT_DEPENDENCIES_HOME,e.DEFAULT_PACKAGE_JSON),e.HVIGOR_BOOT_JS_FILE_PATH=u.resolve(e.HVIGOR_PROJECT_DEPENDENCIES_HOME,"node_modules","@ohos","hvigor","bin","hvigor.js")}(b);var j={},$={};Object.defineProperty($,"__esModule",{value:!0}),$.logInfoPrintConsole=$.logErrorAndExit=void 0,$.logErrorAndExit=function(e){e instanceof Error?console.error(e.message):console.error(e),process.exit(-1)},$.logInfoPrintConsole=function(e){console.log(e)};var H=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),J=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),G=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&H(t,e,n);return J(t,e),t},V=w&&w.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(j,"__esModule",{value:!0}),j.isFileExists=j.offlinePluginConversion=j.executeCommand=j.getNpmPath=j.hasNpmPackInPaths=void 0;const U=h.default,W=G(p.default),z=b,K=$,q=V(D.default);j.hasNpmPackInPaths=function(e,t){try{return require.resolve(e,{paths:[...t]}),!0}catch(e){return!1}},j.getNpmPath=function(){const e=process.execPath;return W.join(W.dirname(e),z.NPM_TOOL)},j.executeCommand=function(e,t,n){0!==(0,U.spawnSync)(e,t,n).status&&(0,K.logErrorAndExit)(`Error: ${e} ${t} execute failed.See above for details.`)},j.offlinePluginConversion=function(e,t){return t.startsWith("file:")||t.endsWith(".tgz")?W.resolve(e,z.HVIGOR,t.replace("file:","")):t},j.isFileExists=function(e){return q.default.existsSync(e)&&q.default.statSync(e).isFile()},function(e){var t=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),n=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var u in e)"default"!==u&&Object.prototype.hasOwnProperty.call(e,u)&&t(r,e,u);return n(r,e),r},u=w&&w.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.executeInstallPnpm=e.isPnpmAvailable=e.environmentHandler=e.checkNpmConifg=e.PNPM_VERSION=void 0;const o=r(D.default),i=b,s=j,c=r(p.default),a=$,l=h.default,f=u(E.default);e.PNPM_VERSION="7.30.0",e.checkNpmConifg=function(){const e=c.resolve(i.HVIGOR_PROJECT_ROOT_DIR,".npmrc"),t=c.resolve(f.default.homedir(),".npmrc");if((0,s.isFileExists)(e)||(0,s.isFileExists)(t))return;const n=(0,s.getNpmPath)(),r=(0,l.spawnSync)(n,["config","get","prefix"],{cwd:i.HVIGOR_PROJECT_ROOT_DIR});if(0!==r.status||!r.stdout)return void(0,a.logErrorAndExit)("Error: The hvigor depends on the npmrc file. Configure the npmrc file first.");const u=c.resolve(`${r.stdout}`.replace(/[\r\n]/gi,""),".npmrc");(0,s.isFileExists)(u)||(0,a.logErrorAndExit)("Error: The hvigor depends on the npmrc file. Configure the npmrc file first.")},e.environmentHandler=function(){process.env["npm_config_update-notifier"]="false"},e.isPnpmAvailable=function(){return!!o.existsSync(i.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH)&&(0,s.hasNpmPackInPaths)("pnpm",[i.HVIGOR_WRAPPER_TOOLS_HOME])},e.executeInstallPnpm=function(){(0,a.logInfoPrintConsole)(`Installing pnpm@${e.PNPM_VERSION}...`);const t=(0,s.getNpmPath)();!function(){const t=c.resolve(i.HVIGOR_WRAPPER_TOOLS_HOME,i.DEFAULT_PACKAGE_JSON);try{o.existsSync(i.HVIGOR_WRAPPER_TOOLS_HOME)||o.mkdirSync(i.HVIGOR_WRAPPER_TOOLS_HOME,{recursive:!0});const n={dependencies:{}};n.dependencies[i.PNPM]=e.PNPM_VERSION,o.writeFileSync(t,JSON.stringify(n))}catch(e){(0,a.logErrorAndExit)(`Error: EPERM: operation not permitted,create ${t} failed.`)}}(),(0,s.executeCommand)(t,["install","pnpm"],{cwd:i.HVIGOR_WRAPPER_TOOLS_HOME,stdio:["inherit","inherit","inherit"],env:process.env}),(0,a.logInfoPrintConsole)("Pnpm install success.")}}(O);var Y={},X={},Z={},Q={};Object.defineProperty(Q,"__esModule",{value:!0}),Q.Unicode=void 0;class ee{}Q.Unicode=ee,ee.Space_Separator=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,ee.ID_Start=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,ee.ID_Continue=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,Object.defineProperty(Z,"__esModule",{value:!0}),Z.JudgeUtil=void 0;const te=Q;Z.JudgeUtil=class{static isIgnoreChar(e){return"string"==typeof e&&("\t"===e||"\v"===e||"\f"===e||" "===e||" "===e||"\ufeff"===e||"\n"===e||"\r"===e||"\u2028"===e||"\u2029"===e)}static isSpaceSeparator(e){return"string"==typeof e&&te.Unicode.Space_Separator.test(e)}static isIdStartChar(e){return"string"==typeof e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||"$"===e||"_"===e||te.Unicode.ID_Start.test(e))}static isIdContinueChar(e){return"string"==typeof e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||"$"===e||"_"===e||"‌"===e||"‍"===e||te.Unicode.ID_Continue.test(e))}static isDigitWithoutZero(e){return/[1-9]/.test(e)}static isDigit(e){return"string"==typeof e&&/[0-9]/.test(e)}static isHexDigit(e){return"string"==typeof e&&/[0-9A-Fa-f]/.test(e)}};var ne={},re={fromCallback:function(e){return Object.defineProperty((function(...t){if("function"!=typeof t[t.length-1])return new Promise(((n,r)=>{e.call(this,...t,((e,t)=>null!=e?r(e):n(t)))}));e.apply(this,t)}),"name",{value:e.name})},fromPromise:function(e){return Object.defineProperty((function(...t){const n=t[t.length-1];if("function"!=typeof n)return e.apply(this,t);e.apply(this,t.slice(0,-1)).then((e=>n(null,e)),n)}),"name",{value:e.name})}},ue=y.default,oe=process.cwd,ie=null,se=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return ie||(ie=oe.call(process)),ie};try{process.cwd()}catch(e){}if("function"==typeof process.chdir){var ce=process.chdir;process.chdir=function(e){ie=null,ce.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,ce)}var ae=function(e){ue.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&function(e){e.lchmod=function(t,n,r){e.open(t,ue.O_WRONLY|ue.O_SYMLINK,n,(function(t,u){t?r&&r(t):e.fchmod(u,n,(function(t){e.close(u,(function(e){r&&r(t||e)}))}))}))},e.lchmodSync=function(t,n){var r,u=e.openSync(t,ue.O_WRONLY|ue.O_SYMLINK,n),o=!0;try{r=e.fchmodSync(u,n),o=!1}finally{if(o)try{e.closeSync(u)}catch(e){}else e.closeSync(u)}return r}}(e);e.lutimes||function(e){ue.hasOwnProperty("O_SYMLINK")&&e.futimes?(e.lutimes=function(t,n,r,u){e.open(t,ue.O_SYMLINK,(function(t,o){t?u&&u(t):e.futimes(o,n,r,(function(t){e.close(o,(function(e){u&&u(t||e)}))}))}))},e.lutimesSync=function(t,n,r){var u,o=e.openSync(t,ue.O_SYMLINK),i=!0;try{u=e.futimesSync(o,n,r),i=!1}finally{if(i)try{e.closeSync(o)}catch(e){}else e.closeSync(o)}return u}):e.futimes&&(e.lutimes=function(e,t,n,r){r&&process.nextTick(r)},e.lutimesSync=function(){})}(e);e.chown=r(e.chown),e.fchown=r(e.fchown),e.lchown=r(e.lchown),e.chmod=t(e.chmod),e.fchmod=t(e.fchmod),e.lchmod=t(e.lchmod),e.chownSync=u(e.chownSync),e.fchownSync=u(e.fchownSync),e.lchownSync=u(e.lchownSync),e.chmodSync=n(e.chmodSync),e.fchmodSync=n(e.fchmodSync),e.lchmodSync=n(e.lchmodSync),e.stat=o(e.stat),e.fstat=o(e.fstat),e.lstat=o(e.lstat),e.statSync=i(e.statSync),e.fstatSync=i(e.fstatSync),e.lstatSync=i(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(e,t,n){n&&process.nextTick(n)},e.lchmodSync=function(){});e.chown&&!e.lchown&&(e.lchown=function(e,t,n,r){r&&process.nextTick(r)},e.lchownSync=function(){});"win32"===se&&(e.rename="function"!=typeof e.rename?e.rename:function(t){function n(n,r,u){var o=Date.now(),i=0;t(n,r,(function s(c){if(c&&("EACCES"===c.code||"EPERM"===c.code||"EBUSY"===c.code)&&Date.now()-o<6e4)return setTimeout((function(){e.stat(r,(function(e,o){e&&"ENOENT"===e.code?t(n,r,s):u(c)}))}),i),void(i<100&&(i+=10));u&&u(c)}))}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n}(e.rename));function t(t){return t?function(n,r,u){return t.call(e,n,r,(function(e){s(e)&&(e=null),u&&u.apply(this,arguments)}))}:t}function n(t){return t?function(n,r){try{return t.call(e,n,r)}catch(e){if(!s(e))throw e}}:t}function r(t){return t?function(n,r,u,o){return t.call(e,n,r,u,(function(e){s(e)&&(e=null),o&&o.apply(this,arguments)}))}:t}function u(t){return t?function(n,r,u){try{return t.call(e,n,r,u)}catch(e){if(!s(e))throw e}}:t}function o(t){return t?function(n,r,u){function o(e,t){t&&(t.uid<0&&(t.uid+=4294967296),t.gid<0&&(t.gid+=4294967296)),u&&u.apply(this,arguments)}return"function"==typeof r&&(u=r,r=null),r?t.call(e,n,r,o):t.call(e,n,o)}:t}function i(t){return t?function(n,r){var u=r?t.call(e,n,r):t.call(e,n);return u&&(u.uid<0&&(u.uid+=4294967296),u.gid<0&&(u.gid+=4294967296)),u}:t}function s(e){return!e||("ENOSYS"===e.code||!(process.getuid&&0===process.getuid()||"EINVAL"!==e.code&&"EPERM"!==e.code))}e.read="function"!=typeof e.read?e.read:function(t){function n(n,r,u,o,i,s){var c;if(s&&"function"==typeof s){var a=0;c=function(l,f,d){if(l&&"EAGAIN"===l.code&&a<10)return a++,t.call(e,n,r,u,o,i,c);s.apply(this,arguments)}}return t.call(e,n,r,u,o,i,c)}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n}(e.read),e.readSync="function"!=typeof e.readSync?e.readSync:(c=e.readSync,function(t,n,r,u,o){for(var i=0;;)try{return c.call(e,t,n,r,u,o)}catch(e){if("EAGAIN"===e.code&&i<10){i++;continue}throw e}});var c};var le=C.default.Stream,fe=function(e){return{ReadStream:function t(n,r){if(!(this instanceof t))return new t(n,r);le.call(this);var u=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,r=r||{};for(var o=Object.keys(r),i=0,s=o.length;ithis.end)throw new Error("start must be <= end");this.pos=this.start}if(null!==this.fd)return void process.nextTick((function(){u._read()}));e.open(this.path,this.flags,this.mode,(function(e,t){if(e)return u.emit("error",e),void(u.readable=!1);u.fd=t,u.emit("open",t),u._read()}))},WriteStream:function t(n,r){if(!(this instanceof t))return new t(n,r);le.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,r=r||{};for(var u=Object.keys(r),o=0,i=u.length;o= zero");this.pos=this.start}this.busy=!1,this._queue=[],null===this.fd&&(this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}};var de=function(e){if(null===e||"object"!=typeof e)return e;if(e instanceof Object)var t={__proto__:De(e)};else t=Object.create(null);return Object.getOwnPropertyNames(e).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})),t},De=Object.getPrototypeOf||function(e){return e.__proto__};var pe,Ee,me=D.default,he=ae,ye=fe,Ce=de,Fe=F.default;function ge(e,t){Object.defineProperty(e,pe,{get:function(){return t}})}"function"==typeof Symbol&&"function"==typeof Symbol.for?(pe=Symbol.for("graceful-fs.queue"),Ee=Symbol.for("graceful-fs.previous")):(pe="___graceful-fs.queue",Ee="___graceful-fs.previous");var Ae=function(){};if(Fe.debuglog?Ae=Fe.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(Ae=function(){var e=Fe.format.apply(Fe,arguments);e="GFS4: "+e.split(/\n/).join("\nGFS4: "),console.error(e)}),!me[pe]){var ve=w[pe]||[];ge(me,ve),me.close=function(e){function t(t,n){return e.call(me,t,(function(e){e||_e(),"function"==typeof n&&n.apply(this,arguments)}))}return Object.defineProperty(t,Ee,{value:e}),t}(me.close),me.closeSync=function(e){function t(t){e.apply(me,arguments),_e()}return Object.defineProperty(t,Ee,{value:e}),t}(me.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",(function(){Ae(me[pe]),g.default.equal(me[pe].length,0)}))}w[pe]||ge(w,me[pe]);var Se,we=Oe(Ce(me));function Oe(e){he(e),e.gracefulify=Oe,e.createReadStream=function(t,n){return new e.ReadStream(t,n)},e.createWriteStream=function(t,n){return new e.WriteStream(t,n)};var t=e.readFile;e.readFile=function(e,n,r){"function"==typeof n&&(r=n,n=null);return function e(n,r,u,o){return t(n,r,(function(t){!t||"EMFILE"!==t.code&&"ENFILE"!==t.code?"function"==typeof u&&u.apply(this,arguments):be([e,[n,r,u],t,o||Date.now(),Date.now()])}))}(e,n,r)};var n=e.writeFile;e.writeFile=function(e,t,r,u){"function"==typeof r&&(u=r,r=null);return function e(t,r,u,o,i){return n(t,r,u,(function(n){!n||"EMFILE"!==n.code&&"ENFILE"!==n.code?"function"==typeof o&&o.apply(this,arguments):be([e,[t,r,u,o],n,i||Date.now(),Date.now()])}))}(e,t,r,u)};var r=e.appendFile;r&&(e.appendFile=function(e,t,n,u){"function"==typeof n&&(u=n,n=null);return function e(t,n,u,o,i){return r(t,n,u,(function(r){!r||"EMFILE"!==r.code&&"ENFILE"!==r.code?"function"==typeof o&&o.apply(this,arguments):be([e,[t,n,u,o],r,i||Date.now(),Date.now()])}))}(e,t,n,u)});var u=e.copyFile;u&&(e.copyFile=function(e,t,n,r){"function"==typeof n&&(r=n,n=0);return function e(t,n,r,o,i){return u(t,n,r,(function(u){!u||"EMFILE"!==u.code&&"ENFILE"!==u.code?"function"==typeof o&&o.apply(this,arguments):be([e,[t,n,r,o],u,i||Date.now(),Date.now()])}))}(e,t,n,r)});var o=e.readdir;e.readdir=function(e,t,n){"function"==typeof t&&(n=t,t=null);var r=i.test(process.version)?function(e,t,n,r){return o(e,u(e,t,n,r))}:function(e,t,n,r){return o(e,t,u(e,t,n,r))};return r(e,t,n);function u(e,t,n,u){return function(o,i){!o||"EMFILE"!==o.code&&"ENFILE"!==o.code?(i&&i.sort&&i.sort(),"function"==typeof n&&n.call(this,o,i)):be([r,[e,t,n],o,u||Date.now(),Date.now()])}}};var i=/^v[0-5]\./;if("v0.8"===process.version.substr(0,4)){var s=ye(e);d=s.ReadStream,D=s.WriteStream}var c=e.ReadStream;c&&(d.prototype=Object.create(c.prototype),d.prototype.open=function(){var e=this;E(e.path,e.flags,e.mode,(function(t,n){t?(e.autoClose&&e.destroy(),e.emit("error",t)):(e.fd=n,e.emit("open",n),e.read())}))});var a=e.WriteStream;a&&(D.prototype=Object.create(a.prototype),D.prototype.open=function(){var e=this;E(e.path,e.flags,e.mode,(function(t,n){t?(e.destroy(),e.emit("error",t)):(e.fd=n,e.emit("open",n))}))}),Object.defineProperty(e,"ReadStream",{get:function(){return d},set:function(e){d=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return D},set:function(e){D=e},enumerable:!0,configurable:!0});var l=d;Object.defineProperty(e,"FileReadStream",{get:function(){return l},set:function(e){l=e},enumerable:!0,configurable:!0});var f=D;function d(e,t){return this instanceof d?(c.apply(this,arguments),this):d.apply(Object.create(d.prototype),arguments)}function D(e,t){return this instanceof D?(a.apply(this,arguments),this):D.apply(Object.create(D.prototype),arguments)}Object.defineProperty(e,"FileWriteStream",{get:function(){return f},set:function(e){f=e},enumerable:!0,configurable:!0});var p=e.open;function E(e,t,n,r){return"function"==typeof n&&(r=n,n=null),function e(t,n,r,u,o){return p(t,n,r,(function(i,s){!i||"EMFILE"!==i.code&&"ENFILE"!==i.code?"function"==typeof u&&u.apply(this,arguments):be([e,[t,n,r,u],i,o||Date.now(),Date.now()])}))}(e,t,n,r)}return e.open=E,e}function be(e){Ae("ENQUEUE",e[0].name,e[1]),me[pe].push(e),Be()}function _e(){for(var e=Date.now(),t=0;t2&&(me[pe][t][3]=e,me[pe][t][4]=e);Be()}function Be(){if(clearTimeout(Se),Se=void 0,0!==me[pe].length){var e=me[pe].shift(),t=e[0],n=e[1],r=e[2],u=e[3],o=e[4];if(void 0===u)Ae("RETRY",t.name,n),t.apply(null,n);else if(Date.now()-u>=6e4){Ae("TIMEOUT",t.name,n);var i=n.pop();"function"==typeof i&&i.call(null,r)}else{var s=Date.now()-o,c=Math.max(o-u,1);s>=Math.min(1.2*c,100)?(Ae("RETRY",t.name,n),t.apply(null,n.concat([u]))):me[pe].push(e)}void 0===Se&&(Se=setTimeout(Be,0))}}process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!me.__patched&&(we=Oe(me),me.__patched=!0),function(e){const t=re.fromCallback,n=we,r=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchmod","lchown","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter((e=>"function"==typeof n[e]));Object.assign(e,n),r.forEach((r=>{e[r]=t(n[r])})),e.realpath.native=t(n.realpath.native),e.exists=function(e,t){return"function"==typeof t?n.exists(e,t):new Promise((t=>n.exists(e,t)))},e.read=function(e,t,r,u,o,i){return"function"==typeof i?n.read(e,t,r,u,o,i):new Promise(((i,s)=>{n.read(e,t,r,u,o,((e,t,n)=>{if(e)return s(e);i({bytesRead:t,buffer:n})}))}))},e.write=function(e,t,...r){return"function"==typeof r[r.length-1]?n.write(e,t,...r):new Promise(((u,o)=>{n.write(e,t,...r,((e,t,n)=>{if(e)return o(e);u({bytesWritten:t,buffer:n})}))}))},"function"==typeof n.writev&&(e.writev=function(e,t,...r){return"function"==typeof r[r.length-1]?n.writev(e,t,...r):new Promise(((u,o)=>{n.writev(e,t,...r,((e,t,n)=>{if(e)return o(e);u({bytesWritten:t,buffers:n})}))}))})}(ne);var Pe={},ke={};const xe=p.default;ke.checkPath=function(e){if("win32"===process.platform){if(/[<>:"|?*]/.test(e.replace(xe.parse(e).root,""))){const t=new Error(`Path contains invalid characters: ${e}`);throw t.code="EINVAL",t}}};const Ne=ne,{checkPath:Ie}=ke,Te=e=>"number"==typeof e?e:{mode:511,...e}.mode;Pe.makeDir=async(e,t)=>(Ie(e),Ne.mkdir(e,{mode:Te(t),recursive:!0})),Pe.makeDirSync=(e,t)=>(Ie(e),Ne.mkdirSync(e,{mode:Te(t),recursive:!0}));const Re=re.fromPromise,{makeDir:Me,makeDirSync:Le}=Pe,je=Re(Me);var $e={mkdirs:je,mkdirsSync:Le,mkdirp:je,mkdirpSync:Le,ensureDir:je,ensureDirSync:Le};const He=re.fromPromise,Je=ne;var Ge={pathExists:He((function(e){return Je.access(e).then((()=>!0)).catch((()=>!1))})),pathExistsSync:Je.existsSync};const Ve=we;var Ue=function(e,t,n,r){Ve.open(e,"r+",((e,u)=>{if(e)return r(e);Ve.futimes(u,t,n,(e=>{Ve.close(u,(t=>{r&&r(e||t)}))}))}))},We=function(e,t,n){const r=Ve.openSync(e,"r+");return Ve.futimesSync(r,t,n),Ve.closeSync(r)};const ze=ne,Ke=p.default,qe=F.default;function Ye(e,t,n){const r=n.dereference?e=>ze.stat(e,{bigint:!0}):e=>ze.lstat(e,{bigint:!0});return Promise.all([r(e),r(t).catch((e=>{if("ENOENT"===e.code)return null;throw e}))]).then((([e,t])=>({srcStat:e,destStat:t})))}function Xe(e,t){return t.ino&&t.dev&&t.ino===e.ino&&t.dev===e.dev}function Ze(e,t){const n=Ke.resolve(e).split(Ke.sep).filter((e=>e)),r=Ke.resolve(t).split(Ke.sep).filter((e=>e));return n.reduce(((e,t,n)=>e&&r[n]===t),!0)}function Qe(e,t,n){return`Cannot ${n} '${e}' to a subdirectory of itself, '${t}'.`}var et={checkPaths:function(e,t,n,r,u){qe.callbackify(Ye)(e,t,r,((r,o)=>{if(r)return u(r);const{srcStat:i,destStat:s}=o;if(s){if(Xe(i,s)){const r=Ke.basename(e),o=Ke.basename(t);return"move"===n&&r!==o&&r.toLowerCase()===o.toLowerCase()?u(null,{srcStat:i,destStat:s,isChangingCase:!0}):u(new Error("Source and destination must not be the same."))}if(i.isDirectory()&&!s.isDirectory())return u(new Error(`Cannot overwrite non-directory '${t}' with directory '${e}'.`));if(!i.isDirectory()&&s.isDirectory())return u(new Error(`Cannot overwrite directory '${t}' with non-directory '${e}'.`))}return i.isDirectory()&&Ze(e,t)?u(new Error(Qe(e,t,n))):u(null,{srcStat:i,destStat:s})}))},checkPathsSync:function(e,t,n,r){const{srcStat:u,destStat:o}=function(e,t,n){let r;const u=n.dereference?e=>ze.statSync(e,{bigint:!0}):e=>ze.lstatSync(e,{bigint:!0}),o=u(e);try{r=u(t)}catch(e){if("ENOENT"===e.code)return{srcStat:o,destStat:null};throw e}return{srcStat:o,destStat:r}}(e,t,r);if(o){if(Xe(u,o)){const r=Ke.basename(e),i=Ke.basename(t);if("move"===n&&r!==i&&r.toLowerCase()===i.toLowerCase())return{srcStat:u,destStat:o,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(u.isDirectory()&&!o.isDirectory())throw new Error(`Cannot overwrite non-directory '${t}' with directory '${e}'.`);if(!u.isDirectory()&&o.isDirectory())throw new Error(`Cannot overwrite directory '${t}' with non-directory '${e}'.`)}if(u.isDirectory()&&Ze(e,t))throw new Error(Qe(e,t,n));return{srcStat:u,destStat:o}},checkParentPaths:function e(t,n,r,u,o){const i=Ke.resolve(Ke.dirname(t)),s=Ke.resolve(Ke.dirname(r));if(s===i||s===Ke.parse(s).root)return o();ze.stat(s,{bigint:!0},((i,c)=>i?"ENOENT"===i.code?o():o(i):Xe(n,c)?o(new Error(Qe(t,r,u))):e(t,n,s,u,o)))},checkParentPathsSync:function e(t,n,r,u){const o=Ke.resolve(Ke.dirname(t)),i=Ke.resolve(Ke.dirname(r));if(i===o||i===Ke.parse(i).root)return;let s;try{s=ze.statSync(i,{bigint:!0})}catch(e){if("ENOENT"===e.code)return;throw e}if(Xe(n,s))throw new Error(Qe(t,r,u));return e(t,n,i,u)},isSrcSubdir:Ze,areIdentical:Xe};const tt=we,nt=p.default,rt=$e.mkdirs,ut=Ge.pathExists,ot=Ue,it=et;function st(e,t,n,r,u){const o=nt.dirname(n);ut(o,((i,s)=>i?u(i):s?at(e,t,n,r,u):void rt(o,(o=>o?u(o):at(e,t,n,r,u)))))}function ct(e,t,n,r,u,o){Promise.resolve(u.filter(n,r)).then((i=>i?e(t,n,r,u,o):o()),(e=>o(e)))}function at(e,t,n,r,u){(r.dereference?tt.stat:tt.lstat)(t,((o,i)=>o?u(o):i.isDirectory()?function(e,t,n,r,u,o){return t?Dt(n,r,u,o):function(e,t,n,r,u){tt.mkdir(n,(o=>{if(o)return u(o);Dt(t,n,r,(t=>t?u(t):dt(n,e,u)))}))}(e.mode,n,r,u,o)}(i,e,t,n,r,u):i.isFile()||i.isCharacterDevice()||i.isBlockDevice()?function(e,t,n,r,u,o){return t?function(e,t,n,r,u){if(!r.overwrite)return r.errorOnExist?u(new Error(`'${n}' already exists`)):u();tt.unlink(n,(o=>o?u(o):lt(e,t,n,r,u)))}(e,n,r,u,o):lt(e,n,r,u,o)}(i,e,t,n,r,u):i.isSymbolicLink()?function(e,t,n,r,u){tt.readlink(t,((t,o)=>t?u(t):(r.dereference&&(o=nt.resolve(process.cwd(),o)),e?void tt.readlink(n,((t,i)=>t?"EINVAL"===t.code||"UNKNOWN"===t.code?tt.symlink(o,n,u):u(t):(r.dereference&&(i=nt.resolve(process.cwd(),i)),it.isSrcSubdir(o,i)?u(new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`)):e.isDirectory()&&it.isSrcSubdir(i,o)?u(new Error(`Cannot overwrite '${i}' with '${o}'.`)):function(e,t,n){tt.unlink(t,(r=>r?n(r):tt.symlink(e,t,n)))}(o,n,u)))):tt.symlink(o,n,u))))}(e,t,n,r,u):i.isSocket()?u(new Error(`Cannot copy a socket file: ${t}`)):i.isFIFO()?u(new Error(`Cannot copy a FIFO pipe: ${t}`)):u(new Error(`Unknown file: ${t}`))))}function lt(e,t,n,r,u){tt.copyFile(t,n,(o=>o?u(o):r.preserveTimestamps?function(e,t,n,r){if(function(e){return 0==(128&e)}(e))return function(e,t,n){return dt(e,128|t,n)}(n,e,(u=>u?r(u):ft(e,t,n,r)));return ft(e,t,n,r)}(e.mode,t,n,u):dt(n,e.mode,u)))}function ft(e,t,n,r){!function(e,t,n){tt.stat(e,((e,r)=>e?n(e):ot(t,r.atime,r.mtime,n)))}(t,n,(t=>t?r(t):dt(n,e,r)))}function dt(e,t,n){return tt.chmod(e,t,n)}function Dt(e,t,n,r){tt.readdir(e,((u,o)=>u?r(u):pt(o,e,t,n,r)))}function pt(e,t,n,r,u){const o=e.pop();return o?function(e,t,n,r,u,o){const i=nt.join(n,t),s=nt.join(r,t);it.checkPaths(i,s,"copy",u,((t,c)=>{if(t)return o(t);const{destStat:a}=c;!function(e,t,n,r,u){r.filter?ct(at,e,t,n,r,u):at(e,t,n,r,u)}(a,i,s,u,(t=>t?o(t):pt(e,n,r,u,o)))}))}(e,o,t,n,r,u):u()}var Et=function(e,t,n,r){"function"!=typeof n||r?"function"==typeof n&&(n={filter:n}):(r=n,n={}),r=r||function(){},(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269"),it.checkPaths(e,t,"copy",n,((u,o)=>{if(u)return r(u);const{srcStat:i,destStat:s}=o;it.checkParentPaths(e,i,t,"copy",(u=>u?r(u):n.filter?ct(st,s,e,t,n,r):st(s,e,t,n,r)))}))};const mt=we,ht=p.default,yt=$e.mkdirsSync,Ct=We,Ft=et;function gt(e,t,n,r){const u=(r.dereference?mt.statSync:mt.lstatSync)(t);if(u.isDirectory())return function(e,t,n,r,u){return t?St(n,r,u):function(e,t,n,r){return mt.mkdirSync(n),St(t,n,r),vt(n,e)}(e.mode,n,r,u)}(u,e,t,n,r);if(u.isFile()||u.isCharacterDevice()||u.isBlockDevice())return function(e,t,n,r,u){return t?function(e,t,n,r){if(r.overwrite)return mt.unlinkSync(n),At(e,t,n,r);if(r.errorOnExist)throw new Error(`'${n}' already exists`)}(e,n,r,u):At(e,n,r,u)}(u,e,t,n,r);if(u.isSymbolicLink())return function(e,t,n,r){let u=mt.readlinkSync(t);r.dereference&&(u=ht.resolve(process.cwd(),u));if(e){let e;try{e=mt.readlinkSync(n)}catch(e){if("EINVAL"===e.code||"UNKNOWN"===e.code)return mt.symlinkSync(u,n);throw e}if(r.dereference&&(e=ht.resolve(process.cwd(),e)),Ft.isSrcSubdir(u,e))throw new Error(`Cannot copy '${u}' to a subdirectory of itself, '${e}'.`);if(mt.statSync(n).isDirectory()&&Ft.isSrcSubdir(e,u))throw new Error(`Cannot overwrite '${e}' with '${u}'.`);return function(e,t){return mt.unlinkSync(t),mt.symlinkSync(e,t)}(u,n)}return mt.symlinkSync(u,n)}(e,t,n,r);if(u.isSocket())throw new Error(`Cannot copy a socket file: ${t}`);if(u.isFIFO())throw new Error(`Cannot copy a FIFO pipe: ${t}`);throw new Error(`Unknown file: ${t}`)}function At(e,t,n,r){return mt.copyFileSync(t,n),r.preserveTimestamps&&function(e,t,n){(function(e){return 0==(128&e)})(e)&&function(e,t){vt(e,128|t)}(n,e);(function(e,t){const n=mt.statSync(e);Ct(t,n.atime,n.mtime)})(t,n)}(e.mode,t,n),vt(n,e.mode)}function vt(e,t){return mt.chmodSync(e,t)}function St(e,t,n){mt.readdirSync(e).forEach((r=>function(e,t,n,r){const u=ht.join(t,e),o=ht.join(n,e),{destStat:i}=Ft.checkPathsSync(u,o,"copy",r);return function(e,t,n,r){if(!r.filter||r.filter(t,n))return gt(e,t,n,r)}(i,u,o,r)}(r,e,t,n)))}var wt=function(e,t,n){"function"==typeof n&&(n={filter:n}),(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269");const{srcStat:r,destStat:u}=Ft.checkPathsSync(e,t,"copy",n);return Ft.checkParentPathsSync(e,r,t,"copy"),function(e,t,n,r){if(r.filter&&!r.filter(t,n))return;const u=ht.dirname(n);mt.existsSync(u)||yt(u);return gt(e,t,n,r)}(u,e,t,n)};var Ot={copy:(0,re.fromCallback)(Et),copySync:wt};const bt=we,_t=p.default,Bt=g.default,Pt="win32"===process.platform;function kt(e){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach((t=>{e[t]=e[t]||bt[t],e[t+="Sync"]=e[t]||bt[t]})),e.maxBusyTries=e.maxBusyTries||3}function xt(e,t,n){let r=0;"function"==typeof t&&(n=t,t={}),Bt(e,"rimraf: missing path"),Bt.strictEqual(typeof e,"string","rimraf: path should be a string"),Bt.strictEqual(typeof n,"function","rimraf: callback function required"),Bt(t,"rimraf: invalid options argument provided"),Bt.strictEqual(typeof t,"object","rimraf: options should be object"),kt(t),Nt(e,t,(function u(o){if(o){if(("EBUSY"===o.code||"ENOTEMPTY"===o.code||"EPERM"===o.code)&&rNt(e,t,u)),100*r)}"ENOENT"===o.code&&(o=null)}n(o)}))}function Nt(e,t,n){Bt(e),Bt(t),Bt("function"==typeof n),t.lstat(e,((r,u)=>r&&"ENOENT"===r.code?n(null):r&&"EPERM"===r.code&&Pt?It(e,t,r,n):u&&u.isDirectory()?Rt(e,t,r,n):void t.unlink(e,(r=>{if(r){if("ENOENT"===r.code)return n(null);if("EPERM"===r.code)return Pt?It(e,t,r,n):Rt(e,t,r,n);if("EISDIR"===r.code)return Rt(e,t,r,n)}return n(r)}))))}function It(e,t,n,r){Bt(e),Bt(t),Bt("function"==typeof r),t.chmod(e,438,(u=>{u?r("ENOENT"===u.code?null:n):t.stat(e,((u,o)=>{u?r("ENOENT"===u.code?null:n):o.isDirectory()?Rt(e,t,n,r):t.unlink(e,r)}))}))}function Tt(e,t,n){let r;Bt(e),Bt(t);try{t.chmodSync(e,438)}catch(e){if("ENOENT"===e.code)return;throw n}try{r=t.statSync(e)}catch(e){if("ENOENT"===e.code)return;throw n}r.isDirectory()?Lt(e,t,n):t.unlinkSync(e)}function Rt(e,t,n,r){Bt(e),Bt(t),Bt("function"==typeof r),t.rmdir(e,(u=>{!u||"ENOTEMPTY"!==u.code&&"EEXIST"!==u.code&&"EPERM"!==u.code?u&&"ENOTDIR"===u.code?r(n):r(u):function(e,t,n){Bt(e),Bt(t),Bt("function"==typeof n),t.readdir(e,((r,u)=>{if(r)return n(r);let o,i=u.length;if(0===i)return t.rmdir(e,n);u.forEach((r=>{xt(_t.join(e,r),t,(r=>{if(!o)return r?n(o=r):void(0==--i&&t.rmdir(e,n))}))}))}))}(e,t,r)}))}function Mt(e,t){let n;kt(t=t||{}),Bt(e,"rimraf: missing path"),Bt.strictEqual(typeof e,"string","rimraf: path should be a string"),Bt(t,"rimraf: missing options"),Bt.strictEqual(typeof t,"object","rimraf: options should be object");try{n=t.lstatSync(e)}catch(n){if("ENOENT"===n.code)return;"EPERM"===n.code&&Pt&&Tt(e,t,n)}try{n&&n.isDirectory()?Lt(e,t,null):t.unlinkSync(e)}catch(n){if("ENOENT"===n.code)return;if("EPERM"===n.code)return Pt?Tt(e,t,n):Lt(e,t,n);if("EISDIR"!==n.code)throw n;Lt(e,t,n)}}function Lt(e,t,n){Bt(e),Bt(t);try{t.rmdirSync(e)}catch(r){if("ENOTDIR"===r.code)throw n;if("ENOTEMPTY"===r.code||"EEXIST"===r.code||"EPERM"===r.code)!function(e,t){if(Bt(e),Bt(t),t.readdirSync(e).forEach((n=>Mt(_t.join(e,n),t))),!Pt){return t.rmdirSync(e,t)}{const n=Date.now();do{try{return t.rmdirSync(e,t)}catch{}}while(Date.now()-n<500)}}(e,t);else if("ENOENT"!==r.code)throw r}}var jt=xt;xt.sync=Mt;const $t=we,Ht=re.fromCallback,Jt=jt;var Gt={remove:Ht((function(e,t){if($t.rm)return $t.rm(e,{recursive:!0,force:!0},t);Jt(e,t)})),removeSync:function(e){if($t.rmSync)return $t.rmSync(e,{recursive:!0,force:!0});Jt.sync(e)}};const Vt=re.fromPromise,Ut=ne,Wt=p.default,zt=$e,Kt=Gt,qt=Vt((async function(e){let t;try{t=await Ut.readdir(e)}catch{return zt.mkdirs(e)}return Promise.all(t.map((t=>Kt.remove(Wt.join(e,t)))))}));function Yt(e){let t;try{t=Ut.readdirSync(e)}catch{return zt.mkdirsSync(e)}t.forEach((t=>{t=Wt.join(e,t),Kt.removeSync(t)}))}var Xt={emptyDirSync:Yt,emptydirSync:Yt,emptyDir:qt,emptydir:qt};const Zt=re.fromCallback,Qt=p.default,en=we,tn=$e;var nn={createFile:Zt((function(e,t){function n(){en.writeFile(e,"",(e=>{if(e)return t(e);t()}))}en.stat(e,((r,u)=>{if(!r&&u.isFile())return t();const o=Qt.dirname(e);en.stat(o,((e,r)=>{if(e)return"ENOENT"===e.code?tn.mkdirs(o,(e=>{if(e)return t(e);n()})):t(e);r.isDirectory()?n():en.readdir(o,(e=>{if(e)return t(e)}))}))}))})),createFileSync:function(e){let t;try{t=en.statSync(e)}catch{}if(t&&t.isFile())return;const n=Qt.dirname(e);try{en.statSync(n).isDirectory()||en.readdirSync(n)}catch(e){if(!e||"ENOENT"!==e.code)throw e;tn.mkdirsSync(n)}en.writeFileSync(e,"")}};const rn=re.fromCallback,un=p.default,on=we,sn=$e,cn=Ge.pathExists,{areIdentical:an}=et;var ln={createLink:rn((function(e,t,n){function r(e,t){on.link(e,t,(e=>{if(e)return n(e);n(null)}))}on.lstat(t,((u,o)=>{on.lstat(e,((u,i)=>{if(u)return u.message=u.message.replace("lstat","ensureLink"),n(u);if(o&&an(i,o))return n(null);const s=un.dirname(t);cn(s,((u,o)=>u?n(u):o?r(e,t):void sn.mkdirs(s,(u=>{if(u)return n(u);r(e,t)}))))}))}))})),createLinkSync:function(e,t){let n;try{n=on.lstatSync(t)}catch{}try{const t=on.lstatSync(e);if(n&&an(t,n))return}catch(e){throw e.message=e.message.replace("lstat","ensureLink"),e}const r=un.dirname(t);return on.existsSync(r)||sn.mkdirsSync(r),on.linkSync(e,t)}};const fn=p.default,dn=we,Dn=Ge.pathExists;var pn={symlinkPaths:function(e,t,n){if(fn.isAbsolute(e))return dn.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:e})));{const r=fn.dirname(t),u=fn.join(r,e);return Dn(u,((t,o)=>t?n(t):o?n(null,{toCwd:u,toDst:e}):dn.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:fn.relative(r,e)})))))}},symlinkPathsSync:function(e,t){let n;if(fn.isAbsolute(e)){if(n=dn.existsSync(e),!n)throw new Error("absolute srcpath does not exist");return{toCwd:e,toDst:e}}{const r=fn.dirname(t),u=fn.join(r,e);if(n=dn.existsSync(u),n)return{toCwd:u,toDst:e};if(n=dn.existsSync(e),!n)throw new Error("relative srcpath does not exist");return{toCwd:e,toDst:fn.relative(r,e)}}}};const En=we;var mn={symlinkType:function(e,t,n){if(n="function"==typeof t?t:n,t="function"!=typeof t&&t)return n(null,t);En.lstat(e,((e,r)=>{if(e)return n(null,"file");t=r&&r.isDirectory()?"dir":"file",n(null,t)}))},symlinkTypeSync:function(e,t){let n;if(t)return t;try{n=En.lstatSync(e)}catch{return"file"}return n&&n.isDirectory()?"dir":"file"}};const hn=re.fromCallback,yn=p.default,Cn=ne,Fn=$e.mkdirs,gn=$e.mkdirsSync,An=pn.symlinkPaths,vn=pn.symlinkPathsSync,Sn=mn.symlinkType,wn=mn.symlinkTypeSync,On=Ge.pathExists,{areIdentical:bn}=et;function _n(e,t,n,r){An(e,t,((u,o)=>{if(u)return r(u);e=o.toDst,Sn(o.toCwd,n,((n,u)=>{if(n)return r(n);const o=yn.dirname(t);On(o,((n,i)=>n?r(n):i?Cn.symlink(e,t,u,r):void Fn(o,(n=>{if(n)return r(n);Cn.symlink(e,t,u,r)}))))}))}))}var Bn={createSymlink:hn((function(e,t,n,r){r="function"==typeof n?n:r,n="function"!=typeof n&&n,Cn.lstat(t,((u,o)=>{!u&&o.isSymbolicLink()?Promise.all([Cn.stat(e),Cn.stat(t)]).then((([u,o])=>{if(bn(u,o))return r(null);_n(e,t,n,r)})):_n(e,t,n,r)}))})),createSymlinkSync:function(e,t,n){let r;try{r=Cn.lstatSync(t)}catch{}if(r&&r.isSymbolicLink()){const n=Cn.statSync(e),r=Cn.statSync(t);if(bn(n,r))return}const u=vn(e,t);e=u.toDst,n=wn(u.toCwd,n);const o=yn.dirname(t);return Cn.existsSync(o)||gn(o),Cn.symlinkSync(e,t,n)}};const{createFile:Pn,createFileSync:kn}=nn,{createLink:xn,createLinkSync:Nn}=ln,{createSymlink:In,createSymlinkSync:Tn}=Bn;var Rn={createFile:Pn,createFileSync:kn,ensureFile:Pn,ensureFileSync:kn,createLink:xn,createLinkSync:Nn,ensureLink:xn,ensureLinkSync:Nn,createSymlink:In,createSymlinkSync:Tn,ensureSymlink:In,ensureSymlinkSync:Tn};var Mn={stringify:function(e,{EOL:t="\n",finalEOL:n=!0,replacer:r=null,spaces:u}={}){const o=n?t:"";return JSON.stringify(e,r,u).replace(/\n/g,t)+o},stripBom:function(e){return Buffer.isBuffer(e)&&(e=e.toString("utf8")),e.replace(/^\uFEFF/,"")}};let Ln;try{Ln=we}catch(e){Ln=D.default}const jn=re,{stringify:$n,stripBom:Hn}=Mn;const Jn=jn.fromPromise((async function(e,t={}){"string"==typeof t&&(t={encoding:t});const n=t.fs||Ln,r=!("throws"in t)||t.throws;let u,o=await jn.fromCallback(n.readFile)(e,t);o=Hn(o);try{u=JSON.parse(o,t?t.reviver:null)}catch(t){if(r)throw t.message=`${e}: ${t.message}`,t;return null}return u}));const Gn=jn.fromPromise((async function(e,t,n={}){const r=n.fs||Ln,u=$n(t,n);await jn.fromCallback(r.writeFile)(e,u,n)}));const Vn={readFile:Jn,readFileSync:function(e,t={}){"string"==typeof t&&(t={encoding:t});const n=t.fs||Ln,r=!("throws"in t)||t.throws;try{let r=n.readFileSync(e,t);return r=Hn(r),JSON.parse(r,t.reviver)}catch(t){if(r)throw t.message=`${e}: ${t.message}`,t;return null}},writeFile:Gn,writeFileSync:function(e,t,n={}){const r=n.fs||Ln,u=$n(t,n);return r.writeFileSync(e,u,n)}};var Un={readJson:Vn.readFile,readJsonSync:Vn.readFileSync,writeJson:Vn.writeFile,writeJsonSync:Vn.writeFileSync};const Wn=re.fromCallback,zn=we,Kn=p.default,qn=$e,Yn=Ge.pathExists;var Xn={outputFile:Wn((function(e,t,n,r){"function"==typeof n&&(r=n,n="utf8");const u=Kn.dirname(e);Yn(u,((o,i)=>o?r(o):i?zn.writeFile(e,t,n,r):void qn.mkdirs(u,(u=>{if(u)return r(u);zn.writeFile(e,t,n,r)}))))})),outputFileSync:function(e,...t){const n=Kn.dirname(e);if(zn.existsSync(n))return zn.writeFileSync(e,...t);qn.mkdirsSync(n),zn.writeFileSync(e,...t)}};const{stringify:Zn}=Mn,{outputFile:Qn}=Xn;var er=async function(e,t,n={}){const r=Zn(t,n);await Qn(e,r,n)};const{stringify:tr}=Mn,{outputFileSync:nr}=Xn;var rr=function(e,t,n){const r=tr(t,n);nr(e,r,n)};const ur=re.fromPromise,or=Un;or.outputJson=ur(er),or.outputJsonSync=rr,or.outputJSON=or.outputJson,or.outputJSONSync=or.outputJsonSync,or.writeJSON=or.writeJson,or.writeJSONSync=or.writeJsonSync,or.readJSON=or.readJson,or.readJSONSync=or.readJsonSync;var ir=or;const sr=we,cr=p.default,ar=Ot.copy,lr=Gt.remove,fr=$e.mkdirp,dr=Ge.pathExists,Dr=et;function pr(e,t,n,r,u){return r?Er(e,t,n,u):n?lr(t,(r=>r?u(r):Er(e,t,n,u))):void dr(t,((r,o)=>r?u(r):o?u(new Error("dest already exists.")):Er(e,t,n,u)))}function Er(e,t,n,r){sr.rename(e,t,(u=>u?"EXDEV"!==u.code?r(u):function(e,t,n,r){const u={overwrite:n,errorOnExist:!0};ar(e,t,u,(t=>t?r(t):lr(e,r)))}(e,t,n,r):r()))}var mr=function(e,t,n,r){"function"==typeof n&&(r=n,n={});const u=n.overwrite||n.clobber||!1;Dr.checkPaths(e,t,"move",n,((n,o)=>{if(n)return r(n);const{srcStat:i,isChangingCase:s=!1}=o;Dr.checkParentPaths(e,i,t,"move",(n=>n?r(n):function(e){const t=cr.dirname(e);return cr.parse(t).root===t}(t)?pr(e,t,u,s,r):void fr(cr.dirname(t),(n=>n?r(n):pr(e,t,u,s,r)))))}))};const hr=we,yr=p.default,Cr=Ot.copySync,Fr=Gt.removeSync,gr=$e.mkdirpSync,Ar=et;function vr(e,t,n){try{hr.renameSync(e,t)}catch(r){if("EXDEV"!==r.code)throw r;return function(e,t,n){const r={overwrite:n,errorOnExist:!0};return Cr(e,t,r),Fr(e)}(e,t,n)}}var Sr=function(e,t,n){const r=(n=n||{}).overwrite||n.clobber||!1,{srcStat:u,isChangingCase:o=!1}=Ar.checkPathsSync(e,t,"move",n);return Ar.checkParentPathsSync(e,u,t,"move"),function(e){const t=yr.dirname(e);return yr.parse(t).root===t}(t)||gr(yr.dirname(t)),function(e,t,n,r){if(r)return vr(e,t,n);if(n)return Fr(t),vr(e,t,n);if(hr.existsSync(t))throw new Error("dest already exists.");return vr(e,t,n)}(e,t,r,o)};var wr,Or,br,_r,Br,Pr={move:(0,re.fromCallback)(mr),moveSync:Sr},kr={...ne,...Ot,...Xt,...Rn,...ir,...$e,...Pr,...Xn,...Ge,...Gt},xr={},Nr={exports:{}},Ir={exports:{}};function Tr(){if(Or)return wr;Or=1;var e=1e3,t=60*e,n=60*t,r=24*n,u=7*r,o=365.25*r;function i(e,t,n,r){var u=t>=1.5*n;return Math.round(e/n)+" "+r+(u?"s":"")}return wr=function(s,c){c=c||{};var a=typeof s;if("string"===a&&s.length>0)return function(i){if((i=String(i)).length>100)return;var s=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(!s)return;var c=parseFloat(s[1]);switch((s[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*o;case"weeks":case"week":case"w":return c*u;case"days":case"day":case"d":return c*r;case"hours":case"hour":case"hrs":case"hr":case"h":return c*n;case"minutes":case"minute":case"mins":case"min":case"m":return c*t;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(s);if("number"===a&&isFinite(s))return c.long?function(u){var o=Math.abs(u);if(o>=r)return i(u,o,r,"day");if(o>=n)return i(u,o,n,"hour");if(o>=t)return i(u,o,t,"minute");if(o>=e)return i(u,o,e,"second");return u+" ms"}(s):function(u){var o=Math.abs(u);if(o>=r)return Math.round(u/r)+"d";if(o>=n)return Math.round(u/n)+"h";if(o>=t)return Math.round(u/t)+"m";if(o>=e)return Math.round(u/e)+"s";return u+"ms"}(s);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(s))}}function Rr(){if(_r)return br;return _r=1,br=function(e){function t(e){let r,u,o,i=null;function s(...e){if(!s.enabled)return;const n=s,u=Number(new Date),o=u-(r||u);n.diff=o,n.prev=r,n.curr=u,r=u,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let i=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((r,u)=>{if("%%"===r)return"%";i++;const o=t.formatters[u];if("function"==typeof o){const t=e[i];r=o.call(n,t),e.splice(i,1),i--}return r})),t.formatArgs.call(n,e);(n.log||t.log).apply(n,e)}return s.namespace=e,s.useColors=t.useColors(),s.color=t.selectColor(e),s.extend=n,s.destroy=t.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==i?i:(u!==t.namespaces&&(u=t.namespaces,o=t.enabled(e)),o),set:e=>{i=e}}),"function"==typeof t.init&&t.init(s),s}function n(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function r(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(r),...t.skips.map(r).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),u=r.length;for(n=0;n{t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t{const n=e.startsWith("-")?"":1===e.length?"-":"--",r=t.indexOf(n+e),u=t.indexOf("--");return-1!==r&&(-1===u||r{}),"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{const e=function(){if($r)return jr;$r=1;const e=E.default,t=A.default,n=Vr(),{env:r}=process;let u;function o(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function i(t,o){if(0===u)return 0;if(n("color=16m")||n("color=full")||n("color=truecolor"))return 3;if(n("color=256"))return 2;if(t&&!o&&void 0===u)return 0;const i=u||0;if("dumb"===r.TERM)return i;if("win32"===process.platform){const t=e.release().split(".");return Number(t[0])>=10&&Number(t[2])>=10586?Number(t[2])>=14931?3:2:1}if("CI"in r)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some((e=>e in r))||"codeship"===r.CI_NAME?1:i;if("TEAMCITY_VERSION"in r)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(r.TEAMCITY_VERSION)?1:0;if("truecolor"===r.COLORTERM)return 3;if("TERM_PROGRAM"in r){const e=parseInt((r.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(r.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(r.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(r.TERM)||"COLORTERM"in r?1:i}return n("no-color")||n("no-colors")||n("color=false")||n("color=never")?u=0:(n("color")||n("colors")||n("color=true")||n("color=always"))&&(u=1),"FORCE_COLOR"in r&&(u="true"===r.FORCE_COLOR?1:"false"===r.FORCE_COLOR?0:0===r.FORCE_COLOR.length?1:Math.min(parseInt(r.FORCE_COLOR,10),3)),jr={supportsColor:function(e){return o(i(e,e&&e.isTTY))},stdout:o(i(!0,t.isatty(1))),stderr:o(i(!0,t.isatty(2)))}}();e&&(e.stderr||e).level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}t.inspectOpts=Object.keys(process.env).filter((e=>/^debug_/i.test(e))).reduce(((e,t)=>{const n=t.substring(6).toLowerCase().replace(/_([a-z])/g,((e,t)=>t.toUpperCase()));let r=process.env[t];return r=!!/^(yes|on|true|enabled)$/i.test(r)||!/^(no|off|false|disabled)$/i.test(r)&&("null"===r?null:Number(r)),e[n]=r,e}),{}),e.exports=Rr()(t);const{formatters:u}=e.exports;u.o=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")},u.O=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts)}}(Gr,Gr.exports)),Gr.exports}Jr=Nr,"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?Jr.exports=(Br||(Br=1,function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,u=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(u=r))})),t.splice(u,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=Rr()(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(Ir,Ir.exports)),Ir.exports):Jr.exports=Ur();var Wr=function(e){return(e=e||{}).circles?function(e){var t=[],n=[];return e.proto?function e(u){if("object"!=typeof u||null===u)return u;if(u instanceof Date)return new Date(u);if(Array.isArray(u))return r(u,e);if(u instanceof Map)return new Map(r(Array.from(u),e));if(u instanceof Set)return new Set(r(Array.from(u),e));var o={};for(var i in t.push(u),n.push(o),u){var s=u[i];if("object"!=typeof s||null===s)o[i]=s;else if(s instanceof Date)o[i]=new Date(s);else if(s instanceof Map)o[i]=new Map(r(Array.from(s),e));else if(s instanceof Set)o[i]=new Set(r(Array.from(s),e));else if(ArrayBuffer.isView(s))o[i]=zr(s);else{var c=t.indexOf(s);o[i]=-1!==c?n[c]:e(s)}}return t.pop(),n.pop(),o}:function e(u){if("object"!=typeof u||null===u)return u;if(u instanceof Date)return new Date(u);if(Array.isArray(u))return r(u,e);if(u instanceof Map)return new Map(r(Array.from(u),e));if(u instanceof Set)return new Set(r(Array.from(u),e));var o={};for(var i in t.push(u),n.push(o),u)if(!1!==Object.hasOwnProperty.call(u,i)){var s=u[i];if("object"!=typeof s||null===s)o[i]=s;else if(s instanceof Date)o[i]=new Date(s);else if(s instanceof Map)o[i]=new Map(r(Array.from(s),e));else if(s instanceof Set)o[i]=new Set(r(Array.from(s),e));else if(ArrayBuffer.isView(s))o[i]=zr(s);else{var c=t.indexOf(s);o[i]=-1!==c?n[c]:e(s)}}return t.pop(),n.pop(),o};function r(e,r){for(var u=Object.keys(e),o=new Array(u.length),i=0;i!e,Qr=e=>e&&"object"==typeof e&&!Array.isArray(e),eu=(e,t,n)=>{(Array.isArray(t)?t:[t]).forEach((t=>{if(t)throw new Error(`Problem with log4js configuration: (${Kr.inspect(e,{depth:5})}) - ${n}`)}))};var tu={configure:e=>{qr("New configuration to be validated: ",e),eu(e,Zr(Qr(e)),"must be an object."),qr(`Calling pre-processing listeners (${Yr.length})`),Yr.forEach((t=>t(e))),qr("Configuration pre-processing finished."),qr(`Calling configuration listeners (${Xr.length})`),Xr.forEach((t=>t(e))),qr("Configuration finished.")},addListener:e=>{Xr.push(e),qr(`Added listener, now ${Xr.length} listeners`)},addPreProcessingListener:e=>{Yr.push(e),qr(`Added pre-processing listener, now ${Yr.length} listeners`)},throwExceptionIf:eu,anObject:Qr,anInteger:e=>e&&"number"==typeof e&&Number.isInteger(e),validIdentifier:e=>/^[A-Za-z][A-Za-z0-9_]*$/g.test(e),not:Zr},nu={exports:{}};!function(e){function t(e,t){for(var n=e.toString();n.length-1?s:c,l=n(u.getHours()),f=n(u.getMinutes()),d=n(u.getSeconds()),D=t(u.getMilliseconds(),3),p=function(e){var t=Math.abs(e),n=String(Math.floor(t/60)),r=String(t%60);return n=("0"+n).slice(-2),r=("0"+r).slice(-2),0===e?"Z":(e<0?"+":"-")+n+":"+r}(u.getTimezoneOffset());return r.replace(/dd/g,o).replace(/MM/g,i).replace(/y{1,4}/g,a).replace(/hh/g,l).replace(/mm/g,f).replace(/ss/g,d).replace(/SSS/g,D).replace(/O/g,p)}function u(e,t,n,r){e["set"+(r?"":"UTC")+t](n)}e.exports=r,e.exports.asString=r,e.exports.parse=function(t,n,r){if(!t)throw new Error("pattern must be supplied");return function(t,n,r){var o=t.indexOf("O")<0,i=!1,s=[{pattern:/y{1,4}/,regexp:"\\d{1,4}",fn:function(e,t){u(e,"FullYear",t,o)}},{pattern:/MM/,regexp:"\\d{1,2}",fn:function(e,t){u(e,"Month",t-1,o),e.getMonth()!==t-1&&(i=!0)}},{pattern:/dd/,regexp:"\\d{1,2}",fn:function(e,t){i&&u(e,"Month",e.getMonth()-1,o),u(e,"Date",t,o)}},{pattern:/hh/,regexp:"\\d{1,2}",fn:function(e,t){u(e,"Hours",t,o)}},{pattern:/mm/,regexp:"\\d\\d",fn:function(e,t){u(e,"Minutes",t,o)}},{pattern:/ss/,regexp:"\\d\\d",fn:function(e,t){u(e,"Seconds",t,o)}},{pattern:/SSS/,regexp:"\\d\\d\\d",fn:function(e,t){u(e,"Milliseconds",t,o)}},{pattern:/O/,regexp:"[+-]\\d{1,2}:?\\d{2}?|Z",fn:function(e,t){t="Z"===t?0:t.replace(":","");var n=Math.abs(t),r=(t>0?-1:1)*(n%100+60*Math.floor(n/100));e.setUTCMinutes(e.getUTCMinutes()+r)}}],c=s.reduce((function(e,t){return t.pattern.test(e.regexp)?(t.index=e.regexp.match(t.pattern).index,e.regexp=e.regexp.replace(t.pattern,"("+t.regexp+")")):t.index=-1,e}),{regexp:t,index:[]}),a=s.filter((function(e){return e.index>-1}));a.sort((function(e,t){return e.index-t.index}));var l=new RegExp(c.regexp).exec(n);if(l){var f=r||e.exports.now();return a.forEach((function(e,t){e.fn(f,l[t+1])})),f}throw new Error("String '"+n+"' could not be parsed as '"+t+"'")}(t,n,r)},e.exports.now=function(){return new Date},e.exports.ISO8601_FORMAT="yyyy-MM-ddThh:mm:ss.SSS",e.exports.ISO8601_WITH_TZ_OFFSET_FORMAT="yyyy-MM-ddThh:mm:ss.SSSO",e.exports.DATETIME_FORMAT="dd MM yyyy hh:mm:ss.SSS",e.exports.ABSOLUTETIME_FORMAT="hh:mm:ss.SSS"}(nu);const ru=nu.exports,uu=E.default,ou=F.default,iu=p.default,su={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[90,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[91,39],yellow:[33,39]};function cu(e){return e?`[${su[e][0]}m`:""}function au(e){return e?`[${su[e][1]}m`:""}function lu(e,t){return n=ou.format("[%s] [%s] %s - ",ru.asString(e.startTime),e.level.toString(),e.categoryName),cu(r=t)+n+au(r);var n,r}function fu(e){return lu(e)+ou.format(...e.data)}function du(e){return lu(e,e.level.colour)+ou.format(...e.data)}function Du(e){return ou.format(...e.data)}function pu(e){return e.data[0]}function Eu(e,t){const n=/%(-?[0-9]+)?(\.?-?[0-9]+)?([[\]cdhmnprzxXyflos%])(\{([^}]+)\})?|([^%]+)/;function r(e){return e&&e.pid?e.pid.toString():process.pid.toString()}e=e||"%r %p %c - %m%n";const u={c:function(e,t){let n=e.categoryName;if(t){const e=parseInt(t,10),r=n.split(".");ee&&(n=r.slice(-e).join(iu.sep))}return n},l:function(e){return e.lineNumber?`${e.lineNumber}`:""},o:function(e){return e.columnNumber?`${e.columnNumber}`:""},s:function(e){return e.callStack||""}};function o(e,t,n){return u[e](t,n)}function i(e,t,n){let r=e;return r=function(e,t){let n;return e?(n=parseInt(e.substr(1),10),n>0?t.slice(0,n):t.slice(n)):t}(t,r),r=function(e,t){let n;if(e)if("-"===e.charAt(0))for(n=parseInt(e.substr(1),10);t.lengthDu,basic:()=>fu,colored:()=>du,coloured:()=>du,pattern:e=>Eu(e&&e.pattern,e&&e.tokens),dummy:()=>pu};var hu={basicLayout:fu,messagePassThroughLayout:Du,patternLayout:Eu,colouredLayout:du,coloredLayout:du,dummyLayout:pu,addLayout(e,t){mu[e]=t},layout:(e,t)=>mu[e]&&mu[e](t)};const yu=tu,Cu=["white","grey","black","blue","cyan","green","magenta","red","yellow"];class Fu{constructor(e,t,n){this.level=e,this.levelStr=t,this.colour=n}toString(){return this.levelStr}static getLevel(e,t){return e?e instanceof Fu?e:(e instanceof Object&&e.levelStr&&(e=e.levelStr),Fu[e.toString().toUpperCase()]||t):t}static addLevels(e){if(e){Object.keys(e).forEach((t=>{const n=t.toUpperCase();Fu[n]=new Fu(e[t].value,n,e[t].colour);const r=Fu.levels.findIndex((e=>e.levelStr===n));r>-1?Fu.levels[r]=Fu[n]:Fu.levels.push(Fu[n])})),Fu.levels.sort(((e,t)=>e.level-t.level))}}isLessThanOrEqualTo(e){return"string"==typeof e&&(e=Fu.getLevel(e)),this.level<=e.level}isGreaterThanOrEqualTo(e){return"string"==typeof e&&(e=Fu.getLevel(e)),this.level>=e.level}isEqualTo(e){return"string"==typeof e&&(e=Fu.getLevel(e)),this.level===e.level}}Fu.levels=[],Fu.addLevels({ALL:{value:Number.MIN_VALUE,colour:"grey"},TRACE:{value:5e3,colour:"blue"},DEBUG:{value:1e4,colour:"cyan"},INFO:{value:2e4,colour:"green"},WARN:{value:3e4,colour:"yellow"},ERROR:{value:4e4,colour:"red"},FATAL:{value:5e4,colour:"magenta"},MARK:{value:9007199254740992,colour:"grey"},OFF:{value:Number.MAX_VALUE,colour:"grey"}}),yu.addListener((e=>{const t=e.levels;if(t){yu.throwExceptionIf(e,yu.not(yu.anObject(t)),"levels must be an object");Object.keys(t).forEach((n=>{yu.throwExceptionIf(e,yu.not(yu.validIdentifier(n)),`level name "${n}" is not a valid identifier (must start with a letter, only contain A-Z,a-z,0-9,_)`),yu.throwExceptionIf(e,yu.not(yu.anObject(t[n])),`level "${n}" must be an object`),yu.throwExceptionIf(e,yu.not(t[n].value),`level "${n}" must have a 'value' property`),yu.throwExceptionIf(e,yu.not(yu.anInteger(t[n].value)),`level "${n}".value must have an integer value`),yu.throwExceptionIf(e,yu.not(t[n].colour),`level "${n}" must have a 'colour' property`),yu.throwExceptionIf(e,yu.not(Cu.indexOf(t[n].colour)>-1),`level "${n}".colour must be one of ${Cu.join(", ")}`)}))}})),yu.addListener((e=>{Fu.addLevels(e.levels)}));var gu=Fu,Au={exports:{}},vu={};/*! (c) 2020 Andrea Giammarchi */ +const{parse:Su,stringify:wu}=JSON,{keys:Ou}=Object,bu=String,_u="string",Bu={},Pu="object",ku=(e,t)=>t,xu=e=>e instanceof bu?bu(e):e,Nu=(e,t)=>typeof t===_u?new bu(t):t,Iu=(e,t,n,r)=>{const u=[];for(let o=Ou(n),{length:i}=o,s=0;s{const r=bu(t.push(n)-1);return e.set(n,r),r},Ru=(e,t)=>{const n=Su(e,Nu).map(xu),r=n[0],u=t||ku,o=typeof r===Pu&&r?Iu(n,new Set,r,u):r;return u.call({"":o},"",o)};vu.parse=Ru;const Mu=(e,t,n)=>{const r=t&&typeof t===Pu?(e,n)=>""===e||-1Su(Mu(e));vu.fromJSON=e=>Ru(wu(e));const Lu=vu,ju=gu;class $u{constructor(e,t,n,r,u){this.startTime=new Date,this.categoryName=e,this.data=n,this.level=t,this.context=Object.assign({},r),this.pid=process.pid,u&&(this.functionName=u.functionName,this.fileName=u.fileName,this.lineNumber=u.lineNumber,this.columnNumber=u.columnNumber,this.callStack=u.callStack)}serialise(){const e=this.data.map((e=>(e&&e.message&&e.stack&&(e=Object.assign({message:e.message,stack:e.stack},e)),e)));return this.data=e,Lu.stringify(this)}static deserialise(e){let t;try{const n=Lu.parse(e);n.data=n.data.map((e=>{if(e&&e.message&&e.stack){const t=new Error(e);Object.keys(e).forEach((n=>{t[n]=e[n]})),e=t}return e})),t=new $u(n.categoryName,ju.getLevel(n.level.levelStr),n.data,n.context),t.startTime=new Date(n.startTime),t.pid=n.pid,t.cluster=n.cluster}catch(n){t=new $u("log4js",ju.ERROR,["Unable to parse log:",e,"because: ",n])}return t}}var Hu=$u;const Ju=Nr.exports("log4js:clustering"),Gu=Hu,Vu=tu;let Uu=!1,Wu=null;try{Wu=require("cluster")}catch(e){Ju("cluster module not present"),Uu=!0}const zu=[];let Ku=!1,qu="NODE_APP_INSTANCE";const Yu=()=>Ku&&"0"===process.env[qu],Xu=()=>Uu||Wu.isMaster||Yu(),Zu=e=>{zu.forEach((t=>t(e)))},Qu=(e,t)=>{if(Ju("cluster message received from worker ",e,": ",t),e.topic&&e.data&&(t=e,e=void 0),t&&t.topic&&"log4js:message"===t.topic){Ju("received message: ",t.data);const e=Gu.deserialise(t.data);Zu(e)}};Uu||Vu.addListener((e=>{zu.length=0,({pm2:Ku,disableClustering:Uu,pm2InstanceVar:qu="NODE_APP_INSTANCE"}=e),Ju(`clustering disabled ? ${Uu}`),Ju(`cluster.isMaster ? ${Wu&&Wu.isMaster}`),Ju(`pm2 enabled ? ${Ku}`),Ju(`pm2InstanceVar = ${qu}`),Ju(`process.env[${qu}] = ${process.env[qu]}`),Ku&&process.removeListener("message",Qu),Wu&&Wu.removeListener&&Wu.removeListener("message",Qu),Uu||e.disableClustering?Ju("Not listening for cluster messages, because clustering disabled."):Yu()?(Ju("listening for PM2 broadcast messages"),process.on("message",Qu)):Wu.isMaster?(Ju("listening for cluster messages"),Wu.on("message",Qu)):Ju("not listening for messages, because we are not a master process")}));var eo={onlyOnMaster:(e,t)=>Xu()?e():t,isMaster:Xu,send:e=>{Xu()?Zu(e):(Ku||(e.cluster={workerId:Wu.worker.id,worker:process.pid}),process.send({topic:"log4js:message",data:e.serialise()}))},onMessage:e=>{zu.push(e)}},to={};function no(e){if("number"==typeof e&&Number.isInteger(e))return e;const t={K:1024,M:1048576,G:1073741824},n=Object.keys(t),r=e.substr(e.length-1).toLocaleUpperCase(),u=e.substring(0,e.length-1).trim();if(n.indexOf(r)<0||!Number.isInteger(Number(u)))throw Error(`maxLogSize: "${e}" is invalid`);return u*t[r]}function ro(e){return function(e,t){const n=Object.assign({},t);return Object.keys(e).forEach((r=>{n[r]&&(n[r]=e[r](t[r]))})),n}({maxLogSize:no},e)}const uo={file:ro,fileSync:ro};to.modifyConfig=e=>uo[e.type]?uo[e.type](e):e;var oo={};const io=console.log.bind(console);oo.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{io(e(n,t))}}(n,e.timezoneOffset)};var so={};so.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{process.stdout.write(`${e(n,t)}\n`)}}(n,e.timezoneOffset)};var co={};co.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{process.stderr.write(`${e(n,t)}\n`)}}(n,e.timezoneOffset)};var ao={};ao.configure=function(e,t,n,r){const u=n(e.appender);return function(e,t,n,r){const u=r.getLevel(e),o=r.getLevel(t,r.FATAL);return e=>{const t=e.level;t.isGreaterThanOrEqualTo(u)&&t.isLessThanOrEqualTo(o)&&n(e)}}(e.level,e.maxLevel,u,r)};var lo={};const fo=Nr.exports("log4js:categoryFilter");lo.configure=function(e,t,n){const r=n(e.appender);return function(e,t){return"string"==typeof e&&(e=[e]),n=>{fo(`Checking ${n.categoryName} against ${e}`),-1===e.indexOf(n.categoryName)&&(fo("Not excluded, sending to appender"),t(n))}}(e.exclude,r)};var Do={};const po=Nr.exports("log4js:noLogFilter");Do.configure=function(e,t,n){const r=n(e.appender);return function(e,t){return n=>{po(`Checking data: ${n.data} against filters: ${e}`),"string"==typeof e&&(e=[e]),e=e.filter((e=>null!=e&&""!==e));const r=new RegExp(e.join("|"),"i");(0===e.length||n.data.findIndex((e=>r.test(e)))<0)&&(po("Not excluded, sending to appender"),t(n))}}(e.exclude,r)};var Eo={},mo={exports:{}},ho={},yo={fromCallback:function(e){return Object.defineProperty((function(){if("function"!=typeof arguments[arguments.length-1])return new Promise(((t,n)=>{arguments[arguments.length]=(e,r)=>{if(e)return n(e);t(r)},arguments.length++,e.apply(this,arguments)}));e.apply(this,arguments)}),"name",{value:e.name})},fromPromise:function(e){return Object.defineProperty((function(){const t=arguments[arguments.length-1];if("function"!=typeof t)return e.apply(this,arguments);e.apply(this,arguments).then((e=>t(null,e)),t)}),"name",{value:e.name})}};!function(e){const t=yo.fromCallback,n=we,r=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchown","lchmod","link","lstat","mkdir","mkdtemp","open","readFile","readdir","readlink","realpath","rename","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter((e=>"function"==typeof n[e]));Object.keys(n).forEach((t=>{"promises"!==t&&(e[t]=n[t])})),r.forEach((r=>{e[r]=t(n[r])})),e.exists=function(e,t){return"function"==typeof t?n.exists(e,t):new Promise((t=>n.exists(e,t)))},e.read=function(e,t,r,u,o,i){return"function"==typeof i?n.read(e,t,r,u,o,i):new Promise(((i,s)=>{n.read(e,t,r,u,o,((e,t,n)=>{if(e)return s(e);i({bytesRead:t,buffer:n})}))}))},e.write=function(e,t,...r){return"function"==typeof r[r.length-1]?n.write(e,t,...r):new Promise(((u,o)=>{n.write(e,t,...r,((e,t,n)=>{if(e)return o(e);u({bytesWritten:t,buffer:n})}))}))},"function"==typeof n.realpath.native&&(e.realpath.native=t(n.realpath.native))}(ho);const Co=p.default;function Fo(e){return(e=Co.normalize(Co.resolve(e)).split(Co.sep)).length>0?e[0]:null}const go=/[<>:"|?*]/;var Ao=function(e){const t=Fo(e);return e=e.replace(t,""),go.test(e)};const vo=we,So=p.default,wo=Ao,Oo=parseInt("0777",8);var bo=function e(t,n,r,u){if("function"==typeof n?(r=n,n={}):n&&"object"==typeof n||(n={mode:n}),"win32"===process.platform&&wo(t)){const e=new Error(t+" contains invalid WIN32 path characters.");return e.code="EINVAL",r(e)}let o=n.mode;const i=n.fs||vo;void 0===o&&(o=Oo&~process.umask()),u||(u=null),r=r||function(){},t=So.resolve(t),i.mkdir(t,o,(o=>{if(!o)return r(null,u=u||t);if("ENOENT"===o.code){if(So.dirname(t)===t)return r(o);e(So.dirname(t),n,((u,o)=>{u?r(u,o):e(t,n,r,o)}))}else i.stat(t,((e,t)=>{e||!t.isDirectory()?r(o,u):r(null,u)}))}))};const _o=we,Bo=p.default,Po=Ao,ko=parseInt("0777",8);var xo=function e(t,n,r){n&&"object"==typeof n||(n={mode:n});let u=n.mode;const o=n.fs||_o;if("win32"===process.platform&&Po(t)){const e=new Error(t+" contains invalid WIN32 path characters.");throw e.code="EINVAL",e}void 0===u&&(u=ko&~process.umask()),r||(r=null),t=Bo.resolve(t);try{o.mkdirSync(t,u),r=r||t}catch(u){if("ENOENT"===u.code){if(Bo.dirname(t)===t)throw u;r=e(Bo.dirname(t),n,r),e(t,n,r)}else{let e;try{e=o.statSync(t)}catch(e){throw u}if(!e.isDirectory())throw u}}return r};const No=(0,yo.fromCallback)(bo);var Io={mkdirs:No,mkdirsSync:xo,mkdirp:No,mkdirpSync:xo,ensureDir:No,ensureDirSync:xo};const To=we;E.default,p.default;var Ro=function(e,t,n,r){To.open(e,"r+",((e,u)=>{if(e)return r(e);To.futimes(u,t,n,(e=>{To.close(u,(t=>{r&&r(e||t)}))}))}))},Mo=function(e,t,n){const r=To.openSync(e,"r+");return To.futimesSync(r,t,n),To.closeSync(r)};const Lo=we,jo=p.default,$o=10,Ho=5,Jo=0,Go=process.versions.node.split("."),Vo=Number.parseInt(Go[0],10),Uo=Number.parseInt(Go[1],10),Wo=Number.parseInt(Go[2],10);function zo(){if(Vo>$o)return!0;if(Vo===$o){if(Uo>Ho)return!0;if(Uo===Ho&&Wo>=Jo)return!0}return!1}function Ko(e,t){const n=jo.resolve(e).split(jo.sep).filter((e=>e)),r=jo.resolve(t).split(jo.sep).filter((e=>e));return n.reduce(((e,t,n)=>e&&r[n]===t),!0)}function qo(e,t,n){return`Cannot ${n} '${e}' to a subdirectory of itself, '${t}'.`}var Yo,Xo,Zo={checkPaths:function(e,t,n,r){!function(e,t,n){zo()?Lo.stat(e,{bigint:!0},((e,r)=>{if(e)return n(e);Lo.stat(t,{bigint:!0},((e,t)=>e?"ENOENT"===e.code?n(null,{srcStat:r,destStat:null}):n(e):n(null,{srcStat:r,destStat:t})))})):Lo.stat(e,((e,r)=>{if(e)return n(e);Lo.stat(t,((e,t)=>e?"ENOENT"===e.code?n(null,{srcStat:r,destStat:null}):n(e):n(null,{srcStat:r,destStat:t})))}))}(e,t,((u,o)=>{if(u)return r(u);const{srcStat:i,destStat:s}=o;return s&&s.ino&&s.dev&&s.ino===i.ino&&s.dev===i.dev?r(new Error("Source and destination must not be the same.")):i.isDirectory()&&Ko(e,t)?r(new Error(qo(e,t,n))):r(null,{srcStat:i,destStat:s})}))},checkPathsSync:function(e,t,n){const{srcStat:r,destStat:u}=function(e,t){let n,r;n=zo()?Lo.statSync(e,{bigint:!0}):Lo.statSync(e);try{r=zo()?Lo.statSync(t,{bigint:!0}):Lo.statSync(t)}catch(e){if("ENOENT"===e.code)return{srcStat:n,destStat:null};throw e}return{srcStat:n,destStat:r}}(e,t);if(u&&u.ino&&u.dev&&u.ino===r.ino&&u.dev===r.dev)throw new Error("Source and destination must not be the same.");if(r.isDirectory()&&Ko(e,t))throw new Error(qo(e,t,n));return{srcStat:r,destStat:u}},checkParentPaths:function e(t,n,r,u,o){const i=jo.resolve(jo.dirname(t)),s=jo.resolve(jo.dirname(r));if(s===i||s===jo.parse(s).root)return o();zo()?Lo.stat(s,{bigint:!0},((i,c)=>i?"ENOENT"===i.code?o():o(i):c.ino&&c.dev&&c.ino===n.ino&&c.dev===n.dev?o(new Error(qo(t,r,u))):e(t,n,s,u,o))):Lo.stat(s,((i,c)=>i?"ENOENT"===i.code?o():o(i):c.ino&&c.dev&&c.ino===n.ino&&c.dev===n.dev?o(new Error(qo(t,r,u))):e(t,n,s,u,o)))},checkParentPathsSync:function e(t,n,r,u){const o=jo.resolve(jo.dirname(t)),i=jo.resolve(jo.dirname(r));if(i===o||i===jo.parse(i).root)return;let s;try{s=zo()?Lo.statSync(i,{bigint:!0}):Lo.statSync(i)}catch(e){if("ENOENT"===e.code)return;throw e}if(s.ino&&s.dev&&s.ino===n.ino&&s.dev===n.dev)throw new Error(qo(t,r,u));return e(t,n,i,u)},isSrcSubdir:Ko};const Qo=we,ei=p.default,ti=Io.mkdirsSync,ni=Mo,ri=Zo;function ui(e,t,n,r){if(!r.filter||r.filter(t,n))return function(e,t,n,r){const u=r.dereference?Qo.statSync:Qo.lstatSync,o=u(t);if(o.isDirectory())return function(e,t,n,r,u){if(!t)return function(e,t,n,r){return Qo.mkdirSync(n),ii(t,n,r),Qo.chmodSync(n,e.mode)}(e,n,r,u);if(t&&!t.isDirectory())throw new Error(`Cannot overwrite non-directory '${r}' with directory '${n}'.`);return ii(n,r,u)}(o,e,t,n,r);if(o.isFile()||o.isCharacterDevice()||o.isBlockDevice())return function(e,t,n,r,u){return t?function(e,t,n,r){if(r.overwrite)return Qo.unlinkSync(n),oi(e,t,n,r);if(r.errorOnExist)throw new Error(`'${n}' already exists`)}(e,n,r,u):oi(e,n,r,u)}(o,e,t,n,r);if(o.isSymbolicLink())return function(e,t,n,r){let u=Qo.readlinkSync(t);r.dereference&&(u=ei.resolve(process.cwd(),u));if(e){let e;try{e=Qo.readlinkSync(n)}catch(e){if("EINVAL"===e.code||"UNKNOWN"===e.code)return Qo.symlinkSync(u,n);throw e}if(r.dereference&&(e=ei.resolve(process.cwd(),e)),ri.isSrcSubdir(u,e))throw new Error(`Cannot copy '${u}' to a subdirectory of itself, '${e}'.`);if(Qo.statSync(n).isDirectory()&&ri.isSrcSubdir(e,u))throw new Error(`Cannot overwrite '${e}' with '${u}'.`);return function(e,t){return Qo.unlinkSync(t),Qo.symlinkSync(e,t)}(u,n)}return Qo.symlinkSync(u,n)}(e,t,n,r)}(e,t,n,r)}function oi(e,t,n,r){return"function"==typeof Qo.copyFileSync?(Qo.copyFileSync(t,n),Qo.chmodSync(n,e.mode),r.preserveTimestamps?ni(n,e.atime,e.mtime):void 0):function(e,t,n,r){const u=65536,o=(Xo?Yo:(Xo=1,Yo=function(e){if("function"==typeof Buffer.allocUnsafe)try{return Buffer.allocUnsafe(e)}catch(t){return new Buffer(e)}return new Buffer(e)}))(u),i=Qo.openSync(t,"r"),s=Qo.openSync(n,"w",e.mode);let c=0;for(;cfunction(e,t,n,r){const u=ei.join(t,e),o=ei.join(n,e),{destStat:i}=ri.checkPathsSync(u,o,"copy");return ui(i,u,o,r)}(r,e,t,n)))}var si=function(e,t,n){"function"==typeof n&&(n={filter:n}),(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269");const{srcStat:r,destStat:u}=ri.checkPathsSync(e,t,"copy");return ri.checkParentPathsSync(e,r,t,"copy"),function(e,t,n,r){if(r.filter&&!r.filter(t,n))return;const u=ei.dirname(n);Qo.existsSync(u)||ti(u);return ui(e,t,n,r)}(u,e,t,n)},ci={copySync:si};const ai=yo.fromPromise,li=ho;var fi={pathExists:ai((function(e){return li.access(e).then((()=>!0)).catch((()=>!1))})),pathExistsSync:li.existsSync};const di=we,Di=p.default,pi=Io.mkdirs,Ei=fi.pathExists,mi=Ro,hi=Zo;function yi(e,t,n,r,u){const o=Di.dirname(n);Ei(o,((i,s)=>i?u(i):s?Fi(e,t,n,r,u):void pi(o,(o=>o?u(o):Fi(e,t,n,r,u)))))}function Ci(e,t,n,r,u,o){Promise.resolve(u.filter(n,r)).then((i=>i?e(t,n,r,u,o):o()),(e=>o(e)))}function Fi(e,t,n,r,u){return r.filter?Ci(gi,e,t,n,r,u):gi(e,t,n,r,u)}function gi(e,t,n,r,u){(r.dereference?di.stat:di.lstat)(t,((o,i)=>o?u(o):i.isDirectory()?function(e,t,n,r,u,o){if(!t)return function(e,t,n,r,u){di.mkdir(n,(o=>{if(o)return u(o);Si(t,n,r,(t=>t?u(t):di.chmod(n,e.mode,u)))}))}(e,n,r,u,o);if(t&&!t.isDirectory())return o(new Error(`Cannot overwrite non-directory '${r}' with directory '${n}'.`));return Si(n,r,u,o)}(i,e,t,n,r,u):i.isFile()||i.isCharacterDevice()||i.isBlockDevice()?function(e,t,n,r,u,o){return t?function(e,t,n,r,u){if(!r.overwrite)return r.errorOnExist?u(new Error(`'${n}' already exists`)):u();di.unlink(n,(o=>o?u(o):Ai(e,t,n,r,u)))}(e,n,r,u,o):Ai(e,n,r,u,o)}(i,e,t,n,r,u):i.isSymbolicLink()?function(e,t,n,r,u){di.readlink(t,((t,o)=>t?u(t):(r.dereference&&(o=Di.resolve(process.cwd(),o)),e?void di.readlink(n,((t,i)=>t?"EINVAL"===t.code||"UNKNOWN"===t.code?di.symlink(o,n,u):u(t):(r.dereference&&(i=Di.resolve(process.cwd(),i)),hi.isSrcSubdir(o,i)?u(new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`)):e.isDirectory()&&hi.isSrcSubdir(i,o)?u(new Error(`Cannot overwrite '${i}' with '${o}'.`)):function(e,t,n){di.unlink(t,(r=>r?n(r):di.symlink(e,t,n)))}(o,n,u)))):di.symlink(o,n,u))))}(e,t,n,r,u):void 0))}function Ai(e,t,n,r,u){return"function"==typeof di.copyFile?di.copyFile(t,n,(t=>t?u(t):vi(e,n,r,u))):function(e,t,n,r,u){const o=di.createReadStream(t);o.on("error",(e=>u(e))).once("open",(()=>{const t=di.createWriteStream(n,{mode:e.mode});t.on("error",(e=>u(e))).on("open",(()=>o.pipe(t))).once("close",(()=>vi(e,n,r,u)))}))}(e,t,n,r,u)}function vi(e,t,n,r){di.chmod(t,e.mode,(u=>u?r(u):n.preserveTimestamps?mi(t,e.atime,e.mtime,r):r()))}function Si(e,t,n,r){di.readdir(e,((u,o)=>u?r(u):wi(o,e,t,n,r)))}function wi(e,t,n,r,u){const o=e.pop();return o?function(e,t,n,r,u,o){const i=Di.join(n,t),s=Di.join(r,t);hi.checkPaths(i,s,"copy",((t,c)=>{if(t)return o(t);const{destStat:a}=c;Fi(a,i,s,u,(t=>t?o(t):wi(e,n,r,u,o)))}))}(e,o,t,n,r,u):u()}var Oi=function(e,t,n,r){"function"!=typeof n||r?"function"==typeof n&&(n={filter:n}):(r=n,n={}),r=r||function(){},(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269"),hi.checkPaths(e,t,"copy",((u,o)=>{if(u)return r(u);const{srcStat:i,destStat:s}=o;hi.checkParentPaths(e,i,t,"copy",(u=>u?r(u):n.filter?Ci(yi,s,e,t,n,r):yi(s,e,t,n,r)))}))};var bi={copy:(0,yo.fromCallback)(Oi)};const _i=we,Bi=p.default,Pi=g.default,ki="win32"===process.platform;function xi(e){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach((t=>{e[t]=e[t]||_i[t],e[t+="Sync"]=e[t]||_i[t]})),e.maxBusyTries=e.maxBusyTries||3}function Ni(e,t,n){let r=0;"function"==typeof t&&(n=t,t={}),Pi(e,"rimraf: missing path"),Pi.strictEqual(typeof e,"string","rimraf: path should be a string"),Pi.strictEqual(typeof n,"function","rimraf: callback function required"),Pi(t,"rimraf: invalid options argument provided"),Pi.strictEqual(typeof t,"object","rimraf: options should be object"),xi(t),Ii(e,t,(function u(o){if(o){if(("EBUSY"===o.code||"ENOTEMPTY"===o.code||"EPERM"===o.code)&&rIi(e,t,u)),100*r)}"ENOENT"===o.code&&(o=null)}n(o)}))}function Ii(e,t,n){Pi(e),Pi(t),Pi("function"==typeof n),t.lstat(e,((r,u)=>r&&"ENOENT"===r.code?n(null):r&&"EPERM"===r.code&&ki?Ti(e,t,r,n):u&&u.isDirectory()?Mi(e,t,r,n):void t.unlink(e,(r=>{if(r){if("ENOENT"===r.code)return n(null);if("EPERM"===r.code)return ki?Ti(e,t,r,n):Mi(e,t,r,n);if("EISDIR"===r.code)return Mi(e,t,r,n)}return n(r)}))))}function Ti(e,t,n,r){Pi(e),Pi(t),Pi("function"==typeof r),n&&Pi(n instanceof Error),t.chmod(e,438,(u=>{u?r("ENOENT"===u.code?null:n):t.stat(e,((u,o)=>{u?r("ENOENT"===u.code?null:n):o.isDirectory()?Mi(e,t,n,r):t.unlink(e,r)}))}))}function Ri(e,t,n){let r;Pi(e),Pi(t),n&&Pi(n instanceof Error);try{t.chmodSync(e,438)}catch(e){if("ENOENT"===e.code)return;throw n}try{r=t.statSync(e)}catch(e){if("ENOENT"===e.code)return;throw n}r.isDirectory()?ji(e,t,n):t.unlinkSync(e)}function Mi(e,t,n,r){Pi(e),Pi(t),n&&Pi(n instanceof Error),Pi("function"==typeof r),t.rmdir(e,(u=>{!u||"ENOTEMPTY"!==u.code&&"EEXIST"!==u.code&&"EPERM"!==u.code?u&&"ENOTDIR"===u.code?r(n):r(u):function(e,t,n){Pi(e),Pi(t),Pi("function"==typeof n),t.readdir(e,((r,u)=>{if(r)return n(r);let o,i=u.length;if(0===i)return t.rmdir(e,n);u.forEach((r=>{Ni(Bi.join(e,r),t,(r=>{if(!o)return r?n(o=r):void(0==--i&&t.rmdir(e,n))}))}))}))}(e,t,r)}))}function Li(e,t){let n;xi(t=t||{}),Pi(e,"rimraf: missing path"),Pi.strictEqual(typeof e,"string","rimraf: path should be a string"),Pi(t,"rimraf: missing options"),Pi.strictEqual(typeof t,"object","rimraf: options should be object");try{n=t.lstatSync(e)}catch(n){if("ENOENT"===n.code)return;"EPERM"===n.code&&ki&&Ri(e,t,n)}try{n&&n.isDirectory()?ji(e,t,null):t.unlinkSync(e)}catch(n){if("ENOENT"===n.code)return;if("EPERM"===n.code)return ki?Ri(e,t,n):ji(e,t,n);if("EISDIR"!==n.code)throw n;ji(e,t,n)}}function ji(e,t,n){Pi(e),Pi(t),n&&Pi(n instanceof Error);try{t.rmdirSync(e)}catch(r){if("ENOTDIR"===r.code)throw n;if("ENOTEMPTY"===r.code||"EEXIST"===r.code||"EPERM"===r.code)!function(e,t){if(Pi(e),Pi(t),t.readdirSync(e).forEach((n=>Li(Bi.join(e,n),t))),!ki){return t.rmdirSync(e,t)}{const n=Date.now();do{try{return t.rmdirSync(e,t)}catch(e){}}while(Date.now()-n<500)}}(e,t);else if("ENOENT"!==r.code)throw r}}var $i=Ni;Ni.sync=Li;const Hi=$i;var Ji={remove:(0,yo.fromCallback)(Hi),removeSync:Hi.sync};const Gi=yo.fromCallback,Vi=we,Ui=p.default,Wi=Io,zi=Ji,Ki=Gi((function(e,t){t=t||function(){},Vi.readdir(e,((n,r)=>{if(n)return Wi.mkdirs(e,t);r=r.map((t=>Ui.join(e,t))),function e(){const n=r.pop();if(!n)return t();zi.remove(n,(n=>{if(n)return t(n);e()}))}()}))}));function qi(e){let t;try{t=Vi.readdirSync(e)}catch(t){return Wi.mkdirsSync(e)}t.forEach((t=>{t=Ui.join(e,t),zi.removeSync(t)}))}var Yi={emptyDirSync:qi,emptydirSync:qi,emptyDir:Ki,emptydir:Ki};const Xi=yo.fromCallback,Zi=p.default,Qi=we,es=Io,ts=fi.pathExists;var ns={createFile:Xi((function(e,t){function n(){Qi.writeFile(e,"",(e=>{if(e)return t(e);t()}))}Qi.stat(e,((r,u)=>{if(!r&&u.isFile())return t();const o=Zi.dirname(e);ts(o,((e,r)=>e?t(e):r?n():void es.mkdirs(o,(e=>{if(e)return t(e);n()}))))}))})),createFileSync:function(e){let t;try{t=Qi.statSync(e)}catch(e){}if(t&&t.isFile())return;const n=Zi.dirname(e);Qi.existsSync(n)||es.mkdirsSync(n),Qi.writeFileSync(e,"")}};const rs=yo.fromCallback,us=p.default,os=we,is=Io,ss=fi.pathExists;var cs={createLink:rs((function(e,t,n){function r(e,t){os.link(e,t,(e=>{if(e)return n(e);n(null)}))}ss(t,((u,o)=>u?n(u):o?n(null):void os.lstat(e,(u=>{if(u)return u.message=u.message.replace("lstat","ensureLink"),n(u);const o=us.dirname(t);ss(o,((u,i)=>u?n(u):i?r(e,t):void is.mkdirs(o,(u=>{if(u)return n(u);r(e,t)}))))}))))})),createLinkSync:function(e,t){if(os.existsSync(t))return;try{os.lstatSync(e)}catch(e){throw e.message=e.message.replace("lstat","ensureLink"),e}const n=us.dirname(t);return os.existsSync(n)||is.mkdirsSync(n),os.linkSync(e,t)}};const as=p.default,ls=we,fs=fi.pathExists;var ds={symlinkPaths:function(e,t,n){if(as.isAbsolute(e))return ls.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:e})));{const r=as.dirname(t),u=as.join(r,e);return fs(u,((t,o)=>t?n(t):o?n(null,{toCwd:u,toDst:e}):ls.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:as.relative(r,e)})))))}},symlinkPathsSync:function(e,t){let n;if(as.isAbsolute(e)){if(n=ls.existsSync(e),!n)throw new Error("absolute srcpath does not exist");return{toCwd:e,toDst:e}}{const r=as.dirname(t),u=as.join(r,e);if(n=ls.existsSync(u),n)return{toCwd:u,toDst:e};if(n=ls.existsSync(e),!n)throw new Error("relative srcpath does not exist");return{toCwd:e,toDst:as.relative(r,e)}}}};const Ds=we;var ps={symlinkType:function(e,t,n){if(n="function"==typeof t?t:n,t="function"!=typeof t&&t)return n(null,t);Ds.lstat(e,((e,r)=>{if(e)return n(null,"file");t=r&&r.isDirectory()?"dir":"file",n(null,t)}))},symlinkTypeSync:function(e,t){let n;if(t)return t;try{n=Ds.lstatSync(e)}catch(e){return"file"}return n&&n.isDirectory()?"dir":"file"}};const Es=yo.fromCallback,ms=p.default,hs=we,ys=Io.mkdirs,Cs=Io.mkdirsSync,Fs=ds.symlinkPaths,gs=ds.symlinkPathsSync,As=ps.symlinkType,vs=ps.symlinkTypeSync,Ss=fi.pathExists;var ws={createSymlink:Es((function(e,t,n,r){r="function"==typeof n?n:r,n="function"!=typeof n&&n,Ss(t,((u,o)=>u?r(u):o?r(null):void Fs(e,t,((u,o)=>{if(u)return r(u);e=o.toDst,As(o.toCwd,n,((n,u)=>{if(n)return r(n);const o=ms.dirname(t);Ss(o,((n,i)=>n?r(n):i?hs.symlink(e,t,u,r):void ys(o,(n=>{if(n)return r(n);hs.symlink(e,t,u,r)}))))}))}))))})),createSymlinkSync:function(e,t,n){if(hs.existsSync(t))return;const r=gs(e,t);e=r.toDst,n=vs(r.toCwd,n);const u=ms.dirname(t);return hs.existsSync(u)||Cs(u),hs.symlinkSync(e,t,n)}};var Os,bs={createFile:ns.createFile,createFileSync:ns.createFileSync,ensureFile:ns.createFile,ensureFileSync:ns.createFileSync,createLink:cs.createLink,createLinkSync:cs.createLinkSync,ensureLink:cs.createLink,ensureLinkSync:cs.createLinkSync,createSymlink:ws.createSymlink,createSymlinkSync:ws.createSymlinkSync,ensureSymlink:ws.createSymlink,ensureSymlinkSync:ws.createSymlinkSync};try{Os=we}catch(e){Os=D.default}function _s(e,t){var n,r="\n";return"object"==typeof t&&null!==t&&(t.spaces&&(n=t.spaces),t.EOL&&(r=t.EOL)),JSON.stringify(e,t?t.replacer:null,n).replace(/\n/g,r)+r}function Bs(e){return Buffer.isBuffer(e)&&(e=e.toString("utf8")),e=e.replace(/^\uFEFF/,"")}var Ps={readFile:function(e,t,n){null==n&&(n=t,t={}),"string"==typeof t&&(t={encoding:t});var r=(t=t||{}).fs||Os,u=!0;"throws"in t&&(u=t.throws),r.readFile(e,t,(function(r,o){if(r)return n(r);var i;o=Bs(o);try{i=JSON.parse(o,t?t.reviver:null)}catch(t){return u?(t.message=e+": "+t.message,n(t)):n(null,null)}n(null,i)}))},readFileSync:function(e,t){"string"==typeof(t=t||{})&&(t={encoding:t});var n=t.fs||Os,r=!0;"throws"in t&&(r=t.throws);try{var u=n.readFileSync(e,t);return u=Bs(u),JSON.parse(u,t.reviver)}catch(t){if(r)throw t.message=e+": "+t.message,t;return null}},writeFile:function(e,t,n,r){null==r&&(r=n,n={});var u=(n=n||{}).fs||Os,o="";try{o=_s(t,n)}catch(e){return void(r&&r(e,null))}u.writeFile(e,o,n,r)},writeFileSync:function(e,t,n){var r=(n=n||{}).fs||Os,u=_s(t,n);return r.writeFileSync(e,u,n)}},ks=Ps;const xs=yo.fromCallback,Ns=ks;var Is={readJson:xs(Ns.readFile),readJsonSync:Ns.readFileSync,writeJson:xs(Ns.writeFile),writeJsonSync:Ns.writeFileSync};const Ts=p.default,Rs=Io,Ms=fi.pathExists,Ls=Is;var js=function(e,t,n,r){"function"==typeof n&&(r=n,n={});const u=Ts.dirname(e);Ms(u,((o,i)=>o?r(o):i?Ls.writeJson(e,t,n,r):void Rs.mkdirs(u,(u=>{if(u)return r(u);Ls.writeJson(e,t,n,r)}))))};const $s=we,Hs=p.default,Js=Io,Gs=Is;var Vs=function(e,t,n){const r=Hs.dirname(e);$s.existsSync(r)||Js.mkdirsSync(r),Gs.writeJsonSync(e,t,n)};const Us=yo.fromCallback,Ws=Is;Ws.outputJson=Us(js),Ws.outputJsonSync=Vs,Ws.outputJSON=Ws.outputJson,Ws.outputJSONSync=Ws.outputJsonSync,Ws.writeJSON=Ws.writeJson,Ws.writeJSONSync=Ws.writeJsonSync,Ws.readJSON=Ws.readJson,Ws.readJSONSync=Ws.readJsonSync;var zs=Ws;const Ks=we,qs=p.default,Ys=ci.copySync,Xs=Ji.removeSync,Zs=Io.mkdirpSync,Qs=Zo;function ec(e,t,n){try{Ks.renameSync(e,t)}catch(r){if("EXDEV"!==r.code)throw r;return function(e,t,n){const r={overwrite:n,errorOnExist:!0};return Ys(e,t,r),Xs(e)}(e,t,n)}}var tc=function(e,t,n){const r=(n=n||{}).overwrite||n.clobber||!1,{srcStat:u}=Qs.checkPathsSync(e,t,"move");return Qs.checkParentPathsSync(e,u,t,"move"),Zs(qs.dirname(t)),function(e,t,n){if(n)return Xs(t),ec(e,t,n);if(Ks.existsSync(t))throw new Error("dest already exists.");return ec(e,t,n)}(e,t,r)},nc={moveSync:tc};const rc=we,uc=p.default,oc=bi.copy,ic=Ji.remove,sc=Io.mkdirp,cc=fi.pathExists,ac=Zo;function lc(e,t,n,r){rc.rename(e,t,(u=>u?"EXDEV"!==u.code?r(u):function(e,t,n,r){const u={overwrite:n,errorOnExist:!0};oc(e,t,u,(t=>t?r(t):ic(e,r)))}(e,t,n,r):r()))}var fc=function(e,t,n,r){"function"==typeof n&&(r=n,n={});const u=n.overwrite||n.clobber||!1;ac.checkPaths(e,t,"move",((n,o)=>{if(n)return r(n);const{srcStat:i}=o;ac.checkParentPaths(e,i,t,"move",(n=>{if(n)return r(n);sc(uc.dirname(t),(n=>n?r(n):function(e,t,n,r){if(n)return ic(t,(u=>u?r(u):lc(e,t,n,r)));cc(t,((u,o)=>u?r(u):o?r(new Error("dest already exists.")):lc(e,t,n,r)))}(e,t,u,r)))}))}))};var dc={move:(0,yo.fromCallback)(fc)};const Dc=yo.fromCallback,pc=we,Ec=p.default,mc=Io,hc=fi.pathExists;var yc={outputFile:Dc((function(e,t,n,r){"function"==typeof n&&(r=n,n="utf8");const u=Ec.dirname(e);hc(u,((o,i)=>o?r(o):i?pc.writeFile(e,t,n,r):void mc.mkdirs(u,(u=>{if(u)return r(u);pc.writeFile(e,t,n,r)}))))})),outputFileSync:function(e,...t){const n=Ec.dirname(e);if(pc.existsSync(n))return pc.writeFileSync(e,...t);mc.mkdirsSync(n),pc.writeFileSync(e,...t)}};!function(e){e.exports=Object.assign({},ho,ci,bi,Yi,bs,zs,Io,nc,dc,yc,fi,Ji);const t=D.default;Object.getOwnPropertyDescriptor(t,"promises")&&Object.defineProperty(e.exports,"promises",{get:()=>t.promises})}(mo);const Cc=Nr.exports("streamroller:fileNameFormatter"),Fc=p.default;const gc=Nr.exports("streamroller:fileNameParser"),Ac=nu.exports;const vc=Nr.exports("streamroller:moveAndMaybeCompressFile"),Sc=mo.exports,wc=v.default;var Oc=async(e,t,n)=>{if(n=function(e){const t={mode:parseInt("0600",8),compress:!1},n=Object.assign({},t,e);return vc(`_parseOption: moveAndMaybeCompressFile called with option=${JSON.stringify(n)}`),n}(n),e!==t){if(await Sc.pathExists(e))if(vc(`moveAndMaybeCompressFile: moving file from ${e} to ${t} ${n.compress?"with":"without"} compress`),n.compress)await new Promise(((r,u)=>{let o=!1;const i=Sc.createWriteStream(t,{mode:n.mode,flags:"wx"}).on("open",(()=>{o=!0;const t=Sc.createReadStream(e).on("open",(()=>{t.pipe(wc.createGzip()).pipe(i)})).on("error",(t=>{vc(`moveAndMaybeCompressFile: error reading ${e}`,t),i.destroy(t)}))})).on("finish",(()=>{vc(`moveAndMaybeCompressFile: finished compressing ${t}, deleting ${e}`),Sc.unlink(e).then(r).catch((t=>{vc(`moveAndMaybeCompressFile: error deleting ${e}, truncating instead`,t),Sc.truncate(e).then(r).catch((t=>{vc(`moveAndMaybeCompressFile: error truncating ${e}`,t),u(t)}))}))})).on("error",(e=>{o?(vc(`moveAndMaybeCompressFile: error writing ${t}, deleting`,e),Sc.unlink(t).then((()=>{u(e)})).catch((e=>{vc(`moveAndMaybeCompressFile: error deleting ${t}`,e),u(e)}))):(vc(`moveAndMaybeCompressFile: error creating ${t}`,e),u(e))}))})).catch((()=>{}));else{vc(`moveAndMaybeCompressFile: renaming ${e} to ${t}`);try{await Sc.move(e,t,{overwrite:!0})}catch(n){if(vc(`moveAndMaybeCompressFile: error renaming ${e} to ${t}`,n),"ENOENT"!==n.code){vc("moveAndMaybeCompressFile: trying copy+truncate instead");try{await Sc.copy(e,t,{overwrite:!0}),await Sc.truncate(e)}catch(e){vc("moveAndMaybeCompressFile: error copy+truncate",e)}}}}}else vc("moveAndMaybeCompressFile: source and target are the same, not doing anything")};const bc=Nr.exports("streamroller:RollingFileWriteStream"),_c=mo.exports,Bc=p.default,Pc=E.default,kc=()=>new Date,xc=nu.exports,{Writable:Nc}=C.default,Ic=({file:e,keepFileExt:t,needsIndex:n,alwaysIncludeDate:r,compress:u,fileNameSep:o})=>{let i=o||".";const s=Fc.join(e.dir,e.name),c=t=>t+e.ext,a=(e,t,r)=>!n&&r||!t?e:e+i+t,l=(e,t,n)=>(t>0||r)&&n?e+i+n:e,f=(e,t)=>t&&u?e+".gz":e,d=t?[l,a,c,f]:[c,l,a,f];return({date:e,index:t})=>(Cc(`_formatFileName: date=${e}, index=${t}`),d.reduce(((n,r)=>r(n,t,e)),s))},Tc=({file:e,keepFileExt:t,pattern:n,fileNameSep:r})=>{let u=r||".";const o="__NOT_MATCHING__";let i=[(e,t)=>e.endsWith(".gz")?(gc("it is gzipped"),t.isCompressed=!0,e.slice(0,-1*".gz".length)):e,t?t=>t.startsWith(e.name)&&t.endsWith(e.ext)?(gc("it starts and ends with the right things"),t.slice(e.name.length+1,-1*e.ext.length)):o:t=>t.startsWith(e.base)?(gc("it starts with the right things"),t.slice(e.base.length+1)):o,n?(e,t)=>{const r=e.split(u);let o=r[r.length-1];gc("items: ",r,", indexStr: ",o);let i=e;void 0!==o&&o.match(/^\d+$/)?(i=e.slice(0,-1*(o.length+1)),gc(`dateStr is ${i}`),n&&!i&&(i=o,o="0")):o="0";try{const r=Ac.parse(n,i,new Date(0,0));return Ac.asString(n,r)!==i?e:(t.index=parseInt(o,10),t.date=i,t.timestamp=r.getTime(),"")}catch(t){return gc(`Problem parsing ${i} as ${n}, error was: `,t),e}}:(e,t)=>e.match(/^\d+$/)?(gc("it has an index"),t.index=parseInt(e,10),""):e];return e=>{let t={filename:e,index:0,isCompressed:!1};return i.reduce(((e,n)=>n(e,t)),e)?null:t}},Rc=Oc;var Mc=class extends Nc{constructor(e,t){if(bc(`constructor: creating RollingFileWriteStream. path=${e}`),"string"!=typeof e||0===e.length)throw new Error(`Invalid filename: ${e}`);if(e.endsWith(Bc.sep))throw new Error(`Filename is a directory: ${e}`);0===e.indexOf(`~${Bc.sep}`)&&(e=e.replace("~",Pc.homedir())),super(t),this.options=this._parseOption(t),this.fileObject=Bc.parse(e),""===this.fileObject.dir&&(this.fileObject=Bc.parse(Bc.join(process.cwd(),e))),this.fileFormatter=Ic({file:this.fileObject,alwaysIncludeDate:this.options.alwaysIncludePattern,needsIndex:this.options.maxSize 0`)}else delete n.maxSize;if(n.numBackups||0===n.numBackups){if(n.numBackups<0)throw new Error(`options.numBackups (${n.numBackups}) should be >= 0`);if(n.numBackups>=Number.MAX_SAFE_INTEGER)throw new Error(`options.numBackups (${n.numBackups}) should be < Number.MAX_SAFE_INTEGER`);n.numToKeep=n.numBackups+1}else if(n.numToKeep<=0)throw new Error(`options.numToKeep (${n.numToKeep}) should be > 0`);return bc(`_parseOption: creating stream with option=${JSON.stringify(n)}`),n}_final(e){this.currentFileStream.end("",this.options.encoding,e)}_write(e,t,n){this._shouldRoll().then((()=>{bc(`_write: writing chunk. file=${this.currentFileStream.path} state=${JSON.stringify(this.state)} chunk=${e}`),this.currentFileStream.write(e,t,(t=>{this.state.currentSize+=e.length,n(t)}))}))}async _shouldRoll(){(this._dateChanged()||this._tooBig())&&(bc(`_shouldRoll: rolling because dateChanged? ${this._dateChanged()} or tooBig? ${this._tooBig()}`),await this._roll())}_dateChanged(){return this.state.currentDate&&this.state.currentDate!==xc(this.options.pattern,kc())}_tooBig(){return this.state.currentSize>=this.options.maxSize}_roll(){return bc("_roll: closing the current stream"),new Promise(((e,t)=>{this.currentFileStream.end("",this.options.encoding,(()=>{this._moveOldFiles().then(e).catch(t)}))}))}async _moveOldFiles(){const e=await this._getExistingFiles();for(let t=(this.state.currentDate?e.filter((e=>e.date===this.state.currentDate)):e).length;t>=0;t--){bc(`_moveOldFiles: i = ${t}`);const e=this.fileFormatter({date:this.state.currentDate,index:t}),n=this.fileFormatter({date:this.state.currentDate,index:t+1}),r={compress:this.options.compress&&0===t,mode:this.options.mode};await Rc(e,n,r)}this.state.currentSize=0,this.state.currentDate=this.state.currentDate?xc(this.options.pattern,kc()):null,bc(`_moveOldFiles: finished rolling files. state=${JSON.stringify(this.state)}`),this._renewWriteStream(),await new Promise(((e,t)=>{this.currentFileStream.write("","utf8",(()=>{this._clean().then(e).catch(t)}))}))}async _getExistingFiles(){const e=await _c.readdir(this.fileObject.dir).catch((()=>[]));bc(`_getExistingFiles: files=${e}`);const t=e.map((e=>this.fileNameParser(e))).filter((e=>e)),n=e=>(e.timestamp?e.timestamp:kc().getTime())-e.index;return t.sort(((e,t)=>n(e)-n(t))),t}_renewWriteStream(){const e=this.fileFormatter({date:this.state.currentDate,index:0}),t=e=>{try{return _c.mkdirSync(e,{recursive:!0})}catch(n){if("ENOENT"===n.code)return t(Bc.dirname(e)),t(e);if("EEXIST"!==n.code&&"EROFS"!==n.code)throw n;try{if(_c.statSync(e).isDirectory())return e;throw n}catch(e){throw n}}};t(this.fileObject.dir);const n={flags:this.options.flags,encoding:this.options.encoding,mode:this.options.mode};var r,u;_c.appendFileSync(e,"",(r={...n},u="flags",r["flag"]=r[u],delete r[u],r)),this.currentFileStream=_c.createWriteStream(e,n),this.currentFileStream.on("error",(e=>{this.emit("error",e)}))}async _clean(){const e=await this._getExistingFiles();if(bc(`_clean: numToKeep = ${this.options.numToKeep}, existingFiles = ${e.length}`),bc("_clean: existing files are: ",e),this._tooManyFiles(e.length)){const n=e.slice(0,e.length-this.options.numToKeep).map((e=>Bc.format({dir:this.fileObject.dir,base:e.filename})));await(t=n,bc(`deleteFiles: files to delete: ${t}`),Promise.all(t.map((e=>_c.unlink(e).catch((t=>{bc(`deleteFiles: error when unlinking ${e}, ignoring. Error was ${t}`)}))))))}var t}_tooManyFiles(e){return this.options.numToKeep>0&&e>this.options.numToKeep}};const Lc=Mc;var jc=class extends Lc{constructor(e,t,n,r){r||(r={}),t&&(r.maxSize=t),r.numBackups||0===r.numBackups||(n||0===n||(n=1),r.numBackups=n),super(e,r),this.backups=r.numBackups,this.size=this.options.maxSize}get theStream(){return this.currentFileStream}};const $c=Mc;var Hc={RollingFileWriteStream:Mc,RollingFileStream:jc,DateRollingFileStream:class extends $c{constructor(e,t,n){t&&"object"==typeof t&&(n=t,t=null),n||(n={}),t||(t="yyyy-MM-dd"),n.pattern=t,n.numBackups||0===n.numBackups?n.daysToKeep=n.numBackups:(n.daysToKeep||0===n.daysToKeep?process.emitWarning("options.daysToKeep is deprecated due to the confusion it causes when used together with file size rolling. Please use options.numBackups instead.","DeprecationWarning","streamroller-DEP0001"):n.daysToKeep=1,n.numBackups=n.daysToKeep),super(e,n),this.mode=this.options.mode}get theStream(){return this.currentFileStream}}};const Jc=Nr.exports("log4js:file"),Gc=p.default,Vc=Hc,Uc=E.default.EOL;let Wc=!1;const zc=new Set;function Kc(){zc.forEach((e=>{e.sighupHandler()}))}function qc(e,t,n,r){const u=new Vc.RollingFileStream(e,t,n,r);return u.on("error",(t=>{console.error("log4js.fileAppender - Writing to file %s, error happened ",e,t)})),u.on("drain",(()=>{process.emit("log4js:pause",!1)})),u}Eo.configure=function(e,t){let n=t.basicLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),e.mode=e.mode||384,function(e,t,n,r,u,o){e=Gc.normalize(e),Jc("Creating file appender (",e,", ",n,", ",r=r||0===r?r:5,", ",u,", ",o,")");let i=qc(e,n,r,u);const s=function(e){if(i.writable){if(!0===u.removeColor){const t=/\x1b[[0-9;]*m/g;e.data=e.data.map((e=>"string"==typeof e?e.replace(t,""):e))}i.write(t(e,o)+Uc,"utf8")||process.emit("log4js:pause",!0)}};return s.reopen=function(){i.end((()=>{i=qc(e,n,r,u)}))},s.sighupHandler=function(){Jc("SIGHUP handler called."),s.reopen()},s.shutdown=function(e){zc.delete(s),0===zc.size&&Wc&&(process.removeListener("SIGHUP",Kc),Wc=!1),i.end("","utf-8",e)},zc.add(s),Wc||(process.on("SIGHUP",Kc),Wc=!0),s}(e.filename,n,e.maxLogSize,e.backups,e,e.timezoneOffset)};var Yc={};const Xc=Hc,Zc=E.default.EOL;function Qc(e,t,n,r,u){r.maxSize=r.maxLogSize;const o=function(e,t,n){const r=new Xc.DateRollingFileStream(e,t,n);return r.on("error",(t=>{console.error("log4js.dateFileAppender - Writing to file %s, error happened ",e,t)})),r.on("drain",(()=>{process.emit("log4js:pause",!1)})),r}(e,t,r),i=function(e){o.writable&&(o.write(n(e,u)+Zc,"utf8")||process.emit("log4js:pause",!0))};return i.shutdown=function(e){o.end("","utf-8",e)},i}Yc.configure=function(e,t){let n=t.basicLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),e.alwaysIncludePattern||(e.alwaysIncludePattern=!1),e.mode=e.mode||384,Qc(e.filename,e.pattern,n,e,e.timezoneOffset)};var ea={};const ta=Nr.exports("log4js:fileSync"),na=p.default,ra=D.default,ua=E.default.EOL||"\n";function oa(e,t){if(ra.existsSync(e))return;const n=ra.openSync(e,t.flags,t.mode);ra.closeSync(n)}class ia{constructor(e,t,n,r){ta("In RollingFileStream"),function(){if(!e||!t||t<=0)throw new Error("You must specify a filename and file size")}(),this.filename=e,this.size=t,this.backups=n,this.options=r,this.currentSize=0,this.currentSize=function(e){let t=0;try{t=ra.statSync(e).size}catch(t){oa(e,r)}return t}(this.filename)}shouldRoll(){return ta("should roll with current size %d, and max size %d",this.currentSize,this.size),this.currentSize>=this.size}roll(e){const t=this,n=new RegExp(`^${na.basename(e)}`);function r(e){return n.test(e)}function u(t){return parseInt(t.substring(`${na.basename(e)}.`.length),10)||0}function o(e,t){return u(e)>u(t)?1:u(e) ${e}.${r+1}`),ra.renameSync(na.join(na.dirname(e),n),`${e}.${r+1}`)}}ta("Rolling, rolling, rolling"),ta("Renaming the old files"),ra.readdirSync(na.dirname(e)).filter(r).sort(o).reverse().forEach(i)}write(e,t){const n=this;ta("in write"),this.shouldRoll()&&(this.currentSize=0,this.roll(this.filename)),ta("writing the chunk to the file"),n.currentSize+=e.length,ra.appendFileSync(n.filename,e)}}ea.configure=function(e,t){let n=t.basicLayout;e.layout&&(n=t.layout(e.layout.type,e.layout));const r={flags:e.flags||"a",encoding:e.encoding||"utf8",mode:e.mode||384};return function(e,t,n,r,u,o){ta("fileSync appender created");const i=function(e,t,n){let r;var u;return t?r=new ia(e,t,n,o):(oa(u=e,o),r={write(e){ra.appendFileSync(u,e)}}),r}(e=na.normalize(e),n,r=r||0===r?r:5);return e=>{i.write(t(e,u)+ua)}}(e.filename,n,e.maxLogSize,e.backups,e.timezoneOffset,r)};var sa={};const ca=Nr.exports("log4js:tcp"),aa=S.default;sa.configure=function(e,t){ca(`configure with config = ${e}`);let n=function(e){return e.serialise()};return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){let n=!1;const r=[];let u,o=3,i="__LOG4JS__";function s(e){ca("Writing log event to socket"),n=u.write(`${t(e)}${i}`,"utf8")}function c(){let e;for(ca("emptying buffer");e=r.shift();)s(e)}function a(e){n?s(e):(ca("buffering log event because it cannot write at the moment"),r.push(e))}return function t(){ca(`appender creating socket to ${e.host||"localhost"}:${e.port||5e3}`),i=`${e.endMsg||"__LOG4JS__"}`,u=aa.createConnection(e.port||5e3,e.host||"localhost"),u.on("connect",(()=>{ca("socket connected"),c(),n=!0})),u.on("drain",(()=>{ca("drain event received, emptying buffer"),n=!0,c()})),u.on("timeout",u.end.bind(u)),u.on("error",(e=>{ca("connection error",e),n=!1,c()})),u.on("close",t)}(),a.shutdown=function(e){ca("shutdown called"),r.length&&o?(ca("buffer has items, waiting 100ms to empty"),o-=1,setTimeout((()=>{a.shutdown(e)}),100)):(u.removeAllListeners("close"),u.end(e))},a}(e,n)};const la=p.default,fa=Nr.exports("log4js:appenders"),da=tu,Da=eo,pa=gu,Ea=hu,ma=to,ha=new Map;ha.set("console",oo),ha.set("stdout",so),ha.set("stderr",co),ha.set("logLevelFilter",ao),ha.set("categoryFilter",lo),ha.set("noLogFilter",Do),ha.set("file",Eo),ha.set("dateFile",Yc),ha.set("fileSync",ea),ha.set("tcp",sa);const ya=new Map,Ca=(e,t)=>{fa("Loading module from ",e);try{return require(e)}catch(n){return void da.throwExceptionIf(t,"MODULE_NOT_FOUND"!==n.code,`appender "${e}" could not be loaded (error was: ${n})`)}},Fa=new Set,ga=(e,t)=>{if(ya.has(e))return ya.get(e);if(!t.appenders[e])return!1;if(Fa.has(e))throw new Error(`Dependency loop detected for appender ${e}.`);Fa.add(e),fa(`Creating appender ${e}`);const n=Aa(e,t);return Fa.delete(e),ya.set(e,n),n},Aa=(e,t)=>{const n=t.appenders[e],r=n.type.configure?n.type:((e,t)=>ha.get(e)||Ca(`./${e}`,t)||Ca(e,t)||require.main&&Ca(la.join(la.dirname(require.main.filename),e),t)||Ca(la.join(process.cwd(),e),t))(n.type,t);return da.throwExceptionIf(t,da.not(r),`appender "${e}" is not valid (type "${n.type}" could not be found)`),r.appender&&fa(`DEPRECATION: Appender ${n.type} exports an appender function.`),r.shutdown&&fa(`DEPRECATION: Appender ${n.type} exports a shutdown function.`),fa(`${e}: clustering.isMaster ? ${Da.isMaster()}`),fa(`${e}: appenderModule is ${F.default.inspect(r)}`),Da.onlyOnMaster((()=>(fa(`calling appenderModule.configure for ${e} / ${n.type}`),r.configure(ma.modifyConfig(n),Ea,(e=>ga(e,t)),pa))),(()=>{}))},va=e=>{ya.clear(),Fa.clear();const t=[];Object.values(e.categories).forEach((e=>{t.push(...e.appenders)})),Object.keys(e.appenders).forEach((n=>{(t.includes(n)||"tcp-server"===e.appenders[n].type)&&ga(n,e)}))},Sa=()=>{va({appenders:{out:{type:"stdout"}},categories:{default:{appenders:["out"],level:"trace"}}})};Sa(),da.addListener((e=>{da.throwExceptionIf(e,da.not(da.anObject(e.appenders)),'must have a property "appenders" of type object.');const t=Object.keys(e.appenders);da.throwExceptionIf(e,da.not(t.length),"must define at least one appender."),t.forEach((t=>{da.throwExceptionIf(e,da.not(e.appenders[t].type),`appender "${t}" is not valid (must be an object with property "type")`)}))})),da.addListener(va),Au.exports=ya,Au.exports.init=Sa;var wa={exports:{}};!function(e){const t=Nr.exports("log4js:categories"),n=tu,r=gu,u=Au.exports,o=new Map;function i(e,t,n){if(!1===t.inherit)return;const r=n.lastIndexOf(".");if(r<0)return;const u=n.substring(0,r);let o=e.categories[u];o||(o={inherit:!0,appenders:[]}),i(e,o,u),!e.categories[u]&&o.appenders&&o.appenders.length&&o.level&&(e.categories[u]=o),t.appenders=t.appenders||[],t.level=t.level||o.level,o.appenders.forEach((e=>{t.appenders.includes(e)||t.appenders.push(e)})),t.parent=o}function s(e){if(!e.categories)return;Object.keys(e.categories).forEach((t=>{const n=e.categories[t];i(e,n,t)}))}n.addPreProcessingListener((e=>s(e))),n.addListener((e=>{n.throwExceptionIf(e,n.not(n.anObject(e.categories)),'must have a property "categories" of type object.');const t=Object.keys(e.categories);n.throwExceptionIf(e,n.not(t.length),"must define at least one category."),t.forEach((t=>{const o=e.categories[t];n.throwExceptionIf(e,[n.not(o.appenders),n.not(o.level)],`category "${t}" is not valid (must be an object with properties "appenders" and "level")`),n.throwExceptionIf(e,n.not(Array.isArray(o.appenders)),`category "${t}" is not valid (appenders must be an array of appender names)`),n.throwExceptionIf(e,n.not(o.appenders.length),`category "${t}" is not valid (appenders must contain at least one appender name)`),Object.prototype.hasOwnProperty.call(o,"enableCallStack")&&n.throwExceptionIf(e,"boolean"!=typeof o.enableCallStack,`category "${t}" is not valid (enableCallStack must be boolean type)`),o.appenders.forEach((r=>{n.throwExceptionIf(e,n.not(u.get(r)),`category "${t}" is not valid (appender "${r}" is not defined)`)})),n.throwExceptionIf(e,n.not(r.getLevel(o.level)),`category "${t}" is not valid (level "${o.level}" not recognised; valid levels are ${r.levels.join(", ")})`)})),n.throwExceptionIf(e,n.not(e.categories.default),'must define a "default" category.')}));const c=e=>{o.clear();Object.keys(e.categories).forEach((n=>{const i=e.categories[n],s=[];i.appenders.forEach((e=>{s.push(u.get(e)),t(`Creating category ${n}`),o.set(n,{appenders:s,level:r.getLevel(i.level),enableCallStack:i.enableCallStack||!1})}))}))},a=()=>{c({categories:{default:{appenders:["out"],level:"OFF"}}})};a(),n.addListener(c);const l=e=>(t(`configForCategory: searching for config for ${e}`),o.has(e)?(t(`configForCategory: ${e} exists in config, returning it`),o.get(e)):e.indexOf(".")>0?(t(`configForCategory: ${e} has hierarchy, searching for parents`),l(e.substring(0,e.lastIndexOf(".")))):(t("configForCategory: returning config for default category"),l("default")));e.exports=o,e.exports=Object.assign(e.exports,{appendersForCategory:e=>l(e).appenders,getLevelForCategory:e=>l(e).level,setLevelForCategory:(e,n)=>{let r=o.get(e);if(t(`setLevelForCategory: found ${r} for ${e}`),!r){const n=l(e);t(`setLevelForCategory: no config found for category, found ${n} for parents of ${e}`),r={appenders:n.appenders}}r.level=n,o.set(e,r)},getEnableCallStackForCategory:e=>!0===l(e).enableCallStack,setEnableCallStackForCategory:(e,t)=>{l(e).enableCallStack=t},init:a})}(wa);const Oa=Nr.exports("log4js:logger"),ba=Hu,_a=gu,Ba=eo,Pa=wa.exports,ka=tu,xa=/at (?:(.+)\s+\()?(?:(.+?):(\d+)(?::(\d+))?|([^)]+))\)?/;function Na(e,t=4){const n=e.stack.split("\n").slice(t),r=xa.exec(n[0]);return r&&6===r.length?{functionName:r[1],fileName:r[2],lineNumber:parseInt(r[3],10),columnNumber:parseInt(r[4],10),callStack:n.join("\n")}:null}class Ia{constructor(e){if(!e)throw new Error("No category provided.");this.category=e,this.context={},this.parseCallStack=Na,Oa(`Logger created (${this.category}, ${this.level})`)}get level(){return _a.getLevel(Pa.getLevelForCategory(this.category),_a.TRACE)}set level(e){Pa.setLevelForCategory(this.category,_a.getLevel(e,this.level))}get useCallStack(){return Pa.getEnableCallStackForCategory(this.category)}set useCallStack(e){Pa.setEnableCallStackForCategory(this.category,!0===e)}log(e,...t){let n=_a.getLevel(e);n||(this._log(_a.WARN,"log4js:logger.log: invalid value for log-level as first parameter given: ",e),n=_a.INFO),this.isLevelEnabled(n)&&this._log(n,t)}isLevelEnabled(e){return this.level.isLessThanOrEqualTo(e)}_log(e,t){Oa(`sending log data (${e}) to appenders`);const n=new ba(this.category,e,t,this.context,this.useCallStack&&this.parseCallStack(new Error));Ba.send(n)}addContext(e,t){this.context[e]=t}removeContext(e){delete this.context[e]}clearContext(){this.context={}}setParseCallStackFunction(e){this.parseCallStack=e}}function Ta(e){const t=_a.getLevel(e),n=t.toString().toLowerCase().replace(/_([a-z])/g,(e=>e[1].toUpperCase())),r=n[0].toUpperCase()+n.slice(1);Ia.prototype[`is${r}Enabled`]=function(){return this.isLevelEnabled(t)},Ia.prototype[n]=function(...e){this.log(t,...e)}}_a.levels.forEach(Ta),ka.addListener((()=>{_a.levels.forEach(Ta)}));var Ra=Ia;const Ma=gu;function La(e){return e.originalUrl||e.url}function ja(e,t){for(let n=0;ne.source?e.source:e));t=new RegExp(n.join("|"))}return t}(t.nolog);return(e,i,s)=>{if(e._logging)return s();if(o&&o.test(e.originalUrl))return s();if(n.isLevelEnabled(r)||"auto"===t.level){const o=new Date,{writeHead:s}=i;e._logging=!0,i.writeHead=(e,t)=>{i.writeHead=s,i.writeHead(e,t),i.__statusCode=e,i.__headers=t||{}},i.on("finish",(()=>{i.responseTime=new Date-o,i.statusCode&&"auto"===t.level&&(r=Ma.INFO,i.statusCode>=300&&(r=Ma.WARN),i.statusCode>=400&&(r=Ma.ERROR)),r=function(e,t,n){let r=t;if(n){const t=n.find((t=>{let n=!1;return n=t.from&&t.to?e>=t.from&&e<=t.to:-1!==t.codes.indexOf(e),n}));t&&(r=Ma.getLevel(t.level,r))}return r}(i.statusCode,r,t.statusRules);const s=function(e,t,n){const r=[];return r.push({token:":url",replacement:La(e)}),r.push({token:":protocol",replacement:e.protocol}),r.push({token:":hostname",replacement:e.hostname}),r.push({token:":method",replacement:e.method}),r.push({token:":status",replacement:t.__statusCode||t.statusCode}),r.push({token:":response-time",replacement:t.responseTime}),r.push({token:":date",replacement:(new Date).toUTCString()}),r.push({token:":referrer",replacement:e.headers.referer||e.headers.referrer||""}),r.push({token:":http-version",replacement:`${e.httpVersionMajor}.${e.httpVersionMinor}`}),r.push({token:":remote-addr",replacement:e.headers["x-forwarded-for"]||e.ip||e._remoteAddress||e.socket&&(e.socket.remoteAddress||e.socket.socket&&e.socket.socket.remoteAddress)}),r.push({token:":user-agent",replacement:e.headers["user-agent"]}),r.push({token:":content-length",replacement:t.getHeader("content-length")||t.__headers&&t.__headers["Content-Length"]||"-"}),r.push({token:/:req\[([^\]]+)]/g,replacement:(t,n)=>e.headers[n.toLowerCase()]}),r.push({token:/:res\[([^\]]+)]/g,replacement:(e,n)=>t.getHeader(n.toLowerCase())||t.__headers&&t.__headers[n]}),(e=>{const t=e.concat();for(let e=0;eja(e,s)));t&&n.log(r,t)}else n.log(r,ja(u,s));t.context&&n.removeContext("res")}))}return s()}},nl=Va;let rl=!1;function ul(e){if(!rl)return;Ua("Received log event ",e);Za.appendersForCategory(e.categoryName).forEach((t=>{t(e)}))}function ol(e){rl&&il();let t=e;return"string"==typeof t&&(t=function(e){Ua(`Loading configuration from ${e}`);try{return JSON.parse(Wa.readFileSync(e,"utf8"))}catch(t){throw new Error(`Problem reading config from file "${e}". Error was ${t.message}`,t)}}(e)),Ua(`Configuration is ${t}`),Ka.configure(za(t)),el.onMessage(ul),rl=!0,sl}function il(e){Ua("Shutdown called. Disabling all log writing."),rl=!1;const t=Array.from(Xa.values());Xa.init(),Za.init();const n=t.reduceRight(((e,t)=>t.shutdown?e+1:e),0);if(0===n)return Ua("No appenders with shutdown functions found."),void 0!==e&&e();let r,u=0;function o(t){r=r||t,u+=1,Ua(`Appender shutdowns complete: ${u} / ${n}`),u>=n&&(Ua("All shutdown functions completed."),e&&e(r))}return Ua(`Found ${n} appenders with shutdown functions.`),t.filter((e=>e.shutdown)).forEach((e=>e.shutdown(o))),null}const sl={getLogger:function(e){return rl||ol(process.env.LOG4JS_CONFIG||{appenders:{out:{type:"stdout"}},categories:{default:{appenders:["out"],level:"OFF"}}}),new Qa(e||"default")},configure:ol,shutdown:il,connectLogger:tl,levels:Ya,addLayout:qa.addLayout,recording:function(){return nl}};var cl=sl,al={};Object.defineProperty(al,"__esModule",{value:!0}),al.levelMap=al.getLevel=al.setCategoriesLevel=al.getConfiguration=al.setConfiguration=void 0;const ll=cl;let fl={appenders:{debug:{type:"stdout",layout:{type:"pattern",pattern:"[%d] > hvigor %p %c %[%m%]"}},info:{type:"stdout",layout:{type:"pattern",pattern:"[%d] > hvigor %[%m%]"}},"no-pattern-info":{type:"stdout",layout:{type:"pattern",pattern:"%m"}},wrong:{type:"stderr",layout:{type:"pattern",pattern:"[%d] > hvigor %[%p: %m%]"}},"just-debug":{type:"logLevelFilter",appender:"debug",level:"debug",maxLevel:"debug"},"just-info":{type:"logLevelFilter",appender:"info",level:"info",maxLevel:"info"},"just-wrong":{type:"logLevelFilter",appender:"wrong",level:"warn",maxLevel:"error"}},categories:{default:{appenders:["just-debug","just-info","just-wrong"],level:"debug"},"no-pattern-info":{appenders:["no-pattern-info"],level:"info"}}};al.setConfiguration=e=>{fl=e};al.getConfiguration=()=>fl;let dl=ll.levels.DEBUG;al.setCategoriesLevel=(e,t)=>{dl=e;const n=fl.categories;for(const r in n)(null==t?void 0:t.includes(r))||Object.prototype.hasOwnProperty.call(n,r)&&(n[r].level=e.levelStr)};al.getLevel=()=>dl,al.levelMap=new Map([["ALL",ll.levels.ALL],["MARK",ll.levels.MARK],["TRACE",ll.levels.TRACE],["DEBUG",ll.levels.DEBUG],["INFO",ll.levels.INFO],["WARN",ll.levels.WARN],["ERROR",ll.levels.ERROR],["FATAL",ll.levels.FATAL],["OFF",ll.levels.OFF]]);var Dl=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),pl=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),El=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&Dl(t,e,n);return pl(t,e),t};Object.defineProperty(xr,"__esModule",{value:!0}),xr.evaluateLogLevel=xr.HvigorLogger=void 0;const ml=El(cl),hl=cl,yl=El(F.default),Cl=al;class Fl{constructor(e){ml.configure((0,Cl.getConfiguration)()),this._logger=ml.getLogger(e),this._logger.level=(0,Cl.getLevel)()}static getLogger(e){return new Fl(e)}log(e,...t){this._logger.log(e,...t)}debug(e,...t){this._logger.debug(e,...t)}info(e,...t){this._logger.info(e,...t)}warn(e,...t){void 0!==e&&""!==e&&this._logger.warn(e,...t)}error(e,...t){this._logger.error(e,...t)}_printTaskExecuteInfo(e,t){this.info(`Finished :${e}... after ${t}`)}_printFailedTaskInfo(e){this.error(`Failed :${e}... `)}_printDisabledTaskInfo(e){this.info(`Disabled :${e}... `)}_printUpToDateTaskInfo(e){this.info(`UP-TO-DATE :${e}... `)}errorMessageExit(e,...t){throw new Error(yl.format(e,...t))}errorExit(e,t,...n){t&&this._logger.error(t,n),this._logger.error(e.stack)}setLevel(e,t){(0,Cl.setCategoriesLevel)(e,t),ml.shutdown(),ml.configure((0,Cl.getConfiguration)())}getLevel(){return this._logger.level}configure(e){const t=(0,Cl.getConfiguration)(),n={appenders:{...t.appenders,...e.appenders},categories:{...t.categories,...e.categories}};(0,Cl.setConfiguration)(n),ml.shutdown(),ml.configure(n)}}xr.HvigorLogger=Fl,xr.evaluateLogLevel=function(e,t){t.debug?e.setLevel(hl.levels.DEBUG):t.warn?e.setLevel(hl.levels.WARN):t.error?e.setLevel(hl.levels.ERROR):e.setLevel(hl.levels.INFO)};var gl=w&&w.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(X,"__esModule",{value:!0}),X.parseJsonText=X.parseJsonFile=void 0;const Al=Z,vl=gl(kr),Sl=gl(p.default),wl=gl(E.default),Ol=xr.HvigorLogger.getLogger("parse-json-util");var bl;!function(e){e[e.Char=0]="Char",e[e.EOF=1]="EOF",e[e.Identifier=2]="Identifier"}(bl||(bl={}));let _l,Bl,Pl,kl,xl,Nl,Il="start",Tl=[],Rl=0,Ml=1,Ll=0,jl=!1,$l="default",Hl="'",Jl=1;function Gl(e,t=!1){Bl=String(e),Il="start",Tl=[],Rl=0,Ml=1,Ll=0,kl=void 0,jl=t;do{_l=Vl(),Xl[Il]()}while("eof"!==_l.type);return kl}function Vl(){for($l="default",xl="",Hl="'",Jl=1;;){Nl=Ul();const e=zl[$l]();if(e)return e}}function Ul(){if(Bl[Rl])return String.fromCodePoint(Bl.codePointAt(Rl))}function Wl(){const e=Ul();return"\n"===e?(Ml++,Ll=0):e?Ll+=e.length:Ll++,e&&(Rl+=e.length),e}X.parseJsonFile=function(e,t=!1,n="utf-8"){const r=vl.default.readFileSync(Sl.default.resolve(e),{encoding:n});try{return Gl(r,t)}catch(t){if(t instanceof SyntaxError){const n=t.message.split("at");2===n.length&&Ol.errorMessageExit(`${n[0].trim()}${wl.default.EOL}\t at ${e}:${n[1].trim()}`)}Ol.errorMessageExit(`${e} is not in valid JSON/JSON5 format.`)}},X.parseJsonText=Gl;const zl={default(){switch(Nl){case"/":return Wl(),void($l="comment");case void 0:return Wl(),Kl("eof")}if(!Al.JudgeUtil.isIgnoreChar(Nl)&&!Al.JudgeUtil.isSpaceSeparator(Nl))return zl[Il]();Wl()},start(){$l="value"},beforePropertyName(){switch(Nl){case"$":case"_":return xl=Wl(),void($l="identifierName");case"\\":return Wl(),void($l="identifierNameStartEscape");case"}":return Kl("punctuator",Wl());case'"':case"'":return Hl=Nl,Wl(),void($l="string")}if(Al.JudgeUtil.isIdStartChar(Nl))return xl+=Wl(),void($l="identifierName");throw tf(bl.Char,Wl())},afterPropertyName(){if(":"===Nl)return Kl("punctuator",Wl());throw tf(bl.Char,Wl())},beforePropertyValue(){$l="value"},afterPropertyValue(){switch(Nl){case",":case"}":return Kl("punctuator",Wl())}throw tf(bl.Char,Wl())},beforeArrayValue(){if("]"===Nl)return Kl("punctuator",Wl());$l="value"},afterArrayValue(){switch(Nl){case",":case"]":return Kl("punctuator",Wl())}throw tf(bl.Char,Wl())},end(){throw tf(bl.Char,Wl())},comment(){switch(Nl){case"*":return Wl(),void($l="multiLineComment");case"/":return Wl(),void($l="singleLineComment")}throw tf(bl.Char,Wl())},multiLineComment(){switch(Nl){case"*":return Wl(),void($l="multiLineCommentAsterisk");case void 0:throw tf(bl.Char,Wl())}Wl()},multiLineCommentAsterisk(){switch(Nl){case"*":return void Wl();case"/":return Wl(),void($l="default");case void 0:throw tf(bl.Char,Wl())}Wl(),$l="multiLineComment"},singleLineComment(){switch(Nl){case"\n":case"\r":case"\u2028":case"\u2029":return Wl(),void($l="default");case void 0:return Wl(),Kl("eof")}Wl()},value(){switch(Nl){case"{":case"[":return Kl("punctuator",Wl());case"n":return Wl(),ql("ull"),Kl("null",null);case"t":return Wl(),ql("rue"),Kl("boolean",!0);case"f":return Wl(),ql("alse"),Kl("boolean",!1);case"-":case"+":return"-"===Wl()&&(Jl=-1),void($l="numerical");case".":case"0":case"I":case"N":return void($l="numerical");case'"':case"'":return Hl=Nl,Wl(),xl="",void($l="string")}if(void 0===Nl||!Al.JudgeUtil.isDigitWithoutZero(Nl))throw tf(bl.Char,Wl());$l="numerical"},numerical(){switch(Nl){case".":return xl=Wl(),void($l="decimalPointLeading");case"0":return xl=Wl(),void($l="zero");case"I":return Wl(),ql("nfinity"),Kl("numeric",Jl*(1/0));case"N":return Wl(),ql("aN"),Kl("numeric",NaN)}if(void 0!==Nl&&Al.JudgeUtil.isDigitWithoutZero(Nl))return xl=Wl(),void($l="decimalInteger");throw tf(bl.Char,Wl())},zero(){switch(Nl){case".":case"e":case"E":return void($l="decimal");case"x":case"X":return xl+=Wl(),void($l="hexadecimal")}return Kl("numeric",0)},decimalInteger(){switch(Nl){case".":case"e":case"E":return void($l="decimal")}if(!Al.JudgeUtil.isDigit(Nl))return Kl("numeric",Jl*Number(xl));xl+=Wl()},decimal(){switch(Nl){case".":xl+=Wl(),$l="decimalFraction";break;case"e":case"E":xl+=Wl(),$l="decimalExponent"}},decimalPointLeading(){if(Al.JudgeUtil.isDigit(Nl))return xl+=Wl(),void($l="decimalFraction");throw tf(bl.Char,Wl())},decimalFraction(){switch(Nl){case"e":case"E":return xl+=Wl(),void($l="decimalExponent")}if(!Al.JudgeUtil.isDigit(Nl))return Kl("numeric",Jl*Number(xl));xl+=Wl()},decimalExponent(){switch(Nl){case"+":case"-":return xl+=Wl(),void($l="decimalExponentSign")}if(Al.JudgeUtil.isDigit(Nl))return xl+=Wl(),void($l="decimalExponentInteger");throw tf(bl.Char,Wl())},decimalExponentSign(){if(Al.JudgeUtil.isDigit(Nl))return xl+=Wl(),void($l="decimalExponentInteger");throw tf(bl.Char,Wl())},decimalExponentInteger(){if(!Al.JudgeUtil.isDigit(Nl))return Kl("numeric",Jl*Number(xl));xl+=Wl()},hexadecimal(){if(Al.JudgeUtil.isHexDigit(Nl))return xl+=Wl(),void($l="hexadecimalInteger");throw tf(bl.Char,Wl())},hexadecimalInteger(){if(!Al.JudgeUtil.isHexDigit(Nl))return Kl("numeric",Jl*Number(xl));xl+=Wl()},identifierNameStartEscape(){if("u"!==Nl)throw tf(bl.Char,Wl());Wl();const e=Yl();switch(e){case"$":case"_":break;default:if(!Al.JudgeUtil.isIdStartChar(e))throw tf(bl.Identifier)}xl+=e,$l="identifierName"},identifierName(){switch(Nl){case"$":case"_":case"‌":case"‍":return void(xl+=Wl());case"\\":return Wl(),void($l="identifierNameEscape")}if(!Al.JudgeUtil.isIdContinueChar(Nl))return Kl("identifier",xl);xl+=Wl()},identifierNameEscape(){if("u"!==Nl)throw tf(bl.Char,Wl());Wl();const e=Yl();switch(e){case"$":case"_":case"‌":case"‍":break;default:if(!Al.JudgeUtil.isIdContinueChar(e))throw tf(bl.Identifier)}xl+=e,$l="identifierName"},string(){switch(Nl){case"\\":return Wl(),void(xl+=function(){const e=Ul(),t=function(){switch(Ul()){case"b":return Wl(),"\b";case"f":return Wl(),"\f";case"n":return Wl(),"\n";case"r":return Wl(),"\r";case"t":return Wl(),"\t";case"v":return Wl(),"\v"}return}();if(t)return t;switch(e){case"0":if(Wl(),Al.JudgeUtil.isDigit(Ul()))throw tf(bl.Char,Wl());return"\0";case"x":return Wl(),function(){let e="",t=Ul();if(!Al.JudgeUtil.isHexDigit(t))throw tf(bl.Char,Wl());if(e+=Wl(),t=Ul(),!Al.JudgeUtil.isHexDigit(t))throw tf(bl.Char,Wl());return e+=Wl(),String.fromCodePoint(parseInt(e,16))}();case"u":return Wl(),Yl();case"\n":case"\u2028":case"\u2029":return Wl(),"";case"\r":return Wl(),"\n"===Ul()&&Wl(),""}if(void 0===e||Al.JudgeUtil.isDigitWithoutZero(e))throw tf(bl.Char,Wl());return Wl()}());case'"':case"'":if(Nl===Hl){const e=Kl("string",xl);return Wl(),e}return void(xl+=Wl());case"\n":case"\r":case void 0:throw tf(bl.Char,Wl());case"\u2028":case"\u2029":!function(e){Ol.warn(`JSON5: '${ef(e)}' in strings is not valid ECMAScript; consider escaping.`)}(Nl)}xl+=Wl()}};function Kl(e,t){return{type:e,value:t,line:Ml,column:Ll}}function ql(e){for(const t of e){if(Ul()!==t)throw tf(bl.Char,Wl());Wl()}}function Yl(){let e="",t=4;for(;t-- >0;){const t=Ul();if(!Al.JudgeUtil.isHexDigit(t))throw tf(bl.Char,Wl());e+=Wl()}return String.fromCodePoint(parseInt(e,16))}const Xl={start(){if("eof"===_l.type)throw tf(bl.EOF);Zl()},beforePropertyName(){switch(_l.type){case"identifier":case"string":return Pl=_l.value,void(Il="afterPropertyName");case"punctuator":return void Ql();case"eof":throw tf(bl.EOF)}},afterPropertyName(){if("eof"===_l.type)throw tf(bl.EOF);Il="beforePropertyValue"},beforePropertyValue(){if("eof"===_l.type)throw tf(bl.EOF);Zl()},afterPropertyValue(){if("eof"===_l.type)throw tf(bl.EOF);switch(_l.value){case",":return void(Il="beforePropertyName");case"}":Ql()}},beforeArrayValue(){if("eof"===_l.type)throw tf(bl.EOF);"punctuator"!==_l.type||"]"!==_l.value?Zl():Ql()},afterArrayValue(){if("eof"===_l.type)throw tf(bl.EOF);switch(_l.value){case",":return void(Il="beforeArrayValue");case"]":Ql()}},end(){}};function Zl(){const e=function(){let e;switch(_l.type){case"punctuator":switch(_l.value){case"{":e={};break;case"[":e=[]}break;case"null":case"boolean":case"numeric":case"string":e=_l.value}return e}();if(jl&&"object"==typeof e&&(e._line=Ml,e._column=Ll),void 0===kl)kl=e;else{const t=Tl[Tl.length-1];Array.isArray(t)?jl&&"object"!=typeof e?t.push({value:e,_line:Ml,_column:Ll}):t.push(e):t[Pl]=jl&&"object"!=typeof e?{value:e,_line:Ml,_column:Ll}:e}!function(e){if(e&&"object"==typeof e)Tl.push(e),Il=Array.isArray(e)?"beforeArrayValue":"beforePropertyName";else{const e=Tl[Tl.length-1];Il=e?Array.isArray(e)?"afterArrayValue":"afterPropertyValue":"end"}}(e)}function Ql(){Tl.pop();const e=Tl[Tl.length-1];Il=e?Array.isArray(e)?"afterArrayValue":"afterPropertyValue":"end"}function ef(e){const t={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(t[e])return t[e];if(e<" "){const t=e.charCodeAt(0).toString(16);return`\\x${`00${t}`.substring(t.length)}`}return e}function tf(e,t){let n="";switch(e){case bl.Char:n=void 0===t?`JSON5: invalid end of input at ${Ml}:${Ll}`:`JSON5: invalid character '${ef(t)}' at ${Ml}:${Ll}`;break;case bl.EOF:n=`JSON5: invalid end of input at ${Ml}:${Ll}`;break;case bl.Identifier:Ll-=5,n=`JSON5: invalid identifier character at ${Ml}:${Ll}`}const r=new nf(n);return r.lineNumber=Ml,r.columnNumber=Ll,r}class nf extends SyntaxError{}var rf=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),uf=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),of=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&rf(t,e,n);return uf(t,e),t};Object.defineProperty(Y,"__esModule",{value:!0});var sf=Y.cleanWorkSpace=Ff=Y.executeInstallHvigor=yf=Y.isHvigorInstalled=mf=Y.isAllDependenciesInstalled=void 0;const cf=of(D.default),af=of(p.default),lf=b,ff=j,df=$,Df=X;let pf,Ef;var mf=Y.isAllDependenciesInstalled=function(){function e(e){const t=null==e?void 0:e.dependencies;return void 0===t?0:Object.getOwnPropertyNames(t).length}if(pf=gf(),Ef=Af(),e(pf)+1!==e(Ef))return!1;for(const e in null==pf?void 0:pf.dependencies)if(!(0,ff.hasNpmPackInPaths)(e,[lf.HVIGOR_PROJECT_DEPENDENCIES_HOME])||!hf(e,pf,Ef))return!1;return!0};function hf(e,t,n){return void 0!==n.dependencies&&(0,ff.offlinePluginConversion)(lf.HVIGOR_PROJECT_ROOT_DIR,t.dependencies[e])===n.dependencies[e]}var yf=Y.isHvigorInstalled=function(){return pf=gf(),Ef=Af(),(0,ff.hasNpmPackInPaths)(lf.HVIGOR_ENGINE_PACKAGE_NAME,[lf.HVIGOR_PROJECT_DEPENDENCIES_HOME])&&(0,ff.offlinePluginConversion)(lf.HVIGOR_PROJECT_ROOT_DIR,pf.hvigorVersion)===Ef.dependencies[lf.HVIGOR_ENGINE_PACKAGE_NAME]};const Cf={cwd:lf.HVIGOR_PROJECT_DEPENDENCIES_HOME,stdio:["inherit","inherit","inherit"]};var Ff=Y.executeInstallHvigor=function(){(0,df.logInfoPrintConsole)("Hvigor installing...");const e={dependencies:{}};e.dependencies[lf.HVIGOR_ENGINE_PACKAGE_NAME]=(0,ff.offlinePluginConversion)(lf.HVIGOR_PROJECT_ROOT_DIR,pf.hvigorVersion);try{cf.mkdirSync(lf.HVIGOR_PROJECT_DEPENDENCIES_HOME,{recursive:!0});const t=af.resolve(lf.HVIGOR_PROJECT_DEPENDENCIES_HOME,lf.DEFAULT_PACKAGE_JSON);cf.writeFileSync(t,JSON.stringify(e))}catch(e){(0,df.logErrorAndExit)(e)}!function(){const e=["config","set","store-dir",lf.HVIGOR_PNPM_STORE_PATH];(0,ff.executeCommand)(lf.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH,e,Cf)}(),(0,ff.executeCommand)(lf.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH,["install"],Cf)};function gf(){const e=af.resolve(lf.HVIGOR_PROJECT_WRAPPER_HOME,lf.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME);return cf.existsSync(e)||(0,df.logErrorAndExit)(`Error: Hvigor config file ${e} does not exist.`),(0,Df.parseJsonFile)(e)}function Af(){return cf.existsSync(lf.HVIGOR_PROJECT_DEPENDENCY_PACKAGE_JSON_PATH)?(0,Df.parseJsonFile)(lf.HVIGOR_PROJECT_DEPENDENCY_PACKAGE_JSON_PATH):{dependencies:{}}}sf=Y.cleanWorkSpace=function(){if((0,df.logInfoPrintConsole)("Hvigor cleaning..."),!cf.existsSync(lf.HVIGOR_PROJECT_DEPENDENCIES_HOME))return;const e=cf.readdirSync(lf.HVIGOR_PROJECT_DEPENDENCIES_HOME);if(e&&0!==e.length){cf.existsSync(lf.HVIGOR_BOOT_JS_FILE_PATH)&&(0,ff.executeCommand)(process.argv[0],[lf.HVIGOR_BOOT_JS_FILE_PATH,"--stop-daemon"],{});try{e.forEach((e=>{cf.rmSync(af.resolve(lf.HVIGOR_PROJECT_DEPENDENCIES_HOME,e),{recursive:!0})}))}catch(e){(0,df.logErrorAndExit)(`The hvigor build tool cannot be installed. Please manually clear the workspace directory and synchronize the project again.\n\n Workspace Path: ${lf.HVIGOR_PROJECT_DEPENDENCIES_HOME}.`)}}};var vf={},Sf=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),wf=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Of=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&Sf(t,e,n);return wf(t,e),t};Object.defineProperty(vf,"__esModule",{value:!0});var bf=vf.executeBuild=void 0;const _f=b,Bf=Of(D.default),Pf=Of(p.default),kf=$;bf=vf.executeBuild=function(){const e=Pf.resolve(_f.HVIGOR_PROJECT_DEPENDENCIES_HOME,"node_modules","@ohos","hvigor","bin","hvigor.js");try{const t=Bf.realpathSync(e);require(t)}catch(t){(0,kf.logErrorAndExit)(`Error: ENOENT: no such file ${e},delete ${_f.HVIGOR_PROJECT_DEPENDENCIES_HOME} and retry.`)}},function(){if(O.checkNpmConifg(),O.environmentHandler(),O.isPnpmAvailable()||O.executeInstallPnpm(),yf()&&mf())bf();else{sf();try{Ff()}catch(e){return void sf()}bf()}}(); \ No newline at end of file diff --git a/ohos/test_collection/ohos/hvigorfile.ts b/ohos/test_collection/ohos/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..5a172b770e3b15f67c12152d00f38f2084d3915b --- /dev/null +++ b/ohos/test_collection/ohos/hvigorfile.ts @@ -0,0 +1,17 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently. +export { appTasks } from '@ohos/hvigor-ohos-plugin'; \ No newline at end of file diff --git a/ohos/test_collection/ohos/hvigorw b/ohos/test_collection/ohos/hvigorw new file mode 100755 index 0000000000000000000000000000000000000000..5efd8343d3232bdd1d9b7f67a3326034054c5396 --- /dev/null +++ b/ohos/test_collection/ohos/hvigorw @@ -0,0 +1,61 @@ +#!/bin/bash + +# Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# ---------------------------------------------------------------------------- +# Hvigor startup script, version 1.0.0 +# +# Required ENV vars: +# ------------------ +# NODE_HOME - location of a Node home dir +# or +# Add /usr/local/nodejs/bin to the PATH environment variable +# ---------------------------------------------------------------------------- + +HVIGOR_APP_HOME=$(dirname $(readlink -f $0)) +HVIGOR_WRAPPER_SCRIPT=${HVIGOR_APP_HOME}/hvigor/hvigor-wrapper.js +warn() { + echo "" + echo -e "\033[1;33m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m" +} + +error() { + echo "" + echo -e "\033[1;31m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m" +} + +fail() { + error "$@" + exit 1 +} + +# Determine node to start hvigor wrapper script +if [ -n "${NODE_HOME}" ];then + EXECUTABLE_NODE="${NODE_HOME}/bin/node" + if [ ! -x "$EXECUTABLE_NODE" ];then + fail "ERROR: NODE_HOME is set to an invalid directory,check $NODE_HOME\n\nPlease set NODE_HOME in your environment to the location where your nodejs installed" + fi +else + EXECUTABLE_NODE="node" + which ${EXECUTABLE_NODE} > /dev/null 2>&1 || fail "ERROR: NODE_HOME is not set and not 'node' command found in your path" +fi + +# Check hvigor wrapper script +if [ ! -r "$HVIGOR_WRAPPER_SCRIPT" ];then + fail "ERROR: Couldn't find hvigor/hvigor-wrapper.js in ${HVIGOR_APP_HOME}" +fi + +# start hvigor-wrapper script +exec "${EXECUTABLE_NODE}" \ + "${HVIGOR_WRAPPER_SCRIPT}" "$@" diff --git a/ohos/test_collection/ohos/hvigorw.bat b/ohos/test_collection/ohos/hvigorw.bat new file mode 100644 index 0000000000000000000000000000000000000000..6861293e47dfd0186da380321b73be9033507e24 --- /dev/null +++ b/ohos/test_collection/ohos/hvigorw.bat @@ -0,0 +1,64 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Hvigor startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +set WRAPPER_MODULE_PATH=%APP_HOME%\hvigor\hvigor-wrapper.js +set NODE_EXE=node.exe + +goto start + +:start +@rem Find node.exe +if defined NODE_HOME goto findNodeFromNodeHome + +%NODE_EXE% --version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH. +echo. +echo Please set the NODE_HOME variable in your environment to match the +echo location of your NodeJs installation. + +goto fail + +:findNodeFromNodeHome +set NODE_HOME=%NODE_HOME:"=% +set NODE_EXE_PATH=%NODE_HOME%/%NODE_EXE% + +if exist "%NODE_EXE_PATH%" goto execute +echo. +echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH. +echo. +echo Please set the NODE_HOME variable in your environment to match the +echo location of your NodeJs installation. + +goto fail + +:execute +@rem Execute hvigor +"%NODE_EXE%" %WRAPPER_MODULE_PATH% %* + +if "%ERRORLEVEL%" == "0" goto hvigorwEnd + +:fail +exit /b 1 + +:hvigorwEnd +if "%OS%" == "Windows_NT" endlocal + +:end diff --git a/ohos/test_collection/ohos/oh-package.json5 b/ohos/test_collection/ohos/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..a2408ea9cb7b309e6ad95e27a4c8b88985ae57c6 --- /dev/null +++ b/ohos/test_collection/ohos/oh-package.json5 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +{ + "name": "apptemplate", + "version": "1.0.0", + "description": "Please describe the basic information.", + "main": "", + "author": "", + "license": "", + "dependencies": { + }, + "devDependencies": { + "@ohos/hypium": "1.0.6" + } +} diff --git a/ohos/test_collection/pubspec.yaml b/ohos/test_collection/pubspec.yaml new file mode 100644 index 0000000000000000000000000000000000000000..953170794f7c6a993e257b827ceb1a5854fb0b66 --- /dev/null +++ b/ohos/test_collection/pubspec.yaml @@ -0,0 +1,13 @@ +name: test_collection +description: A new Flutter project. +publish_to: 'none' +version: 1.0.0 + +environment: + sdk: '>=2.12.0 <3.0.0' +dependencies: + flutter: + sdk: flutter + collection: 1.17.0 +flutter: + uses-material-design: true \ No newline at end of file diff --git a/ohos/test_flutter_cache_manager/.gitignore b/ohos/test_flutter_cache_manager/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..24476c5d1eb55824c76d8b01a3965f94abad1ef8 --- /dev/null +++ b/ohos/test_flutter_cache_manager/.gitignore @@ -0,0 +1,44 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.packages +.pub-cache/ +.pub/ +/build/ + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/ohos/test_flutter_cache_manager/.metadata b/ohos/test_flutter_cache_manager/.metadata new file mode 100644 index 0000000000000000000000000000000000000000..5e296a78a68d4f3bf758cae1171c0c2e71ad6edd --- /dev/null +++ b/ohos/test_flutter_cache_manager/.metadata @@ -0,0 +1,30 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled. + +version: + revision: 840747ee91d7cfb95661ce7358b7256919075c2a + channel: master + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: 840747ee91d7cfb95661ce7358b7256919075c2a + base_revision: 840747ee91d7cfb95661ce7358b7256919075c2a + - platform: ohos + create_revision: 840747ee91d7cfb95661ce7358b7256919075c2a + base_revision: 840747ee91d7cfb95661ce7358b7256919075c2a + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/ohos/test_flutter_cache_manager/README.md b/ohos/test_flutter_cache_manager/README.md new file mode 100755 index 0000000000000000000000000000000000000000..85bdbf81728f0dc824fa53f39015c8889320983b --- /dev/null +++ b/ohos/test_flutter_cache_manager/README.md @@ -0,0 +1,16 @@ +# test_flutter_cache_manager + +A new Flutter project. + +## Getting Started + +This project is a starting point for a Flutter application. + +A few resources to get you started if this is your first Flutter project: + +- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) +- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) + +For help getting started with Flutter development, view the +[online documentation](https://docs.flutter.dev/), which offers tutorials, +samples, guidance on mobile development, and a full API reference. diff --git a/ohos/test_flutter_cache_manager/analysis_options.yaml b/ohos/test_flutter_cache_manager/analysis_options.yaml new file mode 100755 index 0000000000000000000000000000000000000000..61b6c4de17c96863d24279f06b85e01b6ebbdb34 --- /dev/null +++ b/ohos/test_flutter_cache_manager/analysis_options.yaml @@ -0,0 +1,29 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at + # https://dart-lang.github.io/linter/lints/index.html. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/ohos/test_flutter_cache_manager/assets/image-120.png b/ohos/test_flutter_cache_manager/assets/image-120.png new file mode 100644 index 0000000000000000000000000000000000000000..a02e94a16e1ef5f9db866407d36541c1aa0d0f47 Binary files /dev/null and b/ohos/test_flutter_cache_manager/assets/image-120.png differ diff --git a/ohos/test_flutter_cache_manager/lib/base/base_page.dart b/ohos/test_flutter_cache_manager/lib/base/base_page.dart new file mode 100644 index 0000000000000000000000000000000000000000..4e7696dd6aacb60c31d5f27aec4769a189efd686 --- /dev/null +++ b/ohos/test_flutter_cache_manager/lib/base/base_page.dart @@ -0,0 +1,41 @@ +import 'package:flutter/material.dart'; + +import 'main_item_widget.dart'; +import 'test_route.dart'; + +/// 全局静态数据存储 +abstract class GlobalData { + static String appName = ''; +} + +/// app基本首页 +class BasePage extends StatefulWidget { + const BasePage({Key? key, required this.data}) : super(key: key); + + final List data; + + @override + State createState() => _BasePageState(); +} + +class _BasePageState extends State { + int get _itemCount => widget.data.length; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Center( + child: Text(GlobalData.appName, textAlign: TextAlign.center)), + ), + body: + ListView.builder(itemBuilder: _itemBuilder, itemCount: _itemCount)); + } + + Widget _itemBuilder(BuildContext context, int index) { + return MainItemWidget(widget.data[index], (MainItem item) { + Navigator.push( + context, MaterialPageRoute(builder: (content) => item.route)); + }); + } +} diff --git a/ohos/test_flutter_cache_manager/lib/base/item_widget.dart b/ohos/test_flutter_cache_manager/lib/base/item_widget.dart new file mode 100644 index 0000000000000000000000000000000000000000..64a3e8a5cf9e689e7a991b5d2efd49f0badf9646 --- /dev/null +++ b/ohos/test_flutter_cache_manager/lib/base/item_widget.dart @@ -0,0 +1,112 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +import 'test_page.dart'; + +/// Item widget. +class ItemWidget extends StatefulWidget { + /// Item widget. + const ItemWidget( + {required this.item, required this.index, required this.getGroupRange, required this.runGroup, required this.onTap, this.summary, Key? key}) + : super(key: key); + + /// item summary. + final String? summary; + + /// item data. + final Item item; + + /// 当前下标 + final int index; + + /// 获取对应的组信息 + final GroupRange Function() getGroupRange; + + /// 获取对应的组信息 + final void Function(int start, int end) runGroup; + + /// Action when pressed (typically run). + final void Function(Item item) onTap; + + @override + ItemWidgetState createState() => ItemWidgetState(); +} + +class ItemWidgetState extends State { + @override + Widget build(BuildContext context) { + IconData? icon; + Color? color; + + switch (widget.item.state) { + case ItemState.none: + icon = Icons.arrow_forward_ios; + break; + case ItemState.running: + icon = Icons.more_horiz; + break; + case ItemState.success: + icon = Icons.check; + color = Colors.green; + break; + case ItemState.failure: + icon = Icons.close; + color = Colors.red; + break; + } + + final Widget listTile = ListTile( + leading: SizedBox( + child: IconButton( + icon: Icon(icon, color: color), + onPressed: null, + )), + title: Text(widget.item.name), + subtitle: widget.summary != null ? Text(widget.summary!) : null, + onTap: () { + widget.onTap(widget.item); + }); + + final data = widget.getGroupRange(); + + return Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (data.groupName.isNotEmpty && data.startIndex == widget.index) + GestureDetector( + onTap: () {}, + child: Container( + height: 35, + decoration: BoxDecoration(color: CupertinoColors.extraLightBackgroundGray), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + '测试组: ${data.groupName}', + style: TextStyle(fontSize: 18), + ), + FilledButton( + onPressed: () => widget.runGroup(data.startIndex, data.startIndex), + child: Text( + '整组测试', + style: TextStyle(fontSize: 16), + )) + ], + ), + ), + ), + Container( + margin: data.groupName.isNotEmpty && data.startIndex == widget.index ? EdgeInsets.only(bottom: 10) : null, + decoration: BoxDecoration( + border: data.groupName.isNotEmpty && data.endIndex == widget.index ? Border(bottom: BorderSide(color: Colors.grey)) : null, + ), + child: Padding( + padding: data.groupName.isNotEmpty && data.startIndex <= widget.index && data.endIndex >= widget.index ? EdgeInsets.only(left: 35) : EdgeInsets.zero, + child: listTile, + ), + ) + ], + ); + } +} diff --git a/ohos/test_flutter_cache_manager/lib/base/main_item_widget.dart b/ohos/test_flutter_cache_manager/lib/base/main_item_widget.dart new file mode 100644 index 0000000000000000000000000000000000000000..32f8261b736c517c5984710ec950be96470dacdc --- /dev/null +++ b/ohos/test_flutter_cache_manager/lib/base/main_item_widget.dart @@ -0,0 +1,35 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'test_route.dart'; + +/// Main item widget. +class MainItemWidget extends StatefulWidget { + /// Main item widget. + const MainItemWidget(this.item, this.onTap, {Key? key}) : super(key: key); + + /// item data. + final MainItem item; + + /// onTap action (typically run or open). + final void Function(MainItem item) onTap; + + @override + MainItemWidgetState createState() => MainItemWidgetState(); +} + +class MainItemWidgetState extends State { + @override + Widget build(BuildContext context) { + return Container( + margin: const EdgeInsets.only(bottom: 10), + child: ListTile( + tileColor: CupertinoColors.extraLightBackgroundGray, + title: Text(widget.item.title), + onTap: _onTap), + ); + } + + void _onTap() { + widget.onTap(widget.item); + } +} diff --git a/ohos/test_flutter_cache_manager/lib/base/test_model_app.dart b/ohos/test_flutter_cache_manager/lib/base/test_model_app.dart new file mode 100644 index 0000000000000000000000000000000000000000..f565a5f8dab474f51e2a0c16cf745a6f7887b65b --- /dev/null +++ b/ohos/test_flutter_cache_manager/lib/base/test_model_app.dart @@ -0,0 +1,36 @@ +import 'package:flutter/material.dart'; + +import 'base_page.dart'; +import 'test_route.dart'; + +/// 基础app框架 +class TestModelApp extends StatefulWidget { + TestModelApp({Key? key, required this.appName, required this.data}) : super(key: key) { + GlobalData.appName = appName; + } + + /// 测试包名称 + final String appName; + + /// 路由数据 + final List data; + + @override + State createState() => TestModelState(); +} + +class TestModelState extends State { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: widget.appName, + theme: ThemeData( + colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue), + appBarTheme: const AppBarTheme(backgroundColor: Colors.blue), + primarySwatch: Colors.blue, + useMaterial3: true, + ), + home: BasePage(data: widget.data), + ); + } +} diff --git a/ohos/test_flutter_cache_manager/lib/base/test_page.dart b/ohos/test_flutter_cache_manager/lib/base/test_page.dart new file mode 100644 index 0000000000000000000000000000000000000000..babcabaa7a2518f65dbfed58afa0017739ec540e --- /dev/null +++ b/ohos/test_flutter_cache_manager/lib/base/test_page.dart @@ -0,0 +1,309 @@ +import 'dart:async'; + +import 'package:flutter/material.dart'; + +import 'item_widget.dart'; + +List contentList = []; + +class Test { + /// Test definition. + Test(this.name, this.fn, {bool? solo, bool? skip}) + : solo = solo == true, + skip = skip == true; + + /// Only run this test. + final bool solo; + + /// Skip this test. + final bool skip; + + /// Test name. + String name; + + /// Test body. + FutureOr Function() fn; +} + +/// Item states. +enum ItemState { + /// test not run yet. + none, + + /// test is running. + running, + + /// test succeeded. + success, + + /// test fails. + failure +} + +/// Menu item. +class Item { + /// Menu item. + Item(this.name); + + /// Menu item state. + ItemState state = ItemState.running; + + /// Menu item name/ + String name; +} + +class TestLength { + TestLength(this.oldLength, this.newLength); + + int oldLength; + int newLength; +} + +class GroupRange { + GroupRange(this.groupName, this.startIndex, this.endIndex); + + String groupName; + int startIndex; + int endIndex; +} + +/// 基础测试页面 +class TestPage extends StatefulWidget { + /// Base test page. + TestPage({required this.title, Key? key}) : super(key: key); + + /// The title. + final String title; + + /// Test list. + final List tests = []; + + /// 保存group的范围信息 + final Map groupTitle = {}; + + /// define a test. + void test(String name, FutureOr Function() fn) { + tests.add(Test(name, fn)); + } + + /// define a group test. + void group(String name, FutureOr Function() fn) { + int oldLength = tests.length; + fn(); + + int newLength = tests.length - 1; + groupTitle.addAll({name: TestLength(oldLength, newLength)}); + } + + /// Thrown an exception + void fail([String? message]) { + throw Exception(message ?? 'should fail'); + } + + @override + TestPageState createState() => TestPageState(); +} + +/// Group. +mixin Group { + /// List of tests. + List get tests { + throw UnimplementedError(); + } + + bool? _hasSolo; + final _tests = []; + + /// Add a test. + void add(Test test) { + if (!test.skip) { + if (test.solo) { + if (_hasSolo != true) { + _hasSolo = true; + _tests.clear(); + } + _tests.add(test); + } else if (_hasSolo != true) { + _tests.add(test); + } + } + } + + /// true if it has solo or contains item with solo feature + bool? get hasSolo => _hasSolo; +} + +class TestPageState extends State with Group { + List items = []; + + Future _run() async { + if (!mounted) { + return null; + } + + setState(() { + items.clear(); + }); + _tests.clear(); + for (var test in widget.tests) { + add(test); + } + for (var test in _tests) { + var item = Item(test.name); + contentList.add(Text(test.name, style: const TextStyle(fontSize: 18, color: Colors.green))); + + late int position; + setState(() { + position = items.length; + items.add(item); + }); + try { + await test.fn(); + item = Item(test.name)..state = ItemState.success; + print('ohFlutter: ${test.name}, result: success'); + } catch (e, st) { + contentList.add(Text('$e, $st', style: const TextStyle(fontSize: 18, color: Colors.red))); + print('ohFlutter: ${test.name}-error: $e, $st}'); + item = Item(test.name)..state = ItemState.failure; + } + + if (!mounted) { + return null; + } + + setState(() { + items[position] = item; + }); + } + } + + Future _runTest(int index) async { + if (!mounted) { + return null; + } + + final test = _tests[index]; + + var item = items[index]; + setState(() { + contentList = []; + item.state = ItemState.running; + }); + contentList.add(Text(test.name, style: const TextStyle(fontSize: 18, color: Colors.green))); + try { + await test.fn(); + + item = Item(test.name)..state = ItemState.success; + print('ohFlutter: ${test.name}, result: success'); + } catch (e, st) { + contentList.add(Text('$e, $st', style: const TextStyle(fontSize: 18, color: Colors.red))); + print('ohFlutter: ${test.name}-error: $e, $st}'); + try { + print(st); + } catch (_) {} + item = Item(test.name)..state = ItemState.failure; + } + + if (!mounted) { + return null; + } + + setState(() { + items[index] = item; + }); + } + + @override + void initState() { + super.initState(); + contentList = []; + _run(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar(title: Text(widget.title), actions: [ + IconButton( + icon: const Icon(Icons.search), + tooltip: 'Results', + onPressed: () { + showAlertDialog(context); + }, + ), + IconButton( + icon: const Icon(Icons.refresh), + tooltip: 'Run again', + onPressed: _run, + ), + ]), + body: ListView(children: [ + ...items.asMap().keys.map((e) => _itemBuilder(context, e)).toList(), + ])); + } + + Widget _itemBuilder(BuildContext context, int index) { + final item = getItem(index); + return ItemWidget( + item: item, + index: index, + getGroupRange: () { + GroupRange data = GroupRange('', 0, 0); + widget.groupTitle.forEach((key, value) { + if (value.oldLength <= index && value.newLength >= index) { + data = GroupRange(key, value.oldLength, value.newLength); + } + }); + return data; + }, + runGroup: (start, end) async { + for (var i = start; i <= end; i++) { + await _runTest(i); + print('\n'); + } + }, + onTap: (Item item) { + _runTest(index); + }); + } + + Item getItem(int index) { + return items[index]; + } + + @override + List get tests => widget.tests; +} + +void expect(var testModel, var object) { + try { + testModel; + contentList.add(Text('运行正常,输出参数为$testModel')); + } catch(e) { + contentList.add(Text('运行失败,错误信息为$e')); + print(e.toString()); + } +} + +void showAlertDialog(BuildContext context) { + showDialog( + context: context, + barrierDismissible: false, + builder: (BuildContext context) { + return AlertDialog( + content: SingleChildScrollView( + child: Column( + children: contentList, + ), + ), + actions: [ + MaterialButton( + child: const Text('确定'), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + ], + ); + }); +} \ No newline at end of file diff --git a/ohos/test_flutter_cache_manager/lib/base/test_route.dart b/ohos/test_flutter_cache_manager/lib/base/test_route.dart new file mode 100644 index 0000000000000000000000000000000000000000..dc37452a13174a378beda98af423a6c1717d1c57 --- /dev/null +++ b/ohos/test_flutter_cache_manager/lib/base/test_route.dart @@ -0,0 +1,13 @@ +import 'package:flutter/cupertino.dart'; + +class MainItem { + /// Main item. + MainItem(this.title, this.route); + + /// Title. + String title; + + /// Page route. + Widget route; +} + diff --git a/ohos/test_flutter_cache_manager/lib/main.dart b/ohos/test_flutter_cache_manager/lib/main.dart new file mode 100644 index 0000000000000000000000000000000000000000..767533da8dd02754df12aabe018c68f8572c24ff --- /dev/null +++ b/ohos/test_flutter_cache_manager/lib/main.dart @@ -0,0 +1,35 @@ +import 'package:flutter/foundation.dart' show kDebugMode; +import 'package:flutter/material.dart'; +import 'package:flutter_cache_manager/flutter_cache_manager.dart'; +import 'package:test_flutter_cache_manager/plugin_example/download_page.dart'; +import 'package:test_flutter_cache_manager/plugin_example/input_page.dart'; +import 'package:test_flutter_cache_manager/src/cache_manager_test.dart'; +import 'package:test_flutter_cache_manager/src/cache_object_test.dart'; +import 'package:test_flutter_cache_manager/src/cache_store_test.dart'; +import 'package:test_flutter_cache_manager/src/http_file_fetcher_test.dart'; +import 'package:test_flutter_cache_manager/src/image_cache_manager_test.dart'; +import 'package:test_flutter_cache_manager/src/repositories/json_file_repository_test.dart'; +import 'package:test_flutter_cache_manager/src/repositories/migration_test.dart'; +import 'package:test_flutter_cache_manager/src/web_helper_test.dart'; + +import 'base/test_model_app.dart'; +import 'base/test_route.dart'; + +void main() { + WidgetsFlutterBinding.ensureInitialized(); + final app = [ + MainItem('可视化ui界面', InputPage()), + MainItem('WebHelper', WebHelperTestPage('WebHelper')), + MainItem( + 'ImageCacheManager', ImageCacheManagerTestPage('ImageCacheManager')), + MainItem('HttpFileService', HttpFileServiceTestPage('HttpFileService')), + MainItem('CacheStore', CacheStoreTestPage('CacheStore')), + MainItem('CacheObject', CacheObjectTestPage('CacheObject')), + MainItem('CacheManager', CacheManagerTestPage('CacheManager')), + MainItem('Migration', MigrationTestPage('Migration')), + MainItem('JsonCacheInfoRepository', + JsonCacheInfoRepositoryTestPage('JsonCacheInfoRepository')), + ]; + + runApp(TestModelApp(appName: 'flutter_cache_manager', data: app)); +} diff --git a/ohos/test_flutter_cache_manager/lib/plugin_example/download_page.dart b/ohos/test_flutter_cache_manager/lib/plugin_example/download_page.dart new file mode 100644 index 0000000000000000000000000000000000000000..d8c94d4de54af005045d3b003ce22bff6345e606 --- /dev/null +++ b/ohos/test_flutter_cache_manager/lib/plugin_example/download_page.dart @@ -0,0 +1,55 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_cache_manager/flutter_cache_manager.dart'; + +import 'file_info_widget.dart'; +import 'progress_indicator.dart' as p_i; + +/// A [Widget] showing the information about the status of the [FileResponse] +class DownloadPage extends StatelessWidget { + final Stream fileStream; + final VoidCallback downloadFile; + final VoidCallback clearCache; + final VoidCallback removeFile; + + const DownloadPage({ + required this.fileStream, + required this.downloadFile, + required this.clearCache, + required this.removeFile, + }); + + @override + Widget build(BuildContext context) { + return StreamBuilder( + stream: fileStream, + builder: (context, snapshot) { + Widget body; + final loading = !snapshot.hasData || snapshot.data is DownloadProgress; + + if (snapshot.hasError) { + body = ListTile( + title: const Text('出现错误'), + subtitle: Text(snapshot.error.toString()), + ); + } else if (loading) { + body = p_i.ProgressIndicator( + progress: snapshot.data as DownloadProgress?, + ); + } else { + body = FileInfoWidget( + fileInfo: snapshot.requireData as FileInfo, + clearCache: clearCache, + removeFile: removeFile, + ); + } + + return Scaffold( + appBar: AppBar( + title: Text('结果页'), + ), + body: body, + ); + }, + ); + } +} diff --git a/ohos/test_flutter_cache_manager/lib/plugin_example/file_info_widget.dart b/ohos/test_flutter_cache_manager/lib/plugin_example/file_info_widget.dart new file mode 100644 index 0000000000000000000000000000000000000000..61bef0891f6177088056fc1e2bbc647fb8284be8 --- /dev/null +++ b/ohos/test_flutter_cache_manager/lib/plugin_example/file_info_widget.dart @@ -0,0 +1,58 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_cache_manager/flutter_cache_manager.dart'; + +/// A [Widget] showing all available information about the downloaded file +class FileInfoWidget extends StatelessWidget { + final FileInfo fileInfo; + final VoidCallback clearCache; + final VoidCallback removeFile; + + const FileInfoWidget({ + required this.clearCache, + required this.removeFile, + required this.fileInfo, + }); + + @override + Widget build(BuildContext context) { + return ListView( + children: [ + Container( + height: 200, + margin: EdgeInsets.only(top: 20, bottom: 20), + child: Image.file(fileInfo.file), + ), + ListTile( + title: const Text('远程链接'), + subtitle: Text(fileInfo.originalUrl), + ), + ListTile( + title: const Text('本地文件路径'), + subtitle: Text(fileInfo.file.path), + ), + ListTile( + title: const Text('加载来源'), + subtitle: Text(fileInfo.source.toString()), + ), + ListTile( + title: const Text('有效期至'), + subtitle: Text(fileInfo.validTill.toIso8601String()), + ), + Padding( + padding: const EdgeInsets.all(10), + child: ElevatedButton( + onPressed: clearCache, + child: const Text('清除缓存') + ), + ), + Padding( + padding: const EdgeInsets.all(10), + child: ElevatedButton( + onPressed: removeFile, + child: const Text('删除文件'), + ), + ), + ], + ); + } +} diff --git a/ohos/test_flutter_cache_manager/lib/plugin_example/input_page.dart b/ohos/test_flutter_cache_manager/lib/plugin_example/input_page.dart new file mode 100644 index 0000000000000000000000000000000000000000..2f4c64d1f6e8de84cb5e2c809abbe78f7ad4470f --- /dev/null +++ b/ohos/test_flutter_cache_manager/lib/plugin_example/input_page.dart @@ -0,0 +1,126 @@ +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_cache_manager/flutter_cache_manager.dart'; +import 'package:permission_handler/permission_handler.dart'; + +import 'download_page.dart'; + +/// Example [Widget] showing the functionalities of flutter_cache_manager +class InputPage extends StatefulWidget { + const InputPage(); + + @override + InputPageState createState() => InputPageState(); +} + +class InputPageState extends State { + Stream? fileStream; + + final String staticUrl = + 'https://img2.baidu.com/it/u=3902309251,2849519907&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=889'; + + final TextEditingController controller = TextEditingController(); + + void _testDownloadFile() async { + + print('ohFlutter: ------------------------------------------------------------'); + + final storageStatus = await Permission.storage.request(); + if (storageStatus.isGranted == false) { + print('存储权限未申请'); + } else { + print('存储权限已申请'); + } + + if (controller.text.isEmpty) { + return; + } + + setState(() { + fileStream = DefaultCacheManager() + .getFileStream(controller.text, withProgress: true); + }); + } + + void _downloadFile() async { + if (controller.text.isEmpty) { + return; + } + + setState(() { + fileStream = DefaultCacheManager() + .getFileStream(controller.text, withProgress: true); + }); + } + + @override + Widget build(BuildContext context) { + if (fileStream == null) { + controller.text = staticUrl; + return Scaffold( + appBar: AppBar( + title: Text('请先下载图片'), + ), + body: Column( + children: [ + Container( + child: TextField( + controller: controller, + ), + ), + const ListTile( + title: Text('请输入图片的网络地址或重置url, 然后点击浮动动作按钮下载'), + ), + FilledButton( + onPressed: _downloadFile, + child: const Icon(Icons.cloud_download), + ), + FilledButton( + onPressed: () { + setState(() { + controller.text = staticUrl; + }); + }, + child: const Icon(Icons.refresh), + ), + FilledButton( + onPressed: _testDownloadFile, + child: const Icon(Icons.network_check_outlined), + ), + Text('临时测试权限按钮'), + Container(height: 20), + Image.asset('assets/image-120.png'), + ], + ), + ); + } + return DownloadPage( + fileStream: fileStream!, + downloadFile: _downloadFile, + clearCache: _clearCache, + removeFile: _removeFile, + ); + } + + void _clearCache() { + DefaultCacheManager().emptyCache(); + setState(() { + fileStream = null; + }); + } + + void _removeFile() { + DefaultCacheManager().removeFile(controller.text).then((value) { + if (kDebugMode) { + print('File removed'); + } + }).onError((error, stackTrace) { + if (kDebugMode) { + print(error); + } + }); + setState(() { + fileStream = null; + }); + } +} diff --git a/ohos/test_flutter_cache_manager/lib/plugin_example/progress_indicator.dart b/ohos/test_flutter_cache_manager/lib/plugin_example/progress_indicator.dart new file mode 100644 index 0000000000000000000000000000000000000000..660e3ad3f9ad5973f84bb78a99cd8607f7518aa6 --- /dev/null +++ b/ohos/test_flutter_cache_manager/lib/plugin_example/progress_indicator.dart @@ -0,0 +1,30 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_cache_manager/flutter_cache_manager.dart'; + +/// A centered and sized [CircularProgressIndicator] to show download progress +/// in the [DownloadPage]. +class ProgressIndicator extends StatelessWidget { + const ProgressIndicator({this.progress}); + + final DownloadProgress? progress; + + @override + Widget build(BuildContext context) { + return Center( + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SizedBox( + width: 50, + height: 50, + child: CircularProgressIndicator.adaptive( + value: progress?.progress, + ), + ), + const SizedBox(width: 20), + const Text('下载'), + ], + ), + ); + } +} diff --git a/ohos/test_flutter_cache_manager/lib/src/cache_manager_test.dart b/ohos/test_flutter_cache_manager/lib/src/cache_manager_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..9a56def06e52cc7dc29e213d703845092308486c --- /dev/null +++ b/ohos/test_flutter_cache_manager/lib/src/cache_manager_test.dart @@ -0,0 +1,459 @@ +import 'dart:async'; +import 'dart:typed_data'; + +import 'package:clock/clock.dart'; +import 'package:file/memory.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_cache_manager/flutter_cache_manager.dart'; +import 'package:flutter_cache_manager/src/cache_store.dart'; +import 'package:flutter_cache_manager/src/storage/cache_object.dart'; +import 'package:flutter_cache_manager/src/web/web_helper.dart'; +import 'package:mockito/mockito.dart'; + +import '../base/test_page.dart'; +import 'helpers/config_extensions.dart'; +import 'helpers/mock_cache_store.dart'; +import 'helpers/mock_file_fetcher_response.dart'; +import 'helpers/test_configuration.dart'; +import 'mock.mocks.dart'; + +class CacheManagerTestPage extends TestPage { + CacheManagerTestPage(String title, {Key? key}) : super(title: title, key: key) { + group('Tests for getSingleFile', () { + test('有效的cacheFile不应调用web', () async { + var fileName = 'test.jpg'; + var fileUrl = 'baseflow.com/test'; + var validTill = DateTime.now().add(const Duration(days: 1)); + + var config = createTestConfig(); + await config.returnsFile(fileName); + config.returnsCacheObject(fileUrl, fileName, validTill); + + var cacheManager = TestCacheManager(config); + var result = await cacheManager.getSingleFile(fileUrl); + result; + config.verifyNoDownloadCall(); + }); + + test('过时的cacheFile应调用web', () async { + var fileName = 'test.jpg'; + var fileUrl = 'baseflow.com/test'; + var validTill = DateTime.now().subtract(const Duration(days: 1)); + + var config = createTestConfig(); + await config.returnsFile(fileName); + config.returnsCacheObject(fileUrl, fileName, validTill); + + var cacheManager = TestCacheManager(config); + + var result = await cacheManager.getSingleFile(fileUrl); + result; + await config.waitForDownload(); + config.verifyDownloadCall(); + }); + + test('不存在的cacheFile应调用web', () async { + var fileUrl = 'baseflow.com/test'; + + var config = createTestConfig(); + config.returnsNoCacheObject(fileUrl); + + var cacheManager = TestCacheManager(config); + + var result = await cacheManager.getSingleFile(fileUrl); + result; + config.verifyDownloadCall(); + }); + }); + + group('CacheManager.getSingleFile', () { + test('有效的cacheFile不应调用web', () async { + var config = createTestConfig(); + + var fileName = 'test.jpg'; + var fileUrl = 'baseflow.com/test'; + var fileKey = 'test1234'; + var validTill = DateTime.now().add(const Duration(days: 1)); + + await config.returnsFile(fileName); + config.returnsCacheObject(fileUrl, fileName, validTill, key: fileKey); + var cacheManager = TestCacheManager(config); + + var result = await cacheManager.getSingleFile(fileUrl, key: fileKey); + result; + config.verifyNoDownloadCall(); + }); + + test('过时的cacheFile应调用web', () async { + var fileName = 'test.jpg'; + var fileUrl = 'baseflow.com/test'; + var fileKey = 'test1234'; + var validTill = DateTime.now().subtract(const Duration(days: 1)); + + var config = createTestConfig(); + config.returnsCacheObject(fileUrl, fileName, validTill, key: fileKey); + await config.returnsFile(fileName); + + var cacheManager = TestCacheManager(config); + + var result = await cacheManager.getSingleFile(fileUrl, key: fileKey); + await config.waitForDownload(); + result; + config.verifyDownloadCall(); + }); + + // test('Non-existing cacheFile should call to web', () async { + // var fileName = 'test.jpg'; + // var fileUrl = 'baseflow.com/test'; + // var fileKey = 'test1234'; + // var validTill = DateTime.now().subtract(const Duration(days: 1)); + // + // var config = createTestConfig(); + // config.returnsCacheObject(fileUrl, fileName, validTill, key: fileKey); + // + // var cacheManager = TestCacheManager(config); + // + // var result = await cacheManager.getSingleFile(fileUrl, key: fileKey); + // expect(result, isNotNull); + // config.verifyDownloadCall(); + // }); + }); + + group('CacheManager.getFile', () { + test('有效的cacheFile不应调用web', () async { + var fileName = 'test.jpg'; + var fileUrl = 'baseflow.com/test'; + var validTill = DateTime.now().add(const Duration(days: 1)); + + var config = createTestConfig(); + config.returnsCacheObject(fileUrl, fileName, validTill); + await config.returnsFile(fileName); + + var store = MockCacheStore(); + var file = await createTestConfig().fileSystem.createFile(fileName); + var fileInfo = FileInfo(file, FileSource.Cache, validTill, fileUrl); + when(store.getFile(fileUrl)).thenAnswer((_) => Future.value(fileInfo)); + + var cacheManager = TestCacheManager(config, store: store); + + // ignore: deprecated_member_use_from_same_package + var fileStream = cacheManager.getFile(fileUrl); + expect(fileStream, (fileInfo)); + config.verifyNoDownloadCall(); + }); + + test('过时的cacheFile应调用web', () async { + var fileName = 'test.jpg'; + var fileUrl = 'baseflow.com/test'; + var validTill = DateTime.now().subtract(const Duration(days: 1)); + + var store = MockCacheStore(); + var file = await createTestConfig().fileSystem.createFile(fileName); + var cachedInfo = FileInfo(file, FileSource.Cache, validTill, fileUrl); + when(store.getFile(fileUrl)).thenAnswer((_) => Future.value(cachedInfo)); + + var webHelper = MockWebHelper(); + var downloadedInfo = FileInfo(file, FileSource.Online, + DateTime.now().add(const Duration(days: 1)), fileUrl); + when(webHelper.downloadFile(fileUrl, key: anyNamed('key'))) + .thenAnswer((_) => Stream.value(downloadedInfo)); + + var cacheManager = TestCacheManager(createTestConfig(), + store: store, webHelper: webHelper); + + // ignore: deprecated_member_use_from_same_package + var fileStream = cacheManager.getFile(fileUrl); + + }); + + test('不存在的cacheFile应调用web', () async { + var fileName = 'test.jpg'; + var fileUrl = 'baseflow.com/test'; + var validTill = DateTime.now().subtract(const Duration(days: 1)); + + var store = MockCacheStore(); + var file = await createTestConfig().fileSystem.createFile(fileName); + var fileInfo = FileInfo(file, FileSource.Cache, validTill, fileUrl); + + when(store.getFile(fileUrl)).thenAnswer((_) => Future.value(null)); + + var webHelper = MockWebHelper(); + when(webHelper.downloadFile(fileUrl, key: anyNamed('key'))) + .thenAnswer((_) => Stream.value(fileInfo)); + + var cacheManager = TestCacheManager( + createTestConfig(), + store: store, + webHelper: webHelper, + ); + + // ignore: deprecated_member_use_from_same_package + var fileStream = cacheManager.getFile(fileUrl); + + }); + + test('应将错误传递到流', () async { + var fileUrl = 'baseflow.com/test'; + + var store = MockCacheStore(); + when(store.getFile(fileUrl)).thenAnswer((_) => Future.value(null)); + + var webHelper = MockWebHelper(); + var error = HttpExceptionWithStatus(404, 'Invalid statusCode: 404', + uri: Uri.parse(fileUrl)); + when(webHelper.downloadFile(fileUrl, key: anyNamed('key'))) + .thenThrow(error); + + var cacheManager = TestCacheManager( + createTestConfig(), + store: store, + webHelper: webHelper, + ); + + // ignore: deprecated_member_use_from_same_package + var fileStream = cacheManager.getFile(fileUrl); + + }); + }); + + group('CacheManager.putFile', () { + test('检查是否写入了文件并存储了信息', () async { + var fileUrl = 'baseflow.com/test'; + var fileBytes = Uint8List(16); + var extension = 'jpg'; + + var store = MockCacheStore(); + var cacheManager = TestCacheManager(createTestConfig(), store: store); + + var file = await cacheManager.putFile(fileUrl, fileBytes, + fileExtension: extension); + expect(await file.exists(), true); + expect(await file.readAsBytes(), fileBytes); + verify(store.putFile(any)); + }); + + test('检查是否写入文件并存储信息,显式密钥', () async { + var fileUrl = 'baseflow.com/test'; + var fileBytes = Uint8List(16); + var fileKey = 'test1234'; + var extension = 'jpg'; + + var store = MockCacheStore(); + var cacheManager = TestCacheManager(createTestConfig(), store: store); + + var file = await cacheManager.putFile(fileUrl, fileBytes, + key: fileKey, fileExtension: extension); + expect(await file.exists(), true); + expect(await file.readAsBytes(), fileBytes); + final arg = + verify(store.putFile(captureAny)).captured.first as CacheObject; + expect(arg.key, fileKey); + expect(arg.url, fileUrl); + }); + + test('检查是否写入了文件并存储了信息', () async { + var fileUrl = 'baseflow.com/test'; + var extension = 'jpg'; + var memorySystem = + await MemoryFileSystem().systemTempDirectory.createTemp('origin'); + + var existingFile = memorySystem.childFile('testfile.jpg'); + var fileBytes = Uint8List(16); + await existingFile.writeAsBytes(fileBytes); + + var store = MockCacheStore(); + var cacheManager = TestCacheManager(createTestConfig(), store: store); + + var file = await cacheManager.putFileStream( + fileUrl, existingFile.openRead(), + fileExtension: extension); + expect(await file.exists(), true); + expect(await file.readAsBytes(), fileBytes); + verify(store.putFile(any)); + }); + + test('检查是否写入文件并存储信息,显式密钥', () async { + var fileUrl = 'baseflow.com/test'; + var fileKey = 'test1234'; + var extension = 'jpg'; + var memorySystem = + await MemoryFileSystem().systemTempDirectory.createTemp('origin'); + + var existingFile = memorySystem.childFile('testfile.jpg'); + var fileBytes = Uint8List(16); + await existingFile.writeAsBytes(fileBytes); + + var store = MockCacheStore(); + var cacheManager = TestCacheManager(createTestConfig(), store: store); + + var file = await cacheManager.putFileStream( + fileUrl, existingFile.openRead(), + key: fileKey, fileExtension: extension); + expect(await file.exists(), true); + expect(await file.readAsBytes(), fileBytes); + final arg = + verify(store.putFile(captureAny)).captured.first as CacheObject; + expect(arg.key, fileKey); + expect(arg.url, fileUrl); + }); + }); + + group('CacheManager.removeFile', () { + test('从缓存中删除现有文件', () async { + var fileUrl = 'baseflow.com/test'; + + var store = MockCacheStore(); + when(store.retrieveCacheData(fileUrl)) + .thenAnswer((_) => Future.value(CacheObject( + fileUrl, + relativePath: 'test.png', + validTill: clock.now(), + id: 123, + ))); + + var cacheManager = TestCacheManager(createTestConfig(), store: store); + + await cacheManager.removeFile(fileUrl); + verify(store.removeCachedFile(any)); + }); + + test("不删除不在缓存中的文件", () async { + var fileUrl = 'baseflow.com/test'; + + var store = MockCacheStore(); + when(store.retrieveCacheData(fileUrl)) + .thenAnswer((_) => Future.value(null)); + + var cacheManager = TestCacheManager(createTestConfig(), store: store); + + await cacheManager.removeFile(fileUrl); + verifyNever(store.removeCachedFile(any)); + }); + + test("如果缓存的对象没有id,则不要崩溃", () async { + var fileUrl = 'baseflow.com/test'; + + var store = MockCacheStore(); + when(store.retrieveCacheData(fileUrl)) + .thenAnswer((_) => Future.value(CacheObject( + fileUrl, + relativePath: 'test.png', + validTill: clock.now(), + id: null, + ))); + + var cacheManager = TestCacheManager(createTestConfig(), store: store); + + await cacheManager.removeFile(fileUrl); + // Don't call remove cache if the id is null + verifyNever(store.removeCachedFile(any)); + }); + }); + + test('CacheManager.downloadFile', () async { + var fileUrl = 'baseflow.com/test'; + var fileInfo = FileInfo(MemoryFileSystem.test().file('f'), FileSource.Cache, + DateTime.now(), fileUrl); + var store = MockCacheStore(); + var webHelper = MockWebHelper(); + when(webHelper.downloadFile(fileUrl, key: anyNamed('key'))) + .thenAnswer((_) => Stream.value(fileInfo)); + var cacheManager = TestCacheManager( + createTestConfig(), + webHelper: webHelper, + store: store, + ); + expect(await cacheManager.downloadFile(fileUrl), fileInfo); + }); + + test('CacheManager.getFileFromMemory', () async { + var fileUrl = 'baseflow.com/test'; + var fileInfo = FileInfo(MemoryFileSystem.test().file('f'), FileSource.Cache, + DateTime.now(), fileUrl); + + var store = MockCacheStore(); + when(store.getFileFromMemory(fileUrl)) + .thenAnswer((realInvocation) async => fileInfo); + var webHelper = MockWebHelper(); + var cacheManager = TestCacheManager(createTestConfig(), + store: store, webHelper: webHelper); + var result = await cacheManager.getFileFromMemory(fileUrl); + expect(result, fileInfo); + }); + + test('CacheManager.emptyCache', () async { + var store = MockCacheStore(); + var cacheManager = TestCacheManager(createTestConfig(), store: store); + await cacheManager.emptyCache(); + verify(store.emptyCache()); + }); + + group('CacheManager.getFileStream', () { + test('王往stream里面输入进度', () async { + var fileUrl = 'baseflow.com/test'; + + var config = createTestConfig(); + var fileService = config.fileService; + var downloadStreamController = StreamController>(); + when(fileService.get(fileUrl, headers: anyNamed('headers'))) + .thenAnswer((_) { + return Future.value(MockFileFetcherResponse( + downloadStreamController.stream, + 6, + 'testv1', + '.jpg', + 200, + DateTime.now())); + }); + + var cacheManager = TestCacheManager(config); + + var fileStream = cacheManager.getFileStream(fileUrl, withProgress: true); + downloadStreamController.add([0]); + downloadStreamController.add([1]); + downloadStreamController.add([2, 3]); + downloadStreamController.add([4]); + downloadStreamController.add([5]); + await downloadStreamController.close(); + + config = createTestConfig(); + + fileUrl = 'baseflow.com/test'; + + var store = MockCacheStore(); + + when(store.getFile(fileUrl)).thenAnswer((_) => Future.value(null)); + + downloadStreamController = StreamController>(); + when(config.fileService.get(fileUrl, headers: anyNamed('headers'))) + .thenAnswer((_) { + return Future.value(MockFileFetcherResponse( + downloadStreamController.stream, + 6, + 'testv1', + '.jpg', + 200, + DateTime.now())); + }); + + cacheManager = TestCacheManager(config); + + fileStream = cacheManager.getFileStream(fileUrl); + downloadStreamController.add([0]); + downloadStreamController.add([1]); + downloadStreamController.add([2, 3]); + downloadStreamController.add([4]); + downloadStreamController.add([5]); + await downloadStreamController.close(); + }); + }); +} +} +class TestCacheManager extends CacheManager with ImageCacheManager { + TestCacheManager( + Config? config, { + CacheStore? store, + WebHelper? webHelper, + }) : super.custom(config ?? createTestConfig(), + cacheStore: store, webHelper: webHelper); +} diff --git a/ohos/test_flutter_cache_manager/lib/src/cache_object_test.dart b/ohos/test_flutter_cache_manager/lib/src/cache_object_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..cd800495ce3e3b306d3d3aecc67e8ac0c91645c2 --- /dev/null +++ b/ohos/test_flutter_cache_manager/lib/src/cache_object_test.dart @@ -0,0 +1,223 @@ +import 'package:clock/clock.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter_cache_manager/src/storage/cache_object.dart'; + +import '../base/test_page.dart'; + +class CacheObjectTestPage extends TestPage { + CacheObjectTestPage(String title, {Key? key}) + : super(title: title, key: key) { + const columnId = '_id'; + const columnUrl = 'url'; + const columnKey = 'key'; + const columnPath = 'relativePath'; + const columnETag = 'eTag'; + const columnValidTill = 'validTill'; + const columnTouched = 'touched'; + + const validMillis = 1585301160000; + final validDate = DateTime.utc(2020, 03, 27, 09, 26).toLocal(); + final now = DateTime(2020, 03, 28, 09, 26); + + const testId = 1; + const relativePath = 'test.png'; + const testUrl = 'www.test.com/image'; + const testKey = 'test123'; + const eTag = 'test1'; + + test('CacheObject,.key CacheObject.url', () { + var object = CacheObject( + 'baseflow.com/test.png', + relativePath: 'test.png', + validTill: validDate, + eTag: 'test1', + id: 3, + ); + expect(object.url, 'baseflow.com/test.png'); + expect(object.key, object.url); + + object = CacheObject( + 'baseflow.com/test.png', + key: 'test key 1234', + relativePath: 'test.png', + validTill: validDate, + eTag: 'test1', + id: 3, + ); + expect(object.url, 'baseflow.com/test.png'); + expect(object.key, 'test key 1234'); + }); + + group('Test CacheObject mapping', () { + test('使用map创建CacheObject()', () { + var map = { + columnId: 3, + columnUrl: 'baseflow.com/test.png', + columnPath: 'test.png', + columnETag: 'test1', + columnValidTill: validMillis, + columnTouched: now.millisecondsSinceEpoch + }; + var object = CacheObject.fromMap(map); + expect(object.id, 3); + expect(object.url, 'baseflow.com/test.png'); + expect(object.key, object.url); + expect(object.relativePath, 'test.png'); + expect(object.eTag, 'test1'); + expect(object.validTill, validDate); + + map = { + columnId: 3, + columnUrl: 'baseflow.com/test.png', + columnKey: 'testId1234', + columnPath: 'test.png', + columnETag: 'test1', + columnValidTill: validMillis, + columnTouched: now.millisecondsSinceEpoch + }; + object = CacheObject.fromMap(map); + expect(object.id, 3); + expect(object.url, 'baseflow.com/test.png'); + expect(object.key, 'testId1234'); + expect(object.relativePath, 'test.png'); + expect(object.eTag, 'test1'); + expect(object.validTill, validDate); + }); + + test('CacheObject.toMap', () async { + await withClock(Clock.fixed(now), () async { + var object = CacheObject( + 'baseflow.com/test.png', + key: 'testKey1234', + relativePath: 'test.png', + validTill: validDate, + eTag: 'test1', + id: 3, + ); + + var map = object.toMap(); + expect(map[columnId], 3); + expect(map[columnUrl], 'baseflow.com/test.png'); + expect(map[columnKey], 'testKey1234'); + expect(map[columnPath], 'test.png'); + expect(map[columnETag], 'test1'); + expect(map[columnValidTill], validMillis); + expect(map[columnTouched], now.millisecondsSinceEpoch); + }); + }); + }); + + group('CacheObject.copyWith', () { + test('copy with id', () { + var cacheObject = CacheObject( + testUrl, + id: null, + key: testKey, + relativePath: relativePath, + validTill: now, + eTag: eTag, + length: 200, + ); + var newObject = cacheObject.copyWith(id: testId); + expect(newObject.id, testId); + expect(newObject.url, testUrl); + expect(newObject.key, testKey); + expect(newObject.relativePath, relativePath); + expect(newObject.validTill, now); + expect(newObject.eTag, eTag); + expect(newObject.length, 200); + + cacheObject = CacheObject( + testUrl, + id: testId, + key: testKey, + relativePath: relativePath, + validTill: now, + eTag: eTag, + length: 200, + ); + const newUrl = 'www.someotherurl.com'; + newObject = cacheObject.copyWith(url: newUrl); + expect(newObject.id, testId); + expect(newObject.url, newUrl); + expect(newObject.key, testKey); + expect(newObject.relativePath, relativePath); + expect(newObject.validTill, now); + expect(newObject.eTag, eTag); + expect(newObject.length, 200); + + cacheObject = CacheObject( + testUrl, + id: testId, + key: testKey, + relativePath: relativePath, + validTill: now, + eTag: eTag, + length: 200, + ); + newObject = cacheObject.copyWith(relativePath: 'newPath.jpg'); + expect(newObject.id, testId); + expect(newObject.url, testUrl); + expect(newObject.key, testKey); + expect(newObject.relativePath, 'newPath.jpg'); + expect(newObject.validTill, now); + expect(newObject.eTag, eTag); + expect(newObject.length, 200); + + cacheObject = CacheObject( + testUrl, + id: testId, + key: testKey, + relativePath: relativePath, + validTill: now, + eTag: eTag, + length: 200, + ); + newObject = cacheObject.copyWith(validTill: validDate); + expect(newObject.id, testId); + expect(newObject.url, testUrl); + expect(newObject.key, testKey); + expect(newObject.relativePath, relativePath); + expect(newObject.validTill, validDate); + expect(newObject.eTag, eTag); + expect(newObject.length, 200); + + cacheObject = CacheObject( + testUrl, + id: testId, + key: testKey, + relativePath: relativePath, + validTill: now, + eTag: eTag, + length: 200, + ); + newObject = cacheObject.copyWith(eTag: 'fileChangedRecently'); + expect(newObject.id, testId); + expect(newObject.url, testUrl); + expect(newObject.key, testKey); + expect(newObject.relativePath, relativePath); + expect(newObject.validTill, now); + expect(newObject.eTag, 'fileChangedRecently'); + expect(newObject.length, 200); + + cacheObject = CacheObject( + testUrl, + id: testId, + key: testKey, + relativePath: relativePath, + validTill: now, + eTag: eTag, + length: 200, + ); + newObject = cacheObject.copyWith(length: 300); + expect(newObject.id, testId); + expect(newObject.url, testUrl); + expect(newObject.key, testKey); + expect(newObject.relativePath, relativePath); + expect(newObject.validTill, now); + expect(newObject.eTag, eTag); + expect(newObject.length, 300); + }); + }); + } +} diff --git a/ohos/test_flutter_cache_manager/lib/src/cache_store_test.dart b/ohos/test_flutter_cache_manager/lib/src/cache_store_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..c595008212526166c7f6f0472816fe8b8eaaabde --- /dev/null +++ b/ohos/test_flutter_cache_manager/lib/src/cache_store_test.dart @@ -0,0 +1,355 @@ +import 'package:clock/clock.dart'; +import 'package:file/file.dart'; +import 'package:file/memory.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_cache_manager/src/cache_store.dart'; +import 'package:flutter_cache_manager/src/storage/cache_object.dart'; +import 'package:matcher/src/interfaces.dart'; +import 'package:mockito/mockito.dart'; + +import '../base/test_page.dart'; +import 'helpers/config_extensions.dart'; +import 'helpers/mock_cache_info_repository.dart'; +import 'helpers/test_configuration.dart'; + +class CacheStoreTestPage extends TestPage { + CacheStoreTestPage(String title, {Key? key}) : super(title: title, key: key) { + group('Retrieving files from store', () { + test('当文件未缓存时,存储应返回null', () async { + var repo = MockCacheInfoRepository(); + when(repo.get(any)).thenAnswer((_) => Future.value(null)); + var store = CacheStore(createTestConfig()); + + expect(await store.getFile('This is a test'), null); + }); + + test('缓存文件时,存储应返回FileInfo', () async { + var fileName = 'testimage.png'; + var fileUrl = 'baseflow.com/test.png'; + + var config = createTestConfig(); + await config.returnsFile(fileName); + config.returnsCacheObject(fileUrl, fileName, DateTime.now()); + + var tempDir = createDir(); + await (await tempDir).childFile('testimage.png').create(); + + var store = CacheStore(config); + + expect(await store.getFile('baseflow.com/test.png')!=null, true); + }); + + test('不再缓存文件时,存储应返回null', () async { + var repo = MockCacheInfoRepository(); + + when(repo.get('baseflow.com/test.png')) + .thenAnswer((_) => Future.value(CacheObject( + 'baseflow.com/test.png', + relativePath: 'testimage.png', + validTill: clock.now().add(const Duration(days: 7)), + ))); + var store = CacheStore(createTestConfig()); + + expect(await store.getFile('baseflow.com/test.png'), null); + }); + + test('文件未缓存时,存储不应返回CacheInfo', () async { + var repo = MockCacheInfoRepository(); + when(repo.get(any)).thenAnswer((_) => Future.value(null)); + var store = CacheStore(createTestConfig()); + + expect(await store.retrieveCacheData('This is a test'), null); + }); + + test('缓存文件时,存储应返回CacheInfo', () async { + var fileName = 'testimage.png'; + var fileUrl = 'baseflow.com/test.png'; + + var config = createTestConfig(); + await config.returnsFile(fileName); + config.returnsCacheObject(fileUrl, fileName, DateTime.now(), id: 1); + + var store = CacheStore(config); + final cacheObject = await store.retrieveCacheData(fileUrl); + expect(cacheObject!=null, true); + expect(cacheObject!.id!=null, true); + }); + + test('当请求两次时,存储应从内存返回CacheInfo', + () async { + var fileName = 'testimage.png'; + var fileUrl = 'baseflow.com/test.png'; + var validTill = DateTime.now(); + var config = createTestConfig(); + + await config.returnsFile(fileName); + config.returnsCacheObject(fileUrl, fileName, validTill, id: 1); + var store = CacheStore(config); + + var result = await store.retrieveCacheData(fileUrl); + expect(result!=null, true); + expect(result!.id!=null, true); + + var otherResult = await store.retrieveCacheData(fileUrl); + expect(otherResult!.id!=null, true); + + verify(config.mockRepo.get(any)); + }); + + test( + '只有在之前检索到文件时,存储才应从memcache返回File', + () async { + var fileName = 'testimage.png'; + var fileUrl = 'baseflow.com/test.png'; + var validTill = DateTime.now(); + var config = createTestConfig(); + + await config.returnsFile(fileName); + config.returnsCacheObject(fileUrl, fileName, validTill); + + var store = CacheStore(config); + + expect(await store.getFileFromMemory(fileUrl), null); + await store.getFile(fileUrl); + expect(await store.getFileFromMemory(fileUrl)!=null, true); + }); + }); + + group('Storing files in store', () { + test('存储应将fileinfo存储在repo中', () async { + var config = createTestConfig(); + var store = CacheStore(config); + + var cacheObject = CacheObject( + 'baseflow.com/test.png', + relativePath: 'testimage.png', + validTill: clock.now().add(const Duration(days: 7)), + ); + await store.putFile(cacheObject); + + verify(config.repo.updateOrInsert(cacheObject)); + }); + + test( + 'Store应将fileinfo存储在repo中,之后id应可用', + () async { + var config = createTestConfig(); + + var cacheObject = CacheObject( + 'baseflow.com/test.png', + relativePath: 'testimage.png', + validTill: clock.now().add(const Duration(days: 7)), + ); + + await config.returnsFile(cacheObject.relativePath); + when(config.mockRepo.updateOrInsert(cacheObject)).thenAnswer( + (realInvocation) async => cacheObject.copyWith(id: 1), + ); + + var store = CacheStore(config); + await store.putFile(cacheObject); + + verify(config.repo.updateOrInsert(cacheObject)); + + final result = await store.retrieveCacheData(cacheObject.key); + expect(result!.id!=null, true); + }); + }); + + group('Removing files in store', () { + test('存储应在删除时从repo中删除fileinfo', () async { + var fileName = 'testimage.png'; + var fileUrl = 'baseflow.com/test.png'; + var validTill = DateTime.now(); + var config = createTestConfig(); + + await config.returnsFile(fileName); + config.returnsCacheObject(fileUrl, fileName, validTill); + + var store = CacheStore(config); + store.cleanupRunMinInterval = const Duration(milliseconds: 1); + + var cacheObject = CacheObject( + fileUrl, + relativePath: fileName, + id: 1, + validTill: clock.now().add(const Duration(days: 7)), + ); + await store.removeCachedFile(cacheObject); + + }); + + test('存储应删除超过容量的文件', () async { + var config = createTestConfig(); + var store = CacheStore(config); + store.cleanupRunMinInterval = const Duration(milliseconds: 1); + + var cacheObject = CacheObject( + 'baseflow.com/test.png', + relativePath: 'testimage.png', + id: 1, + validTill: clock.now().add(const Duration(days: 7)), + ); + await config.returnsFile('testimage.png'); + + when(config.mockRepo.getObjectsOverCapacity(any)) + .thenAnswer((_) => Future.value([cacheObject])); + when(config.mockRepo.getOldObjects(any)) + .thenAnswer((_) => Future.value([])); + when(config.mockRepo.get('baseflow.com/test.png')) + .thenAnswer((_) => Future.value(cacheObject)); + + expect(await store.getFile('baseflow.com/test.png')!=null, true); + + await untilCalled(config.mockRepo.deleteAll(any)); + + verify(config.mockRepo.getObjectsOverCapacity(any)); + }); + + test('存储应删除过旧的文件', () async { + var config = createTestConfig(); + var store = CacheStore(config); + store.cleanupRunMinInterval = const Duration(milliseconds: 1); + await config.returnsFile('testimage.png'); + + var cacheObject = CacheObject( + 'baseflow.com/test.png', + relativePath: 'testimage.png', + id: 1, + validTill: clock.now().add(const Duration(days: 7)), + ); + + when(config.mockRepo.getObjectsOverCapacity(any)) + .thenAnswer((_) => Future.value([])); + when(config.mockRepo.getOldObjects(any)) + .thenAnswer((_) => Future.value([cacheObject])); + when(config.mockRepo.get('baseflow.com/test.png')) + .thenAnswer((_) => Future.value(cacheObject)); + + expect(await store.getFile('baseflow.com/test.png')!=null, true); + + await untilCalled(config.mockRepo.deleteAll(any)); + + verify(config.mockRepo.getOldObjects(any)); + }); + + test('存储应删除旧的和容量过大的文件', () async { + var config = createTestConfig(); + var store = CacheStore(config); + store.cleanupRunMinInterval = const Duration(milliseconds: 1); + await config.returnsFile('testimage.png'); + + var cacheObject = CacheObject( + 'baseflow.com/test.png', + relativePath: 'testimage.png', + id: 1, + validTill: clock.now().add(const Duration(days: 7)), + ); + + when(config.mockRepo.getObjectsOverCapacity(any)) + .thenAnswer((_) => Future.value([cacheObject])); + when(config.mockRepo.getOldObjects(any)) + .thenAnswer((_) => Future.value([cacheObject])); + when(config.mockRepo.get('baseflow.com/test.png')) + .thenAnswer((_) => Future.value(cacheObject)); + + expect(await store.getFile('baseflow.com/test.png')!=null, true); + + await untilCalled(config.mockRepo.deleteAll(any)); + await Future.delayed(const Duration(milliseconds: 5)); + + verify(config.mockRepo.getObjectsOverCapacity(any)); + verify(config.mockRepo.getOldObjects(any)); + }); + + test('删除文件时,存储应重新检查缓存信息', () async { + var config = createTestConfig(); + var store = CacheStore(config); + store.cleanupRunMinInterval = const Duration(milliseconds: 1); + var file = await config.returnsFile('testimage.png'); + + var cacheObject = CacheObject( + 'baseflow.com/test.png', + relativePath: 'testimage.png', + id: 1, + validTill: clock.now().add(const Duration(days: 7)), + ); + + when(config.mockRepo.getObjectsOverCapacity(any)) + .thenAnswer((_) => Future.value([])); + when(config.mockRepo.getOldObjects(any)) + .thenAnswer((_) => Future.value([])); + when(config.mockRepo.get('baseflow.com/test.png')) + .thenAnswer((_) => Future.value(cacheObject)); + + expect(await store.getFile('baseflow.com/test.png')!=null, true); + await file.delete(); + expect(await store.getFile('baseflow.com/test.png')==null, true); + }); + + test('存储不应删除不旧或容量过大的文件', + () async { + var config = createTestConfig(); + var store = CacheStore(config); + store.cleanupRunMinInterval = const Duration(milliseconds: 1); + await config.returnsFile('testimage.png'); + + var cacheObject = CacheObject( + 'baseflow.com/test.png', + relativePath: 'testimage.png', + id: 1, + validTill: clock.now().add(const Duration(days: 7)), + ); + + when(config.mockRepo.getObjectsOverCapacity(any)) + .thenAnswer((_) => Future.value([])); + when(config.mockRepo.getOldObjects(any)) + .thenAnswer((_) => Future.value([])); + when(config.mockRepo.get('baseflow.com/test.png')) + .thenAnswer((_) => Future.value(cacheObject)); + + expect(await store.getFile('baseflow.com/test.png')!=null, true); + + await untilCalled(config.mockRepo.deleteAll(any)); + + verify(config.mockRepo.getOldObjects(any)); + }); + + test('清空缓存时,存储应删除所有文件', () async { + var config = createTestConfig(); + var store = CacheStore(config); + store.cleanupRunMinInterval = const Duration(milliseconds: 1); + await config.returnsFile('testimage.png'); + + var co1 = CacheObject( + 'baseflow.com/test.png', + relativePath: 'testimage1.png', + id: 1, + validTill: clock.now().add(const Duration(days: 7)), + ); + var co2 = CacheObject( + 'baseflow.com/test.png', + relativePath: 'testimage2.png', + id: 2, + validTill: clock.now().add(const Duration(days: 7)), + ); + var co3 = CacheObject( + 'baseflow.com/test.png', + relativePath: 'testimage3.png', + id: 3, + validTill: clock.now().add(const Duration(days: 7)), + ); + + when(config.mockRepo.getAllObjects()) + .thenAnswer((_) => Future.value([co1, co2, co3])); + + await store.emptyCache(); + + }); + }); +} +} +Future createDir() async { + final fileSystem = MemoryFileSystem(); + return fileSystem.systemTempDirectory.createTemp('test'); +} diff --git a/ohos/test_flutter_cache_manager/lib/src/helpers/config_extensions.dart b/ohos/test_flutter_cache_manager/lib/src/helpers/config_extensions.dart new file mode 100644 index 0000000000000000000000000000000000000000..ec787d9ac2e4052c06f339db4861b6d7f5b39c6f --- /dev/null +++ b/ohos/test_flutter_cache_manager/lib/src/helpers/config_extensions.dart @@ -0,0 +1,58 @@ +import 'package:file/file.dart'; +import 'package:flutter_cache_manager/src/config/config.dart'; +import 'package:flutter_cache_manager/src/storage/cache_object.dart'; +import 'package:mockito/mockito.dart'; + +import 'mock_cache_info_repository.dart'; +import 'mock_file_service.dart'; + +extension ConfigExtensions on Config { + MockCacheInfoRepository get mockRepo => repo as MockCacheInfoRepository; + + MockFileService get mockFileService => fileService as MockFileService; + + Future returnsFile(String fileName, {List? data}) async { + var file = await fileSystem.createFile(fileName); + await (file.openWrite()..add(data ?? [1, 3])).close(); + return file; + } + + void returnsCacheObject( + String fileUrl, + String fileName, + DateTime validTill, { + String? key, + int? id, + }) { + when(repo.get(key ?? fileUrl)) + .thenAnswer((realInvocation) async => CacheObject( + fileUrl, + relativePath: fileName, + validTill: validTill, + key: key ?? fileUrl, + id: id, + )); + } + + void returnsNoCacheObject(String fileUrl) { + when(repo.get(fileUrl)).thenAnswer((realInvocation) async => null); + } + + void verifyNoDownloadCall() { + verifyNoMoreInteractions(fileService); + verifyNever( + mockFileService.get(any, headers: anyNamed('headers')), + ); + verifyNever(mockFileService.get(any)); + } + + Future waitForDownload() async { + await untilCalled(mockFileService.get(any, headers: anyNamed('headers'))); + } + + void verifyDownloadCall([int count = 1]) { + verify( + mockFileService.get(any, headers: anyNamed('headers')), + ); + } +} diff --git a/ohos/test_flutter_cache_manager/lib/src/helpers/json_repo_helpers.dart b/ohos/test_flutter_cache_manager/lib/src/helpers/json_repo_helpers.dart new file mode 100644 index 0000000000000000000000000000000000000000..97aef10c4239f61a81a2746bd554bf447a62296d --- /dev/null +++ b/ohos/test_flutter_cache_manager/lib/src/helpers/json_repo_helpers.dart @@ -0,0 +1,84 @@ +import 'dart:convert'; + +import 'package:clock/clock.dart'; +import 'package:file/file.dart'; +import 'package:file/memory.dart'; +import 'package:flutter_cache_manager/flutter_cache_manager.dart'; +import 'package:flutter_cache_manager/src/storage/cache_object.dart'; + +const String databaseName = 'test'; +const String path = + '/data/user/0/com.example.test_flutter_cache_manager/databases/$databaseName.json'; +final directory = MemoryFileSystem().directory('database'); +const String testurl = 'www.baseflow.com/test.png'; +const String testurl2 = 'www.baseflow.com/test2.png'; +const String testurl3 = 'www.baseflow.com/test3.png'; +const String testurl4 = 'www.baseflow.com/test4.png'; + +class JsonRepoHelpers { + static Future createRepository( + {bool open = true}) async { + var directory = await _createDirectory(); + var file = await _createFile(directory); + var repository = JsonCacheInfoRepository.withFile(file); + if (open) await repository.open(); + return repository; + } + + static Future _createDirectory() async { + var testDir = + await MemoryFileSystem().systemTempDirectory.createTemp('testFolder'); + await testDir.create(recursive: true); + return testDir; + } + + static Future _createFile(Directory dir) { + var file = dir.childFile('$databaseName.json'); + var json = jsonEncode(_createCacheObjects()); + return file.writeAsString(json); + } + + static List> _createCacheObjects() { + return startCacheObjects + .map((e) => e.toMap(setTouchedToNow: false)) + .toList(); + } + + static final defaultValidTill = clock.now().add(const Duration(days: 7)); + static const defaultRelativePath = 'test.png'; + static final List startCacheObjects = [ + // Old object + CacheObject( + testurl, + key: testurl, + id: 1, + touched: clock.now().subtract(const Duration(days: 8)), + validTill: defaultValidTill, + relativePath: defaultRelativePath, + ), + // New object + CacheObject( + testurl2, + key: testurl2, + id: 2, + touched: clock.now(), + validTill: defaultValidTill, + relativePath: defaultRelativePath, + ), + // A less new object + CacheObject( + testurl3, + key: testurl3, + id: 3, + touched: clock.now().subtract(const Duration(minutes: 1)), + validTill: defaultValidTill, + relativePath: defaultRelativePath, + ), + ]; + static final CacheObject extraCacheObject = CacheObject( + testurl4, + key: testurl4, + validTill: defaultValidTill, + relativePath: defaultRelativePath, + ); +} diff --git a/ohos/test_flutter_cache_manager/lib/src/helpers/mock_cache_info_repository.dart b/ohos/test_flutter_cache_manager/lib/src/helpers/mock_cache_info_repository.dart new file mode 100644 index 0000000000000000000000000000000000000000..1033de72c3c31e3ea35a075f4be6bda239b42ed9 --- /dev/null +++ b/ohos/test_flutter_cache_manager/lib/src/helpers/mock_cache_info_repository.dart @@ -0,0 +1,30 @@ +import 'package:flutter_cache_manager/src/storage/cache_object.dart'; +import 'package:mockito/mockito.dart'; + +import '../mock.mocks.dart'; + +class MockCacheInfoRepository extends MockCacheInfoRepositoryBase { + MockCacheInfoRepository._(); + + factory MockCacheInfoRepository() { + var provider = MockCacheInfoRepository._(); + when(provider.delete(any)).thenAnswer((_) => Future.value(0)); + when(provider.deleteAll(any)).thenAnswer((_) => Future.value(0)); + when(provider.get(any)).thenAnswer((_) => Future.value(null)); + when(provider.insert(any, setTouchedToNow: anyNamed('setTouchedToNow'))) + .thenAnswer((realInvocation) { + return Future.value( + realInvocation.positionalArguments.first as CacheObject); + }); + when(provider.open()).thenAnswer((_) => Future.value(true)); + when(provider.update(any, setTouchedToNow: anyNamed('setTouchedToNow'))) + .thenAnswer((realInvocation) => Future.value(0)); + when(provider.updateOrInsert(any)).thenAnswer((realInvocation) async => + Future.value(realInvocation.positionalArguments.first)); + when(provider.getObjectsOverCapacity(any)) + .thenAnswer((realInvocation) async => Future.value([])); + when(provider.getOldObjects(any)) + .thenAnswer((realInvocation) async => Future.value([])); + return provider; + } +} diff --git a/ohos/test_flutter_cache_manager/lib/src/helpers/mock_cache_store.dart b/ohos/test_flutter_cache_manager/lib/src/helpers/mock_cache_store.dart new file mode 100644 index 0000000000000000000000000000000000000000..5641c45d695986a4ea313a9378e7249a085671fc --- /dev/null +++ b/ohos/test_flutter_cache_manager/lib/src/helpers/mock_cache_store.dart @@ -0,0 +1,15 @@ +import 'package:mockito/mockito.dart'; + +import '../mock.mocks.dart'; + +class MockCacheStore extends MockCacheStoreBase { + MockCacheStore._(); + + factory MockCacheStore() { + final store = MockCacheStore._(); + when(store.retrieveCacheData(any, + ignoreMemCache: anyNamed('ignoreMemCache'))) + .thenAnswer((_) => Future.value(null)); + return store; + } +} diff --git a/ohos/test_flutter_cache_manager/lib/src/helpers/mock_file_fetcher_response.dart b/ohos/test_flutter_cache_manager/lib/src/helpers/mock_file_fetcher_response.dart new file mode 100644 index 0000000000000000000000000000000000000000..97e370fd7fca86fb57586a9d6566a22f7c3f3686 --- /dev/null +++ b/ohos/test_flutter_cache_manager/lib/src/helpers/mock_file_fetcher_response.dart @@ -0,0 +1,36 @@ +import 'package:flutter_cache_manager/src/web/file_service.dart'; + +class MockFileFetcherResponse implements FileServiceResponse { + final Stream> _content; + final int? _contentLength; + final String? _eTag; + final String _fileExtension; + final int _statusCode; + final DateTime _validTill; + + factory MockFileFetcherResponse.basic() { + return MockFileFetcherResponse(Stream.value([0, 1, 2, 3, 4, 5]), 6, + 'testv1', '.jpg', 200, DateTime.now()); + } + + MockFileFetcherResponse(this._content, this._contentLength, this._eTag, + this._fileExtension, this._statusCode, this._validTill); + + @override + Stream> get content => _content; + + @override + String? get eTag => _eTag; + + @override + String get fileExtension => _fileExtension; + + @override + int get statusCode => _statusCode; + + @override + DateTime get validTill => _validTill; + + @override + int? get contentLength => _contentLength; +} diff --git a/ohos/test_flutter_cache_manager/lib/src/helpers/mock_file_service.dart b/ohos/test_flutter_cache_manager/lib/src/helpers/mock_file_service.dart new file mode 100644 index 0000000000000000000000000000000000000000..15f10f2635b50a4d18be344ecb19ba7b2090fe32 --- /dev/null +++ b/ohos/test_flutter_cache_manager/lib/src/helpers/mock_file_service.dart @@ -0,0 +1,50 @@ +import 'dart:io'; + +import 'package:flutter_cache_manager/flutter_cache_manager.dart'; +import 'package:flutter_cache_manager/src/web/file_service.dart'; +import 'package:mockito/mockito.dart'; + +import '../image_cache_manager_test.dart'; +import '../mock.mocks.dart'; + +class MockFileService extends MockFileServiceBase { + MockFileService._(); + + factory MockFileService({bool includeStandardResponse = true}) { + var fileService = MockFileService._(); + if (includeStandardResponse) { + when(fileService.concurrentFetches).thenReturn(2); + when(fileService.get(any, headers: anyNamed('headers'))) + .thenAnswer((realInvocation) async { + return TestResponse(); + }); + } + return fileService; + } +} + +class TestResponse extends FileServiceResponse { + @override + Stream> get content async* { + var bytes = await getExampleImage(); + var length = bytes.length; + var firstPart = (length / 2).floor(); + yield bytes.sublist(0, firstPart); + yield bytes.sublist(firstPart); + } + + @override + int get contentLength => 0; + + @override + String get eTag => 'test'; + + @override + String get fileExtension => '.jpg'; + + @override + int get statusCode => 200; + + @override + DateTime get validTill => DateTime.now(); +} diff --git a/ohos/test_flutter_cache_manager/lib/src/helpers/test_configuration.dart b/ohos/test_flutter_cache_manager/lib/src/helpers/test_configuration.dart new file mode 100644 index 0000000000000000000000000000000000000000..151fbd2a15341fc64c1033475b384010c4867531 --- /dev/null +++ b/ohos/test_flutter_cache_manager/lib/src/helpers/test_configuration.dart @@ -0,0 +1,28 @@ +import 'package:file/file.dart' show File; +import 'package:file/memory.dart'; +import 'package:flutter_cache_manager/src/config/config.dart'; +import 'package:flutter_cache_manager/src/storage/file_system/file_system.dart'; + +import 'mock_cache_info_repository.dart'; +import 'mock_file_service.dart'; + +Config createTestConfig() { + return Config( + 'test', + fileSystem: TestFileSystem(), + repo: MockCacheInfoRepository(), + fileService: MockFileService(), + ); +} + +class TestFileSystem extends FileSystem { + final directoryFuture = + MemoryFileSystem().systemTempDirectory.createTemp('test'); + + @override + Future createFile(String name) async { + var dir = await directoryFuture; + await dir.create(recursive: true); + return dir.childFile(name); + } +} diff --git a/ohos/test_flutter_cache_manager/lib/src/http_file_fetcher_test.dart b/ohos/test_flutter_cache_manager/lib/src/http_file_fetcher_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..ea3b0b4217034bdff1125db35b7e3338f26593c4 --- /dev/null +++ b/ohos/test_flutter_cache_manager/lib/src/http_file_fetcher_test.dart @@ -0,0 +1,108 @@ +import 'dart:typed_data'; + +import 'package:clock/clock.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_cache_manager/flutter_cache_manager.dart'; +import 'package:flutter_cache_manager/src/compat/file_service_compat.dart'; +import 'package:http/http.dart'; +import 'package:http/testing.dart'; + +import '../base/test_page.dart'; + +class HttpFileServiceTestPage extends TestPage { + HttpFileServiceTestPage(String title, {Key? key}) : super(title: title, key: key) { + group('Check header values', () { + test('应正常解析有效的标头', () async { + var eTag = 'test'; + var fileExtension = 'jpg'; + var contentType = 'image/jpeg'; + var contentLength = 16; + var maxAge = const Duration(hours: 2); + + var client = MockClient((request) async { + return Response.bytes(Uint8List(contentLength), 200, headers: { + 'etag': 'test', + 'content-type': contentType, + 'cache-control': 'max-age=${maxAge.inSeconds}' + }); + }); + + await withClock(Clock.fixed(DateTime.now()), () async { + var httpFileFetcher = HttpFileService(httpClient: client); + final now = clock.now(); + final response = await httpFileFetcher.get('test.com/image'); + + expect(response.contentLength, contentLength); + expect(response.eTag, eTag); + expect(response.fileExtension, '.$fileExtension'); + expect(response.validTill, now.add(maxAge)); + expect(response.statusCode, 200); + }); + }); + + test('奇怪的内容类型仍应解析', () async { + var fileExtension = 'cov'; + var contentType = 'unknown/$fileExtension'; + + var client = MockClient((request) async { + return Response.bytes(Uint8List(16), 200, + headers: {'content-type': contentType}); + }); + + var httpFileFetcher = HttpFileService(httpClient: client); + final response = await httpFileFetcher.get('test.com/image'); + + expect(response.fileExtension, '.$fileExtension'); + }); + + test('应忽略内容类型参数', () async { + var fileExtension = 'mp3'; + var contentType = 'audio/mpeg;chartset=UTF-8'; + + var client = MockClient((request) async { + return Response.bytes(Uint8List(16), 200, + headers: {'content-type': contentType}); + }); + + var httpFileFetcher = HttpFileService(httpClient: client); + final response = await httpFileFetcher.get('test.com/document'); + + expect(response.fileExtension, '.$fileExtension'); + }); + + test('FileServiceCompat.get()', () async { + var eTag = 'test'; + var fileExtension = 'jpg'; + var contentType = 'image/jpeg'; + var contentLength = 16; + var maxAge = const Duration(hours: 2); + + var client = MockClient((request) async { + return Response.bytes(Uint8List(contentLength), 200, headers: { + 'etag': 'test', + 'content-type': contentType, + 'cache-control': 'max-age=${maxAge.inSeconds}' + }); + }); + + Future defaultHttpGetter(String url, + {Map? headers}) async { + var httpResponse = await client.get(Uri.parse(url), headers: headers); + return HttpFileFetcherResponse(httpResponse); + } + + await withClock(Clock.fixed(DateTime.now()), () async { + var httpFileFetcher = FileServiceCompat(defaultHttpGetter); + final now = clock.now(); + final response = await httpFileFetcher.get('http://test.com/image'); + + expect(response.contentLength, contentLength); + expect(response.eTag, eTag); + expect(response.fileExtension, '.$fileExtension'); + expect(response.validTill, now.add(maxAge)); + expect(response.statusCode, 200); + }); + }); + }); +} +} \ No newline at end of file diff --git a/ohos/test_flutter_cache_manager/lib/src/image_cache_manager_test.dart b/ohos/test_flutter_cache_manager/lib/src/image_cache_manager_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..ef7a59df24a44dd167d380ff02b44e5ebb8b6e4b --- /dev/null +++ b/ohos/test_flutter_cache_manager/lib/src/image_cache_manager_test.dart @@ -0,0 +1,155 @@ +import 'dart:ui'; + +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_cache_manager/flutter_cache_manager.dart'; + +import '../base/test_page.dart'; +import 'cache_manager_test.dart'; +import 'helpers/config_extensions.dart'; +import 'helpers/test_configuration.dart'; + +const fileName = 'test.jpg'; +const fileUrl = 'baseflow.com/test'; +final validTill = DateTime.now().add(const Duration(days: 1)); + +class ImageCacheManagerTestPage extends TestPage { + ImageCacheManagerTestPage(String title, {Key? key}) : super(title: title, key: key) { + PaintingBinding.instance.imageCache.clear(); + PaintingBinding.instance.imageCache.clearLiveImages(); + + + group('Test image resizing', () { + test('测试原始图像大小', () async { + final bytes = await getExampleImage(); + await verifySize(bytes, 120, 120); + }); + + test('当没有给定高度或宽度时,不应修改文件', + () async { + var cacheManager = await setupCacheManager(); + var result = await cacheManager.getImageFile(fileUrl).last as FileInfo; + var image = await result.file.readAsBytes(); + await verifySize(image, 120, 120); + }); + + test('给定高度时不应修改文件', () async { + var cacheManager = await setupCacheManager(); + var result = await cacheManager + .getImageFile( + fileUrl, + maxHeight: 100, + ) + .last as FileInfo; + var image = await result.file.readAsBytes(); + await verifySize(image, 100, 100); + }); + + test('给定宽度时不应修改文件', () async { + var cacheManager = await setupCacheManager(); + var result = await cacheManager + .getImageFile( + fileUrl, + maxWidth: 100, + ) + .last as FileInfo; + var image = await result.file.readAsBytes(); + await verifySize(image, 100, 100); + }); + + test('当给定高度和宽度时,文件应保持纵横比', + () async { + var cacheManager = await setupCacheManager(); + var result = await cacheManager + .getImageFile(fileUrl, maxWidth: 100, maxHeight: 80) + .last as FileInfo; + var image = await result.file.readAsBytes(); + await verifySize(image, 80, 80); + }); + }); + group('Test resized image caching', () { + test('应从缓存中提取调整大小的图像', () async { + var config = await setupConfig(cacheKey: 'resized_w100_h80_$fileUrl'); + var cacheManager = TestCacheManager(config); + var result = await cacheManager + .getImageFile(fileUrl, maxWidth: 100, maxHeight: 80) + .last as FileInfo; + + + config.verifyNoDownloadCall(); + }); + + test('应从缓存中提取未大小的图像', () async { + var config = await setupConfig(); + config.returnsCacheObject( + fileUrl, + fileName, + validTill, + ); + var cacheManager = TestCacheManager(config); + var result = await cacheManager + .getImageFile(fileUrl, maxWidth: 100, maxHeight: 80) + .last as FileInfo; + + + config.verifyNoDownloadCall(); + }); + + test('不应从缓存中提取大小错误的图像', () async { + var config = await setupConfig(cacheKey: 'resized_w100_h150_$fileUrl'); + var cacheManager = TestCacheManager(config); + var result = await cacheManager + .getImageFile(fileUrl, maxWidth: 100, maxHeight: 80) + .last as FileInfo; + + + config.verifyDownloadCall(); + }); + + test('下载应显示进度', () async { + var config = await setupConfig(cacheKey: 'resized_w100_h150_$fileUrl'); + var cacheManager = TestCacheManager(config); + var results = await cacheManager + .getImageFile( + fileUrl, + maxWidth: 100, + maxHeight: 80, + withProgress: true, + ) + .toList(); + var progress = results.whereType().toList(); + print(progress.reversed); + config.verifyDownloadCall(); + }); + }); +} +} +Future setupCacheManager() async { + return TestCacheManager(await setupConfig()); +} + +Future setupConfig({String? cacheKey}) async { + var validTill = DateTime.now().add(const Duration(days: 1)); + var config = createTestConfig(); + await config.returnsFile(fileName, data: await getExampleImage()); + config.returnsCacheObject(fileUrl, fileName, validTill, key: cacheKey); + return config; +} + +Future verifySize( + Uint8List image, + int expectedWidth, + int expectedHeight, +) async { + var codec = await instantiateImageCodec(image); + var frame = await codec.getNextFrame(); + var height = frame.image.height; + var width = frame.image.width; + expect(width, expectedWidth); + expect(height, expectedHeight); +} + +Future getExampleImage() async { + final byteData = await rootBundle.load('assets/image-120.png'); + return byteData.buffer.asUint8List(); +} diff --git a/ohos/test_flutter_cache_manager/lib/src/images/image-120.png b/ohos/test_flutter_cache_manager/lib/src/images/image-120.png new file mode 100644 index 0000000000000000000000000000000000000000..a02e94a16e1ef5f9db866407d36541c1aa0d0f47 Binary files /dev/null and b/ohos/test_flutter_cache_manager/lib/src/images/image-120.png differ diff --git a/ohos/test_flutter_cache_manager/lib/src/mock.dart b/ohos/test_flutter_cache_manager/lib/src/mock.dart new file mode 100644 index 0000000000000000000000000000000000000000..d681f5e5ef46f649450b3f3f6015029bf20e12f8 --- /dev/null +++ b/ohos/test_flutter_cache_manager/lib/src/mock.dart @@ -0,0 +1,16 @@ +import 'package:flutter_cache_manager/flutter_cache_manager.dart'; +import 'package:flutter_cache_manager/src/cache_store.dart'; +import 'package:flutter_cache_manager/src/web/web_helper.dart'; +import 'package:mockito/annotations.dart'; + +@GenerateMocks( + [], + customMocks: [ + MockSpec(as: #MockCacheInfoRepositoryBase), + MockSpec(as: #MockCacheStoreBase), + MockSpec(as: #MockFileServiceBase), + MockSpec(), + ], +) +// ignore: unused_element +void _f() {} diff --git a/ohos/test_flutter_cache_manager/lib/src/mock.mocks.dart b/ohos/test_flutter_cache_manager/lib/src/mock.mocks.dart new file mode 100644 index 0000000000000000000000000000000000000000..65312d65cab9acff8e0c9c7893acc1792018f538 --- /dev/null +++ b/ohos/test_flutter_cache_manager/lib/src/mock.mocks.dart @@ -0,0 +1,463 @@ +// Mocks generated by Mockito 5.4.2 from annotations +// in flutter_cache_manager/test/mock.dart. +// Do not manually edit this file. + +// ignore_for_file: no_leading_underscores_for_library_prefixes +import 'dart:async' as _i5; + +import 'package:flutter_cache_manager/flutter_cache_manager.dart' as _i4; +import 'package:flutter_cache_manager/src/cache_store.dart' as _i6; +import 'package:flutter_cache_manager/src/storage/cache_object.dart' as _i2; +import 'package:flutter_cache_manager/src/storage/file_system/file_system.dart' + as _i3; +import 'package:flutter_cache_manager/src/web/web_helper.dart' as _i7; +import 'package:mockito/mockito.dart' as _i1; + +// ignore_for_file: type=lint +// ignore_for_file: avoid_redundant_argument_values +// ignore_for_file: avoid_setters_without_getters +// ignore_for_file: comment_references +// ignore_for_file: implementation_imports +// ignore_for_file: invalid_use_of_visible_for_testing_member +// ignore_for_file: prefer_const_constructors +// ignore_for_file: unnecessary_parenthesis +// ignore_for_file: camel_case_types +// ignore_for_file: subtype_of_sealed_class + +class _FakeCacheObject_0 extends _i1.SmartFake implements _i2.CacheObject { + _FakeCacheObject_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeDuration_1 extends _i1.SmartFake implements Duration { + _FakeDuration_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeFileSystem_2 extends _i1.SmartFake implements _i3.FileSystem { + _FakeFileSystem_2( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeDateTime_3 extends _i1.SmartFake implements DateTime { + _FakeDateTime_3( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeFileServiceResponse_4 extends _i1.SmartFake + implements _i4.FileServiceResponse { + _FakeFileServiceResponse_4( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeFileService_5 extends _i1.SmartFake implements _i4.FileService { + _FakeFileService_5( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +/// A class which mocks [CacheInfoRepository]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockCacheInfoRepositoryBase extends _i1.Mock + implements _i4.CacheInfoRepository { + MockCacheInfoRepositoryBase() { + _i1.throwOnMissingStub(this); + } + + @override + _i5.Future exists() => (super.noSuchMethod( + Invocation.method( + #exists, + [], + ), + returnValue: _i5.Future.value(false), + ) as _i5.Future); + @override + _i5.Future open() => (super.noSuchMethod( + Invocation.method( + #open, + [], + ), + returnValue: _i5.Future.value(false), + ) as _i5.Future); + @override + _i5.Future updateOrInsert(_i2.CacheObject? cacheObject) => + (super.noSuchMethod( + Invocation.method( + #updateOrInsert, + [cacheObject], + ), + returnValue: _i5.Future.value(), + ) as _i5.Future); + @override + _i5.Future<_i2.CacheObject> insert( + _i2.CacheObject? cacheObject, { + bool? setTouchedToNow = true, + }) => + (super.noSuchMethod( + Invocation.method( + #insert, + [cacheObject], + {#setTouchedToNow: setTouchedToNow}, + ), + returnValue: _i5.Future<_i2.CacheObject>.value(_FakeCacheObject_0( + this, + Invocation.method( + #insert, + [cacheObject], + {#setTouchedToNow: setTouchedToNow}, + ), + )), + ) as _i5.Future<_i2.CacheObject>); + @override + _i5.Future<_i2.CacheObject?> get(String? key) => (super.noSuchMethod( + Invocation.method( + #get, + [key], + ), + returnValue: _i5.Future<_i2.CacheObject?>.value(), + ) as _i5.Future<_i2.CacheObject?>); + @override + _i5.Future delete(int? id) => (super.noSuchMethod( + Invocation.method( + #delete, + [id], + ), + returnValue: _i5.Future.value(0), + ) as _i5.Future); + @override + _i5.Future deleteAll(Iterable? ids) => (super.noSuchMethod( + Invocation.method( + #deleteAll, + [ids], + ), + returnValue: _i5.Future.value(0), + ) as _i5.Future); + @override + _i5.Future update( + _i2.CacheObject? cacheObject, { + bool? setTouchedToNow = true, + }) => + (super.noSuchMethod( + Invocation.method( + #update, + [cacheObject], + {#setTouchedToNow: setTouchedToNow}, + ), + returnValue: _i5.Future.value(0), + ) as _i5.Future); + @override + _i5.Future> getAllObjects() => (super.noSuchMethod( + Invocation.method( + #getAllObjects, + [], + ), + returnValue: + _i5.Future>.value(<_i2.CacheObject>[]), + ) as _i5.Future>); + @override + _i5.Future> getObjectsOverCapacity(int? capacity) => + (super.noSuchMethod( + Invocation.method( + #getObjectsOverCapacity, + [capacity], + ), + returnValue: + _i5.Future>.value(<_i2.CacheObject>[]), + ) as _i5.Future>); + @override + _i5.Future> getOldObjects(Duration? maxAge) => + (super.noSuchMethod( + Invocation.method( + #getOldObjects, + [maxAge], + ), + returnValue: + _i5.Future>.value(<_i2.CacheObject>[]), + ) as _i5.Future>); + @override + _i5.Future close() => (super.noSuchMethod( + Invocation.method( + #close, + [], + ), + returnValue: _i5.Future.value(false), + ) as _i5.Future); + @override + _i5.Future deleteDataFile() => (super.noSuchMethod( + Invocation.method( + #deleteDataFile, + [], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); +} + +/// A class which mocks [CacheStore]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockCacheStoreBase extends _i1.Mock implements _i6.CacheStore { + MockCacheStoreBase() { + _i1.throwOnMissingStub(this); + } + + @override + Duration get cleanupRunMinInterval => (super.noSuchMethod( + Invocation.getter(#cleanupRunMinInterval), + returnValue: _FakeDuration_1( + this, + Invocation.getter(#cleanupRunMinInterval), + ), + ) as Duration); + @override + set cleanupRunMinInterval(Duration? _cleanupRunMinInterval) => + super.noSuchMethod( + Invocation.setter( + #cleanupRunMinInterval, + _cleanupRunMinInterval, + ), + returnValueForMissingStub: null, + ); + @override + _i3.FileSystem get fileSystem => (super.noSuchMethod( + Invocation.getter(#fileSystem), + returnValue: _FakeFileSystem_2( + this, + Invocation.getter(#fileSystem), + ), + ) as _i3.FileSystem); + @override + set fileSystem(_i3.FileSystem? _fileSystem) => super.noSuchMethod( + Invocation.setter( + #fileSystem, + _fileSystem, + ), + returnValueForMissingStub: null, + ); + @override + DateTime get lastCleanupRun => (super.noSuchMethod( + Invocation.getter(#lastCleanupRun), + returnValue: _FakeDateTime_3( + this, + Invocation.getter(#lastCleanupRun), + ), + ) as DateTime); + @override + set lastCleanupRun(DateTime? _lastCleanupRun) => super.noSuchMethod( + Invocation.setter( + #lastCleanupRun, + _lastCleanupRun, + ), + returnValueForMissingStub: null, + ); + @override + String get storeKey => (super.noSuchMethod( + Invocation.getter(#storeKey), + returnValue: '', + ) as String); + @override + _i5.Future<_i4.FileInfo?> getFile( + String? key, { + bool? ignoreMemCache = false, + }) => + (super.noSuchMethod( + Invocation.method( + #getFile, + [key], + {#ignoreMemCache: ignoreMemCache}, + ), + returnValue: _i5.Future<_i4.FileInfo?>.value(), + ) as _i5.Future<_i4.FileInfo?>); + @override + _i5.Future putFile(_i2.CacheObject? cacheObject) => (super.noSuchMethod( + Invocation.method( + #putFile, + [cacheObject], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + @override + _i5.Future<_i2.CacheObject?> retrieveCacheData( + String? key, { + bool? ignoreMemCache = false, + }) => + (super.noSuchMethod( + Invocation.method( + #retrieveCacheData, + [key], + {#ignoreMemCache: ignoreMemCache}, + ), + returnValue: _i5.Future<_i2.CacheObject?>.value(), + ) as _i5.Future<_i2.CacheObject?>); + @override + _i5.Future<_i4.FileInfo?> getFileFromMemory(String? key) => + (super.noSuchMethod( + Invocation.method( + #getFileFromMemory, + [key], + ), + returnValue: _i5.Future<_i4.FileInfo?>.value(), + ) as _i5.Future<_i4.FileInfo?>); + @override + _i5.Future emptyCache() => (super.noSuchMethod( + Invocation.method( + #emptyCache, + [], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + @override + void emptyMemoryCache() => super.noSuchMethod( + Invocation.method( + #emptyMemoryCache, + [], + ), + returnValueForMissingStub: null, + ); + @override + _i5.Future removeCachedFile(_i2.CacheObject? cacheObject) => + (super.noSuchMethod( + Invocation.method( + #removeCachedFile, + [cacheObject], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + @override + _i5.Future dispose() => (super.noSuchMethod( + Invocation.method( + #dispose, + [], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); +} + +/// A class which mocks [FileService]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockFileServiceBase extends _i1.Mock implements _i4.FileService { + MockFileServiceBase() { + _i1.throwOnMissingStub(this); + } + + @override + int get concurrentFetches => (super.noSuchMethod( + Invocation.getter(#concurrentFetches), + returnValue: 0, + ) as int); + @override + set concurrentFetches(int? _concurrentFetches) => super.noSuchMethod( + Invocation.setter( + #concurrentFetches, + _concurrentFetches, + ), + returnValueForMissingStub: null, + ); + @override + _i5.Future<_i4.FileServiceResponse> get( + String? url, { + Map? headers, + }) => + (super.noSuchMethod( + Invocation.method( + #get, + [url], + {#headers: headers}, + ), + returnValue: _i5.Future<_i4.FileServiceResponse>.value( + _FakeFileServiceResponse_4( + this, + Invocation.method( + #get, + [url], + {#headers: headers}, + ), + )), + ) as _i5.Future<_i4.FileServiceResponse>); +} + +/// A class which mocks [WebHelper]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockWebHelper extends _i1.Mock implements _i7.WebHelper { + MockWebHelper() { + _i1.throwOnMissingStub(this); + } + + @override + _i4.FileService get fileFetcher => (super.noSuchMethod( + Invocation.getter(#fileFetcher), + returnValue: _FakeFileService_5( + this, + Invocation.getter(#fileFetcher), + ), + ) as _i4.FileService); + @override + int get concurrentCalls => (super.noSuchMethod( + Invocation.getter(#concurrentCalls), + returnValue: 0, + ) as int); + @override + set concurrentCalls(int? _concurrentCalls) => super.noSuchMethod( + Invocation.setter( + #concurrentCalls, + _concurrentCalls, + ), + returnValueForMissingStub: null, + ); + @override + _i5.Stream<_i4.FileResponse> downloadFile( + String? url, { + String? key, + Map? authHeaders, + bool? ignoreMemCache = false, + }) => + (super.noSuchMethod( + Invocation.method( + #downloadFile, + [url], + { + #key: key, + #authHeaders: authHeaders, + #ignoreMemCache: ignoreMemCache, + }, + ), + returnValue: _i5.Stream<_i4.FileResponse>.empty(), + ) as _i5.Stream<_i4.FileResponse>); +} diff --git a/ohos/test_flutter_cache_manager/lib/src/repositories/json_file_repository_test.dart b/ohos/test_flutter_cache_manager/lib/src/repositories/json_file_repository_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..1386bd583584d15bb9e7219999fb0a7ddffd0e5c --- /dev/null +++ b/ohos/test_flutter_cache_manager/lib/src/repositories/json_file_repository_test.dart @@ -0,0 +1,209 @@ +import 'dart:io'; + +import 'package:collection/collection.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_cache_manager/src/storage/cache_info_repositories/json_cache_info_repository.dart'; +import 'package:flutter_cache_manager/src/storage/cache_object.dart'; +import 'package:test_flutter_cache_manager/base/test_page.dart'; + +import '../helpers/json_repo_helpers.dart'; + +class JsonCacheInfoRepositoryTestPage extends TestPage { + JsonCacheInfoRepositoryTestPage(String title, {Key? key}) + : super(title: title, key: key) { + group('创建存储库', () { + test('使用数据库名称创建存储库成功', () { + var repository = JsonCacheInfoRepository(databaseName: databaseName); + expect(repository != null, true); + }); + + test('成功创建指定路径的存储库', () { + var repository = JsonCacheInfoRepository(path: path); + expect(repository != null, true); + }); + + test('使用路径和databaseName创建存储库引发断言错误', () { + JsonCacheInfoRepository( + path: path, + databaseName: databaseName, + ); + }); + + test('使用目录创建存储库成功', () { + var repository = JsonCacheInfoRepository.withFile(File(path)); + expect(repository != null, true); + }); + }); + + group('打开和关闭存储库', () { + test('打开存储库 JsonCacheInfoRepository.withFile.open', () async { + var repository = JsonCacheInfoRepository.withFile(File(path)); + await repository.open(); + }); + + test('关闭存储库 JsonRepoHelpers.createRepository.close', () async { + var repository = await JsonRepoHelpers.createRepository(); + var isClosed = await repository.close(); + expect(isClosed, true); + }); + + test('重复关闭存储库', () async { + var repository = await JsonRepoHelpers.createRepository(); + await repository.open(); + var isClosed = await repository.close(); + expect(isClosed, false); + isClosed = await repository.close(); + expect(isClosed, true); + }); + }); + + group('Exist and delete', () { + test('是否存在JsonCacheInfoRepository.withFile.exists', () async { + var repository = JsonCacheInfoRepository.withFile(File(path)); + var exists = await repository.exists(); + expect(exists, false); + + repository = await JsonRepoHelpers.createRepository(); + exists = await repository.exists(); + expect(exists, true); + }); + + test('JsonRepoHelpers.createRepository.deleteDataFile', () async { + var repository = await JsonRepoHelpers.createRepository(); + await repository.deleteDataFile(); + var exists = await repository.exists(); + expect(exists, false); + }); + }); + + group('Get', () { + test('JsonRepoHelpers.createRepository.get', () async { + var repo = await JsonRepoHelpers.createRepository(); + var result = await repo.get(testurl); + expect(result != null, true); + + repo = await JsonRepoHelpers.createRepository(); + result = await repo.get('not an url'); + expect(result == null, true); + }); + + test('JsonRepoHelpers.createRepository.getAllObjects', () async { + var repo = await JsonRepoHelpers.createRepository(); + var result = await repo.getAllObjects(); + expect(result.length, JsonRepoHelpers.startCacheObjects.length); + }); + + test('JsonRepoHelpers.createRepository.getObjectsOverCapacity', () async { + var repo = await JsonRepoHelpers.createRepository(); + var result = await repo.getObjectsOverCapacity(1); + expect(result.length, 2); + expectIdInList(result, 1); + expectIdInList(result, 3); + + repo = await JsonRepoHelpers.createRepository(); + result = await repo.getOldObjects(const Duration(days: 7)); + expect(result.length, 1); + }); + }); + + group('update and insert', () { + test('JsonRepoHelpers.createRepository.insert', () async { + var repo = await JsonRepoHelpers.createRepository(); + var objectToInsert = JsonRepoHelpers.extraCacheObject; + var insertedObject = + await repo.insert(JsonRepoHelpers.extraCacheObject); + expect(insertedObject.id, JsonRepoHelpers.startCacheObjects.length + 1); + expect(insertedObject.url, objectToInsert.url); + expect(insertedObject.touched != null, true); + + var allObjects = await repo.getAllObjects(); + var newObject = + allObjects.where((element) => element.id == insertedObject.id); + expect(newObject != null, true); + }); + + test('insert throws when adding existing object', () async { + var repo = await JsonRepoHelpers.createRepository(); + var objectToInsert = JsonRepoHelpers.startCacheObjects.first; + repo.insert(objectToInsert); + }); + + test('JsonRepoHelpers.createRepository.update', () async { + var repo = await JsonRepoHelpers.createRepository(); + var objectToInsert = JsonRepoHelpers.startCacheObjects.first; + var newUrl = 'newUrl.com'; + var updatedObject = objectToInsert.copyWith(url: newUrl); + await repo.update(updatedObject); + var retrievedObject = await repo.get(objectToInsert.key); + expect(retrievedObject!.url, newUrl); + }); + + test('JsonRepoHelpers.createRepository.extraCacheObject', () async { + var repo = await JsonRepoHelpers.createRepository(); + var newObject = JsonRepoHelpers.extraCacheObject; + repo.update(newObject); + }); + + test('JsonRepoHelpers.createRepository.get', () async { + var repo = await JsonRepoHelpers.createRepository(); + var objectToInsert = JsonRepoHelpers.startCacheObjects.first; + var newUrl = 'newUrl.com'; + var updatedObject = objectToInsert.copyWith(url: newUrl); + await repo.updateOrInsert(updatedObject); + var retrievedObject = await repo.get(objectToInsert.key); + expect(retrievedObject!.url, newUrl); + }); + + test('JsonRepoHelpers.createRepository.updateOrInsert', () async { + var repo = await JsonRepoHelpers.createRepository(); + var objectToInsert = JsonRepoHelpers.extraCacheObject; + var insertedObject = + await repo.updateOrInsert(JsonRepoHelpers.extraCacheObject); + expect(insertedObject.id, JsonRepoHelpers.startCacheObjects.length + 1); + expect(insertedObject.url, objectToInsert.url); + expect(insertedObject.touched != null, true); + + var allObjects = await repo.getAllObjects(); + var newObject = + allObjects.where((element) => element.id == insertedObject.id); + expect(newObject != null, true); + }); + }); + + group('delete', () { + test('JsonRepoHelpers.createRepository.delete', () async { + var removedId = 2; + var repo = await JsonRepoHelpers.createRepository(); + var deleted = await repo.delete(removedId); + expect(deleted, 1); + var objects = await repo.getAllObjects(); + var removedObject = objects.where((element) => element.id == removedId); + expect(removedObject.length, 0); + expect(objects.length, JsonRepoHelpers.startCacheObjects.length - 1); + }); + + test('JsonRepoHelpers.createRepository.deleteAll', () async { + var removedIds = [2, 3]; + var repo = await JsonRepoHelpers.createRepository(); + var deleted = await repo.deleteAll(removedIds); + expect(deleted, 2); + var objects = await repo.getAllObjects(); + var removedObject = + objects.where((element) => removedIds.contains(element.id)); + expect(removedObject.length, 0); + expect(objects.length, + JsonRepoHelpers.startCacheObjects.length - removedIds.length); + + var removedId = 99; + repo = await JsonRepoHelpers.createRepository(); + deleted = await repo.delete(removedId); + expect(deleted, 0); + }); + }); + } +} + +void expectIdInList(List cacheObjects, int id) { + var object = cacheObjects.singleWhereOrNull((element) => element.id == id); + expect(object != null, true); +} diff --git a/ohos/test_flutter_cache_manager/lib/src/repositories/migration_test.dart b/ohos/test_flutter_cache_manager/lib/src/repositories/migration_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..640c7915a1c04eb982c5ac06637e2a72f19d2c74 --- /dev/null +++ b/ohos/test_flutter_cache_manager/lib/src/repositories/migration_test.dart @@ -0,0 +1,116 @@ +import 'package:collection/collection.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_cache_manager/flutter_cache_manager.dart'; +import 'package:flutter_cache_manager/src/storage/cache_object.dart'; +import 'package:matcher/src/interfaces.dart'; +import 'package:mockito/mockito.dart'; +import 'package:test_flutter_cache_manager/base/test_page.dart'; + +import '../helpers/json_repo_helpers.dart' show JsonRepoHelpers; +import '../helpers/mock_cache_info_repository.dart'; + +class MigrationTestPage extends TestPage { + MigrationTestPage(String title, {Key? key}) : super(title: title, key: key) { + group('迁移测试', () { + test('文件添加到新存储库中', () async { + var mockRepo = setupMockRepo(false); + var source = await JsonRepoHelpers.createRepository(open: false); + await mockRepo.migrateFrom(source); + for (var object in JsonRepoHelpers.startCacheObjects) { + verify( + mockRepo.insert( + argThat(CacheObjectMatcher(object)), + setTouchedToNow: anyNamed('setTouchedToNow'), + ), + ); + } + }); + + test('旧存储已删除', () async { + var mockRepo = setupMockRepo(false); + var source = await JsonRepoHelpers.createRepository(open: false); + await mockRepo.migrateFrom(source); + var exists = await source.exists(); + expect(exists, false); + }); + + test('在现有存储中更新文件', () async { + var mockRepo = setupMockRepo(true); + var source = await JsonRepoHelpers.createRepository(open: false); + await mockRepo.migrateFrom(source); + for (var object in JsonRepoHelpers.startCacheObjects) { + verify( + mockRepo.update( + argThat(CacheObjectMatcher(object)), + setTouchedToNow: anyNamed('setTouchedToNow'), + ), + ); + } + }); + }); +} +} +MockCacheInfoRepository setupMockRepo(bool returnObjects) { + var mockRepo = MockCacheInfoRepository(); + when(mockRepo.get(any)).thenAnswer((realInvocation) { + if (!returnObjects) return Future.value(null); + var key = realInvocation.positionalArguments.first as String; + var cacheObject = JsonRepoHelpers.startCacheObjects.firstWhereOrNull( + (element) => element.key == key, + ); + return Future.value(cacheObject); + }); + when(mockRepo.insert(any)).thenAnswer((realInvocation) => + Future.value(realInvocation.positionalArguments.first as CacheObject)); + return mockRepo; +} + +class CacheObjectMatcher extends Matcher { + final CacheObject value; + static final Object _mismatchedValueKey = Object(); + + CacheObjectMatcher(this.value); + + @override + Description describe(Description description) { + description.add('Matches cacheObject $value'); + return description; + } + + @override + bool matches(item, Map matchState) { + var isMatch = false; + if (item is CacheObject) { + isMatch = item.key == value.key && + item.url == value.url && + item.relativePath == value.relativePath && + item.length == value.length && + item.touched!.millisecondsSinceEpoch == + value.touched!.millisecondsSinceEpoch && + item.eTag == value.eTag; + } + if (!isMatch) matchState[_mismatchedValueKey] = item; + return isMatch; + } + + @override + Description describeMismatch( + dynamic item, + Description mismatchDescription, + Map matchState, + bool verbose, + ) { + if (matchState.containsKey(_mismatchedValueKey)) { + final actualValue = matchState[_mismatchedValueKey] as CacheObject; + // Leading whitespace is added so that lines in the multiline + // description returned by addDescriptionOf are all indented equally + // which makes the output easier to read for this case. + return mismatchDescription + .add('expected normalized value\n ') + .addDescriptionOf('${value.key}: ${value.url}') + .add('\nbut got\n ') + .addDescriptionOf('${actualValue.key}: ${actualValue.url}'); + } + return mismatchDescription; + } +} diff --git a/ohos/test_flutter_cache_manager/lib/src/web_helper_test.dart b/ohos/test_flutter_cache_manager/lib/src/web_helper_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..dc012b1d311229270f8df4c686cc07647df6971f --- /dev/null +++ b/ohos/test_flutter_cache_manager/lib/src/web_helper_test.dart @@ -0,0 +1,243 @@ +import 'dart:async'; + +import 'package:flutter/material.dart'; +import 'package:flutter_cache_manager/flutter_cache_manager.dart'; +import 'package:flutter_cache_manager/src/cache_store.dart'; +import 'package:flutter_cache_manager/src/web/web_helper.dart'; +import 'package:mockito/mockito.dart'; +import 'package:test_flutter_cache_manager/base/test_page.dart'; + +import 'helpers/config_extensions.dart'; +import 'helpers/mock_cache_store.dart'; +import 'helpers/mock_file_fetcher_response.dart'; +import 'helpers/mock_file_service.dart'; +import 'helpers/test_configuration.dart'; + +class WebHelperTestPage extends TestPage { + WebHelperTestPage(String title, {Key? key}) : super(title: title, key: key) { + group('测试状态码', () { + test('返回200正常', () async { + const imageUrl = 'baseflow.com/testimage'; + + var config = createTestConfig(); + var store = CacheStore(config); + + final fileService = MockFileService(); + when(fileService.get(imageUrl, headers: anyNamed('headers'))) + .thenAnswer((_) { + return Future.value(MockFileFetcherResponse( + Stream.value([0, 1, 2, 3, 4, 5]), + 0, + 'testv1', + '.jpg', + 200, + DateTime.now())); + }); + + var webHelper = WebHelper(store, fileService); + var result = await webHelper + .downloadFile(imageUrl) + .firstWhere((r) => r is FileInfo, orElse: null); + result; + }); + + test('404 异常', () async { + const imageUrl = 'baseflow.com/testimage'; + + var config = createTestConfig(); + var store = CacheStore(config); + + final fileService = MockFileService(); + when(fileService.get(imageUrl, headers: anyNamed('headers'))) + .thenAnswer((_) { + return Future.value(MockFileFetcherResponse( + Stream.value([]), 0, null, '', 404, DateTime.now())); + }); + + var webHelper = WebHelper(store, fileService); + + expect(webHelper.downloadFile(imageUrl).toList(), + (e) => e is HttpExceptionWithStatus && e.statusCode == 404); + }); + + test('304忽略内容', () async { + const imageUrl = 'baseflow.com/testimage'; + + var config = createTestConfig(); + var store = CacheStore(config); + + final fileService = MockFileService(); + when(fileService.get(imageUrl, headers: anyNamed('headers'))) + .thenAnswer((_) { + return Future.value(MockFileFetcherResponse( + Stream.value([]), 0, 'testv1', '.jpg', 304, DateTime.now())); + }); + + var webHelper = WebHelper(store, fileService); + var result = await webHelper + .downloadFile(imageUrl) + .firstWhere((r) => r is FileInfo, orElse: null); + result; + }); + }); + + group('Parallel logic', () { + test('重复调用WebHelper', () async { + const imageUrl = 'baseflow.com/testimage'; + + var config = createTestConfig(); + var store = _createStore(config); + + final fileService = MockFileService(); + when(fileService.get(imageUrl, headers: anyNamed('headers'))) + .thenAnswer((_) { + return Future.value(MockFileFetcherResponse( + Stream.value([0, 1, 2, 3, 4, 5]), + 6, + 'testv1', + '.jpg', + 200, + DateTime.now())); + }); + + var webHelper = WebHelper(store, fileService); + + var call1 = webHelper.downloadFile(imageUrl).toList(); + var call2 = webHelper.downloadFile(imageUrl).toList(); + await Future.wait([call1, call2]); + + verify(store.retrieveCacheData(any)); + }); + + test('当memcache被忽略时,调用webhelper两次会超过两次', + () async { + const imageUrl = 'baseflow.com/testimage'; + + var config = createTestConfig(); + var store = _createStore(config); + + final fileService = MockFileService(); + when(fileService.get(imageUrl, headers: anyNamed('headers'))) + .thenAnswer((_) { + return Future.value(MockFileFetcherResponse( + Stream.value([0, 1, 2, 3, 4, 5]), + 6, + 'testv1', + '.jpg', + 200, + DateTime.now())); + }); + + var webHelper = WebHelper(store, fileService); + var call1 = webHelper.downloadFile(imageUrl).toList(); + var call2 = + webHelper.downloadFile(imageUrl, ignoreMemCache: true).toList(); + await Future.wait([call1, call2]); + + verify(store.retrieveCacheData(any)); + }); + + test('并发调用', () async { + const url1 = 'baseflow.com/testimage1'; + const url2 = 'baseflow.com/testimage2'; + const url3 = 'baseflow.com/testimage3'; + + var config = createTestConfig(); + var store = _createStore(config); + final fileService = MockFileService(); + + var completer1 = Completer(); + var completer2 = Completer(); + var completer3 = Completer(); + + when(fileService.get(url1, headers: anyNamed('headers'))) + .thenAnswer((realInvocation) => completer1.future); + when(fileService.get(url2, headers: anyNamed('headers'))) + .thenAnswer((realInvocation) => completer2.future); + when(fileService.get(url3, headers: anyNamed('headers'))) + .thenAnswer((realInvocation) => completer3.future); + + var webHelper = WebHelper(store, fileService); + webHelper.downloadFile(url1); + webHelper.downloadFile(url2); + webHelper.downloadFile(url3); + + await Future.delayed(const Duration(microseconds: 1)); + + verify(fileService.get(url1, headers: anyNamed('headers'))); + verify(fileService.get(url2, headers: anyNamed('headers'))); + verifyNever(fileService.get(url3, headers: anyNamed('headers'))); + + completer1.complete(MockFileFetcherResponse.basic()); + + await Future.delayed(const Duration(microseconds: 1)); + verify(fileService.get(url3, headers: anyNamed('headers'))); + }); + }); + + group('Miscellaneous', () { + test('当尚未缓存时,应创建新的cacheobject', () async { + const imageUrl = 'baseflow.com/testimage'; + const fileName = 'testv1.jpg'; + final validTill = DateTime.now(); + + var config = createTestConfig(); + var store = _createStore(config); + config.returnsCacheObject(imageUrl, fileName, validTill); + + final fileService = MockFileService(); + when(fileService.get(imageUrl, headers: anyNamed('headers'))) + .thenAnswer((_) { + return Future.value(MockFileFetcherResponse( + Stream.value([0, 1, 2, 3, 4, 5]), + 6, + 'testv1', + '.jpg', + 200, + DateTime.now())); + }); + + var webHelper = WebHelper(store, fileService); + var result = await webHelper + .downloadFile(imageUrl) + .firstWhere((r) => r is FileInfo, orElse: null); + result; + verify(store.putFile(any)); + }); + + test('如果扩展名更改,则应删除文件', () async { + const imageUrl = 'baseflow.com/testimage'; + var imageName = 'image.png'; + + var config = createTestConfig(); + var store = CacheStore(config); + var file = await config.returnsFile(imageName); + config.returnsCacheObject(imageUrl, imageName, DateTime.now()); + + final fileService = MockFileService(); + var webHelper = WebHelper(store, fileService); + + expect(await file.exists(), true); + var _ = await webHelper + .downloadFile(imageUrl) + .firstWhere((r) => r is FileInfo, orElse: null); + expect(await file.exists(), false); + }); + }); + } +} + +MockCacheStore _createStore(Config config) { + final store = MockCacheStore(); + // when(store.putFile(argThat(null))).thenAnswer((_) => Future.value()); + // when(store.retrieveCacheData(argThat(anything))) + // .thenAnswer((invocation) => Future.value(CacheObject( + // invocation.positionalArguments.first as String, + // relativePath: 'test.png', + // validTill: clock.now().add(const Duration(days: 7)), + // ))); + when(store.fileSystem).thenReturn(config.fileSystem); + return store; +} + +class MockStore extends Mock implements CacheStore {} diff --git a/ohos/test_flutter_cache_manager/ohos/.gitignore b/ohos/test_flutter_cache_manager/ohos/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..fbabf771011fe78f9919db0b1195ab6cadffc2b0 --- /dev/null +++ b/ohos/test_flutter_cache_manager/ohos/.gitignore @@ -0,0 +1,11 @@ +/node_modules +/oh_modules +/local.properties +/.idea +**/build +/.hvigor +.cxx +/.clangd +/.clang-format +/.clang-tidy +**/.test \ No newline at end of file diff --git a/ohos/test_flutter_cache_manager/ohos/AppScope/app.json5 b/ohos/test_flutter_cache_manager/ohos/AppScope/app.json5 new file mode 100644 index 0000000000000000000000000000000000000000..36ea350903b7d882911a6d68f25910ea2d0f4c1f --- /dev/null +++ b/ohos/test_flutter_cache_manager/ohos/AppScope/app.json5 @@ -0,0 +1,10 @@ +{ + "app": { + "bundleName": "com.example.test_flutter_cache_manager", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name" + } +} diff --git a/ohos/test_flutter_cache_manager/ohos/AppScope/resources/base/element/string.json b/ohos/test_flutter_cache_manager/ohos/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..0040d9a7c161e04dcba2dc63b4e76151d51589f9 --- /dev/null +++ b/ohos/test_flutter_cache_manager/ohos/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "test_flutter_cache_manager" + } + ] +} diff --git a/ohos/test_flutter_cache_manager/ohos/AppScope/resources/base/media/app_icon.png b/ohos/test_flutter_cache_manager/ohos/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ohos/test_flutter_cache_manager/ohos/AppScope/resources/base/media/app_icon.png differ diff --git a/ohos/test_flutter_cache_manager/ohos/build-profile.json5 b/ohos/test_flutter_cache_manager/ohos/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..238b2d5bbf8b3a0c28dae746eaf5220737a944fe --- /dev/null +++ b/ohos/test_flutter_cache_manager/ohos/build-profile.json5 @@ -0,0 +1,42 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +{ + "app": { + "signingConfigs": [], + "compileSdkVersion": 10, + "compatibleSdkVersion": 10, + "products": [ + { + "name": "default", + "signingConfig": "default", + } + ] + }, + "modules": [ + { + "name": "entry", + "srcPath": "./entry", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/ohos/test_flutter_cache_manager/ohos/dta/icudtl.dat b/ohos/test_flutter_cache_manager/ohos/dta/icudtl.dat new file mode 100644 index 0000000000000000000000000000000000000000..d1f10917ab52e3ebd251abd7f5377d7196b80d67 Binary files /dev/null and b/ohos/test_flutter_cache_manager/ohos/dta/icudtl.dat differ diff --git a/ohos/test_flutter_cache_manager/ohos/entry/.gitignore b/ohos/test_flutter_cache_manager/ohos/entry/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..2795a1c5b1fe53659dd1b71d90ba0592eaf7e043 --- /dev/null +++ b/ohos/test_flutter_cache_manager/ohos/entry/.gitignore @@ -0,0 +1,7 @@ + +/node_modules +/oh_modules +/.preview +/build +/.cxx +/.test \ No newline at end of file diff --git a/ohos/test_flutter_cache_manager/ohos/entry/build-profile.json5 b/ohos/test_flutter_cache_manager/ohos/entry/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..f02a52e08c8fa1c3a33b9faa4592e9f695cd1c54 --- /dev/null +++ b/ohos/test_flutter_cache_manager/ohos/entry/build-profile.json5 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +{ + "apiType": 'stageMode', + "buildOption": { + }, + "targets": [ + { + "name": "default", + "runtimeOS": "OpenHarmony" + }, + { + "name": "ohosTest", + } + ] +} \ No newline at end of file diff --git a/ohos/test_flutter_cache_manager/ohos/entry/hvigorfile.ts b/ohos/test_flutter_cache_manager/ohos/entry/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..894fc15c6b793f085e6c8506e43d719af658e8ff --- /dev/null +++ b/ohos/test_flutter_cache_manager/ohos/entry/hvigorfile.ts @@ -0,0 +1,17 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently. +export { hapTasks } from '@ohos/hvigor-ohos-plugin'; diff --git a/ohos/test_flutter_cache_manager/ohos/entry/libs/arm64-v8a/libc++_shared.so b/ohos/test_flutter_cache_manager/ohos/entry/libs/arm64-v8a/libc++_shared.so new file mode 100644 index 0000000000000000000000000000000000000000..831c9353702073d45889352a4dafb93103d67d20 Binary files /dev/null and b/ohos/test_flutter_cache_manager/ohos/entry/libs/arm64-v8a/libc++_shared.so differ diff --git a/ohos/test_flutter_cache_manager/ohos/entry/libs/arm64-v8a/libflutter.so b/ohos/test_flutter_cache_manager/ohos/entry/libs/arm64-v8a/libflutter.so new file mode 100755 index 0000000000000000000000000000000000000000..48d4cb06e796b84779143f12ef4b4d5b4cf58776 Binary files /dev/null and b/ohos/test_flutter_cache_manager/ohos/entry/libs/arm64-v8a/libflutter.so differ diff --git a/ohos/test_flutter_cache_manager/ohos/entry/oh-package.json5 b/ohos/test_flutter_cache_manager/ohos/entry/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..ab756b7624a009a30db809d7d64c62d84dc7b153 --- /dev/null +++ b/ohos/test_flutter_cache_manager/ohos/entry/oh-package.json5 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +{ + "name": "entry", + "version": "1.0.0", + "description": "Please describe the basic information.", + "main": "", + "author": "", + "license": "", + "dependencies": { + "@ohos/flutter_ohos": "file:../har/flutter_embedding.har" + } +} + diff --git a/ohos/test_flutter_cache_manager/ohos/entry/src/main/ets/entryability/EntryAbility.ets b/ohos/test_flutter_cache_manager/ohos/entry/src/main/ets/entryability/EntryAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..321a4eeaacd7b8079a876e25c4dafd498e4d9fb9 --- /dev/null +++ b/ohos/test_flutter_cache_manager/ohos/entry/src/main/ets/entryability/EntryAbility.ets @@ -0,0 +1,22 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import { FlutterAbility } from '@ohos/flutter_ohos' + +export default class EntryAbility extends FlutterAbility { + onFlutterEngineReady(): void { + super.onFlutterEngineReady() + } +} diff --git a/ohos/test_flutter_cache_manager/ohos/entry/src/main/ets/pages/Index.ets b/ohos/test_flutter_cache_manager/ohos/entry/src/main/ets/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..d784c75ed9d16a6657bb6466a148752b1b20bd91 --- /dev/null +++ b/ohos/test_flutter_cache_manager/ohos/entry/src/main/ets/pages/Index.ets @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import { FlutterPage } from '@ohos/flutter_ohos' + +@Entry +@Component +struct Index { + build() { + Column() { + FlutterPage() + } + } +} \ No newline at end of file diff --git a/ohos/test_flutter_cache_manager/ohos/entry/src/main/module.json5 b/ohos/test_flutter_cache_manager/ohos/entry/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..db416e1705809c2dfaae9fcfaa64e98f7148c57b --- /dev/null +++ b/ohos/test_flutter_cache_manager/ohos/entry/src/main/module.json5 @@ -0,0 +1,58 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +{ + "module": { + "name": "entry", + "type": "entry", + "description": "$string:module_desc", + "mainElement": "EntryAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "EntryAbility", + "srcEntry": "./ets/entryability/EntryAbility.ets", + "description": "$string:EntryAbility_desc", + "icon": "$media:icon", + "label": "$string:EntryAbility_label", + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:start_window_background", + "exported": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ], + "requestPermissions": [ + {"name" : "ohos.permission.INTERNET"}, + {"name" : "ohos.permission.GET_WIFI_INFO"}, + {"name" : "ohos.permission.GET_WIFI_INFO_INTERNAL"}, + {"name" : "ohos.permission.GET_WIFI_LOCAL_MAC"}, + {"name" : "ohos.permission.READ_MEDIA"}, + {"name" : "ohos.permission.WRITE_MEDIA"}, + ] + } +} \ No newline at end of file diff --git a/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/base/element/color.json b/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02 --- /dev/null +++ b/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/base/element/string.json b/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f94595515a99e0c828807e243494f57f09251930 --- /dev/null +++ b/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/base/media/icon.png b/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/base/media/icon.png differ diff --git a/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/base/profile/main_pages.json b/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce --- /dev/null +++ b/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/Index" + ] +} diff --git a/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/en_US/element/string.json b/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f94595515a99e0c828807e243494f57f09251930 --- /dev/null +++ b/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/en_US/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/rawfile/flutter_assets/AssetManifest.json b/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/rawfile/flutter_assets/AssetManifest.json new file mode 100644 index 0000000000000000000000000000000000000000..a3f82e25b39241c953fea95504c15b5df5f14e2c --- /dev/null +++ b/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/rawfile/flutter_assets/AssetManifest.json @@ -0,0 +1 @@ +{"assets/image-120.png":["assets/image-120.png"],"packages/cupertino_icons/assets/CupertinoIcons.ttf":["packages/cupertino_icons/assets/CupertinoIcons.ttf"]} \ No newline at end of file diff --git a/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/rawfile/flutter_assets/FontManifest.json b/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/rawfile/flutter_assets/FontManifest.json new file mode 100644 index 0000000000000000000000000000000000000000..464ab5882a2234c39b1a4dbad5feba0954478155 --- /dev/null +++ b/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/rawfile/flutter_assets/FontManifest.json @@ -0,0 +1 @@ +[{"family":"MaterialIcons","fonts":[{"asset":"fonts/MaterialIcons-Regular.otf"}]},{"family":"packages/cupertino_icons/CupertinoIcons","fonts":[{"asset":"packages/cupertino_icons/assets/CupertinoIcons.ttf"}]}] \ No newline at end of file diff --git a/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/rawfile/flutter_assets/NOTICES.Z b/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/rawfile/flutter_assets/NOTICES.Z new file mode 100644 index 0000000000000000000000000000000000000000..99b260baf4600d8211ed8880a15cf575c191b5bf Binary files /dev/null and b/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/rawfile/flutter_assets/NOTICES.Z differ diff --git a/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/rawfile/flutter_assets/assets/image-120.png b/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/rawfile/flutter_assets/assets/image-120.png new file mode 100644 index 0000000000000000000000000000000000000000..a02e94a16e1ef5f9db866407d36541c1aa0d0f47 Binary files /dev/null and b/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/rawfile/flutter_assets/assets/image-120.png differ diff --git a/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/rawfile/flutter_assets/fonts/MaterialIcons-Regular.otf b/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/rawfile/flutter_assets/fonts/MaterialIcons-Regular.otf new file mode 100644 index 0000000000000000000000000000000000000000..8c99266130a89547b4344f47e08aacad473b14e0 Binary files /dev/null and b/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/rawfile/flutter_assets/fonts/MaterialIcons-Regular.otf differ diff --git a/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/rawfile/flutter_assets/icudtl.dat b/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/rawfile/flutter_assets/icudtl.dat new file mode 100644 index 0000000000000000000000000000000000000000..d1f10917ab52e3ebd251abd7f5377d7196b80d67 Binary files /dev/null and b/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/rawfile/flutter_assets/icudtl.dat differ diff --git a/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/rawfile/flutter_assets/isolate_snapshot_data b/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/rawfile/flutter_assets/isolate_snapshot_data new file mode 100644 index 0000000000000000000000000000000000000000..0c27f9d5b95a1a20177e0069bda7f9126746ee14 Binary files /dev/null and b/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/rawfile/flutter_assets/isolate_snapshot_data differ diff --git a/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/rawfile/flutter_assets/kernel_blob.bin b/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/rawfile/flutter_assets/kernel_blob.bin new file mode 100644 index 0000000000000000000000000000000000000000..9e92a6bf5152ab96ac240c6acac9f7554378954e Binary files /dev/null and b/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/rawfile/flutter_assets/kernel_blob.bin differ diff --git a/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/rawfile/flutter_assets/packages/cupertino_icons/assets/CupertinoIcons.ttf b/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/rawfile/flutter_assets/packages/cupertino_icons/assets/CupertinoIcons.ttf new file mode 100644 index 0000000000000000000000000000000000000000..79ba7ea0836b93b3f178067bcd0a0945dbc26b3f Binary files /dev/null and b/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/rawfile/flutter_assets/packages/cupertino_icons/assets/CupertinoIcons.ttf differ diff --git a/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/rawfile/flutter_assets/shaders/ink_sparkle.frag b/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/rawfile/flutter_assets/shaders/ink_sparkle.frag new file mode 100644 index 0000000000000000000000000000000000000000..0bb5a14a220d223adde1e69eb1959332d6bd08c7 Binary files /dev/null and b/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/rawfile/flutter_assets/shaders/ink_sparkle.frag differ diff --git a/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/rawfile/flutter_assets/vm_snapshot_data b/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/rawfile/flutter_assets/vm_snapshot_data new file mode 100644 index 0000000000000000000000000000000000000000..b5bd48ef5234cafddbb10134e1077fdfb85edf20 Binary files /dev/null and b/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/rawfile/flutter_assets/vm_snapshot_data differ diff --git a/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/zh_CN/element/string.json b/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..597ecf95e61d7e30367c22fe2f8638008361b044 --- /dev/null +++ b/ohos/test_flutter_cache_manager/ohos/entry/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "模块描述" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ohos/test_flutter_cache_manager/ohos/entry/src/ohosTest/ets/test/Ability.test.ets b/ohos/test_flutter_cache_manager/ohos/entry/src/ohosTest/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..25d4c71ff3cd584f5d64f6f8c0ac864928c234c4 --- /dev/null +++ b/ohos/test_flutter_cache_manager/ohos/entry/src/ohosTest/ets/test/Ability.test.ets @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import hilog from '@ohos.hilog'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' + +export default function abilityTest() { + describe('ActsAbilityTest', function () { + // Defines a test suite. Two parameters are supported: test suite name and test suite function. + beforeAll(function () { + // Presets an action, which is performed only once before all test cases of the test suite start. + // This API supports only one parameter: preset action function. + }) + beforeEach(function () { + // Presets an action, which is performed before each unit test case starts. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: preset action function. + }) + afterEach(function () { + // Presets a clear action, which is performed after each unit test case ends. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: clear action function. + }) + afterAll(function () { + // Presets a clear action, which is performed after all test cases of the test suite end. + // This API supports only one parameter: clear action function. + }) + it('assertContain',0, function () { + // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. + hilog.info(0x0000, 'testTag', '%{public}s', 'it begin'); + let a = 'abc' + let b = 'b' + // Defines a variety of assertion methods, which are used to declare expected boolean conditions. + expect(a).assertContain(b) + expect(a).assertEqual(a) + }) + }) +} \ No newline at end of file diff --git a/ohos/test_flutter_cache_manager/ohos/entry/src/ohosTest/ets/test/List.test.ets b/ohos/test_flutter_cache_manager/ohos/entry/src/ohosTest/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..f4140030e65d20df6af30a6bf51e464dea8f8aa6 --- /dev/null +++ b/ohos/test_flutter_cache_manager/ohos/entry/src/ohosTest/ets/test/List.test.ets @@ -0,0 +1,20 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import abilityTest from './Ability.test' + +export default function testsuite() { + abilityTest() +} \ No newline at end of file diff --git a/ohos/test_flutter_cache_manager/ohos/entry/src/ohosTest/ets/testability/TestAbility.ets b/ohos/test_flutter_cache_manager/ohos/entry/src/ohosTest/ets/testability/TestAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..4ca645e6013cfce8e7dbb728313cb8840c4da660 --- /dev/null +++ b/ohos/test_flutter_cache_manager/ohos/entry/src/ohosTest/ets/testability/TestAbility.ets @@ -0,0 +1,63 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import UIAbility from '@ohos.app.ability.UIAbility'; +import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; +import hilog from '@ohos.hilog'; +import { Hypium } from '@ohos/hypium'; +import testsuite from '../test/List.test'; +import window from '@ohos.window'; + +export default class TestAbility extends UIAbility { + onCreate(want, launchParam) { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate'); + hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); + hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? ''); + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy'); + } + + onWindowStageCreate(windowStage: window.WindowStage) { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate'); + windowStage.loadContent('testability/pages/Index', (err, data) => { + if (err.code) { + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', + JSON.stringify(data) ?? ''); + }); + } + + onWindowStageDestroy() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy'); + } + + onForeground() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground'); + } + + onBackground() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground'); + } +} \ No newline at end of file diff --git a/ohos/test_flutter_cache_manager/ohos/entry/src/ohosTest/ets/testability/pages/Index.ets b/ohos/test_flutter_cache_manager/ohos/entry/src/ohosTest/ets/testability/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..cef0447cd2f137ef82d223ead2e156808878ab90 --- /dev/null +++ b/ohos/test_flutter_cache_manager/ohos/entry/src/ohosTest/ets/testability/pages/Index.ets @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import hilog from '@ohos.hilog'; + +@Entry +@Component +struct Index { + aboutToAppear() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear'); + } + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } \ No newline at end of file diff --git a/ohos/test_flutter_cache_manager/ohos/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts b/ohos/test_flutter_cache_manager/ohos/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..1def08f2e9dcbfa3454a07b7a3b82b173bb90d02 --- /dev/null +++ b/ohos/test_flutter_cache_manager/ohos/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import hilog from '@ohos.hilog'; +import TestRunner from '@ohos.application.testRunner'; +import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +async function onAbilityCreateCallback() { + hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); +} + +async function addAbilityMonitorCallback(err: any) { + hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); + } + + async onRun() { + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility' + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName + var debug = abilityDelegatorArguments.parameters['-D'] + if (debug == 'true') + { + cmd += ' -D' + } + hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd); + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? ''); + hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? ''); + hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? ''); + }) + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end'); + } +} \ No newline at end of file diff --git a/ohos/test_flutter_cache_manager/ohos/entry/src/ohosTest/module.json5 b/ohos/test_flutter_cache_manager/ohos/entry/src/ohosTest/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..fab77ce2e0c61e3ad010bab5b27ccbd15f9a8c96 --- /dev/null +++ b/ohos/test_flutter_cache_manager/ohos/entry/src/ohosTest/module.json5 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +{ + "module": { + "name": "entry_test", + "type": "feature", + "description": "$string:module_test_desc", + "mainElement": "TestAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:test_pages", + "abilities": [ + { + "name": "TestAbility", + "srcEntry": "./ets/testability/TestAbility.ets", + "description": "$string:TestAbility_desc", + "icon": "$media:icon", + "label": "$string:TestAbility_label", + "exported": true, + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:start_window_background", + "skills": [ + { + "actions": [ + "action.system.home" + ], + "entities": [ + "entity.system.home" + ] + } + ] + } + ] + } +} diff --git a/ohos/test_flutter_cache_manager/ohos/entry/src/ohosTest/resources/base/element/color.json b/ohos/test_flutter_cache_manager/ohos/entry/src/ohosTest/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02 --- /dev/null +++ b/ohos/test_flutter_cache_manager/ohos/entry/src/ohosTest/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/ohos/test_flutter_cache_manager/ohos/entry/src/ohosTest/resources/base/element/string.json b/ohos/test_flutter_cache_manager/ohos/entry/src/ohosTest/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..65d8fa5a7cf54aa3943dcd0214f58d1771bc1f6c --- /dev/null +++ b/ohos/test_flutter_cache_manager/ohos/entry/src/ohosTest/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_test_desc", + "value": "test ability description" + }, + { + "name": "TestAbility_desc", + "value": "the test ability" + }, + { + "name": "TestAbility_label", + "value": "test label" + } + ] +} \ No newline at end of file diff --git a/ohos/test_flutter_cache_manager/ohos/entry/src/ohosTest/resources/base/media/icon.png b/ohos/test_flutter_cache_manager/ohos/entry/src/ohosTest/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ohos/test_flutter_cache_manager/ohos/entry/src/ohosTest/resources/base/media/icon.png differ diff --git a/ohos/test_flutter_cache_manager/ohos/entry/src/ohosTest/resources/base/profile/test_pages.json b/ohos/test_flutter_cache_manager/ohos/entry/src/ohosTest/resources/base/profile/test_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..b7e7343cacb32ce982a45e76daad86e435e054fe --- /dev/null +++ b/ohos/test_flutter_cache_manager/ohos/entry/src/ohosTest/resources/base/profile/test_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "testability/pages/Index" + ] +} diff --git a/ohos/test_flutter_cache_manager/ohos/har/flutter_embedding.har b/ohos/test_flutter_cache_manager/ohos/har/flutter_embedding.har new file mode 100644 index 0000000000000000000000000000000000000000..b75cb4e20800111a17d237ff0bc22eb8fd3d5875 Binary files /dev/null and b/ohos/test_flutter_cache_manager/ohos/har/flutter_embedding.har differ diff --git a/ohos/test_flutter_cache_manager/ohos/har/flutter_embedding.har.debug.10 b/ohos/test_flutter_cache_manager/ohos/har/flutter_embedding.har.debug.10 new file mode 100644 index 0000000000000000000000000000000000000000..b75cb4e20800111a17d237ff0bc22eb8fd3d5875 Binary files /dev/null and b/ohos/test_flutter_cache_manager/ohos/har/flutter_embedding.har.debug.10 differ diff --git a/ohos/test_flutter_cache_manager/ohos/har/flutter_embedding.har.debug.9 b/ohos/test_flutter_cache_manager/ohos/har/flutter_embedding.har.debug.9 new file mode 100644 index 0000000000000000000000000000000000000000..f0df4ca0064821178bf4254b16e8d23d873827da Binary files /dev/null and b/ohos/test_flutter_cache_manager/ohos/har/flutter_embedding.har.debug.9 differ diff --git a/ohos/test_flutter_cache_manager/ohos/har/flutter_embedding.har.release.10 b/ohos/test_flutter_cache_manager/ohos/har/flutter_embedding.har.release.10 new file mode 100644 index 0000000000000000000000000000000000000000..df4ad91a9a830bf776221dd2983cd02fc13a9e4f Binary files /dev/null and b/ohos/test_flutter_cache_manager/ohos/har/flutter_embedding.har.release.10 differ diff --git a/ohos/test_flutter_cache_manager/ohos/har/flutter_embedding.har.release.9 b/ohos/test_flutter_cache_manager/ohos/har/flutter_embedding.har.release.9 new file mode 100644 index 0000000000000000000000000000000000000000..ba52754a80826e5614438b3faf931ed2f487eaab Binary files /dev/null and b/ohos/test_flutter_cache_manager/ohos/har/flutter_embedding.har.release.9 differ diff --git a/ohos/test_flutter_cache_manager/ohos/hvigor/hvigor-config.json5 b/ohos/test_flutter_cache_manager/ohos/hvigor/hvigor-config.json5 new file mode 100644 index 0000000000000000000000000000000000000000..990085f6621b0d3e876a162e42eb2bc1bf441434 --- /dev/null +++ b/ohos/test_flutter_cache_manager/ohos/hvigor/hvigor-config.json5 @@ -0,0 +1,21 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +{ + "hvigorVersion": "2.1.1", + "dependencies": { + "@ohos/hvigor-ohos-plugin": "2.1.1" + } +} diff --git a/ohos/test_flutter_cache_manager/ohos/hvigor/hvigor-wrapper.js b/ohos/test_flutter_cache_manager/ohos/hvigor/hvigor-wrapper.js new file mode 100644 index 0000000000000000000000000000000000000000..994f22987bd0739b9faa07c966b066c2d9218602 --- /dev/null +++ b/ohos/test_flutter_cache_manager/ohos/hvigor/hvigor-wrapper.js @@ -0,0 +1,2 @@ +"use strict";var e=require("fs"),t=require("path"),n=require("os"),r=require("crypto"),u=require("child_process"),o=require("constants"),i=require("stream"),s=require("util"),c=require("assert"),a=require("tty"),l=require("zlib"),f=require("net");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var D=d(e),p=d(t),E=d(n),m=d(r),h=d(u),y=d(o),C=d(i),F=d(s),g=d(c),A=d(a),v=d(l),S=d(f),w="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},O={},b={},_={},B=w&&w.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(_,"__esModule",{value:!0}),_.isMac=_.isLinux=_.isWindows=void 0;const P=B(E.default),k="Windows_NT",x="Linux",N="Darwin";_.isWindows=function(){return P.default.type()===k},_.isLinux=function(){return P.default.type()===x},_.isMac=function(){return P.default.type()===N};var I={},T=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),R=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),M=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&T(t,e,n);return R(t,e),t};Object.defineProperty(I,"__esModule",{value:!0}),I.hash=void 0;const L=M(m.default);I.hash=function(e,t="md5"){return L.createHash(t).update(e,"utf-8").digest("hex")},function(e){var t=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),n=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var u in e)"default"!==u&&Object.prototype.hasOwnProperty.call(e,u)&&t(r,e,u);return n(r,e),r};Object.defineProperty(e,"__esModule",{value:!0}),e.HVIGOR_BOOT_JS_FILE_PATH=e.HVIGOR_PROJECT_DEPENDENCY_PACKAGE_JSON_PATH=e.HVIGOR_PROJECT_DEPENDENCIES_HOME=e.HVIGOR_PROJECT_WRAPPER_HOME=e.HVIGOR_PROJECT_NAME=e.HVIGOR_PROJECT_ROOT_DIR=e.HVIGOR_PROJECT_CACHES_HOME=e.HVIGOR_PNPM_STORE_PATH=e.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH=e.HVIGOR_WRAPPER_TOOLS_HOME=e.HVIGOR_USER_HOME=e.DEFAULT_PACKAGE_JSON=e.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME=e.PNPM=e.HVIGOR=e.NPM_TOOL=e.PNPM_TOOL=e.HVIGOR_ENGINE_PACKAGE_NAME=void 0;const u=r(p.default),o=r(E.default),i=_,s=I;e.HVIGOR_ENGINE_PACKAGE_NAME="@ohos/hvigor",e.PNPM_TOOL=(0,i.isWindows)()?"pnpm.cmd":"pnpm",e.NPM_TOOL=(0,i.isWindows)()?"npm.cmd":"npm",e.HVIGOR="hvigor",e.PNPM="pnpm",e.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME="hvigor-config.json5",e.DEFAULT_PACKAGE_JSON="package.json",e.HVIGOR_USER_HOME=u.resolve(o.homedir(),".hvigor"),e.HVIGOR_WRAPPER_TOOLS_HOME=u.resolve(e.HVIGOR_USER_HOME,"wrapper","tools"),e.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH=u.resolve(e.HVIGOR_WRAPPER_TOOLS_HOME,"node_modules",".bin",e.PNPM_TOOL),e.HVIGOR_PNPM_STORE_PATH=u.resolve(e.HVIGOR_USER_HOME,"caches"),e.HVIGOR_PROJECT_CACHES_HOME=u.resolve(e.HVIGOR_USER_HOME,"project_caches"),e.HVIGOR_PROJECT_ROOT_DIR=process.cwd(),e.HVIGOR_PROJECT_NAME=u.basename((0,s.hash)(e.HVIGOR_PROJECT_ROOT_DIR)),e.HVIGOR_PROJECT_WRAPPER_HOME=u.resolve(e.HVIGOR_PROJECT_ROOT_DIR,e.HVIGOR),e.HVIGOR_PROJECT_DEPENDENCIES_HOME=u.resolve(e.HVIGOR_PROJECT_CACHES_HOME,e.HVIGOR_PROJECT_NAME,"workspace"),e.HVIGOR_PROJECT_DEPENDENCY_PACKAGE_JSON_PATH=u.resolve(e.HVIGOR_PROJECT_DEPENDENCIES_HOME,e.DEFAULT_PACKAGE_JSON),e.HVIGOR_BOOT_JS_FILE_PATH=u.resolve(e.HVIGOR_PROJECT_DEPENDENCIES_HOME,"node_modules","@ohos","hvigor","bin","hvigor.js")}(b);var j={},$={};Object.defineProperty($,"__esModule",{value:!0}),$.logInfoPrintConsole=$.logErrorAndExit=void 0,$.logErrorAndExit=function(e){e instanceof Error?console.error(e.message):console.error(e),process.exit(-1)},$.logInfoPrintConsole=function(e){console.log(e)};var H=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),J=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),G=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&H(t,e,n);return J(t,e),t},V=w&&w.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(j,"__esModule",{value:!0}),j.isFileExists=j.offlinePluginConversion=j.executeCommand=j.getNpmPath=j.hasNpmPackInPaths=void 0;const U=h.default,W=G(p.default),z=b,K=$,q=V(D.default);j.hasNpmPackInPaths=function(e,t){try{return require.resolve(e,{paths:[...t]}),!0}catch(e){return!1}},j.getNpmPath=function(){const e=process.execPath;return W.join(W.dirname(e),z.NPM_TOOL)},j.executeCommand=function(e,t,n){0!==(0,U.spawnSync)(e,t,n).status&&(0,K.logErrorAndExit)(`Error: ${e} ${t} execute failed.See above for details.`)},j.offlinePluginConversion=function(e,t){return t.startsWith("file:")||t.endsWith(".tgz")?W.resolve(e,z.HVIGOR,t.replace("file:","")):t},j.isFileExists=function(e){return q.default.existsSync(e)&&q.default.statSync(e).isFile()},function(e){var t=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),n=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var u in e)"default"!==u&&Object.prototype.hasOwnProperty.call(e,u)&&t(r,e,u);return n(r,e),r},u=w&&w.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.executeInstallPnpm=e.isPnpmAvailable=e.environmentHandler=e.checkNpmConifg=e.PNPM_VERSION=void 0;const o=r(D.default),i=b,s=j,c=r(p.default),a=$,l=h.default,f=u(E.default);e.PNPM_VERSION="7.30.0",e.checkNpmConifg=function(){const e=c.resolve(i.HVIGOR_PROJECT_ROOT_DIR,".npmrc"),t=c.resolve(f.default.homedir(),".npmrc");if((0,s.isFileExists)(e)||(0,s.isFileExists)(t))return;const n=(0,s.getNpmPath)(),r=(0,l.spawnSync)(n,["config","get","prefix"],{cwd:i.HVIGOR_PROJECT_ROOT_DIR});if(0!==r.status||!r.stdout)return void(0,a.logErrorAndExit)("Error: The hvigor depends on the npmrc file. Configure the npmrc file first.");const u=c.resolve(`${r.stdout}`.replace(/[\r\n]/gi,""),".npmrc");(0,s.isFileExists)(u)||(0,a.logErrorAndExit)("Error: The hvigor depends on the npmrc file. Configure the npmrc file first.")},e.environmentHandler=function(){process.env["npm_config_update-notifier"]="false"},e.isPnpmAvailable=function(){return!!o.existsSync(i.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH)&&(0,s.hasNpmPackInPaths)("pnpm",[i.HVIGOR_WRAPPER_TOOLS_HOME])},e.executeInstallPnpm=function(){(0,a.logInfoPrintConsole)(`Installing pnpm@${e.PNPM_VERSION}...`);const t=(0,s.getNpmPath)();!function(){const t=c.resolve(i.HVIGOR_WRAPPER_TOOLS_HOME,i.DEFAULT_PACKAGE_JSON);try{o.existsSync(i.HVIGOR_WRAPPER_TOOLS_HOME)||o.mkdirSync(i.HVIGOR_WRAPPER_TOOLS_HOME,{recursive:!0});const n={dependencies:{}};n.dependencies[i.PNPM]=e.PNPM_VERSION,o.writeFileSync(t,JSON.stringify(n))}catch(e){(0,a.logErrorAndExit)(`Error: EPERM: operation not permitted,create ${t} failed.`)}}(),(0,s.executeCommand)(t,["install","pnpm"],{cwd:i.HVIGOR_WRAPPER_TOOLS_HOME,stdio:["inherit","inherit","inherit"],env:process.env}),(0,a.logInfoPrintConsole)("Pnpm install success.")}}(O);var Y={},X={},Z={},Q={};Object.defineProperty(Q,"__esModule",{value:!0}),Q.Unicode=void 0;class ee{}Q.Unicode=ee,ee.Space_Separator=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,ee.ID_Start=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,ee.ID_Continue=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,Object.defineProperty(Z,"__esModule",{value:!0}),Z.JudgeUtil=void 0;const te=Q;Z.JudgeUtil=class{static isIgnoreChar(e){return"string"==typeof e&&("\t"===e||"\v"===e||"\f"===e||" "===e||" "===e||"\ufeff"===e||"\n"===e||"\r"===e||"\u2028"===e||"\u2029"===e)}static isSpaceSeparator(e){return"string"==typeof e&&te.Unicode.Space_Separator.test(e)}static isIdStartChar(e){return"string"==typeof e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||"$"===e||"_"===e||te.Unicode.ID_Start.test(e))}static isIdContinueChar(e){return"string"==typeof e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||"$"===e||"_"===e||"‌"===e||"‍"===e||te.Unicode.ID_Continue.test(e))}static isDigitWithoutZero(e){return/[1-9]/.test(e)}static isDigit(e){return"string"==typeof e&&/[0-9]/.test(e)}static isHexDigit(e){return"string"==typeof e&&/[0-9A-Fa-f]/.test(e)}};var ne={},re={fromCallback:function(e){return Object.defineProperty((function(...t){if("function"!=typeof t[t.length-1])return new Promise(((n,r)=>{e.call(this,...t,((e,t)=>null!=e?r(e):n(t)))}));e.apply(this,t)}),"name",{value:e.name})},fromPromise:function(e){return Object.defineProperty((function(...t){const n=t[t.length-1];if("function"!=typeof n)return e.apply(this,t);e.apply(this,t.slice(0,-1)).then((e=>n(null,e)),n)}),"name",{value:e.name})}},ue=y.default,oe=process.cwd,ie=null,se=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return ie||(ie=oe.call(process)),ie};try{process.cwd()}catch(e){}if("function"==typeof process.chdir){var ce=process.chdir;process.chdir=function(e){ie=null,ce.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,ce)}var ae=function(e){ue.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&function(e){e.lchmod=function(t,n,r){e.open(t,ue.O_WRONLY|ue.O_SYMLINK,n,(function(t,u){t?r&&r(t):e.fchmod(u,n,(function(t){e.close(u,(function(e){r&&r(t||e)}))}))}))},e.lchmodSync=function(t,n){var r,u=e.openSync(t,ue.O_WRONLY|ue.O_SYMLINK,n),o=!0;try{r=e.fchmodSync(u,n),o=!1}finally{if(o)try{e.closeSync(u)}catch(e){}else e.closeSync(u)}return r}}(e);e.lutimes||function(e){ue.hasOwnProperty("O_SYMLINK")&&e.futimes?(e.lutimes=function(t,n,r,u){e.open(t,ue.O_SYMLINK,(function(t,o){t?u&&u(t):e.futimes(o,n,r,(function(t){e.close(o,(function(e){u&&u(t||e)}))}))}))},e.lutimesSync=function(t,n,r){var u,o=e.openSync(t,ue.O_SYMLINK),i=!0;try{u=e.futimesSync(o,n,r),i=!1}finally{if(i)try{e.closeSync(o)}catch(e){}else e.closeSync(o)}return u}):e.futimes&&(e.lutimes=function(e,t,n,r){r&&process.nextTick(r)},e.lutimesSync=function(){})}(e);e.chown=r(e.chown),e.fchown=r(e.fchown),e.lchown=r(e.lchown),e.chmod=t(e.chmod),e.fchmod=t(e.fchmod),e.lchmod=t(e.lchmod),e.chownSync=u(e.chownSync),e.fchownSync=u(e.fchownSync),e.lchownSync=u(e.lchownSync),e.chmodSync=n(e.chmodSync),e.fchmodSync=n(e.fchmodSync),e.lchmodSync=n(e.lchmodSync),e.stat=o(e.stat),e.fstat=o(e.fstat),e.lstat=o(e.lstat),e.statSync=i(e.statSync),e.fstatSync=i(e.fstatSync),e.lstatSync=i(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(e,t,n){n&&process.nextTick(n)},e.lchmodSync=function(){});e.chown&&!e.lchown&&(e.lchown=function(e,t,n,r){r&&process.nextTick(r)},e.lchownSync=function(){});"win32"===se&&(e.rename="function"!=typeof e.rename?e.rename:function(t){function n(n,r,u){var o=Date.now(),i=0;t(n,r,(function s(c){if(c&&("EACCES"===c.code||"EPERM"===c.code||"EBUSY"===c.code)&&Date.now()-o<6e4)return setTimeout((function(){e.stat(r,(function(e,o){e&&"ENOENT"===e.code?t(n,r,s):u(c)}))}),i),void(i<100&&(i+=10));u&&u(c)}))}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n}(e.rename));function t(t){return t?function(n,r,u){return t.call(e,n,r,(function(e){s(e)&&(e=null),u&&u.apply(this,arguments)}))}:t}function n(t){return t?function(n,r){try{return t.call(e,n,r)}catch(e){if(!s(e))throw e}}:t}function r(t){return t?function(n,r,u,o){return t.call(e,n,r,u,(function(e){s(e)&&(e=null),o&&o.apply(this,arguments)}))}:t}function u(t){return t?function(n,r,u){try{return t.call(e,n,r,u)}catch(e){if(!s(e))throw e}}:t}function o(t){return t?function(n,r,u){function o(e,t){t&&(t.uid<0&&(t.uid+=4294967296),t.gid<0&&(t.gid+=4294967296)),u&&u.apply(this,arguments)}return"function"==typeof r&&(u=r,r=null),r?t.call(e,n,r,o):t.call(e,n,o)}:t}function i(t){return t?function(n,r){var u=r?t.call(e,n,r):t.call(e,n);return u&&(u.uid<0&&(u.uid+=4294967296),u.gid<0&&(u.gid+=4294967296)),u}:t}function s(e){return!e||("ENOSYS"===e.code||!(process.getuid&&0===process.getuid()||"EINVAL"!==e.code&&"EPERM"!==e.code))}e.read="function"!=typeof e.read?e.read:function(t){function n(n,r,u,o,i,s){var c;if(s&&"function"==typeof s){var a=0;c=function(l,f,d){if(l&&"EAGAIN"===l.code&&a<10)return a++,t.call(e,n,r,u,o,i,c);s.apply(this,arguments)}}return t.call(e,n,r,u,o,i,c)}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n}(e.read),e.readSync="function"!=typeof e.readSync?e.readSync:(c=e.readSync,function(t,n,r,u,o){for(var i=0;;)try{return c.call(e,t,n,r,u,o)}catch(e){if("EAGAIN"===e.code&&i<10){i++;continue}throw e}});var c};var le=C.default.Stream,fe=function(e){return{ReadStream:function t(n,r){if(!(this instanceof t))return new t(n,r);le.call(this);var u=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,r=r||{};for(var o=Object.keys(r),i=0,s=o.length;ithis.end)throw new Error("start must be <= end");this.pos=this.start}if(null!==this.fd)return void process.nextTick((function(){u._read()}));e.open(this.path,this.flags,this.mode,(function(e,t){if(e)return u.emit("error",e),void(u.readable=!1);u.fd=t,u.emit("open",t),u._read()}))},WriteStream:function t(n,r){if(!(this instanceof t))return new t(n,r);le.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,r=r||{};for(var u=Object.keys(r),o=0,i=u.length;o= zero");this.pos=this.start}this.busy=!1,this._queue=[],null===this.fd&&(this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}};var de=function(e){if(null===e||"object"!=typeof e)return e;if(e instanceof Object)var t={__proto__:De(e)};else t=Object.create(null);return Object.getOwnPropertyNames(e).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})),t},De=Object.getPrototypeOf||function(e){return e.__proto__};var pe,Ee,me=D.default,he=ae,ye=fe,Ce=de,Fe=F.default;function ge(e,t){Object.defineProperty(e,pe,{get:function(){return t}})}"function"==typeof Symbol&&"function"==typeof Symbol.for?(pe=Symbol.for("graceful-fs.queue"),Ee=Symbol.for("graceful-fs.previous")):(pe="___graceful-fs.queue",Ee="___graceful-fs.previous");var Ae=function(){};if(Fe.debuglog?Ae=Fe.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(Ae=function(){var e=Fe.format.apply(Fe,arguments);e="GFS4: "+e.split(/\n/).join("\nGFS4: "),console.error(e)}),!me[pe]){var ve=w[pe]||[];ge(me,ve),me.close=function(e){function t(t,n){return e.call(me,t,(function(e){e||_e(),"function"==typeof n&&n.apply(this,arguments)}))}return Object.defineProperty(t,Ee,{value:e}),t}(me.close),me.closeSync=function(e){function t(t){e.apply(me,arguments),_e()}return Object.defineProperty(t,Ee,{value:e}),t}(me.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",(function(){Ae(me[pe]),g.default.equal(me[pe].length,0)}))}w[pe]||ge(w,me[pe]);var Se,we=Oe(Ce(me));function Oe(e){he(e),e.gracefulify=Oe,e.createReadStream=function(t,n){return new e.ReadStream(t,n)},e.createWriteStream=function(t,n){return new e.WriteStream(t,n)};var t=e.readFile;e.readFile=function(e,n,r){"function"==typeof n&&(r=n,n=null);return function e(n,r,u,o){return t(n,r,(function(t){!t||"EMFILE"!==t.code&&"ENFILE"!==t.code?"function"==typeof u&&u.apply(this,arguments):be([e,[n,r,u],t,o||Date.now(),Date.now()])}))}(e,n,r)};var n=e.writeFile;e.writeFile=function(e,t,r,u){"function"==typeof r&&(u=r,r=null);return function e(t,r,u,o,i){return n(t,r,u,(function(n){!n||"EMFILE"!==n.code&&"ENFILE"!==n.code?"function"==typeof o&&o.apply(this,arguments):be([e,[t,r,u,o],n,i||Date.now(),Date.now()])}))}(e,t,r,u)};var r=e.appendFile;r&&(e.appendFile=function(e,t,n,u){"function"==typeof n&&(u=n,n=null);return function e(t,n,u,o,i){return r(t,n,u,(function(r){!r||"EMFILE"!==r.code&&"ENFILE"!==r.code?"function"==typeof o&&o.apply(this,arguments):be([e,[t,n,u,o],r,i||Date.now(),Date.now()])}))}(e,t,n,u)});var u=e.copyFile;u&&(e.copyFile=function(e,t,n,r){"function"==typeof n&&(r=n,n=0);return function e(t,n,r,o,i){return u(t,n,r,(function(u){!u||"EMFILE"!==u.code&&"ENFILE"!==u.code?"function"==typeof o&&o.apply(this,arguments):be([e,[t,n,r,o],u,i||Date.now(),Date.now()])}))}(e,t,n,r)});var o=e.readdir;e.readdir=function(e,t,n){"function"==typeof t&&(n=t,t=null);var r=i.test(process.version)?function(e,t,n,r){return o(e,u(e,t,n,r))}:function(e,t,n,r){return o(e,t,u(e,t,n,r))};return r(e,t,n);function u(e,t,n,u){return function(o,i){!o||"EMFILE"!==o.code&&"ENFILE"!==o.code?(i&&i.sort&&i.sort(),"function"==typeof n&&n.call(this,o,i)):be([r,[e,t,n],o,u||Date.now(),Date.now()])}}};var i=/^v[0-5]\./;if("v0.8"===process.version.substr(0,4)){var s=ye(e);d=s.ReadStream,D=s.WriteStream}var c=e.ReadStream;c&&(d.prototype=Object.create(c.prototype),d.prototype.open=function(){var e=this;E(e.path,e.flags,e.mode,(function(t,n){t?(e.autoClose&&e.destroy(),e.emit("error",t)):(e.fd=n,e.emit("open",n),e.read())}))});var a=e.WriteStream;a&&(D.prototype=Object.create(a.prototype),D.prototype.open=function(){var e=this;E(e.path,e.flags,e.mode,(function(t,n){t?(e.destroy(),e.emit("error",t)):(e.fd=n,e.emit("open",n))}))}),Object.defineProperty(e,"ReadStream",{get:function(){return d},set:function(e){d=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return D},set:function(e){D=e},enumerable:!0,configurable:!0});var l=d;Object.defineProperty(e,"FileReadStream",{get:function(){return l},set:function(e){l=e},enumerable:!0,configurable:!0});var f=D;function d(e,t){return this instanceof d?(c.apply(this,arguments),this):d.apply(Object.create(d.prototype),arguments)}function D(e,t){return this instanceof D?(a.apply(this,arguments),this):D.apply(Object.create(D.prototype),arguments)}Object.defineProperty(e,"FileWriteStream",{get:function(){return f},set:function(e){f=e},enumerable:!0,configurable:!0});var p=e.open;function E(e,t,n,r){return"function"==typeof n&&(r=n,n=null),function e(t,n,r,u,o){return p(t,n,r,(function(i,s){!i||"EMFILE"!==i.code&&"ENFILE"!==i.code?"function"==typeof u&&u.apply(this,arguments):be([e,[t,n,r,u],i,o||Date.now(),Date.now()])}))}(e,t,n,r)}return e.open=E,e}function be(e){Ae("ENQUEUE",e[0].name,e[1]),me[pe].push(e),Be()}function _e(){for(var e=Date.now(),t=0;t2&&(me[pe][t][3]=e,me[pe][t][4]=e);Be()}function Be(){if(clearTimeout(Se),Se=void 0,0!==me[pe].length){var e=me[pe].shift(),t=e[0],n=e[1],r=e[2],u=e[3],o=e[4];if(void 0===u)Ae("RETRY",t.name,n),t.apply(null,n);else if(Date.now()-u>=6e4){Ae("TIMEOUT",t.name,n);var i=n.pop();"function"==typeof i&&i.call(null,r)}else{var s=Date.now()-o,c=Math.max(o-u,1);s>=Math.min(1.2*c,100)?(Ae("RETRY",t.name,n),t.apply(null,n.concat([u]))):me[pe].push(e)}void 0===Se&&(Se=setTimeout(Be,0))}}process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!me.__patched&&(we=Oe(me),me.__patched=!0),function(e){const t=re.fromCallback,n=we,r=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchmod","lchown","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter((e=>"function"==typeof n[e]));Object.assign(e,n),r.forEach((r=>{e[r]=t(n[r])})),e.realpath.native=t(n.realpath.native),e.exists=function(e,t){return"function"==typeof t?n.exists(e,t):new Promise((t=>n.exists(e,t)))},e.read=function(e,t,r,u,o,i){return"function"==typeof i?n.read(e,t,r,u,o,i):new Promise(((i,s)=>{n.read(e,t,r,u,o,((e,t,n)=>{if(e)return s(e);i({bytesRead:t,buffer:n})}))}))},e.write=function(e,t,...r){return"function"==typeof r[r.length-1]?n.write(e,t,...r):new Promise(((u,o)=>{n.write(e,t,...r,((e,t,n)=>{if(e)return o(e);u({bytesWritten:t,buffer:n})}))}))},"function"==typeof n.writev&&(e.writev=function(e,t,...r){return"function"==typeof r[r.length-1]?n.writev(e,t,...r):new Promise(((u,o)=>{n.writev(e,t,...r,((e,t,n)=>{if(e)return o(e);u({bytesWritten:t,buffers:n})}))}))})}(ne);var Pe={},ke={};const xe=p.default;ke.checkPath=function(e){if("win32"===process.platform){if(/[<>:"|?*]/.test(e.replace(xe.parse(e).root,""))){const t=new Error(`Path contains invalid characters: ${e}`);throw t.code="EINVAL",t}}};const Ne=ne,{checkPath:Ie}=ke,Te=e=>"number"==typeof e?e:{mode:511,...e}.mode;Pe.makeDir=async(e,t)=>(Ie(e),Ne.mkdir(e,{mode:Te(t),recursive:!0})),Pe.makeDirSync=(e,t)=>(Ie(e),Ne.mkdirSync(e,{mode:Te(t),recursive:!0}));const Re=re.fromPromise,{makeDir:Me,makeDirSync:Le}=Pe,je=Re(Me);var $e={mkdirs:je,mkdirsSync:Le,mkdirp:je,mkdirpSync:Le,ensureDir:je,ensureDirSync:Le};const He=re.fromPromise,Je=ne;var Ge={pathExists:He((function(e){return Je.access(e).then((()=>!0)).catch((()=>!1))})),pathExistsSync:Je.existsSync};const Ve=we;var Ue=function(e,t,n,r){Ve.open(e,"r+",((e,u)=>{if(e)return r(e);Ve.futimes(u,t,n,(e=>{Ve.close(u,(t=>{r&&r(e||t)}))}))}))},We=function(e,t,n){const r=Ve.openSync(e,"r+");return Ve.futimesSync(r,t,n),Ve.closeSync(r)};const ze=ne,Ke=p.default,qe=F.default;function Ye(e,t,n){const r=n.dereference?e=>ze.stat(e,{bigint:!0}):e=>ze.lstat(e,{bigint:!0});return Promise.all([r(e),r(t).catch((e=>{if("ENOENT"===e.code)return null;throw e}))]).then((([e,t])=>({srcStat:e,destStat:t})))}function Xe(e,t){return t.ino&&t.dev&&t.ino===e.ino&&t.dev===e.dev}function Ze(e,t){const n=Ke.resolve(e).split(Ke.sep).filter((e=>e)),r=Ke.resolve(t).split(Ke.sep).filter((e=>e));return n.reduce(((e,t,n)=>e&&r[n]===t),!0)}function Qe(e,t,n){return`Cannot ${n} '${e}' to a subdirectory of itself, '${t}'.`}var et={checkPaths:function(e,t,n,r,u){qe.callbackify(Ye)(e,t,r,((r,o)=>{if(r)return u(r);const{srcStat:i,destStat:s}=o;if(s){if(Xe(i,s)){const r=Ke.basename(e),o=Ke.basename(t);return"move"===n&&r!==o&&r.toLowerCase()===o.toLowerCase()?u(null,{srcStat:i,destStat:s,isChangingCase:!0}):u(new Error("Source and destination must not be the same."))}if(i.isDirectory()&&!s.isDirectory())return u(new Error(`Cannot overwrite non-directory '${t}' with directory '${e}'.`));if(!i.isDirectory()&&s.isDirectory())return u(new Error(`Cannot overwrite directory '${t}' with non-directory '${e}'.`))}return i.isDirectory()&&Ze(e,t)?u(new Error(Qe(e,t,n))):u(null,{srcStat:i,destStat:s})}))},checkPathsSync:function(e,t,n,r){const{srcStat:u,destStat:o}=function(e,t,n){let r;const u=n.dereference?e=>ze.statSync(e,{bigint:!0}):e=>ze.lstatSync(e,{bigint:!0}),o=u(e);try{r=u(t)}catch(e){if("ENOENT"===e.code)return{srcStat:o,destStat:null};throw e}return{srcStat:o,destStat:r}}(e,t,r);if(o){if(Xe(u,o)){const r=Ke.basename(e),i=Ke.basename(t);if("move"===n&&r!==i&&r.toLowerCase()===i.toLowerCase())return{srcStat:u,destStat:o,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(u.isDirectory()&&!o.isDirectory())throw new Error(`Cannot overwrite non-directory '${t}' with directory '${e}'.`);if(!u.isDirectory()&&o.isDirectory())throw new Error(`Cannot overwrite directory '${t}' with non-directory '${e}'.`)}if(u.isDirectory()&&Ze(e,t))throw new Error(Qe(e,t,n));return{srcStat:u,destStat:o}},checkParentPaths:function e(t,n,r,u,o){const i=Ke.resolve(Ke.dirname(t)),s=Ke.resolve(Ke.dirname(r));if(s===i||s===Ke.parse(s).root)return o();ze.stat(s,{bigint:!0},((i,c)=>i?"ENOENT"===i.code?o():o(i):Xe(n,c)?o(new Error(Qe(t,r,u))):e(t,n,s,u,o)))},checkParentPathsSync:function e(t,n,r,u){const o=Ke.resolve(Ke.dirname(t)),i=Ke.resolve(Ke.dirname(r));if(i===o||i===Ke.parse(i).root)return;let s;try{s=ze.statSync(i,{bigint:!0})}catch(e){if("ENOENT"===e.code)return;throw e}if(Xe(n,s))throw new Error(Qe(t,r,u));return e(t,n,i,u)},isSrcSubdir:Ze,areIdentical:Xe};const tt=we,nt=p.default,rt=$e.mkdirs,ut=Ge.pathExists,ot=Ue,it=et;function st(e,t,n,r,u){const o=nt.dirname(n);ut(o,((i,s)=>i?u(i):s?at(e,t,n,r,u):void rt(o,(o=>o?u(o):at(e,t,n,r,u)))))}function ct(e,t,n,r,u,o){Promise.resolve(u.filter(n,r)).then((i=>i?e(t,n,r,u,o):o()),(e=>o(e)))}function at(e,t,n,r,u){(r.dereference?tt.stat:tt.lstat)(t,((o,i)=>o?u(o):i.isDirectory()?function(e,t,n,r,u,o){return t?Dt(n,r,u,o):function(e,t,n,r,u){tt.mkdir(n,(o=>{if(o)return u(o);Dt(t,n,r,(t=>t?u(t):dt(n,e,u)))}))}(e.mode,n,r,u,o)}(i,e,t,n,r,u):i.isFile()||i.isCharacterDevice()||i.isBlockDevice()?function(e,t,n,r,u,o){return t?function(e,t,n,r,u){if(!r.overwrite)return r.errorOnExist?u(new Error(`'${n}' already exists`)):u();tt.unlink(n,(o=>o?u(o):lt(e,t,n,r,u)))}(e,n,r,u,o):lt(e,n,r,u,o)}(i,e,t,n,r,u):i.isSymbolicLink()?function(e,t,n,r,u){tt.readlink(t,((t,o)=>t?u(t):(r.dereference&&(o=nt.resolve(process.cwd(),o)),e?void tt.readlink(n,((t,i)=>t?"EINVAL"===t.code||"UNKNOWN"===t.code?tt.symlink(o,n,u):u(t):(r.dereference&&(i=nt.resolve(process.cwd(),i)),it.isSrcSubdir(o,i)?u(new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`)):e.isDirectory()&&it.isSrcSubdir(i,o)?u(new Error(`Cannot overwrite '${i}' with '${o}'.`)):function(e,t,n){tt.unlink(t,(r=>r?n(r):tt.symlink(e,t,n)))}(o,n,u)))):tt.symlink(o,n,u))))}(e,t,n,r,u):i.isSocket()?u(new Error(`Cannot copy a socket file: ${t}`)):i.isFIFO()?u(new Error(`Cannot copy a FIFO pipe: ${t}`)):u(new Error(`Unknown file: ${t}`))))}function lt(e,t,n,r,u){tt.copyFile(t,n,(o=>o?u(o):r.preserveTimestamps?function(e,t,n,r){if(function(e){return 0==(128&e)}(e))return function(e,t,n){return dt(e,128|t,n)}(n,e,(u=>u?r(u):ft(e,t,n,r)));return ft(e,t,n,r)}(e.mode,t,n,u):dt(n,e.mode,u)))}function ft(e,t,n,r){!function(e,t,n){tt.stat(e,((e,r)=>e?n(e):ot(t,r.atime,r.mtime,n)))}(t,n,(t=>t?r(t):dt(n,e,r)))}function dt(e,t,n){return tt.chmod(e,t,n)}function Dt(e,t,n,r){tt.readdir(e,((u,o)=>u?r(u):pt(o,e,t,n,r)))}function pt(e,t,n,r,u){const o=e.pop();return o?function(e,t,n,r,u,o){const i=nt.join(n,t),s=nt.join(r,t);it.checkPaths(i,s,"copy",u,((t,c)=>{if(t)return o(t);const{destStat:a}=c;!function(e,t,n,r,u){r.filter?ct(at,e,t,n,r,u):at(e,t,n,r,u)}(a,i,s,u,(t=>t?o(t):pt(e,n,r,u,o)))}))}(e,o,t,n,r,u):u()}var Et=function(e,t,n,r){"function"!=typeof n||r?"function"==typeof n&&(n={filter:n}):(r=n,n={}),r=r||function(){},(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269"),it.checkPaths(e,t,"copy",n,((u,o)=>{if(u)return r(u);const{srcStat:i,destStat:s}=o;it.checkParentPaths(e,i,t,"copy",(u=>u?r(u):n.filter?ct(st,s,e,t,n,r):st(s,e,t,n,r)))}))};const mt=we,ht=p.default,yt=$e.mkdirsSync,Ct=We,Ft=et;function gt(e,t,n,r){const u=(r.dereference?mt.statSync:mt.lstatSync)(t);if(u.isDirectory())return function(e,t,n,r,u){return t?St(n,r,u):function(e,t,n,r){return mt.mkdirSync(n),St(t,n,r),vt(n,e)}(e.mode,n,r,u)}(u,e,t,n,r);if(u.isFile()||u.isCharacterDevice()||u.isBlockDevice())return function(e,t,n,r,u){return t?function(e,t,n,r){if(r.overwrite)return mt.unlinkSync(n),At(e,t,n,r);if(r.errorOnExist)throw new Error(`'${n}' already exists`)}(e,n,r,u):At(e,n,r,u)}(u,e,t,n,r);if(u.isSymbolicLink())return function(e,t,n,r){let u=mt.readlinkSync(t);r.dereference&&(u=ht.resolve(process.cwd(),u));if(e){let e;try{e=mt.readlinkSync(n)}catch(e){if("EINVAL"===e.code||"UNKNOWN"===e.code)return mt.symlinkSync(u,n);throw e}if(r.dereference&&(e=ht.resolve(process.cwd(),e)),Ft.isSrcSubdir(u,e))throw new Error(`Cannot copy '${u}' to a subdirectory of itself, '${e}'.`);if(mt.statSync(n).isDirectory()&&Ft.isSrcSubdir(e,u))throw new Error(`Cannot overwrite '${e}' with '${u}'.`);return function(e,t){return mt.unlinkSync(t),mt.symlinkSync(e,t)}(u,n)}return mt.symlinkSync(u,n)}(e,t,n,r);if(u.isSocket())throw new Error(`Cannot copy a socket file: ${t}`);if(u.isFIFO())throw new Error(`Cannot copy a FIFO pipe: ${t}`);throw new Error(`Unknown file: ${t}`)}function At(e,t,n,r){return mt.copyFileSync(t,n),r.preserveTimestamps&&function(e,t,n){(function(e){return 0==(128&e)})(e)&&function(e,t){vt(e,128|t)}(n,e);(function(e,t){const n=mt.statSync(e);Ct(t,n.atime,n.mtime)})(t,n)}(e.mode,t,n),vt(n,e.mode)}function vt(e,t){return mt.chmodSync(e,t)}function St(e,t,n){mt.readdirSync(e).forEach((r=>function(e,t,n,r){const u=ht.join(t,e),o=ht.join(n,e),{destStat:i}=Ft.checkPathsSync(u,o,"copy",r);return function(e,t,n,r){if(!r.filter||r.filter(t,n))return gt(e,t,n,r)}(i,u,o,r)}(r,e,t,n)))}var wt=function(e,t,n){"function"==typeof n&&(n={filter:n}),(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269");const{srcStat:r,destStat:u}=Ft.checkPathsSync(e,t,"copy",n);return Ft.checkParentPathsSync(e,r,t,"copy"),function(e,t,n,r){if(r.filter&&!r.filter(t,n))return;const u=ht.dirname(n);mt.existsSync(u)||yt(u);return gt(e,t,n,r)}(u,e,t,n)};var Ot={copy:(0,re.fromCallback)(Et),copySync:wt};const bt=we,_t=p.default,Bt=g.default,Pt="win32"===process.platform;function kt(e){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach((t=>{e[t]=e[t]||bt[t],e[t+="Sync"]=e[t]||bt[t]})),e.maxBusyTries=e.maxBusyTries||3}function xt(e,t,n){let r=0;"function"==typeof t&&(n=t,t={}),Bt(e,"rimraf: missing path"),Bt.strictEqual(typeof e,"string","rimraf: path should be a string"),Bt.strictEqual(typeof n,"function","rimraf: callback function required"),Bt(t,"rimraf: invalid options argument provided"),Bt.strictEqual(typeof t,"object","rimraf: options should be object"),kt(t),Nt(e,t,(function u(o){if(o){if(("EBUSY"===o.code||"ENOTEMPTY"===o.code||"EPERM"===o.code)&&rNt(e,t,u)),100*r)}"ENOENT"===o.code&&(o=null)}n(o)}))}function Nt(e,t,n){Bt(e),Bt(t),Bt("function"==typeof n),t.lstat(e,((r,u)=>r&&"ENOENT"===r.code?n(null):r&&"EPERM"===r.code&&Pt?It(e,t,r,n):u&&u.isDirectory()?Rt(e,t,r,n):void t.unlink(e,(r=>{if(r){if("ENOENT"===r.code)return n(null);if("EPERM"===r.code)return Pt?It(e,t,r,n):Rt(e,t,r,n);if("EISDIR"===r.code)return Rt(e,t,r,n)}return n(r)}))))}function It(e,t,n,r){Bt(e),Bt(t),Bt("function"==typeof r),t.chmod(e,438,(u=>{u?r("ENOENT"===u.code?null:n):t.stat(e,((u,o)=>{u?r("ENOENT"===u.code?null:n):o.isDirectory()?Rt(e,t,n,r):t.unlink(e,r)}))}))}function Tt(e,t,n){let r;Bt(e),Bt(t);try{t.chmodSync(e,438)}catch(e){if("ENOENT"===e.code)return;throw n}try{r=t.statSync(e)}catch(e){if("ENOENT"===e.code)return;throw n}r.isDirectory()?Lt(e,t,n):t.unlinkSync(e)}function Rt(e,t,n,r){Bt(e),Bt(t),Bt("function"==typeof r),t.rmdir(e,(u=>{!u||"ENOTEMPTY"!==u.code&&"EEXIST"!==u.code&&"EPERM"!==u.code?u&&"ENOTDIR"===u.code?r(n):r(u):function(e,t,n){Bt(e),Bt(t),Bt("function"==typeof n),t.readdir(e,((r,u)=>{if(r)return n(r);let o,i=u.length;if(0===i)return t.rmdir(e,n);u.forEach((r=>{xt(_t.join(e,r),t,(r=>{if(!o)return r?n(o=r):void(0==--i&&t.rmdir(e,n))}))}))}))}(e,t,r)}))}function Mt(e,t){let n;kt(t=t||{}),Bt(e,"rimraf: missing path"),Bt.strictEqual(typeof e,"string","rimraf: path should be a string"),Bt(t,"rimraf: missing options"),Bt.strictEqual(typeof t,"object","rimraf: options should be object");try{n=t.lstatSync(e)}catch(n){if("ENOENT"===n.code)return;"EPERM"===n.code&&Pt&&Tt(e,t,n)}try{n&&n.isDirectory()?Lt(e,t,null):t.unlinkSync(e)}catch(n){if("ENOENT"===n.code)return;if("EPERM"===n.code)return Pt?Tt(e,t,n):Lt(e,t,n);if("EISDIR"!==n.code)throw n;Lt(e,t,n)}}function Lt(e,t,n){Bt(e),Bt(t);try{t.rmdirSync(e)}catch(r){if("ENOTDIR"===r.code)throw n;if("ENOTEMPTY"===r.code||"EEXIST"===r.code||"EPERM"===r.code)!function(e,t){if(Bt(e),Bt(t),t.readdirSync(e).forEach((n=>Mt(_t.join(e,n),t))),!Pt){return t.rmdirSync(e,t)}{const n=Date.now();do{try{return t.rmdirSync(e,t)}catch{}}while(Date.now()-n<500)}}(e,t);else if("ENOENT"!==r.code)throw r}}var jt=xt;xt.sync=Mt;const $t=we,Ht=re.fromCallback,Jt=jt;var Gt={remove:Ht((function(e,t){if($t.rm)return $t.rm(e,{recursive:!0,force:!0},t);Jt(e,t)})),removeSync:function(e){if($t.rmSync)return $t.rmSync(e,{recursive:!0,force:!0});Jt.sync(e)}};const Vt=re.fromPromise,Ut=ne,Wt=p.default,zt=$e,Kt=Gt,qt=Vt((async function(e){let t;try{t=await Ut.readdir(e)}catch{return zt.mkdirs(e)}return Promise.all(t.map((t=>Kt.remove(Wt.join(e,t)))))}));function Yt(e){let t;try{t=Ut.readdirSync(e)}catch{return zt.mkdirsSync(e)}t.forEach((t=>{t=Wt.join(e,t),Kt.removeSync(t)}))}var Xt={emptyDirSync:Yt,emptydirSync:Yt,emptyDir:qt,emptydir:qt};const Zt=re.fromCallback,Qt=p.default,en=we,tn=$e;var nn={createFile:Zt((function(e,t){function n(){en.writeFile(e,"",(e=>{if(e)return t(e);t()}))}en.stat(e,((r,u)=>{if(!r&&u.isFile())return t();const o=Qt.dirname(e);en.stat(o,((e,r)=>{if(e)return"ENOENT"===e.code?tn.mkdirs(o,(e=>{if(e)return t(e);n()})):t(e);r.isDirectory()?n():en.readdir(o,(e=>{if(e)return t(e)}))}))}))})),createFileSync:function(e){let t;try{t=en.statSync(e)}catch{}if(t&&t.isFile())return;const n=Qt.dirname(e);try{en.statSync(n).isDirectory()||en.readdirSync(n)}catch(e){if(!e||"ENOENT"!==e.code)throw e;tn.mkdirsSync(n)}en.writeFileSync(e,"")}};const rn=re.fromCallback,un=p.default,on=we,sn=$e,cn=Ge.pathExists,{areIdentical:an}=et;var ln={createLink:rn((function(e,t,n){function r(e,t){on.link(e,t,(e=>{if(e)return n(e);n(null)}))}on.lstat(t,((u,o)=>{on.lstat(e,((u,i)=>{if(u)return u.message=u.message.replace("lstat","ensureLink"),n(u);if(o&&an(i,o))return n(null);const s=un.dirname(t);cn(s,((u,o)=>u?n(u):o?r(e,t):void sn.mkdirs(s,(u=>{if(u)return n(u);r(e,t)}))))}))}))})),createLinkSync:function(e,t){let n;try{n=on.lstatSync(t)}catch{}try{const t=on.lstatSync(e);if(n&&an(t,n))return}catch(e){throw e.message=e.message.replace("lstat","ensureLink"),e}const r=un.dirname(t);return on.existsSync(r)||sn.mkdirsSync(r),on.linkSync(e,t)}};const fn=p.default,dn=we,Dn=Ge.pathExists;var pn={symlinkPaths:function(e,t,n){if(fn.isAbsolute(e))return dn.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:e})));{const r=fn.dirname(t),u=fn.join(r,e);return Dn(u,((t,o)=>t?n(t):o?n(null,{toCwd:u,toDst:e}):dn.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:fn.relative(r,e)})))))}},symlinkPathsSync:function(e,t){let n;if(fn.isAbsolute(e)){if(n=dn.existsSync(e),!n)throw new Error("absolute srcpath does not exist");return{toCwd:e,toDst:e}}{const r=fn.dirname(t),u=fn.join(r,e);if(n=dn.existsSync(u),n)return{toCwd:u,toDst:e};if(n=dn.existsSync(e),!n)throw new Error("relative srcpath does not exist");return{toCwd:e,toDst:fn.relative(r,e)}}}};const En=we;var mn={symlinkType:function(e,t,n){if(n="function"==typeof t?t:n,t="function"!=typeof t&&t)return n(null,t);En.lstat(e,((e,r)=>{if(e)return n(null,"file");t=r&&r.isDirectory()?"dir":"file",n(null,t)}))},symlinkTypeSync:function(e,t){let n;if(t)return t;try{n=En.lstatSync(e)}catch{return"file"}return n&&n.isDirectory()?"dir":"file"}};const hn=re.fromCallback,yn=p.default,Cn=ne,Fn=$e.mkdirs,gn=$e.mkdirsSync,An=pn.symlinkPaths,vn=pn.symlinkPathsSync,Sn=mn.symlinkType,wn=mn.symlinkTypeSync,On=Ge.pathExists,{areIdentical:bn}=et;function _n(e,t,n,r){An(e,t,((u,o)=>{if(u)return r(u);e=o.toDst,Sn(o.toCwd,n,((n,u)=>{if(n)return r(n);const o=yn.dirname(t);On(o,((n,i)=>n?r(n):i?Cn.symlink(e,t,u,r):void Fn(o,(n=>{if(n)return r(n);Cn.symlink(e,t,u,r)}))))}))}))}var Bn={createSymlink:hn((function(e,t,n,r){r="function"==typeof n?n:r,n="function"!=typeof n&&n,Cn.lstat(t,((u,o)=>{!u&&o.isSymbolicLink()?Promise.all([Cn.stat(e),Cn.stat(t)]).then((([u,o])=>{if(bn(u,o))return r(null);_n(e,t,n,r)})):_n(e,t,n,r)}))})),createSymlinkSync:function(e,t,n){let r;try{r=Cn.lstatSync(t)}catch{}if(r&&r.isSymbolicLink()){const n=Cn.statSync(e),r=Cn.statSync(t);if(bn(n,r))return}const u=vn(e,t);e=u.toDst,n=wn(u.toCwd,n);const o=yn.dirname(t);return Cn.existsSync(o)||gn(o),Cn.symlinkSync(e,t,n)}};const{createFile:Pn,createFileSync:kn}=nn,{createLink:xn,createLinkSync:Nn}=ln,{createSymlink:In,createSymlinkSync:Tn}=Bn;var Rn={createFile:Pn,createFileSync:kn,ensureFile:Pn,ensureFileSync:kn,createLink:xn,createLinkSync:Nn,ensureLink:xn,ensureLinkSync:Nn,createSymlink:In,createSymlinkSync:Tn,ensureSymlink:In,ensureSymlinkSync:Tn};var Mn={stringify:function(e,{EOL:t="\n",finalEOL:n=!0,replacer:r=null,spaces:u}={}){const o=n?t:"";return JSON.stringify(e,r,u).replace(/\n/g,t)+o},stripBom:function(e){return Buffer.isBuffer(e)&&(e=e.toString("utf8")),e.replace(/^\uFEFF/,"")}};let Ln;try{Ln=we}catch(e){Ln=D.default}const jn=re,{stringify:$n,stripBom:Hn}=Mn;const Jn=jn.fromPromise((async function(e,t={}){"string"==typeof t&&(t={encoding:t});const n=t.fs||Ln,r=!("throws"in t)||t.throws;let u,o=await jn.fromCallback(n.readFile)(e,t);o=Hn(o);try{u=JSON.parse(o,t?t.reviver:null)}catch(t){if(r)throw t.message=`${e}: ${t.message}`,t;return null}return u}));const Gn=jn.fromPromise((async function(e,t,n={}){const r=n.fs||Ln,u=$n(t,n);await jn.fromCallback(r.writeFile)(e,u,n)}));const Vn={readFile:Jn,readFileSync:function(e,t={}){"string"==typeof t&&(t={encoding:t});const n=t.fs||Ln,r=!("throws"in t)||t.throws;try{let r=n.readFileSync(e,t);return r=Hn(r),JSON.parse(r,t.reviver)}catch(t){if(r)throw t.message=`${e}: ${t.message}`,t;return null}},writeFile:Gn,writeFileSync:function(e,t,n={}){const r=n.fs||Ln,u=$n(t,n);return r.writeFileSync(e,u,n)}};var Un={readJson:Vn.readFile,readJsonSync:Vn.readFileSync,writeJson:Vn.writeFile,writeJsonSync:Vn.writeFileSync};const Wn=re.fromCallback,zn=we,Kn=p.default,qn=$e,Yn=Ge.pathExists;var Xn={outputFile:Wn((function(e,t,n,r){"function"==typeof n&&(r=n,n="utf8");const u=Kn.dirname(e);Yn(u,((o,i)=>o?r(o):i?zn.writeFile(e,t,n,r):void qn.mkdirs(u,(u=>{if(u)return r(u);zn.writeFile(e,t,n,r)}))))})),outputFileSync:function(e,...t){const n=Kn.dirname(e);if(zn.existsSync(n))return zn.writeFileSync(e,...t);qn.mkdirsSync(n),zn.writeFileSync(e,...t)}};const{stringify:Zn}=Mn,{outputFile:Qn}=Xn;var er=async function(e,t,n={}){const r=Zn(t,n);await Qn(e,r,n)};const{stringify:tr}=Mn,{outputFileSync:nr}=Xn;var rr=function(e,t,n){const r=tr(t,n);nr(e,r,n)};const ur=re.fromPromise,or=Un;or.outputJson=ur(er),or.outputJsonSync=rr,or.outputJSON=or.outputJson,or.outputJSONSync=or.outputJsonSync,or.writeJSON=or.writeJson,or.writeJSONSync=or.writeJsonSync,or.readJSON=or.readJson,or.readJSONSync=or.readJsonSync;var ir=or;const sr=we,cr=p.default,ar=Ot.copy,lr=Gt.remove,fr=$e.mkdirp,dr=Ge.pathExists,Dr=et;function pr(e,t,n,r,u){return r?Er(e,t,n,u):n?lr(t,(r=>r?u(r):Er(e,t,n,u))):void dr(t,((r,o)=>r?u(r):o?u(new Error("dest already exists.")):Er(e,t,n,u)))}function Er(e,t,n,r){sr.rename(e,t,(u=>u?"EXDEV"!==u.code?r(u):function(e,t,n,r){const u={overwrite:n,errorOnExist:!0};ar(e,t,u,(t=>t?r(t):lr(e,r)))}(e,t,n,r):r()))}var mr=function(e,t,n,r){"function"==typeof n&&(r=n,n={});const u=n.overwrite||n.clobber||!1;Dr.checkPaths(e,t,"move",n,((n,o)=>{if(n)return r(n);const{srcStat:i,isChangingCase:s=!1}=o;Dr.checkParentPaths(e,i,t,"move",(n=>n?r(n):function(e){const t=cr.dirname(e);return cr.parse(t).root===t}(t)?pr(e,t,u,s,r):void fr(cr.dirname(t),(n=>n?r(n):pr(e,t,u,s,r)))))}))};const hr=we,yr=p.default,Cr=Ot.copySync,Fr=Gt.removeSync,gr=$e.mkdirpSync,Ar=et;function vr(e,t,n){try{hr.renameSync(e,t)}catch(r){if("EXDEV"!==r.code)throw r;return function(e,t,n){const r={overwrite:n,errorOnExist:!0};return Cr(e,t,r),Fr(e)}(e,t,n)}}var Sr=function(e,t,n){const r=(n=n||{}).overwrite||n.clobber||!1,{srcStat:u,isChangingCase:o=!1}=Ar.checkPathsSync(e,t,"move",n);return Ar.checkParentPathsSync(e,u,t,"move"),function(e){const t=yr.dirname(e);return yr.parse(t).root===t}(t)||gr(yr.dirname(t)),function(e,t,n,r){if(r)return vr(e,t,n);if(n)return Fr(t),vr(e,t,n);if(hr.existsSync(t))throw new Error("dest already exists.");return vr(e,t,n)}(e,t,r,o)};var wr,Or,br,_r,Br,Pr={move:(0,re.fromCallback)(mr),moveSync:Sr},kr={...ne,...Ot,...Xt,...Rn,...ir,...$e,...Pr,...Xn,...Ge,...Gt},xr={},Nr={exports:{}},Ir={exports:{}};function Tr(){if(Or)return wr;Or=1;var e=1e3,t=60*e,n=60*t,r=24*n,u=7*r,o=365.25*r;function i(e,t,n,r){var u=t>=1.5*n;return Math.round(e/n)+" "+r+(u?"s":"")}return wr=function(s,c){c=c||{};var a=typeof s;if("string"===a&&s.length>0)return function(i){if((i=String(i)).length>100)return;var s=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(!s)return;var c=parseFloat(s[1]);switch((s[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*o;case"weeks":case"week":case"w":return c*u;case"days":case"day":case"d":return c*r;case"hours":case"hour":case"hrs":case"hr":case"h":return c*n;case"minutes":case"minute":case"mins":case"min":case"m":return c*t;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(s);if("number"===a&&isFinite(s))return c.long?function(u){var o=Math.abs(u);if(o>=r)return i(u,o,r,"day");if(o>=n)return i(u,o,n,"hour");if(o>=t)return i(u,o,t,"minute");if(o>=e)return i(u,o,e,"second");return u+" ms"}(s):function(u){var o=Math.abs(u);if(o>=r)return Math.round(u/r)+"d";if(o>=n)return Math.round(u/n)+"h";if(o>=t)return Math.round(u/t)+"m";if(o>=e)return Math.round(u/e)+"s";return u+"ms"}(s);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(s))}}function Rr(){if(_r)return br;return _r=1,br=function(e){function t(e){let r,u,o,i=null;function s(...e){if(!s.enabled)return;const n=s,u=Number(new Date),o=u-(r||u);n.diff=o,n.prev=r,n.curr=u,r=u,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let i=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((r,u)=>{if("%%"===r)return"%";i++;const o=t.formatters[u];if("function"==typeof o){const t=e[i];r=o.call(n,t),e.splice(i,1),i--}return r})),t.formatArgs.call(n,e);(n.log||t.log).apply(n,e)}return s.namespace=e,s.useColors=t.useColors(),s.color=t.selectColor(e),s.extend=n,s.destroy=t.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==i?i:(u!==t.namespaces&&(u=t.namespaces,o=t.enabled(e)),o),set:e=>{i=e}}),"function"==typeof t.init&&t.init(s),s}function n(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function r(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(r),...t.skips.map(r).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),u=r.length;for(n=0;n{t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t{const n=e.startsWith("-")?"":1===e.length?"-":"--",r=t.indexOf(n+e),u=t.indexOf("--");return-1!==r&&(-1===u||r{}),"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{const e=function(){if($r)return jr;$r=1;const e=E.default,t=A.default,n=Vr(),{env:r}=process;let u;function o(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function i(t,o){if(0===u)return 0;if(n("color=16m")||n("color=full")||n("color=truecolor"))return 3;if(n("color=256"))return 2;if(t&&!o&&void 0===u)return 0;const i=u||0;if("dumb"===r.TERM)return i;if("win32"===process.platform){const t=e.release().split(".");return Number(t[0])>=10&&Number(t[2])>=10586?Number(t[2])>=14931?3:2:1}if("CI"in r)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some((e=>e in r))||"codeship"===r.CI_NAME?1:i;if("TEAMCITY_VERSION"in r)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(r.TEAMCITY_VERSION)?1:0;if("truecolor"===r.COLORTERM)return 3;if("TERM_PROGRAM"in r){const e=parseInt((r.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(r.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(r.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(r.TERM)||"COLORTERM"in r?1:i}return n("no-color")||n("no-colors")||n("color=false")||n("color=never")?u=0:(n("color")||n("colors")||n("color=true")||n("color=always"))&&(u=1),"FORCE_COLOR"in r&&(u="true"===r.FORCE_COLOR?1:"false"===r.FORCE_COLOR?0:0===r.FORCE_COLOR.length?1:Math.min(parseInt(r.FORCE_COLOR,10),3)),jr={supportsColor:function(e){return o(i(e,e&&e.isTTY))},stdout:o(i(!0,t.isatty(1))),stderr:o(i(!0,t.isatty(2)))}}();e&&(e.stderr||e).level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}t.inspectOpts=Object.keys(process.env).filter((e=>/^debug_/i.test(e))).reduce(((e,t)=>{const n=t.substring(6).toLowerCase().replace(/_([a-z])/g,((e,t)=>t.toUpperCase()));let r=process.env[t];return r=!!/^(yes|on|true|enabled)$/i.test(r)||!/^(no|off|false|disabled)$/i.test(r)&&("null"===r?null:Number(r)),e[n]=r,e}),{}),e.exports=Rr()(t);const{formatters:u}=e.exports;u.o=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")},u.O=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts)}}(Gr,Gr.exports)),Gr.exports}Jr=Nr,"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?Jr.exports=(Br||(Br=1,function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,u=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(u=r))})),t.splice(u,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=Rr()(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(Ir,Ir.exports)),Ir.exports):Jr.exports=Ur();var Wr=function(e){return(e=e||{}).circles?function(e){var t=[],n=[];return e.proto?function e(u){if("object"!=typeof u||null===u)return u;if(u instanceof Date)return new Date(u);if(Array.isArray(u))return r(u,e);if(u instanceof Map)return new Map(r(Array.from(u),e));if(u instanceof Set)return new Set(r(Array.from(u),e));var o={};for(var i in t.push(u),n.push(o),u){var s=u[i];if("object"!=typeof s||null===s)o[i]=s;else if(s instanceof Date)o[i]=new Date(s);else if(s instanceof Map)o[i]=new Map(r(Array.from(s),e));else if(s instanceof Set)o[i]=new Set(r(Array.from(s),e));else if(ArrayBuffer.isView(s))o[i]=zr(s);else{var c=t.indexOf(s);o[i]=-1!==c?n[c]:e(s)}}return t.pop(),n.pop(),o}:function e(u){if("object"!=typeof u||null===u)return u;if(u instanceof Date)return new Date(u);if(Array.isArray(u))return r(u,e);if(u instanceof Map)return new Map(r(Array.from(u),e));if(u instanceof Set)return new Set(r(Array.from(u),e));var o={};for(var i in t.push(u),n.push(o),u)if(!1!==Object.hasOwnProperty.call(u,i)){var s=u[i];if("object"!=typeof s||null===s)o[i]=s;else if(s instanceof Date)o[i]=new Date(s);else if(s instanceof Map)o[i]=new Map(r(Array.from(s),e));else if(s instanceof Set)o[i]=new Set(r(Array.from(s),e));else if(ArrayBuffer.isView(s))o[i]=zr(s);else{var c=t.indexOf(s);o[i]=-1!==c?n[c]:e(s)}}return t.pop(),n.pop(),o};function r(e,r){for(var u=Object.keys(e),o=new Array(u.length),i=0;i!e,Qr=e=>e&&"object"==typeof e&&!Array.isArray(e),eu=(e,t,n)=>{(Array.isArray(t)?t:[t]).forEach((t=>{if(t)throw new Error(`Problem with log4js configuration: (${Kr.inspect(e,{depth:5})}) - ${n}`)}))};var tu={configure:e=>{qr("New configuration to be validated: ",e),eu(e,Zr(Qr(e)),"must be an object."),qr(`Calling pre-processing listeners (${Yr.length})`),Yr.forEach((t=>t(e))),qr("Configuration pre-processing finished."),qr(`Calling configuration listeners (${Xr.length})`),Xr.forEach((t=>t(e))),qr("Configuration finished.")},addListener:e=>{Xr.push(e),qr(`Added listener, now ${Xr.length} listeners`)},addPreProcessingListener:e=>{Yr.push(e),qr(`Added pre-processing listener, now ${Yr.length} listeners`)},throwExceptionIf:eu,anObject:Qr,anInteger:e=>e&&"number"==typeof e&&Number.isInteger(e),validIdentifier:e=>/^[A-Za-z][A-Za-z0-9_]*$/g.test(e),not:Zr},nu={exports:{}};!function(e){function t(e,t){for(var n=e.toString();n.length-1?s:c,l=n(u.getHours()),f=n(u.getMinutes()),d=n(u.getSeconds()),D=t(u.getMilliseconds(),3),p=function(e){var t=Math.abs(e),n=String(Math.floor(t/60)),r=String(t%60);return n=("0"+n).slice(-2),r=("0"+r).slice(-2),0===e?"Z":(e<0?"+":"-")+n+":"+r}(u.getTimezoneOffset());return r.replace(/dd/g,o).replace(/MM/g,i).replace(/y{1,4}/g,a).replace(/hh/g,l).replace(/mm/g,f).replace(/ss/g,d).replace(/SSS/g,D).replace(/O/g,p)}function u(e,t,n,r){e["set"+(r?"":"UTC")+t](n)}e.exports=r,e.exports.asString=r,e.exports.parse=function(t,n,r){if(!t)throw new Error("pattern must be supplied");return function(t,n,r){var o=t.indexOf("O")<0,i=!1,s=[{pattern:/y{1,4}/,regexp:"\\d{1,4}",fn:function(e,t){u(e,"FullYear",t,o)}},{pattern:/MM/,regexp:"\\d{1,2}",fn:function(e,t){u(e,"Month",t-1,o),e.getMonth()!==t-1&&(i=!0)}},{pattern:/dd/,regexp:"\\d{1,2}",fn:function(e,t){i&&u(e,"Month",e.getMonth()-1,o),u(e,"Date",t,o)}},{pattern:/hh/,regexp:"\\d{1,2}",fn:function(e,t){u(e,"Hours",t,o)}},{pattern:/mm/,regexp:"\\d\\d",fn:function(e,t){u(e,"Minutes",t,o)}},{pattern:/ss/,regexp:"\\d\\d",fn:function(e,t){u(e,"Seconds",t,o)}},{pattern:/SSS/,regexp:"\\d\\d\\d",fn:function(e,t){u(e,"Milliseconds",t,o)}},{pattern:/O/,regexp:"[+-]\\d{1,2}:?\\d{2}?|Z",fn:function(e,t){t="Z"===t?0:t.replace(":","");var n=Math.abs(t),r=(t>0?-1:1)*(n%100+60*Math.floor(n/100));e.setUTCMinutes(e.getUTCMinutes()+r)}}],c=s.reduce((function(e,t){return t.pattern.test(e.regexp)?(t.index=e.regexp.match(t.pattern).index,e.regexp=e.regexp.replace(t.pattern,"("+t.regexp+")")):t.index=-1,e}),{regexp:t,index:[]}),a=s.filter((function(e){return e.index>-1}));a.sort((function(e,t){return e.index-t.index}));var l=new RegExp(c.regexp).exec(n);if(l){var f=r||e.exports.now();return a.forEach((function(e,t){e.fn(f,l[t+1])})),f}throw new Error("String '"+n+"' could not be parsed as '"+t+"'")}(t,n,r)},e.exports.now=function(){return new Date},e.exports.ISO8601_FORMAT="yyyy-MM-ddThh:mm:ss.SSS",e.exports.ISO8601_WITH_TZ_OFFSET_FORMAT="yyyy-MM-ddThh:mm:ss.SSSO",e.exports.DATETIME_FORMAT="dd MM yyyy hh:mm:ss.SSS",e.exports.ABSOLUTETIME_FORMAT="hh:mm:ss.SSS"}(nu);const ru=nu.exports,uu=E.default,ou=F.default,iu=p.default,su={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[90,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[91,39],yellow:[33,39]};function cu(e){return e?`[${su[e][0]}m`:""}function au(e){return e?`[${su[e][1]}m`:""}function lu(e,t){return n=ou.format("[%s] [%s] %s - ",ru.asString(e.startTime),e.level.toString(),e.categoryName),cu(r=t)+n+au(r);var n,r}function fu(e){return lu(e)+ou.format(...e.data)}function du(e){return lu(e,e.level.colour)+ou.format(...e.data)}function Du(e){return ou.format(...e.data)}function pu(e){return e.data[0]}function Eu(e,t){const n=/%(-?[0-9]+)?(\.?-?[0-9]+)?([[\]cdhmnprzxXyflos%])(\{([^}]+)\})?|([^%]+)/;function r(e){return e&&e.pid?e.pid.toString():process.pid.toString()}e=e||"%r %p %c - %m%n";const u={c:function(e,t){let n=e.categoryName;if(t){const e=parseInt(t,10),r=n.split(".");ee&&(n=r.slice(-e).join(iu.sep))}return n},l:function(e){return e.lineNumber?`${e.lineNumber}`:""},o:function(e){return e.columnNumber?`${e.columnNumber}`:""},s:function(e){return e.callStack||""}};function o(e,t,n){return u[e](t,n)}function i(e,t,n){let r=e;return r=function(e,t){let n;return e?(n=parseInt(e.substr(1),10),n>0?t.slice(0,n):t.slice(n)):t}(t,r),r=function(e,t){let n;if(e)if("-"===e.charAt(0))for(n=parseInt(e.substr(1),10);t.lengthDu,basic:()=>fu,colored:()=>du,coloured:()=>du,pattern:e=>Eu(e&&e.pattern,e&&e.tokens),dummy:()=>pu};var hu={basicLayout:fu,messagePassThroughLayout:Du,patternLayout:Eu,colouredLayout:du,coloredLayout:du,dummyLayout:pu,addLayout(e,t){mu[e]=t},layout:(e,t)=>mu[e]&&mu[e](t)};const yu=tu,Cu=["white","grey","black","blue","cyan","green","magenta","red","yellow"];class Fu{constructor(e,t,n){this.level=e,this.levelStr=t,this.colour=n}toString(){return this.levelStr}static getLevel(e,t){return e?e instanceof Fu?e:(e instanceof Object&&e.levelStr&&(e=e.levelStr),Fu[e.toString().toUpperCase()]||t):t}static addLevels(e){if(e){Object.keys(e).forEach((t=>{const n=t.toUpperCase();Fu[n]=new Fu(e[t].value,n,e[t].colour);const r=Fu.levels.findIndex((e=>e.levelStr===n));r>-1?Fu.levels[r]=Fu[n]:Fu.levels.push(Fu[n])})),Fu.levels.sort(((e,t)=>e.level-t.level))}}isLessThanOrEqualTo(e){return"string"==typeof e&&(e=Fu.getLevel(e)),this.level<=e.level}isGreaterThanOrEqualTo(e){return"string"==typeof e&&(e=Fu.getLevel(e)),this.level>=e.level}isEqualTo(e){return"string"==typeof e&&(e=Fu.getLevel(e)),this.level===e.level}}Fu.levels=[],Fu.addLevels({ALL:{value:Number.MIN_VALUE,colour:"grey"},TRACE:{value:5e3,colour:"blue"},DEBUG:{value:1e4,colour:"cyan"},INFO:{value:2e4,colour:"green"},WARN:{value:3e4,colour:"yellow"},ERROR:{value:4e4,colour:"red"},FATAL:{value:5e4,colour:"magenta"},MARK:{value:9007199254740992,colour:"grey"},OFF:{value:Number.MAX_VALUE,colour:"grey"}}),yu.addListener((e=>{const t=e.levels;if(t){yu.throwExceptionIf(e,yu.not(yu.anObject(t)),"levels must be an object");Object.keys(t).forEach((n=>{yu.throwExceptionIf(e,yu.not(yu.validIdentifier(n)),`level name "${n}" is not a valid identifier (must start with a letter, only contain A-Z,a-z,0-9,_)`),yu.throwExceptionIf(e,yu.not(yu.anObject(t[n])),`level "${n}" must be an object`),yu.throwExceptionIf(e,yu.not(t[n].value),`level "${n}" must have a 'value' property`),yu.throwExceptionIf(e,yu.not(yu.anInteger(t[n].value)),`level "${n}".value must have an integer value`),yu.throwExceptionIf(e,yu.not(t[n].colour),`level "${n}" must have a 'colour' property`),yu.throwExceptionIf(e,yu.not(Cu.indexOf(t[n].colour)>-1),`level "${n}".colour must be one of ${Cu.join(", ")}`)}))}})),yu.addListener((e=>{Fu.addLevels(e.levels)}));var gu=Fu,Au={exports:{}},vu={};/*! (c) 2020 Andrea Giammarchi */ +const{parse:Su,stringify:wu}=JSON,{keys:Ou}=Object,bu=String,_u="string",Bu={},Pu="object",ku=(e,t)=>t,xu=e=>e instanceof bu?bu(e):e,Nu=(e,t)=>typeof t===_u?new bu(t):t,Iu=(e,t,n,r)=>{const u=[];for(let o=Ou(n),{length:i}=o,s=0;s{const r=bu(t.push(n)-1);return e.set(n,r),r},Ru=(e,t)=>{const n=Su(e,Nu).map(xu),r=n[0],u=t||ku,o=typeof r===Pu&&r?Iu(n,new Set,r,u):r;return u.call({"":o},"",o)};vu.parse=Ru;const Mu=(e,t,n)=>{const r=t&&typeof t===Pu?(e,n)=>""===e||-1Su(Mu(e));vu.fromJSON=e=>Ru(wu(e));const Lu=vu,ju=gu;class $u{constructor(e,t,n,r,u){this.startTime=new Date,this.categoryName=e,this.data=n,this.level=t,this.context=Object.assign({},r),this.pid=process.pid,u&&(this.functionName=u.functionName,this.fileName=u.fileName,this.lineNumber=u.lineNumber,this.columnNumber=u.columnNumber,this.callStack=u.callStack)}serialise(){const e=this.data.map((e=>(e&&e.message&&e.stack&&(e=Object.assign({message:e.message,stack:e.stack},e)),e)));return this.data=e,Lu.stringify(this)}static deserialise(e){let t;try{const n=Lu.parse(e);n.data=n.data.map((e=>{if(e&&e.message&&e.stack){const t=new Error(e);Object.keys(e).forEach((n=>{t[n]=e[n]})),e=t}return e})),t=new $u(n.categoryName,ju.getLevel(n.level.levelStr),n.data,n.context),t.startTime=new Date(n.startTime),t.pid=n.pid,t.cluster=n.cluster}catch(n){t=new $u("log4js",ju.ERROR,["Unable to parse log:",e,"because: ",n])}return t}}var Hu=$u;const Ju=Nr.exports("log4js:clustering"),Gu=Hu,Vu=tu;let Uu=!1,Wu=null;try{Wu=require("cluster")}catch(e){Ju("cluster module not present"),Uu=!0}const zu=[];let Ku=!1,qu="NODE_APP_INSTANCE";const Yu=()=>Ku&&"0"===process.env[qu],Xu=()=>Uu||Wu.isMaster||Yu(),Zu=e=>{zu.forEach((t=>t(e)))},Qu=(e,t)=>{if(Ju("cluster message received from worker ",e,": ",t),e.topic&&e.data&&(t=e,e=void 0),t&&t.topic&&"log4js:message"===t.topic){Ju("received message: ",t.data);const e=Gu.deserialise(t.data);Zu(e)}};Uu||Vu.addListener((e=>{zu.length=0,({pm2:Ku,disableClustering:Uu,pm2InstanceVar:qu="NODE_APP_INSTANCE"}=e),Ju(`clustering disabled ? ${Uu}`),Ju(`cluster.isMaster ? ${Wu&&Wu.isMaster}`),Ju(`pm2 enabled ? ${Ku}`),Ju(`pm2InstanceVar = ${qu}`),Ju(`process.env[${qu}] = ${process.env[qu]}`),Ku&&process.removeListener("message",Qu),Wu&&Wu.removeListener&&Wu.removeListener("message",Qu),Uu||e.disableClustering?Ju("Not listening for cluster messages, because clustering disabled."):Yu()?(Ju("listening for PM2 broadcast messages"),process.on("message",Qu)):Wu.isMaster?(Ju("listening for cluster messages"),Wu.on("message",Qu)):Ju("not listening for messages, because we are not a master process")}));var eo={onlyOnMaster:(e,t)=>Xu()?e():t,isMaster:Xu,send:e=>{Xu()?Zu(e):(Ku||(e.cluster={workerId:Wu.worker.id,worker:process.pid}),process.send({topic:"log4js:message",data:e.serialise()}))},onMessage:e=>{zu.push(e)}},to={};function no(e){if("number"==typeof e&&Number.isInteger(e))return e;const t={K:1024,M:1048576,G:1073741824},n=Object.keys(t),r=e.substr(e.length-1).toLocaleUpperCase(),u=e.substring(0,e.length-1).trim();if(n.indexOf(r)<0||!Number.isInteger(Number(u)))throw Error(`maxLogSize: "${e}" is invalid`);return u*t[r]}function ro(e){return function(e,t){const n=Object.assign({},t);return Object.keys(e).forEach((r=>{n[r]&&(n[r]=e[r](t[r]))})),n}({maxLogSize:no},e)}const uo={file:ro,fileSync:ro};to.modifyConfig=e=>uo[e.type]?uo[e.type](e):e;var oo={};const io=console.log.bind(console);oo.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{io(e(n,t))}}(n,e.timezoneOffset)};var so={};so.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{process.stdout.write(`${e(n,t)}\n`)}}(n,e.timezoneOffset)};var co={};co.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{process.stderr.write(`${e(n,t)}\n`)}}(n,e.timezoneOffset)};var ao={};ao.configure=function(e,t,n,r){const u=n(e.appender);return function(e,t,n,r){const u=r.getLevel(e),o=r.getLevel(t,r.FATAL);return e=>{const t=e.level;t.isGreaterThanOrEqualTo(u)&&t.isLessThanOrEqualTo(o)&&n(e)}}(e.level,e.maxLevel,u,r)};var lo={};const fo=Nr.exports("log4js:categoryFilter");lo.configure=function(e,t,n){const r=n(e.appender);return function(e,t){return"string"==typeof e&&(e=[e]),n=>{fo(`Checking ${n.categoryName} against ${e}`),-1===e.indexOf(n.categoryName)&&(fo("Not excluded, sending to appender"),t(n))}}(e.exclude,r)};var Do={};const po=Nr.exports("log4js:noLogFilter");Do.configure=function(e,t,n){const r=n(e.appender);return function(e,t){return n=>{po(`Checking data: ${n.data} against filters: ${e}`),"string"==typeof e&&(e=[e]),e=e.filter((e=>null!=e&&""!==e));const r=new RegExp(e.join("|"),"i");(0===e.length||n.data.findIndex((e=>r.test(e)))<0)&&(po("Not excluded, sending to appender"),t(n))}}(e.exclude,r)};var Eo={},mo={exports:{}},ho={},yo={fromCallback:function(e){return Object.defineProperty((function(){if("function"!=typeof arguments[arguments.length-1])return new Promise(((t,n)=>{arguments[arguments.length]=(e,r)=>{if(e)return n(e);t(r)},arguments.length++,e.apply(this,arguments)}));e.apply(this,arguments)}),"name",{value:e.name})},fromPromise:function(e){return Object.defineProperty((function(){const t=arguments[arguments.length-1];if("function"!=typeof t)return e.apply(this,arguments);e.apply(this,arguments).then((e=>t(null,e)),t)}),"name",{value:e.name})}};!function(e){const t=yo.fromCallback,n=we,r=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchown","lchmod","link","lstat","mkdir","mkdtemp","open","readFile","readdir","readlink","realpath","rename","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter((e=>"function"==typeof n[e]));Object.keys(n).forEach((t=>{"promises"!==t&&(e[t]=n[t])})),r.forEach((r=>{e[r]=t(n[r])})),e.exists=function(e,t){return"function"==typeof t?n.exists(e,t):new Promise((t=>n.exists(e,t)))},e.read=function(e,t,r,u,o,i){return"function"==typeof i?n.read(e,t,r,u,o,i):new Promise(((i,s)=>{n.read(e,t,r,u,o,((e,t,n)=>{if(e)return s(e);i({bytesRead:t,buffer:n})}))}))},e.write=function(e,t,...r){return"function"==typeof r[r.length-1]?n.write(e,t,...r):new Promise(((u,o)=>{n.write(e,t,...r,((e,t,n)=>{if(e)return o(e);u({bytesWritten:t,buffer:n})}))}))},"function"==typeof n.realpath.native&&(e.realpath.native=t(n.realpath.native))}(ho);const Co=p.default;function Fo(e){return(e=Co.normalize(Co.resolve(e)).split(Co.sep)).length>0?e[0]:null}const go=/[<>:"|?*]/;var Ao=function(e){const t=Fo(e);return e=e.replace(t,""),go.test(e)};const vo=we,So=p.default,wo=Ao,Oo=parseInt("0777",8);var bo=function e(t,n,r,u){if("function"==typeof n?(r=n,n={}):n&&"object"==typeof n||(n={mode:n}),"win32"===process.platform&&wo(t)){const e=new Error(t+" contains invalid WIN32 path characters.");return e.code="EINVAL",r(e)}let o=n.mode;const i=n.fs||vo;void 0===o&&(o=Oo&~process.umask()),u||(u=null),r=r||function(){},t=So.resolve(t),i.mkdir(t,o,(o=>{if(!o)return r(null,u=u||t);if("ENOENT"===o.code){if(So.dirname(t)===t)return r(o);e(So.dirname(t),n,((u,o)=>{u?r(u,o):e(t,n,r,o)}))}else i.stat(t,((e,t)=>{e||!t.isDirectory()?r(o,u):r(null,u)}))}))};const _o=we,Bo=p.default,Po=Ao,ko=parseInt("0777",8);var xo=function e(t,n,r){n&&"object"==typeof n||(n={mode:n});let u=n.mode;const o=n.fs||_o;if("win32"===process.platform&&Po(t)){const e=new Error(t+" contains invalid WIN32 path characters.");throw e.code="EINVAL",e}void 0===u&&(u=ko&~process.umask()),r||(r=null),t=Bo.resolve(t);try{o.mkdirSync(t,u),r=r||t}catch(u){if("ENOENT"===u.code){if(Bo.dirname(t)===t)throw u;r=e(Bo.dirname(t),n,r),e(t,n,r)}else{let e;try{e=o.statSync(t)}catch(e){throw u}if(!e.isDirectory())throw u}}return r};const No=(0,yo.fromCallback)(bo);var Io={mkdirs:No,mkdirsSync:xo,mkdirp:No,mkdirpSync:xo,ensureDir:No,ensureDirSync:xo};const To=we;E.default,p.default;var Ro=function(e,t,n,r){To.open(e,"r+",((e,u)=>{if(e)return r(e);To.futimes(u,t,n,(e=>{To.close(u,(t=>{r&&r(e||t)}))}))}))},Mo=function(e,t,n){const r=To.openSync(e,"r+");return To.futimesSync(r,t,n),To.closeSync(r)};const Lo=we,jo=p.default,$o=10,Ho=5,Jo=0,Go=process.versions.node.split("."),Vo=Number.parseInt(Go[0],10),Uo=Number.parseInt(Go[1],10),Wo=Number.parseInt(Go[2],10);function zo(){if(Vo>$o)return!0;if(Vo===$o){if(Uo>Ho)return!0;if(Uo===Ho&&Wo>=Jo)return!0}return!1}function Ko(e,t){const n=jo.resolve(e).split(jo.sep).filter((e=>e)),r=jo.resolve(t).split(jo.sep).filter((e=>e));return n.reduce(((e,t,n)=>e&&r[n]===t),!0)}function qo(e,t,n){return`Cannot ${n} '${e}' to a subdirectory of itself, '${t}'.`}var Yo,Xo,Zo={checkPaths:function(e,t,n,r){!function(e,t,n){zo()?Lo.stat(e,{bigint:!0},((e,r)=>{if(e)return n(e);Lo.stat(t,{bigint:!0},((e,t)=>e?"ENOENT"===e.code?n(null,{srcStat:r,destStat:null}):n(e):n(null,{srcStat:r,destStat:t})))})):Lo.stat(e,((e,r)=>{if(e)return n(e);Lo.stat(t,((e,t)=>e?"ENOENT"===e.code?n(null,{srcStat:r,destStat:null}):n(e):n(null,{srcStat:r,destStat:t})))}))}(e,t,((u,o)=>{if(u)return r(u);const{srcStat:i,destStat:s}=o;return s&&s.ino&&s.dev&&s.ino===i.ino&&s.dev===i.dev?r(new Error("Source and destination must not be the same.")):i.isDirectory()&&Ko(e,t)?r(new Error(qo(e,t,n))):r(null,{srcStat:i,destStat:s})}))},checkPathsSync:function(e,t,n){const{srcStat:r,destStat:u}=function(e,t){let n,r;n=zo()?Lo.statSync(e,{bigint:!0}):Lo.statSync(e);try{r=zo()?Lo.statSync(t,{bigint:!0}):Lo.statSync(t)}catch(e){if("ENOENT"===e.code)return{srcStat:n,destStat:null};throw e}return{srcStat:n,destStat:r}}(e,t);if(u&&u.ino&&u.dev&&u.ino===r.ino&&u.dev===r.dev)throw new Error("Source and destination must not be the same.");if(r.isDirectory()&&Ko(e,t))throw new Error(qo(e,t,n));return{srcStat:r,destStat:u}},checkParentPaths:function e(t,n,r,u,o){const i=jo.resolve(jo.dirname(t)),s=jo.resolve(jo.dirname(r));if(s===i||s===jo.parse(s).root)return o();zo()?Lo.stat(s,{bigint:!0},((i,c)=>i?"ENOENT"===i.code?o():o(i):c.ino&&c.dev&&c.ino===n.ino&&c.dev===n.dev?o(new Error(qo(t,r,u))):e(t,n,s,u,o))):Lo.stat(s,((i,c)=>i?"ENOENT"===i.code?o():o(i):c.ino&&c.dev&&c.ino===n.ino&&c.dev===n.dev?o(new Error(qo(t,r,u))):e(t,n,s,u,o)))},checkParentPathsSync:function e(t,n,r,u){const o=jo.resolve(jo.dirname(t)),i=jo.resolve(jo.dirname(r));if(i===o||i===jo.parse(i).root)return;let s;try{s=zo()?Lo.statSync(i,{bigint:!0}):Lo.statSync(i)}catch(e){if("ENOENT"===e.code)return;throw e}if(s.ino&&s.dev&&s.ino===n.ino&&s.dev===n.dev)throw new Error(qo(t,r,u));return e(t,n,i,u)},isSrcSubdir:Ko};const Qo=we,ei=p.default,ti=Io.mkdirsSync,ni=Mo,ri=Zo;function ui(e,t,n,r){if(!r.filter||r.filter(t,n))return function(e,t,n,r){const u=r.dereference?Qo.statSync:Qo.lstatSync,o=u(t);if(o.isDirectory())return function(e,t,n,r,u){if(!t)return function(e,t,n,r){return Qo.mkdirSync(n),ii(t,n,r),Qo.chmodSync(n,e.mode)}(e,n,r,u);if(t&&!t.isDirectory())throw new Error(`Cannot overwrite non-directory '${r}' with directory '${n}'.`);return ii(n,r,u)}(o,e,t,n,r);if(o.isFile()||o.isCharacterDevice()||o.isBlockDevice())return function(e,t,n,r,u){return t?function(e,t,n,r){if(r.overwrite)return Qo.unlinkSync(n),oi(e,t,n,r);if(r.errorOnExist)throw new Error(`'${n}' already exists`)}(e,n,r,u):oi(e,n,r,u)}(o,e,t,n,r);if(o.isSymbolicLink())return function(e,t,n,r){let u=Qo.readlinkSync(t);r.dereference&&(u=ei.resolve(process.cwd(),u));if(e){let e;try{e=Qo.readlinkSync(n)}catch(e){if("EINVAL"===e.code||"UNKNOWN"===e.code)return Qo.symlinkSync(u,n);throw e}if(r.dereference&&(e=ei.resolve(process.cwd(),e)),ri.isSrcSubdir(u,e))throw new Error(`Cannot copy '${u}' to a subdirectory of itself, '${e}'.`);if(Qo.statSync(n).isDirectory()&&ri.isSrcSubdir(e,u))throw new Error(`Cannot overwrite '${e}' with '${u}'.`);return function(e,t){return Qo.unlinkSync(t),Qo.symlinkSync(e,t)}(u,n)}return Qo.symlinkSync(u,n)}(e,t,n,r)}(e,t,n,r)}function oi(e,t,n,r){return"function"==typeof Qo.copyFileSync?(Qo.copyFileSync(t,n),Qo.chmodSync(n,e.mode),r.preserveTimestamps?ni(n,e.atime,e.mtime):void 0):function(e,t,n,r){const u=65536,o=(Xo?Yo:(Xo=1,Yo=function(e){if("function"==typeof Buffer.allocUnsafe)try{return Buffer.allocUnsafe(e)}catch(t){return new Buffer(e)}return new Buffer(e)}))(u),i=Qo.openSync(t,"r"),s=Qo.openSync(n,"w",e.mode);let c=0;for(;cfunction(e,t,n,r){const u=ei.join(t,e),o=ei.join(n,e),{destStat:i}=ri.checkPathsSync(u,o,"copy");return ui(i,u,o,r)}(r,e,t,n)))}var si=function(e,t,n){"function"==typeof n&&(n={filter:n}),(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269");const{srcStat:r,destStat:u}=ri.checkPathsSync(e,t,"copy");return ri.checkParentPathsSync(e,r,t,"copy"),function(e,t,n,r){if(r.filter&&!r.filter(t,n))return;const u=ei.dirname(n);Qo.existsSync(u)||ti(u);return ui(e,t,n,r)}(u,e,t,n)},ci={copySync:si};const ai=yo.fromPromise,li=ho;var fi={pathExists:ai((function(e){return li.access(e).then((()=>!0)).catch((()=>!1))})),pathExistsSync:li.existsSync};const di=we,Di=p.default,pi=Io.mkdirs,Ei=fi.pathExists,mi=Ro,hi=Zo;function yi(e,t,n,r,u){const o=Di.dirname(n);Ei(o,((i,s)=>i?u(i):s?Fi(e,t,n,r,u):void pi(o,(o=>o?u(o):Fi(e,t,n,r,u)))))}function Ci(e,t,n,r,u,o){Promise.resolve(u.filter(n,r)).then((i=>i?e(t,n,r,u,o):o()),(e=>o(e)))}function Fi(e,t,n,r,u){return r.filter?Ci(gi,e,t,n,r,u):gi(e,t,n,r,u)}function gi(e,t,n,r,u){(r.dereference?di.stat:di.lstat)(t,((o,i)=>o?u(o):i.isDirectory()?function(e,t,n,r,u,o){if(!t)return function(e,t,n,r,u){di.mkdir(n,(o=>{if(o)return u(o);Si(t,n,r,(t=>t?u(t):di.chmod(n,e.mode,u)))}))}(e,n,r,u,o);if(t&&!t.isDirectory())return o(new Error(`Cannot overwrite non-directory '${r}' with directory '${n}'.`));return Si(n,r,u,o)}(i,e,t,n,r,u):i.isFile()||i.isCharacterDevice()||i.isBlockDevice()?function(e,t,n,r,u,o){return t?function(e,t,n,r,u){if(!r.overwrite)return r.errorOnExist?u(new Error(`'${n}' already exists`)):u();di.unlink(n,(o=>o?u(o):Ai(e,t,n,r,u)))}(e,n,r,u,o):Ai(e,n,r,u,o)}(i,e,t,n,r,u):i.isSymbolicLink()?function(e,t,n,r,u){di.readlink(t,((t,o)=>t?u(t):(r.dereference&&(o=Di.resolve(process.cwd(),o)),e?void di.readlink(n,((t,i)=>t?"EINVAL"===t.code||"UNKNOWN"===t.code?di.symlink(o,n,u):u(t):(r.dereference&&(i=Di.resolve(process.cwd(),i)),hi.isSrcSubdir(o,i)?u(new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`)):e.isDirectory()&&hi.isSrcSubdir(i,o)?u(new Error(`Cannot overwrite '${i}' with '${o}'.`)):function(e,t,n){di.unlink(t,(r=>r?n(r):di.symlink(e,t,n)))}(o,n,u)))):di.symlink(o,n,u))))}(e,t,n,r,u):void 0))}function Ai(e,t,n,r,u){return"function"==typeof di.copyFile?di.copyFile(t,n,(t=>t?u(t):vi(e,n,r,u))):function(e,t,n,r,u){const o=di.createReadStream(t);o.on("error",(e=>u(e))).once("open",(()=>{const t=di.createWriteStream(n,{mode:e.mode});t.on("error",(e=>u(e))).on("open",(()=>o.pipe(t))).once("close",(()=>vi(e,n,r,u)))}))}(e,t,n,r,u)}function vi(e,t,n,r){di.chmod(t,e.mode,(u=>u?r(u):n.preserveTimestamps?mi(t,e.atime,e.mtime,r):r()))}function Si(e,t,n,r){di.readdir(e,((u,o)=>u?r(u):wi(o,e,t,n,r)))}function wi(e,t,n,r,u){const o=e.pop();return o?function(e,t,n,r,u,o){const i=Di.join(n,t),s=Di.join(r,t);hi.checkPaths(i,s,"copy",((t,c)=>{if(t)return o(t);const{destStat:a}=c;Fi(a,i,s,u,(t=>t?o(t):wi(e,n,r,u,o)))}))}(e,o,t,n,r,u):u()}var Oi=function(e,t,n,r){"function"!=typeof n||r?"function"==typeof n&&(n={filter:n}):(r=n,n={}),r=r||function(){},(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269"),hi.checkPaths(e,t,"copy",((u,o)=>{if(u)return r(u);const{srcStat:i,destStat:s}=o;hi.checkParentPaths(e,i,t,"copy",(u=>u?r(u):n.filter?Ci(yi,s,e,t,n,r):yi(s,e,t,n,r)))}))};var bi={copy:(0,yo.fromCallback)(Oi)};const _i=we,Bi=p.default,Pi=g.default,ki="win32"===process.platform;function xi(e){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach((t=>{e[t]=e[t]||_i[t],e[t+="Sync"]=e[t]||_i[t]})),e.maxBusyTries=e.maxBusyTries||3}function Ni(e,t,n){let r=0;"function"==typeof t&&(n=t,t={}),Pi(e,"rimraf: missing path"),Pi.strictEqual(typeof e,"string","rimraf: path should be a string"),Pi.strictEqual(typeof n,"function","rimraf: callback function required"),Pi(t,"rimraf: invalid options argument provided"),Pi.strictEqual(typeof t,"object","rimraf: options should be object"),xi(t),Ii(e,t,(function u(o){if(o){if(("EBUSY"===o.code||"ENOTEMPTY"===o.code||"EPERM"===o.code)&&rIi(e,t,u)),100*r)}"ENOENT"===o.code&&(o=null)}n(o)}))}function Ii(e,t,n){Pi(e),Pi(t),Pi("function"==typeof n),t.lstat(e,((r,u)=>r&&"ENOENT"===r.code?n(null):r&&"EPERM"===r.code&&ki?Ti(e,t,r,n):u&&u.isDirectory()?Mi(e,t,r,n):void t.unlink(e,(r=>{if(r){if("ENOENT"===r.code)return n(null);if("EPERM"===r.code)return ki?Ti(e,t,r,n):Mi(e,t,r,n);if("EISDIR"===r.code)return Mi(e,t,r,n)}return n(r)}))))}function Ti(e,t,n,r){Pi(e),Pi(t),Pi("function"==typeof r),n&&Pi(n instanceof Error),t.chmod(e,438,(u=>{u?r("ENOENT"===u.code?null:n):t.stat(e,((u,o)=>{u?r("ENOENT"===u.code?null:n):o.isDirectory()?Mi(e,t,n,r):t.unlink(e,r)}))}))}function Ri(e,t,n){let r;Pi(e),Pi(t),n&&Pi(n instanceof Error);try{t.chmodSync(e,438)}catch(e){if("ENOENT"===e.code)return;throw n}try{r=t.statSync(e)}catch(e){if("ENOENT"===e.code)return;throw n}r.isDirectory()?ji(e,t,n):t.unlinkSync(e)}function Mi(e,t,n,r){Pi(e),Pi(t),n&&Pi(n instanceof Error),Pi("function"==typeof r),t.rmdir(e,(u=>{!u||"ENOTEMPTY"!==u.code&&"EEXIST"!==u.code&&"EPERM"!==u.code?u&&"ENOTDIR"===u.code?r(n):r(u):function(e,t,n){Pi(e),Pi(t),Pi("function"==typeof n),t.readdir(e,((r,u)=>{if(r)return n(r);let o,i=u.length;if(0===i)return t.rmdir(e,n);u.forEach((r=>{Ni(Bi.join(e,r),t,(r=>{if(!o)return r?n(o=r):void(0==--i&&t.rmdir(e,n))}))}))}))}(e,t,r)}))}function Li(e,t){let n;xi(t=t||{}),Pi(e,"rimraf: missing path"),Pi.strictEqual(typeof e,"string","rimraf: path should be a string"),Pi(t,"rimraf: missing options"),Pi.strictEqual(typeof t,"object","rimraf: options should be object");try{n=t.lstatSync(e)}catch(n){if("ENOENT"===n.code)return;"EPERM"===n.code&&ki&&Ri(e,t,n)}try{n&&n.isDirectory()?ji(e,t,null):t.unlinkSync(e)}catch(n){if("ENOENT"===n.code)return;if("EPERM"===n.code)return ki?Ri(e,t,n):ji(e,t,n);if("EISDIR"!==n.code)throw n;ji(e,t,n)}}function ji(e,t,n){Pi(e),Pi(t),n&&Pi(n instanceof Error);try{t.rmdirSync(e)}catch(r){if("ENOTDIR"===r.code)throw n;if("ENOTEMPTY"===r.code||"EEXIST"===r.code||"EPERM"===r.code)!function(e,t){if(Pi(e),Pi(t),t.readdirSync(e).forEach((n=>Li(Bi.join(e,n),t))),!ki){return t.rmdirSync(e,t)}{const n=Date.now();do{try{return t.rmdirSync(e,t)}catch(e){}}while(Date.now()-n<500)}}(e,t);else if("ENOENT"!==r.code)throw r}}var $i=Ni;Ni.sync=Li;const Hi=$i;var Ji={remove:(0,yo.fromCallback)(Hi),removeSync:Hi.sync};const Gi=yo.fromCallback,Vi=we,Ui=p.default,Wi=Io,zi=Ji,Ki=Gi((function(e,t){t=t||function(){},Vi.readdir(e,((n,r)=>{if(n)return Wi.mkdirs(e,t);r=r.map((t=>Ui.join(e,t))),function e(){const n=r.pop();if(!n)return t();zi.remove(n,(n=>{if(n)return t(n);e()}))}()}))}));function qi(e){let t;try{t=Vi.readdirSync(e)}catch(t){return Wi.mkdirsSync(e)}t.forEach((t=>{t=Ui.join(e,t),zi.removeSync(t)}))}var Yi={emptyDirSync:qi,emptydirSync:qi,emptyDir:Ki,emptydir:Ki};const Xi=yo.fromCallback,Zi=p.default,Qi=we,es=Io,ts=fi.pathExists;var ns={createFile:Xi((function(e,t){function n(){Qi.writeFile(e,"",(e=>{if(e)return t(e);t()}))}Qi.stat(e,((r,u)=>{if(!r&&u.isFile())return t();const o=Zi.dirname(e);ts(o,((e,r)=>e?t(e):r?n():void es.mkdirs(o,(e=>{if(e)return t(e);n()}))))}))})),createFileSync:function(e){let t;try{t=Qi.statSync(e)}catch(e){}if(t&&t.isFile())return;const n=Zi.dirname(e);Qi.existsSync(n)||es.mkdirsSync(n),Qi.writeFileSync(e,"")}};const rs=yo.fromCallback,us=p.default,os=we,is=Io,ss=fi.pathExists;var cs={createLink:rs((function(e,t,n){function r(e,t){os.link(e,t,(e=>{if(e)return n(e);n(null)}))}ss(t,((u,o)=>u?n(u):o?n(null):void os.lstat(e,(u=>{if(u)return u.message=u.message.replace("lstat","ensureLink"),n(u);const o=us.dirname(t);ss(o,((u,i)=>u?n(u):i?r(e,t):void is.mkdirs(o,(u=>{if(u)return n(u);r(e,t)}))))}))))})),createLinkSync:function(e,t){if(os.existsSync(t))return;try{os.lstatSync(e)}catch(e){throw e.message=e.message.replace("lstat","ensureLink"),e}const n=us.dirname(t);return os.existsSync(n)||is.mkdirsSync(n),os.linkSync(e,t)}};const as=p.default,ls=we,fs=fi.pathExists;var ds={symlinkPaths:function(e,t,n){if(as.isAbsolute(e))return ls.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:e})));{const r=as.dirname(t),u=as.join(r,e);return fs(u,((t,o)=>t?n(t):o?n(null,{toCwd:u,toDst:e}):ls.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:as.relative(r,e)})))))}},symlinkPathsSync:function(e,t){let n;if(as.isAbsolute(e)){if(n=ls.existsSync(e),!n)throw new Error("absolute srcpath does not exist");return{toCwd:e,toDst:e}}{const r=as.dirname(t),u=as.join(r,e);if(n=ls.existsSync(u),n)return{toCwd:u,toDst:e};if(n=ls.existsSync(e),!n)throw new Error("relative srcpath does not exist");return{toCwd:e,toDst:as.relative(r,e)}}}};const Ds=we;var ps={symlinkType:function(e,t,n){if(n="function"==typeof t?t:n,t="function"!=typeof t&&t)return n(null,t);Ds.lstat(e,((e,r)=>{if(e)return n(null,"file");t=r&&r.isDirectory()?"dir":"file",n(null,t)}))},symlinkTypeSync:function(e,t){let n;if(t)return t;try{n=Ds.lstatSync(e)}catch(e){return"file"}return n&&n.isDirectory()?"dir":"file"}};const Es=yo.fromCallback,ms=p.default,hs=we,ys=Io.mkdirs,Cs=Io.mkdirsSync,Fs=ds.symlinkPaths,gs=ds.symlinkPathsSync,As=ps.symlinkType,vs=ps.symlinkTypeSync,Ss=fi.pathExists;var ws={createSymlink:Es((function(e,t,n,r){r="function"==typeof n?n:r,n="function"!=typeof n&&n,Ss(t,((u,o)=>u?r(u):o?r(null):void Fs(e,t,((u,o)=>{if(u)return r(u);e=o.toDst,As(o.toCwd,n,((n,u)=>{if(n)return r(n);const o=ms.dirname(t);Ss(o,((n,i)=>n?r(n):i?hs.symlink(e,t,u,r):void ys(o,(n=>{if(n)return r(n);hs.symlink(e,t,u,r)}))))}))}))))})),createSymlinkSync:function(e,t,n){if(hs.existsSync(t))return;const r=gs(e,t);e=r.toDst,n=vs(r.toCwd,n);const u=ms.dirname(t);return hs.existsSync(u)||Cs(u),hs.symlinkSync(e,t,n)}};var Os,bs={createFile:ns.createFile,createFileSync:ns.createFileSync,ensureFile:ns.createFile,ensureFileSync:ns.createFileSync,createLink:cs.createLink,createLinkSync:cs.createLinkSync,ensureLink:cs.createLink,ensureLinkSync:cs.createLinkSync,createSymlink:ws.createSymlink,createSymlinkSync:ws.createSymlinkSync,ensureSymlink:ws.createSymlink,ensureSymlinkSync:ws.createSymlinkSync};try{Os=we}catch(e){Os=D.default}function _s(e,t){var n,r="\n";return"object"==typeof t&&null!==t&&(t.spaces&&(n=t.spaces),t.EOL&&(r=t.EOL)),JSON.stringify(e,t?t.replacer:null,n).replace(/\n/g,r)+r}function Bs(e){return Buffer.isBuffer(e)&&(e=e.toString("utf8")),e=e.replace(/^\uFEFF/,"")}var Ps={readFile:function(e,t,n){null==n&&(n=t,t={}),"string"==typeof t&&(t={encoding:t});var r=(t=t||{}).fs||Os,u=!0;"throws"in t&&(u=t.throws),r.readFile(e,t,(function(r,o){if(r)return n(r);var i;o=Bs(o);try{i=JSON.parse(o,t?t.reviver:null)}catch(t){return u?(t.message=e+": "+t.message,n(t)):n(null,null)}n(null,i)}))},readFileSync:function(e,t){"string"==typeof(t=t||{})&&(t={encoding:t});var n=t.fs||Os,r=!0;"throws"in t&&(r=t.throws);try{var u=n.readFileSync(e,t);return u=Bs(u),JSON.parse(u,t.reviver)}catch(t){if(r)throw t.message=e+": "+t.message,t;return null}},writeFile:function(e,t,n,r){null==r&&(r=n,n={});var u=(n=n||{}).fs||Os,o="";try{o=_s(t,n)}catch(e){return void(r&&r(e,null))}u.writeFile(e,o,n,r)},writeFileSync:function(e,t,n){var r=(n=n||{}).fs||Os,u=_s(t,n);return r.writeFileSync(e,u,n)}},ks=Ps;const xs=yo.fromCallback,Ns=ks;var Is={readJson:xs(Ns.readFile),readJsonSync:Ns.readFileSync,writeJson:xs(Ns.writeFile),writeJsonSync:Ns.writeFileSync};const Ts=p.default,Rs=Io,Ms=fi.pathExists,Ls=Is;var js=function(e,t,n,r){"function"==typeof n&&(r=n,n={});const u=Ts.dirname(e);Ms(u,((o,i)=>o?r(o):i?Ls.writeJson(e,t,n,r):void Rs.mkdirs(u,(u=>{if(u)return r(u);Ls.writeJson(e,t,n,r)}))))};const $s=we,Hs=p.default,Js=Io,Gs=Is;var Vs=function(e,t,n){const r=Hs.dirname(e);$s.existsSync(r)||Js.mkdirsSync(r),Gs.writeJsonSync(e,t,n)};const Us=yo.fromCallback,Ws=Is;Ws.outputJson=Us(js),Ws.outputJsonSync=Vs,Ws.outputJSON=Ws.outputJson,Ws.outputJSONSync=Ws.outputJsonSync,Ws.writeJSON=Ws.writeJson,Ws.writeJSONSync=Ws.writeJsonSync,Ws.readJSON=Ws.readJson,Ws.readJSONSync=Ws.readJsonSync;var zs=Ws;const Ks=we,qs=p.default,Ys=ci.copySync,Xs=Ji.removeSync,Zs=Io.mkdirpSync,Qs=Zo;function ec(e,t,n){try{Ks.renameSync(e,t)}catch(r){if("EXDEV"!==r.code)throw r;return function(e,t,n){const r={overwrite:n,errorOnExist:!0};return Ys(e,t,r),Xs(e)}(e,t,n)}}var tc=function(e,t,n){const r=(n=n||{}).overwrite||n.clobber||!1,{srcStat:u}=Qs.checkPathsSync(e,t,"move");return Qs.checkParentPathsSync(e,u,t,"move"),Zs(qs.dirname(t)),function(e,t,n){if(n)return Xs(t),ec(e,t,n);if(Ks.existsSync(t))throw new Error("dest already exists.");return ec(e,t,n)}(e,t,r)},nc={moveSync:tc};const rc=we,uc=p.default,oc=bi.copy,ic=Ji.remove,sc=Io.mkdirp,cc=fi.pathExists,ac=Zo;function lc(e,t,n,r){rc.rename(e,t,(u=>u?"EXDEV"!==u.code?r(u):function(e,t,n,r){const u={overwrite:n,errorOnExist:!0};oc(e,t,u,(t=>t?r(t):ic(e,r)))}(e,t,n,r):r()))}var fc=function(e,t,n,r){"function"==typeof n&&(r=n,n={});const u=n.overwrite||n.clobber||!1;ac.checkPaths(e,t,"move",((n,o)=>{if(n)return r(n);const{srcStat:i}=o;ac.checkParentPaths(e,i,t,"move",(n=>{if(n)return r(n);sc(uc.dirname(t),(n=>n?r(n):function(e,t,n,r){if(n)return ic(t,(u=>u?r(u):lc(e,t,n,r)));cc(t,((u,o)=>u?r(u):o?r(new Error("dest already exists.")):lc(e,t,n,r)))}(e,t,u,r)))}))}))};var dc={move:(0,yo.fromCallback)(fc)};const Dc=yo.fromCallback,pc=we,Ec=p.default,mc=Io,hc=fi.pathExists;var yc={outputFile:Dc((function(e,t,n,r){"function"==typeof n&&(r=n,n="utf8");const u=Ec.dirname(e);hc(u,((o,i)=>o?r(o):i?pc.writeFile(e,t,n,r):void mc.mkdirs(u,(u=>{if(u)return r(u);pc.writeFile(e,t,n,r)}))))})),outputFileSync:function(e,...t){const n=Ec.dirname(e);if(pc.existsSync(n))return pc.writeFileSync(e,...t);mc.mkdirsSync(n),pc.writeFileSync(e,...t)}};!function(e){e.exports=Object.assign({},ho,ci,bi,Yi,bs,zs,Io,nc,dc,yc,fi,Ji);const t=D.default;Object.getOwnPropertyDescriptor(t,"promises")&&Object.defineProperty(e.exports,"promises",{get:()=>t.promises})}(mo);const Cc=Nr.exports("streamroller:fileNameFormatter"),Fc=p.default;const gc=Nr.exports("streamroller:fileNameParser"),Ac=nu.exports;const vc=Nr.exports("streamroller:moveAndMaybeCompressFile"),Sc=mo.exports,wc=v.default;var Oc=async(e,t,n)=>{if(n=function(e){const t={mode:parseInt("0600",8),compress:!1},n=Object.assign({},t,e);return vc(`_parseOption: moveAndMaybeCompressFile called with option=${JSON.stringify(n)}`),n}(n),e!==t){if(await Sc.pathExists(e))if(vc(`moveAndMaybeCompressFile: moving file from ${e} to ${t} ${n.compress?"with":"without"} compress`),n.compress)await new Promise(((r,u)=>{let o=!1;const i=Sc.createWriteStream(t,{mode:n.mode,flags:"wx"}).on("open",(()=>{o=!0;const t=Sc.createReadStream(e).on("open",(()=>{t.pipe(wc.createGzip()).pipe(i)})).on("error",(t=>{vc(`moveAndMaybeCompressFile: error reading ${e}`,t),i.destroy(t)}))})).on("finish",(()=>{vc(`moveAndMaybeCompressFile: finished compressing ${t}, deleting ${e}`),Sc.unlink(e).then(r).catch((t=>{vc(`moveAndMaybeCompressFile: error deleting ${e}, truncating instead`,t),Sc.truncate(e).then(r).catch((t=>{vc(`moveAndMaybeCompressFile: error truncating ${e}`,t),u(t)}))}))})).on("error",(e=>{o?(vc(`moveAndMaybeCompressFile: error writing ${t}, deleting`,e),Sc.unlink(t).then((()=>{u(e)})).catch((e=>{vc(`moveAndMaybeCompressFile: error deleting ${t}`,e),u(e)}))):(vc(`moveAndMaybeCompressFile: error creating ${t}`,e),u(e))}))})).catch((()=>{}));else{vc(`moveAndMaybeCompressFile: renaming ${e} to ${t}`);try{await Sc.move(e,t,{overwrite:!0})}catch(n){if(vc(`moveAndMaybeCompressFile: error renaming ${e} to ${t}`,n),"ENOENT"!==n.code){vc("moveAndMaybeCompressFile: trying copy+truncate instead");try{await Sc.copy(e,t,{overwrite:!0}),await Sc.truncate(e)}catch(e){vc("moveAndMaybeCompressFile: error copy+truncate",e)}}}}}else vc("moveAndMaybeCompressFile: source and target are the same, not doing anything")};const bc=Nr.exports("streamroller:RollingFileWriteStream"),_c=mo.exports,Bc=p.default,Pc=E.default,kc=()=>new Date,xc=nu.exports,{Writable:Nc}=C.default,Ic=({file:e,keepFileExt:t,needsIndex:n,alwaysIncludeDate:r,compress:u,fileNameSep:o})=>{let i=o||".";const s=Fc.join(e.dir,e.name),c=t=>t+e.ext,a=(e,t,r)=>!n&&r||!t?e:e+i+t,l=(e,t,n)=>(t>0||r)&&n?e+i+n:e,f=(e,t)=>t&&u?e+".gz":e,d=t?[l,a,c,f]:[c,l,a,f];return({date:e,index:t})=>(Cc(`_formatFileName: date=${e}, index=${t}`),d.reduce(((n,r)=>r(n,t,e)),s))},Tc=({file:e,keepFileExt:t,pattern:n,fileNameSep:r})=>{let u=r||".";const o="__NOT_MATCHING__";let i=[(e,t)=>e.endsWith(".gz")?(gc("it is gzipped"),t.isCompressed=!0,e.slice(0,-1*".gz".length)):e,t?t=>t.startsWith(e.name)&&t.endsWith(e.ext)?(gc("it starts and ends with the right things"),t.slice(e.name.length+1,-1*e.ext.length)):o:t=>t.startsWith(e.base)?(gc("it starts with the right things"),t.slice(e.base.length+1)):o,n?(e,t)=>{const r=e.split(u);let o=r[r.length-1];gc("items: ",r,", indexStr: ",o);let i=e;void 0!==o&&o.match(/^\d+$/)?(i=e.slice(0,-1*(o.length+1)),gc(`dateStr is ${i}`),n&&!i&&(i=o,o="0")):o="0";try{const r=Ac.parse(n,i,new Date(0,0));return Ac.asString(n,r)!==i?e:(t.index=parseInt(o,10),t.date=i,t.timestamp=r.getTime(),"")}catch(t){return gc(`Problem parsing ${i} as ${n}, error was: `,t),e}}:(e,t)=>e.match(/^\d+$/)?(gc("it has an index"),t.index=parseInt(e,10),""):e];return e=>{let t={filename:e,index:0,isCompressed:!1};return i.reduce(((e,n)=>n(e,t)),e)?null:t}},Rc=Oc;var Mc=class extends Nc{constructor(e,t){if(bc(`constructor: creating RollingFileWriteStream. path=${e}`),"string"!=typeof e||0===e.length)throw new Error(`Invalid filename: ${e}`);if(e.endsWith(Bc.sep))throw new Error(`Filename is a directory: ${e}`);0===e.indexOf(`~${Bc.sep}`)&&(e=e.replace("~",Pc.homedir())),super(t),this.options=this._parseOption(t),this.fileObject=Bc.parse(e),""===this.fileObject.dir&&(this.fileObject=Bc.parse(Bc.join(process.cwd(),e))),this.fileFormatter=Ic({file:this.fileObject,alwaysIncludeDate:this.options.alwaysIncludePattern,needsIndex:this.options.maxSize 0`)}else delete n.maxSize;if(n.numBackups||0===n.numBackups){if(n.numBackups<0)throw new Error(`options.numBackups (${n.numBackups}) should be >= 0`);if(n.numBackups>=Number.MAX_SAFE_INTEGER)throw new Error(`options.numBackups (${n.numBackups}) should be < Number.MAX_SAFE_INTEGER`);n.numToKeep=n.numBackups+1}else if(n.numToKeep<=0)throw new Error(`options.numToKeep (${n.numToKeep}) should be > 0`);return bc(`_parseOption: creating stream with option=${JSON.stringify(n)}`),n}_final(e){this.currentFileStream.end("",this.options.encoding,e)}_write(e,t,n){this._shouldRoll().then((()=>{bc(`_write: writing chunk. file=${this.currentFileStream.path} state=${JSON.stringify(this.state)} chunk=${e}`),this.currentFileStream.write(e,t,(t=>{this.state.currentSize+=e.length,n(t)}))}))}async _shouldRoll(){(this._dateChanged()||this._tooBig())&&(bc(`_shouldRoll: rolling because dateChanged? ${this._dateChanged()} or tooBig? ${this._tooBig()}`),await this._roll())}_dateChanged(){return this.state.currentDate&&this.state.currentDate!==xc(this.options.pattern,kc())}_tooBig(){return this.state.currentSize>=this.options.maxSize}_roll(){return bc("_roll: closing the current stream"),new Promise(((e,t)=>{this.currentFileStream.end("",this.options.encoding,(()=>{this._moveOldFiles().then(e).catch(t)}))}))}async _moveOldFiles(){const e=await this._getExistingFiles();for(let t=(this.state.currentDate?e.filter((e=>e.date===this.state.currentDate)):e).length;t>=0;t--){bc(`_moveOldFiles: i = ${t}`);const e=this.fileFormatter({date:this.state.currentDate,index:t}),n=this.fileFormatter({date:this.state.currentDate,index:t+1}),r={compress:this.options.compress&&0===t,mode:this.options.mode};await Rc(e,n,r)}this.state.currentSize=0,this.state.currentDate=this.state.currentDate?xc(this.options.pattern,kc()):null,bc(`_moveOldFiles: finished rolling files. state=${JSON.stringify(this.state)}`),this._renewWriteStream(),await new Promise(((e,t)=>{this.currentFileStream.write("","utf8",(()=>{this._clean().then(e).catch(t)}))}))}async _getExistingFiles(){const e=await _c.readdir(this.fileObject.dir).catch((()=>[]));bc(`_getExistingFiles: files=${e}`);const t=e.map((e=>this.fileNameParser(e))).filter((e=>e)),n=e=>(e.timestamp?e.timestamp:kc().getTime())-e.index;return t.sort(((e,t)=>n(e)-n(t))),t}_renewWriteStream(){const e=this.fileFormatter({date:this.state.currentDate,index:0}),t=e=>{try{return _c.mkdirSync(e,{recursive:!0})}catch(n){if("ENOENT"===n.code)return t(Bc.dirname(e)),t(e);if("EEXIST"!==n.code&&"EROFS"!==n.code)throw n;try{if(_c.statSync(e).isDirectory())return e;throw n}catch(e){throw n}}};t(this.fileObject.dir);const n={flags:this.options.flags,encoding:this.options.encoding,mode:this.options.mode};var r,u;_c.appendFileSync(e,"",(r={...n},u="flags",r["flag"]=r[u],delete r[u],r)),this.currentFileStream=_c.createWriteStream(e,n),this.currentFileStream.on("error",(e=>{this.emit("error",e)}))}async _clean(){const e=await this._getExistingFiles();if(bc(`_clean: numToKeep = ${this.options.numToKeep}, existingFiles = ${e.length}`),bc("_clean: existing files are: ",e),this._tooManyFiles(e.length)){const n=e.slice(0,e.length-this.options.numToKeep).map((e=>Bc.format({dir:this.fileObject.dir,base:e.filename})));await(t=n,bc(`deleteFiles: files to delete: ${t}`),Promise.all(t.map((e=>_c.unlink(e).catch((t=>{bc(`deleteFiles: error when unlinking ${e}, ignoring. Error was ${t}`)}))))))}var t}_tooManyFiles(e){return this.options.numToKeep>0&&e>this.options.numToKeep}};const Lc=Mc;var jc=class extends Lc{constructor(e,t,n,r){r||(r={}),t&&(r.maxSize=t),r.numBackups||0===r.numBackups||(n||0===n||(n=1),r.numBackups=n),super(e,r),this.backups=r.numBackups,this.size=this.options.maxSize}get theStream(){return this.currentFileStream}};const $c=Mc;var Hc={RollingFileWriteStream:Mc,RollingFileStream:jc,DateRollingFileStream:class extends $c{constructor(e,t,n){t&&"object"==typeof t&&(n=t,t=null),n||(n={}),t||(t="yyyy-MM-dd"),n.pattern=t,n.numBackups||0===n.numBackups?n.daysToKeep=n.numBackups:(n.daysToKeep||0===n.daysToKeep?process.emitWarning("options.daysToKeep is deprecated due to the confusion it causes when used together with file size rolling. Please use options.numBackups instead.","DeprecationWarning","streamroller-DEP0001"):n.daysToKeep=1,n.numBackups=n.daysToKeep),super(e,n),this.mode=this.options.mode}get theStream(){return this.currentFileStream}}};const Jc=Nr.exports("log4js:file"),Gc=p.default,Vc=Hc,Uc=E.default.EOL;let Wc=!1;const zc=new Set;function Kc(){zc.forEach((e=>{e.sighupHandler()}))}function qc(e,t,n,r){const u=new Vc.RollingFileStream(e,t,n,r);return u.on("error",(t=>{console.error("log4js.fileAppender - Writing to file %s, error happened ",e,t)})),u.on("drain",(()=>{process.emit("log4js:pause",!1)})),u}Eo.configure=function(e,t){let n=t.basicLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),e.mode=e.mode||384,function(e,t,n,r,u,o){e=Gc.normalize(e),Jc("Creating file appender (",e,", ",n,", ",r=r||0===r?r:5,", ",u,", ",o,")");let i=qc(e,n,r,u);const s=function(e){if(i.writable){if(!0===u.removeColor){const t=/\x1b[[0-9;]*m/g;e.data=e.data.map((e=>"string"==typeof e?e.replace(t,""):e))}i.write(t(e,o)+Uc,"utf8")||process.emit("log4js:pause",!0)}};return s.reopen=function(){i.end((()=>{i=qc(e,n,r,u)}))},s.sighupHandler=function(){Jc("SIGHUP handler called."),s.reopen()},s.shutdown=function(e){zc.delete(s),0===zc.size&&Wc&&(process.removeListener("SIGHUP",Kc),Wc=!1),i.end("","utf-8",e)},zc.add(s),Wc||(process.on("SIGHUP",Kc),Wc=!0),s}(e.filename,n,e.maxLogSize,e.backups,e,e.timezoneOffset)};var Yc={};const Xc=Hc,Zc=E.default.EOL;function Qc(e,t,n,r,u){r.maxSize=r.maxLogSize;const o=function(e,t,n){const r=new Xc.DateRollingFileStream(e,t,n);return r.on("error",(t=>{console.error("log4js.dateFileAppender - Writing to file %s, error happened ",e,t)})),r.on("drain",(()=>{process.emit("log4js:pause",!1)})),r}(e,t,r),i=function(e){o.writable&&(o.write(n(e,u)+Zc,"utf8")||process.emit("log4js:pause",!0))};return i.shutdown=function(e){o.end("","utf-8",e)},i}Yc.configure=function(e,t){let n=t.basicLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),e.alwaysIncludePattern||(e.alwaysIncludePattern=!1),e.mode=e.mode||384,Qc(e.filename,e.pattern,n,e,e.timezoneOffset)};var ea={};const ta=Nr.exports("log4js:fileSync"),na=p.default,ra=D.default,ua=E.default.EOL||"\n";function oa(e,t){if(ra.existsSync(e))return;const n=ra.openSync(e,t.flags,t.mode);ra.closeSync(n)}class ia{constructor(e,t,n,r){ta("In RollingFileStream"),function(){if(!e||!t||t<=0)throw new Error("You must specify a filename and file size")}(),this.filename=e,this.size=t,this.backups=n,this.options=r,this.currentSize=0,this.currentSize=function(e){let t=0;try{t=ra.statSync(e).size}catch(t){oa(e,r)}return t}(this.filename)}shouldRoll(){return ta("should roll with current size %d, and max size %d",this.currentSize,this.size),this.currentSize>=this.size}roll(e){const t=this,n=new RegExp(`^${na.basename(e)}`);function r(e){return n.test(e)}function u(t){return parseInt(t.substring(`${na.basename(e)}.`.length),10)||0}function o(e,t){return u(e)>u(t)?1:u(e) ${e}.${r+1}`),ra.renameSync(na.join(na.dirname(e),n),`${e}.${r+1}`)}}ta("Rolling, rolling, rolling"),ta("Renaming the old files"),ra.readdirSync(na.dirname(e)).filter(r).sort(o).reverse().forEach(i)}write(e,t){const n=this;ta("in write"),this.shouldRoll()&&(this.currentSize=0,this.roll(this.filename)),ta("writing the chunk to the file"),n.currentSize+=e.length,ra.appendFileSync(n.filename,e)}}ea.configure=function(e,t){let n=t.basicLayout;e.layout&&(n=t.layout(e.layout.type,e.layout));const r={flags:e.flags||"a",encoding:e.encoding||"utf8",mode:e.mode||384};return function(e,t,n,r,u,o){ta("fileSync appender created");const i=function(e,t,n){let r;var u;return t?r=new ia(e,t,n,o):(oa(u=e,o),r={write(e){ra.appendFileSync(u,e)}}),r}(e=na.normalize(e),n,r=r||0===r?r:5);return e=>{i.write(t(e,u)+ua)}}(e.filename,n,e.maxLogSize,e.backups,e.timezoneOffset,r)};var sa={};const ca=Nr.exports("log4js:tcp"),aa=S.default;sa.configure=function(e,t){ca(`configure with config = ${e}`);let n=function(e){return e.serialise()};return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){let n=!1;const r=[];let u,o=3,i="__LOG4JS__";function s(e){ca("Writing log event to socket"),n=u.write(`${t(e)}${i}`,"utf8")}function c(){let e;for(ca("emptying buffer");e=r.shift();)s(e)}function a(e){n?s(e):(ca("buffering log event because it cannot write at the moment"),r.push(e))}return function t(){ca(`appender creating socket to ${e.host||"localhost"}:${e.port||5e3}`),i=`${e.endMsg||"__LOG4JS__"}`,u=aa.createConnection(e.port||5e3,e.host||"localhost"),u.on("connect",(()=>{ca("socket connected"),c(),n=!0})),u.on("drain",(()=>{ca("drain event received, emptying buffer"),n=!0,c()})),u.on("timeout",u.end.bind(u)),u.on("error",(e=>{ca("connection error",e),n=!1,c()})),u.on("close",t)}(),a.shutdown=function(e){ca("shutdown called"),r.length&&o?(ca("buffer has items, waiting 100ms to empty"),o-=1,setTimeout((()=>{a.shutdown(e)}),100)):(u.removeAllListeners("close"),u.end(e))},a}(e,n)};const la=p.default,fa=Nr.exports("log4js:appenders"),da=tu,Da=eo,pa=gu,Ea=hu,ma=to,ha=new Map;ha.set("console",oo),ha.set("stdout",so),ha.set("stderr",co),ha.set("logLevelFilter",ao),ha.set("categoryFilter",lo),ha.set("noLogFilter",Do),ha.set("file",Eo),ha.set("dateFile",Yc),ha.set("fileSync",ea),ha.set("tcp",sa);const ya=new Map,Ca=(e,t)=>{fa("Loading module from ",e);try{return require(e)}catch(n){return void da.throwExceptionIf(t,"MODULE_NOT_FOUND"!==n.code,`appender "${e}" could not be loaded (error was: ${n})`)}},Fa=new Set,ga=(e,t)=>{if(ya.has(e))return ya.get(e);if(!t.appenders[e])return!1;if(Fa.has(e))throw new Error(`Dependency loop detected for appender ${e}.`);Fa.add(e),fa(`Creating appender ${e}`);const n=Aa(e,t);return Fa.delete(e),ya.set(e,n),n},Aa=(e,t)=>{const n=t.appenders[e],r=n.type.configure?n.type:((e,t)=>ha.get(e)||Ca(`./${e}`,t)||Ca(e,t)||require.main&&Ca(la.join(la.dirname(require.main.filename),e),t)||Ca(la.join(process.cwd(),e),t))(n.type,t);return da.throwExceptionIf(t,da.not(r),`appender "${e}" is not valid (type "${n.type}" could not be found)`),r.appender&&fa(`DEPRECATION: Appender ${n.type} exports an appender function.`),r.shutdown&&fa(`DEPRECATION: Appender ${n.type} exports a shutdown function.`),fa(`${e}: clustering.isMaster ? ${Da.isMaster()}`),fa(`${e}: appenderModule is ${F.default.inspect(r)}`),Da.onlyOnMaster((()=>(fa(`calling appenderModule.configure for ${e} / ${n.type}`),r.configure(ma.modifyConfig(n),Ea,(e=>ga(e,t)),pa))),(()=>{}))},va=e=>{ya.clear(),Fa.clear();const t=[];Object.values(e.categories).forEach((e=>{t.push(...e.appenders)})),Object.keys(e.appenders).forEach((n=>{(t.includes(n)||"tcp-server"===e.appenders[n].type)&&ga(n,e)}))},Sa=()=>{va({appenders:{out:{type:"stdout"}},categories:{default:{appenders:["out"],level:"trace"}}})};Sa(),da.addListener((e=>{da.throwExceptionIf(e,da.not(da.anObject(e.appenders)),'must have a property "appenders" of type object.');const t=Object.keys(e.appenders);da.throwExceptionIf(e,da.not(t.length),"must define at least one appender."),t.forEach((t=>{da.throwExceptionIf(e,da.not(e.appenders[t].type),`appender "${t}" is not valid (must be an object with property "type")`)}))})),da.addListener(va),Au.exports=ya,Au.exports.init=Sa;var wa={exports:{}};!function(e){const t=Nr.exports("log4js:categories"),n=tu,r=gu,u=Au.exports,o=new Map;function i(e,t,n){if(!1===t.inherit)return;const r=n.lastIndexOf(".");if(r<0)return;const u=n.substring(0,r);let o=e.categories[u];o||(o={inherit:!0,appenders:[]}),i(e,o,u),!e.categories[u]&&o.appenders&&o.appenders.length&&o.level&&(e.categories[u]=o),t.appenders=t.appenders||[],t.level=t.level||o.level,o.appenders.forEach((e=>{t.appenders.includes(e)||t.appenders.push(e)})),t.parent=o}function s(e){if(!e.categories)return;Object.keys(e.categories).forEach((t=>{const n=e.categories[t];i(e,n,t)}))}n.addPreProcessingListener((e=>s(e))),n.addListener((e=>{n.throwExceptionIf(e,n.not(n.anObject(e.categories)),'must have a property "categories" of type object.');const t=Object.keys(e.categories);n.throwExceptionIf(e,n.not(t.length),"must define at least one category."),t.forEach((t=>{const o=e.categories[t];n.throwExceptionIf(e,[n.not(o.appenders),n.not(o.level)],`category "${t}" is not valid (must be an object with properties "appenders" and "level")`),n.throwExceptionIf(e,n.not(Array.isArray(o.appenders)),`category "${t}" is not valid (appenders must be an array of appender names)`),n.throwExceptionIf(e,n.not(o.appenders.length),`category "${t}" is not valid (appenders must contain at least one appender name)`),Object.prototype.hasOwnProperty.call(o,"enableCallStack")&&n.throwExceptionIf(e,"boolean"!=typeof o.enableCallStack,`category "${t}" is not valid (enableCallStack must be boolean type)`),o.appenders.forEach((r=>{n.throwExceptionIf(e,n.not(u.get(r)),`category "${t}" is not valid (appender "${r}" is not defined)`)})),n.throwExceptionIf(e,n.not(r.getLevel(o.level)),`category "${t}" is not valid (level "${o.level}" not recognised; valid levels are ${r.levels.join(", ")})`)})),n.throwExceptionIf(e,n.not(e.categories.default),'must define a "default" category.')}));const c=e=>{o.clear();Object.keys(e.categories).forEach((n=>{const i=e.categories[n],s=[];i.appenders.forEach((e=>{s.push(u.get(e)),t(`Creating category ${n}`),o.set(n,{appenders:s,level:r.getLevel(i.level),enableCallStack:i.enableCallStack||!1})}))}))},a=()=>{c({categories:{default:{appenders:["out"],level:"OFF"}}})};a(),n.addListener(c);const l=e=>(t(`configForCategory: searching for config for ${e}`),o.has(e)?(t(`configForCategory: ${e} exists in config, returning it`),o.get(e)):e.indexOf(".")>0?(t(`configForCategory: ${e} has hierarchy, searching for parents`),l(e.substring(0,e.lastIndexOf(".")))):(t("configForCategory: returning config for default category"),l("default")));e.exports=o,e.exports=Object.assign(e.exports,{appendersForCategory:e=>l(e).appenders,getLevelForCategory:e=>l(e).level,setLevelForCategory:(e,n)=>{let r=o.get(e);if(t(`setLevelForCategory: found ${r} for ${e}`),!r){const n=l(e);t(`setLevelForCategory: no config found for category, found ${n} for parents of ${e}`),r={appenders:n.appenders}}r.level=n,o.set(e,r)},getEnableCallStackForCategory:e=>!0===l(e).enableCallStack,setEnableCallStackForCategory:(e,t)=>{l(e).enableCallStack=t},init:a})}(wa);const Oa=Nr.exports("log4js:logger"),ba=Hu,_a=gu,Ba=eo,Pa=wa.exports,ka=tu,xa=/at (?:(.+)\s+\()?(?:(.+?):(\d+)(?::(\d+))?|([^)]+))\)?/;function Na(e,t=4){const n=e.stack.split("\n").slice(t),r=xa.exec(n[0]);return r&&6===r.length?{functionName:r[1],fileName:r[2],lineNumber:parseInt(r[3],10),columnNumber:parseInt(r[4],10),callStack:n.join("\n")}:null}class Ia{constructor(e){if(!e)throw new Error("No category provided.");this.category=e,this.context={},this.parseCallStack=Na,Oa(`Logger created (${this.category}, ${this.level})`)}get level(){return _a.getLevel(Pa.getLevelForCategory(this.category),_a.TRACE)}set level(e){Pa.setLevelForCategory(this.category,_a.getLevel(e,this.level))}get useCallStack(){return Pa.getEnableCallStackForCategory(this.category)}set useCallStack(e){Pa.setEnableCallStackForCategory(this.category,!0===e)}log(e,...t){let n=_a.getLevel(e);n||(this._log(_a.WARN,"log4js:logger.log: invalid value for log-level as first parameter given: ",e),n=_a.INFO),this.isLevelEnabled(n)&&this._log(n,t)}isLevelEnabled(e){return this.level.isLessThanOrEqualTo(e)}_log(e,t){Oa(`sending log data (${e}) to appenders`);const n=new ba(this.category,e,t,this.context,this.useCallStack&&this.parseCallStack(new Error));Ba.send(n)}addContext(e,t){this.context[e]=t}removeContext(e){delete this.context[e]}clearContext(){this.context={}}setParseCallStackFunction(e){this.parseCallStack=e}}function Ta(e){const t=_a.getLevel(e),n=t.toString().toLowerCase().replace(/_([a-z])/g,(e=>e[1].toUpperCase())),r=n[0].toUpperCase()+n.slice(1);Ia.prototype[`is${r}Enabled`]=function(){return this.isLevelEnabled(t)},Ia.prototype[n]=function(...e){this.log(t,...e)}}_a.levels.forEach(Ta),ka.addListener((()=>{_a.levels.forEach(Ta)}));var Ra=Ia;const Ma=gu;function La(e){return e.originalUrl||e.url}function ja(e,t){for(let n=0;ne.source?e.source:e));t=new RegExp(n.join("|"))}return t}(t.nolog);return(e,i,s)=>{if(e._logging)return s();if(o&&o.test(e.originalUrl))return s();if(n.isLevelEnabled(r)||"auto"===t.level){const o=new Date,{writeHead:s}=i;e._logging=!0,i.writeHead=(e,t)=>{i.writeHead=s,i.writeHead(e,t),i.__statusCode=e,i.__headers=t||{}},i.on("finish",(()=>{i.responseTime=new Date-o,i.statusCode&&"auto"===t.level&&(r=Ma.INFO,i.statusCode>=300&&(r=Ma.WARN),i.statusCode>=400&&(r=Ma.ERROR)),r=function(e,t,n){let r=t;if(n){const t=n.find((t=>{let n=!1;return n=t.from&&t.to?e>=t.from&&e<=t.to:-1!==t.codes.indexOf(e),n}));t&&(r=Ma.getLevel(t.level,r))}return r}(i.statusCode,r,t.statusRules);const s=function(e,t,n){const r=[];return r.push({token:":url",replacement:La(e)}),r.push({token:":protocol",replacement:e.protocol}),r.push({token:":hostname",replacement:e.hostname}),r.push({token:":method",replacement:e.method}),r.push({token:":status",replacement:t.__statusCode||t.statusCode}),r.push({token:":response-time",replacement:t.responseTime}),r.push({token:":date",replacement:(new Date).toUTCString()}),r.push({token:":referrer",replacement:e.headers.referer||e.headers.referrer||""}),r.push({token:":http-version",replacement:`${e.httpVersionMajor}.${e.httpVersionMinor}`}),r.push({token:":remote-addr",replacement:e.headers["x-forwarded-for"]||e.ip||e._remoteAddress||e.socket&&(e.socket.remoteAddress||e.socket.socket&&e.socket.socket.remoteAddress)}),r.push({token:":user-agent",replacement:e.headers["user-agent"]}),r.push({token:":content-length",replacement:t.getHeader("content-length")||t.__headers&&t.__headers["Content-Length"]||"-"}),r.push({token:/:req\[([^\]]+)]/g,replacement:(t,n)=>e.headers[n.toLowerCase()]}),r.push({token:/:res\[([^\]]+)]/g,replacement:(e,n)=>t.getHeader(n.toLowerCase())||t.__headers&&t.__headers[n]}),(e=>{const t=e.concat();for(let e=0;eja(e,s)));t&&n.log(r,t)}else n.log(r,ja(u,s));t.context&&n.removeContext("res")}))}return s()}},nl=Va;let rl=!1;function ul(e){if(!rl)return;Ua("Received log event ",e);Za.appendersForCategory(e.categoryName).forEach((t=>{t(e)}))}function ol(e){rl&&il();let t=e;return"string"==typeof t&&(t=function(e){Ua(`Loading configuration from ${e}`);try{return JSON.parse(Wa.readFileSync(e,"utf8"))}catch(t){throw new Error(`Problem reading config from file "${e}". Error was ${t.message}`,t)}}(e)),Ua(`Configuration is ${t}`),Ka.configure(za(t)),el.onMessage(ul),rl=!0,sl}function il(e){Ua("Shutdown called. Disabling all log writing."),rl=!1;const t=Array.from(Xa.values());Xa.init(),Za.init();const n=t.reduceRight(((e,t)=>t.shutdown?e+1:e),0);if(0===n)return Ua("No appenders with shutdown functions found."),void 0!==e&&e();let r,u=0;function o(t){r=r||t,u+=1,Ua(`Appender shutdowns complete: ${u} / ${n}`),u>=n&&(Ua("All shutdown functions completed."),e&&e(r))}return Ua(`Found ${n} appenders with shutdown functions.`),t.filter((e=>e.shutdown)).forEach((e=>e.shutdown(o))),null}const sl={getLogger:function(e){return rl||ol(process.env.LOG4JS_CONFIG||{appenders:{out:{type:"stdout"}},categories:{default:{appenders:["out"],level:"OFF"}}}),new Qa(e||"default")},configure:ol,shutdown:il,connectLogger:tl,levels:Ya,addLayout:qa.addLayout,recording:function(){return nl}};var cl=sl,al={};Object.defineProperty(al,"__esModule",{value:!0}),al.levelMap=al.getLevel=al.setCategoriesLevel=al.getConfiguration=al.setConfiguration=void 0;const ll=cl;let fl={appenders:{debug:{type:"stdout",layout:{type:"pattern",pattern:"[%d] > hvigor %p %c %[%m%]"}},info:{type:"stdout",layout:{type:"pattern",pattern:"[%d] > hvigor %[%m%]"}},"no-pattern-info":{type:"stdout",layout:{type:"pattern",pattern:"%m"}},wrong:{type:"stderr",layout:{type:"pattern",pattern:"[%d] > hvigor %[%p: %m%]"}},"just-debug":{type:"logLevelFilter",appender:"debug",level:"debug",maxLevel:"debug"},"just-info":{type:"logLevelFilter",appender:"info",level:"info",maxLevel:"info"},"just-wrong":{type:"logLevelFilter",appender:"wrong",level:"warn",maxLevel:"error"}},categories:{default:{appenders:["just-debug","just-info","just-wrong"],level:"debug"},"no-pattern-info":{appenders:["no-pattern-info"],level:"info"}}};al.setConfiguration=e=>{fl=e};al.getConfiguration=()=>fl;let dl=ll.levels.DEBUG;al.setCategoriesLevel=(e,t)=>{dl=e;const n=fl.categories;for(const r in n)(null==t?void 0:t.includes(r))||Object.prototype.hasOwnProperty.call(n,r)&&(n[r].level=e.levelStr)};al.getLevel=()=>dl,al.levelMap=new Map([["ALL",ll.levels.ALL],["MARK",ll.levels.MARK],["TRACE",ll.levels.TRACE],["DEBUG",ll.levels.DEBUG],["INFO",ll.levels.INFO],["WARN",ll.levels.WARN],["ERROR",ll.levels.ERROR],["FATAL",ll.levels.FATAL],["OFF",ll.levels.OFF]]);var Dl=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),pl=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),El=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&Dl(t,e,n);return pl(t,e),t};Object.defineProperty(xr,"__esModule",{value:!0}),xr.evaluateLogLevel=xr.HvigorLogger=void 0;const ml=El(cl),hl=cl,yl=El(F.default),Cl=al;class Fl{constructor(e){ml.configure((0,Cl.getConfiguration)()),this._logger=ml.getLogger(e),this._logger.level=(0,Cl.getLevel)()}static getLogger(e){return new Fl(e)}log(e,...t){this._logger.log(e,...t)}debug(e,...t){this._logger.debug(e,...t)}info(e,...t){this._logger.info(e,...t)}warn(e,...t){void 0!==e&&""!==e&&this._logger.warn(e,...t)}error(e,...t){this._logger.error(e,...t)}_printTaskExecuteInfo(e,t){this.info(`Finished :${e}... after ${t}`)}_printFailedTaskInfo(e){this.error(`Failed :${e}... `)}_printDisabledTaskInfo(e){this.info(`Disabled :${e}... `)}_printUpToDateTaskInfo(e){this.info(`UP-TO-DATE :${e}... `)}errorMessageExit(e,...t){throw new Error(yl.format(e,...t))}errorExit(e,t,...n){t&&this._logger.error(t,n),this._logger.error(e.stack)}setLevel(e,t){(0,Cl.setCategoriesLevel)(e,t),ml.shutdown(),ml.configure((0,Cl.getConfiguration)())}getLevel(){return this._logger.level}configure(e){const t=(0,Cl.getConfiguration)(),n={appenders:{...t.appenders,...e.appenders},categories:{...t.categories,...e.categories}};(0,Cl.setConfiguration)(n),ml.shutdown(),ml.configure(n)}}xr.HvigorLogger=Fl,xr.evaluateLogLevel=function(e,t){t.debug?e.setLevel(hl.levels.DEBUG):t.warn?e.setLevel(hl.levels.WARN):t.error?e.setLevel(hl.levels.ERROR):e.setLevel(hl.levels.INFO)};var gl=w&&w.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(X,"__esModule",{value:!0}),X.parseJsonText=X.parseJsonFile=void 0;const Al=Z,vl=gl(kr),Sl=gl(p.default),wl=gl(E.default),Ol=xr.HvigorLogger.getLogger("parse-json-util");var bl;!function(e){e[e.Char=0]="Char",e[e.EOF=1]="EOF",e[e.Identifier=2]="Identifier"}(bl||(bl={}));let _l,Bl,Pl,kl,xl,Nl,Il="start",Tl=[],Rl=0,Ml=1,Ll=0,jl=!1,$l="default",Hl="'",Jl=1;function Gl(e,t=!1){Bl=String(e),Il="start",Tl=[],Rl=0,Ml=1,Ll=0,kl=void 0,jl=t;do{_l=Vl(),Xl[Il]()}while("eof"!==_l.type);return kl}function Vl(){for($l="default",xl="",Hl="'",Jl=1;;){Nl=Ul();const e=zl[$l]();if(e)return e}}function Ul(){if(Bl[Rl])return String.fromCodePoint(Bl.codePointAt(Rl))}function Wl(){const e=Ul();return"\n"===e?(Ml++,Ll=0):e?Ll+=e.length:Ll++,e&&(Rl+=e.length),e}X.parseJsonFile=function(e,t=!1,n="utf-8"){const r=vl.default.readFileSync(Sl.default.resolve(e),{encoding:n});try{return Gl(r,t)}catch(t){if(t instanceof SyntaxError){const n=t.message.split("at");2===n.length&&Ol.errorMessageExit(`${n[0].trim()}${wl.default.EOL}\t at ${e}:${n[1].trim()}`)}Ol.errorMessageExit(`${e} is not in valid JSON/JSON5 format.`)}},X.parseJsonText=Gl;const zl={default(){switch(Nl){case"/":return Wl(),void($l="comment");case void 0:return Wl(),Kl("eof")}if(!Al.JudgeUtil.isIgnoreChar(Nl)&&!Al.JudgeUtil.isSpaceSeparator(Nl))return zl[Il]();Wl()},start(){$l="value"},beforePropertyName(){switch(Nl){case"$":case"_":return xl=Wl(),void($l="identifierName");case"\\":return Wl(),void($l="identifierNameStartEscape");case"}":return Kl("punctuator",Wl());case'"':case"'":return Hl=Nl,Wl(),void($l="string")}if(Al.JudgeUtil.isIdStartChar(Nl))return xl+=Wl(),void($l="identifierName");throw tf(bl.Char,Wl())},afterPropertyName(){if(":"===Nl)return Kl("punctuator",Wl());throw tf(bl.Char,Wl())},beforePropertyValue(){$l="value"},afterPropertyValue(){switch(Nl){case",":case"}":return Kl("punctuator",Wl())}throw tf(bl.Char,Wl())},beforeArrayValue(){if("]"===Nl)return Kl("punctuator",Wl());$l="value"},afterArrayValue(){switch(Nl){case",":case"]":return Kl("punctuator",Wl())}throw tf(bl.Char,Wl())},end(){throw tf(bl.Char,Wl())},comment(){switch(Nl){case"*":return Wl(),void($l="multiLineComment");case"/":return Wl(),void($l="singleLineComment")}throw tf(bl.Char,Wl())},multiLineComment(){switch(Nl){case"*":return Wl(),void($l="multiLineCommentAsterisk");case void 0:throw tf(bl.Char,Wl())}Wl()},multiLineCommentAsterisk(){switch(Nl){case"*":return void Wl();case"/":return Wl(),void($l="default");case void 0:throw tf(bl.Char,Wl())}Wl(),$l="multiLineComment"},singleLineComment(){switch(Nl){case"\n":case"\r":case"\u2028":case"\u2029":return Wl(),void($l="default");case void 0:return Wl(),Kl("eof")}Wl()},value(){switch(Nl){case"{":case"[":return Kl("punctuator",Wl());case"n":return Wl(),ql("ull"),Kl("null",null);case"t":return Wl(),ql("rue"),Kl("boolean",!0);case"f":return Wl(),ql("alse"),Kl("boolean",!1);case"-":case"+":return"-"===Wl()&&(Jl=-1),void($l="numerical");case".":case"0":case"I":case"N":return void($l="numerical");case'"':case"'":return Hl=Nl,Wl(),xl="",void($l="string")}if(void 0===Nl||!Al.JudgeUtil.isDigitWithoutZero(Nl))throw tf(bl.Char,Wl());$l="numerical"},numerical(){switch(Nl){case".":return xl=Wl(),void($l="decimalPointLeading");case"0":return xl=Wl(),void($l="zero");case"I":return Wl(),ql("nfinity"),Kl("numeric",Jl*(1/0));case"N":return Wl(),ql("aN"),Kl("numeric",NaN)}if(void 0!==Nl&&Al.JudgeUtil.isDigitWithoutZero(Nl))return xl=Wl(),void($l="decimalInteger");throw tf(bl.Char,Wl())},zero(){switch(Nl){case".":case"e":case"E":return void($l="decimal");case"x":case"X":return xl+=Wl(),void($l="hexadecimal")}return Kl("numeric",0)},decimalInteger(){switch(Nl){case".":case"e":case"E":return void($l="decimal")}if(!Al.JudgeUtil.isDigit(Nl))return Kl("numeric",Jl*Number(xl));xl+=Wl()},decimal(){switch(Nl){case".":xl+=Wl(),$l="decimalFraction";break;case"e":case"E":xl+=Wl(),$l="decimalExponent"}},decimalPointLeading(){if(Al.JudgeUtil.isDigit(Nl))return xl+=Wl(),void($l="decimalFraction");throw tf(bl.Char,Wl())},decimalFraction(){switch(Nl){case"e":case"E":return xl+=Wl(),void($l="decimalExponent")}if(!Al.JudgeUtil.isDigit(Nl))return Kl("numeric",Jl*Number(xl));xl+=Wl()},decimalExponent(){switch(Nl){case"+":case"-":return xl+=Wl(),void($l="decimalExponentSign")}if(Al.JudgeUtil.isDigit(Nl))return xl+=Wl(),void($l="decimalExponentInteger");throw tf(bl.Char,Wl())},decimalExponentSign(){if(Al.JudgeUtil.isDigit(Nl))return xl+=Wl(),void($l="decimalExponentInteger");throw tf(bl.Char,Wl())},decimalExponentInteger(){if(!Al.JudgeUtil.isDigit(Nl))return Kl("numeric",Jl*Number(xl));xl+=Wl()},hexadecimal(){if(Al.JudgeUtil.isHexDigit(Nl))return xl+=Wl(),void($l="hexadecimalInteger");throw tf(bl.Char,Wl())},hexadecimalInteger(){if(!Al.JudgeUtil.isHexDigit(Nl))return Kl("numeric",Jl*Number(xl));xl+=Wl()},identifierNameStartEscape(){if("u"!==Nl)throw tf(bl.Char,Wl());Wl();const e=Yl();switch(e){case"$":case"_":break;default:if(!Al.JudgeUtil.isIdStartChar(e))throw tf(bl.Identifier)}xl+=e,$l="identifierName"},identifierName(){switch(Nl){case"$":case"_":case"‌":case"‍":return void(xl+=Wl());case"\\":return Wl(),void($l="identifierNameEscape")}if(!Al.JudgeUtil.isIdContinueChar(Nl))return Kl("identifier",xl);xl+=Wl()},identifierNameEscape(){if("u"!==Nl)throw tf(bl.Char,Wl());Wl();const e=Yl();switch(e){case"$":case"_":case"‌":case"‍":break;default:if(!Al.JudgeUtil.isIdContinueChar(e))throw tf(bl.Identifier)}xl+=e,$l="identifierName"},string(){switch(Nl){case"\\":return Wl(),void(xl+=function(){const e=Ul(),t=function(){switch(Ul()){case"b":return Wl(),"\b";case"f":return Wl(),"\f";case"n":return Wl(),"\n";case"r":return Wl(),"\r";case"t":return Wl(),"\t";case"v":return Wl(),"\v"}return}();if(t)return t;switch(e){case"0":if(Wl(),Al.JudgeUtil.isDigit(Ul()))throw tf(bl.Char,Wl());return"\0";case"x":return Wl(),function(){let e="",t=Ul();if(!Al.JudgeUtil.isHexDigit(t))throw tf(bl.Char,Wl());if(e+=Wl(),t=Ul(),!Al.JudgeUtil.isHexDigit(t))throw tf(bl.Char,Wl());return e+=Wl(),String.fromCodePoint(parseInt(e,16))}();case"u":return Wl(),Yl();case"\n":case"\u2028":case"\u2029":return Wl(),"";case"\r":return Wl(),"\n"===Ul()&&Wl(),""}if(void 0===e||Al.JudgeUtil.isDigitWithoutZero(e))throw tf(bl.Char,Wl());return Wl()}());case'"':case"'":if(Nl===Hl){const e=Kl("string",xl);return Wl(),e}return void(xl+=Wl());case"\n":case"\r":case void 0:throw tf(bl.Char,Wl());case"\u2028":case"\u2029":!function(e){Ol.warn(`JSON5: '${ef(e)}' in strings is not valid ECMAScript; consider escaping.`)}(Nl)}xl+=Wl()}};function Kl(e,t){return{type:e,value:t,line:Ml,column:Ll}}function ql(e){for(const t of e){if(Ul()!==t)throw tf(bl.Char,Wl());Wl()}}function Yl(){let e="",t=4;for(;t-- >0;){const t=Ul();if(!Al.JudgeUtil.isHexDigit(t))throw tf(bl.Char,Wl());e+=Wl()}return String.fromCodePoint(parseInt(e,16))}const Xl={start(){if("eof"===_l.type)throw tf(bl.EOF);Zl()},beforePropertyName(){switch(_l.type){case"identifier":case"string":return Pl=_l.value,void(Il="afterPropertyName");case"punctuator":return void Ql();case"eof":throw tf(bl.EOF)}},afterPropertyName(){if("eof"===_l.type)throw tf(bl.EOF);Il="beforePropertyValue"},beforePropertyValue(){if("eof"===_l.type)throw tf(bl.EOF);Zl()},afterPropertyValue(){if("eof"===_l.type)throw tf(bl.EOF);switch(_l.value){case",":return void(Il="beforePropertyName");case"}":Ql()}},beforeArrayValue(){if("eof"===_l.type)throw tf(bl.EOF);"punctuator"!==_l.type||"]"!==_l.value?Zl():Ql()},afterArrayValue(){if("eof"===_l.type)throw tf(bl.EOF);switch(_l.value){case",":return void(Il="beforeArrayValue");case"]":Ql()}},end(){}};function Zl(){const e=function(){let e;switch(_l.type){case"punctuator":switch(_l.value){case"{":e={};break;case"[":e=[]}break;case"null":case"boolean":case"numeric":case"string":e=_l.value}return e}();if(jl&&"object"==typeof e&&(e._line=Ml,e._column=Ll),void 0===kl)kl=e;else{const t=Tl[Tl.length-1];Array.isArray(t)?jl&&"object"!=typeof e?t.push({value:e,_line:Ml,_column:Ll}):t.push(e):t[Pl]=jl&&"object"!=typeof e?{value:e,_line:Ml,_column:Ll}:e}!function(e){if(e&&"object"==typeof e)Tl.push(e),Il=Array.isArray(e)?"beforeArrayValue":"beforePropertyName";else{const e=Tl[Tl.length-1];Il=e?Array.isArray(e)?"afterArrayValue":"afterPropertyValue":"end"}}(e)}function Ql(){Tl.pop();const e=Tl[Tl.length-1];Il=e?Array.isArray(e)?"afterArrayValue":"afterPropertyValue":"end"}function ef(e){const t={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(t[e])return t[e];if(e<" "){const t=e.charCodeAt(0).toString(16);return`\\x${`00${t}`.substring(t.length)}`}return e}function tf(e,t){let n="";switch(e){case bl.Char:n=void 0===t?`JSON5: invalid end of input at ${Ml}:${Ll}`:`JSON5: invalid character '${ef(t)}' at ${Ml}:${Ll}`;break;case bl.EOF:n=`JSON5: invalid end of input at ${Ml}:${Ll}`;break;case bl.Identifier:Ll-=5,n=`JSON5: invalid identifier character at ${Ml}:${Ll}`}const r=new nf(n);return r.lineNumber=Ml,r.columnNumber=Ll,r}class nf extends SyntaxError{}var rf=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),uf=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),of=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&rf(t,e,n);return uf(t,e),t};Object.defineProperty(Y,"__esModule",{value:!0});var sf=Y.cleanWorkSpace=Ff=Y.executeInstallHvigor=yf=Y.isHvigorInstalled=mf=Y.isAllDependenciesInstalled=void 0;const cf=of(D.default),af=of(p.default),lf=b,ff=j,df=$,Df=X;let pf,Ef;var mf=Y.isAllDependenciesInstalled=function(){function e(e){const t=null==e?void 0:e.dependencies;return void 0===t?0:Object.getOwnPropertyNames(t).length}if(pf=gf(),Ef=Af(),e(pf)+1!==e(Ef))return!1;for(const e in null==pf?void 0:pf.dependencies)if(!(0,ff.hasNpmPackInPaths)(e,[lf.HVIGOR_PROJECT_DEPENDENCIES_HOME])||!hf(e,pf,Ef))return!1;return!0};function hf(e,t,n){return void 0!==n.dependencies&&(0,ff.offlinePluginConversion)(lf.HVIGOR_PROJECT_ROOT_DIR,t.dependencies[e])===n.dependencies[e]}var yf=Y.isHvigorInstalled=function(){return pf=gf(),Ef=Af(),(0,ff.hasNpmPackInPaths)(lf.HVIGOR_ENGINE_PACKAGE_NAME,[lf.HVIGOR_PROJECT_DEPENDENCIES_HOME])&&(0,ff.offlinePluginConversion)(lf.HVIGOR_PROJECT_ROOT_DIR,pf.hvigorVersion)===Ef.dependencies[lf.HVIGOR_ENGINE_PACKAGE_NAME]};const Cf={cwd:lf.HVIGOR_PROJECT_DEPENDENCIES_HOME,stdio:["inherit","inherit","inherit"]};var Ff=Y.executeInstallHvigor=function(){(0,df.logInfoPrintConsole)("Hvigor installing...");const e={dependencies:{}};e.dependencies[lf.HVIGOR_ENGINE_PACKAGE_NAME]=(0,ff.offlinePluginConversion)(lf.HVIGOR_PROJECT_ROOT_DIR,pf.hvigorVersion);try{cf.mkdirSync(lf.HVIGOR_PROJECT_DEPENDENCIES_HOME,{recursive:!0});const t=af.resolve(lf.HVIGOR_PROJECT_DEPENDENCIES_HOME,lf.DEFAULT_PACKAGE_JSON);cf.writeFileSync(t,JSON.stringify(e))}catch(e){(0,df.logErrorAndExit)(e)}!function(){const e=["config","set","store-dir",lf.HVIGOR_PNPM_STORE_PATH];(0,ff.executeCommand)(lf.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH,e,Cf)}(),(0,ff.executeCommand)(lf.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH,["install"],Cf)};function gf(){const e=af.resolve(lf.HVIGOR_PROJECT_WRAPPER_HOME,lf.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME);return cf.existsSync(e)||(0,df.logErrorAndExit)(`Error: Hvigor config file ${e} does not exist.`),(0,Df.parseJsonFile)(e)}function Af(){return cf.existsSync(lf.HVIGOR_PROJECT_DEPENDENCY_PACKAGE_JSON_PATH)?(0,Df.parseJsonFile)(lf.HVIGOR_PROJECT_DEPENDENCY_PACKAGE_JSON_PATH):{dependencies:{}}}sf=Y.cleanWorkSpace=function(){if((0,df.logInfoPrintConsole)("Hvigor cleaning..."),!cf.existsSync(lf.HVIGOR_PROJECT_DEPENDENCIES_HOME))return;const e=cf.readdirSync(lf.HVIGOR_PROJECT_DEPENDENCIES_HOME);if(e&&0!==e.length){cf.existsSync(lf.HVIGOR_BOOT_JS_FILE_PATH)&&(0,ff.executeCommand)(process.argv[0],[lf.HVIGOR_BOOT_JS_FILE_PATH,"--stop-daemon"],{});try{e.forEach((e=>{cf.rmSync(af.resolve(lf.HVIGOR_PROJECT_DEPENDENCIES_HOME,e),{recursive:!0})}))}catch(e){(0,df.logErrorAndExit)(`The hvigor build tool cannot be installed. Please manually clear the workspace directory and synchronize the project again.\n\n Workspace Path: ${lf.HVIGOR_PROJECT_DEPENDENCIES_HOME}.`)}}};var vf={},Sf=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),wf=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Of=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&Sf(t,e,n);return wf(t,e),t};Object.defineProperty(vf,"__esModule",{value:!0});var bf=vf.executeBuild=void 0;const _f=b,Bf=Of(D.default),Pf=Of(p.default),kf=$;bf=vf.executeBuild=function(){const e=Pf.resolve(_f.HVIGOR_PROJECT_DEPENDENCIES_HOME,"node_modules","@ohos","hvigor","bin","hvigor.js");try{const t=Bf.realpathSync(e);require(t)}catch(t){(0,kf.logErrorAndExit)(`Error: ENOENT: no such file ${e},delete ${_f.HVIGOR_PROJECT_DEPENDENCIES_HOME} and retry.`)}},function(){if(O.checkNpmConifg(),O.environmentHandler(),O.isPnpmAvailable()||O.executeInstallPnpm(),yf()&&mf())bf();else{sf();try{Ff()}catch(e){return void sf()}bf()}}(); \ No newline at end of file diff --git a/ohos/test_flutter_cache_manager/ohos/hvigorfile.ts b/ohos/test_flutter_cache_manager/ohos/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..5a172b770e3b15f67c12152d00f38f2084d3915b --- /dev/null +++ b/ohos/test_flutter_cache_manager/ohos/hvigorfile.ts @@ -0,0 +1,17 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently. +export { appTasks } from '@ohos/hvigor-ohos-plugin'; \ No newline at end of file diff --git a/ohos/test_flutter_cache_manager/ohos/hvigorw b/ohos/test_flutter_cache_manager/ohos/hvigorw new file mode 100755 index 0000000000000000000000000000000000000000..5efd8343d3232bdd1d9b7f67a3326034054c5396 --- /dev/null +++ b/ohos/test_flutter_cache_manager/ohos/hvigorw @@ -0,0 +1,61 @@ +#!/bin/bash + +# Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# ---------------------------------------------------------------------------- +# Hvigor startup script, version 1.0.0 +# +# Required ENV vars: +# ------------------ +# NODE_HOME - location of a Node home dir +# or +# Add /usr/local/nodejs/bin to the PATH environment variable +# ---------------------------------------------------------------------------- + +HVIGOR_APP_HOME=$(dirname $(readlink -f $0)) +HVIGOR_WRAPPER_SCRIPT=${HVIGOR_APP_HOME}/hvigor/hvigor-wrapper.js +warn() { + echo "" + echo -e "\033[1;33m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m" +} + +error() { + echo "" + echo -e "\033[1;31m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m" +} + +fail() { + error "$@" + exit 1 +} + +# Determine node to start hvigor wrapper script +if [ -n "${NODE_HOME}" ];then + EXECUTABLE_NODE="${NODE_HOME}/bin/node" + if [ ! -x "$EXECUTABLE_NODE" ];then + fail "ERROR: NODE_HOME is set to an invalid directory,check $NODE_HOME\n\nPlease set NODE_HOME in your environment to the location where your nodejs installed" + fi +else + EXECUTABLE_NODE="node" + which ${EXECUTABLE_NODE} > /dev/null 2>&1 || fail "ERROR: NODE_HOME is not set and not 'node' command found in your path" +fi + +# Check hvigor wrapper script +if [ ! -r "$HVIGOR_WRAPPER_SCRIPT" ];then + fail "ERROR: Couldn't find hvigor/hvigor-wrapper.js in ${HVIGOR_APP_HOME}" +fi + +# start hvigor-wrapper script +exec "${EXECUTABLE_NODE}" \ + "${HVIGOR_WRAPPER_SCRIPT}" "$@" diff --git a/ohos/test_flutter_cache_manager/ohos/hvigorw.bat b/ohos/test_flutter_cache_manager/ohos/hvigorw.bat new file mode 100644 index 0000000000000000000000000000000000000000..6861293e47dfd0186da380321b73be9033507e24 --- /dev/null +++ b/ohos/test_flutter_cache_manager/ohos/hvigorw.bat @@ -0,0 +1,64 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Hvigor startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +set WRAPPER_MODULE_PATH=%APP_HOME%\hvigor\hvigor-wrapper.js +set NODE_EXE=node.exe + +goto start + +:start +@rem Find node.exe +if defined NODE_HOME goto findNodeFromNodeHome + +%NODE_EXE% --version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH. +echo. +echo Please set the NODE_HOME variable in your environment to match the +echo location of your NodeJs installation. + +goto fail + +:findNodeFromNodeHome +set NODE_HOME=%NODE_HOME:"=% +set NODE_EXE_PATH=%NODE_HOME%/%NODE_EXE% + +if exist "%NODE_EXE_PATH%" goto execute +echo. +echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH. +echo. +echo Please set the NODE_HOME variable in your environment to match the +echo location of your NodeJs installation. + +goto fail + +:execute +@rem Execute hvigor +"%NODE_EXE%" %WRAPPER_MODULE_PATH% %* + +if "%ERRORLEVEL%" == "0" goto hvigorwEnd + +:fail +exit /b 1 + +:hvigorwEnd +if "%OS%" == "Windows_NT" endlocal + +:end diff --git a/ohos/test_flutter_cache_manager/ohos/oh-package.json5 b/ohos/test_flutter_cache_manager/ohos/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..a2408ea9cb7b309e6ad95e27a4c8b88985ae57c6 --- /dev/null +++ b/ohos/test_flutter_cache_manager/ohos/oh-package.json5 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +{ + "name": "apptemplate", + "version": "1.0.0", + "description": "Please describe the basic information.", + "main": "", + "author": "", + "license": "", + "dependencies": { + }, + "devDependencies": { + "@ohos/hypium": "1.0.6" + } +} diff --git a/ohos/test_flutter_cache_manager/package-lock.json b/ohos/test_flutter_cache_manager/package-lock.json new file mode 100644 index 0000000000000000000000000000000000000000..901dbc8bc50c9ede0494f54eb0ac99e4298cb2d6 --- /dev/null +++ b/ohos/test_flutter_cache_manager/package-lock.json @@ -0,0 +1,6 @@ +{ + "name": "test_flutter_cache_manager", + "lockfileVersion": 2, + "requires": true, + "packages": {} +} diff --git a/ohos/test_flutter_cache_manager/pubspec.yaml b/ohos/test_flutter_cache_manager/pubspec.yaml new file mode 100755 index 0000000000000000000000000000000000000000..91f5a979d40aef673baf070ec5060a957663394f --- /dev/null +++ b/ohos/test_flutter_cache_manager/pubspec.yaml @@ -0,0 +1,24 @@ +name: test_flutter_cache_manager +description: A new Flutter project. +publish_to: 'none' +version: 1.0.0 + +environment: + sdk: '>=2.12.0 <3.0.0' +dependencies: + cupertino_icons: ^1.0.5 + flutter: + sdk: flutter + url_launcher: ^6.1.10 + flutter_cache_manager: 3.3.1 + mockito: ^5.0.0 + permission_handler: ^11.0.1 +flutter: + uses-material-design: true + assets: + - assets/image-120.png +dependency_overrides: + path_provider_ohos: + path: /home/hhc/test_example/local_package/path_provider_ohos + permission_handler: + path: /home/hhc/test_example/9/flutter_permission_handler/permission_handler \ No newline at end of file diff --git a/ohos/test_quiver/.gitignore b/ohos/test_quiver/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..24476c5d1eb55824c76d8b01a3965f94abad1ef8 --- /dev/null +++ b/ohos/test_quiver/.gitignore @@ -0,0 +1,44 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.packages +.pub-cache/ +.pub/ +/build/ + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/ohos/test_quiver/.metadata b/ohos/test_quiver/.metadata new file mode 100644 index 0000000000000000000000000000000000000000..3211d02f27792d7031aa1b7c8263028fd922a720 --- /dev/null +++ b/ohos/test_quiver/.metadata @@ -0,0 +1,30 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled. + +version: + revision: 840747ee91d7cfb95661ce7358b7256919075c2a + channel: master + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: 840747ee91d7cfb95661ce7358b7256919075c2a + base_revision: 840747ee91d7cfb95661ce7358b7256919075c2a + - platform: android + create_revision: 840747ee91d7cfb95661ce7358b7256919075c2a + base_revision: 840747ee91d7cfb95661ce7358b7256919075c2a + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/ohos/test_quiver/README.md b/ohos/test_quiver/README.md new file mode 100644 index 0000000000000000000000000000000000000000..415f73b86235f52916d572c86b463a05d3bdc1e6 --- /dev/null +++ b/ohos/test_quiver/README.md @@ -0,0 +1,16 @@ +# test_quiver + +A new Flutter project. + +## Getting Started + +This project is a starting point for a Flutter application. + +A few resources to get you started if this is your first Flutter project: + +- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) +- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) + +For help getting started with Flutter development, view the +[online documentation](https://docs.flutter.dev/), which offers tutorials, +samples, guidance on mobile development, and a full API reference. diff --git a/ohos/test_quiver/analysis_options.yaml b/ohos/test_quiver/analysis_options.yaml new file mode 100644 index 0000000000000000000000000000000000000000..61b6c4de17c96863d24279f06b85e01b6ebbdb34 --- /dev/null +++ b/ohos/test_quiver/analysis_options.yaml @@ -0,0 +1,29 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at + # https://dart-lang.github.io/linter/lints/index.html. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/ohos/test_quiver/lib/base/base_page.dart b/ohos/test_quiver/lib/base/base_page.dart new file mode 100644 index 0000000000000000000000000000000000000000..4e7696dd6aacb60c31d5f27aec4769a189efd686 --- /dev/null +++ b/ohos/test_quiver/lib/base/base_page.dart @@ -0,0 +1,41 @@ +import 'package:flutter/material.dart'; + +import 'main_item_widget.dart'; +import 'test_route.dart'; + +/// 全局静态数据存储 +abstract class GlobalData { + static String appName = ''; +} + +/// app基本首页 +class BasePage extends StatefulWidget { + const BasePage({Key? key, required this.data}) : super(key: key); + + final List data; + + @override + State createState() => _BasePageState(); +} + +class _BasePageState extends State { + int get _itemCount => widget.data.length; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Center( + child: Text(GlobalData.appName, textAlign: TextAlign.center)), + ), + body: + ListView.builder(itemBuilder: _itemBuilder, itemCount: _itemCount)); + } + + Widget _itemBuilder(BuildContext context, int index) { + return MainItemWidget(widget.data[index], (MainItem item) { + Navigator.push( + context, MaterialPageRoute(builder: (content) => item.route)); + }); + } +} diff --git a/ohos/test_quiver/lib/base/item_widget.dart b/ohos/test_quiver/lib/base/item_widget.dart new file mode 100644 index 0000000000000000000000000000000000000000..64a3e8a5cf9e689e7a991b5d2efd49f0badf9646 --- /dev/null +++ b/ohos/test_quiver/lib/base/item_widget.dart @@ -0,0 +1,112 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +import 'test_page.dart'; + +/// Item widget. +class ItemWidget extends StatefulWidget { + /// Item widget. + const ItemWidget( + {required this.item, required this.index, required this.getGroupRange, required this.runGroup, required this.onTap, this.summary, Key? key}) + : super(key: key); + + /// item summary. + final String? summary; + + /// item data. + final Item item; + + /// 当前下标 + final int index; + + /// 获取对应的组信息 + final GroupRange Function() getGroupRange; + + /// 获取对应的组信息 + final void Function(int start, int end) runGroup; + + /// Action when pressed (typically run). + final void Function(Item item) onTap; + + @override + ItemWidgetState createState() => ItemWidgetState(); +} + +class ItemWidgetState extends State { + @override + Widget build(BuildContext context) { + IconData? icon; + Color? color; + + switch (widget.item.state) { + case ItemState.none: + icon = Icons.arrow_forward_ios; + break; + case ItemState.running: + icon = Icons.more_horiz; + break; + case ItemState.success: + icon = Icons.check; + color = Colors.green; + break; + case ItemState.failure: + icon = Icons.close; + color = Colors.red; + break; + } + + final Widget listTile = ListTile( + leading: SizedBox( + child: IconButton( + icon: Icon(icon, color: color), + onPressed: null, + )), + title: Text(widget.item.name), + subtitle: widget.summary != null ? Text(widget.summary!) : null, + onTap: () { + widget.onTap(widget.item); + }); + + final data = widget.getGroupRange(); + + return Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (data.groupName.isNotEmpty && data.startIndex == widget.index) + GestureDetector( + onTap: () {}, + child: Container( + height: 35, + decoration: BoxDecoration(color: CupertinoColors.extraLightBackgroundGray), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + '测试组: ${data.groupName}', + style: TextStyle(fontSize: 18), + ), + FilledButton( + onPressed: () => widget.runGroup(data.startIndex, data.startIndex), + child: Text( + '整组测试', + style: TextStyle(fontSize: 16), + )) + ], + ), + ), + ), + Container( + margin: data.groupName.isNotEmpty && data.startIndex == widget.index ? EdgeInsets.only(bottom: 10) : null, + decoration: BoxDecoration( + border: data.groupName.isNotEmpty && data.endIndex == widget.index ? Border(bottom: BorderSide(color: Colors.grey)) : null, + ), + child: Padding( + padding: data.groupName.isNotEmpty && data.startIndex <= widget.index && data.endIndex >= widget.index ? EdgeInsets.only(left: 35) : EdgeInsets.zero, + child: listTile, + ), + ) + ], + ); + } +} diff --git a/ohos/test_quiver/lib/base/main_item_widget.dart b/ohos/test_quiver/lib/base/main_item_widget.dart new file mode 100644 index 0000000000000000000000000000000000000000..32f8261b736c517c5984710ec950be96470dacdc --- /dev/null +++ b/ohos/test_quiver/lib/base/main_item_widget.dart @@ -0,0 +1,35 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'test_route.dart'; + +/// Main item widget. +class MainItemWidget extends StatefulWidget { + /// Main item widget. + const MainItemWidget(this.item, this.onTap, {Key? key}) : super(key: key); + + /// item data. + final MainItem item; + + /// onTap action (typically run or open). + final void Function(MainItem item) onTap; + + @override + MainItemWidgetState createState() => MainItemWidgetState(); +} + +class MainItemWidgetState extends State { + @override + Widget build(BuildContext context) { + return Container( + margin: const EdgeInsets.only(bottom: 10), + child: ListTile( + tileColor: CupertinoColors.extraLightBackgroundGray, + title: Text(widget.item.title), + onTap: _onTap), + ); + } + + void _onTap() { + widget.onTap(widget.item); + } +} diff --git a/ohos/test_quiver/lib/base/test_model_app.dart b/ohos/test_quiver/lib/base/test_model_app.dart new file mode 100644 index 0000000000000000000000000000000000000000..f565a5f8dab474f51e2a0c16cf745a6f7887b65b --- /dev/null +++ b/ohos/test_quiver/lib/base/test_model_app.dart @@ -0,0 +1,36 @@ +import 'package:flutter/material.dart'; + +import 'base_page.dart'; +import 'test_route.dart'; + +/// 基础app框架 +class TestModelApp extends StatefulWidget { + TestModelApp({Key? key, required this.appName, required this.data}) : super(key: key) { + GlobalData.appName = appName; + } + + /// 测试包名称 + final String appName; + + /// 路由数据 + final List data; + + @override + State createState() => TestModelState(); +} + +class TestModelState extends State { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: widget.appName, + theme: ThemeData( + colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue), + appBarTheme: const AppBarTheme(backgroundColor: Colors.blue), + primarySwatch: Colors.blue, + useMaterial3: true, + ), + home: BasePage(data: widget.data), + ); + } +} diff --git a/ohos/test_quiver/lib/base/test_page.dart b/ohos/test_quiver/lib/base/test_page.dart new file mode 100644 index 0000000000000000000000000000000000000000..babcabaa7a2518f65dbfed58afa0017739ec540e --- /dev/null +++ b/ohos/test_quiver/lib/base/test_page.dart @@ -0,0 +1,309 @@ +import 'dart:async'; + +import 'package:flutter/material.dart'; + +import 'item_widget.dart'; + +List contentList = []; + +class Test { + /// Test definition. + Test(this.name, this.fn, {bool? solo, bool? skip}) + : solo = solo == true, + skip = skip == true; + + /// Only run this test. + final bool solo; + + /// Skip this test. + final bool skip; + + /// Test name. + String name; + + /// Test body. + FutureOr Function() fn; +} + +/// Item states. +enum ItemState { + /// test not run yet. + none, + + /// test is running. + running, + + /// test succeeded. + success, + + /// test fails. + failure +} + +/// Menu item. +class Item { + /// Menu item. + Item(this.name); + + /// Menu item state. + ItemState state = ItemState.running; + + /// Menu item name/ + String name; +} + +class TestLength { + TestLength(this.oldLength, this.newLength); + + int oldLength; + int newLength; +} + +class GroupRange { + GroupRange(this.groupName, this.startIndex, this.endIndex); + + String groupName; + int startIndex; + int endIndex; +} + +/// 基础测试页面 +class TestPage extends StatefulWidget { + /// Base test page. + TestPage({required this.title, Key? key}) : super(key: key); + + /// The title. + final String title; + + /// Test list. + final List tests = []; + + /// 保存group的范围信息 + final Map groupTitle = {}; + + /// define a test. + void test(String name, FutureOr Function() fn) { + tests.add(Test(name, fn)); + } + + /// define a group test. + void group(String name, FutureOr Function() fn) { + int oldLength = tests.length; + fn(); + + int newLength = tests.length - 1; + groupTitle.addAll({name: TestLength(oldLength, newLength)}); + } + + /// Thrown an exception + void fail([String? message]) { + throw Exception(message ?? 'should fail'); + } + + @override + TestPageState createState() => TestPageState(); +} + +/// Group. +mixin Group { + /// List of tests. + List get tests { + throw UnimplementedError(); + } + + bool? _hasSolo; + final _tests = []; + + /// Add a test. + void add(Test test) { + if (!test.skip) { + if (test.solo) { + if (_hasSolo != true) { + _hasSolo = true; + _tests.clear(); + } + _tests.add(test); + } else if (_hasSolo != true) { + _tests.add(test); + } + } + } + + /// true if it has solo or contains item with solo feature + bool? get hasSolo => _hasSolo; +} + +class TestPageState extends State with Group { + List items = []; + + Future _run() async { + if (!mounted) { + return null; + } + + setState(() { + items.clear(); + }); + _tests.clear(); + for (var test in widget.tests) { + add(test); + } + for (var test in _tests) { + var item = Item(test.name); + contentList.add(Text(test.name, style: const TextStyle(fontSize: 18, color: Colors.green))); + + late int position; + setState(() { + position = items.length; + items.add(item); + }); + try { + await test.fn(); + item = Item(test.name)..state = ItemState.success; + print('ohFlutter: ${test.name}, result: success'); + } catch (e, st) { + contentList.add(Text('$e, $st', style: const TextStyle(fontSize: 18, color: Colors.red))); + print('ohFlutter: ${test.name}-error: $e, $st}'); + item = Item(test.name)..state = ItemState.failure; + } + + if (!mounted) { + return null; + } + + setState(() { + items[position] = item; + }); + } + } + + Future _runTest(int index) async { + if (!mounted) { + return null; + } + + final test = _tests[index]; + + var item = items[index]; + setState(() { + contentList = []; + item.state = ItemState.running; + }); + contentList.add(Text(test.name, style: const TextStyle(fontSize: 18, color: Colors.green))); + try { + await test.fn(); + + item = Item(test.name)..state = ItemState.success; + print('ohFlutter: ${test.name}, result: success'); + } catch (e, st) { + contentList.add(Text('$e, $st', style: const TextStyle(fontSize: 18, color: Colors.red))); + print('ohFlutter: ${test.name}-error: $e, $st}'); + try { + print(st); + } catch (_) {} + item = Item(test.name)..state = ItemState.failure; + } + + if (!mounted) { + return null; + } + + setState(() { + items[index] = item; + }); + } + + @override + void initState() { + super.initState(); + contentList = []; + _run(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar(title: Text(widget.title), actions: [ + IconButton( + icon: const Icon(Icons.search), + tooltip: 'Results', + onPressed: () { + showAlertDialog(context); + }, + ), + IconButton( + icon: const Icon(Icons.refresh), + tooltip: 'Run again', + onPressed: _run, + ), + ]), + body: ListView(children: [ + ...items.asMap().keys.map((e) => _itemBuilder(context, e)).toList(), + ])); + } + + Widget _itemBuilder(BuildContext context, int index) { + final item = getItem(index); + return ItemWidget( + item: item, + index: index, + getGroupRange: () { + GroupRange data = GroupRange('', 0, 0); + widget.groupTitle.forEach((key, value) { + if (value.oldLength <= index && value.newLength >= index) { + data = GroupRange(key, value.oldLength, value.newLength); + } + }); + return data; + }, + runGroup: (start, end) async { + for (var i = start; i <= end; i++) { + await _runTest(i); + print('\n'); + } + }, + onTap: (Item item) { + _runTest(index); + }); + } + + Item getItem(int index) { + return items[index]; + } + + @override + List get tests => widget.tests; +} + +void expect(var testModel, var object) { + try { + testModel; + contentList.add(Text('运行正常,输出参数为$testModel')); + } catch(e) { + contentList.add(Text('运行失败,错误信息为$e')); + print(e.toString()); + } +} + +void showAlertDialog(BuildContext context) { + showDialog( + context: context, + barrierDismissible: false, + builder: (BuildContext context) { + return AlertDialog( + content: SingleChildScrollView( + child: Column( + children: contentList, + ), + ), + actions: [ + MaterialButton( + child: const Text('确定'), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + ], + ); + }); +} \ No newline at end of file diff --git a/ohos/test_quiver/lib/base/test_route.dart b/ohos/test_quiver/lib/base/test_route.dart new file mode 100644 index 0000000000000000000000000000000000000000..dc37452a13174a378beda98af423a6c1717d1c57 --- /dev/null +++ b/ohos/test_quiver/lib/base/test_route.dart @@ -0,0 +1,13 @@ +import 'package:flutter/cupertino.dart'; + +class MainItem { + /// Main item. + MainItem(this.title, this.route); + + /// Title. + String title; + + /// Page route. + Widget route; +} + diff --git a/ohos/test_quiver/lib/main.dart b/ohos/test_quiver/lib/main.dart new file mode 100644 index 0000000000000000000000000000000000000000..d23170bbf394092dd1670b78025de24fd0a197c7 --- /dev/null +++ b/ohos/test_quiver/lib/main.dart @@ -0,0 +1,93 @@ +import 'package:flutter/material.dart'; +import 'package:test_quiver/src/async/collect_test.dart'; +import 'package:test_quiver/src/async/concat_test.dart'; +import 'package:test_quiver/src/async/countdown_timer_test.dart'; +import 'package:test_quiver/src/async/enumerate_test.dart'; +import 'package:test_quiver/src/async/future_stream_test.dart'; +import 'package:test_quiver/src/async/metronome_test.dart'; +import 'package:test_quiver/src/async/stream_buffer_test.dart'; +import 'package:test_quiver/src/async/stream_router_test.dart'; +import 'package:test_quiver/src/async/string_test.dart'; +import 'package:test_quiver/src/cache/map_cache_test.dart'; +import 'package:test_quiver/src/check_test.dart'; +import 'package:test_quiver/src/collection/bimap_test.dart'; +import 'package:test_quiver/src/collection/delegates/iterable_test.dart'; +import 'package:test_quiver/src/collection/delegates/list_test.dart'; +import 'package:test_quiver/src/collection/delegates/map_test.dart'; +import 'package:test_quiver/src/collection/delegates/queue_test.dart'; +import 'package:test_quiver/src/collection/delegates/set_test.dart'; +import 'package:test_quiver/src/collection/lru_map_test.dart'; +import 'package:test_quiver/src/collection/multimap_test.dart'; +import 'package:test_quiver/src/collection/treeset_test.dart'; +import 'package:test_quiver/src/collection/utils_test.dart'; +import 'package:test_quiver/src/core/hash_test.dart'; +import 'package:test_quiver/src/core/optional_test.dart'; +import 'package:test_quiver/src/core/utils_test.dart'; +import 'package:test_quiver/src/iterables/concat_test.dart'; +import 'package:test_quiver/src/iterables/count_test.dart'; +import 'package:test_quiver/src/iterables/cycle_test.dart'; +import 'package:test_quiver/src/iterables/enumerate_test.dart'; +import 'package:test_quiver/src/iterables/generating_iterable_test.dart'; +import 'package:test_quiver/src/iterables/infinite_iterable_test.dart'; +import 'package:test_quiver/src/iterables/merge_test.dart'; +import 'package:test_quiver/src/iterables/min_max_test.dart'; +import 'package:test_quiver/src/iterables/partition_test.dart'; +import 'package:test_quiver/src/iterables/range_test.dart'; +import 'package:test_quiver/src/iterables/zip_test.dart'; +import 'package:test_quiver/src/pattern/glob_test.dart'; +import 'package:test_quiver/src/pattern/pattern_test.dart'; +import 'package:test_quiver/src/strings_test.dart'; +import 'package:test_quiver/src/testing/async/fake_async_test.dart'; +import 'package:test_quiver/src/testing/equality/equality_test.dart'; +import 'package:test_quiver/src/time/clock_test.dart'; + +import 'base/test_model_app.dart'; +import 'base/test_route.dart'; + +void main() { + final app = [ + MainItem('collect_test', CollectTestPage('collect_test')), + MainItem('concat_test' ,ConcatTestPage('concat_test')), + MainItem('countdown_timer_test' ,CountDownTimerTestPage('countdown_timer_test')), + MainItem('enumerate_test' ,EnumerateTestPage('enumerate_test')), + MainItem('future_stream_test' ,FutureStreamTestPage('future_stream_test')), + MainItem('metronome_test' ,MetronomeTestPage('metronome_test')), + MainItem('stream_buffer_test' ,StreamBufferTestPage('stream_buffer_test')), + MainItem('stream_router_test' ,StreamRouterTestPage('stream_router_test')), + MainItem('string_test' ,StringTestPage('string_test')), + MainItem('map_cache_test' ,MapCacheTestPage('map_cache_test')), + MainItem('iterable_test' ,IterableTestPage('iterable_test')), + MainItem('list_test' ,ListTestPage('list_test')), + MainItem('map_test' ,MapTestPage('map_test')), + MainItem('queue_test' ,QueueTestPage('queue_test')), + MainItem('set_test' ,SetTestPage('set_test')), + MainItem('bimap_test' ,BimapTestPage('bimap_test')), + MainItem('lru_map_test' ,LruMapTestPage('lru_map_test')), + MainItem('multimap_test' ,MultimapTestPage('multimap_test')), + MainItem('treeset_test' ,TreeSetTestPage('treeset_test')), + MainItem('utils_test' ,UtilsTestPage('utils_test')), + MainItem('hash_test' ,HashTestPage('hash_test')), + MainItem('optional_test' ,OptionalTestPage('optional_test')), + MainItem('collection_utils_test' ,CollectionUtilsTestPage('collection_utils_test')), + MainItem('iterables_concat_test' ,IterablesConcatTestPage('iterables_concat_test')), + MainItem('count_test' ,CountTestPage('count_test')), + MainItem('cycle_test' ,CycleTestPage('cycle_test')), + MainItem('iterables_enumerate_test' ,IterablesEnumerateTestPage('iterables_enumerate_test')), + MainItem('generating_iterable_test' ,GeneratingIterableTestPage('generating_iterable_test')), + MainItem('infinite_iterable_test' ,InfiniteIterablePage('infinite_iterable_test')), + MainItem('merge_test' ,MergeTestPage('merge_test')), + MainItem('min_max_test' ,MinMaxTestPage('min_max_test')), + MainItem('partition_test' ,PartitionTestPage('partition_test')), + MainItem('range_test' ,RangeTestPage('range_test')), + MainItem('zip_test' ,ZipTestPage('zip_test')), + MainItem('glob_test' ,GlobTestPage('glob_test')), + MainItem('pattern_test' ,PatternTestPage('pattern_test')), + MainItem('fake_async_test' ,FakeAsyncTestPage('fake_async_test')), + MainItem('equality_test' ,EqualityTestPage('equality_test')), + MainItem('clock_test' ,ClockTestPage('clock_test')), + MainItem('check_test' ,CheckTestPage('check_test')), + MainItem('strings_test' ,StringsTestPage('strings_test')), + ]; + + runApp(TestModelApp(appName: 'quiver', data: app)); +} diff --git a/ohos/test_quiver/lib/src/async/collect_test.dart b/ohos/test_quiver/lib/src/async/collect_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..25785a32416e6b830422480c1d8005dd2868141a --- /dev/null +++ b/ohos/test_quiver/lib/src/async/collect_test.dart @@ -0,0 +1,72 @@ +// Copyright 2013 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +library quiver.async.collect_test; + +import 'dart:async'; +import 'dart:math'; + +import 'package:quiver/src/async/collect.dart'; +import 'package:flutter/material.dart'; +import 'package:test_quiver/base/test_page.dart'; + +class CollectTestPage extends TestPage { + CollectTestPage(String title, {Key? key}) : super(title: title, key: key) { + group('collect', () { + test('不应该产生任何事件', + () => collect([]).toList().then((events) => events.isEmpty)); + + test('应按输入顺序为将来的完成生成事件', () { + var futures = Iterable.generate( + 5, (int i) => i.isEven ? Future.value(i) : Future.error(i)); + var events = []; + var done = Completer>(); + + collect(futures).listen(events.add, + onError: (i) { + events.add('e$i'); + }, + onDone: () => done.complete([])); + return Future.wait(futures).catchError((_) => done.future).then((_) { + expect(events, [0, 'e1', 2, 'e3', 4]); + }); + }); + + test('发送上一个将来的事件', () { + var eventCount = 0; + var maxParallel = 0; + var currentParallel = 0; + var done = Completer(); + var futures = Iterable.generate(3, (_) { + maxParallel = max(++currentParallel, maxParallel); + return Future.value(); + }); + + var collected = collect(futures); + + void decrementParallel(_) { + eventCount++; + currentParallel--; + } + + collected.listen(decrementParallel, + onError: decrementParallel, onDone: done.complete); + return done.future.then((_) { + expect(maxParallel, 1); + expect(eventCount, 3); + }); + }); + }); + } +} diff --git a/ohos/test_quiver/lib/src/async/concat_test.dart b/ohos/test_quiver/lib/src/async/concat_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..3ab1bae31e51c689d7a2563f1dba5208426af36d --- /dev/null +++ b/ohos/test_quiver/lib/src/async/concat_test.dart @@ -0,0 +1,112 @@ +// Copyright 2013 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +library quiver.async.concat_test; + +import 'dart:async'; + +import 'package:quiver/src/async/concat.dart'; +import 'package:flutter/material.dart'; +import 'package:test_quiver/base/test_page.dart'; + +class ConcatTestPage extends TestPage { + ConcatTestPage(String title,{ Key? key}) : super(title: title, key: key) { + group('concat', () { + test('没有事件', + () => concat([]).toList().then((events) => events.isEmpty)); + + test('应回显单个流的事件', () { + var controller = StreamController(); + var concatenated = concat([controller.stream]); + var expectation = concatenated.toList().then((e) { + expect(e, ['a', 'b', 'c']); + }); + ['a', 'b', 'c'].forEach(controller.add); + return Future.wait([controller.close(), expectation]); + }); + + test('应处理空流', () { + var concatenated = concat([Stream.fromIterable([])]); + return concatenated.toList().then((e) { + expect(e, []); + }); + }); + + test('应连接流数据事件', () { + var controller1 = StreamController(); + var controller2 = StreamController(); + var concatenated = concat([controller1.stream, controller2.stream]); + var expectation = concatenated.toList().then((e) { + expect(e, ['a', 'b', 'c', 'd', 'e', 'f']); + }); + ['a', 'b', 'c'].forEach(controller1.add); + ['d', 'e', 'f'].forEach(controller2.add); + return Future.wait( + [controller1.close(), controller2.close(), expectation]); + }); + + test('应连接流错误事件', () { + var controller1 = StreamController(); + var controller2 = StreamController(); + var concatenated = concat([controller1.stream, controller2.stream]); + var errors = []; + concatenated.listen(null, onError: errors.add); + ['e1', 'e2'].forEach(controller1.addError); + ['e3', 'e4'].forEach(controller2.addError); + return Future.wait([controller1.close(), controller2.close()]).then((_) { + expect(errors, ['e1', 'e2', 'e3', 'e4']); + }); + }); + + test('应将暂停、继续和取消转发到当前流', () { + var wasPaused = false, wasResumed = false, wasCanceled = false; + var controller = StreamController( + onPause: () => wasPaused = true, + onResume: () => wasResumed = true, + onCancel: () { + wasCanceled = true; + }); + var concatenated = concat([controller.stream]); + var subscription = concatenated.listen(null); + controller.add('a'); + return Future.value() + .then((_) => subscription.pause()) + .then((_) => subscription.resume()) + + // Give resume a chance to take effect. + .then((_) => controller.add('b')) + .then((_) => Future(subscription.cancel)) + .then((_) { + expect(wasPaused, true); + expect(wasResumed, true); + expect(wasCanceled, true); + }).then((_) => controller.close()); + }); + + test('应该转发错误并停止', () { + var data = [], errors = []; + var badIteration = + ['e', 'this should not get thrown'].map((message) => throw message); + var concatenated = concat(badIteration); + var completer = Completer(); + concatenated.listen(data.add, + onError: errors.add, onDone: completer.complete); + return completer.future.then((_) { + expect(data, []); + expect(errors, ['e']); + }); + }); + }); +} +} \ No newline at end of file diff --git a/ohos/test_quiver/lib/src/async/countdown_timer_test.dart b/ohos/test_quiver/lib/src/async/countdown_timer_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..9946f1197fd0e401ca4f81619157dc3d12a35a4c --- /dev/null +++ b/ohos/test_quiver/lib/src/async/countdown_timer_test.dart @@ -0,0 +1,51 @@ +// Copyright 2013 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +library quiver.async.countdown_timer_test; + +import 'package:quiver/src/async/countdown_timer.dart'; +import 'package:quiver/testing/async.dart'; +import 'package:quiver/testing/time.dart'; +import 'package:quiver/time.dart'; +import 'package:flutter/material.dart'; +import 'package:test_quiver/base/test_page.dart'; + +class CountDownTimerTestPage extends TestPage { + CountDownTimerTestPage(String title,{ Key? key}) : super(title: title, key: key) { + group('CountdownTimer', () { + test('倒计时', () { + FakeAsync().run((FakeAsync async) async { + var clock = async.getClock(DateTime.fromMillisecondsSinceEpoch(0)); + var stopwatch = FakeStopwatch( + () => 1000 * clock.now().millisecondsSinceEpoch, 1000000); + + var timings = CountdownTimer(const Duration(milliseconds: 500), + const Duration(milliseconds: 100), + stopwatch: stopwatch) + .map((c) => c.remaining.inMilliseconds); + + List result = await timings.toList(); + async.elapse(aMillisecond * 500); + expect(result, [400, 300, 200, 100, 0]); + }); + }); + + test('设置初始化值', () { + var timer = CountdownTimer( + const Duration(milliseconds: 321), const Duration(milliseconds: 123)); + expect(timer.increment, const Duration(milliseconds: 123)); + }); + }); +} +} \ No newline at end of file diff --git a/ohos/test_quiver/lib/src/async/enumerate_test.dart b/ohos/test_quiver/lib/src/async/enumerate_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..86525496f77f4ac7ccc8acb6057af01f915bec34 --- /dev/null +++ b/ohos/test_quiver/lib/src/async/enumerate_test.dart @@ -0,0 +1,38 @@ +// Copyright 2013 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +library quiver.async.enumerate_test; + +import 'dart:async'; + +import 'package:quiver/src/async/enumerate.dart'; +import 'package:flutter/material.dart'; +import 'package:test_quiver/base/test_page.dart'; + +class EnumerateTestPage extends TestPage { + EnumerateTestPage(String title,{ Key? key}) : super(title: title, key: key) { + group('Enumerate', () { + test('应为其参数添加索引', () { + var controller = StreamController(); + var enumerated = enumerate(controller.stream); + var expectation = enumerated.toList().then((e) { + expect(e.map((v) => v.index), [0, 1, 2]); + expect(e.map((v) => v.value), ['a', 'b', 'c']); + }); + ['a', 'b', 'c'].forEach(controller.add); + return Future.wait([controller.close(), expectation]); + }); + }); +} +} \ No newline at end of file diff --git a/ohos/test_quiver/lib/src/async/future_stream_test.dart b/ohos/test_quiver/lib/src/async/future_stream_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..46bdf09dc1f4e5d11c6ce5bf849ec180f919d4a3 --- /dev/null +++ b/ohos/test_quiver/lib/src/async/future_stream_test.dart @@ -0,0 +1,84 @@ +// Copyright 2013 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +library quiver.async.future_stream_test; + +import 'dart:async'; + +import 'package:quiver/src/async/future_stream.dart'; +import 'package:flutter/material.dart'; +import 'package:test_quiver/base/test_page.dart'; + +class FutureStreamTestPage extends TestPage { + FutureStreamTestPage(String title,{ Key? key}) : super(title: title, key: key) { + group('FutureStream', () { + test('应该转发事件', () { + var completer = Completer>(); + var controller = StreamController(); + var futureStream = FutureStream(completer.future); + + var done = futureStream.first.then((s) { + expect(s, 'hello'); + }); + + completer.complete(controller.stream); + controller.add('hello'); + + return done; + }); + + test('stream需要被关闭', () { + var completer = Completer>(); + var controller = StreamController(); + var futureStream = FutureStream(completer.future); + + var testCompleter = Completer(); + + futureStream.listen((_) {}, onDone: () { + // pass + testCompleter.complete(); + }); + + completer.complete(controller.stream); + controller.close(); + + return testCompleter.future; + }); + + test('应转发错误', () { + var completer = Completer>(); + var controller = StreamController(); + var futureStream = FutureStream(completer.future); + + var testCompleter = Completer(); + + futureStream.listen((_) {}, onError: (e) { + expect(e, 'error'); + testCompleter.complete(); + }); + + completer.complete(controller.stream); + controller.addError('error'); + + return testCompleter.future; + }); + + test('应该广播', () { + var completer = Completer>(); + var futureStream = FutureStream(completer.future, broadcast: true); + expect(futureStream.isBroadcast, true); + }); + }); +} +} \ No newline at end of file diff --git a/ohos/test_quiver/lib/src/async/metronome_test.dart b/ohos/test_quiver/lib/src/async/metronome_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..6259df7faf4c9fc1845261a1aeefd3d81ac04a08 --- /dev/null +++ b/ohos/test_quiver/lib/src/async/metronome_test.dart @@ -0,0 +1,198 @@ +// Copyright 2013 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the 'License'); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an 'AS IS' BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +library quiver.time.clock_test; + +import 'package:quiver/src/async/metronome.dart'; +import 'package:quiver/testing/async.dart'; +import 'package:quiver/time.dart'; +import 'package:flutter/material.dart'; +import 'package:test_quiver/base/test_page.dart'; + +class MetronomeTestPage extends TestPage { + MetronomeTestPage(String title,{ Key? key}) : super(title: title, key: key) { + group('Metronome', () { + test('按预期时间交付事件', () { + FakeAsync().run((async) { + int callbacks = 0; + + // Initialize metronome with start time. + DateTime lastTime = DateTime.parse('2014-05-05 20:00:30'); + var sub = Metronome.epoch(aMinute, clock: async.getClock(lastTime)) + .listen((d) { + callbacks++; + lastTime = d; + }); + expect(callbacks, 0,); + async.elapse(aSecond * 15); + expect(callbacks, 0); + async.elapse(aSecond * 15); + expect(callbacks, 1); + expect(lastTime, DateTime.parse('2014-05-05 20:01:00') + ); + async.elapse(aMinute * 1); + expect(callbacks, 2); + expect(lastTime, DateTime.parse('2014-05-05 20:02:00') + ); + sub.cancel(); + async.elapse(aMinute * 2); + expect(callbacks, 2); + }); + }); + + test('可以重新收听', () { + FakeAsync().run((async) { + int callbacks = 0; + var clock = Metronome.epoch(aMinute, + clock: async.getClock(DateTime.parse('2014-05-05 20:00:30'))); + var sub = clock.listen((d) { + callbacks++; + }); + async.elapse(aMinute); + expect(callbacks, 1); + sub.cancel(); + async.elapse(aMinute); + expect(callbacks, 1); + sub = clock.listen((d) { + callbacks++; + }); + async.elapse(aMinute); + expect(callbacks, 2); + }); + }); + + test('支持多个侦听器加入和离开', () { + FakeAsync().run((async) { + List callbacks = [0, 0]; + var clock = Metronome.epoch(aMinute, + clock: async.getClock(DateTime.parse('2014-05-05 20:00:30'))); + List subs = [ + clock.listen((d) { + callbacks[0]++; + }), + clock.listen((d) { + callbacks[1]++; + }) + ]; + + async.elapse(aMinute); + expect(callbacks, [1, 1]); + subs[0].cancel(); + async.elapse(aMinute); + expect(callbacks, [1, 2]); + }); + }); + + test('随时关闭', () { + FakeAsync().run((async) { + List times = []; + DateTime start = DateTime.parse('2014-05-05 20:06:00'); + Clock clock = async.getClock(start); + Metronome.periodic(aMinute * 10, + clock: clock, anchor: clock.minutesAgo(59)) + .listen((d) { + times.add(d); + }); + async.elapse(anHour); + expect(times, [ + DateTime.parse('2014-05-05 20:07:00'), + DateTime.parse('2014-05-05 20:17:00'), + DateTime.parse('2014-05-05 20:27:00'), + DateTime.parse('2014-05-05 20:37:00'), + DateTime.parse('2014-05-05 20:47:00'), + DateTime.parse('2014-05-05 20:57:00'), + ]); + }); + }); + + test('可以在一段时间后暂停', () { + FakeAsync().run((async) { + List times = []; + DateTime start = DateTime.parse('2014-05-05 20:06:00'); + Clock clock = async.getClock(start); + Metronome.periodic(aMinute * 10, + clock: clock, anchor: clock.minutesFromNow(61)) + .listen((d) { + times.add(d); + }); + async.elapse(anHour); + expect(times, [ + DateTime.parse('2014-05-05 20:07:00'), + DateTime.parse('2014-05-05 20:17:00'), + DateTime.parse('2014-05-05 20:27:00'), + DateTime.parse('2014-05-05 20:37:00'), + DateTime.parse('2014-05-05 20:47:00'), + DateTime.parse('2014-05-05 20:57:00'), + ]); + }); + }); + + test('周期性计时器', () { + FakeAsync().run((async) { + List times = []; + DateTime start = DateTime.parse('2014-05-05 20:06:00.004'); + Metronome.periodic(aMillisecond * 100, + clock: async.getClock(start), anchor: start) + .listen((d) { + times.add(d); + }); + async.elapse(aMillisecond * 304); + expect(times, [ + DateTime.parse('2014-05-05 20:06:00.104'), + DateTime.parse('2014-05-05 20:06:00.204'), + DateTime.parse('2014-05-05 20:06:00.304'), + ]); + }); + }); + + test('重新同步', () { + FakeAsync().run((async) { + List times = []; + DateTime start = DateTime.parse('2014-05-05 20:06:00.004'); + Metronome.periodic(aMillisecond * 100, + clock: async.getClock(start), anchor: start) + .listen((d) { + times.add(d); + async.elapseBlocking(const Duration(milliseconds: 80)); + }); + async.elapse(aMillisecond * 304); + expect(times, [ + DateTime.parse('2014-05-05 20:06:00.104'), + DateTime.parse('2014-05-05 20:06:00.204'), + DateTime.parse('2014-05-05 20:06:00.304'), + ]); + }); + }); + + test('超时重连', () { + FakeAsync().run((async) { + List times = []; + DateTime start = DateTime.parse('2014-05-05 20:06:00.004'); + Metronome.periodic(aMillisecond * 100, + clock: async.getClock(start), anchor: start) + .listen((d) { + times.add(d); + async.elapseBlocking(const Duration(milliseconds: 105)); + }); + async.elapse(aMillisecond * 504); + expect(times, [ + DateTime.parse('2014-05-05 20:06:00.104'), + DateTime.parse('2014-05-05 20:06:00.304'), + DateTime.parse('2014-05-05 20:06:00.504'), + ]); + }); + }); + }); +} +} \ No newline at end of file diff --git a/ohos/test_quiver/lib/src/async/stream_buffer_test.dart b/ohos/test_quiver/lib/src/async/stream_buffer_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..6a177950eda10ce53778f765a7f3c847af885806 --- /dev/null +++ b/ohos/test_quiver/lib/src/async/stream_buffer_test.dart @@ -0,0 +1,116 @@ +// Copyright 2013 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +library quiver.async.stream_buffer_test; + +import 'package:quiver/src/async/stream_buffer.dart'; +import 'package:flutter/material.dart'; +import 'package:test_quiver/base/test_page.dart'; + +class StreamBufferTestPage extends TestPage { + StreamBufferTestPage(String title,{ Key? key}) : super(title: title, key: key) { + group('StreamBuffer', () { + test('有序返回数据', () { + StreamBuffer buf = StreamBuffer(); + Stream.fromIterable([ + [1], + [2, 3, 4], + [5, 6, 7, 8] + ]).pipe(buf); + return Future.wait([buf.read(2), buf.read(4), buf.read(2)]).then((vals) { + expect(vals[0], [1, 2]); + expect(vals[1], [3, 4, 5, 6]); + expect(vals[2], [7, 8]); + }).then((_) { + buf.close(); + }); + }); + + test('可以收听到流的暂停', () { + StreamBuffer buf = StreamBuffer()..limit = 2; + Stream.fromIterable([ + [1], + [2], + [3], + [4] + ]).pipe(buf); + return buf.read(2).then((val) { + expect(val, [1, 2]); + }).then((_) { + return buf.read(2); + }).then((val) { + expect(val, [3, 4]); + }); + }); + + test('大量获取数据时抛出异常', () { + StreamBuffer buf = StreamBuffer()..limit = 1; + Stream.fromIterable([ + [1], + [2] + ]).pipe(buf); + try { + buf.read(2); + } catch (e) { + e; + return; + } + fail('error not thrown when reading more data than buffer limit'); + }); + + test('允许重连流', () { + StreamBuffer buf = StreamBuffer(); + Stream.fromIterable([ + [1, 2] + ]).pipe(buf).then((_) { + return Stream.fromIterable([ + [3, 4] + ]).pipe(buf); + }); + return Future.wait([buf.read(1), buf.read(2), buf.read(1)]).then((vals) { + expect(vals[0], [1]); + expect(vals[1], [2, 3]); + expect(vals[2], [4]); + }); + }); + + test('溢出错误', () async { + StreamBuffer buf = StreamBuffer(throwOnError: true); + Future> futureBytes = buf.read(4); + Stream.fromIterable([ + [1, 2, 3] + ]).pipe(buf); + try { + List bytes = await futureBytes; + fail('should not have gotten bytes: $bytes'); + } catch (e) { + expect(e is UnderflowError, true); + } + }); + + test('接受多个流', () async { + StreamBuffer buf = StreamBuffer(); + Stream.fromIterable([ + [1] + ]).pipe(buf); + Stream.fromIterable([ + [2, 3, 4, 5] + ]).pipe(buf); + final vals = await buf.read(4); + expect(vals, [2, 3, 4, 5]); + buf.close(); + }); + }); +} +} \ No newline at end of file diff --git a/ohos/test_quiver/lib/src/async/stream_router_test.dart b/ohos/test_quiver/lib/src/async/stream_router_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..a9a624a3116e5929552626e025d0f6514130813e --- /dev/null +++ b/ohos/test_quiver/lib/src/async/stream_router_test.dart @@ -0,0 +1,82 @@ +// Copyright 2013 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +library quiver.async.stream_router_test; + +import 'dart:async'; + +import 'package:quiver/src/async/stream_router.dart'; +import 'package:flutter/material.dart'; +import 'package:test_quiver/base/test_page.dart'; + +class StreamRouterTestPage extends TestPage { + StreamRouterTestPage(String title,{ Key? key}) : super(title: title, key: key) { + group('StreamRouter', () { + test('应将事件路由到正确的流', () { + var controller = StreamController(); + StreamRouter(controller.stream) + ..route((e) => e == 'foo').listen((e) { + expect(e, 'foo'); + }) + ..route((e) => e == 'bar').listen((e) { + fail('wrong stream'); + }) + ..route((e) => e == 'foo').listen((e) { + fail('wrong stream'); + }) + ..defaultStream.listen((e) { + fail('wrong stream'); + }); + controller.add('foo'); + return controller.close(); + }); + + test('应将不匹配谓词的事件发送到默认流', () { + var controller = StreamController(); + StreamRouter(controller.stream) + ..route((e) => e == 'foo').listen((e) { + fail('wrong stream'); + }) + ..route((e) => e == 'bar').listen((e) { + fail('wrong stream'); + }) + ..defaultStream.listen((e) { + expect(e, 'baz'); + }); + controller.add('baz'); + return controller.close(); + }); + + test('应关闭子流', () { + var controller = StreamController(sync: true); + var router = StreamRouter(controller.stream); + // toList() will only complete when the child streams are closed + var future = Future.wait([ + router.route((e) => e % 2 == 0).toList(), + router.route((e) => e % 2 == 1).toList(), + ]).then((l) { + expect(l, [ + [4], + [5] + ]); + }); + controller + ..add(4) + ..add(5); + router.close(); + return future; + }); + }); +} +} \ No newline at end of file diff --git a/ohos/test_quiver/lib/src/async/string_test.dart b/ohos/test_quiver/lib/src/async/string_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..b9945307544fadbdd143a6cb011914a1623ea18e --- /dev/null +++ b/ohos/test_quiver/lib/src/async/string_test.dart @@ -0,0 +1,45 @@ +// Copyright 2013 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import 'dart:convert' show latin1, utf8; + +import 'package:quiver/src/async/string.dart'; +import 'package:flutter/material.dart'; +import 'package:test_quiver/base/test_page.dart'; + +class StringTestPage extends TestPage { + StringTestPage(String title,{ Key? key}) : super(title: title, key: key) { + group('byteStreamToString', () { + test('默认情况下应解码UTF8文本', () { + var string = '箙、靫'; + var encoded = utf8.encoder.convert(string); + var data = [encoded.sublist(0, 3), encoded.sublist(3)]; + var stream = Stream>.fromIterable(data); + byteStreamToString(stream).then((decoded) { + expect(decoded, string); + }); + }); + + test('应使用指定的编码解码文本', () { + var string = 'blåbærgrød'; + var encoded = latin1.encoder.convert(string); + var data = [encoded.sublist(0, 4), encoded.sublist(4)]; + var stream = Stream>.fromIterable(data); + byteStreamToString(stream, encoding: latin1).then((decoded) { + expect(decoded, string); + }); + }); + }); +} +} \ No newline at end of file diff --git a/ohos/test_quiver/lib/src/cache/map_cache_test.dart b/ohos/test_quiver/lib/src/cache/map_cache_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..fedd1d310ad18260ab9722079c9a0c1d2df65488 --- /dev/null +++ b/ohos/test_quiver/lib/src/cache/map_cache_test.dart @@ -0,0 +1,113 @@ +// Copyright 2013 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the 'License'); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an 'AS IS' BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +library quiver.cache.map_cache_test; + +import 'dart:async'; + +import 'package:quiver/src/cache/map_cache.dart'; +import 'package:flutter/material.dart'; +import 'package:test_quiver/base/test_page.dart'; + +class MapCacheTestPage extends TestPage { + MapCacheTestPage(String title, {Key? key}) : super(title: title, key: key) { + group('MapCache', () { + cache = MapCache(); + + test('对于不存在的键,应返回null', () { + return cache.get('foo1').then((value) { + expect(value, null); + }); + }); + + test('应返回以前设置的键/值对', () { + return cache + .set('foo', 'bar') + .then((_) => cache.get('foo')) + .then((value) { + expect(value, 'bar'); + }); + }); + + test('应该使密钥无效', () { + return cache + .set('foo', 'bar') + .then((_) => cache.invalidate('foo')) + .then((_) => cache.get('foo')) + .then((value) { + expect(value, null); + }); + }); + + test('如果没有值且没有ifAbsent处理程序,则应返回null', () { + return cache.get('foo').then((value) { + expect(value, null); + }); + }); + + test('应该加载给定同步加载程序的值', () { + return cache.get('foo', ifAbsent: (k) => k + k).then((value) { + expect(value, 'foofoo'); + }); + }); + + test('应该加载给定异步加载程序的值', () { + return cache + .get('foo', ifAbsent: (k) => Future.value(k + k)) + .then((value) { + expect(value, 'foofoo'); + }); + }); + + test('不应对同一密钥进行多次请求', () async { + final completer = Completer(); + int count = 0; + + Future loader(String key) { + count += 1; + return completer.future; + } + + final futures = Future.wait([ + cache.get('test', ifAbsent: loader), + cache.get('test', ifAbsent: loader), + ]); + + completer.complete('bar'); + expect(count, 1); + expect(await futures, ['bar', 'bar']); + }); + + test('缓存失败的请求', () async { + int count = 0; + + Future failLoader(String key) async { + count += 1; + throw StateError('Request failed'); + } + + await cache.get('test', ifAbsent: failLoader); + await cache.get('test', ifAbsent: failLoader); + + expect(count, 2); + expect(await cache.get('test'), null); + + // Make sure it doesn't block a later successful load. + await cache.get('test', ifAbsent: (key) => 'bar'); + }); + }); + } + + late MapCache cache; +} diff --git a/ohos/test_quiver/lib/src/check_test.dart b/ohos/test_quiver/lib/src/check_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..5f202b68da5f202c35659bbe9b1481fe4b9bd969 --- /dev/null +++ b/ohos/test_quiver/lib/src/check_test.dart @@ -0,0 +1,141 @@ +library quiver.check_test; + +import 'package:quiver/check.dart'; +import 'package:flutter/material.dart'; +import 'package:test_quiver/base/test_page.dart'; + +class CheckTestPage extends TestPage { + CheckTestPage(String title,{ Key? key}) : super(title: title, key: key) { + group('checkArgument', () { + group('success', () { + test('简单的检查', () => checkArgument(true)); + test('空消息', () => checkArgument(true, message: null)); + test('字符串消息', () => checkArgument(true, message: 'foo')); + test('功能消息', () => checkArgument(true, message: () => fail("Shouldn't be called"))); + }); + + group('failure', () { + void checkArgumentShouldFail(Function f, [String? expectedMessage]) { + try { + f(); + fail('Should have thrown an ArgumentError'); + } on ArgumentError catch (e) { + expect(e.message, expectedMessage); + } + } + + test('无消息', () => checkArgumentShouldFail(() => checkArgument(false))); + + test('故障和简单字符串消息', () => checkArgumentShouldFail(() => checkArgument(false, message: 'message'), 'message')); + + test('失败和空消息', () => checkArgumentShouldFail(() => checkArgument(false, message: null))); + test('失败并将对象作为消息', () => checkArgumentShouldFail(() => checkArgument(false, message: 5), '5')); + test('失败,消息关闭返回对象', () => checkArgumentShouldFail(() => checkArgument(false, message: () => 5), '5')); + + test('故障和消息功能', () { + int five = 5; + checkArgumentShouldFail(() => checkArgument(false, message: () => 'I ate $five pies'), 'I ate 5 pies'); + }); + }); + }); + + group('checkState', () { + group('success', () { + test('简单的', () => checkState(true)); + test('空消息', () => checkState(true, message: null)); + test('字符串消息', () => checkState(true, message: 'foo')); + test('功能消息', () => checkState(true, message: () => fail("Shouldn't be called"))); + }); + + group('failure', () { + void checkStateShouldFail(Function f, [String? expectedMessage]) { + expectedMessage ??= 'failed precondition'; + try { + f(); + fail('Should have thrown a StateError'); + } on StateError catch (e) { + expect(e.message, expectedMessage); + } + } + + test('无消息', () => checkStateShouldFail(() => checkState(false))); + + test('故障和简单字符串消息', () => checkStateShouldFail(() => checkState(false, message: 'message'), 'message')); + + test('失败和空消息', () => checkStateShouldFail(() => checkState(false, message: null))); + test('消息闭包返回null', () => checkStateShouldFail(() => checkState(false, message: () => null))); + + test('故障和消息功能', () { + int five = 5; + checkStateShouldFail(() => checkState(false, message: () => 'I ate $five pies'), 'I ate 5 pies'); + }); + }); + }); + + group('checkNotNull', () { + group('success', () { + test('简单的', () => expect(checkNotNull(''), '')); + test('字符串消息', () => expect(checkNotNull(5, message: 'foo'), 5)); + test('函数消息', () => expect(checkNotNull(true, message: () => fail("Shouldn't be called")), true)); + }); + + group('failure', () { + void checkNotNullShouldFail(Function f, [String? expectedMessage]) { + expectedMessage ??= 'null pointer'; + try { + f(); + fail('Should have thrown an ArgumentError'); + } on ArgumentError catch (e) { + expect(e.message, expectedMessage); + } + } + + test('无消息', () => checkNotNullShouldFail(() => checkNotNull(null))); + + test('简单故障消息', () => checkNotNullShouldFail(() => checkNotNull(null, message: 'message'), 'message')); + + test('空消息', () => checkNotNullShouldFail(() => checkNotNull(null, message: null))); + + test('消息闭包返回null', () => checkNotNullShouldFail(() => checkNotNull(null, message: () => null))); + + test('故障和消息功能', () { + int five = 5; + checkNotNullShouldFail(() => checkNotNull(null, message: () => 'I ate $five pies'), 'I ate 5 pies'); + }); + }); + }); + + group('checkListIndex', () { + test('success', () { + checkListIndex(0, 1); + checkListIndex(0, 1, message: () => fail("shouldn't be called")); + checkListIndex(0, 2); + checkListIndex(0, 2, message: () => fail("shouldn't be called")); + checkListIndex(1, 2); + checkListIndex(1, 2, message: () => fail("shouldn't be called")); + }); + + group('failure', () { + void checkListIndexShouldFail(int index, int size, [message, String? expectedMessage]) { + try { + checkListIndex(index, size, message: message); + fail('Should have thrown a RangeError'); + } on RangeError catch (e) { + expect(e.message, expectedMessage ?? 'index $index not valid for list of size $size'); + } + } + + test('底片尺寸', () => checkListIndexShouldFail(0, -1)); + test('下标', () => checkListIndexShouldFail(-1, 1)); + test('下标太大', () => checkListIndexShouldFail(1, 1)); + test('大小为零', () => checkListIndexShouldFail(0, 0)); + + test('带有故障消息', () => checkListIndexShouldFail(1, 1, 'foo', 'foo')); + test('具有故障消息功能', () { + int five = 5; + checkListIndexShouldFail(1, 1, () => 'I ate $five pies', 'I ate 5 pies'); + }); + }); + }); + } +} \ No newline at end of file diff --git a/ohos/test_quiver/lib/src/collection/bimap_test.dart b/ohos/test_quiver/lib/src/collection/bimap_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..f03229224bf55a8aff6b5861f4d9ca19cec9a644 --- /dev/null +++ b/ohos/test_quiver/lib/src/collection/bimap_test.dart @@ -0,0 +1,425 @@ +// Copyright 2013 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +library quiver.collection.bimap_test; + +import 'package:quiver/src/collection/bimap.dart'; +import 'package:flutter/material.dart'; +import 'package:test_quiver/base/test_page.dart'; +import 'package:matcher/src/expect/throws_matcher.dart'; + +class BimapTestPage extends TestPage { + BimapTestPage(String title,{ Key? key}) : super(title: title, key: key) { + group('BiMap', () { + test('should construct a HashBiMap', () { + expect(BiMap() is HashBiMap, true); + }); + }); + + group('HashBiMap', () { + late BiMap map; + const String k1 = 'k1', k2 = 'k2', k3 = 'k3'; + const int v1 = 1, v2 = 2, v3 = 3; + + map = HashBiMap(); + + test('应初始化为空', () { + expect(map.isEmpty, true); + expect(map.isNotEmpty, false); + expect(map.inverse.isEmpty, true); + expect(map.inverse.isNotEmpty, false); + }); + + test('应支持空键', () { + final map = BiMap(); + map[null] = 5; + expect(map.isEmpty, false); + expect(map.containsKey(null), true); + expect(map.containsValue(5), true); + expect(map.keys, map.keys.contains(null)); + + expect(map.inverse.containsKey(5), true); + expect(map.inverse.containsValue(null), true); + expect(map.inverse.keys, map.inverse.keys.contains(5)); + }); + + test('应支持null值', () { + final map = BiMap(); + map[k1] = null; + expect(map.isEmpty, false); + expect(map.containsKey(k1), true); + expect(map.containsValue(null), true); + expect(map[k1], null); + }); + + test('添加映射后不应为空', () { + map[k1] = v1; + expect(map.isEmpty, false); + expect(map.isNotEmpty, true); + expect(map.inverse.isEmpty, false); + expect(map.inverse.isNotEmpty, true); + }); + + test('反向添加映射后不应为空', () { + map.inverse[v1] = k1; + expect(map.isEmpty, false); + expect(map.isNotEmpty, true); + expect(map.inverse.isEmpty, false); + expect(map.inverse.isNotEmpty, true); + }); + + test('应包含添加的映射', () { + map[k1] = v1; + map[k2] = v2; + expect(map[k1], v1); + expect(map[k2], v2); + expect(map.inverse[v1], k1); + expect(map.inverse[v2], k2); + }); + + test('应允许覆盖现有keys', () { + map = HashBiMap(); + map[k1] = v1; + map[k1] = v2; + expect(map[k1], v2); + expect(map.inverse.containsKey(v1), false); + expect(map.inverse[v2], k1); + }); + + test('应允许通过其反向键覆盖现有键', () { + map = HashBiMap(); + map.inverse[v1] = k1; + map.inverse[v1] = k2; + expect(map[k2], v1); + expect(map.inverse.containsKey(v2), false); + expect(map.inverse[v1], k2); + }); + + test('应允许覆盖现有键值对', () { + map = HashBiMap(); + map[k1] = v1; + map[k1] = v1; + expect(map[k1], v1); + expect(map.inverse.containsKey(v1), true); + expect(map.inverse[v1], k1); + }); + + test('应允许通过其反向覆盖现有键值对', + () { + map.inverse[v1] = k1; + map.inverse[v1] = k1; + expect(map[k1], v1); + expect(map.inverse.containsKey(v1), true); + expect(map.inverse[v1], k1); + }); + + test('应该使用映射值覆盖未映射的键', () { + map = HashBiMap(); + map[k1] = v1; + expect(map.containsKey(k2), false); + expect(map.inverse.containsValue(k2), false); + }); + + test('应该使用映射的null值覆盖未映射的键', + () { + final map1 = BiMap(); + map1[k1] = null; + expect(map1.containsKey(k2), false); + expect(map1.inverse.containsValue(k2), false); + }); + + test( + '应该通过反向使用映射值覆盖未映射的键', + () { + map = HashBiMap(); + map[k1] = v1; + expect(map.containsValue(v2), false); + }); + + test( + '应该通过反向使用映射的null值覆盖未映射的键', + () { + final map1 = BiMap(); + map1[null] = v1; + }); + + test('应允许强制添加具有映射值的未映射关键帧', () { + map[k1] = v1; + map.replace(k2, v1); + expect(map[k2], v1); + expect(map.containsKey(k1), false); + expect(map.inverse[v1], k2); + expect(map.inverse.containsValue(k1), false); + }); + + test( + '应允许通过反向强制添加具有映射值的未映射关键帧', + () { + map.inverse[v1] = k1; + map.inverse.replace(v2, k1); + expect(map[k1], v2); + expect(map.containsValue(v1), false); + expect(map.inverse[v2], k1); + expect(map.inverse.containsKey(v1), false); + }); + + test('不应包含已删除的 mappings', () { + map[k1] = v1; + map.remove(k1); + expect(map.containsKey(k1), false); + expect(map.inverse.containsKey(v1), false); + + map[k1] = v1; + map[k2] = v2; + map.removeWhere((k, v) => v.isOdd); + expect(map.containsKey(k1), false); + expect(map.containsKey(k2), true); + expect(map.inverse.containsKey(v1), false); + expect(map.inverse.containsKey(v2), true); + }); + + test('不应包含从其反向中删除的映射', () { + map[k1] = v1; + map.inverse.remove(v1); + expect(map.containsKey(k1), false); + expect(map.inverse.containsKey(v1), false); + + map[k1] = v1; + map[k2] = v2; + map.inverse.removeWhere((v, k) => v.isOdd); + expect(map.containsKey(k1), false); + expect(map.containsKey(k2), true); + expect(map.inverse.containsKey(v1), false); + expect(map.inverse.containsKey(v2), true); + }); + + test('应该更新双方', () { + map[k1] = v1; + map.update(k1, (v) => v + 1); + expect(map[k1], v1 + 1); + expect(map.inverse[v1 + 1], k1); + + map[k1] = v1; + map.inverse.update(v1, (k) => '_$k'); + expect(map['_$k1'], v1); + expect(map.inverse[v1],'_$k1'); + }); + + test('应更新缺少的键值', () { + map = HashBiMap(); + map[k1] = v1; + map.update(k2, (v) => v + 1, ifAbsent: () => 0); + map[k1] = v1; + map.inverse.update(v2, (k) => '_$k', ifAbsent: () => '_X'); + expect(map['_X'], v2); + expect(map.inverse[v2], '_X'); + }); + + test('应更新所有值', () { + map = HashBiMap(); + map[k1] = v1; + map[k2] = v2; + map.updateAll((k, v) => v + k.length); + + expect(map.inverse[3], k1); + expect(map.inverse[4], k2); + }); + + test('清除后应为空', () { + map[k1] = v1; + map[k2] = v2; + map.clear(); + }); + + test('inverte.clear之后应为空', () { + map[k1] = v1; + map[k2] = v2; + map.inverse.clear(); + expect(map.isEmpty, true); + }); + + test('应包含映射的键', () { + map[k1] = v1; + map[k2] = v2; + expect(map.containsKey(k1), true); + expect(map.containsKey(k2), true); + expect(map.inverse.containsKey(v1), true); + expect(map.inverse.keys, [v1, v2]); + }); + + test('应包含通过其反向映射的关键帧', () { + map.inverse[v1] = k1; + map.inverse[v2] = k2; + expect(map.containsKey(k1), true); + expect(map.containsKey(k2), true); + expect(map.keys, [k1, k2]); + expect(map.inverse.containsKey(v1), true); + expect(map.inverse.containsKey(v2), true); + expect(map.inverse.keys, [v1, v2]); + }); + + test('应包含 mapped values', () { + map[k1] = v1; + map[k2] = v2; + expect(map.containsValue(v1), true); + expect(map.containsValue(v2), true); + expect(map.values, [v1, v2]); + expect(map.inverse.containsValue(k1), true); + expect(map.inverse.containsValue(k2), true); + expect(map.inverse.values, [k1, k2]); + }); + + test('应包含通过其反向映射的值', () { + map.inverse[v1] = k1; + map.inverse[v2] = k2; + expect(map.containsValue(v1), true); + expect(map.containsValue(v2), true); + expect(map.values, [v1, v2]); + expect(map.inverse.containsValue(k1), true); + expect(map.inverse.containsValue(k2), true); + expect(map.inverse.values, [k1, k2]); + }); + + test('应添加 entries', () { + map.addEntries(const [MapEntry(k1, v1)]); + expect(map[k1], v1); + expect(map.inverse[v1], k1); + + map.inverse.addEntries(const [MapEntry(v2, k2)]); + expect(map[k2], v2); + expect(map.inverse[v2], k2); + }); + + test('获取 entries', () { + map[k1] = v1; + map.inverse[v2] = k2; + + var mapEntries = map.entries; + expect(mapEntries, 2); + // MapEntry objects are not equal to each other; cannot use `contains`. :( + expect(mapEntries.singleWhere((e) => e.key == k1).value, v1); + expect(mapEntries.singleWhere((e) => e.key == k2).value, v2); + + var inverseEntries = map.inverse.entries; + expect(inverseEntries, 2); + expect(inverseEntries.singleWhere((e) => e.key == v1).value, k1); + expect(inverseEntries.singleWhere((e) => e.key == v2).value, k2); + }); + + test(' map 映射', () { + map[k1] = v1; + map[k2] = v2; + + var mapped = map.map((k, v) => MapEntry(k.toUpperCase(), '$k / $v')); + expect(mapped, 'K1'); + expect(mapped, 'K2'); + expect(mapped['K1'], 'k1 / 1'); + expect(mapped['K2'], 'k2 / 2'); + + var mapped2 = map.inverse.map((v, k) => MapEntry('$v$v', k.length)); + expect(mapped2, '11'); + expect(mapped2, '22'); + expect(mapped2['11'], 2); + expect(mapped2['22'], 2); + }); + + test('如果不存在,则应通过putIfAbsent添加映射', () { + map.putIfAbsent(k1, () => v1); + expect(map[k1], v1); + expect(map.inverse[v1], k1); + }); + + test('应通过inverte.putIfAbsent添加映射(如果不存在)', () { + map.inverse.putIfAbsent(v1, () => k1); + expect(map[k1], v1); + expect(map.inverse[v1], k1); + }); + + test('不应通过putIfAbsent添加映射(如果存在)', () { + map[k1] = v1; + map.putIfAbsent(k1, () => v2); + expect(map[k1], v1); + expect(map.inverse[v1], k1); + expect(map.inverse.containsKey(v2), false); + }); + + test('不应通过inverte.putIfAbsent添加映射(如果存在)', () { + map[k1] = v1; + map.inverse.putIfAbsent(v1, () => k2); + expect(map[k1], v1); + expect(map.containsKey(k2), false); + expect(map.inverse[v1], k1); + }); + + test('应包含从另一个映射添加的映射', () { + map.addAll({k1: v1, k2: v2, k3: v3}); + expect(map[k1], v1); + expect(map[k2], v2); + expect(map[k3], v3); + expect(map.inverse[v1], k1); + expect(map.inverse[v2], k2); + expect(map.inverse[v3], k3); + }); + + test('应包含从另一个映射通过其反向添加的映射', () { + map.inverse.addAll({v1: k1, v2: k2, v3: k3}); + expect(map[k1], v1); + expect(map[k2], v2); + expect(map[k3], v3); + expect(map.inverse[v1], k1); + expect(map.inverse[v2], k2); + expect(map.inverse[v3], k3); + }); + + test('应返回键值对的数量作为其长度', () { + map = HashBiMap(); + expect(map.length, 0); + map[k1] = v1; + expect(map.length, 1); + map[k1] = v2; + expect(map.length, 1); + map.replace(k2, v2); + expect(map.length, 1); + map[k1] = v1; + expect(map.length, 2); + }); + + test('应通过forEach迭代所有对', () { + map[k1] = v1; + map[k2] = v2; + var keys = []; + var values = []; + map.forEach((k, v) { + keys.add(k); + values.add(v); + }); + expect(keys, [k1, k2]); + expect(values, [v1, v2]); + }); + + test('应通过其逆函数的forEach迭代所有对', () { + map[k1] = v1; + map[k2] = v2; + var keys = []; + var values = []; + map.inverse.forEach((k, v) { + keys.add(k); + values.add(v); + }); + expect(keys, [v1, v2]); + expect(values, [k1, k2]); + }); + }); +} +} \ No newline at end of file diff --git a/ohos/test_quiver/lib/src/collection/delegates/iterable_test.dart b/ohos/test_quiver/lib/src/collection/delegates/iterable_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..631cbf6dbc0dadc00c2ee01b60907b78f4219c48 --- /dev/null +++ b/ohos/test_quiver/lib/src/collection/delegates/iterable_test.dart @@ -0,0 +1,180 @@ +// Copyright 2013 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +library quiver.collection.delegates.iterable_test; + +import 'package:quiver/src/collection/delegates/iterable.dart'; +import 'package:flutter/material.dart'; +import 'package:test_quiver/base/test_page.dart'; + +class MyIterable extends DelegatingIterable { + MyIterable(this._delegate); + + final Iterable _delegate; + + @override + Iterable get delegate => _delegate; +} + +class IterableTestPage extends TestPage { + IterableTestPage(String title, {Key? key}) : super(title: title, key: key) { + group('DelegatingIterable', () { + late DelegatingIterable delegatingIterable; + + delegatingIterable = MyIterable(['a', 'b', 'cc']); + + test('any', () { + expect(delegatingIterable.any((e) => e == 'b'), true); + expect(delegatingIterable.any((e) => e == 'd'), false); + }); + + test('contains', () { + expect(delegatingIterable.contains('b'), true); + expect(delegatingIterable.contains('d'), false); + }); + + test('elementAt', () { + expect(delegatingIterable.elementAt(1), 'b'); + }); + + test('every', () { + expect(delegatingIterable.every((e) => true), true); + expect(delegatingIterable.every((e) => e == 'b'), false); + }); + + test('expand', () { + expect(delegatingIterable.expand((e) => e.codeUnits), [97, 98, 99, 99]); + }); + + test('first', () { + expect(delegatingIterable.first, 'a'); + }); + + test('firstWhere', () { + expect(delegatingIterable.firstWhere((e) => e == 'b'), 'b'); + expect( + delegatingIterable.firstWhere((e) => e == 'd', orElse: () => 'e'), + 'e'); + }); + + // test('fold', () { + // expect(delegatingIterable.fold('z', (String p, String e) => p + e), + // equals('zabcc')); + // }); + + test('forEach', () { + final s = StringBuffer(); + delegatingIterable.forEach(s.write); + expect(s.toString(), 'abcc'); + }); + + test('isEmpty', () { + expect(delegatingIterable.isEmpty, false); + expect(MyIterable([]).isEmpty, true); + }); + + test('isNotEmpty', () { + expect(delegatingIterable.isNotEmpty, true); + expect(MyIterable([]).isNotEmpty, false); + }); + + test('followedBy', () { + expect(delegatingIterable.followedBy(['d', 'e']), + ['a', 'b', 'cc', 'd', 'e']); + expect(delegatingIterable.followedBy(delegatingIterable), + ['a', 'b', 'cc', 'a', 'b', 'cc']); + }); + + test('forEach', () { + final it = delegatingIterable.iterator; + expect(it.moveNext(), true); + expect(it.current, 'a'); + expect(it.moveNext(), true); + expect(it.current, 'b'); + expect(it.moveNext(), true); + expect(it.current, 'cc'); + expect(it.moveNext(), false); + }); + + test('join', () { + expect(delegatingIterable.join(), 'abcc'); + expect(delegatingIterable.join(','), 'a,b,cc'); + }); + + test('last', () { + expect(delegatingIterable.last, 'cc'); + }); + + test('lastWhere', () { + expect(delegatingIterable.lastWhere((e) => e == 'b'), 'b'); + expect(delegatingIterable.lastWhere((e) => e == 'd', orElse: () => 'e'), + 'e'); + }); + + test('length', () { + expect(delegatingIterable.length, 3); + }); + + test('map', () { + expect( + delegatingIterable.map((e) => e.toUpperCase()), ['A', 'B', 'CC']); + }); + + test('reduce', () { + expect(delegatingIterable.reduce((value, element) => value + element), + 'abcc'); + }); + + test('single, 此处应为x', () { + delegatingIterable.single; + expect(MyIterable(['a']).single, 'a'); + }); + + test('singleWhere', () { + expect(delegatingIterable.singleWhere((e) => e == 'b'), 'b'); + expect( + delegatingIterable.singleWhere((e) => e == 'd', orElse: () => 'X'), + 'X'); + }); + + test('skip', () { + expect(delegatingIterable.skip(1), ['b', 'cc']); + }); + + test('skipWhile', () { + expect(delegatingIterable.skipWhile((e) => e == 'a'), ['b', 'cc']); + }); + + test('take', () { + expect(delegatingIterable.take(1), ['a']); + }); + + test('skipWhile', () { + expect(delegatingIterable.takeWhile((e) => e == 'a'), ['a']); + }); + + test('toList', () { + expect(delegatingIterable.toList(), ['a', 'b', 'cc']); + }); + + test('toSet', () { + expect(delegatingIterable.toSet(), {'a', 'b', 'cc'}); + }); + + test('where', () { + expect(delegatingIterable.where((e) => e.length == 1), ['a', 'b']); + }); + }); + } +} diff --git a/ohos/test_quiver/lib/src/collection/delegates/list_test.dart b/ohos/test_quiver/lib/src/collection/delegates/list_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..08cda59f48bdbb8e1138e3e9ef159dd5236c0356 --- /dev/null +++ b/ohos/test_quiver/lib/src/collection/delegates/list_test.dart @@ -0,0 +1,180 @@ +// Copyright 2013 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +library quiver.collection.delegates.list_test; + +import 'package:quiver/src/collection/delegates/list.dart'; +import 'package:flutter/material.dart'; +import 'package:test_quiver/base/test_page.dart'; + +class MyList extends DelegatingList { + MyList(this._delegate); + + final List _delegate; + + @override + List get delegate => _delegate; +} + +class ListTestPage extends TestPage { + ListTestPage(String title, {Key? key}) : super(title: title, key: key) { + group('DelegatingList', () { + DelegatingList delegatingList = MyList(['a', 'b', 'cc']); + test('依据下标获取值', () { + expect(delegatingList[1], 'b'); + expect(delegatingList[2], 'cc'); + }); + + test('[]=', () { + delegatingList[0] = 'd'; + expect(delegatingList, ['d', 'b', 'cc']); + }); + + test('+', () { + var sum = delegatingList + ['d', 'e']; + expect(sum, ['a', 'b', 'cc', 'd', 'e']); + }); + + test('add', () { + delegatingList.add('d'); + expect(delegatingList, ['a', 'b', 'cc', 'd']); + }); + + test('addAll', () { + delegatingList.addAll(['d', 'e']); + expect(delegatingList, ['a', 'b', 'cc', 'd', 'e']); + }); + + test('asMap', () { + expect(delegatingList.asMap(), {0: 'a', 1: 'b', 2: 'cc'}); + }); + + test('clear', () { + delegatingList.clear(); + expect(delegatingList, []); + }); + + test('fillRange', () { + DelegatingList nullableDelegatingList = + MyList(['a', 'b', 'cc']); + nullableDelegatingList.fillRange(0, 2); + expect(nullableDelegatingList, [null, null, 'cc']); + + expect(delegatingList, ['d', 'd', 'cc']); + }); + + test('getRange', () { + delegatingList = MyList(['a', 'b', 'cc']); + expect(delegatingList.getRange(1, 2), ['b']); + }); + + test('indexOf', () { + expect(delegatingList.indexOf('b'), 1); + expect(delegatingList.indexOf('a', 1), -1); + expect(delegatingList.indexOf('cc', 1), 2); + }); + + test('indexWhere', () { + delegatingList.add('bb'); + expect(delegatingList.indexWhere((e) => e.length > 1), 2); + }); + + test('insert', () { + delegatingList.insert(1, 'd'); + expect(delegatingList, ['a', 'd', 'b', 'cc']); + }); + + test('insertAll', () { + delegatingList.insertAll(1, ['d', 'e']); + expect(delegatingList, ['a', 'd', 'e', 'b', 'cc']); + }); + + test('lastIndexOf', () { + expect(delegatingList.lastIndexOf('b'), 1); + expect(delegatingList.lastIndexOf('a', 1), 0); + expect(delegatingList.lastIndexOf('cc', 1), -1); + }); + + test('lastIndexWhere', () { + delegatingList.add('bb'); + expect(delegatingList.lastIndexWhere((e) => e.length > 1), 3); + }); + + test('set length', () { + delegatingList.length = 2; + expect(delegatingList, ['a', 'b']); + }); + + test('remove', () { + delegatingList.remove('b'); + expect(delegatingList, ['a', 'cc']); + }); + + test('removeAt', () { + delegatingList.removeAt(1); + expect(delegatingList, ['a', 'cc']); + }); + + test('removeLast', () { + delegatingList.removeLast(); + expect(delegatingList, ['a', 'b']); + }); + + test('removeRange', () { + delegatingList = MyList(['a', 'b', 'cc']); + delegatingList.removeRange(1, 2); + }); + + test('removeWhere', () { + delegatingList.removeWhere((e) => e.length == 1); + expect(delegatingList, ['cc']); + }); + + test('replaceRange', () { + delegatingList = MyList(['a', 'b', 'cc']); + delegatingList.replaceRange(1, 2, ['d', 'e']); + expect(delegatingList, ['a', 'd', 'e', 'cc']); + }); + + test('retainWhere', () { + delegatingList.retainWhere((e) => e.length == 1); + expect(delegatingList, ['a', 'b']); + }); + + test('reversed', () { + expect(delegatingList.reversed, ['cc', 'b', 'a']); + }); + + test('setAll', () { + delegatingList.setAll(1, ['d', 'e']); + expect(delegatingList, ['a', 'd', 'e']); + }); + + test('setRange', () { + delegatingList.setRange(1, 3, ['d', 'e']); + expect(delegatingList, ['a', 'd', 'e']); + }); + + test('sort', () { + delegatingList.sort((a, b) => b.codeUnitAt(0) - a.codeUnitAt(0)); + expect(delegatingList, ['cc', 'b', 'a']); + }); + + test('sublist', () { + expect(delegatingList.sublist(1), ['b', 'cc']); + expect(delegatingList.sublist(1, 2), ['b']); + }); + }); + } +} diff --git a/ohos/test_quiver/lib/src/collection/delegates/map_test.dart b/ohos/test_quiver/lib/src/collection/delegates/map_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..bd5682757e65e32090f26cbf4813c7a58ada205e --- /dev/null +++ b/ohos/test_quiver/lib/src/collection/delegates/map_test.dart @@ -0,0 +1,108 @@ +// Copyright 2013 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +library quiver.collection.delegates.map_test; + +import 'package:quiver/src/collection/delegates/map.dart'; +import 'package:flutter/material.dart'; +import 'package:test_quiver/base/test_page.dart'; + +class MyMap extends DelegatingMap { + MyMap(this._delegate); + + final Map _delegate; + + @override + Map get delegate => _delegate; +} + +class MapTestPage extends TestPage { + MapTestPage(String title, {Key? key}) : super(title: title, key: key) { + group('DelegatingMap', () { + DelegatingMap delegatingMap = MyMap({'a': 1, 'bb': 2}); + + test('依据key获取值', () { + DelegatingMap delegatingMap = MyMap({'a': 1, 'bb': 2}); + expect(delegatingMap['a'], 1); + expect(delegatingMap['bb'], 2); + expect(delegatingMap['c'], null); + }); + + test('[]=', () { + delegatingMap['a'] = 3; + delegatingMap['c'] = 4; + expect(delegatingMap, {'a': 3, 'bb': 2, 'c': 4}); + }); + + test('addAll', () { + delegatingMap.addAll({'a': 3, 'c': 4}); + expect(delegatingMap, {'a': 3, 'bb': 2, 'c': 4}); + }); + + test('clear', () { + delegatingMap.clear(); + expect(delegatingMap, {}); + }); + + test('containsKey', () { + expect(delegatingMap.containsKey('a'), true); + expect(delegatingMap.containsKey('b'), false); + }); + + test('containsValue', () { + expect(delegatingMap.containsValue(1), true); + expect(delegatingMap.containsValue('b'), false); + }); + + test('forEach', () { + final s = StringBuffer(); + delegatingMap.forEach((k, v) => s.write('$k$v')); + expect(s.toString(), 'a1bb2'); + }); + + test('isEmpty', () { + expect(delegatingMap.isEmpty, false); + expect(MyMap({}).isEmpty, true); + }); + + test('isNotEmpty', () { + expect(delegatingMap.isNotEmpty, true); + expect(MyMap({}).isNotEmpty, false); + }); + + test('keys', () { + expect(delegatingMap.keys, ['a', 'bb']); + }); + + test('length', () { + expect(delegatingMap.length, 2); + expect(MyMap({}).length, 0); + }); + + test('putIfAbsent', () { + expect(delegatingMap.putIfAbsent('c', () => 4), 4); + expect(delegatingMap.putIfAbsent('c', () => throw ''), 4); + }); + + test('remove', () { + expect(delegatingMap.remove('a'), 1); + expect(delegatingMap, {'bb': 2}); + }); + + test('values', () { + expect(delegatingMap.values, [1, 2]); + }); + }); + } +} diff --git a/ohos/test_quiver/lib/src/collection/delegates/queue_test.dart b/ohos/test_quiver/lib/src/collection/delegates/queue_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..8cb0ca5a5f6f2d0163ec190a5193fb052311a997 --- /dev/null +++ b/ohos/test_quiver/lib/src/collection/delegates/queue_test.dart @@ -0,0 +1,81 @@ +// Copyright 2013 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +library quiver.collection.delegates.queue_test; + +import 'dart:collection' show Queue; + +import 'package:quiver/src/collection/delegates/queue.dart'; +import 'package:flutter/material.dart'; +import 'package:test_quiver/base/test_page.dart'; + +class MyQueue extends DelegatingQueue { + MyQueue(this._delegate); + + final Queue _delegate; + + @override + Queue get delegate => _delegate; +} + +class QueueTestPage extends TestPage { + QueueTestPage(String title, {Key? key}) : super(title: title, key: key) { + group('DelegatingQueue', () { + late DelegatingQueue delegatingQueue; + + delegatingQueue = MyQueue(Queue.from(['a', 'b', 'cc'])); + + test('add', () { + delegatingQueue.add('d'); + expect(delegatingQueue, ['a', 'b', 'cc', 'd']); + }); + + test('addAll', () { + delegatingQueue.addAll(['d', 'e']); + expect(delegatingQueue, ['a', 'b', 'cc', 'd', 'e']); + }); + + test('addFirst', () { + delegatingQueue.addFirst('d'); + expect(delegatingQueue, ['d', 'a', 'b', 'cc']); + }); + + test('addLast', () { + delegatingQueue.addLast('d'); + expect(delegatingQueue, ['a', 'b', 'cc', 'd']); + }); + + test('clear', () { + delegatingQueue.clear(); + expect(delegatingQueue, []); + }); + + test('remove', () { + expect(delegatingQueue.remove('b'), true); + expect(delegatingQueue, ['a', 'cc']); + }); + + test('removeFirst', () { + delegatingQueue = MyQueue(Queue.from(['a', 'b', 'cc'])); + expect(delegatingQueue.removeFirst(), 'a'); + expect(delegatingQueue, ['b', 'cc']); + }); + + test('removeLast', () { + expect(delegatingQueue.removeLast(), 'cc'); + expect(delegatingQueue, ['a', 'b']); + }); + }); + } +} diff --git a/ohos/test_quiver/lib/src/collection/delegates/set_test.dart b/ohos/test_quiver/lib/src/collection/delegates/set_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..f22815f701dc66baaa686e135f537ebe6b11b40c --- /dev/null +++ b/ohos/test_quiver/lib/src/collection/delegates/set_test.dart @@ -0,0 +1,99 @@ +// Copyright 2013 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +library quiver.collection.delegates.set_test; + +import 'package:quiver/src/collection/delegates/set.dart'; +import 'package:flutter/material.dart'; +import 'package:test_quiver/base/test_page.dart'; + +class MySet extends DelegatingSet { + MySet(this._delegate); + + final Set _delegate; + + @override + Set get delegate => _delegate; +} + +class SetTestPage extends TestPage { + SetTestPage(String title, {Key? key}) : super(title: title, key: key) { + group('DelegatingSet', () { + late DelegatingSet delegatingSet; + + delegatingSet = MySet({'a', 'b', 'cc'}); + + test('add', () { + delegatingSet.add('d'); + expect(delegatingSet, ['a', 'b', 'cc', 'd']); + delegatingSet.add('d'); + expect(delegatingSet, ['a', 'b', 'cc', 'd']); + }); + + test('addAll', () { + delegatingSet.addAll(['d', 'e']); + expect(delegatingSet, ['a', 'b', 'cc', 'd', 'e']); + }); + + test('clear', () { + delegatingSet.clear(); + expect(delegatingSet, []); + }); + + test('containsAll', () { + expect(delegatingSet.containsAll(['a', 'cc']), true); + expect(delegatingSet.containsAll(['a', 'c']), false); + }); + + test('difference', () { + expect(delegatingSet.difference({'a', 'cc'}), ['b']); + expect(delegatingSet.difference({'cc'}), ['a', 'b']); + }); + + test('intersection', () { + expect(delegatingSet.intersection({'a', 'dd'}), ['a']); + expect(delegatingSet.intersection({'e'}), []); + }); + + test('remove', () { + expect(delegatingSet.remove('b'), true); + expect(delegatingSet, ['a', 'cc']); + }); + + test('removeAll', () { + delegatingSet.removeAll(['a', 'cc']); + expect(delegatingSet, ['b']); + }); + + test('removeWhere', () { + delegatingSet.removeWhere((e) => e.length == 1); + expect(delegatingSet, ['cc']); + }); + + test('retainAll', () { + delegatingSet.retainAll(['a', 'cc', 'd']); + expect(delegatingSet, ['a', 'cc']); + }); + + test('retainWhere', () { + delegatingSet.retainWhere((e) => e.length == 1); + expect(delegatingSet, ['a', 'b']); + }); + + test('union', () { + expect(delegatingSet.union({'a', 'cc', 'd'}), ['a', 'b', 'cc', 'd']); + }); + }); + } +} diff --git a/ohos/test_quiver/lib/src/collection/lru_map_test.dart b/ohos/test_quiver/lib/src/collection/lru_map_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..de062dc1f4cff069fdd14bee50f79869c02b4cae --- /dev/null +++ b/ohos/test_quiver/lib/src/collection/lru_map_test.dart @@ -0,0 +1,347 @@ +// Copyright 2013 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +library quiver.collection.lru_map_test; + +import 'package:quiver/src/collection/lru_map.dart'; +import 'package:flutter/material.dart'; +import 'package:test_quiver/base/test_page.dart'; + +class LruMapTestPage extends TestPage { + LruMapTestPage(String title,{ Key? key}) : super(title: title, key: key) { + group('LruMap', () { + /// A map that will be initialized by individual tests. + late LruMap lruMap; + + test('length属性反映映射中的键数', () { + lruMap = LruMap(); + expect(lruMap, lruMap.length==0); + + lruMap.addAll({'A': 'Alpha', 'B': 'Beta', 'C': 'Charlie'}); + expect(lruMap, lruMap.length==3); + }); + + test('访问密钥', () { + lruMap = LruMap()..addAll({'A': 'Alpha', 'B': 'Beta', 'C': 'Charlie'}); + + expect(lruMap.keys.toList(), ['C', 'B', 'A']); + + // Trigger promotion of B. + final _ = lruMap['B']; + + // In a LRU cache, the first key is the one that will be removed if the + // capacity is reached, so adding keys to the end is considered to be a + // 'promotion'. + expect(lruMap.keys.toList(), ['B', 'C', 'A']); + }); + + test('在开头添加新密钥', () { + lruMap = LruMap()..addAll({'A': 'Alpha', 'B': 'Beta', 'C': 'Charlie'}); + + lruMap['D'] = 'Delta'; + expect(lruMap.keys.toList(), ['D', 'C', 'B', 'A']); + }); + + test('在现有密钥上设置值有效,并提升密钥', () { + lruMap = LruMap()..addAll({'A': 'Alpha', 'B': 'Beta', 'C': 'Charlie'}); + + lruMap['B'] = 'Bravo'; + expect(lruMap.keys.toList(), ['B', 'C', 'A']); + expect(lruMap['B'], 'Bravo'); + }); + + test('更新现有密钥的值有效,并提升密钥', () { + lruMap = LruMap()..addAll({'A': 'Alpha', 'B': 'Beta', 'C': 'Charlie'}); + + lruMap.update('B', (v) => '$v$v'); + expect(lruMap.keys.toList(), ['B', 'C', 'A']); + expect(lruMap['B'], 'BetaBeta'); + }); + + test('更新缺少密钥的值有效,并提升密钥', () { + lruMap = LruMap()..addAll({'A': 'Alpha', 'B': 'Beta', 'C': 'Charlie'}); + + lruMap.update('D', (v) => '$v$v', ifAbsent: () => 'Delta'); + expect(lruMap.keys.toList(), ['D', 'C', 'B', 'A']); + expect(lruMap['D'], 'Delta'); + }); + + test('更新所有值有效,不会更改已使用的顺序', () { + lruMap = LruMap()..addAll({'A': 'Alpha', 'B': 'Beta', 'C': 'Charlie'}); + lruMap.updateAll((k, v) => '$v$v'); + expect(lruMap.keys.toList(), ['C', 'B', 'A']); + expect(lruMap['A'], 'AlphaAlpha'); + expect(lruMap['B'], 'BetaBeta'); + expect(lruMap['C'], 'CharlieCharlie'); + }); + + test('当容量达到时,最近最少使用的密钥将被收回', () { + lruMap = LruMap(maximumSize: 3) + ..addAll({'A': 'Alpha', 'B': 'Beta', 'C': 'Charlie'}); + + lruMap['D'] = 'Delta'; + expect(lruMap.keys.toList(), ['D', 'C', 'B']); + }); + + test('设置最大大小将逐出关键帧,直到达到该大小为止', () { + lruMap = LruMap(maximumSize: 5) + ..addAll({ + 'A': 'Alpha', + 'B': 'Beta', + 'C': 'Charlie', + 'D': 'Delta', + 'E': 'Epsilon' + }); + + lruMap.maximumSize = 3; + expect(lruMap.keys.toList(), ['E', 'D', 'C']); + }); + + test('访问“keys”集合不会影响位置', () { + lruMap = LruMap()..addAll({'A': 'Alpha', 'B': 'Beta', 'C': 'Charlie'}); + + expect(lruMap.keys.toList(), ['C', 'B', 'A']); + + void nop(String key) {} + lruMap.keys.forEach(nop); + lruMap.keys.forEach(nop); + + expect(lruMap.keys.toList(), ['C', 'B', 'A']); + }); + + test('访问“values”集合不会影响位置', () { + lruMap = LruMap()..addAll({'A': 'Alpha', 'B': 'Beta', 'C': 'Charlie'}); + + expect(lruMap.values.toList(), ['Charlie', 'Beta', 'Alpha']); + + void nop(String key) {} + lruMap.values.forEach(nop); + lruMap.values.forEach(nop); + + expect(lruMap.values.toList(), ['Charlie', 'Beta', 'Alpha']); + }); + + test('清除将删除所有键和值', () { + lruMap = LruMap()..addAll({'A': 'Alpha', 'B': 'Beta', 'C': 'Charlie'}); + + expect(lruMap.isNotEmpty, true); + expect(lruMap.keys.isNotEmpty, true); + expect(lruMap.values.isNotEmpty, true); + + lruMap.clear(); + + expect(lruMap.isEmpty, true); + expect(lruMap.keys.isEmpty, true); + expect(lruMap.values.isEmpty, true); + }); + + test('`containsKey`如果键在映射中,则返回true', () { + lruMap = LruMap()..addAll({'A': 'Alpha', 'B': 'Beta', 'C': 'Charlie'}); + + expect(lruMap.containsKey('A'), true); + expect(lruMap.containsKey('D'), false); + }); + + test('`containsValue`如果值在映射中,则返回true', () { + lruMap = LruMap()..addAll({'A': 'Alpha', 'B': 'Beta', 'C': 'Charlie'}); + + expect(lruMap.containsValue('Alpha'), true); + expect(lruMap.containsValue('Delta'), false); + }); + + test('`forEach `返回所有键值对而不修改顺序', () { + final keys = []; + final values = []; + + lruMap = LruMap()..addAll({'A': 'Alpha', 'B': 'Beta', 'C': 'Charlie'}); + + expect(lruMap.keys.toList(), ['C', 'B', 'A']); + expect(lruMap.values.toList(), ['Charlie', 'Beta', 'Alpha']); + + lruMap.forEach((key, value) { + keys.add(key); + values.add(value); + }); + + expect(keys, ['C', 'B', 'A']); + expect(values, ['Charlie', 'Beta', 'Alpha']); + expect(lruMap.keys.toList(), ['C', 'B', 'A']); + expect(lruMap.values.toList(), ['Charlie', 'Beta', 'Alpha']); + }); + + test('`获取条目`返回所有条目', () { + lruMap = LruMap()..addAll({'A': 'Alpha', 'B': 'Beta', 'C': 'Charlie'}); + + var entries = lruMap.entries; + expect(entries, entries.length==3); + // MapEntry objects are not equal to each other; cannot use `contains`. :( + expect(entries.singleWhere((e) => e.key == 'A').value, 'Alpha'); + expect(entries.singleWhere((e) => e.key == 'B').value, 'Beta'); + expect(entries.singleWhere((e) => e.key == 'C').value, ('Charlie')); + }); + + test('addEntries将项目添加到开头', () { + lruMap = LruMap()..addAll({'A': 'Alpha', 'B': 'Beta', 'C': 'Charlie'}); + + var entries = [const MapEntry('D', 'Delta'), const MapEntry('E', 'Echo')]; + lruMap.addEntries(entries); + expect(lruMap.keys.toList(), ['E', 'D', 'C', 'B', 'A']); + }); + + test('addEntries将现有项目添加到开头', () { + lruMap = LruMap()..addAll({'A': 'Alpha', 'B': 'Beta', 'C': 'Charlie'}); + + var entries = [const MapEntry('B', 'Bravo'), const MapEntry('E', 'Echo')]; + lruMap.addEntries(entries); + expect(lruMap.keys.toList(), ['E', 'B', 'C', 'A']); + }); + + test('重新添加标题条目是不可行的', () { + // See: https://github.com/google/quiver-dart/issues/357 + lruMap = LruMap(); + lruMap['A'] = 'Alpha'; + lruMap['A'] = 'Alpha'; + + expect(lruMap.keys.toList(), ['A']); + expect(lruMap.values.toList(), ['Alpha']); + }); + + group('`remove`', () { + // setUp(() { + lruMap = LruMap()..addAll({'A': 'Alpha', 'B': 'Beta', 'C': 'Charlie'}); + // }); + + test('返回与键关联的值(如果存在)', () { + expect(lruMap.remove('A'), 'Alpha'); + }); + + test('如果提供的密钥不存在,则返回null', () { + expect(lruMap.remove('D'), null); + }); + + test('可以移除最后一个项目(头部和尾部)', () { + // See: https://github.com/google/quiver-dart/issues/385 + lruMap = LruMap(maximumSize: 1) + ..addAll({'A': 'Alpha'}) + ..remove('A'); + lruMap['B'] = 'Beta'; + lruMap['C'] = 'Charlie'; + expect(lruMap.keys.toList(), ['C']); + }); + + test('可以删除头部', () { + lruMap.remove('C'); + expect(lruMap.keys.toList(), ['B', 'A']); + }); + + test('可以删除最后一项', () { + lruMap.remove('A'); + expect(lruMap.keys.toList(), ['C', 'B']); + }); + + test('可以删除中间条目', () { + lruMap.remove('B'); + expect(lruMap.keys.toList(), ['C', 'A']); + }); + + test('可以删除指定项', () { + lruMap.removeWhere((k, v) => v.contains('h')); + expect(lruMap.keys.toList(), ['B']); + }); + + test('可以批量删除', () { + lruMap.removeWhere((k, v) => v.contains('A')); + expect(lruMap.keys.toList(), ['C', 'B']); + }); + + test('删除时正确保留链接', () { + lruMap.remove('B'); + + // Order is now [C, A]. Trigger promotion of A to check linkage. + final _ = lruMap['A']; + + final keys = []; + lruMap.forEach((String k, String v) => keys.add(k)); + expect(keys, ['A', 'C']); + }); + }); + + test('当提升中间的项目时,链接列表会发生变化', () { + LruMap lruMap = LruMap(maximumSize: 3) + ..addAll({'C': 1, 'A': 1, 'B': 1}); + // Order is now [B, A, C]. Trigger promotion of A. + lruMap['A'] = 1; + + // Order is now [A, B, C]. Trigger promotion of C to check linkage. + final _ = lruMap['C']; + expect(lruMap.length, lruMap.keys.length); + expect(lruMap.keys.toList(), ['C', 'A', 'B']); + }); + + group('`putIfAbsent`', () { + // setUp(() { + lruMap = LruMap()..addAll({'A': 'Alpha', 'B': 'Beta', 'C': 'Charlie'}); + // }); + + test('如果项目不存在,则添加该项目,并将其移动到MRU', () { + expect(lruMap.putIfAbsent('D', () => 'Delta'), 'Delta'); + expect(lruMap.keys.toList(), ['D', 'C', 'B', 'A']); + }); + + test('不添加项目(如果存在),但将其提升为MRU', () { + expect(lruMap.keys.toList(), ['B', 'C', 'A']); + }); + + test('如果超过“maximumSize”,则删除LRU项目', () { + lruMap.maximumSize = 3; + expect(lruMap.putIfAbsent('D', () => 'Delta'), 'Delta'); + expect(lruMap.keys.toList(), ['D', 'C', 'B']); + }); + + test('正确处理 maximumSize 1', () { + lruMap.maximumSize = 1; + lruMap.putIfAbsent('B', () => 'Beta'); + expect(lruMap.keys.toList(), ['B']); + }); + }); + }); + + group('LruMap builds an informative string representation', () { + late LruMap lruMap; + + // setUp(() { + lruMap = LruMap(); + // }); + + test('empty map', () { + expect(lruMap.toString(), '{}'); + }); + + test(' map 有一个值', () { + lruMap.addAll({'A': 'Alpha'}); + expect(lruMap.toString(), '{A: Alpha}'); + }); + + test('对于具有值的map', () { + lruMap.addAll({'A': 'Alpha', 'B': 'Beta', 'C': 'Charlie'}); + expect(lruMap.toString(), '{C: Charlie, B: Beta, A: Alpha}'); + }); + + test('可循环的map', () { + lruMap.addAll({'A': 'Alpha', 'B': lruMap}); + expect(lruMap.toString(), '{B: {...}, A: Alpha}'); + }); + }); +} +} \ No newline at end of file diff --git a/ohos/test_quiver/lib/src/collection/multimap_test.dart b/ohos/test_quiver/lib/src/collection/multimap_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..150f7ef0443330cff6591ecd5a6a8fa2106d2314 --- /dev/null +++ b/ohos/test_quiver/lib/src/collection/multimap_test.dart @@ -0,0 +1,1056 @@ +// Copyright 2013 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +library quiver.collection.multimap_test; + +import 'package:quiver/src/collection/multimap.dart'; +import 'package:flutter/material.dart'; +import 'package:test_quiver/base/test_page.dart'; + +class MultimapTestPage extends TestPage { + MultimapTestPage(String title, { Key? key}) : super(title: title, key: key) { + group('Multimap', () { + test('列表支持的多映射', () { + var map = Multimap(); + expect(map is ListMultimap, true); + }); + }); + + group('Multimap.fromIterable', () { + var map = Multimap.fromIterable([1, 2, 1]); + expect(map.asMap(), { + 1: [1, 1], + 2: [2], + + }); + + + var i = 0; + var map1 = Multimap.fromIterable([1, 2, 1], + value: (x) => '$x:${i++}'); + expect(map1.asMap(), { + 1: ['1:0', '1:2'], + 2: ['2:1'], + + }); + + + var map2 = + Multimap.fromIterable([1, 2, 1], key: (x) => '($x)'); + expect(map2.asMap(), { + '(1)': [1, 1], + '(2)': [2], + }); + + + + var j = 0; + var map3 = Multimap.fromIterable([1, 2, 1], + key: (x) => -x, value: (x) => '$x:${j++}'); + expect(map3.asMap(), { + -1: ['1:0', '1:2'], + -2: ['2:1'], + }); + + }); + + group('Multimap asMap() view', () { + late Multimap mmap; + late Map> map; + + mmap = Multimap() + ..add('k1', 'v1')..add('k1', 'v2')..add('k2', 'v3'); + map = mmap.asMap(); + + + test('operator[]=应抛出UnsupportedError', () { + map['k1'] = ['1', '2', '3']; + }); + + test('addEntries应抛出UnsupportedError', () { + map.addEntries(>>[] + ); + }); + + test('update 应抛出 UnsupportedError', () { + map.update('k1', (_) => ['1', '2', '3']) + ; + }); + + test('updateAll 应抛出 UnsupportedError', () { + map.updateAll((_, __) => ['1', '2', '3']); + }); + + test('containsKey() ', () { + expect(map.containsKey('k3'), false); + + expect(map.containsKey('k1'), true); + }); + + test('containsValue()', () { + expect(map.containsValue('k3'), false); + + expect(map.containsValue('v1'), true); + }); + + test('forEach应遍历所有键值对', () { + var results = []; + map.forEach((k, v) => results.add(Pair(k, v))); + expect( + results, + [ + Pair('k1', ['v1', 'v2']), + Pair('k2', ['v3']) + ]); + }); + + test( + 'isEmpty应返回映射是否包含键值对', () { + expect(map.isEmpty, false); + expect(map.isNotEmpty, true); + expect(Multimap() + .asMap() + .isEmpty, true); + expect(Multimap() + .asMap() + .isNotEmpty, false); + }); + + test('length应返回键值对的数量', () { + expect(Multimap() + .asMap() + .length, 0); + expect(map.length, 2); + }); + + // test('addAll(Map m) ', () { + // map.clear(); + // map.addAll(>{ + // 'k1': ['1', '2', '3'] + // }); + // }); + // + // test('putIfAbsent() ', () { + // var map = Multimap().asMap(); + // map.putIfAbsent('k1', () => [1]); + // }); + }); + + group('ListMultimap', () { + test('应初始化为空', () { + var map = ListMultimap(); + expect(map.isEmpty, true); + expect(map.isNotEmpty, false); + }); + + test('添加后不应为空', () { + var map = ListMultimap() + ..add('k', 'v'); + expect(map.isEmpty, false); + expect(map.isNotEmpty, true); + }); + + test('应将键数作为长度返回', () { + var map = ListMultimap(); + expect(map.length, 0); + map..add('k1', 'v1')..add('k1', 'v2')..add('k2', 'v3'); + expect(map.length, 2); + }); + + test('应该为未映射的键返回一个空的可迭代项', () { + var map = ListMultimap(); + expect(map['k1'], []); + }); + + test('应支持为未映射的键添加值', () { + var map = ListMultimap() + ..['k1'] + .add('v1'); + expect(map['k1'], ['v1'] + ); + }); + + test('应支持为未映射的键添加多个值', () { + var map = ListMultimap() + ..['k1'] + .addAll(['v1', 'v2']); + expect(map['k1'], ['v1', 'v2'] + ); + }); + + test('应支持为未映射的键插入值', () { + var map = ListMultimap() + ..['k1'] + .insert(0, 'v1'); + expect(map['k1'], ['v1'] + ); + }); + + test('应支持为未映射的键插入多个值', () { + var map = ListMultimap() + ..['k1'] + .insertAll(0, ['v1', 'v2']); + expect(map['k1'], ['v1', 'v2'] + ); + }); + + test('应该支持增加未映射键的基础列表', () { + var map = ListMultimap() + ..['k1'] + .length = 2; + expect(map['k1'], [null, null]); + }); + + test('应返回在添加时保持同步的未映射迭代', () { + var map = ListMultimap(); + List values1 = map['k1']; + List values2 = map['k1']; + values1.add('v1'); + expect(map['k1'], ['v1']); + expect(values2, ['v1']); + }); + + test('应返回在addAll上保持同步的未映射迭代', () { + var map = ListMultimap(); + List values1 = map['k1']; + List values2 = map['k1']; + values1.addAll(['v1', 'v2']); + expect(map['k1'], ['v1', 'v2']); + expect(values2, ['v1', 'v2']); + }); + + test('应该支持为键添加重复值', () { + var map = ListMultimap() + ..add('k', 'v1')..add('k', 'v1'); + expect(map['k'], ['v1', 'v1']); + }); + + test( + '应支持在初始化时为键添加重复值', () { + var map = ListMultimap.fromIterable(['k', 'k'], + value: (x) => 'v1'); + expect(map['k'], ['v1', 'v1']); + }); + + test('应支持添加多个密钥', () { + var map = ListMultimap() + ..add('k1', 'v1')..add('k1', 'v2')..add('k2', 'v3'); + expect(map['k1'], ['v1', 'v2']); + expect(map['k2'], ['v3']); + }); + + test('应支持同时添加多个值', () { + var map = ListMultimap() + ..addValues('k1', ['v1', 'v2']); + expect(map['k1'], ['v1', 'v2']); + }); + + test( + '应支持为现有键同时添加多个值', () { + var map = ListMultimap() + ..add('k1', 'v1') + ..addValues('k1', ['v1', 'v2']); + expect(map['k1'], ['v1', 'v1', 'v2']); + }); + + test('应该支持从另一个map添加', () { + var from = ListMultimap() + ..addValues('k1', ['v1', 'v2']) + ..add('k2', 'v3'); + var map = ListMultimap() + ..addAll(from); + expect(map['k1'], ['v1', 'v2']); + expect(map['k2'], ['v3']); + }); + + test( + '应该支持使用现有键从另一个多映射添加', () { + var from = ListMultimap() + ..addValues('k1', ['v1', 'v2']) + ..add('k2', 'v3'); + var map = ListMultimap() + ..add('k1', 'v0')..add('k2', 'v3') + ..addAll(from); + expect(map['k1'], ['v0', 'v1', 'v2']); + expect(map['k2'], ['v3', 'v3']); + }); + + test('应返回其密钥', () { + var map = ListMultimap() + ..add('k1', 'v1')..add('k1', 'v2')..add('k2', 'v3'); + expect(map.keys, ['k1', 'k2']); + }); + + test('应返回其值', () { + var map = ListMultimap() + ..add('k1', 'v1')..add('k1', 'v2')..add('k2', 'v3'); + expect(map.values, ['v1', 'v2', 'v3']); + }); + + test('应支持重复的值', () { + var map = ListMultimap() + ..add('k1', 'v1')..add('k1', 'v2')..add('k2', 'v1'); + expect(map.values, ['v1', 'v2', 'v1']); + }); + + test('应返回一个有序的值列表', () { + var map = ListMultimap() + ..add('k', 'v1')..add('k', 'v2'); + expect(map['k'], ['v1', 'v2']); + }); + + test('应反映对基础列表的更改', () { + var map = ListMultimap() + ..add('k', 'v1')..add('k', 'v2'); + map['k'].add('v3'); + map['k'].remove('v2'); + expect(map['k'], ['v1', 'v3']); + }); + + test('应返回是否包含密钥', () { + var map = ListMultimap() + ..add('k', 'v1')..add('k', 'v2'); + expect(map.containsKey('j'), false); + expect(map.containsKey('k'), true); + }); + + test('应返回是否包含值', () { + var map = ListMultimap() + ..add('k', 'v1')..add('k', 'v2'); + expect(map.containsValue('v0'), false); + expect(map.containsValue('v1'), true); + }); + + test('应返回是否包含键/值关联', () { + var map = ListMultimap() + ..add('k', 'v1')..add('k', 'v2'); + expect(map.contains('k', 'v0'), false); + expect(map.contains('f', 'v1'), false); + expect(map.contains('k', 'v1'), true); + }); + + test('应删除指定的键值关联', () { + var map = ListMultimap() + ..add('k1', 'v1')..add('k1', 'v2')..add('k2', 'v3'); + expect(map.remove('k1', 'v0'), false); + expect(map.remove('k1', 'v1'), true); + expect(map['k1'], ['v2']); + expect(map.containsKey('k2'), true); + }); + + test('应在删除所有关联值时删除键', () { + var map = ListMultimap() + ..add('k1', 'v1') + ..remove('k1', 'v1'); + expect(map.containsKey('k1'), false); + }); + + test( + '应在删除所有关联值时删除键', () { + var map = ListMultimap() + ..add('k1', 'v1'); + map['k1'].remove('v1'); + expect(map.containsKey('k1'), false); + }); + + test( + '应在删除所有关联值时删除键,通过基础iterable.removeAt', () { + var map = ListMultimap() + ..add('k1', 'v1'); + map['k1'].removeAt(0); + expect(map.containsKey('k1'), false); + }); + + test( + '应在从底层iterable.removeAt中删除所有关联值时删除键', () { + var map = ListMultimap() + ..add('k1', 'v1'); + map['k1'].removeLast(); + expect(map.containsKey('k1'), false); + }); + + test( + '应在通过底层iterable.removeRange删除所有关联值时删除键', () { + var map = ListMultimap() + ..add('k1', 'v1'); + map['k1'].removeRange(0, 1); + expect(map.containsKey('k1'), false); + }); + + test( + '应在通过底层iterable.removeWhere删除所有关联值时删除键', () { + var map = ListMultimap() + ..add('k1', 'v1'); + map['k1'].removeWhere((_) => true); + expect(map.containsKey('k1'), false); + }); + + test( + '应在通过底层iterable.replaceRange删除所有关联值时删除键', () { + var map = ListMultimap() + ..add('k1', 'v1'); + map['k1'].replaceRange(0, 1, []); + expect(map.containsKey('k1'), false); + }); + + test( + '应在通过底层iterable.retainWhere删除所有关联值时删除键', () { + var map = ListMultimap() + ..add('k1', 'v1'); + map['k1'].retainWhere((_) => false); + expect(map.containsKey('k1'), false); + }); + + test( + '应在通过底层iterable.clear删除所有关联值时删除键', () { + var map = ListMultimap() + ..add('k1', 'v1')..add('k1', 'v2'); + map['k1'].clear(); + expect(map.containsKey('k1'), false); + }); + + test('应删除键的所有值', () { + var map = ListMultimap() + ..add('k1', 'v1')..add('k1', 'v2')..add('k2', 'v3'); + expect(map.removeAll('k1'), ['v1', 'v2']); + expect(map.containsKey('k1'), false); + expect(map.containsKey('k2'), true); + }); + + test('应使用所有{key,value}对调用removeWhere', () { + Set s = {}; + ListMultimap() + ..add('k1', 'v1')..add('k1', 'v2')..add('k2', 'v3') + ..removeWhere((k, v) { + s.add(Pair(k, v)); + return false; + }); + expect( + s, + + [Pair('k1', 'v1'), Pair('k1', 'v2'), Pair('k2', 'v3')]); + }); + + test( + '应删除所有满足removeWhere中谓词的{key,value}对', () { + var map = ListMultimap() + ..add('k1', 'v1')..add('k1', 'v2')..add('k2', 'v1') + ..removeWhere((k, v) => k == 'k2' || v == 'v1'); + expect(map.keys, ['k1']); + expect(map.values, ['v2']); + }); + + test('应在移除时清除底层iterable', () { + var map = ListMultimap() + ..add('k1', 'v1'); + List values = map['k1']; + expect(map.removeAll('k1'), ['v1']); + expect(values, []); + }); + + test('应在removeAll of unmapped键上返回一个空的iterable', () { + var map = ListMultimap(); + var removed = map.removeAll('k1'); + expect(removed, []); + }); + + test('应与removeAll返回的iterable解耦', () { + var map = ListMultimap() + ..add('k1', 'v1'); + var removed = map.removeAll('k1'); + removed.add('v2'); + map.add('k1', 'v3'); + expect(removed, ['v1', 'v2']); + expect(map['k1'], ['v3']); + }); + + test('应该清除map', () { + var map = ListMultimap() + ..add('k1', 'v1')..add('k1', 'v2')..add('k2', 'v3') + ..clear(); + expect(map.isEmpty, true); + expect(map.containsKey('k1'), false); + expect(map.containsKey('k2'), false); + }); + + test('应清除clear上的底层iterable', () { + var map = ListMultimap() + ..add('k1', 'v1'); + List values = map['k1']; + map.clear(); + expect(values, []); + }); + + test('不应在查找未映射的键时添加映射', () { + var map = ListMultimap() + ..['k1']; + expect(map.containsKey('k1'), false); + }); + + test('不应在清除映射值时删除映射', () { + var map = ListMultimap() + ..add('k1', 'v1') + ..['v1'] + .clear(); + expect(map.containsKey('k1') + , + true + ); + }); + + test('应返回map', () { + var mmap = ListMultimap() + ..add('k1', 'v1')..add('k1', 'v2')..add('k2', 'v3'); + Map map = mmap.asMap(); + expect(map.keys, ['k1', 'k2']); + expect(map.values, map.values.length == 2); + expect(map.values, ['v1', 'v2']); + expect(map.values, ['v3']); + expect(map['k1'], ['v1', 'v2']); + expect(map['k2'], ['v3']); + }); + + test('应在映射视图上返回一个空的可迭代未映射键', () { + Map map = ListMultimap().asMap(); + expect(map['k1'], []); + }); + + test('应允许通过映射视图上的未映射键查找进行添加', () { + var mmap = ListMultimap(); + Map map = mmap.asMap(); + map['k1'].add('v1'); + map['k2'].addAll(['v1', 'v2']); + expect(mmap['k1'], ['v1']); + expect(mmap['k2'], ['v1', 'v2']); + }); + + test('应反映映射视图返回的可迭代项的添加', () { + var mmap = ListMultimap() + ..add('k1', 'v1')..add('k1', 'v2'); + Map map = mmap.asMap(); + map['k1'].add('v3'); + expect(mmap['k1'], ['v1', 'v2', 'v3']); + }); + + test('应反映返回的map中键的删除', () { + var mmap = ListMultimap() + ..add('k1', 'v1')..add('k1', 'v2'); + Map map = mmap.asMap(); + map.remove('k1'); + expect(mmap.containsKey('k1'), false); + }); + + test('应反映清除返回的地图视图', () { + var mmap = ListMultimap() + ..add('k1', 'v1')..add('k1', 'v2')..add('k2', 'v3'); + Map map = mmap.asMap(); + map.clear(); + expect(mmap.isEmpty, true); + }); + + test('应支持对所有{key,value}对进行迭代', () { + Set s = {}; + ListMultimap() + ..add('k1', 'v1')..add('k1', 'v2')..add('k2', 'v3') + ..forEach((k, v) => s.add(Pair(k, v))); + expect( + s, + + [Pair('k1', 'v1'), Pair('k1', 'v2'), Pair('k2', 'v3')]); + }); + + test( + '应支持对所有{key,Iterable<value>}对进行迭代', () { + Map map = {}; + var mmap = ListMultimap() + ..add('k1', 'v1')..add('k1', 'v2')..add('k2', 'v3') + ..forEachKey((k, v) => map[k] = v); + expect(map.length, mmap.length); + expect(map['k1'], ['v1', 'v2']); + expect(map['k2'], ['v3']); + }); + + test( + '应支持在不中断委托同步的情况下对空映射视图执行操作', + () { + var mmap = ListMultimap(); + List x = mmap['k1']; + List y = mmap['k1']; + List z = mmap['k1']; + List w = mmap['k1']; + mmap['k1'].add('v1'); + expect(mmap['k1'], ['v1']); + x.add('v2'); + expect(mmap['k1'], ['v1', 'v2']); + y.addAll(['v3', 'v4']); + expect(mmap['k1'], ['v1', 'v2', 'v3', 'v4']); + z.insert(0, 'v0'); + expect(mmap['k1'], ['v0', 'v1', 'v2', 'v3', 'v4']); + w.insertAll(5, ['v5', 'v6']); + expect(mmap['k1'], ['v0', 'v1', 'v2', 'v3', 'v4', 'v5', 'v6']); + }); + }); + + group('SetMultimap', () { + test('应初始化为空', () { + var map = SetMultimap(); + expect(map.isEmpty, true); + expect(map.isNotEmpty, false); + }); + + test('添加后不应为空', () { + var map = SetMultimap() + ..add('k', 'v'); + expect(map.isEmpty, false); + expect(map.isNotEmpty, true); + }); + + test('应将键数作为长度返回', () { + var map = SetMultimap(); + expect(map.length, 0); + map..add('k1', 'v1')..add('k1', 'v2')..add('k2', 'v3'); + expect(map.length, 2); + }); + + test('应该为未映射的键返回一个空的可迭代项', () { + var map = SetMultimap(); + expect(map['k1'], []); + }); + + test('应支持为未映射的键添加值', () { + var map = SetMultimap() + ..['k1'] + .add('v1'); + expect(map['k1'], ['v1'] + ); + }); + + test('应支持为未映射的键添加多个值', () { + var map = SetMultimap() + ..['k1'] + .addAll(['v1', 'v2']); + expect(map['k1'], ['v1', 'v2'] + ); + }); + + test('应返回在添加时保持同步的未映射迭代', () { + var map = SetMultimap(); + Set values1 = map['k1']; + Set values2 = map['k1']; + values1.add('v1'); + expect(map['k1'], ['v1']); + expect(values2, ['v1']); + }); + + test('应返回在addAll上保持同步的未映射迭代', () { + var map = SetMultimap(); + Set values1 = map['k1']; + Set values2 = map['k1']; + values1.addAll(['v1', 'v2']); + expect(map['k1'], ['v1', 'v2']); + expect(values2, ['v1', 'v2']); + }); + + test('不应支持为键添加重复值', () { + var map = SetMultimap() + ..add('k', 'v1')..add('k', 'v1'); + expect(map['k'], ['v1']); + }); + + test( + '当从可迭代项初始化时,不应支持为键添加重复值', () { + var map = SetMultimap.fromIterable(['k', 'k'], + value: (x) => 'v1'); + expect(map['k'], ['v1']); + }); + + test('应支持添加多个密钥', () { + var map = SetMultimap() + ..add('k1', 'v1')..add('k1', 'v2')..add('k2', 'v3'); + expect(map['k1'], ['v1', 'v2']); + expect(map['k2'], ['v3']); + }); + + test('应支持同时添加多个值', () { + var map = SetMultimap() + ..addValues('k1', ['v1', 'v2']); + expect(map['k1'], ['v1', 'v2']); + }); + + test( + '应支持为现有键同时添加多个值', () { + var map = SetMultimap() + ..add('k1', 'v0') + ..addValues('k1', ['v1', 'v2']); + expect(map['k1'], ['v0', 'v1', 'v2']); + }); + + test( + '应支持为现有(键、值)添加多个值', () { + var map = SetMultimap() + ..add('k1', 'v1') + ..addValues('k1', ['v1', 'v2']); + expect(map['k1'], ['v1', 'v2']); + }); + + test('应该支持从另一个多映射添加', () { + var from = SetMultimap() + ..addValues('k1', ['v1', 'v2']) + ..add('k2', 'v3'); + var map = SetMultimap() + ..addAll(from); + expect(map['k1'], ['v1', 'v2']); + expect(map['k2'], ['v3']); + }); + + test( + '应该支持使用现有键从另一个多映射添加', () { + var from = SetMultimap() + ..addValues('k1', ['v1', 'v2']) + ..add('k2', 'v3'); + var map = SetMultimap() + ..add('k1', 'v0')..add('k2', 'v3') + ..addAll(from); + expect(map['k1'], ['v0', 'v1', 'v2']); + expect(map['k2'], ['v3']); + }); + + test('应返回其密钥', () { + var map = SetMultimap() + ..add('k1', 'v1')..add('k1', 'v2')..add('k2', 'v3'); + expect(map.keys, ['k1', 'k2']); + }); + + test('应返回其值', () { + var map = SetMultimap() + ..add('k1', 'v1')..add('k1', 'v2')..add('k2', 'v3'); + expect(map.values, ['v1', 'v2', 'v3']); + }); + + test('应支持重复的值', () { + var map = SetMultimap() + ..add('k1', 'v1')..add('k1', 'v2')..add('k2', 'v1'); + expect(map.values, ['v1', 'v2', 'v1']); + }); + + test('应返回一个有序的值列表', () { + var map = SetMultimap() + ..add('k', 'v1')..add('k', 'v2'); + expect(map['k'], ['v1', 'v2']); + }); + + test('应反映对基础集的更改', () { + var map = SetMultimap() + ..add('k', 'v1')..add('k', 'v2'); + map['k'].add('v3'); + map['k'].remove('v2'); + expect(map['k'], ['v1', 'v3']); + }); + + test('应返回是否包含密钥', () { + var map = SetMultimap() + ..add('k', 'v1')..add('k', 'v2'); + expect(map.containsKey('j'), false); + expect(map.containsKey('k'), true); + }); + + test('应返回是否包含值', () { + var map = SetMultimap() + ..add('k', 'v1')..add('k', 'v2'); + expect(map.containsValue('v0'), false); + expect(map.containsValue('v1'), true); + }); + + test('应删除指定的键值关联', () { + var map = SetMultimap() + ..add('k1', 'v1')..add('k1', 'v2')..add('k2', 'v3'); + expect(map.remove('k1', 'v0'), false); + expect(map.remove('k1', 'v1'), true); + expect(map['k1'], ['v2']); + expect(map.containsKey('k2'), true); + }); + + test('应在删除所有关联值时删除键', () { + var map = SetMultimap() + ..add('k1', 'v1') + ..remove('k1', 'v1'); + expect(map.containsKey('k1'), false); + }); + + test( + '应在通过底层iterable.remove删除所有关联值时删除键', () { + var map = SetMultimap() + ..add('k1', 'v1'); + map['k1'].remove('v1'); + expect(map.containsKey('k1'), false); + }); + + test( + '应在通过底层iterable.removeAll删除所有关联值时删除键', () { + var map = SetMultimap() + ..add('k1', 'v1')..add('k1', 'v2'); + map['k1'].removeAll(['v1', 'v2']); + expect(map.containsKey('k1'), false); + }); + + test( + '应在通过底层iterable.removeWhere删除所有关联值时删除键', () { + var map = SetMultimap() + ..add('k1', 'v1'); + map['k1'].removeWhere((_) => true); + expect(map.containsKey('k1'), false); + }); + + test( + '应在通过底层iterable.reainAll删除所有关联值时删除键', () { + var map = SetMultimap() + ..add('k1', 'v1'); + map['k1'].retainAll([]); + expect(map.containsKey('k1'), false); + }); + + test( + '应在通过底层iterable.retainWhere删除所有关联值时删除键', () { + var map = SetMultimap() + ..add('k1', 'v1'); + map['k1'].retainWhere((_) => false); + expect(map.containsKey('k1'), false); + }); + + test( + '应在通过底层iterable.clear删除所有关联值时删除键', () { + var map = SetMultimap() + ..add('k1', 'v1'); + map['k1'].clear(); + expect(map.containsKey('k1'), false); + }); + + test('应删除键的所有值', () { + var map = SetMultimap() + ..add('k1', 'v1')..add('k1', 'v2')..add('k2', 'v3'); + expect(map.removeAll('k1'), ['v1', 'v2']); + expect(map.containsKey('k1'), false); + expect(map.containsKey('k2'), true); + }); + + test('应使用所有{key,value}对调用removeWhere', () { + Set s = {}; + SetMultimap() + ..add('k1', 'v1')..add('k1', 'v2')..add('k2', 'v3') + ..removeWhere((k, v) { + s.add(Pair(k, v)); + return false; + }); + expect( + s, + + [Pair('k1', 'v1'), Pair('k1', 'v2'), Pair('k2', 'v3')]); + }); + + test( + '应删除所有满足removeWhere中谓词的{key,value}对', () { + var map = SetMultimap() + ..add('k1', 'v1')..add('k1', 'v2')..add('k2', 'v1') + ..removeWhere((k, v) => k == 'k2' || v == 'v1'); + expect(map.keys, ['k1']); + expect(map.values, ['v2']); + }); + + test('应在移除时清除底层可迭代项', () { + var map = SetMultimap() + ..add('k1', 'v1'); + Set values = map['k1']; + expect(map.removeAll('k1'), ['v1']); + expect(values, []); + }); + + test('应在removeAll of unmapped键上返回一个空的可迭代项', () { + var map = SetMultimap(); + var removed = map.removeAll('k1'); + expect(removed, []); + }); + + test('应与removeAll返回的可迭代项解耦', () { + var map = SetMultimap() + ..add('k1', 'v1'); + var removed = map.removeAll('k1'); + removed.add('v2'); + map.add('k1', 'v3'); + expect(removed, ['v1', 'v2']); + expect(map['k1'], ['v3']); + }); + + test('应该清除地图', () { + var map = SetMultimap() + ..add('k1', 'v1')..add('k1', 'v2')..add('k2', 'v3') + ..clear(); + expect(map.isEmpty, true); + expect(map.containsKey('k1'), false); + expect(map.containsKey('k2'), false); + }); + + test('应清除clear上的底层可迭代项', () { + var map = SetMultimap() + ..add('k1', 'v1'); + Set values = map['k1']; + map.clear(); + expect(values, []); + }); + + test('不应在查找未映射的键时添加映射', () { + var map = SetMultimap() + ..['k1']; + expect(map.containsKey('k1'), false); + }); + + test('不应在清除映射值时删除映射', () { + var map = SetMultimap() + ..add('k1', 'v1') + ..['v1'] + .clear(); + expect(map.containsKey('k1') + , + true + ); + }); + + test('应返回地图视图', () { + var mmap = SetMultimap() + ..add('k1', 'v1')..add('k1', 'v2')..add('k2', 'v3'); + Map map = mmap.asMap(); + expect(map.keys, ['k1', 'k2']); + expect(map['k1'], ['v1', 'v2']); + expect(map['k2'], ['v3']); + }); + + test('应在映射视图上返回一个空的可迭代未映射键', () { + Map map = SetMultimap().asMap(); + expect(map['k1'], []); + }); + + test('应允许通过映射视图上的未映射键查找进行添加', () { + var mmap = SetMultimap(); + Map map = mmap.asMap(); + map['k1'].add('v1'); + map['k2'].addAll(['v1', 'v2']); + expect(mmap['k1'], ['v1']); + expect(mmap['k2'], ['v1', 'v2']); + }); + + test('应反映映射视图返回的可迭代项的添加', () { + var mmap = SetMultimap() + ..add('k1', 'v1')..add('k1', 'v2'); + Map map = mmap.asMap(); + map['k1'].add('v3'); + expect(mmap['k1'], ['v1', 'v2', 'v3']); + }); + + test('应反映映射视图返回的可迭代项的添加', () { + var mmap = SetMultimap() + ..add('k1', 'v1')..add('k1', 'v2'); + Map map = mmap.asMap(); + map['k1'].add('v3'); + expect(mmap['k1'], ['v1', 'v2', 'v3']); + }); + + test('应反映返回的映射视图中键的删除', () { + var mmap = SetMultimap() + ..add('k1', 'v1')..add('k1', 'v2'); + Map map = mmap.asMap(); + map.remove('k1'); + expect(mmap.containsKey('k1'), false); + }); + + test('是否应该了解返回的映射视图中的条目', () { + var mmap = SetMultimap() + ..add('k1', 'v1')..add('k1', 'v2'); + Map map = mmap.asMap(); + expect(map.entries, map.entries.length == 1); + expect(map.entries.single.key, 'k1'); + expect(map.entries.single.value, ['v1', 'v2']); + }); + + test('应该从返回的地图视图映射', () { + var mmap = SetMultimap() + ..add('k1', 'v1')..add('k1', 'v2'); + Map map = mmap.asMap(); + var newMap = map.map((k, v) => MapEntry(k, v.join(','))); + expect(newMap, newMap.length == 1); + expect(newMap, newMap.containsKey('k1')); + expect(newMap, newMap.containsValue('v1,v2')); + }); + + test('应反映清除返回的地图视图', () { + var mmap = SetMultimap() + ..add('k1', 'v1')..add('k1', 'v2')..add('k2', 'v3'); + Map map = mmap.asMap(); + map.clear(); + expect(mmap.isEmpty, true); + }); + + test('应支持对所有{key,value}对进行迭代', () { + Set s = {}; + SetMultimap() + ..add('k1', 'v1')..add('k1', 'v2')..add('k2', 'v3') + ..forEach((k, v) => s.add(Pair(k, v))); + expect( + s, + + [Pair('k1', 'v1'), Pair('k1', 'v2'), Pair('k2', 'v3')]); + }); + + test( + '应支持对所有{key,Iterable<value>}对进行迭代', () { + Map map = {}; + var mmap = SetMultimap() + ..add('k1', 'v1')..add('k1', 'v2')..add('k2', 'v3') + ..forEachKey((k, v) => map[k] = v); + expect(map.length, mmap.length); + expect(map['k1'], ['v1', 'v2']); + expect(map['k2'], ['v3']); + }); + + test( + '应支持在不中断委托同步的情况下对空映射视图执行操作', () { + var mmap = SetMultimap(); + Set x = mmap['k1']; + Set y = mmap['k1']; + mmap['k1'].add('v0'); + x.add('v1'); + y.addAll(['v2', 'v3']); + expect(mmap['k1'], ['v0', 'v1', 'v2', 'v3']); + }); + }); + } +} + +class Pair { + Pair(this.x, this.y) : assert(x != null && y != null); + + final T x; + final T y; + + @override + bool operator ==(Object other) { + if (other is! Pair) return false; + if (x != other.x) return false; + return y == other.y; + } + + @override + int get hashCode => x.hashCode ^ y.hashCode; + + @override + String toString() => '($x, $y)'; +} diff --git a/ohos/test_quiver/lib/src/collection/treeset_test.dart b/ohos/test_quiver/lib/src/collection/treeset_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..4ba51a6b27ec08757b6ff0a3aaf445496d57ace3 --- /dev/null +++ b/ohos/test_quiver/lib/src/collection/treeset_test.dart @@ -0,0 +1,582 @@ +// Copyright 2013 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +library quiver.collection.treeset_test; + +import 'package:quiver/src/collection/treeset.dart'; +import 'package:flutter/material.dart'; +import 'package:test_quiver/base/test_page.dart'; +import 'package:matcher/src/expect/throws_matcher.dart'; + +/// Matcher that verifies an [Error] is thrown. + +class TreeSetTestPage extends TestPage { + TreeSetTestPage(String title,{ Key? key}) : super(title: title, key: key) { + group('TreeSet', () { + group('when empty', () { + late TreeSet tree; + // setUp(() { + tree = TreeSet(); + // }); + test('TreeSet.isEmpty', () => expect(tree.isEmpty, tree.isEmpty)); + test('不应包含元素', + () => expect(tree.lookup(0), null)); + test('向前迭代时没有元素', () { + var i = tree.iterator; + expect(i.moveNext(), false); + expect(() => i.current, null); + }); + test('向后迭代时没有元素', () { + var i = tree.iterator; + expect(i.movePrevious(), false); + expect(() => i.current, null); + }); + }); + + group('with [10, 20, 15]', () { + late AvlTreeSet tree; + + tree = TreeSet() as AvlTreeSet; + tree.addAll([10, 20, 15]); + + test('查找插入的元素成功', () { + expect(tree.lookup(10), 10); + expect(tree.lookup(15), 15); + expect(tree.lookup(20), 20); + }); + test('订单是正确的', () { + AvlNode ten = debugGetNode(tree, 10)!; + AvlNode twenty = debugGetNode(tree, 20)!; + AvlNode fifteen = debugGetNode(tree, 15)!; + expect(ten.predecessor, null ); + expect(ten.successor, fifteen); + expect(ten.successor!.successor, twenty + ); + + expect(twenty.successor, null,); + expect(twenty.predecessor, fifteen); + expect(twenty.predecessor!.predecessor, ten); + }); + }); + + group('First & Last', () { + test(' num ', () { + var tree = TreeSet(); + tree.add(1); + tree.add(2); + tree.add(3); + expect(tree.first, 1); + expect(tree.last, 3); + }); + + test(' String ', () { + var tree = TreeSet(); + tree.add('abc'); + tree.add('aaa'); + tree.add('zzz'); + expect(tree.first, 'aaa'); + expect(tree.last, 'zzz'); + }); + }); + + group('with repeated elements', () { + late TreeSet tree; + + tree = TreeSet()..addAll([10, 20, 15, 21, 30, 20]); + + + test('仅包含子集', () { + var it = tree.iterator; + var testList = List.from([10, 15, 20, 21, 30]); + while (it.moveNext()) { + expect(it.current, testList.removeAt(0)); + } + expect(testList.length, 0); + }); + }); + + group('iteration', () { + late TreeSet tree; + + tree = TreeSet()..addAll([10, 20, 15, 21, 30]); + + + test('双向工作', () { + var it = tree.iterator; + while (it.moveNext()) {} + expect(it.movePrevious(), true + ); + expect(it.current, 30 + ); + while (it.movePrevious()) {} + expect(it.moveNext(), true + ); + expect(it.current, 10, + ); + }); + + group('from', () { + test('未插入中点向前工作', () { + var it = tree.fromIterator(19); + expect(() => it.current, null); + expect(it.moveNext(), true,); + expect(it.current, 20); + }); + + test('movePrevious()', () { + var it = tree.fromIterator(19); + expect(() => it.current, null); + expect(it.movePrevious(), true); + expect(it.current, 15); + }); + + test('reversed', () { + var it = tree.fromIterator(19, reversed: true); + expect(() => it.current, null); + expect(it.moveNext(), true); + expect(it.current, 15); + }); + + test(' reversed, movePrevious()', () { + var it = tree.fromIterator(19, reversed: true); + expect(() => it.current, null); + expect(it.movePrevious(), true + ); + expect(it.current, 20); + }); + + test('插入的中点向前工作', () { + var it = tree.fromIterator(20); + expect(() => it.current, null); + expect(it.moveNext(), true,); + expect(it.current, 20); + }); + + test('插入的中点反向工作', () { + var it = tree.fromIterator(20, reversed: true); + expect(() => it.current, null); + expect(it.moveNext(), true); + expect(it.current, 20); + }); + + test('set后', () { + var it = tree.fromIterator(100); + expect(() => it.current, null); + expect(it.moveNext(), false); + expect(it.movePrevious(), true); + expect(it.current, 30); + }); + + test('set之前', () { + var it = tree.fromIterator(0); + expect(() => it.current, null); + expect(it.movePrevious(), false); + expect(it.moveNext(), true); + expect(it.current, 10); + }); + + test('inserted midpoint, non-inclusive, works forward', () { + var it = tree.fromIterator(20, inclusive: false); + expect(() => it.current, null); + expect(it.moveNext(), true); + expect(it.current, 21); + }); + + test('inserted endpoint, non-inclusive, works forward', () { + var it = tree.fromIterator(30, inclusive: false); + expect(() => it.current, null); + expect(it.moveNext(), false); + + it = tree.fromIterator(10, inclusive: false); + expect(() => it.current, null); + expect(it.moveNext(), true); + expect(it.current, 15); + }); + + test('inserted endpoint, non-inclusive, works backward', () { + var it = tree.fromIterator(10, inclusive: false); + expect(() => it.current, null); + expect(it.movePrevious(), false + ); + + it = tree.fromIterator(30, inclusive: false); + expect(() => it.current, null); + expect(it.movePrevious(), true + ); + expect(it.current, 21); + }); + + test('inserted midpoint, non-inclusive, reversed, works forward', () { + var it = tree.fromIterator(20, inclusive: false, reversed: true); + expect(() => it.current, null); + expect(it.moveNext(), true); + expect(it.current, 15); + }); + + test('inserted endpoint, non-inclusive, reversed, works forward', () { + var it = tree.fromIterator(30, inclusive: false, reversed: true); + expect(() => it.current, null); + expect(it.moveNext(), true); + expect(it.current, 21); + + it = tree.fromIterator(10, inclusive: false, reversed: true); + expect(() => it.current, null); + expect(it.moveNext(), false); + }); + + test('inserted endpoint, non-inclusive, reversed, works backward', () { + var it = tree.fromIterator(10, inclusive: false, reversed: true); + expect(() => it.current, null); + expect(it.movePrevious(), true + ); + expect(it.current, 15); + + it = tree.fromIterator(30, inclusive: false, reversed: true); + expect(() => it.current, null); + expect(it.movePrevious(), false + ); + }); + }); + + group('fails', () { + late Iterator it; + // setUp(() { + it = tree.iterator; + // }); + + test('清除树之后', () { + tree.clear(); + dynamic error; + try { + it.moveNext(); + } catch (e) { + error = e; + } + expect(error, null); + }); + + test('插入元素后', () { + tree.add(101); + dynamic error; + try { + it.moveNext(); + } catch (e) { + error = e; + } + expect(error, null); + }); + + test('删除元素后', () { + tree.remove(10); + dynamic error; + try { + it.moveNext(); + } catch (e) { + error = e; + } + expect(error,null); + }); + }); + + group('still works', () { + late Iterator it; + // setUp(() { + it = tree.iterator; + // }); + + test('删除不存在的元素时', () { + tree.remove(42); + dynamic error; + try { + it.moveNext(); + } catch (e) { + error = e; + } + expect(error, null); + }); + test('添加已存在的元素时', () { + tree.add(10); + dynamic error; + try { + it.moveNext(); + } catch (e) { + error = e; + } + expect(error, null); + }); + }); + }); + + group('removal', () { + late TreeSet tree; + + test('从空树中删除', () { + tree = TreeSet(); + tree.remove(10); + expect(tree, tree.isEmpty); + }); + + test('从树中删除', () { + tree = TreeSet()..addAll([10, 20, 15, 21, 30, 20]); + tree.remove(42); + expect(tree.toList(), [10, 15, 20, 21, 30]); + + tree.remove(10); + expect(tree.toList(), [15, 20, 21, 30]); + + tree.remove(30); + expect(tree.toList(), [15, 20, 21]); + + tree.remove(20); + expect(tree.toList(), [15, 21]); + }); + + test('removeAll', () { + tree = TreeSet() + ..addAll([1, 3, 5, 6, 2, 4]) + ..removeAll([1, 3]); + expect(tree.toList(), [2, 4, 5, 6]); + }); + + test('removeAll from tree', () { + tree = TreeSet()..addAll([10, 20, 15, 21, 30, 20]); + tree.removeAll([42]); + expect(tree.toList(),[10, 15, 20, 21, 30]); + + tree.removeAll([10, 30]); + expect(tree.toList(), [15, 20, 21]); + + tree.removeAll([21, 20, 15]); + expect(tree, tree.isEmpty); + }); + + test('removeWhere from tree', () { + tree = TreeSet()..addAll([10, 20, 15, 21, 30, 20]); + tree.removeWhere((e) => e % 10 == 2); + expect(tree.toList(), [10, 15, 20, 21, 30]); + + tree.removeWhere((e) => e % 10 == 0); + expect(tree.toList(), [15, 21]); + + tree.removeWhere((e) => e % 10 > 0); + expect(tree, tree.isEmpty); + }); + + test('retainAll from tree', () { + tree = TreeSet()..addAll([10, 20, 15, 21, 30, 20]); + tree.retainAll([10, 30]); + expect(tree.toList(), [10, 30]); + + tree.retainAll([42]); + expect(tree, tree.isEmpty); + }); + + test('retainWhere from tree', () { + tree = TreeSet()..addAll([10, 20, 15, 21, 30, 20]); + tree.retainWhere((e) => e % 1 == 0); + expect(tree.toList(), [10, 15, 20, 21, 30]); + + tree.retainWhere((e) => e % 10 == 0); + expect(tree.toList(), [10, 20, 30]); + + tree.retainWhere((e) => e % 10 > 0); + expect(tree, tree.isEmpty); + }); + }); + + group('set math', () { + /// NOTE: set math with sorted sets should have a performance benefit; + /// we do not check the performance, only that the resulting math + /// is equivalent to non-sorted sets. + + late TreeSet tree; + late List expectedUnion; + late List expectedIntersection; + late List expectedDifference; + late Set nonSortedTestSet; + late TreeSet sortedTestSet; + + // setUp(() { + tree = TreeSet()..addAll([10, 20, 15, 21, 30, 20]); + expectedUnion = [10, 15, 18, 20, 21, 22, 30]; + expectedIntersection = [10, 15]; + expectedDifference = [20, 21, 30]; + nonSortedTestSet = {10, 18, 22, 15}; + sortedTestSet = TreeSet()..addAll(nonSortedTestSet); + // }); + + test( + '具有非排序集的并集', + () => expect( + tree.union(nonSortedTestSet).toList(), expectedUnion)); + test( + '具有排序集的并集', + () => expect( + tree.union(sortedTestSet).toList(), expectedUnion)); + test( + '与非排序集的交集', + () => expect(tree.intersection(nonSortedTestSet).toList(), + expectedIntersection)); + test( + '与排序集的交集', + () => expect(tree.intersection(sortedTestSet).toList(), + expectedIntersection)); + test( + '与非排序集的差异', + () => expect(tree.difference(nonSortedTestSet).toList(), + expectedDifference)); + test( + '排序集的差异', + () => expect(tree.difference(sortedTestSet).toList(), + expectedDifference)); + }); + + group('AVL implementation', () { + /// NOTE: This is implementation specific testing for coverage. + /// Users do not have access to [AvlNode] or [AvlTreeSet] + test('RightLeftRotation', () { + AvlTreeSet tree = TreeSet() as AvlTreeSet; + tree.add(10); + tree.add(20); + tree.add(15); + + AvlNode ten = debugGetNode(tree, 10)!; + AvlNode twenty = debugGetNode(tree, 20)!; + AvlNode fifteen = debugGetNode(tree, 15)!; + + expect(ten.parent, fifteen); + expect(ten.hasLeft, false); + expect(ten.hasRight, false); + expect(ten.balance, 0); + + expect(twenty.parent, fifteen); + expect(twenty.hasLeft, false); + expect(twenty.hasRight, false); + expect(twenty.balance, 0); + + expect(fifteen.hasParent, false); + expect(fifteen.left, ten); + expect(fifteen.right, twenty); + expect(fifteen.balance, 0); + }); + test('左右旋转', () { + AvlTreeSet tree = TreeSet() as AvlTreeSet; + tree.add(30); + tree.add(10); + tree.add(20); + + AvlNode thirty = debugGetNode(tree, 30)!; + AvlNode ten = debugGetNode(tree, 10)!; + AvlNode twenty = debugGetNode(tree, 20)!; + + expect(thirty.parent, twenty); + expect(thirty.hasLeft, false); + expect(thirty.hasRight, false); + expect(thirty.balance, 0); + + expect(ten.parent, twenty); + expect(ten.hasLeft, false); + expect(ten.hasRight, false); + expect(ten.balance, 0); + + expect(twenty.hasParent, false); + expect(twenty.left, ten); + expect(twenty.right, thirty); + expect(twenty.balance, 0); + }); + + test('AVL向左旋转', () { + AvlTreeSet tree = TreeSet() as AvlTreeSet; + tree.add(1); + tree.add(2); + tree.add(3); + + AvlNode one = debugGetNode(tree, 1)!; + AvlNode two = debugGetNode(tree, 2)!; + AvlNode three = debugGetNode(tree, 3)!; + + expect(one.parent, two); + expect(one.hasLeft, false); + expect(one.hasRight, false); + expect(one.balance, 0); + + expect(three.parent, two); + expect(three.hasLeft, false); + expect(three.hasRight, false); + expect(three.balance, 0); + + expect(two.hasParent, false); + expect(two.left, one); + expect(two.right, three); + expect(two.balance, 0); + }); + + test('AVL向右旋转', () { + AvlTreeSet tree = TreeSet() as AvlTreeSet; + tree.add(3); + tree.add(2); + tree.add(1); + + AvlNode one = debugGetNode(tree, 1)!; + AvlNode two = debugGetNode(tree, 2)!; + AvlNode three = debugGetNode(tree, 3)!; + + expect(one.parent, two); + expect(one.hasLeft, false); + expect(one.hasRight, false); + expect(one.balance, 0); + + expect(three.parent, two); + expect(three.hasLeft, false); + expect(three.hasRight, false); + expect(three.balance, 0); + + expect(two.hasParent, false); + expect(two.left, one); + expect(two.right, three); + expect(two.balance, 0); + }); + }); + + group('nearest search', () { + late TreeSet tree; + // setUp(() { + tree = TreeSet(comparator: (num left, num right) { + return left - right as int; + }) + ..addAll([300, 200, 100]); + // }); + + test('最近的', () { + var val = tree.nearest(199); + expect(val, 200); + val = tree.nearest(201); + expect(val, 200); + val = tree.nearest(150); + expect(val,100); + }); + + test('小于', () { + var val = tree.nearest(199, nearestOption: TreeSearch.LESS_THAN); + expect(val, 100); + }); + + test('大于', () { + var val = tree.nearest(101, nearestOption: TreeSearch.GREATER_THAN); + expect(val, 200); + }); + }); + }); +} +} \ No newline at end of file diff --git a/ohos/test_quiver/lib/src/collection/utils_test.dart b/ohos/test_quiver/lib/src/collection/utils_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..6ec7d8ddaaa741552f7018b0aa7a67ad79e90011 --- /dev/null +++ b/ohos/test_quiver/lib/src/collection/utils_test.dart @@ -0,0 +1,83 @@ +// Copyright 2013 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +library quiver.collection.utils_test; + +import 'dart:io'; + +import 'package:quiver/src/collection/utils.dart'; +import 'package:flutter/material.dart'; +import 'package:test_quiver/base/test_page.dart'; + +class CollectionUtilsTestPage extends TestPage { + CollectionUtilsTestPage(String title,{ Key? key}) : super(title: title, key: key) { + group('listsEqual', () { + test('对于相等列表,返回true', () { + expect(listsEqual(null, null), true); + expect(listsEqual([], []), true); + expect(listsEqual([1], [1]), true); + expect(listsEqual(['a', 'b'], ['a', 'b']), true); + }); + + test('对于不相等的列表,返回false', () { + expect(listsEqual(null, []), false); + expect(listsEqual([], null), false); + expect(listsEqual([1], [2]), false); + expect(listsEqual([1], []), false); + expect(listsEqual([], [1]), false); + }); + }); + + group('listMap', () { + test('对于相等的映射返回true', () { + expect(mapsEqual({}, {}), true); + expect(mapsEqual({'a': 1}, {'a': 1}), true); + }); + + test('对于不等映射,返回false', () { + expect(mapsEqual({'a': 1}, {'a': 2}), false); + expect(mapsEqual({'a': 1}, {'b': 1}), false); + expect(mapsEqual({'a': 1}, {'a': 1, 'b': 2}), false); + expect(mapsEqual({'a': 1, 'b': 2}, {'a': 1}), false); + }); + }); + + group('setsEqual', () { + test('对于相等集返回true', () { + expect(setsEqual({}, {}), true); + expect(setsEqual({1}, {1}), true); + expect(setsEqual({'a', 'b'}, {'a', 'b'}), true); + }); + + test('不相等集合返回false', () { + expect(setsEqual({1}, {2}), false); + expect(setsEqual({1}, {}), false); + expect(setsEqual({}, {1}), false); + }); + }); + + group('indexOf', () { + test('返回第一个匹配索引', () { + expect(indexOf([1, 12, 19, 20, 24], (n) => n % 2 == 0), 1); + expect(indexOf(['a', 'b', 'a'], (s) => s == 'a'), 0); + }); + + test('当没有匹配项时返回-1', () { + expect(indexOf([1, 3, 7], (n) => n % 2 == 0), -1); + expect(indexOf(['a', 'b'], (s) => s == 'e'), -1); + expect(indexOf([], (_) => true), -1); + }); + }); +} +} \ No newline at end of file diff --git a/ohos/test_quiver/lib/src/core/hash_test.dart b/ohos/test_quiver/lib/src/core/hash_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..8ca82b443de36b9b937cbc7ba6dcc6c25a1ef03f --- /dev/null +++ b/ohos/test_quiver/lib/src/core/hash_test.dart @@ -0,0 +1,56 @@ +// Copyright 2013 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +library quiver.core.hash_test; + +import 'dart:math'; + +import 'package:quiver/src/core/hash.dart'; +import 'package:flutter/material.dart'; +import 'package:test_quiver/base/test_page.dart'; + +class HashTestPage extends TestPage { + HashTestPage(String title,{ Key? key}) : super(title: title, key: key) { + test('hashObjects应返回int', () { + int h = hashObjects(['123', 456]); + expect(h,h); + h; + }); + + test('hashObjects应返回null', () { + int h = hashObjects(['123', null]); + h; + }); + + test('hashObjects应该处理所有为null的对象', () { + int h = hashObjects([null, null]); + h; + }); + + test('hash2应该返回一个int', () { + int h = hash2('123', 456); + h; + }); + + test('hash3应该返回一个int', () { + int h = hash3('123', 456, true); + h; + }); + + test('hash4应该返回一个int', () { + int h = hash4('123', 456, true, []); + h; + }); + } +} diff --git a/ohos/test_quiver/lib/src/core/optional_test.dart b/ohos/test_quiver/lib/src/core/optional_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..67a65ba1a20dd6378ececd916fb78fa4e1893fc1 --- /dev/null +++ b/ohos/test_quiver/lib/src/core/optional_test.dart @@ -0,0 +1,157 @@ +// Copyright 2013 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// ignore_for_file: deprecated_member_use_from_same_package +library quiver.core.optional_test; + +import 'package:quiver/src/core/optional.dart'; +import 'package:flutter/material.dart'; +import 'package:test_quiver/base/test_page.dart'; + +class OptionalTestPage extends TestPage { + OptionalTestPage(String title,{ Key? key}) : super(title: title, key: key) { + group('Optional', () { + test('absent不存在‘', () { + const Optional absent = Optional.absent(); + expect(absent.isPresent, false); + expect(absent.isNotPresent, true); + }); + + test('应存在并返回值', () { + Optional seven = Optional.of(7); + expect(seven.isPresent, true); + expect(seven.isNotPresent, false); + expect(seven.value, 7); + }); + + test('ifPresent应仅在存在时执行', () { + int? value; + Optional.of(7).ifPresent((v) { + value = v; + }); + expect(value, 7); + const Optional.absent().ifPresent((v) { + value = v; + }); + expect(value, 7); + }); + + test('sAbsent应仅在不存在时执行', () { + int? value; + Optional.of(7).ifAbsent(() { + value = 7; + }); + expect(value, null); + const Optional.absent().ifAbsent(() { + value = 7; + }); + expect(value, 7); + }); + + test('fromNullable应允许存在或不存在', () { + expect(const Optional.fromNullable(7).value, 7); + expect(const Optional.fromNullable(null).isPresent, false); + expect(const Optional.fromNullable(null).isNotPresent, true); + }); + + test('或应返回当前位置并替换缺席位置', () { + expect(Optional.of(7).or(13), 7); + expect(const Optional.fromNullable(null).or(13), 13); + }); + + test('orNull应返回值(如果存在)或null(如果不存在)', () { + expect(Optional.of(7).orNull, Optional.of(7) !=null); + expect(const Optional.fromNullable(null).orNull, null); + }); + + test('transform应返回转换后的值或不存在', () { + expect(Optional.of(7).transform((a) => a + 1), + Optional.of(8)); + expect( + const Optional.fromNullable(null) + .transform((a) => a + 1) + .isPresent, + false); + }); + + test('transformNullable应返回转换后的值或不存在', () { + expect(Optional.of(7).transformNullable((a) => a + 1), + Optional.of(8)); + expect( + const Optional.fromNullable(null) + .transformNullable((a) => a + 1) + .isPresent, + false); + }); + + test('如果转换后的值为null,transformNullable应返回不存在', + () { + String? maybeToString(int i) => null; + + expect(Optional.of(7).transformNullable(maybeToString).isPresent, + false); + }); + + test('hashCode应允许选项位于哈希集中', () { + expect( + { + Optional.of(7), + Optional.of(8), + const Optional.absent() + }, + { + Optional.of(7), + Optional.of(8), + const Optional.absent() + }); + expect({Optional.of(7), Optional.of(8)}, + {Optional.of(7), Optional.of(9)}); + }); + + test('==应按值进行比较', () { + expect(Optional.of(7), Optional.of(7)); + expect(const Optional.fromNullable(null), + const Optional.fromNullable(null)); + expect(const Optional.fromNullable(null), + const Optional.fromNullable(null)); + expect(const Optional.fromNullable(null), + Optional.of(7)); + expect(Optional.of(7), Optional.of(8)); + }); + + test('toString应显示值或不显示', () { + expect(Optional.of(7).toString(), 'Optional { value: 7 }'); + expect(const Optional.fromNullable(null).toString(), + 'Optional { absent }'); + }); + + test('不存在时的长度应返回0', () { + expect(const Optional.absent().length, 0); + }); + + test('存在时的长度应返回1', () { + expect(Optional.of(1).length, 1); + }); + + test('expand应该表现为等价的可迭代', () { + final optionals = >[ + Optional.of(1), + const Optional.absent(), + Optional.of(2) + ].expand((i) => i); + expect(optionals, [1, 2]); + }); + }); +} +} \ No newline at end of file diff --git a/ohos/test_quiver/lib/src/core/utils_test.dart b/ohos/test_quiver/lib/src/core/utils_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..f774c6a924f4d170972e56df0486075d100eebc4 --- /dev/null +++ b/ohos/test_quiver/lib/src/core/utils_test.dart @@ -0,0 +1,31 @@ +library quiver.core.utils_test; + +import 'package:quiver/src/core/utils.dart'; +import 'package:flutter/material.dart'; +import 'package:test_quiver/base/test_page.dart'; + +class UtilsTestPage extends TestPage { + UtilsTestPage(String title,{ Key? key}) : super(title: title, key: key) { + group('firstNonNull', () { + test('如果第一个参数不为null,则应返回该参数', () { + expect(firstNonNull(1, 2), 1); + }); + + test('如果第二个参数不为null,则应返回该参数', () { + expect(firstNonNull(null, 2), 2); + }); + + test('如果第三个参数不为null,则应返回该参数', () { + expect(firstNonNull(null, null, 3), 3); + }); + + test('如果第四个参数不为null,则应返回该参数', () { + expect(firstNonNull(null, null, null, 4), 4); + }); + + test('如果所有参数都为null,则应抛出', () { + firstNonNull(null, null, null, null); + }); + }); + } +} diff --git a/ohos/test_quiver/lib/src/iterables/concat_test.dart b/ohos/test_quiver/lib/src/iterables/concat_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..5187b640274914a9d42e9adf62f57d2fdf8367f4 --- /dev/null +++ b/ohos/test_quiver/lib/src/iterables/concat_test.dart @@ -0,0 +1,56 @@ +// Copyright 2013 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +library quiver.iterables.concat_test; + +import 'package:quiver/src/iterables/concat.dart'; +import 'package:flutter/material.dart'; +import 'package:test_quiver/base/test_page.dart'; + +class IterablesConcatTestPage extends TestPage { + IterablesConcatTestPage(String title,{ Key? key}) : super(title: title, key: key) { + group('concat', () { + test('应该处理空的输入 iterables', () { + expect(concat([]), []); + }); + + test('应处理单个输入iterables', () { + expect( + concat([ + [1, 2, 3] + ]), + [1, 2, 3]); + }); + + test('应链接多个输入', () { + expect( + concat([ + [1, 2, 3], + [-1, -2, -3] + ]), + [1, 2, 3, -1, -2, -3]); + }); + + test('应反映输入的变化', () { + var a = [1, 2]; + var b = [4, 5]; + var ab = concat([a, b]); + expect(ab, [1, 2, 4, 5]); + a.add(3); + b.add(6); + expect(ab, [1, 2, 3, 4, 5, 6]); + }); + }); +} +} \ No newline at end of file diff --git a/ohos/test_quiver/lib/src/iterables/count_test.dart b/ohos/test_quiver/lib/src/iterables/count_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..d8c5eca335ae9e6ec1637b9248ae453d88180a25 --- /dev/null +++ b/ohos/test_quiver/lib/src/iterables/count_test.dart @@ -0,0 +1,42 @@ +// Copyright 2013 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +library quiver.iterables.count_test; + +import 'package:quiver/src/iterables/count.dart'; +import 'package:flutter/material.dart'; +import 'package:test_quiver/base/test_page.dart'; + +class CountTestPage extends TestPage { + CountTestPage(String title,{ Key? key}) : super(title: title, key: key) { + group('count', () { + test('应在没有参数的情况下创建从0开始的无限序列', () { + expect(count().first, 0); + expect(count().take(5), [0, 1, 2, 3, 4]); + }); + + test('应该从开始创建一个无限序列', () { + expect(count(3).first, 3); + expect(count(3).take(5), [3, 4, 5, 6, 7]); + }); + + test('应该一步一步创建一个无限序列', () { + expect(count(3, 2).first, 3); + expect(count(3, 2).take(5), [3, 5, 7, 9, 11]); + expect(count(3.5, 2).first, 3.5); + expect(count(3.5, .5).take(5), [3.5, 4, 4.5, 5, 5.5]); + }); + }); +} +} \ No newline at end of file diff --git a/ohos/test_quiver/lib/src/iterables/cycle_test.dart b/ohos/test_quiver/lib/src/iterables/cycle_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..025bb9d4b3d82e26914480be4376c0c105126f36 --- /dev/null +++ b/ohos/test_quiver/lib/src/iterables/cycle_test.dart @@ -0,0 +1,37 @@ +// Copyright 2013 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +library quiver.iterables.cycle_test; + +import 'package:quiver/src/iterables/cycle.dart'; +import 'package:flutter/material.dart'; +import 'package:test_quiver/base/test_page.dart'; + +class CycleTestPage extends TestPage { + CycleTestPage(String title,{ Key? key}) : super(title: title, key: key) { + group('cycle', () { + test('应在给定一个空的可迭代项的情况下创建一个空iterable', () { + expect(cycle([]), []); + expect(cycle([]).isEmpty, true); + expect(cycle([]).isNotEmpty, false); + }); + + test('应该循环', () { + expect(cycle([1, 2, 3]).take(7), [1, 2, 3, 1, 2, 3, 1]); + expect(cycle([1, 2, 3]).isEmpty, false); + expect(cycle([1, 2, 3]).isNotEmpty, true); + }); + }); +} +} \ No newline at end of file diff --git a/ohos/test_quiver/lib/src/iterables/enumerate_test.dart b/ohos/test_quiver/lib/src/iterables/enumerate_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..414a69b792e05fddeee7bf2936ef6e90e304b8dd --- /dev/null +++ b/ohos/test_quiver/lib/src/iterables/enumerate_test.dart @@ -0,0 +1,87 @@ +// Copyright 2013 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +library quiver.iterables.enumerate_test; + +import 'package:quiver/src/iterables/enumerate.dart'; +import 'package:flutter/material.dart'; +import 'package:test_quiver/base/test_page.dart'; + +class IterablesEnumerateTestPage extends TestPage { + IterablesEnumerateTestPage(String title,{ Key? key}) : super(title: title, key: key) { + group('enumerate', () { + test('应该在其参数中添加索引', () { + var e = enumerate(['a', 'b', 'c']); + expect(e.map((v) => v.index), [0, 1, 2]); + expect(e.map((v) => v.value), ['a', 'b', 'c']); + }); + + test('应该返回一个空的可迭代项,给定一个空 iterable', () { + expect(enumerate([]), []); + }); + + test('应为其参数添加索引', () { + var e = enumerate(['a', 'b', 'c']); + expect(e.map((v) => v.index), [0, 1, 2]); + expect(e.map((v) => v.index), [0, 1, 2] + ); + }); + + test('first', () { + var e = enumerate(['a', 'b', 'c']); + expect(e.first.value, 'a'); + expect(e.first.index, 0); + expect(e.first.value, 'a'); + }); + + test('last', () { + var e = enumerate(['a', 'b', 'c']); + expect(e.last.value, 'c'); + expect(e.last.index, 2); + expect(e.last.value, 'c'); + }); + + test('single', () { + var e = enumerate(['a']); + expect(e.single.value, 'a'); + expect(e.single.index, 0); + expect(e.single.value, 'a'); + }); + + test('length', () { + expect(enumerate([7, 8, 9]).length, 3); + }); + + test('elementAt', () { + var list = ['a', 'b', 'c']; + var e = enumerate(list); + for (int i = 2; i >= 0; i--) { + expect(e.elementAt(i).value, list[i]); + expect(e.elementAt(i).index, i); + } + }); + + test('equals and hashcode', () { + var list = ['a', 'b', 'c']; + var e1 = enumerate(list); + var e2 = enumerate(list); + for (int i = 0; i < 2; i++) { + expect(e1.elementAt(i), e2.elementAt(i)); + expect(e1.elementAt(i).hashCode, e1.elementAt(i).hashCode); + expect(identical(e1.elementAt(i), e2.elementAt(i)), false); + } + }); + }); +} +} \ No newline at end of file diff --git a/ohos/test_quiver/lib/src/iterables/generating_iterable_test.dart b/ohos/test_quiver/lib/src/iterables/generating_iterable_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..c026710846584a8ba8aa79fe6048d535d2d2f5b8 --- /dev/null +++ b/ohos/test_quiver/lib/src/iterables/generating_iterable_test.dart @@ -0,0 +1,45 @@ +// Copyright 2013 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +library quiver.iterables.property_iterable_test; + +import 'package:quiver/src/iterables/generating_iterable.dart'; +import 'package:flutter/material.dart'; +import 'package:test_quiver/base/test_page.dart'; + +class GeneratingIterableTestPage extends TestPage { + GeneratingIterableTestPage(String title,{ Key? key}) : super(title: title, key: key) { + group('GeneratingIterable', () { + test('应该为null开始对象创建一个空的Iterable', () { + var iterable = GeneratingIterable(() => null, (n) => null); + expect(iterable, []); + }); + + test('当next返回null时,应创建一个空Iterable', () { + var iterable = GeneratingIterable(() => 'Hello', (n) => null); + expect(iterable, ['Hello']); + }); + + test('应添加项目,直到next返回null', () { + var parent = Node(); + var node = Node()..parent = parent; + var iterable = GeneratingIterable(() => node, (n) => n.parent); + expect(iterable, [node, parent]); + }); + }); +} +} +class Node { + Node? parent; +} diff --git a/ohos/test_quiver/lib/src/iterables/infinite_iterable_test.dart b/ohos/test_quiver/lib/src/iterables/infinite_iterable_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..e8bc1047b64f5ac7c6b7227b548b62ee56cdbf74 --- /dev/null +++ b/ohos/test_quiver/lib/src/iterables/infinite_iterable_test.dart @@ -0,0 +1,101 @@ +import 'package:quiver/src/iterables/infinite_iterable.dart'; +import 'package:flutter/material.dart'; + +import '../../base/test_page.dart'; + +class NaturalNumberIterable extends InfiniteIterable { + @override + final iterator = NaturalNumberIterator(); +} + +class NaturalNumberIterator implements Iterator { + int _current = -1; + + @override + int get current => _current; + + @override + bool moveNext() { + ++_current; + return true; + } +} + +class InfiniteIterablePage extends TestPage { + InfiniteIterablePage(String title, {Key? key}) + : super(title: title, key: key) { + NaturalNumberIterable it = NaturalNumberIterable(); + test('isEmpty should be false', () { + expect(it.isEmpty, false); + }); + + test('isNotEmpty should be true', () { + expect(it.isNotEmpty, true); + }); + + test('single should throw StateError,此处应为x', () { + it.single; + }); + + test('last should throw UnsupportedError,此处应为x', () { + it.last; + }); + + test('length should throw UnsupportedError,此处应为x', () { + it.length; + }); + + test('every should throw UnsupportedError,此处应为x', () { + bool yes(int x) => true; + it.every(yes); + }); + + test('fold should throw UnsupportedError,此处应为x', () { + it.fold(0, (__, ___) => 0); + }); + + test('forEach should throw UnsupportedError,此处应为x', () { + void nop(int x) {} + it.forEach(nop); + }); + + test('join should throw UnsupportedError,此处应为x', () { + it.join(); + }); + + test('lastWhere should throw UnsupportedError,此处应为x', () { + it.lastWhere((_) => true); + }); + + test('reduce should throw UnsupportedError,此处应为x', () { + it.reduce((_, __) => 0); + }); + + test('toList should throw UnsupportedError,此处应为x', () { + it.toList(); + }); + + test('toSet should throw UnsupportedError,此处应为x', () { + it.toSet(); + }); + + test('first should return a value', () { + expect(it.first, 0); + }); + + + test('contains should return', () { + expect(it.contains(2), true); + }); + + test('skip should return', () { + final skipped = it.skip(3); + expect(skipped.first, 3); + }); + + test('take should return', () { + final taken = it.take(3); + expect(taken, [0, 1, 2]); + }); + } +} diff --git a/ohos/test_quiver/lib/src/iterables/merge_test.dart b/ohos/test_quiver/lib/src/iterables/merge_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..b4b975fc749fa6b44a9ad967134b102f04387dd3 --- /dev/null +++ b/ohos/test_quiver/lib/src/iterables/merge_test.dart @@ -0,0 +1,104 @@ +// Copyright 2013 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +library quiver.iterables.merge_test; + +import 'package:quiver/src/iterables/merge.dart'; +import 'package:quiver/src/iterables/min_max.dart'; +import 'package:flutter/material.dart'; +import 'package:test_quiver/base/test_page.dart'; + +class MergeTestPage extends TestPage { + MergeTestPage(String title,{ Key? key}) : super(title: title, key: key) { + group('merge', () { + test('应将无可迭代项合并为空 iterable', () { + expect(merge([]), []); + }); + + test('应将空的可迭代项合并为空的iterables', () { + expect(merge([[]]), []); + expect(merge([[], []]), []); + expect(merge([[], [], []]), []); + for (int i = 4; i <= 10; i++) { + expect(merge(List.filled(i, const [])), []); + } + }); + + test('应该合并单个元素的 iterables', () { + expect( + merge([ + ['a'], + ['b'] + ]), + ['a', 'b']); + }); + + test('应输出两个iterables中元素的并集', () { + var a = ['a', 'b', 'c']; + expect(merge([a, a]), ['a', 'a', 'b', 'b', 'c', 'c']); + }); + + test('比较器可靠', () { + var a = ['c', 'b', 'a']; + expect(merge([a, a], (String x, String y) => -x.compareTo(y)), + ['c', 'c', 'b', 'b', 'a', 'a']); + }); + + test('应该将空的iterables与非空的可重复项合并', () { + var a = ['a', 'b', 'c']; + expect(merge([a, []]), ['a', 'b', 'c']); + expect(merge([[], a]), ['a', 'b', 'c']); + }); + + test('应处理 zig-zag case', () { + var a = ['a', 'a', 'd', 'f']; + var b = ['b', 'c', 'g', 'g']; + expect(merge([a, b]), ['a', 'a', 'b', 'c', 'd', 'f', 'g', 'g']); + }); + + test('应处理最大值(a)<最小值(b)的情况', () { + var a = ['a', 'b']; + var b = ['c', 'd']; + expect(max(a)!.compareTo(min(b)!) < 0, true); // test the test + expect(merge([a, b]), ['a', 'b', 'c', 'd']); + }); + + test('应处理三向 zig-zag case', () { + var a = ['a', 'd', 'g', 'j']; + var b = ['b', 'e', 'h', 'k']; + var c = ['c', 'f', 'i', 'l']; + var expected = [ + 'a', + 'b', + 'c', + 'd', + 'e', + 'f', + 'g', + 'h', + 'i', + 'j', + 'k', + 'l' + ]; + expect(merge([a, b, c]), expected); + expect(merge([a, c, b]), expected); + expect(merge([b, a, c]), expected); + expect(merge([b, c, a]), expected); + expect(merge([c, a, b]), expected); + expect(merge([c, b, a]), expected); + }); + }); +} +} \ No newline at end of file diff --git a/ohos/test_quiver/lib/src/iterables/min_max_test.dart b/ohos/test_quiver/lib/src/iterables/min_max_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..4fffcf7245c4c3f6e0d8f72ebe4ef6e9da937cbf --- /dev/null +++ b/ohos/test_quiver/lib/src/iterables/min_max_test.dart @@ -0,0 +1,63 @@ +// Copyright 2013 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +library quiver.iterables.min_max_test; + +import 'package:quiver/src/iterables/min_max.dart'; +import 'package:flutter/material.dart'; +import 'package:test_quiver/base/test_page.dart'; + +class MinMaxTestPage extends TestPage { + MinMaxTestPage(String title,{ Key? key}) : super(title: title, key: key) { + group('max', () { + test('应返回最大元素', () { + expect(max([2, 5, 1, 4]), 5); + }); + + test('如果可迭代项为空,则应返回null', () { + expect(max([]), null); + }); + }); + + group('min', () { + test('应返回最小元素', () { + expect(min([2, 5, 1, 4]), 1); + }); + + test('如果可迭代项为空,则应返回null', () { + expect(min([]), null); + }); + }); + + group('extent', () { + test('应返回max和min元素', () { + var ext = extent([2, 5, 1, 4]); + expect(ext.min, 1); + expect(ext.max, 5); + }); + + test('应返回单个元素', () { + var ext = extent([2]); + expect(ext.min, 2); + expect(ext.max, 2); + }); + + test('如果可迭代项为空,则应返回null', () { + var ext = extent([]); + expect(ext.min, null); + expect(ext.max, null); + }); + }); +} +} \ No newline at end of file diff --git a/ohos/test_quiver/lib/src/iterables/partition_test.dart b/ohos/test_quiver/lib/src/iterables/partition_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..d90243c4c1de784816d50829ec6b9aefedbb7bd0 --- /dev/null +++ b/ohos/test_quiver/lib/src/iterables/partition_test.dart @@ -0,0 +1,59 @@ +// Copyright 2013 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +library quiver.iterables.partition_test; + +import 'package:quiver/src/iterables/partition.dart'; +import 'package:flutter/material.dart'; +import 'package:test_quiver/base/test_page.dart'; +import 'package:matcher/src/expect/throws_matcher.dart'; + +class PartitionTestPage extends TestPage { + PartitionTestPage(String title,{ Key? key}) : super(title: title, key: key) { + group('partition', () { + test('当大小小于等于0时应抛出', () { + partition([1, 2, 3], 0); + partition([1, 2, 3], -1); + }); + + test('应为可迭代的空输入返回一个空列表', () { + expect(partition([], 5), []); + }); + + test('如果分区大小<输入大小,则应返回一个分区', () { + var it = partition([1, 2, 3], 5).iterator; + expect(it.moveNext(), true); + expect(it.current, [1, 2, 3]); + expect(it.moveNext(), false); + }); + + test('如果分区大小==输入大小,则应返回一个分区', () { + var it = partition([1, 2, 3, 4, 5], 5).iterator; + expect(it.moveNext(), true); + expect(it.current, [1, 2, 3, 4, 5]); + expect(it.moveNext(), false); + }); + + test( + '如果分区大小>输入大小,则应返回正确大小的分区', () { + var it = partition([1, 2, 3, 4, 5], 3).iterator; + expect(it.moveNext(), true); + expect(it.current, [1, 2, 3]); + expect(it.moveNext(), true); + expect(it.current, [4, 5]); + expect(it.moveNext(), false); + }); + }); + } +} diff --git a/ohos/test_quiver/lib/src/iterables/range_test.dart b/ohos/test_quiver/lib/src/iterables/range_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..fbb6f21fe7eb828b792b8c4cbf620f17a7dc138c --- /dev/null +++ b/ohos/test_quiver/lib/src/iterables/range_test.dart @@ -0,0 +1,46 @@ +// Copyright 2013 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +library quiver.iterables.range_test; + +import 'package:quiver/src/iterables/range.dart'; +import 'package:flutter/material.dart'; +import 'package:test_quiver/base/test_page.dart'; + +class RangeTestPage extends TestPage { + RangeTestPage(String title,{ Key? key}) : super(title: title, key: key) { + group('range', () { + test('如果stop为0,则应创建一个空迭代器', () { + expect(range(0), []); + }); + + test('应创建一个从0到停止-1的序列', () { + expect(range(10), [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]); + }); + + test('应该在start_or_stop开始序列', () { + expect(range(1, 11), [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); + }); + + test('如果start和stop相等,则应创建一个空迭代器', () { + expect(range(1, 1), []); + }); + + test('应该循序渐进', () { + expect(range(0, 10, 2), [0, 2, 4, 6, 8]); + expect(range(0, 10, 3), [0, 3, 6, 9]); + }); + }); +} +} \ No newline at end of file diff --git a/ohos/test_quiver/lib/src/iterables/zip_test.dart b/ohos/test_quiver/lib/src/iterables/zip_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..b6c0d21beda7756a869657799e534d10795be54c --- /dev/null +++ b/ohos/test_quiver/lib/src/iterables/zip_test.dart @@ -0,0 +1,67 @@ +// Copyright 2013 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +library quiver.iterables.zip_test; + +import 'package:quiver/src/iterables/range.dart'; +import 'package:quiver/src/iterables/zip.dart'; +import 'package:flutter/material.dart'; +import 'package:test_quiver/base/test_page.dart'; + +class ZipTestPage extends TestPage { + ZipTestPage(String title,{ Key? key}) : super(title: title, key: key) { + group('zip', () { + test('如果没有给定可迭代项,则应创建一个空的可迭代项', () { + expect(zip([]), []); + }); + + test('应该压缩相等长度的列表', () { + expect( + zip([ + [1, 2, 3], + ['a', 'b', 'c'] + ]), + [ + [1, 'a'], + [2, 'b'], + [3, 'c'] + ]); + expect( + zip([ + [1, 2], + ['a', 'b'], + [2, 4] + ]), + [ + [1, 'a', 2], + [2, 'b', 4] + ]); + }); + + test('应停止在最短可迭代的末尾', () { + expect( + zip([ + [1, 2], + ['a', 'b'], + [] + ]), + []); + expect(zip([range(2), range(4)]), [ + [0, 0], + [1, 1] + ]); + }); + }); +} +} \ No newline at end of file diff --git a/ohos/test_quiver/lib/src/pattern/glob_test.dart b/ohos/test_quiver/lib/src/pattern/glob_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..23608691b19b0923ec9d08a75b67210c55e2fcec --- /dev/null +++ b/ohos/test_quiver/lib/src/pattern/glob_test.dart @@ -0,0 +1,75 @@ +// Copyright 2013 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +library quiver.patttern.glob_test; + +import 'package:quiver/pattern.dart'; +import 'package:flutter/material.dart'; +import 'package:test_quiver/base/test_page.dart'; + +class GlobTestPage extends TestPage { + GlobTestPage(String title,{ Key? key}) : super(title: title, key: key) { + group('Glob', () { + test('应根据单词字符序列匹配“*”', () { + expectGlob('*.html', matches: [ + 'a.html', + '_-a.html', + r'^$*?.html', + '()[]{}.html', + '↭.html', + '\u21ad.html', + '♥.html', + '\u2665.html' + ], nonMatches: [ + 'a.htm', + 'a.htmlx', + '/a.html' + ]); + expectGlob('foo.*', + matches: ['foo.html'], + nonMatches: ['afoo.html', 'foo/a.html', 'foo.html/a']); + }); + + test('应将“**”与路径匹配', () { + expectGlob('**/*.html', + matches: ['/a.html', 'a/b.html', 'a/b/c.html', 'a/b/c.html/d.html'], + nonMatches: ['a.html', 'a/b.html/c']); + }); + + test('应该匹配“?”单个单词的字符', () { + expectGlob('a?', + matches: ['ab', 'a?', 'a↭', 'a\u21ad', 'a\\'], + nonMatches: ['a', 'abc']); + }); + }); +} +} + +void expectGlob(String pattern, + {List matches = const [], List nonMatches = const []}) { + var glob = Glob(pattern); + for (final str in matches) { + expect(glob.hasMatch(str), true); + expect(glob.allMatches(str).map((m) => m.input), [str]); + Match match = glob.matchAsPrefix(str)!; + expect(match.start, 0); + expect(match.end, str.length); + } + for (final str in nonMatches) { + expect(glob.hasMatch(str), false); + var m = List.from(glob.allMatches(str)); + expect(m.length, 0); + expect(glob.matchAsPrefix(str), null); + } +} diff --git a/ohos/test_quiver/lib/src/pattern/pattern_test.dart b/ohos/test_quiver/lib/src/pattern/pattern_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..dd1c7a80f9a289f9a7e41daa84d4afd3cb1bc690 --- /dev/null +++ b/ohos/test_quiver/lib/src/pattern/pattern_test.dart @@ -0,0 +1,82 @@ +// Copyright 2013 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +library quiver.pattern_test; + +import 'package:quiver/pattern.dart'; +import 'package:flutter/material.dart'; +import 'package:test_quiver/base/test_page.dart'; + +const _specialChars = r'\^$.|+[](){}'; + +class PatternTestPage extends TestPage { + PatternTestPage(String title,{ Key? key}) : super(title: title, key: key) { + group('escapeRegex', () { + test('应转义特殊字符', () { + for (final c in _specialChars.split('')) { + expect(escapeRegex(c), '\\$c'); + } + }); + }); + + group('matchesAny', () { + test('应匹配多个包含模式', () { + expectMatch(matchAny(['a', 'b']), 'a', 0, ['a']); + expectMatch(matchAny(['a', 'b']), 'b', 0, ['b']); + }); + + test('应匹配多个包含模式(非零开始)', () { + expectMatch(matchAny(['a', 'b']), 'ba', 1, ['a']); + expectMatch(matchAny(['a', 'b']), 'aab', 2, ['b']); + }); + + test('应返回多个匹配项', () { + expectMatch(matchAny(['a', 'b']), 'ab', 0, ['a', 'b']); + }); + + test('应返回多个匹配项(非零开头)', () { + expectMatch(matchAny(['a', 'b', 'c']), 'cab', 1, ['a', 'b']); + }); + + test('应排除', () { + expectMatch( + matchAny(['foo', 'bar'], exclude: ['foobar']), 'foobar', 0, []); + }); + + test('应排除(非零起始)', () { + expectMatch( + matchAny(['foo', 'bar'], exclude: ['foobar']), 'xyfoobar', 2, []); + }); + }); + + group('matchesFull', () { + test('应与字符串匹配', () { + expect(matchesFull('abcd', 'abcd'), true); + expect(matchesFull(RegExp('a.*d'), 'abcd'), true); + }); + + test('对于部分匹配,应返回false', () { + expect(matchesFull('abc', 'abcd'), false); + expect(matchesFull('bcd', 'abcd'), false); + expect(matchesFull(RegExp('a.*c'), 'abcd'), false); + expect(matchesFull(RegExp('b.*d'), 'abcd'), false); + }); + }); +} +} + +void expectMatch(Pattern pattern, String str, int start, List matches) { + var actual = pattern.allMatches(str, start).map((m) => m.group(0)).toList(); + expect(actual, matches); +} diff --git a/ohos/test_quiver/lib/src/strings_test.dart b/ohos/test_quiver/lib/src/strings_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..60888df8b0eb07a4c80fb03638f01dac2fd16592 --- /dev/null +++ b/ohos/test_quiver/lib/src/strings_test.dart @@ -0,0 +1,219 @@ +// Copyright 2013 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +library quiver.strings; + +import 'package:quiver/strings.dart'; +import 'package:flutter/material.dart'; +import 'package:test_quiver/base/test_page.dart'; + +class StringsTestPage extends TestPage { + StringsTestPage(String title, {Key? key}) : super(title: title, key: key) { + group('isBlank', () { + test('应将null视为空白', () { + expect(isBlank(null), true); + }); + test('应该将空字符串视为空白', () { + expect(isBlank(''), true); + }); + test('应该将空白字符串视为空白', () { + expect(isBlank(' \n\t\r\f'), true); + }); + test('应该考虑非空白字符串而不是空白', () { + expect(isBlank('hello'), false); + }); + }); + + group('isNotBlank', () { + test('应将null视为空白', () { + expect(isNotBlank(null), false); + }); + test('应该将空字符串视为空白', () { + expect(isNotBlank(''), false); + }); + test('应该将空白字符串视为空白', () { + expect(isNotBlank(' \n\t\r\f'), false); + }); + test('应该考虑非空白字符串而不是空白', () { + expect(isNotBlank('hello'), true); + }); + }); + + group('isEmpty', () { + test('应将null视为空', () { + expect(isEmpty(null), true); + }); + test('应该将空字符串视为空', () { + expect(isEmpty(''), true); + }); + test('应考虑空白字符串不为空', () { + expect(isEmpty(' '), false); + }); + test('应将非空白字符串视为非空', () { + expect(isEmpty('hello'), false); + }); + }); + + group('isNotEmpty', () { + test('应将null视为空', () { + expect(isNotEmpty(null), false); + }); + test('应该将空字符串视为空', () { + expect(isNotEmpty(''), false); + }); + test('应考虑空白字符串不为空', () { + expect(isNotEmpty(' '), true); + }); + test('应将非空白字符串视为非空', () { + expect(isNotEmpty('hello'), true); + }); + }); + + group('isDigit', () { + test('对于标准数字应返回true', () { + for (var i = 0; i <= 9; i++) { + expect(isDigit('$i'.codeUnitAt(0)), true); + } + }); + test('对于非数字,应返回false', () { + expect(isDigit('a'.codeUnitAt(0)), false); + expect(isDigit(' '.codeUnitAt(0)), false); + expect(isDigit('%'.codeUnitAt(0)), false); + }); + }); + + group('loop', () { + // Forward direction test cases + test('应该像普通子字符串一样工作', () { + expect(loop('hello', 1, 3), 'el'); + }); + test('应该像正常子字符串完整字符串一样工作', () { + expect(loop('hello', 0, 5), 'hello'); + }); + test('应为圆形', () { + expect(loop('ldwor', -3, 2), 'world'); + }); + test('应该在多个循环上是圆形的', () { + expect(loop('ab', 0, 8), 'abababab'); + }); + test('在多个循环上应该是圆形的,从循环开始', () { + expect(loop('ab', 4, 12), 'abababab'); + }); + test('在中途开始的许多循环上应该是圆形的', () { + expect(loop('ab', 1, 9), 'babababa'); + }); + test('应该是圆形的,从中途循环开始', () { + expect(loop('ab', 5, 13), 'babababa'); + }); + test('应默认为字符串结尾', () { + expect(loop('hello', 3), 'lo'); + }); + test('应默认为负索引的字符串结尾', () { + expect(loop('/home/user/test.txt', -3), 'txt'); + }); + test('应默认为远负索引的字符串结尾', () { + expect(loop('ab', -5), 'b'); + }); + test('应处理片段中的子字符串循环,使其为负数', () { + expect(loop('hello', -4, -2), 'el'); + }); + test('应处理片段中的子字符串循环,使其为正数', () { + expect(loop('hello', 6, 8), 'el'); + }); + + // Backward direction test cases + test('应该向后遍历', () { + expect(loop('hello', 3, 0), 'leh'); + }); + test('应该向后穿过边界', () { + expect(loop('eholl', 2, -3), 'hello'); + }); + test('应该向后遍历许多循环', () { + expect(loop('ab', 0, -6), 'bababa'); + }); + + // Corner cases + test('应该空掷', () { + expect(() => loop('', 6, 8), 'no error'); + }); + }); + + group('center', () { + test('如果长度大于宽度,则应返回输入', () { + expect(center('abc', 2, '0'), 'abc'); + expect(center('abc', 3, '0'), 'abc'); + }); + + test('应在左右两侧填充相等的字符,以实现偶数填充计数', () { + expect(center('abc', 5, '0'), '0abc0'); + expect(center('abc', 9, '0'), '000abc000'); + }); + + test('应在右侧添加额外的字符以获得奇数填充量', () { + expect(center('abc', 4, '0'), 'abc0'); + expect(center('abc', 8, '0'), '00abc000'); + }); + + test('应使用多字符填充', () { + expect(center('abc', 7, '012345'), '01abc45'); + expect(center('abc', 6, '012345'), '0abc45'); + expect(center('abc', 9, '01'), '010abc101'); + }); + + test('应处理null和空输入', () { + expect(center(null, 4, '012345'), '0145'); + expect(center('', 4, '012345'), '0145'); + expect(center(null, 5, '012345'), '01345'); + expect(center('', 5, '012345'), '01345'); + }); + }); + + group('equalsIgnoreCase', () { + test('对于相等的字符串,应返回true', () { + expect(equalsIgnoreCase('abc', 'abc'), true); + }); + + test('对于大小写不敏感的相等字符串,应返回true', () { + expect(equalsIgnoreCase('abc', 'AbC'), true); + }); + + test('对于null应返回true', () { + expect(equalsIgnoreCase(null, null), true); + }); + + test('对于不相等的字符串,应返回false', () { + expect(equalsIgnoreCase('abc', 'bcd'), false); + }); + + test('如果其中一个为null,则应返回false', () { + expect(equalsIgnoreCase('abc', null), false); + expect(equalsIgnoreCase(null, 'abc'), false); + }); + }); + + group('compareIgnoreCase', () { + test('对于大小写不敏感的相等字符串,应返回0', () { + expect(compareIgnoreCase('abc', 'abc'), 0); + expect(compareIgnoreCase('abc', 'AbC'), 0); + }); + + test('should return compare unequal Strings correctly', () { + expect(compareIgnoreCase('abc', 'abd'), 0); + expect(compareIgnoreCase('abc', 'abD'), 0); + expect(compareIgnoreCase('abd', 'abc'), 0); + expect(compareIgnoreCase('abD', 'abc'), 0); + }); + }); + } +} diff --git a/ohos/test_quiver/lib/src/testing/async/fake_async_test.dart b/ohos/test_quiver/lib/src/testing/async/fake_async_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..3a9914f692abbbe44cbdb241366d67b65005551e --- /dev/null +++ b/ohos/test_quiver/lib/src/testing/async/fake_async_test.dart @@ -0,0 +1,658 @@ +// Copyright 2013 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +library quiver.testing.async.fake_async_test; + +import 'dart:async'; + +import 'package:quiver/testing/src/async/fake_async.dart'; +import 'package:flutter/material.dart'; +import 'package:test_quiver/base/test_page.dart'; +import 'package:matcher/src/expect/throws_matcher.dart'; + +class FakeAsyncTestPage extends TestPage { + FakeAsyncTestPage(String title, {Key? key}) : super(title: title, key: key) { + group('FakeAsync', () { + var initialTime = DateTime(2000); + var elapseBy = const Duration(days: 1); + + test('应设置初始时间', () { + expect(FakeAsync().getClock(initialTime).now(), initialTime); + }); + + group('elapseBlocking', () { + test('应该经过时间而不调用计时器', () { + var timerCalled = false; + var timer = Timer(elapseBy ~/ 2, () => timerCalled = true); + FakeAsync().elapseBlocking(elapseBy); + expect(timerCalled, false); + timer.cancel(); + }); + + test('应该经过指定的时间', () { + var it = FakeAsync(); + it.elapseBlocking(elapseBy); + expect(it.getClock(initialTime).now(), initialTime.add(elapseBy)); + }); + + test('当以负持续时间调用时应抛出', () { + FakeAsync().elapseBlocking(const Duration(days: -1)); + }); + }); + + group('elapse', () { + test('应该经过指定的时间', () { + FakeAsync().run((async) { + async.elapse(elapseBy); + expect( + async.getClock(initialTime).now(), initialTime.add(elapseBy)); + }); + }); + + test('当以负持续时间调用时应抛出ArgumentError', () { + FakeAsync().elapse(const Duration(days: -1)); + }); + + test('应在上一次调用完成之前调用时抛出', () { + FakeAsync().run((async) { + dynamic error; + Timer(elapseBy ~/ 2, () { + try { + async.elapse(elapseBy); + } catch (e) { + error = e; + } + }); + async.elapse(elapseBy); + error; + }); + }); + + group('when creating timers', () { + test('应调用在结束时间之前或结束时间到期的计时器', () { + FakeAsync().run((async) { + var beforeCallCount = 0; + var atCallCount = 0; + Timer(elapseBy ~/ 2, () { + beforeCallCount++; + }); + Timer(elapseBy, () { + atCallCount++; + }); + async.elapse(elapseBy); + expect(beforeCallCount, 1); + expect(atCallCount, 1); + }); + }); + + test('应该调用由于过期而过期的计时器阻止', () { + FakeAsync().run((async) { + bool secondaryCalled = false; + Timer(elapseBy, () { + async.elapseBlocking(elapseBy); + }); + Timer(elapseBy * 2, () { + secondaryCalled = true; + }); + async.elapse(elapseBy); + expect(secondaryCalled, true); + expect(async.getClock(initialTime).now(), + initialTime.add(elapseBy * 2)); + }); + }); + + test('应在计时器的预定时间呼叫计时器', () { + FakeAsync().run((async) { + DateTime? calledAt; + var periodicCalledAt = []; + Timer(elapseBy ~/ 2, () { + calledAt = async.getClock(initialTime).now(); + }); + Timer.periodic(elapseBy ~/ 2, (_) { + periodicCalledAt.add(async.getClock(initialTime).now()); + }); + async.elapse(elapseBy); + expect(calledAt, initialTime.add(elapseBy ~/ 2)); + expect(periodicCalledAt, + [elapseBy ~/ 2, elapseBy].map(initialTime.add)); + }); + }); + + test('不应调用在结束时间后过期的计时器', () { + FakeAsync().run((async) { + var timerCallCount = 0; + Timer(elapseBy * 2, () { + timerCallCount++; + }); + async.elapse(elapseBy); + expect(timerCallCount, 0); + }); + }); + + test('不应呼叫已取消的计时器', () { + FakeAsync().run((async) { + int timerCallCount = 0; + var timer = Timer(elapseBy ~/ 2, () { + timerCallCount++; + }); + timer.cancel(); + async.elapse(elapseBy); + expect(timerCallCount, 0); + }); + }); + + test('应在每次持续时间过后调用定期计时器', () { + FakeAsync().run((async) { + var periodicCallCount = 0; + Timer.periodic(elapseBy ~/ 10, (_) { + periodicCallCount++; + }); + async.elapse(elapseBy); + expect(periodicCallCount, 10); + }); + }); + + test('是否应按FIFO顺序同时调用计时器', () { + FakeAsync().run((async) { + var log = []; + Timer(elapseBy ~/ 2, () { + log.add('1'); + }); + Timer(elapseBy ~/ 2, () { + log.add('2'); + }); + async.elapse(elapseBy); + expect(log, ['1', '2']); + }); + }); + + test('即使使用定期定时器,也应保持FIFO顺序', () { + FakeAsync().run((async) { + var log = []; + Timer.periodic(elapseBy ~/ 2, (_) { + log.add('periodic 1'); + }); + Timer(elapseBy ~/ 2, () { + log.add('delayed 1'); + }); + Timer(elapseBy, () { + log.add('delayed 2'); + }); + Timer.periodic(elapseBy, (_) { + log.add('periodic 2'); + }); + async.elapse(elapseBy); + expect(log, [ + 'periodic 1', + 'delayed 1', + 'periodic 1', + 'delayed 2', + 'periodic 2' + ]); + }); + }); + + test('应该处理每个定时器周围的微任务', () { + FakeAsync().run((async) { + var microtaskCalls = 0; + var timerCalls = 0; + void scheduleMicrotasks() { + for (int i = 0; i < 5; i++) { + scheduleMicrotask(() => microtaskCalls++); + } + } + + scheduleMicrotasks(); + Timer.periodic(elapseBy ~/ 5, (_) { + timerCalls++; + expect(microtaskCalls, 5 * timerCalls); + scheduleMicrotasks(); + }); + async.elapse(elapseBy); + expect(timerCalls, 5); + expect(microtaskCalls, 5 * (timerCalls + 1)); + }); + }); + + test('应该将周期性计时器本身传递给回调', () { + FakeAsync().run((async) { + Timer? passedTimer; + Timer periodic = Timer.periodic(elapseBy, (timer) { + passedTimer = timer; + }); + async.elapse(elapseBy); + expect(periodic, passedTimer); + }); + }); + + test('应该在提前时间之前调用微任务', () { + FakeAsync().run((async) { + DateTime? calledAt; + scheduleMicrotask(() { + calledAt = async.getClock(initialTime).now(); + }); + async.elapse(const Duration(minutes: 1)); + expect(calledAt, initialTime); + }); + }); + + test('应在提前时间之前添加事件', () { + return Future(() => FakeAsync().run((async) { + var controller = StreamController(); + var ret = controller.stream.first.then((_) { + expect(async.getClock(initialTime).now(), initialTime); + }); + controller.add(null); + async.elapse(const Duration(minutes: 1)); + return ret; + })); + }); + + test('应将负持续时间计时器增加到零持续时间', () { + FakeAsync().run((async) { + var negativeDuration = const Duration(days: -1); + DateTime? calledAt; + Timer(negativeDuration, () { + calledAt = async.getClock(initialTime).now(); + }); + async.elapse(const Duration(minutes: 1)); + expect(calledAt, initialTime); + }); + }); + + test('不应与elapseBlocking相加', () { + FakeAsync().run((async) { + Timer(Duration.zero, () => async.elapseBlocking(elapseBy * 5)); + async.elapse(elapseBy); + expect(async.getClock(initialTime).now(), + initialTime.add(elapseBy * 5)); + }); + }); + + group('isActive', () { + test('计时器运行后应为false', () { + FakeAsync().run((async) { + var timer = Timer(elapseBy ~/ 2, () {}); + async.elapse(elapseBy); + expect(timer.isActive, false); + }); + }); + + test('运行定期计时器后应为true', () { + FakeAsync().run((async) { + var timer = Timer.periodic(elapseBy ~/ 2, (_) {}); + async.elapse(elapseBy); + expect(timer.isActive, true); + }); + }); + + test('取消计时器后应为false', () { + FakeAsync().run((async) { + var timer = Timer(elapseBy ~/ 2, () {}); + timer.cancel(); + expect(timer.isActive, false); + }); + }); + }); + + test('应该与新的Future()一起工作', () { + FakeAsync().run((async) { + var callCount = 0; + Future(() => callCount++); + async.elapse(Duration.zero); + expect(callCount, 1); + }); + }); + + test('应与Future.delayed合作', () { + FakeAsync().run((async) { + int? result; + Future.delayed(elapseBy, () => result = 5); + async.elapse(elapseBy); + expect(result, 5); + }); + }); + + test('应使用Future.timeout', () { + FakeAsync().run((async) { + var completer = Completer(); + TimeoutException? timeout; + completer.future.timeout(elapseBy ~/ 2).catchError((err) { + timeout = err; + }); + async.elapse(elapseBy); + timeout; + completer.complete(); + }); + }); + + test('应使用Stream.periodic', () { + FakeAsync().run((async) { + var events = []; + StreamSubscription subscription; + var periodic = + Stream.periodic(const Duration(minutes: 1), (i) => i); + subscription = periodic.listen(events.add); + async.elapse(const Duration(minutes: 3)); + expect(events, [0, 1, 2]); + subscription.cancel(); + }); + }); + + test('应使用Stream.timeout', () { + FakeAsync().run((async) { + var events = []; + var errors = []; + var controller = StreamController(); + var timed = controller.stream.timeout(const Duration(minutes: 2)); + var subscription = timed.listen(events.add, onError: errors.add); + controller.add(0); + async.elapse(const Duration(minutes: 1)); + expect(events, [0]); + async.elapse(const Duration(minutes: 1)); + expect(errors, 1); + expect(errors.first, errors.first != null); + subscription.cancel(); + controller.close(); + }); + }); + }); + }); + + group('flushMicrotasks', () { + test('应该刷新微任务', () { + FakeAsync().run((async) { + bool microtaskRan = false; + Future.microtask(() { + microtaskRan = true; + }); + expect(microtaskRan, false); + async.flushMicrotasks(); + expect(microtaskRan, true); + }); + }); + test('应该按顺序刷新由微任务调度的微任务', () { + FakeAsync().run((async) { + final log = []; + Future.microtask(() { + log.add(1); + Future.microtask(() { + log.add(3); + }); + }); + Future.microtask(() { + log.add(2); + }); + expect(log, 0); + async.flushMicrotasks(); + expect(log, [1, 2, 3]); + }); + }); + test('不应运行计时器', () { + FakeAsync().run((async) { + final log = []; + Future.microtask(() { + log.add(1); + }); + Future(() { + log.add(2); + }); + Timer.periodic(const Duration(seconds: 1), (_) { + log.add(2); + }); + async.flushMicrotasks(); + expect(log, [1]); + }); + }); + }); + + group('flushTimers', () { + test('应按FIFO顺序刷新计时器', () { + FakeAsync().run((async) { + final log = []; + Future(() { + log.add(1); + Future.delayed(elapseBy, () { + log.add(3); + }); + }); + Future(() { + log.add(2); + }); + expect(log, 0); + async.flushTimers( + timeout: elapseBy * 2, flushPeriodicTimers: false); + expect(log, [1, 2, 3]); + expect( + async.getClock(initialTime).now(), initialTime.add(elapseBy)); + }); + }); + + test('如果先安排,则应先运行非周期性的并行定期计时器', () { + FakeAsync().run((async) { + final log = []; + Future.delayed(const Duration(seconds: 2), () { + log.add('delayed'); + }); + Timer.periodic(const Duration(seconds: 1), (_) { + log.add('periodic'); + }); + expect(log, 0); + async.flushTimers(flushPeriodicTimers: false); + expect(log, ['periodic', 'delayed', 'periodic']); + }); + }); + + test('如果首先安排,则应运行具有周期性第一的并行定期计时器', () { + FakeAsync().run((async) { + final log = []; + Timer.periodic(const Duration(seconds: 1), (_) { + log.add('periodic'); + }); + Future.delayed(const Duration(seconds: 2), () { + log.add('delayed'); + }); + expect(log, 0); + async.flushTimers(flushPeriodicTimers: false); + expect(log, ['periodic', 'periodic', 'delayed']); + }); + }); + + test('应超时', () { + FakeAsync().run((async) { + int count = 0; + // Schedule 3 timers. All but the last one should fire. + for (final delay in [30, 60, 90]) { + Future.delayed(Duration(minutes: delay), () { + count++; + }); + } + async.flushTimers(flushPeriodicTimers: false); + expect(count, 2); + }); + }); + + test('应该使计时器链超时', () { + FakeAsync().run((async) { + int count = 0; + void createTimer() { + Future.delayed(const Duration(minutes: 30), () { + count++; + createTimer(); + }); + } + + createTimer(); + async.flushTimers( + timeout: const Duration(hours: 2), flushPeriodicTimers: false); + + expect(count, 4); + }); + }); + + test('应使定期计时器超时', () { + FakeAsync().run((async) { + int count = 0; + Timer.periodic(const Duration(minutes: 30), (Timer timer) { + count++; + }); + async.flushTimers(timeout: const Duration(hours: 1)); + + expect(count, 2); + }); + }); + + test('应该刷新定期计时器', () { + FakeAsync().run((async) { + int count = 0; + Timer.periodic(const Duration(minutes: 30), (Timer timer) { + if (count == 3) { + timer.cancel(); + } + count++; + }); + async.flushTimers(timeout: const Duration(hours: 20)); + expect(count, 4); + }); + }); + + test('应将绝对超时计算为已用超时+超时', () { + FakeAsync().run((async) { + final log = []; + int count = 0; + void createTimer() { + Future.delayed(const Duration(minutes: 30), () { + log.add(count); + count++; + if (count < 4) { + createTimer(); + } + }); + } + + createTimer(); + async.elapse(const Duration(hours: 1)); + async.flushTimers(timeout: const Duration(hours: 1)); + expect(count, 4); + }); + }); + }); + + group('stats', () { + test('应报告挂起的微任务数', () { + FakeAsync().run((async) { + expect(async.microtaskCount, 0); + scheduleMicrotask(() {}); + expect(async.microtaskCount, 1); + scheduleMicrotask(() {}); + expect(async.microtaskCount, 2); + async.flushMicrotasks(); + expect(async.microtaskCount, 0); + }); + }); + + test('应报告挂起的定期计时器的数量', () { + FakeAsync().run((async) { + expect(async.periodicTimerCount, 0); + Timer timer = + Timer.periodic(const Duration(minutes: 30), (Timer timer) {}); + expect(async.periodicTimerCount, 1); + Timer.periodic(const Duration(minutes: 20), (Timer timer) {}); + expect(async.periodicTimerCount, 2); + async.elapse(const Duration(minutes: 20)); + expect(async.periodicTimerCount, 2); + timer.cancel(); + expect(async.periodicTimerCount, 1); + }); + }); + + test('应报告挂起的非周期性计时器的数量', () { + FakeAsync().run((async) { + expect(async.nonPeriodicTimerCount, 0); + Timer timer = Timer(const Duration(minutes: 30), () {}); + expect(async.nonPeriodicTimerCount, 1); + Timer(const Duration(minutes: 20), () {}); + expect(async.nonPeriodicTimerCount, 2); + async.elapse(const Duration(minutes: 25)); + expect(async.nonPeriodicTimerCount, 1); + timer.cancel(); + expect(async.nonPeriodicTimerCount, 0); + }); + }); + + test('应报告挂起计时器的调试信息', () { + FakeAsync().run((async) { + expect(async.pendingTimersDebugInfo, []); + // Use `dynamic` to subvert the type checks and access `_FakeAsync` + // internals. + dynamic nonPeriodic = Timer(const Duration(seconds: 1), () {}); + dynamic periodic = + Timer.periodic(const Duration(seconds: 2), (Timer timer) {}); + final debugInfo = async.pendingTimersDebugInfo; + expect(debugInfo.length, 2); + expect( + debugInfo, + debugInfo.contains([ + nonPeriodic.debugInfo, + periodic.debugInfo, + ]), + ); + + // Substrings expected to be included in the first line of + // [Timer.debugInfo]. + final expectedInFirstLine = { + nonPeriodic: [':01.0', 'periodic: false'], + periodic: [':02.0', 'periodic: true'], + }; + + const thisFileName = 'fake_async_test.dart'; + for (final expectedEntry in expectedInFirstLine.entries) { + final debugInfo = expectedEntry.key.debugInfo; + final firstLineEnd = debugInfo.indexOf('\n'); + final firstLine = debugInfo.substring(0, firstLineEnd); + final rest = debugInfo.substring(firstLineEnd + 1); + + for (final expectedValue in expectedEntry.value) { + expect(firstLine, firstLine.contains(expectedValue)); + } + + expect(rest, rest.contains(thisFileName)); + } + }); + }); + }); + + group('timers', () { + test('应该像真实时间一样', () { + return FakeAsync().run((async) { + var timeout = const Duration(minutes: 1); + int counter = 0; + late Timer timer; + timer = Timer(timeout, () { + counter++; + expect( + timer.isActive, + false, + ); + }); + expect(timer.isActive, true); + async.elapse(timeout); + expect(counter, 1); + expect(timer.isActive, false); + }); + }); + }); + }); + } +} diff --git a/ohos/test_quiver/lib/src/testing/equality/equality_test.dart b/ohos/test_quiver/lib/src/testing/equality/equality_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..392b783d490ef696b805228b3ad7c6c7f2834fdc --- /dev/null +++ b/ohos/test_quiver/lib/src/testing/equality/equality_test.dart @@ -0,0 +1,396 @@ +// Copyright 2013 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the 'License'); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an 'AS IS' BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +library quiver.testing.util.equalstester; + +import 'package:quiver/testing/src/equality/equality.dart'; +import 'package:flutter/material.dart'; +import 'package:test_quiver/base/test_page.dart'; + +class EqualityTestPage extends TestPage { + EqualityTestPage(String title,{ Key? key}) : super(title: title, key: key) { + group('expectEquals', () { + late _ValidTestObject reference; + late _ValidTestObject equalObject1; + late _ValidTestObject equalObject2; + late _ValidTestObject notEqualObject1; + + // setUp(() { + reference = _ValidTestObject(1, 2); + equalObject1 = _ValidTestObject(1, 2); + equalObject2 = _ValidTestObject(1, 2); + notEqualObject1 = _ValidTestObject(0, 2); + // }); + + test('测试空引用产生错误', () { + try { + expect(null, areEqualityGroups); + fail('Should fail with null reference'); + } catch (e) { + expect(e.toString(), e.toString().contains('Equality Group must not be null')); + } + }); + + test('测试null组名称产生错误', () { + try { + expect({ + 'null': [reference], + null: [reference] + }, areEqualityGroups); + fail('Should fail with null group name'); + } catch (e) { + expect(e.toString(),e.toString().contains('Group name must not be null')); + } + }); + + test('测试null组产生错误', () { + try { + expect({'bad group': null}, areEqualityGroups); + fail('Should fail with null group'); + } catch (e) { + expect(e.toString(), e.toString().contains('Group must not be null')); + } + }); + + test('使用null同时添加多个实例后进行测试', () { + try { + expect({ + 'bad group': [reference, equalObject1, null] + }, areEqualityGroups); + fail('Should fail with null group'); + } catch (e) { + expect( + e.toString(), + e.toString().contains("$reference [group 'bad group', item 1]" + " must be equal to null [group 'bad group', item 3]")); + } + }); + + test('测试仅在单个组中添加不相等的对象', () { + try { + expect({ + 'not equal': [equalObject1, notEqualObject1] + }, areEqualityGroups); + fail('Should get not equal to equal object error'); + } catch (e) { + expect( + e.toString(), + e.toString().contains("$equalObject1 [group 'not equal', item" + " 1] must be equal to $notEqualObject1 [group 'not equal'" + ', item 2]')); + } + }); + + test( + '不使用等于或不等于对象进行测试。这将检查是否正确处理null、不兼容类和自反测试', () { + expect({ + 'single object': [reference] + }, areEqualityGroups); + }); + + test( + '填充相等对象后进行测试。这将检查平等的正确处理,并验证有效对象的hashCode', () { + expect({ + 'all equal': [reference, equalObject1, equalObject2] + }, areEqualityGroups); + }); + + test('测试对象与自身不相等的情况下的正确处理', + () { + Object obj = _NonReflexiveObject(); + try { + expect({ + 'non-reflexive': [obj] + }, areEqualityGroups); + fail('Should get non-reflexive error'); + } catch (e) { + expect(e.toString(), e.toString().contains('$obj must be equal to itself')); + } + }); + + test('测试哈希代码不是幂等的情况的正确处理', () { + Object obj = _InconsistentHashCodeObject(1, 2); + try { + expect({ + 'non-reflexive': [obj] + }, areEqualityGroups); + fail('Should get non-reflexive error'); + } catch (e) { + expect( + e.toString(), + e.toString().contains( + 'the implementation of hashCode of $obj must be idempotent')); + } + }); + + test( + '测试对象错误地测试不兼容类的正确处理', () { + Object obj = _InvalidEqualsIncompatibleClassObject(); + try { + expect({ + 'equals method broken': [obj] + }, areEqualityGroups); + fail('Should get equal to incompatible class error'); + } catch (e) { + expect( + e.toString(), + e.toString().contains('$obj must not be equal to an ' + 'arbitrary object of another class')); + } + }); + + test( + '测试对象与用户所说的应该相等的对象不相等时的正确处理', () { + try { + expect({ + 'non-equal': [reference, notEqualObject1] + }, areEqualityGroups); + fail('Should get not equal to equal object error'); + } catch (e) { + expect( + e.toString(), e.toString().contains("$reference [group 'non-equal', item 1]")); + expect(e.toString(), + e.toString().contains("$notEqualObject1 [group 'non-equal', item 2]")); + } + }); + + test( + '测试无效的hashCode方法,即根据equals方法为相等的对象返回不同值的方法', () { + Object a = _InvalidHashCodeObject(1, 2); + Object b = _InvalidHashCodeObject(1, 2); + try { + expect({ + 'invalid hashcode': [a, b] + }, areEqualityGroups); + fail('Should get invalid hashCode error'); + } catch (e) { + expect( + e.toString(), + e.toString().contains('the hashCode (${a.hashCode}) of $a' + " [group 'invalid hashcode', item 1] must be equal to the" + ' hashCode (${b.hashCode}) of $b')); + } + }); + + test('对称', () { + try { + expect({ + 'broken symmetry': [ + _named('foo')..addPeers(['bar']), + _named('bar') + ] + }, areEqualityGroups); + fail('should fail because symmetry is broken'); + } catch (e) { + expect( + e.toString(), + e.toString().contains("bar [group 'broken symmetry', item 2] " + "must be equal to foo [group 'broken symmetry', item 1]")); + } + }); + + test('传递性在EqualityGroup中断开', () { + try { + expect({ + 'transitivity broken': [ + _named('foo')..addPeers(['bar', 'baz']), + _named('bar')..addPeers(['foo']), + _named('baz')..addPeers(['foo']) + ] + }, areEqualityGroups); + fail('should fail because transitivity is broken'); + } catch (e) { + expect( + e.toString(), + e.toString().contains("bar [group 'transitivity broken', " + "item 2] must be equal to baz [group 'transitivity " + "broken', item 3]")); + } + }); + + test('EqualityGroup中的不相等对象', () { + try { + expect({ + 'unequal objects': [_named('foo'), _named('bar')] + }, areEqualityGroups); + fail('should fail because of unequal objects in the same equality ' + 'group'); + } catch (e) { + expect( + e.toString(), + e.toString().contains("foo [group 'unequal objects', item 1] " + "must be equal to bar [group 'unequal objects', item 2]")); + } + }); + + test('跨均衡组的传递性中断', () { + try { + expect({ + 'transitivity one': [ + _named('foo')..addPeers(['bar']), + _named('bar')..addPeers(['foo', 'x']) + ], + 'transitivity two': [ + _named('baz')..addPeers(['x']), + _named('x')..addPeers(['baz', 'bar']) + ] + }, areEqualityGroups); + fail('should fail because transitivity is broken'); + } catch (e) { + expect( + e.toString(), + e.toString().contains("bar [group 'transitivity one', item 2]" + " must not be equal to x [group 'transitivity two'," + ' item 2]')); + } + }); + + test('均衡器组', () { + expect({ + 'valid groups one': [ + _named('foo')..addPeers(['bar']), + _named('bar')..addPeers(['foo']) + ], + 'valid groups two': [_named('baz'), _named('baz')] + }, areEqualityGroups); + }); + }); +} +} +/// Test class that violates reflexitivity. It is not equal to itself. +class _NonReflexiveObject { + @override + bool operator ==(Object o) => false; + + @override + int get hashCode => 0; +} + +/// Test class with valid equals and hashCode methods. Testers created +/// with instances of this class should always pass. +class _ValidTestObject { + _ValidTestObject(this.aspect1, this.aspect2); + + int aspect1; + int aspect2; + + @override + bool operator ==(Object o) { + if (o is! _ValidTestObject) { + return false; + } + final _ValidTestObject other = o; + if (aspect1 != other.aspect1) { + return false; + } + if (aspect2 != other.aspect2) { + return false; + } + return true; + } + + @override + int get hashCode { + int result = 17; + result = 37 * result + aspect1; + result = 37 * result + aspect2; + return result; + } +} + +///Test class that returns true even if the test object is of the wrong class. +class _InvalidEqualsIncompatibleClassObject { + @override + bool operator ==(Object o) { + return true; + } + + @override + int get hashCode => 0; +} + +/// Test class with inconsistent hashCode method. +class _InconsistentHashCodeObject { + _InconsistentHashCodeObject(this._aspect1, this._aspect2); + + final int _aspect1; + final int _aspect2; + int _hashCode = 0; + + @override + int get hashCode => _hashCode++; + + @override + bool operator ==(Object o) { + if (o is! _InconsistentHashCodeObject) { + return false; + } + final _InconsistentHashCodeObject other = o; + if (_aspect1 != other._aspect1) return false; + if (_aspect2 != other._aspect2) return false; + return true; + } +} + +/// Test class with invalid hashCode method. +class _InvalidHashCodeObject { + _InvalidHashCodeObject(this._aspect1, this._aspect2); + + static int hashCodeSource = 0; + final int _aspect1; + final int _aspect2; + final int _hashCode = hashCodeSource++; + + @override + int get hashCode => _hashCode; + + @override + bool operator ==(Object o) { + if (o is! _InvalidHashCodeObject) { + return false; + } + final _InvalidHashCodeObject other = o; + if (_aspect1 != other._aspect1) return false; + if (_aspect2 != other._aspect2) return false; + return true; + } +} + +_NamedObject _named(String name) => _NamedObject(name); + +class _NamedObject { + _NamedObject(this.name); + + final Set peerNames = {}; + final String name; + + void addPeers(List names) { + peerNames.addAll(names); + } + + @override + bool operator ==(Object obj) { + if (obj is _NamedObject) { + _NamedObject that = obj; + return name == that.name || peerNames.contains(that.name); + } + return false; + } + + @override + int get hashCode => 0; + + @override + String toString() => name; +} diff --git a/ohos/test_quiver/lib/src/time/clock_test.dart b/ohos/test_quiver/lib/src/time/clock_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..1420129259599d829acf4b5c53dd51a7c750089a --- /dev/null +++ b/ohos/test_quiver/lib/src/time/clock_test.dart @@ -0,0 +1,223 @@ +// Copyright 2013 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the 'License'); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an 'AS IS' BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +library quiver.time.clock_test; + +import 'package:quiver/src/time/clock.dart'; +import 'package:flutter/material.dart'; +import 'package:test_quiver/base/test_page.dart'; + +Clock from(int y, int m, int d) => Clock.fixed(DateTime(y, m, d)); + +void expectDate(DateTime date, int y, [int m = 1, int d = 1]) { + expect(date, DateTime(y, m, d)); +} + +class ClockTestPage extends TestPage { + ClockTestPage(String title,{ Key? key}) : super(title: title, key: key) { + group('clock', () { + late Clock subject; + + // setUp(() { + subject = Clock.fixed(DateTime(2013)); + // }); + + test('应该从系统时钟返回一个非零值', () { + expect(const Clock().now(), const Clock().now() !=null); + }); + + // This test may be flaky on certain systems. I ran it over 10 million + // cycles on my machine without any failures, but that's no guarantee. + test('应该足够接近系统时钟', () { + // At 10ms the test doesn't seem to be flaky. + var epsilon = 10; + expect( + DateTime.now().difference(const Clock().now()).inMilliseconds.abs(), + epsilon); + expect( + DateTime.now().difference(const Clock().now()).inMilliseconds.abs(), + epsilon); + }); + + test('s应返回自定义TimeFunction提供的时间', () { + var time = DateTime(2013); + var fixedClock = Clock(() => time); + expect(fixedClock.now(), DateTime(2013)); + + time = DateTime(2014); + expect(fixedClock.now(), DateTime(2014)); + }); + + test('应返回固定时间', () { + expect(Clock.fixed(DateTime(2013)).now(), DateTime(2013)); + }); + + test('应返回时间Duration ago', () { + expect(subject.agoBy(const Duration(days: 366)), DateTime(2012)); + }); + + test('应该返回时间从现在开始的持续时间', () { + expect(subject.fromNowBy(const Duration(days: 365)), DateTime(2014)); + }); + + test('应该返回以前的时间部分', () { + expect( + subject.ago( + days: 1, + hours: 1, + minutes: 1, + seconds: 1, + milliseconds: 1, + microseconds: 1000), + DateTime(2012, 12, 30, 22, 58, 58, 998)); + }); + + test('应该从现在起返回时间部件', () { + expect( + subject.fromNow( + days: 1, + hours: 1, + minutes: 1, + seconds: 1, + milliseconds: 1, + microseconds: 1000), + DateTime(2013, 1, 2, 1, 1, 1, 2)); + }); + + test('应该返回micros前的时间', () { + expect(subject.microsAgo(1000), DateTime(2012, 12, 31, 23, 59, 59, 999)); + }); + + test('应该从现在起返回时间micros', () { + expect(subject.microsFromNow(1000), DateTime(2013, 1, 1, 0, 0, 0, 1)); + }); + + test('应该返回毫秒前的时间', () { + expect(subject.millisAgo(1000), DateTime(2012, 12, 31, 23, 59, 59, 000)); + }); + + test('应该从现在开始返回时间毫秒', () { + expect(subject.millisFromNow(3), DateTime(2013, 1, 1, 0, 0, 0, 3)); + }); + + test('应该返回秒前的时间', () { + expect(subject.secondsAgo(10), DateTime(2012, 12, 31, 23, 59, 50, 000)); + }); + + test('应该从现在起返回秒的时间', () { + expect(subject.secondsFromNow(3), DateTime(2013, 1, 1, 0, 0, 3, 0)); + }); + + test('应返回分钟前的时间', () { + expect(subject.minutesAgo(10), DateTime(2012, 12, 31, 23, 50, 0, 000)); + }); + + test('应从现在起返回时间分钟', () { + expect(subject.minutesFromNow(3), DateTime(2013, 1, 1, 0, 3, 0, 0)); + }); + + test('应返回小时前的时间', () { + expect(subject.hoursAgo(10), DateTime(2012, 12, 31, 14, 0, 0, 000)); + }); + + test('应从现在起返回时间小时', () { + expect(subject.hoursFromNow(3), DateTime(2013, 1, 1, 3, 0, 0, 0)); + }); + + test('应该返回几天前的时间', () { + expectDate(subject.daysAgo(10), 2012, 12, 22); + }); + + test('应该返回从现在起天的时间', () { + expectDate(subject.daysFromNow(3), 2013, 1, 4); + }); + + test('应在几个月前的同一日期返回时间', () { + expectDate(subject.monthsAgo(1), 2012, 12, 1); + expectDate(subject.monthsAgo(2), 2012, 11, 1); + expectDate(subject.monthsAgo(3), 2012, 10, 1); + expectDate(subject.monthsAgo(4), 2012, 9, 1); + }); + + test('应在同一日期返回从现在起数月的时间', () { + expectDate(subject.monthsFromNow(1), 2013, 2, 1); + expectDate(subject.monthsFromNow(2), 2013, 3, 1); + expectDate(subject.monthsFromNow(3), 2013, 4, 1); + expectDate(subject.monthsFromNow(4), 2013, 5, 1); + }); + + test('应该从2013-05-31到2012-11-30', () { + expectDate(from(2013, 5, 31).monthsAgo(6), 2012, 11, 30); + }); + + test('应该从2013-03-31到2013-02-28(普通年份)', () { + expectDate(from(2013, 3, 31).monthsAgo(1), 2013, 2, 28); + }); + + test('应该从2013-05-31到2013-02-28(普通年份)', () { + expectDate(from(2013, 5, 31).monthsAgo(3), 2013, 2, 28); + }); + + test('应该从2004-03-31到2004-02-29(闰年)', () { + expectDate(from(2004, 3, 31).monthsAgo(1), 2004, 2, 29); + }); + + test('应该从2013-03-31到2013-06-30', () { + expectDate(from(2013, 3, 31).monthsFromNow(3), 2013, 6, 30); + }); + + test('应该从2003-12-31到2004-02-29(跳跃常见)', () { + expectDate(from(2003, 12, 31).monthsFromNow(2), 2004, 2, 29); + }); + + test('应该从2004年2月29日到2003年2月28日', () { + expectDate(from(2004, 2, 29).yearsAgo(1), 2003, 2, 28); + }); + + test('应该从2004-02-29到2003-02-28', () { + expectDate(from(2004, 2, 29).monthsAgo(12), 2003, 2, 28); + }); + + test('应该从2004-02-29到2005-02-28', () { + expectDate(from(2004, 2, 29).yearsFromNow(1), 2005, 2, 28); + }); + + test('应该从2004-02-29到2005-02-28', () { + expectDate(from(2004, 2, 29).monthsFromNow(12), 2005, 2, 28); + }); + + test('应该在几年前的同一天返回', () { + expectDate(subject.yearsAgo(1), 2012, 1, 1); // leap year + expectDate(subject.yearsAgo(2), 2011, 1, 1); + expectDate(subject.yearsAgo(3), 2010, 1, 1); + expectDate(subject.yearsAgo(4), 2009, 1, 1); + expectDate(subject.yearsAgo(5), 2008, 1, 1); // leap year + expectDate(subject.yearsAgo(6), 2007, 1, 1); + expectDate(subject.yearsAgo(30), 1983, 1, 1); + expectDate(subject.yearsAgo(2013), 0, 1, 1); + }); + + test('s应在同一日期返回时间年', () { + expectDate(subject.yearsFromNow(1), 2014, 1, 1); + expectDate(subject.yearsFromNow(2), 2015, 1, 1); + expectDate(subject.yearsFromNow(3), 2016, 1, 1); + expectDate(subject.yearsFromNow(4), 2017, 1, 1); + expectDate(subject.yearsFromNow(5), 2018, 1, 1); + expectDate(subject.yearsFromNow(6), 2019, 1, 1); + expectDate(subject.yearsFromNow(30), 2043, 1, 1); + expectDate(subject.yearsFromNow(1000), 3013, 1, 1); + }); + }); +} +} \ No newline at end of file diff --git a/ohos/test_quiver/ohos/.gitignore b/ohos/test_quiver/ohos/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..fbabf771011fe78f9919db0b1195ab6cadffc2b0 --- /dev/null +++ b/ohos/test_quiver/ohos/.gitignore @@ -0,0 +1,11 @@ +/node_modules +/oh_modules +/local.properties +/.idea +**/build +/.hvigor +.cxx +/.clangd +/.clang-format +/.clang-tidy +**/.test \ No newline at end of file diff --git a/ohos/test_quiver/ohos/AppScope/app.json5 b/ohos/test_quiver/ohos/AppScope/app.json5 new file mode 100644 index 0000000000000000000000000000000000000000..1e9bdddccad6844cf848c1529e3016934f5b9c71 --- /dev/null +++ b/ohos/test_quiver/ohos/AppScope/app.json5 @@ -0,0 +1,10 @@ +{ + "app": { + "bundleName": "com.example.test_quiver", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name" + } +} diff --git a/ohos/test_quiver/ohos/AppScope/resources/base/element/string.json b/ohos/test_quiver/ohos/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..1a64c4ae5aebd49674987a01fed9bed66fe3efaf --- /dev/null +++ b/ohos/test_quiver/ohos/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "test_quiver" + } + ] +} diff --git a/ohos/test_quiver/ohos/AppScope/resources/base/media/app_icon.png b/ohos/test_quiver/ohos/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ohos/test_quiver/ohos/AppScope/resources/base/media/app_icon.png differ diff --git a/ohos/test_quiver/ohos/build-profile.json5 b/ohos/test_quiver/ohos/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..238b2d5bbf8b3a0c28dae746eaf5220737a944fe --- /dev/null +++ b/ohos/test_quiver/ohos/build-profile.json5 @@ -0,0 +1,42 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +{ + "app": { + "signingConfigs": [], + "compileSdkVersion": 10, + "compatibleSdkVersion": 10, + "products": [ + { + "name": "default", + "signingConfig": "default", + } + ] + }, + "modules": [ + { + "name": "entry", + "srcPath": "./entry", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/ohos/test_quiver/ohos/dta/icudtl.dat b/ohos/test_quiver/ohos/dta/icudtl.dat new file mode 100644 index 0000000000000000000000000000000000000000..d1f10917ab52e3ebd251abd7f5377d7196b80d67 Binary files /dev/null and b/ohos/test_quiver/ohos/dta/icudtl.dat differ diff --git a/ohos/test_quiver/ohos/entry/.gitignore b/ohos/test_quiver/ohos/entry/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..2795a1c5b1fe53659dd1b71d90ba0592eaf7e043 --- /dev/null +++ b/ohos/test_quiver/ohos/entry/.gitignore @@ -0,0 +1,7 @@ + +/node_modules +/oh_modules +/.preview +/build +/.cxx +/.test \ No newline at end of file diff --git a/ohos/test_quiver/ohos/entry/build-profile.json5 b/ohos/test_quiver/ohos/entry/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..f02a52e08c8fa1c3a33b9faa4592e9f695cd1c54 --- /dev/null +++ b/ohos/test_quiver/ohos/entry/build-profile.json5 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +{ + "apiType": 'stageMode', + "buildOption": { + }, + "targets": [ + { + "name": "default", + "runtimeOS": "OpenHarmony" + }, + { + "name": "ohosTest", + } + ] +} \ No newline at end of file diff --git a/ohos/test_quiver/ohos/entry/hvigorfile.ts b/ohos/test_quiver/ohos/entry/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..894fc15c6b793f085e6c8506e43d719af658e8ff --- /dev/null +++ b/ohos/test_quiver/ohos/entry/hvigorfile.ts @@ -0,0 +1,17 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently. +export { hapTasks } from '@ohos/hvigor-ohos-plugin'; diff --git a/ohos/test_quiver/ohos/entry/libs/arm64-v8a/libapp.so b/ohos/test_quiver/ohos/entry/libs/arm64-v8a/libapp.so new file mode 100644 index 0000000000000000000000000000000000000000..ed4f8d1f7c65fbf19e2251d6781b2e1aa25da1f3 Binary files /dev/null and b/ohos/test_quiver/ohos/entry/libs/arm64-v8a/libapp.so differ diff --git a/ohos/test_quiver/ohos/entry/libs/arm64-v8a/libc++_shared.so b/ohos/test_quiver/ohos/entry/libs/arm64-v8a/libc++_shared.so new file mode 100644 index 0000000000000000000000000000000000000000..831c9353702073d45889352a4dafb93103d67d20 Binary files /dev/null and b/ohos/test_quiver/ohos/entry/libs/arm64-v8a/libc++_shared.so differ diff --git a/ohos/test_quiver/ohos/entry/libs/arm64-v8a/libflutter.so b/ohos/test_quiver/ohos/entry/libs/arm64-v8a/libflutter.so new file mode 100755 index 0000000000000000000000000000000000000000..488ebb753f1bf6ffadfc3329a7ef64f0265d20fd Binary files /dev/null and b/ohos/test_quiver/ohos/entry/libs/arm64-v8a/libflutter.so differ diff --git a/ohos/test_quiver/ohos/entry/oh-package.json5 b/ohos/test_quiver/ohos/entry/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..ab756b7624a009a30db809d7d64c62d84dc7b153 --- /dev/null +++ b/ohos/test_quiver/ohos/entry/oh-package.json5 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +{ + "name": "entry", + "version": "1.0.0", + "description": "Please describe the basic information.", + "main": "", + "author": "", + "license": "", + "dependencies": { + "@ohos/flutter_ohos": "file:../har/flutter_embedding.har" + } +} + diff --git a/ohos/test_quiver/ohos/entry/src/main/ets/entryability/EntryAbility.ets b/ohos/test_quiver/ohos/entry/src/main/ets/entryability/EntryAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..321a4eeaacd7b8079a876e25c4dafd498e4d9fb9 --- /dev/null +++ b/ohos/test_quiver/ohos/entry/src/main/ets/entryability/EntryAbility.ets @@ -0,0 +1,22 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import { FlutterAbility } from '@ohos/flutter_ohos' + +export default class EntryAbility extends FlutterAbility { + onFlutterEngineReady(): void { + super.onFlutterEngineReady() + } +} diff --git a/ohos/test_quiver/ohos/entry/src/main/ets/pages/Index.ets b/ohos/test_quiver/ohos/entry/src/main/ets/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..d784c75ed9d16a6657bb6466a148752b1b20bd91 --- /dev/null +++ b/ohos/test_quiver/ohos/entry/src/main/ets/pages/Index.ets @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import { FlutterPage } from '@ohos/flutter_ohos' + +@Entry +@Component +struct Index { + build() { + Column() { + FlutterPage() + } + } +} \ No newline at end of file diff --git a/ohos/test_quiver/ohos/entry/src/main/module.json5 b/ohos/test_quiver/ohos/entry/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..7bbf78b18f39991b1404061c7437538c7d532bb7 --- /dev/null +++ b/ohos/test_quiver/ohos/entry/src/main/module.json5 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +{ + "module": { + "name": "entry", + "type": "entry", + "description": "$string:module_desc", + "mainElement": "EntryAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "EntryAbility", + "srcEntry": "./ets/entryability/EntryAbility.ets", + "description": "$string:EntryAbility_desc", + "icon": "$media:icon", + "label": "$string:EntryAbility_label", + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:start_window_background", + "exported": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ], + "requestPermissions": [ + {"name" : "ohos.permission.INTERNET"}, + ] + } +} \ No newline at end of file diff --git a/ohos/test_quiver/ohos/entry/src/main/resources/base/element/color.json b/ohos/test_quiver/ohos/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02 --- /dev/null +++ b/ohos/test_quiver/ohos/entry/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/ohos/test_quiver/ohos/entry/src/main/resources/base/element/string.json b/ohos/test_quiver/ohos/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f94595515a99e0c828807e243494f57f09251930 --- /dev/null +++ b/ohos/test_quiver/ohos/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ohos/test_quiver/ohos/entry/src/main/resources/base/media/icon.png b/ohos/test_quiver/ohos/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ohos/test_quiver/ohos/entry/src/main/resources/base/media/icon.png differ diff --git a/ohos/test_quiver/ohos/entry/src/main/resources/base/profile/main_pages.json b/ohos/test_quiver/ohos/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce --- /dev/null +++ b/ohos/test_quiver/ohos/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/Index" + ] +} diff --git a/ohos/test_quiver/ohos/entry/src/main/resources/en_US/element/string.json b/ohos/test_quiver/ohos/entry/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f94595515a99e0c828807e243494f57f09251930 --- /dev/null +++ b/ohos/test_quiver/ohos/entry/src/main/resources/en_US/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ohos/test_quiver/ohos/entry/src/main/resources/rawfile/flutter_assets/AssetManifest.json b/ohos/test_quiver/ohos/entry/src/main/resources/rawfile/flutter_assets/AssetManifest.json new file mode 100644 index 0000000000000000000000000000000000000000..9e26dfeeb6e641a33dae4961196235bdb965b21b --- /dev/null +++ b/ohos/test_quiver/ohos/entry/src/main/resources/rawfile/flutter_assets/AssetManifest.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/ohos/test_quiver/ohos/entry/src/main/resources/rawfile/flutter_assets/FontManifest.json b/ohos/test_quiver/ohos/entry/src/main/resources/rawfile/flutter_assets/FontManifest.json new file mode 100644 index 0000000000000000000000000000000000000000..3abf18c41c58c933308c244a875bf383856e103e --- /dev/null +++ b/ohos/test_quiver/ohos/entry/src/main/resources/rawfile/flutter_assets/FontManifest.json @@ -0,0 +1 @@ +[{"family":"MaterialIcons","fonts":[{"asset":"fonts/MaterialIcons-Regular.otf"}]}] \ No newline at end of file diff --git a/ohos/test_quiver/ohos/entry/src/main/resources/rawfile/flutter_assets/NOTICES.Z b/ohos/test_quiver/ohos/entry/src/main/resources/rawfile/flutter_assets/NOTICES.Z new file mode 100644 index 0000000000000000000000000000000000000000..3fb2e9fcb9d83b6d513bae9a9b48e10f5cf5b506 Binary files /dev/null and b/ohos/test_quiver/ohos/entry/src/main/resources/rawfile/flutter_assets/NOTICES.Z differ diff --git a/ohos/test_quiver/ohos/entry/src/main/resources/rawfile/flutter_assets/fonts/MaterialIcons-Regular.otf b/ohos/test_quiver/ohos/entry/src/main/resources/rawfile/flutter_assets/fonts/MaterialIcons-Regular.otf new file mode 100644 index 0000000000000000000000000000000000000000..8c99266130a89547b4344f47e08aacad473b14e0 Binary files /dev/null and b/ohos/test_quiver/ohos/entry/src/main/resources/rawfile/flutter_assets/fonts/MaterialIcons-Regular.otf differ diff --git a/ohos/test_quiver/ohos/entry/src/main/resources/rawfile/flutter_assets/icudtl.dat b/ohos/test_quiver/ohos/entry/src/main/resources/rawfile/flutter_assets/icudtl.dat new file mode 100644 index 0000000000000000000000000000000000000000..d1f10917ab52e3ebd251abd7f5377d7196b80d67 Binary files /dev/null and b/ohos/test_quiver/ohos/entry/src/main/resources/rawfile/flutter_assets/icudtl.dat differ diff --git a/ohos/test_quiver/ohos/entry/src/main/resources/rawfile/flutter_assets/shaders/ink_sparkle.frag b/ohos/test_quiver/ohos/entry/src/main/resources/rawfile/flutter_assets/shaders/ink_sparkle.frag new file mode 100644 index 0000000000000000000000000000000000000000..0bb5a14a220d223adde1e69eb1959332d6bd08c7 Binary files /dev/null and b/ohos/test_quiver/ohos/entry/src/main/resources/rawfile/flutter_assets/shaders/ink_sparkle.frag differ diff --git a/ohos/test_quiver/ohos/entry/src/main/resources/zh_CN/element/string.json b/ohos/test_quiver/ohos/entry/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..597ecf95e61d7e30367c22fe2f8638008361b044 --- /dev/null +++ b/ohos/test_quiver/ohos/entry/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "模块描述" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ohos/test_quiver/ohos/entry/src/ohosTest/ets/test/Ability.test.ets b/ohos/test_quiver/ohos/entry/src/ohosTest/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..25d4c71ff3cd584f5d64f6f8c0ac864928c234c4 --- /dev/null +++ b/ohos/test_quiver/ohos/entry/src/ohosTest/ets/test/Ability.test.ets @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import hilog from '@ohos.hilog'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' + +export default function abilityTest() { + describe('ActsAbilityTest', function () { + // Defines a test suite. Two parameters are supported: test suite name and test suite function. + beforeAll(function () { + // Presets an action, which is performed only once before all test cases of the test suite start. + // This API supports only one parameter: preset action function. + }) + beforeEach(function () { + // Presets an action, which is performed before each unit test case starts. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: preset action function. + }) + afterEach(function () { + // Presets a clear action, which is performed after each unit test case ends. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: clear action function. + }) + afterAll(function () { + // Presets a clear action, which is performed after all test cases of the test suite end. + // This API supports only one parameter: clear action function. + }) + it('assertContain',0, function () { + // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. + hilog.info(0x0000, 'testTag', '%{public}s', 'it begin'); + let a = 'abc' + let b = 'b' + // Defines a variety of assertion methods, which are used to declare expected boolean conditions. + expect(a).assertContain(b) + expect(a).assertEqual(a) + }) + }) +} \ No newline at end of file diff --git a/ohos/test_quiver/ohos/entry/src/ohosTest/ets/test/List.test.ets b/ohos/test_quiver/ohos/entry/src/ohosTest/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..f4140030e65d20df6af30a6bf51e464dea8f8aa6 --- /dev/null +++ b/ohos/test_quiver/ohos/entry/src/ohosTest/ets/test/List.test.ets @@ -0,0 +1,20 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import abilityTest from './Ability.test' + +export default function testsuite() { + abilityTest() +} \ No newline at end of file diff --git a/ohos/test_quiver/ohos/entry/src/ohosTest/ets/testability/TestAbility.ets b/ohos/test_quiver/ohos/entry/src/ohosTest/ets/testability/TestAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..4ca645e6013cfce8e7dbb728313cb8840c4da660 --- /dev/null +++ b/ohos/test_quiver/ohos/entry/src/ohosTest/ets/testability/TestAbility.ets @@ -0,0 +1,63 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import UIAbility from '@ohos.app.ability.UIAbility'; +import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; +import hilog from '@ohos.hilog'; +import { Hypium } from '@ohos/hypium'; +import testsuite from '../test/List.test'; +import window from '@ohos.window'; + +export default class TestAbility extends UIAbility { + onCreate(want, launchParam) { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate'); + hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); + hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? ''); + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy'); + } + + onWindowStageCreate(windowStage: window.WindowStage) { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate'); + windowStage.loadContent('testability/pages/Index', (err, data) => { + if (err.code) { + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', + JSON.stringify(data) ?? ''); + }); + } + + onWindowStageDestroy() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy'); + } + + onForeground() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground'); + } + + onBackground() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground'); + } +} \ No newline at end of file diff --git a/ohos/test_quiver/ohos/entry/src/ohosTest/ets/testability/pages/Index.ets b/ohos/test_quiver/ohos/entry/src/ohosTest/ets/testability/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..cef0447cd2f137ef82d223ead2e156808878ab90 --- /dev/null +++ b/ohos/test_quiver/ohos/entry/src/ohosTest/ets/testability/pages/Index.ets @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import hilog from '@ohos.hilog'; + +@Entry +@Component +struct Index { + aboutToAppear() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear'); + } + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } \ No newline at end of file diff --git a/ohos/test_quiver/ohos/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts b/ohos/test_quiver/ohos/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..1def08f2e9dcbfa3454a07b7a3b82b173bb90d02 --- /dev/null +++ b/ohos/test_quiver/ohos/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import hilog from '@ohos.hilog'; +import TestRunner from '@ohos.application.testRunner'; +import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +async function onAbilityCreateCallback() { + hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); +} + +async function addAbilityMonitorCallback(err: any) { + hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); + } + + async onRun() { + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility' + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName + var debug = abilityDelegatorArguments.parameters['-D'] + if (debug == 'true') + { + cmd += ' -D' + } + hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd); + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? ''); + hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? ''); + hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? ''); + }) + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end'); + } +} \ No newline at end of file diff --git a/ohos/test_quiver/ohos/entry/src/ohosTest/module.json5 b/ohos/test_quiver/ohos/entry/src/ohosTest/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..fab77ce2e0c61e3ad010bab5b27ccbd15f9a8c96 --- /dev/null +++ b/ohos/test_quiver/ohos/entry/src/ohosTest/module.json5 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +{ + "module": { + "name": "entry_test", + "type": "feature", + "description": "$string:module_test_desc", + "mainElement": "TestAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:test_pages", + "abilities": [ + { + "name": "TestAbility", + "srcEntry": "./ets/testability/TestAbility.ets", + "description": "$string:TestAbility_desc", + "icon": "$media:icon", + "label": "$string:TestAbility_label", + "exported": true, + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:start_window_background", + "skills": [ + { + "actions": [ + "action.system.home" + ], + "entities": [ + "entity.system.home" + ] + } + ] + } + ] + } +} diff --git a/ohos/test_quiver/ohos/entry/src/ohosTest/resources/base/element/color.json b/ohos/test_quiver/ohos/entry/src/ohosTest/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02 --- /dev/null +++ b/ohos/test_quiver/ohos/entry/src/ohosTest/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/ohos/test_quiver/ohos/entry/src/ohosTest/resources/base/element/string.json b/ohos/test_quiver/ohos/entry/src/ohosTest/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..65d8fa5a7cf54aa3943dcd0214f58d1771bc1f6c --- /dev/null +++ b/ohos/test_quiver/ohos/entry/src/ohosTest/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_test_desc", + "value": "test ability description" + }, + { + "name": "TestAbility_desc", + "value": "the test ability" + }, + { + "name": "TestAbility_label", + "value": "test label" + } + ] +} \ No newline at end of file diff --git a/ohos/test_quiver/ohos/entry/src/ohosTest/resources/base/media/icon.png b/ohos/test_quiver/ohos/entry/src/ohosTest/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ohos/test_quiver/ohos/entry/src/ohosTest/resources/base/media/icon.png differ diff --git a/ohos/test_quiver/ohos/entry/src/ohosTest/resources/base/profile/test_pages.json b/ohos/test_quiver/ohos/entry/src/ohosTest/resources/base/profile/test_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..b7e7343cacb32ce982a45e76daad86e435e054fe --- /dev/null +++ b/ohos/test_quiver/ohos/entry/src/ohosTest/resources/base/profile/test_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "testability/pages/Index" + ] +} diff --git a/ohos/test_quiver/ohos/har/flutter_embedding.har b/ohos/test_quiver/ohos/har/flutter_embedding.har new file mode 100644 index 0000000000000000000000000000000000000000..df4ad91a9a830bf776221dd2983cd02fc13a9e4f Binary files /dev/null and b/ohos/test_quiver/ohos/har/flutter_embedding.har differ diff --git a/ohos/test_quiver/ohos/har/flutter_embedding.har.debug.10 b/ohos/test_quiver/ohos/har/flutter_embedding.har.debug.10 new file mode 100644 index 0000000000000000000000000000000000000000..b75cb4e20800111a17d237ff0bc22eb8fd3d5875 Binary files /dev/null and b/ohos/test_quiver/ohos/har/flutter_embedding.har.debug.10 differ diff --git a/ohos/test_quiver/ohos/har/flutter_embedding.har.debug.9 b/ohos/test_quiver/ohos/har/flutter_embedding.har.debug.9 new file mode 100644 index 0000000000000000000000000000000000000000..f0df4ca0064821178bf4254b16e8d23d873827da Binary files /dev/null and b/ohos/test_quiver/ohos/har/flutter_embedding.har.debug.9 differ diff --git a/ohos/test_quiver/ohos/har/flutter_embedding.har.release.10 b/ohos/test_quiver/ohos/har/flutter_embedding.har.release.10 new file mode 100644 index 0000000000000000000000000000000000000000..df4ad91a9a830bf776221dd2983cd02fc13a9e4f Binary files /dev/null and b/ohos/test_quiver/ohos/har/flutter_embedding.har.release.10 differ diff --git a/ohos/test_quiver/ohos/har/flutter_embedding.har.release.9 b/ohos/test_quiver/ohos/har/flutter_embedding.har.release.9 new file mode 100644 index 0000000000000000000000000000000000000000..ba52754a80826e5614438b3faf931ed2f487eaab Binary files /dev/null and b/ohos/test_quiver/ohos/har/flutter_embedding.har.release.9 differ diff --git a/ohos/test_quiver/ohos/hvigor/hvigor-config.json5 b/ohos/test_quiver/ohos/hvigor/hvigor-config.json5 new file mode 100644 index 0000000000000000000000000000000000000000..990085f6621b0d3e876a162e42eb2bc1bf441434 --- /dev/null +++ b/ohos/test_quiver/ohos/hvigor/hvigor-config.json5 @@ -0,0 +1,21 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +{ + "hvigorVersion": "2.1.1", + "dependencies": { + "@ohos/hvigor-ohos-plugin": "2.1.1" + } +} diff --git a/ohos/test_quiver/ohos/hvigor/hvigor-wrapper.js b/ohos/test_quiver/ohos/hvigor/hvigor-wrapper.js new file mode 100644 index 0000000000000000000000000000000000000000..994f22987bd0739b9faa07c966b066c2d9218602 --- /dev/null +++ b/ohos/test_quiver/ohos/hvigor/hvigor-wrapper.js @@ -0,0 +1,2 @@ +"use strict";var e=require("fs"),t=require("path"),n=require("os"),r=require("crypto"),u=require("child_process"),o=require("constants"),i=require("stream"),s=require("util"),c=require("assert"),a=require("tty"),l=require("zlib"),f=require("net");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var D=d(e),p=d(t),E=d(n),m=d(r),h=d(u),y=d(o),C=d(i),F=d(s),g=d(c),A=d(a),v=d(l),S=d(f),w="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},O={},b={},_={},B=w&&w.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(_,"__esModule",{value:!0}),_.isMac=_.isLinux=_.isWindows=void 0;const P=B(E.default),k="Windows_NT",x="Linux",N="Darwin";_.isWindows=function(){return P.default.type()===k},_.isLinux=function(){return P.default.type()===x},_.isMac=function(){return P.default.type()===N};var I={},T=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),R=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),M=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&T(t,e,n);return R(t,e),t};Object.defineProperty(I,"__esModule",{value:!0}),I.hash=void 0;const L=M(m.default);I.hash=function(e,t="md5"){return L.createHash(t).update(e,"utf-8").digest("hex")},function(e){var t=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),n=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var u in e)"default"!==u&&Object.prototype.hasOwnProperty.call(e,u)&&t(r,e,u);return n(r,e),r};Object.defineProperty(e,"__esModule",{value:!0}),e.HVIGOR_BOOT_JS_FILE_PATH=e.HVIGOR_PROJECT_DEPENDENCY_PACKAGE_JSON_PATH=e.HVIGOR_PROJECT_DEPENDENCIES_HOME=e.HVIGOR_PROJECT_WRAPPER_HOME=e.HVIGOR_PROJECT_NAME=e.HVIGOR_PROJECT_ROOT_DIR=e.HVIGOR_PROJECT_CACHES_HOME=e.HVIGOR_PNPM_STORE_PATH=e.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH=e.HVIGOR_WRAPPER_TOOLS_HOME=e.HVIGOR_USER_HOME=e.DEFAULT_PACKAGE_JSON=e.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME=e.PNPM=e.HVIGOR=e.NPM_TOOL=e.PNPM_TOOL=e.HVIGOR_ENGINE_PACKAGE_NAME=void 0;const u=r(p.default),o=r(E.default),i=_,s=I;e.HVIGOR_ENGINE_PACKAGE_NAME="@ohos/hvigor",e.PNPM_TOOL=(0,i.isWindows)()?"pnpm.cmd":"pnpm",e.NPM_TOOL=(0,i.isWindows)()?"npm.cmd":"npm",e.HVIGOR="hvigor",e.PNPM="pnpm",e.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME="hvigor-config.json5",e.DEFAULT_PACKAGE_JSON="package.json",e.HVIGOR_USER_HOME=u.resolve(o.homedir(),".hvigor"),e.HVIGOR_WRAPPER_TOOLS_HOME=u.resolve(e.HVIGOR_USER_HOME,"wrapper","tools"),e.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH=u.resolve(e.HVIGOR_WRAPPER_TOOLS_HOME,"node_modules",".bin",e.PNPM_TOOL),e.HVIGOR_PNPM_STORE_PATH=u.resolve(e.HVIGOR_USER_HOME,"caches"),e.HVIGOR_PROJECT_CACHES_HOME=u.resolve(e.HVIGOR_USER_HOME,"project_caches"),e.HVIGOR_PROJECT_ROOT_DIR=process.cwd(),e.HVIGOR_PROJECT_NAME=u.basename((0,s.hash)(e.HVIGOR_PROJECT_ROOT_DIR)),e.HVIGOR_PROJECT_WRAPPER_HOME=u.resolve(e.HVIGOR_PROJECT_ROOT_DIR,e.HVIGOR),e.HVIGOR_PROJECT_DEPENDENCIES_HOME=u.resolve(e.HVIGOR_PROJECT_CACHES_HOME,e.HVIGOR_PROJECT_NAME,"workspace"),e.HVIGOR_PROJECT_DEPENDENCY_PACKAGE_JSON_PATH=u.resolve(e.HVIGOR_PROJECT_DEPENDENCIES_HOME,e.DEFAULT_PACKAGE_JSON),e.HVIGOR_BOOT_JS_FILE_PATH=u.resolve(e.HVIGOR_PROJECT_DEPENDENCIES_HOME,"node_modules","@ohos","hvigor","bin","hvigor.js")}(b);var j={},$={};Object.defineProperty($,"__esModule",{value:!0}),$.logInfoPrintConsole=$.logErrorAndExit=void 0,$.logErrorAndExit=function(e){e instanceof Error?console.error(e.message):console.error(e),process.exit(-1)},$.logInfoPrintConsole=function(e){console.log(e)};var H=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),J=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),G=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&H(t,e,n);return J(t,e),t},V=w&&w.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(j,"__esModule",{value:!0}),j.isFileExists=j.offlinePluginConversion=j.executeCommand=j.getNpmPath=j.hasNpmPackInPaths=void 0;const U=h.default,W=G(p.default),z=b,K=$,q=V(D.default);j.hasNpmPackInPaths=function(e,t){try{return require.resolve(e,{paths:[...t]}),!0}catch(e){return!1}},j.getNpmPath=function(){const e=process.execPath;return W.join(W.dirname(e),z.NPM_TOOL)},j.executeCommand=function(e,t,n){0!==(0,U.spawnSync)(e,t,n).status&&(0,K.logErrorAndExit)(`Error: ${e} ${t} execute failed.See above for details.`)},j.offlinePluginConversion=function(e,t){return t.startsWith("file:")||t.endsWith(".tgz")?W.resolve(e,z.HVIGOR,t.replace("file:","")):t},j.isFileExists=function(e){return q.default.existsSync(e)&&q.default.statSync(e).isFile()},function(e){var t=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),n=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var u in e)"default"!==u&&Object.prototype.hasOwnProperty.call(e,u)&&t(r,e,u);return n(r,e),r},u=w&&w.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.executeInstallPnpm=e.isPnpmAvailable=e.environmentHandler=e.checkNpmConifg=e.PNPM_VERSION=void 0;const o=r(D.default),i=b,s=j,c=r(p.default),a=$,l=h.default,f=u(E.default);e.PNPM_VERSION="7.30.0",e.checkNpmConifg=function(){const e=c.resolve(i.HVIGOR_PROJECT_ROOT_DIR,".npmrc"),t=c.resolve(f.default.homedir(),".npmrc");if((0,s.isFileExists)(e)||(0,s.isFileExists)(t))return;const n=(0,s.getNpmPath)(),r=(0,l.spawnSync)(n,["config","get","prefix"],{cwd:i.HVIGOR_PROJECT_ROOT_DIR});if(0!==r.status||!r.stdout)return void(0,a.logErrorAndExit)("Error: The hvigor depends on the npmrc file. Configure the npmrc file first.");const u=c.resolve(`${r.stdout}`.replace(/[\r\n]/gi,""),".npmrc");(0,s.isFileExists)(u)||(0,a.logErrorAndExit)("Error: The hvigor depends on the npmrc file. Configure the npmrc file first.")},e.environmentHandler=function(){process.env["npm_config_update-notifier"]="false"},e.isPnpmAvailable=function(){return!!o.existsSync(i.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH)&&(0,s.hasNpmPackInPaths)("pnpm",[i.HVIGOR_WRAPPER_TOOLS_HOME])},e.executeInstallPnpm=function(){(0,a.logInfoPrintConsole)(`Installing pnpm@${e.PNPM_VERSION}...`);const t=(0,s.getNpmPath)();!function(){const t=c.resolve(i.HVIGOR_WRAPPER_TOOLS_HOME,i.DEFAULT_PACKAGE_JSON);try{o.existsSync(i.HVIGOR_WRAPPER_TOOLS_HOME)||o.mkdirSync(i.HVIGOR_WRAPPER_TOOLS_HOME,{recursive:!0});const n={dependencies:{}};n.dependencies[i.PNPM]=e.PNPM_VERSION,o.writeFileSync(t,JSON.stringify(n))}catch(e){(0,a.logErrorAndExit)(`Error: EPERM: operation not permitted,create ${t} failed.`)}}(),(0,s.executeCommand)(t,["install","pnpm"],{cwd:i.HVIGOR_WRAPPER_TOOLS_HOME,stdio:["inherit","inherit","inherit"],env:process.env}),(0,a.logInfoPrintConsole)("Pnpm install success.")}}(O);var Y={},X={},Z={},Q={};Object.defineProperty(Q,"__esModule",{value:!0}),Q.Unicode=void 0;class ee{}Q.Unicode=ee,ee.Space_Separator=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,ee.ID_Start=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,ee.ID_Continue=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,Object.defineProperty(Z,"__esModule",{value:!0}),Z.JudgeUtil=void 0;const te=Q;Z.JudgeUtil=class{static isIgnoreChar(e){return"string"==typeof e&&("\t"===e||"\v"===e||"\f"===e||" "===e||" "===e||"\ufeff"===e||"\n"===e||"\r"===e||"\u2028"===e||"\u2029"===e)}static isSpaceSeparator(e){return"string"==typeof e&&te.Unicode.Space_Separator.test(e)}static isIdStartChar(e){return"string"==typeof e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||"$"===e||"_"===e||te.Unicode.ID_Start.test(e))}static isIdContinueChar(e){return"string"==typeof e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||"$"===e||"_"===e||"‌"===e||"‍"===e||te.Unicode.ID_Continue.test(e))}static isDigitWithoutZero(e){return/[1-9]/.test(e)}static isDigit(e){return"string"==typeof e&&/[0-9]/.test(e)}static isHexDigit(e){return"string"==typeof e&&/[0-9A-Fa-f]/.test(e)}};var ne={},re={fromCallback:function(e){return Object.defineProperty((function(...t){if("function"!=typeof t[t.length-1])return new Promise(((n,r)=>{e.call(this,...t,((e,t)=>null!=e?r(e):n(t)))}));e.apply(this,t)}),"name",{value:e.name})},fromPromise:function(e){return Object.defineProperty((function(...t){const n=t[t.length-1];if("function"!=typeof n)return e.apply(this,t);e.apply(this,t.slice(0,-1)).then((e=>n(null,e)),n)}),"name",{value:e.name})}},ue=y.default,oe=process.cwd,ie=null,se=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return ie||(ie=oe.call(process)),ie};try{process.cwd()}catch(e){}if("function"==typeof process.chdir){var ce=process.chdir;process.chdir=function(e){ie=null,ce.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,ce)}var ae=function(e){ue.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&function(e){e.lchmod=function(t,n,r){e.open(t,ue.O_WRONLY|ue.O_SYMLINK,n,(function(t,u){t?r&&r(t):e.fchmod(u,n,(function(t){e.close(u,(function(e){r&&r(t||e)}))}))}))},e.lchmodSync=function(t,n){var r,u=e.openSync(t,ue.O_WRONLY|ue.O_SYMLINK,n),o=!0;try{r=e.fchmodSync(u,n),o=!1}finally{if(o)try{e.closeSync(u)}catch(e){}else e.closeSync(u)}return r}}(e);e.lutimes||function(e){ue.hasOwnProperty("O_SYMLINK")&&e.futimes?(e.lutimes=function(t,n,r,u){e.open(t,ue.O_SYMLINK,(function(t,o){t?u&&u(t):e.futimes(o,n,r,(function(t){e.close(o,(function(e){u&&u(t||e)}))}))}))},e.lutimesSync=function(t,n,r){var u,o=e.openSync(t,ue.O_SYMLINK),i=!0;try{u=e.futimesSync(o,n,r),i=!1}finally{if(i)try{e.closeSync(o)}catch(e){}else e.closeSync(o)}return u}):e.futimes&&(e.lutimes=function(e,t,n,r){r&&process.nextTick(r)},e.lutimesSync=function(){})}(e);e.chown=r(e.chown),e.fchown=r(e.fchown),e.lchown=r(e.lchown),e.chmod=t(e.chmod),e.fchmod=t(e.fchmod),e.lchmod=t(e.lchmod),e.chownSync=u(e.chownSync),e.fchownSync=u(e.fchownSync),e.lchownSync=u(e.lchownSync),e.chmodSync=n(e.chmodSync),e.fchmodSync=n(e.fchmodSync),e.lchmodSync=n(e.lchmodSync),e.stat=o(e.stat),e.fstat=o(e.fstat),e.lstat=o(e.lstat),e.statSync=i(e.statSync),e.fstatSync=i(e.fstatSync),e.lstatSync=i(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(e,t,n){n&&process.nextTick(n)},e.lchmodSync=function(){});e.chown&&!e.lchown&&(e.lchown=function(e,t,n,r){r&&process.nextTick(r)},e.lchownSync=function(){});"win32"===se&&(e.rename="function"!=typeof e.rename?e.rename:function(t){function n(n,r,u){var o=Date.now(),i=0;t(n,r,(function s(c){if(c&&("EACCES"===c.code||"EPERM"===c.code||"EBUSY"===c.code)&&Date.now()-o<6e4)return setTimeout((function(){e.stat(r,(function(e,o){e&&"ENOENT"===e.code?t(n,r,s):u(c)}))}),i),void(i<100&&(i+=10));u&&u(c)}))}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n}(e.rename));function t(t){return t?function(n,r,u){return t.call(e,n,r,(function(e){s(e)&&(e=null),u&&u.apply(this,arguments)}))}:t}function n(t){return t?function(n,r){try{return t.call(e,n,r)}catch(e){if(!s(e))throw e}}:t}function r(t){return t?function(n,r,u,o){return t.call(e,n,r,u,(function(e){s(e)&&(e=null),o&&o.apply(this,arguments)}))}:t}function u(t){return t?function(n,r,u){try{return t.call(e,n,r,u)}catch(e){if(!s(e))throw e}}:t}function o(t){return t?function(n,r,u){function o(e,t){t&&(t.uid<0&&(t.uid+=4294967296),t.gid<0&&(t.gid+=4294967296)),u&&u.apply(this,arguments)}return"function"==typeof r&&(u=r,r=null),r?t.call(e,n,r,o):t.call(e,n,o)}:t}function i(t){return t?function(n,r){var u=r?t.call(e,n,r):t.call(e,n);return u&&(u.uid<0&&(u.uid+=4294967296),u.gid<0&&(u.gid+=4294967296)),u}:t}function s(e){return!e||("ENOSYS"===e.code||!(process.getuid&&0===process.getuid()||"EINVAL"!==e.code&&"EPERM"!==e.code))}e.read="function"!=typeof e.read?e.read:function(t){function n(n,r,u,o,i,s){var c;if(s&&"function"==typeof s){var a=0;c=function(l,f,d){if(l&&"EAGAIN"===l.code&&a<10)return a++,t.call(e,n,r,u,o,i,c);s.apply(this,arguments)}}return t.call(e,n,r,u,o,i,c)}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n}(e.read),e.readSync="function"!=typeof e.readSync?e.readSync:(c=e.readSync,function(t,n,r,u,o){for(var i=0;;)try{return c.call(e,t,n,r,u,o)}catch(e){if("EAGAIN"===e.code&&i<10){i++;continue}throw e}});var c};var le=C.default.Stream,fe=function(e){return{ReadStream:function t(n,r){if(!(this instanceof t))return new t(n,r);le.call(this);var u=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,r=r||{};for(var o=Object.keys(r),i=0,s=o.length;ithis.end)throw new Error("start must be <= end");this.pos=this.start}if(null!==this.fd)return void process.nextTick((function(){u._read()}));e.open(this.path,this.flags,this.mode,(function(e,t){if(e)return u.emit("error",e),void(u.readable=!1);u.fd=t,u.emit("open",t),u._read()}))},WriteStream:function t(n,r){if(!(this instanceof t))return new t(n,r);le.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,r=r||{};for(var u=Object.keys(r),o=0,i=u.length;o= zero");this.pos=this.start}this.busy=!1,this._queue=[],null===this.fd&&(this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}};var de=function(e){if(null===e||"object"!=typeof e)return e;if(e instanceof Object)var t={__proto__:De(e)};else t=Object.create(null);return Object.getOwnPropertyNames(e).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})),t},De=Object.getPrototypeOf||function(e){return e.__proto__};var pe,Ee,me=D.default,he=ae,ye=fe,Ce=de,Fe=F.default;function ge(e,t){Object.defineProperty(e,pe,{get:function(){return t}})}"function"==typeof Symbol&&"function"==typeof Symbol.for?(pe=Symbol.for("graceful-fs.queue"),Ee=Symbol.for("graceful-fs.previous")):(pe="___graceful-fs.queue",Ee="___graceful-fs.previous");var Ae=function(){};if(Fe.debuglog?Ae=Fe.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(Ae=function(){var e=Fe.format.apply(Fe,arguments);e="GFS4: "+e.split(/\n/).join("\nGFS4: "),console.error(e)}),!me[pe]){var ve=w[pe]||[];ge(me,ve),me.close=function(e){function t(t,n){return e.call(me,t,(function(e){e||_e(),"function"==typeof n&&n.apply(this,arguments)}))}return Object.defineProperty(t,Ee,{value:e}),t}(me.close),me.closeSync=function(e){function t(t){e.apply(me,arguments),_e()}return Object.defineProperty(t,Ee,{value:e}),t}(me.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",(function(){Ae(me[pe]),g.default.equal(me[pe].length,0)}))}w[pe]||ge(w,me[pe]);var Se,we=Oe(Ce(me));function Oe(e){he(e),e.gracefulify=Oe,e.createReadStream=function(t,n){return new e.ReadStream(t,n)},e.createWriteStream=function(t,n){return new e.WriteStream(t,n)};var t=e.readFile;e.readFile=function(e,n,r){"function"==typeof n&&(r=n,n=null);return function e(n,r,u,o){return t(n,r,(function(t){!t||"EMFILE"!==t.code&&"ENFILE"!==t.code?"function"==typeof u&&u.apply(this,arguments):be([e,[n,r,u],t,o||Date.now(),Date.now()])}))}(e,n,r)};var n=e.writeFile;e.writeFile=function(e,t,r,u){"function"==typeof r&&(u=r,r=null);return function e(t,r,u,o,i){return n(t,r,u,(function(n){!n||"EMFILE"!==n.code&&"ENFILE"!==n.code?"function"==typeof o&&o.apply(this,arguments):be([e,[t,r,u,o],n,i||Date.now(),Date.now()])}))}(e,t,r,u)};var r=e.appendFile;r&&(e.appendFile=function(e,t,n,u){"function"==typeof n&&(u=n,n=null);return function e(t,n,u,o,i){return r(t,n,u,(function(r){!r||"EMFILE"!==r.code&&"ENFILE"!==r.code?"function"==typeof o&&o.apply(this,arguments):be([e,[t,n,u,o],r,i||Date.now(),Date.now()])}))}(e,t,n,u)});var u=e.copyFile;u&&(e.copyFile=function(e,t,n,r){"function"==typeof n&&(r=n,n=0);return function e(t,n,r,o,i){return u(t,n,r,(function(u){!u||"EMFILE"!==u.code&&"ENFILE"!==u.code?"function"==typeof o&&o.apply(this,arguments):be([e,[t,n,r,o],u,i||Date.now(),Date.now()])}))}(e,t,n,r)});var o=e.readdir;e.readdir=function(e,t,n){"function"==typeof t&&(n=t,t=null);var r=i.test(process.version)?function(e,t,n,r){return o(e,u(e,t,n,r))}:function(e,t,n,r){return o(e,t,u(e,t,n,r))};return r(e,t,n);function u(e,t,n,u){return function(o,i){!o||"EMFILE"!==o.code&&"ENFILE"!==o.code?(i&&i.sort&&i.sort(),"function"==typeof n&&n.call(this,o,i)):be([r,[e,t,n],o,u||Date.now(),Date.now()])}}};var i=/^v[0-5]\./;if("v0.8"===process.version.substr(0,4)){var s=ye(e);d=s.ReadStream,D=s.WriteStream}var c=e.ReadStream;c&&(d.prototype=Object.create(c.prototype),d.prototype.open=function(){var e=this;E(e.path,e.flags,e.mode,(function(t,n){t?(e.autoClose&&e.destroy(),e.emit("error",t)):(e.fd=n,e.emit("open",n),e.read())}))});var a=e.WriteStream;a&&(D.prototype=Object.create(a.prototype),D.prototype.open=function(){var e=this;E(e.path,e.flags,e.mode,(function(t,n){t?(e.destroy(),e.emit("error",t)):(e.fd=n,e.emit("open",n))}))}),Object.defineProperty(e,"ReadStream",{get:function(){return d},set:function(e){d=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return D},set:function(e){D=e},enumerable:!0,configurable:!0});var l=d;Object.defineProperty(e,"FileReadStream",{get:function(){return l},set:function(e){l=e},enumerable:!0,configurable:!0});var f=D;function d(e,t){return this instanceof d?(c.apply(this,arguments),this):d.apply(Object.create(d.prototype),arguments)}function D(e,t){return this instanceof D?(a.apply(this,arguments),this):D.apply(Object.create(D.prototype),arguments)}Object.defineProperty(e,"FileWriteStream",{get:function(){return f},set:function(e){f=e},enumerable:!0,configurable:!0});var p=e.open;function E(e,t,n,r){return"function"==typeof n&&(r=n,n=null),function e(t,n,r,u,o){return p(t,n,r,(function(i,s){!i||"EMFILE"!==i.code&&"ENFILE"!==i.code?"function"==typeof u&&u.apply(this,arguments):be([e,[t,n,r,u],i,o||Date.now(),Date.now()])}))}(e,t,n,r)}return e.open=E,e}function be(e){Ae("ENQUEUE",e[0].name,e[1]),me[pe].push(e),Be()}function _e(){for(var e=Date.now(),t=0;t2&&(me[pe][t][3]=e,me[pe][t][4]=e);Be()}function Be(){if(clearTimeout(Se),Se=void 0,0!==me[pe].length){var e=me[pe].shift(),t=e[0],n=e[1],r=e[2],u=e[3],o=e[4];if(void 0===u)Ae("RETRY",t.name,n),t.apply(null,n);else if(Date.now()-u>=6e4){Ae("TIMEOUT",t.name,n);var i=n.pop();"function"==typeof i&&i.call(null,r)}else{var s=Date.now()-o,c=Math.max(o-u,1);s>=Math.min(1.2*c,100)?(Ae("RETRY",t.name,n),t.apply(null,n.concat([u]))):me[pe].push(e)}void 0===Se&&(Se=setTimeout(Be,0))}}process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!me.__patched&&(we=Oe(me),me.__patched=!0),function(e){const t=re.fromCallback,n=we,r=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchmod","lchown","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter((e=>"function"==typeof n[e]));Object.assign(e,n),r.forEach((r=>{e[r]=t(n[r])})),e.realpath.native=t(n.realpath.native),e.exists=function(e,t){return"function"==typeof t?n.exists(e,t):new Promise((t=>n.exists(e,t)))},e.read=function(e,t,r,u,o,i){return"function"==typeof i?n.read(e,t,r,u,o,i):new Promise(((i,s)=>{n.read(e,t,r,u,o,((e,t,n)=>{if(e)return s(e);i({bytesRead:t,buffer:n})}))}))},e.write=function(e,t,...r){return"function"==typeof r[r.length-1]?n.write(e,t,...r):new Promise(((u,o)=>{n.write(e,t,...r,((e,t,n)=>{if(e)return o(e);u({bytesWritten:t,buffer:n})}))}))},"function"==typeof n.writev&&(e.writev=function(e,t,...r){return"function"==typeof r[r.length-1]?n.writev(e,t,...r):new Promise(((u,o)=>{n.writev(e,t,...r,((e,t,n)=>{if(e)return o(e);u({bytesWritten:t,buffers:n})}))}))})}(ne);var Pe={},ke={};const xe=p.default;ke.checkPath=function(e){if("win32"===process.platform){if(/[<>:"|?*]/.test(e.replace(xe.parse(e).root,""))){const t=new Error(`Path contains invalid characters: ${e}`);throw t.code="EINVAL",t}}};const Ne=ne,{checkPath:Ie}=ke,Te=e=>"number"==typeof e?e:{mode:511,...e}.mode;Pe.makeDir=async(e,t)=>(Ie(e),Ne.mkdir(e,{mode:Te(t),recursive:!0})),Pe.makeDirSync=(e,t)=>(Ie(e),Ne.mkdirSync(e,{mode:Te(t),recursive:!0}));const Re=re.fromPromise,{makeDir:Me,makeDirSync:Le}=Pe,je=Re(Me);var $e={mkdirs:je,mkdirsSync:Le,mkdirp:je,mkdirpSync:Le,ensureDir:je,ensureDirSync:Le};const He=re.fromPromise,Je=ne;var Ge={pathExists:He((function(e){return Je.access(e).then((()=>!0)).catch((()=>!1))})),pathExistsSync:Je.existsSync};const Ve=we;var Ue=function(e,t,n,r){Ve.open(e,"r+",((e,u)=>{if(e)return r(e);Ve.futimes(u,t,n,(e=>{Ve.close(u,(t=>{r&&r(e||t)}))}))}))},We=function(e,t,n){const r=Ve.openSync(e,"r+");return Ve.futimesSync(r,t,n),Ve.closeSync(r)};const ze=ne,Ke=p.default,qe=F.default;function Ye(e,t,n){const r=n.dereference?e=>ze.stat(e,{bigint:!0}):e=>ze.lstat(e,{bigint:!0});return Promise.all([r(e),r(t).catch((e=>{if("ENOENT"===e.code)return null;throw e}))]).then((([e,t])=>({srcStat:e,destStat:t})))}function Xe(e,t){return t.ino&&t.dev&&t.ino===e.ino&&t.dev===e.dev}function Ze(e,t){const n=Ke.resolve(e).split(Ke.sep).filter((e=>e)),r=Ke.resolve(t).split(Ke.sep).filter((e=>e));return n.reduce(((e,t,n)=>e&&r[n]===t),!0)}function Qe(e,t,n){return`Cannot ${n} '${e}' to a subdirectory of itself, '${t}'.`}var et={checkPaths:function(e,t,n,r,u){qe.callbackify(Ye)(e,t,r,((r,o)=>{if(r)return u(r);const{srcStat:i,destStat:s}=o;if(s){if(Xe(i,s)){const r=Ke.basename(e),o=Ke.basename(t);return"move"===n&&r!==o&&r.toLowerCase()===o.toLowerCase()?u(null,{srcStat:i,destStat:s,isChangingCase:!0}):u(new Error("Source and destination must not be the same."))}if(i.isDirectory()&&!s.isDirectory())return u(new Error(`Cannot overwrite non-directory '${t}' with directory '${e}'.`));if(!i.isDirectory()&&s.isDirectory())return u(new Error(`Cannot overwrite directory '${t}' with non-directory '${e}'.`))}return i.isDirectory()&&Ze(e,t)?u(new Error(Qe(e,t,n))):u(null,{srcStat:i,destStat:s})}))},checkPathsSync:function(e,t,n,r){const{srcStat:u,destStat:o}=function(e,t,n){let r;const u=n.dereference?e=>ze.statSync(e,{bigint:!0}):e=>ze.lstatSync(e,{bigint:!0}),o=u(e);try{r=u(t)}catch(e){if("ENOENT"===e.code)return{srcStat:o,destStat:null};throw e}return{srcStat:o,destStat:r}}(e,t,r);if(o){if(Xe(u,o)){const r=Ke.basename(e),i=Ke.basename(t);if("move"===n&&r!==i&&r.toLowerCase()===i.toLowerCase())return{srcStat:u,destStat:o,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(u.isDirectory()&&!o.isDirectory())throw new Error(`Cannot overwrite non-directory '${t}' with directory '${e}'.`);if(!u.isDirectory()&&o.isDirectory())throw new Error(`Cannot overwrite directory '${t}' with non-directory '${e}'.`)}if(u.isDirectory()&&Ze(e,t))throw new Error(Qe(e,t,n));return{srcStat:u,destStat:o}},checkParentPaths:function e(t,n,r,u,o){const i=Ke.resolve(Ke.dirname(t)),s=Ke.resolve(Ke.dirname(r));if(s===i||s===Ke.parse(s).root)return o();ze.stat(s,{bigint:!0},((i,c)=>i?"ENOENT"===i.code?o():o(i):Xe(n,c)?o(new Error(Qe(t,r,u))):e(t,n,s,u,o)))},checkParentPathsSync:function e(t,n,r,u){const o=Ke.resolve(Ke.dirname(t)),i=Ke.resolve(Ke.dirname(r));if(i===o||i===Ke.parse(i).root)return;let s;try{s=ze.statSync(i,{bigint:!0})}catch(e){if("ENOENT"===e.code)return;throw e}if(Xe(n,s))throw new Error(Qe(t,r,u));return e(t,n,i,u)},isSrcSubdir:Ze,areIdentical:Xe};const tt=we,nt=p.default,rt=$e.mkdirs,ut=Ge.pathExists,ot=Ue,it=et;function st(e,t,n,r,u){const o=nt.dirname(n);ut(o,((i,s)=>i?u(i):s?at(e,t,n,r,u):void rt(o,(o=>o?u(o):at(e,t,n,r,u)))))}function ct(e,t,n,r,u,o){Promise.resolve(u.filter(n,r)).then((i=>i?e(t,n,r,u,o):o()),(e=>o(e)))}function at(e,t,n,r,u){(r.dereference?tt.stat:tt.lstat)(t,((o,i)=>o?u(o):i.isDirectory()?function(e,t,n,r,u,o){return t?Dt(n,r,u,o):function(e,t,n,r,u){tt.mkdir(n,(o=>{if(o)return u(o);Dt(t,n,r,(t=>t?u(t):dt(n,e,u)))}))}(e.mode,n,r,u,o)}(i,e,t,n,r,u):i.isFile()||i.isCharacterDevice()||i.isBlockDevice()?function(e,t,n,r,u,o){return t?function(e,t,n,r,u){if(!r.overwrite)return r.errorOnExist?u(new Error(`'${n}' already exists`)):u();tt.unlink(n,(o=>o?u(o):lt(e,t,n,r,u)))}(e,n,r,u,o):lt(e,n,r,u,o)}(i,e,t,n,r,u):i.isSymbolicLink()?function(e,t,n,r,u){tt.readlink(t,((t,o)=>t?u(t):(r.dereference&&(o=nt.resolve(process.cwd(),o)),e?void tt.readlink(n,((t,i)=>t?"EINVAL"===t.code||"UNKNOWN"===t.code?tt.symlink(o,n,u):u(t):(r.dereference&&(i=nt.resolve(process.cwd(),i)),it.isSrcSubdir(o,i)?u(new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`)):e.isDirectory()&&it.isSrcSubdir(i,o)?u(new Error(`Cannot overwrite '${i}' with '${o}'.`)):function(e,t,n){tt.unlink(t,(r=>r?n(r):tt.symlink(e,t,n)))}(o,n,u)))):tt.symlink(o,n,u))))}(e,t,n,r,u):i.isSocket()?u(new Error(`Cannot copy a socket file: ${t}`)):i.isFIFO()?u(new Error(`Cannot copy a FIFO pipe: ${t}`)):u(new Error(`Unknown file: ${t}`))))}function lt(e,t,n,r,u){tt.copyFile(t,n,(o=>o?u(o):r.preserveTimestamps?function(e,t,n,r){if(function(e){return 0==(128&e)}(e))return function(e,t,n){return dt(e,128|t,n)}(n,e,(u=>u?r(u):ft(e,t,n,r)));return ft(e,t,n,r)}(e.mode,t,n,u):dt(n,e.mode,u)))}function ft(e,t,n,r){!function(e,t,n){tt.stat(e,((e,r)=>e?n(e):ot(t,r.atime,r.mtime,n)))}(t,n,(t=>t?r(t):dt(n,e,r)))}function dt(e,t,n){return tt.chmod(e,t,n)}function Dt(e,t,n,r){tt.readdir(e,((u,o)=>u?r(u):pt(o,e,t,n,r)))}function pt(e,t,n,r,u){const o=e.pop();return o?function(e,t,n,r,u,o){const i=nt.join(n,t),s=nt.join(r,t);it.checkPaths(i,s,"copy",u,((t,c)=>{if(t)return o(t);const{destStat:a}=c;!function(e,t,n,r,u){r.filter?ct(at,e,t,n,r,u):at(e,t,n,r,u)}(a,i,s,u,(t=>t?o(t):pt(e,n,r,u,o)))}))}(e,o,t,n,r,u):u()}var Et=function(e,t,n,r){"function"!=typeof n||r?"function"==typeof n&&(n={filter:n}):(r=n,n={}),r=r||function(){},(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269"),it.checkPaths(e,t,"copy",n,((u,o)=>{if(u)return r(u);const{srcStat:i,destStat:s}=o;it.checkParentPaths(e,i,t,"copy",(u=>u?r(u):n.filter?ct(st,s,e,t,n,r):st(s,e,t,n,r)))}))};const mt=we,ht=p.default,yt=$e.mkdirsSync,Ct=We,Ft=et;function gt(e,t,n,r){const u=(r.dereference?mt.statSync:mt.lstatSync)(t);if(u.isDirectory())return function(e,t,n,r,u){return t?St(n,r,u):function(e,t,n,r){return mt.mkdirSync(n),St(t,n,r),vt(n,e)}(e.mode,n,r,u)}(u,e,t,n,r);if(u.isFile()||u.isCharacterDevice()||u.isBlockDevice())return function(e,t,n,r,u){return t?function(e,t,n,r){if(r.overwrite)return mt.unlinkSync(n),At(e,t,n,r);if(r.errorOnExist)throw new Error(`'${n}' already exists`)}(e,n,r,u):At(e,n,r,u)}(u,e,t,n,r);if(u.isSymbolicLink())return function(e,t,n,r){let u=mt.readlinkSync(t);r.dereference&&(u=ht.resolve(process.cwd(),u));if(e){let e;try{e=mt.readlinkSync(n)}catch(e){if("EINVAL"===e.code||"UNKNOWN"===e.code)return mt.symlinkSync(u,n);throw e}if(r.dereference&&(e=ht.resolve(process.cwd(),e)),Ft.isSrcSubdir(u,e))throw new Error(`Cannot copy '${u}' to a subdirectory of itself, '${e}'.`);if(mt.statSync(n).isDirectory()&&Ft.isSrcSubdir(e,u))throw new Error(`Cannot overwrite '${e}' with '${u}'.`);return function(e,t){return mt.unlinkSync(t),mt.symlinkSync(e,t)}(u,n)}return mt.symlinkSync(u,n)}(e,t,n,r);if(u.isSocket())throw new Error(`Cannot copy a socket file: ${t}`);if(u.isFIFO())throw new Error(`Cannot copy a FIFO pipe: ${t}`);throw new Error(`Unknown file: ${t}`)}function At(e,t,n,r){return mt.copyFileSync(t,n),r.preserveTimestamps&&function(e,t,n){(function(e){return 0==(128&e)})(e)&&function(e,t){vt(e,128|t)}(n,e);(function(e,t){const n=mt.statSync(e);Ct(t,n.atime,n.mtime)})(t,n)}(e.mode,t,n),vt(n,e.mode)}function vt(e,t){return mt.chmodSync(e,t)}function St(e,t,n){mt.readdirSync(e).forEach((r=>function(e,t,n,r){const u=ht.join(t,e),o=ht.join(n,e),{destStat:i}=Ft.checkPathsSync(u,o,"copy",r);return function(e,t,n,r){if(!r.filter||r.filter(t,n))return gt(e,t,n,r)}(i,u,o,r)}(r,e,t,n)))}var wt=function(e,t,n){"function"==typeof n&&(n={filter:n}),(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269");const{srcStat:r,destStat:u}=Ft.checkPathsSync(e,t,"copy",n);return Ft.checkParentPathsSync(e,r,t,"copy"),function(e,t,n,r){if(r.filter&&!r.filter(t,n))return;const u=ht.dirname(n);mt.existsSync(u)||yt(u);return gt(e,t,n,r)}(u,e,t,n)};var Ot={copy:(0,re.fromCallback)(Et),copySync:wt};const bt=we,_t=p.default,Bt=g.default,Pt="win32"===process.platform;function kt(e){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach((t=>{e[t]=e[t]||bt[t],e[t+="Sync"]=e[t]||bt[t]})),e.maxBusyTries=e.maxBusyTries||3}function xt(e,t,n){let r=0;"function"==typeof t&&(n=t,t={}),Bt(e,"rimraf: missing path"),Bt.strictEqual(typeof e,"string","rimraf: path should be a string"),Bt.strictEqual(typeof n,"function","rimraf: callback function required"),Bt(t,"rimraf: invalid options argument provided"),Bt.strictEqual(typeof t,"object","rimraf: options should be object"),kt(t),Nt(e,t,(function u(o){if(o){if(("EBUSY"===o.code||"ENOTEMPTY"===o.code||"EPERM"===o.code)&&rNt(e,t,u)),100*r)}"ENOENT"===o.code&&(o=null)}n(o)}))}function Nt(e,t,n){Bt(e),Bt(t),Bt("function"==typeof n),t.lstat(e,((r,u)=>r&&"ENOENT"===r.code?n(null):r&&"EPERM"===r.code&&Pt?It(e,t,r,n):u&&u.isDirectory()?Rt(e,t,r,n):void t.unlink(e,(r=>{if(r){if("ENOENT"===r.code)return n(null);if("EPERM"===r.code)return Pt?It(e,t,r,n):Rt(e,t,r,n);if("EISDIR"===r.code)return Rt(e,t,r,n)}return n(r)}))))}function It(e,t,n,r){Bt(e),Bt(t),Bt("function"==typeof r),t.chmod(e,438,(u=>{u?r("ENOENT"===u.code?null:n):t.stat(e,((u,o)=>{u?r("ENOENT"===u.code?null:n):o.isDirectory()?Rt(e,t,n,r):t.unlink(e,r)}))}))}function Tt(e,t,n){let r;Bt(e),Bt(t);try{t.chmodSync(e,438)}catch(e){if("ENOENT"===e.code)return;throw n}try{r=t.statSync(e)}catch(e){if("ENOENT"===e.code)return;throw n}r.isDirectory()?Lt(e,t,n):t.unlinkSync(e)}function Rt(e,t,n,r){Bt(e),Bt(t),Bt("function"==typeof r),t.rmdir(e,(u=>{!u||"ENOTEMPTY"!==u.code&&"EEXIST"!==u.code&&"EPERM"!==u.code?u&&"ENOTDIR"===u.code?r(n):r(u):function(e,t,n){Bt(e),Bt(t),Bt("function"==typeof n),t.readdir(e,((r,u)=>{if(r)return n(r);let o,i=u.length;if(0===i)return t.rmdir(e,n);u.forEach((r=>{xt(_t.join(e,r),t,(r=>{if(!o)return r?n(o=r):void(0==--i&&t.rmdir(e,n))}))}))}))}(e,t,r)}))}function Mt(e,t){let n;kt(t=t||{}),Bt(e,"rimraf: missing path"),Bt.strictEqual(typeof e,"string","rimraf: path should be a string"),Bt(t,"rimraf: missing options"),Bt.strictEqual(typeof t,"object","rimraf: options should be object");try{n=t.lstatSync(e)}catch(n){if("ENOENT"===n.code)return;"EPERM"===n.code&&Pt&&Tt(e,t,n)}try{n&&n.isDirectory()?Lt(e,t,null):t.unlinkSync(e)}catch(n){if("ENOENT"===n.code)return;if("EPERM"===n.code)return Pt?Tt(e,t,n):Lt(e,t,n);if("EISDIR"!==n.code)throw n;Lt(e,t,n)}}function Lt(e,t,n){Bt(e),Bt(t);try{t.rmdirSync(e)}catch(r){if("ENOTDIR"===r.code)throw n;if("ENOTEMPTY"===r.code||"EEXIST"===r.code||"EPERM"===r.code)!function(e,t){if(Bt(e),Bt(t),t.readdirSync(e).forEach((n=>Mt(_t.join(e,n),t))),!Pt){return t.rmdirSync(e,t)}{const n=Date.now();do{try{return t.rmdirSync(e,t)}catch{}}while(Date.now()-n<500)}}(e,t);else if("ENOENT"!==r.code)throw r}}var jt=xt;xt.sync=Mt;const $t=we,Ht=re.fromCallback,Jt=jt;var Gt={remove:Ht((function(e,t){if($t.rm)return $t.rm(e,{recursive:!0,force:!0},t);Jt(e,t)})),removeSync:function(e){if($t.rmSync)return $t.rmSync(e,{recursive:!0,force:!0});Jt.sync(e)}};const Vt=re.fromPromise,Ut=ne,Wt=p.default,zt=$e,Kt=Gt,qt=Vt((async function(e){let t;try{t=await Ut.readdir(e)}catch{return zt.mkdirs(e)}return Promise.all(t.map((t=>Kt.remove(Wt.join(e,t)))))}));function Yt(e){let t;try{t=Ut.readdirSync(e)}catch{return zt.mkdirsSync(e)}t.forEach((t=>{t=Wt.join(e,t),Kt.removeSync(t)}))}var Xt={emptyDirSync:Yt,emptydirSync:Yt,emptyDir:qt,emptydir:qt};const Zt=re.fromCallback,Qt=p.default,en=we,tn=$e;var nn={createFile:Zt((function(e,t){function n(){en.writeFile(e,"",(e=>{if(e)return t(e);t()}))}en.stat(e,((r,u)=>{if(!r&&u.isFile())return t();const o=Qt.dirname(e);en.stat(o,((e,r)=>{if(e)return"ENOENT"===e.code?tn.mkdirs(o,(e=>{if(e)return t(e);n()})):t(e);r.isDirectory()?n():en.readdir(o,(e=>{if(e)return t(e)}))}))}))})),createFileSync:function(e){let t;try{t=en.statSync(e)}catch{}if(t&&t.isFile())return;const n=Qt.dirname(e);try{en.statSync(n).isDirectory()||en.readdirSync(n)}catch(e){if(!e||"ENOENT"!==e.code)throw e;tn.mkdirsSync(n)}en.writeFileSync(e,"")}};const rn=re.fromCallback,un=p.default,on=we,sn=$e,cn=Ge.pathExists,{areIdentical:an}=et;var ln={createLink:rn((function(e,t,n){function r(e,t){on.link(e,t,(e=>{if(e)return n(e);n(null)}))}on.lstat(t,((u,o)=>{on.lstat(e,((u,i)=>{if(u)return u.message=u.message.replace("lstat","ensureLink"),n(u);if(o&&an(i,o))return n(null);const s=un.dirname(t);cn(s,((u,o)=>u?n(u):o?r(e,t):void sn.mkdirs(s,(u=>{if(u)return n(u);r(e,t)}))))}))}))})),createLinkSync:function(e,t){let n;try{n=on.lstatSync(t)}catch{}try{const t=on.lstatSync(e);if(n&&an(t,n))return}catch(e){throw e.message=e.message.replace("lstat","ensureLink"),e}const r=un.dirname(t);return on.existsSync(r)||sn.mkdirsSync(r),on.linkSync(e,t)}};const fn=p.default,dn=we,Dn=Ge.pathExists;var pn={symlinkPaths:function(e,t,n){if(fn.isAbsolute(e))return dn.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:e})));{const r=fn.dirname(t),u=fn.join(r,e);return Dn(u,((t,o)=>t?n(t):o?n(null,{toCwd:u,toDst:e}):dn.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:fn.relative(r,e)})))))}},symlinkPathsSync:function(e,t){let n;if(fn.isAbsolute(e)){if(n=dn.existsSync(e),!n)throw new Error("absolute srcpath does not exist");return{toCwd:e,toDst:e}}{const r=fn.dirname(t),u=fn.join(r,e);if(n=dn.existsSync(u),n)return{toCwd:u,toDst:e};if(n=dn.existsSync(e),!n)throw new Error("relative srcpath does not exist");return{toCwd:e,toDst:fn.relative(r,e)}}}};const En=we;var mn={symlinkType:function(e,t,n){if(n="function"==typeof t?t:n,t="function"!=typeof t&&t)return n(null,t);En.lstat(e,((e,r)=>{if(e)return n(null,"file");t=r&&r.isDirectory()?"dir":"file",n(null,t)}))},symlinkTypeSync:function(e,t){let n;if(t)return t;try{n=En.lstatSync(e)}catch{return"file"}return n&&n.isDirectory()?"dir":"file"}};const hn=re.fromCallback,yn=p.default,Cn=ne,Fn=$e.mkdirs,gn=$e.mkdirsSync,An=pn.symlinkPaths,vn=pn.symlinkPathsSync,Sn=mn.symlinkType,wn=mn.symlinkTypeSync,On=Ge.pathExists,{areIdentical:bn}=et;function _n(e,t,n,r){An(e,t,((u,o)=>{if(u)return r(u);e=o.toDst,Sn(o.toCwd,n,((n,u)=>{if(n)return r(n);const o=yn.dirname(t);On(o,((n,i)=>n?r(n):i?Cn.symlink(e,t,u,r):void Fn(o,(n=>{if(n)return r(n);Cn.symlink(e,t,u,r)}))))}))}))}var Bn={createSymlink:hn((function(e,t,n,r){r="function"==typeof n?n:r,n="function"!=typeof n&&n,Cn.lstat(t,((u,o)=>{!u&&o.isSymbolicLink()?Promise.all([Cn.stat(e),Cn.stat(t)]).then((([u,o])=>{if(bn(u,o))return r(null);_n(e,t,n,r)})):_n(e,t,n,r)}))})),createSymlinkSync:function(e,t,n){let r;try{r=Cn.lstatSync(t)}catch{}if(r&&r.isSymbolicLink()){const n=Cn.statSync(e),r=Cn.statSync(t);if(bn(n,r))return}const u=vn(e,t);e=u.toDst,n=wn(u.toCwd,n);const o=yn.dirname(t);return Cn.existsSync(o)||gn(o),Cn.symlinkSync(e,t,n)}};const{createFile:Pn,createFileSync:kn}=nn,{createLink:xn,createLinkSync:Nn}=ln,{createSymlink:In,createSymlinkSync:Tn}=Bn;var Rn={createFile:Pn,createFileSync:kn,ensureFile:Pn,ensureFileSync:kn,createLink:xn,createLinkSync:Nn,ensureLink:xn,ensureLinkSync:Nn,createSymlink:In,createSymlinkSync:Tn,ensureSymlink:In,ensureSymlinkSync:Tn};var Mn={stringify:function(e,{EOL:t="\n",finalEOL:n=!0,replacer:r=null,spaces:u}={}){const o=n?t:"";return JSON.stringify(e,r,u).replace(/\n/g,t)+o},stripBom:function(e){return Buffer.isBuffer(e)&&(e=e.toString("utf8")),e.replace(/^\uFEFF/,"")}};let Ln;try{Ln=we}catch(e){Ln=D.default}const jn=re,{stringify:$n,stripBom:Hn}=Mn;const Jn=jn.fromPromise((async function(e,t={}){"string"==typeof t&&(t={encoding:t});const n=t.fs||Ln,r=!("throws"in t)||t.throws;let u,o=await jn.fromCallback(n.readFile)(e,t);o=Hn(o);try{u=JSON.parse(o,t?t.reviver:null)}catch(t){if(r)throw t.message=`${e}: ${t.message}`,t;return null}return u}));const Gn=jn.fromPromise((async function(e,t,n={}){const r=n.fs||Ln,u=$n(t,n);await jn.fromCallback(r.writeFile)(e,u,n)}));const Vn={readFile:Jn,readFileSync:function(e,t={}){"string"==typeof t&&(t={encoding:t});const n=t.fs||Ln,r=!("throws"in t)||t.throws;try{let r=n.readFileSync(e,t);return r=Hn(r),JSON.parse(r,t.reviver)}catch(t){if(r)throw t.message=`${e}: ${t.message}`,t;return null}},writeFile:Gn,writeFileSync:function(e,t,n={}){const r=n.fs||Ln,u=$n(t,n);return r.writeFileSync(e,u,n)}};var Un={readJson:Vn.readFile,readJsonSync:Vn.readFileSync,writeJson:Vn.writeFile,writeJsonSync:Vn.writeFileSync};const Wn=re.fromCallback,zn=we,Kn=p.default,qn=$e,Yn=Ge.pathExists;var Xn={outputFile:Wn((function(e,t,n,r){"function"==typeof n&&(r=n,n="utf8");const u=Kn.dirname(e);Yn(u,((o,i)=>o?r(o):i?zn.writeFile(e,t,n,r):void qn.mkdirs(u,(u=>{if(u)return r(u);zn.writeFile(e,t,n,r)}))))})),outputFileSync:function(e,...t){const n=Kn.dirname(e);if(zn.existsSync(n))return zn.writeFileSync(e,...t);qn.mkdirsSync(n),zn.writeFileSync(e,...t)}};const{stringify:Zn}=Mn,{outputFile:Qn}=Xn;var er=async function(e,t,n={}){const r=Zn(t,n);await Qn(e,r,n)};const{stringify:tr}=Mn,{outputFileSync:nr}=Xn;var rr=function(e,t,n){const r=tr(t,n);nr(e,r,n)};const ur=re.fromPromise,or=Un;or.outputJson=ur(er),or.outputJsonSync=rr,or.outputJSON=or.outputJson,or.outputJSONSync=or.outputJsonSync,or.writeJSON=or.writeJson,or.writeJSONSync=or.writeJsonSync,or.readJSON=or.readJson,or.readJSONSync=or.readJsonSync;var ir=or;const sr=we,cr=p.default,ar=Ot.copy,lr=Gt.remove,fr=$e.mkdirp,dr=Ge.pathExists,Dr=et;function pr(e,t,n,r,u){return r?Er(e,t,n,u):n?lr(t,(r=>r?u(r):Er(e,t,n,u))):void dr(t,((r,o)=>r?u(r):o?u(new Error("dest already exists.")):Er(e,t,n,u)))}function Er(e,t,n,r){sr.rename(e,t,(u=>u?"EXDEV"!==u.code?r(u):function(e,t,n,r){const u={overwrite:n,errorOnExist:!0};ar(e,t,u,(t=>t?r(t):lr(e,r)))}(e,t,n,r):r()))}var mr=function(e,t,n,r){"function"==typeof n&&(r=n,n={});const u=n.overwrite||n.clobber||!1;Dr.checkPaths(e,t,"move",n,((n,o)=>{if(n)return r(n);const{srcStat:i,isChangingCase:s=!1}=o;Dr.checkParentPaths(e,i,t,"move",(n=>n?r(n):function(e){const t=cr.dirname(e);return cr.parse(t).root===t}(t)?pr(e,t,u,s,r):void fr(cr.dirname(t),(n=>n?r(n):pr(e,t,u,s,r)))))}))};const hr=we,yr=p.default,Cr=Ot.copySync,Fr=Gt.removeSync,gr=$e.mkdirpSync,Ar=et;function vr(e,t,n){try{hr.renameSync(e,t)}catch(r){if("EXDEV"!==r.code)throw r;return function(e,t,n){const r={overwrite:n,errorOnExist:!0};return Cr(e,t,r),Fr(e)}(e,t,n)}}var Sr=function(e,t,n){const r=(n=n||{}).overwrite||n.clobber||!1,{srcStat:u,isChangingCase:o=!1}=Ar.checkPathsSync(e,t,"move",n);return Ar.checkParentPathsSync(e,u,t,"move"),function(e){const t=yr.dirname(e);return yr.parse(t).root===t}(t)||gr(yr.dirname(t)),function(e,t,n,r){if(r)return vr(e,t,n);if(n)return Fr(t),vr(e,t,n);if(hr.existsSync(t))throw new Error("dest already exists.");return vr(e,t,n)}(e,t,r,o)};var wr,Or,br,_r,Br,Pr={move:(0,re.fromCallback)(mr),moveSync:Sr},kr={...ne,...Ot,...Xt,...Rn,...ir,...$e,...Pr,...Xn,...Ge,...Gt},xr={},Nr={exports:{}},Ir={exports:{}};function Tr(){if(Or)return wr;Or=1;var e=1e3,t=60*e,n=60*t,r=24*n,u=7*r,o=365.25*r;function i(e,t,n,r){var u=t>=1.5*n;return Math.round(e/n)+" "+r+(u?"s":"")}return wr=function(s,c){c=c||{};var a=typeof s;if("string"===a&&s.length>0)return function(i){if((i=String(i)).length>100)return;var s=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(!s)return;var c=parseFloat(s[1]);switch((s[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*o;case"weeks":case"week":case"w":return c*u;case"days":case"day":case"d":return c*r;case"hours":case"hour":case"hrs":case"hr":case"h":return c*n;case"minutes":case"minute":case"mins":case"min":case"m":return c*t;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(s);if("number"===a&&isFinite(s))return c.long?function(u){var o=Math.abs(u);if(o>=r)return i(u,o,r,"day");if(o>=n)return i(u,o,n,"hour");if(o>=t)return i(u,o,t,"minute");if(o>=e)return i(u,o,e,"second");return u+" ms"}(s):function(u){var o=Math.abs(u);if(o>=r)return Math.round(u/r)+"d";if(o>=n)return Math.round(u/n)+"h";if(o>=t)return Math.round(u/t)+"m";if(o>=e)return Math.round(u/e)+"s";return u+"ms"}(s);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(s))}}function Rr(){if(_r)return br;return _r=1,br=function(e){function t(e){let r,u,o,i=null;function s(...e){if(!s.enabled)return;const n=s,u=Number(new Date),o=u-(r||u);n.diff=o,n.prev=r,n.curr=u,r=u,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let i=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((r,u)=>{if("%%"===r)return"%";i++;const o=t.formatters[u];if("function"==typeof o){const t=e[i];r=o.call(n,t),e.splice(i,1),i--}return r})),t.formatArgs.call(n,e);(n.log||t.log).apply(n,e)}return s.namespace=e,s.useColors=t.useColors(),s.color=t.selectColor(e),s.extend=n,s.destroy=t.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==i?i:(u!==t.namespaces&&(u=t.namespaces,o=t.enabled(e)),o),set:e=>{i=e}}),"function"==typeof t.init&&t.init(s),s}function n(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function r(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(r),...t.skips.map(r).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),u=r.length;for(n=0;n{t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t{const n=e.startsWith("-")?"":1===e.length?"-":"--",r=t.indexOf(n+e),u=t.indexOf("--");return-1!==r&&(-1===u||r{}),"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{const e=function(){if($r)return jr;$r=1;const e=E.default,t=A.default,n=Vr(),{env:r}=process;let u;function o(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function i(t,o){if(0===u)return 0;if(n("color=16m")||n("color=full")||n("color=truecolor"))return 3;if(n("color=256"))return 2;if(t&&!o&&void 0===u)return 0;const i=u||0;if("dumb"===r.TERM)return i;if("win32"===process.platform){const t=e.release().split(".");return Number(t[0])>=10&&Number(t[2])>=10586?Number(t[2])>=14931?3:2:1}if("CI"in r)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some((e=>e in r))||"codeship"===r.CI_NAME?1:i;if("TEAMCITY_VERSION"in r)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(r.TEAMCITY_VERSION)?1:0;if("truecolor"===r.COLORTERM)return 3;if("TERM_PROGRAM"in r){const e=parseInt((r.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(r.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(r.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(r.TERM)||"COLORTERM"in r?1:i}return n("no-color")||n("no-colors")||n("color=false")||n("color=never")?u=0:(n("color")||n("colors")||n("color=true")||n("color=always"))&&(u=1),"FORCE_COLOR"in r&&(u="true"===r.FORCE_COLOR?1:"false"===r.FORCE_COLOR?0:0===r.FORCE_COLOR.length?1:Math.min(parseInt(r.FORCE_COLOR,10),3)),jr={supportsColor:function(e){return o(i(e,e&&e.isTTY))},stdout:o(i(!0,t.isatty(1))),stderr:o(i(!0,t.isatty(2)))}}();e&&(e.stderr||e).level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}t.inspectOpts=Object.keys(process.env).filter((e=>/^debug_/i.test(e))).reduce(((e,t)=>{const n=t.substring(6).toLowerCase().replace(/_([a-z])/g,((e,t)=>t.toUpperCase()));let r=process.env[t];return r=!!/^(yes|on|true|enabled)$/i.test(r)||!/^(no|off|false|disabled)$/i.test(r)&&("null"===r?null:Number(r)),e[n]=r,e}),{}),e.exports=Rr()(t);const{formatters:u}=e.exports;u.o=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")},u.O=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts)}}(Gr,Gr.exports)),Gr.exports}Jr=Nr,"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?Jr.exports=(Br||(Br=1,function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,u=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(u=r))})),t.splice(u,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=Rr()(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(Ir,Ir.exports)),Ir.exports):Jr.exports=Ur();var Wr=function(e){return(e=e||{}).circles?function(e){var t=[],n=[];return e.proto?function e(u){if("object"!=typeof u||null===u)return u;if(u instanceof Date)return new Date(u);if(Array.isArray(u))return r(u,e);if(u instanceof Map)return new Map(r(Array.from(u),e));if(u instanceof Set)return new Set(r(Array.from(u),e));var o={};for(var i in t.push(u),n.push(o),u){var s=u[i];if("object"!=typeof s||null===s)o[i]=s;else if(s instanceof Date)o[i]=new Date(s);else if(s instanceof Map)o[i]=new Map(r(Array.from(s),e));else if(s instanceof Set)o[i]=new Set(r(Array.from(s),e));else if(ArrayBuffer.isView(s))o[i]=zr(s);else{var c=t.indexOf(s);o[i]=-1!==c?n[c]:e(s)}}return t.pop(),n.pop(),o}:function e(u){if("object"!=typeof u||null===u)return u;if(u instanceof Date)return new Date(u);if(Array.isArray(u))return r(u,e);if(u instanceof Map)return new Map(r(Array.from(u),e));if(u instanceof Set)return new Set(r(Array.from(u),e));var o={};for(var i in t.push(u),n.push(o),u)if(!1!==Object.hasOwnProperty.call(u,i)){var s=u[i];if("object"!=typeof s||null===s)o[i]=s;else if(s instanceof Date)o[i]=new Date(s);else if(s instanceof Map)o[i]=new Map(r(Array.from(s),e));else if(s instanceof Set)o[i]=new Set(r(Array.from(s),e));else if(ArrayBuffer.isView(s))o[i]=zr(s);else{var c=t.indexOf(s);o[i]=-1!==c?n[c]:e(s)}}return t.pop(),n.pop(),o};function r(e,r){for(var u=Object.keys(e),o=new Array(u.length),i=0;i!e,Qr=e=>e&&"object"==typeof e&&!Array.isArray(e),eu=(e,t,n)=>{(Array.isArray(t)?t:[t]).forEach((t=>{if(t)throw new Error(`Problem with log4js configuration: (${Kr.inspect(e,{depth:5})}) - ${n}`)}))};var tu={configure:e=>{qr("New configuration to be validated: ",e),eu(e,Zr(Qr(e)),"must be an object."),qr(`Calling pre-processing listeners (${Yr.length})`),Yr.forEach((t=>t(e))),qr("Configuration pre-processing finished."),qr(`Calling configuration listeners (${Xr.length})`),Xr.forEach((t=>t(e))),qr("Configuration finished.")},addListener:e=>{Xr.push(e),qr(`Added listener, now ${Xr.length} listeners`)},addPreProcessingListener:e=>{Yr.push(e),qr(`Added pre-processing listener, now ${Yr.length} listeners`)},throwExceptionIf:eu,anObject:Qr,anInteger:e=>e&&"number"==typeof e&&Number.isInteger(e),validIdentifier:e=>/^[A-Za-z][A-Za-z0-9_]*$/g.test(e),not:Zr},nu={exports:{}};!function(e){function t(e,t){for(var n=e.toString();n.length-1?s:c,l=n(u.getHours()),f=n(u.getMinutes()),d=n(u.getSeconds()),D=t(u.getMilliseconds(),3),p=function(e){var t=Math.abs(e),n=String(Math.floor(t/60)),r=String(t%60);return n=("0"+n).slice(-2),r=("0"+r).slice(-2),0===e?"Z":(e<0?"+":"-")+n+":"+r}(u.getTimezoneOffset());return r.replace(/dd/g,o).replace(/MM/g,i).replace(/y{1,4}/g,a).replace(/hh/g,l).replace(/mm/g,f).replace(/ss/g,d).replace(/SSS/g,D).replace(/O/g,p)}function u(e,t,n,r){e["set"+(r?"":"UTC")+t](n)}e.exports=r,e.exports.asString=r,e.exports.parse=function(t,n,r){if(!t)throw new Error("pattern must be supplied");return function(t,n,r){var o=t.indexOf("O")<0,i=!1,s=[{pattern:/y{1,4}/,regexp:"\\d{1,4}",fn:function(e,t){u(e,"FullYear",t,o)}},{pattern:/MM/,regexp:"\\d{1,2}",fn:function(e,t){u(e,"Month",t-1,o),e.getMonth()!==t-1&&(i=!0)}},{pattern:/dd/,regexp:"\\d{1,2}",fn:function(e,t){i&&u(e,"Month",e.getMonth()-1,o),u(e,"Date",t,o)}},{pattern:/hh/,regexp:"\\d{1,2}",fn:function(e,t){u(e,"Hours",t,o)}},{pattern:/mm/,regexp:"\\d\\d",fn:function(e,t){u(e,"Minutes",t,o)}},{pattern:/ss/,regexp:"\\d\\d",fn:function(e,t){u(e,"Seconds",t,o)}},{pattern:/SSS/,regexp:"\\d\\d\\d",fn:function(e,t){u(e,"Milliseconds",t,o)}},{pattern:/O/,regexp:"[+-]\\d{1,2}:?\\d{2}?|Z",fn:function(e,t){t="Z"===t?0:t.replace(":","");var n=Math.abs(t),r=(t>0?-1:1)*(n%100+60*Math.floor(n/100));e.setUTCMinutes(e.getUTCMinutes()+r)}}],c=s.reduce((function(e,t){return t.pattern.test(e.regexp)?(t.index=e.regexp.match(t.pattern).index,e.regexp=e.regexp.replace(t.pattern,"("+t.regexp+")")):t.index=-1,e}),{regexp:t,index:[]}),a=s.filter((function(e){return e.index>-1}));a.sort((function(e,t){return e.index-t.index}));var l=new RegExp(c.regexp).exec(n);if(l){var f=r||e.exports.now();return a.forEach((function(e,t){e.fn(f,l[t+1])})),f}throw new Error("String '"+n+"' could not be parsed as '"+t+"'")}(t,n,r)},e.exports.now=function(){return new Date},e.exports.ISO8601_FORMAT="yyyy-MM-ddThh:mm:ss.SSS",e.exports.ISO8601_WITH_TZ_OFFSET_FORMAT="yyyy-MM-ddThh:mm:ss.SSSO",e.exports.DATETIME_FORMAT="dd MM yyyy hh:mm:ss.SSS",e.exports.ABSOLUTETIME_FORMAT="hh:mm:ss.SSS"}(nu);const ru=nu.exports,uu=E.default,ou=F.default,iu=p.default,su={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[90,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[91,39],yellow:[33,39]};function cu(e){return e?`[${su[e][0]}m`:""}function au(e){return e?`[${su[e][1]}m`:""}function lu(e,t){return n=ou.format("[%s] [%s] %s - ",ru.asString(e.startTime),e.level.toString(),e.categoryName),cu(r=t)+n+au(r);var n,r}function fu(e){return lu(e)+ou.format(...e.data)}function du(e){return lu(e,e.level.colour)+ou.format(...e.data)}function Du(e){return ou.format(...e.data)}function pu(e){return e.data[0]}function Eu(e,t){const n=/%(-?[0-9]+)?(\.?-?[0-9]+)?([[\]cdhmnprzxXyflos%])(\{([^}]+)\})?|([^%]+)/;function r(e){return e&&e.pid?e.pid.toString():process.pid.toString()}e=e||"%r %p %c - %m%n";const u={c:function(e,t){let n=e.categoryName;if(t){const e=parseInt(t,10),r=n.split(".");ee&&(n=r.slice(-e).join(iu.sep))}return n},l:function(e){return e.lineNumber?`${e.lineNumber}`:""},o:function(e){return e.columnNumber?`${e.columnNumber}`:""},s:function(e){return e.callStack||""}};function o(e,t,n){return u[e](t,n)}function i(e,t,n){let r=e;return r=function(e,t){let n;return e?(n=parseInt(e.substr(1),10),n>0?t.slice(0,n):t.slice(n)):t}(t,r),r=function(e,t){let n;if(e)if("-"===e.charAt(0))for(n=parseInt(e.substr(1),10);t.lengthDu,basic:()=>fu,colored:()=>du,coloured:()=>du,pattern:e=>Eu(e&&e.pattern,e&&e.tokens),dummy:()=>pu};var hu={basicLayout:fu,messagePassThroughLayout:Du,patternLayout:Eu,colouredLayout:du,coloredLayout:du,dummyLayout:pu,addLayout(e,t){mu[e]=t},layout:(e,t)=>mu[e]&&mu[e](t)};const yu=tu,Cu=["white","grey","black","blue","cyan","green","magenta","red","yellow"];class Fu{constructor(e,t,n){this.level=e,this.levelStr=t,this.colour=n}toString(){return this.levelStr}static getLevel(e,t){return e?e instanceof Fu?e:(e instanceof Object&&e.levelStr&&(e=e.levelStr),Fu[e.toString().toUpperCase()]||t):t}static addLevels(e){if(e){Object.keys(e).forEach((t=>{const n=t.toUpperCase();Fu[n]=new Fu(e[t].value,n,e[t].colour);const r=Fu.levels.findIndex((e=>e.levelStr===n));r>-1?Fu.levels[r]=Fu[n]:Fu.levels.push(Fu[n])})),Fu.levels.sort(((e,t)=>e.level-t.level))}}isLessThanOrEqualTo(e){return"string"==typeof e&&(e=Fu.getLevel(e)),this.level<=e.level}isGreaterThanOrEqualTo(e){return"string"==typeof e&&(e=Fu.getLevel(e)),this.level>=e.level}isEqualTo(e){return"string"==typeof e&&(e=Fu.getLevel(e)),this.level===e.level}}Fu.levels=[],Fu.addLevels({ALL:{value:Number.MIN_VALUE,colour:"grey"},TRACE:{value:5e3,colour:"blue"},DEBUG:{value:1e4,colour:"cyan"},INFO:{value:2e4,colour:"green"},WARN:{value:3e4,colour:"yellow"},ERROR:{value:4e4,colour:"red"},FATAL:{value:5e4,colour:"magenta"},MARK:{value:9007199254740992,colour:"grey"},OFF:{value:Number.MAX_VALUE,colour:"grey"}}),yu.addListener((e=>{const t=e.levels;if(t){yu.throwExceptionIf(e,yu.not(yu.anObject(t)),"levels must be an object");Object.keys(t).forEach((n=>{yu.throwExceptionIf(e,yu.not(yu.validIdentifier(n)),`level name "${n}" is not a valid identifier (must start with a letter, only contain A-Z,a-z,0-9,_)`),yu.throwExceptionIf(e,yu.not(yu.anObject(t[n])),`level "${n}" must be an object`),yu.throwExceptionIf(e,yu.not(t[n].value),`level "${n}" must have a 'value' property`),yu.throwExceptionIf(e,yu.not(yu.anInteger(t[n].value)),`level "${n}".value must have an integer value`),yu.throwExceptionIf(e,yu.not(t[n].colour),`level "${n}" must have a 'colour' property`),yu.throwExceptionIf(e,yu.not(Cu.indexOf(t[n].colour)>-1),`level "${n}".colour must be one of ${Cu.join(", ")}`)}))}})),yu.addListener((e=>{Fu.addLevels(e.levels)}));var gu=Fu,Au={exports:{}},vu={};/*! (c) 2020 Andrea Giammarchi */ +const{parse:Su,stringify:wu}=JSON,{keys:Ou}=Object,bu=String,_u="string",Bu={},Pu="object",ku=(e,t)=>t,xu=e=>e instanceof bu?bu(e):e,Nu=(e,t)=>typeof t===_u?new bu(t):t,Iu=(e,t,n,r)=>{const u=[];for(let o=Ou(n),{length:i}=o,s=0;s{const r=bu(t.push(n)-1);return e.set(n,r),r},Ru=(e,t)=>{const n=Su(e,Nu).map(xu),r=n[0],u=t||ku,o=typeof r===Pu&&r?Iu(n,new Set,r,u):r;return u.call({"":o},"",o)};vu.parse=Ru;const Mu=(e,t,n)=>{const r=t&&typeof t===Pu?(e,n)=>""===e||-1Su(Mu(e));vu.fromJSON=e=>Ru(wu(e));const Lu=vu,ju=gu;class $u{constructor(e,t,n,r,u){this.startTime=new Date,this.categoryName=e,this.data=n,this.level=t,this.context=Object.assign({},r),this.pid=process.pid,u&&(this.functionName=u.functionName,this.fileName=u.fileName,this.lineNumber=u.lineNumber,this.columnNumber=u.columnNumber,this.callStack=u.callStack)}serialise(){const e=this.data.map((e=>(e&&e.message&&e.stack&&(e=Object.assign({message:e.message,stack:e.stack},e)),e)));return this.data=e,Lu.stringify(this)}static deserialise(e){let t;try{const n=Lu.parse(e);n.data=n.data.map((e=>{if(e&&e.message&&e.stack){const t=new Error(e);Object.keys(e).forEach((n=>{t[n]=e[n]})),e=t}return e})),t=new $u(n.categoryName,ju.getLevel(n.level.levelStr),n.data,n.context),t.startTime=new Date(n.startTime),t.pid=n.pid,t.cluster=n.cluster}catch(n){t=new $u("log4js",ju.ERROR,["Unable to parse log:",e,"because: ",n])}return t}}var Hu=$u;const Ju=Nr.exports("log4js:clustering"),Gu=Hu,Vu=tu;let Uu=!1,Wu=null;try{Wu=require("cluster")}catch(e){Ju("cluster module not present"),Uu=!0}const zu=[];let Ku=!1,qu="NODE_APP_INSTANCE";const Yu=()=>Ku&&"0"===process.env[qu],Xu=()=>Uu||Wu.isMaster||Yu(),Zu=e=>{zu.forEach((t=>t(e)))},Qu=(e,t)=>{if(Ju("cluster message received from worker ",e,": ",t),e.topic&&e.data&&(t=e,e=void 0),t&&t.topic&&"log4js:message"===t.topic){Ju("received message: ",t.data);const e=Gu.deserialise(t.data);Zu(e)}};Uu||Vu.addListener((e=>{zu.length=0,({pm2:Ku,disableClustering:Uu,pm2InstanceVar:qu="NODE_APP_INSTANCE"}=e),Ju(`clustering disabled ? ${Uu}`),Ju(`cluster.isMaster ? ${Wu&&Wu.isMaster}`),Ju(`pm2 enabled ? ${Ku}`),Ju(`pm2InstanceVar = ${qu}`),Ju(`process.env[${qu}] = ${process.env[qu]}`),Ku&&process.removeListener("message",Qu),Wu&&Wu.removeListener&&Wu.removeListener("message",Qu),Uu||e.disableClustering?Ju("Not listening for cluster messages, because clustering disabled."):Yu()?(Ju("listening for PM2 broadcast messages"),process.on("message",Qu)):Wu.isMaster?(Ju("listening for cluster messages"),Wu.on("message",Qu)):Ju("not listening for messages, because we are not a master process")}));var eo={onlyOnMaster:(e,t)=>Xu()?e():t,isMaster:Xu,send:e=>{Xu()?Zu(e):(Ku||(e.cluster={workerId:Wu.worker.id,worker:process.pid}),process.send({topic:"log4js:message",data:e.serialise()}))},onMessage:e=>{zu.push(e)}},to={};function no(e){if("number"==typeof e&&Number.isInteger(e))return e;const t={K:1024,M:1048576,G:1073741824},n=Object.keys(t),r=e.substr(e.length-1).toLocaleUpperCase(),u=e.substring(0,e.length-1).trim();if(n.indexOf(r)<0||!Number.isInteger(Number(u)))throw Error(`maxLogSize: "${e}" is invalid`);return u*t[r]}function ro(e){return function(e,t){const n=Object.assign({},t);return Object.keys(e).forEach((r=>{n[r]&&(n[r]=e[r](t[r]))})),n}({maxLogSize:no},e)}const uo={file:ro,fileSync:ro};to.modifyConfig=e=>uo[e.type]?uo[e.type](e):e;var oo={};const io=console.log.bind(console);oo.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{io(e(n,t))}}(n,e.timezoneOffset)};var so={};so.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{process.stdout.write(`${e(n,t)}\n`)}}(n,e.timezoneOffset)};var co={};co.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{process.stderr.write(`${e(n,t)}\n`)}}(n,e.timezoneOffset)};var ao={};ao.configure=function(e,t,n,r){const u=n(e.appender);return function(e,t,n,r){const u=r.getLevel(e),o=r.getLevel(t,r.FATAL);return e=>{const t=e.level;t.isGreaterThanOrEqualTo(u)&&t.isLessThanOrEqualTo(o)&&n(e)}}(e.level,e.maxLevel,u,r)};var lo={};const fo=Nr.exports("log4js:categoryFilter");lo.configure=function(e,t,n){const r=n(e.appender);return function(e,t){return"string"==typeof e&&(e=[e]),n=>{fo(`Checking ${n.categoryName} against ${e}`),-1===e.indexOf(n.categoryName)&&(fo("Not excluded, sending to appender"),t(n))}}(e.exclude,r)};var Do={};const po=Nr.exports("log4js:noLogFilter");Do.configure=function(e,t,n){const r=n(e.appender);return function(e,t){return n=>{po(`Checking data: ${n.data} against filters: ${e}`),"string"==typeof e&&(e=[e]),e=e.filter((e=>null!=e&&""!==e));const r=new RegExp(e.join("|"),"i");(0===e.length||n.data.findIndex((e=>r.test(e)))<0)&&(po("Not excluded, sending to appender"),t(n))}}(e.exclude,r)};var Eo={},mo={exports:{}},ho={},yo={fromCallback:function(e){return Object.defineProperty((function(){if("function"!=typeof arguments[arguments.length-1])return new Promise(((t,n)=>{arguments[arguments.length]=(e,r)=>{if(e)return n(e);t(r)},arguments.length++,e.apply(this,arguments)}));e.apply(this,arguments)}),"name",{value:e.name})},fromPromise:function(e){return Object.defineProperty((function(){const t=arguments[arguments.length-1];if("function"!=typeof t)return e.apply(this,arguments);e.apply(this,arguments).then((e=>t(null,e)),t)}),"name",{value:e.name})}};!function(e){const t=yo.fromCallback,n=we,r=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchown","lchmod","link","lstat","mkdir","mkdtemp","open","readFile","readdir","readlink","realpath","rename","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter((e=>"function"==typeof n[e]));Object.keys(n).forEach((t=>{"promises"!==t&&(e[t]=n[t])})),r.forEach((r=>{e[r]=t(n[r])})),e.exists=function(e,t){return"function"==typeof t?n.exists(e,t):new Promise((t=>n.exists(e,t)))},e.read=function(e,t,r,u,o,i){return"function"==typeof i?n.read(e,t,r,u,o,i):new Promise(((i,s)=>{n.read(e,t,r,u,o,((e,t,n)=>{if(e)return s(e);i({bytesRead:t,buffer:n})}))}))},e.write=function(e,t,...r){return"function"==typeof r[r.length-1]?n.write(e,t,...r):new Promise(((u,o)=>{n.write(e,t,...r,((e,t,n)=>{if(e)return o(e);u({bytesWritten:t,buffer:n})}))}))},"function"==typeof n.realpath.native&&(e.realpath.native=t(n.realpath.native))}(ho);const Co=p.default;function Fo(e){return(e=Co.normalize(Co.resolve(e)).split(Co.sep)).length>0?e[0]:null}const go=/[<>:"|?*]/;var Ao=function(e){const t=Fo(e);return e=e.replace(t,""),go.test(e)};const vo=we,So=p.default,wo=Ao,Oo=parseInt("0777",8);var bo=function e(t,n,r,u){if("function"==typeof n?(r=n,n={}):n&&"object"==typeof n||(n={mode:n}),"win32"===process.platform&&wo(t)){const e=new Error(t+" contains invalid WIN32 path characters.");return e.code="EINVAL",r(e)}let o=n.mode;const i=n.fs||vo;void 0===o&&(o=Oo&~process.umask()),u||(u=null),r=r||function(){},t=So.resolve(t),i.mkdir(t,o,(o=>{if(!o)return r(null,u=u||t);if("ENOENT"===o.code){if(So.dirname(t)===t)return r(o);e(So.dirname(t),n,((u,o)=>{u?r(u,o):e(t,n,r,o)}))}else i.stat(t,((e,t)=>{e||!t.isDirectory()?r(o,u):r(null,u)}))}))};const _o=we,Bo=p.default,Po=Ao,ko=parseInt("0777",8);var xo=function e(t,n,r){n&&"object"==typeof n||(n={mode:n});let u=n.mode;const o=n.fs||_o;if("win32"===process.platform&&Po(t)){const e=new Error(t+" contains invalid WIN32 path characters.");throw e.code="EINVAL",e}void 0===u&&(u=ko&~process.umask()),r||(r=null),t=Bo.resolve(t);try{o.mkdirSync(t,u),r=r||t}catch(u){if("ENOENT"===u.code){if(Bo.dirname(t)===t)throw u;r=e(Bo.dirname(t),n,r),e(t,n,r)}else{let e;try{e=o.statSync(t)}catch(e){throw u}if(!e.isDirectory())throw u}}return r};const No=(0,yo.fromCallback)(bo);var Io={mkdirs:No,mkdirsSync:xo,mkdirp:No,mkdirpSync:xo,ensureDir:No,ensureDirSync:xo};const To=we;E.default,p.default;var Ro=function(e,t,n,r){To.open(e,"r+",((e,u)=>{if(e)return r(e);To.futimes(u,t,n,(e=>{To.close(u,(t=>{r&&r(e||t)}))}))}))},Mo=function(e,t,n){const r=To.openSync(e,"r+");return To.futimesSync(r,t,n),To.closeSync(r)};const Lo=we,jo=p.default,$o=10,Ho=5,Jo=0,Go=process.versions.node.split("."),Vo=Number.parseInt(Go[0],10),Uo=Number.parseInt(Go[1],10),Wo=Number.parseInt(Go[2],10);function zo(){if(Vo>$o)return!0;if(Vo===$o){if(Uo>Ho)return!0;if(Uo===Ho&&Wo>=Jo)return!0}return!1}function Ko(e,t){const n=jo.resolve(e).split(jo.sep).filter((e=>e)),r=jo.resolve(t).split(jo.sep).filter((e=>e));return n.reduce(((e,t,n)=>e&&r[n]===t),!0)}function qo(e,t,n){return`Cannot ${n} '${e}' to a subdirectory of itself, '${t}'.`}var Yo,Xo,Zo={checkPaths:function(e,t,n,r){!function(e,t,n){zo()?Lo.stat(e,{bigint:!0},((e,r)=>{if(e)return n(e);Lo.stat(t,{bigint:!0},((e,t)=>e?"ENOENT"===e.code?n(null,{srcStat:r,destStat:null}):n(e):n(null,{srcStat:r,destStat:t})))})):Lo.stat(e,((e,r)=>{if(e)return n(e);Lo.stat(t,((e,t)=>e?"ENOENT"===e.code?n(null,{srcStat:r,destStat:null}):n(e):n(null,{srcStat:r,destStat:t})))}))}(e,t,((u,o)=>{if(u)return r(u);const{srcStat:i,destStat:s}=o;return s&&s.ino&&s.dev&&s.ino===i.ino&&s.dev===i.dev?r(new Error("Source and destination must not be the same.")):i.isDirectory()&&Ko(e,t)?r(new Error(qo(e,t,n))):r(null,{srcStat:i,destStat:s})}))},checkPathsSync:function(e,t,n){const{srcStat:r,destStat:u}=function(e,t){let n,r;n=zo()?Lo.statSync(e,{bigint:!0}):Lo.statSync(e);try{r=zo()?Lo.statSync(t,{bigint:!0}):Lo.statSync(t)}catch(e){if("ENOENT"===e.code)return{srcStat:n,destStat:null};throw e}return{srcStat:n,destStat:r}}(e,t);if(u&&u.ino&&u.dev&&u.ino===r.ino&&u.dev===r.dev)throw new Error("Source and destination must not be the same.");if(r.isDirectory()&&Ko(e,t))throw new Error(qo(e,t,n));return{srcStat:r,destStat:u}},checkParentPaths:function e(t,n,r,u,o){const i=jo.resolve(jo.dirname(t)),s=jo.resolve(jo.dirname(r));if(s===i||s===jo.parse(s).root)return o();zo()?Lo.stat(s,{bigint:!0},((i,c)=>i?"ENOENT"===i.code?o():o(i):c.ino&&c.dev&&c.ino===n.ino&&c.dev===n.dev?o(new Error(qo(t,r,u))):e(t,n,s,u,o))):Lo.stat(s,((i,c)=>i?"ENOENT"===i.code?o():o(i):c.ino&&c.dev&&c.ino===n.ino&&c.dev===n.dev?o(new Error(qo(t,r,u))):e(t,n,s,u,o)))},checkParentPathsSync:function e(t,n,r,u){const o=jo.resolve(jo.dirname(t)),i=jo.resolve(jo.dirname(r));if(i===o||i===jo.parse(i).root)return;let s;try{s=zo()?Lo.statSync(i,{bigint:!0}):Lo.statSync(i)}catch(e){if("ENOENT"===e.code)return;throw e}if(s.ino&&s.dev&&s.ino===n.ino&&s.dev===n.dev)throw new Error(qo(t,r,u));return e(t,n,i,u)},isSrcSubdir:Ko};const Qo=we,ei=p.default,ti=Io.mkdirsSync,ni=Mo,ri=Zo;function ui(e,t,n,r){if(!r.filter||r.filter(t,n))return function(e,t,n,r){const u=r.dereference?Qo.statSync:Qo.lstatSync,o=u(t);if(o.isDirectory())return function(e,t,n,r,u){if(!t)return function(e,t,n,r){return Qo.mkdirSync(n),ii(t,n,r),Qo.chmodSync(n,e.mode)}(e,n,r,u);if(t&&!t.isDirectory())throw new Error(`Cannot overwrite non-directory '${r}' with directory '${n}'.`);return ii(n,r,u)}(o,e,t,n,r);if(o.isFile()||o.isCharacterDevice()||o.isBlockDevice())return function(e,t,n,r,u){return t?function(e,t,n,r){if(r.overwrite)return Qo.unlinkSync(n),oi(e,t,n,r);if(r.errorOnExist)throw new Error(`'${n}' already exists`)}(e,n,r,u):oi(e,n,r,u)}(o,e,t,n,r);if(o.isSymbolicLink())return function(e,t,n,r){let u=Qo.readlinkSync(t);r.dereference&&(u=ei.resolve(process.cwd(),u));if(e){let e;try{e=Qo.readlinkSync(n)}catch(e){if("EINVAL"===e.code||"UNKNOWN"===e.code)return Qo.symlinkSync(u,n);throw e}if(r.dereference&&(e=ei.resolve(process.cwd(),e)),ri.isSrcSubdir(u,e))throw new Error(`Cannot copy '${u}' to a subdirectory of itself, '${e}'.`);if(Qo.statSync(n).isDirectory()&&ri.isSrcSubdir(e,u))throw new Error(`Cannot overwrite '${e}' with '${u}'.`);return function(e,t){return Qo.unlinkSync(t),Qo.symlinkSync(e,t)}(u,n)}return Qo.symlinkSync(u,n)}(e,t,n,r)}(e,t,n,r)}function oi(e,t,n,r){return"function"==typeof Qo.copyFileSync?(Qo.copyFileSync(t,n),Qo.chmodSync(n,e.mode),r.preserveTimestamps?ni(n,e.atime,e.mtime):void 0):function(e,t,n,r){const u=65536,o=(Xo?Yo:(Xo=1,Yo=function(e){if("function"==typeof Buffer.allocUnsafe)try{return Buffer.allocUnsafe(e)}catch(t){return new Buffer(e)}return new Buffer(e)}))(u),i=Qo.openSync(t,"r"),s=Qo.openSync(n,"w",e.mode);let c=0;for(;cfunction(e,t,n,r){const u=ei.join(t,e),o=ei.join(n,e),{destStat:i}=ri.checkPathsSync(u,o,"copy");return ui(i,u,o,r)}(r,e,t,n)))}var si=function(e,t,n){"function"==typeof n&&(n={filter:n}),(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269");const{srcStat:r,destStat:u}=ri.checkPathsSync(e,t,"copy");return ri.checkParentPathsSync(e,r,t,"copy"),function(e,t,n,r){if(r.filter&&!r.filter(t,n))return;const u=ei.dirname(n);Qo.existsSync(u)||ti(u);return ui(e,t,n,r)}(u,e,t,n)},ci={copySync:si};const ai=yo.fromPromise,li=ho;var fi={pathExists:ai((function(e){return li.access(e).then((()=>!0)).catch((()=>!1))})),pathExistsSync:li.existsSync};const di=we,Di=p.default,pi=Io.mkdirs,Ei=fi.pathExists,mi=Ro,hi=Zo;function yi(e,t,n,r,u){const o=Di.dirname(n);Ei(o,((i,s)=>i?u(i):s?Fi(e,t,n,r,u):void pi(o,(o=>o?u(o):Fi(e,t,n,r,u)))))}function Ci(e,t,n,r,u,o){Promise.resolve(u.filter(n,r)).then((i=>i?e(t,n,r,u,o):o()),(e=>o(e)))}function Fi(e,t,n,r,u){return r.filter?Ci(gi,e,t,n,r,u):gi(e,t,n,r,u)}function gi(e,t,n,r,u){(r.dereference?di.stat:di.lstat)(t,((o,i)=>o?u(o):i.isDirectory()?function(e,t,n,r,u,o){if(!t)return function(e,t,n,r,u){di.mkdir(n,(o=>{if(o)return u(o);Si(t,n,r,(t=>t?u(t):di.chmod(n,e.mode,u)))}))}(e,n,r,u,o);if(t&&!t.isDirectory())return o(new Error(`Cannot overwrite non-directory '${r}' with directory '${n}'.`));return Si(n,r,u,o)}(i,e,t,n,r,u):i.isFile()||i.isCharacterDevice()||i.isBlockDevice()?function(e,t,n,r,u,o){return t?function(e,t,n,r,u){if(!r.overwrite)return r.errorOnExist?u(new Error(`'${n}' already exists`)):u();di.unlink(n,(o=>o?u(o):Ai(e,t,n,r,u)))}(e,n,r,u,o):Ai(e,n,r,u,o)}(i,e,t,n,r,u):i.isSymbolicLink()?function(e,t,n,r,u){di.readlink(t,((t,o)=>t?u(t):(r.dereference&&(o=Di.resolve(process.cwd(),o)),e?void di.readlink(n,((t,i)=>t?"EINVAL"===t.code||"UNKNOWN"===t.code?di.symlink(o,n,u):u(t):(r.dereference&&(i=Di.resolve(process.cwd(),i)),hi.isSrcSubdir(o,i)?u(new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`)):e.isDirectory()&&hi.isSrcSubdir(i,o)?u(new Error(`Cannot overwrite '${i}' with '${o}'.`)):function(e,t,n){di.unlink(t,(r=>r?n(r):di.symlink(e,t,n)))}(o,n,u)))):di.symlink(o,n,u))))}(e,t,n,r,u):void 0))}function Ai(e,t,n,r,u){return"function"==typeof di.copyFile?di.copyFile(t,n,(t=>t?u(t):vi(e,n,r,u))):function(e,t,n,r,u){const o=di.createReadStream(t);o.on("error",(e=>u(e))).once("open",(()=>{const t=di.createWriteStream(n,{mode:e.mode});t.on("error",(e=>u(e))).on("open",(()=>o.pipe(t))).once("close",(()=>vi(e,n,r,u)))}))}(e,t,n,r,u)}function vi(e,t,n,r){di.chmod(t,e.mode,(u=>u?r(u):n.preserveTimestamps?mi(t,e.atime,e.mtime,r):r()))}function Si(e,t,n,r){di.readdir(e,((u,o)=>u?r(u):wi(o,e,t,n,r)))}function wi(e,t,n,r,u){const o=e.pop();return o?function(e,t,n,r,u,o){const i=Di.join(n,t),s=Di.join(r,t);hi.checkPaths(i,s,"copy",((t,c)=>{if(t)return o(t);const{destStat:a}=c;Fi(a,i,s,u,(t=>t?o(t):wi(e,n,r,u,o)))}))}(e,o,t,n,r,u):u()}var Oi=function(e,t,n,r){"function"!=typeof n||r?"function"==typeof n&&(n={filter:n}):(r=n,n={}),r=r||function(){},(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269"),hi.checkPaths(e,t,"copy",((u,o)=>{if(u)return r(u);const{srcStat:i,destStat:s}=o;hi.checkParentPaths(e,i,t,"copy",(u=>u?r(u):n.filter?Ci(yi,s,e,t,n,r):yi(s,e,t,n,r)))}))};var bi={copy:(0,yo.fromCallback)(Oi)};const _i=we,Bi=p.default,Pi=g.default,ki="win32"===process.platform;function xi(e){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach((t=>{e[t]=e[t]||_i[t],e[t+="Sync"]=e[t]||_i[t]})),e.maxBusyTries=e.maxBusyTries||3}function Ni(e,t,n){let r=0;"function"==typeof t&&(n=t,t={}),Pi(e,"rimraf: missing path"),Pi.strictEqual(typeof e,"string","rimraf: path should be a string"),Pi.strictEqual(typeof n,"function","rimraf: callback function required"),Pi(t,"rimraf: invalid options argument provided"),Pi.strictEqual(typeof t,"object","rimraf: options should be object"),xi(t),Ii(e,t,(function u(o){if(o){if(("EBUSY"===o.code||"ENOTEMPTY"===o.code||"EPERM"===o.code)&&rIi(e,t,u)),100*r)}"ENOENT"===o.code&&(o=null)}n(o)}))}function Ii(e,t,n){Pi(e),Pi(t),Pi("function"==typeof n),t.lstat(e,((r,u)=>r&&"ENOENT"===r.code?n(null):r&&"EPERM"===r.code&&ki?Ti(e,t,r,n):u&&u.isDirectory()?Mi(e,t,r,n):void t.unlink(e,(r=>{if(r){if("ENOENT"===r.code)return n(null);if("EPERM"===r.code)return ki?Ti(e,t,r,n):Mi(e,t,r,n);if("EISDIR"===r.code)return Mi(e,t,r,n)}return n(r)}))))}function Ti(e,t,n,r){Pi(e),Pi(t),Pi("function"==typeof r),n&&Pi(n instanceof Error),t.chmod(e,438,(u=>{u?r("ENOENT"===u.code?null:n):t.stat(e,((u,o)=>{u?r("ENOENT"===u.code?null:n):o.isDirectory()?Mi(e,t,n,r):t.unlink(e,r)}))}))}function Ri(e,t,n){let r;Pi(e),Pi(t),n&&Pi(n instanceof Error);try{t.chmodSync(e,438)}catch(e){if("ENOENT"===e.code)return;throw n}try{r=t.statSync(e)}catch(e){if("ENOENT"===e.code)return;throw n}r.isDirectory()?ji(e,t,n):t.unlinkSync(e)}function Mi(e,t,n,r){Pi(e),Pi(t),n&&Pi(n instanceof Error),Pi("function"==typeof r),t.rmdir(e,(u=>{!u||"ENOTEMPTY"!==u.code&&"EEXIST"!==u.code&&"EPERM"!==u.code?u&&"ENOTDIR"===u.code?r(n):r(u):function(e,t,n){Pi(e),Pi(t),Pi("function"==typeof n),t.readdir(e,((r,u)=>{if(r)return n(r);let o,i=u.length;if(0===i)return t.rmdir(e,n);u.forEach((r=>{Ni(Bi.join(e,r),t,(r=>{if(!o)return r?n(o=r):void(0==--i&&t.rmdir(e,n))}))}))}))}(e,t,r)}))}function Li(e,t){let n;xi(t=t||{}),Pi(e,"rimraf: missing path"),Pi.strictEqual(typeof e,"string","rimraf: path should be a string"),Pi(t,"rimraf: missing options"),Pi.strictEqual(typeof t,"object","rimraf: options should be object");try{n=t.lstatSync(e)}catch(n){if("ENOENT"===n.code)return;"EPERM"===n.code&&ki&&Ri(e,t,n)}try{n&&n.isDirectory()?ji(e,t,null):t.unlinkSync(e)}catch(n){if("ENOENT"===n.code)return;if("EPERM"===n.code)return ki?Ri(e,t,n):ji(e,t,n);if("EISDIR"!==n.code)throw n;ji(e,t,n)}}function ji(e,t,n){Pi(e),Pi(t),n&&Pi(n instanceof Error);try{t.rmdirSync(e)}catch(r){if("ENOTDIR"===r.code)throw n;if("ENOTEMPTY"===r.code||"EEXIST"===r.code||"EPERM"===r.code)!function(e,t){if(Pi(e),Pi(t),t.readdirSync(e).forEach((n=>Li(Bi.join(e,n),t))),!ki){return t.rmdirSync(e,t)}{const n=Date.now();do{try{return t.rmdirSync(e,t)}catch(e){}}while(Date.now()-n<500)}}(e,t);else if("ENOENT"!==r.code)throw r}}var $i=Ni;Ni.sync=Li;const Hi=$i;var Ji={remove:(0,yo.fromCallback)(Hi),removeSync:Hi.sync};const Gi=yo.fromCallback,Vi=we,Ui=p.default,Wi=Io,zi=Ji,Ki=Gi((function(e,t){t=t||function(){},Vi.readdir(e,((n,r)=>{if(n)return Wi.mkdirs(e,t);r=r.map((t=>Ui.join(e,t))),function e(){const n=r.pop();if(!n)return t();zi.remove(n,(n=>{if(n)return t(n);e()}))}()}))}));function qi(e){let t;try{t=Vi.readdirSync(e)}catch(t){return Wi.mkdirsSync(e)}t.forEach((t=>{t=Ui.join(e,t),zi.removeSync(t)}))}var Yi={emptyDirSync:qi,emptydirSync:qi,emptyDir:Ki,emptydir:Ki};const Xi=yo.fromCallback,Zi=p.default,Qi=we,es=Io,ts=fi.pathExists;var ns={createFile:Xi((function(e,t){function n(){Qi.writeFile(e,"",(e=>{if(e)return t(e);t()}))}Qi.stat(e,((r,u)=>{if(!r&&u.isFile())return t();const o=Zi.dirname(e);ts(o,((e,r)=>e?t(e):r?n():void es.mkdirs(o,(e=>{if(e)return t(e);n()}))))}))})),createFileSync:function(e){let t;try{t=Qi.statSync(e)}catch(e){}if(t&&t.isFile())return;const n=Zi.dirname(e);Qi.existsSync(n)||es.mkdirsSync(n),Qi.writeFileSync(e,"")}};const rs=yo.fromCallback,us=p.default,os=we,is=Io,ss=fi.pathExists;var cs={createLink:rs((function(e,t,n){function r(e,t){os.link(e,t,(e=>{if(e)return n(e);n(null)}))}ss(t,((u,o)=>u?n(u):o?n(null):void os.lstat(e,(u=>{if(u)return u.message=u.message.replace("lstat","ensureLink"),n(u);const o=us.dirname(t);ss(o,((u,i)=>u?n(u):i?r(e,t):void is.mkdirs(o,(u=>{if(u)return n(u);r(e,t)}))))}))))})),createLinkSync:function(e,t){if(os.existsSync(t))return;try{os.lstatSync(e)}catch(e){throw e.message=e.message.replace("lstat","ensureLink"),e}const n=us.dirname(t);return os.existsSync(n)||is.mkdirsSync(n),os.linkSync(e,t)}};const as=p.default,ls=we,fs=fi.pathExists;var ds={symlinkPaths:function(e,t,n){if(as.isAbsolute(e))return ls.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:e})));{const r=as.dirname(t),u=as.join(r,e);return fs(u,((t,o)=>t?n(t):o?n(null,{toCwd:u,toDst:e}):ls.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:as.relative(r,e)})))))}},symlinkPathsSync:function(e,t){let n;if(as.isAbsolute(e)){if(n=ls.existsSync(e),!n)throw new Error("absolute srcpath does not exist");return{toCwd:e,toDst:e}}{const r=as.dirname(t),u=as.join(r,e);if(n=ls.existsSync(u),n)return{toCwd:u,toDst:e};if(n=ls.existsSync(e),!n)throw new Error("relative srcpath does not exist");return{toCwd:e,toDst:as.relative(r,e)}}}};const Ds=we;var ps={symlinkType:function(e,t,n){if(n="function"==typeof t?t:n,t="function"!=typeof t&&t)return n(null,t);Ds.lstat(e,((e,r)=>{if(e)return n(null,"file");t=r&&r.isDirectory()?"dir":"file",n(null,t)}))},symlinkTypeSync:function(e,t){let n;if(t)return t;try{n=Ds.lstatSync(e)}catch(e){return"file"}return n&&n.isDirectory()?"dir":"file"}};const Es=yo.fromCallback,ms=p.default,hs=we,ys=Io.mkdirs,Cs=Io.mkdirsSync,Fs=ds.symlinkPaths,gs=ds.symlinkPathsSync,As=ps.symlinkType,vs=ps.symlinkTypeSync,Ss=fi.pathExists;var ws={createSymlink:Es((function(e,t,n,r){r="function"==typeof n?n:r,n="function"!=typeof n&&n,Ss(t,((u,o)=>u?r(u):o?r(null):void Fs(e,t,((u,o)=>{if(u)return r(u);e=o.toDst,As(o.toCwd,n,((n,u)=>{if(n)return r(n);const o=ms.dirname(t);Ss(o,((n,i)=>n?r(n):i?hs.symlink(e,t,u,r):void ys(o,(n=>{if(n)return r(n);hs.symlink(e,t,u,r)}))))}))}))))})),createSymlinkSync:function(e,t,n){if(hs.existsSync(t))return;const r=gs(e,t);e=r.toDst,n=vs(r.toCwd,n);const u=ms.dirname(t);return hs.existsSync(u)||Cs(u),hs.symlinkSync(e,t,n)}};var Os,bs={createFile:ns.createFile,createFileSync:ns.createFileSync,ensureFile:ns.createFile,ensureFileSync:ns.createFileSync,createLink:cs.createLink,createLinkSync:cs.createLinkSync,ensureLink:cs.createLink,ensureLinkSync:cs.createLinkSync,createSymlink:ws.createSymlink,createSymlinkSync:ws.createSymlinkSync,ensureSymlink:ws.createSymlink,ensureSymlinkSync:ws.createSymlinkSync};try{Os=we}catch(e){Os=D.default}function _s(e,t){var n,r="\n";return"object"==typeof t&&null!==t&&(t.spaces&&(n=t.spaces),t.EOL&&(r=t.EOL)),JSON.stringify(e,t?t.replacer:null,n).replace(/\n/g,r)+r}function Bs(e){return Buffer.isBuffer(e)&&(e=e.toString("utf8")),e=e.replace(/^\uFEFF/,"")}var Ps={readFile:function(e,t,n){null==n&&(n=t,t={}),"string"==typeof t&&(t={encoding:t});var r=(t=t||{}).fs||Os,u=!0;"throws"in t&&(u=t.throws),r.readFile(e,t,(function(r,o){if(r)return n(r);var i;o=Bs(o);try{i=JSON.parse(o,t?t.reviver:null)}catch(t){return u?(t.message=e+": "+t.message,n(t)):n(null,null)}n(null,i)}))},readFileSync:function(e,t){"string"==typeof(t=t||{})&&(t={encoding:t});var n=t.fs||Os,r=!0;"throws"in t&&(r=t.throws);try{var u=n.readFileSync(e,t);return u=Bs(u),JSON.parse(u,t.reviver)}catch(t){if(r)throw t.message=e+": "+t.message,t;return null}},writeFile:function(e,t,n,r){null==r&&(r=n,n={});var u=(n=n||{}).fs||Os,o="";try{o=_s(t,n)}catch(e){return void(r&&r(e,null))}u.writeFile(e,o,n,r)},writeFileSync:function(e,t,n){var r=(n=n||{}).fs||Os,u=_s(t,n);return r.writeFileSync(e,u,n)}},ks=Ps;const xs=yo.fromCallback,Ns=ks;var Is={readJson:xs(Ns.readFile),readJsonSync:Ns.readFileSync,writeJson:xs(Ns.writeFile),writeJsonSync:Ns.writeFileSync};const Ts=p.default,Rs=Io,Ms=fi.pathExists,Ls=Is;var js=function(e,t,n,r){"function"==typeof n&&(r=n,n={});const u=Ts.dirname(e);Ms(u,((o,i)=>o?r(o):i?Ls.writeJson(e,t,n,r):void Rs.mkdirs(u,(u=>{if(u)return r(u);Ls.writeJson(e,t,n,r)}))))};const $s=we,Hs=p.default,Js=Io,Gs=Is;var Vs=function(e,t,n){const r=Hs.dirname(e);$s.existsSync(r)||Js.mkdirsSync(r),Gs.writeJsonSync(e,t,n)};const Us=yo.fromCallback,Ws=Is;Ws.outputJson=Us(js),Ws.outputJsonSync=Vs,Ws.outputJSON=Ws.outputJson,Ws.outputJSONSync=Ws.outputJsonSync,Ws.writeJSON=Ws.writeJson,Ws.writeJSONSync=Ws.writeJsonSync,Ws.readJSON=Ws.readJson,Ws.readJSONSync=Ws.readJsonSync;var zs=Ws;const Ks=we,qs=p.default,Ys=ci.copySync,Xs=Ji.removeSync,Zs=Io.mkdirpSync,Qs=Zo;function ec(e,t,n){try{Ks.renameSync(e,t)}catch(r){if("EXDEV"!==r.code)throw r;return function(e,t,n){const r={overwrite:n,errorOnExist:!0};return Ys(e,t,r),Xs(e)}(e,t,n)}}var tc=function(e,t,n){const r=(n=n||{}).overwrite||n.clobber||!1,{srcStat:u}=Qs.checkPathsSync(e,t,"move");return Qs.checkParentPathsSync(e,u,t,"move"),Zs(qs.dirname(t)),function(e,t,n){if(n)return Xs(t),ec(e,t,n);if(Ks.existsSync(t))throw new Error("dest already exists.");return ec(e,t,n)}(e,t,r)},nc={moveSync:tc};const rc=we,uc=p.default,oc=bi.copy,ic=Ji.remove,sc=Io.mkdirp,cc=fi.pathExists,ac=Zo;function lc(e,t,n,r){rc.rename(e,t,(u=>u?"EXDEV"!==u.code?r(u):function(e,t,n,r){const u={overwrite:n,errorOnExist:!0};oc(e,t,u,(t=>t?r(t):ic(e,r)))}(e,t,n,r):r()))}var fc=function(e,t,n,r){"function"==typeof n&&(r=n,n={});const u=n.overwrite||n.clobber||!1;ac.checkPaths(e,t,"move",((n,o)=>{if(n)return r(n);const{srcStat:i}=o;ac.checkParentPaths(e,i,t,"move",(n=>{if(n)return r(n);sc(uc.dirname(t),(n=>n?r(n):function(e,t,n,r){if(n)return ic(t,(u=>u?r(u):lc(e,t,n,r)));cc(t,((u,o)=>u?r(u):o?r(new Error("dest already exists.")):lc(e,t,n,r)))}(e,t,u,r)))}))}))};var dc={move:(0,yo.fromCallback)(fc)};const Dc=yo.fromCallback,pc=we,Ec=p.default,mc=Io,hc=fi.pathExists;var yc={outputFile:Dc((function(e,t,n,r){"function"==typeof n&&(r=n,n="utf8");const u=Ec.dirname(e);hc(u,((o,i)=>o?r(o):i?pc.writeFile(e,t,n,r):void mc.mkdirs(u,(u=>{if(u)return r(u);pc.writeFile(e,t,n,r)}))))})),outputFileSync:function(e,...t){const n=Ec.dirname(e);if(pc.existsSync(n))return pc.writeFileSync(e,...t);mc.mkdirsSync(n),pc.writeFileSync(e,...t)}};!function(e){e.exports=Object.assign({},ho,ci,bi,Yi,bs,zs,Io,nc,dc,yc,fi,Ji);const t=D.default;Object.getOwnPropertyDescriptor(t,"promises")&&Object.defineProperty(e.exports,"promises",{get:()=>t.promises})}(mo);const Cc=Nr.exports("streamroller:fileNameFormatter"),Fc=p.default;const gc=Nr.exports("streamroller:fileNameParser"),Ac=nu.exports;const vc=Nr.exports("streamroller:moveAndMaybeCompressFile"),Sc=mo.exports,wc=v.default;var Oc=async(e,t,n)=>{if(n=function(e){const t={mode:parseInt("0600",8),compress:!1},n=Object.assign({},t,e);return vc(`_parseOption: moveAndMaybeCompressFile called with option=${JSON.stringify(n)}`),n}(n),e!==t){if(await Sc.pathExists(e))if(vc(`moveAndMaybeCompressFile: moving file from ${e} to ${t} ${n.compress?"with":"without"} compress`),n.compress)await new Promise(((r,u)=>{let o=!1;const i=Sc.createWriteStream(t,{mode:n.mode,flags:"wx"}).on("open",(()=>{o=!0;const t=Sc.createReadStream(e).on("open",(()=>{t.pipe(wc.createGzip()).pipe(i)})).on("error",(t=>{vc(`moveAndMaybeCompressFile: error reading ${e}`,t),i.destroy(t)}))})).on("finish",(()=>{vc(`moveAndMaybeCompressFile: finished compressing ${t}, deleting ${e}`),Sc.unlink(e).then(r).catch((t=>{vc(`moveAndMaybeCompressFile: error deleting ${e}, truncating instead`,t),Sc.truncate(e).then(r).catch((t=>{vc(`moveAndMaybeCompressFile: error truncating ${e}`,t),u(t)}))}))})).on("error",(e=>{o?(vc(`moveAndMaybeCompressFile: error writing ${t}, deleting`,e),Sc.unlink(t).then((()=>{u(e)})).catch((e=>{vc(`moveAndMaybeCompressFile: error deleting ${t}`,e),u(e)}))):(vc(`moveAndMaybeCompressFile: error creating ${t}`,e),u(e))}))})).catch((()=>{}));else{vc(`moveAndMaybeCompressFile: renaming ${e} to ${t}`);try{await Sc.move(e,t,{overwrite:!0})}catch(n){if(vc(`moveAndMaybeCompressFile: error renaming ${e} to ${t}`,n),"ENOENT"!==n.code){vc("moveAndMaybeCompressFile: trying copy+truncate instead");try{await Sc.copy(e,t,{overwrite:!0}),await Sc.truncate(e)}catch(e){vc("moveAndMaybeCompressFile: error copy+truncate",e)}}}}}else vc("moveAndMaybeCompressFile: source and target are the same, not doing anything")};const bc=Nr.exports("streamroller:RollingFileWriteStream"),_c=mo.exports,Bc=p.default,Pc=E.default,kc=()=>new Date,xc=nu.exports,{Writable:Nc}=C.default,Ic=({file:e,keepFileExt:t,needsIndex:n,alwaysIncludeDate:r,compress:u,fileNameSep:o})=>{let i=o||".";const s=Fc.join(e.dir,e.name),c=t=>t+e.ext,a=(e,t,r)=>!n&&r||!t?e:e+i+t,l=(e,t,n)=>(t>0||r)&&n?e+i+n:e,f=(e,t)=>t&&u?e+".gz":e,d=t?[l,a,c,f]:[c,l,a,f];return({date:e,index:t})=>(Cc(`_formatFileName: date=${e}, index=${t}`),d.reduce(((n,r)=>r(n,t,e)),s))},Tc=({file:e,keepFileExt:t,pattern:n,fileNameSep:r})=>{let u=r||".";const o="__NOT_MATCHING__";let i=[(e,t)=>e.endsWith(".gz")?(gc("it is gzipped"),t.isCompressed=!0,e.slice(0,-1*".gz".length)):e,t?t=>t.startsWith(e.name)&&t.endsWith(e.ext)?(gc("it starts and ends with the right things"),t.slice(e.name.length+1,-1*e.ext.length)):o:t=>t.startsWith(e.base)?(gc("it starts with the right things"),t.slice(e.base.length+1)):o,n?(e,t)=>{const r=e.split(u);let o=r[r.length-1];gc("items: ",r,", indexStr: ",o);let i=e;void 0!==o&&o.match(/^\d+$/)?(i=e.slice(0,-1*(o.length+1)),gc(`dateStr is ${i}`),n&&!i&&(i=o,o="0")):o="0";try{const r=Ac.parse(n,i,new Date(0,0));return Ac.asString(n,r)!==i?e:(t.index=parseInt(o,10),t.date=i,t.timestamp=r.getTime(),"")}catch(t){return gc(`Problem parsing ${i} as ${n}, error was: `,t),e}}:(e,t)=>e.match(/^\d+$/)?(gc("it has an index"),t.index=parseInt(e,10),""):e];return e=>{let t={filename:e,index:0,isCompressed:!1};return i.reduce(((e,n)=>n(e,t)),e)?null:t}},Rc=Oc;var Mc=class extends Nc{constructor(e,t){if(bc(`constructor: creating RollingFileWriteStream. path=${e}`),"string"!=typeof e||0===e.length)throw new Error(`Invalid filename: ${e}`);if(e.endsWith(Bc.sep))throw new Error(`Filename is a directory: ${e}`);0===e.indexOf(`~${Bc.sep}`)&&(e=e.replace("~",Pc.homedir())),super(t),this.options=this._parseOption(t),this.fileObject=Bc.parse(e),""===this.fileObject.dir&&(this.fileObject=Bc.parse(Bc.join(process.cwd(),e))),this.fileFormatter=Ic({file:this.fileObject,alwaysIncludeDate:this.options.alwaysIncludePattern,needsIndex:this.options.maxSize 0`)}else delete n.maxSize;if(n.numBackups||0===n.numBackups){if(n.numBackups<0)throw new Error(`options.numBackups (${n.numBackups}) should be >= 0`);if(n.numBackups>=Number.MAX_SAFE_INTEGER)throw new Error(`options.numBackups (${n.numBackups}) should be < Number.MAX_SAFE_INTEGER`);n.numToKeep=n.numBackups+1}else if(n.numToKeep<=0)throw new Error(`options.numToKeep (${n.numToKeep}) should be > 0`);return bc(`_parseOption: creating stream with option=${JSON.stringify(n)}`),n}_final(e){this.currentFileStream.end("",this.options.encoding,e)}_write(e,t,n){this._shouldRoll().then((()=>{bc(`_write: writing chunk. file=${this.currentFileStream.path} state=${JSON.stringify(this.state)} chunk=${e}`),this.currentFileStream.write(e,t,(t=>{this.state.currentSize+=e.length,n(t)}))}))}async _shouldRoll(){(this._dateChanged()||this._tooBig())&&(bc(`_shouldRoll: rolling because dateChanged? ${this._dateChanged()} or tooBig? ${this._tooBig()}`),await this._roll())}_dateChanged(){return this.state.currentDate&&this.state.currentDate!==xc(this.options.pattern,kc())}_tooBig(){return this.state.currentSize>=this.options.maxSize}_roll(){return bc("_roll: closing the current stream"),new Promise(((e,t)=>{this.currentFileStream.end("",this.options.encoding,(()=>{this._moveOldFiles().then(e).catch(t)}))}))}async _moveOldFiles(){const e=await this._getExistingFiles();for(let t=(this.state.currentDate?e.filter((e=>e.date===this.state.currentDate)):e).length;t>=0;t--){bc(`_moveOldFiles: i = ${t}`);const e=this.fileFormatter({date:this.state.currentDate,index:t}),n=this.fileFormatter({date:this.state.currentDate,index:t+1}),r={compress:this.options.compress&&0===t,mode:this.options.mode};await Rc(e,n,r)}this.state.currentSize=0,this.state.currentDate=this.state.currentDate?xc(this.options.pattern,kc()):null,bc(`_moveOldFiles: finished rolling files. state=${JSON.stringify(this.state)}`),this._renewWriteStream(),await new Promise(((e,t)=>{this.currentFileStream.write("","utf8",(()=>{this._clean().then(e).catch(t)}))}))}async _getExistingFiles(){const e=await _c.readdir(this.fileObject.dir).catch((()=>[]));bc(`_getExistingFiles: files=${e}`);const t=e.map((e=>this.fileNameParser(e))).filter((e=>e)),n=e=>(e.timestamp?e.timestamp:kc().getTime())-e.index;return t.sort(((e,t)=>n(e)-n(t))),t}_renewWriteStream(){const e=this.fileFormatter({date:this.state.currentDate,index:0}),t=e=>{try{return _c.mkdirSync(e,{recursive:!0})}catch(n){if("ENOENT"===n.code)return t(Bc.dirname(e)),t(e);if("EEXIST"!==n.code&&"EROFS"!==n.code)throw n;try{if(_c.statSync(e).isDirectory())return e;throw n}catch(e){throw n}}};t(this.fileObject.dir);const n={flags:this.options.flags,encoding:this.options.encoding,mode:this.options.mode};var r,u;_c.appendFileSync(e,"",(r={...n},u="flags",r["flag"]=r[u],delete r[u],r)),this.currentFileStream=_c.createWriteStream(e,n),this.currentFileStream.on("error",(e=>{this.emit("error",e)}))}async _clean(){const e=await this._getExistingFiles();if(bc(`_clean: numToKeep = ${this.options.numToKeep}, existingFiles = ${e.length}`),bc("_clean: existing files are: ",e),this._tooManyFiles(e.length)){const n=e.slice(0,e.length-this.options.numToKeep).map((e=>Bc.format({dir:this.fileObject.dir,base:e.filename})));await(t=n,bc(`deleteFiles: files to delete: ${t}`),Promise.all(t.map((e=>_c.unlink(e).catch((t=>{bc(`deleteFiles: error when unlinking ${e}, ignoring. Error was ${t}`)}))))))}var t}_tooManyFiles(e){return this.options.numToKeep>0&&e>this.options.numToKeep}};const Lc=Mc;var jc=class extends Lc{constructor(e,t,n,r){r||(r={}),t&&(r.maxSize=t),r.numBackups||0===r.numBackups||(n||0===n||(n=1),r.numBackups=n),super(e,r),this.backups=r.numBackups,this.size=this.options.maxSize}get theStream(){return this.currentFileStream}};const $c=Mc;var Hc={RollingFileWriteStream:Mc,RollingFileStream:jc,DateRollingFileStream:class extends $c{constructor(e,t,n){t&&"object"==typeof t&&(n=t,t=null),n||(n={}),t||(t="yyyy-MM-dd"),n.pattern=t,n.numBackups||0===n.numBackups?n.daysToKeep=n.numBackups:(n.daysToKeep||0===n.daysToKeep?process.emitWarning("options.daysToKeep is deprecated due to the confusion it causes when used together with file size rolling. Please use options.numBackups instead.","DeprecationWarning","streamroller-DEP0001"):n.daysToKeep=1,n.numBackups=n.daysToKeep),super(e,n),this.mode=this.options.mode}get theStream(){return this.currentFileStream}}};const Jc=Nr.exports("log4js:file"),Gc=p.default,Vc=Hc,Uc=E.default.EOL;let Wc=!1;const zc=new Set;function Kc(){zc.forEach((e=>{e.sighupHandler()}))}function qc(e,t,n,r){const u=new Vc.RollingFileStream(e,t,n,r);return u.on("error",(t=>{console.error("log4js.fileAppender - Writing to file %s, error happened ",e,t)})),u.on("drain",(()=>{process.emit("log4js:pause",!1)})),u}Eo.configure=function(e,t){let n=t.basicLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),e.mode=e.mode||384,function(e,t,n,r,u,o){e=Gc.normalize(e),Jc("Creating file appender (",e,", ",n,", ",r=r||0===r?r:5,", ",u,", ",o,")");let i=qc(e,n,r,u);const s=function(e){if(i.writable){if(!0===u.removeColor){const t=/\x1b[[0-9;]*m/g;e.data=e.data.map((e=>"string"==typeof e?e.replace(t,""):e))}i.write(t(e,o)+Uc,"utf8")||process.emit("log4js:pause",!0)}};return s.reopen=function(){i.end((()=>{i=qc(e,n,r,u)}))},s.sighupHandler=function(){Jc("SIGHUP handler called."),s.reopen()},s.shutdown=function(e){zc.delete(s),0===zc.size&&Wc&&(process.removeListener("SIGHUP",Kc),Wc=!1),i.end("","utf-8",e)},zc.add(s),Wc||(process.on("SIGHUP",Kc),Wc=!0),s}(e.filename,n,e.maxLogSize,e.backups,e,e.timezoneOffset)};var Yc={};const Xc=Hc,Zc=E.default.EOL;function Qc(e,t,n,r,u){r.maxSize=r.maxLogSize;const o=function(e,t,n){const r=new Xc.DateRollingFileStream(e,t,n);return r.on("error",(t=>{console.error("log4js.dateFileAppender - Writing to file %s, error happened ",e,t)})),r.on("drain",(()=>{process.emit("log4js:pause",!1)})),r}(e,t,r),i=function(e){o.writable&&(o.write(n(e,u)+Zc,"utf8")||process.emit("log4js:pause",!0))};return i.shutdown=function(e){o.end("","utf-8",e)},i}Yc.configure=function(e,t){let n=t.basicLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),e.alwaysIncludePattern||(e.alwaysIncludePattern=!1),e.mode=e.mode||384,Qc(e.filename,e.pattern,n,e,e.timezoneOffset)};var ea={};const ta=Nr.exports("log4js:fileSync"),na=p.default,ra=D.default,ua=E.default.EOL||"\n";function oa(e,t){if(ra.existsSync(e))return;const n=ra.openSync(e,t.flags,t.mode);ra.closeSync(n)}class ia{constructor(e,t,n,r){ta("In RollingFileStream"),function(){if(!e||!t||t<=0)throw new Error("You must specify a filename and file size")}(),this.filename=e,this.size=t,this.backups=n,this.options=r,this.currentSize=0,this.currentSize=function(e){let t=0;try{t=ra.statSync(e).size}catch(t){oa(e,r)}return t}(this.filename)}shouldRoll(){return ta("should roll with current size %d, and max size %d",this.currentSize,this.size),this.currentSize>=this.size}roll(e){const t=this,n=new RegExp(`^${na.basename(e)}`);function r(e){return n.test(e)}function u(t){return parseInt(t.substring(`${na.basename(e)}.`.length),10)||0}function o(e,t){return u(e)>u(t)?1:u(e) ${e}.${r+1}`),ra.renameSync(na.join(na.dirname(e),n),`${e}.${r+1}`)}}ta("Rolling, rolling, rolling"),ta("Renaming the old files"),ra.readdirSync(na.dirname(e)).filter(r).sort(o).reverse().forEach(i)}write(e,t){const n=this;ta("in write"),this.shouldRoll()&&(this.currentSize=0,this.roll(this.filename)),ta("writing the chunk to the file"),n.currentSize+=e.length,ra.appendFileSync(n.filename,e)}}ea.configure=function(e,t){let n=t.basicLayout;e.layout&&(n=t.layout(e.layout.type,e.layout));const r={flags:e.flags||"a",encoding:e.encoding||"utf8",mode:e.mode||384};return function(e,t,n,r,u,o){ta("fileSync appender created");const i=function(e,t,n){let r;var u;return t?r=new ia(e,t,n,o):(oa(u=e,o),r={write(e){ra.appendFileSync(u,e)}}),r}(e=na.normalize(e),n,r=r||0===r?r:5);return e=>{i.write(t(e,u)+ua)}}(e.filename,n,e.maxLogSize,e.backups,e.timezoneOffset,r)};var sa={};const ca=Nr.exports("log4js:tcp"),aa=S.default;sa.configure=function(e,t){ca(`configure with config = ${e}`);let n=function(e){return e.serialise()};return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){let n=!1;const r=[];let u,o=3,i="__LOG4JS__";function s(e){ca("Writing log event to socket"),n=u.write(`${t(e)}${i}`,"utf8")}function c(){let e;for(ca("emptying buffer");e=r.shift();)s(e)}function a(e){n?s(e):(ca("buffering log event because it cannot write at the moment"),r.push(e))}return function t(){ca(`appender creating socket to ${e.host||"localhost"}:${e.port||5e3}`),i=`${e.endMsg||"__LOG4JS__"}`,u=aa.createConnection(e.port||5e3,e.host||"localhost"),u.on("connect",(()=>{ca("socket connected"),c(),n=!0})),u.on("drain",(()=>{ca("drain event received, emptying buffer"),n=!0,c()})),u.on("timeout",u.end.bind(u)),u.on("error",(e=>{ca("connection error",e),n=!1,c()})),u.on("close",t)}(),a.shutdown=function(e){ca("shutdown called"),r.length&&o?(ca("buffer has items, waiting 100ms to empty"),o-=1,setTimeout((()=>{a.shutdown(e)}),100)):(u.removeAllListeners("close"),u.end(e))},a}(e,n)};const la=p.default,fa=Nr.exports("log4js:appenders"),da=tu,Da=eo,pa=gu,Ea=hu,ma=to,ha=new Map;ha.set("console",oo),ha.set("stdout",so),ha.set("stderr",co),ha.set("logLevelFilter",ao),ha.set("categoryFilter",lo),ha.set("noLogFilter",Do),ha.set("file",Eo),ha.set("dateFile",Yc),ha.set("fileSync",ea),ha.set("tcp",sa);const ya=new Map,Ca=(e,t)=>{fa("Loading module from ",e);try{return require(e)}catch(n){return void da.throwExceptionIf(t,"MODULE_NOT_FOUND"!==n.code,`appender "${e}" could not be loaded (error was: ${n})`)}},Fa=new Set,ga=(e,t)=>{if(ya.has(e))return ya.get(e);if(!t.appenders[e])return!1;if(Fa.has(e))throw new Error(`Dependency loop detected for appender ${e}.`);Fa.add(e),fa(`Creating appender ${e}`);const n=Aa(e,t);return Fa.delete(e),ya.set(e,n),n},Aa=(e,t)=>{const n=t.appenders[e],r=n.type.configure?n.type:((e,t)=>ha.get(e)||Ca(`./${e}`,t)||Ca(e,t)||require.main&&Ca(la.join(la.dirname(require.main.filename),e),t)||Ca(la.join(process.cwd(),e),t))(n.type,t);return da.throwExceptionIf(t,da.not(r),`appender "${e}" is not valid (type "${n.type}" could not be found)`),r.appender&&fa(`DEPRECATION: Appender ${n.type} exports an appender function.`),r.shutdown&&fa(`DEPRECATION: Appender ${n.type} exports a shutdown function.`),fa(`${e}: clustering.isMaster ? ${Da.isMaster()}`),fa(`${e}: appenderModule is ${F.default.inspect(r)}`),Da.onlyOnMaster((()=>(fa(`calling appenderModule.configure for ${e} / ${n.type}`),r.configure(ma.modifyConfig(n),Ea,(e=>ga(e,t)),pa))),(()=>{}))},va=e=>{ya.clear(),Fa.clear();const t=[];Object.values(e.categories).forEach((e=>{t.push(...e.appenders)})),Object.keys(e.appenders).forEach((n=>{(t.includes(n)||"tcp-server"===e.appenders[n].type)&&ga(n,e)}))},Sa=()=>{va({appenders:{out:{type:"stdout"}},categories:{default:{appenders:["out"],level:"trace"}}})};Sa(),da.addListener((e=>{da.throwExceptionIf(e,da.not(da.anObject(e.appenders)),'must have a property "appenders" of type object.');const t=Object.keys(e.appenders);da.throwExceptionIf(e,da.not(t.length),"must define at least one appender."),t.forEach((t=>{da.throwExceptionIf(e,da.not(e.appenders[t].type),`appender "${t}" is not valid (must be an object with property "type")`)}))})),da.addListener(va),Au.exports=ya,Au.exports.init=Sa;var wa={exports:{}};!function(e){const t=Nr.exports("log4js:categories"),n=tu,r=gu,u=Au.exports,o=new Map;function i(e,t,n){if(!1===t.inherit)return;const r=n.lastIndexOf(".");if(r<0)return;const u=n.substring(0,r);let o=e.categories[u];o||(o={inherit:!0,appenders:[]}),i(e,o,u),!e.categories[u]&&o.appenders&&o.appenders.length&&o.level&&(e.categories[u]=o),t.appenders=t.appenders||[],t.level=t.level||o.level,o.appenders.forEach((e=>{t.appenders.includes(e)||t.appenders.push(e)})),t.parent=o}function s(e){if(!e.categories)return;Object.keys(e.categories).forEach((t=>{const n=e.categories[t];i(e,n,t)}))}n.addPreProcessingListener((e=>s(e))),n.addListener((e=>{n.throwExceptionIf(e,n.not(n.anObject(e.categories)),'must have a property "categories" of type object.');const t=Object.keys(e.categories);n.throwExceptionIf(e,n.not(t.length),"must define at least one category."),t.forEach((t=>{const o=e.categories[t];n.throwExceptionIf(e,[n.not(o.appenders),n.not(o.level)],`category "${t}" is not valid (must be an object with properties "appenders" and "level")`),n.throwExceptionIf(e,n.not(Array.isArray(o.appenders)),`category "${t}" is not valid (appenders must be an array of appender names)`),n.throwExceptionIf(e,n.not(o.appenders.length),`category "${t}" is not valid (appenders must contain at least one appender name)`),Object.prototype.hasOwnProperty.call(o,"enableCallStack")&&n.throwExceptionIf(e,"boolean"!=typeof o.enableCallStack,`category "${t}" is not valid (enableCallStack must be boolean type)`),o.appenders.forEach((r=>{n.throwExceptionIf(e,n.not(u.get(r)),`category "${t}" is not valid (appender "${r}" is not defined)`)})),n.throwExceptionIf(e,n.not(r.getLevel(o.level)),`category "${t}" is not valid (level "${o.level}" not recognised; valid levels are ${r.levels.join(", ")})`)})),n.throwExceptionIf(e,n.not(e.categories.default),'must define a "default" category.')}));const c=e=>{o.clear();Object.keys(e.categories).forEach((n=>{const i=e.categories[n],s=[];i.appenders.forEach((e=>{s.push(u.get(e)),t(`Creating category ${n}`),o.set(n,{appenders:s,level:r.getLevel(i.level),enableCallStack:i.enableCallStack||!1})}))}))},a=()=>{c({categories:{default:{appenders:["out"],level:"OFF"}}})};a(),n.addListener(c);const l=e=>(t(`configForCategory: searching for config for ${e}`),o.has(e)?(t(`configForCategory: ${e} exists in config, returning it`),o.get(e)):e.indexOf(".")>0?(t(`configForCategory: ${e} has hierarchy, searching for parents`),l(e.substring(0,e.lastIndexOf(".")))):(t("configForCategory: returning config for default category"),l("default")));e.exports=o,e.exports=Object.assign(e.exports,{appendersForCategory:e=>l(e).appenders,getLevelForCategory:e=>l(e).level,setLevelForCategory:(e,n)=>{let r=o.get(e);if(t(`setLevelForCategory: found ${r} for ${e}`),!r){const n=l(e);t(`setLevelForCategory: no config found for category, found ${n} for parents of ${e}`),r={appenders:n.appenders}}r.level=n,o.set(e,r)},getEnableCallStackForCategory:e=>!0===l(e).enableCallStack,setEnableCallStackForCategory:(e,t)=>{l(e).enableCallStack=t},init:a})}(wa);const Oa=Nr.exports("log4js:logger"),ba=Hu,_a=gu,Ba=eo,Pa=wa.exports,ka=tu,xa=/at (?:(.+)\s+\()?(?:(.+?):(\d+)(?::(\d+))?|([^)]+))\)?/;function Na(e,t=4){const n=e.stack.split("\n").slice(t),r=xa.exec(n[0]);return r&&6===r.length?{functionName:r[1],fileName:r[2],lineNumber:parseInt(r[3],10),columnNumber:parseInt(r[4],10),callStack:n.join("\n")}:null}class Ia{constructor(e){if(!e)throw new Error("No category provided.");this.category=e,this.context={},this.parseCallStack=Na,Oa(`Logger created (${this.category}, ${this.level})`)}get level(){return _a.getLevel(Pa.getLevelForCategory(this.category),_a.TRACE)}set level(e){Pa.setLevelForCategory(this.category,_a.getLevel(e,this.level))}get useCallStack(){return Pa.getEnableCallStackForCategory(this.category)}set useCallStack(e){Pa.setEnableCallStackForCategory(this.category,!0===e)}log(e,...t){let n=_a.getLevel(e);n||(this._log(_a.WARN,"log4js:logger.log: invalid value for log-level as first parameter given: ",e),n=_a.INFO),this.isLevelEnabled(n)&&this._log(n,t)}isLevelEnabled(e){return this.level.isLessThanOrEqualTo(e)}_log(e,t){Oa(`sending log data (${e}) to appenders`);const n=new ba(this.category,e,t,this.context,this.useCallStack&&this.parseCallStack(new Error));Ba.send(n)}addContext(e,t){this.context[e]=t}removeContext(e){delete this.context[e]}clearContext(){this.context={}}setParseCallStackFunction(e){this.parseCallStack=e}}function Ta(e){const t=_a.getLevel(e),n=t.toString().toLowerCase().replace(/_([a-z])/g,(e=>e[1].toUpperCase())),r=n[0].toUpperCase()+n.slice(1);Ia.prototype[`is${r}Enabled`]=function(){return this.isLevelEnabled(t)},Ia.prototype[n]=function(...e){this.log(t,...e)}}_a.levels.forEach(Ta),ka.addListener((()=>{_a.levels.forEach(Ta)}));var Ra=Ia;const Ma=gu;function La(e){return e.originalUrl||e.url}function ja(e,t){for(let n=0;ne.source?e.source:e));t=new RegExp(n.join("|"))}return t}(t.nolog);return(e,i,s)=>{if(e._logging)return s();if(o&&o.test(e.originalUrl))return s();if(n.isLevelEnabled(r)||"auto"===t.level){const o=new Date,{writeHead:s}=i;e._logging=!0,i.writeHead=(e,t)=>{i.writeHead=s,i.writeHead(e,t),i.__statusCode=e,i.__headers=t||{}},i.on("finish",(()=>{i.responseTime=new Date-o,i.statusCode&&"auto"===t.level&&(r=Ma.INFO,i.statusCode>=300&&(r=Ma.WARN),i.statusCode>=400&&(r=Ma.ERROR)),r=function(e,t,n){let r=t;if(n){const t=n.find((t=>{let n=!1;return n=t.from&&t.to?e>=t.from&&e<=t.to:-1!==t.codes.indexOf(e),n}));t&&(r=Ma.getLevel(t.level,r))}return r}(i.statusCode,r,t.statusRules);const s=function(e,t,n){const r=[];return r.push({token:":url",replacement:La(e)}),r.push({token:":protocol",replacement:e.protocol}),r.push({token:":hostname",replacement:e.hostname}),r.push({token:":method",replacement:e.method}),r.push({token:":status",replacement:t.__statusCode||t.statusCode}),r.push({token:":response-time",replacement:t.responseTime}),r.push({token:":date",replacement:(new Date).toUTCString()}),r.push({token:":referrer",replacement:e.headers.referer||e.headers.referrer||""}),r.push({token:":http-version",replacement:`${e.httpVersionMajor}.${e.httpVersionMinor}`}),r.push({token:":remote-addr",replacement:e.headers["x-forwarded-for"]||e.ip||e._remoteAddress||e.socket&&(e.socket.remoteAddress||e.socket.socket&&e.socket.socket.remoteAddress)}),r.push({token:":user-agent",replacement:e.headers["user-agent"]}),r.push({token:":content-length",replacement:t.getHeader("content-length")||t.__headers&&t.__headers["Content-Length"]||"-"}),r.push({token:/:req\[([^\]]+)]/g,replacement:(t,n)=>e.headers[n.toLowerCase()]}),r.push({token:/:res\[([^\]]+)]/g,replacement:(e,n)=>t.getHeader(n.toLowerCase())||t.__headers&&t.__headers[n]}),(e=>{const t=e.concat();for(let e=0;eja(e,s)));t&&n.log(r,t)}else n.log(r,ja(u,s));t.context&&n.removeContext("res")}))}return s()}},nl=Va;let rl=!1;function ul(e){if(!rl)return;Ua("Received log event ",e);Za.appendersForCategory(e.categoryName).forEach((t=>{t(e)}))}function ol(e){rl&&il();let t=e;return"string"==typeof t&&(t=function(e){Ua(`Loading configuration from ${e}`);try{return JSON.parse(Wa.readFileSync(e,"utf8"))}catch(t){throw new Error(`Problem reading config from file "${e}". Error was ${t.message}`,t)}}(e)),Ua(`Configuration is ${t}`),Ka.configure(za(t)),el.onMessage(ul),rl=!0,sl}function il(e){Ua("Shutdown called. Disabling all log writing."),rl=!1;const t=Array.from(Xa.values());Xa.init(),Za.init();const n=t.reduceRight(((e,t)=>t.shutdown?e+1:e),0);if(0===n)return Ua("No appenders with shutdown functions found."),void 0!==e&&e();let r,u=0;function o(t){r=r||t,u+=1,Ua(`Appender shutdowns complete: ${u} / ${n}`),u>=n&&(Ua("All shutdown functions completed."),e&&e(r))}return Ua(`Found ${n} appenders with shutdown functions.`),t.filter((e=>e.shutdown)).forEach((e=>e.shutdown(o))),null}const sl={getLogger:function(e){return rl||ol(process.env.LOG4JS_CONFIG||{appenders:{out:{type:"stdout"}},categories:{default:{appenders:["out"],level:"OFF"}}}),new Qa(e||"default")},configure:ol,shutdown:il,connectLogger:tl,levels:Ya,addLayout:qa.addLayout,recording:function(){return nl}};var cl=sl,al={};Object.defineProperty(al,"__esModule",{value:!0}),al.levelMap=al.getLevel=al.setCategoriesLevel=al.getConfiguration=al.setConfiguration=void 0;const ll=cl;let fl={appenders:{debug:{type:"stdout",layout:{type:"pattern",pattern:"[%d] > hvigor %p %c %[%m%]"}},info:{type:"stdout",layout:{type:"pattern",pattern:"[%d] > hvigor %[%m%]"}},"no-pattern-info":{type:"stdout",layout:{type:"pattern",pattern:"%m"}},wrong:{type:"stderr",layout:{type:"pattern",pattern:"[%d] > hvigor %[%p: %m%]"}},"just-debug":{type:"logLevelFilter",appender:"debug",level:"debug",maxLevel:"debug"},"just-info":{type:"logLevelFilter",appender:"info",level:"info",maxLevel:"info"},"just-wrong":{type:"logLevelFilter",appender:"wrong",level:"warn",maxLevel:"error"}},categories:{default:{appenders:["just-debug","just-info","just-wrong"],level:"debug"},"no-pattern-info":{appenders:["no-pattern-info"],level:"info"}}};al.setConfiguration=e=>{fl=e};al.getConfiguration=()=>fl;let dl=ll.levels.DEBUG;al.setCategoriesLevel=(e,t)=>{dl=e;const n=fl.categories;for(const r in n)(null==t?void 0:t.includes(r))||Object.prototype.hasOwnProperty.call(n,r)&&(n[r].level=e.levelStr)};al.getLevel=()=>dl,al.levelMap=new Map([["ALL",ll.levels.ALL],["MARK",ll.levels.MARK],["TRACE",ll.levels.TRACE],["DEBUG",ll.levels.DEBUG],["INFO",ll.levels.INFO],["WARN",ll.levels.WARN],["ERROR",ll.levels.ERROR],["FATAL",ll.levels.FATAL],["OFF",ll.levels.OFF]]);var Dl=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),pl=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),El=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&Dl(t,e,n);return pl(t,e),t};Object.defineProperty(xr,"__esModule",{value:!0}),xr.evaluateLogLevel=xr.HvigorLogger=void 0;const ml=El(cl),hl=cl,yl=El(F.default),Cl=al;class Fl{constructor(e){ml.configure((0,Cl.getConfiguration)()),this._logger=ml.getLogger(e),this._logger.level=(0,Cl.getLevel)()}static getLogger(e){return new Fl(e)}log(e,...t){this._logger.log(e,...t)}debug(e,...t){this._logger.debug(e,...t)}info(e,...t){this._logger.info(e,...t)}warn(e,...t){void 0!==e&&""!==e&&this._logger.warn(e,...t)}error(e,...t){this._logger.error(e,...t)}_printTaskExecuteInfo(e,t){this.info(`Finished :${e}... after ${t}`)}_printFailedTaskInfo(e){this.error(`Failed :${e}... `)}_printDisabledTaskInfo(e){this.info(`Disabled :${e}... `)}_printUpToDateTaskInfo(e){this.info(`UP-TO-DATE :${e}... `)}errorMessageExit(e,...t){throw new Error(yl.format(e,...t))}errorExit(e,t,...n){t&&this._logger.error(t,n),this._logger.error(e.stack)}setLevel(e,t){(0,Cl.setCategoriesLevel)(e,t),ml.shutdown(),ml.configure((0,Cl.getConfiguration)())}getLevel(){return this._logger.level}configure(e){const t=(0,Cl.getConfiguration)(),n={appenders:{...t.appenders,...e.appenders},categories:{...t.categories,...e.categories}};(0,Cl.setConfiguration)(n),ml.shutdown(),ml.configure(n)}}xr.HvigorLogger=Fl,xr.evaluateLogLevel=function(e,t){t.debug?e.setLevel(hl.levels.DEBUG):t.warn?e.setLevel(hl.levels.WARN):t.error?e.setLevel(hl.levels.ERROR):e.setLevel(hl.levels.INFO)};var gl=w&&w.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(X,"__esModule",{value:!0}),X.parseJsonText=X.parseJsonFile=void 0;const Al=Z,vl=gl(kr),Sl=gl(p.default),wl=gl(E.default),Ol=xr.HvigorLogger.getLogger("parse-json-util");var bl;!function(e){e[e.Char=0]="Char",e[e.EOF=1]="EOF",e[e.Identifier=2]="Identifier"}(bl||(bl={}));let _l,Bl,Pl,kl,xl,Nl,Il="start",Tl=[],Rl=0,Ml=1,Ll=0,jl=!1,$l="default",Hl="'",Jl=1;function Gl(e,t=!1){Bl=String(e),Il="start",Tl=[],Rl=0,Ml=1,Ll=0,kl=void 0,jl=t;do{_l=Vl(),Xl[Il]()}while("eof"!==_l.type);return kl}function Vl(){for($l="default",xl="",Hl="'",Jl=1;;){Nl=Ul();const e=zl[$l]();if(e)return e}}function Ul(){if(Bl[Rl])return String.fromCodePoint(Bl.codePointAt(Rl))}function Wl(){const e=Ul();return"\n"===e?(Ml++,Ll=0):e?Ll+=e.length:Ll++,e&&(Rl+=e.length),e}X.parseJsonFile=function(e,t=!1,n="utf-8"){const r=vl.default.readFileSync(Sl.default.resolve(e),{encoding:n});try{return Gl(r,t)}catch(t){if(t instanceof SyntaxError){const n=t.message.split("at");2===n.length&&Ol.errorMessageExit(`${n[0].trim()}${wl.default.EOL}\t at ${e}:${n[1].trim()}`)}Ol.errorMessageExit(`${e} is not in valid JSON/JSON5 format.`)}},X.parseJsonText=Gl;const zl={default(){switch(Nl){case"/":return Wl(),void($l="comment");case void 0:return Wl(),Kl("eof")}if(!Al.JudgeUtil.isIgnoreChar(Nl)&&!Al.JudgeUtil.isSpaceSeparator(Nl))return zl[Il]();Wl()},start(){$l="value"},beforePropertyName(){switch(Nl){case"$":case"_":return xl=Wl(),void($l="identifierName");case"\\":return Wl(),void($l="identifierNameStartEscape");case"}":return Kl("punctuator",Wl());case'"':case"'":return Hl=Nl,Wl(),void($l="string")}if(Al.JudgeUtil.isIdStartChar(Nl))return xl+=Wl(),void($l="identifierName");throw tf(bl.Char,Wl())},afterPropertyName(){if(":"===Nl)return Kl("punctuator",Wl());throw tf(bl.Char,Wl())},beforePropertyValue(){$l="value"},afterPropertyValue(){switch(Nl){case",":case"}":return Kl("punctuator",Wl())}throw tf(bl.Char,Wl())},beforeArrayValue(){if("]"===Nl)return Kl("punctuator",Wl());$l="value"},afterArrayValue(){switch(Nl){case",":case"]":return Kl("punctuator",Wl())}throw tf(bl.Char,Wl())},end(){throw tf(bl.Char,Wl())},comment(){switch(Nl){case"*":return Wl(),void($l="multiLineComment");case"/":return Wl(),void($l="singleLineComment")}throw tf(bl.Char,Wl())},multiLineComment(){switch(Nl){case"*":return Wl(),void($l="multiLineCommentAsterisk");case void 0:throw tf(bl.Char,Wl())}Wl()},multiLineCommentAsterisk(){switch(Nl){case"*":return void Wl();case"/":return Wl(),void($l="default");case void 0:throw tf(bl.Char,Wl())}Wl(),$l="multiLineComment"},singleLineComment(){switch(Nl){case"\n":case"\r":case"\u2028":case"\u2029":return Wl(),void($l="default");case void 0:return Wl(),Kl("eof")}Wl()},value(){switch(Nl){case"{":case"[":return Kl("punctuator",Wl());case"n":return Wl(),ql("ull"),Kl("null",null);case"t":return Wl(),ql("rue"),Kl("boolean",!0);case"f":return Wl(),ql("alse"),Kl("boolean",!1);case"-":case"+":return"-"===Wl()&&(Jl=-1),void($l="numerical");case".":case"0":case"I":case"N":return void($l="numerical");case'"':case"'":return Hl=Nl,Wl(),xl="",void($l="string")}if(void 0===Nl||!Al.JudgeUtil.isDigitWithoutZero(Nl))throw tf(bl.Char,Wl());$l="numerical"},numerical(){switch(Nl){case".":return xl=Wl(),void($l="decimalPointLeading");case"0":return xl=Wl(),void($l="zero");case"I":return Wl(),ql("nfinity"),Kl("numeric",Jl*(1/0));case"N":return Wl(),ql("aN"),Kl("numeric",NaN)}if(void 0!==Nl&&Al.JudgeUtil.isDigitWithoutZero(Nl))return xl=Wl(),void($l="decimalInteger");throw tf(bl.Char,Wl())},zero(){switch(Nl){case".":case"e":case"E":return void($l="decimal");case"x":case"X":return xl+=Wl(),void($l="hexadecimal")}return Kl("numeric",0)},decimalInteger(){switch(Nl){case".":case"e":case"E":return void($l="decimal")}if(!Al.JudgeUtil.isDigit(Nl))return Kl("numeric",Jl*Number(xl));xl+=Wl()},decimal(){switch(Nl){case".":xl+=Wl(),$l="decimalFraction";break;case"e":case"E":xl+=Wl(),$l="decimalExponent"}},decimalPointLeading(){if(Al.JudgeUtil.isDigit(Nl))return xl+=Wl(),void($l="decimalFraction");throw tf(bl.Char,Wl())},decimalFraction(){switch(Nl){case"e":case"E":return xl+=Wl(),void($l="decimalExponent")}if(!Al.JudgeUtil.isDigit(Nl))return Kl("numeric",Jl*Number(xl));xl+=Wl()},decimalExponent(){switch(Nl){case"+":case"-":return xl+=Wl(),void($l="decimalExponentSign")}if(Al.JudgeUtil.isDigit(Nl))return xl+=Wl(),void($l="decimalExponentInteger");throw tf(bl.Char,Wl())},decimalExponentSign(){if(Al.JudgeUtil.isDigit(Nl))return xl+=Wl(),void($l="decimalExponentInteger");throw tf(bl.Char,Wl())},decimalExponentInteger(){if(!Al.JudgeUtil.isDigit(Nl))return Kl("numeric",Jl*Number(xl));xl+=Wl()},hexadecimal(){if(Al.JudgeUtil.isHexDigit(Nl))return xl+=Wl(),void($l="hexadecimalInteger");throw tf(bl.Char,Wl())},hexadecimalInteger(){if(!Al.JudgeUtil.isHexDigit(Nl))return Kl("numeric",Jl*Number(xl));xl+=Wl()},identifierNameStartEscape(){if("u"!==Nl)throw tf(bl.Char,Wl());Wl();const e=Yl();switch(e){case"$":case"_":break;default:if(!Al.JudgeUtil.isIdStartChar(e))throw tf(bl.Identifier)}xl+=e,$l="identifierName"},identifierName(){switch(Nl){case"$":case"_":case"‌":case"‍":return void(xl+=Wl());case"\\":return Wl(),void($l="identifierNameEscape")}if(!Al.JudgeUtil.isIdContinueChar(Nl))return Kl("identifier",xl);xl+=Wl()},identifierNameEscape(){if("u"!==Nl)throw tf(bl.Char,Wl());Wl();const e=Yl();switch(e){case"$":case"_":case"‌":case"‍":break;default:if(!Al.JudgeUtil.isIdContinueChar(e))throw tf(bl.Identifier)}xl+=e,$l="identifierName"},string(){switch(Nl){case"\\":return Wl(),void(xl+=function(){const e=Ul(),t=function(){switch(Ul()){case"b":return Wl(),"\b";case"f":return Wl(),"\f";case"n":return Wl(),"\n";case"r":return Wl(),"\r";case"t":return Wl(),"\t";case"v":return Wl(),"\v"}return}();if(t)return t;switch(e){case"0":if(Wl(),Al.JudgeUtil.isDigit(Ul()))throw tf(bl.Char,Wl());return"\0";case"x":return Wl(),function(){let e="",t=Ul();if(!Al.JudgeUtil.isHexDigit(t))throw tf(bl.Char,Wl());if(e+=Wl(),t=Ul(),!Al.JudgeUtil.isHexDigit(t))throw tf(bl.Char,Wl());return e+=Wl(),String.fromCodePoint(parseInt(e,16))}();case"u":return Wl(),Yl();case"\n":case"\u2028":case"\u2029":return Wl(),"";case"\r":return Wl(),"\n"===Ul()&&Wl(),""}if(void 0===e||Al.JudgeUtil.isDigitWithoutZero(e))throw tf(bl.Char,Wl());return Wl()}());case'"':case"'":if(Nl===Hl){const e=Kl("string",xl);return Wl(),e}return void(xl+=Wl());case"\n":case"\r":case void 0:throw tf(bl.Char,Wl());case"\u2028":case"\u2029":!function(e){Ol.warn(`JSON5: '${ef(e)}' in strings is not valid ECMAScript; consider escaping.`)}(Nl)}xl+=Wl()}};function Kl(e,t){return{type:e,value:t,line:Ml,column:Ll}}function ql(e){for(const t of e){if(Ul()!==t)throw tf(bl.Char,Wl());Wl()}}function Yl(){let e="",t=4;for(;t-- >0;){const t=Ul();if(!Al.JudgeUtil.isHexDigit(t))throw tf(bl.Char,Wl());e+=Wl()}return String.fromCodePoint(parseInt(e,16))}const Xl={start(){if("eof"===_l.type)throw tf(bl.EOF);Zl()},beforePropertyName(){switch(_l.type){case"identifier":case"string":return Pl=_l.value,void(Il="afterPropertyName");case"punctuator":return void Ql();case"eof":throw tf(bl.EOF)}},afterPropertyName(){if("eof"===_l.type)throw tf(bl.EOF);Il="beforePropertyValue"},beforePropertyValue(){if("eof"===_l.type)throw tf(bl.EOF);Zl()},afterPropertyValue(){if("eof"===_l.type)throw tf(bl.EOF);switch(_l.value){case",":return void(Il="beforePropertyName");case"}":Ql()}},beforeArrayValue(){if("eof"===_l.type)throw tf(bl.EOF);"punctuator"!==_l.type||"]"!==_l.value?Zl():Ql()},afterArrayValue(){if("eof"===_l.type)throw tf(bl.EOF);switch(_l.value){case",":return void(Il="beforeArrayValue");case"]":Ql()}},end(){}};function Zl(){const e=function(){let e;switch(_l.type){case"punctuator":switch(_l.value){case"{":e={};break;case"[":e=[]}break;case"null":case"boolean":case"numeric":case"string":e=_l.value}return e}();if(jl&&"object"==typeof e&&(e._line=Ml,e._column=Ll),void 0===kl)kl=e;else{const t=Tl[Tl.length-1];Array.isArray(t)?jl&&"object"!=typeof e?t.push({value:e,_line:Ml,_column:Ll}):t.push(e):t[Pl]=jl&&"object"!=typeof e?{value:e,_line:Ml,_column:Ll}:e}!function(e){if(e&&"object"==typeof e)Tl.push(e),Il=Array.isArray(e)?"beforeArrayValue":"beforePropertyName";else{const e=Tl[Tl.length-1];Il=e?Array.isArray(e)?"afterArrayValue":"afterPropertyValue":"end"}}(e)}function Ql(){Tl.pop();const e=Tl[Tl.length-1];Il=e?Array.isArray(e)?"afterArrayValue":"afterPropertyValue":"end"}function ef(e){const t={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(t[e])return t[e];if(e<" "){const t=e.charCodeAt(0).toString(16);return`\\x${`00${t}`.substring(t.length)}`}return e}function tf(e,t){let n="";switch(e){case bl.Char:n=void 0===t?`JSON5: invalid end of input at ${Ml}:${Ll}`:`JSON5: invalid character '${ef(t)}' at ${Ml}:${Ll}`;break;case bl.EOF:n=`JSON5: invalid end of input at ${Ml}:${Ll}`;break;case bl.Identifier:Ll-=5,n=`JSON5: invalid identifier character at ${Ml}:${Ll}`}const r=new nf(n);return r.lineNumber=Ml,r.columnNumber=Ll,r}class nf extends SyntaxError{}var rf=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),uf=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),of=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&rf(t,e,n);return uf(t,e),t};Object.defineProperty(Y,"__esModule",{value:!0});var sf=Y.cleanWorkSpace=Ff=Y.executeInstallHvigor=yf=Y.isHvigorInstalled=mf=Y.isAllDependenciesInstalled=void 0;const cf=of(D.default),af=of(p.default),lf=b,ff=j,df=$,Df=X;let pf,Ef;var mf=Y.isAllDependenciesInstalled=function(){function e(e){const t=null==e?void 0:e.dependencies;return void 0===t?0:Object.getOwnPropertyNames(t).length}if(pf=gf(),Ef=Af(),e(pf)+1!==e(Ef))return!1;for(const e in null==pf?void 0:pf.dependencies)if(!(0,ff.hasNpmPackInPaths)(e,[lf.HVIGOR_PROJECT_DEPENDENCIES_HOME])||!hf(e,pf,Ef))return!1;return!0};function hf(e,t,n){return void 0!==n.dependencies&&(0,ff.offlinePluginConversion)(lf.HVIGOR_PROJECT_ROOT_DIR,t.dependencies[e])===n.dependencies[e]}var yf=Y.isHvigorInstalled=function(){return pf=gf(),Ef=Af(),(0,ff.hasNpmPackInPaths)(lf.HVIGOR_ENGINE_PACKAGE_NAME,[lf.HVIGOR_PROJECT_DEPENDENCIES_HOME])&&(0,ff.offlinePluginConversion)(lf.HVIGOR_PROJECT_ROOT_DIR,pf.hvigorVersion)===Ef.dependencies[lf.HVIGOR_ENGINE_PACKAGE_NAME]};const Cf={cwd:lf.HVIGOR_PROJECT_DEPENDENCIES_HOME,stdio:["inherit","inherit","inherit"]};var Ff=Y.executeInstallHvigor=function(){(0,df.logInfoPrintConsole)("Hvigor installing...");const e={dependencies:{}};e.dependencies[lf.HVIGOR_ENGINE_PACKAGE_NAME]=(0,ff.offlinePluginConversion)(lf.HVIGOR_PROJECT_ROOT_DIR,pf.hvigorVersion);try{cf.mkdirSync(lf.HVIGOR_PROJECT_DEPENDENCIES_HOME,{recursive:!0});const t=af.resolve(lf.HVIGOR_PROJECT_DEPENDENCIES_HOME,lf.DEFAULT_PACKAGE_JSON);cf.writeFileSync(t,JSON.stringify(e))}catch(e){(0,df.logErrorAndExit)(e)}!function(){const e=["config","set","store-dir",lf.HVIGOR_PNPM_STORE_PATH];(0,ff.executeCommand)(lf.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH,e,Cf)}(),(0,ff.executeCommand)(lf.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH,["install"],Cf)};function gf(){const e=af.resolve(lf.HVIGOR_PROJECT_WRAPPER_HOME,lf.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME);return cf.existsSync(e)||(0,df.logErrorAndExit)(`Error: Hvigor config file ${e} does not exist.`),(0,Df.parseJsonFile)(e)}function Af(){return cf.existsSync(lf.HVIGOR_PROJECT_DEPENDENCY_PACKAGE_JSON_PATH)?(0,Df.parseJsonFile)(lf.HVIGOR_PROJECT_DEPENDENCY_PACKAGE_JSON_PATH):{dependencies:{}}}sf=Y.cleanWorkSpace=function(){if((0,df.logInfoPrintConsole)("Hvigor cleaning..."),!cf.existsSync(lf.HVIGOR_PROJECT_DEPENDENCIES_HOME))return;const e=cf.readdirSync(lf.HVIGOR_PROJECT_DEPENDENCIES_HOME);if(e&&0!==e.length){cf.existsSync(lf.HVIGOR_BOOT_JS_FILE_PATH)&&(0,ff.executeCommand)(process.argv[0],[lf.HVIGOR_BOOT_JS_FILE_PATH,"--stop-daemon"],{});try{e.forEach((e=>{cf.rmSync(af.resolve(lf.HVIGOR_PROJECT_DEPENDENCIES_HOME,e),{recursive:!0})}))}catch(e){(0,df.logErrorAndExit)(`The hvigor build tool cannot be installed. Please manually clear the workspace directory and synchronize the project again.\n\n Workspace Path: ${lf.HVIGOR_PROJECT_DEPENDENCIES_HOME}.`)}}};var vf={},Sf=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),wf=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Of=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&Sf(t,e,n);return wf(t,e),t};Object.defineProperty(vf,"__esModule",{value:!0});var bf=vf.executeBuild=void 0;const _f=b,Bf=Of(D.default),Pf=Of(p.default),kf=$;bf=vf.executeBuild=function(){const e=Pf.resolve(_f.HVIGOR_PROJECT_DEPENDENCIES_HOME,"node_modules","@ohos","hvigor","bin","hvigor.js");try{const t=Bf.realpathSync(e);require(t)}catch(t){(0,kf.logErrorAndExit)(`Error: ENOENT: no such file ${e},delete ${_f.HVIGOR_PROJECT_DEPENDENCIES_HOME} and retry.`)}},function(){if(O.checkNpmConifg(),O.environmentHandler(),O.isPnpmAvailable()||O.executeInstallPnpm(),yf()&&mf())bf();else{sf();try{Ff()}catch(e){return void sf()}bf()}}(); \ No newline at end of file diff --git a/ohos/test_quiver/ohos/hvigorfile.ts b/ohos/test_quiver/ohos/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..5a172b770e3b15f67c12152d00f38f2084d3915b --- /dev/null +++ b/ohos/test_quiver/ohos/hvigorfile.ts @@ -0,0 +1,17 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently. +export { appTasks } from '@ohos/hvigor-ohos-plugin'; \ No newline at end of file diff --git a/ohos/test_quiver/ohos/hvigorw b/ohos/test_quiver/ohos/hvigorw new file mode 100755 index 0000000000000000000000000000000000000000..5efd8343d3232bdd1d9b7f67a3326034054c5396 --- /dev/null +++ b/ohos/test_quiver/ohos/hvigorw @@ -0,0 +1,61 @@ +#!/bin/bash + +# Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# ---------------------------------------------------------------------------- +# Hvigor startup script, version 1.0.0 +# +# Required ENV vars: +# ------------------ +# NODE_HOME - location of a Node home dir +# or +# Add /usr/local/nodejs/bin to the PATH environment variable +# ---------------------------------------------------------------------------- + +HVIGOR_APP_HOME=$(dirname $(readlink -f $0)) +HVIGOR_WRAPPER_SCRIPT=${HVIGOR_APP_HOME}/hvigor/hvigor-wrapper.js +warn() { + echo "" + echo -e "\033[1;33m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m" +} + +error() { + echo "" + echo -e "\033[1;31m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m" +} + +fail() { + error "$@" + exit 1 +} + +# Determine node to start hvigor wrapper script +if [ -n "${NODE_HOME}" ];then + EXECUTABLE_NODE="${NODE_HOME}/bin/node" + if [ ! -x "$EXECUTABLE_NODE" ];then + fail "ERROR: NODE_HOME is set to an invalid directory,check $NODE_HOME\n\nPlease set NODE_HOME in your environment to the location where your nodejs installed" + fi +else + EXECUTABLE_NODE="node" + which ${EXECUTABLE_NODE} > /dev/null 2>&1 || fail "ERROR: NODE_HOME is not set and not 'node' command found in your path" +fi + +# Check hvigor wrapper script +if [ ! -r "$HVIGOR_WRAPPER_SCRIPT" ];then + fail "ERROR: Couldn't find hvigor/hvigor-wrapper.js in ${HVIGOR_APP_HOME}" +fi + +# start hvigor-wrapper script +exec "${EXECUTABLE_NODE}" \ + "${HVIGOR_WRAPPER_SCRIPT}" "$@" diff --git a/ohos/test_quiver/ohos/hvigorw.bat b/ohos/test_quiver/ohos/hvigorw.bat new file mode 100644 index 0000000000000000000000000000000000000000..6861293e47dfd0186da380321b73be9033507e24 --- /dev/null +++ b/ohos/test_quiver/ohos/hvigorw.bat @@ -0,0 +1,64 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Hvigor startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +set WRAPPER_MODULE_PATH=%APP_HOME%\hvigor\hvigor-wrapper.js +set NODE_EXE=node.exe + +goto start + +:start +@rem Find node.exe +if defined NODE_HOME goto findNodeFromNodeHome + +%NODE_EXE% --version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH. +echo. +echo Please set the NODE_HOME variable in your environment to match the +echo location of your NodeJs installation. + +goto fail + +:findNodeFromNodeHome +set NODE_HOME=%NODE_HOME:"=% +set NODE_EXE_PATH=%NODE_HOME%/%NODE_EXE% + +if exist "%NODE_EXE_PATH%" goto execute +echo. +echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH. +echo. +echo Please set the NODE_HOME variable in your environment to match the +echo location of your NodeJs installation. + +goto fail + +:execute +@rem Execute hvigor +"%NODE_EXE%" %WRAPPER_MODULE_PATH% %* + +if "%ERRORLEVEL%" == "0" goto hvigorwEnd + +:fail +exit /b 1 + +:hvigorwEnd +if "%OS%" == "Windows_NT" endlocal + +:end diff --git a/ohos/test_quiver/ohos/oh-package.json5 b/ohos/test_quiver/ohos/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..a2408ea9cb7b309e6ad95e27a4c8b88985ae57c6 --- /dev/null +++ b/ohos/test_quiver/ohos/oh-package.json5 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +{ + "name": "apptemplate", + "version": "1.0.0", + "description": "Please describe the basic information.", + "main": "", + "author": "", + "license": "", + "dependencies": { + }, + "devDependencies": { + "@ohos/hypium": "1.0.6" + } +} diff --git a/ohos/test_quiver/pubspec.yaml b/ohos/test_quiver/pubspec.yaml new file mode 100644 index 0000000000000000000000000000000000000000..af0aa41e6073cbe96285a356c3177c3347d35c19 --- /dev/null +++ b/ohos/test_quiver/pubspec.yaml @@ -0,0 +1,13 @@ +name: test_quiver +description: A new Flutter project. +publish_to: 'none' +version: 1.0.0 + +environment: + sdk: '>=2.12.0 <3.0.0' +dependencies: + flutter: + sdk: flutter + quiver: 3.2.1 +flutter: + uses-material-design: true \ No newline at end of file diff --git a/ohos/test_sqflite_common/.gitignore b/ohos/test_sqflite_common/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..24476c5d1eb55824c76d8b01a3965f94abad1ef8 --- /dev/null +++ b/ohos/test_sqflite_common/.gitignore @@ -0,0 +1,44 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.packages +.pub-cache/ +.pub/ +/build/ + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/ohos/test_sqflite_common/.metadata b/ohos/test_sqflite_common/.metadata new file mode 100644 index 0000000000000000000000000000000000000000..3211d02f27792d7031aa1b7c8263028fd922a720 --- /dev/null +++ b/ohos/test_sqflite_common/.metadata @@ -0,0 +1,30 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled. + +version: + revision: 840747ee91d7cfb95661ce7358b7256919075c2a + channel: master + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: 840747ee91d7cfb95661ce7358b7256919075c2a + base_revision: 840747ee91d7cfb95661ce7358b7256919075c2a + - platform: android + create_revision: 840747ee91d7cfb95661ce7358b7256919075c2a + base_revision: 840747ee91d7cfb95661ce7358b7256919075c2a + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/ohos/test_sqflite_common/README.md b/ohos/test_sqflite_common/README.md new file mode 100644 index 0000000000000000000000000000000000000000..c70871550801207d58586114e6e96525e98fa493 --- /dev/null +++ b/ohos/test_sqflite_common/README.md @@ -0,0 +1,16 @@ +# test_sqflite_common + +A new Flutter project. + +## Getting Started + +This project is a starting point for a Flutter application. + +A few resources to get you started if this is your first Flutter project: + +- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) +- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) + +For help getting started with Flutter development, view the +[online documentation](https://docs.flutter.dev/), which offers tutorials, +samples, guidance on mobile development, and a full API reference. diff --git a/ohos/test_sqflite_common/analysis_options.yaml b/ohos/test_sqflite_common/analysis_options.yaml new file mode 100644 index 0000000000000000000000000000000000000000..61b6c4de17c96863d24279f06b85e01b6ebbdb34 --- /dev/null +++ b/ohos/test_sqflite_common/analysis_options.yaml @@ -0,0 +1,29 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at + # https://dart-lang.github.io/linter/lints/index.html. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/ohos/test_sqflite_common/lib/base/base_page.dart b/ohos/test_sqflite_common/lib/base/base_page.dart new file mode 100644 index 0000000000000000000000000000000000000000..4e7696dd6aacb60c31d5f27aec4769a189efd686 --- /dev/null +++ b/ohos/test_sqflite_common/lib/base/base_page.dart @@ -0,0 +1,41 @@ +import 'package:flutter/material.dart'; + +import 'main_item_widget.dart'; +import 'test_route.dart'; + +/// 全局静态数据存储 +abstract class GlobalData { + static String appName = ''; +} + +/// app基本首页 +class BasePage extends StatefulWidget { + const BasePage({Key? key, required this.data}) : super(key: key); + + final List data; + + @override + State createState() => _BasePageState(); +} + +class _BasePageState extends State { + int get _itemCount => widget.data.length; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Center( + child: Text(GlobalData.appName, textAlign: TextAlign.center)), + ), + body: + ListView.builder(itemBuilder: _itemBuilder, itemCount: _itemCount)); + } + + Widget _itemBuilder(BuildContext context, int index) { + return MainItemWidget(widget.data[index], (MainItem item) { + Navigator.push( + context, MaterialPageRoute(builder: (content) => item.route)); + }); + } +} diff --git a/ohos/test_sqflite_common/lib/base/item_widget.dart b/ohos/test_sqflite_common/lib/base/item_widget.dart new file mode 100644 index 0000000000000000000000000000000000000000..64a3e8a5cf9e689e7a991b5d2efd49f0badf9646 --- /dev/null +++ b/ohos/test_sqflite_common/lib/base/item_widget.dart @@ -0,0 +1,112 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +import 'test_page.dart'; + +/// Item widget. +class ItemWidget extends StatefulWidget { + /// Item widget. + const ItemWidget( + {required this.item, required this.index, required this.getGroupRange, required this.runGroup, required this.onTap, this.summary, Key? key}) + : super(key: key); + + /// item summary. + final String? summary; + + /// item data. + final Item item; + + /// 当前下标 + final int index; + + /// 获取对应的组信息 + final GroupRange Function() getGroupRange; + + /// 获取对应的组信息 + final void Function(int start, int end) runGroup; + + /// Action when pressed (typically run). + final void Function(Item item) onTap; + + @override + ItemWidgetState createState() => ItemWidgetState(); +} + +class ItemWidgetState extends State { + @override + Widget build(BuildContext context) { + IconData? icon; + Color? color; + + switch (widget.item.state) { + case ItemState.none: + icon = Icons.arrow_forward_ios; + break; + case ItemState.running: + icon = Icons.more_horiz; + break; + case ItemState.success: + icon = Icons.check; + color = Colors.green; + break; + case ItemState.failure: + icon = Icons.close; + color = Colors.red; + break; + } + + final Widget listTile = ListTile( + leading: SizedBox( + child: IconButton( + icon: Icon(icon, color: color), + onPressed: null, + )), + title: Text(widget.item.name), + subtitle: widget.summary != null ? Text(widget.summary!) : null, + onTap: () { + widget.onTap(widget.item); + }); + + final data = widget.getGroupRange(); + + return Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (data.groupName.isNotEmpty && data.startIndex == widget.index) + GestureDetector( + onTap: () {}, + child: Container( + height: 35, + decoration: BoxDecoration(color: CupertinoColors.extraLightBackgroundGray), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + '测试组: ${data.groupName}', + style: TextStyle(fontSize: 18), + ), + FilledButton( + onPressed: () => widget.runGroup(data.startIndex, data.startIndex), + child: Text( + '整组测试', + style: TextStyle(fontSize: 16), + )) + ], + ), + ), + ), + Container( + margin: data.groupName.isNotEmpty && data.startIndex == widget.index ? EdgeInsets.only(bottom: 10) : null, + decoration: BoxDecoration( + border: data.groupName.isNotEmpty && data.endIndex == widget.index ? Border(bottom: BorderSide(color: Colors.grey)) : null, + ), + child: Padding( + padding: data.groupName.isNotEmpty && data.startIndex <= widget.index && data.endIndex >= widget.index ? EdgeInsets.only(left: 35) : EdgeInsets.zero, + child: listTile, + ), + ) + ], + ); + } +} diff --git a/ohos/test_sqflite_common/lib/base/main_item_widget.dart b/ohos/test_sqflite_common/lib/base/main_item_widget.dart new file mode 100644 index 0000000000000000000000000000000000000000..32f8261b736c517c5984710ec950be96470dacdc --- /dev/null +++ b/ohos/test_sqflite_common/lib/base/main_item_widget.dart @@ -0,0 +1,35 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'test_route.dart'; + +/// Main item widget. +class MainItemWidget extends StatefulWidget { + /// Main item widget. + const MainItemWidget(this.item, this.onTap, {Key? key}) : super(key: key); + + /// item data. + final MainItem item; + + /// onTap action (typically run or open). + final void Function(MainItem item) onTap; + + @override + MainItemWidgetState createState() => MainItemWidgetState(); +} + +class MainItemWidgetState extends State { + @override + Widget build(BuildContext context) { + return Container( + margin: const EdgeInsets.only(bottom: 10), + child: ListTile( + tileColor: CupertinoColors.extraLightBackgroundGray, + title: Text(widget.item.title), + onTap: _onTap), + ); + } + + void _onTap() { + widget.onTap(widget.item); + } +} diff --git a/ohos/test_sqflite_common/lib/base/test_model_app.dart b/ohos/test_sqflite_common/lib/base/test_model_app.dart new file mode 100644 index 0000000000000000000000000000000000000000..f565a5f8dab474f51e2a0c16cf745a6f7887b65b --- /dev/null +++ b/ohos/test_sqflite_common/lib/base/test_model_app.dart @@ -0,0 +1,36 @@ +import 'package:flutter/material.dart'; + +import 'base_page.dart'; +import 'test_route.dart'; + +/// 基础app框架 +class TestModelApp extends StatefulWidget { + TestModelApp({Key? key, required this.appName, required this.data}) : super(key: key) { + GlobalData.appName = appName; + } + + /// 测试包名称 + final String appName; + + /// 路由数据 + final List data; + + @override + State createState() => TestModelState(); +} + +class TestModelState extends State { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: widget.appName, + theme: ThemeData( + colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue), + appBarTheme: const AppBarTheme(backgroundColor: Colors.blue), + primarySwatch: Colors.blue, + useMaterial3: true, + ), + home: BasePage(data: widget.data), + ); + } +} diff --git a/ohos/test_sqflite_common/lib/base/test_page.dart b/ohos/test_sqflite_common/lib/base/test_page.dart new file mode 100644 index 0000000000000000000000000000000000000000..babcabaa7a2518f65dbfed58afa0017739ec540e --- /dev/null +++ b/ohos/test_sqflite_common/lib/base/test_page.dart @@ -0,0 +1,309 @@ +import 'dart:async'; + +import 'package:flutter/material.dart'; + +import 'item_widget.dart'; + +List contentList = []; + +class Test { + /// Test definition. + Test(this.name, this.fn, {bool? solo, bool? skip}) + : solo = solo == true, + skip = skip == true; + + /// Only run this test. + final bool solo; + + /// Skip this test. + final bool skip; + + /// Test name. + String name; + + /// Test body. + FutureOr Function() fn; +} + +/// Item states. +enum ItemState { + /// test not run yet. + none, + + /// test is running. + running, + + /// test succeeded. + success, + + /// test fails. + failure +} + +/// Menu item. +class Item { + /// Menu item. + Item(this.name); + + /// Menu item state. + ItemState state = ItemState.running; + + /// Menu item name/ + String name; +} + +class TestLength { + TestLength(this.oldLength, this.newLength); + + int oldLength; + int newLength; +} + +class GroupRange { + GroupRange(this.groupName, this.startIndex, this.endIndex); + + String groupName; + int startIndex; + int endIndex; +} + +/// 基础测试页面 +class TestPage extends StatefulWidget { + /// Base test page. + TestPage({required this.title, Key? key}) : super(key: key); + + /// The title. + final String title; + + /// Test list. + final List tests = []; + + /// 保存group的范围信息 + final Map groupTitle = {}; + + /// define a test. + void test(String name, FutureOr Function() fn) { + tests.add(Test(name, fn)); + } + + /// define a group test. + void group(String name, FutureOr Function() fn) { + int oldLength = tests.length; + fn(); + + int newLength = tests.length - 1; + groupTitle.addAll({name: TestLength(oldLength, newLength)}); + } + + /// Thrown an exception + void fail([String? message]) { + throw Exception(message ?? 'should fail'); + } + + @override + TestPageState createState() => TestPageState(); +} + +/// Group. +mixin Group { + /// List of tests. + List get tests { + throw UnimplementedError(); + } + + bool? _hasSolo; + final _tests = []; + + /// Add a test. + void add(Test test) { + if (!test.skip) { + if (test.solo) { + if (_hasSolo != true) { + _hasSolo = true; + _tests.clear(); + } + _tests.add(test); + } else if (_hasSolo != true) { + _tests.add(test); + } + } + } + + /// true if it has solo or contains item with solo feature + bool? get hasSolo => _hasSolo; +} + +class TestPageState extends State with Group { + List items = []; + + Future _run() async { + if (!mounted) { + return null; + } + + setState(() { + items.clear(); + }); + _tests.clear(); + for (var test in widget.tests) { + add(test); + } + for (var test in _tests) { + var item = Item(test.name); + contentList.add(Text(test.name, style: const TextStyle(fontSize: 18, color: Colors.green))); + + late int position; + setState(() { + position = items.length; + items.add(item); + }); + try { + await test.fn(); + item = Item(test.name)..state = ItemState.success; + print('ohFlutter: ${test.name}, result: success'); + } catch (e, st) { + contentList.add(Text('$e, $st', style: const TextStyle(fontSize: 18, color: Colors.red))); + print('ohFlutter: ${test.name}-error: $e, $st}'); + item = Item(test.name)..state = ItemState.failure; + } + + if (!mounted) { + return null; + } + + setState(() { + items[position] = item; + }); + } + } + + Future _runTest(int index) async { + if (!mounted) { + return null; + } + + final test = _tests[index]; + + var item = items[index]; + setState(() { + contentList = []; + item.state = ItemState.running; + }); + contentList.add(Text(test.name, style: const TextStyle(fontSize: 18, color: Colors.green))); + try { + await test.fn(); + + item = Item(test.name)..state = ItemState.success; + print('ohFlutter: ${test.name}, result: success'); + } catch (e, st) { + contentList.add(Text('$e, $st', style: const TextStyle(fontSize: 18, color: Colors.red))); + print('ohFlutter: ${test.name}-error: $e, $st}'); + try { + print(st); + } catch (_) {} + item = Item(test.name)..state = ItemState.failure; + } + + if (!mounted) { + return null; + } + + setState(() { + items[index] = item; + }); + } + + @override + void initState() { + super.initState(); + contentList = []; + _run(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar(title: Text(widget.title), actions: [ + IconButton( + icon: const Icon(Icons.search), + tooltip: 'Results', + onPressed: () { + showAlertDialog(context); + }, + ), + IconButton( + icon: const Icon(Icons.refresh), + tooltip: 'Run again', + onPressed: _run, + ), + ]), + body: ListView(children: [ + ...items.asMap().keys.map((e) => _itemBuilder(context, e)).toList(), + ])); + } + + Widget _itemBuilder(BuildContext context, int index) { + final item = getItem(index); + return ItemWidget( + item: item, + index: index, + getGroupRange: () { + GroupRange data = GroupRange('', 0, 0); + widget.groupTitle.forEach((key, value) { + if (value.oldLength <= index && value.newLength >= index) { + data = GroupRange(key, value.oldLength, value.newLength); + } + }); + return data; + }, + runGroup: (start, end) async { + for (var i = start; i <= end; i++) { + await _runTest(i); + print('\n'); + } + }, + onTap: (Item item) { + _runTest(index); + }); + } + + Item getItem(int index) { + return items[index]; + } + + @override + List get tests => widget.tests; +} + +void expect(var testModel, var object) { + try { + testModel; + contentList.add(Text('运行正常,输出参数为$testModel')); + } catch(e) { + contentList.add(Text('运行失败,错误信息为$e')); + print(e.toString()); + } +} + +void showAlertDialog(BuildContext context) { + showDialog( + context: context, + barrierDismissible: false, + builder: (BuildContext context) { + return AlertDialog( + content: SingleChildScrollView( + child: Column( + children: contentList, + ), + ), + actions: [ + MaterialButton( + child: const Text('确定'), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + ], + ); + }); +} \ No newline at end of file diff --git a/ohos/test_sqflite_common/lib/base/test_route.dart b/ohos/test_sqflite_common/lib/base/test_route.dart new file mode 100644 index 0000000000000000000000000000000000000000..dc37452a13174a378beda98af423a6c1717d1c57 --- /dev/null +++ b/ohos/test_sqflite_common/lib/base/test_route.dart @@ -0,0 +1,13 @@ +import 'package:flutter/cupertino.dart'; + +class MainItem { + /// Main item. + MainItem(this.title, this.route); + + /// Title. + String title; + + /// Page route. + Widget route; +} + diff --git a/ohos/test_sqflite_common/lib/main.dart b/ohos/test_sqflite_common/lib/main.dart new file mode 100644 index 0000000000000000000000000000000000000000..19c224a5a4d62a50e1dde8442f6f763f051eb65e --- /dev/null +++ b/ohos/test_sqflite_common/lib/main.dart @@ -0,0 +1,49 @@ +import 'package:flutter/material.dart'; +import 'package:test_sqflite_common/src/import_mixin_test.dart'; +import 'package:test_sqflite_common/src/list_mixin_test.dart'; +import 'package:test_sqflite_common/src/path_utils_test.dart'; +import 'package:test_sqflite_common/src/sqflite_batch_test.dart'; +import 'package:test_sqflite_common/src/sqflite_debug_test.dart'; +import 'package:test_sqflite_common/src/sqflite_dev_test.dart'; +import 'package:test_sqflite_common/src/sqflite_exception_test.dart'; +import 'package:test_sqflite_common/src/sqflite_impl_test.dart'; +import 'package:test_sqflite_common/src/sqflite_logger_test.dart'; +import 'package:test_sqflite_common/src/sqflite_not_initialized_test.dart'; +import 'package:test_sqflite_common/src/sqflite_open_test.dart'; +import 'package:test_sqflite_common/src/sqflite_sql_test.dart'; +import 'package:test_sqflite_common/src/sqflite_transaction_test.dart'; +import 'package:test_sqflite_common/src/sql_builder_test.dart'; +import 'package:test_sqflite_common/src/sql_test.dart'; +import 'package:test_sqflite_common/src/sqlite_api_test.dart'; +import 'package:test_sqflite_common/src/src_mixin_factory_test.dart'; +import 'package:test_sqflite_common/src/src_mixin_test.dart'; +import 'package:test_sqflite_common/src/utils_test.dart'; + +import 'base/test_model_app.dart'; +import 'base/test_route.dart'; + +void main() { + final app = [ + MainItem('import_mixin_test', ImportMixinTestPage('import_mixin_test')), + MainItem('list_mixin_test', ListMixinTestPage('list_mixin_test')), + MainItem('path_utils_test', PathUtilsTestPage('path_utils_test')), + MainItem('sqflite_batch_test', SqfliteBatchTestPage('sqflite_batch_test')), + MainItem('sqflite_debug_test', SqfliteDebugTestPage('sqflite_debug_test')), + MainItem('sqflite_dev_test', SqfliteDevTestPage('sqflite_dev_test')), + MainItem('sqflite_exception_test', SqfliteExceptionTestPage('sqflite_exception_test')), + MainItem('sqflite_impl_test', SqfliteImplTestPage('sqflite_impl_test')), + MainItem('sqflite_logger_test', SqfliteLoggerTestPage('sqflite_logger_test')), + MainItem('sqflite_not_initialized_test', SqfliteNotInitializedTestPage('sqflite_not_initialized_test')), + MainItem('sqflite_open_test', SqfliteOpenTestPage('sqflite_open_test')), + MainItem('sqflite_sql_test', SqfliteSqlTestPage('sqflite_sql_test')), + MainItem('sqflite_transaction_test', SqfliteTransactionTestPage('sqflite_transaction_test')), + MainItem('sql_builder_test', SqlBuilderTestPage('sql_builder_test')), + MainItem('sql_test', SqlTestPage('sql_test')), + MainItem('sqlite_api_test', SqliteApiTestPage('sqlite_api_test')), + MainItem('src_mixin_factory_test', SrcMixinFactoryTestPage('src_mixin_factory_test')), + MainItem('src_mixin_test', SrcMixinTestPage('src_mixin_test')), + MainItem('utils_test', UtilsTestPage('utils_test')), + ]; + + runApp(TestModelApp(appName: 'sqflite_common', data: app)); +} diff --git a/ohos/test_sqflite_common/lib/src/import_mixin_test.dart b/ohos/test_sqflite_common/lib/src/import_mixin_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..5571a7125518a0318dd18c2a557b5d6a0fac9563 --- /dev/null +++ b/ohos/test_sqflite_common/lib/src/import_mixin_test.dart @@ -0,0 +1,40 @@ +import 'package:sqflite_common/src/mixin/dev_utils.dart'; +import 'package:sqflite_common/src/mixin/import_mixin.dart'; +import 'package:flutter/material.dart'; +import 'package:test_sqflite_common/base/test_page.dart'; + +class ImportMixinTestPage extends TestPage { + ImportMixinTestPage(String title,{ Key? key}) : super(title: title, key: key) { + group('handler_mixin', () { + // Check that public api are exported + test('exported', () { + for (var value in [ + // ignore: deprecated_member_use_from_same_package + SqfliteOptions, + methodOpenDatabase, + methodOpenDatabase, + methodCloseDatabase, + methodOptions, + sqliteErrorCode, + methodInsert, + methodQuery, + methodUpdate, + methodExecute, + methodBatch, + // Factory + buildDatabaseFactory, SqfliteInvokeHandler, SqfliteDatabaseFactoryBase, + SqfliteDatabaseFactoryMixin, SqfliteDatabaseFactory, + // Database + SqfliteDatabaseOpenHelper, SqfliteDatabase, SqfliteDatabaseMixin, + SqfliteDatabaseBase, + // Exception + SqfliteDatabaseException, + // ignore: deprecated_member_use_from_same_package + devPrint, devWarning, + ]) { + expect(value, value !=null); + } + }); + }); +} +} \ No newline at end of file diff --git a/ohos/test_sqflite_common/lib/src/list_mixin_test.dart b/ohos/test_sqflite_common/lib/src/list_mixin_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..fee81f3ea72e7a56ff3ac34db9875da4f7491aed --- /dev/null +++ b/ohos/test_sqflite_common/lib/src/list_mixin_test.dart @@ -0,0 +1,76 @@ +import 'dart:collection'; + +import 'package:flutter/material.dart'; +import 'package:test_sqflite_common/base/test_page.dart'; + +class MyList1 extends Object with ListMixin> { + MyList1.from(this._list); + + final List _list; + + @override + Map operator [](int index) { + final value = _list[index] as Map; + return value.cast(); + } + + @override + void operator []=(int index, Map value) { + throw 'read-only'; + } + + @override + set length(int newLength) { + throw 'read-only'; + } + + @override + int get length => _list.length; +} + +class MyList2 extends ListBase> { + MyList2.from(this._list); + + final List _list; + + @override + Map operator [](int index) { + final value = _list[index] as Map; + return value.cast(); + } + + @override + void operator []=(int index, Map value) { + throw 'read-only'; + } + + @override + set length(int newLength) { + throw 'read-only'; + } + + @override + int get length => _list.length; +} +class ListMixinTestPage extends TestPage { + ListMixinTestPage(String title,{ Key? key}) : super(title: title, key: key) { + group('mixin', () { + // This fails on beta 1, should work now + test('ListMixin', () { + final raw = [ + {'col': 1} + ]; + final rows = MyList1.from(raw); + expect(rows, raw); + }); + + test('ListBase', () { + final raw = [ + {'col': 1} + ]; + final rows = MyList2.from(raw); + expect(rows, raw); + }); + }); + } +} \ No newline at end of file diff --git a/ohos/test_sqflite_common/lib/src/path_utils_test.dart b/ohos/test_sqflite_common/lib/src/path_utils_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..392fc52e3f3328998dabdaf2bf81b083f7bd417f --- /dev/null +++ b/ohos/test_sqflite_common/lib/src/path_utils_test.dart @@ -0,0 +1,24 @@ +import 'package:sqflite_common/sqlite_api.dart'; +import 'package:sqflite_common/src/path_utils.dart'; +import 'package:flutter/material.dart'; +import 'package:test_sqflite_common/base/test_page.dart'; + +class PathUtilsTestPage extends TestPage { + PathUtilsTestPage(String title,{ Key? key}) : super(title: title, key: key) { + group('数据库路径', () { + test('在内存中的数据库', () { + expect(inMemoryDatabasePath, ':memory:'); + expect(isInMemoryDatabasePath('test.db'), false); + expect(isInMemoryDatabasePath(':memory:'), true); + expect(isInMemoryDatabasePath('file::memory:'), true); + }); + + test('文件路径', () { + expect(isFileUriDatabasePath('file::memory:'), true); + expect(isFileUriDatabasePath('filememory'), false); + expect(isFileUriDatabasePath('file:relative'), true); + expect(isFileUriDatabasePath('file:///abs'), true); + }); + }); + } +} \ No newline at end of file diff --git a/ohos/test_sqflite_common/lib/src/sqflite_batch_test.dart b/ohos/test_sqflite_common/lib/src/sqflite_batch_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..360433a30fc1fbb0ecdec589f640e36b4d838e56 --- /dev/null +++ b/ohos/test_sqflite_common/lib/src/sqflite_batch_test.dart @@ -0,0 +1,76 @@ +import 'package:sqflite_common/sqlite_api.dart'; +import 'package:flutter/material.dart'; +import 'package:test_sqflite_common/base/test_page.dart'; + +import 'test_scenario.dart'; +class SqfliteBatchTestPage extends TestPage { + SqfliteBatchTestPage(String title,{ Key? key}) : super(title: title, key: key) { + group('批量功能测试', () { + var startCommands = [protocolOpenStep]; + var endCommands = [protocolCloseStep]; + test('批量提交', () async { + final scenario = startScenario([ + ...startCommands, + [ + 'execute', + { + 'sql': 'BEGIN IMMEDIATE', + 'id': 1, + 'inTransaction': true, + 'transactionId': null + }, + null + ], + [ + 'batch', + { + 'operations': [ + {'method': 'execute', 'sql': 'PRAGMA dummy'} + ], + 'id': 1 + }, + null + ], + [ + 'execute', + {'sql': 'COMMIT', 'id': 1, 'inTransaction': false}, + null + ], + ...endCommands, + ]); + final factory = scenario.factory; + final db = await factory.openDatabase(inMemoryDatabasePath); + var batch = db.batch(); + expect(batch.length, 0); + batch.execute('PRAGMA dummy'); + expect(batch.length, 1); + expect(await batch.commit(), null); // Mock return values + await db.close(); + scenario.end(); + }); + test('批量应用', () async { + final scenario = startScenario([ + ...startCommands, + [ + 'batch', + { + 'operations': [ + {'method': 'execute', 'sql': 'PRAGMA dummy'} + ], + 'id': 1 + }, + null + ], + ...endCommands, + ]); + final factory = scenario.factory; + final db = await factory.openDatabase(inMemoryDatabasePath); + var batch = db.batch(); + batch.execute('PRAGMA dummy'); + await batch.apply(); + await db.close(); + scenario.end(); + }); + }); + } +} \ No newline at end of file diff --git a/ohos/test_sqflite_common/lib/src/sqflite_debug_test.dart b/ohos/test_sqflite_common/lib/src/sqflite_debug_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..3977cb1e3b51a7dd31dae64a3e2ed0a58f62045f --- /dev/null +++ b/ohos/test_sqflite_common/lib/src/sqflite_debug_test.dart @@ -0,0 +1,42 @@ +import 'package:sqflite_common/sqlite_api.dart'; +import 'package:sqflite_common/src/constant.dart'; +import 'package:sqflite_common/src/method_call.dart'; +import 'package:sqflite_common/src/mixin/factory.dart'; +import 'package:flutter/material.dart'; +import 'package:test_sqflite_common/base/test_page.dart'; + +var logs = []; +var databaseFactoryMock = buildDatabaseFactory( + tag: 'mock', + invokeMethod: (method, [arguments]) async { + logs.add(SqfliteMethodCall(method, arguments)); + if (method == methodGetDatabasesPath) { + return 'mock_path'; + } + }); + +class SqfliteDebugTestPage extends TestPage { + SqfliteDebugTestPage(String title,{ Key? key}) : super(title: title, key: key) { + test('简单的数据库例子', () async { + logs.clear(); + // ignore: deprecated_member_use_from_same_package + await databaseFactoryMock.debugSetLogLevel(sqfliteLogLevelVerbose); + expect(logs.map((log) => log.toMap()), [ + { + 'method': 'options', + 'arguments': {'logLevel': 2} + } + ]); + }); + test('getDatabasesPath setDatabasesPath', () async { + final oldDatabasePath = await databaseFactoryMock.getDatabasesPath(); + try { + await databaseFactoryMock.setDatabasesPath('.'); + final path = await databaseFactoryMock.getDatabasesPath(); + expect(path, '.'); + } finally { + await databaseFactoryMock.setDatabasesPath(oldDatabasePath); + } + }); + } +} \ No newline at end of file diff --git a/ohos/test_sqflite_common/lib/src/sqflite_dev_test.dart b/ohos/test_sqflite_common/lib/src/sqflite_dev_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..4492ba8002f249b25484af136e515e15d8a28ef4 --- /dev/null +++ b/ohos/test_sqflite_common/lib/src/sqflite_dev_test.dart @@ -0,0 +1,41 @@ +import 'package:sqflite_common/sqflite_dev.dart'; +import 'package:sqflite_common/src/constant.dart'; +import 'package:sqflite_common/src/method_call.dart'; +import 'package:sqflite_common/src/mixin/factory.dart'; +import 'package:flutter/material.dart'; +import 'package:test_sqflite_common/base/test_page.dart'; + +var logs = []; +var databaseFactoryMock = buildDatabaseFactory( + tag: 'mock', + invokeMethod: (method, [arguments]) async { + logs.add(SqfliteMethodCall(method, arguments)); + if (method == methodGetDatabasesPath) { + return 'mock_path'; + } + }); +class SqfliteDevTestPage extends TestPage { + SqfliteDevTestPage(String title,{ Key? key}) : super(title: title, key: key) { + test('简单的sqflite示例', () async { + logs.clear(); + // ignore: deprecated_member_use_from_same_package + await databaseFactoryMock.setLogLevel(sqfliteLogLevelVerbose); + expect(logs.map((log) => log.toMap()), [ + { + 'method': 'options', + 'arguments': {'logLevel': 2} + } + ]); + }); + test('getDatabasesPath setDatabasesPath', () async { + final oldDatabasePath = await databaseFactoryMock.getDatabasesPath(); + try { + await databaseFactoryMock.setDatabasesPath('.'); + final path = await databaseFactoryMock.getDatabasesPath(); + expect(path, '.'); + } finally { + await databaseFactoryMock.setDatabasesPath(oldDatabasePath); + } + }); + } +} \ No newline at end of file diff --git a/ohos/test_sqflite_common/lib/src/sqflite_exception_test.dart b/ohos/test_sqflite_common/lib/src/sqflite_exception_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..211ba25e3244eb3f0920fce86fe4ffe5afdbdb6f --- /dev/null +++ b/ohos/test_sqflite_common/lib/src/sqflite_exception_test.dart @@ -0,0 +1,165 @@ +import 'dart:typed_data'; + +import 'package:sqflite_common/src/exception.dart'; +import 'package:flutter/material.dart'; +import 'package:test_sqflite_common/base/test_page.dart'; + +class SqfliteExceptionTestPage extends TestPage { + SqfliteExceptionTestPage(String title,{ Key? key}) : super(title: title, key: key) { + group('sqflite_exception', () { + test('isUniqueConstraint', () async { + // Android + var msg = 'UNIQUE constraint failed: Test.name (code 2067))'; + var exception = SqfliteDatabaseException(msg, null); + expect(exception.isDatabaseClosedError(), false); + expect(exception.isReadOnlyError(), false); + expect(exception.isNoSuchTableError(), false); + expect(exception.isOpenFailedError(), false); + expect(exception.isSyntaxError(), false); + expect(exception.isNotNullConstraintError(), false); + expect(exception.isUniqueConstraintError(), true); + expect(exception.isUniqueConstraintError('Test.name'), true); + + msg = 'UNIQUE constraint failed: Test.name (code 1555))'; + exception = SqfliteDatabaseException(msg, null); + expect(exception.isSyntaxError(), false); + expect(exception.isUniqueConstraintError(), true); + expect(exception.isUniqueConstraintError('Test.name'), true); + }); + + test('isNotNullConstraint', () async { + // FFI mac + var msg = + 'DatabaseException(SqliteException(1299): NOT NULL constraint failed: Test.name, constraint failed (code 1299))'; + var exception = SqfliteDatabaseException(msg, null); + expect(exception.isDatabaseClosedError(), false); + expect(exception.isReadOnlyError(), false); + expect(exception.isNoSuchTableError(), false); + expect(exception.isOpenFailedError(), false); + expect(exception.isSyntaxError(), false); + expect(exception.isUniqueConstraintError(), false); + expect(exception.isUniqueConstraintError('Test.name'), false); + expect(exception.getResultCode(), 1299); + + // ios + msg = + 'DatabaseException(Error Domain=FMDatabase Code=1299 "NOT NULL constraint failed: Test.name"'; + exception = SqfliteDatabaseException(msg, null); + expect(exception.isSyntaxError(), false); + expect(exception.isNotNullConstraintError(), true); + expect(exception.isNotNullConstraintError('Test.name'), true); + expect(exception.isUniqueConstraintError(), false); + expect(exception.isUniqueConstraintError('Test.name'), false); + expect(exception.getResultCode(), 1299); + }); + + test('isSyntaxError', () async { + // Android + final msg = 'near "DUMMY": syntax error (code 1)'; + final exception = SqfliteDatabaseException(msg, null); + expect(exception.isDatabaseClosedError(), false); + expect(exception.isReadOnlyError(), false); + expect(exception.isNoSuchTableError(), false); + expect(exception.isOpenFailedError(), false); + expect(exception.isSyntaxError(), true); + expect(exception.isUniqueConstraintError(), false); + expect(exception.getResultCode(), 1); + }); + + test('isSyntaxError with symbolic names', () { + // Android + final msg = 'near "DUMMY": syntax error (code 1 SQLITE_ERROR)'; + final exception = SqfliteDatabaseException(msg, null); + expect(exception.isDatabaseClosedError(), false); + expect(exception.isReadOnlyError(), false); + expect(exception.isNoSuchTableError(), false); + expect(exception.isOpenFailedError(), false); + expect(exception.isSyntaxError(), true); + expect(exception.isUniqueConstraintError(), false); + expect(exception.getResultCode(), 1); + }); + + test('isNoSuchTable', () async { + // Android + final msg = 'no such table: Test (code 1)'; + final exception = SqfliteDatabaseException(msg, null); + expect(exception.isDatabaseClosedError(), false); + expect(exception.isReadOnlyError(), false); + expect(exception.isNoSuchTableError(), true); + expect(exception.isNoSuchTableError('Test'), true); + expect(exception.isNoSuchTableError('Other'), false); + expect(exception.isDuplicateColumnError('tableName'), false); + expect(exception.isDuplicateColumnError(), false); + expect(exception.isOpenFailedError(), false); + expect(exception.isSyntaxError(), false); + expect(exception.isUniqueConstraintError(), false); + expect(exception.getResultCode(), 1); + }); + + test('isDuplicateColumn', () { + // Android + final msg = 'duplicate column name: tableName (code 1 SQLITE_ERROR)'; + final exception = SqfliteDatabaseException(msg, null); + expect(exception.isDatabaseClosedError(), false); + expect(exception.isReadOnlyError(), false); + expect(exception.isDuplicateColumnError('tableName'), true); + expect(exception.isDuplicateColumnError(), true); + expect(exception.isDuplicateColumnError('tableName2'), false); + expect(exception.isNoSuchTableError(), false); + expect(exception.isNoSuchTableError('Test'), false); + expect(exception.isNoSuchTableError('Other'), false); + expect(exception.isOpenFailedError(), false); + expect(exception.isSyntaxError(), false); + expect(exception.isUniqueConstraintError(), false); + expect(exception.getResultCode(), 1); + }); + test('getResultCode', () async { + // Android + final msg = 'UNIQUE constraint failed: Test.name (code 2067))'; + var exception = SqfliteDatabaseException(msg, null); + expect(exception.getResultCode(), 2067); + exception = SqfliteDatabaseException( + 'UNIQUE constraint failed: Test.name (code 1555))', null); + expect(exception.getResultCode(), 1555); + exception = + SqfliteDatabaseException('near "DUMMY": syntax error (code 1)', null); + expect(exception.getResultCode(), 1); + + exception = SqfliteDatabaseException( + 'attempt to write a readonly database (code 8)) running Open read-only', + null); + expect(exception.getResultCode(), 8); + + // iOS: Error Domain=FMDatabase Code=19 'UNIQUE constraint failed: Test.name' UserInfo={NSLocalizedDescription=UNIQUE constraint failed: Test.name}) s + exception = SqfliteDatabaseException( + "Error Domain=FMDatabase Code=19 'UNIQUE constraint failed: Test.name' UserInfo={NSLocalizedDescription=UNIQUE constraint failed: Test.name})", + null); + expect(exception.getResultCode(), 19); + exception = + SqfliteDatabaseException('Error Domain=FMDatabase Code=19', null); + expect(exception.getResultCode(), 19); + }); + + test('Exception args', () async { + var exception = SqfliteDatabaseException('test', { + 'sql': 'statement', + 'arguments': [ + null, + 1, + 'short', + '123456789012345678901234567890123456789012345678901', + Uint8List.fromList([1, 2, 3]) + ] + }); + expect(exception.toString(), + 'DatabaseException(test) sql \'statement\' args [null, 1, short, 12345678901234567890123456789012345678901234567890..., Blob(3)]'); + }); + test('Exception result', () async { + DatabaseException exception = SqfliteDatabaseException('test', 1); + expect(exception.result, 1); + exception = SqfliteDatabaseException('test', null); + expect(exception.result, null); + }); + }); + } +} \ No newline at end of file diff --git a/ohos/test_sqflite_common/lib/src/sqflite_impl_test.dart b/ohos/test_sqflite_common/lib/src/sqflite_impl_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..70955d368ece096c6cdeb29bdf20b3a7467318bd --- /dev/null +++ b/ohos/test_sqflite_common/lib/src/sqflite_impl_test.dart @@ -0,0 +1,124 @@ +import 'package:sqflite_common/src/collection_utils.dart'; +import 'package:sqflite_common/src/exception.dart'; +import 'package:flutter/material.dart'; +import 'package:test_sqflite_common/base/test_page.dart'; + +class SqfliteImplTestPage extends TestPage { + SqfliteImplTestPage(String title,{ Key? key}) : super(title: title, key: key) { + group('sqflite', () { + test('Rows.from()', () { + final raw = [ + {'col': 1} + ]; + final rows = Rows.from(raw); + final row = rows.first; + expect(rows, raw); + expect(row, {'col': 1}); + }); + + test('fromRawOperationResult', () async { + expect(fromRawOperationResult({'result': 1}), 1); + expect( + fromRawOperationResult({ + 'result': { + 'columns': ['column'], + 'rows': [ + [1] + ] + } + }), + >[ + {'column': 1} + ]); + var exception = fromRawOperationResult({ + 'error': { + 'code': 1234, + 'message': 'hello', + 'data': {'some': 'data'} + } + }) as SqfliteDatabaseException; + expect(exception.message, 'hello'); + expect(exception.result, {'some': 'data'}); + expect(exception.getResultCode(), null); + + exception = fromRawOperationResult({ + 'error': { + 'code': 1234, + 'message': 'hello', + 'data': {'some': 'data'}, + 'resultCode': 1, + } + }) as SqfliteDatabaseException; + expect(exception.message, 'hello'); + expect(exception.result, {'some': 'data'}); + expect(exception.getResultCode(), 1); + }); + test('QueryResultSet', () { + final raw = { + 'columns': ['column'], + 'rows': [ + [1] + ] + }; + final queryResultSet = QueryResultSet([ + 'column' + ], [ + [1] + ]); + expect(queryResultSet.columnIndex('dummy'), null); + expect(queryResultSet.columnIndex('column'), 0); + final row = queryResultSet.first; + //expect(rows, raw); + expect(row, {'column': 1}); + + // read only + try { + row['column'] = 2; + fail('should have failed'); + } on UnsupportedError catch (_) {} + final map = Map.from(row); + // now can modify + map['column'] = 2; + + final queryResultSetMap = { + 'columns': ['id', 'name'], + 'rows': >[ + [1, 'item 1'], + [2, 'item 2'] + ] + }; + final expected = >[ + {'id': 1, 'name': 'item 1'}, + {'id': 2, 'name': 'item 2'} + ]; + expect(queryResultToList(queryResultSetMap), expected); + expect(queryResultToList(expected), expected); + expect(queryResultToList(raw), >[ + {'column': 1} + ]); + + expect(queryResultToList({}), []); + }); + + test('QueryResultSet.keys', () { + final queryResultSet = QueryResultSet([ + 'col', + 'col' + ], [ + [1, 2] + ]); + // last one wins... + expect(queryResultSet.columnIndex('col'), 1); + final row = queryResultSet.first; + expect(row['col'], 2); + + expect(row.length, 1); + expect(row.keys, ['col']); + expect(row.values, [2]); + expect(row, {'col': 2}); + }); + + test('lockWarning', () {}); + }); + } +} \ No newline at end of file diff --git a/ohos/test_sqflite_common/lib/src/sqflite_logger_test.dart b/ohos/test_sqflite_common/lib/src/sqflite_logger_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..8ff5f063d396c2a4d8822061987111d6ea09f64f --- /dev/null +++ b/ohos/test_sqflite_common/lib/src/sqflite_logger_test.dart @@ -0,0 +1,76 @@ +import 'package:sqflite_common/sqlite_api.dart'; +import 'package:sqflite_common/src/internals.dart'; +import 'package:sqflite_common/src/logger/sqflite_logger.dart'; +import 'package:flutter/material.dart'; +import 'package:test_sqflite_common/base/test_page.dart'; + +import 'src_mixin_test.dart'; +class SqfliteLoggerTestPage extends TestPage { + SqfliteLoggerTestPage(String title,{ Key? key}) : super(title: title, key: key) { + group('sqflite_logger', () { + test('内部调用测试, 输出部分日志', () async { + var events = []; + var lines = []; + final factory = SqfliteDatabaseFactoryLogger(MockDatabaseFactoryEmpty(), + options: SqfliteLoggerOptions( + type: SqfliteDatabaseFactoryLoggerType.invoke, + log: (event) { + event.dump( + print: (msg) { + lines.add(msg?.toString() ?? ''); + print(msg); + }, + noStopwatch: true); + events.add(event); + })); + try { + await factory.internalsInvokeMethod('test', {'some': 'param'}); + } catch (_) { + // unimplemented + } + var event = events.first as SqfliteLoggerInvokeEvent; + expect(event.method, 'test'); + expect(event.arguments, {'some': 'param'}); + expect(event.sw!.isRunning, false); + // is currently an error + // 'invoke:({method: test, arguments: {some: param}, error: UnimplementedError: test {some: param}})' + expect(lines.first, + 'invoke:({method: test, arguments: {some: param}'); + }); + test('输出所有日志', () async { + var events = []; + var lines = []; + final factory = SqfliteDatabaseFactoryLogger(MockDatabaseFactoryEmpty(), + options: SqfliteLoggerOptions( + type: SqfliteDatabaseFactoryLoggerType.all, + log: (event) { + event.dump( + print: (msg) { + lines.add(msg?.toString() ?? ''); + print(msg); + }, + noStopwatch: true); + events.add(event); + })); + var db = await factory.openDatabase(inMemoryDatabasePath); + var batch = db.batch(); + batch.rawQuery('PRAGMA user_version'); + await batch.commit(); + var event = events.first as SqfliteLoggerDatabaseOpenEvent; + expect(event.path, inMemoryDatabasePath); + expect(event.options?.readOnly, false); + expect(event.sw!.isRunning, false); + await db.close(); + expect(lines, [ + 'openDatabase:({path: :memory:, options: {readOnly: false, singleInstance: true}})', + 'execute:({db: 1, sql: BEGIN IMMEDIATE})', + 'batch:({db: 1})', + ' query({sql: PRAGMA user_version})', + 'execute:({db: 1, sql: COMMIT})', + 'closeDatabase:({db: 1})' + ]); + }); + test('batch', () async {}); + }); + } +} \ No newline at end of file diff --git a/ohos/test_sqflite_common/lib/src/sqflite_not_initialized_test.dart b/ohos/test_sqflite_common/lib/src/sqflite_not_initialized_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..e0807eab6dd443396b71600d10a86163e5319162 --- /dev/null +++ b/ohos/test_sqflite_common/lib/src/sqflite_not_initialized_test.dart @@ -0,0 +1,14 @@ +import 'package:sqflite_common/sqflite.dart'; +import 'package:flutter/material.dart'; +import 'package:test_sqflite_common/base/test_page.dart'; + +class SqfliteNotInitializedTestPage extends TestPage { + SqfliteNotInitializedTestPage(String title,{ Key? key}) : super(title: title, key: key) { + group('未初始化sql时的测试', () { + test('打开一个内存上的数据库, 此处会报错', () async { + openDatabase(inMemoryDatabasePath); + }); + }); + + } +} diff --git a/ohos/test_sqflite_common/lib/src/sqflite_open_test.dart b/ohos/test_sqflite_common/lib/src/sqflite_open_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..c9ee03cfbdf76b012a9b4d1a46da61f8492f5203 --- /dev/null +++ b/ohos/test_sqflite_common/lib/src/sqflite_open_test.dart @@ -0,0 +1,92 @@ +import 'dart:typed_data'; + +import 'package:sqflite_common/sqlite_api.dart'; +import 'package:flutter/material.dart'; +import 'package:test_sqflite_common/base/test_page.dart'; + +import 'test_scenario.dart'; + +class SqfliteOpenTestPage extends TestPage { + SqfliteOpenTestPage(String title,{ Key? key}) : super(title: title, key: key) { + group('sqflite', () { + test('读取id结果', () async { + final scenario = startScenario([ + [ + 'openDatabase', + {'path': ':memory:', 'singleInstance': false}, + 1 + ], + [ + 'closeDatabase', + {'id': 1}, + null + ], + ]); + final factory = scenario.factory; + final db = await factory.openDatabase(inMemoryDatabasePath); + await db.close(); + scenario.end(); + }); + test('读取map结果', () async { + final scenario = startScenario([ + [ + 'openDatabase', + {'path': ':memory:', 'singleInstance': false}, + {'id': 1}, + ], + [ + 'closeDatabase', + {'id': 1}, + null + ], + ]); + final factory = scenario.factory; + final db = await factory.openDatabase(inMemoryDatabasePath); + await db.close(); + scenario.end(); + }); + test('打开对应版本的数据库', () async { + final scenario = startScenario([ + protocolOpenStep, + [ + 'query', + {'sql': 'PRAGMA user_version', 'id': 1}, + // ignore: inference_failure_on_collection_literal + {} + ], + [ + 'execute', + { + 'sql': 'BEGIN EXCLUSIVE', + 'id': 1, + 'inTransaction': true, + 'transactionId': null + }, + null + ], + [ + 'query', + {'sql': 'PRAGMA user_version', 'id': 1}, + // ignore: inference_failure_on_collection_literal + {} + ], + [ + 'execute', + {'sql': 'PRAGMA user_version = 1', 'id': 1}, + null + ], + [ + 'execute', + {'sql': 'COMMIT', 'id': 1, 'inTransaction': false}, + null + ], + protocolCloseStep, + ]); + final db = await scenario.factory.openDatabase(inMemoryDatabasePath, + options: OpenDatabaseOptions(version: 1, onCreate: (db, version) {})); + await db.close(); + scenario.end(); + }); + }); + } +} \ No newline at end of file diff --git a/ohos/test_sqflite_common/lib/src/sqflite_sql_test.dart b/ohos/test_sqflite_common/lib/src/sqflite_sql_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..34b5caafa951c587b5999b7580d5c24b2f7abcf8 --- /dev/null +++ b/ohos/test_sqflite_common/lib/src/sqflite_sql_test.dart @@ -0,0 +1,301 @@ +import 'dart:typed_data'; + +import 'package:sqflite_common/sqlite_api.dart'; +import 'package:flutter/material.dart'; +import 'package:test_sqflite_common/base/test_page.dart'; + +import 'test_scenario.dart'; + +class SqfliteSqlTestPage extends TestPage { + SqfliteSqlTestPage(String title,{ Key? key}) : super(title: title, key: key) { + group('sqflite', () { + test('使用sql语句打开数据库', () async { + final scenario = startScenario([ + protocolOpenStep, + [ + 'execute', + {'sql': 'PRAGMA user_version = 1', 'id': 1}, + null, + ], + protocolCloseStep + ]); + final db = await scenario.factory.openDatabase(inMemoryDatabasePath); + await db.setVersion(1); + + await db.close(); + scenario.end(); + }); + test('事物测试 v2', () async { + final scenario = startScenario([ + protocolOpenStep, + [ + 'execute', + { + 'sql': 'BEGIN IMMEDIATE', + 'id': 1, + 'inTransaction': true, + 'transactionId': null + }, + {'transactionId': 1}, + ], + [ + 'execute', + { + 'sql': 'COMMIT', + 'id': 1, + 'inTransaction': false, + 'transactionId': 1 + }, + null, + ], + protocolCloseStep + ]); + final db = await scenario.factory.openDatabase(inMemoryDatabasePath); + await db.transaction((txn) async {}); + + await db.close(); + scenario.end(); + }); + + test('事物测试 v1', () async { + final scenario = startScenario([ + protocolOpenStep, + [ + 'execute', + { + 'sql': 'BEGIN IMMEDIATE', + 'id': 1, + 'inTransaction': true, + 'transactionId': null + }, + null, + ], + [ + 'execute', + { + 'sql': 'COMMIT', + 'id': 1, + 'inTransaction': false, + }, + null, + ], + protocolCloseStep + ]); + final db = await scenario.factory.openDatabase(inMemoryDatabasePath); + await db.transaction((txn) async {}); + + await db.close(); + scenario.end(); + }); + + test('自动关闭数据库', () async { + final scenario = startScenario([ + protocolOpenStep, + [ + 'execute', + {'sql': 'BEGIN TRANSACTION', 'id': 1, 'inTransaction': true}, + null, + ], + [ + 'execute', + { + 'sql': 'ROLLBACK', + 'id': 1, + 'inTransaction': false, + 'transactionId': -1 + }, + null, + ], + protocolCloseStep + ]); + final db = await scenario.factory.openDatabase(inMemoryDatabasePath); + await db.execute('BEGIN TRANSACTION'); + + await db.close(); + scenario.end(); + }); + + test('手动关闭数据库', () async { + final scenario = startScenario([ + protocolOpenStep, + [ + 'execute', + {'sql': 'BEGIN TRANSACTION', 'id': 1, 'inTransaction': true}, + null, + ], + [ + 'execute', + {'sql': 'ROLLBACK TRANSACTION', 'id': 1, 'inTransaction': false}, + null, + ], + protocolCloseStep + ]); + final db = await scenario.factory.openDatabase(inMemoryDatabasePath); + await db.execute('BEGIN TRANSACTION'); + await db.execute('ROLLBACK TRANSACTION'); + + await db.close(); + scenario.end(); + }); + test('插入数据', () async { + final scenario = startScenario([ + protocolOpenStep, + [ + 'insert', + { + 'sql': 'INSERT INTO test (blob) VALUES (?)', + 'arguments': [ + [1, 2, 3] + ], + 'id': 1 + }, + 1 + ], + protocolCloseStep + ]); + final db = await scenario.factory.openDatabase(inMemoryDatabasePath); + expect( + await db.insert('test', { + 'blob': Uint8List.fromList([1, 2, 3]) + }), + 1); + await db.close(); + scenario.end(); + }); + + test('插入数据出错', () async { + final scenario = startScenario([ + protocolOpenStep, + [ + 'insert', + { + 'sql': 'INSERT OR IGNORE INTO test (value) VALUES (?)', + 'arguments': [1], + 'id': 1 + }, + 1 + ], + protocolCloseStep + ]); + final db = await scenario.factory.openDatabase(inMemoryDatabasePath); + expect( + await db.insert('test', {'value': 1}, + conflictAlgorithm: ConflictAlgorithm.ignore), + 1); + await db.close(); + scenario.end(); + }); + + test('打开数据库时调用batch', () async { + final scenario = startScenario([ + protocolOpenStep, + [ + 'execute', + { + 'sql': 'BEGIN IMMEDIATE', + 'id': 1, + 'inTransaction': true, + 'transactionId': null, + }, + {'transactionId': 1} + ], + [ + 'batch', + { + 'operations': [ + { + 'method': 'insert', + 'sql': 'INSERT INTO test (blob) VALUES (?)', + 'arguments': [ + [1, 2, 3] + ] + } + ], + 'id': 1, + 'transactionId': 1 + }, + null + ], + [ + 'execute', + { + 'sql': 'COMMIT', + 'id': 1, + 'inTransaction': false, + 'transactionId': 1 + }, + null + ], + protocolCloseStep + ]); + final db = await scenario.factory.openDatabase(inMemoryDatabasePath); + final batch = db.batch(); + batch.insert('test', { + 'blob': Uint8List.fromList([1, 2, 3]) + }); + await batch.commit(); + await db.close(); + scenario.end(); + }); + + test('查询数据', () async { + final scenario = startScenario([ + protocolOpenStep, + [ + 'query', + { + 'sql': '_', + 'id': 1, + 'cursorPageSize': 2, + }, + { + 'cursorId': 1, + 'rows': [ + // ignore: inference_failure_on_collection_literal + [{}] + ], + // ignore: inference_failure_on_collection_literal + 'columns': [] + } + ], + [ + 'queryCursorNext', + {'cursorId': 1, 'id': 1}, + { + 'cursorId': 1, + 'rows': [ + // ignore: inference_failure_on_collection_literal + [{}] + ], + // ignore: inference_failure_on_collection_literal + 'columns': [] + }, + ], + [ + 'queryCursorNext', + {'cursorId': 1, 'cancel': true, 'id': 1}, + null + ], + protocolCloseStep + ]); + var resultList = >[]; + final db = await scenario.factory.openDatabase(inMemoryDatabasePath); + var cursor = await db.rawQueryCursor( + '_', + null, + bufferSize: 2, + ); + expect(await cursor.moveNext(), true); + resultList.add(cursor.current); + expect(await cursor.moveNext(), true); + resultList.add(cursor.current); + await cursor.close(); + + // ignore: inference_failure_on_collection_literal + expect(resultList, [{}, {}]); + await db.close(); + scenario.end(); + }); + }); + } +} \ No newline at end of file diff --git a/ohos/test_sqflite_common/lib/src/sqflite_transaction_test.dart b/ohos/test_sqflite_common/lib/src/sqflite_transaction_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..6b095b1380f461d8c252958d61d0f8571247335a --- /dev/null +++ b/ohos/test_sqflite_common/lib/src/sqflite_transaction_test.dart @@ -0,0 +1,113 @@ +import 'package:sqflite_common/sqlite_api.dart'; +import 'package:sqflite_common/src/exception.dart'; +import 'package:flutter/material.dart'; +import 'package:test_sqflite_common/base/test_page.dart'; + +import 'test_scenario.dart'; + +class SqfliteTransactionTestPage extends TestPage { + SqfliteTransactionTestPage(String title,{ Key? key}) : super(title: title, key: key) { + group('transaction', () { + final transactionBeginStep = [ + 'execute', + { + 'sql': 'BEGIN IMMEDIATE', + 'id': 1, + 'inTransaction': true, + 'transactionId': null + }, + null, + ]; + final transactionBeginFailureStep = [ + 'execute', + { + 'sql': 'BEGIN IMMEDIATE', + 'id': 1, + 'inTransaction': true, + 'transactionId': null + }, + SqfliteDatabaseException('failure', null), + ]; + final transactionEndStep = [ + 'execute', + {'sql': 'COMMIT', 'id': 1, 'inTransaction': false}, + 1 + ]; + test('DatabaseFactory.openDatabase', () async { + final scenario = startScenario([ + protocolOpenStep, + transactionBeginStep, + transactionEndStep, + transactionBeginStep, + transactionEndStep, + protocolCloseStep, + ]); + final factory = scenario.factory; + final db = await factory.openDatabase(inMemoryDatabasePath); + + await db.transaction((txn) async {}); + await db.transaction((txn) async {}); + await db.close(); + scenario.end(); + }); + test('检查Database.transaction', () async { + final scenario = startScenario([ + protocolOpenStep, + transactionBeginFailureStep, + transactionBeginStep, + transactionEndStep, + protocolCloseStep, + ]); + final factory = scenario.factory; + final db = await factory.openDatabase(inMemoryDatabasePath); + + try { + await db.transaction((txn) async {}); + fail('should fail'); + } on DatabaseException catch (_) {} + await db.transaction((txn) async {}); + await db.close(); + scenario.end(); + }); + test('打开过程中开始出错', () async { + final scenario = startScenario([ + protocolOpenStep, + [ + 'query', + {'sql': 'PRAGMA user_version', 'id': 1}, + // ignore: inference_failure_on_collection_literal + {}, + ], + [ + 'execute', + { + 'sql': 'BEGIN EXCLUSIVE', + 'id': 1, + 'inTransaction': true, + 'transactionId': null + }, + SqfliteDatabaseException('failure', null), + ], + [ + 'execute', + { + 'sql': 'ROLLBACK', + 'id': 1, + 'transactionId': -1, + 'inTransaction': false + }, + null, + ], + protocolCloseStep, + ]); + final factory = scenario.factory; + try { + await factory.openDatabase(inMemoryDatabasePath, + options: + OpenDatabaseOptions(version: 1, onCreate: (db, version) {})); + } on DatabaseException catch (_) {} + scenario.end(); + }); + }); +} +} \ No newline at end of file diff --git a/ohos/test_sqflite_common/lib/src/sql_builder_test.dart b/ohos/test_sqflite_common/lib/src/sql_builder_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..d541c43508bbc0e619cb20903e04518bc4173696 --- /dev/null +++ b/ohos/test_sqflite_common/lib/src/sql_builder_test.dart @@ -0,0 +1,201 @@ +//import 'package:test/test.dart'; +import 'package:sqflite_common/src/sql_builder.dart'; +import 'package:flutter/material.dart'; +import 'package:test_sqflite_common/base/test_page.dart'; + +class SqlBuilderTestPage extends TestPage { + SqlBuilderTestPage(String title,{ Key? key}) : super(title: title, key: key) { + group('SqlBuilder', () { + test('delete', () { + var builder = + SqlBuilder.delete('test', where: 'value = ?', whereArgs: [1]); + expect(builder.sql, 'DELETE FROM test WHERE value = ?'); + expect(builder.arguments, [1]); + + builder = SqlBuilder.delete('test'); + expect(builder.sql, 'DELETE FROM test'); + expect(builder.arguments, null); + + // escape + builder = SqlBuilder.delete('table'); + expect(builder.sql, 'DELETE FROM "table"'); + expect(builder.arguments, null); + }); + + test('query', () { + var builder = SqlBuilder.query('test'); + expect(builder.sql, 'SELECT * FROM test'); + expect(builder.arguments, null); + + builder = SqlBuilder.query('test', columns: ['COUNT(*)']); + expect(builder.sql, 'SELECT COUNT(*) FROM test'); + expect(builder.arguments, null); + + builder = SqlBuilder.query('test', + distinct: true, + columns: ['value'], + where: 'value = ?', + whereArgs: [1], + groupBy: 'group_value', + having: 'value > 0', + orderBy: 'other_value', + limit: 2, + offset: 3); + expect(builder.sql, + 'SELECT DISTINCT value FROM test WHERE value = ? GROUP BY group_value HAVING value > 0 ORDER BY other_value LIMIT 2 OFFSET 3'); + expect(builder.arguments, [1]); + + // no offset + builder = SqlBuilder.query('test', limit: 99); + expect(builder.sql, 'SELECT * FROM test LIMIT 99'); + expect(builder.arguments, null); + + // no limit + builder = SqlBuilder.query('test', offset: 99); + expect(builder.sql, 'SELECT * FROM test LIMIT -1 OFFSET 99'); + expect(builder.arguments, null); + }); + + test('insert', () { + try { + SqlBuilder.insert('test', {}); + fail('should fail, no nullColumnHack'); + } on ArgumentError catch (_) {} + + var builder = SqlBuilder.insert('test', {}, + nullColumnHack: 'value'); + expect(builder.sql, 'INSERT INTO test (value) VALUES (NULL)'); + expect(builder.arguments, null); + + builder = SqlBuilder.insert('test', {'value': 1}); + expect(builder.sql, 'INSERT INTO test (value) VALUES (?)'); + expect(builder.arguments, [1]); + + builder = SqlBuilder.insert( + 'test', {'value': 1, 'other_value': null}); + expect(builder.sql, + 'INSERT INTO test (value, other_value) VALUES (?, NULL)'); + expect(builder.arguments, [1]); + + builder = SqlBuilder.insert('test', {'value': 1}, + conflictAlgorithm: ConflictAlgorithm.ignore); + expect(builder.sql, 'INSERT OR IGNORE INTO test (value) VALUES (?)'); + expect(builder.arguments, [1]); + + // no escape yet + builder = SqlBuilder.insert('test', {'value:': 1}); + expect(builder.sql, 'INSERT INTO test (value:) VALUES (?)'); + expect(builder.arguments, [1]); + + // escape + builder = SqlBuilder.insert('table', {'table': 1}); + expect(builder.sql, 'INSERT INTO "table" ("table") VALUES (?)'); + expect(builder.arguments, [1]); + }); + + test('update', () { + try { + SqlBuilder.update('test', {}); + fail('should fail, no values'); + } on ArgumentError catch (_) {} + + var builder = SqlBuilder.update('test', {'value': 1}); + expect(builder.sql, 'UPDATE test SET value = ?'); + expect(builder.arguments, [1]); + + builder = SqlBuilder.update( + 'test', {'value': 1, 'other_value': null}); + expect(builder.sql, 'UPDATE test SET value = ?, other_value = NULL'); + expect(builder.arguments, [1]); + + // testing where + builder = SqlBuilder.update('test', {'value': 1}, + where: 'a = ? AND b = ?', whereArgs: ['some_test', 1]); + expect(builder.arguments, [1, 'some_test', 1]); + + // no escape yet + builder = SqlBuilder.update('test:', {'value:': 1}); + expect(builder.sql, 'UPDATE test: SET value: = ?'); + expect(builder.arguments, [1]); + + // escape + builder = SqlBuilder.update('test:', {'table': 1}); + expect(builder.sql, 'UPDATE test: SET "table" = ?'); + expect(builder.arguments, [1]); + }); + + test('query', () { + var builder = SqlBuilder.query('table', orderBy: 'value'); + expect(builder.sql, 'SELECT * FROM "table" ORDER BY value'); + expect(builder.arguments, null); + + builder = + SqlBuilder.query('table', orderBy: 'column_1 ASC, column_2 DESC'); + expect(builder.sql, + 'SELECT * FROM "table" ORDER BY column_1 ASC, column_2 DESC'); + expect(builder.arguments, null); + + // testing where + builder = SqlBuilder.query('test', + where: 'a = ? AND b = ?', whereArgs: ['some_test', 1]); + expect(builder.arguments, ['some_test', 1]); + }); + + test('isEscapedName', () { + //expect(isEscapedName(null), false); + expect(isEscapedName('group'), false); + expect(isEscapedName("'group'"), false); + expect(isEscapedName('"group"'), true); + expect(isEscapedName('`group`'), true); + expect(isEscapedName("`group'"), false); + expect(isEscapedName('"group"'), true); + }); + + test('escapeName', () { + // expect(escapeName(null!), null); + expect(escapeName('group'), '"group"'); + expect(escapeName('dummy'), 'dummy'); + expect(escapeName('"dummy"'), '"dummy"'); + expect(escapeName('semicolumn:'), 'semicolumn:'); // for now no escape + expect( + escapeName( + 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789'), + 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789'); + + for (var name in escapeNames) { + expect(escapeName(name), '"$name"'); + } + }); + + test('escapeEntityName', () { + // expect(escapeEntityName(null!), null); + expect(escapeEntityName('group'), '"group"'); + expect(escapeEntityName('dummy'), 'dummy'); + expect(escapeEntityName('"dummy"'), '""dummy""'); + expect(escapeEntityName('semicolumn:'), '"semicolumn:"'); + expect( + escapeEntityName( + 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789'), + 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789'); + + for (var name in escapeNames) { + expect(escapeEntityName(name), '"$name"'); + } + }); + + test('unescapeName', () { + // expect(unescapeName(null!), null); + + expect(unescapeName('dummy'), 'dummy'); + expect(unescapeName("'dummy'"), "'dummy'"); + expect(unescapeName("'group'"), "'group'"); + expect(unescapeName('"group"'), 'group'); + expect(unescapeName('`group`'), 'group'); + + for (var name in escapeNames) { + expect(unescapeName('"$name"'), name); + } + }); + }); +} +} \ No newline at end of file diff --git a/ohos/test_sqflite_common/lib/src/sql_test.dart b/ohos/test_sqflite_common/lib/src/sql_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..2d6678a99f76e436d20db99e7e35b1a368da4f29 --- /dev/null +++ b/ohos/test_sqflite_common/lib/src/sql_test.dart @@ -0,0 +1,21 @@ +import 'package:sqflite_common/sql.dart'; +import 'package:flutter/material.dart'; +import 'package:test_sqflite_common/base/test_page.dart'; + +class SqlTestPage extends TestPage { + SqlTestPage(String title,{ Key? key}) : super(title: title, key: key) { + group('sqflite', () { + test('ConflictAlgorithm 枚举调用是否正常', () { + expect(ConflictAlgorithm.abort, null); + }); + + test('escapeName', () { + expect(escapeName('group'), '"group"'); + }); + + test('unescapeName', () { + expect(unescapeName('"group"'), 'group'); + }); + }); +} +} \ No newline at end of file diff --git a/ohos/test_sqflite_common/lib/src/sqlite_api_test.dart b/ohos/test_sqflite_common/lib/src/sqlite_api_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..35a52dc9c1887116523d13401dcab2db1ab35b98 --- /dev/null +++ b/ohos/test_sqflite_common/lib/src/sqlite_api_test.dart @@ -0,0 +1,32 @@ +import 'package:sqflite_common/sqlite_api.dart'; +import 'package:flutter/material.dart'; +import 'package:test_sqflite_common/base/test_page.dart'; + +class SqliteApiTestPage extends TestPage { + SqliteApiTestPage(String title,{ Key? key}) : super(title: title, key: key) { + group('sqlite_api', () { + // Check that public api are exported + test('接口暴露检查', () { + for (var value in [ + OpenDatabaseOptions, + DatabaseFactory, + Database, + Transaction, + Batch, + ConflictAlgorithm, + inMemoryDatabasePath, + OnDatabaseConfigureFn, + OnDatabaseCreateFn, + OnDatabaseOpenFn, + OnDatabaseVersionChangeFn, + onDatabaseDowngradeDelete, + sqfliteLogLevelNone, + sqfliteLogLevelSql, + sqfliteLogLevelVerbose, + ]) { + expect(value, null); + } + }); + }); +} +} \ No newline at end of file diff --git a/ohos/test_sqflite_common/lib/src/src_mixin_factory_test.dart b/ohos/test_sqflite_common/lib/src/src_mixin_factory_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..9984154c8be32c5afe4382c406beb9600799a95b --- /dev/null +++ b/ohos/test_sqflite_common/lib/src/src_mixin_factory_test.dart @@ -0,0 +1,36 @@ +import 'package:sqflite_common/sqlite_api.dart'; +import 'package:sqflite_common/src/constant.dart'; +import 'package:sqflite_common/src/factory_mixin.dart'; +import 'package:sqflite_common/src/mixin/factory.dart'; +import 'package:flutter/material.dart'; +import 'package:test_sqflite_common/base/test_page.dart'; + +import 'src_mixin_test.dart'; + +class SrcMixinFactoryTestPage extends TestPage { +SrcMixinFactoryTestPage(String title,{ Key? key}) : super(title: title, key: key) { + group('mixin_factory', () { + test('buildDatabaseFactory', () { + // ignore: unnecessary_statements + buildDatabaseFactory; + // ignore: unnecessary_statements + SqfliteInvokeHandler; + }); + test('buildDatabaseFactory', () async { + final methods = []; + final factory = buildDatabaseFactory( + tag: 'mock', + invokeMethod: (String method, [Object? arguments]) async { + final dynamic result = mockResult(method, arguments); + methods.add(method); + return result; + }); + expect((factory as SqfliteDatabaseFactoryMixin).tag, 'mock'); + // ignore: unnecessary_type_check + expect(factory is SqfliteInvokeHandler, true); + await factory.openDatabase(inMemoryDatabasePath); + expect(methods, ['openDatabase']); + }); + }); +} +} \ No newline at end of file diff --git a/ohos/test_sqflite_common/lib/src/src_mixin_test.dart b/ohos/test_sqflite_common/lib/src/src_mixin_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..68952584eb73daab4a5dc3c9293504506e1a207b --- /dev/null +++ b/ohos/test_sqflite_common/lib/src/src_mixin_test.dart @@ -0,0 +1,803 @@ +import 'dart:async'; + +import 'package:path/path.dart'; +import 'package:sqflite_common/sqlite_api.dart'; +import 'package:sqflite_common/src/constant.dart'; +import 'package:sqflite_common/src/database.dart'; +import 'package:sqflite_common/src/mixin.dart'; +import 'package:sqflite_common/src/mixin/dev_utils.dart'; // ignore: unused_import +import 'package:sqflite_common/src/open_options.dart'; +import 'package:sqflite_common/utils/utils.dart'; +import 'package:flutter/material.dart'; +import 'package:test_sqflite_common/base/test_page.dart'; + +var _mockDatabasesPath = '.'; + +/// Mock the result based on the method used +Object? mockResult(String method, Object? arguments) { + Object? handleSqlMethod(String sqlMethod) { + switch (sqlMethod) { + case methodOpenDatabase: + return 1; + case methodInsert: + return 0; + case methodUpdate: + return 0; + case methodExecute: + return null; + case methodQuery: + return {}; + } + throw UnimplementedError('$method $sqlMethod $arguments'); + } + + // devPrint('$method'); + switch (method) { + case methodGetDatabasesPath: + return _mockDatabasesPath; + case methodOpenDatabase: + return 1; + case methodCloseDatabase: + return null; + case methodDeleteDatabase: + return null; + case methodDatabaseExists: + return true; + case methodInsert: + case methodUpdate: + case methodExecute: + case methodQuery: + return handleSqlMethod(method); + case methodBatch: + var operations = (arguments as Map)[paramOperations] as List; + var results = []; + for (var operation in operations) { + var sqlMethod = (operation as Map)[paramMethod] as String; + results.add(handleSqlMethod(sqlMethod)); + } + return results; + } + throw UnimplementedError('$method $arguments'); +} + +class MockDatabase extends SqfliteDatabaseBase { + MockDatabase(SqfliteDatabaseOpenHelper openHelper, [String name = 'mock']) + : super(openHelper, name); + + int? version; + List methods = []; + List sqls = []; + List?> argumentsLists = ?>[]; + + @override + Future invokeMethod(String method, [Object? arguments]) async { + // return super.invokeMethod(method, arguments); + + methods.add(method); + if (arguments is Map) { + argumentsLists.add(arguments.cast()); + if (arguments[paramOperations] != null) { + final operations = + arguments[paramOperations] as List>; + for (var operation in operations) { + final sql = operation[paramSql] as String?; + sqls.add(sql); + } + } else { + final sql = arguments[paramSql] as String?; + sqls.add(sql); + + // Basic version handling + if (sql?.startsWith('PRAGMA user_version = ') == true) { + version = int.tryParse(sql!.split(' ').last); + } else if (sql == 'PRAGMA user_version') { + return >[ + {'user_version': version} + ] as T; + } + } + } else { + argumentsLists.add(null); + sqls.add(null); + } + return mockResult(method, arguments) as T; + } +} + +class MockDatabaseFactory extends SqfliteDatabaseFactoryBase { + final List methods = []; + final List argumentsList = []; + final Map databases = {}; + + @override + Future invokeMethod(String method, [Object? arguments]) async { + methods.add(method); + argumentsList.add(arguments); + return mockResult(method, arguments) as T; + } + + SqfliteDatabase newEmptyDatabase() { + final path = 'empty'; + final helper = SqfliteDatabaseOpenHelper(this, path, OpenDatabaseOptions()); + final db = helper.newDatabase(path)..id = 1; + return db; + } + + @override + SqfliteDatabaseMixin newDatabase( + SqfliteDatabaseOpenHelper openHelper, String path) { + final existing = databases[path]; + final db = MockDatabase(openHelper, path); + // Copy version + db.version = existing?.version; + // Last replaces + databases[path] = db; + + return db; + } + + @override + Future getDatabasesPath() async { + return join('.dart_tool', 'sqlite', 'test', 'mock'); + } +} + +class MockDatabaseFactoryEmpty extends SqfliteDatabaseFactoryBase { + final List methods = []; + + @override + Future invokeMethod(String method, [Object? arguments]) async { + methods.add(method); + return mockResult(method, arguments) as T; + } +} + +final MockDatabaseFactory mockDatabaseFactory = MockDatabaseFactory(); + +class SrcMixinTestPage extends TestPage { + SrcMixinTestPage(String title, {Key? key}) : super(title: title, key: key) { + group('database_factory', () { + test('SqfliteDatabaseFactoryBase.getDatabasesPath', () async { + final factory = MockDatabaseFactoryEmpty(); + await factory.getDatabasesPath(); + expect(factory.methods, ['getDatabasesPath']); + }); + test('SqfliteDatabaseFactoryBase.setDatabasesPath', () async { + final factory = MockDatabaseFactoryEmpty(); + + factory.setDatabasesPathOrNull('.'); + expect(await factory.getDatabasesPath(), '.'); + + // reset + factory.setDatabasesPathOrNull(null); + expect(factory.methods, []); + + await factory.getDatabasesPath(); + expect(factory.methods, ['getDatabasesPath']); + //expect(directory, ) + }); + }); + group('database', () { + test('Database.transaction', () async { + final Database db = mockDatabaseFactory.newEmptyDatabase(); + await db.execute('test'); + await db.insert('test', {'test': 1}); + await db.update('test', {'test': 1}); + await db.delete('test'); + await db.query('test'); + + await db.transaction((Transaction txn) async { + await txn.execute('test'); + await txn.insert('test', {'test': 1}); + await txn.update('test', {'test': 1}); + await txn.delete('test'); + await txn.query('test'); + }); + + final batch = db.batch(); + batch.execute('test'); + batch.insert('test', {'test': 1}); + batch.update('test', {'test': 1}); + batch.delete('test'); + batch.query('test'); + await batch.commit(); + }); + + group('open', () { + test('openDatabase() 指明只读模式', () async { + // var db = mockDatabaseFactory.newEmptyDatabase(); + final db = await mockDatabaseFactory.openDatabase('test', + options: SqfliteOpenDatabaseOptions(readOnly: true)) + as MockDatabase; + await db.close(); + expect(db.methods, ['openDatabase', 'closeDatabase']); + expect(db.argumentsLists.first, { + 'path': absolute( + join(await mockDatabaseFactory.getDatabasesPath(), 'test')), + 'readOnly': true, + 'singleInstance': true + }); + }); + test('openDatabase() 指明不是单例', () async { + // var db = mockDatabaseFactory.newEmptyDatabase(); + final db = await mockDatabaseFactory.openDatabase( + 'single_instance.db', + options: SqfliteOpenDatabaseOptions(singleInstance: false)) + as MockDatabase; + await db.close(); + expect(db.methods, ['openDatabase', 'closeDatabase']); + expect(db.argumentsLists.first, { + 'path': absolute(join(await mockDatabaseFactory.getDatabasesPath(), + 'single_instance.db')), + 'singleInstance': false + }); + }); + + test('Database.isOpen', () async { + // var db = mockDatabaseFactory.newEmptyDatabase(); + final db = await mockDatabaseFactory.openDatabase('is_open.db', + options: SqfliteOpenDatabaseOptions(readOnly: true)) + as MockDatabase; + expect(db.isOpen, true); + final closeFuture = db.close(); + // it is not closed right away + expect(db.isOpen, true); + await closeFuture; + expect(db.isOpen, false); + }); + + test('openDatabase() 指定version', () async { + var db = await mockDatabaseFactory.openDatabase('on_reopen.db', + options: OpenDatabaseOptions( + version: 1, + )) as MockDatabase; + await db.close(); + + expect(db.sqls, [ + null, + 'PRAGMA user_version', + 'BEGIN EXCLUSIVE', + 'PRAGMA user_version', + 'PRAGMA user_version = 1', + 'COMMIT', + null + ]); + + db = await mockDatabaseFactory.openDatabase('on_reopen.db', + options: OpenDatabaseOptions( + version: 1, + )) as MockDatabase; + await db.close(); + + // Re-opening, no transaction is created + expect(db.sqls, [null, 'PRAGMA user_version', null]); + }); + }); + group('openTransaction', () { + test('openDatabase() 在创建数据库时执行onCreate', () async { + final db = await mockDatabaseFactory.openDatabase('on_create.db', + options: SqfliteOpenDatabaseOptions( + version: 1, + onCreate: (Database db, int version) async { + await db.execute('test1'); + await db.transaction((Transaction txn) async { + await txn.execute('test2'); + }); + })) as MockDatabase; + + await db.close(); + expect(db.methods, [ + 'openDatabase', + 'query', + 'execute', + 'query', + 'execute', + 'execute', + 'execute', + 'execute', + 'closeDatabase' + ]); + expect(db.sqls, [ + null, + 'PRAGMA user_version', + 'BEGIN EXCLUSIVE', + 'PRAGMA user_version', + 'test1', + 'test2', + 'PRAGMA user_version = 1', + 'COMMIT', + null + ]); + }); + + test('openDatabase() 打开数据库时优先执行onConfigure', () async { + final db = await mockDatabaseFactory.openDatabase('on_configure.db', + options: OpenDatabaseOptions( + version: 1, + onConfigure: (Database db) async { + await db.execute('test1'); + await db.transaction((Transaction txn) async { + await txn.execute('test2'); + }); + })) as MockDatabase; + + await db.close(); + expect(db.sqls, [ + null, + 'test1', + 'BEGIN IMMEDIATE', + 'test2', + 'COMMIT', + 'PRAGMA user_version', + 'BEGIN EXCLUSIVE', + 'PRAGMA user_version', + 'PRAGMA user_version = 1', + 'COMMIT', + null + ]); + }); + + test('openDatabase() 设置数据库版本后执行onOpen', () async { + final db = await mockDatabaseFactory.openDatabase('on_open', + options: OpenDatabaseOptions( + version: 1, + onOpen: (Database db) async { + await db.execute('test1'); + await db.transaction((Transaction txn) async { + await txn.execute('test2'); + }); + })) as MockDatabase; + + await db.close(); + expect(db.sqls, [ + null, + 'PRAGMA user_version', + 'BEGIN EXCLUSIVE', + 'PRAGMA user_version', + 'PRAGMA user_version = 1', + 'COMMIT', + 'test1', + 'BEGIN IMMEDIATE', + 'test2', + 'COMMIT', + null + ]); + }); + + test('Database.batch', () async { + final db = await mockDatabaseFactory.openDatabase('test', + options: OpenDatabaseOptions( + version: 1, + onConfigure: (Database db) async { + final batch = db.batch(); + batch.execute('test1'); + await batch.commit(); + }, + onCreate: (db, _) async { + final batch = db.batch(); + batch.execute('test2'); + await batch.commit(noResult: true); + }, + onOpen: (Database db) async { + final batch = db.batch(); + batch.execute('test3'); + await batch.commit(continueOnError: true); + })) as MockDatabase; + + await db.close(); + expect(db.sqls, [ + null, + 'BEGIN IMMEDIATE', + 'test1', + 'COMMIT', + 'PRAGMA user_version', + 'BEGIN EXCLUSIVE', + 'PRAGMA user_version', + 'test2', + 'PRAGMA user_version = 1', + 'COMMIT', + 'BEGIN IMMEDIATE', + 'test3', + 'COMMIT', + null + ]); + expect(db.argumentsLists, [ + { + 'path': absolute( + join(await mockDatabaseFactory.getDatabasesPath(), 'test')), + 'singleInstance': true + }, + { + 'sql': 'BEGIN IMMEDIATE', + 'id': 1, + 'inTransaction': true, + 'transactionId': null + }, + { + 'operations': [ + { + 'method': 'execute', + 'sql': 'test1', + } + ], + 'id': 1 + }, + {'sql': 'COMMIT', 'id': 1, 'inTransaction': false}, + {'sql': 'PRAGMA user_version', 'id': 1}, + { + 'sql': 'BEGIN EXCLUSIVE', + 'inTransaction': true, + 'id': 1, + 'transactionId': null + }, + {'sql': 'PRAGMA user_version', 'id': 1}, + { + 'operations': >[ + { + 'method': 'execute', + 'sql': 'test2', + } + ], + 'id': 1, + 'noResult': true + }, + {'sql': 'PRAGMA user_version = 1', 'id': 1}, + {'sql': 'COMMIT', 'id': 1, 'inTransaction': false}, + { + 'sql': 'BEGIN IMMEDIATE', + 'id': 1, + 'inTransaction': true, + 'transactionId': null, + }, + { + 'operations': >[ + { + 'method': 'execute', + 'sql': 'test3', + } + ], + 'id': 1, + 'continueOnError': true + }, + {'sql': 'COMMIT', 'id': 1, 'inTransaction': false}, + {'id': 1} + ]); + }); + }); + + group('并发测试', () { + test('concurrent 1', () async { + final db = mockDatabaseFactory.newEmptyDatabase() as MockDatabase; + final step1 = Completer(); + final step2 = Completer(); + final step3 = Completer(); + + Future action1() async { + await db.execute('test'); + step1.complete(); + + await step2.future; + try { + await db + .execute('test') + .timeout(const Duration(milliseconds: 100)); + throw 'should fail'; + } catch (e) { + expect(e is TimeoutException, true); + } + + step3.complete(); + } + + Future action2() async { + // This is the change with concurrency 2 + await step1.future; + await db.transaction((Transaction txn) async { + // Wait for table being created; + await txn.execute('test'); + step2.complete(); + + await step3.future; + + await txn.execute('test'); + }); + } + + final Future future1 = action1(); + final Future future2 = action2(); + + await Future.wait(>[future1, future2]); + // check ready + await db.transaction(((_) async {})); + }); + + test('concurrent 2', () async { + final db = mockDatabaseFactory.newEmptyDatabase() as MockDatabase; + final step1 = Completer(); + final step2 = Completer(); + final step3 = Completer(); + + Future action1() async { + await db.execute('test'); + step1.complete(); + + await step2.future; + try { + await db + .execute('test') + .timeout(const Duration(milliseconds: 100)); + throw 'should fail'; + } catch (e) { + expect(e is TimeoutException, true); + } + + step3.complete(); + } + + Future action2() async { + await db.transaction((Transaction txn) async { + await step1.future; + // Wait for table being created; + await txn.execute('test'); + step2.complete(); + + await step3.future; + + await txn.execute('test'); + }); + } + + final Future future1 = action1(); + final Future future2 = action2(); + + await Future.wait(>[future1, future2]); + }); + }); + + group('compatibility 1', () { + test('concurrent 1', () async { + final db = mockDatabaseFactory.newEmptyDatabase() as MockDatabase; + final step1 = Completer(); + final step2 = Completer(); + final step3 = Completer(); + + Future action1() async { + await db.execute('test'); + step1.complete(); + + await step2.future; + try { + await db + .execute('test') + .timeout(const Duration(milliseconds: 100)); + throw 'should fail'; + } catch (e) { + expect(e is TimeoutException, true); + } + + step3.complete(); + } + + Future action2() async { + // This is the change with concurrency 2 + await step1.future; + await db.transaction((Transaction txn) async { + // Wait for table being created; + await txn.execute('test'); + step2.complete(); + + await step3.future; + + await txn.execute('test'); + }); + } + + final Future future1 = action1(); + final Future future2 = action2(); + + await Future.wait(>[future1, future2]); + // check ready + await db.transaction(((_) async {})); + }); + + test('concurrent 2', () async { + final db = mockDatabaseFactory.newEmptyDatabase() as MockDatabase; + final step1 = Completer(); + final step2 = Completer(); + final step3 = Completer(); + + Future action1() async { + await step1.future; + try { + await db + .execute('test') + .timeout(const Duration(milliseconds: 100)); + throw 'should fail'; + } catch (e) { + expect(e is TimeoutException, true); + } + + await step2.future; + try { + await db + .execute('test') + .timeout(const Duration(milliseconds: 100)); + throw 'should fail'; + } catch (e) { + expect(e is TimeoutException, true); + } + + step3.complete(); + } + + Future action2() async { + await db.transaction((Transaction txn) async { + step1.complete(); + + // Wait for table being created; + await txn.execute('test'); + step2.complete(); + + await step3.future; + + await txn.execute('test'); + }); + } + + final Future future2 = action2(); + final Future future1 = action1(); + + await Future.wait(>[future1, future2]); + // check ready + await db.transaction(((_) async {})); + }); + }); + + group('batch', () { + test('simple', () async { + final db = await mockDatabaseFactory.openDatabase('batch_simple.db') + as MockDatabase; + + final batch = db.batch(); + batch.execute('test'); + await batch.commit(); + await batch.commit(); + await db.close(); + expect(db.methods, [ + 'openDatabase', + 'execute', + 'batch', + 'execute', + 'execute', + 'batch', + 'execute', + 'closeDatabase' + ]); + expect(db.sqls, [ + null, + 'BEGIN IMMEDIATE', + 'test', + 'COMMIT', + 'BEGIN IMMEDIATE', + 'test', + 'COMMIT', + null + ]); + }); + + test('Database.transaction', () async { + final db = await mockDatabaseFactory + .openDatabase('batch_in_transaction.db') as MockDatabase; + + await db.transaction((Transaction txn) async { + final batch = txn.batch(); + batch.execute('test'); + + await batch.commit(); + await batch.commit(); + }); + await db.close(); + expect(db.methods, [ + 'openDatabase', + 'execute', + 'batch', + 'batch', + 'execute', + 'closeDatabase' + ]); + expect(db.sqls, [ + null, + 'BEGIN IMMEDIATE', + 'test', + 'test', + 'COMMIT', + null + ]); + }); + }); + + group('单例数据库测试', () { + test('singleInstance==true', () async { + final futureDb1 = mockDatabaseFactory.openDatabase('test', + options: OpenDatabaseOptions(singleInstance: true)); + final db2 = await mockDatabaseFactory.openDatabase('test', + options: OpenDatabaseOptions(singleInstance: true)) + as MockDatabase; + final db1 = await futureDb1 as MockDatabase; + expect(db1, db2); + }); + test('singleInstance', () async { + final futureDb1 = mockDatabaseFactory.openDatabase('test', + options: OpenDatabaseOptions(singleInstance: true)); + final db2 = await mockDatabaseFactory.openDatabase('test', + options: OpenDatabaseOptions(singleInstance: true)) + as MockDatabase; + final db1 = await futureDb1 as MockDatabase; + final db3 = await mockDatabaseFactory.openDatabase('other', + options: OpenDatabaseOptions(singleInstance: true)) + as MockDatabase; + final db4 = await mockDatabaseFactory.openDatabase(join('.', 'other'), + options: OpenDatabaseOptions(singleInstance: true)) + as MockDatabase; + //expect(db1, db2); + expect(db1, db3); + expect(db3, db4); + await db1.close(); + await db2.close(); + await db3.close(); + }); + + test('multiInstances', () async { + final futureDb1 = mockDatabaseFactory.openDatabase( + 'multi_instances.db', + options: OpenDatabaseOptions(singleInstance: false)); + final db2 = await mockDatabaseFactory.openDatabase( + 'multi_instances.db', + options: OpenDatabaseOptions(singleInstance: false)) + as MockDatabase; + final db1 = await futureDb1 as MockDatabase; + expect(db1, db2); + await db1.close(); + await db2.close(); + }); + }); + + test('setLockWarningInfo', () async { + final db = mockDatabaseFactory.newEmptyDatabase() as MockDatabase; + var hasTimedOut = false; + var callbackCount = 0; + setLockWarningInfo( + duration: const Duration(milliseconds: 200), + callback: () { + callbackCount++; + }); + try { + await db.transaction((Transaction txn) async { + await db.execute('test'); + fail('should fail'); + }).timeout(const Duration(milliseconds: 500)); + } on TimeoutException catch (_) { + hasTimedOut = true; + } + expect(hasTimedOut, true); + expect(callbackCount, 1); + await db.close(); + }); + + test('deleteDatabase databaseExists', () async { + const path = 'test_exists.db'; + await mockDatabaseFactory.deleteDatabase(path); + final exists = await mockDatabaseFactory.databaseExists(path); + expect(exists, true); + final expectedPath = + absolute(join(await mockDatabaseFactory.getDatabasesPath(), path)); + expect(mockDatabaseFactory.methods, + ['deleteDatabase', 'databaseExists']); + expect(mockDatabaseFactory.argumentsList, >[ + {'path': expectedPath}, + {'path': expectedPath} + ]); + }); + }); + } +} diff --git a/ohos/test_sqflite_common/lib/src/test_scenario.dart b/ohos/test_sqflite_common/lib/src/test_scenario.dart new file mode 100644 index 0000000000000000000000000000000000000000..16a6dc10f6c215b38bf5793891306dabf38f888f --- /dev/null +++ b/ohos/test_sqflite_common/lib/src/test_scenario.dart @@ -0,0 +1,74 @@ +import 'package:sqflite_common/sqlite_api.dart'; +import 'package:sqflite_common/src/mixin/import_mixin.dart'; +import 'package:flutter/material.dart'; +import 'package:test_sqflite_common/base/test_page.dart'; + +/// Common open step +var protocolOpenStep = [ + 'openDatabase', + {'path': ':memory:', 'singleInstance': false}, + {'id': 1} +]; + +/// Common close step +var protocolCloseStep = [ + 'closeDatabase', + {'id': 1}, + null +]; + +class MockMethodCall { + String? expectedMethod; + dynamic expectedArguments; + + /// Response can be an exception + dynamic response; + + @override + String toString() => '$expectedMethod $expectedArguments $response'; +} + +class MockScenario { + MockScenario(this.factory, List data) { + methodsCalls = data + .map((list) => MockMethodCall() + ..expectedMethod = list[0]?.toString() + ..expectedArguments = list[1] + ..response = list[2]) + .toList(growable: false); + } + + final DatabaseFactory factory; + late List methodsCalls; + var index = 0; + dynamic exception; + + void end() { + expect(exception, null); + expect(index, methodsCalls.length); + } +} + +MockScenario startScenario(List data) { + late MockScenario scenario; + final databaseFactoryMock = buildDatabaseFactory( + tag: 'mock', + invokeMethod: (String method, [Object? arguments]) async { + final index = scenario.index++; + // devPrint('$index ${scenario.methodsCalls[index]}'); + final item = scenario.methodsCalls[index]; + try { + expect(method, item.expectedMethod); + expect(arguments, item.expectedArguments); + } catch (e) { + // devPrint(e); + scenario.exception ??= '$e $index'; + } + if (item.response is DatabaseException) { + throw item.response as DatabaseException; + } + return item.response; + }); + scenario = MockScenario(databaseFactoryMock, data); + return scenario; +} diff --git a/ohos/test_sqflite_common/lib/src/utils_test.dart b/ohos/test_sqflite_common/lib/src/utils_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..f0750340ba6f42b8c59f0844f990a3b751360323 --- /dev/null +++ b/ohos/test_sqflite_common/lib/src/utils_test.dart @@ -0,0 +1,76 @@ +import 'package:sqflite_common/src/utils.dart'; +import 'package:sqflite_common/utils/utils.dart'; +import 'package:flutter/material.dart'; +import 'package:test_sqflite_common/base/test_page.dart'; +import 'package:test_sqflite_common/base/test_page.dart'; + +class UtilsTestPage extends TestPage { + UtilsTestPage(String title,{ Key? key}) : super(title: title, key: key) { + group('sqflite', () { + test('firstIntValue', () { + expect( + firstIntValue(>[ + {'test': 1} + ]), + 1); + expect( + firstIntValue(>[ + {'test': 1}, + {'test': 1} + ]), + 1); + expect( + firstIntValue(>[ + {'test': null} + ]), + null); + expect(firstIntValue(>[{}]), null); + expect(firstIntValue(>[]), null); + expect(firstIntValue(>[{}]), null); + }); + + test('hex', () { + expect(hex([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 255]), '000102030405060708090A0B0C0D0E0F1011FF'); + expect(hex([]), ''); + expect(hex([32]), '20'); + + try { + hex([-1]); + fail('should fail'); + } on FormatException catch (_) {} + + try { + hex([256]); + fail('should fail'); + } on FormatException catch (_) {} + }); + + test('listChunk', () { + expect(listChunk([], null), null); + expect(listChunk([1], null), [ + [1] + ]); + expect(listChunk([1], 0), [ + [1] + ]); + expect(listChunk([1, 2], 0), [ + [1, 2] + ]); + expect(listChunk([1, 2], 2), [ + [1, 2] + ]); + expect(listChunk([1, 2], 3), [ + [1, 2] + ]); + expect(listChunk([1, 2], 1), [ + [1], + [2] + ]); + expect(listChunk([1, 2, 3], 2), [ + [1, 2], + [3] + ]); + }); + }); + } +} diff --git a/ohos/test_sqflite_common/ohos/.gitignore b/ohos/test_sqflite_common/ohos/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..fbabf771011fe78f9919db0b1195ab6cadffc2b0 --- /dev/null +++ b/ohos/test_sqflite_common/ohos/.gitignore @@ -0,0 +1,11 @@ +/node_modules +/oh_modules +/local.properties +/.idea +**/build +/.hvigor +.cxx +/.clangd +/.clang-format +/.clang-tidy +**/.test \ No newline at end of file diff --git a/ohos/test_sqflite_common/ohos/AppScope/app.json5 b/ohos/test_sqflite_common/ohos/AppScope/app.json5 new file mode 100644 index 0000000000000000000000000000000000000000..eb963ef2983ae14605ca911ff046d0e96f501211 --- /dev/null +++ b/ohos/test_sqflite_common/ohos/AppScope/app.json5 @@ -0,0 +1,10 @@ +{ + "app": { + "bundleName": "com.example.test_sqflite_common", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name" + } +} diff --git a/ohos/test_sqflite_common/ohos/AppScope/resources/base/element/string.json b/ohos/test_sqflite_common/ohos/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..149c0f26e0cfce5e7efe2d381a5717bcc8276234 --- /dev/null +++ b/ohos/test_sqflite_common/ohos/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "test_sqflite_common" + } + ] +} diff --git a/ohos/test_sqflite_common/ohos/AppScope/resources/base/media/app_icon.png b/ohos/test_sqflite_common/ohos/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ohos/test_sqflite_common/ohos/AppScope/resources/base/media/app_icon.png differ diff --git a/ohos/test_sqflite_common/ohos/build-profile.json5 b/ohos/test_sqflite_common/ohos/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..238b2d5bbf8b3a0c28dae746eaf5220737a944fe --- /dev/null +++ b/ohos/test_sqflite_common/ohos/build-profile.json5 @@ -0,0 +1,42 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +{ + "app": { + "signingConfigs": [], + "compileSdkVersion": 10, + "compatibleSdkVersion": 10, + "products": [ + { + "name": "default", + "signingConfig": "default", + } + ] + }, + "modules": [ + { + "name": "entry", + "srcPath": "./entry", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/ohos/test_sqflite_common/ohos/dta/icudtl.dat b/ohos/test_sqflite_common/ohos/dta/icudtl.dat new file mode 100644 index 0000000000000000000000000000000000000000..d1f10917ab52e3ebd251abd7f5377d7196b80d67 Binary files /dev/null and b/ohos/test_sqflite_common/ohos/dta/icudtl.dat differ diff --git a/ohos/test_sqflite_common/ohos/entry/.gitignore b/ohos/test_sqflite_common/ohos/entry/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..2795a1c5b1fe53659dd1b71d90ba0592eaf7e043 --- /dev/null +++ b/ohos/test_sqflite_common/ohos/entry/.gitignore @@ -0,0 +1,7 @@ + +/node_modules +/oh_modules +/.preview +/build +/.cxx +/.test \ No newline at end of file diff --git a/ohos/test_sqflite_common/ohos/entry/build-profile.json5 b/ohos/test_sqflite_common/ohos/entry/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..f02a52e08c8fa1c3a33b9faa4592e9f695cd1c54 --- /dev/null +++ b/ohos/test_sqflite_common/ohos/entry/build-profile.json5 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +{ + "apiType": 'stageMode', + "buildOption": { + }, + "targets": [ + { + "name": "default", + "runtimeOS": "OpenHarmony" + }, + { + "name": "ohosTest", + } + ] +} \ No newline at end of file diff --git a/ohos/test_sqflite_common/ohos/entry/hvigorfile.ts b/ohos/test_sqflite_common/ohos/entry/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..894fc15c6b793f085e6c8506e43d719af658e8ff --- /dev/null +++ b/ohos/test_sqflite_common/ohos/entry/hvigorfile.ts @@ -0,0 +1,17 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently. +export { hapTasks } from '@ohos/hvigor-ohos-plugin'; diff --git a/ohos/test_sqflite_common/ohos/entry/libs/arm64-v8a/libapp.so b/ohos/test_sqflite_common/ohos/entry/libs/arm64-v8a/libapp.so new file mode 100644 index 0000000000000000000000000000000000000000..4ac373ac163bf8dc395d3b558cc956e500cd6dbe Binary files /dev/null and b/ohos/test_sqflite_common/ohos/entry/libs/arm64-v8a/libapp.so differ diff --git a/ohos/test_sqflite_common/ohos/entry/libs/arm64-v8a/libc++_shared.so b/ohos/test_sqflite_common/ohos/entry/libs/arm64-v8a/libc++_shared.so new file mode 100644 index 0000000000000000000000000000000000000000..831c9353702073d45889352a4dafb93103d67d20 Binary files /dev/null and b/ohos/test_sqflite_common/ohos/entry/libs/arm64-v8a/libc++_shared.so differ diff --git a/ohos/test_sqflite_common/ohos/entry/libs/arm64-v8a/libflutter.so b/ohos/test_sqflite_common/ohos/entry/libs/arm64-v8a/libflutter.so new file mode 100755 index 0000000000000000000000000000000000000000..488ebb753f1bf6ffadfc3329a7ef64f0265d20fd Binary files /dev/null and b/ohos/test_sqflite_common/ohos/entry/libs/arm64-v8a/libflutter.so differ diff --git a/ohos/test_sqflite_common/ohos/entry/oh-package.json5 b/ohos/test_sqflite_common/ohos/entry/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..ab756b7624a009a30db809d7d64c62d84dc7b153 --- /dev/null +++ b/ohos/test_sqflite_common/ohos/entry/oh-package.json5 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +{ + "name": "entry", + "version": "1.0.0", + "description": "Please describe the basic information.", + "main": "", + "author": "", + "license": "", + "dependencies": { + "@ohos/flutter_ohos": "file:../har/flutter_embedding.har" + } +} + diff --git a/ohos/test_sqflite_common/ohos/entry/src/main/ets/entryability/EntryAbility.ets b/ohos/test_sqflite_common/ohos/entry/src/main/ets/entryability/EntryAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..321a4eeaacd7b8079a876e25c4dafd498e4d9fb9 --- /dev/null +++ b/ohos/test_sqflite_common/ohos/entry/src/main/ets/entryability/EntryAbility.ets @@ -0,0 +1,22 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import { FlutterAbility } from '@ohos/flutter_ohos' + +export default class EntryAbility extends FlutterAbility { + onFlutterEngineReady(): void { + super.onFlutterEngineReady() + } +} diff --git a/ohos/test_sqflite_common/ohos/entry/src/main/ets/pages/Index.ets b/ohos/test_sqflite_common/ohos/entry/src/main/ets/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..d784c75ed9d16a6657bb6466a148752b1b20bd91 --- /dev/null +++ b/ohos/test_sqflite_common/ohos/entry/src/main/ets/pages/Index.ets @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import { FlutterPage } from '@ohos/flutter_ohos' + +@Entry +@Component +struct Index { + build() { + Column() { + FlutterPage() + } + } +} \ No newline at end of file diff --git a/ohos/test_sqflite_common/ohos/entry/src/main/module.json5 b/ohos/test_sqflite_common/ohos/entry/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..7bbf78b18f39991b1404061c7437538c7d532bb7 --- /dev/null +++ b/ohos/test_sqflite_common/ohos/entry/src/main/module.json5 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +{ + "module": { + "name": "entry", + "type": "entry", + "description": "$string:module_desc", + "mainElement": "EntryAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "EntryAbility", + "srcEntry": "./ets/entryability/EntryAbility.ets", + "description": "$string:EntryAbility_desc", + "icon": "$media:icon", + "label": "$string:EntryAbility_label", + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:start_window_background", + "exported": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ], + "requestPermissions": [ + {"name" : "ohos.permission.INTERNET"}, + ] + } +} \ No newline at end of file diff --git a/ohos/test_sqflite_common/ohos/entry/src/main/resources/base/element/color.json b/ohos/test_sqflite_common/ohos/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02 --- /dev/null +++ b/ohos/test_sqflite_common/ohos/entry/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/ohos/test_sqflite_common/ohos/entry/src/main/resources/base/element/string.json b/ohos/test_sqflite_common/ohos/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f94595515a99e0c828807e243494f57f09251930 --- /dev/null +++ b/ohos/test_sqflite_common/ohos/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ohos/test_sqflite_common/ohos/entry/src/main/resources/base/media/icon.png b/ohos/test_sqflite_common/ohos/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ohos/test_sqflite_common/ohos/entry/src/main/resources/base/media/icon.png differ diff --git a/ohos/test_sqflite_common/ohos/entry/src/main/resources/base/profile/main_pages.json b/ohos/test_sqflite_common/ohos/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce --- /dev/null +++ b/ohos/test_sqflite_common/ohos/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/Index" + ] +} diff --git a/ohos/test_sqflite_common/ohos/entry/src/main/resources/en_US/element/string.json b/ohos/test_sqflite_common/ohos/entry/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f94595515a99e0c828807e243494f57f09251930 --- /dev/null +++ b/ohos/test_sqflite_common/ohos/entry/src/main/resources/en_US/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ohos/test_sqflite_common/ohos/entry/src/main/resources/rawfile/flutter_assets/AssetManifest.json b/ohos/test_sqflite_common/ohos/entry/src/main/resources/rawfile/flutter_assets/AssetManifest.json new file mode 100644 index 0000000000000000000000000000000000000000..9e26dfeeb6e641a33dae4961196235bdb965b21b --- /dev/null +++ b/ohos/test_sqflite_common/ohos/entry/src/main/resources/rawfile/flutter_assets/AssetManifest.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/ohos/test_sqflite_common/ohos/entry/src/main/resources/rawfile/flutter_assets/FontManifest.json b/ohos/test_sqflite_common/ohos/entry/src/main/resources/rawfile/flutter_assets/FontManifest.json new file mode 100644 index 0000000000000000000000000000000000000000..3abf18c41c58c933308c244a875bf383856e103e --- /dev/null +++ b/ohos/test_sqflite_common/ohos/entry/src/main/resources/rawfile/flutter_assets/FontManifest.json @@ -0,0 +1 @@ +[{"family":"MaterialIcons","fonts":[{"asset":"fonts/MaterialIcons-Regular.otf"}]}] \ No newline at end of file diff --git a/ohos/test_sqflite_common/ohos/entry/src/main/resources/rawfile/flutter_assets/NOTICES.Z b/ohos/test_sqflite_common/ohos/entry/src/main/resources/rawfile/flutter_assets/NOTICES.Z new file mode 100644 index 0000000000000000000000000000000000000000..a4f19fdb5b956d2469d50bfa4f2e50d6a044e763 Binary files /dev/null and b/ohos/test_sqflite_common/ohos/entry/src/main/resources/rawfile/flutter_assets/NOTICES.Z differ diff --git a/ohos/test_sqflite_common/ohos/entry/src/main/resources/rawfile/flutter_assets/fonts/MaterialIcons-Regular.otf b/ohos/test_sqflite_common/ohos/entry/src/main/resources/rawfile/flutter_assets/fonts/MaterialIcons-Regular.otf new file mode 100644 index 0000000000000000000000000000000000000000..8c99266130a89547b4344f47e08aacad473b14e0 Binary files /dev/null and b/ohos/test_sqflite_common/ohos/entry/src/main/resources/rawfile/flutter_assets/fonts/MaterialIcons-Regular.otf differ diff --git a/ohos/test_sqflite_common/ohos/entry/src/main/resources/rawfile/flutter_assets/icudtl.dat b/ohos/test_sqflite_common/ohos/entry/src/main/resources/rawfile/flutter_assets/icudtl.dat new file mode 100644 index 0000000000000000000000000000000000000000..d1f10917ab52e3ebd251abd7f5377d7196b80d67 Binary files /dev/null and b/ohos/test_sqflite_common/ohos/entry/src/main/resources/rawfile/flutter_assets/icudtl.dat differ diff --git a/ohos/test_sqflite_common/ohos/entry/src/main/resources/rawfile/flutter_assets/shaders/ink_sparkle.frag b/ohos/test_sqflite_common/ohos/entry/src/main/resources/rawfile/flutter_assets/shaders/ink_sparkle.frag new file mode 100644 index 0000000000000000000000000000000000000000..0bb5a14a220d223adde1e69eb1959332d6bd08c7 Binary files /dev/null and b/ohos/test_sqflite_common/ohos/entry/src/main/resources/rawfile/flutter_assets/shaders/ink_sparkle.frag differ diff --git a/ohos/test_sqflite_common/ohos/entry/src/main/resources/zh_CN/element/string.json b/ohos/test_sqflite_common/ohos/entry/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..597ecf95e61d7e30367c22fe2f8638008361b044 --- /dev/null +++ b/ohos/test_sqflite_common/ohos/entry/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "模块描述" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ohos/test_sqflite_common/ohos/entry/src/ohosTest/ets/test/Ability.test.ets b/ohos/test_sqflite_common/ohos/entry/src/ohosTest/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..25d4c71ff3cd584f5d64f6f8c0ac864928c234c4 --- /dev/null +++ b/ohos/test_sqflite_common/ohos/entry/src/ohosTest/ets/test/Ability.test.ets @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import hilog from '@ohos.hilog'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' + +export default function abilityTest() { + describe('ActsAbilityTest', function () { + // Defines a test suite. Two parameters are supported: test suite name and test suite function. + beforeAll(function () { + // Presets an action, which is performed only once before all test cases of the test suite start. + // This API supports only one parameter: preset action function. + }) + beforeEach(function () { + // Presets an action, which is performed before each unit test case starts. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: preset action function. + }) + afterEach(function () { + // Presets a clear action, which is performed after each unit test case ends. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: clear action function. + }) + afterAll(function () { + // Presets a clear action, which is performed after all test cases of the test suite end. + // This API supports only one parameter: clear action function. + }) + it('assertContain',0, function () { + // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. + hilog.info(0x0000, 'testTag', '%{public}s', 'it begin'); + let a = 'abc' + let b = 'b' + // Defines a variety of assertion methods, which are used to declare expected boolean conditions. + expect(a).assertContain(b) + expect(a).assertEqual(a) + }) + }) +} \ No newline at end of file diff --git a/ohos/test_sqflite_common/ohos/entry/src/ohosTest/ets/test/List.test.ets b/ohos/test_sqflite_common/ohos/entry/src/ohosTest/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..f4140030e65d20df6af30a6bf51e464dea8f8aa6 --- /dev/null +++ b/ohos/test_sqflite_common/ohos/entry/src/ohosTest/ets/test/List.test.ets @@ -0,0 +1,20 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import abilityTest from './Ability.test' + +export default function testsuite() { + abilityTest() +} \ No newline at end of file diff --git a/ohos/test_sqflite_common/ohos/entry/src/ohosTest/ets/testability/TestAbility.ets b/ohos/test_sqflite_common/ohos/entry/src/ohosTest/ets/testability/TestAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..4ca645e6013cfce8e7dbb728313cb8840c4da660 --- /dev/null +++ b/ohos/test_sqflite_common/ohos/entry/src/ohosTest/ets/testability/TestAbility.ets @@ -0,0 +1,63 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import UIAbility from '@ohos.app.ability.UIAbility'; +import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; +import hilog from '@ohos.hilog'; +import { Hypium } from '@ohos/hypium'; +import testsuite from '../test/List.test'; +import window from '@ohos.window'; + +export default class TestAbility extends UIAbility { + onCreate(want, launchParam) { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate'); + hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); + hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? ''); + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy'); + } + + onWindowStageCreate(windowStage: window.WindowStage) { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate'); + windowStage.loadContent('testability/pages/Index', (err, data) => { + if (err.code) { + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', + JSON.stringify(data) ?? ''); + }); + } + + onWindowStageDestroy() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy'); + } + + onForeground() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground'); + } + + onBackground() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground'); + } +} \ No newline at end of file diff --git a/ohos/test_sqflite_common/ohos/entry/src/ohosTest/ets/testability/pages/Index.ets b/ohos/test_sqflite_common/ohos/entry/src/ohosTest/ets/testability/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..cef0447cd2f137ef82d223ead2e156808878ab90 --- /dev/null +++ b/ohos/test_sqflite_common/ohos/entry/src/ohosTest/ets/testability/pages/Index.ets @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import hilog from '@ohos.hilog'; + +@Entry +@Component +struct Index { + aboutToAppear() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear'); + } + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } \ No newline at end of file diff --git a/ohos/test_sqflite_common/ohos/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts b/ohos/test_sqflite_common/ohos/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..1def08f2e9dcbfa3454a07b7a3b82b173bb90d02 --- /dev/null +++ b/ohos/test_sqflite_common/ohos/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import hilog from '@ohos.hilog'; +import TestRunner from '@ohos.application.testRunner'; +import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +async function onAbilityCreateCallback() { + hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); +} + +async function addAbilityMonitorCallback(err: any) { + hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); + } + + async onRun() { + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility' + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName + var debug = abilityDelegatorArguments.parameters['-D'] + if (debug == 'true') + { + cmd += ' -D' + } + hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd); + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? ''); + hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? ''); + hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? ''); + }) + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end'); + } +} \ No newline at end of file diff --git a/ohos/test_sqflite_common/ohos/entry/src/ohosTest/module.json5 b/ohos/test_sqflite_common/ohos/entry/src/ohosTest/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..fab77ce2e0c61e3ad010bab5b27ccbd15f9a8c96 --- /dev/null +++ b/ohos/test_sqflite_common/ohos/entry/src/ohosTest/module.json5 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +{ + "module": { + "name": "entry_test", + "type": "feature", + "description": "$string:module_test_desc", + "mainElement": "TestAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:test_pages", + "abilities": [ + { + "name": "TestAbility", + "srcEntry": "./ets/testability/TestAbility.ets", + "description": "$string:TestAbility_desc", + "icon": "$media:icon", + "label": "$string:TestAbility_label", + "exported": true, + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:start_window_background", + "skills": [ + { + "actions": [ + "action.system.home" + ], + "entities": [ + "entity.system.home" + ] + } + ] + } + ] + } +} diff --git a/ohos/test_sqflite_common/ohos/entry/src/ohosTest/resources/base/element/color.json b/ohos/test_sqflite_common/ohos/entry/src/ohosTest/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02 --- /dev/null +++ b/ohos/test_sqflite_common/ohos/entry/src/ohosTest/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/ohos/test_sqflite_common/ohos/entry/src/ohosTest/resources/base/element/string.json b/ohos/test_sqflite_common/ohos/entry/src/ohosTest/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..65d8fa5a7cf54aa3943dcd0214f58d1771bc1f6c --- /dev/null +++ b/ohos/test_sqflite_common/ohos/entry/src/ohosTest/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_test_desc", + "value": "test ability description" + }, + { + "name": "TestAbility_desc", + "value": "the test ability" + }, + { + "name": "TestAbility_label", + "value": "test label" + } + ] +} \ No newline at end of file diff --git a/ohos/test_sqflite_common/ohos/entry/src/ohosTest/resources/base/media/icon.png b/ohos/test_sqflite_common/ohos/entry/src/ohosTest/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ohos/test_sqflite_common/ohos/entry/src/ohosTest/resources/base/media/icon.png differ diff --git a/ohos/test_sqflite_common/ohos/entry/src/ohosTest/resources/base/profile/test_pages.json b/ohos/test_sqflite_common/ohos/entry/src/ohosTest/resources/base/profile/test_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..b7e7343cacb32ce982a45e76daad86e435e054fe --- /dev/null +++ b/ohos/test_sqflite_common/ohos/entry/src/ohosTest/resources/base/profile/test_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "testability/pages/Index" + ] +} diff --git a/ohos/test_sqflite_common/ohos/har/flutter_embedding.har b/ohos/test_sqflite_common/ohos/har/flutter_embedding.har new file mode 100644 index 0000000000000000000000000000000000000000..df4ad91a9a830bf776221dd2983cd02fc13a9e4f Binary files /dev/null and b/ohos/test_sqflite_common/ohos/har/flutter_embedding.har differ diff --git a/ohos/test_sqflite_common/ohos/har/flutter_embedding.har.debug.10 b/ohos/test_sqflite_common/ohos/har/flutter_embedding.har.debug.10 new file mode 100644 index 0000000000000000000000000000000000000000..b75cb4e20800111a17d237ff0bc22eb8fd3d5875 Binary files /dev/null and b/ohos/test_sqflite_common/ohos/har/flutter_embedding.har.debug.10 differ diff --git a/ohos/test_sqflite_common/ohos/har/flutter_embedding.har.debug.9 b/ohos/test_sqflite_common/ohos/har/flutter_embedding.har.debug.9 new file mode 100644 index 0000000000000000000000000000000000000000..f0df4ca0064821178bf4254b16e8d23d873827da Binary files /dev/null and b/ohos/test_sqflite_common/ohos/har/flutter_embedding.har.debug.9 differ diff --git a/ohos/test_sqflite_common/ohos/har/flutter_embedding.har.release.10 b/ohos/test_sqflite_common/ohos/har/flutter_embedding.har.release.10 new file mode 100644 index 0000000000000000000000000000000000000000..df4ad91a9a830bf776221dd2983cd02fc13a9e4f Binary files /dev/null and b/ohos/test_sqflite_common/ohos/har/flutter_embedding.har.release.10 differ diff --git a/ohos/test_sqflite_common/ohos/har/flutter_embedding.har.release.9 b/ohos/test_sqflite_common/ohos/har/flutter_embedding.har.release.9 new file mode 100644 index 0000000000000000000000000000000000000000..ba52754a80826e5614438b3faf931ed2f487eaab Binary files /dev/null and b/ohos/test_sqflite_common/ohos/har/flutter_embedding.har.release.9 differ diff --git a/ohos/test_sqflite_common/ohos/hvigor/hvigor-config.json5 b/ohos/test_sqflite_common/ohos/hvigor/hvigor-config.json5 new file mode 100644 index 0000000000000000000000000000000000000000..990085f6621b0d3e876a162e42eb2bc1bf441434 --- /dev/null +++ b/ohos/test_sqflite_common/ohos/hvigor/hvigor-config.json5 @@ -0,0 +1,21 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +{ + "hvigorVersion": "2.1.1", + "dependencies": { + "@ohos/hvigor-ohos-plugin": "2.1.1" + } +} diff --git a/ohos/test_sqflite_common/ohos/hvigor/hvigor-wrapper.js b/ohos/test_sqflite_common/ohos/hvigor/hvigor-wrapper.js new file mode 100644 index 0000000000000000000000000000000000000000..994f22987bd0739b9faa07c966b066c2d9218602 --- /dev/null +++ b/ohos/test_sqflite_common/ohos/hvigor/hvigor-wrapper.js @@ -0,0 +1,2 @@ +"use strict";var e=require("fs"),t=require("path"),n=require("os"),r=require("crypto"),u=require("child_process"),o=require("constants"),i=require("stream"),s=require("util"),c=require("assert"),a=require("tty"),l=require("zlib"),f=require("net");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var D=d(e),p=d(t),E=d(n),m=d(r),h=d(u),y=d(o),C=d(i),F=d(s),g=d(c),A=d(a),v=d(l),S=d(f),w="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},O={},b={},_={},B=w&&w.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(_,"__esModule",{value:!0}),_.isMac=_.isLinux=_.isWindows=void 0;const P=B(E.default),k="Windows_NT",x="Linux",N="Darwin";_.isWindows=function(){return P.default.type()===k},_.isLinux=function(){return P.default.type()===x},_.isMac=function(){return P.default.type()===N};var I={},T=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),R=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),M=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&T(t,e,n);return R(t,e),t};Object.defineProperty(I,"__esModule",{value:!0}),I.hash=void 0;const L=M(m.default);I.hash=function(e,t="md5"){return L.createHash(t).update(e,"utf-8").digest("hex")},function(e){var t=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),n=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var u in e)"default"!==u&&Object.prototype.hasOwnProperty.call(e,u)&&t(r,e,u);return n(r,e),r};Object.defineProperty(e,"__esModule",{value:!0}),e.HVIGOR_BOOT_JS_FILE_PATH=e.HVIGOR_PROJECT_DEPENDENCY_PACKAGE_JSON_PATH=e.HVIGOR_PROJECT_DEPENDENCIES_HOME=e.HVIGOR_PROJECT_WRAPPER_HOME=e.HVIGOR_PROJECT_NAME=e.HVIGOR_PROJECT_ROOT_DIR=e.HVIGOR_PROJECT_CACHES_HOME=e.HVIGOR_PNPM_STORE_PATH=e.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH=e.HVIGOR_WRAPPER_TOOLS_HOME=e.HVIGOR_USER_HOME=e.DEFAULT_PACKAGE_JSON=e.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME=e.PNPM=e.HVIGOR=e.NPM_TOOL=e.PNPM_TOOL=e.HVIGOR_ENGINE_PACKAGE_NAME=void 0;const u=r(p.default),o=r(E.default),i=_,s=I;e.HVIGOR_ENGINE_PACKAGE_NAME="@ohos/hvigor",e.PNPM_TOOL=(0,i.isWindows)()?"pnpm.cmd":"pnpm",e.NPM_TOOL=(0,i.isWindows)()?"npm.cmd":"npm",e.HVIGOR="hvigor",e.PNPM="pnpm",e.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME="hvigor-config.json5",e.DEFAULT_PACKAGE_JSON="package.json",e.HVIGOR_USER_HOME=u.resolve(o.homedir(),".hvigor"),e.HVIGOR_WRAPPER_TOOLS_HOME=u.resolve(e.HVIGOR_USER_HOME,"wrapper","tools"),e.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH=u.resolve(e.HVIGOR_WRAPPER_TOOLS_HOME,"node_modules",".bin",e.PNPM_TOOL),e.HVIGOR_PNPM_STORE_PATH=u.resolve(e.HVIGOR_USER_HOME,"caches"),e.HVIGOR_PROJECT_CACHES_HOME=u.resolve(e.HVIGOR_USER_HOME,"project_caches"),e.HVIGOR_PROJECT_ROOT_DIR=process.cwd(),e.HVIGOR_PROJECT_NAME=u.basename((0,s.hash)(e.HVIGOR_PROJECT_ROOT_DIR)),e.HVIGOR_PROJECT_WRAPPER_HOME=u.resolve(e.HVIGOR_PROJECT_ROOT_DIR,e.HVIGOR),e.HVIGOR_PROJECT_DEPENDENCIES_HOME=u.resolve(e.HVIGOR_PROJECT_CACHES_HOME,e.HVIGOR_PROJECT_NAME,"workspace"),e.HVIGOR_PROJECT_DEPENDENCY_PACKAGE_JSON_PATH=u.resolve(e.HVIGOR_PROJECT_DEPENDENCIES_HOME,e.DEFAULT_PACKAGE_JSON),e.HVIGOR_BOOT_JS_FILE_PATH=u.resolve(e.HVIGOR_PROJECT_DEPENDENCIES_HOME,"node_modules","@ohos","hvigor","bin","hvigor.js")}(b);var j={},$={};Object.defineProperty($,"__esModule",{value:!0}),$.logInfoPrintConsole=$.logErrorAndExit=void 0,$.logErrorAndExit=function(e){e instanceof Error?console.error(e.message):console.error(e),process.exit(-1)},$.logInfoPrintConsole=function(e){console.log(e)};var H=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),J=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),G=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&H(t,e,n);return J(t,e),t},V=w&&w.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(j,"__esModule",{value:!0}),j.isFileExists=j.offlinePluginConversion=j.executeCommand=j.getNpmPath=j.hasNpmPackInPaths=void 0;const U=h.default,W=G(p.default),z=b,K=$,q=V(D.default);j.hasNpmPackInPaths=function(e,t){try{return require.resolve(e,{paths:[...t]}),!0}catch(e){return!1}},j.getNpmPath=function(){const e=process.execPath;return W.join(W.dirname(e),z.NPM_TOOL)},j.executeCommand=function(e,t,n){0!==(0,U.spawnSync)(e,t,n).status&&(0,K.logErrorAndExit)(`Error: ${e} ${t} execute failed.See above for details.`)},j.offlinePluginConversion=function(e,t){return t.startsWith("file:")||t.endsWith(".tgz")?W.resolve(e,z.HVIGOR,t.replace("file:","")):t},j.isFileExists=function(e){return q.default.existsSync(e)&&q.default.statSync(e).isFile()},function(e){var t=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),n=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var u in e)"default"!==u&&Object.prototype.hasOwnProperty.call(e,u)&&t(r,e,u);return n(r,e),r},u=w&&w.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.executeInstallPnpm=e.isPnpmAvailable=e.environmentHandler=e.checkNpmConifg=e.PNPM_VERSION=void 0;const o=r(D.default),i=b,s=j,c=r(p.default),a=$,l=h.default,f=u(E.default);e.PNPM_VERSION="7.30.0",e.checkNpmConifg=function(){const e=c.resolve(i.HVIGOR_PROJECT_ROOT_DIR,".npmrc"),t=c.resolve(f.default.homedir(),".npmrc");if((0,s.isFileExists)(e)||(0,s.isFileExists)(t))return;const n=(0,s.getNpmPath)(),r=(0,l.spawnSync)(n,["config","get","prefix"],{cwd:i.HVIGOR_PROJECT_ROOT_DIR});if(0!==r.status||!r.stdout)return void(0,a.logErrorAndExit)("Error: The hvigor depends on the npmrc file. Configure the npmrc file first.");const u=c.resolve(`${r.stdout}`.replace(/[\r\n]/gi,""),".npmrc");(0,s.isFileExists)(u)||(0,a.logErrorAndExit)("Error: The hvigor depends on the npmrc file. Configure the npmrc file first.")},e.environmentHandler=function(){process.env["npm_config_update-notifier"]="false"},e.isPnpmAvailable=function(){return!!o.existsSync(i.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH)&&(0,s.hasNpmPackInPaths)("pnpm",[i.HVIGOR_WRAPPER_TOOLS_HOME])},e.executeInstallPnpm=function(){(0,a.logInfoPrintConsole)(`Installing pnpm@${e.PNPM_VERSION}...`);const t=(0,s.getNpmPath)();!function(){const t=c.resolve(i.HVIGOR_WRAPPER_TOOLS_HOME,i.DEFAULT_PACKAGE_JSON);try{o.existsSync(i.HVIGOR_WRAPPER_TOOLS_HOME)||o.mkdirSync(i.HVIGOR_WRAPPER_TOOLS_HOME,{recursive:!0});const n={dependencies:{}};n.dependencies[i.PNPM]=e.PNPM_VERSION,o.writeFileSync(t,JSON.stringify(n))}catch(e){(0,a.logErrorAndExit)(`Error: EPERM: operation not permitted,create ${t} failed.`)}}(),(0,s.executeCommand)(t,["install","pnpm"],{cwd:i.HVIGOR_WRAPPER_TOOLS_HOME,stdio:["inherit","inherit","inherit"],env:process.env}),(0,a.logInfoPrintConsole)("Pnpm install success.")}}(O);var Y={},X={},Z={},Q={};Object.defineProperty(Q,"__esModule",{value:!0}),Q.Unicode=void 0;class ee{}Q.Unicode=ee,ee.Space_Separator=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,ee.ID_Start=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,ee.ID_Continue=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,Object.defineProperty(Z,"__esModule",{value:!0}),Z.JudgeUtil=void 0;const te=Q;Z.JudgeUtil=class{static isIgnoreChar(e){return"string"==typeof e&&("\t"===e||"\v"===e||"\f"===e||" "===e||" "===e||"\ufeff"===e||"\n"===e||"\r"===e||"\u2028"===e||"\u2029"===e)}static isSpaceSeparator(e){return"string"==typeof e&&te.Unicode.Space_Separator.test(e)}static isIdStartChar(e){return"string"==typeof e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||"$"===e||"_"===e||te.Unicode.ID_Start.test(e))}static isIdContinueChar(e){return"string"==typeof e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||"$"===e||"_"===e||"‌"===e||"‍"===e||te.Unicode.ID_Continue.test(e))}static isDigitWithoutZero(e){return/[1-9]/.test(e)}static isDigit(e){return"string"==typeof e&&/[0-9]/.test(e)}static isHexDigit(e){return"string"==typeof e&&/[0-9A-Fa-f]/.test(e)}};var ne={},re={fromCallback:function(e){return Object.defineProperty((function(...t){if("function"!=typeof t[t.length-1])return new Promise(((n,r)=>{e.call(this,...t,((e,t)=>null!=e?r(e):n(t)))}));e.apply(this,t)}),"name",{value:e.name})},fromPromise:function(e){return Object.defineProperty((function(...t){const n=t[t.length-1];if("function"!=typeof n)return e.apply(this,t);e.apply(this,t.slice(0,-1)).then((e=>n(null,e)),n)}),"name",{value:e.name})}},ue=y.default,oe=process.cwd,ie=null,se=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return ie||(ie=oe.call(process)),ie};try{process.cwd()}catch(e){}if("function"==typeof process.chdir){var ce=process.chdir;process.chdir=function(e){ie=null,ce.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,ce)}var ae=function(e){ue.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&function(e){e.lchmod=function(t,n,r){e.open(t,ue.O_WRONLY|ue.O_SYMLINK,n,(function(t,u){t?r&&r(t):e.fchmod(u,n,(function(t){e.close(u,(function(e){r&&r(t||e)}))}))}))},e.lchmodSync=function(t,n){var r,u=e.openSync(t,ue.O_WRONLY|ue.O_SYMLINK,n),o=!0;try{r=e.fchmodSync(u,n),o=!1}finally{if(o)try{e.closeSync(u)}catch(e){}else e.closeSync(u)}return r}}(e);e.lutimes||function(e){ue.hasOwnProperty("O_SYMLINK")&&e.futimes?(e.lutimes=function(t,n,r,u){e.open(t,ue.O_SYMLINK,(function(t,o){t?u&&u(t):e.futimes(o,n,r,(function(t){e.close(o,(function(e){u&&u(t||e)}))}))}))},e.lutimesSync=function(t,n,r){var u,o=e.openSync(t,ue.O_SYMLINK),i=!0;try{u=e.futimesSync(o,n,r),i=!1}finally{if(i)try{e.closeSync(o)}catch(e){}else e.closeSync(o)}return u}):e.futimes&&(e.lutimes=function(e,t,n,r){r&&process.nextTick(r)},e.lutimesSync=function(){})}(e);e.chown=r(e.chown),e.fchown=r(e.fchown),e.lchown=r(e.lchown),e.chmod=t(e.chmod),e.fchmod=t(e.fchmod),e.lchmod=t(e.lchmod),e.chownSync=u(e.chownSync),e.fchownSync=u(e.fchownSync),e.lchownSync=u(e.lchownSync),e.chmodSync=n(e.chmodSync),e.fchmodSync=n(e.fchmodSync),e.lchmodSync=n(e.lchmodSync),e.stat=o(e.stat),e.fstat=o(e.fstat),e.lstat=o(e.lstat),e.statSync=i(e.statSync),e.fstatSync=i(e.fstatSync),e.lstatSync=i(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(e,t,n){n&&process.nextTick(n)},e.lchmodSync=function(){});e.chown&&!e.lchown&&(e.lchown=function(e,t,n,r){r&&process.nextTick(r)},e.lchownSync=function(){});"win32"===se&&(e.rename="function"!=typeof e.rename?e.rename:function(t){function n(n,r,u){var o=Date.now(),i=0;t(n,r,(function s(c){if(c&&("EACCES"===c.code||"EPERM"===c.code||"EBUSY"===c.code)&&Date.now()-o<6e4)return setTimeout((function(){e.stat(r,(function(e,o){e&&"ENOENT"===e.code?t(n,r,s):u(c)}))}),i),void(i<100&&(i+=10));u&&u(c)}))}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n}(e.rename));function t(t){return t?function(n,r,u){return t.call(e,n,r,(function(e){s(e)&&(e=null),u&&u.apply(this,arguments)}))}:t}function n(t){return t?function(n,r){try{return t.call(e,n,r)}catch(e){if(!s(e))throw e}}:t}function r(t){return t?function(n,r,u,o){return t.call(e,n,r,u,(function(e){s(e)&&(e=null),o&&o.apply(this,arguments)}))}:t}function u(t){return t?function(n,r,u){try{return t.call(e,n,r,u)}catch(e){if(!s(e))throw e}}:t}function o(t){return t?function(n,r,u){function o(e,t){t&&(t.uid<0&&(t.uid+=4294967296),t.gid<0&&(t.gid+=4294967296)),u&&u.apply(this,arguments)}return"function"==typeof r&&(u=r,r=null),r?t.call(e,n,r,o):t.call(e,n,o)}:t}function i(t){return t?function(n,r){var u=r?t.call(e,n,r):t.call(e,n);return u&&(u.uid<0&&(u.uid+=4294967296),u.gid<0&&(u.gid+=4294967296)),u}:t}function s(e){return!e||("ENOSYS"===e.code||!(process.getuid&&0===process.getuid()||"EINVAL"!==e.code&&"EPERM"!==e.code))}e.read="function"!=typeof e.read?e.read:function(t){function n(n,r,u,o,i,s){var c;if(s&&"function"==typeof s){var a=0;c=function(l,f,d){if(l&&"EAGAIN"===l.code&&a<10)return a++,t.call(e,n,r,u,o,i,c);s.apply(this,arguments)}}return t.call(e,n,r,u,o,i,c)}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n}(e.read),e.readSync="function"!=typeof e.readSync?e.readSync:(c=e.readSync,function(t,n,r,u,o){for(var i=0;;)try{return c.call(e,t,n,r,u,o)}catch(e){if("EAGAIN"===e.code&&i<10){i++;continue}throw e}});var c};var le=C.default.Stream,fe=function(e){return{ReadStream:function t(n,r){if(!(this instanceof t))return new t(n,r);le.call(this);var u=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,r=r||{};for(var o=Object.keys(r),i=0,s=o.length;ithis.end)throw new Error("start must be <= end");this.pos=this.start}if(null!==this.fd)return void process.nextTick((function(){u._read()}));e.open(this.path,this.flags,this.mode,(function(e,t){if(e)return u.emit("error",e),void(u.readable=!1);u.fd=t,u.emit("open",t),u._read()}))},WriteStream:function t(n,r){if(!(this instanceof t))return new t(n,r);le.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,r=r||{};for(var u=Object.keys(r),o=0,i=u.length;o= zero");this.pos=this.start}this.busy=!1,this._queue=[],null===this.fd&&(this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}};var de=function(e){if(null===e||"object"!=typeof e)return e;if(e instanceof Object)var t={__proto__:De(e)};else t=Object.create(null);return Object.getOwnPropertyNames(e).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})),t},De=Object.getPrototypeOf||function(e){return e.__proto__};var pe,Ee,me=D.default,he=ae,ye=fe,Ce=de,Fe=F.default;function ge(e,t){Object.defineProperty(e,pe,{get:function(){return t}})}"function"==typeof Symbol&&"function"==typeof Symbol.for?(pe=Symbol.for("graceful-fs.queue"),Ee=Symbol.for("graceful-fs.previous")):(pe="___graceful-fs.queue",Ee="___graceful-fs.previous");var Ae=function(){};if(Fe.debuglog?Ae=Fe.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(Ae=function(){var e=Fe.format.apply(Fe,arguments);e="GFS4: "+e.split(/\n/).join("\nGFS4: "),console.error(e)}),!me[pe]){var ve=w[pe]||[];ge(me,ve),me.close=function(e){function t(t,n){return e.call(me,t,(function(e){e||_e(),"function"==typeof n&&n.apply(this,arguments)}))}return Object.defineProperty(t,Ee,{value:e}),t}(me.close),me.closeSync=function(e){function t(t){e.apply(me,arguments),_e()}return Object.defineProperty(t,Ee,{value:e}),t}(me.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",(function(){Ae(me[pe]),g.default.equal(me[pe].length,0)}))}w[pe]||ge(w,me[pe]);var Se,we=Oe(Ce(me));function Oe(e){he(e),e.gracefulify=Oe,e.createReadStream=function(t,n){return new e.ReadStream(t,n)},e.createWriteStream=function(t,n){return new e.WriteStream(t,n)};var t=e.readFile;e.readFile=function(e,n,r){"function"==typeof n&&(r=n,n=null);return function e(n,r,u,o){return t(n,r,(function(t){!t||"EMFILE"!==t.code&&"ENFILE"!==t.code?"function"==typeof u&&u.apply(this,arguments):be([e,[n,r,u],t,o||Date.now(),Date.now()])}))}(e,n,r)};var n=e.writeFile;e.writeFile=function(e,t,r,u){"function"==typeof r&&(u=r,r=null);return function e(t,r,u,o,i){return n(t,r,u,(function(n){!n||"EMFILE"!==n.code&&"ENFILE"!==n.code?"function"==typeof o&&o.apply(this,arguments):be([e,[t,r,u,o],n,i||Date.now(),Date.now()])}))}(e,t,r,u)};var r=e.appendFile;r&&(e.appendFile=function(e,t,n,u){"function"==typeof n&&(u=n,n=null);return function e(t,n,u,o,i){return r(t,n,u,(function(r){!r||"EMFILE"!==r.code&&"ENFILE"!==r.code?"function"==typeof o&&o.apply(this,arguments):be([e,[t,n,u,o],r,i||Date.now(),Date.now()])}))}(e,t,n,u)});var u=e.copyFile;u&&(e.copyFile=function(e,t,n,r){"function"==typeof n&&(r=n,n=0);return function e(t,n,r,o,i){return u(t,n,r,(function(u){!u||"EMFILE"!==u.code&&"ENFILE"!==u.code?"function"==typeof o&&o.apply(this,arguments):be([e,[t,n,r,o],u,i||Date.now(),Date.now()])}))}(e,t,n,r)});var o=e.readdir;e.readdir=function(e,t,n){"function"==typeof t&&(n=t,t=null);var r=i.test(process.version)?function(e,t,n,r){return o(e,u(e,t,n,r))}:function(e,t,n,r){return o(e,t,u(e,t,n,r))};return r(e,t,n);function u(e,t,n,u){return function(o,i){!o||"EMFILE"!==o.code&&"ENFILE"!==o.code?(i&&i.sort&&i.sort(),"function"==typeof n&&n.call(this,o,i)):be([r,[e,t,n],o,u||Date.now(),Date.now()])}}};var i=/^v[0-5]\./;if("v0.8"===process.version.substr(0,4)){var s=ye(e);d=s.ReadStream,D=s.WriteStream}var c=e.ReadStream;c&&(d.prototype=Object.create(c.prototype),d.prototype.open=function(){var e=this;E(e.path,e.flags,e.mode,(function(t,n){t?(e.autoClose&&e.destroy(),e.emit("error",t)):(e.fd=n,e.emit("open",n),e.read())}))});var a=e.WriteStream;a&&(D.prototype=Object.create(a.prototype),D.prototype.open=function(){var e=this;E(e.path,e.flags,e.mode,(function(t,n){t?(e.destroy(),e.emit("error",t)):(e.fd=n,e.emit("open",n))}))}),Object.defineProperty(e,"ReadStream",{get:function(){return d},set:function(e){d=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return D},set:function(e){D=e},enumerable:!0,configurable:!0});var l=d;Object.defineProperty(e,"FileReadStream",{get:function(){return l},set:function(e){l=e},enumerable:!0,configurable:!0});var f=D;function d(e,t){return this instanceof d?(c.apply(this,arguments),this):d.apply(Object.create(d.prototype),arguments)}function D(e,t){return this instanceof D?(a.apply(this,arguments),this):D.apply(Object.create(D.prototype),arguments)}Object.defineProperty(e,"FileWriteStream",{get:function(){return f},set:function(e){f=e},enumerable:!0,configurable:!0});var p=e.open;function E(e,t,n,r){return"function"==typeof n&&(r=n,n=null),function e(t,n,r,u,o){return p(t,n,r,(function(i,s){!i||"EMFILE"!==i.code&&"ENFILE"!==i.code?"function"==typeof u&&u.apply(this,arguments):be([e,[t,n,r,u],i,o||Date.now(),Date.now()])}))}(e,t,n,r)}return e.open=E,e}function be(e){Ae("ENQUEUE",e[0].name,e[1]),me[pe].push(e),Be()}function _e(){for(var e=Date.now(),t=0;t2&&(me[pe][t][3]=e,me[pe][t][4]=e);Be()}function Be(){if(clearTimeout(Se),Se=void 0,0!==me[pe].length){var e=me[pe].shift(),t=e[0],n=e[1],r=e[2],u=e[3],o=e[4];if(void 0===u)Ae("RETRY",t.name,n),t.apply(null,n);else if(Date.now()-u>=6e4){Ae("TIMEOUT",t.name,n);var i=n.pop();"function"==typeof i&&i.call(null,r)}else{var s=Date.now()-o,c=Math.max(o-u,1);s>=Math.min(1.2*c,100)?(Ae("RETRY",t.name,n),t.apply(null,n.concat([u]))):me[pe].push(e)}void 0===Se&&(Se=setTimeout(Be,0))}}process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!me.__patched&&(we=Oe(me),me.__patched=!0),function(e){const t=re.fromCallback,n=we,r=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchmod","lchown","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter((e=>"function"==typeof n[e]));Object.assign(e,n),r.forEach((r=>{e[r]=t(n[r])})),e.realpath.native=t(n.realpath.native),e.exists=function(e,t){return"function"==typeof t?n.exists(e,t):new Promise((t=>n.exists(e,t)))},e.read=function(e,t,r,u,o,i){return"function"==typeof i?n.read(e,t,r,u,o,i):new Promise(((i,s)=>{n.read(e,t,r,u,o,((e,t,n)=>{if(e)return s(e);i({bytesRead:t,buffer:n})}))}))},e.write=function(e,t,...r){return"function"==typeof r[r.length-1]?n.write(e,t,...r):new Promise(((u,o)=>{n.write(e,t,...r,((e,t,n)=>{if(e)return o(e);u({bytesWritten:t,buffer:n})}))}))},"function"==typeof n.writev&&(e.writev=function(e,t,...r){return"function"==typeof r[r.length-1]?n.writev(e,t,...r):new Promise(((u,o)=>{n.writev(e,t,...r,((e,t,n)=>{if(e)return o(e);u({bytesWritten:t,buffers:n})}))}))})}(ne);var Pe={},ke={};const xe=p.default;ke.checkPath=function(e){if("win32"===process.platform){if(/[<>:"|?*]/.test(e.replace(xe.parse(e).root,""))){const t=new Error(`Path contains invalid characters: ${e}`);throw t.code="EINVAL",t}}};const Ne=ne,{checkPath:Ie}=ke,Te=e=>"number"==typeof e?e:{mode:511,...e}.mode;Pe.makeDir=async(e,t)=>(Ie(e),Ne.mkdir(e,{mode:Te(t),recursive:!0})),Pe.makeDirSync=(e,t)=>(Ie(e),Ne.mkdirSync(e,{mode:Te(t),recursive:!0}));const Re=re.fromPromise,{makeDir:Me,makeDirSync:Le}=Pe,je=Re(Me);var $e={mkdirs:je,mkdirsSync:Le,mkdirp:je,mkdirpSync:Le,ensureDir:je,ensureDirSync:Le};const He=re.fromPromise,Je=ne;var Ge={pathExists:He((function(e){return Je.access(e).then((()=>!0)).catch((()=>!1))})),pathExistsSync:Je.existsSync};const Ve=we;var Ue=function(e,t,n,r){Ve.open(e,"r+",((e,u)=>{if(e)return r(e);Ve.futimes(u,t,n,(e=>{Ve.close(u,(t=>{r&&r(e||t)}))}))}))},We=function(e,t,n){const r=Ve.openSync(e,"r+");return Ve.futimesSync(r,t,n),Ve.closeSync(r)};const ze=ne,Ke=p.default,qe=F.default;function Ye(e,t,n){const r=n.dereference?e=>ze.stat(e,{bigint:!0}):e=>ze.lstat(e,{bigint:!0});return Promise.all([r(e),r(t).catch((e=>{if("ENOENT"===e.code)return null;throw e}))]).then((([e,t])=>({srcStat:e,destStat:t})))}function Xe(e,t){return t.ino&&t.dev&&t.ino===e.ino&&t.dev===e.dev}function Ze(e,t){const n=Ke.resolve(e).split(Ke.sep).filter((e=>e)),r=Ke.resolve(t).split(Ke.sep).filter((e=>e));return n.reduce(((e,t,n)=>e&&r[n]===t),!0)}function Qe(e,t,n){return`Cannot ${n} '${e}' to a subdirectory of itself, '${t}'.`}var et={checkPaths:function(e,t,n,r,u){qe.callbackify(Ye)(e,t,r,((r,o)=>{if(r)return u(r);const{srcStat:i,destStat:s}=o;if(s){if(Xe(i,s)){const r=Ke.basename(e),o=Ke.basename(t);return"move"===n&&r!==o&&r.toLowerCase()===o.toLowerCase()?u(null,{srcStat:i,destStat:s,isChangingCase:!0}):u(new Error("Source and destination must not be the same."))}if(i.isDirectory()&&!s.isDirectory())return u(new Error(`Cannot overwrite non-directory '${t}' with directory '${e}'.`));if(!i.isDirectory()&&s.isDirectory())return u(new Error(`Cannot overwrite directory '${t}' with non-directory '${e}'.`))}return i.isDirectory()&&Ze(e,t)?u(new Error(Qe(e,t,n))):u(null,{srcStat:i,destStat:s})}))},checkPathsSync:function(e,t,n,r){const{srcStat:u,destStat:o}=function(e,t,n){let r;const u=n.dereference?e=>ze.statSync(e,{bigint:!0}):e=>ze.lstatSync(e,{bigint:!0}),o=u(e);try{r=u(t)}catch(e){if("ENOENT"===e.code)return{srcStat:o,destStat:null};throw e}return{srcStat:o,destStat:r}}(e,t,r);if(o){if(Xe(u,o)){const r=Ke.basename(e),i=Ke.basename(t);if("move"===n&&r!==i&&r.toLowerCase()===i.toLowerCase())return{srcStat:u,destStat:o,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(u.isDirectory()&&!o.isDirectory())throw new Error(`Cannot overwrite non-directory '${t}' with directory '${e}'.`);if(!u.isDirectory()&&o.isDirectory())throw new Error(`Cannot overwrite directory '${t}' with non-directory '${e}'.`)}if(u.isDirectory()&&Ze(e,t))throw new Error(Qe(e,t,n));return{srcStat:u,destStat:o}},checkParentPaths:function e(t,n,r,u,o){const i=Ke.resolve(Ke.dirname(t)),s=Ke.resolve(Ke.dirname(r));if(s===i||s===Ke.parse(s).root)return o();ze.stat(s,{bigint:!0},((i,c)=>i?"ENOENT"===i.code?o():o(i):Xe(n,c)?o(new Error(Qe(t,r,u))):e(t,n,s,u,o)))},checkParentPathsSync:function e(t,n,r,u){const o=Ke.resolve(Ke.dirname(t)),i=Ke.resolve(Ke.dirname(r));if(i===o||i===Ke.parse(i).root)return;let s;try{s=ze.statSync(i,{bigint:!0})}catch(e){if("ENOENT"===e.code)return;throw e}if(Xe(n,s))throw new Error(Qe(t,r,u));return e(t,n,i,u)},isSrcSubdir:Ze,areIdentical:Xe};const tt=we,nt=p.default,rt=$e.mkdirs,ut=Ge.pathExists,ot=Ue,it=et;function st(e,t,n,r,u){const o=nt.dirname(n);ut(o,((i,s)=>i?u(i):s?at(e,t,n,r,u):void rt(o,(o=>o?u(o):at(e,t,n,r,u)))))}function ct(e,t,n,r,u,o){Promise.resolve(u.filter(n,r)).then((i=>i?e(t,n,r,u,o):o()),(e=>o(e)))}function at(e,t,n,r,u){(r.dereference?tt.stat:tt.lstat)(t,((o,i)=>o?u(o):i.isDirectory()?function(e,t,n,r,u,o){return t?Dt(n,r,u,o):function(e,t,n,r,u){tt.mkdir(n,(o=>{if(o)return u(o);Dt(t,n,r,(t=>t?u(t):dt(n,e,u)))}))}(e.mode,n,r,u,o)}(i,e,t,n,r,u):i.isFile()||i.isCharacterDevice()||i.isBlockDevice()?function(e,t,n,r,u,o){return t?function(e,t,n,r,u){if(!r.overwrite)return r.errorOnExist?u(new Error(`'${n}' already exists`)):u();tt.unlink(n,(o=>o?u(o):lt(e,t,n,r,u)))}(e,n,r,u,o):lt(e,n,r,u,o)}(i,e,t,n,r,u):i.isSymbolicLink()?function(e,t,n,r,u){tt.readlink(t,((t,o)=>t?u(t):(r.dereference&&(o=nt.resolve(process.cwd(),o)),e?void tt.readlink(n,((t,i)=>t?"EINVAL"===t.code||"UNKNOWN"===t.code?tt.symlink(o,n,u):u(t):(r.dereference&&(i=nt.resolve(process.cwd(),i)),it.isSrcSubdir(o,i)?u(new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`)):e.isDirectory()&&it.isSrcSubdir(i,o)?u(new Error(`Cannot overwrite '${i}' with '${o}'.`)):function(e,t,n){tt.unlink(t,(r=>r?n(r):tt.symlink(e,t,n)))}(o,n,u)))):tt.symlink(o,n,u))))}(e,t,n,r,u):i.isSocket()?u(new Error(`Cannot copy a socket file: ${t}`)):i.isFIFO()?u(new Error(`Cannot copy a FIFO pipe: ${t}`)):u(new Error(`Unknown file: ${t}`))))}function lt(e,t,n,r,u){tt.copyFile(t,n,(o=>o?u(o):r.preserveTimestamps?function(e,t,n,r){if(function(e){return 0==(128&e)}(e))return function(e,t,n){return dt(e,128|t,n)}(n,e,(u=>u?r(u):ft(e,t,n,r)));return ft(e,t,n,r)}(e.mode,t,n,u):dt(n,e.mode,u)))}function ft(e,t,n,r){!function(e,t,n){tt.stat(e,((e,r)=>e?n(e):ot(t,r.atime,r.mtime,n)))}(t,n,(t=>t?r(t):dt(n,e,r)))}function dt(e,t,n){return tt.chmod(e,t,n)}function Dt(e,t,n,r){tt.readdir(e,((u,o)=>u?r(u):pt(o,e,t,n,r)))}function pt(e,t,n,r,u){const o=e.pop();return o?function(e,t,n,r,u,o){const i=nt.join(n,t),s=nt.join(r,t);it.checkPaths(i,s,"copy",u,((t,c)=>{if(t)return o(t);const{destStat:a}=c;!function(e,t,n,r,u){r.filter?ct(at,e,t,n,r,u):at(e,t,n,r,u)}(a,i,s,u,(t=>t?o(t):pt(e,n,r,u,o)))}))}(e,o,t,n,r,u):u()}var Et=function(e,t,n,r){"function"!=typeof n||r?"function"==typeof n&&(n={filter:n}):(r=n,n={}),r=r||function(){},(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269"),it.checkPaths(e,t,"copy",n,((u,o)=>{if(u)return r(u);const{srcStat:i,destStat:s}=o;it.checkParentPaths(e,i,t,"copy",(u=>u?r(u):n.filter?ct(st,s,e,t,n,r):st(s,e,t,n,r)))}))};const mt=we,ht=p.default,yt=$e.mkdirsSync,Ct=We,Ft=et;function gt(e,t,n,r){const u=(r.dereference?mt.statSync:mt.lstatSync)(t);if(u.isDirectory())return function(e,t,n,r,u){return t?St(n,r,u):function(e,t,n,r){return mt.mkdirSync(n),St(t,n,r),vt(n,e)}(e.mode,n,r,u)}(u,e,t,n,r);if(u.isFile()||u.isCharacterDevice()||u.isBlockDevice())return function(e,t,n,r,u){return t?function(e,t,n,r){if(r.overwrite)return mt.unlinkSync(n),At(e,t,n,r);if(r.errorOnExist)throw new Error(`'${n}' already exists`)}(e,n,r,u):At(e,n,r,u)}(u,e,t,n,r);if(u.isSymbolicLink())return function(e,t,n,r){let u=mt.readlinkSync(t);r.dereference&&(u=ht.resolve(process.cwd(),u));if(e){let e;try{e=mt.readlinkSync(n)}catch(e){if("EINVAL"===e.code||"UNKNOWN"===e.code)return mt.symlinkSync(u,n);throw e}if(r.dereference&&(e=ht.resolve(process.cwd(),e)),Ft.isSrcSubdir(u,e))throw new Error(`Cannot copy '${u}' to a subdirectory of itself, '${e}'.`);if(mt.statSync(n).isDirectory()&&Ft.isSrcSubdir(e,u))throw new Error(`Cannot overwrite '${e}' with '${u}'.`);return function(e,t){return mt.unlinkSync(t),mt.symlinkSync(e,t)}(u,n)}return mt.symlinkSync(u,n)}(e,t,n,r);if(u.isSocket())throw new Error(`Cannot copy a socket file: ${t}`);if(u.isFIFO())throw new Error(`Cannot copy a FIFO pipe: ${t}`);throw new Error(`Unknown file: ${t}`)}function At(e,t,n,r){return mt.copyFileSync(t,n),r.preserveTimestamps&&function(e,t,n){(function(e){return 0==(128&e)})(e)&&function(e,t){vt(e,128|t)}(n,e);(function(e,t){const n=mt.statSync(e);Ct(t,n.atime,n.mtime)})(t,n)}(e.mode,t,n),vt(n,e.mode)}function vt(e,t){return mt.chmodSync(e,t)}function St(e,t,n){mt.readdirSync(e).forEach((r=>function(e,t,n,r){const u=ht.join(t,e),o=ht.join(n,e),{destStat:i}=Ft.checkPathsSync(u,o,"copy",r);return function(e,t,n,r){if(!r.filter||r.filter(t,n))return gt(e,t,n,r)}(i,u,o,r)}(r,e,t,n)))}var wt=function(e,t,n){"function"==typeof n&&(n={filter:n}),(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269");const{srcStat:r,destStat:u}=Ft.checkPathsSync(e,t,"copy",n);return Ft.checkParentPathsSync(e,r,t,"copy"),function(e,t,n,r){if(r.filter&&!r.filter(t,n))return;const u=ht.dirname(n);mt.existsSync(u)||yt(u);return gt(e,t,n,r)}(u,e,t,n)};var Ot={copy:(0,re.fromCallback)(Et),copySync:wt};const bt=we,_t=p.default,Bt=g.default,Pt="win32"===process.platform;function kt(e){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach((t=>{e[t]=e[t]||bt[t],e[t+="Sync"]=e[t]||bt[t]})),e.maxBusyTries=e.maxBusyTries||3}function xt(e,t,n){let r=0;"function"==typeof t&&(n=t,t={}),Bt(e,"rimraf: missing path"),Bt.strictEqual(typeof e,"string","rimraf: path should be a string"),Bt.strictEqual(typeof n,"function","rimraf: callback function required"),Bt(t,"rimraf: invalid options argument provided"),Bt.strictEqual(typeof t,"object","rimraf: options should be object"),kt(t),Nt(e,t,(function u(o){if(o){if(("EBUSY"===o.code||"ENOTEMPTY"===o.code||"EPERM"===o.code)&&rNt(e,t,u)),100*r)}"ENOENT"===o.code&&(o=null)}n(o)}))}function Nt(e,t,n){Bt(e),Bt(t),Bt("function"==typeof n),t.lstat(e,((r,u)=>r&&"ENOENT"===r.code?n(null):r&&"EPERM"===r.code&&Pt?It(e,t,r,n):u&&u.isDirectory()?Rt(e,t,r,n):void t.unlink(e,(r=>{if(r){if("ENOENT"===r.code)return n(null);if("EPERM"===r.code)return Pt?It(e,t,r,n):Rt(e,t,r,n);if("EISDIR"===r.code)return Rt(e,t,r,n)}return n(r)}))))}function It(e,t,n,r){Bt(e),Bt(t),Bt("function"==typeof r),t.chmod(e,438,(u=>{u?r("ENOENT"===u.code?null:n):t.stat(e,((u,o)=>{u?r("ENOENT"===u.code?null:n):o.isDirectory()?Rt(e,t,n,r):t.unlink(e,r)}))}))}function Tt(e,t,n){let r;Bt(e),Bt(t);try{t.chmodSync(e,438)}catch(e){if("ENOENT"===e.code)return;throw n}try{r=t.statSync(e)}catch(e){if("ENOENT"===e.code)return;throw n}r.isDirectory()?Lt(e,t,n):t.unlinkSync(e)}function Rt(e,t,n,r){Bt(e),Bt(t),Bt("function"==typeof r),t.rmdir(e,(u=>{!u||"ENOTEMPTY"!==u.code&&"EEXIST"!==u.code&&"EPERM"!==u.code?u&&"ENOTDIR"===u.code?r(n):r(u):function(e,t,n){Bt(e),Bt(t),Bt("function"==typeof n),t.readdir(e,((r,u)=>{if(r)return n(r);let o,i=u.length;if(0===i)return t.rmdir(e,n);u.forEach((r=>{xt(_t.join(e,r),t,(r=>{if(!o)return r?n(o=r):void(0==--i&&t.rmdir(e,n))}))}))}))}(e,t,r)}))}function Mt(e,t){let n;kt(t=t||{}),Bt(e,"rimraf: missing path"),Bt.strictEqual(typeof e,"string","rimraf: path should be a string"),Bt(t,"rimraf: missing options"),Bt.strictEqual(typeof t,"object","rimraf: options should be object");try{n=t.lstatSync(e)}catch(n){if("ENOENT"===n.code)return;"EPERM"===n.code&&Pt&&Tt(e,t,n)}try{n&&n.isDirectory()?Lt(e,t,null):t.unlinkSync(e)}catch(n){if("ENOENT"===n.code)return;if("EPERM"===n.code)return Pt?Tt(e,t,n):Lt(e,t,n);if("EISDIR"!==n.code)throw n;Lt(e,t,n)}}function Lt(e,t,n){Bt(e),Bt(t);try{t.rmdirSync(e)}catch(r){if("ENOTDIR"===r.code)throw n;if("ENOTEMPTY"===r.code||"EEXIST"===r.code||"EPERM"===r.code)!function(e,t){if(Bt(e),Bt(t),t.readdirSync(e).forEach((n=>Mt(_t.join(e,n),t))),!Pt){return t.rmdirSync(e,t)}{const n=Date.now();do{try{return t.rmdirSync(e,t)}catch{}}while(Date.now()-n<500)}}(e,t);else if("ENOENT"!==r.code)throw r}}var jt=xt;xt.sync=Mt;const $t=we,Ht=re.fromCallback,Jt=jt;var Gt={remove:Ht((function(e,t){if($t.rm)return $t.rm(e,{recursive:!0,force:!0},t);Jt(e,t)})),removeSync:function(e){if($t.rmSync)return $t.rmSync(e,{recursive:!0,force:!0});Jt.sync(e)}};const Vt=re.fromPromise,Ut=ne,Wt=p.default,zt=$e,Kt=Gt,qt=Vt((async function(e){let t;try{t=await Ut.readdir(e)}catch{return zt.mkdirs(e)}return Promise.all(t.map((t=>Kt.remove(Wt.join(e,t)))))}));function Yt(e){let t;try{t=Ut.readdirSync(e)}catch{return zt.mkdirsSync(e)}t.forEach((t=>{t=Wt.join(e,t),Kt.removeSync(t)}))}var Xt={emptyDirSync:Yt,emptydirSync:Yt,emptyDir:qt,emptydir:qt};const Zt=re.fromCallback,Qt=p.default,en=we,tn=$e;var nn={createFile:Zt((function(e,t){function n(){en.writeFile(e,"",(e=>{if(e)return t(e);t()}))}en.stat(e,((r,u)=>{if(!r&&u.isFile())return t();const o=Qt.dirname(e);en.stat(o,((e,r)=>{if(e)return"ENOENT"===e.code?tn.mkdirs(o,(e=>{if(e)return t(e);n()})):t(e);r.isDirectory()?n():en.readdir(o,(e=>{if(e)return t(e)}))}))}))})),createFileSync:function(e){let t;try{t=en.statSync(e)}catch{}if(t&&t.isFile())return;const n=Qt.dirname(e);try{en.statSync(n).isDirectory()||en.readdirSync(n)}catch(e){if(!e||"ENOENT"!==e.code)throw e;tn.mkdirsSync(n)}en.writeFileSync(e,"")}};const rn=re.fromCallback,un=p.default,on=we,sn=$e,cn=Ge.pathExists,{areIdentical:an}=et;var ln={createLink:rn((function(e,t,n){function r(e,t){on.link(e,t,(e=>{if(e)return n(e);n(null)}))}on.lstat(t,((u,o)=>{on.lstat(e,((u,i)=>{if(u)return u.message=u.message.replace("lstat","ensureLink"),n(u);if(o&&an(i,o))return n(null);const s=un.dirname(t);cn(s,((u,o)=>u?n(u):o?r(e,t):void sn.mkdirs(s,(u=>{if(u)return n(u);r(e,t)}))))}))}))})),createLinkSync:function(e,t){let n;try{n=on.lstatSync(t)}catch{}try{const t=on.lstatSync(e);if(n&&an(t,n))return}catch(e){throw e.message=e.message.replace("lstat","ensureLink"),e}const r=un.dirname(t);return on.existsSync(r)||sn.mkdirsSync(r),on.linkSync(e,t)}};const fn=p.default,dn=we,Dn=Ge.pathExists;var pn={symlinkPaths:function(e,t,n){if(fn.isAbsolute(e))return dn.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:e})));{const r=fn.dirname(t),u=fn.join(r,e);return Dn(u,((t,o)=>t?n(t):o?n(null,{toCwd:u,toDst:e}):dn.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:fn.relative(r,e)})))))}},symlinkPathsSync:function(e,t){let n;if(fn.isAbsolute(e)){if(n=dn.existsSync(e),!n)throw new Error("absolute srcpath does not exist");return{toCwd:e,toDst:e}}{const r=fn.dirname(t),u=fn.join(r,e);if(n=dn.existsSync(u),n)return{toCwd:u,toDst:e};if(n=dn.existsSync(e),!n)throw new Error("relative srcpath does not exist");return{toCwd:e,toDst:fn.relative(r,e)}}}};const En=we;var mn={symlinkType:function(e,t,n){if(n="function"==typeof t?t:n,t="function"!=typeof t&&t)return n(null,t);En.lstat(e,((e,r)=>{if(e)return n(null,"file");t=r&&r.isDirectory()?"dir":"file",n(null,t)}))},symlinkTypeSync:function(e,t){let n;if(t)return t;try{n=En.lstatSync(e)}catch{return"file"}return n&&n.isDirectory()?"dir":"file"}};const hn=re.fromCallback,yn=p.default,Cn=ne,Fn=$e.mkdirs,gn=$e.mkdirsSync,An=pn.symlinkPaths,vn=pn.symlinkPathsSync,Sn=mn.symlinkType,wn=mn.symlinkTypeSync,On=Ge.pathExists,{areIdentical:bn}=et;function _n(e,t,n,r){An(e,t,((u,o)=>{if(u)return r(u);e=o.toDst,Sn(o.toCwd,n,((n,u)=>{if(n)return r(n);const o=yn.dirname(t);On(o,((n,i)=>n?r(n):i?Cn.symlink(e,t,u,r):void Fn(o,(n=>{if(n)return r(n);Cn.symlink(e,t,u,r)}))))}))}))}var Bn={createSymlink:hn((function(e,t,n,r){r="function"==typeof n?n:r,n="function"!=typeof n&&n,Cn.lstat(t,((u,o)=>{!u&&o.isSymbolicLink()?Promise.all([Cn.stat(e),Cn.stat(t)]).then((([u,o])=>{if(bn(u,o))return r(null);_n(e,t,n,r)})):_n(e,t,n,r)}))})),createSymlinkSync:function(e,t,n){let r;try{r=Cn.lstatSync(t)}catch{}if(r&&r.isSymbolicLink()){const n=Cn.statSync(e),r=Cn.statSync(t);if(bn(n,r))return}const u=vn(e,t);e=u.toDst,n=wn(u.toCwd,n);const o=yn.dirname(t);return Cn.existsSync(o)||gn(o),Cn.symlinkSync(e,t,n)}};const{createFile:Pn,createFileSync:kn}=nn,{createLink:xn,createLinkSync:Nn}=ln,{createSymlink:In,createSymlinkSync:Tn}=Bn;var Rn={createFile:Pn,createFileSync:kn,ensureFile:Pn,ensureFileSync:kn,createLink:xn,createLinkSync:Nn,ensureLink:xn,ensureLinkSync:Nn,createSymlink:In,createSymlinkSync:Tn,ensureSymlink:In,ensureSymlinkSync:Tn};var Mn={stringify:function(e,{EOL:t="\n",finalEOL:n=!0,replacer:r=null,spaces:u}={}){const o=n?t:"";return JSON.stringify(e,r,u).replace(/\n/g,t)+o},stripBom:function(e){return Buffer.isBuffer(e)&&(e=e.toString("utf8")),e.replace(/^\uFEFF/,"")}};let Ln;try{Ln=we}catch(e){Ln=D.default}const jn=re,{stringify:$n,stripBom:Hn}=Mn;const Jn=jn.fromPromise((async function(e,t={}){"string"==typeof t&&(t={encoding:t});const n=t.fs||Ln,r=!("throws"in t)||t.throws;let u,o=await jn.fromCallback(n.readFile)(e,t);o=Hn(o);try{u=JSON.parse(o,t?t.reviver:null)}catch(t){if(r)throw t.message=`${e}: ${t.message}`,t;return null}return u}));const Gn=jn.fromPromise((async function(e,t,n={}){const r=n.fs||Ln,u=$n(t,n);await jn.fromCallback(r.writeFile)(e,u,n)}));const Vn={readFile:Jn,readFileSync:function(e,t={}){"string"==typeof t&&(t={encoding:t});const n=t.fs||Ln,r=!("throws"in t)||t.throws;try{let r=n.readFileSync(e,t);return r=Hn(r),JSON.parse(r,t.reviver)}catch(t){if(r)throw t.message=`${e}: ${t.message}`,t;return null}},writeFile:Gn,writeFileSync:function(e,t,n={}){const r=n.fs||Ln,u=$n(t,n);return r.writeFileSync(e,u,n)}};var Un={readJson:Vn.readFile,readJsonSync:Vn.readFileSync,writeJson:Vn.writeFile,writeJsonSync:Vn.writeFileSync};const Wn=re.fromCallback,zn=we,Kn=p.default,qn=$e,Yn=Ge.pathExists;var Xn={outputFile:Wn((function(e,t,n,r){"function"==typeof n&&(r=n,n="utf8");const u=Kn.dirname(e);Yn(u,((o,i)=>o?r(o):i?zn.writeFile(e,t,n,r):void qn.mkdirs(u,(u=>{if(u)return r(u);zn.writeFile(e,t,n,r)}))))})),outputFileSync:function(e,...t){const n=Kn.dirname(e);if(zn.existsSync(n))return zn.writeFileSync(e,...t);qn.mkdirsSync(n),zn.writeFileSync(e,...t)}};const{stringify:Zn}=Mn,{outputFile:Qn}=Xn;var er=async function(e,t,n={}){const r=Zn(t,n);await Qn(e,r,n)};const{stringify:tr}=Mn,{outputFileSync:nr}=Xn;var rr=function(e,t,n){const r=tr(t,n);nr(e,r,n)};const ur=re.fromPromise,or=Un;or.outputJson=ur(er),or.outputJsonSync=rr,or.outputJSON=or.outputJson,or.outputJSONSync=or.outputJsonSync,or.writeJSON=or.writeJson,or.writeJSONSync=or.writeJsonSync,or.readJSON=or.readJson,or.readJSONSync=or.readJsonSync;var ir=or;const sr=we,cr=p.default,ar=Ot.copy,lr=Gt.remove,fr=$e.mkdirp,dr=Ge.pathExists,Dr=et;function pr(e,t,n,r,u){return r?Er(e,t,n,u):n?lr(t,(r=>r?u(r):Er(e,t,n,u))):void dr(t,((r,o)=>r?u(r):o?u(new Error("dest already exists.")):Er(e,t,n,u)))}function Er(e,t,n,r){sr.rename(e,t,(u=>u?"EXDEV"!==u.code?r(u):function(e,t,n,r){const u={overwrite:n,errorOnExist:!0};ar(e,t,u,(t=>t?r(t):lr(e,r)))}(e,t,n,r):r()))}var mr=function(e,t,n,r){"function"==typeof n&&(r=n,n={});const u=n.overwrite||n.clobber||!1;Dr.checkPaths(e,t,"move",n,((n,o)=>{if(n)return r(n);const{srcStat:i,isChangingCase:s=!1}=o;Dr.checkParentPaths(e,i,t,"move",(n=>n?r(n):function(e){const t=cr.dirname(e);return cr.parse(t).root===t}(t)?pr(e,t,u,s,r):void fr(cr.dirname(t),(n=>n?r(n):pr(e,t,u,s,r)))))}))};const hr=we,yr=p.default,Cr=Ot.copySync,Fr=Gt.removeSync,gr=$e.mkdirpSync,Ar=et;function vr(e,t,n){try{hr.renameSync(e,t)}catch(r){if("EXDEV"!==r.code)throw r;return function(e,t,n){const r={overwrite:n,errorOnExist:!0};return Cr(e,t,r),Fr(e)}(e,t,n)}}var Sr=function(e,t,n){const r=(n=n||{}).overwrite||n.clobber||!1,{srcStat:u,isChangingCase:o=!1}=Ar.checkPathsSync(e,t,"move",n);return Ar.checkParentPathsSync(e,u,t,"move"),function(e){const t=yr.dirname(e);return yr.parse(t).root===t}(t)||gr(yr.dirname(t)),function(e,t,n,r){if(r)return vr(e,t,n);if(n)return Fr(t),vr(e,t,n);if(hr.existsSync(t))throw new Error("dest already exists.");return vr(e,t,n)}(e,t,r,o)};var wr,Or,br,_r,Br,Pr={move:(0,re.fromCallback)(mr),moveSync:Sr},kr={...ne,...Ot,...Xt,...Rn,...ir,...$e,...Pr,...Xn,...Ge,...Gt},xr={},Nr={exports:{}},Ir={exports:{}};function Tr(){if(Or)return wr;Or=1;var e=1e3,t=60*e,n=60*t,r=24*n,u=7*r,o=365.25*r;function i(e,t,n,r){var u=t>=1.5*n;return Math.round(e/n)+" "+r+(u?"s":"")}return wr=function(s,c){c=c||{};var a=typeof s;if("string"===a&&s.length>0)return function(i){if((i=String(i)).length>100)return;var s=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(!s)return;var c=parseFloat(s[1]);switch((s[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*o;case"weeks":case"week":case"w":return c*u;case"days":case"day":case"d":return c*r;case"hours":case"hour":case"hrs":case"hr":case"h":return c*n;case"minutes":case"minute":case"mins":case"min":case"m":return c*t;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(s);if("number"===a&&isFinite(s))return c.long?function(u){var o=Math.abs(u);if(o>=r)return i(u,o,r,"day");if(o>=n)return i(u,o,n,"hour");if(o>=t)return i(u,o,t,"minute");if(o>=e)return i(u,o,e,"second");return u+" ms"}(s):function(u){var o=Math.abs(u);if(o>=r)return Math.round(u/r)+"d";if(o>=n)return Math.round(u/n)+"h";if(o>=t)return Math.round(u/t)+"m";if(o>=e)return Math.round(u/e)+"s";return u+"ms"}(s);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(s))}}function Rr(){if(_r)return br;return _r=1,br=function(e){function t(e){let r,u,o,i=null;function s(...e){if(!s.enabled)return;const n=s,u=Number(new Date),o=u-(r||u);n.diff=o,n.prev=r,n.curr=u,r=u,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let i=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((r,u)=>{if("%%"===r)return"%";i++;const o=t.formatters[u];if("function"==typeof o){const t=e[i];r=o.call(n,t),e.splice(i,1),i--}return r})),t.formatArgs.call(n,e);(n.log||t.log).apply(n,e)}return s.namespace=e,s.useColors=t.useColors(),s.color=t.selectColor(e),s.extend=n,s.destroy=t.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==i?i:(u!==t.namespaces&&(u=t.namespaces,o=t.enabled(e)),o),set:e=>{i=e}}),"function"==typeof t.init&&t.init(s),s}function n(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function r(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(r),...t.skips.map(r).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),u=r.length;for(n=0;n{t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t{const n=e.startsWith("-")?"":1===e.length?"-":"--",r=t.indexOf(n+e),u=t.indexOf("--");return-1!==r&&(-1===u||r{}),"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{const e=function(){if($r)return jr;$r=1;const e=E.default,t=A.default,n=Vr(),{env:r}=process;let u;function o(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function i(t,o){if(0===u)return 0;if(n("color=16m")||n("color=full")||n("color=truecolor"))return 3;if(n("color=256"))return 2;if(t&&!o&&void 0===u)return 0;const i=u||0;if("dumb"===r.TERM)return i;if("win32"===process.platform){const t=e.release().split(".");return Number(t[0])>=10&&Number(t[2])>=10586?Number(t[2])>=14931?3:2:1}if("CI"in r)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some((e=>e in r))||"codeship"===r.CI_NAME?1:i;if("TEAMCITY_VERSION"in r)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(r.TEAMCITY_VERSION)?1:0;if("truecolor"===r.COLORTERM)return 3;if("TERM_PROGRAM"in r){const e=parseInt((r.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(r.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(r.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(r.TERM)||"COLORTERM"in r?1:i}return n("no-color")||n("no-colors")||n("color=false")||n("color=never")?u=0:(n("color")||n("colors")||n("color=true")||n("color=always"))&&(u=1),"FORCE_COLOR"in r&&(u="true"===r.FORCE_COLOR?1:"false"===r.FORCE_COLOR?0:0===r.FORCE_COLOR.length?1:Math.min(parseInt(r.FORCE_COLOR,10),3)),jr={supportsColor:function(e){return o(i(e,e&&e.isTTY))},stdout:o(i(!0,t.isatty(1))),stderr:o(i(!0,t.isatty(2)))}}();e&&(e.stderr||e).level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}t.inspectOpts=Object.keys(process.env).filter((e=>/^debug_/i.test(e))).reduce(((e,t)=>{const n=t.substring(6).toLowerCase().replace(/_([a-z])/g,((e,t)=>t.toUpperCase()));let r=process.env[t];return r=!!/^(yes|on|true|enabled)$/i.test(r)||!/^(no|off|false|disabled)$/i.test(r)&&("null"===r?null:Number(r)),e[n]=r,e}),{}),e.exports=Rr()(t);const{formatters:u}=e.exports;u.o=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")},u.O=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts)}}(Gr,Gr.exports)),Gr.exports}Jr=Nr,"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?Jr.exports=(Br||(Br=1,function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,u=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(u=r))})),t.splice(u,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=Rr()(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(Ir,Ir.exports)),Ir.exports):Jr.exports=Ur();var Wr=function(e){return(e=e||{}).circles?function(e){var t=[],n=[];return e.proto?function e(u){if("object"!=typeof u||null===u)return u;if(u instanceof Date)return new Date(u);if(Array.isArray(u))return r(u,e);if(u instanceof Map)return new Map(r(Array.from(u),e));if(u instanceof Set)return new Set(r(Array.from(u),e));var o={};for(var i in t.push(u),n.push(o),u){var s=u[i];if("object"!=typeof s||null===s)o[i]=s;else if(s instanceof Date)o[i]=new Date(s);else if(s instanceof Map)o[i]=new Map(r(Array.from(s),e));else if(s instanceof Set)o[i]=new Set(r(Array.from(s),e));else if(ArrayBuffer.isView(s))o[i]=zr(s);else{var c=t.indexOf(s);o[i]=-1!==c?n[c]:e(s)}}return t.pop(),n.pop(),o}:function e(u){if("object"!=typeof u||null===u)return u;if(u instanceof Date)return new Date(u);if(Array.isArray(u))return r(u,e);if(u instanceof Map)return new Map(r(Array.from(u),e));if(u instanceof Set)return new Set(r(Array.from(u),e));var o={};for(var i in t.push(u),n.push(o),u)if(!1!==Object.hasOwnProperty.call(u,i)){var s=u[i];if("object"!=typeof s||null===s)o[i]=s;else if(s instanceof Date)o[i]=new Date(s);else if(s instanceof Map)o[i]=new Map(r(Array.from(s),e));else if(s instanceof Set)o[i]=new Set(r(Array.from(s),e));else if(ArrayBuffer.isView(s))o[i]=zr(s);else{var c=t.indexOf(s);o[i]=-1!==c?n[c]:e(s)}}return t.pop(),n.pop(),o};function r(e,r){for(var u=Object.keys(e),o=new Array(u.length),i=0;i!e,Qr=e=>e&&"object"==typeof e&&!Array.isArray(e),eu=(e,t,n)=>{(Array.isArray(t)?t:[t]).forEach((t=>{if(t)throw new Error(`Problem with log4js configuration: (${Kr.inspect(e,{depth:5})}) - ${n}`)}))};var tu={configure:e=>{qr("New configuration to be validated: ",e),eu(e,Zr(Qr(e)),"must be an object."),qr(`Calling pre-processing listeners (${Yr.length})`),Yr.forEach((t=>t(e))),qr("Configuration pre-processing finished."),qr(`Calling configuration listeners (${Xr.length})`),Xr.forEach((t=>t(e))),qr("Configuration finished.")},addListener:e=>{Xr.push(e),qr(`Added listener, now ${Xr.length} listeners`)},addPreProcessingListener:e=>{Yr.push(e),qr(`Added pre-processing listener, now ${Yr.length} listeners`)},throwExceptionIf:eu,anObject:Qr,anInteger:e=>e&&"number"==typeof e&&Number.isInteger(e),validIdentifier:e=>/^[A-Za-z][A-Za-z0-9_]*$/g.test(e),not:Zr},nu={exports:{}};!function(e){function t(e,t){for(var n=e.toString();n.length-1?s:c,l=n(u.getHours()),f=n(u.getMinutes()),d=n(u.getSeconds()),D=t(u.getMilliseconds(),3),p=function(e){var t=Math.abs(e),n=String(Math.floor(t/60)),r=String(t%60);return n=("0"+n).slice(-2),r=("0"+r).slice(-2),0===e?"Z":(e<0?"+":"-")+n+":"+r}(u.getTimezoneOffset());return r.replace(/dd/g,o).replace(/MM/g,i).replace(/y{1,4}/g,a).replace(/hh/g,l).replace(/mm/g,f).replace(/ss/g,d).replace(/SSS/g,D).replace(/O/g,p)}function u(e,t,n,r){e["set"+(r?"":"UTC")+t](n)}e.exports=r,e.exports.asString=r,e.exports.parse=function(t,n,r){if(!t)throw new Error("pattern must be supplied");return function(t,n,r){var o=t.indexOf("O")<0,i=!1,s=[{pattern:/y{1,4}/,regexp:"\\d{1,4}",fn:function(e,t){u(e,"FullYear",t,o)}},{pattern:/MM/,regexp:"\\d{1,2}",fn:function(e,t){u(e,"Month",t-1,o),e.getMonth()!==t-1&&(i=!0)}},{pattern:/dd/,regexp:"\\d{1,2}",fn:function(e,t){i&&u(e,"Month",e.getMonth()-1,o),u(e,"Date",t,o)}},{pattern:/hh/,regexp:"\\d{1,2}",fn:function(e,t){u(e,"Hours",t,o)}},{pattern:/mm/,regexp:"\\d\\d",fn:function(e,t){u(e,"Minutes",t,o)}},{pattern:/ss/,regexp:"\\d\\d",fn:function(e,t){u(e,"Seconds",t,o)}},{pattern:/SSS/,regexp:"\\d\\d\\d",fn:function(e,t){u(e,"Milliseconds",t,o)}},{pattern:/O/,regexp:"[+-]\\d{1,2}:?\\d{2}?|Z",fn:function(e,t){t="Z"===t?0:t.replace(":","");var n=Math.abs(t),r=(t>0?-1:1)*(n%100+60*Math.floor(n/100));e.setUTCMinutes(e.getUTCMinutes()+r)}}],c=s.reduce((function(e,t){return t.pattern.test(e.regexp)?(t.index=e.regexp.match(t.pattern).index,e.regexp=e.regexp.replace(t.pattern,"("+t.regexp+")")):t.index=-1,e}),{regexp:t,index:[]}),a=s.filter((function(e){return e.index>-1}));a.sort((function(e,t){return e.index-t.index}));var l=new RegExp(c.regexp).exec(n);if(l){var f=r||e.exports.now();return a.forEach((function(e,t){e.fn(f,l[t+1])})),f}throw new Error("String '"+n+"' could not be parsed as '"+t+"'")}(t,n,r)},e.exports.now=function(){return new Date},e.exports.ISO8601_FORMAT="yyyy-MM-ddThh:mm:ss.SSS",e.exports.ISO8601_WITH_TZ_OFFSET_FORMAT="yyyy-MM-ddThh:mm:ss.SSSO",e.exports.DATETIME_FORMAT="dd MM yyyy hh:mm:ss.SSS",e.exports.ABSOLUTETIME_FORMAT="hh:mm:ss.SSS"}(nu);const ru=nu.exports,uu=E.default,ou=F.default,iu=p.default,su={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[90,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[91,39],yellow:[33,39]};function cu(e){return e?`[${su[e][0]}m`:""}function au(e){return e?`[${su[e][1]}m`:""}function lu(e,t){return n=ou.format("[%s] [%s] %s - ",ru.asString(e.startTime),e.level.toString(),e.categoryName),cu(r=t)+n+au(r);var n,r}function fu(e){return lu(e)+ou.format(...e.data)}function du(e){return lu(e,e.level.colour)+ou.format(...e.data)}function Du(e){return ou.format(...e.data)}function pu(e){return e.data[0]}function Eu(e,t){const n=/%(-?[0-9]+)?(\.?-?[0-9]+)?([[\]cdhmnprzxXyflos%])(\{([^}]+)\})?|([^%]+)/;function r(e){return e&&e.pid?e.pid.toString():process.pid.toString()}e=e||"%r %p %c - %m%n";const u={c:function(e,t){let n=e.categoryName;if(t){const e=parseInt(t,10),r=n.split(".");ee&&(n=r.slice(-e).join(iu.sep))}return n},l:function(e){return e.lineNumber?`${e.lineNumber}`:""},o:function(e){return e.columnNumber?`${e.columnNumber}`:""},s:function(e){return e.callStack||""}};function o(e,t,n){return u[e](t,n)}function i(e,t,n){let r=e;return r=function(e,t){let n;return e?(n=parseInt(e.substr(1),10),n>0?t.slice(0,n):t.slice(n)):t}(t,r),r=function(e,t){let n;if(e)if("-"===e.charAt(0))for(n=parseInt(e.substr(1),10);t.lengthDu,basic:()=>fu,colored:()=>du,coloured:()=>du,pattern:e=>Eu(e&&e.pattern,e&&e.tokens),dummy:()=>pu};var hu={basicLayout:fu,messagePassThroughLayout:Du,patternLayout:Eu,colouredLayout:du,coloredLayout:du,dummyLayout:pu,addLayout(e,t){mu[e]=t},layout:(e,t)=>mu[e]&&mu[e](t)};const yu=tu,Cu=["white","grey","black","blue","cyan","green","magenta","red","yellow"];class Fu{constructor(e,t,n){this.level=e,this.levelStr=t,this.colour=n}toString(){return this.levelStr}static getLevel(e,t){return e?e instanceof Fu?e:(e instanceof Object&&e.levelStr&&(e=e.levelStr),Fu[e.toString().toUpperCase()]||t):t}static addLevels(e){if(e){Object.keys(e).forEach((t=>{const n=t.toUpperCase();Fu[n]=new Fu(e[t].value,n,e[t].colour);const r=Fu.levels.findIndex((e=>e.levelStr===n));r>-1?Fu.levels[r]=Fu[n]:Fu.levels.push(Fu[n])})),Fu.levels.sort(((e,t)=>e.level-t.level))}}isLessThanOrEqualTo(e){return"string"==typeof e&&(e=Fu.getLevel(e)),this.level<=e.level}isGreaterThanOrEqualTo(e){return"string"==typeof e&&(e=Fu.getLevel(e)),this.level>=e.level}isEqualTo(e){return"string"==typeof e&&(e=Fu.getLevel(e)),this.level===e.level}}Fu.levels=[],Fu.addLevels({ALL:{value:Number.MIN_VALUE,colour:"grey"},TRACE:{value:5e3,colour:"blue"},DEBUG:{value:1e4,colour:"cyan"},INFO:{value:2e4,colour:"green"},WARN:{value:3e4,colour:"yellow"},ERROR:{value:4e4,colour:"red"},FATAL:{value:5e4,colour:"magenta"},MARK:{value:9007199254740992,colour:"grey"},OFF:{value:Number.MAX_VALUE,colour:"grey"}}),yu.addListener((e=>{const t=e.levels;if(t){yu.throwExceptionIf(e,yu.not(yu.anObject(t)),"levels must be an object");Object.keys(t).forEach((n=>{yu.throwExceptionIf(e,yu.not(yu.validIdentifier(n)),`level name "${n}" is not a valid identifier (must start with a letter, only contain A-Z,a-z,0-9,_)`),yu.throwExceptionIf(e,yu.not(yu.anObject(t[n])),`level "${n}" must be an object`),yu.throwExceptionIf(e,yu.not(t[n].value),`level "${n}" must have a 'value' property`),yu.throwExceptionIf(e,yu.not(yu.anInteger(t[n].value)),`level "${n}".value must have an integer value`),yu.throwExceptionIf(e,yu.not(t[n].colour),`level "${n}" must have a 'colour' property`),yu.throwExceptionIf(e,yu.not(Cu.indexOf(t[n].colour)>-1),`level "${n}".colour must be one of ${Cu.join(", ")}`)}))}})),yu.addListener((e=>{Fu.addLevels(e.levels)}));var gu=Fu,Au={exports:{}},vu={};/*! (c) 2020 Andrea Giammarchi */ +const{parse:Su,stringify:wu}=JSON,{keys:Ou}=Object,bu=String,_u="string",Bu={},Pu="object",ku=(e,t)=>t,xu=e=>e instanceof bu?bu(e):e,Nu=(e,t)=>typeof t===_u?new bu(t):t,Iu=(e,t,n,r)=>{const u=[];for(let o=Ou(n),{length:i}=o,s=0;s{const r=bu(t.push(n)-1);return e.set(n,r),r},Ru=(e,t)=>{const n=Su(e,Nu).map(xu),r=n[0],u=t||ku,o=typeof r===Pu&&r?Iu(n,new Set,r,u):r;return u.call({"":o},"",o)};vu.parse=Ru;const Mu=(e,t,n)=>{const r=t&&typeof t===Pu?(e,n)=>""===e||-1Su(Mu(e));vu.fromJSON=e=>Ru(wu(e));const Lu=vu,ju=gu;class $u{constructor(e,t,n,r,u){this.startTime=new Date,this.categoryName=e,this.data=n,this.level=t,this.context=Object.assign({},r),this.pid=process.pid,u&&(this.functionName=u.functionName,this.fileName=u.fileName,this.lineNumber=u.lineNumber,this.columnNumber=u.columnNumber,this.callStack=u.callStack)}serialise(){const e=this.data.map((e=>(e&&e.message&&e.stack&&(e=Object.assign({message:e.message,stack:e.stack},e)),e)));return this.data=e,Lu.stringify(this)}static deserialise(e){let t;try{const n=Lu.parse(e);n.data=n.data.map((e=>{if(e&&e.message&&e.stack){const t=new Error(e);Object.keys(e).forEach((n=>{t[n]=e[n]})),e=t}return e})),t=new $u(n.categoryName,ju.getLevel(n.level.levelStr),n.data,n.context),t.startTime=new Date(n.startTime),t.pid=n.pid,t.cluster=n.cluster}catch(n){t=new $u("log4js",ju.ERROR,["Unable to parse log:",e,"because: ",n])}return t}}var Hu=$u;const Ju=Nr.exports("log4js:clustering"),Gu=Hu,Vu=tu;let Uu=!1,Wu=null;try{Wu=require("cluster")}catch(e){Ju("cluster module not present"),Uu=!0}const zu=[];let Ku=!1,qu="NODE_APP_INSTANCE";const Yu=()=>Ku&&"0"===process.env[qu],Xu=()=>Uu||Wu.isMaster||Yu(),Zu=e=>{zu.forEach((t=>t(e)))},Qu=(e,t)=>{if(Ju("cluster message received from worker ",e,": ",t),e.topic&&e.data&&(t=e,e=void 0),t&&t.topic&&"log4js:message"===t.topic){Ju("received message: ",t.data);const e=Gu.deserialise(t.data);Zu(e)}};Uu||Vu.addListener((e=>{zu.length=0,({pm2:Ku,disableClustering:Uu,pm2InstanceVar:qu="NODE_APP_INSTANCE"}=e),Ju(`clustering disabled ? ${Uu}`),Ju(`cluster.isMaster ? ${Wu&&Wu.isMaster}`),Ju(`pm2 enabled ? ${Ku}`),Ju(`pm2InstanceVar = ${qu}`),Ju(`process.env[${qu}] = ${process.env[qu]}`),Ku&&process.removeListener("message",Qu),Wu&&Wu.removeListener&&Wu.removeListener("message",Qu),Uu||e.disableClustering?Ju("Not listening for cluster messages, because clustering disabled."):Yu()?(Ju("listening for PM2 broadcast messages"),process.on("message",Qu)):Wu.isMaster?(Ju("listening for cluster messages"),Wu.on("message",Qu)):Ju("not listening for messages, because we are not a master process")}));var eo={onlyOnMaster:(e,t)=>Xu()?e():t,isMaster:Xu,send:e=>{Xu()?Zu(e):(Ku||(e.cluster={workerId:Wu.worker.id,worker:process.pid}),process.send({topic:"log4js:message",data:e.serialise()}))},onMessage:e=>{zu.push(e)}},to={};function no(e){if("number"==typeof e&&Number.isInteger(e))return e;const t={K:1024,M:1048576,G:1073741824},n=Object.keys(t),r=e.substr(e.length-1).toLocaleUpperCase(),u=e.substring(0,e.length-1).trim();if(n.indexOf(r)<0||!Number.isInteger(Number(u)))throw Error(`maxLogSize: "${e}" is invalid`);return u*t[r]}function ro(e){return function(e,t){const n=Object.assign({},t);return Object.keys(e).forEach((r=>{n[r]&&(n[r]=e[r](t[r]))})),n}({maxLogSize:no},e)}const uo={file:ro,fileSync:ro};to.modifyConfig=e=>uo[e.type]?uo[e.type](e):e;var oo={};const io=console.log.bind(console);oo.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{io(e(n,t))}}(n,e.timezoneOffset)};var so={};so.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{process.stdout.write(`${e(n,t)}\n`)}}(n,e.timezoneOffset)};var co={};co.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{process.stderr.write(`${e(n,t)}\n`)}}(n,e.timezoneOffset)};var ao={};ao.configure=function(e,t,n,r){const u=n(e.appender);return function(e,t,n,r){const u=r.getLevel(e),o=r.getLevel(t,r.FATAL);return e=>{const t=e.level;t.isGreaterThanOrEqualTo(u)&&t.isLessThanOrEqualTo(o)&&n(e)}}(e.level,e.maxLevel,u,r)};var lo={};const fo=Nr.exports("log4js:categoryFilter");lo.configure=function(e,t,n){const r=n(e.appender);return function(e,t){return"string"==typeof e&&(e=[e]),n=>{fo(`Checking ${n.categoryName} against ${e}`),-1===e.indexOf(n.categoryName)&&(fo("Not excluded, sending to appender"),t(n))}}(e.exclude,r)};var Do={};const po=Nr.exports("log4js:noLogFilter");Do.configure=function(e,t,n){const r=n(e.appender);return function(e,t){return n=>{po(`Checking data: ${n.data} against filters: ${e}`),"string"==typeof e&&(e=[e]),e=e.filter((e=>null!=e&&""!==e));const r=new RegExp(e.join("|"),"i");(0===e.length||n.data.findIndex((e=>r.test(e)))<0)&&(po("Not excluded, sending to appender"),t(n))}}(e.exclude,r)};var Eo={},mo={exports:{}},ho={},yo={fromCallback:function(e){return Object.defineProperty((function(){if("function"!=typeof arguments[arguments.length-1])return new Promise(((t,n)=>{arguments[arguments.length]=(e,r)=>{if(e)return n(e);t(r)},arguments.length++,e.apply(this,arguments)}));e.apply(this,arguments)}),"name",{value:e.name})},fromPromise:function(e){return Object.defineProperty((function(){const t=arguments[arguments.length-1];if("function"!=typeof t)return e.apply(this,arguments);e.apply(this,arguments).then((e=>t(null,e)),t)}),"name",{value:e.name})}};!function(e){const t=yo.fromCallback,n=we,r=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchown","lchmod","link","lstat","mkdir","mkdtemp","open","readFile","readdir","readlink","realpath","rename","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter((e=>"function"==typeof n[e]));Object.keys(n).forEach((t=>{"promises"!==t&&(e[t]=n[t])})),r.forEach((r=>{e[r]=t(n[r])})),e.exists=function(e,t){return"function"==typeof t?n.exists(e,t):new Promise((t=>n.exists(e,t)))},e.read=function(e,t,r,u,o,i){return"function"==typeof i?n.read(e,t,r,u,o,i):new Promise(((i,s)=>{n.read(e,t,r,u,o,((e,t,n)=>{if(e)return s(e);i({bytesRead:t,buffer:n})}))}))},e.write=function(e,t,...r){return"function"==typeof r[r.length-1]?n.write(e,t,...r):new Promise(((u,o)=>{n.write(e,t,...r,((e,t,n)=>{if(e)return o(e);u({bytesWritten:t,buffer:n})}))}))},"function"==typeof n.realpath.native&&(e.realpath.native=t(n.realpath.native))}(ho);const Co=p.default;function Fo(e){return(e=Co.normalize(Co.resolve(e)).split(Co.sep)).length>0?e[0]:null}const go=/[<>:"|?*]/;var Ao=function(e){const t=Fo(e);return e=e.replace(t,""),go.test(e)};const vo=we,So=p.default,wo=Ao,Oo=parseInt("0777",8);var bo=function e(t,n,r,u){if("function"==typeof n?(r=n,n={}):n&&"object"==typeof n||(n={mode:n}),"win32"===process.platform&&wo(t)){const e=new Error(t+" contains invalid WIN32 path characters.");return e.code="EINVAL",r(e)}let o=n.mode;const i=n.fs||vo;void 0===o&&(o=Oo&~process.umask()),u||(u=null),r=r||function(){},t=So.resolve(t),i.mkdir(t,o,(o=>{if(!o)return r(null,u=u||t);if("ENOENT"===o.code){if(So.dirname(t)===t)return r(o);e(So.dirname(t),n,((u,o)=>{u?r(u,o):e(t,n,r,o)}))}else i.stat(t,((e,t)=>{e||!t.isDirectory()?r(o,u):r(null,u)}))}))};const _o=we,Bo=p.default,Po=Ao,ko=parseInt("0777",8);var xo=function e(t,n,r){n&&"object"==typeof n||(n={mode:n});let u=n.mode;const o=n.fs||_o;if("win32"===process.platform&&Po(t)){const e=new Error(t+" contains invalid WIN32 path characters.");throw e.code="EINVAL",e}void 0===u&&(u=ko&~process.umask()),r||(r=null),t=Bo.resolve(t);try{o.mkdirSync(t,u),r=r||t}catch(u){if("ENOENT"===u.code){if(Bo.dirname(t)===t)throw u;r=e(Bo.dirname(t),n,r),e(t,n,r)}else{let e;try{e=o.statSync(t)}catch(e){throw u}if(!e.isDirectory())throw u}}return r};const No=(0,yo.fromCallback)(bo);var Io={mkdirs:No,mkdirsSync:xo,mkdirp:No,mkdirpSync:xo,ensureDir:No,ensureDirSync:xo};const To=we;E.default,p.default;var Ro=function(e,t,n,r){To.open(e,"r+",((e,u)=>{if(e)return r(e);To.futimes(u,t,n,(e=>{To.close(u,(t=>{r&&r(e||t)}))}))}))},Mo=function(e,t,n){const r=To.openSync(e,"r+");return To.futimesSync(r,t,n),To.closeSync(r)};const Lo=we,jo=p.default,$o=10,Ho=5,Jo=0,Go=process.versions.node.split("."),Vo=Number.parseInt(Go[0],10),Uo=Number.parseInt(Go[1],10),Wo=Number.parseInt(Go[2],10);function zo(){if(Vo>$o)return!0;if(Vo===$o){if(Uo>Ho)return!0;if(Uo===Ho&&Wo>=Jo)return!0}return!1}function Ko(e,t){const n=jo.resolve(e).split(jo.sep).filter((e=>e)),r=jo.resolve(t).split(jo.sep).filter((e=>e));return n.reduce(((e,t,n)=>e&&r[n]===t),!0)}function qo(e,t,n){return`Cannot ${n} '${e}' to a subdirectory of itself, '${t}'.`}var Yo,Xo,Zo={checkPaths:function(e,t,n,r){!function(e,t,n){zo()?Lo.stat(e,{bigint:!0},((e,r)=>{if(e)return n(e);Lo.stat(t,{bigint:!0},((e,t)=>e?"ENOENT"===e.code?n(null,{srcStat:r,destStat:null}):n(e):n(null,{srcStat:r,destStat:t})))})):Lo.stat(e,((e,r)=>{if(e)return n(e);Lo.stat(t,((e,t)=>e?"ENOENT"===e.code?n(null,{srcStat:r,destStat:null}):n(e):n(null,{srcStat:r,destStat:t})))}))}(e,t,((u,o)=>{if(u)return r(u);const{srcStat:i,destStat:s}=o;return s&&s.ino&&s.dev&&s.ino===i.ino&&s.dev===i.dev?r(new Error("Source and destination must not be the same.")):i.isDirectory()&&Ko(e,t)?r(new Error(qo(e,t,n))):r(null,{srcStat:i,destStat:s})}))},checkPathsSync:function(e,t,n){const{srcStat:r,destStat:u}=function(e,t){let n,r;n=zo()?Lo.statSync(e,{bigint:!0}):Lo.statSync(e);try{r=zo()?Lo.statSync(t,{bigint:!0}):Lo.statSync(t)}catch(e){if("ENOENT"===e.code)return{srcStat:n,destStat:null};throw e}return{srcStat:n,destStat:r}}(e,t);if(u&&u.ino&&u.dev&&u.ino===r.ino&&u.dev===r.dev)throw new Error("Source and destination must not be the same.");if(r.isDirectory()&&Ko(e,t))throw new Error(qo(e,t,n));return{srcStat:r,destStat:u}},checkParentPaths:function e(t,n,r,u,o){const i=jo.resolve(jo.dirname(t)),s=jo.resolve(jo.dirname(r));if(s===i||s===jo.parse(s).root)return o();zo()?Lo.stat(s,{bigint:!0},((i,c)=>i?"ENOENT"===i.code?o():o(i):c.ino&&c.dev&&c.ino===n.ino&&c.dev===n.dev?o(new Error(qo(t,r,u))):e(t,n,s,u,o))):Lo.stat(s,((i,c)=>i?"ENOENT"===i.code?o():o(i):c.ino&&c.dev&&c.ino===n.ino&&c.dev===n.dev?o(new Error(qo(t,r,u))):e(t,n,s,u,o)))},checkParentPathsSync:function e(t,n,r,u){const o=jo.resolve(jo.dirname(t)),i=jo.resolve(jo.dirname(r));if(i===o||i===jo.parse(i).root)return;let s;try{s=zo()?Lo.statSync(i,{bigint:!0}):Lo.statSync(i)}catch(e){if("ENOENT"===e.code)return;throw e}if(s.ino&&s.dev&&s.ino===n.ino&&s.dev===n.dev)throw new Error(qo(t,r,u));return e(t,n,i,u)},isSrcSubdir:Ko};const Qo=we,ei=p.default,ti=Io.mkdirsSync,ni=Mo,ri=Zo;function ui(e,t,n,r){if(!r.filter||r.filter(t,n))return function(e,t,n,r){const u=r.dereference?Qo.statSync:Qo.lstatSync,o=u(t);if(o.isDirectory())return function(e,t,n,r,u){if(!t)return function(e,t,n,r){return Qo.mkdirSync(n),ii(t,n,r),Qo.chmodSync(n,e.mode)}(e,n,r,u);if(t&&!t.isDirectory())throw new Error(`Cannot overwrite non-directory '${r}' with directory '${n}'.`);return ii(n,r,u)}(o,e,t,n,r);if(o.isFile()||o.isCharacterDevice()||o.isBlockDevice())return function(e,t,n,r,u){return t?function(e,t,n,r){if(r.overwrite)return Qo.unlinkSync(n),oi(e,t,n,r);if(r.errorOnExist)throw new Error(`'${n}' already exists`)}(e,n,r,u):oi(e,n,r,u)}(o,e,t,n,r);if(o.isSymbolicLink())return function(e,t,n,r){let u=Qo.readlinkSync(t);r.dereference&&(u=ei.resolve(process.cwd(),u));if(e){let e;try{e=Qo.readlinkSync(n)}catch(e){if("EINVAL"===e.code||"UNKNOWN"===e.code)return Qo.symlinkSync(u,n);throw e}if(r.dereference&&(e=ei.resolve(process.cwd(),e)),ri.isSrcSubdir(u,e))throw new Error(`Cannot copy '${u}' to a subdirectory of itself, '${e}'.`);if(Qo.statSync(n).isDirectory()&&ri.isSrcSubdir(e,u))throw new Error(`Cannot overwrite '${e}' with '${u}'.`);return function(e,t){return Qo.unlinkSync(t),Qo.symlinkSync(e,t)}(u,n)}return Qo.symlinkSync(u,n)}(e,t,n,r)}(e,t,n,r)}function oi(e,t,n,r){return"function"==typeof Qo.copyFileSync?(Qo.copyFileSync(t,n),Qo.chmodSync(n,e.mode),r.preserveTimestamps?ni(n,e.atime,e.mtime):void 0):function(e,t,n,r){const u=65536,o=(Xo?Yo:(Xo=1,Yo=function(e){if("function"==typeof Buffer.allocUnsafe)try{return Buffer.allocUnsafe(e)}catch(t){return new Buffer(e)}return new Buffer(e)}))(u),i=Qo.openSync(t,"r"),s=Qo.openSync(n,"w",e.mode);let c=0;for(;cfunction(e,t,n,r){const u=ei.join(t,e),o=ei.join(n,e),{destStat:i}=ri.checkPathsSync(u,o,"copy");return ui(i,u,o,r)}(r,e,t,n)))}var si=function(e,t,n){"function"==typeof n&&(n={filter:n}),(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269");const{srcStat:r,destStat:u}=ri.checkPathsSync(e,t,"copy");return ri.checkParentPathsSync(e,r,t,"copy"),function(e,t,n,r){if(r.filter&&!r.filter(t,n))return;const u=ei.dirname(n);Qo.existsSync(u)||ti(u);return ui(e,t,n,r)}(u,e,t,n)},ci={copySync:si};const ai=yo.fromPromise,li=ho;var fi={pathExists:ai((function(e){return li.access(e).then((()=>!0)).catch((()=>!1))})),pathExistsSync:li.existsSync};const di=we,Di=p.default,pi=Io.mkdirs,Ei=fi.pathExists,mi=Ro,hi=Zo;function yi(e,t,n,r,u){const o=Di.dirname(n);Ei(o,((i,s)=>i?u(i):s?Fi(e,t,n,r,u):void pi(o,(o=>o?u(o):Fi(e,t,n,r,u)))))}function Ci(e,t,n,r,u,o){Promise.resolve(u.filter(n,r)).then((i=>i?e(t,n,r,u,o):o()),(e=>o(e)))}function Fi(e,t,n,r,u){return r.filter?Ci(gi,e,t,n,r,u):gi(e,t,n,r,u)}function gi(e,t,n,r,u){(r.dereference?di.stat:di.lstat)(t,((o,i)=>o?u(o):i.isDirectory()?function(e,t,n,r,u,o){if(!t)return function(e,t,n,r,u){di.mkdir(n,(o=>{if(o)return u(o);Si(t,n,r,(t=>t?u(t):di.chmod(n,e.mode,u)))}))}(e,n,r,u,o);if(t&&!t.isDirectory())return o(new Error(`Cannot overwrite non-directory '${r}' with directory '${n}'.`));return Si(n,r,u,o)}(i,e,t,n,r,u):i.isFile()||i.isCharacterDevice()||i.isBlockDevice()?function(e,t,n,r,u,o){return t?function(e,t,n,r,u){if(!r.overwrite)return r.errorOnExist?u(new Error(`'${n}' already exists`)):u();di.unlink(n,(o=>o?u(o):Ai(e,t,n,r,u)))}(e,n,r,u,o):Ai(e,n,r,u,o)}(i,e,t,n,r,u):i.isSymbolicLink()?function(e,t,n,r,u){di.readlink(t,((t,o)=>t?u(t):(r.dereference&&(o=Di.resolve(process.cwd(),o)),e?void di.readlink(n,((t,i)=>t?"EINVAL"===t.code||"UNKNOWN"===t.code?di.symlink(o,n,u):u(t):(r.dereference&&(i=Di.resolve(process.cwd(),i)),hi.isSrcSubdir(o,i)?u(new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`)):e.isDirectory()&&hi.isSrcSubdir(i,o)?u(new Error(`Cannot overwrite '${i}' with '${o}'.`)):function(e,t,n){di.unlink(t,(r=>r?n(r):di.symlink(e,t,n)))}(o,n,u)))):di.symlink(o,n,u))))}(e,t,n,r,u):void 0))}function Ai(e,t,n,r,u){return"function"==typeof di.copyFile?di.copyFile(t,n,(t=>t?u(t):vi(e,n,r,u))):function(e,t,n,r,u){const o=di.createReadStream(t);o.on("error",(e=>u(e))).once("open",(()=>{const t=di.createWriteStream(n,{mode:e.mode});t.on("error",(e=>u(e))).on("open",(()=>o.pipe(t))).once("close",(()=>vi(e,n,r,u)))}))}(e,t,n,r,u)}function vi(e,t,n,r){di.chmod(t,e.mode,(u=>u?r(u):n.preserveTimestamps?mi(t,e.atime,e.mtime,r):r()))}function Si(e,t,n,r){di.readdir(e,((u,o)=>u?r(u):wi(o,e,t,n,r)))}function wi(e,t,n,r,u){const o=e.pop();return o?function(e,t,n,r,u,o){const i=Di.join(n,t),s=Di.join(r,t);hi.checkPaths(i,s,"copy",((t,c)=>{if(t)return o(t);const{destStat:a}=c;Fi(a,i,s,u,(t=>t?o(t):wi(e,n,r,u,o)))}))}(e,o,t,n,r,u):u()}var Oi=function(e,t,n,r){"function"!=typeof n||r?"function"==typeof n&&(n={filter:n}):(r=n,n={}),r=r||function(){},(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269"),hi.checkPaths(e,t,"copy",((u,o)=>{if(u)return r(u);const{srcStat:i,destStat:s}=o;hi.checkParentPaths(e,i,t,"copy",(u=>u?r(u):n.filter?Ci(yi,s,e,t,n,r):yi(s,e,t,n,r)))}))};var bi={copy:(0,yo.fromCallback)(Oi)};const _i=we,Bi=p.default,Pi=g.default,ki="win32"===process.platform;function xi(e){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach((t=>{e[t]=e[t]||_i[t],e[t+="Sync"]=e[t]||_i[t]})),e.maxBusyTries=e.maxBusyTries||3}function Ni(e,t,n){let r=0;"function"==typeof t&&(n=t,t={}),Pi(e,"rimraf: missing path"),Pi.strictEqual(typeof e,"string","rimraf: path should be a string"),Pi.strictEqual(typeof n,"function","rimraf: callback function required"),Pi(t,"rimraf: invalid options argument provided"),Pi.strictEqual(typeof t,"object","rimraf: options should be object"),xi(t),Ii(e,t,(function u(o){if(o){if(("EBUSY"===o.code||"ENOTEMPTY"===o.code||"EPERM"===o.code)&&rIi(e,t,u)),100*r)}"ENOENT"===o.code&&(o=null)}n(o)}))}function Ii(e,t,n){Pi(e),Pi(t),Pi("function"==typeof n),t.lstat(e,((r,u)=>r&&"ENOENT"===r.code?n(null):r&&"EPERM"===r.code&&ki?Ti(e,t,r,n):u&&u.isDirectory()?Mi(e,t,r,n):void t.unlink(e,(r=>{if(r){if("ENOENT"===r.code)return n(null);if("EPERM"===r.code)return ki?Ti(e,t,r,n):Mi(e,t,r,n);if("EISDIR"===r.code)return Mi(e,t,r,n)}return n(r)}))))}function Ti(e,t,n,r){Pi(e),Pi(t),Pi("function"==typeof r),n&&Pi(n instanceof Error),t.chmod(e,438,(u=>{u?r("ENOENT"===u.code?null:n):t.stat(e,((u,o)=>{u?r("ENOENT"===u.code?null:n):o.isDirectory()?Mi(e,t,n,r):t.unlink(e,r)}))}))}function Ri(e,t,n){let r;Pi(e),Pi(t),n&&Pi(n instanceof Error);try{t.chmodSync(e,438)}catch(e){if("ENOENT"===e.code)return;throw n}try{r=t.statSync(e)}catch(e){if("ENOENT"===e.code)return;throw n}r.isDirectory()?ji(e,t,n):t.unlinkSync(e)}function Mi(e,t,n,r){Pi(e),Pi(t),n&&Pi(n instanceof Error),Pi("function"==typeof r),t.rmdir(e,(u=>{!u||"ENOTEMPTY"!==u.code&&"EEXIST"!==u.code&&"EPERM"!==u.code?u&&"ENOTDIR"===u.code?r(n):r(u):function(e,t,n){Pi(e),Pi(t),Pi("function"==typeof n),t.readdir(e,((r,u)=>{if(r)return n(r);let o,i=u.length;if(0===i)return t.rmdir(e,n);u.forEach((r=>{Ni(Bi.join(e,r),t,(r=>{if(!o)return r?n(o=r):void(0==--i&&t.rmdir(e,n))}))}))}))}(e,t,r)}))}function Li(e,t){let n;xi(t=t||{}),Pi(e,"rimraf: missing path"),Pi.strictEqual(typeof e,"string","rimraf: path should be a string"),Pi(t,"rimraf: missing options"),Pi.strictEqual(typeof t,"object","rimraf: options should be object");try{n=t.lstatSync(e)}catch(n){if("ENOENT"===n.code)return;"EPERM"===n.code&&ki&&Ri(e,t,n)}try{n&&n.isDirectory()?ji(e,t,null):t.unlinkSync(e)}catch(n){if("ENOENT"===n.code)return;if("EPERM"===n.code)return ki?Ri(e,t,n):ji(e,t,n);if("EISDIR"!==n.code)throw n;ji(e,t,n)}}function ji(e,t,n){Pi(e),Pi(t),n&&Pi(n instanceof Error);try{t.rmdirSync(e)}catch(r){if("ENOTDIR"===r.code)throw n;if("ENOTEMPTY"===r.code||"EEXIST"===r.code||"EPERM"===r.code)!function(e,t){if(Pi(e),Pi(t),t.readdirSync(e).forEach((n=>Li(Bi.join(e,n),t))),!ki){return t.rmdirSync(e,t)}{const n=Date.now();do{try{return t.rmdirSync(e,t)}catch(e){}}while(Date.now()-n<500)}}(e,t);else if("ENOENT"!==r.code)throw r}}var $i=Ni;Ni.sync=Li;const Hi=$i;var Ji={remove:(0,yo.fromCallback)(Hi),removeSync:Hi.sync};const Gi=yo.fromCallback,Vi=we,Ui=p.default,Wi=Io,zi=Ji,Ki=Gi((function(e,t){t=t||function(){},Vi.readdir(e,((n,r)=>{if(n)return Wi.mkdirs(e,t);r=r.map((t=>Ui.join(e,t))),function e(){const n=r.pop();if(!n)return t();zi.remove(n,(n=>{if(n)return t(n);e()}))}()}))}));function qi(e){let t;try{t=Vi.readdirSync(e)}catch(t){return Wi.mkdirsSync(e)}t.forEach((t=>{t=Ui.join(e,t),zi.removeSync(t)}))}var Yi={emptyDirSync:qi,emptydirSync:qi,emptyDir:Ki,emptydir:Ki};const Xi=yo.fromCallback,Zi=p.default,Qi=we,es=Io,ts=fi.pathExists;var ns={createFile:Xi((function(e,t){function n(){Qi.writeFile(e,"",(e=>{if(e)return t(e);t()}))}Qi.stat(e,((r,u)=>{if(!r&&u.isFile())return t();const o=Zi.dirname(e);ts(o,((e,r)=>e?t(e):r?n():void es.mkdirs(o,(e=>{if(e)return t(e);n()}))))}))})),createFileSync:function(e){let t;try{t=Qi.statSync(e)}catch(e){}if(t&&t.isFile())return;const n=Zi.dirname(e);Qi.existsSync(n)||es.mkdirsSync(n),Qi.writeFileSync(e,"")}};const rs=yo.fromCallback,us=p.default,os=we,is=Io,ss=fi.pathExists;var cs={createLink:rs((function(e,t,n){function r(e,t){os.link(e,t,(e=>{if(e)return n(e);n(null)}))}ss(t,((u,o)=>u?n(u):o?n(null):void os.lstat(e,(u=>{if(u)return u.message=u.message.replace("lstat","ensureLink"),n(u);const o=us.dirname(t);ss(o,((u,i)=>u?n(u):i?r(e,t):void is.mkdirs(o,(u=>{if(u)return n(u);r(e,t)}))))}))))})),createLinkSync:function(e,t){if(os.existsSync(t))return;try{os.lstatSync(e)}catch(e){throw e.message=e.message.replace("lstat","ensureLink"),e}const n=us.dirname(t);return os.existsSync(n)||is.mkdirsSync(n),os.linkSync(e,t)}};const as=p.default,ls=we,fs=fi.pathExists;var ds={symlinkPaths:function(e,t,n){if(as.isAbsolute(e))return ls.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:e})));{const r=as.dirname(t),u=as.join(r,e);return fs(u,((t,o)=>t?n(t):o?n(null,{toCwd:u,toDst:e}):ls.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:as.relative(r,e)})))))}},symlinkPathsSync:function(e,t){let n;if(as.isAbsolute(e)){if(n=ls.existsSync(e),!n)throw new Error("absolute srcpath does not exist");return{toCwd:e,toDst:e}}{const r=as.dirname(t),u=as.join(r,e);if(n=ls.existsSync(u),n)return{toCwd:u,toDst:e};if(n=ls.existsSync(e),!n)throw new Error("relative srcpath does not exist");return{toCwd:e,toDst:as.relative(r,e)}}}};const Ds=we;var ps={symlinkType:function(e,t,n){if(n="function"==typeof t?t:n,t="function"!=typeof t&&t)return n(null,t);Ds.lstat(e,((e,r)=>{if(e)return n(null,"file");t=r&&r.isDirectory()?"dir":"file",n(null,t)}))},symlinkTypeSync:function(e,t){let n;if(t)return t;try{n=Ds.lstatSync(e)}catch(e){return"file"}return n&&n.isDirectory()?"dir":"file"}};const Es=yo.fromCallback,ms=p.default,hs=we,ys=Io.mkdirs,Cs=Io.mkdirsSync,Fs=ds.symlinkPaths,gs=ds.symlinkPathsSync,As=ps.symlinkType,vs=ps.symlinkTypeSync,Ss=fi.pathExists;var ws={createSymlink:Es((function(e,t,n,r){r="function"==typeof n?n:r,n="function"!=typeof n&&n,Ss(t,((u,o)=>u?r(u):o?r(null):void Fs(e,t,((u,o)=>{if(u)return r(u);e=o.toDst,As(o.toCwd,n,((n,u)=>{if(n)return r(n);const o=ms.dirname(t);Ss(o,((n,i)=>n?r(n):i?hs.symlink(e,t,u,r):void ys(o,(n=>{if(n)return r(n);hs.symlink(e,t,u,r)}))))}))}))))})),createSymlinkSync:function(e,t,n){if(hs.existsSync(t))return;const r=gs(e,t);e=r.toDst,n=vs(r.toCwd,n);const u=ms.dirname(t);return hs.existsSync(u)||Cs(u),hs.symlinkSync(e,t,n)}};var Os,bs={createFile:ns.createFile,createFileSync:ns.createFileSync,ensureFile:ns.createFile,ensureFileSync:ns.createFileSync,createLink:cs.createLink,createLinkSync:cs.createLinkSync,ensureLink:cs.createLink,ensureLinkSync:cs.createLinkSync,createSymlink:ws.createSymlink,createSymlinkSync:ws.createSymlinkSync,ensureSymlink:ws.createSymlink,ensureSymlinkSync:ws.createSymlinkSync};try{Os=we}catch(e){Os=D.default}function _s(e,t){var n,r="\n";return"object"==typeof t&&null!==t&&(t.spaces&&(n=t.spaces),t.EOL&&(r=t.EOL)),JSON.stringify(e,t?t.replacer:null,n).replace(/\n/g,r)+r}function Bs(e){return Buffer.isBuffer(e)&&(e=e.toString("utf8")),e=e.replace(/^\uFEFF/,"")}var Ps={readFile:function(e,t,n){null==n&&(n=t,t={}),"string"==typeof t&&(t={encoding:t});var r=(t=t||{}).fs||Os,u=!0;"throws"in t&&(u=t.throws),r.readFile(e,t,(function(r,o){if(r)return n(r);var i;o=Bs(o);try{i=JSON.parse(o,t?t.reviver:null)}catch(t){return u?(t.message=e+": "+t.message,n(t)):n(null,null)}n(null,i)}))},readFileSync:function(e,t){"string"==typeof(t=t||{})&&(t={encoding:t});var n=t.fs||Os,r=!0;"throws"in t&&(r=t.throws);try{var u=n.readFileSync(e,t);return u=Bs(u),JSON.parse(u,t.reviver)}catch(t){if(r)throw t.message=e+": "+t.message,t;return null}},writeFile:function(e,t,n,r){null==r&&(r=n,n={});var u=(n=n||{}).fs||Os,o="";try{o=_s(t,n)}catch(e){return void(r&&r(e,null))}u.writeFile(e,o,n,r)},writeFileSync:function(e,t,n){var r=(n=n||{}).fs||Os,u=_s(t,n);return r.writeFileSync(e,u,n)}},ks=Ps;const xs=yo.fromCallback,Ns=ks;var Is={readJson:xs(Ns.readFile),readJsonSync:Ns.readFileSync,writeJson:xs(Ns.writeFile),writeJsonSync:Ns.writeFileSync};const Ts=p.default,Rs=Io,Ms=fi.pathExists,Ls=Is;var js=function(e,t,n,r){"function"==typeof n&&(r=n,n={});const u=Ts.dirname(e);Ms(u,((o,i)=>o?r(o):i?Ls.writeJson(e,t,n,r):void Rs.mkdirs(u,(u=>{if(u)return r(u);Ls.writeJson(e,t,n,r)}))))};const $s=we,Hs=p.default,Js=Io,Gs=Is;var Vs=function(e,t,n){const r=Hs.dirname(e);$s.existsSync(r)||Js.mkdirsSync(r),Gs.writeJsonSync(e,t,n)};const Us=yo.fromCallback,Ws=Is;Ws.outputJson=Us(js),Ws.outputJsonSync=Vs,Ws.outputJSON=Ws.outputJson,Ws.outputJSONSync=Ws.outputJsonSync,Ws.writeJSON=Ws.writeJson,Ws.writeJSONSync=Ws.writeJsonSync,Ws.readJSON=Ws.readJson,Ws.readJSONSync=Ws.readJsonSync;var zs=Ws;const Ks=we,qs=p.default,Ys=ci.copySync,Xs=Ji.removeSync,Zs=Io.mkdirpSync,Qs=Zo;function ec(e,t,n){try{Ks.renameSync(e,t)}catch(r){if("EXDEV"!==r.code)throw r;return function(e,t,n){const r={overwrite:n,errorOnExist:!0};return Ys(e,t,r),Xs(e)}(e,t,n)}}var tc=function(e,t,n){const r=(n=n||{}).overwrite||n.clobber||!1,{srcStat:u}=Qs.checkPathsSync(e,t,"move");return Qs.checkParentPathsSync(e,u,t,"move"),Zs(qs.dirname(t)),function(e,t,n){if(n)return Xs(t),ec(e,t,n);if(Ks.existsSync(t))throw new Error("dest already exists.");return ec(e,t,n)}(e,t,r)},nc={moveSync:tc};const rc=we,uc=p.default,oc=bi.copy,ic=Ji.remove,sc=Io.mkdirp,cc=fi.pathExists,ac=Zo;function lc(e,t,n,r){rc.rename(e,t,(u=>u?"EXDEV"!==u.code?r(u):function(e,t,n,r){const u={overwrite:n,errorOnExist:!0};oc(e,t,u,(t=>t?r(t):ic(e,r)))}(e,t,n,r):r()))}var fc=function(e,t,n,r){"function"==typeof n&&(r=n,n={});const u=n.overwrite||n.clobber||!1;ac.checkPaths(e,t,"move",((n,o)=>{if(n)return r(n);const{srcStat:i}=o;ac.checkParentPaths(e,i,t,"move",(n=>{if(n)return r(n);sc(uc.dirname(t),(n=>n?r(n):function(e,t,n,r){if(n)return ic(t,(u=>u?r(u):lc(e,t,n,r)));cc(t,((u,o)=>u?r(u):o?r(new Error("dest already exists.")):lc(e,t,n,r)))}(e,t,u,r)))}))}))};var dc={move:(0,yo.fromCallback)(fc)};const Dc=yo.fromCallback,pc=we,Ec=p.default,mc=Io,hc=fi.pathExists;var yc={outputFile:Dc((function(e,t,n,r){"function"==typeof n&&(r=n,n="utf8");const u=Ec.dirname(e);hc(u,((o,i)=>o?r(o):i?pc.writeFile(e,t,n,r):void mc.mkdirs(u,(u=>{if(u)return r(u);pc.writeFile(e,t,n,r)}))))})),outputFileSync:function(e,...t){const n=Ec.dirname(e);if(pc.existsSync(n))return pc.writeFileSync(e,...t);mc.mkdirsSync(n),pc.writeFileSync(e,...t)}};!function(e){e.exports=Object.assign({},ho,ci,bi,Yi,bs,zs,Io,nc,dc,yc,fi,Ji);const t=D.default;Object.getOwnPropertyDescriptor(t,"promises")&&Object.defineProperty(e.exports,"promises",{get:()=>t.promises})}(mo);const Cc=Nr.exports("streamroller:fileNameFormatter"),Fc=p.default;const gc=Nr.exports("streamroller:fileNameParser"),Ac=nu.exports;const vc=Nr.exports("streamroller:moveAndMaybeCompressFile"),Sc=mo.exports,wc=v.default;var Oc=async(e,t,n)=>{if(n=function(e){const t={mode:parseInt("0600",8),compress:!1},n=Object.assign({},t,e);return vc(`_parseOption: moveAndMaybeCompressFile called with option=${JSON.stringify(n)}`),n}(n),e!==t){if(await Sc.pathExists(e))if(vc(`moveAndMaybeCompressFile: moving file from ${e} to ${t} ${n.compress?"with":"without"} compress`),n.compress)await new Promise(((r,u)=>{let o=!1;const i=Sc.createWriteStream(t,{mode:n.mode,flags:"wx"}).on("open",(()=>{o=!0;const t=Sc.createReadStream(e).on("open",(()=>{t.pipe(wc.createGzip()).pipe(i)})).on("error",(t=>{vc(`moveAndMaybeCompressFile: error reading ${e}`,t),i.destroy(t)}))})).on("finish",(()=>{vc(`moveAndMaybeCompressFile: finished compressing ${t}, deleting ${e}`),Sc.unlink(e).then(r).catch((t=>{vc(`moveAndMaybeCompressFile: error deleting ${e}, truncating instead`,t),Sc.truncate(e).then(r).catch((t=>{vc(`moveAndMaybeCompressFile: error truncating ${e}`,t),u(t)}))}))})).on("error",(e=>{o?(vc(`moveAndMaybeCompressFile: error writing ${t}, deleting`,e),Sc.unlink(t).then((()=>{u(e)})).catch((e=>{vc(`moveAndMaybeCompressFile: error deleting ${t}`,e),u(e)}))):(vc(`moveAndMaybeCompressFile: error creating ${t}`,e),u(e))}))})).catch((()=>{}));else{vc(`moveAndMaybeCompressFile: renaming ${e} to ${t}`);try{await Sc.move(e,t,{overwrite:!0})}catch(n){if(vc(`moveAndMaybeCompressFile: error renaming ${e} to ${t}`,n),"ENOENT"!==n.code){vc("moveAndMaybeCompressFile: trying copy+truncate instead");try{await Sc.copy(e,t,{overwrite:!0}),await Sc.truncate(e)}catch(e){vc("moveAndMaybeCompressFile: error copy+truncate",e)}}}}}else vc("moveAndMaybeCompressFile: source and target are the same, not doing anything")};const bc=Nr.exports("streamroller:RollingFileWriteStream"),_c=mo.exports,Bc=p.default,Pc=E.default,kc=()=>new Date,xc=nu.exports,{Writable:Nc}=C.default,Ic=({file:e,keepFileExt:t,needsIndex:n,alwaysIncludeDate:r,compress:u,fileNameSep:o})=>{let i=o||".";const s=Fc.join(e.dir,e.name),c=t=>t+e.ext,a=(e,t,r)=>!n&&r||!t?e:e+i+t,l=(e,t,n)=>(t>0||r)&&n?e+i+n:e,f=(e,t)=>t&&u?e+".gz":e,d=t?[l,a,c,f]:[c,l,a,f];return({date:e,index:t})=>(Cc(`_formatFileName: date=${e}, index=${t}`),d.reduce(((n,r)=>r(n,t,e)),s))},Tc=({file:e,keepFileExt:t,pattern:n,fileNameSep:r})=>{let u=r||".";const o="__NOT_MATCHING__";let i=[(e,t)=>e.endsWith(".gz")?(gc("it is gzipped"),t.isCompressed=!0,e.slice(0,-1*".gz".length)):e,t?t=>t.startsWith(e.name)&&t.endsWith(e.ext)?(gc("it starts and ends with the right things"),t.slice(e.name.length+1,-1*e.ext.length)):o:t=>t.startsWith(e.base)?(gc("it starts with the right things"),t.slice(e.base.length+1)):o,n?(e,t)=>{const r=e.split(u);let o=r[r.length-1];gc("items: ",r,", indexStr: ",o);let i=e;void 0!==o&&o.match(/^\d+$/)?(i=e.slice(0,-1*(o.length+1)),gc(`dateStr is ${i}`),n&&!i&&(i=o,o="0")):o="0";try{const r=Ac.parse(n,i,new Date(0,0));return Ac.asString(n,r)!==i?e:(t.index=parseInt(o,10),t.date=i,t.timestamp=r.getTime(),"")}catch(t){return gc(`Problem parsing ${i} as ${n}, error was: `,t),e}}:(e,t)=>e.match(/^\d+$/)?(gc("it has an index"),t.index=parseInt(e,10),""):e];return e=>{let t={filename:e,index:0,isCompressed:!1};return i.reduce(((e,n)=>n(e,t)),e)?null:t}},Rc=Oc;var Mc=class extends Nc{constructor(e,t){if(bc(`constructor: creating RollingFileWriteStream. path=${e}`),"string"!=typeof e||0===e.length)throw new Error(`Invalid filename: ${e}`);if(e.endsWith(Bc.sep))throw new Error(`Filename is a directory: ${e}`);0===e.indexOf(`~${Bc.sep}`)&&(e=e.replace("~",Pc.homedir())),super(t),this.options=this._parseOption(t),this.fileObject=Bc.parse(e),""===this.fileObject.dir&&(this.fileObject=Bc.parse(Bc.join(process.cwd(),e))),this.fileFormatter=Ic({file:this.fileObject,alwaysIncludeDate:this.options.alwaysIncludePattern,needsIndex:this.options.maxSize 0`)}else delete n.maxSize;if(n.numBackups||0===n.numBackups){if(n.numBackups<0)throw new Error(`options.numBackups (${n.numBackups}) should be >= 0`);if(n.numBackups>=Number.MAX_SAFE_INTEGER)throw new Error(`options.numBackups (${n.numBackups}) should be < Number.MAX_SAFE_INTEGER`);n.numToKeep=n.numBackups+1}else if(n.numToKeep<=0)throw new Error(`options.numToKeep (${n.numToKeep}) should be > 0`);return bc(`_parseOption: creating stream with option=${JSON.stringify(n)}`),n}_final(e){this.currentFileStream.end("",this.options.encoding,e)}_write(e,t,n){this._shouldRoll().then((()=>{bc(`_write: writing chunk. file=${this.currentFileStream.path} state=${JSON.stringify(this.state)} chunk=${e}`),this.currentFileStream.write(e,t,(t=>{this.state.currentSize+=e.length,n(t)}))}))}async _shouldRoll(){(this._dateChanged()||this._tooBig())&&(bc(`_shouldRoll: rolling because dateChanged? ${this._dateChanged()} or tooBig? ${this._tooBig()}`),await this._roll())}_dateChanged(){return this.state.currentDate&&this.state.currentDate!==xc(this.options.pattern,kc())}_tooBig(){return this.state.currentSize>=this.options.maxSize}_roll(){return bc("_roll: closing the current stream"),new Promise(((e,t)=>{this.currentFileStream.end("",this.options.encoding,(()=>{this._moveOldFiles().then(e).catch(t)}))}))}async _moveOldFiles(){const e=await this._getExistingFiles();for(let t=(this.state.currentDate?e.filter((e=>e.date===this.state.currentDate)):e).length;t>=0;t--){bc(`_moveOldFiles: i = ${t}`);const e=this.fileFormatter({date:this.state.currentDate,index:t}),n=this.fileFormatter({date:this.state.currentDate,index:t+1}),r={compress:this.options.compress&&0===t,mode:this.options.mode};await Rc(e,n,r)}this.state.currentSize=0,this.state.currentDate=this.state.currentDate?xc(this.options.pattern,kc()):null,bc(`_moveOldFiles: finished rolling files. state=${JSON.stringify(this.state)}`),this._renewWriteStream(),await new Promise(((e,t)=>{this.currentFileStream.write("","utf8",(()=>{this._clean().then(e).catch(t)}))}))}async _getExistingFiles(){const e=await _c.readdir(this.fileObject.dir).catch((()=>[]));bc(`_getExistingFiles: files=${e}`);const t=e.map((e=>this.fileNameParser(e))).filter((e=>e)),n=e=>(e.timestamp?e.timestamp:kc().getTime())-e.index;return t.sort(((e,t)=>n(e)-n(t))),t}_renewWriteStream(){const e=this.fileFormatter({date:this.state.currentDate,index:0}),t=e=>{try{return _c.mkdirSync(e,{recursive:!0})}catch(n){if("ENOENT"===n.code)return t(Bc.dirname(e)),t(e);if("EEXIST"!==n.code&&"EROFS"!==n.code)throw n;try{if(_c.statSync(e).isDirectory())return e;throw n}catch(e){throw n}}};t(this.fileObject.dir);const n={flags:this.options.flags,encoding:this.options.encoding,mode:this.options.mode};var r,u;_c.appendFileSync(e,"",(r={...n},u="flags",r["flag"]=r[u],delete r[u],r)),this.currentFileStream=_c.createWriteStream(e,n),this.currentFileStream.on("error",(e=>{this.emit("error",e)}))}async _clean(){const e=await this._getExistingFiles();if(bc(`_clean: numToKeep = ${this.options.numToKeep}, existingFiles = ${e.length}`),bc("_clean: existing files are: ",e),this._tooManyFiles(e.length)){const n=e.slice(0,e.length-this.options.numToKeep).map((e=>Bc.format({dir:this.fileObject.dir,base:e.filename})));await(t=n,bc(`deleteFiles: files to delete: ${t}`),Promise.all(t.map((e=>_c.unlink(e).catch((t=>{bc(`deleteFiles: error when unlinking ${e}, ignoring. Error was ${t}`)}))))))}var t}_tooManyFiles(e){return this.options.numToKeep>0&&e>this.options.numToKeep}};const Lc=Mc;var jc=class extends Lc{constructor(e,t,n,r){r||(r={}),t&&(r.maxSize=t),r.numBackups||0===r.numBackups||(n||0===n||(n=1),r.numBackups=n),super(e,r),this.backups=r.numBackups,this.size=this.options.maxSize}get theStream(){return this.currentFileStream}};const $c=Mc;var Hc={RollingFileWriteStream:Mc,RollingFileStream:jc,DateRollingFileStream:class extends $c{constructor(e,t,n){t&&"object"==typeof t&&(n=t,t=null),n||(n={}),t||(t="yyyy-MM-dd"),n.pattern=t,n.numBackups||0===n.numBackups?n.daysToKeep=n.numBackups:(n.daysToKeep||0===n.daysToKeep?process.emitWarning("options.daysToKeep is deprecated due to the confusion it causes when used together with file size rolling. Please use options.numBackups instead.","DeprecationWarning","streamroller-DEP0001"):n.daysToKeep=1,n.numBackups=n.daysToKeep),super(e,n),this.mode=this.options.mode}get theStream(){return this.currentFileStream}}};const Jc=Nr.exports("log4js:file"),Gc=p.default,Vc=Hc,Uc=E.default.EOL;let Wc=!1;const zc=new Set;function Kc(){zc.forEach((e=>{e.sighupHandler()}))}function qc(e,t,n,r){const u=new Vc.RollingFileStream(e,t,n,r);return u.on("error",(t=>{console.error("log4js.fileAppender - Writing to file %s, error happened ",e,t)})),u.on("drain",(()=>{process.emit("log4js:pause",!1)})),u}Eo.configure=function(e,t){let n=t.basicLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),e.mode=e.mode||384,function(e,t,n,r,u,o){e=Gc.normalize(e),Jc("Creating file appender (",e,", ",n,", ",r=r||0===r?r:5,", ",u,", ",o,")");let i=qc(e,n,r,u);const s=function(e){if(i.writable){if(!0===u.removeColor){const t=/\x1b[[0-9;]*m/g;e.data=e.data.map((e=>"string"==typeof e?e.replace(t,""):e))}i.write(t(e,o)+Uc,"utf8")||process.emit("log4js:pause",!0)}};return s.reopen=function(){i.end((()=>{i=qc(e,n,r,u)}))},s.sighupHandler=function(){Jc("SIGHUP handler called."),s.reopen()},s.shutdown=function(e){zc.delete(s),0===zc.size&&Wc&&(process.removeListener("SIGHUP",Kc),Wc=!1),i.end("","utf-8",e)},zc.add(s),Wc||(process.on("SIGHUP",Kc),Wc=!0),s}(e.filename,n,e.maxLogSize,e.backups,e,e.timezoneOffset)};var Yc={};const Xc=Hc,Zc=E.default.EOL;function Qc(e,t,n,r,u){r.maxSize=r.maxLogSize;const o=function(e,t,n){const r=new Xc.DateRollingFileStream(e,t,n);return r.on("error",(t=>{console.error("log4js.dateFileAppender - Writing to file %s, error happened ",e,t)})),r.on("drain",(()=>{process.emit("log4js:pause",!1)})),r}(e,t,r),i=function(e){o.writable&&(o.write(n(e,u)+Zc,"utf8")||process.emit("log4js:pause",!0))};return i.shutdown=function(e){o.end("","utf-8",e)},i}Yc.configure=function(e,t){let n=t.basicLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),e.alwaysIncludePattern||(e.alwaysIncludePattern=!1),e.mode=e.mode||384,Qc(e.filename,e.pattern,n,e,e.timezoneOffset)};var ea={};const ta=Nr.exports("log4js:fileSync"),na=p.default,ra=D.default,ua=E.default.EOL||"\n";function oa(e,t){if(ra.existsSync(e))return;const n=ra.openSync(e,t.flags,t.mode);ra.closeSync(n)}class ia{constructor(e,t,n,r){ta("In RollingFileStream"),function(){if(!e||!t||t<=0)throw new Error("You must specify a filename and file size")}(),this.filename=e,this.size=t,this.backups=n,this.options=r,this.currentSize=0,this.currentSize=function(e){let t=0;try{t=ra.statSync(e).size}catch(t){oa(e,r)}return t}(this.filename)}shouldRoll(){return ta("should roll with current size %d, and max size %d",this.currentSize,this.size),this.currentSize>=this.size}roll(e){const t=this,n=new RegExp(`^${na.basename(e)}`);function r(e){return n.test(e)}function u(t){return parseInt(t.substring(`${na.basename(e)}.`.length),10)||0}function o(e,t){return u(e)>u(t)?1:u(e) ${e}.${r+1}`),ra.renameSync(na.join(na.dirname(e),n),`${e}.${r+1}`)}}ta("Rolling, rolling, rolling"),ta("Renaming the old files"),ra.readdirSync(na.dirname(e)).filter(r).sort(o).reverse().forEach(i)}write(e,t){const n=this;ta("in write"),this.shouldRoll()&&(this.currentSize=0,this.roll(this.filename)),ta("writing the chunk to the file"),n.currentSize+=e.length,ra.appendFileSync(n.filename,e)}}ea.configure=function(e,t){let n=t.basicLayout;e.layout&&(n=t.layout(e.layout.type,e.layout));const r={flags:e.flags||"a",encoding:e.encoding||"utf8",mode:e.mode||384};return function(e,t,n,r,u,o){ta("fileSync appender created");const i=function(e,t,n){let r;var u;return t?r=new ia(e,t,n,o):(oa(u=e,o),r={write(e){ra.appendFileSync(u,e)}}),r}(e=na.normalize(e),n,r=r||0===r?r:5);return e=>{i.write(t(e,u)+ua)}}(e.filename,n,e.maxLogSize,e.backups,e.timezoneOffset,r)};var sa={};const ca=Nr.exports("log4js:tcp"),aa=S.default;sa.configure=function(e,t){ca(`configure with config = ${e}`);let n=function(e){return e.serialise()};return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){let n=!1;const r=[];let u,o=3,i="__LOG4JS__";function s(e){ca("Writing log event to socket"),n=u.write(`${t(e)}${i}`,"utf8")}function c(){let e;for(ca("emptying buffer");e=r.shift();)s(e)}function a(e){n?s(e):(ca("buffering log event because it cannot write at the moment"),r.push(e))}return function t(){ca(`appender creating socket to ${e.host||"localhost"}:${e.port||5e3}`),i=`${e.endMsg||"__LOG4JS__"}`,u=aa.createConnection(e.port||5e3,e.host||"localhost"),u.on("connect",(()=>{ca("socket connected"),c(),n=!0})),u.on("drain",(()=>{ca("drain event received, emptying buffer"),n=!0,c()})),u.on("timeout",u.end.bind(u)),u.on("error",(e=>{ca("connection error",e),n=!1,c()})),u.on("close",t)}(),a.shutdown=function(e){ca("shutdown called"),r.length&&o?(ca("buffer has items, waiting 100ms to empty"),o-=1,setTimeout((()=>{a.shutdown(e)}),100)):(u.removeAllListeners("close"),u.end(e))},a}(e,n)};const la=p.default,fa=Nr.exports("log4js:appenders"),da=tu,Da=eo,pa=gu,Ea=hu,ma=to,ha=new Map;ha.set("console",oo),ha.set("stdout",so),ha.set("stderr",co),ha.set("logLevelFilter",ao),ha.set("categoryFilter",lo),ha.set("noLogFilter",Do),ha.set("file",Eo),ha.set("dateFile",Yc),ha.set("fileSync",ea),ha.set("tcp",sa);const ya=new Map,Ca=(e,t)=>{fa("Loading module from ",e);try{return require(e)}catch(n){return void da.throwExceptionIf(t,"MODULE_NOT_FOUND"!==n.code,`appender "${e}" could not be loaded (error was: ${n})`)}},Fa=new Set,ga=(e,t)=>{if(ya.has(e))return ya.get(e);if(!t.appenders[e])return!1;if(Fa.has(e))throw new Error(`Dependency loop detected for appender ${e}.`);Fa.add(e),fa(`Creating appender ${e}`);const n=Aa(e,t);return Fa.delete(e),ya.set(e,n),n},Aa=(e,t)=>{const n=t.appenders[e],r=n.type.configure?n.type:((e,t)=>ha.get(e)||Ca(`./${e}`,t)||Ca(e,t)||require.main&&Ca(la.join(la.dirname(require.main.filename),e),t)||Ca(la.join(process.cwd(),e),t))(n.type,t);return da.throwExceptionIf(t,da.not(r),`appender "${e}" is not valid (type "${n.type}" could not be found)`),r.appender&&fa(`DEPRECATION: Appender ${n.type} exports an appender function.`),r.shutdown&&fa(`DEPRECATION: Appender ${n.type} exports a shutdown function.`),fa(`${e}: clustering.isMaster ? ${Da.isMaster()}`),fa(`${e}: appenderModule is ${F.default.inspect(r)}`),Da.onlyOnMaster((()=>(fa(`calling appenderModule.configure for ${e} / ${n.type}`),r.configure(ma.modifyConfig(n),Ea,(e=>ga(e,t)),pa))),(()=>{}))},va=e=>{ya.clear(),Fa.clear();const t=[];Object.values(e.categories).forEach((e=>{t.push(...e.appenders)})),Object.keys(e.appenders).forEach((n=>{(t.includes(n)||"tcp-server"===e.appenders[n].type)&&ga(n,e)}))},Sa=()=>{va({appenders:{out:{type:"stdout"}},categories:{default:{appenders:["out"],level:"trace"}}})};Sa(),da.addListener((e=>{da.throwExceptionIf(e,da.not(da.anObject(e.appenders)),'must have a property "appenders" of type object.');const t=Object.keys(e.appenders);da.throwExceptionIf(e,da.not(t.length),"must define at least one appender."),t.forEach((t=>{da.throwExceptionIf(e,da.not(e.appenders[t].type),`appender "${t}" is not valid (must be an object with property "type")`)}))})),da.addListener(va),Au.exports=ya,Au.exports.init=Sa;var wa={exports:{}};!function(e){const t=Nr.exports("log4js:categories"),n=tu,r=gu,u=Au.exports,o=new Map;function i(e,t,n){if(!1===t.inherit)return;const r=n.lastIndexOf(".");if(r<0)return;const u=n.substring(0,r);let o=e.categories[u];o||(o={inherit:!0,appenders:[]}),i(e,o,u),!e.categories[u]&&o.appenders&&o.appenders.length&&o.level&&(e.categories[u]=o),t.appenders=t.appenders||[],t.level=t.level||o.level,o.appenders.forEach((e=>{t.appenders.includes(e)||t.appenders.push(e)})),t.parent=o}function s(e){if(!e.categories)return;Object.keys(e.categories).forEach((t=>{const n=e.categories[t];i(e,n,t)}))}n.addPreProcessingListener((e=>s(e))),n.addListener((e=>{n.throwExceptionIf(e,n.not(n.anObject(e.categories)),'must have a property "categories" of type object.');const t=Object.keys(e.categories);n.throwExceptionIf(e,n.not(t.length),"must define at least one category."),t.forEach((t=>{const o=e.categories[t];n.throwExceptionIf(e,[n.not(o.appenders),n.not(o.level)],`category "${t}" is not valid (must be an object with properties "appenders" and "level")`),n.throwExceptionIf(e,n.not(Array.isArray(o.appenders)),`category "${t}" is not valid (appenders must be an array of appender names)`),n.throwExceptionIf(e,n.not(o.appenders.length),`category "${t}" is not valid (appenders must contain at least one appender name)`),Object.prototype.hasOwnProperty.call(o,"enableCallStack")&&n.throwExceptionIf(e,"boolean"!=typeof o.enableCallStack,`category "${t}" is not valid (enableCallStack must be boolean type)`),o.appenders.forEach((r=>{n.throwExceptionIf(e,n.not(u.get(r)),`category "${t}" is not valid (appender "${r}" is not defined)`)})),n.throwExceptionIf(e,n.not(r.getLevel(o.level)),`category "${t}" is not valid (level "${o.level}" not recognised; valid levels are ${r.levels.join(", ")})`)})),n.throwExceptionIf(e,n.not(e.categories.default),'must define a "default" category.')}));const c=e=>{o.clear();Object.keys(e.categories).forEach((n=>{const i=e.categories[n],s=[];i.appenders.forEach((e=>{s.push(u.get(e)),t(`Creating category ${n}`),o.set(n,{appenders:s,level:r.getLevel(i.level),enableCallStack:i.enableCallStack||!1})}))}))},a=()=>{c({categories:{default:{appenders:["out"],level:"OFF"}}})};a(),n.addListener(c);const l=e=>(t(`configForCategory: searching for config for ${e}`),o.has(e)?(t(`configForCategory: ${e} exists in config, returning it`),o.get(e)):e.indexOf(".")>0?(t(`configForCategory: ${e} has hierarchy, searching for parents`),l(e.substring(0,e.lastIndexOf(".")))):(t("configForCategory: returning config for default category"),l("default")));e.exports=o,e.exports=Object.assign(e.exports,{appendersForCategory:e=>l(e).appenders,getLevelForCategory:e=>l(e).level,setLevelForCategory:(e,n)=>{let r=o.get(e);if(t(`setLevelForCategory: found ${r} for ${e}`),!r){const n=l(e);t(`setLevelForCategory: no config found for category, found ${n} for parents of ${e}`),r={appenders:n.appenders}}r.level=n,o.set(e,r)},getEnableCallStackForCategory:e=>!0===l(e).enableCallStack,setEnableCallStackForCategory:(e,t)=>{l(e).enableCallStack=t},init:a})}(wa);const Oa=Nr.exports("log4js:logger"),ba=Hu,_a=gu,Ba=eo,Pa=wa.exports,ka=tu,xa=/at (?:(.+)\s+\()?(?:(.+?):(\d+)(?::(\d+))?|([^)]+))\)?/;function Na(e,t=4){const n=e.stack.split("\n").slice(t),r=xa.exec(n[0]);return r&&6===r.length?{functionName:r[1],fileName:r[2],lineNumber:parseInt(r[3],10),columnNumber:parseInt(r[4],10),callStack:n.join("\n")}:null}class Ia{constructor(e){if(!e)throw new Error("No category provided.");this.category=e,this.context={},this.parseCallStack=Na,Oa(`Logger created (${this.category}, ${this.level})`)}get level(){return _a.getLevel(Pa.getLevelForCategory(this.category),_a.TRACE)}set level(e){Pa.setLevelForCategory(this.category,_a.getLevel(e,this.level))}get useCallStack(){return Pa.getEnableCallStackForCategory(this.category)}set useCallStack(e){Pa.setEnableCallStackForCategory(this.category,!0===e)}log(e,...t){let n=_a.getLevel(e);n||(this._log(_a.WARN,"log4js:logger.log: invalid value for log-level as first parameter given: ",e),n=_a.INFO),this.isLevelEnabled(n)&&this._log(n,t)}isLevelEnabled(e){return this.level.isLessThanOrEqualTo(e)}_log(e,t){Oa(`sending log data (${e}) to appenders`);const n=new ba(this.category,e,t,this.context,this.useCallStack&&this.parseCallStack(new Error));Ba.send(n)}addContext(e,t){this.context[e]=t}removeContext(e){delete this.context[e]}clearContext(){this.context={}}setParseCallStackFunction(e){this.parseCallStack=e}}function Ta(e){const t=_a.getLevel(e),n=t.toString().toLowerCase().replace(/_([a-z])/g,(e=>e[1].toUpperCase())),r=n[0].toUpperCase()+n.slice(1);Ia.prototype[`is${r}Enabled`]=function(){return this.isLevelEnabled(t)},Ia.prototype[n]=function(...e){this.log(t,...e)}}_a.levels.forEach(Ta),ka.addListener((()=>{_a.levels.forEach(Ta)}));var Ra=Ia;const Ma=gu;function La(e){return e.originalUrl||e.url}function ja(e,t){for(let n=0;ne.source?e.source:e));t=new RegExp(n.join("|"))}return t}(t.nolog);return(e,i,s)=>{if(e._logging)return s();if(o&&o.test(e.originalUrl))return s();if(n.isLevelEnabled(r)||"auto"===t.level){const o=new Date,{writeHead:s}=i;e._logging=!0,i.writeHead=(e,t)=>{i.writeHead=s,i.writeHead(e,t),i.__statusCode=e,i.__headers=t||{}},i.on("finish",(()=>{i.responseTime=new Date-o,i.statusCode&&"auto"===t.level&&(r=Ma.INFO,i.statusCode>=300&&(r=Ma.WARN),i.statusCode>=400&&(r=Ma.ERROR)),r=function(e,t,n){let r=t;if(n){const t=n.find((t=>{let n=!1;return n=t.from&&t.to?e>=t.from&&e<=t.to:-1!==t.codes.indexOf(e),n}));t&&(r=Ma.getLevel(t.level,r))}return r}(i.statusCode,r,t.statusRules);const s=function(e,t,n){const r=[];return r.push({token:":url",replacement:La(e)}),r.push({token:":protocol",replacement:e.protocol}),r.push({token:":hostname",replacement:e.hostname}),r.push({token:":method",replacement:e.method}),r.push({token:":status",replacement:t.__statusCode||t.statusCode}),r.push({token:":response-time",replacement:t.responseTime}),r.push({token:":date",replacement:(new Date).toUTCString()}),r.push({token:":referrer",replacement:e.headers.referer||e.headers.referrer||""}),r.push({token:":http-version",replacement:`${e.httpVersionMajor}.${e.httpVersionMinor}`}),r.push({token:":remote-addr",replacement:e.headers["x-forwarded-for"]||e.ip||e._remoteAddress||e.socket&&(e.socket.remoteAddress||e.socket.socket&&e.socket.socket.remoteAddress)}),r.push({token:":user-agent",replacement:e.headers["user-agent"]}),r.push({token:":content-length",replacement:t.getHeader("content-length")||t.__headers&&t.__headers["Content-Length"]||"-"}),r.push({token:/:req\[([^\]]+)]/g,replacement:(t,n)=>e.headers[n.toLowerCase()]}),r.push({token:/:res\[([^\]]+)]/g,replacement:(e,n)=>t.getHeader(n.toLowerCase())||t.__headers&&t.__headers[n]}),(e=>{const t=e.concat();for(let e=0;eja(e,s)));t&&n.log(r,t)}else n.log(r,ja(u,s));t.context&&n.removeContext("res")}))}return s()}},nl=Va;let rl=!1;function ul(e){if(!rl)return;Ua("Received log event ",e);Za.appendersForCategory(e.categoryName).forEach((t=>{t(e)}))}function ol(e){rl&&il();let t=e;return"string"==typeof t&&(t=function(e){Ua(`Loading configuration from ${e}`);try{return JSON.parse(Wa.readFileSync(e,"utf8"))}catch(t){throw new Error(`Problem reading config from file "${e}". Error was ${t.message}`,t)}}(e)),Ua(`Configuration is ${t}`),Ka.configure(za(t)),el.onMessage(ul),rl=!0,sl}function il(e){Ua("Shutdown called. Disabling all log writing."),rl=!1;const t=Array.from(Xa.values());Xa.init(),Za.init();const n=t.reduceRight(((e,t)=>t.shutdown?e+1:e),0);if(0===n)return Ua("No appenders with shutdown functions found."),void 0!==e&&e();let r,u=0;function o(t){r=r||t,u+=1,Ua(`Appender shutdowns complete: ${u} / ${n}`),u>=n&&(Ua("All shutdown functions completed."),e&&e(r))}return Ua(`Found ${n} appenders with shutdown functions.`),t.filter((e=>e.shutdown)).forEach((e=>e.shutdown(o))),null}const sl={getLogger:function(e){return rl||ol(process.env.LOG4JS_CONFIG||{appenders:{out:{type:"stdout"}},categories:{default:{appenders:["out"],level:"OFF"}}}),new Qa(e||"default")},configure:ol,shutdown:il,connectLogger:tl,levels:Ya,addLayout:qa.addLayout,recording:function(){return nl}};var cl=sl,al={};Object.defineProperty(al,"__esModule",{value:!0}),al.levelMap=al.getLevel=al.setCategoriesLevel=al.getConfiguration=al.setConfiguration=void 0;const ll=cl;let fl={appenders:{debug:{type:"stdout",layout:{type:"pattern",pattern:"[%d] > hvigor %p %c %[%m%]"}},info:{type:"stdout",layout:{type:"pattern",pattern:"[%d] > hvigor %[%m%]"}},"no-pattern-info":{type:"stdout",layout:{type:"pattern",pattern:"%m"}},wrong:{type:"stderr",layout:{type:"pattern",pattern:"[%d] > hvigor %[%p: %m%]"}},"just-debug":{type:"logLevelFilter",appender:"debug",level:"debug",maxLevel:"debug"},"just-info":{type:"logLevelFilter",appender:"info",level:"info",maxLevel:"info"},"just-wrong":{type:"logLevelFilter",appender:"wrong",level:"warn",maxLevel:"error"}},categories:{default:{appenders:["just-debug","just-info","just-wrong"],level:"debug"},"no-pattern-info":{appenders:["no-pattern-info"],level:"info"}}};al.setConfiguration=e=>{fl=e};al.getConfiguration=()=>fl;let dl=ll.levels.DEBUG;al.setCategoriesLevel=(e,t)=>{dl=e;const n=fl.categories;for(const r in n)(null==t?void 0:t.includes(r))||Object.prototype.hasOwnProperty.call(n,r)&&(n[r].level=e.levelStr)};al.getLevel=()=>dl,al.levelMap=new Map([["ALL",ll.levels.ALL],["MARK",ll.levels.MARK],["TRACE",ll.levels.TRACE],["DEBUG",ll.levels.DEBUG],["INFO",ll.levels.INFO],["WARN",ll.levels.WARN],["ERROR",ll.levels.ERROR],["FATAL",ll.levels.FATAL],["OFF",ll.levels.OFF]]);var Dl=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),pl=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),El=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&Dl(t,e,n);return pl(t,e),t};Object.defineProperty(xr,"__esModule",{value:!0}),xr.evaluateLogLevel=xr.HvigorLogger=void 0;const ml=El(cl),hl=cl,yl=El(F.default),Cl=al;class Fl{constructor(e){ml.configure((0,Cl.getConfiguration)()),this._logger=ml.getLogger(e),this._logger.level=(0,Cl.getLevel)()}static getLogger(e){return new Fl(e)}log(e,...t){this._logger.log(e,...t)}debug(e,...t){this._logger.debug(e,...t)}info(e,...t){this._logger.info(e,...t)}warn(e,...t){void 0!==e&&""!==e&&this._logger.warn(e,...t)}error(e,...t){this._logger.error(e,...t)}_printTaskExecuteInfo(e,t){this.info(`Finished :${e}... after ${t}`)}_printFailedTaskInfo(e){this.error(`Failed :${e}... `)}_printDisabledTaskInfo(e){this.info(`Disabled :${e}... `)}_printUpToDateTaskInfo(e){this.info(`UP-TO-DATE :${e}... `)}errorMessageExit(e,...t){throw new Error(yl.format(e,...t))}errorExit(e,t,...n){t&&this._logger.error(t,n),this._logger.error(e.stack)}setLevel(e,t){(0,Cl.setCategoriesLevel)(e,t),ml.shutdown(),ml.configure((0,Cl.getConfiguration)())}getLevel(){return this._logger.level}configure(e){const t=(0,Cl.getConfiguration)(),n={appenders:{...t.appenders,...e.appenders},categories:{...t.categories,...e.categories}};(0,Cl.setConfiguration)(n),ml.shutdown(),ml.configure(n)}}xr.HvigorLogger=Fl,xr.evaluateLogLevel=function(e,t){t.debug?e.setLevel(hl.levels.DEBUG):t.warn?e.setLevel(hl.levels.WARN):t.error?e.setLevel(hl.levels.ERROR):e.setLevel(hl.levels.INFO)};var gl=w&&w.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(X,"__esModule",{value:!0}),X.parseJsonText=X.parseJsonFile=void 0;const Al=Z,vl=gl(kr),Sl=gl(p.default),wl=gl(E.default),Ol=xr.HvigorLogger.getLogger("parse-json-util");var bl;!function(e){e[e.Char=0]="Char",e[e.EOF=1]="EOF",e[e.Identifier=2]="Identifier"}(bl||(bl={}));let _l,Bl,Pl,kl,xl,Nl,Il="start",Tl=[],Rl=0,Ml=1,Ll=0,jl=!1,$l="default",Hl="'",Jl=1;function Gl(e,t=!1){Bl=String(e),Il="start",Tl=[],Rl=0,Ml=1,Ll=0,kl=void 0,jl=t;do{_l=Vl(),Xl[Il]()}while("eof"!==_l.type);return kl}function Vl(){for($l="default",xl="",Hl="'",Jl=1;;){Nl=Ul();const e=zl[$l]();if(e)return e}}function Ul(){if(Bl[Rl])return String.fromCodePoint(Bl.codePointAt(Rl))}function Wl(){const e=Ul();return"\n"===e?(Ml++,Ll=0):e?Ll+=e.length:Ll++,e&&(Rl+=e.length),e}X.parseJsonFile=function(e,t=!1,n="utf-8"){const r=vl.default.readFileSync(Sl.default.resolve(e),{encoding:n});try{return Gl(r,t)}catch(t){if(t instanceof SyntaxError){const n=t.message.split("at");2===n.length&&Ol.errorMessageExit(`${n[0].trim()}${wl.default.EOL}\t at ${e}:${n[1].trim()}`)}Ol.errorMessageExit(`${e} is not in valid JSON/JSON5 format.`)}},X.parseJsonText=Gl;const zl={default(){switch(Nl){case"/":return Wl(),void($l="comment");case void 0:return Wl(),Kl("eof")}if(!Al.JudgeUtil.isIgnoreChar(Nl)&&!Al.JudgeUtil.isSpaceSeparator(Nl))return zl[Il]();Wl()},start(){$l="value"},beforePropertyName(){switch(Nl){case"$":case"_":return xl=Wl(),void($l="identifierName");case"\\":return Wl(),void($l="identifierNameStartEscape");case"}":return Kl("punctuator",Wl());case'"':case"'":return Hl=Nl,Wl(),void($l="string")}if(Al.JudgeUtil.isIdStartChar(Nl))return xl+=Wl(),void($l="identifierName");throw tf(bl.Char,Wl())},afterPropertyName(){if(":"===Nl)return Kl("punctuator",Wl());throw tf(bl.Char,Wl())},beforePropertyValue(){$l="value"},afterPropertyValue(){switch(Nl){case",":case"}":return Kl("punctuator",Wl())}throw tf(bl.Char,Wl())},beforeArrayValue(){if("]"===Nl)return Kl("punctuator",Wl());$l="value"},afterArrayValue(){switch(Nl){case",":case"]":return Kl("punctuator",Wl())}throw tf(bl.Char,Wl())},end(){throw tf(bl.Char,Wl())},comment(){switch(Nl){case"*":return Wl(),void($l="multiLineComment");case"/":return Wl(),void($l="singleLineComment")}throw tf(bl.Char,Wl())},multiLineComment(){switch(Nl){case"*":return Wl(),void($l="multiLineCommentAsterisk");case void 0:throw tf(bl.Char,Wl())}Wl()},multiLineCommentAsterisk(){switch(Nl){case"*":return void Wl();case"/":return Wl(),void($l="default");case void 0:throw tf(bl.Char,Wl())}Wl(),$l="multiLineComment"},singleLineComment(){switch(Nl){case"\n":case"\r":case"\u2028":case"\u2029":return Wl(),void($l="default");case void 0:return Wl(),Kl("eof")}Wl()},value(){switch(Nl){case"{":case"[":return Kl("punctuator",Wl());case"n":return Wl(),ql("ull"),Kl("null",null);case"t":return Wl(),ql("rue"),Kl("boolean",!0);case"f":return Wl(),ql("alse"),Kl("boolean",!1);case"-":case"+":return"-"===Wl()&&(Jl=-1),void($l="numerical");case".":case"0":case"I":case"N":return void($l="numerical");case'"':case"'":return Hl=Nl,Wl(),xl="",void($l="string")}if(void 0===Nl||!Al.JudgeUtil.isDigitWithoutZero(Nl))throw tf(bl.Char,Wl());$l="numerical"},numerical(){switch(Nl){case".":return xl=Wl(),void($l="decimalPointLeading");case"0":return xl=Wl(),void($l="zero");case"I":return Wl(),ql("nfinity"),Kl("numeric",Jl*(1/0));case"N":return Wl(),ql("aN"),Kl("numeric",NaN)}if(void 0!==Nl&&Al.JudgeUtil.isDigitWithoutZero(Nl))return xl=Wl(),void($l="decimalInteger");throw tf(bl.Char,Wl())},zero(){switch(Nl){case".":case"e":case"E":return void($l="decimal");case"x":case"X":return xl+=Wl(),void($l="hexadecimal")}return Kl("numeric",0)},decimalInteger(){switch(Nl){case".":case"e":case"E":return void($l="decimal")}if(!Al.JudgeUtil.isDigit(Nl))return Kl("numeric",Jl*Number(xl));xl+=Wl()},decimal(){switch(Nl){case".":xl+=Wl(),$l="decimalFraction";break;case"e":case"E":xl+=Wl(),$l="decimalExponent"}},decimalPointLeading(){if(Al.JudgeUtil.isDigit(Nl))return xl+=Wl(),void($l="decimalFraction");throw tf(bl.Char,Wl())},decimalFraction(){switch(Nl){case"e":case"E":return xl+=Wl(),void($l="decimalExponent")}if(!Al.JudgeUtil.isDigit(Nl))return Kl("numeric",Jl*Number(xl));xl+=Wl()},decimalExponent(){switch(Nl){case"+":case"-":return xl+=Wl(),void($l="decimalExponentSign")}if(Al.JudgeUtil.isDigit(Nl))return xl+=Wl(),void($l="decimalExponentInteger");throw tf(bl.Char,Wl())},decimalExponentSign(){if(Al.JudgeUtil.isDigit(Nl))return xl+=Wl(),void($l="decimalExponentInteger");throw tf(bl.Char,Wl())},decimalExponentInteger(){if(!Al.JudgeUtil.isDigit(Nl))return Kl("numeric",Jl*Number(xl));xl+=Wl()},hexadecimal(){if(Al.JudgeUtil.isHexDigit(Nl))return xl+=Wl(),void($l="hexadecimalInteger");throw tf(bl.Char,Wl())},hexadecimalInteger(){if(!Al.JudgeUtil.isHexDigit(Nl))return Kl("numeric",Jl*Number(xl));xl+=Wl()},identifierNameStartEscape(){if("u"!==Nl)throw tf(bl.Char,Wl());Wl();const e=Yl();switch(e){case"$":case"_":break;default:if(!Al.JudgeUtil.isIdStartChar(e))throw tf(bl.Identifier)}xl+=e,$l="identifierName"},identifierName(){switch(Nl){case"$":case"_":case"‌":case"‍":return void(xl+=Wl());case"\\":return Wl(),void($l="identifierNameEscape")}if(!Al.JudgeUtil.isIdContinueChar(Nl))return Kl("identifier",xl);xl+=Wl()},identifierNameEscape(){if("u"!==Nl)throw tf(bl.Char,Wl());Wl();const e=Yl();switch(e){case"$":case"_":case"‌":case"‍":break;default:if(!Al.JudgeUtil.isIdContinueChar(e))throw tf(bl.Identifier)}xl+=e,$l="identifierName"},string(){switch(Nl){case"\\":return Wl(),void(xl+=function(){const e=Ul(),t=function(){switch(Ul()){case"b":return Wl(),"\b";case"f":return Wl(),"\f";case"n":return Wl(),"\n";case"r":return Wl(),"\r";case"t":return Wl(),"\t";case"v":return Wl(),"\v"}return}();if(t)return t;switch(e){case"0":if(Wl(),Al.JudgeUtil.isDigit(Ul()))throw tf(bl.Char,Wl());return"\0";case"x":return Wl(),function(){let e="",t=Ul();if(!Al.JudgeUtil.isHexDigit(t))throw tf(bl.Char,Wl());if(e+=Wl(),t=Ul(),!Al.JudgeUtil.isHexDigit(t))throw tf(bl.Char,Wl());return e+=Wl(),String.fromCodePoint(parseInt(e,16))}();case"u":return Wl(),Yl();case"\n":case"\u2028":case"\u2029":return Wl(),"";case"\r":return Wl(),"\n"===Ul()&&Wl(),""}if(void 0===e||Al.JudgeUtil.isDigitWithoutZero(e))throw tf(bl.Char,Wl());return Wl()}());case'"':case"'":if(Nl===Hl){const e=Kl("string",xl);return Wl(),e}return void(xl+=Wl());case"\n":case"\r":case void 0:throw tf(bl.Char,Wl());case"\u2028":case"\u2029":!function(e){Ol.warn(`JSON5: '${ef(e)}' in strings is not valid ECMAScript; consider escaping.`)}(Nl)}xl+=Wl()}};function Kl(e,t){return{type:e,value:t,line:Ml,column:Ll}}function ql(e){for(const t of e){if(Ul()!==t)throw tf(bl.Char,Wl());Wl()}}function Yl(){let e="",t=4;for(;t-- >0;){const t=Ul();if(!Al.JudgeUtil.isHexDigit(t))throw tf(bl.Char,Wl());e+=Wl()}return String.fromCodePoint(parseInt(e,16))}const Xl={start(){if("eof"===_l.type)throw tf(bl.EOF);Zl()},beforePropertyName(){switch(_l.type){case"identifier":case"string":return Pl=_l.value,void(Il="afterPropertyName");case"punctuator":return void Ql();case"eof":throw tf(bl.EOF)}},afterPropertyName(){if("eof"===_l.type)throw tf(bl.EOF);Il="beforePropertyValue"},beforePropertyValue(){if("eof"===_l.type)throw tf(bl.EOF);Zl()},afterPropertyValue(){if("eof"===_l.type)throw tf(bl.EOF);switch(_l.value){case",":return void(Il="beforePropertyName");case"}":Ql()}},beforeArrayValue(){if("eof"===_l.type)throw tf(bl.EOF);"punctuator"!==_l.type||"]"!==_l.value?Zl():Ql()},afterArrayValue(){if("eof"===_l.type)throw tf(bl.EOF);switch(_l.value){case",":return void(Il="beforeArrayValue");case"]":Ql()}},end(){}};function Zl(){const e=function(){let e;switch(_l.type){case"punctuator":switch(_l.value){case"{":e={};break;case"[":e=[]}break;case"null":case"boolean":case"numeric":case"string":e=_l.value}return e}();if(jl&&"object"==typeof e&&(e._line=Ml,e._column=Ll),void 0===kl)kl=e;else{const t=Tl[Tl.length-1];Array.isArray(t)?jl&&"object"!=typeof e?t.push({value:e,_line:Ml,_column:Ll}):t.push(e):t[Pl]=jl&&"object"!=typeof e?{value:e,_line:Ml,_column:Ll}:e}!function(e){if(e&&"object"==typeof e)Tl.push(e),Il=Array.isArray(e)?"beforeArrayValue":"beforePropertyName";else{const e=Tl[Tl.length-1];Il=e?Array.isArray(e)?"afterArrayValue":"afterPropertyValue":"end"}}(e)}function Ql(){Tl.pop();const e=Tl[Tl.length-1];Il=e?Array.isArray(e)?"afterArrayValue":"afterPropertyValue":"end"}function ef(e){const t={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(t[e])return t[e];if(e<" "){const t=e.charCodeAt(0).toString(16);return`\\x${`00${t}`.substring(t.length)}`}return e}function tf(e,t){let n="";switch(e){case bl.Char:n=void 0===t?`JSON5: invalid end of input at ${Ml}:${Ll}`:`JSON5: invalid character '${ef(t)}' at ${Ml}:${Ll}`;break;case bl.EOF:n=`JSON5: invalid end of input at ${Ml}:${Ll}`;break;case bl.Identifier:Ll-=5,n=`JSON5: invalid identifier character at ${Ml}:${Ll}`}const r=new nf(n);return r.lineNumber=Ml,r.columnNumber=Ll,r}class nf extends SyntaxError{}var rf=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),uf=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),of=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&rf(t,e,n);return uf(t,e),t};Object.defineProperty(Y,"__esModule",{value:!0});var sf=Y.cleanWorkSpace=Ff=Y.executeInstallHvigor=yf=Y.isHvigorInstalled=mf=Y.isAllDependenciesInstalled=void 0;const cf=of(D.default),af=of(p.default),lf=b,ff=j,df=$,Df=X;let pf,Ef;var mf=Y.isAllDependenciesInstalled=function(){function e(e){const t=null==e?void 0:e.dependencies;return void 0===t?0:Object.getOwnPropertyNames(t).length}if(pf=gf(),Ef=Af(),e(pf)+1!==e(Ef))return!1;for(const e in null==pf?void 0:pf.dependencies)if(!(0,ff.hasNpmPackInPaths)(e,[lf.HVIGOR_PROJECT_DEPENDENCIES_HOME])||!hf(e,pf,Ef))return!1;return!0};function hf(e,t,n){return void 0!==n.dependencies&&(0,ff.offlinePluginConversion)(lf.HVIGOR_PROJECT_ROOT_DIR,t.dependencies[e])===n.dependencies[e]}var yf=Y.isHvigorInstalled=function(){return pf=gf(),Ef=Af(),(0,ff.hasNpmPackInPaths)(lf.HVIGOR_ENGINE_PACKAGE_NAME,[lf.HVIGOR_PROJECT_DEPENDENCIES_HOME])&&(0,ff.offlinePluginConversion)(lf.HVIGOR_PROJECT_ROOT_DIR,pf.hvigorVersion)===Ef.dependencies[lf.HVIGOR_ENGINE_PACKAGE_NAME]};const Cf={cwd:lf.HVIGOR_PROJECT_DEPENDENCIES_HOME,stdio:["inherit","inherit","inherit"]};var Ff=Y.executeInstallHvigor=function(){(0,df.logInfoPrintConsole)("Hvigor installing...");const e={dependencies:{}};e.dependencies[lf.HVIGOR_ENGINE_PACKAGE_NAME]=(0,ff.offlinePluginConversion)(lf.HVIGOR_PROJECT_ROOT_DIR,pf.hvigorVersion);try{cf.mkdirSync(lf.HVIGOR_PROJECT_DEPENDENCIES_HOME,{recursive:!0});const t=af.resolve(lf.HVIGOR_PROJECT_DEPENDENCIES_HOME,lf.DEFAULT_PACKAGE_JSON);cf.writeFileSync(t,JSON.stringify(e))}catch(e){(0,df.logErrorAndExit)(e)}!function(){const e=["config","set","store-dir",lf.HVIGOR_PNPM_STORE_PATH];(0,ff.executeCommand)(lf.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH,e,Cf)}(),(0,ff.executeCommand)(lf.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH,["install"],Cf)};function gf(){const e=af.resolve(lf.HVIGOR_PROJECT_WRAPPER_HOME,lf.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME);return cf.existsSync(e)||(0,df.logErrorAndExit)(`Error: Hvigor config file ${e} does not exist.`),(0,Df.parseJsonFile)(e)}function Af(){return cf.existsSync(lf.HVIGOR_PROJECT_DEPENDENCY_PACKAGE_JSON_PATH)?(0,Df.parseJsonFile)(lf.HVIGOR_PROJECT_DEPENDENCY_PACKAGE_JSON_PATH):{dependencies:{}}}sf=Y.cleanWorkSpace=function(){if((0,df.logInfoPrintConsole)("Hvigor cleaning..."),!cf.existsSync(lf.HVIGOR_PROJECT_DEPENDENCIES_HOME))return;const e=cf.readdirSync(lf.HVIGOR_PROJECT_DEPENDENCIES_HOME);if(e&&0!==e.length){cf.existsSync(lf.HVIGOR_BOOT_JS_FILE_PATH)&&(0,ff.executeCommand)(process.argv[0],[lf.HVIGOR_BOOT_JS_FILE_PATH,"--stop-daemon"],{});try{e.forEach((e=>{cf.rmSync(af.resolve(lf.HVIGOR_PROJECT_DEPENDENCIES_HOME,e),{recursive:!0})}))}catch(e){(0,df.logErrorAndExit)(`The hvigor build tool cannot be installed. Please manually clear the workspace directory and synchronize the project again.\n\n Workspace Path: ${lf.HVIGOR_PROJECT_DEPENDENCIES_HOME}.`)}}};var vf={},Sf=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),wf=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Of=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&Sf(t,e,n);return wf(t,e),t};Object.defineProperty(vf,"__esModule",{value:!0});var bf=vf.executeBuild=void 0;const _f=b,Bf=Of(D.default),Pf=Of(p.default),kf=$;bf=vf.executeBuild=function(){const e=Pf.resolve(_f.HVIGOR_PROJECT_DEPENDENCIES_HOME,"node_modules","@ohos","hvigor","bin","hvigor.js");try{const t=Bf.realpathSync(e);require(t)}catch(t){(0,kf.logErrorAndExit)(`Error: ENOENT: no such file ${e},delete ${_f.HVIGOR_PROJECT_DEPENDENCIES_HOME} and retry.`)}},function(){if(O.checkNpmConifg(),O.environmentHandler(),O.isPnpmAvailable()||O.executeInstallPnpm(),yf()&&mf())bf();else{sf();try{Ff()}catch(e){return void sf()}bf()}}(); \ No newline at end of file diff --git a/ohos/test_sqflite_common/ohos/hvigorfile.ts b/ohos/test_sqflite_common/ohos/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..5a172b770e3b15f67c12152d00f38f2084d3915b --- /dev/null +++ b/ohos/test_sqflite_common/ohos/hvigorfile.ts @@ -0,0 +1,17 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently. +export { appTasks } from '@ohos/hvigor-ohos-plugin'; \ No newline at end of file diff --git a/ohos/test_sqflite_common/ohos/hvigorw b/ohos/test_sqflite_common/ohos/hvigorw new file mode 100755 index 0000000000000000000000000000000000000000..5efd8343d3232bdd1d9b7f67a3326034054c5396 --- /dev/null +++ b/ohos/test_sqflite_common/ohos/hvigorw @@ -0,0 +1,61 @@ +#!/bin/bash + +# Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# ---------------------------------------------------------------------------- +# Hvigor startup script, version 1.0.0 +# +# Required ENV vars: +# ------------------ +# NODE_HOME - location of a Node home dir +# or +# Add /usr/local/nodejs/bin to the PATH environment variable +# ---------------------------------------------------------------------------- + +HVIGOR_APP_HOME=$(dirname $(readlink -f $0)) +HVIGOR_WRAPPER_SCRIPT=${HVIGOR_APP_HOME}/hvigor/hvigor-wrapper.js +warn() { + echo "" + echo -e "\033[1;33m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m" +} + +error() { + echo "" + echo -e "\033[1;31m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m" +} + +fail() { + error "$@" + exit 1 +} + +# Determine node to start hvigor wrapper script +if [ -n "${NODE_HOME}" ];then + EXECUTABLE_NODE="${NODE_HOME}/bin/node" + if [ ! -x "$EXECUTABLE_NODE" ];then + fail "ERROR: NODE_HOME is set to an invalid directory,check $NODE_HOME\n\nPlease set NODE_HOME in your environment to the location where your nodejs installed" + fi +else + EXECUTABLE_NODE="node" + which ${EXECUTABLE_NODE} > /dev/null 2>&1 || fail "ERROR: NODE_HOME is not set and not 'node' command found in your path" +fi + +# Check hvigor wrapper script +if [ ! -r "$HVIGOR_WRAPPER_SCRIPT" ];then + fail "ERROR: Couldn't find hvigor/hvigor-wrapper.js in ${HVIGOR_APP_HOME}" +fi + +# start hvigor-wrapper script +exec "${EXECUTABLE_NODE}" \ + "${HVIGOR_WRAPPER_SCRIPT}" "$@" diff --git a/ohos/test_sqflite_common/ohos/hvigorw.bat b/ohos/test_sqflite_common/ohos/hvigorw.bat new file mode 100644 index 0000000000000000000000000000000000000000..6861293e47dfd0186da380321b73be9033507e24 --- /dev/null +++ b/ohos/test_sqflite_common/ohos/hvigorw.bat @@ -0,0 +1,64 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Hvigor startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +set WRAPPER_MODULE_PATH=%APP_HOME%\hvigor\hvigor-wrapper.js +set NODE_EXE=node.exe + +goto start + +:start +@rem Find node.exe +if defined NODE_HOME goto findNodeFromNodeHome + +%NODE_EXE% --version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH. +echo. +echo Please set the NODE_HOME variable in your environment to match the +echo location of your NodeJs installation. + +goto fail + +:findNodeFromNodeHome +set NODE_HOME=%NODE_HOME:"=% +set NODE_EXE_PATH=%NODE_HOME%/%NODE_EXE% + +if exist "%NODE_EXE_PATH%" goto execute +echo. +echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH. +echo. +echo Please set the NODE_HOME variable in your environment to match the +echo location of your NodeJs installation. + +goto fail + +:execute +@rem Execute hvigor +"%NODE_EXE%" %WRAPPER_MODULE_PATH% %* + +if "%ERRORLEVEL%" == "0" goto hvigorwEnd + +:fail +exit /b 1 + +:hvigorwEnd +if "%OS%" == "Windows_NT" endlocal + +:end diff --git a/ohos/test_sqflite_common/ohos/oh-package.json5 b/ohos/test_sqflite_common/ohos/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..a2408ea9cb7b309e6ad95e27a4c8b88985ae57c6 --- /dev/null +++ b/ohos/test_sqflite_common/ohos/oh-package.json5 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +{ + "name": "apptemplate", + "version": "1.0.0", + "description": "Please describe the basic information.", + "main": "", + "author": "", + "license": "", + "dependencies": { + }, + "devDependencies": { + "@ohos/hypium": "1.0.6" + } +} diff --git a/ohos/test_sqflite_common/pubspec.yaml b/ohos/test_sqflite_common/pubspec.yaml new file mode 100644 index 0000000000000000000000000000000000000000..46d50b9548b614d99dc017b729de35f2a37e6a45 --- /dev/null +++ b/ohos/test_sqflite_common/pubspec.yaml @@ -0,0 +1,14 @@ +name: test_sqflite_common +description: A new Flutter project. +publish_to: 'none' +version: 1.0.0 +environment: + sdk: '>=2.12.0 <3.0.0' + +dependencies: + flutter: + sdk: flutter + sqflite_common: 2.4.5+1 +flutter: + uses-material-design: true + \ No newline at end of file