diff --git a/MultiDeviceMusic-army/AppScope/app.json5 b/MultiDeviceMusic-army/AppScope/app.json5 new file mode 100644 index 0000000000000000000000000000000000000000..b15abf3bfa0ec81ca58e5acb283cf42c2aa43035 --- /dev/null +++ b/MultiDeviceMusic-army/AppScope/app.json5 @@ -0,0 +1,10 @@ +{ + "app": { + "bundleName": "com.huawei.music.musichome", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name" + } +} diff --git a/MultiDeviceMusic-army/AppScope/resources/base/element/string.json b/MultiDeviceMusic-army/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..562b83dcb451a703d7801fca79630fb36fca8c6d --- /dev/null +++ b/MultiDeviceMusic-army/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "MusicHome" + } + ] +} diff --git a/MultiDeviceMusic-army/AppScope/resources/base/media/app_icon.png b/MultiDeviceMusic-army/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/MultiDeviceMusic-army/AppScope/resources/base/media/app_icon.png differ diff --git a/MultiDeviceMusic-army/LICENSE b/MultiDeviceMusic-army/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..0210352ae2ade0dd7b4c841cb6e8ba08b4780038 --- /dev/null +++ b/MultiDeviceMusic-army/LICENSE @@ -0,0 +1,78 @@ + Copyright (c) 2023 Huawei Device Co., Ltd. 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. + +Apache License, Version 2.0 +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. + +"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. + +2. Grant of Copyright License. + +Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. + +Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. + +You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: +1.You must give any other recipients of the Work or Derivative Works a copy of this License; and +2.You must cause any modified files to carry prominent notices stating that You changed the files; and +3.You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and +4.If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. + +You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. + +5. Submission of Contributions. + +Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. + +6. Trademarks. + +This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. + +Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. + +In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. + +While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/MultiDeviceMusic-army/README.md b/MultiDeviceMusic-army/README.md new file mode 100644 index 0000000000000000000000000000000000000000..78117ccc37750dae0a49df6c5b09a910536deea9 --- /dev/null +++ b/MultiDeviceMusic-army/README.md @@ -0,0 +1,46 @@ +# 一次开发,多端部署-音乐专辑(ArkTS) + +### 简介 +基于自适应和响应式布局,实现一次开发、多端部署音乐专辑页面。 + +手机效果图如下: + +![](screenshots/device/music.gif) +![](screenshots/device/music.mp4) + +![](screenshots/device/AlbumSM.png) + +折叠屏效果图如下: + +![](screenshots/device/AlbumMD.png) + +平板效果图如下: + +![](screenshots/device/AlbumLG.png) + +### 相关概念 +- [一次开发,多端部署](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/harmonyos-features-0000000000011907#section35241557442):一套代码工程,一次开发上架,多端按需部署。支撑开发者快速高效的开发支持多种终端设备形态的应用,实现对不同设备兼容的同时,提供跨设备的流转、迁移和协同的分布式体验。 +- 自适应布局:当外部容器大小发生变化时,元素可以根据相对关系自动变化以适应外部容器变化的布局能力。相对关系如占比、固定宽高比、显示优先级等。当前自适应布局有4种:[线性布局](https://developer.harmonyos.com/cn/docs/documentation/doc-guides-V3/arkts-layout-development-linear-0000001504125349-V3?catalogVersion=V3&ha_linker=eyJ0cyI6MTY5MDg5MzczNjczMiwiaWQiOiI4ZjRmOTI2ZTdjOWViNGVlZjc5MmQ5MTczOWFiMzU3MyJ9)、[层叠布局](https://developer.harmonyos.com/cn/docs/documentation/doc-guides-V3/arkts-layout-development-stack-layout-0000001454605342-V3?catalogVersion=V3)、[弹性布局](https://developer.harmonyos.com/cn/docs/documentation/doc-guides-V3/arkts-layout-development-flex-layout-0000001504525013-V3?catalogVersion=V3)、[相对布局](https://developer.harmonyos.com/cn/docs/documentation/doc-guides-V3/arkts-layout-development-relative-layout-0000001455042516-V3?catalogVersion=V3)。自适应布局能力可以实现界面显示随外部容器大小连续变化。 +- 响应式布局:当外部容器大小发生变化时,元素可以根据断点、栅格或特定的特征(如屏幕方向、窗口宽高等)自动变化以适应外部容器变化的布局能力。当前响应式布局能力有2种:[媒体查询](https://developer.harmonyos.com/cn/docs/documentation/doc-guides-V3/arkts-layout-development-media-query-0000001454445606-V3?catalogVersion=V3)、[栅格布局](https://developer.harmonyos.com/cn/docs/documentation/doc-guides-V3/arkts-layout-development-grid-layout-0000001454765270-V3?catalogVersion=V3)。 +- [GridRow](https://developer.harmonyos.com/cn/docs/documentation/doc-references-V3/ts-container-gridrow-0000001478181425-V3?ha_linker=eyJ0cyI6MTY5MDg5MzgzOTg5MywiaWQiOiI4ZjRmOTI2ZTdjOWViNGVlZjc5MmQ5MTczOWFiMzU3MyJ9):栅格容器组件,仅可以和栅格子组件(GridCol)在栅格布局场景中使用。 +- [GridCol](https://developer.harmonyos.com/cn/docs/documentation/doc-references-V3/ts-container-gridcol-0000001427744832-V3):栅格子组件,必须作为栅格容器组件(GridRow)的子组件使用。 + +### 相关权限 + +本篇Codelab需要添加以下权限: + +- ohos.permission.KEEP_BACKGROUND_RUNNING + +### 使用说明 + +1. 分别在手机、折叠屏、平板安装并打开应用,不同设备的应用页面通过响应式布局和自适应布局呈现不同的效果。 +2. 点击界面上播放/暂停、上一首、下一首图标控制音乐播放功能。 +3. 点击界面上播放控制区空白处或列表歌曲跳转到播放页面。 +4. 点击界面上评论按钮跳转到对应的评论页面。 +5. 其他按钮无实际点击事件或功能。 + +### 约束与限制 + +1. 本示例仅支持标准系统上运行,支持设备:华为手机或运行在DevEco Studio上的华为手机设备模拟器。 +2. 本示例为Stage模型,支持API version 9及以上版本SDK。 +3. 本示例需要使用DevEco Studio 3.1 Release及以上版本进行编译运行。 \ No newline at end of file diff --git a/MultiDeviceMusic-army/build-profile.json5 b/MultiDeviceMusic-army/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..96efac4d6758725b945574595f06cac13f3a5e1a --- /dev/null +++ b/MultiDeviceMusic-army/build-profile.json5 @@ -0,0 +1,97 @@ +{ + "app": { + "signingConfigs": [ + { + "name": "default", + "type": "HarmonyOS", + "material": { + "certpath": "C:\\Users\\armyq\\.ohos\\config\\auto_debug_MultiDeviceMusic_com.huawei.music.musichome_260086000308369315.cer", + "storePassword": "0000001BCAF1D9BC0E882E3CC61E4C572AF097220FC046ABFD6F14765C5718E9C44263BDC543753267727D", + "keyAlias": "debugKey", + "keyPassword": "0000001B617A96E50B40B7547A42B2569495233ADF0AC1DF6E8FEAE4F6D4A3130396135EAD3C024B1EABFE", + "profile": "C:\\Users\\armyq\\.ohos\\config\\auto_debug_MultiDeviceMusic_com.huawei.music.musichome_260086000308369315.p7b", + "signAlg": "SHA256withECDSA", + "storeFile": "C:\\Users\\armyq\\.ohos\\config\\auto_debug_MultiDeviceMusic_com.huawei.music.musichome_260086000308369315.p12" + } + } + ], + "compileSdkVersion": 9, + "compatibleSdkVersion": 9, + "products": [ + { + "name": "default", + "signingConfig": "default" + } + ] + }, + "modules": [ + { + "name": "phone", + "srcPath": "./products/phone", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + }, + { + "name": "musicList", + "srcPath": "./musicList", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + }, + { + "name": "musicPlay", + "srcPath": "./musicPlay", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + }, + { + "name": "musicComment", + "srcPath": "./musicComment", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + }, + { + "name": "live", + "srcPath": "./live", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + }, + { + "name": "mediaCommon", + "srcPath": "./common/mediaCommon" + }, + { + "name": "constantsCommon", + "srcPath": "./common/constantsCommon" + } + ] +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/common/constantsCommon/build-profile.json5 b/MultiDeviceMusic-army/common/constantsCommon/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..beb58df23d08691b749b0033ac7a16274671e550 --- /dev/null +++ b/MultiDeviceMusic-army/common/constantsCommon/build-profile.json5 @@ -0,0 +1,11 @@ +{ + "apiType": "stageMode", + "buildOption": { + }, + "targets": [ + { + "name": "default", + "runtimeOS": "HarmonyOS" + } + ] +} diff --git a/MultiDeviceMusic-army/common/constantsCommon/hvigorfile.ts b/MultiDeviceMusic-army/common/constantsCommon/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..47e6e1f81d365872f101585f5dbf816bcad65864 --- /dev/null +++ b/MultiDeviceMusic-army/common/constantsCommon/hvigorfile.ts @@ -0,0 +1,2 @@ +// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently. +export { harTasks } from '@ohos/hvigor-ohos-plugin'; \ No newline at end of file diff --git a/MultiDeviceMusic-army/common/constantsCommon/index.ets b/MultiDeviceMusic-army/common/constantsCommon/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..34f600b659c32f6d199102338a33c627c372634e --- /dev/null +++ b/MultiDeviceMusic-army/common/constantsCommon/index.ets @@ -0,0 +1,5 @@ +export { BreakpointConstants } from '../constantsCommon/src/main/ets/constants/BreakpointConstants'; +export { StyleConstants } from '../constantsCommon/src/main/ets/constants/StyleConstants'; +export { GridConstants } from '../constantsCommon/src/main/ets/constants/GridConstants'; +export { RouterUrlConstants } from '../constantsCommon/src/main/ets/constants/RouterUrlConstants'; +export { SongConstants } from './src/main/ets/constants/SongConstants'; \ No newline at end of file diff --git a/MultiDeviceMusic-army/common/constantsCommon/oh-package.json5 b/MultiDeviceMusic-army/common/constantsCommon/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..d5937de21fffc77ce012c9dbdd87d724cc799f79 --- /dev/null +++ b/MultiDeviceMusic-army/common/constantsCommon/oh-package.json5 @@ -0,0 +1,10 @@ +{ + "license": "Apache-2.0", + "devDependencies": {}, + "author": "", + "name": "constantscommon", + "description": "Please describe the basic information.", + "main": "index.ets", + "version": "1.0.0", + "dependencies": {} +} diff --git a/MultiDeviceMusic-army/common/constantsCommon/src/main/ets/constants/BreakpointConstants.ets b/MultiDeviceMusic-army/common/constantsCommon/src/main/ets/constants/BreakpointConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..e217c903d507f0362fea8a36539583e5a4f0042e --- /dev/null +++ b/MultiDeviceMusic-army/common/constantsCommon/src/main/ets/constants/BreakpointConstants.ets @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2023 Huawei Device 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. + */ + +/** + * Constants for breakpoint. + */ +export class BreakpointConstants { + /** + * Breakpoints that represent small device types. + */ + static readonly BREAKPOINT_SM: string = 'sm'; + + /** + * Breakpoints that represent middle device types. + */ + static readonly BREAKPOINT_MD: string = 'md'; + + /** + * Breakpoints that represent large device types. + */ + static readonly BREAKPOINT_LG: string = 'lg'; + + /** + * The break point value. + */ + static readonly BREAKPOINT_VALUE: Array = ['320vp', '600vp', '840vp']; + + /** + * The number of columns for SM device. + */ + static readonly COLUMN_SM: number = 4; + + /** + * The number of columns for MD device. + */ + static readonly COLUMN_MD: number = 8; + + /** + * The number of columns for LG device. + */ + static readonly COLUMN_LG: number = 12; + + /** + * The number of gutter X for device. + */ + static readonly GUTTER_X: number = 12; + + /** + * The number of span for SM device. + */ + static readonly SPAN_SM: number = 4; + + /** + * The number of span for MD device. + */ + static readonly SPAN_MD: number = 6; + + /** + * The number of span for LG device. + */ + static readonly SPAN_LG: number = 8; + + /** + * The number of offset for MD device. + */ + static readonly OFFSET_MD: number = 1; + + /** + * The number of offset for LG device. + */ + static readonly OFFSET_LG: number = 2; + + /** + * Current breakpoints that to query the device types. + */ + static readonly CURRENT_BREAKPOINT: string = 'currentBreakpoint'; + + /** + * Font size of the small device type. + */ + static readonly FONT_SIZE_SM: number = 14; + + /** + * Font size of the middle device type. + */ + static readonly FONT_SIZE_MD: number = 16; + + /** + * Font size of the large device type. + */ + static readonly FONT_SIZE_LG: number = 18; + + /** + * Cover margin of the small device type. + */ + static readonly COVER_MARGIN_SM: number = 10; + + /** + * Cover margin of the middle device type. + */ + static readonly COVER_MARGIN_MD: number = 30; + + /** + * Cover margin of the large device type. + */ + static readonly COVER_MARGIN_LG: number = 40; + + /** + * Range of the small device width. + */ + static readonly RANGE_SM: string = '(320vp<=width<600vp)'; + + /** + * Range of the middle device width. + */ + static readonly RANGE_MD: string = '(600vp<=width<840vp)'; + + /** + * Range of the large device width. + */ + static readonly RANGE_LG: string = '(840vp<=width)'; +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/common/constantsCommon/src/main/ets/constants/GridConstants.ets b/MultiDeviceMusic-army/common/constantsCommon/src/main/ets/constants/GridConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..c68608c75cbaa23f170d1359c2674e23a3828b65 --- /dev/null +++ b/MultiDeviceMusic-army/common/constantsCommon/src/main/ets/constants/GridConstants.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2023 Huawei Device 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. + */ + +/** + * Constants for Grid components. + */ +export class GridConstants { + /** + * Current component width: 4 grids. + */ + static readonly SPAN_FOUR: number = 4; + + /** + * Current component width: 6 grids. + */ + static readonly SPAN_SIX: number = 6; + + /** + * Current component width: 8 grids. + */ + static readonly SPAN_EIGHT: number = 8; + + /** + * Current component width: 12 grids. + */ + static readonly SPAN_TWELVE: number = 12; +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/common/constantsCommon/src/main/ets/constants/RouterUrlConstants.ets b/MultiDeviceMusic-army/common/constantsCommon/src/main/ets/constants/RouterUrlConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..8c75da86e082ffb48715d710d39eea6c5adeffcb --- /dev/null +++ b/MultiDeviceMusic-army/common/constantsCommon/src/main/ets/constants/RouterUrlConstants.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2023 Huawei Device 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. + */ + +/** + * Routing information on the music page. + */ +export class RouterUrlConstants { + /** + * Playback page. + */ + static readonly MUSIC_PLAY: string = '@bundle:com.huawei.music.musichome/musicPlay/ets/pages/PlayPage'; + + /** + * Music list page. + */ + static readonly MUSIC_LIST: string = '@bundle:com.huawei.music.musichome/musicList/ets/pages/Index'; + + /** + * Music review page. + */ + static readonly MUSIC_COMMENT: string = '@bundle:com.huawei.music.musichome/musicComment/ets/pages/Index'; +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/common/constantsCommon/src/main/ets/constants/SongConstants.ets b/MultiDeviceMusic-army/common/constantsCommon/src/main/ets/constants/SongConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..05801fd0c36b0cacea25801059a6bcb7167c68a4 --- /dev/null +++ b/MultiDeviceMusic-army/common/constantsCommon/src/main/ets/constants/SongConstants.ets @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2023 Huawei Device 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. + */ + +/** + * Constants for common components. + */ +export class SongConstants { + /** + * Song list index add 1. + */ + static readonly ADD_INDEX_ONE: number = 1; + + /** + * Song list index add 2. + */ + static readonly ADD_INDEX_TWO: number = 2; + + /** + * Song list index add 3. + */ + static readonly ADD_INDEX_THREE: number = 3; + + /** + * The slice start is 0. + */ + static readonly SLICE_START_ZERO: number = 0; + + /** + * The slice end is 3. + */ + static readonly SLICE_END_THREE: number = 3; + + /** + * The slice index is 1. + */ + static readonly SLICE_INDEX_ONE: number = 1; + + /** + * The slice index is 2. + */ + static readonly SLICE_INDEX_TWO: number = 2; + + /** + * The slice index is 4. + */ + static readonly SLICE_INDEX_FOUR: number = 4; + + /** + * The form id is no exit. + */ + static readonly ID_NO_EXIT: number = 16501001; + + /** + * The duration of page transition. + */ + static readonly TRANSITION_DURATION: number = 500; +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/common/constantsCommon/src/main/ets/constants/StyleConstants.ets b/MultiDeviceMusic-army/common/constantsCommon/src/main/ets/constants/StyleConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..f526374892f1f2bc8ee56dd1ca6592817e6d74b5 --- /dev/null +++ b/MultiDeviceMusic-army/common/constantsCommon/src/main/ets/constants/StyleConstants.ets @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2023 Huawei Device 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. + */ + +/** + * Constants for common style. + */ +export class StyleConstants { + /** + * Component width percentage: 100%. + */ + static readonly FULL_WIDTH: string = '100%'; + + /** + * Component height percentage: 100%. + */ + static readonly FULL_HEIGHT: string = '100%'; + + /** + * Translate value of the collection text. + */ + static readonly TRANSLATE_X: number = 10; + + /** + * Translate value of the number of playbacks. + */ + static readonly TRANSLATE_Y: string = '-100%'; + + /** + * Translate value of the player area on the bottom. + */ + static readonly TRANSLATE_PLAYER_Y: string = '-48vp'; +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/common/constantsCommon/src/main/module.json5 b/MultiDeviceMusic-army/common/constantsCommon/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..a3d80a3f8e7543468ee31f4caed42dccdb0b919c --- /dev/null +++ b/MultiDeviceMusic-army/common/constantsCommon/src/main/module.json5 @@ -0,0 +1,10 @@ +{ + "module": { + "name": "constantsCommon", + "type": "har", + "deviceTypes": [ + "default", + "tablet" + ] + } +} diff --git a/MultiDeviceMusic-army/common/constantsCommon/src/main/resources/base/element/string.json b/MultiDeviceMusic-army/common/constantsCommon/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..1e76de0c66777cfe83568615c5c2e68c61d23fed --- /dev/null +++ b/MultiDeviceMusic-army/common/constantsCommon/src/main/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "page_show", + "value": "page from npm package" + } + ] +} diff --git a/MultiDeviceMusic-army/common/constantsCommon/src/main/resources/en_US/element/string.json b/MultiDeviceMusic-army/common/constantsCommon/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..1e76de0c66777cfe83568615c5c2e68c61d23fed --- /dev/null +++ b/MultiDeviceMusic-army/common/constantsCommon/src/main/resources/en_US/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "page_show", + "value": "page from npm package" + } + ] +} diff --git a/MultiDeviceMusic-army/common/constantsCommon/src/main/resources/zh_CN/element/string.json b/MultiDeviceMusic-army/common/constantsCommon/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..1e76de0c66777cfe83568615c5c2e68c61d23fed --- /dev/null +++ b/MultiDeviceMusic-army/common/constantsCommon/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "page_show", + "value": "page from npm package" + } + ] +} diff --git a/MultiDeviceMusic-army/common/mediaCommon/build-profile.json5 b/MultiDeviceMusic-army/common/mediaCommon/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..beb58df23d08691b749b0033ac7a16274671e550 --- /dev/null +++ b/MultiDeviceMusic-army/common/mediaCommon/build-profile.json5 @@ -0,0 +1,11 @@ +{ + "apiType": "stageMode", + "buildOption": { + }, + "targets": [ + { + "name": "default", + "runtimeOS": "HarmonyOS" + } + ] +} diff --git a/MultiDeviceMusic-army/common/mediaCommon/hvigorfile.ts b/MultiDeviceMusic-army/common/mediaCommon/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..47e6e1f81d365872f101585f5dbf816bcad65864 --- /dev/null +++ b/MultiDeviceMusic-army/common/mediaCommon/hvigorfile.ts @@ -0,0 +1,2 @@ +// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently. +export { harTasks } from '@ohos/hvigor-ohos-plugin'; \ No newline at end of file diff --git a/MultiDeviceMusic-army/common/mediaCommon/index.ets b/MultiDeviceMusic-army/common/mediaCommon/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..5f9c828228aa67f35d6a7536fe4c5a3a21d83b49 --- /dev/null +++ b/MultiDeviceMusic-army/common/mediaCommon/index.ets @@ -0,0 +1,8 @@ +export { BreakpointSystem, BreakpointType } from './src/main/ets/utils/BreakpointSystem'; +export { MenuData } from './src/main/ets/bean/MenuData'; +export { MediaService } from './src/main/ets/utils/MediaService'; +export { SongItem } from './src/main/ets/bean/SongData'; +export { MusicPlayMode } from './src/main/ets/viewmodel/MusicData'; +export { PreferencesUtil } from './src/main/ets/utils/PreferencesUtil'; +export { Logger } from './src/main/ets/utils/Logger'; +export { MusicList } from './src/main/ets/viewmodel/MusicList'; diff --git a/MultiDeviceMusic-army/common/mediaCommon/oh-package.json5 b/MultiDeviceMusic-army/common/mediaCommon/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..4352ce95c3b559b52eb42574e0252fa68481d9fc --- /dev/null +++ b/MultiDeviceMusic-army/common/mediaCommon/oh-package.json5 @@ -0,0 +1,12 @@ +{ + "license": "Apache-2.0", + "devDependencies": {}, + "author": "", + "name": "mediacommon", + "description": "Please describe the basic information.", + "main": "index.ets", + "version": "1.0.0", + "dependencies": { + "@ohos/constantsCommon": "file:../constantsCommon" + } +} diff --git a/MultiDeviceMusic-army/common/mediaCommon/src/main/ets/bean/CardData.ets b/MultiDeviceMusic-army/common/mediaCommon/src/main/ets/bean/CardData.ets new file mode 100644 index 0000000000000000000000000000000000000000..87a1781382243a16cffb90c2f7d436fdff986e51 --- /dev/null +++ b/MultiDeviceMusic-army/common/mediaCommon/src/main/ets/bean/CardData.ets @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2023 Huawei Device 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 { SongItem } from './SongData'; + +/** + * Card data. + */ +export class CardData { + /** + * The music is playing. + */ + isPlay: boolean; + + /** + * The music name. + */ + musicName: string; + + /** + * The music cover. + */ + musicCover: Resource; + + /** + * The music singer. + */ + musicSinger: string; + + /** + * The song list. + */ + cardSongList: SongItem[]; +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/common/mediaCommon/src/main/ets/bean/MenuData.ets b/MultiDeviceMusic-army/common/mediaCommon/src/main/ets/bean/MenuData.ets new file mode 100644 index 0000000000000000000000000000000000000000..a0c01bee5465b229403aba5b3d3f1b9ca38c691e --- /dev/null +++ b/MultiDeviceMusic-army/common/mediaCommon/src/main/ets/bean/MenuData.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2023 Huawei Device 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. + */ + +/** + * Menu item info. + */ +export class MenuData { + + /** + * Indicates menu title. + */ + value: string; + + /** + * Indicates menu action. + */ + action: () => void; +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/common/mediaCommon/src/main/ets/bean/SongData.ets b/MultiDeviceMusic-army/common/mediaCommon/src/main/ets/bean/SongData.ets new file mode 100644 index 0000000000000000000000000000000000000000..5e75547d0748340253d75dc56bbef2b04210ea0a --- /dev/null +++ b/MultiDeviceMusic-army/common/mediaCommon/src/main/ets/bean/SongData.ets @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2023 Huawei Device 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. + */ + +/** + * Music information entity class. + */ +export class SongItem { + /** + * Primary key ID. + */ + id: number; + + /** + * Music name. + */ + title: string; + + /** + * Music author name. + */ + singer: string; + + /** + * Music logo information. + */ + mark: Resource; + + /** + * Music avatar information. + */ + label: Resource; + + /** + * Music file path information. + */ + src: string; + + /** + * Index of the current music list. + */ + index: number; +} diff --git a/MultiDeviceMusic-army/common/mediaCommon/src/main/ets/utils/BackgroundUtil.ets b/MultiDeviceMusic-army/common/mediaCommon/src/main/ets/utils/BackgroundUtil.ets new file mode 100644 index 0000000000000000000000000000000000000000..b95b6a0262781a87437648beb8ab2cb55f185752 --- /dev/null +++ b/MultiDeviceMusic-army/common/mediaCommon/src/main/ets/utils/BackgroundUtil.ets @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2023 Huawei Device 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 wantAgent from '@ohos.app.ability.wantAgent'; +import backgroundTaskManager from '@ohos.resourceschedule.backgroundTaskManager'; +import common from '@ohos.app.ability.common'; +import { Logger } from './Logger'; + +export class BackgroundUtil { + + /** + * Start background task. + * + * @param context + */ + public static startContinuousTask(context: common.UIAbilityContext): void { + let wantAgentInfo = { + wants: [ + { + bundleName: context.abilityInfo.bundleName, + abilityName: context.abilityInfo.name + } + ], + operationType: wantAgent.OperationType.START_ABILITY, + requestCode: 0, + wantAgentFlags: [wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] + }; + + wantAgent.getWantAgent(wantAgentInfo).then((wantAgentObj) => { + try { + backgroundTaskManager.startBackgroundRunning(context, + backgroundTaskManager.BackgroundMode.AUDIO_PLAYBACK, wantAgentObj).then(() => { + Logger.info('this avPlayer: ', 'startBackgroundRunning succeeded'); + }).catch((err) => { + Logger.error('this avPlayer: ', `startBackgroundRunning failed Cause: ${JSON.stringify(err)}`); + }); + } catch (error) { + Logger.error('this avPlayer: ', `startBackgroundRunning failed. code ${error.code} message ${error.message}`); + } + }); + } + + /** + * Stop background task. + * + * @param context + */ + public static stopContinuousTask(context: common.UIAbilityContext): void { + try { + backgroundTaskManager.stopBackgroundRunning(context).then(() => { + Logger.info('this avPlayer: ', 'stopBackgroundRunning succeeded'); + }).catch((err) => { + Logger.error('this avPlayer: ', `stopBackgroundRunning failed Cause: ${JSON.stringify(err)}`); + }); + } catch (error) { + Logger.error('this avPlayer: ', `stopBackgroundRunning failed. code ${error.code} message ${error.message}`); + } + } +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/common/mediaCommon/src/main/ets/utils/BreakpointSystem.ets b/MultiDeviceMusic-army/common/mediaCommon/src/main/ets/utils/BreakpointSystem.ets new file mode 100644 index 0000000000000000000000000000000000000000..558dc57d8739324b7daa6e4f85069dcc94ead0ca --- /dev/null +++ b/MultiDeviceMusic-army/common/mediaCommon/src/main/ets/utils/BreakpointSystem.ets @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2023 Huawei Device 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 mediaQuery from '@ohos.mediaquery'; +import { BreakpointConstants } from '@ohos/constantsCommon'; + +declare interface BreakPointTypeOption { + sm?: T, + md?: T, + lg?: T, + xl?: T, + xxl?: T +} + +export class BreakpointType { + options: BreakPointTypeOption; + + constructor(option: BreakPointTypeOption) { + this.options = option; + } + + getValue(currentPoint: string): T { + return this.options[currentPoint] as T; + } +} + +export class BreakpointSystem { + private currentBreakpoint: string = BreakpointConstants.BREAKPOINT_SM; + private smListener: mediaQuery.MediaQueryListener; + private mdListener: mediaQuery.MediaQueryListener; + private lgListener: mediaQuery.MediaQueryListener; + + private updateCurrentBreakpoint(breakpoint: string): void { + if (this.currentBreakpoint !== breakpoint) { + this.currentBreakpoint = breakpoint; + AppStorage.SetOrCreate(BreakpointConstants.CURRENT_BREAKPOINT, this.currentBreakpoint); + } + } + + private isBreakpointSM = (mediaQueryResult: mediaQuery.MediaQueryResult): void => { + if (mediaQueryResult.matches) { + this.updateCurrentBreakpoint(BreakpointConstants.BREAKPOINT_SM); + } + } + private isBreakpointMD = (mediaQueryResult: mediaQuery.MediaQueryResult): void => { + if (mediaQueryResult.matches) { + this.updateCurrentBreakpoint(BreakpointConstants.BREAKPOINT_MD); + } + } + private isBreakpointLG = (mediaQueryResult: mediaQuery.MediaQueryResult): void => { + if (mediaQueryResult.matches) { + this.updateCurrentBreakpoint(BreakpointConstants.BREAKPOINT_LG); + } + } + + public register(): void { + this.smListener = mediaQuery.matchMediaSync(BreakpointConstants.RANGE_SM); + this.smListener.on('change', this.isBreakpointSM); + this.mdListener = mediaQuery.matchMediaSync(BreakpointConstants.RANGE_MD); + this.mdListener.on('change', this.isBreakpointMD); + this.lgListener = mediaQuery.matchMediaSync(BreakpointConstants.RANGE_LG); + this.lgListener.on('change', this.isBreakpointLG); + } + + public unregister(): void { + this.smListener.off('change', this.isBreakpointSM); + this.mdListener.off('change', this.isBreakpointMD); + this.lgListener.off('change', this.isBreakpointLG); + } +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/common/mediaCommon/src/main/ets/utils/Logger.ets b/MultiDeviceMusic-army/common/mediaCommon/src/main/ets/utils/Logger.ets new file mode 100644 index 0000000000000000000000000000000000000000..c83fbbce32fa9c37939252f5023f8b2e6c332a62 --- /dev/null +++ b/MultiDeviceMusic-army/common/mediaCommon/src/main/ets/utils/Logger.ets @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2023 Huawei Device 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'; + +export class Logger { + private static domain: number = 0xFF00; + private static prefix: string = 'MusicPlay'; + private static format: string = '%{public}s, %{public}s'; + + static debug(...args: any[]): void { + hilog.debug(this.domain, this.prefix, this.format, args); + } + + static info(...args: any[]): void { + hilog.info(this.domain, this.prefix, this.format, args); + } + + static warn(...args: any[]): void { + hilog.warn(this.domain, this.prefix, this.format, args); + } + + static error(...args: any[]): void { + hilog.error(this.domain, this.prefix, this.format, args); + } +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/common/mediaCommon/src/main/ets/utils/MediaService.ets b/MultiDeviceMusic-army/common/mediaCommon/src/main/ets/utils/MediaService.ets new file mode 100644 index 0000000000000000000000000000000000000000..78e08358f587593909f164441451eb7db9013006 --- /dev/null +++ b/MultiDeviceMusic-army/common/mediaCommon/src/main/ets/utils/MediaService.ets @@ -0,0 +1,449 @@ +/* + * Copyright (c) 2023 Huawei Device 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 media from '@ohos.multimedia.media'; +import common from '@ohos.app.ability.common'; +import formProvider from '@ohos.app.form.formProvider'; +import formBindingData from '@ohos.app.form.formBindingData'; +import SongItemBuilder from './SongItemBuilder'; +import { AudioPlayerState, MusicPlayMode } from '../viewmodel/MusicData'; +import { SongItem } from '../bean/SongData'; +import { PreferencesUtil } from './PreferencesUtil'; +import { CardData } from '../bean/CardData'; +import { BackgroundUtil } from './BackgroundUtil'; +import { MediaTools } from './MediaTools'; +import { SongConstants } from '@ohos/constantsCommon'; +import { Logger } from './Logger'; +import { MusicList } from '../viewmodel/MusicList'; + +const TAG = 'MediaService'; + +export class MediaService { + private context: common.UIAbilityContext = AppStorage.Get('context'); + public avPlayer: media.AVPlayer; + private songItemBuilder: SongItemBuilder; + private songItem: SongItem; + private playMode: MusicPlayMode = MusicPlayMode.ORDER; + private state: AudioPlayerState = AudioPlayerState.IDLE; + private isFirst: boolean = true; + private isPrepared: boolean = false; + private musicIndex: number = 0; + private songList: SongItem[] = MusicList; + private formIds: string[]; + private isCurrent: boolean= true; + + constructor() { + this.songItemBuilder = new SongItemBuilder(); + this.initAudioPlayer(); + } + + public static getInstance(): MediaService { + let mediaService: MediaService = AppStorage.Get('mediaService'); + if (!mediaService) { + mediaService = new MediaService(); + AppStorage.SetOrCreate('mediaService', mediaService); + } + return mediaService; + } + + private initAudioPlayer() { + media.createAVPlayer().then(async avPlayer => { + if (avPlayer !== null) { + this.avPlayer = avPlayer; + this.setAVPlayerCallback(); + } + }, error => Logger.error(TAG, 'this avPlayer: ', `error happened,error Name is ${JSON.stringify(error)}`)) + .catch(error => Logger.error(TAG, 'this avPlayer: ', `catch error happened,error Name is ${JSON.stringify(error)}`)) + } + + private setAVPlayerCallback() { + this.avPlayer.on('seekDone', (seekDoneTime) => { + this.isCurrent = true; + Logger.info(TAG, `AVPlayer seek succeeded, seek time is ${seekDoneTime}`); + }); + + this.avPlayer.on('error', (err) => { + Logger.error(TAG, `Invoke avPlayer failed, code is ${err.code}, message is ${err.message}`); + this.avPlayer.reset(); + }); + + this.avPlayer.on('timeUpdate', (updateTime) => { + if (this.isCurrent) { + AppStorage.SetOrCreate('currentTime', MediaTools.msToCountdownTime(updateTime)); + AppStorage.SetOrCreate('progress', updateTime); + } + }); + + this.avPlayer.on("stateChange", async (state) => { + switch (state) { + case 'idle': + Logger.info(TAG, 'AVPlayer state idle called.'); + this.state = AudioPlayerState.IDLE; + this.songItem = await this.songItemBuilder.build(this.songList[this.musicIndex]); + this.avPlayer.url = this.songItemBuilder.getRealUrl(); + // this.avPlayer.fdSrc = this.songItemBuilder.getRealUrl(); + // Logger.info(TAG, 'loadAsset avPlayer.url:' + this.avPlayer.fdSrc); + break; + case 'initialized': + Logger.info(TAG, 'AVPlayer state initialized called.'); + this.state = AudioPlayerState.INITIALIZED; + this.avPlayer.prepare().then(() => { + Logger.info(TAG, 'AVPlayer prepare succeeded.'); + }, (err) => { + Logger.error(TAG, `Invoke prepare failed, code is ${err.code}, message is ${err.message}`); + }); + break; + case 'prepared': + Logger.info(TAG, 'AVPlayer state prepared called.'); + this.state = AudioPlayerState.PREPARED; + this.isPrepared = true; + AppStorage.SetOrCreate('totalTime', MediaTools.msToCountdownTime(this.getDuration())); + AppStorage.SetOrCreate('progressMax', this.getDuration()); + this.avPlayer.play(); + Logger.info(TAG, 'AVPlayer prepared succeeded.'); + break; + case 'playing': + Logger.info(TAG, 'AVPlayer state playing called.'); + this.state = AudioPlayerState.PLAY; + break; + case 'paused': + Logger.info(TAG, 'AVPlayer state paused called.'); + this.state = AudioPlayerState.PAUSE; + break; + case 'completed': + Logger.info(TAG, 'AVPlayer state completed called.'); + this.state = AudioPlayerState.COMPLETED; + this.playNextAuto(false); + break; + case 'stopped': + Logger.info(TAG, 'AVPlayer state stopped called.'); + this.state = AudioPlayerState.STOP; + this.avPlayer.reset(); + break; + case 'released': + Logger.info(TAG, 'AVPlayer state released called.'); + this.state = AudioPlayerState.RELEASED; + break; + default: + Logger.info(TAG, 'AVPlayer state unknown called.'); + this.state = AudioPlayerState.UNKNOWN; + break; + } + this.updateCardData(); + this.updateIsPlay(this.state == AudioPlayerState.PLAY); + }) + } + + /** + * Play music by index. + * + * @param musicIndex + */ + async loadAssent(musicIndex: number) { + if (musicIndex >= this.songList.length) { + Logger.error(TAG, `current musicIndex ${musicIndex}`); + return; + } + BackgroundUtil.startContinuousTask(this.context); + this.updateMusicIndex(musicIndex); + if (this.isFirst) { + this.isFirst = false; + this.songItem = await this.songItemBuilder.build(this.songList[this.musicIndex]); + this.avPlayer.url = this.songItemBuilder.getRealUrl(); + // this.avPlayer.fdSrc = this.songItemBuilder.getRealUrl(); + } else { + await this.stop(); + if (this.songItem === null || this.songItem.src !== this.songList[this.musicIndex].src) { + await this.reset(); + } + } + } + + /** + * Get whether the music is played for the first. + * + * @returns isFirst + */ + public getFirst() { + return this.isFirst; + } + + /** + * Set music play mode. + * + * @param playMode + */ + public setPlayModel(playMode: MusicPlayMode) { + this.playMode = playMode; + Logger.info(TAG, 'setPlayModel mode: ' + this.playMode); + } + + /** + * Get music play mode. + * + * @returns playMode. + */ + public getPlayMode() { + return this.playMode; + } + + private updateIsPlay(isPlay: boolean) { + AppStorage.SetOrCreate('isPlay', isPlay); + } + + /** + * Seek play music. + * + * @param ms. + */ + public seek(ms: number) { + if (this.isPrepared && this.state != AudioPlayerState.ERROR) { + let seekMode = this.getCurrentTime() < ms ? 0 : 1; + let realTime = (ms <= 0 ? 0 : (ms >= this.getDuration() ? this.getDuration() : ms)); + this.isCurrent = false; + this.avPlayer.seek(realTime, seekMode); + } + } + + private getCurrentTime() { + if (this.isPrepared) { + return this.avPlayer.currentTime; + } + return 0; + } + + private getDuration() { + if (this.isPrepared) { + return this.avPlayer.duration; + } + return 0; + } + + private start(seekMs?: number) { + Logger.info(TAG, 'AVPlayer play() isPrepared:' + this.isPrepared + ', state:' + this.state + ',seek:' + seekMs); + this.avPlayer.prepare().then(() => { + }).catch((error) => { + Logger.error(TAG, `start error ${JSON.stringify(error)}`) + this.state = AudioPlayerState.ERROR; + this.updateIsPlay(false); + this.isPrepared = false; + }); + } + + /** + * Play music. + */ + public async play() { + Logger.info(TAG, 'AVPlayer play() isPrepared:' + this.isPrepared + ', state:' + this.state); + BackgroundUtil.startContinuousTask(this.context); + if (!this.isPrepared) { + this.start(0); + } else { + this.avPlayer.play().then(() => { + Logger.info(TAG, 'progressTime play() current time:' + this.getCurrentTime()); + this.seek(this.getCurrentTime()); + this.updateIsPlay(true); + this.state = AudioPlayerState.PLAY; + }) + } + } + + /** + * Pause music. + */ + public pause() { + Logger.info(TAG, 'AVPlayer pause() isPrepared:' + this.isPrepared + ', state:' + this.state); + if (this.isPrepared && this.state == AudioPlayerState.PLAY) { + this.avPlayer.pause().then(() => { + this.state = AudioPlayerState.PAUSE; + this.updateIsPlay(false); + }); + } + } + + /** + * Play next music. + * + * @param isFromControl + */ + public playNextAuto(isFromControl: boolean) { + Logger.info(TAG, 'playNextAuto mode:' + this.playMode); + switch (this.playMode) { + case MusicPlayMode.SINGLE_CYCLE: + if (isFromControl) { + this.playNext(); + } else { + this.avPlayer.play(); + } + break; + case MusicPlayMode.ORDER: + this.playNext(); + break; + case MusicPlayMode.RANDOM: + this.playRandom(); + break; + default: + break; + } + } + + private playNext() { + Logger.info(TAG, 'playNext Index:' + this.musicIndex + ', length-1:' + (this.songList.length - 1)); + if (this.musicIndex === this.songList.length - 1) { + this.loadAssent(0); + } else { + this.loadAssent(this.musicIndex + 1); + } + } + + /** + * Play previous music. + */ + public playPrevious() { + switch (this.playMode) { + case MusicPlayMode.RANDOM: + this.playRandom(); + break; + case MusicPlayMode.ORDER: + case MusicPlayMode.SINGLE_CYCLE: + if (this.musicIndex === 0) { + this.updateMusicIndex(this.songList.length - 1); + } else { + this.updateMusicIndex(this.musicIndex - 1); + } + Logger.info(TAG, 'setLastIndex:' + this.musicIndex); + this.loadAssent(this.musicIndex); + break; + } + } + + private playRandom() { + let num = Math.round(Math.random() * (this.songList.length - 1)); + if (this.musicIndex === num) { + this.playRandom(); + } else { + this.updateMusicIndex(num); + this.loadAssent(num); + } + Logger.info(TAG, 'play Random:' + this.musicIndex); + } + + /** + * Stop music + */ + public async stop() { + Logger.info(TAG, 'stop()'); + if (this.isPrepared) { + await this.avPlayer.stop(); + this.updateIsPlay(false); + this.state = AudioPlayerState.PAUSE; + } + } + + private async reset() { + Logger.info(TAG, 'reset()'); + await this.songItemBuilder.release(); + await this.avPlayer.reset(); + this.isPrepared = false; + } + + /** + * release avPlayer. + */ + public release() { + this.updateIsPlay(false); + this.stop(); + this.reset(); + this.avPlayer.release(); + this.state = AudioPlayerState.IDLE; + BackgroundUtil.stopContinuousTask(this.context); + } + + private updateMusicIndex(musicIndex: number) { + Logger.info(TAG, 'updateMusicIndex ===> ' + musicIndex); + AppStorage.SetOrCreate('selectIndex', musicIndex); + if (this.musicIndex != musicIndex) { + this.musicIndex = musicIndex; + } + } + + /** + * Update card data. + */ + public async updateCardData() { + try { + PreferencesUtil.getInstance().removePreferencesFromCache(this.context); + this.formIds = await PreferencesUtil.getInstance().getFormIds(this.context); + if (this.formIds === null || this.formIds === undefined) { + Logger.error(TAG, 'WANG formIds is null'); + return; + } + + let cardSongList: Array = []; + if (this.musicIndex + SongConstants.ADD_INDEX_ONE === this.songList.length) { + cardSongList = this.songList.slice(SongConstants.SLICE_START_ZERO, SongConstants.SLICE_END_THREE); + } else if (this.musicIndex + SongConstants.ADD_INDEX_TWO === this.songList.length) { + cardSongList.push(this.songList[this.songList.length - 1]); + cardSongList.push(this.songList[0]); + cardSongList.push(this.songList[1]); + } else if (this.musicIndex + SongConstants.ADD_INDEX_THREE === this.songList.length) { + cardSongList = this.songList.slice(this.songList.length - SongConstants.SLICE_INDEX_TWO, + this.songList.length); + cardSongList.push(this.songList[0]); + } else { + cardSongList = this.songList.slice(this.musicIndex + SongConstants.SLICE_INDEX_ONE, + this.musicIndex + SongConstants.SLICE_INDEX_FOUR); + } + let formData: CardData = { + 'isPlay': this.state === AudioPlayerState.PLAY, + 'musicName': this.songList[this.musicIndex].title, + 'musicCover': this.songList[this.musicIndex].label, + 'musicSinger': this.songList[this.musicIndex].singer, + 'cardSongList': cardSongList + } + let formInfo = formBindingData.createFormBindingData(formData); + + this.formIds.forEach(formId => { + formProvider.updateForm(formId, formInfo).then(() => { + Logger.info(TAG, 'WANG updateForm data succeed' + ', formId:' + formId); + }).catch((error) => { + Logger.error(TAG, 'updateForm err:' + JSON.stringify(error)); + if (error.code === SongConstants.ID_NO_EXIT) { + PreferencesUtil.getInstance().removeFormId(this.context, formId); + } + }) + }) + } catch (e) { + Logger.error(TAG, 'updateCardData err:' + JSON.stringify(e)); + } + } + + /** + * Update card data on destroy. + */ + public async updateOnDestroy() { + if (this.formIds === null || this.formIds === undefined) { + Logger.error(TAG, 'formIds is null'); + return; + } + let formData = { + 'isPlay': false + } + let formInfo = formBindingData.createFormBindingData(formData); + this.formIds.forEach(async formId => { + await formProvider.updateForm(formId, formInfo); + }) + } +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/common/mediaCommon/src/main/ets/utils/MediaTools.ets b/MultiDeviceMusic-army/common/mediaCommon/src/main/ets/utils/MediaTools.ets new file mode 100644 index 0000000000000000000000000000000000000000..a0ef18c448bae6e80a4b519dd2aab4df1d039824 --- /dev/null +++ b/MultiDeviceMusic-army/common/mediaCommon/src/main/ets/utils/MediaTools.ets @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2023 Huawei Device 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 image from '@ohos.multimedia.image'; +import { Logger } from './Logger'; + +const TAG = 'MediaTools'; + +export class MediaTools { + + static async getPixelMapFromResource(context: Context, name: Resource): Promise { + let resourceMgr = context.resourceManager; + let fileData = await resourceMgr.getMediaContent(name); + return await image.createImageSource(fileData.buffer).createPixelMap(); + } + + static async getPixelMapFromFile(id: string, path: string): Promise { + Logger.info(TAG, 'getPixelMapFromFile id:' + id + ', path:' + path); + return await image.createImageSource(path).createPixelMap(); + } + + /** + * 日期不足两位补 0 + * + * @param {string} value - 数据值 + * @return {string} - 日期不足两位补 0 + */ + private static fill(value: number): string { + return (value < 10 ? `0${value}` : `${value}`); + } + + static msToCountdownTime(ms): string { + if (!ms) { + return '00:00'; + } + const days = Math.floor(ms / (1000 * 60 * 60 * 24)); + const hours = Math.floor((ms % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); + const minutes = Math.floor((ms % (1000 * 60 * 60)) / (1000 * 60)); + const seconds = Math.floor((ms % (1000 * 60)) / 1000); + return `${(days ? this.fill(days) + ':' : '')}${(hours ? this.fill(hours) + ':' : '')} + ${this.fill(minutes)}:${this.fill(seconds)} `.trim(); + } +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/common/mediaCommon/src/main/ets/utils/PreferencesUtil.ets b/MultiDeviceMusic-army/common/mediaCommon/src/main/ets/utils/PreferencesUtil.ets new file mode 100644 index 0000000000000000000000000000000000000000..67c0db8d6b4cb6509556f3f40c199f76c178dea2 --- /dev/null +++ b/MultiDeviceMusic-army/common/mediaCommon/src/main/ets/utils/PreferencesUtil.ets @@ -0,0 +1,162 @@ +/* + * Copyright (c) 2023 Huawei Device 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 dataPreferences from '@ohos.data.preferences'; +import { Logger } from './Logger'; + +const TAG = 'PreferencesUtil'; +const MY_STORE = 'myStore'; +const FORM_ID = 'formIds'; + +export class PreferencesUtil { + private static preferencesUtil: PreferencesUtil; + + public static getInstance(): PreferencesUtil { + if (!this.preferencesUtil) { + this.preferencesUtil = new PreferencesUtil(); + } + return this.preferencesUtil; + } + + getPreferences(context: Context): Promise { + return new Promise((resolve, reject) => { + dataPreferences.getPreferences(context, MY_STORE, (err, pref: dataPreferences.Preferences) => { + if (err) { + Logger.error(TAG, `Failed to get preferences. Code:${err.code},message:${err.message}`); + reject(err); + return; + } + resolve(pref); + }) + }) + } + + preferencesFlush(preferences: dataPreferences.Preferences) { + preferences.flush((err) => { + if (err) { + Logger.error(TAG, `Failed to flush. Code:${err.code}, message:${err.message}`); + } + }) + } + + preferencesPut(preferences: dataPreferences.Preferences, formIds: Array): Promise { + return new Promise((resolve, reject) => { + try { + preferences.put(FORM_ID, formIds, (err) => { + if (err) { + reject(err); + Logger.error(TAG, `Failed to put data. Code:${err.code}, message:${err.message}`); + return; + } + Logger.info(TAG, `preferencesPut succeed,formIds:` + JSON.stringify(formIds)); + resolve(true); + }) + } catch (err) { + Logger.error(TAG, `Failed to put data. Code: ${err.code},message:${err.message}`); + } + }); + } + + async preferencesHas(preferences: dataPreferences.Preferences): Promise { + return new Promise((resolve, reject) => { + preferences.has(FORM_ID, (err, value) => { + if (err) { + reject(err); + Logger.error(TAG, `WANG to check the key 'formIds'. Code:${err.code}, message:${err.message}`); + return; + } + resolve(value); + }); + }) + } + + removePreferencesFromCache(context: Context): void { + dataPreferences.removePreferencesFromCache(context, MY_STORE); + } + + async getFormIds(context: Context): Promise> { + try { + let preferences = await this.getPreferences(context); + return new Promise((resolve, reject) => { + if (preferences === null) { + Logger.error(TAG, `preferences is null`); + return; + } + preferences.get(FORM_ID, [''], (err, value: Array) => { + if (err) { + reject(err); + Logger.error(TAG, `Failed to get value of 'formIds'. Code:${err.code}, message:${err.message}`); + return; + } + resolve(value); + Logger.info(TAG, `Succeeded in getting value of 'formIds'. val: ${value}.`); + }) + }) + } catch (err) { + Logger.error(TAG, `WANG Failed to get value of 'formIds'. Code:${err.code}, message:${err.message}`); + } + } + + async addFormId(context: Context, formId: string) { + try { + let preferences = await this.getPreferences(context); + if (preferences === null) { + Logger.error(TAG, `preferences is null`); + return; + } + + if (await this.preferencesHas(preferences)) { + let formIds = await this.getFormIds(context); + if (formIds.indexOf(formId) === -1) { + formIds.push(formId); + if (!await this.preferencesPut(preferences, formIds)) { + return; + } + this.preferencesFlush(preferences); + } + } else { + if (!await this.preferencesPut(preferences, [formId])) { + return; + } + this.preferencesFlush(preferences); + } + } catch (err) { + Logger.error(TAG, `Failed to check the key 'formIds'. Code:${err.code}, message:${err.message}`); + } + } + + async removeFormId(context: Context, formId: string) { + try { + let preferences = await this.getPreferences(context); + if (preferences === null) { + Logger.error(TAG, `preferences is null`); + return; + } + if (await this.preferencesHas(preferences)) { + let formIds = await this.getFormIds(context); + let index = formIds.indexOf(formId); + if (index !== -1) { + formIds.splice(index, 1); + } + if (!await this.preferencesPut(preferences, formIds)) { + return; + } + this.preferencesFlush(preferences); + } + } catch (err) { + Logger.error(TAG, `WANG Failed to get preferences. Code:${err.code},message:${err.message}`); + } + } +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/common/mediaCommon/src/main/ets/utils/SongItemBuilder.ets b/MultiDeviceMusic-army/common/mediaCommon/src/main/ets/utils/SongItemBuilder.ets new file mode 100644 index 0000000000000000000000000000000000000000..54495fc7d2667210881ee3348ecff0886e9fbe3b --- /dev/null +++ b/MultiDeviceMusic-army/common/mediaCommon/src/main/ets/utils/SongItemBuilder.ets @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2023 Huawei Device 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 common from '@ohos.app.ability.common'; +import { SongItem } from '../bean/SongData'; +import { Logger } from './Logger'; + +export default class SongItemBuilder { + // private context: common.UIAbilityContext = AppStorage.Get('context'); + private realUrl; + private songItem: SongItem; + + public async build(songItem: SongItem) { + this.songItem = songItem; + this.realUrl = songItem.src; + // let rawfileFd = await this.context.createModuleContext('musicList').resourceManager.getRawFd(songItem.src) + // .catch((error) => { + // Logger.error(`resourceManager error code ${error.code}`); + // }) + // this.realUrl = rawfileFd; + // Logger.info('MediaAssetBuilder build realUrl:' + this.realUrl); + return this.songItem; + } + + public getRealUrl() { + return this.realUrl; + } + + public async release() { + // this.context.resourceManager.closeRawFd(this.songItem.src); + this.songItem = null; + } +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/common/mediaCommon/src/main/ets/viewmodel/MusicData.ets b/MultiDeviceMusic-army/common/mediaCommon/src/main/ets/viewmodel/MusicData.ets new file mode 100644 index 0000000000000000000000000000000000000000..c99528f39c427e2c513ba6c1c1410661f907e9d4 --- /dev/null +++ b/MultiDeviceMusic-army/common/mediaCommon/src/main/ets/viewmodel/MusicData.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2023 Huawei Device 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. + */ + +enum MusicPlayMode { + SINGLE_CYCLE = 0, + ORDER = 1, + RANDOM = 2 +} + +enum AudioPlayerState { + IDLE, + INITIALIZED, + LOAD, + PREPARED, + PLAY, + PAUSE, + STOP, + ERROR, + COMPLETED, + RELEASED, + PROGRESS_SPEED, + TIME_UPDATE, + VOLUME_CHANGE, + UNKNOWN +} + +export { MusicPlayMode, AudioPlayerState } \ No newline at end of file diff --git a/MultiDeviceMusic-army/common/mediaCommon/src/main/ets/viewmodel/MusicList.ets b/MultiDeviceMusic-army/common/mediaCommon/src/main/ets/viewmodel/MusicList.ets new file mode 100644 index 0000000000000000000000000000000000000000..d3c320ac8681b61e9257f8e726cb2f7c6d16aa62 --- /dev/null +++ b/MultiDeviceMusic-army/common/mediaCommon/src/main/ets/viewmodel/MusicList.ets @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2023 Huawei Device 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. + */ + +const MusicList = [ + { id: 1, title: '中国人', singer: '刘德华', mark: $r('app.media.ic_vip'), + label: $r('app.media.ic_avatar1'), src: 'http://music.163.com/song/media/outer/url?id=110743.mp3', index:0}, + { id: 2, title: '我的梦', singer: '张靓颖', mark: $r('app.media.ic_sq'), + label: $r('app.media.ic_avatar2'), src: 'http://music.163.com/song/media/outer/url?id=526668900.mp3', index:1 }, + { id: 3, title: '还是歌名', singer: '不知道你是谁', mark: $r('app.media.ic_vip'), + label: $r('app.media.ic_avatar16'), src: 'http://music.163.com/song/media/outer/url?id=1403528956.mp3', index:2 }, + { id: 4, title: 'AIUHGVNHK', singer: 'Gwyu-Hjjiyabn', mark: $r('app.media.ic_sq'), + label: $r('app.media.ic_avatar4'), src: 'http://music.163.com/song/media/outer/url?id=1403528956.mp3' , index:3}, + { id: 5, title: '可可不喜欢', singer: '名佚', mark: $r('app.media.ic_vip'), + label: $r('app.media.ic_avatar5'), src: 'dynamic.wav', index:4 }, + { id: 6, title: '我是UOUYGBJ', singer: '我是小树', mark: $r('app.media.ic_sq'), + label: $r('app.media.ic_avatar6'), src: 'http://music.163.com/song/media/outer/url?id=1403528956.mp3' , index:5}, + { id: 7, title: '好好学习', singer: '全村最帅', mark: $r('app.media.ic_vip'), + label: $r('app.media.ic_avatar17'), src: 'http://music.163.com/song/media/outer/url?id=4968365.mp3', index:6 }, + { id: 8, title: '安心安心', singer: '小安安', mark: $r('app.media.ic_sq'), + label: $r('app.media.ic_avatar8'), src: 'http://music.163.com/song/media/outer/url?id=1403528956.mp3', index:7 }, + { id: 9, title: 'HBNJGHJHB', singer: '我是小树', mark: $r('app.media.ic_vip'), + label: $r('app.media.ic_avatar9'), src: 'http://music.163.com/song/media/outer/url?id=4968365.mp3', index:8 }, + { id: 10, title: '天天向上', singer: '靓仔', mark: $r('app.media.ic_sq'), + label: $r('app.media.ic_avatar10'), src: 'http://music.163.com/song/media/outer/url?id=1403528956.mp3', index:9 }, + { id: 11, title: 'Notebook', singer: '小安安', mark: $r('app.media.ic_vip'), + label: $r('app.media.ic_avatar11'), src: 'http://music.163.com/song/media/outer/url?id=4968365.mp3', index:10}, + { id: 12, title: '我是谁', singer: '小碗你好', mark: $r('app.media.ic_sq'), + label: $r('app.media.ic_avatar12'), src: 'http://music.163.com/song/media/outer/url?id=1403528956.mp3', index:11 }, + { id: 13, title: '你好吗', singer: '张三-你好我好都好', mark: $r('app.media.ic_vip'), + label: $r('app.media.ic_avatar13'), src: 'http://music.163.com/song/media/outer/url?id=4968365.mp3', index:12 }, + { id: 14, title: '你在哪', singer: '不知道你是谁', mark: $r('app.media.ic_sq'), + label: $r('app.media.ic_avatar14'), src: 'http://music.163.com/song/media/outer/url?id=1403528956.mp3', index:13 }, + { id: 15, title: 'lovely', singer: 'Gwyu-Hjjiyabn', mark: $r('app.media.ic_vip'), + label: $r('app.media.ic_avatar15'), src: 'http://music.163.com/song/media/outer/url?id=4968365.mp3', index:14 }, + { id: 16, title: '谢谢你', singer: '名佚', mark: $r('app.media.ic_sq'), + label: $r('app.media.ic_avatar16'), src: 'http://music.163.com/song/media/outer/url?id=1403528956.mp3', index:15 }, + { id: 17, title: '我是靓仔', singer: '我是小树', mark: $r('app.media.ic_vip'), + label: $r('app.media.ic_avatar17'), src: 'http://music.163.com/song/media/outer/url?id=4968365.mp3', index:16 }, + { id: 18, title: '听我说', singer: '全村最帅', mark: $r('app.media.ic_sq'), + label: $r('app.media.ic_avatar1'), src: 'http://music.163.com/song/media/outer/url?id=1403528956.mp3', index:17 }, + { id: 19, title: '没什么大不了', singer: '小安安', mark: $r('app.media.ic_vip'), + label: $r('app.media.ic_avatar2'), src: 'http://music.163.com/song/media/outer/url?id=4968365.mp3', index:18 }, + { id: 20, title: '其实也一样', singer: '我是小树', mark: $r('app.media.ic_sq'), + label: $r('app.media.ic_avatar13'), src: 'http://music.163.com/song/media/outer/url?id=1403528956.mp3', index:19 }, + { id: 21, title: '想明白', singer: '小安安', mark: $r('app.media.ic_vip'), + label: $r('app.media.ic_avatar4'), src: 'http://music.163.com/song/media/outer/url?id=4968365.mp3', index:20 }, + { id: 22, title: '你懂的', singer: '小安安', mark: $r('app.media.ic_sq'), + label: $r('app.media.ic_avatar5'), src: 'http://music.163.com/song/media/outer/url?id=1403528956.mp3', index:21 }, + { id: 23, title: '谁了解', singer: '小安安', mark: $r('app.media.ic_vip'), + label: $r('app.media.ic_avatar6'), src: 'http://music.163.com/song/media/outer/url?id=4968365.mp3', index:22 }, + { id: 24, title: '白天', singer: '小安安', mark: $r('app.media.ic_sq'), + label: $r('app.media.ic_avatar17'), src: 'http://music.163.com/song/media/outer/url?id=4968365.mp3', index:23 }, + { id: 25, title: '黑夜', singer: 'Gwyu-Hjjiyabn', mark: $r('app.media.ic_vip'), + label: $r('app.media.ic_avatar15'), src: 'http://music.163.com/song/media/outer/url?id=1403528956.mp3', index:24 }, + { id: 26, title: '春夏秋冬', singer: '名佚', mark: $r('app.media.ic_sq'), + label: $r('app.media.ic_avatar16'), src: 'http://music.163.com/song/media/outer/url?id=1403528956.mp3', index:25 }, + { id: 27, title: '一年四季', singer: '我是小树', mark: $r('app.media.ic_vip'), + label: $r('app.media.ic_avatar17'), src: 'http://music.163.com/song/media/outer/url?id=4968365.mp3', index:26 }, + { id: 28, title: '朝雪', singer: '全村最帅', mark: $r('app.media.ic_sq'), + label: $r('app.media.ic_avatar12'), src: 'http://music.163.com/song/media/outer/url?id=4968365.mp3', index:27 }, + { id: 29, title: '暮色', singer: '小安安', mark: $r('app.media.ic_vip'), + label: $r('app.media.ic_avatar13'), src: 'http://music.163.com/song/media/outer/url?id=1403528956.mp3', index:28 }, + { id: 30, title: '天下', singer: '我是小树', mark: $r('app.media.ic_sq'), + label: $r('app.media.ic_avatar14'), src: 'http://music.163.com/song/media/outer/url?id=4968365.mp3', index:29 }, + { id: 31, title: '勇敢', singer: '小安安', mark: $r('app.media.ic_vip'), + label: $r('app.media.ic_avatar15'), src: 'http://music.163.com/song/media/outer/url?id=1403528956.mp3', index:30 }, + { id: 32, title: '安明', singer: '小安安', mark: $r('app.media.ic_sq'), + label: $r('app.media.ic_avatar16'), src: 'http://music.163.com/song/media/outer/url?id=1403528956.mp3', index:31 }, + { id: 33, title: '心安', singer: '小安安', mark: $r('app.media.ic_vip'), + label: $r('app.media.ic_avatar17'), src: 'http://music.163.com/song/media/outer/url?id=4968365.mp3', index:32 }, + { id: 34, title: '无归', singer: '小安安', mark: $r('app.media.ic_sq'), + label: $r('app.media.ic_avatar11'), src: 'http://music.163.com/song/media/outer/url?id=1403528956.mp3', index:33 } +] + +export { MusicList } \ No newline at end of file diff --git a/MultiDeviceMusic-army/common/mediaCommon/src/main/module.json5 b/MultiDeviceMusic-army/common/mediaCommon/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..9d94dd07b4834f94193683ef4cb55575b4beae7f --- /dev/null +++ b/MultiDeviceMusic-army/common/mediaCommon/src/main/module.json5 @@ -0,0 +1,10 @@ +{ + "module": { + "name": "mediaCommon", + "type": "har", + "deviceTypes": [ + "default", + "tablet" + ] + } +} diff --git a/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/element/string.json b/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..1e76de0c66777cfe83568615c5c2e68c61d23fed --- /dev/null +++ b/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "page_show", + "value": "page from npm package" + } + ] +} diff --git a/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar1.png b/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar1.png new file mode 100644 index 0000000000000000000000000000000000000000..65b36e53f9d57a0e6db7ae333ece7b11213d9392 Binary files /dev/null and b/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar1.png differ diff --git a/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar10.png b/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar10.png new file mode 100644 index 0000000000000000000000000000000000000000..5f9116bc1b5b4a679e26f653d7b9fc20c42c2f4e Binary files /dev/null and b/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar10.png differ diff --git a/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar11.png b/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar11.png new file mode 100644 index 0000000000000000000000000000000000000000..c756ce8f03e183b79e7b3d8af9d1cb3637776b59 Binary files /dev/null and b/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar11.png differ diff --git a/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar12.png b/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar12.png new file mode 100644 index 0000000000000000000000000000000000000000..8f1e60a0135e9484cff840e36080d41095b6d464 Binary files /dev/null and b/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar12.png differ diff --git a/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar13.png b/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar13.png new file mode 100644 index 0000000000000000000000000000000000000000..cb6cd5f6799be28e5aa88903da99548b3ce3241f Binary files /dev/null and b/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar13.png differ diff --git a/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar14.png b/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar14.png new file mode 100644 index 0000000000000000000000000000000000000000..f7e21a4aaaf31b122a04fb9e305080cb95430f6f Binary files /dev/null and b/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar14.png differ diff --git a/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar15.png b/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar15.png new file mode 100644 index 0000000000000000000000000000000000000000..31329a46ac66a5e9297dbdd8b84a8e46e454f4c5 Binary files /dev/null and b/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar15.png differ diff --git a/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar16.png b/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar16.png new file mode 100644 index 0000000000000000000000000000000000000000..65c853e62823a60099ee68ea73d2813f85509e6f Binary files /dev/null and b/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar16.png differ diff --git a/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar17.png b/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar17.png new file mode 100644 index 0000000000000000000000000000000000000000..13d5bcc190d344ed96b8d90eb6063ae354e6d377 Binary files /dev/null and b/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar17.png differ diff --git a/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar2.png b/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar2.png new file mode 100644 index 0000000000000000000000000000000000000000..d29f0e50c55814c75f95ee3258ed06f817a97b6a Binary files /dev/null and b/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar2.png differ diff --git a/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar3.png b/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar3.png new file mode 100644 index 0000000000000000000000000000000000000000..3b1be78d35c1a4824b14de9e490e7053a1c659fe Binary files /dev/null and b/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar3.png differ diff --git a/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar4.png b/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar4.png new file mode 100644 index 0000000000000000000000000000000000000000..b8d673405616ce857ec0ec7008ec3e03234a7f98 Binary files /dev/null and b/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar4.png differ diff --git a/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar5.png b/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar5.png new file mode 100644 index 0000000000000000000000000000000000000000..9386d21151e4bbf07e164f2e5be110b3516075b6 Binary files /dev/null and b/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar5.png differ diff --git a/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar6.png b/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar6.png new file mode 100644 index 0000000000000000000000000000000000000000..6cbae1cacc5d6456ce67b4c9b8be0d3b3d65aad5 Binary files /dev/null and b/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar6.png differ diff --git a/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar7.png b/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar7.png new file mode 100644 index 0000000000000000000000000000000000000000..fe95ce3124dc0b255b806eaceaa8d87d99733d19 Binary files /dev/null and b/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar7.png differ diff --git a/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar8.png b/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar8.png new file mode 100644 index 0000000000000000000000000000000000000000..a939dfef6148d4e33ee3c964130b8572f0d1d58c Binary files /dev/null and b/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar8.png differ diff --git a/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar9.png b/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar9.png new file mode 100644 index 0000000000000000000000000000000000000000..c988e596c6a9c0381eea393333354827fa49b886 Binary files /dev/null and b/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_avatar9.png differ diff --git a/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_sq.svg b/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_sq.svg new file mode 100644 index 0000000000000000000000000000000000000000..1ca33803efecffa4e3b20ecfde7dfc6829872cf3 --- /dev/null +++ b/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_sq.svg @@ -0,0 +1,7 @@ + + + icon_SQ + + + + \ No newline at end of file diff --git a/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_vip.svg b/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_vip.svg new file mode 100644 index 0000000000000000000000000000000000000000..1b0561309697f7045a8f05e6f986e23848111f97 --- /dev/null +++ b/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/base/media/ic_vip.svg @@ -0,0 +1,7 @@ + + + icon_vip + + + + \ No newline at end of file diff --git a/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/en_US/element/string.json b/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..1e76de0c66777cfe83568615c5c2e68c61d23fed --- /dev/null +++ b/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/en_US/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "page_show", + "value": "page from npm package" + } + ] +} diff --git a/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/zh_CN/element/string.json b/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..1e76de0c66777cfe83568615c5c2e68c61d23fed --- /dev/null +++ b/MultiDeviceMusic-army/common/mediaCommon/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "page_show", + "value": "page from npm package" + } + ] +} diff --git a/MultiDeviceMusic-army/hvigor/hvigor-config.json5 b/MultiDeviceMusic-army/hvigor/hvigor-config.json5 new file mode 100644 index 0000000000000000000000000000000000000000..ec2a3ae0df3882488dc4c82e947a40f7eae1da15 --- /dev/null +++ b/MultiDeviceMusic-army/hvigor/hvigor-config.json5 @@ -0,0 +1,6 @@ +{ + "hvigorVersion": "2.4.2", + "dependencies": { + "@ohos/hvigor-ohos-plugin": "2.4.2" + } +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/hvigor/hvigor-wrapper.js b/MultiDeviceMusic-army/hvigor/hvigor-wrapper.js new file mode 100644 index 0000000000000000000000000000000000000000..994f22987bd0739b9faa07c966b066c2d9218602 --- /dev/null +++ b/MultiDeviceMusic-army/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/MultiDeviceMusic-army/hvigorfile.ts b/MultiDeviceMusic-army/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..6478186902c0c1ad7c966a929c7d6b7d8ae7a9f3 --- /dev/null +++ b/MultiDeviceMusic-army/hvigorfile.ts @@ -0,0 +1,2 @@ +// 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/MultiDeviceMusic-army/live/build-profile.json5 b/MultiDeviceMusic-army/live/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..13c5eda6e6a3dae913ec5c5c4d60ea3ac954f205 --- /dev/null +++ b/MultiDeviceMusic-army/live/build-profile.json5 @@ -0,0 +1,11 @@ +{ + "apiType": 'stageMode', + "buildOption": { + }, + "targets": [ + { + "name": "default", + "runtimeOS": "HarmonyOS" + } + ] +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/live/hvigorfile.ts b/MultiDeviceMusic-army/live/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..0e65ea8582bf16134695dfefbdc93d4cda460e84 --- /dev/null +++ b/MultiDeviceMusic-army/live/hvigorfile.ts @@ -0,0 +1,2 @@ +// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently. +module.exports = require('@ohos/hvigor-ohos-plugin').hspTasks diff --git a/MultiDeviceMusic-army/live/oh-package.json5 b/MultiDeviceMusic-army/live/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..4ff70ed48bc9ed6b445819f6f6a580237260f29c --- /dev/null +++ b/MultiDeviceMusic-army/live/oh-package.json5 @@ -0,0 +1,10 @@ +{ + "license": "Apache-2.0", + "devDependencies": {}, + "author": "", + "name": "live", + "description": "Please describe the basic information.", + "main": "./src/main/ets/Index.ets", + "version": "1.0.0", + "dependencies": {} +} diff --git a/MultiDeviceMusic-army/live/src/main/ets/Index.ets b/MultiDeviceMusic-army/live/src/main/ets/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..6f75ad6d064156d271829cca4eb28bf9de9465bd --- /dev/null +++ b/MultiDeviceMusic-army/live/src/main/ets/Index.ets @@ -0,0 +1,17 @@ +/* + * Copyright (c) 2023 Huawei Device 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. + */ + +export { Header } from './view/Header'; +export { LiveList } from './view/LiveList'; \ No newline at end of file diff --git a/MultiDeviceMusic-army/live/src/main/ets/bean/LiveStream.ets b/MultiDeviceMusic-army/live/src/main/ets/bean/LiveStream.ets new file mode 100644 index 0000000000000000000000000000000000000000..46a66e76c1ece76a5fd91a77171bdd0cda5bee77 --- /dev/null +++ b/MultiDeviceMusic-army/live/src/main/ets/bean/LiveStream.ets @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2023 Huawei Device 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. + */ + +export class LiveStream { + /** + * Live stream title. + */ + title: Resource; + + /** + * Introduction to the live stream. + */ + liveIntroduction: Resource; + + /** + * Background picture of the live stream. + */ + liveBackground: Resource; + + constructor(title: Resource, liveIntroduction: Resource, liveBackground: Resource) { + this.title = title; + this.liveIntroduction = liveIntroduction; + this.liveBackground = liveBackground; + } +} diff --git a/MultiDeviceMusic-army/live/src/main/ets/constants/LiveConstants.ets b/MultiDeviceMusic-army/live/src/main/ets/constants/LiveConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..6359be557000d1e1ee2d94f9de85aa3fd571fb3f --- /dev/null +++ b/MultiDeviceMusic-army/live/src/main/ets/constants/LiveConstants.ets @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2023 Huawei Device 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. + */ + +export class LiveConstants { + /** + * The width percentage setting. + */ + static readonly FULL_WIDTH_PERCENT: string = '100%'; + + /** + * The height percentage setting. + */ + static readonly FULL_HEIGHT_PERCENT: string = '100%'; + + /** + * The font family of title. + */ + static readonly LIVE_TITLE_FONT_FAMILY: string = 'HarmonyHeiTi-Bold'; + + /** + * Default current breakpoint. + */ + static readonly CURRENT_BREAKPOINT: string = 'sm'; + + /** + * The font family of live title. + */ + static readonly LIVE_ITEM_TITLE_FONT_FAMILY: string = 'HarmonyHeiTi-Medium'; + + /** + * The font family of live introduction. + */ + static readonly LIVE_ITEM_INTRODUCTION_FONT_FAMILY: string = 'HarmonyHeiTi'; + + /** + * The font weight of title. + */ + static readonly TITLE_FONT_WEIGHT: number = 700; + + /** + * Four column width. + */ + static readonly FOUR_COLUMN: number = 4; + + /** + * Eight column width. + */ + static readonly EIGHT_COLUMN: number = 8; + + /** + * Twelve column width. + */ + static readonly TWELVE_COLUMN: number = 12; + + /** + * Six column width. + */ + static readonly SIX_COLUMN: number = 6; + + /** + * Zero column width. + */ + static readonly ZERO_COLUMN: number = 0; + + /** + * One column width. + */ + static readonly ONE_COLUMN: number = 1; + + /** + * Four column width. + */ + static readonly TWO_COLUMN: number = 2; + + /** + * The font weight of live title. + */ + static readonly LIVE_TITLE_FONT_WEIGHT: number = 500; + + /** + * The font weight of live introduction. + */ + static readonly LIVE_INTRODUCTION_FONT_WEIGHT: number = 400; + + /** + * The width of small devices. + */ + static readonly SMALL_DEVICE_TYPE: string = '320vp'; + + /** + * The width of middle devices. + */ + static readonly MIDDLE_DEVICE_TYPE: string = '600vp'; + + /** + * The width of large devices. + */ + static readonly LARGE_DEVICE_TYPE: string = '840vp'; +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/live/src/main/ets/pages/Index.ets b/MultiDeviceMusic-army/live/src/main/ets/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..e7dd9b04ee3f9cc1bbfa3ecc5bc16ef4d6ecd5f2 --- /dev/null +++ b/MultiDeviceMusic-army/live/src/main/ets/pages/Index.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2023 Huawei Device 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 { Header } from '../view/Header'; +import { LiveList } from '../view/LiveList'; +import { LiveConstants} from '../constants/LiveConstants'; + +@Entry +@Component +struct Index { + build() { + Column() { + Header() + LiveList() + } + .width(LiveConstants.FULL_WIDTH_PERCENT) + .height(LiveConstants.FULL_HEIGHT_PERCENT) + } +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/live/src/main/ets/view/Header.ets b/MultiDeviceMusic-army/live/src/main/ets/view/Header.ets new file mode 100644 index 0000000000000000000000000000000000000000..0e6648a36bb98611d23e94549a1c4b96b3653e1a --- /dev/null +++ b/MultiDeviceMusic-army/live/src/main/ets/view/Header.ets @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2023 Huawei Device 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 { LiveConstants } from '../constants/LiveConstants'; +import router from '@ohos.router'; + +@Component +export struct Header { + build() { + Row() { + Image($r('app.media.ic_back')) + .width($r('app.float.back_width')) + .height($r('app.float.back_height')) + .margin({ left: $r('app.float.back_left_margin') }) + .onClick(() => { + router.back(); + }) + Text($r('app.string.live_title')) + .fontSize($r('app.float.title_font_size')) + .fontFamily(LiveConstants.LIVE_TITLE_FONT_FAMILY) + .fontWeight(LiveConstants.TITLE_FONT_WEIGHT) + .fontColor($r('app.color.live_title_color')) + .margin({ left: $r('app.float.title_left_margin') }) + .height($r('app.float.title_height')) + } + .height($r('app.float.title_row_height')) + .width(LiveConstants.FULL_WIDTH_PERCENT) + } +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/live/src/main/ets/view/LiveList.ets b/MultiDeviceMusic-army/live/src/main/ets/view/LiveList.ets new file mode 100644 index 0000000000000000000000000000000000000000..9419f36c73d7bbd158677d072fad14b20a10a6fc --- /dev/null +++ b/MultiDeviceMusic-army/live/src/main/ets/view/LiveList.ets @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2023 Huawei Device 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 { LiveStream } from '../bean/LiveStream'; +import { LiveConstants } from '../constants/LiveConstants'; +import { LiveStreamViewModel } from '../viewmodel/LiveStreamViewModel'; + +@Component +export struct LiveList { + private scroller: Scroller = new Scroller(); + @State liveStreams: LiveStream[] = new LiveStreamViewModel().getLiveStreamList(); + @State currentBreakpoint: string = LiveConstants.CURRENT_BREAKPOINT; + + build() { + GridRow({ + columns: { sm: LiveConstants.FOUR_COLUMN, md: LiveConstants.EIGHT_COLUMN, lg: LiveConstants.TWELVE_COLUMN }, + breakpoints: { value: [LiveConstants.SMALL_DEVICE_TYPE, LiveConstants.MIDDLE_DEVICE_TYPE, LiveConstants + .LARGE_DEVICE_TYPE] }, + gutter: { x: $r('app.float.grid_row_gutter') } + }) { + GridCol({ + span: { sm: LiveConstants.FOUR_COLUMN, md:LiveConstants.SIX_COLUMN, lg: LiveConstants.EIGHT_COLUMN }, + offset: { sm: LiveConstants.ZERO_COLUMN, md: LiveConstants.ONE_COLUMN, lg: LiveConstants.TWO_COLUMN } + }) { + Scroll(this.scroller) { + Column() { + ForEach(this.liveStreams, (item: LiveStream, index: number) => { + this.LiveItem(item, index) + }, (item: LiveStream, index: number) => index + JSON.stringify(item)) + } + .width(LiveConstants.FULL_WIDTH_PERCENT) + } + .align(Alignment.Top) + .scrollBar(BarState.Off) + .margin({ + bottom: $r('app.float.scroll_margin_bottom') + }) + } + .margin({ left: $r('app.float.grid_col_left_margin'), right: $r('app.float.grid_col_right_margin') }) + } + .onBreakpointChange((breakPoints) => { + this.currentBreakpoint = breakPoints; + }) + } + + @Builder + LiveItem(item: LiveStream, index: number) { + Stack({ alignContent: Alignment.Center }) { + Image(item.liveBackground) + .size({ width: LiveConstants.FULL_WIDTH_PERCENT, height: $r('app.float.live_image_height') }) + .borderRadius($r('app.float.live_image_border_radius')) + + Column() { + Row() { + Image($r('app.media.ic_video')) + .width($r('app.float.video_width')) + .height($r('app.float.video_height')) + .margin({ top: this.currentBreakpoint === LiveConstants.CURRENT_BREAKPOINT + ? $r('app.float.video_top_margin_small') : $r('app.float.video_top_margin_middle_large') }) + } + .height($r('app.float.video_row_height')) + .width(LiveConstants.FULL_WIDTH_PERCENT) + .alignItems(VerticalAlign.Top) + .justifyContent(FlexAlign.End) + + Column() { + Row() { + Text(item.title) + .fontColor($r('app.color.white')) + .fontWeight(LiveConstants.LIVE_TITLE_FONT_WEIGHT) + .fontFamily(LiveConstants.LIVE_ITEM_TITLE_FONT_FAMILY) + .fontSize($r('app.float.live_item_title_font_size')) + } + .height($r('app.float.live_item_title_height')) + .margin({ top: this.currentBreakpoint === LiveConstants.CURRENT_BREAKPOINT + ? $r('app.float.live_item_top_margin_phone') : $r('app.float.live_item_top_margin_tablet')}) + .width(LiveConstants.FULL_WIDTH_PERCENT) + + Row() { + Text(item.liveIntroduction) + .fontFamily(LiveConstants.LIVE_ITEM_INTRODUCTION_FONT_FAMILY) + .fontSize($r('app.float.live_introduction_font_size')) + .fontColor($r('app.color.live_introduction')) + .fontWeight(LiveConstants.LIVE_INTRODUCTION_FONT_WEIGHT) + } + .width(LiveConstants.FULL_WIDTH_PERCENT) + .height($r('app.float.live_introduction_height')) + .margin({ top: $r('app.float.live_introduction_top_margin') }) + } + .height($r('app.float.live_item_row_height')) + .alignItems(HorizontalAlign.Start) + .justifyContent(FlexAlign.Start) + } + .height($r('app.float.live_image_height')) + .padding({ + left: this.currentBreakpoint === LiveConstants.CURRENT_BREAKPOINT + ? $r('app.float.small_left_right_padding') : $r('app.float.middle_large_left_right_padding'), + right: this.currentBreakpoint === LiveConstants.CURRENT_BREAKPOINT + ? $r('app.float.small_left_right_padding') : $r('app.float.middle_large_left_right_padding') + }) + } + .width(LiveConstants.FULL_WIDTH_PERCENT) + .margin({ + top: index === 0 ? $r('app.float.stack_top_margin_small') : 0, + bottom: $r('app.float.stack_top_margin_middle' + ) + }) + } +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/live/src/main/ets/viewmodel/LiveStreamViewModel.ets b/MultiDeviceMusic-army/live/src/main/ets/viewmodel/LiveStreamViewModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..d1cc312809fb7830fa1c8f7e80750615593fad13 --- /dev/null +++ b/MultiDeviceMusic-army/live/src/main/ets/viewmodel/LiveStreamViewModel.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2023 Huawei Device 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 { LiveStream } from '../bean/LiveStream'; + +export class LiveStreamViewModel { + getLiveStreamList(): LiveStream[] { + let LiveStreamList: Array = []; + LiveStreamList.push(new LiveStream($r('app.string.live_one'), $r('app.string.live_one_introduction'), + $r('app.media.snow_mountain'))); + LiveStreamList.push(new LiveStream($r('app.string.live_two'), $r('app.string.live_two_introduction'), + $r('app.media.meal'))); + LiveStreamList.push(new LiveStream($r('app.string.live_three'), $r('app.string.live_three_introduction'), + $r('app.media.insects_world'))); + return LiveStreamList; + } +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/live/src/main/module.json5 b/MultiDeviceMusic-army/live/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..1c42d6b7f5e77d6edddadd589119d9bd20cddd0c --- /dev/null +++ b/MultiDeviceMusic-army/live/src/main/module.json5 @@ -0,0 +1,13 @@ +{ + "module": { + "name": "live", + "type": "shared", + "description": "$string:shared_desc", + "deviceTypes": [ + "default", + "tablet" + ], + "deliveryWithInstall": true, + "pages": "$profile:main_pages" + } +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/live/src/main/resources/base/element/color.json b/MultiDeviceMusic-army/live/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..987c3aa1861f4de2c2dfee44e86b2c8d2e9e9f08 --- /dev/null +++ b/MultiDeviceMusic-army/live/src/main/resources/base/element/color.json @@ -0,0 +1,16 @@ +{ + "color": [ + { + "name": "white", + "value": "#FFFFFF" + }, + { + "name": "live_title_color", + "value": "#FF182431" + }, + { + "name": "live_introduction", + "value": "#99FFFFFF" + } + ] +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/live/src/main/resources/base/element/float.json b/MultiDeviceMusic-army/live/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..bad93cb88c3896bba3c8e3220ece1ac5f8f70954 --- /dev/null +++ b/MultiDeviceMusic-army/live/src/main/resources/base/element/float.json @@ -0,0 +1,124 @@ +{ + "float": [ + { + "name": "back_width", + "value": "24vp" + }, + { + "name": "back_height", + "value": "24vp" + }, + { + "name": "back_left_margin", + "value": "24vp" + }, + { + "name": "title_font_size", + "value": "20fp" + }, + { + "name": "title_left_margin", + "value": "16vp" + }, + { + "name": "title_height", + "value": "28vp" + }, + { + "name": "title_row_height", + "value": "56vp" + }, + { + "name": "grid_row_gutter", + "value": "12vp" + }, + { + "name": "live_image_height", + "value": "200vp" + }, + { + "name": "stack_top_margin_small", + "value": "8vp" + }, + { + "name": "stack_top_margin_middle", + "value": "12vp" + }, + { + "name": "live_image_border_radius", + "value": "24vp" + }, + { + "name": "video_width", + "value": "24vp" + }, + { + "name": "video_height", + "value": "24vp" + }, + { + "name": "video_top_margin_small", + "value": "16vp" + }, + { + "name": "video_top_margin_middle_large", + "value": "24vp" + }, + { + "name": "video_row_height", + "value": "112vp" + }, + { + "name": "grid_col_left_margin", + "value": "12vp" + }, + { + "name": "grid_col_right_margin", + "value": "12vp" + }, + { + "name": "live_item_title_font_size", + "value": "21fp" + }, + { + "name": "live_item_title_height", + "value": "28vp" + }, + { + "name": "live_item_top_margin_phone", + "value": "21vp" + }, + { + "name": "live_item_top_margin_tablet", + "value": "13vp" + }, + { + "name": "live_introduction_font_size", + "value": "12fp" + }, + { + "name": "live_introduction_height", + "value": "17vp" + }, + { + "name": "live_introduction_top_margin", + "value": "2vp" + }, + { + "name": "small_left_right_padding", + "value": "16vp" + }, + { + "name": "middle_large_left_right_padding", + "value": "24vp" + }, + { + "name": "live_item_row_height", + "value": "88vp" + }, + { + "name": "scroll_margin_bottom", + "value": "56vp" + } + ] +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/live/src/main/resources/base/element/string.json b/MultiDeviceMusic-army/live/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f0520ef8db7dc78c6ac03baa5101b5ca707f623c --- /dev/null +++ b/MultiDeviceMusic-army/live/src/main/resources/base/element/string.json @@ -0,0 +1,35 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + }, + { + "name": "live_title", + "value": "Dandelion Live" + }, + { + "name": "live_one", + "value": "Drunk beauty snow mountain" + }, + { + "name": "live_one_introduction", + "value": "Well-known travel bloggers take you to see the most beautiful snow-capped mountains in Yunnan." + }, + { + "name": "live_two", + "value": "Quickly make reduced fat meals" + }, + { + "name": "live_two_introduction", + "value": "Professional dietitian takes you together in 5 minutes to get a nutritious salad." + }, { + "name": "live_three", + "value": "The world of insects" + }, + { + "name": "live_three_introduction", + "value": "Zoologists take you through the third world of insects." + } + ] +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/live/src/main/resources/base/media/ic_back.svg b/MultiDeviceMusic-army/live/src/main/resources/base/media/ic_back.svg new file mode 100644 index 0000000000000000000000000000000000000000..5e82eaf2dd24d2e4b33bd767d27946d0de4a2c5c --- /dev/null +++ b/MultiDeviceMusic-army/live/src/main/resources/base/media/ic_back.svg @@ -0,0 +1,13 @@ + + + ic_back + + + + + + + + + + \ No newline at end of file diff --git a/MultiDeviceMusic-army/live/src/main/resources/base/media/ic_video.svg b/MultiDeviceMusic-army/live/src/main/resources/base/media/ic_video.svg new file mode 100644 index 0000000000000000000000000000000000000000..2defcb7a8b4a2434cfecae00f065346f7aec0931 --- /dev/null +++ b/MultiDeviceMusic-army/live/src/main/resources/base/media/ic_video.svg @@ -0,0 +1,13 @@ + + + ic_video + + + + + + + + + + \ No newline at end of file diff --git a/MultiDeviceMusic-army/live/src/main/resources/base/media/icon.png b/MultiDeviceMusic-army/live/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/MultiDeviceMusic-army/live/src/main/resources/base/media/icon.png differ diff --git a/MultiDeviceMusic-army/live/src/main/resources/base/media/insects_world.jpeg b/MultiDeviceMusic-army/live/src/main/resources/base/media/insects_world.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..e5efb272ecd51b9b802836a1e202133b37f8110c Binary files /dev/null and b/MultiDeviceMusic-army/live/src/main/resources/base/media/insects_world.jpeg differ diff --git a/MultiDeviceMusic-army/live/src/main/resources/base/media/meal.jpeg b/MultiDeviceMusic-army/live/src/main/resources/base/media/meal.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..16175b7276d283083e0b30dd0ddd6178733ba403 Binary files /dev/null and b/MultiDeviceMusic-army/live/src/main/resources/base/media/meal.jpeg differ diff --git a/MultiDeviceMusic-army/live/src/main/resources/base/media/snow_mountain.jpeg b/MultiDeviceMusic-army/live/src/main/resources/base/media/snow_mountain.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..ac45ee88cf3f8a0c1cbf44fedd1af9d0a4950457 Binary files /dev/null and b/MultiDeviceMusic-army/live/src/main/resources/base/media/snow_mountain.jpeg differ diff --git a/MultiDeviceMusic-army/live/src/main/resources/base/profile/main_pages.json b/MultiDeviceMusic-army/live/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce --- /dev/null +++ b/MultiDeviceMusic-army/live/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/Index" + ] +} diff --git a/MultiDeviceMusic-army/live/src/main/resources/en_US/element/string.json b/MultiDeviceMusic-army/live/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..afd49cbf1688663769035f3b75870324751e8d80 --- /dev/null +++ b/MultiDeviceMusic-army/live/src/main/resources/en_US/element/string.json @@ -0,0 +1,35 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + }, + { + "name": "live_title", + "value": "Dandelion Live" + }, + { + "name": "live_one", + "value": "Drunk beauty snow mountain" + }, + { + "name": "live_one_introduction", + "value": "Well-known travel bloggers take you to see the most beautiful snow-capped mountains in Yunnan." + }, + { + "name": "live_two", + "value": "Quickly make reduced fat meals" + }, + { + "name": "live_two_introduction", + "value": "Professional dietitian takes you together in 5 minutes to get a nutritious salad." + }, { + "name": "live_three", + "value": "The world of insects" + }, + { + "name": "live_three_introduction", + "value": "Zoologists take you through the third world of insects." + } + ] +} diff --git a/MultiDeviceMusic-army/live/src/main/resources/zh_CN/element/string.json b/MultiDeviceMusic-army/live/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..66bbb84e3f7a7dec5af6f038618720aeff7e09d2 --- /dev/null +++ b/MultiDeviceMusic-army/live/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,35 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "描述" + }, + { + "name": "live_title", + "value": "蒲公英直播" + }, + { + "name": "live_one", + "value": "醉美雪山" + }, + { + "name": "live_one_introduction", + "value": "知名旅行博主带你一起观赏云南最美雪山。" + }, + { + "name": "live_two", + "value": "快速制作减脂餐" + }, + { + "name": "live_two_introduction", + "value": "专业营养师带你一起5分钟搞定营养沙拉。" + }, { + "name": "live_three", + "value": "昆虫的世界" + }, + { + "name": "live_three_introduction", + "value": "动物学家带你了解昆虫的第三世界。" + } + ] +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/local.properties b/MultiDeviceMusic-army/local.properties new file mode 100644 index 0000000000000000000000000000000000000000..89628bcab328058de2c4ba9295ca86fa5243e9a5 --- /dev/null +++ b/MultiDeviceMusic-army/local.properties @@ -0,0 +1,9 @@ +# This file is automatically generated by DevEco Studio. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file should *NOT* be checked into Version Control Systems, +# as it contains information specific to your local configuration. +# +# For customization when using a Version Control System, please read the header note. +nodejs.dir=C:/Users/armyq/nodejs +hwsdk.dir=D:/ProgramData/HarmonyOS/Sdk \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicComment/build-profile.json5 b/MultiDeviceMusic-army/musicComment/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..13c5eda6e6a3dae913ec5c5c4d60ea3ac954f205 --- /dev/null +++ b/MultiDeviceMusic-army/musicComment/build-profile.json5 @@ -0,0 +1,11 @@ +{ + "apiType": 'stageMode', + "buildOption": { + }, + "targets": [ + { + "name": "default", + "runtimeOS": "HarmonyOS" + } + ] +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicComment/hvigorfile.ts b/MultiDeviceMusic-army/musicComment/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..0e65ea8582bf16134695dfefbdc93d4cda460e84 --- /dev/null +++ b/MultiDeviceMusic-army/musicComment/hvigorfile.ts @@ -0,0 +1,2 @@ +// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently. +module.exports = require('@ohos/hvigor-ohos-plugin').hspTasks diff --git a/MultiDeviceMusic-army/musicComment/oh-package.json5 b/MultiDeviceMusic-army/musicComment/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..835bf17b00ea0928584c7235fefdd82fcd9afb66 --- /dev/null +++ b/MultiDeviceMusic-army/musicComment/oh-package.json5 @@ -0,0 +1,13 @@ +{ + "license": "Apache-2.0", + "devDependencies": {}, + "author": "", + "name": "musiccomment", + "description": "Please describe the basic information.", + "main": "./src/main/ets/Index.ets", + "version": "1.0.0", + "dependencies": { + "@ohos/mediaCommon": "file:../common/mediaCommon", + "@ohos/constantsCommon": "file:../common/constantsCommon" + } +} diff --git a/MultiDeviceMusic-army/musicComment/src/main/ets/Index.ets b/MultiDeviceMusic-army/musicComment/src/main/ets/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/MultiDeviceMusic-army/musicComment/src/main/ets/bean/Comment.ets b/MultiDeviceMusic-army/musicComment/src/main/ets/bean/Comment.ets new file mode 100644 index 0000000000000000000000000000000000000000..b5a401365e750c49d753b0306b4bbe75ded56903 --- /dev/null +++ b/MultiDeviceMusic-army/musicComment/src/main/ets/bean/Comment.ets @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2023 Huawei Device 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. + */ + +/** + * Comment entity class. + */ +export class Comment { + /** + * Comment nickname. + */ + nickname: string; + + /** + * Comment content. + */ + content: string; + + /** + * Comment time. + */ + time: string; + + /** + * Comment image. + */ + icon: ResourceStr; + + /** + * Reply to a list of comments. + */ + commentList: Comment[]; + + constructor(nickname: string, content: string, time: string, icon: ResourceStr, commentList?: Comment[]) { + this.nickname = nickname; + this.content = content; + this.time = time; + this.icon = icon; + this.commentList = commentList; + } +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicComment/src/main/ets/constants/CommonConstants.ets b/MultiDeviceMusic-army/musicComment/src/main/ets/constants/CommonConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..68d6befd30d78078886524ff9239399f59c6add8 --- /dev/null +++ b/MultiDeviceMusic-army/musicComment/src/main/ets/constants/CommonConstants.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2023 Huawei Device 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. + */ + +/** + * Common constants for all features. + */ +export class CommonConstants { + /** + * Spacing between list items. + */ + static readonly LIST_SPACE: string = '10vp'; + + /** + * A maximum of 4 reviews can be displayed under sm and md device types. + */ + static readonly LIST_COUNT: number = 4; + + /** + * Prefix of the reply message. + */ + static readonly NICKNAME_PREV: string = '@'; + + /** + * Suffix of the reply message. + */ + static readonly NICKNAME_SUFFIX: string = ':'; +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicComment/src/main/ets/pages/Index.ets b/MultiDeviceMusic-army/musicComment/src/main/ets/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..5e3210ce129c920cab80415dd2e9ee045959a7c2 --- /dev/null +++ b/MultiDeviceMusic-army/musicComment/src/main/ets/pages/Index.ets @@ -0,0 +1,188 @@ +/* + * Copyright (c) 2023 Huawei Device 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 { StyleConstants, BreakpointConstants } from '@ohos/constantsCommon'; +import { Comment } from '../bean/Comment'; +import CommentViewModel from '../viewmodel/CommentViewModel'; +import { ListItemComponent } from '../view/ListItemComponent'; +import { HeadComponent } from '../view/HeadComponent'; +import { MusicInfoComponent } from '../view/MusicInfoComponent'; +import { CommonConstants } from '../constants/CommonConstants'; + +@Entry +@Component +struct Index { + @State currentBp: string = BreakpointConstants.CURRENT_BREAKPOINT; + @State wonderfulComment: Comment[] = CommentViewModel.getWonderfulReview(); + @State newComment: Comment[] = CommentViewModel.getNewComment(); + + @Builder ShowTitle(title: ResourceStr) { + Row() { + Text(title) + .fontSize($r('app.float.comment_title_size')) + .fontColor($r('app.color.comment_title_color')) + .lineHeight($r('app.float.title_line_height')) + .fontWeight(FontWeight.Medium) + .margin({ + top: $r('app.float.title_margin_top'), + bottom: $r('app.float.title_margin_bottom'), + left: this.currentBp === BreakpointConstants.BREAKPOINT_SM ? + $r('app.float.margin_left_sm') : $r('app.float.margin_left'), + right: this.currentBp === BreakpointConstants.BREAKPOINT_SM ? + $r('app.float.margin_right_sm') : $r('app.float.margin_right') + }) + } + .justifyContent(FlexAlign.Start) + .width(StyleConstants.FULL_WIDTH) + } + + build() { + GridRow({ + breakpoints: { + value: BreakpointConstants.BREAKPOINT_VALUE, + reference: BreakpointsReference.WindowSize + }, + columns: { + sm: BreakpointConstants.COLUMN_SM, + md: BreakpointConstants.COLUMN_MD, + lg: BreakpointConstants.COLUMN_LG + }, + gutter: { x: BreakpointConstants.GUTTER_X } + }) { + GridCol({ + span: { + sm: BreakpointConstants.COLUMN_SM, + md: BreakpointConstants.COLUMN_MD, + lg: BreakpointConstants.COLUMN_LG + } + }) { + Column() { + HeadComponent() + .margin({ + left: this.currentBp === BreakpointConstants.BREAKPOINT_SM ? + $r('app.float.margin_left_sm') : $r('app.float.margin_left'), + right: this.currentBp === BreakpointConstants.BREAKPOINT_SM ? + $r('app.float.margin_right_sm') : $r('app.float.margin_right') + }) + + MusicInfoComponent() + .margin({ + left: this.currentBp === BreakpointConstants.BREAKPOINT_SM ? + $r('app.float.margin_left_sm') : $r('app.float.margin_left'), + right: this.currentBp === BreakpointConstants.BREAKPOINT_SM ? + $r('app.float.margin_right_sm') : $r('app.float.margin_right') + }) + + this.ShowTitle($r('app.string.wonderful_comment')) + + List() { + ForEach(this.wonderfulComment, (comment: Comment, index) => { + if (this.currentBp === BreakpointConstants.BREAKPOINT_SM || + this.currentBp === BreakpointConstants.BREAKPOINT_MD) { + if (index < CommonConstants.LIST_COUNT) { + ListItem() { + ListItemComponent({ item: comment }) + .margin({ + left: this.currentBp === BreakpointConstants.BREAKPOINT_SM ? + 0 : $r('app.float.margin_left_list'), + right: this.currentBp === BreakpointConstants.BREAKPOINT_SM ? + 0 : $r('app.float.margin_right_list') + }) + } + .width(StyleConstants.FULL_WIDTH) + .padding({ + bottom: $r('app.float.padding_bottom') + }) + } + } else { + ListItem() { + ListItemComponent({ item: comment }) + .margin({ + left: this.currentBp === BreakpointConstants.BREAKPOINT_SM ? + 0 : $r('app.float.margin_left_list'), + right: this.currentBp === BreakpointConstants.BREAKPOINT_SM ? + 0 : $r('app.float.margin_right_list') + }) + } + .width(StyleConstants.FULL_WIDTH) + .padding({ + bottom: $r('app.float.padding_bottom') + }) + } + }, (item, index) => index + JSON.stringify(item)) + } + .lanes(this.currentBp === BreakpointConstants.BREAKPOINT_LG ? 2 : 1) + .scrollBar(BarState.Off) + .divider({ + color: $r('app.color.list_divider'), + strokeWidth: $r('app.float.stroke_width'), + startMargin: this.currentBp === BreakpointConstants.BREAKPOINT_SM ? + $r('app.float.start_margin') : $r('app.float.start_margin_lg'), + endMargin: this.currentBp === BreakpointConstants.BREAKPOINT_SM ? + 0 : $r('app.float.divider_margin_left') + }) + .margin({ + left: this.currentBp === BreakpointConstants.BREAKPOINT_SM ? + $r('app.float.margin_left_sm') : $r('app.float.margin_left_list'), + right: this.currentBp === BreakpointConstants.BREAKPOINT_SM ? + $r('app.float.margin_right_sm') : $r('app.float.margin_right_list') + }) + + this.ShowTitle($r('app.string.new_comment')) + + List() { + ForEach(this.newComment, (comment: Comment, index) => { + ListItem() { + ListItemComponent({ item: comment }) + .margin({ + left: this.currentBp === BreakpointConstants.BREAKPOINT_SM ? + 0 : $r('app.float.margin_left_list'), + right: this.currentBp === BreakpointConstants.BREAKPOINT_SM ? + 0 : $r('app.float.margin_right_list') + }) + } + .width(StyleConstants.FULL_WIDTH) + .padding({ + bottom: $r('app.float.padding_bottom') + }) + }, (item, index) => index + JSON.stringify(item)) + } + .layoutWeight(1) + .lanes(this.currentBp === BreakpointConstants.BREAKPOINT_LG ? 2 : 1) + .scrollBar(BarState.Off) + .margin({ + left: this.currentBp === BreakpointConstants.BREAKPOINT_SM ? + $r('app.float.margin_left_sm') : $r('app.float.margin_left_list'), + right: this.currentBp === BreakpointConstants.BREAKPOINT_SM ? + $r('app.float.margin_right_sm') : $r('app.float.margin_right_list') + }) + .divider({ + color: $r('app.color.list_divider'), + strokeWidth: $r('app.float.stroke_width'), + startMargin: this.currentBp === BreakpointConstants.BREAKPOINT_SM ? + $r('app.float.start_margin') : $r('app.float.start_margin_lg'), + endMargin: this.currentBp === BreakpointConstants.BREAKPOINT_SM ? + 0 : $r('app.float.divider_margin_left') + }) + } + .height(StyleConstants.FULL_HEIGHT) + } + } + .backgroundColor(Color.White) + .onBreakpointChange((breakpoint) => { + this.currentBp = breakpoint; + }) + } +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicComment/src/main/ets/view/HeadComponent.ets b/MultiDeviceMusic-army/musicComment/src/main/ets/view/HeadComponent.ets new file mode 100644 index 0000000000000000000000000000000000000000..cd5750d714c94602271b265c1a31649453bb5f58 --- /dev/null +++ b/MultiDeviceMusic-army/musicComment/src/main/ets/view/HeadComponent.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2023 Huawei Device 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 router from '@ohos.router'; +import { StyleConstants } from '@ohos/constantsCommon'; + +@Component +export struct HeadComponent { + build() { + Row() { + Image($r('app.media.ic_public_back')) + .width($r('app.float.header_image_width')) + .height($r('app.float.header_image_height')) + .margin({ + left: $r('app.float.header_margin_left'), + right: $r('app.float.header_margin_right') + }) + Text($r('app.string.comment_title')) + .fontSize($r('app.float.header_font_size')) + .fontColor($r('app.color.header_font_color')) + .lineHeight($r('app.float.header_line_height')) + .fontWeight(FontWeight.Medium) + } + .width(StyleConstants.FULL_WIDTH) + .height($r('app.float.header_height')) + .onClick(() => { + router.back(); + }) + } +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicComment/src/main/ets/view/ListItemComponent.ets b/MultiDeviceMusic-army/musicComment/src/main/ets/view/ListItemComponent.ets new file mode 100644 index 0000000000000000000000000000000000000000..060620b3e1a4ecff25ebede8f86892b24060d82a --- /dev/null +++ b/MultiDeviceMusic-army/musicComment/src/main/ets/view/ListItemComponent.ets @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2023 Huawei Device 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 { StyleConstants } from '@ohos/constantsCommon'; +import { Comment } from '../bean/Comment'; +import { CommonConstants } from '../constants/CommonConstants'; + +@Component +export struct ListItemComponent { + private item: Comment; + + build() { + Row() { + Image(this.item.icon) + .width($r('app.float.list_image_width')) + .height($r('app.float.list_image_height')) + .borderRadius($r('app.float.list_border_radius')) + .margin({ + right: $r('app.float.list_image_margin_right') + }) + Column() { + Row() { + Column() { + Text(this.item.nickname) + .fontSize($r('app.float.nickname_font_size')) + .fontColor($r('app.color.nickname_color')) + .fontWeight(FontWeight.Regular) + Text(this.item.time) + .fontSize($r('app.float.time_font_size')) + .fontColor($r('app.color.time_color')) + .fontWeight(FontWeight.Regular) + .margin({ + top: $r('app.float.time_margin_top') + }) + Text(this.item.content) + .fontSize($r('app.float.content_font_size')) + .fontColor($r('app.color.content_color')) + .fontWeight(FontWeight.Regular) + .margin({ + top: $r('app.float.content_margin_top') + }) + } + .alignItems(HorizontalAlign.Start) + .layoutWeight(1) + Blank() + Image($r('app.media.ic_good')) + .width($r('app.float.good_width')) + .height($r('app.float.good_height')) + .margin({ + top: $r('app.float.good_margin_top') + }) + } + .width(StyleConstants.FULL_WIDTH) + .alignItems(VerticalAlign.Top) + + if (this.item.commentList && this.item.commentList.length > 0) { + Row() { + Column() { + Text() { + Span(CommonConstants.NICKNAME_PREV + this.item.commentList[0].nickname + + CommonConstants.NICKNAME_SUFFIX) + .fontSize($r('app.float.span_font_size')) + .fontColor($r('app.color.span_color')) + .fontWeight(FontWeight.Regular) + Span(this.item.commentList[0].content) + .fontSize($r('app.float.span_font_size')) + .fontColor($r('app.color.span_color')) + .fontWeight(FontWeight.Regular) + } + } + .backgroundColor($r('app.color.review_color')) + .padding($r('app.float.review_padding')) + } + .margin({ + top: $r('app.float.review_margin_top') + }) + .width(StyleConstants.FULL_WIDTH) + .justifyContent(FlexAlign.Start) + } + } + .layoutWeight(1) + } + .width(StyleConstants.FULL_WIDTH) + .alignItems(VerticalAlign.Top) + .padding({ + top: $r('app.float.list_padding_top') + }) + } +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicComment/src/main/ets/view/MusicInfoComponent.ets b/MultiDeviceMusic-army/musicComment/src/main/ets/view/MusicInfoComponent.ets new file mode 100644 index 0000000000000000000000000000000000000000..0d43dd671a24044be8603c76d528c1dd2be9a723 --- /dev/null +++ b/MultiDeviceMusic-army/musicComment/src/main/ets/view/MusicInfoComponent.ets @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2023 Huawei Device 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 router from '@ohos.router'; +import { Logger, SongItem, MusicList } from '@ohos/mediaCommon'; +import { RouterUrlConstants, StyleConstants } from '@ohos/constantsCommon'; + +@Component +export struct MusicInfoComponent { + @StorageProp('selectIndex') selectIndex: number = 0; + songList: SongItem[] = MusicList; + + build() { + Row() { + Image(this.songList[this.selectIndex].label) + .width($r('app.float.info_image_width')) + .height($r('app.float.info_image_height')) + .margin({ + right: $r('app.float.info_image_margin_right') + }) + .borderRadius($r('app.float.info_image_border')) + Column() { + Text(this.songList[this.selectIndex].title) + .fontSize($r('app.float.info_title_size')) + .fontWeight(FontWeight.Regular) + .fontColor($r('app.color.info_title_color')) + Text(this.songList[this.selectIndex].singer) + .fontSize($r('app.float.info_singer_size')) + .fontWeight(FontWeight.Regular) + .fontColor($r('app.color.info_singer_color')) + .lineHeight($r('app.float.info_singer_line_height')) + } + .alignItems(HorizontalAlign.Start) + + Blank() + Image($r('app.media.ic_arrow_right')) + .height($r('app.float.arrow_right_height')) + .objectFit(1) + .onClick(() => { + router.pushUrl({ + url: RouterUrlConstants.MUSIC_PLAY + }, router.RouterMode.Single).catch(error => { + Logger.error('pushUrl failed :' + JSON.stringify(error)) + }); + }) + } + .height($r('app.float.info_height')) + .width(StyleConstants.FULL_WIDTH) + .padding({ + top: $r('app.float.info_padding_top'), + bottom: $r('app.float.info_padding_bottom') + }) + } +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicComment/src/main/ets/viewmodel/CommentViewModel.ets b/MultiDeviceMusic-army/musicComment/src/main/ets/viewmodel/CommentViewModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..0fa2daeb19f6d954a38145cc91be369e54b5bf4a --- /dev/null +++ b/MultiDeviceMusic-army/musicComment/src/main/ets/viewmodel/CommentViewModel.ets @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2023 Huawei Device 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 { Comment } from '../bean/Comment'; + +/** + * Review data generation class. + */ +class CommentViewModel { + /** + * Get great review data. + * + * @returns Comment array. + */ + getWonderfulReview(): Comment[] { + let commentList = []; + commentList.push( + new Comment('139******92', '突然发现系统自带的音乐软件那么强大', '2021年9月7日', $r('app.media.ic_avatar1'))); + commentList.push(new Comment('ke歌可Qi', '单曲循环到天明', '2021年9月4日', $r('app.media.ic_avatar2'))); + commentList.push( + new Comment('Change', '这里歌曲多,人说话又好听,真的太喜欢这里了', '2021年9月1日', $r('app.media.ic_avatar3'))); + commentList.push(new Comment('可可的家', '真是太好听了', '2021年9月7日', $r('app.media.ic_avatar5'))); + commentList.push(new Comment('Nice', '最爱的歌之一啦,超好听', '2021年9月4日', $r('app.media.ic_avatar6'))); + commentList.push(new Comment('没有的世界', '这里歌曲多,人说话又好听', '2021年9月1日', $r('app.media.ic_avatar7'))); + commentList.push(new Comment('蓝色的大海', '在海边听这首歌有另外一种意境', '2021年9月1日', $r('app.media.ic_avatar8'), [ + new Comment('不熬夜了', '身临其境', '2021年9月7日', $r('app.media.ic_avatar1')) + ])); + commentList.push(new Comment('伦本伦', '同听一首歌,我们就是好盆友', '2021年9月1日', $r('app.media.ic_avatar4'), [ + new Comment('今夜小雨', '高考一毕业了,我又会在这里还听这首歌,感觉是一样的热血澎湃', + '2021年9月7日', $r('app.media.ic_avatar9')) + ])); + return commentList; + } + + /** + * Obtain the latest comment data. + * + * @returns Comment array. + */ + getNewComment(): Comment[] { + let commentList = []; + commentList.push( + new Comment('139******92', '突然发现系统自带的音乐软件那么强大', '2021年9月7日', $r('app.media.ic_avatar9'))); + commentList.push(new Comment('139******92', '最爱的歌之一啦,超好听', '2021年9月4日', $r('app.media.ic_avatar10'))); + commentList.push(new Comment('159******88', '突然发现音乐的力量太治愈了', '2021年9月1日', $r('app.media.ic_avatar11'))); + commentList.push(new Comment('159******88', '在海边听这首歌有另外一种意境', '2021年9月1日', $r('app.media.ic_avatar12'))); + return commentList; + } +} + +export default new CommentViewModel(); \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicComment/src/main/module.json5 b/MultiDeviceMusic-army/musicComment/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..ace755fe77f190a121f9202f923ddd4fe71f791e --- /dev/null +++ b/MultiDeviceMusic-army/musicComment/src/main/module.json5 @@ -0,0 +1,13 @@ +{ + "module": { + "name": "musicComment", + "type": "shared", + "description": "$string:shared_desc", + "deviceTypes": [ + "default", + "tablet" + ], + "deliveryWithInstall": true, + "pages": "$profile:main_pages" + } +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicComment/src/main/resources/base/element/color.json b/MultiDeviceMusic-army/musicComment/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..8277ab69e78b6d0f13ec7509805db9876c074f32 --- /dev/null +++ b/MultiDeviceMusic-army/musicComment/src/main/resources/base/element/color.json @@ -0,0 +1,48 @@ +{ + "color": [ + { + "name": "white", + "value": "#FFFFFF" + }, + { + "name": "comment_title_color", + "value": "#e6000000" + }, + { + "name": "list_divider", + "value": "#1a182431" + }, + { + "name": "header_font_color", + "value": "#e6000000" + }, + { + "name": "nickname_color", + "value": "#99182431" + }, + { + "name": "time_color", + "value": "#66182431" + }, + { + "name": "content_color", + "value": "#182431" + }, + { + "name": "span_color", + "value": "#66000000" + }, + { + "name": "review_color", + "value": "#0d000000" + }, + { + "name": "info_title_color", + "value": "#e6000000" + }, + { + "name": "info_singer_color", + "value": "#e6000000" + } + ] +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicComment/src/main/resources/base/element/float.json b/MultiDeviceMusic-army/musicComment/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..f493efe42a797b1ca164217ca2c0603474571c2f --- /dev/null +++ b/MultiDeviceMusic-army/musicComment/src/main/resources/base/element/float.json @@ -0,0 +1,204 @@ +{ + "float": [ + { + "name": "comment_title_size", + "value": "16fp" + }, + { + "name": "title_line_height", + "value": "16fp" + }, + { + "name": "title_margin_top", + "value": "18vp" + }, + { + "name": "title_margin_bottom", + "value": "8.5vp" + }, + { + "name": "margin_left_sm", + "value": "16vp" + }, + { + "name": "margin_left", + "value": "24vp" + }, + { + "name": "divider_margin_left", + "value": "12vp" + }, + { + "name": "margin_left_list", + "value": "12vp" + }, + { + "name": "padding_bottom", + "value": "12vp" + }, + { + "name": "margin_right_sm", + "value": "16vp" + }, + { + "name": "margin_right", + "value": "24vp" + }, + { + "name": "margin_right_list", + "value": "12vp" + }, + { + "name": "stroke_width", + "value": "0.5vp" + }, + { + "name": "start_margin", + "value": "56vp" + }, + { + "name": "start_margin_lg", + "value": "64vp" + }, + { + "name": "header_image_width", + "value": "20vp" + }, + { + "name": "header_image_height", + "value": "18vp" + }, + { + "name": "header_margin_left", + "value": "2vp" + }, + { + "name": "header_margin_right", + "value": "18vp" + }, + { + "name": "header_font_size", + "value": "20fp" + }, + { + "name": "header_line_height", + "value": "28vp" + }, + { + "name": "header_height", + "value": "56vp" + }, + { + "name": "list_image_width", + "value": "40vp" + }, + { + "name": "list_image_height", + "value": "40vp" + }, + { + "name": "list_border_radius", + "value": "32vp" + }, + { + "name": "list_image_margin_right", + "value": "16vp" + }, + { + "name": "nickname_font_size", + "value": "15fp" + }, + { + "name": "time_font_size", + "value": "10fp" + }, + { + "name": "time_margin_top", + "value": "2vp" + }, + { + "name": "content_font_size", + "value": "13fp" + }, + { + "name": "content_margin_top", + "value": "10vp" + }, + { + "name": "good_width", + "value": "16vp" + }, + { + "name": "good_height", + "value": "16vp" + }, + { + "name": "good_margin_top", + "value": "2vp" + }, + { + "name": "span_font_size", + "value": "13fp" + }, + { + "name": "review_padding", + "value": "8vp" + }, + { + "name": "review_margin_top", + "value": "4vp" + }, + { + "name": "list_padding_top", + "value": "12vp" + }, + { + "name": "info_image_width", + "value": "64vp" + }, + { + "name": "info_image_height", + "value": "64vp" + }, + { + "name": "info_image_margin_right", + "value": "16vp" + }, + { + "name": "info_image_border", + "value": "8vp" + }, + { + "name": "info_title_size", + "value": "16fp" + }, + { + "name": "info_singer_size", + "value": "12fp" + }, + { + "name": "info_singer_line_height", + "value": "17vp" + }, + { + "name": "arrow_right_width", + "value": "12vp" + }, + { + "name": "arrow_right_height", + "value": "24vp" + }, + { + "name": "info_height", + "value": "88vp" + }, + { + "name": "info_padding_top", + "value": "12vp" + }, + { + "name": "info_padding_bottom", + "value": "12vp" + } + ] +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicComment/src/main/resources/base/element/string.json b/MultiDeviceMusic-army/musicComment/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..bbcfc090d06a91f9fc7d4d65858ce60e5491f731 --- /dev/null +++ b/MultiDeviceMusic-army/musicComment/src/main/resources/base/element/string.json @@ -0,0 +1,20 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + }, + { + "name": "comment_title", + "value": "comment" + }, + { + "name": "wonderful_comment", + "value": "Wonderful review(999+)" + }, + { + "name": "new_comment", + "value": "Latest Reviews" + } + ] +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicComment/src/main/resources/base/media/ic_arrow_right.svg b/MultiDeviceMusic-army/musicComment/src/main/resources/base/media/ic_arrow_right.svg new file mode 100644 index 0000000000000000000000000000000000000000..c452b001dafc1d775bb2847e572c0be794fe562d --- /dev/null +++ b/MultiDeviceMusic-army/musicComment/src/main/resources/base/media/ic_arrow_right.svg @@ -0,0 +1,13 @@ + + + ic_arrow_right + + + + + + + + + + \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicComment/src/main/resources/base/media/ic_good.svg b/MultiDeviceMusic-army/musicComment/src/main/resources/base/media/ic_good.svg new file mode 100644 index 0000000000000000000000000000000000000000..bfcb41ae6386ee04d6b683ae24ab24dd0070f145 --- /dev/null +++ b/MultiDeviceMusic-army/musicComment/src/main/resources/base/media/ic_good.svg @@ -0,0 +1,13 @@ + + + ic_good + + + + + + + + + + \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicComment/src/main/resources/base/media/ic_public_back.png b/MultiDeviceMusic-army/musicComment/src/main/resources/base/media/ic_public_back.png new file mode 100644 index 0000000000000000000000000000000000000000..bf418cb1f54da326feb5022e372d925f0103e34a Binary files /dev/null and b/MultiDeviceMusic-army/musicComment/src/main/resources/base/media/ic_public_back.png differ diff --git a/MultiDeviceMusic-army/musicComment/src/main/resources/base/media/icon.png b/MultiDeviceMusic-army/musicComment/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/MultiDeviceMusic-army/musicComment/src/main/resources/base/media/icon.png differ diff --git a/MultiDeviceMusic-army/musicComment/src/main/resources/base/profile/main_pages.json b/MultiDeviceMusic-army/musicComment/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce --- /dev/null +++ b/MultiDeviceMusic-army/musicComment/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/Index" + ] +} diff --git a/MultiDeviceMusic-army/musicComment/src/main/resources/en_US/element/string.json b/MultiDeviceMusic-army/musicComment/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..bbcfc090d06a91f9fc7d4d65858ce60e5491f731 --- /dev/null +++ b/MultiDeviceMusic-army/musicComment/src/main/resources/en_US/element/string.json @@ -0,0 +1,20 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + }, + { + "name": "comment_title", + "value": "comment" + }, + { + "name": "wonderful_comment", + "value": "Wonderful review(999+)" + }, + { + "name": "new_comment", + "value": "Latest Reviews" + } + ] +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicComment/src/main/resources/zh_CN/element/string.json b/MultiDeviceMusic-army/musicComment/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..68ae34ba63f68051868ef0a4b1c9ce7122bf29ef --- /dev/null +++ b/MultiDeviceMusic-army/musicComment/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,20 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + }, + { + "name": "comment_title", + "value": "评论" + }, + { + "name": "wonderful_comment", + "value": "精彩评论(999+)" + }, + { + "name": "new_comment", + "value": "最新评论" + } + ] +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicList/build-profile.json5 b/MultiDeviceMusic-army/musicList/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..13c5eda6e6a3dae913ec5c5c4d60ea3ac954f205 --- /dev/null +++ b/MultiDeviceMusic-army/musicList/build-profile.json5 @@ -0,0 +1,11 @@ +{ + "apiType": 'stageMode', + "buildOption": { + }, + "targets": [ + { + "name": "default", + "runtimeOS": "HarmonyOS" + } + ] +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicList/hvigorfile.ts b/MultiDeviceMusic-army/musicList/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..0e65ea8582bf16134695dfefbdc93d4cda460e84 --- /dev/null +++ b/MultiDeviceMusic-army/musicList/hvigorfile.ts @@ -0,0 +1,2 @@ +// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently. +module.exports = require('@ohos/hvigor-ohos-plugin').hspTasks diff --git a/MultiDeviceMusic-army/musicList/oh-package.json5 b/MultiDeviceMusic-army/musicList/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..dd6ea856cafd02b9b231f773d391a55f14cc6e80 --- /dev/null +++ b/MultiDeviceMusic-army/musicList/oh-package.json5 @@ -0,0 +1,13 @@ +{ + "license": "Apache-2.0", + "devDependencies": {}, + "author": "", + "name": "musiclist", + "description": "Please describe the basic information.", + "main": "./src/main/ets/Index.ets", + "version": "1.0.0", + "dependencies": { + "@ohos/mediaCommon": "file:../common/mediaCommon", + "@ohos/constantsCommon": "file:../common/constantsCommon" + } +} diff --git a/MultiDeviceMusic-army/musicList/src/main/ets/Index.ets b/MultiDeviceMusic-army/musicList/src/main/ets/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..c1206616a515f60068557229d6e6bd4caecd0f0c --- /dev/null +++ b/MultiDeviceMusic-army/musicList/src/main/ets/Index.ets @@ -0,0 +1,3 @@ +export { Content } from './components/Content'; +export { Header } from './components/Header'; +export { Player } from './components/Player'; diff --git a/MultiDeviceMusic-army/musicList/src/main/ets/components/AlbumComponent.ets b/MultiDeviceMusic-army/musicList/src/main/ets/components/AlbumComponent.ets new file mode 100644 index 0000000000000000000000000000000000000000..7113d8f2dcda296311bb52d2149cc927abbef20d --- /dev/null +++ b/MultiDeviceMusic-army/musicList/src/main/ets/components/AlbumComponent.ets @@ -0,0 +1,178 @@ +/* + * Copyright (c) 2023 Huawei Device 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 { StyleConstants } from '@ohos/constantsCommon'; +import { BreakpointConstants } from '@ohos/constantsCommon'; +import { GridConstants } from '@ohos/constantsCommon'; +import { BreakpointType } from '@ohos/mediaCommon'; +import { optionList } from '../viewmodel/SongListData'; +import type { OptionItem } from '../viewmodel/SongListData'; +import { ContentConstants } from '../constants/ContentConstants'; + +@Component +export struct AlbumComponent { + @State imgHeight: number = 0; + @Link currentBreakpoint: string; + + @Builder + CoverImage() { + Stack({ alignContent: Alignment.BottomStart }) { + Image($r('app.media.ic_album')) + .width(StyleConstants.FULL_WIDTH) + .aspectRatio(ContentConstants.ASPECT_RATIO_ALBUM_COVER) + .borderRadius($r('app.float.album_cover_border_radius')) + .onAreaChange((oldArea: Area, newArea: Area) => { + this.imgHeight = newArea.height as number; + }) + Text($r('app.string.collection_num')) + .letterSpacing(ContentConstants.LETTER_SPACING) + .fontColor(Color.White) + .fontSize(new BreakpointType({ + sm: $r('app.float.collection_font_sm'), + md: $r('app.float.collection_font_md'), + lg: $r('app.float.collection_font_lg') + }).getValue(this.currentBreakpoint)) + .translate({ + x: StyleConstants.TRANSLATE_X, + y: StyleConstants.TRANSLATE_Y + }) + } + .width(StyleConstants.FULL_WIDTH) + .height(StyleConstants.FULL_HEIGHT) + .aspectRatio(ContentConstants.ASPECT_RATIO_ALBUM_COVER) + } + + @Builder + CoverIntroduction() { + Column() { + Text($r('app.string.list_name')) + .opacity($r('app.float.album_name_opacity')) + .fontWeight(ContentConstants.ALBUM_FONT_WEIGHT) + .fontColor($r('app.color.album_name_introduction')) + .fontSize(new BreakpointType({ + sm: $r('app.float.list_font_sm'), + md: $r('app.float.list_font_md'), + lg: $r('app.float.list_font_lg') + }).getValue(this.currentBreakpoint)) + .margin({ bottom: $r('app.float.album_name_margin') }) + + Text($r('app.string.playlist_Introduction')) + .opacity($r('app.float.introduction_opacity')) + .width(StyleConstants.FULL_WIDTH) + .fontWeight(ContentConstants.INTRODUCTION_FONT_WEIGHT) + .fontColor($r('app.color.album_name_introduction')) + .fontSize(new BreakpointType({ + sm: $r('app.float.introduction_font_sm'), + md: $r('app.float.introduction_font_md'), + lg: $r('app.float.introduction_font_lg') + }).getValue(this.currentBreakpoint)) + } + .width(StyleConstants.FULL_WIDTH) + .height(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? + this.imgHeight : $r('app.float.introduction_height')) + .alignItems(HorizontalAlign.Start) + .justifyContent(FlexAlign.Center) + .padding({ + left: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? $r('app.float.introduction_padding') : 0 + }) + .margin({ + top: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? 0 : $r('app.float.introduction_margin_top'), + bottom: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? + 0 : $r('app.float.introduction_margin_bottom') + }) + } + + @Builder + CoverOptions() { + Row() { + ForEach(optionList, (item: OptionItem) => { + Column({ space: ContentConstants.COVER_OPTION_SPACE }) { + Image(item.image) + .height($r('app.float.option_image_size')) + .width($r('app.float.option_image_size')) + Text(item.text) + .fontColor($r('app.color.album_name_introduction')) + .fontSize(new BreakpointType({ + sm: $r('app.float.option_font_sm'), + md: $r('app.float.option_font_md'), + lg: $r('app.float.option_font_lg') + }).getValue(this.currentBreakpoint)) + } + .onClick(item.action) + }, (item, index) => index + JSON.stringify(item)) + } + .height($r('app.float.option_area_height')) + .width(StyleConstants.FULL_WIDTH) + .padding({ + left: $r('app.float.options_padding'), + right: $r('app.float.options_padding') + }) + .justifyContent(FlexAlign.SpaceBetween) + } + + build() { + Column() { + GridRow() { + GridCol({ + span: { sm: GridConstants.SPAN_FOUR, md: GridConstants.SPAN_TWELVE, lg: GridConstants.SPAN_TWELVE } + }) { + this.CoverImage() + } + + GridCol({ + span: { sm: GridConstants.SPAN_EIGHT, md: GridConstants.SPAN_TWELVE, lg: GridConstants.SPAN_TWELVE } + }) { + this.CoverIntroduction() + } + + GridCol({ + span: { sm: GridConstants.SPAN_TWELVE, md: GridConstants.SPAN_TWELVE, lg: GridConstants.SPAN_TWELVE } + }) { + this.CoverOptions() + } + .padding({ + top: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? $r('app.float.option_margin') : 0, + bottom: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? $r('app.float.option_margin') : 0 + }) + } + .padding({ + top: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? + $r('app.float.cover_padding_top_sm') : $r('app.float.cover_padding_top_other'), + left: new BreakpointType({ + sm: $r('app.float.album_padding_sm'), + md: $r('app.float.album_padding_md'), + lg: $r('app.float.album_padding_lg') + }).getValue(this.currentBreakpoint), + right: new BreakpointType({ + sm: $r('app.float.album_padding_sm'), + md: $r('app.float.album_padding_md'), + lg: $r('app.float.album_padding_lg') + }).getValue(this.currentBreakpoint) + }) + } + .margin({ + left: new BreakpointType({ + sm: $r('app.float.cover_margin_sm'), + md: $r('app.float.cover_margin_md'), + lg: $r('app.float.cover_margin_lg') + }).getValue(this.currentBreakpoint), + right: new BreakpointType({ + sm: $r('app.float.cover_margin_sm'), + md: $r('app.float.cover_margin_md'), + lg: $r('app.float.cover_margin_lg') + }).getValue(this.currentBreakpoint) + }) + } +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicList/src/main/ets/components/AlbumCover.ets b/MultiDeviceMusic-army/musicList/src/main/ets/components/AlbumCover.ets new file mode 100644 index 0000000000000000000000000000000000000000..9e521bf99847357d3d64889902ffee1b48b6348b --- /dev/null +++ b/MultiDeviceMusic-army/musicList/src/main/ets/components/AlbumCover.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2023 Huawei Device 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 { StyleConstants } from '@ohos/constantsCommon'; +import { BreakpointConstants } from '@ohos/constantsCommon'; +import { AlbumComponent } from './AlbumComponent'; + +@Component +export struct AlbumCover { + @Link currentBreakpoint: string; + + build() { + if (this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM) { + AlbumComponent({ currentBreakpoint: $currentBreakpoint }) + } else { + AlbumComponent({ currentBreakpoint: $currentBreakpoint }) + .height(StyleConstants.FULL_HEIGHT) + } + } +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicList/src/main/ets/components/Content.ets b/MultiDeviceMusic-army/musicList/src/main/ets/components/Content.ets new file mode 100644 index 0000000000000000000000000000000000000000..63f14bc8c2761209ee9e3b30fb27a6c700b80bbb --- /dev/null +++ b/MultiDeviceMusic-army/musicList/src/main/ets/components/Content.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2023 Huawei Device 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 { GridConstants } from '@ohos/constantsCommon'; +import { StyleConstants } from '@ohos/constantsCommon'; +import { AlbumCover } from './AlbumCover'; +import { PlayList } from './PlayList'; + +@Component +export struct Content { + @Link currentBreakpoint: string; + + build() { + GridRow() { + GridCol({ span: { sm: GridConstants.SPAN_TWELVE, md: GridConstants.SPAN_SIX, lg: GridConstants.SPAN_FOUR } }) { + AlbumCover({ currentBreakpoint: $currentBreakpoint }) + } + .backgroundColor($r('app.color.album_background')) + + GridCol({ span: { sm: GridConstants.SPAN_TWELVE, md: GridConstants.SPAN_SIX, lg: GridConstants.SPAN_EIGHT } }) { + PlayList({ currentBreakpoint: $currentBreakpoint }) + } + .borderRadius($r('app.float.playlist_border_radius')) + } + .height(StyleConstants.FULL_HEIGHT) + .onBreakpointChange((breakpoints: string) => { + this.currentBreakpoint = breakpoints; + }) + } +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicList/src/main/ets/components/Header.ets b/MultiDeviceMusic-army/musicList/src/main/ets/components/Header.ets new file mode 100644 index 0000000000000000000000000000000000000000..394c4aada856d86324f9df13bb50e33785ad8de1 --- /dev/null +++ b/MultiDeviceMusic-army/musicList/src/main/ets/components/Header.ets @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2023 Huawei Device 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 router from '@ohos.router'; +import promptAction from '@ohos.promptAction'; +import { BreakpointType, MenuData } from '@ohos/mediaCommon'; +import { StyleConstants } from '@ohos/constantsCommon'; +import { HeaderConstants } from '../constants/HeaderConstants'; + +@Component +export struct Header { + @Link currentBreakpoint: string; + + build() { + Row() { + Image($r('app.media.ic_back')) + .width($r('app.float.icon_width')) + .height($r('app.float.icon_height')) + .margin({ left: $r('app.float.icon_margin') }) + .onClick(() => { + router.back() + }) + Text($r('app.string.play_list')) + .fontSize(new BreakpointType({ + sm: $r('app.float.header_font_sm'), + md: $r('app.float.header_font_md'), + lg: $r('app.float.header_font_lg') + }).getValue(this.currentBreakpoint)) + .fontWeight(HeaderConstants.TITLE_FONT_WEIGHT) + .fontColor($r('app.color.title_color')) + .opacity($r('app.float.title_opacity')) + .letterSpacing(HeaderConstants.LETTER_SPACING) + .padding({ left: $r('app.float.title_padding_left') }) + + Blank() + + Image($r('app.media.ic_more')) + .width($r('app.float.icon_width')) + .height($r('app.float.icon_height')) + .margin({ right: $r('app.float.icon_margin') }) + .bindMenu(this.getMenu()) + } + .width(StyleConstants.FULL_WIDTH) + .height($r('app.float.title_bar_height')) + .zIndex(HeaderConstants.Z_INDEX) + } + + getMenu(): MenuData[] { + let menuItem: MenuData = new MenuData(); + let menuDatas: MenuData[] = []; + if (canIUse(HeaderConstants.SYSCAP_ETHERNET)) { + menuItem.value = HeaderConstants.AUDIO_DEVICE_SERVICE; + menuItem.action = (): void => { + promptAction.showToast({ + message: HeaderConstants.AUDIO_DEVICE_SERVICE, + duration: HeaderConstants.TOAST_DURATION + }); + }; + menuDatas.push(menuItem); + } + return menuDatas; + } +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicList/src/main/ets/components/PlayList.ets b/MultiDeviceMusic-army/musicList/src/main/ets/components/PlayList.ets new file mode 100644 index 0000000000000000000000000000000000000000..8cc012cdedb1feb69066dbbc11f682c80c7b7c74 --- /dev/null +++ b/MultiDeviceMusic-army/musicList/src/main/ets/components/PlayList.ets @@ -0,0 +1,146 @@ +/* + * Copyright (c) 2023 Huawei Device 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 router from '@ohos.router'; +import { BreakpointConstants, StyleConstants, RouterUrlConstants } from '@ohos/constantsCommon'; +import { MediaService, SongItem, Logger, BreakpointType, MusicList } from '@ohos/mediaCommon'; +import { SongDataSource } from '../viewmodel/SongDataSource'; +import { ContentConstants } from '../constants/ContentConstants'; + +@Component +export struct PlayList { + @Link currentBreakpoint: string; + songList: SongItem[] = MusicList; + + @Builder + PlayAll() { + Row() { + Image($r('app.media.ic_play_all')) + .height($r('app.float.play_all_icon_size')) + .width($r('app.float.play_all_icon_size')) + Text($r('app.string.play_all', this.songList.length)) + .maxLines(ContentConstants.PLAY_ALL_MAX_LINES) + .padding({ left: $r('app.float.play_all_text_padding') }) + .fontColor(Color.Black) + .fontSize(new BreakpointType({ + sm: $r('app.float.play_font_sm'), + md: $r('app.float.play_font_md'), + lg: $r('app.float.play_font_lg') + }).getValue(this.currentBreakpoint)) + Blank() + Image($r('app.media.ic_order_play')) + .width($r('app.float.order_icon_size')) + .height($r('app.float.order_icon_size')) + .margin({ right: $r('app.float.order_icon_margin') }) + Image($r('app.media.ic_sort_list')) + .height($r('app.float.order_icon_size')) + .width($r('app.float.order_icon_size')) + } + .height($r('app.float.play_all_area_height')) + .width(StyleConstants.FULL_WIDTH) + .backgroundColor(Color.White) + .padding({ + left: $r('app.float.play_all_area_padding'), + right: $r('app.float.play_all_area_padding') + }) + .borderRadius({ + topRight: $r('app.float.play_all_border_radius'), + topLeft: $r('app.float.play_all_border_radius') + }) + .position({ x: 0, y: 0 }) + } + + @Builder + SongItem(item: SongItem, index: number) { + Row() { + Column() { + Text(item.title) + .fontColor(Color.Black) + .fontSize(new BreakpointType({ + sm: $r('app.float.item_font_sm'), + md: $r('app.float.item_font_md'), + lg: $r('app.float.item_font_lg') + }).getValue(this.currentBreakpoint)) + .margin({ bottom: $r('app.float.list_item_title_margin') }) + Row() { + Image(item.mark) + .width($r('app.float.list_item_image_size')) + .height($r('app.float.list_item_image_size')) + .margin({ right: $r('app.float.list_item_image_margin') }) + Text(item.singer) + .opacity($r('app.float.singer_opacity')) + .fontColor(Color.Black) + .fontSize(new BreakpointType({ + sm: $r('app.float.singer_title_sm'), + md: $r('app.float.singer_title_md'), + lg: $r('app.float.singer_title_lg') + }).getValue(this.currentBreakpoint)) + } + } + .alignItems(HorizontalAlign.Start) + + Blank() + Image($r('app.media.ic_list_more')) + .height($r('app.float.order_icon_size')) + .width($r('app.float.order_icon_size')) + } + .onClick(() => { + MediaService.getInstance().loadAssent(index) + router.pushUrl({ + url: RouterUrlConstants.MUSIC_PLAY + }, router.RouterMode.Single) + .catch(error => { + Logger.error('pushUrl failed :' + JSON.stringify(error)) + }) + }) + .height($r('app.float.list_item_height')) + .width(StyleConstants.FULL_WIDTH) + } + + build() { + Column() { + this.PlayAll() + List() { + LazyForEach(new SongDataSource(this.songList), (item: SongItem, index: number) => { + ListItem() { + Column() { + this.SongItem(item, index) + } + .padding({ + left: $r('app.float.list_item_padding'), + right: $r('app.float.list_item_padding') + }) + } + }, (item, index) => JSON.stringify(item) + index) + } + .width(StyleConstants.FULL_WIDTH) + .backgroundColor(Color.White) + .margin({ top: $r('app.float.list_area_margin_top') }) + .lanes(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + ContentConstants.COL_TWO : ContentConstants.COL_ONE) + .layoutWeight(1) + .divider({ + color: $r('app.color.list_divider'), + strokeWidth: $r('app.float.stroke_width'), + startMargin: $r('app.float.list_item_padding'), + endMargin: $r('app.float.list_item_padding') + }) + } + .padding({ + top: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? 0 : $r('app.float.list_area_padding_top'), + bottom: $r('app.float.list_area_padding_bottom') + }) + } +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicList/src/main/ets/components/Player.ets b/MultiDeviceMusic-army/musicList/src/main/ets/components/Player.ets new file mode 100644 index 0000000000000000000000000000000000000000..ec00c348bd3493ded4a172570694297a3f29c138 --- /dev/null +++ b/MultiDeviceMusic-army/musicList/src/main/ets/components/Player.ets @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2023 Huawei Device 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 router from '@ohos.router'; +import { RouterUrlConstants, StyleConstants } from '@ohos/constantsCommon'; +import { BreakpointType, MediaService, SongItem, MusicList } from '@ohos/mediaCommon'; +import { PlayerConstants } from '../constants/PlayerConstants'; + +@Preview +@Component +export struct Player { + @StorageProp('selectIndex') selectIndex: number = 0; + @StorageLink('isPlay') isPlay: boolean = false; + songList: SongItem[] = MusicList; + @Link currentBreakpoint: string; + + build() { + Row() { + Row() { + Image(this.songList[this.selectIndex]?.label) + .height($r('app.float.cover_height')) + .width($r('app.float.cover_width')) + .borderRadius($r('app.float.label_border_radius')) + .margin({ right: $r('app.float.cover_margin') }) + .rotate({ angle: this.isPlay ? PlayerConstants.ROTATE : 0 }) + .animation({ + duration: PlayerConstants.ANIMATION_DURATION, + iterations: PlayerConstants.ITERATIONS, + curve: Curve.Linear + }) + Column() { + Text(this.songList[this.selectIndex].title) + .fontColor($r('app.color.song_name')) + .fontSize(new BreakpointType({ + sm: $r('app.float.song_title_sm'), + md: $r('app.float.song_title_md'), + lg: $r('app.float.song_title_lg') + }).getValue(this.currentBreakpoint)) + Row() { + Image($r('app.media.ic_vip')) + .height($r('app.float.vip_icon_height')) + .width($r('app.float.vip_icon_width')) + .margin({ right: $r('app.float.vip_icon_margin') }) + Text(this.songList[this.selectIndex].singer) + .fontColor($r('app.color.singer')) + .fontSize(new BreakpointType({ + sm: $r('app.float.singer_title_sm'), + md: $r('app.float.singer_title_md'), + lg: $r('app.float.singer_title_lg') + }).getValue(this.currentBreakpoint)) + .opacity($r('app.float.singer_opacity')) + } + } + .alignItems(HorizontalAlign.Start) + } + .layoutWeight(PlayerConstants.LAYOUT_WEIGHT_PLAYER_CONTROL) + .onClick(() => { + router.pushUrl({ + url: RouterUrlConstants.MUSIC_PLAY + }, router.RouterMode.Single) + }) + + Blank() + .onClick(() => { + router.pushUrl({ + url: RouterUrlConstants.MUSIC_PLAY + }, router.RouterMode.Single) + }) + + Row() { + Image($r('app.media.ic_previous')) + .height($r('app.float.control_icon_height')) + .width($r('app.float.control_icon_width')) + .margin({ right: $r('app.float.control_icon_margin') }) + .displayPriority(PlayerConstants.DISPLAY_PRIORITY_TWO) + .onClick(() => MediaService.getInstance().playPrevious()) + Image(this.isPlay ? $r('app.media.ic_play') : $r('app.media.ic_pause')) + .height($r('app.float.control_icon_height')) + .width($r('app.float.control_icon_width')) + .displayPriority(PlayerConstants.DISPLAY_PRIORITY_THREE) + .onClick(() => { + if (MediaService.getInstance().getFirst()) { + MediaService.getInstance().loadAssent(0) + } else { + this.isPlay ? MediaService.getInstance().pause() : MediaService.getInstance().play(); + } + }) + Image($r('app.media.ic_next')) + .height($r('app.float.control_icon_height')) + .width($r('app.float.control_icon_width')) + .margin({ + right: $r('app.float.control_icon_margin'), + left: $r('app.float.control_icon_margin') + }) + .displayPriority(PlayerConstants.DISPLAY_PRIORITY_TWO) + .onClick(() => MediaService.getInstance().playNextAuto(true)) + Image($r('app.media.ic_music_list')) + .height($r('app.float.control_icon_height')) + .width($r('app.float.control_icon_width')) + .displayPriority(PlayerConstants.DISPLAY_PRIORITY_ONE) + } + .width(new BreakpointType({ + sm: $r('app.float.play_width_sm'), + md: $r('app.float.play_width_sm'), + lg: $r('app.float.play_width_lg') + }).getValue(this.currentBreakpoint)) + .justifyContent(FlexAlign.End) + } + .width(StyleConstants.FULL_WIDTH) + .height($r('app.float.player_area_height')) + .backgroundColor($r('app.color.player_background')) + .padding({ + left: $r('app.float.player_padding'), + right: $r('app.float.player_padding') + }) + .position({ + x: 0, + y: StyleConstants.FULL_HEIGHT + }) + .translate({ + x: 0, + y: StyleConstants.TRANSLATE_PLAYER_Y + }) + } +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicList/src/main/ets/constants/ContentConstants.ets b/MultiDeviceMusic-army/musicList/src/main/ets/constants/ContentConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..b4175d1f62a7519b34fe6ccd91ac68004f66f991 --- /dev/null +++ b/MultiDeviceMusic-army/musicList/src/main/ets/constants/ContentConstants.ets @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2023 Huawei Device 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. + */ + +/** + * Constants for main content area. + */ +export class ContentConstants { + /** + * The max lines of play all area is 1. + */ + static readonly PLAY_ALL_MAX_LINES: number = 1; + + /** + * The font size of the singer is smaller. + */ + static readonly SINGER_FONT_REDUCE: number = 4; + + /** + * The font size of the album name is larger. + */ + static readonly ALBUM_FONT_PLUS: number = 2; + + /** + * The font size of the introduction is smaller. + */ + static readonly INTRODUCTION_FONT_REDUCE: number = 2; + + /** + * Width of the list item divider. + */ + static readonly DIVIDER_STROKE_WIDTH: number = 0.5; + + /** + * Aspect ratio of the album cover image. + */ + static readonly ASPECT_RATIO_ALBUM_COVER: number = 1; + + /** + * Letter spacing. + */ + static readonly LETTER_SPACING: number = 1; + + /** + * Font weight of the album title. + */ + static readonly ALBUM_FONT_WEIGHT: number = 500; + + /** + * Font weight of the album introduction. + */ + static readonly INTRODUCTION_FONT_WEIGHT: number = 400; + + /** + * Space between cover options. + */ + static readonly COVER_OPTION_SPACE: number = 4; + + /** + * Value of lanes is 2. + */ + static readonly COL_TWO: number = 2; + + /** + * Value of lanes is 1. + */ + static readonly COL_ONE: number = 1; +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicList/src/main/ets/constants/HeaderConstants.ets b/MultiDeviceMusic-army/musicList/src/main/ets/constants/HeaderConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..1f15c491104af86bbf351a7e9775b8654846714f --- /dev/null +++ b/MultiDeviceMusic-army/musicList/src/main/ets/constants/HeaderConstants.ets @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2023 Huawei Device 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. + */ + +/** + * Constants for header area. + */ +export class HeaderConstants { + /** + * The font size of the title is larger. + */ + static readonly TITLE_FONT_SIZE_PLUS: number = 4; + + /** + * The font weight of the title. + */ + static readonly TITLE_FONT_WEIGHT: number = 500; + + /** + * Letter spacing of the title. + */ + static readonly LETTER_SPACING: number = 2; + + /** + * Title bar z-index. + */ + static readonly Z_INDEX: number = 2; + + /** + * SystemCapability that indicates audio device management capability. + */ + static readonly SYSCAP_ETHERNET: string = 'SystemCapability.Multimedia.Audio.Device'; + + /** + * SystemCapability name: audio device service. + */ + static readonly AUDIO_DEVICE_SERVICE: string = '音频设备管理'; + + /** + * Toast duration is 2000ms. + */ + static readonly TOAST_DURATION: number = 2000; +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicList/src/main/ets/constants/PlayerConstants.ets b/MultiDeviceMusic-army/musicList/src/main/ets/constants/PlayerConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..0aa9be205bbc126c85bbf3b4928faa8af6749416 --- /dev/null +++ b/MultiDeviceMusic-army/musicList/src/main/ets/constants/PlayerConstants.ets @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2023 Huawei Device 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. + */ + +/** + * Constants for player area. + */ +export class PlayerConstants { + /** + * The font size of the singer is smaller. + */ + static readonly FONT_REDUCE: number = 4; + + /** + * The layout weight of player control. + */ + static readonly LAYOUT_WEIGHT_PLAYER_CONTROL: number = 1; + + /** + * The display priority is 1. + */ + static readonly DISPLAY_PRIORITY_ONE: number = 1; + + /** + * The display priority is 2. + */ + static readonly DISPLAY_PRIORITY_TWO: number = 2; + + /** + * The display priority is 3. + */ + static readonly DISPLAY_PRIORITY_THREE: number = 3; + + /** + * The rotate is 360. + */ + static readonly ROTATE: number = 360; + + /** + * The animation duration is 3000. + */ + static readonly ANIMATION_DURATION: number = 3000; + + /** + * The value of iterations. + */ + static readonly ITERATIONS: number = -1; +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicList/src/main/ets/pages/Index.ets b/MultiDeviceMusic-army/musicList/src/main/ets/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..aabfd3e5d45f42e58212602bddb7cc859d240b7b --- /dev/null +++ b/MultiDeviceMusic-army/musicList/src/main/ets/pages/Index.ets @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2023 Huawei Device 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 go + verning permissions and + * limitations under the License. + */ + +import { BreakpointSystem, MediaService } from '@ohos/mediaCommon'; +import { StyleConstants, BreakpointConstants, SongConstants } from '@ohos/constantsCommon'; +import { Header } from '../components/Header'; +import { Player } from '../components/Player'; +import { Content } from '../components/Content'; + +@Entry +@Component +struct Index { + private breakpointSystem: BreakpointSystem = new BreakpointSystem(); + @State currentBreakpoint: string = BreakpointConstants.BREAKPOINT_SM; + + aboutToAppear() { + MediaService.getInstance(); + this.breakpointSystem.register(); + } + + aboutToDisappear() { + this.breakpointSystem.unregister(); + } + + build() { + Stack({ alignContent: Alignment.Top }) { + Header({ currentBreakpoint: $currentBreakpoint }) + Content({ currentBreakpoint: $currentBreakpoint }) + Player({ currentBreakpoint: $currentBreakpoint }) + } + .width(StyleConstants.FULL_WIDTH) + .backgroundColor(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? + $r('app.color.page_background_sm') : $r('app.color.page_background_other')) + } + + pageTransition() { + PageTransitionEnter({ duration: SongConstants.TRANSITION_DURATION, curve: Curve.Smooth, type: RouteType.Pop }) + PageTransitionExit({ duration: SongConstants.TRANSITION_DURATION, curve: Curve.Smooth, type: RouteType.Push }) + } +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicList/src/main/ets/viewmodel/SongDataSource.ets b/MultiDeviceMusic-army/musicList/src/main/ets/viewmodel/SongDataSource.ets new file mode 100644 index 0000000000000000000000000000000000000000..866be1222ad2caa3d115eccef7a6a2f067dd4e0f --- /dev/null +++ b/MultiDeviceMusic-army/musicList/src/main/ets/viewmodel/SongDataSource.ets @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2023 Huawei Device 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 { SongItem } from '@ohos/mediaCommon'; + +export class SongDataSource implements IDataSource { + private dataArray: SongItem[] = []; + private listeners: DataChangeListener[] = []; + + constructor(element: SongItem[]) { + for (let index = 0; index < element.length; index++) { + this.dataArray.push(element[index]); + } + } + + public totalCount(): number { + return this.dataArray.length; + } + + public getData(index: number): SongItem { + return this.dataArray[index]; + } + + public addData(index: number, data: SongItem): void { + this.dataArray.splice(index, 0, data); + this.notifyDataAdd(index); + } + + public pushData(data: SongItem): void { + this.dataArray.push(data); + this.notifyDataAdd(this.dataArray.length - 1); + } + + registerDataChangeListener(listener: DataChangeListener): void { + if (this.listeners.indexOf(listener) < 0) { + this.listeners.push(listener); + } + } + + unregisterDataChangeListener(listener: DataChangeListener): void { + const pos = this.listeners.indexOf(listener); + if (pos >= 0) { + this.listeners.splice(pos, 1); + } + } + + notifyDataReload(): void { + this.listeners.forEach(listener => { + listener.onDataReloaded(); + }); + } + + notifyDataAdd(index: number): void { + this.listeners.forEach(listener => { + listener.onDataAdd(index); + }) + } + + notifyDataChange(index: number): void { + this.listeners.forEach(listener => { + listener.onDataChange(index); + }) + } + + notifyDataDelete(index: number): void { + this.listeners.forEach(listener => { + listener.onDataDelete(index); + }) + } + + notifyDataMove(from: number, to: number): void { + this.listeners.forEach(listener => { + listener.onDataMove(from, to); + }) + } +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicList/src/main/ets/viewmodel/SongListData.ets b/MultiDeviceMusic-army/musicList/src/main/ets/viewmodel/SongListData.ets new file mode 100644 index 0000000000000000000000000000000000000000..91430e22edc9b20bf2191a3a518ad59ba7617491 --- /dev/null +++ b/MultiDeviceMusic-army/musicList/src/main/ets/viewmodel/SongListData.ets @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2023 Huawei Device 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 router from '@ohos.router'; +import { RouterUrlConstants } from '@ohos/constantsCommon'; + +const optionList : OptionItem[] = [ + { image: $r('app.media.ic_collect'), text: $r('app.string.collect') }, + { image: $r('app.media.ic_download'), text: $r('app.string.download') }, + { image: $r('app.media.ic_comments'), text: $r('app.string.comment'), action: () => { + router.pushUrl({ + url: RouterUrlConstants.MUSIC_COMMENT + }, router.RouterMode.Single) + }}, + { image: $r('app.media.ic_share'), text: $r('app.string.share') } +] + +type OptionItem = { + image: Resource; + text: Resource; + action?: () => void; +} + +export { optionList, OptionItem } \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicList/src/main/module.json5 b/MultiDeviceMusic-army/musicList/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..d4427c9238fb2e8cff6d9a500309f8e30b809c49 --- /dev/null +++ b/MultiDeviceMusic-army/musicList/src/main/module.json5 @@ -0,0 +1,13 @@ +{ + "module": { + "name": "musicList", + "type": "shared", + "description": "$string:shared_desc", + "deviceTypes": [ + "default", + "tablet" + ], + "deliveryWithInstall": true, + "pages": "$profile:main_pages" + } +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicList/src/main/resources/base/element/color.json b/MultiDeviceMusic-army/musicList/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..f218ad6e5144ad28ea7ff3176d006086cfc91163 --- /dev/null +++ b/MultiDeviceMusic-army/musicList/src/main/resources/base/element/color.json @@ -0,0 +1,48 @@ +{ + "color": [ + { + "name": "album_background", + "value": "#e4ecf7" + }, + { + "name": "album_name_introduction", + "value": "#556B89" + }, + { + "name": "title_color", + "value": "#556B89" + }, + { + "name": "singer", + "value": "#000000" + }, + { + "name": "song_name", + "value": "#000000" + }, + { + "name": "player_background", + "value": "#F6F9FC" + }, + { + "name": "start_window_background", + "value": "#FFFFFF" + }, + { + "name": "title_font", + "value": "#E5FFFFFF" + }, + { + "name": "page_background_sm", + "value": "#e4ecf7" + }, + { + "name": "page_background_other", + "value": "#f6f9fc" + }, + { + "name": "list_divider", + "value": "#1a182431" + } + ] +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicList/src/main/resources/base/element/float.json b/MultiDeviceMusic-army/musicList/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..d9cc69ce6722e48b3c45ac86fa341ad21e3a8a63 --- /dev/null +++ b/MultiDeviceMusic-army/musicList/src/main/resources/base/element/float.json @@ -0,0 +1,348 @@ +{ + "float": [ + { + "name": "playlist_border_radius", + "value": "40vp" + }, + { + "name": "play_all_icon_size", + "value": "23vp" + }, + { + "name": "play_all_text_padding", + "value": "10vp" + }, + { + "name": "order_icon_size", + "value": "24vp" + }, + { + "name": "order_icon_margin", + "value": "16vp" + }, + { + "name": "play_all_area_height", + "value": "60vp" + }, + { + "name": "play_all_area_padding", + "value": "12vp" + }, + { + "name": "play_all_border_radius", + "value": "20vp" + }, + { + "name": "list_item_title_margin", + "value": "4vp" + }, + { + "name": "list_item_image_size", + "value": "16vp" + }, + { + "name": "list_item_image_margin", + "value": "4vp" + }, + { + "name": "list_item_height", + "value": "60vp" + }, + { + "name": "list_item_padding", + "value": "14vp" + }, + { + "name": "list_area_margin_top", + "value": "60vp" + }, + { + "name": "singer_opacity", + "value": "0.38" + }, + { + "name": "divider_opacity", + "value": "0.1" + }, + { + "name": "list_area_padding_top", + "value": "50vp" + }, + { + "name": "list_area_padding_bottom", + "value": "48vp" + }, + { + "name": "album_cover_border_radius", + "value": "8vp" + }, + { + "name": "album_name_opacity", + "value": "0.9" + }, + { + "name": "album_name_margin", + "value": "10vp" + }, + { + "name": "introduction_opacity", + "value": "0.6" + }, + { + "name": "introduction_height", + "value": "70vp" + }, + { + "name": "introduction_padding", + "value": "20vp" + }, + { + "name": "introduction_margin_top", + "value": "30vp" + }, + { + "name": "introduction_margin_bottom", + "value": "20vp" + }, + { + "name": "option_image_size", + "value": "30vp" + }, + { + "name": "option_area_height", + "value": "70vp" + }, + { + "name": "option_margin", + "value": "15vp" + }, + { + "name": "cover_padding_top_sm", + "value": "50vp" + }, + { + "name": "cover_padding_top_other", + "value": "70vp" + }, + { + "name": "icon_width", + "value": "20vp" + }, + { + "name": "icon_height", + "value": "20vp" + }, + { + "name": "icon_margin", + "value": "16vp" + }, + { + "name": "title_opacity", + "value": "0.9" + }, + { + "name": "title_padding_left", + "value": "10vp" + }, + { + "name": "title_bar_height", + "value": "50vp" + }, + { + "name": "cover_width", + "value": "32vp" + }, + { + "name": "cover_height", + "value": "32vp" + }, + { + "name": "label_border_radius", + "value": "16vp" + }, + { + "name": "cover_margin", + "value": "12vp" + }, + { + "name": "vip_icon_width", + "value": "16vp" + }, + { + "name": "vip_icon_height", + "value": "16vp" + }, + { + "name": "vip_icon_margin", + "value": "4vp" + }, + { + "name": "control_icon_width", + "value": "24vp" + }, + { + "name": "control_icon_height", + "value": "24vp" + }, + { + "name": "control_icon_margin", + "value": "16vp" + }, + { + "name": "player_area_height", + "value": "48vp" + }, + { + "name": "player_padding", + "value": "16vp" + }, + { + "name": "play_width_sm", + "value": "120vp" + }, + { + "name": "play_width_lg", + "value": "150vp" + }, + { + "name": "stroke_width", + "value": "0.5vp" + }, + { + "name": "header_font_sm", + "value": "18fp" + }, + { + "name": "header_font_md", + "value": "20fp" + }, + { + "name": "header_font_lg", + "value": "22fp" + }, + { + "name": "song_title_sm", + "value": "14fp" + }, + { + "name": "song_title_md", + "value": "16fp" + }, + { + "name": "song_title_lg", + "value": "18fp" + }, + { + "name": "singer_title_sm", + "value": "10fp" + }, + { + "name": "singer_title_md", + "value": "12fp" + }, + { + "name": "singer_title_lg", + "value": "14fp" + }, + { + "name": "collection_font_sm", + "value": "10fp" + }, + { + "name": "collection_font_md", + "value": "12fp" + }, + { + "name": "collection_font_lg", + "value": "14fp" + }, + { + "name": "list_font_sm", + "value": "16fp" + }, + { + "name": "list_font_md", + "value": "18fp" + }, + { + "name": "list_font_lg", + "value": "20fp" + }, + { + "name": "introduction_font_sm", + "value": "12fp" + }, + { + "name": "introduction_font_md", + "value": "14fp" + }, + { + "name": "introduction_font_lg", + "value": "16fp" + }, + { + "name": "option_font_sm", + "value": "13fp" + }, + { + "name": "option_font_md", + "value": "15fp" + }, + { + "name": "option_font_lg", + "value": "17fp" + }, + { + "name": "cover_margin_sm", + "value": "10vp" + }, + { + "name": "cover_margin_md", + "value": "30vp" + }, + { + "name": "cover_margin_lg", + "value": "40vp" + }, + { + "name": "play_font_sm", + "value": "14fp" + }, + { + "name": "play_font_md", + "value": "16fp" + }, + { + "name": "play_font_lg", + "value": "18fp" + }, + { + "name": "item_font_sm", + "value": "14fp" + }, + { + "name": "item_font_md", + "value": "16fp" + }, + { + "name": "item_font_lg", + "value": "18fp" + }, + { + "name": "album_padding_sm", + "value": "0vp" + }, + { + "name": "album_padding_md", + "value": "10vp" + }, + { + "name": "album_padding_lg", + "value": "20vp" + }, + { + "name": "options_padding", + "value": "10vp" + } + ] +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicList/src/main/resources/base/element/string.json b/MultiDeviceMusic-army/musicList/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..c36aae59a5631668d17049b2e72def6ef6fba38d --- /dev/null +++ b/MultiDeviceMusic-army/musicList/src/main/resources/base/element/string.json @@ -0,0 +1,72 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "shared_desc" + }, + { + "name": "collection_num", + "value": "125000" + }, + { + "name": "list_name", + "value": "Independent folk" + }, + { + "name": "playlist_Introduction", + "value": "The set list is a selection of popular folk songs." + }, + { + "name": "play_all", + "value": "Play all(%d)" + }, + { + "name": "collect", + "value": "collect" + }, + { + "name": "download", + "value": "download" + }, + { + "name": "comment", + "value": "comment" + }, + { + "name": "share", + "value": "share" + }, + { + "name": "play_list", + "value": "play list" + }, + { + "name": "song_name", + "value": "I don't know" + }, + { + "name": "singer", + "value": "Hello xiao wan" + }, + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "label" + }, + { + "name": "EntryFormAbility_desc", + "value": "form_description" + }, + { + "name": "EntryFormAbility_label", + "value": "form_label" + } + ] +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_album.png b/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_album.png new file mode 100644 index 0000000000000000000000000000000000000000..a7e68c33bd077f429174cec25b030c805fdeb55c Binary files /dev/null and b/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_album.png differ diff --git a/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_back.svg b/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_back.svg new file mode 100644 index 0000000000000000000000000000000000000000..f142f2dd05ec50aca35584bfd3c3cca86963cfba --- /dev/null +++ b/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_back.svg @@ -0,0 +1,15 @@ + + + icon_morebackup + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_collect.svg b/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_collect.svg new file mode 100644 index 0000000000000000000000000000000000000000..a3f144a24d14402d314ad9df9ceba0620904f423 --- /dev/null +++ b/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_collect.svg @@ -0,0 +1,7 @@ + + + icon_collect + + + + \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_comments.svg b/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_comments.svg new file mode 100644 index 0000000000000000000000000000000000000000..6d2fc29d42f43082d07233a84910b8b95b8adcef --- /dev/null +++ b/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_comments.svg @@ -0,0 +1,13 @@ + + + icon_review + + + + + + + + + + \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_download.svg b/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_download.svg new file mode 100644 index 0000000000000000000000000000000000000000..4ac6c0232ac12f30d1fa4e1e3ae98196f28134fd --- /dev/null +++ b/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_download.svg @@ -0,0 +1,7 @@ + + + icon_download + + + + \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_favorite.svg b/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_favorite.svg new file mode 100644 index 0000000000000000000000000000000000000000..696166660053a45821ad90240ae0335a3d56c528 --- /dev/null +++ b/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_favorite.svg @@ -0,0 +1,7 @@ + + + icon_collect + + + + \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_list_more.svg b/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_list_more.svg new file mode 100644 index 0000000000000000000000000000000000000000..15d942cc933b31a7a94e0655a7f00d7d258d4173 --- /dev/null +++ b/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_list_more.svg @@ -0,0 +1,13 @@ + + + ic_list_more + + + + + + + + + + \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_more.svg b/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_more.svg new file mode 100644 index 0000000000000000000000000000000000000000..a17e3d6870f72df9831e7c07fd169f6b3f493573 --- /dev/null +++ b/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_more.svg @@ -0,0 +1,13 @@ + + + icon_add + + + + + + + + + + \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_music_cover.png b/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_music_cover.png new file mode 100644 index 0000000000000000000000000000000000000000..bf4580c99075e1a721c13661884b0210f9994086 Binary files /dev/null and b/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_music_cover.png differ diff --git a/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_music_list.svg b/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_music_list.svg new file mode 100644 index 0000000000000000000000000000000000000000..6f89a64c5ad30aa7b0576570b6fdc8672c4412d6 --- /dev/null +++ b/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_music_list.svg @@ -0,0 +1,7 @@ + + + ic_Music_list + + + + \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_next.svg b/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_next.svg new file mode 100644 index 0000000000000000000000000000000000000000..63f5683d5ebc0c868d900f905b3db08bd25d76ad --- /dev/null +++ b/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_next.svg @@ -0,0 +1,15 @@ + + + ic_next + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_order_play.svg b/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_order_play.svg new file mode 100644 index 0000000000000000000000000000000000000000..17086c1e537b6e79ea3600e552d2f5b5b2dbac10 --- /dev/null +++ b/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_order_play.svg @@ -0,0 +1,7 @@ + + + ic_order_play + + + + \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_pause.svg b/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_pause.svg new file mode 100644 index 0000000000000000000000000000000000000000..fe7e3c89a6676a664acf4055a4ac7187861de8b2 --- /dev/null +++ b/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_pause.svg @@ -0,0 +1,15 @@ + + + icon_pause + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_play.svg b/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_play.svg new file mode 100644 index 0000000000000000000000000000000000000000..9442848313f405688080774b77a6138680217567 --- /dev/null +++ b/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_play.svg @@ -0,0 +1,7 @@ + + + ic_play_all + + + + \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_play_all.svg b/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_play_all.svg new file mode 100644 index 0000000000000000000000000000000000000000..23e09ccf3aae3480238d6364e0a741a98678d7e9 --- /dev/null +++ b/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_play_all.svg @@ -0,0 +1,10 @@ + + + ic_detail_play_all + + + + + + + \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_previous.svg b/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_previous.svg new file mode 100644 index 0000000000000000000000000000000000000000..697ec959c31976712a8b5c2de37f55ed0d085ace --- /dev/null +++ b/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_previous.svg @@ -0,0 +1,9 @@ + + + icon_last + + + + + + \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_share.svg b/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_share.svg new file mode 100644 index 0000000000000000000000000000000000000000..aaa05519d375a0170cc18faf6b05aff12b70ec56 --- /dev/null +++ b/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_share.svg @@ -0,0 +1,13 @@ + + + icon_share + + + + + + + + + + \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_sort_list.svg b/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_sort_list.svg new file mode 100644 index 0000000000000000000000000000000000000000..77cd7de67701e5e8b8b6630a0d6827fe3a15a069 --- /dev/null +++ b/MultiDeviceMusic-army/musicList/src/main/resources/base/media/ic_sort_list.svg @@ -0,0 +1,7 @@ + + + ic_sort_list + + + + \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicList/src/main/resources/base/media/icon.png b/MultiDeviceMusic-army/musicList/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/MultiDeviceMusic-army/musicList/src/main/resources/base/media/icon.png differ diff --git a/MultiDeviceMusic-army/musicList/src/main/resources/base/media/setting.jpeg b/MultiDeviceMusic-army/musicList/src/main/resources/base/media/setting.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..57e67dd49d39ad64ef090f59db3db9dfe6632106 Binary files /dev/null and b/MultiDeviceMusic-army/musicList/src/main/resources/base/media/setting.jpeg differ diff --git a/MultiDeviceMusic-army/musicList/src/main/resources/base/profile/main_pages.json b/MultiDeviceMusic-army/musicList/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce --- /dev/null +++ b/MultiDeviceMusic-army/musicList/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/Index" + ] +} diff --git a/MultiDeviceMusic-army/musicList/src/main/resources/en_US/element/string.json b/MultiDeviceMusic-army/musicList/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..c36aae59a5631668d17049b2e72def6ef6fba38d --- /dev/null +++ b/MultiDeviceMusic-army/musicList/src/main/resources/en_US/element/string.json @@ -0,0 +1,72 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "shared_desc" + }, + { + "name": "collection_num", + "value": "125000" + }, + { + "name": "list_name", + "value": "Independent folk" + }, + { + "name": "playlist_Introduction", + "value": "The set list is a selection of popular folk songs." + }, + { + "name": "play_all", + "value": "Play all(%d)" + }, + { + "name": "collect", + "value": "collect" + }, + { + "name": "download", + "value": "download" + }, + { + "name": "comment", + "value": "comment" + }, + { + "name": "share", + "value": "share" + }, + { + "name": "play_list", + "value": "play list" + }, + { + "name": "song_name", + "value": "I don't know" + }, + { + "name": "singer", + "value": "Hello xiao wan" + }, + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "label" + }, + { + "name": "EntryFormAbility_desc", + "value": "form_description" + }, + { + "name": "EntryFormAbility_label", + "value": "form_label" + } + ] +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicList/src/main/resources/rawfile/boisterous.wav b/MultiDeviceMusic-army/musicList/src/main/resources/rawfile/boisterous.wav new file mode 100644 index 0000000000000000000000000000000000000000..14ca072df420827b0d3e2d4fb4d3278aff8bc067 Binary files /dev/null and b/MultiDeviceMusic-army/musicList/src/main/resources/rawfile/boisterous.wav differ diff --git a/MultiDeviceMusic-army/musicList/src/main/resources/rawfile/dynamic.wav b/MultiDeviceMusic-army/musicList/src/main/resources/rawfile/dynamic.wav new file mode 100644 index 0000000000000000000000000000000000000000..39a12d3b764eba91a731f53da020d7d4d58f90e1 Binary files /dev/null and b/MultiDeviceMusic-army/musicList/src/main/resources/rawfile/dynamic.wav differ diff --git a/MultiDeviceMusic-army/musicList/src/main/resources/zh_CN/element/string.json b/MultiDeviceMusic-army/musicList/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..c5816c7a3a38d5bd081ce5199727c39b0807510b --- /dev/null +++ b/MultiDeviceMusic-army/musicList/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,72 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "shared_desc" + }, + { + "name": "collection_num", + "value": "12.5万" + }, + { + "name": "list_name", + "value": "独立民谣" + }, + { + "name": "playlist_Introduction", + "value": "歌单选取了一些比较受关注的民谣歌曲。" + }, + { + "name": "play_all", + "value": "播放全部(%d)" + }, + { + "name": "collect", + "value": "收藏" + }, + { + "name": "download", + "value": "下载" + }, + { + "name": "comment", + "value": "评论" + }, + { + "name": "share", + "value": "分享" + }, + { + "name": "play_list", + "value": "歌单" + }, + { + "name": "song_name", + "value": "不知道" + }, + { + "name": "singer", + "value": "小碗你好" + }, + { + "name": "module_desc", + "value": "模块描述" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "label" + }, + { + "name": "EntryFormAbility_desc", + "value": "form_description" + }, + { + "name": "EntryFormAbility_label", + "value": "form_label" + } + ] +} diff --git a/MultiDeviceMusic-army/musicPlay/build-profile.json5 b/MultiDeviceMusic-army/musicPlay/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..13c5eda6e6a3dae913ec5c5c4d60ea3ac954f205 --- /dev/null +++ b/MultiDeviceMusic-army/musicPlay/build-profile.json5 @@ -0,0 +1,11 @@ +{ + "apiType": 'stageMode', + "buildOption": { + }, + "targets": [ + { + "name": "default", + "runtimeOS": "HarmonyOS" + } + ] +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicPlay/hvigorfile.ts b/MultiDeviceMusic-army/musicPlay/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..0e65ea8582bf16134695dfefbdc93d4cda460e84 --- /dev/null +++ b/MultiDeviceMusic-army/musicPlay/hvigorfile.ts @@ -0,0 +1,2 @@ +// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently. +module.exports = require('@ohos/hvigor-ohos-plugin').hspTasks diff --git a/MultiDeviceMusic-army/musicPlay/oh-package.json5 b/MultiDeviceMusic-army/musicPlay/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..eaf9d79d1d4ba6441f5789b70ba8e561a7a1de24 --- /dev/null +++ b/MultiDeviceMusic-army/musicPlay/oh-package.json5 @@ -0,0 +1,13 @@ +{ + "license": "Apache-2.0", + "devDependencies": {}, + "author": "", + "name": "musicplay", + "description": "Please describe the basic information.", + "main": "./src/main/ets/Index.ets", + "version": "1.0.0", + "dependencies": { + "@ohos/mediaCommon": "file:../common/mediaCommon", + "@ohos/constantsCommon": "file:../common/constantsCommon" + } +} diff --git a/MultiDeviceMusic-army/musicPlay/src/main/ets/Index.ets b/MultiDeviceMusic-army/musicPlay/src/main/ets/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/MultiDeviceMusic-army/musicPlay/src/main/ets/bean/PlayControlModel.ets b/MultiDeviceMusic-army/musicPlay/src/main/ets/bean/PlayControlModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..f99cf86d706510f6ed3b9a1c7c674aa21c2d45ca --- /dev/null +++ b/MultiDeviceMusic-army/musicPlay/src/main/ets/bean/PlayControlModel.ets @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2023 Huawei Device 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. + */ + +@Observed +export class PlayControlModel { + icon: Resource; + key?: string; + + constructor(icon: Resource, key: string) { + this.icon = icon; + this.key = key; + } +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicPlay/src/main/ets/component/ControlComponent.ets b/MultiDeviceMusic-army/musicPlay/src/main/ets/component/ControlComponent.ets new file mode 100644 index 0000000000000000000000000000000000000000..24ccac6cc68c00b7c70a90fddf4ac81c39248c5d --- /dev/null +++ b/MultiDeviceMusic-army/musicPlay/src/main/ets/component/ControlComponent.ets @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2023 Huawei Device 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 { MediaService, BreakpointType } from '@ohos/mediaCommon'; +import { PlayControlModel } from '../bean/PlayControlModel'; +import { ControlConstants } from '../constants/ControlConstants'; +import { PlayConstants } from '../constants/PlayConstants'; +import { playControl } from '../viewmodel/PlayData'; +import { PlayControlComponent } from './PlayControlComponent'; + +@Component +export struct ControlComponent { + @StorageProp('currentBreakpoint') currentBreakpoint: string = 'sm'; + @StorageLink('isPlay') @Watch('updatePlay') isPlay: boolean = false; + @StorageLink('currentTime') currentTime: string = '00:00'; + @StorageLink('totalTime') totalTime: string = '00:00'; + @StorageLink('progress') value: number = 0; + @StorageLink('progressMax') max: number = 0; + + aboutToAppear() { + this.updatePlay(); + } + + updatePlay() { + playControl.forEach((item: PlayControlModel, index: number) => { + if (index === PlayConstants.PLAY_INDEX) { + item.icon = this.isPlay ? $r('app.media.ic_play_big') : $r('app.media.ic_pause_big'); + item.key = this.isPlay ? ControlConstants.PAUSE : ControlConstants.PLAY; + } + }) + } + + build() { + Column() { + GridRow({ + columns: { sm: PlayConstants.COLUMN_FOUR, md: PlayConstants.COLUMN_EIGHT, lg: PlayConstants.COLUMN_TWELVE }, + gutter: PlayConstants.GRID_COL_GUTTER + }) { + GridCol({ + span: { sm: PlayConstants.SPAN_FOUR, md: PlayConstants.SPAN_SIX, lg: PlayConstants.SPAN_FOUR }, + offset: { md: PlayConstants.OFFSET_ONE, lg: PlayConstants.OFFSET_ONE } + }) { + Column() { + Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { + Text(this.currentTime) + .width($r('app.float.slide_text_width')) + .textAlign(TextAlign.Center) + .fontColor($r("app.color.text_sixty_color")) + .fontSize(new BreakpointType({ + sm: $r('app.float.font_twelve'), + md: $r('app.float.font_twelve'), + lg: $r('app.float.font_fifteen') + }).getValue(this.currentBreakpoint)) + Slider({ min: 0, max: this.max, step: PlayConstants.SLIDE_STEP, value: this.value }) + .blockColor($r('app.color.text_color')) + .selectedColor($r('app.color.text_color')) + .trackColor($r('app.color.text_twenty_color')) + .onChange((value: number, mode: SliderChangeMode) => { + if (mode === SliderChangeMode.End || mode === SliderChangeMode.Begin || + mode === SliderChangeMode.Click) { + MediaService.getInstance().seek(value); + } + }) + Text(this.totalTime) + .width($r('app.float.slide_text_width')) + .textAlign(TextAlign.Center) + .fontColor($r("app.color.text_sixty_color")) + .fontSize(new BreakpointType({ + sm: $r('app.float.font_twelve'), + md: $r('app.float.font_twelve'), + lg: $r('app.float.font_fifteen') + }).getValue(this.currentBreakpoint)) + } + .margin({ top: $r('app.float.cover_margin'), bottom: $r('app.float.cover_margin') }) + + Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { + ForEach(playControl, (item: PlayControlModel, index: number) => { + PlayControlComponent({ + playControl: item, + index: index + }) + }, item => JSON.stringify(item)) + } + } + } + } + } + .margin({ + top: $r('app.float.twenty_four'), + left: $r('app.float.twenty_four'), + right: $r('app.float.twenty_four'), + bottom: $r('app.float.fifty_six') + }) + } +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicPlay/src/main/ets/component/LyricsComponent.ets b/MultiDeviceMusic-army/musicPlay/src/main/ets/component/LyricsComponent.ets new file mode 100644 index 0000000000000000000000000000000000000000..785b188d042cfc03fc747c8f236fdbee6f6b76a0 --- /dev/null +++ b/MultiDeviceMusic-army/musicPlay/src/main/ets/component/LyricsComponent.ets @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2023 Huawei Device 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 { BreakpointType, SongItem, MusicList } from '@ohos/mediaCommon'; +import { StyleConstants } from '@ohos/constantsCommon'; +import { PlayConstants } from '../constants/PlayConstants'; + +@Component +export struct LyricsComponent { + @StorageProp('currentBreakpoint') currentBreakpoint: string = 'sm'; + songList: SongItem[] = MusicList; + @StorageProp('selectIndex') selectIndex: number = 0; + + build() { + Column() { + GridRow({ + columns: { sm: PlayConstants.COLUMN_FOUR, md: PlayConstants.COLUMN_EIGHT, lg: PlayConstants.COLUMN_TWELVE }, + gutter: PlayConstants.GRID_COL_GUTTER + }) { + GridCol({ + span: { sm: PlayConstants.SPAN_FOUR, md: PlayConstants.SPAN_SIX, lg: PlayConstants.SPAN_SIX }, + offset: { md: PlayConstants.OFFSET_ONE, lg: PlayConstants.OFFSET_SIX } + }) { + Flex({ direction: FlexDirection.Column }) { + Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { + Text(this.songList[this.selectIndex].title) + .fontSize(new BreakpointType({ + sm: $r('app.float.font_twenty_four'), + md: $r('app.float.font_twenty_four'), + lg: $r('app.float.font_thirty') + }).getValue(this.currentBreakpoint)) + .fontColor($r('app.color.text_color')) + .textAlign(TextAlign.Start) + .width(StyleConstants.FULL_WIDTH) + + Image($r('app.media.ic_like')) + .width($r('app.float.image_like_size')) + .aspectRatio(1) + .objectFit(ImageFit.Contain) + .visibility(new BreakpointType({ + sm: Visibility.None, + md: Visibility.None, + lg: Visibility.Visible + }).getValue(this.currentBreakpoint)) + } + + Text(this.songList[this.selectIndex].singer) + .textAlign(TextAlign.Start) + .fontSize(new BreakpointType({ + sm: $r('app.float.font_fourteen'), + md: $r('app.float.font_fourteen'), + lg: $r('app.float.font_eighteen') + }).getValue(this.currentBreakpoint)) + .fontColor($r("app.color.text_sixty_color")) + .margin({ top: $r('app.float.text_singer_margin_top') }) + .width(StyleConstants.FULL_WIDTH) + + Text(PlayConstants.LYRICS_CONTENT) + .fontSize(new BreakpointType({ + sm: $r('app.float.font_twenty'), + md: $r('app.float.font_twenty'), + lg: $r('app.float.font_twenty_four') + }).getValue(this.currentBreakpoint)) + .fontColor($r("app.color.text_sixty_color")) + .textAlign(TextAlign.Start) + .width(StyleConstants.FULL_WIDTH) + .margin({ top: $r('app.float.lyrics_text_margin_top') }) + } + } + } + } + .margin({ + top: new BreakpointType({ + sm: $r('app.float.twenty_four'), + md: $r('app.float.twenty_four'), + lg: $r('app.float.lyrics_margin_top_lg') + }).getValue(this.currentBreakpoint), + left: $r('app.float.twenty_four'), + right: $r('app.float.twenty_four') + }) + } +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicPlay/src/main/ets/component/MusicInfoComponent.ets b/MultiDeviceMusic-army/musicPlay/src/main/ets/component/MusicInfoComponent.ets new file mode 100644 index 0000000000000000000000000000000000000000..166ed14a41d6dfca40e28cb41b4337a9d18ce369 --- /dev/null +++ b/MultiDeviceMusic-army/musicPlay/src/main/ets/component/MusicInfoComponent.ets @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2023 Huawei Device 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 router from '@ohos.router'; +import { BreakpointType, Logger, SongItem, MusicList } from '@ohos/mediaCommon'; +import { RouterUrlConstants, StyleConstants } from '@ohos/constantsCommon'; +import { playImage } from '../viewmodel/PlayData'; +import { ControlConstants } from '../constants/ControlConstants'; +import { PlayConstants } from '../constants/PlayConstants'; +import { PlayControlModel } from '../bean/PlayControlModel'; + +@Component +export struct MusicInfoComponent { + @StorageProp('currentBreakpoint') currentBreakpoint: string = 'sm'; + @StorageProp('selectIndex') selectIndex: number = 0; + songList: SongItem[] = MusicList; + + build() { + Column() { + GridRow({ + columns: { sm: PlayConstants.COLUMN_FOUR, md: PlayConstants.COLUMN_EIGHT, lg: PlayConstants.COLUMN_TWELVE }, + gutter: PlayConstants.GRID_COL_GUTTER + }) { + GridCol({ + span: { sm: PlayConstants.SPAN_FOUR, md: PlayConstants.SPAN_FOUR, lg: PlayConstants.SPAN_FOUR }, + offset: { md: PlayConstants.OFFSET_TWO, lg: PlayConstants.OFFSET_ONE } + }) { + this.CoverInfo() + } + + GridCol({ + span: { sm: PlayConstants.SPAN_FOUR, md: PlayConstants.SPAN_SIX, lg: 0 }, + offset: { md: PlayConstants.OFFSET_THREE } + }) { + this.MusicInfo() + } + } + + Blank() + GridRow({ + columns: { sm: PlayConstants.COLUMN_FOUR, md: PlayConstants.COLUMN_EIGHT, lg: PlayConstants.COLUMN_TWELVE }, + gutter: PlayConstants.GRID_COL_GUTTER + }) { + GridCol({ + span: { sm: PlayConstants.SPAN_FOUR, md: PlayConstants.SPAN_SIX, lg: PlayConstants.SPAN_FOUR }, + offset: { md: PlayConstants.OFFSET_ONE, lg: PlayConstants.OFFSET_ONE } + }) { + this.OperationInfo() + } + } + } + .margin({ left: $r('app.float.twenty_four'), right: $r('app.float.twenty_four') }) + .height(StyleConstants.FULL_HEIGHT) + } + + @Builder CoverInfo() { + Image(this.songList[this.selectIndex].label) + .constraintSize({ maxWidth: new BreakpointType({ + sm: $r('app.float.cover_image_width'), + md: $r('app.float.cover_image_width'), + lg: $r('app.float.cover_image_width_lg') + }).getValue(this.currentBreakpoint) }) + .width(StyleConstants.FULL_WIDTH) + .aspectRatio(1) + .borderRadius($r('app.float.cover_radius')) + .margin({ + left: new BreakpointType({ + sm: $r('app.float.cover_margin_left_sm') + }).getValue(this.currentBreakpoint), + right: new BreakpointType({ + sm: $r('app.float.cover_margin_right_sm') + }).getValue(this.currentBreakpoint), + top: new BreakpointType({ + sm: $r('app.float.cover_margin_top_sm'), + md: $r('app.float.cover_margin_top_md'), + lg: $r('app.float.cover_margin_top_lg') + }).getValue(this.currentBreakpoint) + }) + } + + @Builder MusicInfo() { + Column() { + Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { + Text(this.songList[this.selectIndex].title) + .fontSize($r('app.float.font_twenty_four')) + .fontColor($r('app.color.text_color')) + Image($r('app.media.ic_like')) + .width($r('app.float.twenty_four')) + .aspectRatio(1) + .objectFit(ImageFit.Contain) + } + + Text(this.songList[this.selectIndex].singer) + .textAlign(TextAlign.Start) + .fontSize($r('app.float.font_fourteen')) + .fontColor($r("app.color.text_sixty_color")) + .margin({ top: $r('app.float.music_text_margin_top') }) + .width(StyleConstants.FULL_WIDTH) + } + .margin({ top: $r('app.float.music_info_margin_top') }) + } + + @Builder OperationInfo() { + Flex({ justifyContent: FlexAlign.SpaceBetween }) { + ForEach(playImage, (item: PlayControlModel) => { + Image(item.icon) + .aspectRatio(1) + .width(new BreakpointType({ + sm: $r('app.float.twenty_four'), + md: $r('app.float.twenty_four'), + lg: $r('app.float.operation_image_width_lg') + }).getValue(this.currentBreakpoint)) + .objectFit(ImageFit.Contain) + .onClick(() => this.controlClick(item.key)) + }, item => JSON.stringify(item)) + } + } + + controlClick(key: string) { + if (key === ControlConstants.REVIEW) { + router.pushUrl({ + url: RouterUrlConstants.MUSIC_COMMENT + }, router.RouterMode.Single).catch(error => { + Logger.error('pushUrl failed :' + JSON.stringify(error)); + }) + } + } +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicPlay/src/main/ets/component/PlayControlComponent.ets b/MultiDeviceMusic-army/musicPlay/src/main/ets/component/PlayControlComponent.ets new file mode 100644 index 0000000000000000000000000000000000000000..adc003b850224b640fa665aed5a9efa056de847f --- /dev/null +++ b/MultiDeviceMusic-army/musicPlay/src/main/ets/component/PlayControlComponent.ets @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2023 Huawei Device 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 { MediaService, BreakpointType, MusicPlayMode, Logger } from '@ohos/mediaCommon'; +import { PlayControlModel } from '../bean/PlayControlModel'; +import { ControlConstants } from '../constants/ControlConstants'; +import { PlayConstants } from '../constants/PlayConstants'; + +@Component +export struct PlayControlComponent { + @StorageProp('currentBreakpoint') currentBreakpoint: string = 'sm'; + @ObjectLink playControl: PlayControlModel; + @State index: number = 0; + + build() { + Image(this.playControl.icon) + .width(this.index === PlayConstants.PLAY_INDEX ? new BreakpointType({ + sm: $r('app.float.play_image_size'), + md: $r('app.float.play_image_size'), + lg: $r('app.float.play_image_size_lg') + }).getValue(this.currentBreakpoint) : new BreakpointType({ + sm: $r('app.float.twenty_four'), + md: $r('app.float.twenty_four'), + lg: $r('app.float.play_control_image_size') + }).getValue(this.currentBreakpoint)) + .aspectRatio(1) + .objectFit(ImageFit.Contain) + .onClick(() => this.playControlClick(this.playControl.key)) + } + + playControlClick(key) { + switch (key) { + case ControlConstants.PLAY_MODE: + this.changePlayMode(); + break; + case ControlConstants.PREVIOUS: + MediaService.getInstance().playPrevious(); + break; + case ControlConstants.PLAY: + if (MediaService.getInstance().getFirst()) { + MediaService.getInstance().loadAssent(0); + } else { + MediaService.getInstance().play(); + } + this.playControl.icon = $r('app.media.ic_play_big'); + this.playControl.key = ControlConstants.PAUSE; + break; + case ControlConstants.PAUSE: + MediaService.getInstance().pause(); + this.playControl.icon = $r('app.media.ic_pause_big'); + this.playControl.key = ControlConstants.PLAY; + break; + case ControlConstants.NEXT: + MediaService.getInstance().playNextAuto(true); + break; + case ControlConstants.PLAY_LIST: + break; + default: + break; + } + } + + private changePlayMode(): void { + const mode = [MusicPlayMode.SINGLE_CYCLE, MusicPlayMode.ORDER, MusicPlayMode.RANDOM]; + const resource = [$r('app.media.ic_single_cycle'), $r('app.media.ic_list_cycle'), $r('app.media.ic_list_random')]; + let index = MediaService.getInstance().getPlayMode() + 1; + if (index > mode.length - 1) { + index = 0; + } + Logger.info('change play mode setPlayModel index:' + index); + this.playControl.icon = resource[index]; + MediaService.getInstance().setPlayModel(mode[index]); + } +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicPlay/src/main/ets/constants/ControlConstants.ets b/MultiDeviceMusic-army/musicPlay/src/main/ets/constants/ControlConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..655de95a2fd998d7ebbd76424901a469a295b5f7 --- /dev/null +++ b/MultiDeviceMusic-army/musicPlay/src/main/ets/constants/ControlConstants.ets @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2023 Huawei Device 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. + */ + +export class ControlConstants { + /** + * Play control value. + */ + static readonly PLAY: string = 'play'; + + /** + * Pause control value. + */ + static readonly PAUSE: string = 'pause'; + + /** + * Play next control value. + */ + static readonly NEXT: string = 'next'; + + /** + * Play previous control value. + */ + static readonly PREVIOUS: string = 'previous'; + + /** + * review value. + */ + static readonly REVIEW: string = 'review'; + + /** + * Play mode control value. + */ + static readonly PLAY_MODE: string = 'playMode'; + + /** + * Play list control value. + */ + static readonly PLAY_LIST: string = 'playList'; +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicPlay/src/main/ets/constants/PlayConstants.ets b/MultiDeviceMusic-army/musicPlay/src/main/ets/constants/PlayConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..4b30dbc9383087dfb1bef4bb1edd0f1f578cdf15 --- /dev/null +++ b/MultiDeviceMusic-army/musicPlay/src/main/ets/constants/PlayConstants.ets @@ -0,0 +1,141 @@ +/* + * Copyright (c) 2023 Huawei Device 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. + */ + +export class PlayConstants { + /** + * Play control index. + */ + static readonly PLAY_INDEX: number = 2; + + /** + * The value of slide step. + */ + static readonly SLIDE_STEP: number = 1; + + /** + * The value of gridRow gutter twelve. + */ + static readonly GRID_COL_GUTTER: number = 12; + + /** + * The value of gridRow column four. + */ + static readonly COLUMN_FOUR: number = 4; + + /** + * The value of gridRow column eight. + */ + static readonly COLUMN_EIGHT: number = 8; + + /** + * The value of gridRow column twelve. + */ + static readonly COLUMN_TWELVE: number = 12; + + /** + * The value of gridCol span four. + */ + static readonly SPAN_FOUR: number = 4; + + /** + * The value of gridCol span six. + */ + static readonly SPAN_SIX: number = 6; + + /** + * The value of gridCol span eight. + */ + static readonly SPAN_EIGHT: number = 8; + + /** + * The value of gridCol offset one. + */ + static readonly OFFSET_ONE: number = 1; + + /** + * The value of gridCol offset two. + */ + static readonly OFFSET_TWO: number = 2; + + /** + * The value of gridCol offset three. + */ + static readonly OFFSET_THREE: number = 3; + + /** + * The value of gridCol offset six. + */ + static readonly OFFSET_SIX: number = 6; + + /** + * The value of five hundred. + */ + static readonly FIVE_HUNDRED: number = 500; + + /** + * The value of four hundred. + */ + static readonly FOUR_HUNDRED: number = 400; + + /** + * The value of image background blur. + */ + static readonly BLUR: number = 50; + + /** + * The background value of eighty percent transparency white. + */ + static readonly EIGHTY_WHITE: number = 0.5; + + /** + * The background value of ninety percent transparency white. + */ + static readonly NINETY_WHITE: number = 1.0; + + /** + * The color value of eighty percent transparency white. + */ + static readonly EIGHTY_WHITE_COLOR: string = '#ccffffff'; + + /** + * The color value of ninety percent transparency white. + */ + static readonly NINETY_WHITE_COLOR: string = '#e6ffffff'; + + /** + * The value of lg. + */ + static readonly LG: string = 'lg'; + + /** + * The tab text value of song. + */ + static readonly TAB_SONG: string = '歌曲'; + + /** + * The tab text value of lyrics. + */ + static readonly TAB_LYRICS: string = '歌词'; + + /** + * The tab text value of lyrics. + */ + static readonly LYRICS_CONTENT: string = '此歌曲为没有填词的纯音乐,请您欣赏'; + + /** + * The value tab width. + */ + static readonly TAB_WIDTH: string = '36%'; +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicPlay/src/main/ets/pages/PlayPage.ets b/MultiDeviceMusic-army/musicPlay/src/main/ets/pages/PlayPage.ets new file mode 100644 index 0000000000000000000000000000000000000000..023192b99cdaf916ebd53f3b2461c591ed1f7058 --- /dev/null +++ b/MultiDeviceMusic-army/musicPlay/src/main/ets/pages/PlayPage.ets @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2023 Huawei Device 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 router from '@ohos.router'; +import { StyleConstants } from '@ohos/constantsCommon'; +import { BreakpointType, SongItem, MusicList } from '@ohos/mediaCommon'; +import { ControlComponent } from '../component/ControlComponent'; +import { LyricsComponent } from '../component/LyricsComponent'; +import { MusicInfoComponent } from '../component/MusicInfoComponent'; +import { PlayConstants } from '../constants/PlayConstants'; + +@Entry +@Component +struct PlayPage { + @State currentTabIndex: number = 0; + @StorageProp('currentBreakpoint') currentBreakpoint: string = 'sm'; + songList: SongItem[] = MusicList; + @StorageProp('selectIndex') selectIndex: number = 0; + + build() { + Stack({ alignContent: Alignment.TopStart }) { + if (this.currentBreakpoint === PlayConstants.LG) { + Stack({ alignContent: Alignment.Top }) { + LyricsComponent() + + Flex({ direction: FlexDirection.Column }) { + MusicInfoComponent() + ControlComponent() + } + } + } else { + Flex({ direction: FlexDirection.Column }) { + Tabs({ barPosition: BarPosition.Start, index: this.currentTabIndex }) { + TabContent() { + MusicInfoComponent() + } + .tabBar(this.TabTitle(PlayConstants.TAB_SONG, 0)) + + TabContent() { + LyricsComponent() + } + .tabBar(this.TabTitle(PlayConstants.TAB_LYRICS, 1)) + } + .onChange(index => this.currentTabIndex = index) + .vertical(false) + .barHeight($r('app.float.fifty_six')) + .barWidth(PlayConstants.TAB_WIDTH) + + ControlComponent() + } + } + + Image($r('app.media.ic_back_down')) + .width($r('app.float.image_back_size')) + .height($r('app.float.image_back_size')) + .margin({ left: $r('app.float.twenty_four'), top: $r('app.float.image_back_margin_top') }) + .onClick(() => router.back()) + } + .backgroundImage(this.songList[this.selectIndex].label) + .backgroundImageSize(ImageSize.Cover) + .backdropBlur(PlayConstants.BLUR) + .linearGradient({ + direction: GradientDirection.Bottom, + colors: [ + [PlayConstants.EIGHTY_WHITE_COLOR, PlayConstants.EIGHTY_WHITE], + [PlayConstants.NINETY_WHITE_COLOR, PlayConstants.NINETY_WHITE] + ] + }) + .height(StyleConstants.FULL_HEIGHT) + .width(StyleConstants.FULL_WIDTH) + } + + @Builder TabTitle(title, index) { + Text(title) + .fontColor(this.currentTabIndex === index ? $r('app.color.text_color') : $r('app.color.text_forty_color')) + .fontWeight(this.currentTabIndex === index ? PlayConstants.FIVE_HUNDRED : PlayConstants.FOUR_HUNDRED) + .fontSize(new BreakpointType({ + sm: $r('app.float.font_sixteen'), + md: $r('app.float.font_twenty') + }).getValue(this.currentBreakpoint)) + .border({ + width: { bottom: this.currentTabIndex === index ? $r('app.float.tab_border_width') : 0 }, + color: $r('app.color.text_color') + }) + .padding({ bottom: $r('app.float.tab_text_padding_bottom') }) + } + + pageTransition() { + PageTransitionEnter({ duration: PlayConstants.FIVE_HUNDRED, curve: Curve.Smooth }).slide(SlideEffect.Bottom); + PageTransitionExit({ duration: PlayConstants.FIVE_HUNDRED, curve: Curve.Smooth }).slide(SlideEffect.Bottom); + } +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicPlay/src/main/ets/viewmodel/PlayData.ets b/MultiDeviceMusic-army/musicPlay/src/main/ets/viewmodel/PlayData.ets new file mode 100644 index 0000000000000000000000000000000000000000..f75c7cf8d08be1afb191f978e42d4ebceefd9106 --- /dev/null +++ b/MultiDeviceMusic-army/musicPlay/src/main/ets/viewmodel/PlayData.ets @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2023 Huawei Device 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 { PlayControlModel } from '../bean/PlayControlModel'; +import { ControlConstants } from '../constants/ControlConstants'; + +const playImage: PlayControlModel[] = [ + { icon: $r('app.media.ic_download') }, + { icon: $r('app.media.ic_review'), key: 'review' }, + { icon: $r('app.media.ic_mv') }, + { icon: $r('app.media.ic_ring') }, + { icon: $r('app.media.ic_list_more') } +] + +const playControl: PlayControlModel[] = [ + new PlayControlModel( + $r('app.media.ic_list_cycle'), + ControlConstants.PLAY_MODE + ), + new PlayControlModel( + $r('app.media.ic_last'), + ControlConstants.PREVIOUS + ), + new PlayControlModel( + $r('app.media.ic_play_big'), + ControlConstants.PLAY + ), + new PlayControlModel( + $r('app.media.ic_next'), + ControlConstants.NEXT + ), + new PlayControlModel( + $r('app.media.ic_music_list'), + ControlConstants.PLAY_LIST + ) +] + +export { playImage, playControl } \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicPlay/src/main/module.json5 b/MultiDeviceMusic-army/musicPlay/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..4347435a1e4b12e541eaa47d3ae52ab7ed3a5bd8 --- /dev/null +++ b/MultiDeviceMusic-army/musicPlay/src/main/module.json5 @@ -0,0 +1,13 @@ +{ + "module": { + "name": "musicPlay", + "type": "shared", + "description": "$string:shared_desc", + "deviceTypes": [ + "default", + "tablet" + ], + "deliveryWithInstall": true, + "pages": "$profile:main_pages" + } +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicPlay/src/main/resources/base/element/color.json b/MultiDeviceMusic-army/musicPlay/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..fa905a3743bca529a8b8561aefbe216145e36591 --- /dev/null +++ b/MultiDeviceMusic-army/musicPlay/src/main/resources/base/element/color.json @@ -0,0 +1,24 @@ +{ + "color": [ + { + "name": "white", + "value": "#FFFFFF" + }, + { + "name": "text_color", + "value": "#376668" + }, + { + "name": "text_sixty_color", + "value": "#99376668" + }, + { + "name": "text_forty_color", + "value": "#99376668" + }, + { + "name": "text_twenty_color", + "value": "#33376668" + } + ] +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicPlay/src/main/resources/base/element/float.json b/MultiDeviceMusic-army/musicPlay/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..06d77e0413fab1f559a5291523640019a3ac1f4d --- /dev/null +++ b/MultiDeviceMusic-army/musicPlay/src/main/resources/base/element/float.json @@ -0,0 +1,140 @@ +{ + "float": [ + { + "name": "font_twelve", + "value": "12fp" + }, + { + "name": "font_fourteen", + "value": "14fp" + }, + { + "name": "font_fifteen", + "value": "15fp" + }, + { + "name": "font_sixteen", + "value": "16fp" + }, + { + "name": "font_eighteen", + "value": "18fp" + }, + { + "name": "font_twenty", + "value": "20fp" + }, + { + "name": "font_twenty_four", + "value": "24fp" + }, + { + "name": "font_thirty", + "value": "30fp" + }, + { + "name": "twenty_four", + "value": "24vp" + }, + { + "name": "fifty_six", + "value": "56vp" + }, + { + "name": "text_singer_margin_top", + "value": "6vp" + }, + { + "name": "image_back_margin_top", + "value": "6vp" + }, + { + "name": "image_back_size", + "value": "30vp" + }, + { + "name": "tab_border_width", + "value": "2vp" + }, + { + "name": "tab_text_padding_bottom", + "value": "2vp" + }, + { + "name": "slide_text_width", + "value": "58vp" + }, + { + "name": "lyrics_margin_top_lg", + "value": "78vp" + }, + { + "name": "lyrics_text_margin_top", + "value": "24vp" + }, + { + "name": "image_like_size", + "value": "30vp" + }, + { + "name": "cover_radius", + "value": "16vp" + }, + { + "name": "cover_margin", + "value": "18vp" + }, + { + "name": "cover_margin_left_sm", + "value": "10vp" + }, + { + "name": "cover_margin_right_sm", + "value": "10vp" + }, + { + "name": "cover_margin_top_sm", + "value": "16vp" + }, + { + "name": "cover_margin_top_md", + "value": "16vp" + }, + { + "name": "cover_margin_top_lg", + "value": "78vp" + }, + { + "name": "music_info_margin_top", + "value": "38vp" + }, + { + "name": "music_text_margin_top", + "value": "6vp" + }, + { + "name": "operation_image_width_lg", + "value": "30vp" + }, + { + "name": "play_image_size", + "value": "64vp" + }, + { + "name": "play_image_size_lg", + "value": "80vp" + }, + { + "name": "play_control_image_size", + "value": "30vp" + }, + { + "name": "cover_image_width", + "value": "296vp" + }, + { + "name": "cover_image_width_lg", + "value": "452vp" + } + ] +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicPlay/src/main/resources/base/element/string.json b/MultiDeviceMusic-army/musicPlay/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..98e1d8a84b3d8539ea33e79fe2ac593a05d23bb4 --- /dev/null +++ b/MultiDeviceMusic-army/musicPlay/src/main/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + } + ] +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/ic_back_down.svg b/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/ic_back_down.svg new file mode 100644 index 0000000000000000000000000000000000000000..73c4eacf767465a1811259aaef606fafcb01d55a --- /dev/null +++ b/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/ic_back_down.svg @@ -0,0 +1,13 @@ + + + ic_more备份 5 + + + + + + + + + + \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/ic_download.svg b/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/ic_download.svg new file mode 100644 index 0000000000000000000000000000000000000000..b589f7ff0f1ac0393d959a27328208c4978c12eb --- /dev/null +++ b/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/ic_download.svg @@ -0,0 +1,13 @@ + + + ic_download + + + + + + + + + + \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/ic_last.svg b/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/ic_last.svg new file mode 100644 index 0000000000000000000000000000000000000000..98820f2a23e7fe293bb721d4ce1d329471ff8fc1 --- /dev/null +++ b/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/ic_last.svg @@ -0,0 +1,7 @@ + + + ic_last + + + + \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/ic_like.svg b/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/ic_like.svg new file mode 100644 index 0000000000000000000000000000000000000000..3f1ba68ba4e8266ad48ef6b3048effb799389ae9 --- /dev/null +++ b/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/ic_like.svg @@ -0,0 +1,13 @@ + + + ic_Favorites_line + + + + + + + + + + \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/ic_list_cycle.svg b/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/ic_list_cycle.svg new file mode 100644 index 0000000000000000000000000000000000000000..e6093e5e5d8bc9d346e59a352c699458ef5e22e7 --- /dev/null +++ b/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/ic_list_cycle.svg @@ -0,0 +1,13 @@ + + + ic_more备份 4 + + + + + + + + + + \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/ic_list_more.svg b/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/ic_list_more.svg new file mode 100644 index 0000000000000000000000000000000000000000..b2d527d46fdaebfcacf2630d11f7e11454bc080a --- /dev/null +++ b/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/ic_list_more.svg @@ -0,0 +1,13 @@ + + + ic_list_more + + + + + + + + + + \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/ic_list_random.svg b/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/ic_list_random.svg new file mode 100644 index 0000000000000000000000000000000000000000..ebd422133383756881866557b75c5959759257a6 --- /dev/null +++ b/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/ic_list_random.svg @@ -0,0 +1,13 @@ + + + ic_public_random + + + + + + + + + + \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/ic_music_bg.png b/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/ic_music_bg.png new file mode 100644 index 0000000000000000000000000000000000000000..65b36e53f9d57a0e6db7ae333ece7b11213d9392 Binary files /dev/null and b/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/ic_music_bg.png differ diff --git a/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/ic_music_list.svg b/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/ic_music_list.svg new file mode 100644 index 0000000000000000000000000000000000000000..26d953b4b0c3a27fd992317b2906454d4dd0504b --- /dev/null +++ b/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/ic_music_list.svg @@ -0,0 +1,10 @@ + + + ic_more备份 8 + + + + + + + \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/ic_mv.svg b/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/ic_mv.svg new file mode 100644 index 0000000000000000000000000000000000000000..88f3cd7a58d00a40b1b90d7d44111206663359ec --- /dev/null +++ b/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/ic_mv.svg @@ -0,0 +1,8 @@ + + + ic_more备份 + + + + + \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/ic_next.svg b/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/ic_next.svg new file mode 100644 index 0000000000000000000000000000000000000000..597bd53ca4886cbfbf3dd7c917c181f31583a5db --- /dev/null +++ b/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/ic_next.svg @@ -0,0 +1,7 @@ + + + ic_next + + + + \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/ic_pause_big.svg b/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/ic_pause_big.svg new file mode 100644 index 0000000000000000000000000000000000000000..de4a81ed83515f6fe65efd43833bf8d2808336b2 --- /dev/null +++ b/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/ic_pause_big.svg @@ -0,0 +1,7 @@ + + + ic_Pause_big + + + + \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/ic_play_big.svg b/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/ic_play_big.svg new file mode 100644 index 0000000000000000000000000000000000000000..c172bc047a1fd216a175c18d7c0bd42a2f796418 --- /dev/null +++ b/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/ic_play_big.svg @@ -0,0 +1,7 @@ + + + ic_play_big + + + + \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/ic_review.svg b/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/ic_review.svg new file mode 100644 index 0000000000000000000000000000000000000000..a9e9b973162fc9e6aed0400b7b527a4f99cbb509 --- /dev/null +++ b/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/ic_review.svg @@ -0,0 +1,13 @@ + + + ic_review + + + + + + + + + + \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/ic_ring.svg b/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/ic_ring.svg new file mode 100644 index 0000000000000000000000000000000000000000..65fdce828394b49f7e54176365f2a0cc9b330cf3 --- /dev/null +++ b/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/ic_ring.svg @@ -0,0 +1,13 @@ + + + ic_more备份 2 + + + + + + + + + + \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/ic_single_cycle.svg b/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/ic_single_cycle.svg new file mode 100644 index 0000000000000000000000000000000000000000..23f0a3b088ce6de726659ce2b43abd6a76a35e77 --- /dev/null +++ b/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/ic_single_cycle.svg @@ -0,0 +1,13 @@ + + + ic_public_single_cycle + + + + + + + + + + \ No newline at end of file diff --git a/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/icon.png b/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/icon.png differ diff --git a/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/setting.jpeg b/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/setting.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..57e67dd49d39ad64ef090f59db3db9dfe6632106 Binary files /dev/null and b/MultiDeviceMusic-army/musicPlay/src/main/resources/base/media/setting.jpeg differ diff --git a/MultiDeviceMusic-army/musicPlay/src/main/resources/base/profile/main_pages.json b/MultiDeviceMusic-army/musicPlay/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..2d767f8a1bbbae34ca17dff9817aa5c82e059e79 --- /dev/null +++ b/MultiDeviceMusic-army/musicPlay/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/PlayPage" + ] +} diff --git a/MultiDeviceMusic-army/oh-package.json5 b/MultiDeviceMusic-army/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..d04930e687dcfe6a8ea9d4a168c45dd79244878b --- /dev/null +++ b/MultiDeviceMusic-army/oh-package.json5 @@ -0,0 +1,12 @@ +{ + "license": "", + "devDependencies": { + "@ohos/hypium": "1.0.6" + }, + "author": "", + "name": "musichome", + "description": "Please describe the basic information.", + "main": "", + "version": "1.0.0", + "dependencies": {} +} diff --git a/MultiDeviceMusic-army/products/phone/build-profile.json5 b/MultiDeviceMusic-army/products/phone/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..13c5eda6e6a3dae913ec5c5c4d60ea3ac954f205 --- /dev/null +++ b/MultiDeviceMusic-army/products/phone/build-profile.json5 @@ -0,0 +1,11 @@ +{ + "apiType": 'stageMode', + "buildOption": { + }, + "targets": [ + { + "name": "default", + "runtimeOS": "HarmonyOS" + } + ] +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/products/phone/hvigorfile.ts b/MultiDeviceMusic-army/products/phone/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..80e4ec5b81689f238c34614b167a0b9e9c83e8d9 --- /dev/null +++ b/MultiDeviceMusic-army/products/phone/hvigorfile.ts @@ -0,0 +1,2 @@ +// 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/MultiDeviceMusic-army/products/phone/oh-package.json5 b/MultiDeviceMusic-army/products/phone/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..c2103797773b68802bdfa707f37901ef56af4b66 --- /dev/null +++ b/MultiDeviceMusic-army/products/phone/oh-package.json5 @@ -0,0 +1,13 @@ +{ + "license": "", + "devDependencies": {}, + "author": "", + "name": "phone", + "description": "Please describe the basic information.", + "main": "", + "version": "1.0.0", + "dependencies": { + "@ohos/mediaCommon": "file:../../common/mediaCommon", + "@ohos/constantsCommon": "file:../../common/constantsCommon" + } +} diff --git a/MultiDeviceMusic-army/products/phone/src/main/ets/common/bean/IndexItem.ets b/MultiDeviceMusic-army/products/phone/src/main/ets/common/bean/IndexItem.ets new file mode 100644 index 0000000000000000000000000000000000000000..88e75df7f41c894d3131147d0ba8ee9315cfa9f2 --- /dev/null +++ b/MultiDeviceMusic-army/products/phone/src/main/ets/common/bean/IndexItem.ets @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2023 Huawei Device 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. + */ + +/** + * Home page list information. + */ +export default class IndexItem { + /** + * List item name. + */ + title: ResourceStr; + + /** + * List item description. + */ + description: ResourceStr; + + /** + * Button text information. + */ + button: ResourceStr; + + /** + * Background image information. + */ + icon: Resource; + + /** + * Jumping path information. + */ + url: string; + + constructor(title: ResourceStr, description: ResourceStr, button: ResourceStr, icon: Resource, url: string) { + this.title = title; + this.description = description; + this.button = button; + this.icon = icon; + this.url = url; + } +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/products/phone/src/main/ets/common/constants/HomeConstants.ets b/MultiDeviceMusic-army/products/phone/src/main/ets/common/constants/HomeConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..784961a6bbd493c0e487c32f7978c6f5880fd7bf --- /dev/null +++ b/MultiDeviceMusic-army/products/phone/src/main/ets/common/constants/HomeConstants.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2023 Huawei Device 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. + */ + +/** + * Constants for home. + */ +export class HomeConstants { + /** + * Column component spacing. + */ + static readonly COLUMN_SPACE: string = '12vp'; + + /** + * Text transparency. + */ + static readonly TEXT_OPACITY: number = 0.6; +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/products/phone/src/main/ets/entryability/EntryAbility.ts b/MultiDeviceMusic-army/products/phone/src/main/ets/entryability/EntryAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..6ae05254a272e4f5d80c0857467f964bef7df070 --- /dev/null +++ b/MultiDeviceMusic-army/products/phone/src/main/ets/entryability/EntryAbility.ts @@ -0,0 +1,163 @@ +/* + * Copyright (c) 2023 Huawei Device 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 AbilityConstant from '@ohos.app.ability.AbilityConstant'; +import hilog from '@ohos.hilog'; +import UIAbility from '@ohos.app.ability.UIAbility'; +import Want from '@ohos.app.ability.Want'; +import window from '@ohos.window'; +import formBindingData from '@ohos.app.form.formBindingData'; +import formProvider from '@ohos.app.form.formProvider'; + +import { MediaService, SongItem, MusicList } from '@ohos/mediaCommon'; + +// let selectIndex: number = AppStorage.Get("selectIndex"); +let selectPage = ""; +let currentWindowStage = null; +const MSG_MUSIC_METHOD: string = 'funMusic' +// 在收到call事件后会触发callee监听的方法 +function FunMusicCall(data) { + // 获取call事件中传递的所有参数 + let params = JSON.parse(data.readString()) + if (params.formId !== undefined) { + let curFormId = params.formId; + let action = params.detail; + console.info(`UpdateForm formId: ${curFormId}, detail: ${action}`); + + + let songList: SongItem[] = MusicList; + let isPlay = params.isPlay; + let selectIndex: number = AppStorage.Get("selectIndex"); + + if (action == 'previous') { + selectIndex -= 1; + if (selectIndex < 0) { + selectIndex = 0 + } + MediaService.getInstance().playPrevious(); + }else if(action == 'next') { + selectIndex += 1; + if (selectIndex >= songList.length) { + selectIndex = songList.length + } + MediaService.getInstance().playNextAuto(true); + }else { + // isPlay = !params.isPlay; + // AppStorage.Set("isPlay", isPlay) + if (MediaService.getInstance().getFirst()) { + MediaService.getInstance().loadAssent(0) + } else { + isPlay ? MediaService.getInstance().pause() : MediaService.getInstance().play(); + } + } + + AppStorage.Set("isPlay", isPlay) + let formData = { + "title": songList[selectIndex]?.title, + "label": songList[selectIndex]?.label, + "isPlay": isPlay, + "formId": curFormId + }; + let formMsg = formBindingData.createFormBindingData(formData) + formProvider.updateForm(curFormId, formMsg).then((data) => { + console.info('updateForm success.' + JSON.stringify(data)); + }).catch((error) => { + console.error('updateForm failed:' + JSON.stringify(error)); + }) + } + return null; +} + + +export default class EntryAbility extends UIAbility { + onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) { + AppStorage.SetOrCreate('context', this.context) + AppStorage.SetOrCreate('isPlay', false); + AppStorage.SetOrCreate('selectIndex', 0); + + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); + // 获取router事件中传递的targetPage参数 + console.info("onCreate want:" + JSON.stringify(want)); + if (want.parameters.params !== undefined) { + let params = JSON.parse(want.parameters.params.toString()); + console.info("onCreate router targetPage:" + params.targetPage); + selectPage = params.targetPage; + AppStorage.SetOrCreate('selectPage', selectPage) + } + try { + // 监听call事件所需的方法 + this.callee.on(MSG_MUSIC_METHOD, FunMusicCall); + } catch (error) { + console.log(`${MSG_MUSIC_METHOD} register failed with error ${JSON.stringify(error)}`) + } + } + + onDestroy() { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); + } + + // 如果UIAbility已在后台运行,在收到Router事件后会触发onNewWant生命周期回调 + onNewWant(want, launchParam) { + console.info("onNewWant want:" + JSON.stringify(want)); + if (want.parameters.params !== undefined) { + let params = JSON.parse(want.parameters.params.toString()); + console.info("onNewWant router targetPage:" + params.targetPage); + selectPage = params.targetPage; + AppStorage.SetOrCreate('selectPage', selectPage) + } + if (currentWindowStage != null) { + this.onWindowStageCreate(currentWindowStage); + } + try { + // 监听call事件所需的方法 + this.callee.on(MSG_MUSIC_METHOD, FunMusicCall); + } catch (error) { + console.log(`${MSG_MUSIC_METHOD} register failed with error ${JSON.stringify(error)}`) + } + } + + onWindowStageCreate(windowStage: window.WindowStage) { + // Main window is created, set main page for this ability + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); + + if (currentWindowStage === null) { + currentWindowStage = windowStage; + } + + windowStage.loadContent('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() { + // Main window is destroyed, release UI related resources + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); + } + + onForeground() { + // Ability has brought to foreground + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); + } + + onBackground() { + // Ability has back to background + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); + } +} diff --git a/MultiDeviceMusic-army/products/phone/src/main/ets/pages/Index.ets b/MultiDeviceMusic-army/products/phone/src/main/ets/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..269e44f8d48d992572ae944e3cefb3da41b76131 --- /dev/null +++ b/MultiDeviceMusic-army/products/phone/src/main/ets/pages/Index.ets @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2023 Huawei Device 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 router from '@ohos.router'; +import IndexItem from '../common/bean/IndexItem'; +import IndexViewModel from '../viewmodel/IndexViewModel'; +import { BreakpointConstants, StyleConstants } from '@ohos/constantsCommon' +import { HomeConstants } from '../common/constants/HomeConstants'; + +@Entry +@Component +struct Index { + @State indexItemList: IndexItem[] = IndexViewModel.getIndexItemList(); + @State selectPage: string = AppStorage.Get('selectPage'); + + aboutToAppear() { + if (this.selectPage === 'musicList') { + router.pushUrl({ + url: '@bundle:com.huawei.music.musichome/musicList/ets/pages/Index' + }, router.RouterMode.Single); + } + } + + build() { + GridRow({ + breakpoints: { + value: BreakpointConstants.BREAKPOINT_VALUE, + reference: BreakpointsReference.WindowSize + }, + columns: { + sm: BreakpointConstants.COLUMN_SM, + md: BreakpointConstants.COLUMN_MD, + lg: BreakpointConstants.COLUMN_LG + }, + gutter: { x: BreakpointConstants.GUTTER_X }, + direction: GridRowDirection.Row + }) { + GridCol({ + span: { + sm: BreakpointConstants.SPAN_SM, + md: BreakpointConstants.SPAN_MD, + lg: BreakpointConstants.SPAN_LG + }, + offset: { + md: BreakpointConstants.OFFSET_MD, + lg: BreakpointConstants.OFFSET_LG + } + }) { + Column({ space: HomeConstants.COLUMN_SPACE }) { + ForEach(this.indexItemList, (item: IndexItem) => { + Stack() { + Image(item.icon) + .width(StyleConstants.FULL_WIDTH) + .height($r('app.float.item_height')) + .borderRadius($r('app.float.item_border_radius')) + Column() { + Text(item.title) + .fontSize($r('app.float.title_font_size')) + .fontColor(Color.White) + Text(item.description) + .fontSize($r('app.float.description_font_size')) + .opacity(HomeConstants.TEXT_OPACITY) + .fontColor(Color.White) + .margin({ + top: $r('app.float.description_margin_top') + }) + Blank() + Column() { + Button() { + Text(item.button) + .fontSize($r('app.float.button_font_size')) + .fontColor(Color.White) + } + .backgroundColor($r('app.color.button_background_color')) + .borderRadius($r('app.float.button_border_radius')) + .width($r('app.float.button_width')) + .height($r('app.float.button_height')) + .onClick(() => { + router.pushUrl({ + url: item.url + }, router.RouterMode.Single); + }) + } + .alignItems(HorizontalAlign.End) + .width(StyleConstants.FULL_WIDTH) + } + .width(StyleConstants.FULL_WIDTH) + .height($r('app.float.item_height')) + .borderRadius($r('app.float.item_border_radius')) + .padding($r('app.float.item_padding')) + .alignItems(HorizontalAlign.Start) + .justifyContent(FlexAlign.SpaceBetween) + } + }, (item, index) => index + JSON.stringify(item)) + } + } + } + .padding({ + top: $r('app.float.column_padding_top'), + left: $r('app.float.column_padding_left'), + right: $r('app.float.column_padding_right') + }) + } +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/products/phone/src/main/ets/phoneformability/PhoneFormAbility.ts b/MultiDeviceMusic-army/products/phone/src/main/ets/phoneformability/PhoneFormAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..955bf06dfc7a70a63cc2da7d410e53f60050ee43 --- /dev/null +++ b/MultiDeviceMusic-army/products/phone/src/main/ets/phoneformability/PhoneFormAbility.ts @@ -0,0 +1,50 @@ +import formInfo from '@ohos.app.form.formInfo'; +import formBindingData from '@ohos.app.form.formBindingData'; +import FormExtensionAbility from '@ohos.app.form.FormExtensionAbility'; +import { SongItem, MusicList } from '@ohos/mediaCommon'; + +export default class PhoneFormAbility extends FormExtensionAbility { + onAddForm(want) { + // Called to return a FormBindingData object. + // 获取卡片ID:ohos.extra.param.key.form_identity + let formId: string = want.parameters['ohos.extra.param.key.form_identity'] as string; + + let selectIndex: number = AppStorage.Get('selectIndex'); + let isPlay: boolean = AppStorage.Get('isPlay'); + let songList: SongItem[] = MusicList; + let formData = { + "title": songList[selectIndex]?.title, + "label": songList[selectIndex]?.label, + "isPlay": isPlay, + "formId": formId + }; + + return formBindingData.createFormBindingData(formData); + } + + onCastToNormalForm(formId) { + // Called when the form provider is notified that a temporary form is successfully + // converted to a normal form. + } + + onUpdateForm(formId) { + // Called to notify the form provider to update a specified form. + } + + onChangeFormVisibility(newStatus) { + // Called when the form provider receives form events from the system. + } + + onFormEvent(formId, message) { + // Called when a specified message event defined by the form provider is triggered. + } + + onRemoveForm(formId) { + // Called to notify the form provider that a specified form has been destroyed. + } + + onAcquireFormState(want) { + // Called to return a {@link FormState} object. + return formInfo.FormState.READY; + } +}; \ No newline at end of file diff --git a/MultiDeviceMusic-army/products/phone/src/main/ets/viewmodel/IndexViewModel.ets b/MultiDeviceMusic-army/products/phone/src/main/ets/viewmodel/IndexViewModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..d3b2d4ee0f28782fe1050de214a81c737c9175b3 --- /dev/null +++ b/MultiDeviceMusic-army/products/phone/src/main/ets/viewmodel/IndexViewModel.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2023 Huawei Device 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 IndexItem from '../common/bean/IndexItem'; + +/** + * Home page information data processing class. + */ +class IndexViewModel { + /** + * Data information on the home page. + * + * @returns IndexItem array. + */ + getIndexItemList(): IndexItem[] { + let IndexItemList = []; + IndexItemList.push(new IndexItem($r('app.string.music_title'), $r('app.string.music_description'), + $r('app.string.button_music'), $r('app.media.ic_music'), + '@bundle:com.huawei.music.musichome/musicList/ets/pages/Index')); + IndexItemList.push(new IndexItem($r('app.string.live_title'), $r('app.string.live_description'), + $r('app.string.button_live'), $r('app.media.ic_live'), + '@bundle:com.huawei.music.musichome/live/ets/pages/Index')); + return IndexItemList; + } +} + +export default new IndexViewModel(); \ No newline at end of file diff --git a/MultiDeviceMusic-army/products/phone/src/main/ets/widget/pages/WidgetCard.ets b/MultiDeviceMusic-army/products/phone/src/main/ets/widget/pages/WidgetCard.ets new file mode 100644 index 0000000000000000000000000000000000000000..733a3804ab74c3b06516c6fbc558e0b8f30e5f1b --- /dev/null +++ b/MultiDeviceMusic-army/products/phone/src/main/ets/widget/pages/WidgetCard.ets @@ -0,0 +1,111 @@ +let storage = new LocalStorage(); + +@Entry(storage) +@Component +struct WidgetCard { + @LocalStorageProp('title') title: string = '中国人'; + @LocalStorageProp('label') label: Resource = $r('app.media.ic_avatar13'); + @LocalStorageProp('isPlay') isPlay: boolean = false; + @LocalStorageProp('formId') formId: string = '0'; + + + /* + * The action type. + */ + readonly ACTION_TYPE: string = 'router'; + + /* + * The ability name. + */ + readonly ABILITY_NAME: string = 'EntryAbility'; + + /* + * The with percentage setting. + */ + readonly FULL_WIDTH_PERCENT: string = '100%'; + + /* + * The height percentage setting. + */ + readonly FULL_HEIGHT_PERCENT: string = '100%'; + + build() { + Column() { + // Image(this.label).objectFit(ImageFit.Fill) + Text(this.title) + .width(this.FULL_WIDTH_PERCENT) + .layoutWeight(1) + .fontColor(Color.White) + .textAlign(TextAlign.Center) + .onClick(() => { + postCardAction(this, { + "action": this.ACTION_TYPE, + "abilityName": this.ABILITY_NAME, + "params": { + "targetPage": 'musicList' + } + }); + }) + + Row(){ + Image($r('app.media.ic_previous')) + .height($r('app.float.control_icon_height')) + .width($r('app.float.control_icon_width')) + .onClick(() => { + // MediaService.getInstance().playPrevious() + postCardAction(this, { + 'action': 'call', + 'abilityName': this.ABILITY_NAME, // 只能跳转到当前应用下的UIAbility + 'params': { + 'method': 'funMusic', + 'formId': this.formId, + 'detail': 'previous' + } + }); + }) + Image(!this.isPlay ? $r('app.media.ic_play') : $r('app.media.ic_pause')) + .height($r('app.float.control_icon_height')) + .width($r('app.float.control_icon_width')) + .onClick(() => { + // if (MediaService.getInstance().getFirst()) { + // MediaService.getInstance().loadAssent(0) + // } else { + // this.isPlay ? MediaService.getInstance().pause() : MediaService.getInstance().play(); + // } + postCardAction(this, { + 'action': 'call', + 'abilityName': this.ABILITY_NAME, // 只能跳转到当前应用下的UIAbility + 'params': { + 'method': 'funMusic', + 'formId': this.formId, + 'detail': 'playAndPause', + 'isPlay': !this.isPlay + } + }); + }) + Image($r('app.media.ic_next')) + .height($r('app.float.control_icon_height')) + .width($r('app.float.control_icon_width')) + .onClick(() => { + // MediaService.getInstance().playNextAuto(true) + postCardAction(this, { + 'action': 'call', + 'abilityName': this.ABILITY_NAME, // 只能跳转到当前应用下的UIAbility + 'params': { + 'method': 'funMusic', + 'formId': this.formId, + 'detail': 'next' + } + }); + }) + } + .width(this.FULL_WIDTH_PERCENT) + .height(40) + .justifyContent(FlexAlign.SpaceEvenly) + } + .width(this.FULL_WIDTH_PERCENT) + .height(this.FULL_HEIGHT_PERCENT) + .backgroundImage(this.label) + + } +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/products/phone/src/main/module.json5 b/MultiDeviceMusic-army/products/phone/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..0c79fb35e4cc7785a1a43279382867ebf41e270f --- /dev/null +++ b/MultiDeviceMusic-army/products/phone/src/main/module.json5 @@ -0,0 +1,72 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "description": "$string:module_desc", + "mainElement": "EntryAbility", + "deviceTypes": [ + "default", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "requestPermissions": [ + { + "name": "ohos.permission.KEEP_BACKGROUND_RUNNING", + "reason": "$string:reason_background", + "usedScene": { + "abilities": [ + "EntryAbility" + ], + "when": "always" + } + }, + { + "name": "ohos.permission.INTERNET" + } + ], + "abilities": [ + { + "name": "EntryAbility", + "srcEntry": "./ets/entryability/EntryAbility.ts", + "description": "$string:EntryAbility_desc", + "icon": "$media:ic_music_icon", + "label": "$string:EntryAbility_label", + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:start_window_background", + "exported": true, + "minWindowHeight": 780, + "minWindowWidth": 360, + "backgroundModes": [ + "audioPlayback" + ], + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ], + "extensionAbilities": [ + { + "name": "PhoneFormAbility", + "srcEntry": "./ets/phoneformability/PhoneFormAbility.ts", + "label": "$string:PhoneFormAbility_label", + "description": "$string:PhoneFormAbility_desc", + "type": "form", + "metadata": [ + { + "name": "ohos.extension.form", + "resource": "$profile:form_config" + } + ] + } + ] + } +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/products/phone/src/main/resources/base/element/color.json b/MultiDeviceMusic-army/products/phone/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..e6847d2a2762239637470aeb6451d26d1ddd9704 --- /dev/null +++ b/MultiDeviceMusic-army/products/phone/src/main/resources/base/element/color.json @@ -0,0 +1,12 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + }, + { + "name": "button_background_color", + "value": "#FF1949" + } + ] +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/products/phone/src/main/resources/base/element/float.json b/MultiDeviceMusic-army/products/phone/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..815ac86f6d4add6f96963711a94d1e1f16bd0d87 --- /dev/null +++ b/MultiDeviceMusic-army/products/phone/src/main/resources/base/element/float.json @@ -0,0 +1,72 @@ +{ + "float": [ + { + "name": "title_font_size", + "value": "28fp" + }, + { + "name": "description_font_size", + "value": "18fp" + }, + { + "name": "description_margin_top", + "value": "8vp" + }, + { + "name": "button_font_size", + "value": "16fp" + }, + { + "name": "button_border_radius", + "value": "20vp" + }, + { + "name": "button_width", + "value": "120vp" + }, + { + "name": "button_height", + "value": "40vp" + }, + { + "name": "item_height", + "value": "200vp" + }, + { + "name": "item_border_radius", + "value": "24vp" + }, + { + "name": "item_padding", + "value": "24vp" + }, + { + "name": "column_padding_top", + "value": "64vp" + }, + { + "name": "column_padding_left", + "value": "12vp" + }, + { + "name": "column_padding_right", + "value": "12vp" + }, + { + "name": "font_size", + "value": "16fp" + }, + { + "name": "control_icon_width", + "value": "24vp" + }, + { + "name": "control_icon_height", + "value": "24vp" + }, + { + "name": "control_icon_margin", + "value": "16vp" + } + ] +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/products/phone/src/main/resources/base/element/string.json b/MultiDeviceMusic-army/products/phone/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..c394d9ac29a6582b7e6e60267b03d9ee09724b7d --- /dev/null +++ b/MultiDeviceMusic-army/products/phone/src/main/resources/base/element/string.json @@ -0,0 +1,52 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "multi device" + }, + { + "name": "music_title", + "value": "Folk Soul" + }, + { + "name": "music_description", + "value": "The song list selects some of the more concerned folk songs, a folk song soothes life." + }, + { + "name": "button_music", + "value": "Playing music" + }, + { + "name": "live_title", + "value": "Dandelion Live" + }, + { + "name": "live_description", + "value": "I've selected some of the live features that everyone likes." + }, + { + "name": "button_live", + "value": "Watch Live" + }, + { + "name": "reason_background", + "value": "keep background running" + }, + { + "name": "PhoneFormAbility_desc", + "value": "form_description" + }, + { + "name": "PhoneFormAbility_label", + "value": "form_label" + } + ] +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/products/phone/src/main/resources/base/media/ic_live.png b/MultiDeviceMusic-army/products/phone/src/main/resources/base/media/ic_live.png new file mode 100644 index 0000000000000000000000000000000000000000..cb6cd5f6799be28e5aa88903da99548b3ce3241f Binary files /dev/null and b/MultiDeviceMusic-army/products/phone/src/main/resources/base/media/ic_live.png differ diff --git a/MultiDeviceMusic-army/products/phone/src/main/resources/base/media/ic_music.png b/MultiDeviceMusic-army/products/phone/src/main/resources/base/media/ic_music.png new file mode 100644 index 0000000000000000000000000000000000000000..f7e21a4aaaf31b122a04fb9e305080cb95430f6f Binary files /dev/null and b/MultiDeviceMusic-army/products/phone/src/main/resources/base/media/ic_music.png differ diff --git a/MultiDeviceMusic-army/products/phone/src/main/resources/base/media/ic_music_icon.png b/MultiDeviceMusic-army/products/phone/src/main/resources/base/media/ic_music_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..b93d55ae76aa1e595ce9295a2b6a9b2645b7d56c Binary files /dev/null and b/MultiDeviceMusic-army/products/phone/src/main/resources/base/media/ic_music_icon.png differ diff --git a/MultiDeviceMusic-army/products/phone/src/main/resources/base/media/ic_next.svg b/MultiDeviceMusic-army/products/phone/src/main/resources/base/media/ic_next.svg new file mode 100644 index 0000000000000000000000000000000000000000..63f5683d5ebc0c868d900f905b3db08bd25d76ad --- /dev/null +++ b/MultiDeviceMusic-army/products/phone/src/main/resources/base/media/ic_next.svg @@ -0,0 +1,15 @@ + + + ic_next + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiDeviceMusic-army/products/phone/src/main/resources/base/media/ic_pause.svg b/MultiDeviceMusic-army/products/phone/src/main/resources/base/media/ic_pause.svg new file mode 100644 index 0000000000000000000000000000000000000000..fe7e3c89a6676a664acf4055a4ac7187861de8b2 --- /dev/null +++ b/MultiDeviceMusic-army/products/phone/src/main/resources/base/media/ic_pause.svg @@ -0,0 +1,15 @@ + + + icon_pause + + + + + + + + + + + + \ No newline at end of file diff --git a/MultiDeviceMusic-army/products/phone/src/main/resources/base/media/ic_play.svg b/MultiDeviceMusic-army/products/phone/src/main/resources/base/media/ic_play.svg new file mode 100644 index 0000000000000000000000000000000000000000..9442848313f405688080774b77a6138680217567 --- /dev/null +++ b/MultiDeviceMusic-army/products/phone/src/main/resources/base/media/ic_play.svg @@ -0,0 +1,7 @@ + + + ic_play_all + + + + \ No newline at end of file diff --git a/MultiDeviceMusic-army/products/phone/src/main/resources/base/media/ic_previous.svg b/MultiDeviceMusic-army/products/phone/src/main/resources/base/media/ic_previous.svg new file mode 100644 index 0000000000000000000000000000000000000000..697ec959c31976712a8b5c2de37f55ed0d085ace --- /dev/null +++ b/MultiDeviceMusic-army/products/phone/src/main/resources/base/media/ic_previous.svg @@ -0,0 +1,9 @@ + + + icon_last + + + + + + \ No newline at end of file diff --git a/MultiDeviceMusic-army/products/phone/src/main/resources/base/media/icon.png b/MultiDeviceMusic-army/products/phone/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/MultiDeviceMusic-army/products/phone/src/main/resources/base/media/icon.png differ diff --git a/MultiDeviceMusic-army/products/phone/src/main/resources/base/profile/form_config.json b/MultiDeviceMusic-army/products/phone/src/main/resources/base/profile/form_config.json new file mode 100644 index 0000000000000000000000000000000000000000..05c99d1ac0a51e6b8700920fd5699747b980bce3 --- /dev/null +++ b/MultiDeviceMusic-army/products/phone/src/main/resources/base/profile/form_config.json @@ -0,0 +1,23 @@ +{ + "forms": [ + { + "name": "widget", + "description": "This is a service widget.", + "src": "./ets/widget/pages/WidgetCard.ets", + "uiSyntax": "arkts", + "window": { + "designWidth": 720, + "autoDesignWidth": true + }, + "colorMode": "auto", + "isDefault": true, + "updateEnabled": false, + "scheduledUpdateTime": "10:30", + "updateDuration": 1, + "defaultDimension": "2*2", + "supportDimensions": [ + "2*2" + ] + } + ] +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/products/phone/src/main/resources/base/profile/main_pages.json b/MultiDeviceMusic-army/products/phone/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce --- /dev/null +++ b/MultiDeviceMusic-army/products/phone/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/Index" + ] +} diff --git a/MultiDeviceMusic-army/products/phone/src/main/resources/en_US/element/string.json b/MultiDeviceMusic-army/products/phone/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..c394d9ac29a6582b7e6e60267b03d9ee09724b7d --- /dev/null +++ b/MultiDeviceMusic-army/products/phone/src/main/resources/en_US/element/string.json @@ -0,0 +1,52 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "multi device" + }, + { + "name": "music_title", + "value": "Folk Soul" + }, + { + "name": "music_description", + "value": "The song list selects some of the more concerned folk songs, a folk song soothes life." + }, + { + "name": "button_music", + "value": "Playing music" + }, + { + "name": "live_title", + "value": "Dandelion Live" + }, + { + "name": "live_description", + "value": "I've selected some of the live features that everyone likes." + }, + { + "name": "button_live", + "value": "Watch Live" + }, + { + "name": "reason_background", + "value": "keep background running" + }, + { + "name": "PhoneFormAbility_desc", + "value": "form_description" + }, + { + "name": "PhoneFormAbility_label", + "value": "form_label" + } + ] +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/products/phone/src/main/resources/zh_CN/element/string.json b/MultiDeviceMusic-army/products/phone/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..df60b02128c7cbbfce417b0a8b53978d14d9cc0d --- /dev/null +++ b/MultiDeviceMusic-army/products/phone/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,52 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "模块描述" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "multi device" + }, + { + "name": "music_title", + "value": "民谣魂" + }, + { + "name": "music_description", + "value": "歌单选取了一些比较受关注的民谣歌曲,一曲民谣抚慰生活。" + }, + { + "name": "button_music", + "value": "播放音乐" + }, + { + "name": "live_title", + "value": "蒲公英直播" + }, + { + "name": "live_description", + "value": "选取了一些大家喜欢的直播专题。" + }, + { + "name": "button_live", + "value": "观看直播" + }, + { + "name": "reason_background", + "value": "保持在后台运行" + }, + { + "name": "PhoneFormAbility_desc", + "value": "form_description" + }, + { + "name": "PhoneFormAbility_label", + "value": "form_label" + } + ] +} \ No newline at end of file diff --git a/MultiDeviceMusic-army/screenshots/device/AlbumLG.png b/MultiDeviceMusic-army/screenshots/device/AlbumLG.png new file mode 100644 index 0000000000000000000000000000000000000000..eacb39afeb12331400533e72b4dc350efa8dfdcc Binary files /dev/null and b/MultiDeviceMusic-army/screenshots/device/AlbumLG.png differ diff --git a/MultiDeviceMusic-army/screenshots/device/AlbumMD.png b/MultiDeviceMusic-army/screenshots/device/AlbumMD.png new file mode 100644 index 0000000000000000000000000000000000000000..be9665467b7dca017b024f43e006d005b790ede6 Binary files /dev/null and b/MultiDeviceMusic-army/screenshots/device/AlbumMD.png differ diff --git a/MultiDeviceMusic-army/screenshots/device/AlbumSM.png b/MultiDeviceMusic-army/screenshots/device/AlbumSM.png new file mode 100644 index 0000000000000000000000000000000000000000..964e17225b5b5ed0b539788b416d6a34ed5163ff Binary files /dev/null and b/MultiDeviceMusic-army/screenshots/device/AlbumSM.png differ diff --git a/MultiDeviceMusic-army/screenshots/device/homePage.png b/MultiDeviceMusic-army/screenshots/device/homePage.png new file mode 100644 index 0000000000000000000000000000000000000000..6d831a6ed374eb874028c24e1b674cfd8e2c5b7a Binary files /dev/null and b/MultiDeviceMusic-army/screenshots/device/homePage.png differ diff --git a/MultiDeviceMusic-army/screenshots/device/music.gif b/MultiDeviceMusic-army/screenshots/device/music.gif new file mode 100644 index 0000000000000000000000000000000000000000..030aa9486300b0c6af1b88b74dbc3bccd774aea9 Binary files /dev/null and b/MultiDeviceMusic-army/screenshots/device/music.gif differ diff --git a/MultiDeviceMusic-army/screenshots/device/music.mp4 b/MultiDeviceMusic-army/screenshots/device/music.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..dbcb1899e3b58b4cedffe22f887fb7bb5b19c23b Binary files /dev/null and b/MultiDeviceMusic-army/screenshots/device/music.mp4 differ diff --git a/alarm-clock-army/AppScope/app.json5 b/alarm-clock-army/AppScope/app.json5 new file mode 100644 index 0000000000000000000000000000000000000000..00ff99ff66e6427ede10ea6cc010542e86e18871 --- /dev/null +++ b/alarm-clock-army/AppScope/app.json5 @@ -0,0 +1,10 @@ +{ + "app": { + "bundleName": "com.huawei.alarmclock", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name" + } +} diff --git a/alarm-clock-army/AppScope/resources/base/element/string.json b/alarm-clock-army/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..34aa6b73219808e5dd820bd4a329b58b848e538c --- /dev/null +++ b/alarm-clock-army/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "闹钟" + } + ] +} diff --git a/alarm-clock-army/AppScope/resources/base/media/app_icon.png b/alarm-clock-army/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/alarm-clock-army/AppScope/resources/base/media/app_icon.png differ diff --git a/alarm-clock-army/LICENSE b/alarm-clock-army/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..0210352ae2ade0dd7b4c841cb6e8ba08b4780038 --- /dev/null +++ b/alarm-clock-army/LICENSE @@ -0,0 +1,78 @@ + Copyright (c) 2023 Huawei Device Co., Ltd. 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. + +Apache License, Version 2.0 +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. + +"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. + +2. Grant of Copyright License. + +Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. + +Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. + +You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: +1.You must give any other recipients of the Work or Derivative Works a copy of this License; and +2.You must cause any modified files to carry prominent notices stating that You changed the files; and +3.You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and +4.If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. + +You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. + +5. Submission of Contributions. + +Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. + +6. Trademarks. + +This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. + +Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. + +In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. + +While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/alarm-clock-army/README.md b/alarm-clock-army/README.md new file mode 100644 index 0000000000000000000000000000000000000000..dc0c72e3219c2d57dca076a42688bfe344044a05 --- /dev/null +++ b/alarm-clock-army/README.md @@ -0,0 +1,57 @@ +# 闹钟(ArkTS) + +## 简介 + +基于ArkTS的声明式开发范式及HarmonyOS的后台代理提醒能力,实现简单的闹钟提醒功能。 + +最终效果图如图所示: + +![](screenshots/device/AlarmClock.gif) + +## 相关概念 + +- [Canvas](https://developer.harmonyos.com/cn/docs/documentation/doc-guides-V3/arkts-drawing-customization-on-canvas-0000001453684976-V3?catalogVersion=V3): 提供画布组件,用于自定义绘制图形。 + +- [CanvasRenderingContext2D](https://developer.harmonyos.com/cn/docs/documentation/doc-references-V3/ts-canvasrenderingcontext2d-0000001478181441-V3?catalogVersion=V3): 使用RenderingContext在Canvas组件上进行绘制,绘制对象可以是矩形、文本、图片等。 + +- [后台代理提醒](https://developer.harmonyos.com/cn/docs/documentation/doc-guides-V3/reminder-agent-development-0000001493903928-V3?catalogVersion=V3): 开发应用时,开发者可以调用后台提醒发布的接口创建定时提醒,包括倒计时、日历、闹钟三种提醒类型。使用后台代理提醒能力后,应用可以被冻结或退出,计时和弹出提醒的功能将被后台系统服务代理。本应用中主要使用到后台代理提醒的两个接口: + + - **publishReminder** + + 发布一个后台代理提醒,使用callback方式实现异步调用,该方法需要申请通知弹窗Notification.requestEnableNotification后才能调用。 + + - **cancelReminder** + + 取消指定id的提醒,使用callback方式实现异步调用。 + +## 相关权限 + +本篇Codelab需要在module.json5中配置如下权限: + +``` +"requestPermissions": [ + { + "name": "ohos.permission.PUBLISH_AGENT_REMINDER", + "reason": "$string:reason", + "usedScene": { + "abilities": [ + "EntryAbility" + ], + "when": "inuse" + } + } +] +``` + +## 使用说明 +1. 打开应用,添加一个闹钟,闹钟到设定的时间后弹出提醒。 +2. 修改闹钟的时间,闹钟到设定的时间后弹出提醒。 +3. 删除闹钟。 +4. 展示闹钟列表,并可打开和关闭单个闹钟。 + +## 约束与限制 + +1. 本示例仅支持标准系统上运行,支持设备:华为手机或运行在DevEco Studio上的华为手机设备模拟器。 +2. 本示例为Stage模型,支持API version 9及以上版本SDK。 +3. 本示例需要使用DevEco Studio 3.1 Release及以上版本进行编译运行。 + diff --git a/alarm-clock-army/build-profile.json5 b/alarm-clock-army/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..76daa465d301cb663d29bdcfbaba5e10f3cb0a9c --- /dev/null +++ b/alarm-clock-army/build-profile.json5 @@ -0,0 +1,41 @@ +{ + "app": { + "compileSdkVersion": 9, + "compatibleSdkVersion": 9, + "products": [ + { + "name": "default", + "signingConfig": "default" + } + ], + "signingConfigs": [ + { + "name": "default", + "type": "HarmonyOS", + "material": { + "certpath": "C:\\Users\\armyq\\.ohos\\config\\auto_debug_AlarmClock_com.huawei.alarmclock_260086000308369315.cer", + "storePassword": "0000001B210A8BB06932B382135ABF209E25B75A34B33BD1FFF265E0FA2DE6C0D2D4F508E05E0F9AE2AA6D", + "keyAlias": "debugKey", + "keyPassword": "0000001BD93B76AB54FDF9D973B3892CF3A068BFB334FE8BFD9619648BB8B4AE7E1C8D7F06BE101E2B5E4C", + "profile": "C:\\Users\\armyq\\.ohos\\config\\auto_debug_AlarmClock_com.huawei.alarmclock_260086000308369315.p7b", + "signAlg": "SHA256withECDSA", + "storeFile": "C:\\Users\\armyq\\.ohos\\config\\auto_debug_AlarmClock_com.huawei.alarmclock_260086000308369315.p12" + } + } + ] + }, + "modules": [ + { + "name": "entry", + "srcPath": "./entry", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/alarm-clock-army/entry/build-profile.json5 b/alarm-clock-army/entry/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..9f84f20bc1d2dde64b31e75a0e4e81c02d452400 --- /dev/null +++ b/alarm-clock-army/entry/build-profile.json5 @@ -0,0 +1,11 @@ +{ + "apiType": 'stageMode', + "buildOption": { + }, + "targets": [ + { + "name": "default", + "runtimeOS": "HarmonyOS" + } + ] +} \ No newline at end of file diff --git a/alarm-clock-army/entry/hvigorfile.ts b/alarm-clock-army/entry/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..80e4ec5b81689f238c34614b167a0b9e9c83e8d9 --- /dev/null +++ b/alarm-clock-army/entry/hvigorfile.ts @@ -0,0 +1,2 @@ +// 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/alarm-clock-army/entry/oh-package.json5 b/alarm-clock-army/entry/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..a7afd4ec1017198e9d8017e9f28e8e1d786a9e39 --- /dev/null +++ b/alarm-clock-army/entry/oh-package.json5 @@ -0,0 +1,9 @@ +{ + "license": "ISC", + "devDependencies": {}, + "name": "entry", + "description": "example description", + "repository": {}, + "version": "1.0.0", + "dependencies": {} +} diff --git a/alarm-clock-army/entry/src/main/ets/common/bean/AlarmItemBean.ets b/alarm-clock-army/entry/src/main/ets/common/bean/AlarmItemBean.ets new file mode 100644 index 0000000000000000000000000000000000000000..a071be657a15166b4f76cf5fd9931e55dcf1d4c5 --- /dev/null +++ b/alarm-clock-army/entry/src/main/ets/common/bean/AlarmItemBean.ets @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2022 Huawei Device 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 ReminderItem from './ReminderItemBean'; + +/** + * Alarm item description. + */ +@Observed export default class AlarmItemBean extends ReminderItem { + /** + * Custom alarm name. + */ + name = '闹钟'; + + /** + * Custom alarm is open. + */ + isOpen: boolean = true; + + /** + * Custom alarm is repeat. + */ + isRepeat: boolean = false; + + /** + * Custom alarm duration. + */ + duration: number = 5; + + /** + * Custom alarm interval minute. + */ + intervalMinute: number = 10; + + /** + * Custom alarm interval times. + */ + intervalTimes: number = 3; + + /** + * Custom alarm notification id. + */ + notificationId: number; +} \ No newline at end of file diff --git a/alarm-clock-army/entry/src/main/ets/common/bean/AlarmSettingBean.ets b/alarm-clock-army/entry/src/main/ets/common/bean/AlarmSettingBean.ets new file mode 100644 index 0000000000000000000000000000000000000000..fbc5e480314000b387c07e4b183a2ab7c7a9e94a --- /dev/null +++ b/alarm-clock-army/entry/src/main/ets/common/bean/AlarmSettingBean.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2022 Huawei Device 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 { AlarmSettingType } from '../constants/AlarmSettingType'; + +/** + * Alarm setting bean information. + */ +export default class AlarmSettingBean { + /** + * Alarm setting title. + */ + public title: string; + + /** + * Alarm setting content. + */ + public content: string; + + /** + * Alarm setting type. + */ + public sType: AlarmSettingType; + + constructor(title, content, sType) { + this.title = title; + this.content = content; + this.sType = sType; + } +} \ No newline at end of file diff --git a/alarm-clock-army/entry/src/main/ets/common/bean/ReminderItemBean.ets b/alarm-clock-army/entry/src/main/ets/common/bean/ReminderItemBean.ets new file mode 100644 index 0000000000000000000000000000000000000000..c77d2fc30cfcd8bc0f21c43423659cbc6a0f67ef --- /dev/null +++ b/alarm-clock-army/entry/src/main/ets/common/bean/ReminderItemBean.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2022 Huawei Device 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 reminderAgent from '@ohos.reminderAgentManager'; + +export default class ReminderItemBean { + id: number; + remindType: reminderAgent.ReminderType = reminderAgent.ReminderType.REMINDER_TYPE_ALARM; + name: string; + hour: number; + minute: number; + duration: number; + intervalMinute: number; + intervalTimes: number; + repeatDays: Array = []; + notificationId: number; +} + diff --git a/alarm-clock-army/entry/src/main/ets/common/constants/AlarmSettingType.ets b/alarm-clock-army/entry/src/main/ets/common/constants/AlarmSettingType.ets new file mode 100644 index 0000000000000000000000000000000000000000..9fb1bab182077ae8353df2928364d3ae62a18855 --- /dev/null +++ b/alarm-clock-army/entry/src/main/ets/common/constants/AlarmSettingType.ets @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2022 Huawei Device 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. + */ + +//export { AlarmSettingBean }; + +/** + * Alarm setting type enum description. + */ +export enum AlarmSettingType { + /** + * Alarm setting type repeat. + */ + REPEAT, + + /** + * Alarm setting type name. + */ + ALARM_NAME, + + /** + * Alarm setting type ring duration. + */ + RING_DURATION, + + /** + * Alarm setting type interval. + */ + INTERVAL +} \ No newline at end of file diff --git a/alarm-clock-army/entry/src/main/ets/common/constants/CommonConstants.ets b/alarm-clock-army/entry/src/main/ets/common/constants/CommonConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..15ac20646a2f30252c41cff0a8da531b7c574795 --- /dev/null +++ b/alarm-clock-army/entry/src/main/ets/common/constants/CommonConstants.ets @@ -0,0 +1,186 @@ +/* + * Copyright (c) 2022 Huawei Device 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. + */ + +/** + * database preference id. + */ +export const PREFERENCE_ID = 'storageId'; + +/** + * database alarm data key. + */ +export const ALARM_KEY = 'alarmData'; + +/** + * database alarm item key. + */ +export const PARAM_KEY = 'alarmItem'; + +export const CommonConstants = { + /** + * common full length + */ + FULL_LENGTH: '100%', + + /** + * default string space. + */ + DEFAULT_STRING_SPACE: ' ', + + /** + * default string comma. + */ + DEFAULT_STRING_COMMA: ',', + + /** + * default string no repeat. + */ + DEFAULT_STRING_NO_REPEAT: '不重复', + + /** + * default number negative. + */ + DEFAULT_NUMBER_NEGATIVE: -1, + + /** + * default layout weight. + */ + DEFAULT_LAYOUT_WEIGHT: 1, + + /** + * default number monday. + */ + DEFAULT_NUMBER_MONDAY: 1, + + /** + * default number tuesday. + */ + DEFAULT_NUMBER_TUESDAY: 2, + + /** + * default number wednesday. + */ + DEFAULT_NUMBER_WEDNESDAY: 3, + + /** + * default number thursday. + */ + DEFAULT_NUMBER_THURSDAY: 4, + + /** + * default number friday. + */ + DEFAULT_NUMBER_FRIDAY: 5, + + /** + * default number saturday. + */ + DEFAULT_NUMBER_SATURDAY: 6, + + /** + * default number sunday. + */ + DEFAULT_NUMBER_SUNDAY: 7, + + /** + * default single. + */ + DEFAULT_SINGLE: 1, + + /** + * default double. + */ + DEFAULT_DOUBLE: 2, + + /** + * default data picker hour selection. + */ + DEFAULT_DATA_PICKER_HOUR_SELECTION: 2, + + /** + * default total minute. + */ + DEFAULT_TOTAL_MINUTE: 60, + + /** + * default string monday. + */ + DEFAULT_STRING_MONDAY: '周一', + + /** + * default string tuesday. + */ + DEFAULT_STRING_TUESDAY: '周二', + + /** + * default string wednesday. + */ + DEFAULT_STRING_WEDNESDAY: '周三', + + /** + * default string thursday. + */ + DEFAULT_STRING_THURSDAY: '周四', + + /** + * default string friday. + */ + DEFAULT_STRING_FRIDAY: '周五', + + /** + * default string saturday. + */ + DEFAULT_STRING_SATURDAY: '周六', + + /** + * default string sunday. + */ + DEFAULT_STRING_SUNDAY: '周日', + + /** + * default number moment. + */ + DEFAULT_NUMBER_MOMENT: 3, + + /** + * default interval step. + */ + DEFAULT_INTERVAL_STEP: 5, + + /** + * default common degree + */ + DEFAULT_COMMON_DEGREE: 6, + + /** + * default pointer width. + */ + DEFAULT_POINTER_WIDTH: 10, + + /** + * default total hour. + */ + DEFAULT_TOTAL_HOUR: 12, + + /** + * default interval time max. + */ + DEFAULT_INTERVAL_TIME_MAX: 10, + + /** + * default interval minute max. + */ + DEFAULT_INTERVAL_MINUTE_MAX: 30, +} \ No newline at end of file diff --git a/alarm-clock-army/entry/src/main/ets/common/constants/DetailConstant.ets b/alarm-clock-army/entry/src/main/ets/common/constants/DetailConstant.ets new file mode 100644 index 0000000000000000000000000000000000000000..7d8e114439644e6b241258d56d0f140d7954e757 --- /dev/null +++ b/alarm-clock-army/entry/src/main/ets/common/constants/DetailConstant.ets @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2022 Huawei Device 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. + */ + +/** + * Detail page constant description. + */ +export const DetailConstant = { + /** + * detail page day data. + */ + DAY_DATA: [ + { timeType: 0, delSelect: 0, data: ['上午', '下午'] }, + { timeType: 1, delSelect: 0, data: ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'] }, + { timeType: 2, delSelect: 0, data: ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', + '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', + '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', + '37', '38', '39', '40', '41', '42', '43', '44', '45', '46', '47', '48', + '49', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '00', + ] } + ], + + /** + * week day data. + */ + WEEKDAY_DATA: [1, 2, 3, 4, 5, 6, 7], + + /** + * ring duration list data. + */ + RING_DURATION: [1, 5, 10, 15, 20, 30], + + /** + * default string minute. + */ + DEFAULT_STRING_MINUTE: '分钟', + + /** + * default string group name. + */ + DEFAULT_STRING_GROUP_NAME: 'radioGroup', + + /** + * default string provider key. + */ + DEFAULT_PROVIDER_KEY: 'alarmItemProvide', + + /** + * default string repeat. + */ + DEFAULT_STRING_REPEAT: '重复', + + /** + * default string alarm name. + */ + DEFAULT_STRING_ALARM_NAME: '闹钟名', + + /** + * default string interval. + */ + DEFAULT_STRING_INTERVAL: '再响间隔', + + /** + * default string duration. + */ + DEFAULT_STRING_DURATION: '闹铃时长', + + /** + * default string times. + */ + DEFAULT_STRING_TIMES: '次', +} \ No newline at end of file diff --git a/alarm-clock-army/entry/src/main/ets/common/constants/MainConstant.ets b/alarm-clock-army/entry/src/main/ets/common/constants/MainConstant.ets new file mode 100644 index 0000000000000000000000000000000000000000..20aaeaa749bf916d71d081f226c4358d5052e476 --- /dev/null +++ b/alarm-clock-army/entry/src/main/ets/common/constants/MainConstant.ets @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2022 Huawei Device 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. + */ + +/** + * Main page constant description. + */ +export const MainConstant = { + /** + * Main page times list. + */ + TIMES: [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2], + + /** + * Default single digit max. + */ + DEFAULT_SINGLE_DIGIT_MAX: 9, + + /** + * Default horizontal angle. + */ + DEFAULT_HORIZONTAL_ANGLE: 180, + + /** + * Default one second ms. + */ + DEFAULT_ONE_SECOND_MS: 1000, + + /** + * Default zeroing. + */ + DEFAULT_ZEROING: "0", + + /** + * Default string morning. + */ + DEFAULT_STRING_MORNING: '上午', + + /** + * Default string afternoon. + */ + DEFAULT_STRING_AFTERNOON: '下午', + + /** + * Default string alarm name. + */ + DEFAULT_STRING_ALARM: '闹钟', + + /** + * Default string quotation. + */ + DEFAULT_STRING_NULL: "", + + /** + * Default string colon. + */ + DEFAULT_STRING_COLON: ':', + + /** + * Default clock time font size unit. + */ + CLOCK_TIME_FONT_SIZE_UNIT: 'px', + + /** + * Hour pointer image url. + */ + HOUR_POINTER_IMAGE_URL: "../../../resources/base/media/ic_hour_pointer.png", + + /** + * Minute pointer image url. + */ + MINUTE_POINTER_IMAGE_URL: "../../../resources/base/media/ic_minute_pointer.png", + + /** + * Second pointer image url. + */ + SECOND_POINTER_IMAGE_URL: "../../../resources/base/media/ic_second_pointer.png", + + /** + * Clock pan image url. + */ + CLOCK_PAN_IMAGE_URL: '../../../resources/base/media/ic_clock_pan.png', +} \ No newline at end of file diff --git a/alarm-clock-army/entry/src/main/ets/common/utils/DataTypeUtils.ets b/alarm-clock-army/entry/src/main/ets/common/utils/DataTypeUtils.ets new file mode 100644 index 0000000000000000000000000000000000000000..90f063727525fcea471edce6da9e751db4ef3a56 --- /dev/null +++ b/alarm-clock-army/entry/src/main/ets/common/utils/DataTypeUtils.ets @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2022 Huawei Device 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. + */ + +/** + * Data type utils. + */ +export default class DataTypeUtils { + /** + * return value is number. + * + * @return boolean. + */ + static isNumber(value): boolean{ + return typeof value === 'number' && isFinite(value); + } + + /** + * return obj is null. + * + * @return boolean. + */ + static isNull(obj): boolean { + return (typeof obj === 'undefined' || obj == null || obj === ''); + } + + /** + * return new deep copy object from obj. + * + * @return type in obj. + */ + static deepCopy(obj) { + var newObj = obj.constructor === Array ? [] : {}; + if (typeof obj !== 'object') { + return obj; + } else { + for (var i in obj) { + if (typeof obj[i] === 'object') { + newObj[i] = this.deepCopy(obj[i]); + } else { + newObj[i] = obj[i]; + } + } + } + return newObj; + } +} \ No newline at end of file diff --git a/alarm-clock-army/entry/src/main/ets/common/utils/DimensionUtil.ets b/alarm-clock-army/entry/src/main/ets/common/utils/DimensionUtil.ets new file mode 100644 index 0000000000000000000000000000000000000000..82edab1d0d73cdb8c22a13ee331481510f0972fe --- /dev/null +++ b/alarm-clock-army/entry/src/main/ets/common/utils/DimensionUtil.ets @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2022 Huawei Device 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. + */ + +var context = getContext(this); + +/** + * Design drawing width. + */ +const DESIGN_WIDTH = 360; + +/** + * Design drawing height. + */ +const DESIGN_HEIGHT = 780; + +/** + * Fits tools with different sizes and lengths. + */ +export default class DimensionUtil { + /** + * Obtains the screen horizontal adaptation value. + * + * @return number + */ + static adaptDimension(value: number): number { + let deviceDisplay = globalThis.display; + let widthScale = deviceDisplay.width / DESIGN_WIDTH; + let virtualHeight = widthScale * DESIGN_HEIGHT; + let designDim = Math.sqrt(DESIGN_WIDTH * DESIGN_WIDTH + DESIGN_HEIGHT * DESIGN_HEIGHT); + let virtualDim = Math.sqrt(deviceDisplay.width * deviceDisplay.width + virtualHeight * virtualHeight); + return virtualDim * value / designDim; // 放缩后长度 + } + + /** + * Obtains the screen horizontal adaptation px. + * + * @return number + */ + static getPx(value: Resource): number { + let beforeVp = context.resourceManager.getNumber(value.id); + return this.adaptDimension(beforeVp); + } + + /** + * Obtains the screen horizontal adaptation vp. + * + * @return number + */ + static getVp(value: Resource): number { + let beforeVp = context.resourceManager.getNumber(value.id); + return px2vp(this.adaptDimension(beforeVp)); + } + + /** + * Obtains the screen horizontal adaptation fp. + * + * @return number + */ + static getFp(value: Resource): number { + let beforeFp = context.resourceManager.getNumber(value.id); + return px2fp(this.adaptDimension(beforeFp)); + } +} \ No newline at end of file diff --git a/alarm-clock-army/entry/src/main/ets/entryability/EntryAbility.ets b/alarm-clock-army/entry/src/main/ets/entryability/EntryAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..238b0819020eab0db5db6a70eebc10f5b76a2010 --- /dev/null +++ b/alarm-clock-army/entry/src/main/ets/entryability/EntryAbility.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2022 Huawei Device 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 display from '@ohos.display'; +import UIAbility from '@ohos.app.ability.UIAbility'; +import PreferencesHandler from '../model/database/PreferencesHandler'; + +export default class EntryAbility extends UIAbility { + onCreate(want) { + let abilityInfo = this.context.abilityInfo; + globalThis.bundleName = abilityInfo.bundleName; + globalThis.abilityName = abilityInfo.name; + globalThis.abilityWant = want; + globalThis.preference = PreferencesHandler.getInstance(); + } + + async onWindowStageCreate(windowStage) { + globalThis.display = await display.getDefaultDisplay(); + await globalThis.preference.configure(this.context.getApplicationContext()); + windowStage.setUIContent(this.context, "pages/MainIndex", null); + } +} \ No newline at end of file diff --git a/alarm-clock-army/entry/src/main/ets/model/ReminderService.ets b/alarm-clock-army/entry/src/main/ets/model/ReminderService.ets new file mode 100644 index 0000000000000000000000000000000000000000..f4a0f5d5c7d95d0016598581e40390036c240a30 --- /dev/null +++ b/alarm-clock-army/entry/src/main/ets/model/ReminderService.ets @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2022 Huawei Device 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 reminderAgent from '@ohos.reminderAgentManager'; +import notification from '@ohos.notificationManager'; +import { CommonConstants } from '../common/constants/CommonConstants'; +import ReminderItem from '../common/bean/ReminderItemBean'; + +/** + * Base on ohos reminder agent service + */ +export default class ReminderService { + /** + * Adding and modifying alarm reminders + * + * @param alarmItem ReminderItem + * @param callback callback + */ + public addReminder(alarmItem: ReminderItem, callback?: (reminderId: number) => void) { + let reminder = this.initReminder(alarmItem); + reminderAgent.publishReminder(reminder, (err, reminderId) => { + if (callback != null) { + callback(reminderId); + } + }); + } + + /** + * Adding and modifying alarm reminders + * + * @param reminderId number + */ + public deleteReminder(reminderId: number) { + reminderAgent.cancelReminder(reminderId); + } + + private initReminder(item: ReminderItem): reminderAgent.ReminderRequestAlarm { + return { + reminderType: item.remindType, + hour: item.hour, + minute: item.minute, + daysOfWeek: item.repeatDays, + title: item.name, + ringDuration: item.duration * CommonConstants.DEFAULT_TOTAL_MINUTE, + snoozeTimes: item.intervalTimes, + timeInterval: item.intervalMinute, + actionButton: [ + { + title: '关闭', + type: reminderAgent.ActionButtonType.ACTION_BUTTON_TYPE_CLOSE + }, + { + title: '稍后提醒', + type: reminderAgent.ActionButtonType.ACTION_BUTTON_TYPE_SNOOZE + }, + ], + wantAgent: { + pkgName: globalThis.bundleName, + abilityName: globalThis.abilityName + }, + notificationId: item.notificationId, + expiredContent: 'this reminder has expired', + snoozeContent: 'remind later', + slotType: notification.SlotType.SOCIAL_COMMUNICATION + } + } +} \ No newline at end of file diff --git a/alarm-clock-army/entry/src/main/ets/model/database/PreferencesHandler.ets b/alarm-clock-army/entry/src/main/ets/model/database/PreferencesHandler.ets new file mode 100644 index 0000000000000000000000000000000000000000..7c84d33a7d29a43e46aad1d9f62d11d59a9eaa95 --- /dev/null +++ b/alarm-clock-army/entry/src/main/ets/model/database/PreferencesHandler.ets @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2022 Huawei Device 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 data_preferences from '@ohos.data.preferences'; +import { PREFERENCE_ID } from '../../common/constants/CommonConstants'; +import PreferencesListener from './PreferencesListener'; + +/** + * Based on lightweight databases preferences handler. + */ +export default class PreferencesHandler { + private static instance: PreferencesHandler; + private preferences; + private defaultValue = ''; + private listeners: PreferencesListener[]; + + private constructor() { + this.listeners = new Array(); + } + + /** + * Get PreferencesHandler instance. + * + * @return instance + */ + public static getInstance() { + if (this.instance == null) { + this.instance = new PreferencesHandler(); + } + return this.instance; + } + + /** + * Configure PreferencesHandler. + * + * @param context Context + */ + public async configure(context) { + this.preferences = await data_preferences.getPreferences(context, PREFERENCE_ID); + this.preferences.on('change', (key) => { + for (let preferencesListener of this.listeners) { + preferencesListener.onDataChanged(key); + } + }); + } + + /** + * Set data in PreferencesHandler. + * + * @param key string + * @param value any + */ + public async set(key: string, value) { + if (this.preferences != null) { + await this.preferences.put(key, value); + await this.preferences.flush(); + } + } + + /** + * Get data in PreferencesHandler. + * + * @param key string + * @param defValue any + * @return data about key + */ + public async get(key: string, defValue?) { + let data; + if (this.preferences != null) { + data = await this.preferences.get(key, defValue == null ? this.defaultValue : defValue); + } + return data; + } + + /** + * Clear data in PreferencesHandler. + */ + public clear() { + if (this.preferences != null) { + this.preferences.clear(); + } + } + + /** + * Get all data in PreferencesHandler. + * + * @return data + */ + public async getAll() { + let data; + if (this.preferences != null) { + data = await this.preferences.getAll(); + } + return data; + } + + /** + * Add preferences listener in PreferencesHandler. + * + * @param listener PreferencesListener + */ + public addPreferencesListener(listener: PreferencesListener) { + this.listeners.push(listener); + } +} \ No newline at end of file diff --git a/alarm-clock-army/entry/src/main/ets/model/database/PreferencesListener.ets b/alarm-clock-army/entry/src/main/ets/model/database/PreferencesListener.ets new file mode 100644 index 0000000000000000000000000000000000000000..d863486554de7fd15ef6c95f7f4248f7444dae77 --- /dev/null +++ b/alarm-clock-army/entry/src/main/ets/model/database/PreferencesListener.ets @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2022 Huawei Device 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. + */ + +/** + * Preferences listener interface. + */ +export default interface PreferencesListener { + /** + * Preferences on data changed listener. + * + * @param key string + */ + onDataChanged(key: string): void +} diff --git a/alarm-clock-army/entry/src/main/ets/pages/DetailIndex.ets b/alarm-clock-army/entry/src/main/ets/pages/DetailIndex.ets new file mode 100644 index 0000000000000000000000000000000000000000..a7c2b8aa556b7caf785dfb3bac969e05acc2fa5c --- /dev/null +++ b/alarm-clock-army/entry/src/main/ets/pages/DetailIndex.ets @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2022 Huawei Device 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 router from '@ohos.router'; +import { PARAM_KEY, CommonConstants } from '../common/constants/CommonConstants'; +import AlarmItem from '../common/bean/AlarmItemBean'; +import AlarmSettingBean from '../common/bean/AlarmSettingBean'; +import { AlarmSettingType } from '../common/constants/AlarmSettingType'; +import { DetailConstant } from '../common/constants/DetailConstant'; +import BackContainer from '../view/BackContainer'; +import DetailModel from '../viewmodel/DetailViewModel'; +import DatePickArea from '../view/detail/DatePickArea'; +import SettingItem from '../view/Detail/SettingItem'; +import DimensionUtil from '../common/utils/DimensionUtil'; + +@Entry +@Component +struct DetailIndex { + @Watch('onAlarmItemChange') @Provide(DetailConstant.DEFAULT_PROVIDER_KEY) alarmItem: AlarmItem = new AlarmItem(); + @State repeatSettingArr: Array = []; + @State alarmSettingInfoArr: Array = []; + private isNow: boolean = true; + private viewModel: DetailModel = DetailModel.getInstant(); + + aboutToAppear() { + if (router.getParams() != null && router.getParams().hasOwnProperty(PARAM_KEY)) { + this.isNow = false; + this.alarmItem = router.getParams()[PARAM_KEY]; + this.viewModel.setAlarmDefaultTime(this.alarmItem); + } else { + this.viewModel.setAlarmDefaultTime(); + } + this.initData(); + } + + onAlarmItemChange() { + this.initData(); + } + + initData() { + this.repeatSettingArr = [ + new AlarmSettingBean(DetailConstant.DEFAULT_STRING_REPEAT, + this.alarmItem.isRepeat ? DetailConstant.DEFAULT_STRING_REPEAT + : CommonConstants.DEFAULT_STRING_NO_REPEAT, AlarmSettingType.REPEAT) + ]; + this.alarmSettingInfoArr = [ + new AlarmSettingBean(DetailConstant.DEFAULT_STRING_ALARM_NAME, this.alarmItem.name, AlarmSettingType.ALARM_NAME), + new AlarmSettingBean(DetailConstant.DEFAULT_STRING_DURATION, + this.alarmItem.duration + DetailConstant.DEFAULT_STRING_MINUTE, AlarmSettingType.RING_DURATION), + new AlarmSettingBean(DetailConstant.DEFAULT_STRING_INTERVAL, this.alarmItem.intervalMinute + + DetailConstant.DEFAULT_STRING_MINUTE + CommonConstants.DEFAULT_STRING_COMMA + + this.alarmItem.intervalTimes + DetailConstant.DEFAULT_STRING_TIMES, AlarmSettingType.INTERVAL) + ] + } + + build() { + Column() { + BackContainer({ + header: this.isNow ? $r('app.string.new_alarm') : $r('app.string.update_alarm'), + backImgRes: $r('app.media.ic_cancel'), + }) { + Button() { + Image($r('app.media.ic_confirm')).objectFit(ImageFit.Fill) + } + .backgroundColor($r('app.color.trans_parent')) + .width(DimensionUtil.getVp($r('app.float.title_button_size'))) + .height(DimensionUtil.getVp($r('app.float.title_button_size'))) + .onClick(() => { + this.viewModel.setAlarmRemind(this.alarmItem); + router.back(); + }) + } + + DatePickArea() + + SettingItem({ + settingInfo: $repeatSettingArr + }) + SettingItem({ + settingInfo: $alarmSettingInfoArr + }) + + Blank() + + Button($r('app.string.delete')) + .visibility(this.isNow ? Visibility.None : Visibility.Visible) + .width(DimensionUtil.getVp($r('app.float.delete_button_width'))) + .height(DimensionUtil.getVp($r('app.float.delete_button_height'))) + .fontSize(DimensionUtil.getFp($r('app.float.delete_button_font_size'))) + .fontColor($r('app.color.red_light')) + .backgroundColor($r('app.color.grey_with_opacity')) + .borderRadius(DimensionUtil.getVp($r('app.float.delete_button_radius'))) + .margin({ + bottom: DimensionUtil.getVp($r('app.float.delete_button_margin_bottom')) + }) + .onClick(() => { + this.viewModel.removeAlarmRemind(this.alarmItem.id); + router.back(); + }) + } + .backgroundColor($r('app.color.grey_light')) + .width(CommonConstants.FULL_LENGTH) + .height(CommonConstants.FULL_LENGTH) + } +} \ No newline at end of file diff --git a/alarm-clock-army/entry/src/main/ets/pages/MainIndex.ets b/alarm-clock-army/entry/src/main/ets/pages/MainIndex.ets new file mode 100644 index 0000000000000000000000000000000000000000..005c59ed6923b91ff20f3c3171b3e74547707115 --- /dev/null +++ b/alarm-clock-army/entry/src/main/ets/pages/MainIndex.ets @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2022 Huawei Device 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 router from '@ohos.router'; +import { CommonConstants } from '../common/constants/CommonConstants'; +import AlarmItem from '../common/bean/AlarmItemBean'; +import { MainConstant } from '../common/constants/MainConstant'; +import MainModel from '../viewmodel/MainViewModel'; +import ClockArea from './../view/Main/ClockArea'; +import AlarmList from './../view/Main/AlarmList'; +import DimensionUtil from '../common/utils/DimensionUtil'; + +@Entry +@Component +struct MainIndex { + private mainModel: MainModel = MainModel.getInstant(); + @State alarmItems: Array = new Array(); + @State isAuth: boolean = false; + + aboutToAppear() { + let that = this; + that.mainModel.queryAlarmsTasker((alarms: Array) => { + that.alarmItems = alarms; + }) + } + + build() { + Column() { + Text(MainConstant.DEFAULT_STRING_ALARM) + .height(DimensionUtil.getVp($r('app.float.page_title_height'))) + .textAlign(TextAlign.Start) + .fontSize(DimensionUtil.getFp($r('app.float.title_font_size'))) + .width(CommonConstants.FULL_LENGTH) + .fontColor($r('app.color.grey_divider')) + .fontWeight(FontWeight.Bold) + .margin({ bottom: DimensionUtil.getVp($r('app.float.content_margin_body')) }) + .padding({ left: DimensionUtil.getVp($r('app.float.title_horizon_margin')) }) + + ClockArea() + + AlarmList({ alarmItems: $alarmItems }) + + Blank() + + Button() { + Image($r('app.media.ic_add')).objectFit(ImageFit.Fill) + } + .backgroundColor($r('app.color.trans_parent')) + .width(DimensionUtil.getVp($r('app.float.new_alarm_button_size'))) + .height(DimensionUtil.getVp($r('app.float.new_alarm_button_size'))) + .margin({ + bottom: DimensionUtil.getVp($r('app.float.new_alarm_button_margin_vertical')), + top: DimensionUtil.getVp($r('app.float.new_alarm_button_margin_vertical')) + }) + .onClick(() => { + router.pushUrl({ url: "pages/DetailIndex" }); + }) + } + .width(CommonConstants.FULL_LENGTH) + .height(CommonConstants.FULL_LENGTH) + .backgroundColor($r('app.color.grey_light')) + } +} \ No newline at end of file diff --git a/alarm-clock-army/entry/src/main/ets/view/BackContainer.ets b/alarm-clock-army/entry/src/main/ets/view/BackContainer.ets new file mode 100644 index 0000000000000000000000000000000000000000..9f5c92ae857fafa67efa3def2c4050d0949488d2 --- /dev/null +++ b/alarm-clock-army/entry/src/main/ets/view/BackContainer.ets @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2022 Huawei Device 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 router from '@ohos.router'; +import { CommonConstants } from '../common/constants/CommonConstants'; +import DimensionUtil from '../common/utils/DimensionUtil'; + +@Component +export default struct BackContainer { + private header: string | Resource; + private backImgRes: string | Resource; + private backFunc: () => void; + @BuilderParam closer: () => void; + + build() { + Row() { + Button() { + Image(this.backImgRes == null ? $r('app.media.ic_public_back') : this.backImgRes).objectFit(ImageFit.Fill) + } + .backgroundColor($r('app.color.trans_parent')) + .width(DimensionUtil.getVp($r('app.float.title_button_size'))) + .height(DimensionUtil.getVp($r('app.float.title_button_size'))) + .onClick(() => { + this.backFunc ? this.backFunc() : router.back(); + }) + + Text(this.header) + .fontSize(DimensionUtil.getFp($r('app.float.detail_title_font_size'))) + .lineHeight(DimensionUtil.getVp($r('app.float.title_line_height'))) + .margin({ left: DimensionUtil.getVp($r('app.float.title_margin')) }) + .fontColor($r('app.color.grey_divider')) + .fontWeight(FontWeight.Bold) + Blank() + if (this.closer) { + this.closer(); + } + } + .padding({ + left: DimensionUtil.getVp($r('app.float.title_horizon_margin')), + right: DimensionUtil.getVp($r('app.float.title_horizon_margin')) + }) + .height(DimensionUtil.getVp($r('app.float.page_title_height'))) + .width(CommonConstants.FULL_LENGTH) + } +} \ No newline at end of file diff --git a/alarm-clock-army/entry/src/main/ets/view/Detail/DatePickArea.ets b/alarm-clock-army/entry/src/main/ets/view/Detail/DatePickArea.ets new file mode 100644 index 0000000000000000000000000000000000000000..27e08ffb1f0b5be46ceb2195026acd5f4016a8af --- /dev/null +++ b/alarm-clock-army/entry/src/main/ets/view/Detail/DatePickArea.ets @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2022 Huawei Device 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 { DetailConstant } from '../../common/constants/DetailConstant'; +import { CommonConstants } from '../../common/constants/CommonConstants'; +import DimensionUtil from '../../common/utils/DimensionUtil'; + +@Component +export default struct DatePickArea { + build() { + Stack({ alignContent: Alignment.Center }) { + Row() { + ForEach(DetailConstant.DAY_DATA, (item) => { + TextPicker({ range: item.data, selected: item.delSelect }) + .layoutWeight(CommonConstants.DEFAULT_LAYOUT_WEIGHT) + .backgroundColor($r('app.color.grey_light')) + .onChange((value: string, index: number) => { + item.delSelect = index; + }) + }, item => JSON.stringify(item)) + } + } + .height(DimensionUtil.getVp($r('app.float.date_picker_height'))) + .padding({ + left: DimensionUtil.getVp($r('app.float.date_picker_padding_horizon')), + right: DimensionUtil.getVp($r('app.float.date_picker_padding_horizon')) + }) + } +} \ No newline at end of file diff --git a/alarm-clock-army/entry/src/main/ets/view/Detail/SettingItem.ets b/alarm-clock-army/entry/src/main/ets/view/Detail/SettingItem.ets new file mode 100644 index 0000000000000000000000000000000000000000..31e639ee040d6856c4451cb5dd4e6da7e3bff023 --- /dev/null +++ b/alarm-clock-army/entry/src/main/ets/view/Detail/SettingItem.ets @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2022 Huawei Device 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 { CommonConstants } from '../../common/constants/CommonConstants'; +import { AlarmSettingType } from '../../common/constants/AlarmSettingType'; +import AlarmSettingBean from '../../common/bean/AlarmSettingBean'; +import DimensionUtil from '../../common/utils/DimensionUtil'; +import IntervalDialog from './dialog/IntervalDialog'; +import DurationDialog from './dialog/DurationDialog'; +import RenameDialog from './dialog/RenameDialog'; +import RepeatDialog from './dialog/RepeatDialog'; + +@Component +export default struct SettingItem { + @Link settingInfo: Array; + repeatDialogController: CustomDialogController = new CustomDialogController({ + builder: RepeatDialog(), + autoCancel: true + }); + reNameDialogController: CustomDialogController = new CustomDialogController({ + builder: RenameDialog(), + autoCancel: true + }); + durationDialogController: CustomDialogController = new CustomDialogController({ + builder: DurationDialog(), + autoCancel: true + }); + intervalDialogController: CustomDialogController = new CustomDialogController({ + builder: IntervalDialog(), + autoCancel: true + }); + + private showSettingDialog(sType: AlarmSettingType) { + switch (sType) { + case AlarmSettingType.REPEAT: + this.repeatDialogController.open(); + break; + case AlarmSettingType.ALARM_NAME: + this.reNameDialogController.open(); + break; + case AlarmSettingType.RING_DURATION: + this.durationDialogController.open(); + break; + case AlarmSettingType.INTERVAL: + this.intervalDialogController.open(); + break; + default: + break + } + } + + build() { + Column() { + ForEach(this.settingInfo, (item: AlarmSettingBean, index: number) => { + Divider() + .visibility(index === 0 ? Visibility.Hidden : Visibility.Visible) + .opacity($r('app.float.divider_opacity')) + .color($r('app.color.grey_divider')) + .lineCap(LineCapStyle.Round) + .margin({ + left: DimensionUtil.getVp($r('app.float.setting_item_divider_margin_horizon')), + right: DimensionUtil.getVp($r('app.float.setting_item_divider_margin_horizon')) + }) + Row() { + Text(item.title) + .fontSize(DimensionUtil.getFp($r('app.float.setting_item_name_font_size'))) + .fontWeight(FontWeight.Regular) + .fontColor($r('app.color.grey_divider')) + .layoutWeight(CommonConstants.DEFAULT_LAYOUT_WEIGHT) + Text(item.content) + .fontSize(DimensionUtil.getFp($r('app.float.setting_item_content_font_size'))) + .fontWeight(FontWeight.Normal) + .fontColor($r('app.color.grey_divider')) + .opacity($r('app.float.setting_item_content_font_opacity')) + Image($r('app.media.ic_right')) + .width(DimensionUtil.getVp($r('app.float.setting_item_image_width'))) + .height(DimensionUtil.getVp($r('app.float.setting_item_image_height'))) + .objectFit(ImageFit.Fill) + .margin({ + left: DimensionUtil.getVp($r('app.float.setting_item_image_margin_horizon')) + }) + } + .height(DimensionUtil.getVp($r('app.float.setting_item_height'))) + .alignItems(VerticalAlign.Center) + .padding({ + left: DimensionUtil.getVp($r('app.float.setting_item_interval')), + right: DimensionUtil.getVp($r('app.float.setting_item_interval')) + }) + .onClick(() => { + this.showSettingDialog(item.sType); + }) + }, (item, index) => JSON.stringify(item) + index) + } + .margin({ + bottom: DimensionUtil.getVp($r('app.float.setting_item_interval')), + left: DimensionUtil.getVp($r('app.float.setting_item_interval')), + right: DimensionUtil.getVp($r('app.float.setting_item_interval')) + }) + .borderRadius(DimensionUtil.getVp($r('app.float.setting_item_border_radius'))) + .backgroundColor(Color.White) + } +} \ No newline at end of file diff --git a/alarm-clock-army/entry/src/main/ets/view/Detail/dialog/CommonDialog.ets b/alarm-clock-army/entry/src/main/ets/view/Detail/dialog/CommonDialog.ets new file mode 100644 index 0000000000000000000000000000000000000000..6061004fc5a338740f33ca8c274f6d418036b19f --- /dev/null +++ b/alarm-clock-army/entry/src/main/ets/view/Detail/dialog/CommonDialog.ets @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2022 Huawei Device 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 { CommonConstants } from '../../../common/constants/CommonConstants'; +import DimensionUtil from '../../../common/utils/DimensionUtil'; + +@Component +export default struct CommonDialog { + private title: string | Resource; + private controller: CustomDialogController; + private onConfirm: () => void; + @BuilderParam closer: () => void; + + build() { + Column() { + Text(this.title) + .fontSize(DimensionUtil.getFp($r('app.float.common_dialog_title_font_size'))) + .width(CommonConstants.FULL_LENGTH) + .fontColor($r('app.color.grey_divider')) + .margin({ + bottom: DimensionUtil.getVp($r('app.float.common_dialog_title_margin_vertical')) + }) + this.closer() + Row() { + Button($r('app.string.cancel')).actionBtnStyle().onClick(() => { + this.controller.close(); + }) + if (this.onConfirm) { + Button($r('app.string.confirm')).actionBtnStyle().onClick(() => { + this.onConfirm(); + this.controller.close(); + }) + } + } + .margin({ top: DimensionUtil.getVp($r('app.float.common_dialog_margin_vertical')) }) + } + .width(CommonConstants.FULL_LENGTH) + .padding(DimensionUtil.getVp($r('app.float.common_dialog_padding'))) + .justifyContent(FlexAlign.Center) + } +} + +@Extend(Button) function actionBtnStyle () { + .fontSize(DimensionUtil.getFp($r('app.float.common_dialog_button_font_size'))) + .height(DimensionUtil.getVp($r('app.float.common_dialog_button_height'))) + .layoutWeight(CommonConstants.DEFAULT_LAYOUT_WEIGHT) + .fontColor($r('app.color.green_light')) + .backgroundColor($r('app.color.trans_parent')) +} \ No newline at end of file diff --git a/alarm-clock-army/entry/src/main/ets/view/Detail/dialog/DurationDialog.ets b/alarm-clock-army/entry/src/main/ets/view/Detail/dialog/DurationDialog.ets new file mode 100644 index 0000000000000000000000000000000000000000..e9c1d7c3ab763fbb599f3db4ae3058030aa9b901 --- /dev/null +++ b/alarm-clock-army/entry/src/main/ets/view/Detail/dialog/DurationDialog.ets @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2022 Huawei Device 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 { CommonConstants } from '../../../common/constants/CommonConstants'; +import { DetailConstant } from '../../../common/constants/DetailConstant'; +import AlarmItem from '../../../common/bean/AlarmItemBean'; +import CommonDialog from './CommonDialog'; +import DimensionUtil from '../../../common/utils/DimensionUtil'; + +@CustomDialog +export default struct DurationDialog { + @Consume(DetailConstant.DEFAULT_PROVIDER_KEY) alarmItem: AlarmItem; + private durations: Array = DetailConstant.RING_DURATION; //响铃时长,分钟 + controller: CustomDialogController; + + build() { + Flex() { + CommonDialog({ + title: $r('app.string.ring_duration'), + controller: this.controller + }) { + ForEach(this.durations, item => { + Row() { + Text(item + CommonConstants.DEFAULT_STRING_SPACE + DetailConstant.DEFAULT_STRING_MINUTE) + .layoutWeight(CommonConstants.DEFAULT_LAYOUT_WEIGHT) + .fontColor($r('app.color.grey_divider')) + .fontSize(DimensionUtil.getFp($r('app.float.duration_dialog_content_font_size'))) + Radio({ value: item, group: DetailConstant.DEFAULT_STRING_GROUP_NAME }) + .checked(item === this.alarmItem.duration ? true : false) + .height(DimensionUtil.getVp($r('app.float.duration_dialog_radio_size'))) + .width(DimensionUtil.getVp($r('app.float.duration_dialog_radio_size'))) + .onChange(() => { + this.controller.close(); + this.alarmItem.duration = item + }) + } + .width(CommonConstants.FULL_LENGTH) + + Divider() + .opacity($r('app.float.divider_opacity')) + .color($r('app.color.grey_divider')) + .lineCap(LineCapStyle.Round) + }) + } + } + } +} \ No newline at end of file diff --git a/alarm-clock-army/entry/src/main/ets/view/Detail/dialog/IntervalDialog.ets b/alarm-clock-army/entry/src/main/ets/view/Detail/dialog/IntervalDialog.ets new file mode 100644 index 0000000000000000000000000000000000000000..bad0e73e4d975bc965478ec98eb982b0bd6aca4a --- /dev/null +++ b/alarm-clock-army/entry/src/main/ets/view/Detail/dialog/IntervalDialog.ets @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2022 Huawei Device 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 { CommonConstants } from '../../../common/constants/CommonConstants'; +import { DetailConstant } from '../../../common/constants/DetailConstant'; +import AlarmItem from '../../../common/bean/AlarmItemBean'; +import CommonDialog from './CommonDialog'; +import DimensionUtil from '../../../common/utils/DimensionUtil'; + +@CustomDialog +export default struct IntervalDialog { + @Consume(DetailConstant.DEFAULT_PROVIDER_KEY) alarmItem: AlarmItem; + @State intervalMinuteSelect: number = 0; + @State intervalTimesSelect: number = 0; + controller: CustomDialogController; + + aboutToAppear(): void{ + this.intervalMinuteSelect = this.alarmItem.intervalMinute; + this.intervalTimesSelect = this.alarmItem.intervalTimes; + } + + build() { + Flex() { + if ((this.intervalTimesSelect | this.intervalMinuteSelect) > 0) { + CommonDialog({ + title: $r('app.string.ring_interval'), + controller: this.controller, + onConfirm: () => { + this.alarmItem.intervalMinute = Number(this.intervalMinuteSelect.toFixed(0)) + this.alarmItem.intervalTimes = Number(this.intervalTimesSelect.toFixed(0)) + } + }) { + this.IntervalItem($r('app.string.ring_interval_content'), 0) + Divider() + .opacity($r('app.float.divider_opacity')) + .color($r('app.color.grey_divider')) + .lineCap(LineCapStyle.Round) + this.IntervalItem($r('app.string.ring_times_content'), CommonConstants.DEFAULT_SINGLE) + } + } + } + } + + @Builder IntervalItem(title: string | Resource, intervalType: number) { + Text(title) + .fontSize(DimensionUtil.getFp($r('app.float.interval_dialog_title_font_size'))) + .width(CommonConstants.FULL_LENGTH) + .textAlign(TextAlign.Start) + .margin({ + top: DimensionUtil.getVp($r('app.float.interval_dialog_title_margin_top')) + }) + Row() { + Slider({ + value: (intervalType === 0 ? this.intervalMinuteSelect : this.intervalTimesSelect), + min: (intervalType === 0 ? CommonConstants.DEFAULT_INTERVAL_STEP : 0), + max: (intervalType === 0 + ? CommonConstants.DEFAULT_INTERVAL_MINUTE_MAX + : CommonConstants.DEFAULT_INTERVAL_TIME_MAX), + step: (intervalType === 0 ? CommonConstants.DEFAULT_INTERVAL_STEP : CommonConstants.DEFAULT_DOUBLE), + style: SliderStyle.OutSet + }) + .blockColor(Color.Blue) + .trackColor(Color.Gray) + .selectedColor(Color.Blue) + .showSteps(true) + .showTips(false) + .onChange((value: number) => { + if (intervalType === 0) { + this.intervalMinuteSelect = value; + } else { + this.intervalTimesSelect = value; + } + }) + Text((intervalType === 0 ? this.intervalMinuteSelect : this.intervalTimesSelect).toFixed(0)) + .fontSize(DimensionUtil.getFp($r('app.float.interval_dialog_result_font_size'))) + } + .width(CommonConstants.FULL_LENGTH) + } +} \ No newline at end of file diff --git a/alarm-clock-army/entry/src/main/ets/view/Detail/dialog/RenameDialog.ets b/alarm-clock-army/entry/src/main/ets/view/Detail/dialog/RenameDialog.ets new file mode 100644 index 0000000000000000000000000000000000000000..732e28790ddadc268b0a6e873efdbffa6d626fb7 --- /dev/null +++ b/alarm-clock-army/entry/src/main/ets/view/Detail/dialog/RenameDialog.ets @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2022 Huawei Device 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 { CommonConstants } from '../../../common/constants/CommonConstants'; +import { DetailConstant } from '../../../common/constants/DetailConstant'; +import AlarmItem from '../../../common/bean/AlarmItemBean'; +import CommonDialog from './CommonDialog'; +import DimensionUtil from '../../../common/utils/DimensionUtil'; + +@CustomDialog +export default struct RenameDialog { + @Consume(DetailConstant.DEFAULT_PROVIDER_KEY) alarmItem: AlarmItem; + private name: string; + controller: CustomDialogController; + + build() { + Flex() { + CommonDialog({ + title: $r('app.string.alarm_name'), + controller: this.controller, + onConfirm: () => { + this.alarmItem.name = this.name; + } + }) { + TextArea({ text: this.alarmItem.name }) + .width(CommonConstants.FULL_LENGTH) + .margin({ bottom: DimensionUtil.getVp($r('app.float.rename_dialog_text_margin_bottom')) }) + .onChange((value: string) => { + this.name = value; + }) + Divider() + .opacity($r('app.float.divider_opacity')) + .color($r('app.color.grey_divider')) + .lineCap(LineCapStyle.Round) + } + } + } +} \ No newline at end of file diff --git a/alarm-clock-army/entry/src/main/ets/view/Detail/dialog/RepeatDialog.ets b/alarm-clock-army/entry/src/main/ets/view/Detail/dialog/RepeatDialog.ets new file mode 100644 index 0000000000000000000000000000000000000000..9879d3cbc1e2fa1c32ed4ccaaf76603727b2a7ac --- /dev/null +++ b/alarm-clock-army/entry/src/main/ets/view/Detail/dialog/RepeatDialog.ets @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2022 Huawei Device 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 { CommonConstants } from '../../../common/constants/CommonConstants'; +import { DetailConstant } from '../../../common/constants/DetailConstant'; +import AlarmItem from '../../../common/bean/AlarmItemBean'; +import DetailModel from '../../../viewmodel/DetailViewModel'; +import CommonDialog from './CommonDialog'; +import DataTypeUtils from '../../../common/utils/DataTypeUtils'; +import DimensionUtil from '../../../common/utils/DimensionUtil'; + +@CustomDialog +export default struct RepeatDialog { + @Consume(DetailConstant.DEFAULT_PROVIDER_KEY) alarmItem: AlarmItem; + private viewModel: DetailModel = DetailModel.getInstant(); + private selects: number[] = []; + controller: CustomDialogController; + + aboutToAppear() { + this.selects = DataTypeUtils.deepCopy(this.alarmItem.repeatDays); + } + + build() { + Flex() { + CommonDialog({ + title: $r('app.string.repeat_name'), + controller: this.controller, + onConfirm: () => { + this.selects.sort(); + this.alarmItem.repeatDays = this.selects; + this.alarmItem.isRepeat = this.selects.length > 0; + } + }) { + ForEach(DetailConstant.WEEKDAY_DATA, (item) => { + Row() { + Text(this.viewModel.transAlarmRepeatDayContent(item)) + .layoutWeight(CommonConstants.DEFAULT_LAYOUT_WEIGHT) + .fontColor($r('app.color.grey_divider')) + .fontSize(DimensionUtil.getFp($r('app.float.repeat_dialog_check_font_size'))) + + Checkbox({ name: item }) + .select(this.alarmItem.repeatDays.indexOf(item) !== CommonConstants.DEFAULT_NUMBER_NEGATIVE) + .width(DimensionUtil.getVp($r('app.float.repeat_dialog_check_box_size'))) + .height(DimensionUtil.getVp($r('app.float.repeat_dialog_check_box_size'))) + .onChange((value: boolean) => { + if (value) { + this.selects.push(item); + } else { + let index = this.selects.indexOf(item); + this.selects.splice(index, CommonConstants.DEFAULT_SINGLE); + } + }) + } + .width(CommonConstants.FULL_LENGTH) + + Divider() + .opacity($r('app.float.divider_opacity')) + .color($r('app.color.grey_divider')) + .lineCap(LineCapStyle.Round) + }) + } + } + } +} \ No newline at end of file diff --git a/alarm-clock-army/entry/src/main/ets/view/Main/AlarmList.ets b/alarm-clock-army/entry/src/main/ets/view/Main/AlarmList.ets new file mode 100644 index 0000000000000000000000000000000000000000..3815fb363d93512342ac45d11874b2fbf77250f1 --- /dev/null +++ b/alarm-clock-army/entry/src/main/ets/view/Main/AlarmList.ets @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2022 Huawei Device 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 router from '@ohos.router'; +import AlarmItem from '../../common/bean/AlarmItemBean'; +import AlarmListItem from '../Main/AlarmListItem'; +import DimensionUtil from '../../common/utils/DimensionUtil'; +import { ALARM_KEY, CommonConstants } from '../../common/constants/CommonConstants'; +import DetailModel from '../../viewmodel/DetailViewModel'; + +@Component +export default struct AlarmList { + @Link alarmItems: Array; + private viewModel: DetailModel = DetailModel.getInstant(); + + @Builder itemEnd(idx: number) { + Button({type: ButtonType.Circle}) { + Image($r('app.media.remove')) + .objectFit(ImageFit.Fill) + .width(24) + .height(24) + } + .backgroundColor('#FA2A2D') + .width(48) + .height(48) + .margin(12) + .onClick(() => { + // 参考DetailIndex页面删除功能 + this.viewModel.removeAlarmRemind(this.alarmItems[idx].id); + }) + } + + build() { + List({ space: DimensionUtil.getVp($r('app.float.alarm_list_space')) }) { + ForEach(this.alarmItems, (item: AlarmItem, idx: number) => { + ListItem() { + AlarmListItem({ alarmItem: item }) + } + .onClick(() => { + router.pushUrl({ url: "pages/DetailIndex", params: { alarmItem: item } }); + }) + .swipeAction({end: this.itemEnd.bind(this, idx)}) + }, item => JSON.stringify(item)) + } + .padding({ + left: DimensionUtil.getVp($r('app.float.alarm_list_content_distance')), + right: DimensionUtil.getVp($r('app.float.alarm_list_content_distance')) + }) + .listDirection(Axis.Vertical) + .layoutWeight(CommonConstants.DEFAULT_LAYOUT_WEIGHT) + .margin({ top: DimensionUtil.getVp($r('app.float.alarm_list_content_distance')) }) + } +} \ No newline at end of file diff --git a/alarm-clock-army/entry/src/main/ets/view/Main/AlarmListItem.ets b/alarm-clock-army/entry/src/main/ets/view/Main/AlarmListItem.ets new file mode 100644 index 0000000000000000000000000000000000000000..460ed043c95ea816373f9f4acf9529435b78d9a7 --- /dev/null +++ b/alarm-clock-army/entry/src/main/ets/view/Main/AlarmListItem.ets @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2022 Huawei Device 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 MainModel from './../../viewmodel/MainViewModel'; +import { CommonConstants } from '../../common/constants/CommonConstants'; +import AlarmItem from '../../common/bean/AlarmItemBean'; +import DimensionUtil from '../../common/utils/DimensionUtil'; + +@Component +export default struct AlarmListItem { + private mainModel: MainModel = MainModel.getInstant(); + private alarmItem: AlarmItem; + + build() { + Row() { + Column() { + Row() { + Text(this.mainModel.getNoonContent(this.alarmItem.hour)) + .CommonTextAttr(DimensionUtil.getFp($r('app.float.alarms_item_noon_font_size')), + FontWeight.Regular) + Text(this.mainModel.getTaskTimeContent(this.alarmItem.hour, this.alarmItem.minute)) + .CommonTextAttr(DimensionUtil.getFp($r('app.float.alarms_item_time_font_size')), + FontWeight.Regular, + { left: DimensionUtil.getVp($r('app.float.alarms_item_time_margin_left')) }) + } + + Text(this.mainModel.getDescContent(this.alarmItem)) + .CommonTextAttr(DimensionUtil.getFp($r('app.float.alarms_item_dec_font_size')), + FontWeight.Normal, + { top: DimensionUtil.getVp($r('app.float.alarms_item_dec_margin_top')) }, + $r('app.float.alarms_item_desc_text_opacity')) + } + .width(CommonConstants.FULL_LENGTH) + .alignItems(HorizontalAlign.Start) + .layoutWeight(CommonConstants.DEFAULT_LAYOUT_WEIGHT) + + Toggle({ type: ToggleType.Switch, isOn: this.alarmItem.isOpen }) + .onChange((isOn: boolean) => { + this.mainModel.openAlarm(this.alarmItem.id, isOn); + }) + .width(DimensionUtil.getVp($r('app.float.alarms_item_toggle_width'))) + .height(DimensionUtil.getVp($r('app.float.alarms_item_toggle_height'))) + } + .padding({ + left: DimensionUtil.getVp($r('app.float.alarm_list_content_distance')), + right: DimensionUtil.getVp($r('app.float.alarm_list_content_distance')) + }) + .width(CommonConstants.FULL_LENGTH) + .height(DimensionUtil.getVp($r('app.float.alarms_item_height'))) + .backgroundColor(Color.White) + .borderRadius(DimensionUtil.getVp($r('app.float.alarms_item_radius'))) + } +} + +@Extend(Text) function CommonTextAttr (fontSize: number, fontWeight: number, margin?, opacity?) { + .fontColor($r('app.color.grey_divider')) + .fontSize(fontSize) + .fontWeight(fontWeight) + .margin(margin) + .opacity(opacity) +} \ No newline at end of file diff --git a/alarm-clock-army/entry/src/main/ets/view/Main/ClockArea.ets b/alarm-clock-army/entry/src/main/ets/view/Main/ClockArea.ets new file mode 100644 index 0000000000000000000000000000000000000000..b3b0a7a1a8d3a114dd6f94ca0b5cd36c169b1d08 --- /dev/null +++ b/alarm-clock-army/entry/src/main/ets/view/Main/ClockArea.ets @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2022 Huawei Device 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 { CommonConstants } from '../../common/constants/CommonConstants'; +import MainModel from '../../viewmodel/MainViewModel'; +import { MainConstant } from '../../common/constants/MainConstant'; +import DimensionUtil from '../../common/utils/DimensionUtil'; + +@Component +export default struct ClockArea { + private mainModel: MainModel; + private drawInterval: any = CommonConstants.DEFAULT_NUMBER_NEGATIVE; + @State showClock: boolean = true; + private canvasSize: number; + private clockRadius: number; + private settings: RenderingContextSettings = new RenderingContextSettings(true); + private renderContext: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings); + + aboutToAppear() { + this.mainModel = MainModel.getInstant(); + this.canvasSize = DimensionUtil.getVp($r('app.float.clock_size')); + this.clockRadius = this.canvasSize / CommonConstants.DEFAULT_DOUBLE - CommonConstants.DEFAULT_DOUBLE; + } + + aboutToDisappear() { + clearInterval(this.drawInterval); + } + + build() { + Canvas(this.renderContext) + .width(this.canvasSize) + .aspectRatio(CommonConstants.DEFAULT_LAYOUT_WEIGHT) + .onReady(() => { + if (this.drawInterval === CommonConstants.DEFAULT_NUMBER_NEGATIVE) { + this.startDrawTask(); + } + }) + .onClick(() => { + this.showClock = !this.showClock; + }) + } + + // 启动绘画任务 + private startDrawTask() { + let that = this; + that.renderContext.translate( + this.canvasSize / CommonConstants.DEFAULT_DOUBLE, + this.canvasSize / CommonConstants.DEFAULT_DOUBLE); + that.drawClockArea(); + this.drawInterval = setInterval(() => { + that.drawClockArea(); + }, MainConstant.DEFAULT_ONE_SECOND_MS); + } + + // 开始绘制时钟区域 + private drawClockArea(): void{ + this.renderContext.clearRect( + -this.canvasSize, + -this.canvasSize / CommonConstants.DEFAULT_DOUBLE, + this.canvasSize * CommonConstants.DEFAULT_DOUBLE, + this.canvasSize); + let date = new Date(); + let hours = date.getHours(); + let minutes = date.getMinutes(); + let seconds = date.getSeconds(); + if (this.showClock) { + this.drawPan(); + this.drawPointer( + CommonConstants.DEFAULT_INTERVAL_MINUTE_MAX * (hours > CommonConstants.DEFAULT_TOTAL_HOUR + ? hours - CommonConstants.DEFAULT_TOTAL_HOUR + : hours) + + minutes / CommonConstants.DEFAULT_TOTAL_HOUR * CommonConstants.DEFAULT_COMMON_DEGREE + , MainConstant.HOUR_POINTER_IMAGE_URL); + this.drawPointer(CommonConstants.DEFAULT_COMMON_DEGREE * minutes, MainConstant.MINUTE_POINTER_IMAGE_URL); + this.drawPointer(CommonConstants.DEFAULT_COMMON_DEGREE * seconds, MainConstant.SECOND_POINTER_IMAGE_URL); + } else { + this.drawTime(hours, minutes, seconds); + } + } + + // 绘制表盘 + private drawPan(): void{ + this.renderContext.beginPath(); + let secondImg = new ImageBitmap(MainConstant.CLOCK_PAN_IMAGE_URL); + let imgWidth = this.clockRadius * 2; + this.renderContext.drawImage(secondImg, -this.clockRadius, -this.clockRadius, imgWidth, imgWidth); + this.renderContext.restore(); + } + + // 绘制时针、分针、秒针 + private drawPointer(degree, pointerImgRes) { + this.renderContext.save(); + var theta = (degree + MainConstant.DEFAULT_HORIZONTAL_ANGLE) * Math.PI / MainConstant.DEFAULT_HORIZONTAL_ANGLE; + this.renderContext.rotate(theta); + this.renderContext.beginPath(); + let secondImg = new ImageBitmap(pointerImgRes); + let imgWidth = CommonConstants.DEFAULT_POINTER_WIDTH; + this.renderContext.drawImage( + secondImg, + -imgWidth / CommonConstants.DEFAULT_DOUBLE, + -this.clockRadius, + imgWidth, + this.clockRadius * CommonConstants.DEFAULT_DOUBLE); + this.renderContext.restore(); + } + + // 绘制完整时间回显 + private drawTime(hour: number, minute: number, second: number): void{ + let time = this.mainModel.fillZero(hour) + + MainConstant.DEFAULT_STRING_COLON + + this.mainModel.fillZero(minute) + + MainConstant.DEFAULT_STRING_COLON + + this.mainModel.fillZero(second); + this.renderContext.save(); + this.renderContext.font = DimensionUtil.getPx($r('app.float.clock_time_font_size')) + + MainConstant.CLOCK_TIME_FONT_SIZE_UNIT; + this.renderContext.beginPath(); + this.renderContext.textAlign = 'center'; + this.renderContext.fillText(time, 0, 0); + this.renderContext.restore(); + } +} \ No newline at end of file diff --git a/alarm-clock-army/entry/src/main/ets/viewmodel/DetailViewModel.ets b/alarm-clock-army/entry/src/main/ets/viewmodel/DetailViewModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..9fbf5cd42b39484b0d6dccfe34f95ddefe2ce89f --- /dev/null +++ b/alarm-clock-army/entry/src/main/ets/viewmodel/DetailViewModel.ets @@ -0,0 +1,174 @@ +/* + * Copyright (c) 2022 Huawei Device 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 { DetailConstant } from '../common/constants/DetailConstant'; +import { ALARM_KEY, CommonConstants } from '../common/constants/CommonConstants'; +import AlarmItem from '../common/bean/AlarmItemBean'; +import ReminderService from '../model/ReminderService'; +import DataTypeUtils from '../common/utils/DataTypeUtils'; + +/** + * Detail page view model description + */ +export default class DetailViewModel { + private static instant; + private reminderService: ReminderService; + private alarms: Array; + + private constructor() { + this.reminderService = new ReminderService(); + this.alarms = new Array(); + } + + /** + * Get DetailViewModel instance. + * + * @return instance + */ + public static getInstant() { + if (this.instant == null) { + this.instant = new DetailViewModel(); + } + return this.instant; + } + + /** + * Conversion alarm repeat day content + * + * @param repeatDay number + * @return repeatContent string + */ + public transAlarmRepeatDayContent(repeatDay: number): string{ + let repeatContent; + switch (repeatDay) { + case CommonConstants.DEFAULT_NUMBER_MONDAY: + repeatContent = CommonConstants.DEFAULT_STRING_MONDAY; + break; + case CommonConstants.DEFAULT_NUMBER_TUESDAY: + repeatContent = CommonConstants.DEFAULT_STRING_TUESDAY; + break; + case CommonConstants.DEFAULT_NUMBER_WEDNESDAY: + repeatContent = CommonConstants.DEFAULT_STRING_WEDNESDAY; + break; + case CommonConstants.DEFAULT_NUMBER_THURSDAY: + repeatContent = CommonConstants.DEFAULT_STRING_THURSDAY; + break; + case CommonConstants.DEFAULT_NUMBER_FRIDAY: + repeatContent = CommonConstants.DEFAULT_STRING_FRIDAY; + break; + case CommonConstants.DEFAULT_NUMBER_SATURDAY: + repeatContent = CommonConstants.DEFAULT_STRING_SATURDAY; + break; + case CommonConstants.DEFAULT_NUMBER_SUNDAY: + repeatContent = CommonConstants.DEFAULT_STRING_SUNDAY; + break; + default: + break; + } + return repeatContent; + } + + /** + * Set the initial time of the alarm. + * + * @param alarmItem AlarmItem + */ + public setAlarmDefaultTime(alarmItem?: AlarmItem) { + let hour; + let minute; + if (alarmItem == null) { + let date = new Date(); + hour = date.getHours(); + minute = date.getMinutes(); + } else { + hour = alarmItem.hour; + minute = alarmItem.minute; + } + DetailConstant.DAY_DATA[0].delSelect = (hour >= CommonConstants.DEFAULT_TOTAL_HOUR + ? CommonConstants.DEFAULT_SINGLE + : 0); + DetailConstant.DAY_DATA[CommonConstants.DEFAULT_SINGLE].delSelect = (hour === 0 + ? CommonConstants.DEFAULT_TOTAL_HOUR + : (hour > CommonConstants.DEFAULT_TOTAL_HOUR ? hour - CommonConstants.DEFAULT_TOTAL_HOUR : hour)) + - CommonConstants.DEFAULT_SINGLE; + DetailConstant.DAY_DATA[CommonConstants.DEFAULT_DATA_PICKER_HOUR_SELECTION].delSelect = + (minute === 0 ? CommonConstants.DEFAULT_TOTAL_MINUTE : minute) - CommonConstants.DEFAULT_SINGLE; + } + + /** + * Set the alarm remind. + * + * @param alarmItem AlarmItem + */ + public async setAlarmRemind(alarmItem: AlarmItem) { + alarmItem.hour = this.getAlarmTime(CommonConstants.DEFAULT_SINGLE); + alarmItem.minute = this.getAlarmTime(CommonConstants.DEFAULT_DATA_PICKER_HOUR_SELECTION); + let index = await this.findAlarmWithId(alarmItem.id); + if (index !== CommonConstants.DEFAULT_NUMBER_NEGATIVE) { // 已存在,删除原有提醒 + this.reminderService.deleteReminder(alarmItem.id); + } else { // 不存在,以数据长度为notificationId新增闹钟数据 + index = this.alarms.length; + alarmItem.notificationId = index; + this.alarms.push(alarmItem); + } + this.reminderService.addReminder(alarmItem, (newId) => { + alarmItem.id = newId; + alarmItem.isOpen = true; + this.alarms[index] = alarmItem; + globalThis.preference.set(ALARM_KEY, JSON.stringify(this.alarms)); + }) + } + + /** + * Remove the alarm remind. + * + * @param id number + */ + public async removeAlarmRemind(id: number) { + this.reminderService.deleteReminder(id); + let index = await this.findAlarmWithId(id); + if (index !== CommonConstants.DEFAULT_NUMBER_NEGATIVE) { + this.alarms.splice(index, CommonConstants.DEFAULT_SINGLE); + } + globalThis.preference.set(ALARM_KEY, JSON.stringify(this.alarms)); + } + + private getAlarmTime(aType: number): number{ + let times = DetailConstant.DAY_DATA[aType]; + let selectedIndex = times.delSelect; + let time = Number(times.data[selectedIndex]); + if (aType === CommonConstants.DEFAULT_SINGLE) { + time = (time === CommonConstants.DEFAULT_TOTAL_HOUR ? 0 : time) + + (DetailConstant.DAY_DATA[0].delSelect === CommonConstants.DEFAULT_SINGLE + ? CommonConstants.DEFAULT_TOTAL_HOUR + : 0); + } + return time; + } + + private async findAlarmWithId(id: number) { + let data = await globalThis.preference.get(ALARM_KEY); + if (!DataTypeUtils.isNull(data)) { + this.alarms = JSON.parse(data); + for (let i = 0;i < this.alarms.length; i++) { + if (this.alarms[i].id === id) { + return i; + } + } + } + return CommonConstants.DEFAULT_NUMBER_NEGATIVE; + } +} + diff --git a/alarm-clock-army/entry/src/main/ets/viewmodel/MainViewModel.ets b/alarm-clock-army/entry/src/main/ets/viewmodel/MainViewModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..b536766bc466db40ad660b0d9674ae4d73e488d3 --- /dev/null +++ b/alarm-clock-army/entry/src/main/ets/viewmodel/MainViewModel.ets @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2022 Huawei Device 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 { MainConstant } from '../common/constants/MainConstant'; +import ReminderService from '../model/ReminderService'; +import { ALARM_KEY, CommonConstants } from '../common/constants/CommonConstants'; +import AlarmItem from '../common/bean/AlarmItemBean'; +import DataTypeUtils from '../common/utils/DataTypeUtils'; + +/** + * Declare class of main view model. + */ +export default class MainViewModel { + private static instant; + private reminderService: ReminderService; + private alarms: Array; + + private constructor() { + this.alarms = new Array(); + this.reminderService = new ReminderService(); + } + + /** + * Get instant in MainViewModel. + */ + public static getInstant() { + if (this.instant == null) { + this.instant = new MainViewModel(); + } + return this.instant; + } + + /** + * Querying alarm task database tables. + * + * @param callback (alarms: Array) => void + */ + private queryDatabaseAlarms(callback: (alarms: Array) => void) { + globalThis.preference.get(ALARM_KEY).then((data) => { + if (!DataTypeUtils.isNull(data)) { + this.alarms = JSON.parse(data); + callback(this.alarms); + } + }) + } + + /** + * Refresh alarm task. + * + * @param callback (alarms: Array) => void + */ + public queryAlarmsTasker(callback: (alarms: Array) => void) { + let that = this; + that.queryDatabaseAlarms(callback); + globalThis.preference.addPreferencesListener({ + onDataChanged() { + that.queryDatabaseAlarms(callback); + } + }) + } + + /** + * Padding zeros for insufficient digits + * + * @param val number + * @return content string + */ + public fillZero(val: number): string{ + return (val > MainConstant.DEFAULT_SINGLE_DIGIT_MAX + ? val.toString() + : (MainConstant.DEFAULT_ZEROING + val)); + } + + /** + * Get noon content in MainViewModel. + * + * @param hour number + * @return content string + */ + public getNoonContent(hour: number): string{ + return (hour < CommonConstants.DEFAULT_TOTAL_HOUR + ? MainConstant.DEFAULT_STRING_MORNING + : MainConstant.DEFAULT_STRING_AFTERNOON); + } + + /** + * Get task time content in MainViewModel. + * + * @param hour number + * @param minute number + * @return content string + */ + public getTaskTimeContent(hour: number, minute: number): string { + return (this.fillZero(hour > CommonConstants.DEFAULT_TOTAL_HOUR ? hour - CommonConstants.DEFAULT_TOTAL_HOUR : hour) + + MainConstant.DEFAULT_STRING_COLON + + this.fillZero(minute)); + } + + /** + * Get description content in MainViewModel. + * + * @param alarmItem AlarmItem + * @return content string + */ + public getDescContent(alarmItem: AlarmItem): string{ + return (alarmItem.name + CommonConstants.DEFAULT_STRING_COMMA + + (alarmItem.isRepeat + ? this.getAlarmRepeatDayContent(alarmItem.repeatDays) + : CommonConstants.DEFAULT_STRING_NO_REPEAT)); + } + + /** + * Obtains the number of repetition days of an alarm task. + * + * @param repeatDays Array + * @return content string + */ + public getAlarmRepeatDayContent(repeatDays: Array): string{ + let content = MainConstant.DEFAULT_STRING_NULL; + for (var i = 0; i < repeatDays.length; i++) { + let repeatDay = repeatDays[i]; + let repeatContent; + switch (repeatDay) { + case CommonConstants.DEFAULT_NUMBER_MONDAY: + repeatContent = CommonConstants.DEFAULT_STRING_MONDAY; + break; + case CommonConstants.DEFAULT_NUMBER_TUESDAY: + repeatContent = CommonConstants.DEFAULT_STRING_TUESDAY; + break; + case CommonConstants.DEFAULT_NUMBER_WEDNESDAY: + repeatContent = CommonConstants.DEFAULT_STRING_WEDNESDAY; + break; + case CommonConstants.DEFAULT_NUMBER_THURSDAY: + repeatContent = CommonConstants.DEFAULT_STRING_THURSDAY; + break; + case CommonConstants.DEFAULT_NUMBER_FRIDAY: + repeatContent = CommonConstants.DEFAULT_STRING_FRIDAY; + break; + case CommonConstants.DEFAULT_NUMBER_SATURDAY: + repeatContent = CommonConstants.DEFAULT_STRING_SATURDAY; + break; + case CommonConstants.DEFAULT_NUMBER_SUNDAY: + repeatContent = CommonConstants.DEFAULT_STRING_SUNDAY; + break; + default: + break; + } + content += (repeatContent + CommonConstants.DEFAULT_STRING_SPACE); + } + return content; + } + + /** + * Enabling/Disabling alarms. + * + * @param id number + * @return isOpen boolean + */ + public openAlarm(id: number, isOpen: boolean) { + for (let i = 0; i < this.alarms.length; i++) { + if (this.alarms[i].id === id) { + this.alarms[i].isOpen = isOpen; + if (isOpen) { + this.reminderService.addReminder(this.alarms[i]); + } else { + this.reminderService.deleteReminder(this.alarms[i].id); + } + globalThis.preference.set(ALARM_KEY, JSON.stringify(this.alarms)); + break; + } + } + } +} \ No newline at end of file diff --git a/alarm-clock-army/entry/src/main/module.json5 b/alarm-clock-army/entry/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..85413de317531d12ef52b8c35766f287d4301373 --- /dev/null +++ b/alarm-clock-army/entry/src/main/module.json5 @@ -0,0 +1,49 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "description": "$string:entry_desc", + "mainElement": "EntryAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "EntryAbility", + "srcEntry": "./ets/entryability/EntryAbility.ets", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:white", + "exported": true, + "orientation": "portrait", + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ], + "requestPermissions": [ + { + "name": "ohos.permission.PUBLISH_AGENT_REMINDER", + "reason": "$string:reason", + "usedScene": { + "abilities": [ + "EntryAbility" + ], + "when": "inuse" + } + } + ] + } +} \ No newline at end of file diff --git a/alarm-clock-army/entry/src/main/resources/base/element/color.json b/alarm-clock-army/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..90aa8c1a168703e5fcf54536837ab360dc96072a --- /dev/null +++ b/alarm-clock-army/entry/src/main/resources/base/element/color.json @@ -0,0 +1,36 @@ +{ + "color": [ + { + "name": "white", + "value": "#FFFFFF" + }, + { + "name": "grey_light", + "value": "#F1F3F5" + }, + { + "name": "grey_divider", + "value": "#182431" + }, + { + "name": "blue_light", + "value": "#007DFF" + }, + { + "name": "grey_with_opacity", + "value": "#0C182431" + }, + { + "name": "red_light", + "value": "#FA2A2D" + }, + { + "name": "trans_parent", + "value": "#00000000" + }, + { + "name": "green_light", + "value": "#17A98E" + } + ] +} \ No newline at end of file diff --git a/alarm-clock-army/entry/src/main/resources/base/element/dimen.json b/alarm-clock-army/entry/src/main/resources/base/element/dimen.json new file mode 100644 index 0000000000000000000000000000000000000000..406dcfbf954b1f0a301bf2966487076a6ad01b39 --- /dev/null +++ b/alarm-clock-army/entry/src/main/resources/base/element/dimen.json @@ -0,0 +1,228 @@ +{ + "float": [ + { + "name": "alarms_item_desc_text_opacity", + "value": "0.6" + }, + { + "name": "divider_opacity", + "value": "0.05" + }, + { + "name": "setting_item_content_font_opacity", + "value": "0.6" + }, + { + "name": "page_title_height", + "value": "56" + }, + { + "name": "content_margin_body", + "value": "16" + }, + { + "name": "title_horizon_margin", + "value": "24" + }, + { + "name": "title_font_size", + "value": "24" + }, + { + "name": "new_alarm_button_size", + "value": "48" + }, + { + "name": "new_alarm_button_margin_vertical", + "value": "24" + }, + { + "name": "title_button_size", + "value": "24" + }, + { + "name": "delete_button_width", + "value": "120" + }, + { + "name": "delete_button_height", + "value": "40" + }, + { + "name": "delete_button_font_size", + "value": "16" + }, + { + "name": "delete_button_radius", + "value": "20" + }, + { + "name": "delete_button_margin_bottom", + "value": "24" + }, + { + "name": "alarm_list_space", + "value": "12" + }, + { + "name": "alarm_list_content_distance", + "value": "12" + }, + { + "name": "alarms_item_noon_font_size", + "value": "16" + }, + { + "name": "alarms_item_time_font_size", + "value": "24" + }, + { + "name": "alarms_item_time_margin_left", + "value": "4" + }, + { + "name": "alarms_item_dec_font_size", + "value": "14" + }, + { + "name": "alarms_item_dec_margin_top", + "value": "2" + }, + { + "name": "alarms_item_toggle_width", + "value": "36" + }, + { + "name": "alarms_item_toggle_height", + "value": "20" + }, + { + "name": "alarms_item_height", + "value": "72" + }, + { + "name": "alarms_item_radius", + "value": "24" + }, + { + "name": "clock_size", + "value": "252" + }, + { + "name": "clock_time_font_size", + "value": "60" + }, + { + "name": "detail_title_font_size", + "value": "20" + }, + { + "name": "title_line_height", + "value": "28" + }, + { + "name": "title_margin", + "value": "16" + }, + { + "name": "common_dialog_title_font_size", + "value": "20" + }, + { + "name": "common_dialog_title_margin_vertical", + "value": "12" + }, + { + "name": "common_dialog_margin_vertical", + "value": "12" + }, + { + "name": "common_dialog_padding", + "value": "24" + }, + { + "name": "common_dialog_button_font_size", + "value": "15" + }, + { + "name": "common_dialog_button_height", + "value": "40" + }, + { + "name": "duration_dialog_content_font_size", + "value": "14" + }, + { + "name": "duration_dialog_radio_size", + "value": "20" + }, + { + "name": "interval_dialog_title_font_size", + "value": "10" + }, + { + "name": "interval_dialog_title_margin_top", + "value": "10" + }, + { + "name": "interval_dialog_result_font_size", + "value": "16" + }, + { + "name": "rename_dialog_text_margin_bottom", + "value": "20" + }, + { + "name": "repeat_dialog_check_font_size", + "value": "14" + }, + { + "name": "repeat_dialog_check_box_size", + "value": "20" + }, + { + "name": "date_picker_height", + "value": "200" + }, + { + "name": "date_picker_padding_horizon", + "value": "24" + }, + { + "name": "setting_item_divider_margin_horizon", + "value": "12" + }, + { + "name": "setting_item_name_font_size", + "value": "16" + }, + { + "name": "setting_item_content_font_size", + "value": "14" + }, + { + "name": "setting_item_image_width", + "value": "6.7" + }, + { + "name": "setting_item_image_height", + "value": "12.8" + }, + { + "name": "setting_item_image_margin_horizon", + "value": "7" + }, + { + "name": "setting_item_height", + "value": "56" + }, + { + "name": "setting_item_interval", + "value": "12" + }, + { + "name": "setting_item_border_radius", + "value": "24" + } + ] +} \ No newline at end of file diff --git a/alarm-clock-army/entry/src/main/resources/base/element/string.json b/alarm-clock-army/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..3de54f2b9b09c5fcea99cf1666ef3ed9568d13d5 --- /dev/null +++ b/alarm-clock-army/entry/src/main/resources/base/element/string.json @@ -0,0 +1,64 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "AlarmClock" + }, + { + "name": "confirm", + "value": "确定" + }, + { + "name": "cancel", + "value": "取消" + }, + { + "name": "ring_duration", + "value": "闹铃时长" + }, + { + "name": "ring_interval", + "value": "再响间隔" + }, + { + "name": "ring_interval_content", + "value": "响铃间隔时间(分钟)" + }, + { + "name": "ring_times_content", + "value": "重复响铃次数" + }, + { + "name": "alarm_name", + "value": "闹钟名" + }, + { + "name": "repeat_name", + "value": "重复" + }, + { + "name": "new_alarm", + "value": "新建闹钟" + }, + { + "name": "update_alarm", + "value": "修改闹钟" + }, + { + "name": "delete", + "value": "删除" + }, + { + "name": "reason", + "value": "通知" + } + ] +} \ No newline at end of file diff --git a/alarm-clock-army/entry/src/main/resources/base/media/ic_add.png b/alarm-clock-army/entry/src/main/resources/base/media/ic_add.png new file mode 100644 index 0000000000000000000000000000000000000000..53968d7c9da7182d73a2e8d3c7c3c9a3cca83b63 Binary files /dev/null and b/alarm-clock-army/entry/src/main/resources/base/media/ic_add.png differ diff --git a/alarm-clock-army/entry/src/main/resources/base/media/ic_cancel.png b/alarm-clock-army/entry/src/main/resources/base/media/ic_cancel.png new file mode 100644 index 0000000000000000000000000000000000000000..c0bece832d3b81d53ac6993e974c0296e73bad8f Binary files /dev/null and b/alarm-clock-army/entry/src/main/resources/base/media/ic_cancel.png differ diff --git a/alarm-clock-army/entry/src/main/resources/base/media/ic_clock_pan.png b/alarm-clock-army/entry/src/main/resources/base/media/ic_clock_pan.png new file mode 100644 index 0000000000000000000000000000000000000000..ea0d3f082b3c160bd326048acf9ec79bdb9ac221 Binary files /dev/null and b/alarm-clock-army/entry/src/main/resources/base/media/ic_clock_pan.png differ diff --git a/alarm-clock-army/entry/src/main/resources/base/media/ic_confirm.png b/alarm-clock-army/entry/src/main/resources/base/media/ic_confirm.png new file mode 100644 index 0000000000000000000000000000000000000000..5d790967e67818c6fbd09788f80149a368cb98b8 Binary files /dev/null and b/alarm-clock-army/entry/src/main/resources/base/media/ic_confirm.png differ diff --git a/alarm-clock-army/entry/src/main/resources/base/media/ic_hour_pointer.png b/alarm-clock-army/entry/src/main/resources/base/media/ic_hour_pointer.png new file mode 100644 index 0000000000000000000000000000000000000000..18d556e197631be29574bd413332ddf6d5b22929 Binary files /dev/null and b/alarm-clock-army/entry/src/main/resources/base/media/ic_hour_pointer.png differ diff --git a/alarm-clock-army/entry/src/main/resources/base/media/ic_minute_pointer.png b/alarm-clock-army/entry/src/main/resources/base/media/ic_minute_pointer.png new file mode 100644 index 0000000000000000000000000000000000000000..60cd4375a30e955ad631316e963bc8ac794405ef Binary files /dev/null and b/alarm-clock-army/entry/src/main/resources/base/media/ic_minute_pointer.png differ diff --git a/alarm-clock-army/entry/src/main/resources/base/media/ic_public_back.png b/alarm-clock-army/entry/src/main/resources/base/media/ic_public_back.png new file mode 100644 index 0000000000000000000000000000000000000000..d3a807db149dd77830017e15eb9a499e8948be25 Binary files /dev/null and b/alarm-clock-army/entry/src/main/resources/base/media/ic_public_back.png differ diff --git a/alarm-clock-army/entry/src/main/resources/base/media/ic_right.png b/alarm-clock-army/entry/src/main/resources/base/media/ic_right.png new file mode 100644 index 0000000000000000000000000000000000000000..f95236854b0e477956269cfe9fecb661e82c6c66 Binary files /dev/null and b/alarm-clock-army/entry/src/main/resources/base/media/ic_right.png differ diff --git a/alarm-clock-army/entry/src/main/resources/base/media/ic_second_pointer.png b/alarm-clock-army/entry/src/main/resources/base/media/ic_second_pointer.png new file mode 100644 index 0000000000000000000000000000000000000000..0f3d604e988165e4bf9fd5d5e42984430389977e Binary files /dev/null and b/alarm-clock-army/entry/src/main/resources/base/media/ic_second_pointer.png differ diff --git a/alarm-clock-army/entry/src/main/resources/base/media/icon.png b/alarm-clock-army/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/alarm-clock-army/entry/src/main/resources/base/media/icon.png differ diff --git a/alarm-clock-army/entry/src/main/resources/base/media/remove.png b/alarm-clock-army/entry/src/main/resources/base/media/remove.png new file mode 100644 index 0000000000000000000000000000000000000000..125884b9432ea7ff58505e0ea460ca72632c58b9 Binary files /dev/null and b/alarm-clock-army/entry/src/main/resources/base/media/remove.png differ diff --git a/alarm-clock-army/entry/src/main/resources/base/profile/main_pages.json b/alarm-clock-army/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..2ec1d513234bfb8bc4257e908322c70d4c95cf5d --- /dev/null +++ b/alarm-clock-army/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,6 @@ +{ + "src": [ + "pages/MainIndex", + "pages/DetailIndex" + ] +} diff --git a/alarm-clock-army/hvigor/hvigor-config.json5 b/alarm-clock-army/hvigor/hvigor-config.json5 new file mode 100644 index 0000000000000000000000000000000000000000..ec2a3ae0df3882488dc4c82e947a40f7eae1da15 --- /dev/null +++ b/alarm-clock-army/hvigor/hvigor-config.json5 @@ -0,0 +1,6 @@ +{ + "hvigorVersion": "2.4.2", + "dependencies": { + "@ohos/hvigor-ohos-plugin": "2.4.2" + } +} \ No newline at end of file diff --git a/alarm-clock-army/hvigor/hvigor-wrapper.js b/alarm-clock-army/hvigor/hvigor-wrapper.js new file mode 100644 index 0000000000000000000000000000000000000000..ed520df42d9190418c6ade156daa022ec8f43e21 --- /dev/null +++ b/alarm-clock-army/hvigor/hvigor-wrapper.js @@ -0,0 +1 @@ +"use strict";var u=require("fs"),e=require("path"),t=require("os"),r=require("crypto"),n=require("child_process"),i=require("constants"),o=require("stream"),D=require("util"),c=require("assert");function a(u){return u&&"object"==typeof u&&"default"in u?u:{default:u}}var s=a(u),f=a(e),E=a(t),l=a(r),F=a(n),C=a(i),A=a(o),d=a(D),y=a(c),p="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},h={},m={},B={},v=p&&p.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(B,"__esModule",{value:!0}),B.isMac=B.isLinux=B.isWindows=void 0;const S=v(E.default),_="Windows_NT",O="Linux",w="Darwin";B.isWindows=function(){return S.default.type()===_},B.isLinux=function(){return S.default.type()===O},B.isMac=function(){return S.default.type()===w};var P={},b=p&&p.__createBinding||(Object.create?function(u,e,t,r){void 0===r&&(r=t);var n=Object.getOwnPropertyDescriptor(e,t);n&&!("get"in n?!e.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(u,r,n)}:function(u,e,t,r){void 0===r&&(r=t),u[r]=e[t]}),g=p&&p.__setModuleDefault||(Object.create?function(u,e){Object.defineProperty(u,"default",{enumerable:!0,value:e})}:function(u,e){u.default=e}),N=p&&p.__importStar||function(u){if(u&&u.__esModule)return u;var e={};if(null!=u)for(var t in u)"default"!==t&&Object.prototype.hasOwnProperty.call(u,t)&&b(e,u,t);return g(e,u),e};Object.defineProperty(P,"__esModule",{value:!0}),P.hash=void 0;const R=N(l.default);P.hash=function(u,e="md5"){return R.createHash(e).update(u,"utf-8").digest("hex")},function(u){var e=p&&p.__createBinding||(Object.create?function(u,e,t,r){void 0===r&&(r=t);var n=Object.getOwnPropertyDescriptor(e,t);n&&!("get"in n?!e.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(u,r,n)}:function(u,e,t,r){void 0===r&&(r=t),u[r]=e[t]}),t=p&&p.__setModuleDefault||(Object.create?function(u,e){Object.defineProperty(u,"default",{enumerable:!0,value:e})}:function(u,e){u.default=e}),r=p&&p.__importStar||function(u){if(u&&u.__esModule)return u;var r={};if(null!=u)for(var n in u)"default"!==n&&Object.prototype.hasOwnProperty.call(u,n)&&e(r,u,n);return t(r,u),r};Object.defineProperty(u,"__esModule",{value:!0}),u.HVIGOR_PROJECT_DEPENDENCY_PACKAGE_JSON_PATH=u.HVIGOR_PROJECT_DEPENDENCIES_HOME=u.HVIGOR_PROJECT_WRAPPER_HOME=u.HVIGOR_PROJECT_NAME=u.HVIGOR_PROJECT_ROOT_DIR=u.HVIGOR_PROJECT_CACHES_HOME=u.HVIGOR_PNPM_STORE_PATH=u.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH=u.HVIGOR_WRAPPER_TOOLS_HOME=u.HVIGOR_USER_HOME=u.DEFAULT_PACKAGE_JSON=u.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME=u.NPM_TOOL=u.PNPM_TOOL=u.HVIGOR_ENGINE_PACKAGE_NAME=void 0;const n=r(f.default),i=r(E.default),o=B,D=P;u.HVIGOR_ENGINE_PACKAGE_NAME="@ohos/hvigor",u.PNPM_TOOL=(0,o.isWindows)()?"pnpm.cmd":"pnpm",u.NPM_TOOL=(0,o.isWindows)()?"npm.cmd":"npm",u.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME="hvigor-config.json5",u.DEFAULT_PACKAGE_JSON="package.json",u.HVIGOR_USER_HOME=n.resolve(i.homedir(),".hvigor"),u.HVIGOR_WRAPPER_TOOLS_HOME=n.resolve(u.HVIGOR_USER_HOME,"wrapper","tools"),u.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH=n.resolve(u.HVIGOR_WRAPPER_TOOLS_HOME,"node_modules",".bin",u.PNPM_TOOL),u.HVIGOR_PNPM_STORE_PATH=n.resolve(u.HVIGOR_USER_HOME,"caches"),u.HVIGOR_PROJECT_CACHES_HOME=n.resolve(u.HVIGOR_USER_HOME,"project_caches"),u.HVIGOR_PROJECT_ROOT_DIR=process.cwd(),u.HVIGOR_PROJECT_NAME=n.basename((0,D.hash)(u.HVIGOR_PROJECT_ROOT_DIR)),u.HVIGOR_PROJECT_WRAPPER_HOME=n.resolve(u.HVIGOR_PROJECT_ROOT_DIR,"hvigor"),u.HVIGOR_PROJECT_DEPENDENCIES_HOME=n.resolve(u.HVIGOR_PROJECT_CACHES_HOME,u.HVIGOR_PROJECT_NAME,"workspace"),u.HVIGOR_PROJECT_DEPENDENCY_PACKAGE_JSON_PATH=n.resolve(u.HVIGOR_PROJECT_DEPENDENCIES_HOME,u.DEFAULT_PACKAGE_JSON)}(m);var I={},k={};Object.defineProperty(k,"__esModule",{value:!0}),k.logErrorAndExit=void 0,k.logErrorAndExit=function(u){u instanceof Error?console.error(u.message):console.error(u),process.exit(-1)};var T=p&&p.__createBinding||(Object.create?function(u,e,t,r){void 0===r&&(r=t);var n=Object.getOwnPropertyDescriptor(e,t);n&&!("get"in n?!e.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(u,r,n)}:function(u,e,t,r){void 0===r&&(r=t),u[r]=e[t]}),x=p&&p.__setModuleDefault||(Object.create?function(u,e){Object.defineProperty(u,"default",{enumerable:!0,value:e})}:function(u,e){u.default=e}),M=p&&p.__importStar||function(u){if(u&&u.__esModule)return u;var e={};if(null!=u)for(var t in u)"default"!==t&&Object.prototype.hasOwnProperty.call(u,t)&&T(e,u,t);return x(e,u),e};Object.defineProperty(I,"__esModule",{value:!0}),I.executeCommand=I.getNpmPath=I.hasNpmPackInPaths=void 0;const H=F.default,j=M(f.default),J=m,L=k;I.hasNpmPackInPaths=function(u,e){try{return require.resolve(u,{paths:[...e]}),!0}catch(u){return!1}},I.getNpmPath=function(){const u=process.execPath;return j.join(j.dirname(u),J.NPM_TOOL)},I.executeCommand=function(u,e,t){0!==(0,H.spawnSync)(u,e,t).status&&(0,L.logErrorAndExit)(`Error: ${u} execute failed.See above for details.`)};var G=p&&p.__createBinding||(Object.create?function(u,e,t,r){void 0===r&&(r=t);var n=Object.getOwnPropertyDescriptor(e,t);n&&!("get"in n?!e.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(u,r,n)}:function(u,e,t,r){void 0===r&&(r=t),u[r]=e[t]}),V=p&&p.__setModuleDefault||(Object.create?function(u,e){Object.defineProperty(u,"default",{enumerable:!0,value:e})}:function(u,e){u.default=e}),$=p&&p.__importStar||function(u){if(u&&u.__esModule)return u;var e={};if(null!=u)for(var t in u)"default"!==t&&Object.prototype.hasOwnProperty.call(u,t)&&G(e,u,t);return V(e,u),e};Object.defineProperty(h,"__esModule",{value:!0});var U=h.executeInstallPnpm=Z=h.isPnpmAvailable=void 0;const W=$(s.default),q=m,K=I,Y=$(f.default),z=k;var Z=h.isPnpmAvailable=function(){return!!W.existsSync(q.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH)&&(0,K.hasNpmPackInPaths)("pnpm",[q.HVIGOR_WRAPPER_TOOLS_HOME])};U=h.executeInstallPnpm=function(){const u=(0,K.getNpmPath)();!function(){const u=Y.resolve(q.HVIGOR_WRAPPER_TOOLS_HOME,q.DEFAULT_PACKAGE_JSON);try{W.existsSync(q.HVIGOR_WRAPPER_TOOLS_HOME)||W.mkdirSync(q.HVIGOR_WRAPPER_TOOLS_HOME,{recursive:!0});const e={dependencies:{}};W.writeFileSync(u,JSON.stringify(e))}catch(e){(0,z.logErrorAndExit)(`Error: EPERM: operation not permitted,create ${u} failed.`)}}(),(0,K.executeCommand)(u,["install","pnpm"],{cwd:q.HVIGOR_WRAPPER_TOOLS_HOME,stdio:["inherit","inherit","inherit"]})};var X={},Q={},uu={},eu={};Object.defineProperty(eu,"__esModule",{value:!0}),eu.Unicode=void 0;class tu{}eu.Unicode=tu,tu.Space_Separator=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,tu.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]/,tu.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(uu,"__esModule",{value:!0}),uu.JudgeUtil=void 0;const ru=eu;uu.JudgeUtil=class{static isIgnoreChar(u){return"string"==typeof u&&("\t"===u||"\v"===u||"\f"===u||" "===u||" "===u||"\ufeff"===u||"\n"===u||"\r"===u||"\u2028"===u||"\u2029"===u)}static isSpaceSeparator(u){return"string"==typeof u&&ru.Unicode.Space_Separator.test(u)}static isIdStartChar(u){return"string"==typeof u&&(u>="a"&&u<="z"||u>="A"&&u<="Z"||"$"===u||"_"===u||ru.Unicode.ID_Start.test(u))}static isIdContinueChar(u){return"string"==typeof u&&(u>="a"&&u<="z"||u>="A"&&u<="Z"||u>="0"&&u<="9"||"$"===u||"_"===u||"‌"===u||"‍"===u||ru.Unicode.ID_Continue.test(u))}static isDigitWithoutZero(u){return/[1-9]/.test(u)}static isDigit(u){return"string"==typeof u&&/[0-9]/.test(u)}static isHexDigit(u){return"string"==typeof u&&/[0-9A-Fa-f]/.test(u)}};var nu={},iu={fromCallback:function(u){return Object.defineProperty((function(...e){if("function"!=typeof e[e.length-1])return new Promise(((t,r)=>{u.call(this,...e,((u,e)=>null!=u?r(u):t(e)))}));u.apply(this,e)}),"name",{value:u.name})},fromPromise:function(u){return Object.defineProperty((function(...e){const t=e[e.length-1];if("function"!=typeof t)return u.apply(this,e);u.apply(this,e.slice(0,-1)).then((u=>t(null,u)),t)}),"name",{value:u.name})}},ou=C.default,Du=process.cwd,cu=null,au=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return cu||(cu=Du.call(process)),cu};try{process.cwd()}catch(u){}if("function"==typeof process.chdir){var su=process.chdir;process.chdir=function(u){cu=null,su.call(process,u)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,su)}var fu=function(u){ou.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&function(u){u.lchmod=function(e,t,r){u.open(e,ou.O_WRONLY|ou.O_SYMLINK,t,(function(e,n){e?r&&r(e):u.fchmod(n,t,(function(e){u.close(n,(function(u){r&&r(e||u)}))}))}))},u.lchmodSync=function(e,t){var r,n=u.openSync(e,ou.O_WRONLY|ou.O_SYMLINK,t),i=!0;try{r=u.fchmodSync(n,t),i=!1}finally{if(i)try{u.closeSync(n)}catch(u){}else u.closeSync(n)}return r}}(u);u.lutimes||function(u){ou.hasOwnProperty("O_SYMLINK")&&u.futimes?(u.lutimes=function(e,t,r,n){u.open(e,ou.O_SYMLINK,(function(e,i){e?n&&n(e):u.futimes(i,t,r,(function(e){u.close(i,(function(u){n&&n(e||u)}))}))}))},u.lutimesSync=function(e,t,r){var n,i=u.openSync(e,ou.O_SYMLINK),o=!0;try{n=u.futimesSync(i,t,r),o=!1}finally{if(o)try{u.closeSync(i)}catch(u){}else u.closeSync(i)}return n}):u.futimes&&(u.lutimes=function(u,e,t,r){r&&process.nextTick(r)},u.lutimesSync=function(){})}(u);u.chown=r(u.chown),u.fchown=r(u.fchown),u.lchown=r(u.lchown),u.chmod=e(u.chmod),u.fchmod=e(u.fchmod),u.lchmod=e(u.lchmod),u.chownSync=n(u.chownSync),u.fchownSync=n(u.fchownSync),u.lchownSync=n(u.lchownSync),u.chmodSync=t(u.chmodSync),u.fchmodSync=t(u.fchmodSync),u.lchmodSync=t(u.lchmodSync),u.stat=i(u.stat),u.fstat=i(u.fstat),u.lstat=i(u.lstat),u.statSync=o(u.statSync),u.fstatSync=o(u.fstatSync),u.lstatSync=o(u.lstatSync),u.chmod&&!u.lchmod&&(u.lchmod=function(u,e,t){t&&process.nextTick(t)},u.lchmodSync=function(){});u.chown&&!u.lchown&&(u.lchown=function(u,e,t,r){r&&process.nextTick(r)},u.lchownSync=function(){});"win32"===au&&(u.rename="function"!=typeof u.rename?u.rename:function(e){function t(t,r,n){var i=Date.now(),o=0;e(t,r,(function D(c){if(c&&("EACCES"===c.code||"EPERM"===c.code)&&Date.now()-i<6e4)return setTimeout((function(){u.stat(r,(function(u,i){u&&"ENOENT"===u.code?e(t,r,D):n(c)}))}),o),void(o<100&&(o+=10));n&&n(c)}))}return Object.setPrototypeOf&&Object.setPrototypeOf(t,e),t}(u.rename));function e(e){return e?function(t,r,n){return e.call(u,t,r,(function(u){D(u)&&(u=null),n&&n.apply(this,arguments)}))}:e}function t(e){return e?function(t,r){try{return e.call(u,t,r)}catch(u){if(!D(u))throw u}}:e}function r(e){return e?function(t,r,n,i){return e.call(u,t,r,n,(function(u){D(u)&&(u=null),i&&i.apply(this,arguments)}))}:e}function n(e){return e?function(t,r,n){try{return e.call(u,t,r,n)}catch(u){if(!D(u))throw u}}:e}function i(e){return e?function(t,r,n){function i(u,e){e&&(e.uid<0&&(e.uid+=4294967296),e.gid<0&&(e.gid+=4294967296)),n&&n.apply(this,arguments)}return"function"==typeof r&&(n=r,r=null),r?e.call(u,t,r,i):e.call(u,t,i)}:e}function o(e){return e?function(t,r){var n=r?e.call(u,t,r):e.call(u,t);return n&&(n.uid<0&&(n.uid+=4294967296),n.gid<0&&(n.gid+=4294967296)),n}:e}function D(u){return!u||("ENOSYS"===u.code||!(process.getuid&&0===process.getuid()||"EINVAL"!==u.code&&"EPERM"!==u.code))}u.read="function"!=typeof u.read?u.read:function(e){function t(t,r,n,i,o,D){var c;if(D&&"function"==typeof D){var a=0;c=function(s,f,E){if(s&&"EAGAIN"===s.code&&a<10)return a++,e.call(u,t,r,n,i,o,c);D.apply(this,arguments)}}return e.call(u,t,r,n,i,o,c)}return Object.setPrototypeOf&&Object.setPrototypeOf(t,e),t}(u.read),u.readSync="function"!=typeof u.readSync?u.readSync:(c=u.readSync,function(e,t,r,n,i){for(var o=0;;)try{return c.call(u,e,t,r,n,i)}catch(u){if("EAGAIN"===u.code&&o<10){o++;continue}throw u}});var c};var Eu=A.default.Stream,lu=function(u){return{ReadStream:function e(t,r){if(!(this instanceof e))return new e(t,r);Eu.call(this);var n=this;this.path=t,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,r=r||{};for(var i=Object.keys(r),o=0,D=i.length;othis.end)throw new Error("start must be <= end");this.pos=this.start}if(null!==this.fd)return void process.nextTick((function(){n._read()}));u.open(this.path,this.flags,this.mode,(function(u,e){if(u)return n.emit("error",u),void(n.readable=!1);n.fd=e,n.emit("open",e),n._read()}))},WriteStream:function e(t,r){if(!(this instanceof e))return new e(t,r);Eu.call(this),this.path=t,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,r=r||{};for(var n=Object.keys(r),i=0,o=n.length;i= zero");this.pos=this.start}this.busy=!1,this._queue=[],null===this.fd&&(this._open=u.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}};var Fu=function(u){if(null===u||"object"!=typeof u)return u;if(u instanceof Object)var e={__proto__:Cu(u)};else e=Object.create(null);return Object.getOwnPropertyNames(u).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(u,t))})),e},Cu=Object.getPrototypeOf||function(u){return u.__proto__};var Au,du,yu=s.default,pu=fu,hu=lu,mu=Fu,Bu=d.default;function vu(u,e){Object.defineProperty(u,Au,{get:function(){return e}})}"function"==typeof Symbol&&"function"==typeof Symbol.for?(Au=Symbol.for("graceful-fs.queue"),du=Symbol.for("graceful-fs.previous")):(Au="___graceful-fs.queue",du="___graceful-fs.previous");var Su=function(){};if(Bu.debuglog?Su=Bu.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(Su=function(){var u=Bu.format.apply(Bu,arguments);u="GFS4: "+u.split(/\n/).join("\nGFS4: "),console.error(u)}),!yu[Au]){var _u=p[Au]||[];vu(yu,_u),yu.close=function(u){function e(e,t){return u.call(yu,e,(function(u){u||gu(),"function"==typeof t&&t.apply(this,arguments)}))}return Object.defineProperty(e,du,{value:u}),e}(yu.close),yu.closeSync=function(u){function e(e){u.apply(yu,arguments),gu()}return Object.defineProperty(e,du,{value:u}),e}(yu.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",(function(){Su(yu[Au]),y.default.equal(yu[Au].length,0)}))}p[Au]||vu(p,yu[Au]);var Ou,wu=Pu(mu(yu));function Pu(u){pu(u),u.gracefulify=Pu,u.createReadStream=function(e,t){return new u.ReadStream(e,t)},u.createWriteStream=function(e,t){return new u.WriteStream(e,t)};var e=u.readFile;u.readFile=function(u,t,r){"function"==typeof t&&(r=t,t=null);return function u(t,r,n,i){return e(t,r,(function(e){!e||"EMFILE"!==e.code&&"ENFILE"!==e.code?"function"==typeof n&&n.apply(this,arguments):bu([u,[t,r,n],e,i||Date.now(),Date.now()])}))}(u,t,r)};var t=u.writeFile;u.writeFile=function(u,e,r,n){"function"==typeof r&&(n=r,r=null);return function u(e,r,n,i,o){return t(e,r,n,(function(t){!t||"EMFILE"!==t.code&&"ENFILE"!==t.code?"function"==typeof i&&i.apply(this,arguments):bu([u,[e,r,n,i],t,o||Date.now(),Date.now()])}))}(u,e,r,n)};var r=u.appendFile;r&&(u.appendFile=function(u,e,t,n){"function"==typeof t&&(n=t,t=null);return function u(e,t,n,i,o){return r(e,t,n,(function(r){!r||"EMFILE"!==r.code&&"ENFILE"!==r.code?"function"==typeof i&&i.apply(this,arguments):bu([u,[e,t,n,i],r,o||Date.now(),Date.now()])}))}(u,e,t,n)});var n=u.copyFile;n&&(u.copyFile=function(u,e,t,r){"function"==typeof t&&(r=t,t=0);return function u(e,t,r,i,o){return n(e,t,r,(function(n){!n||"EMFILE"!==n.code&&"ENFILE"!==n.code?"function"==typeof i&&i.apply(this,arguments):bu([u,[e,t,r,i],n,o||Date.now(),Date.now()])}))}(u,e,t,r)});var i=u.readdir;u.readdir=function(u,e,t){"function"==typeof e&&(t=e,e=null);var r=o.test(process.version)?function(u,e,t,r){return i(u,n(u,e,t,r))}:function(u,e,t,r){return i(u,e,n(u,e,t,r))};return r(u,e,t);function n(u,e,t,n){return function(i,o){!i||"EMFILE"!==i.code&&"ENFILE"!==i.code?(o&&o.sort&&o.sort(),"function"==typeof t&&t.call(this,i,o)):bu([r,[u,e,t],i,n||Date.now(),Date.now()])}}};var o=/^v[0-5]\./;if("v0.8"===process.version.substr(0,4)){var D=hu(u);E=D.ReadStream,l=D.WriteStream}var c=u.ReadStream;c&&(E.prototype=Object.create(c.prototype),E.prototype.open=function(){var u=this;C(u.path,u.flags,u.mode,(function(e,t){e?(u.autoClose&&u.destroy(),u.emit("error",e)):(u.fd=t,u.emit("open",t),u.read())}))});var a=u.WriteStream;a&&(l.prototype=Object.create(a.prototype),l.prototype.open=function(){var u=this;C(u.path,u.flags,u.mode,(function(e,t){e?(u.destroy(),u.emit("error",e)):(u.fd=t,u.emit("open",t))}))}),Object.defineProperty(u,"ReadStream",{get:function(){return E},set:function(u){E=u},enumerable:!0,configurable:!0}),Object.defineProperty(u,"WriteStream",{get:function(){return l},set:function(u){l=u},enumerable:!0,configurable:!0});var s=E;Object.defineProperty(u,"FileReadStream",{get:function(){return s},set:function(u){s=u},enumerable:!0,configurable:!0});var f=l;function E(u,e){return this instanceof E?(c.apply(this,arguments),this):E.apply(Object.create(E.prototype),arguments)}function l(u,e){return this instanceof l?(a.apply(this,arguments),this):l.apply(Object.create(l.prototype),arguments)}Object.defineProperty(u,"FileWriteStream",{get:function(){return f},set:function(u){f=u},enumerable:!0,configurable:!0});var F=u.open;function C(u,e,t,r){return"function"==typeof t&&(r=t,t=null),function u(e,t,r,n,i){return F(e,t,r,(function(o,D){!o||"EMFILE"!==o.code&&"ENFILE"!==o.code?"function"==typeof n&&n.apply(this,arguments):bu([u,[e,t,r,n],o,i||Date.now(),Date.now()])}))}(u,e,t,r)}return u.open=C,u}function bu(u){Su("ENQUEUE",u[0].name,u[1]),yu[Au].push(u),Nu()}function gu(){for(var u=Date.now(),e=0;e2&&(yu[Au][e][3]=u,yu[Au][e][4]=u);Nu()}function Nu(){if(clearTimeout(Ou),Ou=void 0,0!==yu[Au].length){var u=yu[Au].shift(),e=u[0],t=u[1],r=u[2],n=u[3],i=u[4];if(void 0===n)Su("RETRY",e.name,t),e.apply(null,t);else if(Date.now()-n>=6e4){Su("TIMEOUT",e.name,t);var o=t.pop();"function"==typeof o&&o.call(null,r)}else{var D=Date.now()-i,c=Math.max(i-n,1);D>=Math.min(1.2*c,100)?(Su("RETRY",e.name,t),e.apply(null,t.concat([n]))):yu[Au].push(u)}void 0===Ou&&(Ou=setTimeout(Nu,0))}}process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!yu.__patched&&(wu=Pu(yu),yu.__patched=!0),function(u){const e=iu.fromCallback,t=wu,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((u=>"function"==typeof t[u]));Object.assign(u,t),r.forEach((r=>{u[r]=e(t[r])})),u.exists=function(u,e){return"function"==typeof e?t.exists(u,e):new Promise((e=>t.exists(u,e)))},u.read=function(u,e,r,n,i,o){return"function"==typeof o?t.read(u,e,r,n,i,o):new Promise(((o,D)=>{t.read(u,e,r,n,i,((u,e,t)=>{if(u)return D(u);o({bytesRead:e,buffer:t})}))}))},u.write=function(u,e,...r){return"function"==typeof r[r.length-1]?t.write(u,e,...r):new Promise(((n,i)=>{t.write(u,e,...r,((u,e,t)=>{if(u)return i(u);n({bytesWritten:e,buffer:t})}))}))},"function"==typeof t.writev&&(u.writev=function(u,e,...r){return"function"==typeof r[r.length-1]?t.writev(u,e,...r):new Promise(((n,i)=>{t.writev(u,e,...r,((u,e,t)=>{if(u)return i(u);n({bytesWritten:e,buffers:t})}))}))}),"function"==typeof t.realpath.native?u.realpath.native=e(t.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")}(nu);var Ru={},Iu={};const ku=f.default;Iu.checkPath=function(u){if("win32"===process.platform){if(/[<>:"|?*]/.test(u.replace(ku.parse(u).root,""))){const e=new Error(`Path contains invalid characters: ${u}`);throw e.code="EINVAL",e}}};const Tu=nu,{checkPath:xu}=Iu,Mu=u=>"number"==typeof u?u:{mode:511,...u}.mode;Ru.makeDir=async(u,e)=>(xu(u),Tu.mkdir(u,{mode:Mu(e),recursive:!0})),Ru.makeDirSync=(u,e)=>(xu(u),Tu.mkdirSync(u,{mode:Mu(e),recursive:!0}));const Hu=iu.fromPromise,{makeDir:ju,makeDirSync:Ju}=Ru,Lu=Hu(ju);var Gu={mkdirs:Lu,mkdirsSync:Ju,mkdirp:Lu,mkdirpSync:Ju,ensureDir:Lu,ensureDirSync:Ju};const Vu=iu.fromPromise,$u=nu;var Uu={pathExists:Vu((function(u){return $u.access(u).then((()=>!0)).catch((()=>!1))})),pathExistsSync:$u.existsSync};const Wu=wu;var qu=function(u,e,t,r){Wu.open(u,"r+",((u,n)=>{if(u)return r(u);Wu.futimes(n,e,t,(u=>{Wu.close(n,(e=>{r&&r(u||e)}))}))}))},Ku=function(u,e,t){const r=Wu.openSync(u,"r+");return Wu.futimesSync(r,e,t),Wu.closeSync(r)};const Yu=nu,zu=f.default,Zu=d.default;function Xu(u,e,t){const r=t.dereference?u=>Yu.stat(u,{bigint:!0}):u=>Yu.lstat(u,{bigint:!0});return Promise.all([r(u),r(e).catch((u=>{if("ENOENT"===u.code)return null;throw u}))]).then((([u,e])=>({srcStat:u,destStat:e})))}function Qu(u,e){return e.ino&&e.dev&&e.ino===u.ino&&e.dev===u.dev}function ue(u,e){const t=zu.resolve(u).split(zu.sep).filter((u=>u)),r=zu.resolve(e).split(zu.sep).filter((u=>u));return t.reduce(((u,e,t)=>u&&r[t]===e),!0)}function ee(u,e,t){return`Cannot ${t} '${u}' to a subdirectory of itself, '${e}'.`}var te={checkPaths:function(u,e,t,r,n){Zu.callbackify(Xu)(u,e,r,((r,i)=>{if(r)return n(r);const{srcStat:o,destStat:D}=i;if(D){if(Qu(o,D)){const r=zu.basename(u),i=zu.basename(e);return"move"===t&&r!==i&&r.toLowerCase()===i.toLowerCase()?n(null,{srcStat:o,destStat:D,isChangingCase:!0}):n(new Error("Source and destination must not be the same."))}if(o.isDirectory()&&!D.isDirectory())return n(new Error(`Cannot overwrite non-directory '${e}' with directory '${u}'.`));if(!o.isDirectory()&&D.isDirectory())return n(new Error(`Cannot overwrite directory '${e}' with non-directory '${u}'.`))}return o.isDirectory()&&ue(u,e)?n(new Error(ee(u,e,t))):n(null,{srcStat:o,destStat:D})}))},checkPathsSync:function(u,e,t,r){const{srcStat:n,destStat:i}=function(u,e,t){let r;const n=t.dereference?u=>Yu.statSync(u,{bigint:!0}):u=>Yu.lstatSync(u,{bigint:!0}),i=n(u);try{r=n(e)}catch(u){if("ENOENT"===u.code)return{srcStat:i,destStat:null};throw u}return{srcStat:i,destStat:r}}(u,e,r);if(i){if(Qu(n,i)){const r=zu.basename(u),o=zu.basename(e);if("move"===t&&r!==o&&r.toLowerCase()===o.toLowerCase())return{srcStat:n,destStat:i,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(n.isDirectory()&&!i.isDirectory())throw new Error(`Cannot overwrite non-directory '${e}' with directory '${u}'.`);if(!n.isDirectory()&&i.isDirectory())throw new Error(`Cannot overwrite directory '${e}' with non-directory '${u}'.`)}if(n.isDirectory()&&ue(u,e))throw new Error(ee(u,e,t));return{srcStat:n,destStat:i}},checkParentPaths:function u(e,t,r,n,i){const o=zu.resolve(zu.dirname(e)),D=zu.resolve(zu.dirname(r));if(D===o||D===zu.parse(D).root)return i();Yu.stat(D,{bigint:!0},((o,c)=>o?"ENOENT"===o.code?i():i(o):Qu(t,c)?i(new Error(ee(e,r,n))):u(e,t,D,n,i)))},checkParentPathsSync:function u(e,t,r,n){const i=zu.resolve(zu.dirname(e)),o=zu.resolve(zu.dirname(r));if(o===i||o===zu.parse(o).root)return;let D;try{D=Yu.statSync(o,{bigint:!0})}catch(u){if("ENOENT"===u.code)return;throw u}if(Qu(t,D))throw new Error(ee(e,r,n));return u(e,t,o,n)},isSrcSubdir:ue,areIdentical:Qu};const re=wu,ne=f.default,ie=Gu.mkdirs,oe=Uu.pathExists,De=qu,ce=te;function ae(u,e,t,r,n){const i=ne.dirname(t);oe(i,((o,D)=>o?n(o):D?fe(u,e,t,r,n):void ie(i,(i=>i?n(i):fe(u,e,t,r,n)))))}function se(u,e,t,r,n,i){Promise.resolve(n.filter(t,r)).then((o=>o?u(e,t,r,n,i):i()),(u=>i(u)))}function fe(u,e,t,r,n){(r.dereference?re.stat:re.lstat)(e,((i,o)=>i?n(i):o.isDirectory()?function(u,e,t,r,n,i){return e?Ce(t,r,n,i):function(u,e,t,r,n){re.mkdir(t,(i=>{if(i)return n(i);Ce(e,t,r,(e=>e?n(e):Fe(t,u,n)))}))}(u.mode,t,r,n,i)}(o,u,e,t,r,n):o.isFile()||o.isCharacterDevice()||o.isBlockDevice()?function(u,e,t,r,n,i){return e?function(u,e,t,r,n){if(!r.overwrite)return r.errorOnExist?n(new Error(`'${t}' already exists`)):n();re.unlink(t,(i=>i?n(i):Ee(u,e,t,r,n)))}(u,t,r,n,i):Ee(u,t,r,n,i)}(o,u,e,t,r,n):o.isSymbolicLink()?function(u,e,t,r,n){re.readlink(e,((e,i)=>e?n(e):(r.dereference&&(i=ne.resolve(process.cwd(),i)),u?void re.readlink(t,((e,o)=>e?"EINVAL"===e.code||"UNKNOWN"===e.code?re.symlink(i,t,n):n(e):(r.dereference&&(o=ne.resolve(process.cwd(),o)),ce.isSrcSubdir(i,o)?n(new Error(`Cannot copy '${i}' to a subdirectory of itself, '${o}'.`)):u.isDirectory()&&ce.isSrcSubdir(o,i)?n(new Error(`Cannot overwrite '${o}' with '${i}'.`)):function(u,e,t){re.unlink(e,(r=>r?t(r):re.symlink(u,e,t)))}(i,t,n)))):re.symlink(i,t,n))))}(u,e,t,r,n):o.isSocket()?n(new Error(`Cannot copy a socket file: ${e}`)):o.isFIFO()?n(new Error(`Cannot copy a FIFO pipe: ${e}`)):n(new Error(`Unknown file: ${e}`))))}function Ee(u,e,t,r,n){re.copyFile(e,t,(i=>i?n(i):r.preserveTimestamps?function(u,e,t,r){if(function(u){return 0==(128&u)}(u))return function(u,e,t){return Fe(u,128|e,t)}(t,u,(n=>n?r(n):le(u,e,t,r)));return le(u,e,t,r)}(u.mode,e,t,n):Fe(t,u.mode,n)))}function le(u,e,t,r){!function(u,e,t){re.stat(u,((u,r)=>u?t(u):De(e,r.atime,r.mtime,t)))}(e,t,(e=>e?r(e):Fe(t,u,r)))}function Fe(u,e,t){return re.chmod(u,e,t)}function Ce(u,e,t,r){re.readdir(u,((n,i)=>n?r(n):Ae(i,u,e,t,r)))}function Ae(u,e,t,r,n){const i=u.pop();return i?function(u,e,t,r,n,i){const o=ne.join(t,e),D=ne.join(r,e);ce.checkPaths(o,D,"copy",n,((e,c)=>{if(e)return i(e);const{destStat:a}=c;!function(u,e,t,r,n){r.filter?se(fe,u,e,t,r,n):fe(u,e,t,r,n)}(a,o,D,n,(e=>e?i(e):Ae(u,t,r,n,i)))}))}(u,i,e,t,r,n):n()}var de=function(u,e,t,r){"function"!=typeof t||r?"function"==typeof t&&(t={filter:t}):(r=t,t={}),r=r||function(){},(t=t||{}).clobber=!("clobber"in t)||!!t.clobber,t.overwrite="overwrite"in t?!!t.overwrite:t.clobber,t.preserveTimestamps&&"ia32"===process.arch&&process.emitWarning("Using the preserveTimestamps option in 32-bit node is not recommended;\n\n\tsee https://github.com/jprichardson/node-fs-extra/issues/269","Warning","fs-extra-WARN0001"),ce.checkPaths(u,e,"copy",t,((n,i)=>{if(n)return r(n);const{srcStat:o,destStat:D}=i;ce.checkParentPaths(u,o,e,"copy",(n=>n?r(n):t.filter?se(ae,D,u,e,t,r):ae(D,u,e,t,r)))}))};const ye=wu,pe=f.default,he=Gu.mkdirsSync,me=Ku,Be=te;function ve(u,e,t,r){const n=(r.dereference?ye.statSync:ye.lstatSync)(e);if(n.isDirectory())return function(u,e,t,r,n){return e?Oe(t,r,n):function(u,e,t,r){return ye.mkdirSync(t),Oe(e,t,r),_e(t,u)}(u.mode,t,r,n)}(n,u,e,t,r);if(n.isFile()||n.isCharacterDevice()||n.isBlockDevice())return function(u,e,t,r,n){return e?function(u,e,t,r){if(r.overwrite)return ye.unlinkSync(t),Se(u,e,t,r);if(r.errorOnExist)throw new Error(`'${t}' already exists`)}(u,t,r,n):Se(u,t,r,n)}(n,u,e,t,r);if(n.isSymbolicLink())return function(u,e,t,r){let n=ye.readlinkSync(e);r.dereference&&(n=pe.resolve(process.cwd(),n));if(u){let u;try{u=ye.readlinkSync(t)}catch(u){if("EINVAL"===u.code||"UNKNOWN"===u.code)return ye.symlinkSync(n,t);throw u}if(r.dereference&&(u=pe.resolve(process.cwd(),u)),Be.isSrcSubdir(n,u))throw new Error(`Cannot copy '${n}' to a subdirectory of itself, '${u}'.`);if(ye.statSync(t).isDirectory()&&Be.isSrcSubdir(u,n))throw new Error(`Cannot overwrite '${u}' with '${n}'.`);return function(u,e){return ye.unlinkSync(e),ye.symlinkSync(u,e)}(n,t)}return ye.symlinkSync(n,t)}(u,e,t,r);if(n.isSocket())throw new Error(`Cannot copy a socket file: ${e}`);if(n.isFIFO())throw new Error(`Cannot copy a FIFO pipe: ${e}`);throw new Error(`Unknown file: ${e}`)}function Se(u,e,t,r){return ye.copyFileSync(e,t),r.preserveTimestamps&&function(u,e,t){(function(u){return 0==(128&u)})(u)&&function(u,e){_e(u,128|e)}(t,u);(function(u,e){const t=ye.statSync(u);me(e,t.atime,t.mtime)})(e,t)}(u.mode,e,t),_e(t,u.mode)}function _e(u,e){return ye.chmodSync(u,e)}function Oe(u,e,t){ye.readdirSync(u).forEach((r=>function(u,e,t,r){const n=pe.join(e,u),i=pe.join(t,u),{destStat:o}=Be.checkPathsSync(n,i,"copy",r);return function(u,e,t,r){if(!r.filter||r.filter(e,t))return ve(u,e,t,r)}(o,n,i,r)}(r,u,e,t)))}var we=function(u,e,t){"function"==typeof t&&(t={filter:t}),(t=t||{}).clobber=!("clobber"in t)||!!t.clobber,t.overwrite="overwrite"in t?!!t.overwrite:t.clobber,t.preserveTimestamps&&"ia32"===process.arch&&process.emitWarning("Using the preserveTimestamps option in 32-bit node is not recommended;\n\n\tsee https://github.com/jprichardson/node-fs-extra/issues/269","Warning","fs-extra-WARN0002");const{srcStat:r,destStat:n}=Be.checkPathsSync(u,e,"copy",t);return Be.checkParentPathsSync(u,r,e,"copy"),function(u,e,t,r){if(r.filter&&!r.filter(e,t))return;const n=pe.dirname(t);ye.existsSync(n)||he(n);return ve(u,e,t,r)}(n,u,e,t)};var Pe={copy:(0,iu.fromCallback)(de),copySync:we};const be=wu,ge=f.default,Ne=y.default,Re="win32"===process.platform;function Ie(u){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach((e=>{u[e]=u[e]||be[e],u[e+="Sync"]=u[e]||be[e]})),u.maxBusyTries=u.maxBusyTries||3}function ke(u,e,t){let r=0;"function"==typeof e&&(t=e,e={}),Ne(u,"rimraf: missing path"),Ne.strictEqual(typeof u,"string","rimraf: path should be a string"),Ne.strictEqual(typeof t,"function","rimraf: callback function required"),Ne(e,"rimraf: invalid options argument provided"),Ne.strictEqual(typeof e,"object","rimraf: options should be object"),Ie(e),Te(u,e,(function n(i){if(i){if(("EBUSY"===i.code||"ENOTEMPTY"===i.code||"EPERM"===i.code)&&rTe(u,e,n)),100*r)}"ENOENT"===i.code&&(i=null)}t(i)}))}function Te(u,e,t){Ne(u),Ne(e),Ne("function"==typeof t),e.lstat(u,((r,n)=>r&&"ENOENT"===r.code?t(null):r&&"EPERM"===r.code&&Re?xe(u,e,r,t):n&&n.isDirectory()?He(u,e,r,t):void e.unlink(u,(r=>{if(r){if("ENOENT"===r.code)return t(null);if("EPERM"===r.code)return Re?xe(u,e,r,t):He(u,e,r,t);if("EISDIR"===r.code)return He(u,e,r,t)}return t(r)}))))}function xe(u,e,t,r){Ne(u),Ne(e),Ne("function"==typeof r),e.chmod(u,438,(n=>{n?r("ENOENT"===n.code?null:t):e.stat(u,((n,i)=>{n?r("ENOENT"===n.code?null:t):i.isDirectory()?He(u,e,t,r):e.unlink(u,r)}))}))}function Me(u,e,t){let r;Ne(u),Ne(e);try{e.chmodSync(u,438)}catch(u){if("ENOENT"===u.code)return;throw t}try{r=e.statSync(u)}catch(u){if("ENOENT"===u.code)return;throw t}r.isDirectory()?Je(u,e,t):e.unlinkSync(u)}function He(u,e,t,r){Ne(u),Ne(e),Ne("function"==typeof r),e.rmdir(u,(n=>{!n||"ENOTEMPTY"!==n.code&&"EEXIST"!==n.code&&"EPERM"!==n.code?n&&"ENOTDIR"===n.code?r(t):r(n):function(u,e,t){Ne(u),Ne(e),Ne("function"==typeof t),e.readdir(u,((r,n)=>{if(r)return t(r);let i,o=n.length;if(0===o)return e.rmdir(u,t);n.forEach((r=>{ke(ge.join(u,r),e,(r=>{if(!i)return r?t(i=r):void(0==--o&&e.rmdir(u,t))}))}))}))}(u,e,r)}))}function je(u,e){let t;Ie(e=e||{}),Ne(u,"rimraf: missing path"),Ne.strictEqual(typeof u,"string","rimraf: path should be a string"),Ne(e,"rimraf: missing options"),Ne.strictEqual(typeof e,"object","rimraf: options should be object");try{t=e.lstatSync(u)}catch(t){if("ENOENT"===t.code)return;"EPERM"===t.code&&Re&&Me(u,e,t)}try{t&&t.isDirectory()?Je(u,e,null):e.unlinkSync(u)}catch(t){if("ENOENT"===t.code)return;if("EPERM"===t.code)return Re?Me(u,e,t):Je(u,e,t);if("EISDIR"!==t.code)throw t;Je(u,e,t)}}function Je(u,e,t){Ne(u),Ne(e);try{e.rmdirSync(u)}catch(r){if("ENOTDIR"===r.code)throw t;if("ENOTEMPTY"===r.code||"EEXIST"===r.code||"EPERM"===r.code)!function(u,e){if(Ne(u),Ne(e),e.readdirSync(u).forEach((t=>je(ge.join(u,t),e))),!Re){return e.rmdirSync(u,e)}{const t=Date.now();do{try{return e.rmdirSync(u,e)}catch{}}while(Date.now()-t<500)}}(u,e);else if("ENOENT"!==r.code)throw r}}var Le=ke;ke.sync=je;const Ge=wu,Ve=iu.fromCallback,$e=Le;var Ue={remove:Ve((function(u,e){if(Ge.rm)return Ge.rm(u,{recursive:!0,force:!0},e);$e(u,e)})),removeSync:function(u){if(Ge.rmSync)return Ge.rmSync(u,{recursive:!0,force:!0});$e.sync(u)}};const We=iu.fromPromise,qe=nu,Ke=f.default,Ye=Gu,ze=Ue,Ze=We((async function(u){let e;try{e=await qe.readdir(u)}catch{return Ye.mkdirs(u)}return Promise.all(e.map((e=>ze.remove(Ke.join(u,e)))))}));function Xe(u){let e;try{e=qe.readdirSync(u)}catch{return Ye.mkdirsSync(u)}e.forEach((e=>{e=Ke.join(u,e),ze.removeSync(e)}))}var Qe={emptyDirSync:Xe,emptydirSync:Xe,emptyDir:Ze,emptydir:Ze};const ut=iu.fromCallback,et=f.default,tt=wu,rt=Gu;var nt={createFile:ut((function(u,e){function t(){tt.writeFile(u,"",(u=>{if(u)return e(u);e()}))}tt.stat(u,((r,n)=>{if(!r&&n.isFile())return e();const i=et.dirname(u);tt.stat(i,((u,r)=>{if(u)return"ENOENT"===u.code?rt.mkdirs(i,(u=>{if(u)return e(u);t()})):e(u);r.isDirectory()?t():tt.readdir(i,(u=>{if(u)return e(u)}))}))}))})),createFileSync:function(u){let e;try{e=tt.statSync(u)}catch{}if(e&&e.isFile())return;const t=et.dirname(u);try{tt.statSync(t).isDirectory()||tt.readdirSync(t)}catch(u){if(!u||"ENOENT"!==u.code)throw u;rt.mkdirsSync(t)}tt.writeFileSync(u,"")}};const it=iu.fromCallback,ot=f.default,Dt=wu,ct=Gu,at=Uu.pathExists,{areIdentical:st}=te;var ft={createLink:it((function(u,e,t){function r(u,e){Dt.link(u,e,(u=>{if(u)return t(u);t(null)}))}Dt.lstat(e,((n,i)=>{Dt.lstat(u,((n,o)=>{if(n)return n.message=n.message.replace("lstat","ensureLink"),t(n);if(i&&st(o,i))return t(null);const D=ot.dirname(e);at(D,((n,i)=>n?t(n):i?r(u,e):void ct.mkdirs(D,(n=>{if(n)return t(n);r(u,e)}))))}))}))})),createLinkSync:function(u,e){let t;try{t=Dt.lstatSync(e)}catch{}try{const e=Dt.lstatSync(u);if(t&&st(e,t))return}catch(u){throw u.message=u.message.replace("lstat","ensureLink"),u}const r=ot.dirname(e);return Dt.existsSync(r)||ct.mkdirsSync(r),Dt.linkSync(u,e)}};const Et=f.default,lt=wu,Ft=Uu.pathExists;var Ct={symlinkPaths:function(u,e,t){if(Et.isAbsolute(u))return lt.lstat(u,(e=>e?(e.message=e.message.replace("lstat","ensureSymlink"),t(e)):t(null,{toCwd:u,toDst:u})));{const r=Et.dirname(e),n=Et.join(r,u);return Ft(n,((e,i)=>e?t(e):i?t(null,{toCwd:n,toDst:u}):lt.lstat(u,(e=>e?(e.message=e.message.replace("lstat","ensureSymlink"),t(e)):t(null,{toCwd:u,toDst:Et.relative(r,u)})))))}},symlinkPathsSync:function(u,e){let t;if(Et.isAbsolute(u)){if(t=lt.existsSync(u),!t)throw new Error("absolute srcpath does not exist");return{toCwd:u,toDst:u}}{const r=Et.dirname(e),n=Et.join(r,u);if(t=lt.existsSync(n),t)return{toCwd:n,toDst:u};if(t=lt.existsSync(u),!t)throw new Error("relative srcpath does not exist");return{toCwd:u,toDst:Et.relative(r,u)}}}};const At=wu;var dt={symlinkType:function(u,e,t){if(t="function"==typeof e?e:t,e="function"!=typeof e&&e)return t(null,e);At.lstat(u,((u,r)=>{if(u)return t(null,"file");e=r&&r.isDirectory()?"dir":"file",t(null,e)}))},symlinkTypeSync:function(u,e){let t;if(e)return e;try{t=At.lstatSync(u)}catch{return"file"}return t&&t.isDirectory()?"dir":"file"}};const yt=iu.fromCallback,pt=f.default,ht=nu,mt=Gu.mkdirs,Bt=Gu.mkdirsSync,vt=Ct.symlinkPaths,St=Ct.symlinkPathsSync,_t=dt.symlinkType,Ot=dt.symlinkTypeSync,wt=Uu.pathExists,{areIdentical:Pt}=te;function bt(u,e,t,r){vt(u,e,((n,i)=>{if(n)return r(n);u=i.toDst,_t(i.toCwd,t,((t,n)=>{if(t)return r(t);const i=pt.dirname(e);wt(i,((t,o)=>t?r(t):o?ht.symlink(u,e,n,r):void mt(i,(t=>{if(t)return r(t);ht.symlink(u,e,n,r)}))))}))}))}var gt={createSymlink:yt((function(u,e,t,r){r="function"==typeof t?t:r,t="function"!=typeof t&&t,ht.lstat(e,((n,i)=>{!n&&i.isSymbolicLink()?Promise.all([ht.stat(u),ht.stat(e)]).then((([n,i])=>{if(Pt(n,i))return r(null);bt(u,e,t,r)})):bt(u,e,t,r)}))})),createSymlinkSync:function(u,e,t){let r;try{r=ht.lstatSync(e)}catch{}if(r&&r.isSymbolicLink()){const t=ht.statSync(u),r=ht.statSync(e);if(Pt(t,r))return}const n=St(u,e);u=n.toDst,t=Ot(n.toCwd,t);const i=pt.dirname(e);return ht.existsSync(i)||Bt(i),ht.symlinkSync(u,e,t)}};const{createFile:Nt,createFileSync:Rt}=nt,{createLink:It,createLinkSync:kt}=ft,{createSymlink:Tt,createSymlinkSync:xt}=gt;var Mt={createFile:Nt,createFileSync:Rt,ensureFile:Nt,ensureFileSync:Rt,createLink:It,createLinkSync:kt,ensureLink:It,ensureLinkSync:kt,createSymlink:Tt,createSymlinkSync:xt,ensureSymlink:Tt,ensureSymlinkSync:xt};var Ht={stringify:function(u,{EOL:e="\n",finalEOL:t=!0,replacer:r=null,spaces:n}={}){const i=t?e:"";return JSON.stringify(u,r,n).replace(/\n/g,e)+i},stripBom:function(u){return Buffer.isBuffer(u)&&(u=u.toString("utf8")),u.replace(/^\uFEFF/,"")}};let jt;try{jt=wu}catch(u){jt=s.default}const Jt=iu,{stringify:Lt,stripBom:Gt}=Ht;const Vt=Jt.fromPromise((async function(u,e={}){"string"==typeof e&&(e={encoding:e});const t=e.fs||jt,r=!("throws"in e)||e.throws;let n,i=await Jt.fromCallback(t.readFile)(u,e);i=Gt(i);try{n=JSON.parse(i,e?e.reviver:null)}catch(e){if(r)throw e.message=`${u}: ${e.message}`,e;return null}return n}));const $t=Jt.fromPromise((async function(u,e,t={}){const r=t.fs||jt,n=Lt(e,t);await Jt.fromCallback(r.writeFile)(u,n,t)}));const Ut={readFile:Vt,readFileSync:function(u,e={}){"string"==typeof e&&(e={encoding:e});const t=e.fs||jt,r=!("throws"in e)||e.throws;try{let r=t.readFileSync(u,e);return r=Gt(r),JSON.parse(r,e.reviver)}catch(e){if(r)throw e.message=`${u}: ${e.message}`,e;return null}},writeFile:$t,writeFileSync:function(u,e,t={}){const r=t.fs||jt,n=Lt(e,t);return r.writeFileSync(u,n,t)}};var Wt={readJson:Ut.readFile,readJsonSync:Ut.readFileSync,writeJson:Ut.writeFile,writeJsonSync:Ut.writeFileSync};const qt=iu.fromCallback,Kt=wu,Yt=f.default,zt=Gu,Zt=Uu.pathExists;var Xt={outputFile:qt((function(u,e,t,r){"function"==typeof t&&(r=t,t="utf8");const n=Yt.dirname(u);Zt(n,((i,o)=>i?r(i):o?Kt.writeFile(u,e,t,r):void zt.mkdirs(n,(n=>{if(n)return r(n);Kt.writeFile(u,e,t,r)}))))})),outputFileSync:function(u,...e){const t=Yt.dirname(u);if(Kt.existsSync(t))return Kt.writeFileSync(u,...e);zt.mkdirsSync(t),Kt.writeFileSync(u,...e)}};const{stringify:Qt}=Ht,{outputFile:ur}=Xt;var er=async function(u,e,t={}){const r=Qt(e,t);await ur(u,r,t)};const{stringify:tr}=Ht,{outputFileSync:rr}=Xt;var nr=function(u,e,t){const r=tr(e,t);rr(u,r,t)};const ir=iu.fromPromise,or=Wt;or.outputJson=ir(er),or.outputJsonSync=nr,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 Dr=or;const cr=wu,ar=f.default,sr=Pe.copy,fr=Ue.remove,Er=Gu.mkdirp,lr=Uu.pathExists,Fr=te;function Cr(u,e,t,r,n){return r?Ar(u,e,t,n):t?fr(e,(r=>r?n(r):Ar(u,e,t,n))):void lr(e,((r,i)=>r?n(r):i?n(new Error("dest already exists.")):Ar(u,e,t,n)))}function Ar(u,e,t,r){cr.rename(u,e,(n=>n?"EXDEV"!==n.code?r(n):function(u,e,t,r){const n={overwrite:t,errorOnExist:!0};sr(u,e,n,(e=>e?r(e):fr(u,r)))}(u,e,t,r):r()))}var dr=function(u,e,t,r){"function"==typeof t&&(r=t,t={});const n=(t=t||{}).overwrite||t.clobber||!1;Fr.checkPaths(u,e,"move",t,((t,i)=>{if(t)return r(t);const{srcStat:o,isChangingCase:D=!1}=i;Fr.checkParentPaths(u,o,e,"move",(t=>t?r(t):function(u){const e=ar.dirname(u);return ar.parse(e).root===e}(e)?Cr(u,e,n,D,r):void Er(ar.dirname(e),(t=>t?r(t):Cr(u,e,n,D,r)))))}))};const yr=wu,pr=f.default,hr=Pe.copySync,mr=Ue.removeSync,Br=Gu.mkdirpSync,vr=te;function Sr(u,e,t){try{yr.renameSync(u,e)}catch(r){if("EXDEV"!==r.code)throw r;return function(u,e,t){const r={overwrite:t,errorOnExist:!0};return hr(u,e,r),mr(u)}(u,e,t)}}var _r=function(u,e,t){const r=(t=t||{}).overwrite||t.clobber||!1,{srcStat:n,isChangingCase:i=!1}=vr.checkPathsSync(u,e,"move",t);return vr.checkParentPathsSync(u,n,e,"move"),function(u){const e=pr.dirname(u);return pr.parse(e).root===e}(e)||Br(pr.dirname(e)),function(u,e,t,r){if(r)return Sr(u,e,t);if(t)return mr(e),Sr(u,e,t);if(yr.existsSync(e))throw new Error("dest already exists.");return Sr(u,e,t)}(u,e,r,i)};var Or={move:(0,iu.fromCallback)(dr),moveSync:_r},wr={...nu,...Pe,...Qe,...Mt,...Dr,...Gu,...Or,...Xt,...Uu,...Ue},Pr=p&&p.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(Q,"__esModule",{value:!0}),Q.parseJsonText=Q.parseJsonFile=void 0;const br=uu,gr=Pr(wr),Nr=Pr(f.default),Rr=Pr(E.default),Ir=k;var kr;!function(u){u[u.Char=0]="Char",u[u.EOF=1]="EOF",u[u.Identifier=2]="Identifier"}(kr||(kr={}));let Tr,xr,Mr,Hr,jr,Jr,Lr="start",Gr=[],Vr=0,$r=1,Ur=0,Wr=!1,qr="default",Kr="'",Yr=1;function zr(u,e=!1){xr=String(u),Lr="start",Gr=[],Vr=0,$r=1,Ur=0,Hr=void 0,Wr=e;do{Tr=Zr(),nn[Lr]()}while("eof"!==Tr.type);return Hr}function Zr(){for(qr="default",jr="",Kr="'",Yr=1;;){Jr=Xr();const u=un[qr]();if(u)return u}}function Xr(){if(xr[Vr])return String.fromCodePoint(xr.codePointAt(Vr))}function Qr(){const u=Xr();return"\n"===u?($r++,Ur=0):u?Ur+=u.length:Ur++,u&&(Vr+=u.length),u}Q.parseJsonFile=function(u,e=!1,t="utf-8"){const r=gr.default.readFileSync(Nr.default.resolve(u),{encoding:t});try{return zr(r,e)}catch(e){if(e instanceof SyntaxError){const t=e.message.split("at");2===t.length&&(0,Ir.logErrorAndExit)(`${t[0].trim()}${Rr.default.EOL}\t at ${u}:${t[1].trim()}`)}(0,Ir.logErrorAndExit)(`${u} is not in valid JSON/JSON5 format.`)}},Q.parseJsonText=zr;const un={default(){switch(Jr){case"/":return Qr(),void(qr="comment");case void 0:return Qr(),en("eof")}if(!br.JudgeUtil.isIgnoreChar(Jr)&&!br.JudgeUtil.isSpaceSeparator(Jr))return un[Lr]();Qr()},start(){qr="value"},beforePropertyName(){switch(Jr){case"$":case"_":return jr=Qr(),void(qr="identifierName");case"\\":return Qr(),void(qr="identifierNameStartEscape");case"}":return en("punctuator",Qr());case'"':case"'":return Kr=Jr,Qr(),void(qr="string")}if(br.JudgeUtil.isIdStartChar(Jr))return jr+=Qr(),void(qr="identifierName");throw an(kr.Char,Qr())},afterPropertyName(){if(":"===Jr)return en("punctuator",Qr());throw an(kr.Char,Qr())},beforePropertyValue(){qr="value"},afterPropertyValue(){switch(Jr){case",":case"}":return en("punctuator",Qr())}throw an(kr.Char,Qr())},beforeArrayValue(){if("]"===Jr)return en("punctuator",Qr());qr="value"},afterArrayValue(){switch(Jr){case",":case"]":return en("punctuator",Qr())}throw an(kr.Char,Qr())},end(){throw an(kr.Char,Qr())},comment(){switch(Jr){case"*":return Qr(),void(qr="multiLineComment");case"/":return Qr(),void(qr="singleLineComment")}throw an(kr.Char,Qr())},multiLineComment(){switch(Jr){case"*":return Qr(),void(qr="multiLineCommentAsterisk");case void 0:throw an(kr.Char,Qr())}Qr()},multiLineCommentAsterisk(){switch(Jr){case"*":return void Qr();case"/":return Qr(),void(qr="default");case void 0:throw an(kr.Char,Qr())}Qr(),qr="multiLineComment"},singleLineComment(){switch(Jr){case"\n":case"\r":case"\u2028":case"\u2029":return Qr(),void(qr="default");case void 0:return Qr(),en("eof")}Qr()},value(){switch(Jr){case"{":case"[":return en("punctuator",Qr());case"n":return Qr(),tn("ull"),en("null",null);case"t":return Qr(),tn("rue"),en("boolean",!0);case"f":return Qr(),tn("alse"),en("boolean",!1);case"-":case"+":return"-"===Qr()&&(Yr=-1),void(qr="numerical");case".":case"0":case"I":case"N":return void(qr="numerical");case'"':case"'":return Kr=Jr,Qr(),jr="",void(qr="string")}if(void 0===Jr||!br.JudgeUtil.isDigitWithoutZero(Jr))throw an(kr.Char,Qr());qr="numerical"},numerical(){switch(Jr){case".":return jr=Qr(),void(qr="decimalPointLeading");case"0":return jr=Qr(),void(qr="zero");case"I":return Qr(),tn("nfinity"),en("numeric",Yr*(1/0));case"N":return Qr(),tn("aN"),en("numeric",NaN)}if(void 0!==Jr&&br.JudgeUtil.isDigitWithoutZero(Jr))return jr=Qr(),void(qr="decimalInteger");throw an(kr.Char,Qr())},zero(){switch(Jr){case".":case"e":case"E":return void(qr="decimal");case"x":case"X":return jr+=Qr(),void(qr="hexadecimal")}return en("numeric",0)},decimalInteger(){switch(Jr){case".":case"e":case"E":return void(qr="decimal")}if(!br.JudgeUtil.isDigit(Jr))return en("numeric",Yr*Number(jr));jr+=Qr()},decimal(){switch(Jr){case".":jr+=Qr(),qr="decimalFraction";break;case"e":case"E":jr+=Qr(),qr="decimalExponent"}},decimalPointLeading(){if(br.JudgeUtil.isDigit(Jr))return jr+=Qr(),void(qr="decimalFraction");throw an(kr.Char,Qr())},decimalFraction(){switch(Jr){case"e":case"E":return jr+=Qr(),void(qr="decimalExponent")}if(!br.JudgeUtil.isDigit(Jr))return en("numeric",Yr*Number(jr));jr+=Qr()},decimalExponent(){switch(Jr){case"+":case"-":return jr+=Qr(),void(qr="decimalExponentSign")}if(br.JudgeUtil.isDigit(Jr))return jr+=Qr(),void(qr="decimalExponentInteger");throw an(kr.Char,Qr())},decimalExponentSign(){if(br.JudgeUtil.isDigit(Jr))return jr+=Qr(),void(qr="decimalExponentInteger");throw an(kr.Char,Qr())},decimalExponentInteger(){if(!br.JudgeUtil.isDigit(Jr))return en("numeric",Yr*Number(jr));jr+=Qr()},hexadecimal(){if(br.JudgeUtil.isHexDigit(Jr))return jr+=Qr(),void(qr="hexadecimalInteger");throw an(kr.Char,Qr())},hexadecimalInteger(){if(!br.JudgeUtil.isHexDigit(Jr))return en("numeric",Yr*Number(jr));jr+=Qr()},identifierNameStartEscape(){if("u"!==Jr)throw an(kr.Char,Qr());Qr();const u=rn();switch(u){case"$":case"_":break;default:if(!br.JudgeUtil.isIdStartChar(u))throw an(kr.Identifier)}jr+=u,qr="identifierName"},identifierName(){switch(Jr){case"$":case"_":case"‌":case"‍":return void(jr+=Qr());case"\\":return Qr(),void(qr="identifierNameEscape")}if(!br.JudgeUtil.isIdContinueChar(Jr))return en("identifier",jr);jr+=Qr()},identifierNameEscape(){if("u"!==Jr)throw an(kr.Char,Qr());Qr();const u=rn();switch(u){case"$":case"_":case"‌":case"‍":break;default:if(!br.JudgeUtil.isIdContinueChar(u))throw an(kr.Identifier)}jr+=u,qr="identifierName"},string(){switch(Jr){case"\\":return Qr(),void(jr+=function(){const u=Xr(),e=function(){switch(Xr()){case"b":return Qr(),"\b";case"f":return Qr(),"\f";case"n":return Qr(),"\n";case"r":return Qr(),"\r";case"t":return Qr(),"\t";case"v":return Qr(),"\v"}return}();if(e)return e;switch(u){case"0":if(Qr(),br.JudgeUtil.isDigit(Xr()))throw an(kr.Char,Qr());return"\0";case"x":return Qr(),function(){let u="",e=Xr();if(!br.JudgeUtil.isHexDigit(e))throw an(kr.Char,Qr());if(u+=Qr(),e=Xr(),!br.JudgeUtil.isHexDigit(e))throw an(kr.Char,Qr());return u+=Qr(),String.fromCodePoint(parseInt(u,16))}();case"u":return Qr(),rn();case"\n":case"\u2028":case"\u2029":return Qr(),"";case"\r":return Qr(),"\n"===Xr()&&Qr(),""}if(void 0===u||br.JudgeUtil.isDigitWithoutZero(u))throw an(kr.Char,Qr());return Qr()}());case'"':case"'":if(Jr===Kr){const u=en("string",jr);return Qr(),u}return void(jr+=Qr());case"\n":case"\r":case void 0:throw an(kr.Char,Qr());case"\u2028":case"\u2029":!function(u){(0,Ir.logErrorAndExit)(`JSON5: '${cn(u)}' in strings is not valid ECMAScript; consider escaping.`)}(Jr)}jr+=Qr()}};function en(u,e){return{type:u,value:e,line:$r,column:Ur}}function tn(u){for(const e of u){if(Xr()!==e)throw an(kr.Char,Qr());Qr()}}function rn(){let u="",e=4;for(;e-- >0;){const e=Xr();if(!br.JudgeUtil.isHexDigit(e))throw an(kr.Char,Qr());u+=Qr()}return String.fromCodePoint(parseInt(u,16))}const nn={start(){if("eof"===Tr.type)throw an(kr.EOF);on()},beforePropertyName(){switch(Tr.type){case"identifier":case"string":return Mr=Tr.value,void(Lr="afterPropertyName");case"punctuator":return void Dn();case"eof":throw an(kr.EOF)}},afterPropertyName(){if("eof"===Tr.type)throw an(kr.EOF);Lr="beforePropertyValue"},beforePropertyValue(){if("eof"===Tr.type)throw an(kr.EOF);on()},afterPropertyValue(){if("eof"===Tr.type)throw an(kr.EOF);switch(Tr.value){case",":return void(Lr="beforePropertyName");case"}":Dn()}},beforeArrayValue(){if("eof"===Tr.type)throw an(kr.EOF);"punctuator"!==Tr.type||"]"!==Tr.value?on():Dn()},afterArrayValue(){if("eof"===Tr.type)throw an(kr.EOF);switch(Tr.value){case",":return void(Lr="beforeArrayValue");case"]":Dn()}},end(){}};function on(){const u=function(){let u;switch(Tr.type){case"punctuator":switch(Tr.value){case"{":u={};break;case"[":u=[]}break;case"null":case"boolean":case"numeric":case"string":u=Tr.value}return u}();if(Wr&&"object"==typeof u&&(u._line=$r,u._column=Ur),void 0===Hr)Hr=u;else{const e=Gr[Gr.length-1];Array.isArray(e)?Wr&&"object"!=typeof u?e.push({value:u,_line:$r,_column:Ur}):e.push(u):e[Mr]=Wr&&"object"!=typeof u?{value:u,_line:$r,_column:Ur}:u}!function(u){if(u&&"object"==typeof u)Gr.push(u),Lr=Array.isArray(u)?"beforeArrayValue":"beforePropertyName";else{const u=Gr[Gr.length-1];Lr=u?Array.isArray(u)?"afterArrayValue":"afterPropertyValue":"end"}}(u)}function Dn(){Gr.pop();const u=Gr[Gr.length-1];Lr=u?Array.isArray(u)?"afterArrayValue":"afterPropertyValue":"end"}function cn(u){const e={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(e[u])return e[u];if(u<" "){const e=u.charCodeAt(0).toString(16);return`\\x${`00${e}`.substring(e.length)}`}return u}function an(u,e){let t="";switch(u){case kr.Char:t=void 0===e?`JSON5: invalid end of input at ${$r}:${Ur}`:`JSON5: invalid character '${cn(e)}' at ${$r}:${Ur}`;break;case kr.EOF:t=`JSON5: invalid end of input at ${$r}:${Ur}`;break;case kr.Identifier:Ur-=5,t=`JSON5: invalid identifier character at ${$r}:${Ur}`}const r=new sn(t);return r.lineNumber=$r,r.columnNumber=Ur,r}class sn extends SyntaxError{}var fn=p&&p.__createBinding||(Object.create?function(u,e,t,r){void 0===r&&(r=t);var n=Object.getOwnPropertyDescriptor(e,t);n&&!("get"in n?!e.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(u,r,n)}:function(u,e,t,r){void 0===r&&(r=t),u[r]=e[t]}),En=p&&p.__setModuleDefault||(Object.create?function(u,e){Object.defineProperty(u,"default",{enumerable:!0,value:e})}:function(u,e){u.default=e}),ln=p&&p.__importStar||function(u){if(u&&u.__esModule)return u;var e={};if(null!=u)for(var t in u)"default"!==t&&Object.prototype.hasOwnProperty.call(u,t)&&fn(e,u,t);return En(e,u),e};Object.defineProperty(X,"__esModule",{value:!0});var Fn=X.executeInstallHvigor=vn=X.isHvigorInstalled=void 0;const Cn=ln(s.default),An=ln(f.default),dn=m,yn=I,pn=k,hn=Q;let mn,Bn;var vn=X.isHvigorInstalled=function(){return mn=function(){const u=An.resolve(dn.HVIGOR_PROJECT_WRAPPER_HOME,dn.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME);if(!Cn.existsSync(u))throw new Error(`Error: Hvigor config file ${u} does not exist.`);return(0,hn.parseJsonFile)(u)}(),Bn=Cn.existsSync(dn.HVIGOR_PROJECT_DEPENDENCY_PACKAGE_JSON_PATH)?(0,hn.parseJsonFile)(dn.HVIGOR_PROJECT_DEPENDENCY_PACKAGE_JSON_PATH):{dependencies:{}},!(!(0,yn.hasNpmPackInPaths)(dn.HVIGOR_ENGINE_PACKAGE_NAME,[dn.HVIGOR_PROJECT_DEPENDENCIES_HOME])||mn.hvigorVersion!==Bn.dependencies[dn.HVIGOR_ENGINE_PACKAGE_NAME])||(console.log("Hvigor installing..."),!1)};const Sn={cwd:dn.HVIGOR_PROJECT_DEPENDENCIES_HOME,stdio:["inherit","inherit","inherit"]};Fn=X.executeInstallHvigor=function(){const u={dependencies:{}};u.dependencies[dn.HVIGOR_ENGINE_PACKAGE_NAME]=mn.hvigorVersion;try{Cn.mkdirSync(dn.HVIGOR_PROJECT_DEPENDENCIES_HOME,{recursive:!0});const e=An.resolve(dn.HVIGOR_PROJECT_DEPENDENCIES_HOME,dn.DEFAULT_PACKAGE_JSON);Cn.writeFileSync(e,JSON.stringify(u))}catch(u){(0,pn.logErrorAndExit)(u)}!function(){const u=["config","set","store-dir",dn.HVIGOR_PNPM_STORE_PATH];(0,yn.executeCommand)(dn.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH,u,Sn)}(),(0,yn.executeCommand)(dn.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH,["install"],Sn)};var _n={},On=p&&p.__createBinding||(Object.create?function(u,e,t,r){void 0===r&&(r=t);var n=Object.getOwnPropertyDescriptor(e,t);n&&!("get"in n?!e.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(u,r,n)}:function(u,e,t,r){void 0===r&&(r=t),u[r]=e[t]}),wn=p&&p.__setModuleDefault||(Object.create?function(u,e){Object.defineProperty(u,"default",{enumerable:!0,value:e})}:function(u,e){u.default=e}),Pn=p&&p.__importStar||function(u){if(u&&u.__esModule)return u;var e={};if(null!=u)for(var t in u)"default"!==t&&Object.prototype.hasOwnProperty.call(u,t)&&On(e,u,t);return wn(e,u),e};Object.defineProperty(_n,"__esModule",{value:!0});var bn=_n.executeBuild=void 0;const gn=m,Nn=Pn(s.default),Rn=Pn(f.default),In=k;bn=_n.executeBuild=function(){const u=Rn.resolve(gn.HVIGOR_PROJECT_DEPENDENCIES_HOME,"node_modules","@ohos","hvigor","bin","hvigor.js");try{const e=Nn.realpathSync(u);require(e)}catch(e){(0,In.logErrorAndExit)(`Error: ENOENT: no such file ${u},delete ${gn.HVIGOR_PROJECT_DEPENDENCIES_HOME} and retry.`)}},Z()||U(),vn()||Fn(),bn(); \ No newline at end of file diff --git a/alarm-clock-army/hvigorfile.ts b/alarm-clock-army/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..6478186902c0c1ad7c966a929c7d6b7d8ae7a9f3 --- /dev/null +++ b/alarm-clock-army/hvigorfile.ts @@ -0,0 +1,2 @@ +// 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/alarm-clock-army/local.properties b/alarm-clock-army/local.properties new file mode 100644 index 0000000000000000000000000000000000000000..89628bcab328058de2c4ba9295ca86fa5243e9a5 --- /dev/null +++ b/alarm-clock-army/local.properties @@ -0,0 +1,9 @@ +# This file is automatically generated by DevEco Studio. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file should *NOT* be checked into Version Control Systems, +# as it contains information specific to your local configuration. +# +# For customization when using a Version Control System, please read the header note. +nodejs.dir=C:/Users/armyq/nodejs +hwsdk.dir=D:/ProgramData/HarmonyOS/Sdk \ No newline at end of file diff --git a/alarm-clock-army/oh-package.json5 b/alarm-clock-army/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..4b62d9c4c92567d5831f377e6e02eaf787ff4648 --- /dev/null +++ b/alarm-clock-army/oh-package.json5 @@ -0,0 +1,11 @@ +{ + "license": "", + "devDependencies": { + "@ohos/hypium": "1.0.6" + }, + "name": "AlarmClockETS", + "description": "example description", + "repository": {}, + "version": "1.0.0", + "dependencies": {} +} diff --git a/alarm-clock-army/screenshots/device/AlarmClock.gif b/alarm-clock-army/screenshots/device/AlarmClock.gif new file mode 100644 index 0000000000000000000000000000000000000000..b5885a2800574b055f7903f95e3fe1d925bac579 Binary files /dev/null and b/alarm-clock-army/screenshots/device/AlarmClock.gif differ