diff --git a/App.vue b/App.vue new file mode 100644 index 0000000..5990fbc --- /dev/null +++ b/App.vue @@ -0,0 +1,434 @@ + + + diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..8e39ead --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 www.uviewui.com + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.en.md b/README.en.md new file mode 100644 index 0000000..c86ce47 --- /dev/null +++ b/README.en.md @@ -0,0 +1,36 @@ +# 校柚(H5) + +#### Description +校柚(H5) + +#### Software Architecture +Software architecture description + +#### Installation + +1. xxxx +2. xxxx +3. xxxx + +#### Instructions + +1. xxxx +2. xxxx +3. xxxx + +#### Contribution + +1. Fork the repository +2. Create Feat_xxx branch +3. Commit your code +4. Create Pull Request + + +#### Gitee Feature + +1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md +2. Gitee blog [blog.gitee.com](https://blog.gitee.com) +3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore) +4. The most valuable open source project [GVP](https://gitee.com/gvp) +5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) +6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/README.md b/README.md index e69de29..f7a7227 100644 --- a/README.md +++ b/README.md @@ -0,0 +1 @@ +### 项目初始化 \ No newline at end of file diff --git a/common/classify.data.js b/common/classify.data.js new file mode 100644 index 0000000..cb4f75a --- /dev/null +++ b/common/classify.data.js @@ -0,0 +1,1087 @@ +export default[ + { + "name": "女装", + "foods": [ + { + "name": "A字裙", + "key": "A字裙", + "icon": "https://cdn.uviewui.com/uview/common/classify/1/1.jpg", + "cat": 10 + }, + { + "name": "T恤", + "key": "T恤", + "icon": "https://cdn.uviewui.com/uview/common/classify/1/2.jpg", + "cat": 10 + }, + { + "name": "半身裙", + "key": "半身裙", + "icon": "https://cdn.uviewui.com/uview/common/classify/1/3.jpg", + "cat": 10 + }, + { + "name": "衬衫", + "key": "衬衫", + "icon": "https://cdn.uviewui.com/uview/common/classify/1/4.jpg", + "cat": 10 + }, + { + "name": "短裙", + "key": "短裙", + "icon": "https://cdn.uviewui.com/uview/common/classify/1/5.jpg", + "cat": 10 + }, + { + "name": "阔腿裤", + "key": "阔腿裤", + "icon": "https://cdn.uviewui.com/uview/common/classify/1/6.jpg", + "cat": 10 + }, + { + "name": "连衣裙", + "key": "连衣裙", + "icon": "https://cdn.uviewui.com/uview/common/classify/1/7.jpg", + "cat": 10 + }, + { + "name": "妈妈装", + "key": "妈妈装", + "icon": "https://cdn.uviewui.com/uview/common/classify/1/8.jpg", + "cat": 10 + }, + { + "name": "牛仔裤", + "key": "牛仔裤", + "icon": "https://cdn.uviewui.com/uview/common/classify/1/9.jpg", + "cat": 10 + }, + { + "name": "情侣装", + "key": "情侣装", + "icon": "https://cdn.uviewui.com/uview/common/classify/1/10.jpg", + "cat": 10 + }, + { + "name": "休闲裤", + "key": "休闲裤", + "icon": "https://cdn.uviewui.com/uview/common/classify/1/11.jpg", + "cat": 10 + }, + { + "name": "雪纺衫", + "key": "雪纺衫", + "icon": "https://cdn.uviewui.com/uview/common/classify/1/12.jpg", + "cat": 10 + }, + { + "name": "防晒衣", + "key": "防晒衣", + "icon": "https://cdn.uviewui.com/uview/common/classify/1/13.jpg", + "cat": 10 + }, + { + "name": "礼服/婚纱", + "key": "礼服婚纱", + "icon": "https://cdn.uviewui.com/uview/common/classify/1/14.jpg", + "cat": 10 + } + ] + }, + { + "name": "美食", + "foods": [ + { + "name": "火锅", + "key": "火锅", + "icon": "https://cdn.uviewui.com/uview/common/classify/2/1.jpg", + "cat": 6 + }, + { + "name": "糕点饼干", + "key": "糕点饼干", + "icon": "https://cdn.uviewui.com/uview/common/classify/2/2.jpg", + "cat": 6 + }, + { + "name": "坚果果干", + "key": "坚果果干", + "icon": "https://cdn.uviewui.com/uview/common/classify/2/3.jpg", + "cat": 6 + }, + { + "name": "酒类", + "key": "酒类", + "icon": "https://cdn.uviewui.com/uview/common/classify/2/4.jpg", + "cat": 6 + }, + { + "name": "辣条", + "key": "辣条", + "icon": "https://cdn.uviewui.com/uview/common/classify/2/5.jpg", + "cat": 6 + }, + { + "name": "大礼包", + "key": "大礼包", + "icon": "https://cdn.uviewui.com/uview/common/classify/2/6.jpg", + "cat": 6 + }, + { + "name": "精品茗茶", + "key": "茶", + "icon": "https://cdn.uviewui.com/uview/common/classify/2/7.jpg", + "cat": 6 + }, + { + "name": "休闲食品", + "key": "休闲食品", + "icon": "https://cdn.uviewui.com/uview/common/classify/2/8.jpg", + "cat": 6 + }, + { + "name": "糖果巧克力", + "key": "糖果巧克力", + "icon": "https://cdn.uviewui.com/uview/common/classify/2/9.jpg", + "cat": 6 + }, + { + "name": "方便速食", + "key": "方便速食", + "icon": "https://cdn.uviewui.com/uview/common/classify/2/10.jpg", + "cat": 6 + }, + { + "name": "营养代餐", + "key": "营养代餐", + "icon": "https://cdn.uviewui.com/uview/common/classify/2/11.jpg", + "cat": 6 + }, + { + "name": "粮油副食", + "key": "粮油", + "icon": "https://cdn.uviewui.com/uview/common/classify/2/12.jpg", + "cat": 6 + }, + { + "name": "生鲜水果", + "key": "水果", + "icon": "https://cdn.uviewui.com/uview/common/classify/2/13.jpg", + "cat": 6 + }, + { + "name": "饮品", + "key": "饮品", + "icon": "https://cdn.uviewui.com/uview/common/classify/2/14.jpg", + "cat": 6 + } + ] + }, + { + "name": "美妆", + "foods": [ + { + "name": "化妆刷", + "key": "化妆刷", + "icon": "https://cdn.uviewui.com/uview/common/classify/3/1.jpg", + "cat": 3 + }, + { + "name": "粉底", + "key": "粉底", + "icon": "https://cdn.uviewui.com/uview/common/classify/3/2.jpg", + "cat": 3 + }, + { + "name": "洗发护发", + "key": "洗发护发", + "icon": "https://cdn.uviewui.com/uview/common/classify/3/3.jpg", + "cat": 3 + }, + { + "name": "美容工具", + "key": "美容工具", + "icon": "https://cdn.uviewui.com/uview/common/classify/3/4.jpg", + "cat": 3 + }, + { + "name": "眼部护理", + "key": "眼部护理", + "icon": "https://cdn.uviewui.com/uview/common/classify/3/5.jpg", + "cat": 3 + }, + { + "name": "眉妆", + "key": "眉妆", + "icon": "https://cdn.uviewui.com/uview/common/classify/3/6.jpg", + "cat": 3 + }, + { + "name": "卸妆品", + "key": "卸妆品", + "icon": "https://cdn.uviewui.com/uview/common/classify/3/7.jpg", + "cat": 3 + }, + { + "name": "基础护肤", + "key": "基础护肤", + "icon": "https://cdn.uviewui.com/uview/common/classify/3/8.jpg", + "cat": 3 + }, + { + "name": "眼妆", + "key": "眼妆", + "icon": "https://cdn.uviewui.com/uview/common/classify/3/9.jpg", + "cat": 3 + }, + { + "name": "唇妆", + "key": "唇妆", + "icon": "https://cdn.uviewui.com/uview/common/classify/3/10.jpg", + "cat": 3 + }, + { + "name": "面膜", + "key": "面膜", + "icon": "https://cdn.uviewui.com/uview/common/classify/3/11.jpg", + "cat": 3 + }, + { + "name": "沐浴用品", + "key": "沐浴用品", + "icon": "https://cdn.uviewui.com/uview/common/classify/3/12.jpg", + "cat": 3 + }, + { + "name": "护肤套装", + "key": "护肤套装", + "icon": "https://cdn.uviewui.com/uview/common/classify/3/13.jpg", + "cat": 3 + }, + { + "name": "防晒品", + "key": "防晒品", + "icon": "https://cdn.uviewui.com/uview/common/classify/3/14.jpg", + "cat": 3 + }, + { + "name": "美甲", + "key": "美甲", + "icon": "https://cdn.uviewui.com/uview/common/classify/3/15.jpg", + "cat": 3 + } + + ] + }, + { + "name": "居家日用", + "foods": [ + { + "name": "垃圾袋", + "key": "垃圾袋", + "icon": "https://cdn.uviewui.com/uview/common/classify/4/1.jpg", + "cat": 4 + }, + { + "name": "纸巾", + "key": "纸巾", + "icon": "https://cdn.uviewui.com/uview/common/classify/4/2.jpg", + "cat": 4 + }, + { + "name": "驱蚊用品", + "key": "驱蚊用品", + "icon": "https://cdn.uviewui.com/uview/common/classify/4/3.jpg", + "cat": 4 + }, + { + "name": "收纳神器", + "key": "收纳神器", + "icon": "https://cdn.uviewui.com/uview/common/classify/4/4.jpg", + "cat": 4 + }, + { + "name": "厨房用品", + "key": "厨房用品", + "icon": "https://cdn.uviewui.com/uview/common/classify/4/5.jpg", + "cat": 4 + }, + { + "name": "厨房烹饪", + "key": "烹饪", + "icon": "https://cdn.uviewui.com/uview/common/classify/4/6.jpg", + "cat": 4 + }, + { + "name": "衣物晾晒", + "key": "衣物晾晒", + "icon": "https://cdn.uviewui.com/uview/common/classify/4/7.jpg", + "cat": 4 + }, + { + "name": "衣物护理", + "key": "衣物护理", + "icon": "https://cdn.uviewui.com/uview/common/classify/4/8.jpg", + "cat": 4 + }, + { + "name": "宠物用品", + "key": "宠物用品", + "icon": "https://cdn.uviewui.com/uview/common/classify/4/9.jpg", + "cat": 4 + }, + { + "name": "医药保健", + "key": "医药", + "icon": "https://cdn.uviewui.com/uview/common/classify/4/10.jpg", + "cat": 4 + }, + { + "name": "日用百货", + "key": "百货", + "icon": "https://cdn.uviewui.com/uview/common/classify/4/11.jpg", + "cat": 4 + }, + { + "name": "清洁用品", + "key": "清洁", + "icon": "https://cdn.uviewui.com/uview/common/classify/4/12.jpg", + "cat": 4 + }, + { + "name": "绿植园艺", + "key": "绿植", + "icon": "https://cdn.uviewui.com/uview/common/classify/4/13.jpg", + "cat": 4 + } + ] + }, + { + "name": "男装", + "foods": [ + { + "name": "爸爸装", + "key": "爸爸装", + "icon": "https://cdn.uviewui.com/uview/common/classify/5/1.jpg", + "cat": 12 + }, + { + "name": "牛仔裤", + "key": "牛仔裤", + "icon": "https://cdn.uviewui.com/uview/common/classify/5/2.jpg", + "cat": 12 + }, + { + "name": "衬衫", + "key": "衬衫", + "icon": "https://cdn.uviewui.com/uview/common/classify/5/3.jpg", + "cat": 12 + }, + { + "name": "休闲裤", + "key": "休闲裤", + "icon": "https://cdn.uviewui.com/uview/common/classify/5/4.jpg", + "cat": 12 + }, + { + "name": "外套", + "key": "外套", + "icon": "https://cdn.uviewui.com/uview/common/classify/5/5.jpg", + "cat": 12 + }, + { + "name": "T恤", + "key": "T恤", + "icon": "https://cdn.uviewui.com/uview/common/classify/5/6.jpg", + "cat": 12 + }, + { + "name": "套装", + "key": "套装", + "icon": "https://cdn.uviewui.com/uview/common/classify/5/7.jpg", + "cat": 12 + }, + { + "name": "运动裤", + "key": "运动裤", + "icon": "https://cdn.uviewui.com/uview/common/classify/5/8.jpg", + "cat": 12 + }, + { + "name": "马甲/背心", + "key": "马甲背心", + "icon": "https://cdn.uviewui.com/uview/common/classify/5/9.jpg", + "cat": 12 + }, + { + "name": "POLO衫", + "key": "POLO衫", + "icon": "https://cdn.uviewui.com/uview/common/classify/5/10.jpg", + "cat": 12 + }, + { + "name": "商务装", + "key": "商务装", + "icon": "https://cdn.uviewui.com/uview/common/classify/5/11.jpg", + "cat": 12 + } + ] + }, + { + "name": "鞋品", + "foods": [ + { + "name": "单鞋", + "key": "单鞋", + "icon": "https://cdn.uviewui.com/uview/common/classify/6/1.jpg", + "cat": 5 + }, + { + "name": "皮鞋", + "key": "皮鞋", + "icon": "https://cdn.uviewui.com/uview/common/classify/6/2.jpg", + "cat": 5 + }, + { + "name": "帆布鞋", + "key": "帆布鞋", + "icon": "https://cdn.uviewui.com/uview/common/classify/6/3.jpg", + "cat": 5 + }, + { + "name": "北京老布鞋", + "key": "北京老布鞋", + "icon": "https://cdn.uviewui.com/uview/common/classify/6/4.jpg", + "cat": 5 + }, + { + "name": "运动鞋", + "key": "运动鞋", + "icon": "https://cdn.uviewui.com/uview/common/classify/6/5.jpg", + "cat": 5 + }, + { + "name": "拖鞋", + "key": "拖鞋", + "icon": "https://cdn.uviewui.com/uview/common/classify/6/6.jpg", + "cat": 5 + }, + { + "name": "凉鞋", + "key": "凉鞋", + "icon": "https://cdn.uviewui.com/uview/common/classify/6/7.jpg", + "cat": 5 + }, + { + "name": "休闲鞋", + "key": "休闲鞋", + "icon": "https://cdn.uviewui.com/uview/common/classify/6/8.jpg", + "cat": 5 + }, + { + "name": "高跟鞋", + "key": "高跟鞋", + "icon": "https://cdn.uviewui.com/uview/common/classify/6/9.jpg", + "cat": 5 + }, + { + "name": "老人鞋", + "key": "老人鞋", + "icon": "https://cdn.uviewui.com/uview/common/classify/6/10.jpg", + "cat": 5 + }, + { + "name": "懒人鞋", + "key": "懒人鞋", + "icon": "https://cdn.uviewui.com/uview/common/classify/6/11.jpg", + "cat": 5 + } + ] + }, + { + "name": "数码家电", + "foods": [ + { + "name": "数据线", + "key": "数据线", + "icon": "https://cdn.uviewui.com/uview/common/classify/7/1.jpg", + "cat": 8 + }, + { + "name": "耳机", + "key": "耳机", + "icon": "https://cdn.uviewui.com/uview/common/classify/7/2.jpg", + "cat": 8 + }, + { + "name": "生活家电", + "key": "家电", + "icon": "https://cdn.uviewui.com/uview/common/classify/7/3.jpg", + "cat": 8 + }, + { + "name": "电风扇", + "key": "电风扇", + "icon": "https://cdn.uviewui.com/uview/common/classify/7/4.jpg", + "cat": 8 + }, + { + "name": "电吹风", + "key": "电吹风", + "icon": "https://cdn.uviewui.com/uview/common/classify/7/5.jpg", + "cat": 8 + }, + { + "name": "手机壳", + "key": "手机壳", + "icon": "https://cdn.uviewui.com/uview/common/classify/7/6.jpg", + "cat": 8 + }, + { + "name": "榨汁机", + "key": "榨汁机", + "icon": "https://cdn.uviewui.com/uview/common/classify/7/7.jpg", + "cat": 8 + }, + { + "name": "小家电", + "key": "小家电", + "icon": "https://cdn.uviewui.com/uview/common/classify/7/8.jpg", + "cat": 8 + }, + { + "name": "数码电子", + "key": "数码", + "icon": "https://cdn.uviewui.com/uview/common/classify/7/9.jpg", + "cat": 8 + }, + { + "name": "电饭锅", + "key": "电饭锅", + "icon": "https://cdn.uviewui.com/uview/common/classify/7/10.jpg", + "cat": 8 + }, + { + "name": "手机支架", + "key": "手机支架", + "icon": "https://cdn.uviewui.com/uview/common/classify/7/11.jpg", + "cat": 8 + }, + { + "name": "剃须刀", + "key": "剃须刀", + "icon": "https://cdn.uviewui.com/uview/common/classify/7/12.jpg", + "cat": 8 + }, + { + "name": "充电宝", + "key": "充电宝", + "icon": "https://cdn.uviewui.com/uview/common/classify/7/13.jpg", + "cat": 8 + }, + { + "name": "手机配件", + "key": "手机配件", + "icon": "https://cdn.uviewui.com/uview/common/classify/7/14.jpg", + "cat": 8 + } + ] + }, + { + "name": "母婴", + "foods": [ + { + "name": "婴童服饰", + "key": "衣服", + "icon": "https://cdn.uviewui.com/uview/common/classify/8/1.jpg", + "cat": 2 + }, + { + "name": "玩具乐器", + "key": "玩具乐器", + "icon": "https://cdn.uviewui.com/uview/common/classify/8/2.jpg", + "cat": 2 + }, + { + "name": "尿不湿", + "key": "尿不湿", + "icon": "https://cdn.uviewui.com/uview/common/classify/8/3.jpg", + "cat": 2 + }, + { + "name": "安抚牙胶", + "key": "安抚牙胶", + "icon": "https://cdn.uviewui.com/uview/common/classify/8/4.jpg", + "cat": 2 + }, + { + "name": "奶瓶奶嘴", + "key": "奶瓶奶嘴", + "icon": "https://cdn.uviewui.com/uview/common/classify/8/5.jpg", + "cat": 2 + }, + { + "name": "孕妈用品", + "key": "孕妈用品", + "icon": "https://cdn.uviewui.com/uview/common/classify/8/6.jpg", + "cat": 2 + }, + { + "name": "宝宝用品", + "key": "宝宝用品", + "icon": "https://cdn.uviewui.com/uview/common/classify/8/7.jpg", + "cat": 2 + }, + { + "name": "婴童湿巾", + "key": "湿巾", + "icon": "https://cdn.uviewui.com/uview/common/classify/8/8.jpg", + "cat": 2 + }, + { + "name": "喂养洗护", + "key": "洗护", + "icon": "https://cdn.uviewui.com/uview/common/classify/8/9.jpg", + "cat": 2 + }, + { + "name": "婴童鞋靴", + "key": "童鞋", + "icon": "https://cdn.uviewui.com/uview/common/classify/8/10.jpg", + "cat": 2 + }, + { + "name": "口水巾", + "key": "口水巾", + "icon": "https://cdn.uviewui.com/uview/common/classify/8/11.jpg", + "cat": 2 + }, + { + "name": "营养辅食", + "key": "营养", + "icon": "https://cdn.uviewui.com/uview/common/classify/8/12.jpg", + "cat": 2 + }, + { + "name": "婴幼书籍", + "key": "书籍", + "icon": "https://cdn.uviewui.com/uview/common/classify/8/13.jpg", + "cat": 2 + }, + { + "name": "婴儿车", + "key": "婴儿车", + "icon": "https://cdn.uviewui.com/uview/common/classify/8/14.jpg", + "cat": 2 + } + ] + }, + { + "name": "箱包", + "foods": [ + { + "name": "单肩包", + "key": "单肩包", + "icon": "https://cdn.uviewui.com/uview/common/classify/9/1.jpg", + "cat": 0 + }, + { + "name": "斜挎包", + "key": "斜挎包", + "icon": "https://cdn.uviewui.com/uview/common/classify/9/2.jpg", + "cat": 0 + }, + { + "name": "女包", + "key": "女包", + "icon": "https://cdn.uviewui.com/uview/common/classify/9/3.jpg", + "cat": 0 + }, + { + "name": "男包", + "key": "男包", + "icon": "https://cdn.uviewui.com/uview/common/classify/9/4.jpg", + "cat": 0 + }, + { + "name": "双肩包", + "key": "双肩包", + "icon": "https://cdn.uviewui.com/uview/common/classify/9/5.jpg", + "cat": 0 + }, + { + "name": "小方包", + "key": "小方包", + "icon": "https://cdn.uviewui.com/uview/common/classify/9/6.jpg", + "cat": 0 + }, + { + "name": "钱包", + "key": "钱包", + "icon": "https://cdn.uviewui.com/uview/common/classify/9/7.jpg", + "cat": 0 + }, + { + "name": "旅行箱包", + "key": "旅行箱包", + "icon": "https://cdn.uviewui.com/uview/common/classify/9/8.jpg", + "cat": 0 + }, + { + "name": "零钱包", + "key": "零钱包", + "icon": "https://cdn.uviewui.com/uview/common/classify/9/9.jpg", + "cat": 0 + }, + { + "name": "手提包", + "key": "手提包", + "icon": "https://cdn.uviewui.com/uview/common/classify/9/10.jpg", + "cat": 0 + }, + { + "name": "胸包", + "key": "胸包", + "icon": "https://cdn.uviewui.com/uview/common/classify/9/11.jpg", + "cat": 0 + } + ] + }, + { + "name": "内衣", + "foods": [ + { + "name": "袜子", + "key": "袜子", + "icon": "https://cdn.uviewui.com/uview/common/classify/10/1.jpg", + "cat": 11 + }, + { + "name": "吊带背心", + "key": "吊带背心", + "icon": "https://cdn.uviewui.com/uview/common/classify/10/2.jpg", + "cat": 11 + }, + { + "name": "抹胸", + "key": "抹胸", + "icon": "https://cdn.uviewui.com/uview/common/classify/10/3.jpg", + "cat": 11 + }, + { + "name": "内裤", + "key": "内裤", + "icon": "https://cdn.uviewui.com/uview/common/classify/10/4.jpg", + "cat": 11 + }, + { + "name": "文胸", + "key": "文胸", + "icon": "https://cdn.uviewui.com/uview/common/classify/10/5.jpg", + "cat": 11 + }, + { + "name": "文胸套装", + "key": "文胸套装", + "icon": "https://cdn.uviewui.com/uview/common/classify/10/6.jpg", + "cat": 11 + }, + { + "name": "打底塑身", + "key": "打底塑身", + "icon": "https://cdn.uviewui.com/uview/common/classify/10/7.jpg", + "cat": 11 + }, + { + "name": "家居服", + "key": "家居服", + "icon": "https://cdn.uviewui.com/uview/common/classify/10/8.jpg", + "cat": 11 + }, + { + "name": "船袜", + "key": "船袜", + "icon": "https://cdn.uviewui.com/uview/common/classify/10/9.jpg", + "cat": 11 + }, + { + "name": "情侣睡衣", + "key": "情侣睡衣", + "icon": "https://cdn.uviewui.com/uview/common/classify/10/10.jpg", + "cat": 11 + }, + { + "name": "丝袜", + "key": "丝袜", + "icon": "https://cdn.uviewui.com/uview/common/classify/10/11.jpg", + "cat": 11 + } + ] + }, + { + "name": "文娱车品", + "foods": [ + { + "name": "车市车品", + "key": "车市车品", + "icon": "https://cdn.uviewui.com/uview/common/classify/11/1.jpg", + "cat": 7 + }, + { + "name": "办公文具", + "key": "办公文具", + "icon": "https://cdn.uviewui.com/uview/common/classify/11/2.jpg", + "cat": 7 + }, + { + "name": "考试必备", + "key": "考试必备", + "icon": "https://cdn.uviewui.com/uview/common/classify/11/3.jpg", + "cat": 7 + }, + { + "name": "笔记本", + "key": "笔记本", + "icon": "https://cdn.uviewui.com/uview/common/classify/11/4.jpg", + "cat": 7 + }, + { + "name": "艺术礼品", + "key": "礼品", + "icon": "https://cdn.uviewui.com/uview/common/classify/11/5.jpg", + "cat": 7 + }, + { + "name": "书写工具", + "key": "书写工具", + "icon": "https://cdn.uviewui.com/uview/common/classify/11/6.jpg", + "cat": 7 + }, + { + "name": "车载电器", + "key": "车载电器", + "icon": "https://cdn.uviewui.com/uview/common/classify/11/7.jpg", + "cat": 7 + }, + { + "name": "图书音像", + "key": "图书音像", + "icon": "https://cdn.uviewui.com/uview/common/classify/11/8.jpg", + "cat": 7 + }, + { + "name": "画具画材", + "key": "画具画材", + "icon": "https://cdn.uviewui.com/uview/common/classify/11/9.jpg", + "cat": 7 + } + ] + }, + { + "name": "配饰", + "foods": [ + { + "name": "太阳镜", + "key": "太阳镜", + "icon": "https://cdn.uviewui.com/uview/common/classify/12/1.jpg", + "cat": 0 + }, + { + "name": "皮带", + "key": "皮带", + "icon": "https://cdn.uviewui.com/uview/common/classify/12/2.jpg", + "cat": 0 + }, + { + "name": "棒球帽", + "key": "棒球帽", + "icon": "https://cdn.uviewui.com/uview/common/classify/12/3.jpg", + "cat": 0 + }, + { + "name": "手表", + "key": "手表", + "icon": "https://cdn.uviewui.com/uview/common/classify/12/4.jpg", + "cat": 0 + }, + { + "name": "发饰", + "key": "发饰", + "icon": "https://cdn.uviewui.com/uview/common/classify/12/5.jpg", + "cat": 0 + }, + { + "name": "项链", + "key": "项链", + "icon": "https://cdn.uviewui.com/uview/common/classify/12/6.jpg", + "cat": 0 + }, + { + "name": "手饰", + "key": "手饰", + "icon": "https://cdn.uviewui.com/uview/common/classify/12/7.jpg", + "cat": 0 + }, + { + "name": "耳环", + "key": "耳环", + "icon": "https://cdn.uviewui.com/uview/common/classify/12/8.jpg", + "cat": 0 + }, + { + "name": "帽子丝巾", + "key": "帽子丝巾", + "icon": "https://cdn.uviewui.com/uview/common/classify/12/9.jpg", + "cat": 0 + }, + { + "name": "眼镜墨镜", + "key": "眼镜墨镜", + "icon": "https://cdn.uviewui.com/uview/common/classify/12/10.jpg", + "cat": 0 + }, + { + "name": "发带发箍", + "key": "发带发箍", + "icon": "https://cdn.uviewui.com/uview/common/classify/12/11.jpg", + "cat": 0 + } + ] + }, + { + "name": "家装家纺", + "foods": [ + { + "name": "家居饰品", + "key": "家居饰品", + "icon": "https://cdn.uviewui.com/uview/common/classify/13/1.jpg", + "cat": 0 + }, + { + "name": "凉席", + "key": "凉席", + "icon": "https://cdn.uviewui.com/uview/common/classify/13/2.jpg", + "cat": 0 + }, + { + "name": "背枕靠枕", + "key": "靠枕", + "icon": "https://cdn.uviewui.com/uview/common/classify/13/3.jpg", + "cat": 0 + }, + { + "name": "床上用品", + "key": "床上用品", + "icon": "https://cdn.uviewui.com/uview/common/classify/13/4.jpg", + "cat": 0 + }, + { + "name": "摆件", + "key": "摆件", + "icon": "https://cdn.uviewui.com/uview/common/classify/13/5.jpg", + "cat": 0 + }, + { + "name": "四件套", + "key": "四件套", + "icon": "https://cdn.uviewui.com/uview/common/classify/13/6.jpg", + "cat": 0 + }, + { + "name": "装饰品", + "key": "装饰品", + "icon": "https://cdn.uviewui.com/uview/common/classify/13/7.jpg", + "cat": 0 + }, + { + "name": "卫浴用品", + "key": "卫浴", + "icon": "https://cdn.uviewui.com/uview/common/classify/13/8.jpg", + "cat": 0 + }, + { + "name": "家居家装", + "key": "家具", + "icon": "https://cdn.uviewui.com/uview/common/classify/13/9.jpg", + "cat": 0 + }, + { + "name": "蚊帐", + "key": "蚊帐", + "icon": "https://cdn.uviewui.com/uview/common/classify/13/10.jpg", + "cat": 0 + }, + { + "name": "墙纸贴纸", + "key": "墙纸", + "icon": "https://cdn.uviewui.com/uview/common/classify/13/11.jpg", + "cat": 0 + }, + { + "name": "空调被", + "key": "空调被", + "icon": "https://cdn.uviewui.com/uview/common/classify/13/12.jpg", + "cat": 0 + } + ] + }, + { + "name": "户外运动", + "foods": [ + { + "name": "游泳装备", + "key": "游泳", + "icon": "https://cdn.uviewui.com/uview/common/classify/14/1.jpg", + "cat": 0 + }, + { + "name": "泳镜", + "key": "泳镜", + "icon": "https://cdn.uviewui.com/uview/common/classify/14/2.jpg", + "cat": 0 + }, + { + "name": "户外装备", + "key": "户外", + "icon": "https://cdn.uviewui.com/uview/common/classify/14/3.jpg", + "cat": 0 + }, + { + "name": "健身服饰", + "key": "健身", + "icon": "https://cdn.uviewui.com/uview/common/classify/14/4.jpg", + "cat": 0 + }, + { + "name": "泳衣", + "key": "泳衣", + "icon": "https://cdn.uviewui.com/uview/common/classify/14/5.jpg", + "cat": 0 + }, + { + "name": "瑜伽垫", + "key": "瑜伽垫", + "icon": "https://cdn.uviewui.com/uview/common/classify/14/6.jpg", + "cat": 0 + }, + { + "name": "瑜伽用品", + "key": "瑜伽", + "icon": "https://cdn.uviewui.com/uview/common/classify/14/7.jpg", + "cat": 0 + }, + { + "name": "健身装备", + "key": "健身", + "icon": "https://cdn.uviewui.com/uview/common/classify/14/8.jpg", + "cat": 0 + }, + { + "name": "球迷用品", + "key": "球迷", + "icon": "https://cdn.uviewui.com/uview/common/classify/14/9.jpg", + "cat": 0 + } + ] + } +] \ No newline at end of file diff --git a/common/demo.scss b/common/demo.scss new file mode 100644 index 0000000..547d5d9 --- /dev/null +++ b/common/demo.scss @@ -0,0 +1,86 @@ +/* #ifndef APP-NVUE */ +view, +text { + box-sizing: border-box; +} +/* #endif */ + +/* start--演示页面使用的统一样式--start */ +.u-demo { + padding: 25px 20px; +} + +.u-demo-wrap { + border-width: 1px; + border-color: #ddd; + border-style: dashed; + background-color: rgb(250, 250, 250); + padding: 20px 10px; + border-radius: 3px; +} + +.u-demo-area { + text-align: center; +} + +.u-no-demo-here { + color: $u-tips-color; + font-size: 13px; +} + +.u-demo-result-line { + border-width: 1px; + border-color: #ddd; + border-style: dashed; + padding: 5px 20px; + margin-top: 30px; + border-radius: 5px; + background-color: rgb(240, 240, 240); + color: $u-content-color; + font-size: 16px; + /* #ifndef APP-NVUE */ + word-break: break-word; + display: inline-block; + /* #endif */ + text-align: left; + +} + +.u-demo-title, +.u-config-title { + text-align: center; + font-size: 16px; + font-weight: bold; + margin-bottom: 20px; +} + +.u-config-item { + margin-top: 25px; +} + +.u-config-title { + margin-top: 20px; + padding-bottom: 5px; +} + +.u-item-title { + position: relative; + font-size: 15px; + padding-left: 8px; + line-height: 1; + margin-bottom: 11px; +} + +.u-item-title:after { + position: absolute; + width: 4px; + top: -1px; + height: 16px; + /* #ifndef APP-NVUE */ + content: ''; + /* #endif */ + left: 0; + border-radius: 10px; + background-color: $u-content-color; +} +/* end--演示页面使用的统一样式--end */ diff --git a/common/http.api.js b/common/http.api.js new file mode 100644 index 0000000..b412aaa --- /dev/null +++ b/common/http.api.js @@ -0,0 +1,137 @@ +// 此处第二个参数vm,就是我们在页面使用的this,你可以通过vm获取vuex等操作 +const install = (Vue, vm) => { + // 登录 + let LoginApp = (params = {}) => vm.$u.post('api/Token/LoginApp', params) + // 注册 + let RegisterUser = (params = {}) => vm.$u.post('api/Token/RegisterUser', params); + // 基础资料以及保存用户头像 + let saveUserInfo = (params = {}) => vm.$u.post('app/User/UploadingFormFileHead', params); + // 更新用户定位信息 + let upPosition = (params = {}) => vm.$u.post('app/Position/InsertPosition', params); + // 获取用户当前定位信息 + let getPosition = (params = {}) => vm.$u.get('app/Position/GetPositionByUser', { + userId: vm.vuex_user.id + }); + // 获取所有学校 + let GetAllSchool = (params = {}) => vm.$u.get('app/User/GetSchoolList', params); + //获取首页地图信息 + let HomeMap = (params = {}) => vm.$u.get('/app/User/HomeMap', params); + //修改密码 + let ChangePassword = (params = {}) => vm.$u.post('app/User/ChangePassword', params); + //修改密码 + let myChangePassword = (params = {}) => vm.$u.post('app/My/ChangePassword', params); + // 获取搜索页面相关信息 + let SearchInfo = (params = {}) => vm.$u.get('app/User/SearchRelevant', params); + //获取搜索结果页面 + let getSearch = (params = {}) => vm.$u.get('app/User/GetSearchList', params); + // 获取用户信息 + let getUserInfo = (params = {}) => vm.$u.get('app/User/HomePage', params); + // 获取校友帮帮列表 + let GetHelpList = (params = {}) => vm.$u.get('app/HelpArticle/GetHelpArticleListByKey', params); + // 获取学校资讯 + let GetSchoolList = (params = {}) => vm.$u.get('app/AlumnRange/AlumnRangeSchool', params); + //获取最新的用户信息(更新用户数据) + let getUser = (params = {}) => vm.$u.get('app/User/GetUser', {userId: vm.vuex_user.id}).then(res => { + vm.$u.get('/app/User/GetUserSchool').then(ress => { + // res.isAttestationGLY = ress.isAttestationGLY + // res.isAttestationJZG = ress.isAttestationJZG + // res.isAttestationQY = ress.isAttestationQY + // res.isAttestationXY = res.isAttestationXY + // res.isAttestationZXS = ress.isAttestationZXS + res.schoolId = ress.items.schoolId + vm.$u.vuex('vuex_user', {...res.user,...res.userExtension}) + vm.$u.vuex('vuex_user_hobby', res.lableList) + }) + }) + //获取用户消息列表 + let getcharList = (params = {}) => vm.$u.get('app/Chat/GetUserMessageList', params); + //获取用户获取关注列表 + let getFollowList = (params = {}) => vm.$u.get('app/Chat/GetFollowList', {id: vm.vuex_user.id}); + // 获取系统消息列表 + let getSysList = (params = {}) => vm.$u.get('app/Chat/GetSystemMessageList', {id: vm.vuex_user.id}); + //获取管理消息列表 + let getAdminList = (params = {}) => vm.$u.get('app/Chat/GetManageMessageList', {schoolId: vm.vuex_user.id}); + //获取互动信息列表 + let getinteractionList = (params) => vm.$u.get('app/Chat/GetInterMessageList', {id: vm.vuex_user.id, type: params}); + //校友找找推荐列表 + let getAlumnSearch = (params = {}) => vm.$u.get('app/AlumnRange/AlumnSearch', params); + //获取聊天记录 + let getChatRecord = (params = {}) => vm.$u.get('app/Chat/GetChatRecord', params); + //校友找找列表 + let AlumnSearchList = (params = {}) => vm.$u.get('app/AlumnRange/AlumnSearchList', params); + // 初始化的数据调用微信接口返回参数 + let GetInfoMation = (params = {}) => vm.$u.get('api/Token/GetInfoMation', params); + // 回复绑定 + let toBind = (params = {}) => vm.$u.get('app/Chat/ReplyBind', params); + //我的资讯 + let MyAlumnRange = (params = {}) => vm.$u.get('app/My/MyAlumnRange', params); + // 解除绑定 + let colseBind = (params = {}) => vm.$u.get('app/Chat/UnbindReply', params); + // 删除评论 + let DelateComment = (params = {}) => vm.$u.get('app/AlumnRange/DelateComment', params); + let userVerify = (params = {}) => vm.$u.post('api/Token/IsIdentityCard', params) + + // 获取人脸验证token + let getAPIToken = (params = {}) => vm.$u.post('app/My/GetVerifyToken', params) + // 查询人脸核验结果 + let getVerifyInfo = (params = {}) => vm.$u.post('app/My/GetDetailInfo?VerifyToken=' + params) + // 根据身份证获取信息 + let getInfoByCard = (params = {}) => vm.$u.get('app/User/GetCardByPreConfiguredUser', params); + // 更新身份信息 + let updateCard = (params = {}) => vm.$u.post('api/Token/UpdateCard', params) + + //【手机端】添加心愿 + let PushWishDan = (params = {}) => vm.$u.post("app/My/PushWishDan", params) + + //【手机端】获取个人心愿列表 + let GetWishListAsync_mobile = (params = {}) => vm.$u.get("app/My/GetWishListAsync_mobile", params) + //【手机端】删除心愿 删除=失效 + let DeleteWish = (params = {}) => vm.$u.post("app/My/DeleteWish", params) + //【管理端】获取当前是否开启匿名 开启true 关闭false + let CheckNM = (params = {}) => vm.$u.get("/app/My/CheckNM", params) + + // 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下 + vm.$u.api = { + LoginApp, + RegisterUser, + saveUserInfo, + upPosition, + getPosition, + GetAllSchool, + HomeMap, + ChangePassword, + myChangePassword, + SearchInfo, + getSearch, + getUserInfo, + GetHelpList, + GetSchoolList, + getUser, + getcharList, + getFollowList, + getSysList, + getAdminList, + getinteractionList, + getAlumnSearch, + getChatRecord, + AlumnSearchList, + GetInfoMation, + toBind, + colseBind, + MyAlumnRange, + DelateComment, + userVerify, + GetWishListAsync_mobile, + DeleteWish, + CheckNM, + PushWishDan, + getAPIToken, + getVerifyInfo, + getInfoByCard, + updateCard + }; +} + +export default { + install +} diff --git a/common/http.apiList.js b/common/http.apiList.js new file mode 100644 index 0000000..b5fd25b --- /dev/null +++ b/common/http.apiList.js @@ -0,0 +1,245 @@ +// 此处第二个参数vm,就是我们在页面使用的this,你可以通过vm获取vuex等操作 +const install = (Vue, vm) => { + // 获取行业下所有子行业和标签 + let GetLableList = (params = {}) => vm.$u.get('app/User/GetLableList', params) + // 获取兴趣标签 + let GetInterestLable = (params = {}) => vm.$u.get('app/User/GetInterestLable', params) + // 修改个人资料 + let UpdateUser = (params = {}) => vm.$u.post('app/User/UpdateUser', params); + // 获取所有工作领域 + let GetWorkFile = (params = {}) => vm.$u.get('app/User/GetWorkFileList', params); + // 我的页面 + let MyPage = (params = {}) => vm.$u.get('app/My/MyPage', params); + // 我的教育经历 + let MyEducations = (params = {}) => vm.$u.get('app/My/MyEducations', params); + // 添加教育经历 + let AddEducation = (params = {}) => vm.$u.post('app/My/AddEducation', params); + // 提交校友认证 + let SubmitAttestationXY = (params = {}) => vm.$u.post('app/My/SubmitAttestationXY', params); + // 选择已认证的教育经历 返回学校ID + let SelectEducation = (params = {}) => vm.$u.post('app/My/SelectEducation', params); + // 我的发布 + let Publishs = (params = {}) => vm.$u.get('app/My/Publish', params); + //用户发布学校资讯 + let InsertJournaArticle = (params = {}) => vm.$u.post('app/AlumnRange/InsertJournaArticle', params); + //用户发布帮帮资讯 + let InsertHelpArticle = (params = {}) => vm.$u.post('app/AlumnRange/InsertHelpArticle', params); + //管理员认证 + let AttestationGLY = (params = {}) => vm.$u.get('app/My/AttestationGLY', params); + //提交管理员认证 + let SubmitAttestationGLY = (params = {}) => vm.$u.post('app/My/SubmitAttestationGLY', params); + //教职工认证 + let AttestationJZG = (params = {}) => vm.$u.get('app/My/AttestationJZG', params); + //提交教职工认证 + let SubmitAttestationJZG = (params = {}) => vm.$u.post('app/My/SubmitAttestationJZG', params); + //基础资料以及教职工认证 + let UpdateUserJZG = (params = {}) => vm.$u.post("app/User/UpdateUserJZG", params) + + //企业认证 + let AttestationQY = (params = {}) => vm.$u.get('app/My/AttestationQY', params); + //提交企业认证 + let SubmitAttestationQY = (params = {}) => vm.$u.post('app/My/SubmitAttestationQY', params); + //定位、推荐、消息设置 + let Setting = (params = {}) => vm.$u.post('app/My/Setting', params); + //获取当前登录用户 + let GetUser = (params = {}) => vm.$u.get('app/User/GetUser', params); + //获取所有标签 + let GetSign = (params = {}) => vm.$u.get('app/AlumnRange/GetSign', params); + //关注或取关 + let InsertOrDelFollow = (params = {}) => vm.$u.post('app/Follow/InsertOrDelFollow', params); + //评论 + let InsertComment = (params = {}) => vm.$u.post('app/AlumnRange/InsertComment', params); + //获取文章评论信息 + let GetJournaArticle = (params = {}) => vm.$u.get('app/AlumnRange/GetJournaArticle', params); + //获取评论详细信息 + let GetComment = (params = {}) => vm.$u.get('app/AlumnRange/GetComment', params); + //添加收藏(0资讯,1帮帮) + let LikeCollect = (params = {}) => vm.$u.get('app/AlumnRange/LikeCollect', params); + //点赞(0资讯,1帮帮,2评论) 或取消点赞 + let LikeHe = (params = {}) => vm.$u.get('app/AlumnRange/LikeHe', params); + //用户转发帮帮资讯 + let ForwardHelpArticle = (params = {}) => vm.$u.post('app/AlumnRange/ForwardHelpArticle', params); + //获取用户当前学校信息(未认证为空,未选中默认选择最新认证学校) + let GetUserSchool = (params = {}) => vm.$u.get('app/User/GetUserSchool', params); + //我的收藏 + let Collection = (params = {}) => vm.$u.get('app/My/Collection', params) + //查看用户发布信息 + let UserHelp = (params = {}) => vm.$u.get('app/User/UserHelp', params) + //审核列表 + let AuditList = (params = {}) => vm.$u.get('app/My/AuditList', params) + //审核详情 + let AuditDeatil = (params = {}) => vm.$u.get('app/My/AuditDeatil', params) + //审核 + let Audit = (params = {}) => vm.$u.post('app/My/Audit', params); + //获取手机验证码 + let GetPhoneValidateCode = (params = {}) => vm.$u.post('api/Token/GetPhoneValidateCode', params) + // 获取验证码 + let Captcha = (params = {}) => vm.$u.get('api/Token/Captcha', params) + //根据页面类型获取手机验证码 + let GetAppValidateCode = (params = {}) => vm.$u.post('api/Token/GetAppValidateCode', params) + //验证码是否正确 + let IsPhoneCode = (params = {}) => vm.$u.get('api/Token/IsPhoneCode', params) + //学校资讯 + let AlumnRangeSchool = (params = {}) => vm.$u.get('app/AlumnRange/AlumnRangeSchool', params) + //意见反馈 + let SubmitFeedback = (params = {}) => vm.$u.post('app/My/SubmitFeedback', params) + //获取学校学院列表 + let GetCollegeList = (params = {}) => vm.$u.get('app/User/GetCollegeList', params) + //获取专业列表 + let GetMajorList = (params = {}) => vm.$u.get('app/User/GetMajorList', params) + //获取当前学校是否认证信息 + let GetUserApproval = (params = {}) => vm.$u.get('app/User/GetUserApproval', params) + // 删除未认证教育经历 + let DeleteEducation = (params = {}) => vm.$u.get('app/My/DeleteEducation', params) + // 删除文章 + let DelateArticle = (params = {}) => vm.$u.get('app/AlumnRange/DelateArticle', params) + // 取消收藏 + let CancleCollect = (params = {}) => vm.$u.get('app/My/CancleCollect', params) + //忘记密码 + let ForgotPassword = (params = {}) => vm.$u.post('admin/User/ForgotPassword', params) + //手机申请返校预约 + let AddReturnSchoolApi = (params = {}) => vm.$u.post('app/ReturnSchoolPrebook/AddReturnSchool', params); + // 返校预约列表 - 待审核 + let SelectReturnSchoolList_dshApi = (params = {}) => vm.$u.get('app/ReturnSchoolPrebook/SelectReturnSchoolList_dsh', params) + // 返校预约列表 - 传状态 + let SelectReturnSchoolList_typeApi = (params = {}) => vm.$u.get('app/ReturnSchoolPrebook/SelectReturnSchoolList_type', params) + // 获取返校预约设置 + let SelectInfoSetApi = (params = {}) => vm.$u.get('/app/ReturnSchoolPrebook/SelectInfoSet', params) + // 获取返校预约设置 没token + let SelectInfoSetNoTokenApi = (params = {}) => vm.$u.get('/app/Share/SelectInfoSet', params) + // 返校预约详情 + let SelectReturnSchoolInfoApi = (params = {}) => vm.$u.post('app/ReturnSchoolPrebook/SelectReturnSchoolInfo', params); + // 返校预约详情 没token + let SelectReturnSchoolInfoNotokenApi = (params = {}) => vm.$u.post('/app/Share/SelectReturnSchoolInfo', params); + // 取消返校预约 + let DelReturnSchoolInfoApi = (params = {}) => vm.$u.post('app/ReturnSchoolPrebook/DelReturnSchoolInfo', params); + // 核验二维码 + let SaveReturnSchoolInfoApi = (params = {}) => vm.$u.post('app/ReturnSchoolPrebook/SaveReturnSchoolInfo', params); + // 核验二维码 没token + let SaveReturnSchoolInfoNoTokenApi = (params = {}) => vm.$u.post('app/Share/SaveReturnSchoolInfo', params); + // 获取二维码 + let SaveReturnSchoolVerifyApi = (params = {}) => vm.$u.post('app/ReturnSchoolPrebook/SaveReturnSchoolVerify', params); + // 获取二维码 没token + let SaveReturnSchoolVerifyNoTokenApi = (params = {}) => vm.$u.post('app/Share/SaveReturnSchoolVerify', params); + // 添加工作经历 + let AddWordInfoApi = (params = {}) => vm.$u.post('/app/User/AddWordInfo', params); + // 修改工作经历 + let UpdateWorkInfoApi = (params = {}) => vm.$u.post('/app/User/UpdateWorkInfo', params); + // 删除工作经历 + let DelWorkInfoApi = (params = {}) => vm.$u.post('/app/User/DelWorkInfo', params); + // 添加项目经历 + let AddProjectInfoApi = (params = {}) => vm.$u.post('/app/User/AddProjectInfo', params); + // 修改项目经历 + let UpdateProjectInfoApi = (params = {}) => vm.$u.post('/app/User/UpdateProjectInfo', params); + // 删除项目经历 + let DelProjectInfoApi = (params = {}) => vm.$u.post('/app/User/DelProjectInfo', params); + // 制作简历界面 + let ResumeUserApi = (params = {}) => vm.$u.get('/app/User/ResumeUser', params); + // 附件简历列表 + let GetUserFileApi = (params = {}) => vm.$u.get('/app/User/GetUserFile', params); + // 删除附件 + let DelUserFileApi = (params = {}) => vm.$u.post('/app/User/DelUserFile', params); + // 设置展示简历 + let UpdateUserFileApi = (params = {}) => vm.$u.post('/app/User/UpdateUserFile', params); + // 获取学校ID + let GetUserSchoolApi = (params = {}) => vm.$u.get('/app/User/GetUserSchool', params); + // 获取已预约的日期 + let GetDateTimeReturnApi = (params = {}) => vm.$u.get('/app/ReturnSchoolPrebook/GetDateTimeReturn', params); + // 选择教职工认证 + let SelectJZGApi = (params = {}) => vm.$u.post('/app/My/SelectJZG', params); + + let ForgotPasswordValidate = (params = {}) => vm.$u.post('/admin/User/ForgotPasswordValidate', params); + //忘记密码-验证验证码 + + // 删除 + let DeleteJZGApi = (params = {}) => vm.$u.get('/app/My/DeleteJZG', params); + // 返回判断用户身份信息 + let SelectUserTypeApi = (params = {}) => vm.$u.get('/app/My/SelectUserType', params); + // 更新切换用户身份UserType + let UpdateUserTypeApi = (params = {}) => vm.$u.get('/app/My/UpdateUserType', params); + // 将各个定义的接口名称,统一放进对象挂载到vm.$u.apiList(因为vm就是this,也即this.$u.apiList)下 + vm.$u.apiList = { + Captcha, + GetInterestLable, + GetLableList, + SelectUserTypeApi, + UpdateUserTypeApi, + ForgotPasswordValidate, + DeleteJZGApi, + SelectJZGApi, + GetDateTimeReturnApi, + AddReturnSchoolApi, + GetUserSchoolApi, + UpdateUserFileApi, + DelUserFileApi, + AddWordInfoApi, + GetUserFileApi, + DelWorkInfoApi, + UpdateProjectInfoApi, + DelProjectInfoApi, + AddProjectInfoApi, + UpdateWorkInfoApi, + ResumeUserApi, + SaveReturnSchoolVerifyApi, + SelectInfoSetApi, + SelectInfoSetNoTokenApi, + SelectReturnSchoolList_dshApi, + SelectReturnSchoolList_typeApi, + SelectReturnSchoolInfoApi, + SaveReturnSchoolInfoNoTokenApi, + SaveReturnSchoolVerifyNoTokenApi, + SelectReturnSchoolInfoNotokenApi, + DelReturnSchoolInfoApi, + SaveReturnSchoolInfoApi, + UpdateUser, + GetWorkFile, + MyPage, + MyEducations, + AddEducation, + SubmitAttestationXY, + SelectEducation, + Publishs, + InsertJournaArticle, + InsertHelpArticle, + AttestationGLY, + SubmitAttestationGLY, + AttestationJZG, + SubmitAttestationJZG, + AttestationQY, + SubmitAttestationQY, + Setting, + GetUser, + GetSign, + InsertOrDelFollow, + InsertComment, + GetJournaArticle, + GetComment, + LikeCollect, + LikeHe, + ForwardHelpArticle, + GetUserSchool, + Collection, + UserHelp, + AuditList, + AuditDeatil, + ForwardHelpArticle, + Audit, + GetPhoneValidateCode, + AlumnRangeSchool, + IsPhoneCode, + SubmitFeedback, + GetCollegeList, + GetMajorList, + GetUserApproval, + DeleteEducation, + DelateArticle, + CancleCollect, + GetAppValidateCode, + ForgotPassword, + UpdateUserJZG + }; +} + +export default { + install +} diff --git a/common/http.interceptor.js b/common/http.interceptor.js new file mode 100644 index 0000000..53b347e --- /dev/null +++ b/common/http.interceptor.js @@ -0,0 +1,64 @@ +// 这里的vm,就是我们在vue文件里面的this,所以我们能在这里获取vuex的变量,比如存放在里面的token +// 同时,我们也可以在此使用getApp().globalData,如果你把token放在getApp().globalData的话,也是可以使用的 +const install = (Vue, vm) => { + Vue.prototype.$u.http.setConfig({ + // baseUrl: 'https://xy.apps.service.zheke.com', + // imgUrl: 'https://xy.apps.service.zheke.com/', + baseUrl: 'http://sl.vrgon.com:8003', + imgUrl: 'http://sl.vrgon.com:8003/', + // imgUrl:'http://115.238.47.235:8987/', + // baseUrl: 'http://115.238.47.235:8993', + // 如果将此值设置为true,拦截回调中将会返回服务端返回的所有数据response,而不是response.data + // 设置为true后,就需要在this.$u.http.interceptor.response进行多一次的判断,请打印查看具体值 + // originalData: true, + // 设置自定义头部content-type + // header: { + // 'content-type': 'xxx' + // } + }); + // 请求拦截,配置Token等参数 + Vue.prototype.$u.http.interceptor.request = (config) => { + + // config.header.Token = 'xxxxxx'; + // 方式一,存放在vuex的token,假设 ,见:https://uviewui.com/components/globalVariable.html + config.header.Authorization = 'Bearer ' + vm.vuex_token; + // 方式二,如果没有使用uView封装的vuex方法,那么需要使用$store.state获取 + // config.header.token = vm.$store.state.token; + + // 方式三,如果token放在了globalData,通过getApp().globalData获取 + // config.header.token = getApp().globalData.username; + + // 方式四,如果token放在了Storage本地存储中,拦截是每次请求都执行的,所以哪怕您重新登录修改了Storage,下一次的请求将会是最新值 + // const token = uni.getStorageSync('token'); + // config.header.token = token; + uni.showLoading({ + title: '加载中' + }); + // setTimeout(function () { + // uni.hideLoading(); + // }, 2000); + + return config; + } + // 响应拦截,判断状态码是否通过 + Vue.prototype.$u.http.interceptor.response = (res) => { + uni.hideLoading(); + if (res.succeed == true || res.success == true) { + return res.data || res; + } else { + // uni.showToast({ + // title: res.error, + // duration: 2000, + // icon: 'none' + // }); + // uni.navigateTo({ + // url: "/pages/login/login/login", + // }); + return false; + } + } +} + +export default { + install +} diff --git a/common/index.list.js b/common/index.list.js new file mode 100644 index 0000000..7e0f5ed --- /dev/null +++ b/common/index.list.js @@ -0,0 +1,585 @@ +module.exports = { + list: [{ + "letter": "A", + "data": [{ + "name": "阿拉斯加", + "mobile": "13588889999", + "keyword": "阿拉斯加ABA13588889999" + }, + { + "name": "阿克苏", + "mobile": "0551-4386721", + "keyword": "阿克苏AKESU0551-4386721" + }, + { + "name": "阿拉善", + "mobile": "4008009100", + "keyword": "阿拉善ALASHAN4008009100" + }, + { + "name": "阿勒泰", + "mobile": "13588889999", + "keyword": "阿勒泰ALETAI13588889999" + }, + { + "name": "阿里", + "mobile": "13588889999", + "keyword": "阿里ALI13588889999" + }, + { + "name": "安阳", + "mobile": "13588889999", + "keyword": "13588889999安阳ANYANG" + } + ] + }, + { + "letter": "B", + "data": [{ + "name": "白城", + "mobile": "该主子没有留电话~", + "keyword": "白城BAICHENG" + }, + { + "name": "白山", + "mobile": "13588889999", + "keyword": "白山BAISHAN13588889999" + }, + { + "name": "白银", + "mobile": "13588889999", + "keyword": "白银BAIYIN13588889999" + }, + { + "name": "保定", + "mobile": "13588889999", + "keyword": "保定BAODING13588889999" + } + ] + }, + { + "letter": "C", + "data": [{ + "name": "沧州", + "mobile": "13588889999", + "keyword": "沧州CANGZHOU13588889999" + }, + { + "name": "长春", + "mobile": "13588889999", + "keyword": "长春CHANGCHUN13588889999" + } + ] + }, + { + "letter": "D", + "data": [{ + "name": "大理", + "mobile": "13588889999", + "keyword": "大理DALI13588889999" + }, + { + "name": "大连", + "mobile": "13588889999", + "keyword": "大连DALIAN13588889999" + } + ] + }, + { + "letter": "E", + "data": [{ + "name": "鄂尔多斯", + "mobile": "13588889999", + "keyword": "鄂尔多斯EERDUOSI13588889999" + }, + { + "name": "恩施", + "mobile": "13588889999", + "keyword": "恩施ENSHI13588889999" + }, + { + "name": "鄂州", + "mobile": "13588889999", + "keyword": "鄂州EZHOU13588889999" + } + ] + }, + { + "letter": "F", + "data": [{ + "name": "防城港", + "mobile": "该主子没有留电话~", + "keyword": "防城港FANGCHENGGANG" + }, + { + "name": "抚顺", + "mobile": "13588889999", + "keyword": "抚顺FUSHUN13588889999" + }, + { + "name": "阜新", + "mobile": "13588889999", + "keyword": "阜新FUXIN13588889999" + }, + { + "name": "阜阳", + "mobile": "13588889999", + "keyword": "阜阳FUYANG13588889999" + }, + { + "name": "抚州", + "mobile": "13588889999", + "keyword": "抚州FUZHOU13588889999" + }, + { + "name": "福州", + "mobile": "13588889999", + "keyword": "福州FUZHOU13588889999" + } + ] + }, + { + "letter": "G", + "data": [{ + "name": "甘南", + "mobile": "13588889999", + "keyword": "甘南GANNAN13588889999" + }, + { + "name": "赣州", + "mobile": "13588889999", + "keyword": "赣州GANZHOU13588889999" + }, + { + "name": "甘孜", + "mobile": "13588889999", + "keyword": "甘孜GANZI13588889999" + } + ] + }, + { + "letter": "H", + "data": [{ + "name": "哈尔滨", + "mobile": "13588889999", + "keyword": "哈尔滨HAERBIN13588889999" + }, + { + "name": "海北", + "mobile": "13588889999", + "keyword": "海北HAIBEI13588889999" + }, + { + "name": "海东", + "mobile": "13588889999", + "keyword": "海东HAIDONG13588889999" + }, + { + "name": "海口", + "mobile": "13588889999", + "keyword": "海口HAIKOU13588889999" + } + ] + }, + { + "letter": "I", + "data": [{ + "name": "ice", + "mobile": "13588889999", + "keyword": "佳木斯JIAMUSI13588889999" + }] + }, + { + "letter": "J", + "data": [{ + "name": "佳木斯", + "mobile": "13588889999", + "keyword": "佳木斯JIAMUSI13588889999" + }, + { + "name": "吉安", + "mobile": "13588889999", + "keyword": "吉安JIAN13588889999" + }, + { + "name": "江门", + "mobile": "13588889999", + "keyword": "江门JIANGMEN13588889999" + } + ] + }, + { + "letter": "K", + "data": [{ + "name": "开封", + "mobile": "13588889999", + "keyword": "开封KAIFENG13588889999" + }, + { + "name": "喀什", + "mobile": "13588889999", + "keyword": "喀什KASHI13588889999" + }, + { + "name": "克拉玛依", + "mobile": "13588889999", + "keyword": "克拉玛依KELAMAYI13588889999" + } + ] + }, + { + "letter": "L", + "data": [{ + "name": "来宾", + "mobile": "13588889999", + "keyword": "来宾LAIBIN13588889999" + }, + { + "name": "兰州", + "mobile": "13588889999", + "keyword": "兰州LANZHOU13588889999" + }, + { + "name": "拉萨", + "mobile": "13588889999", + "keyword": "拉萨LASA13588889999" + }, + { + "name": "乐山", + "mobile": "13588889999", + "keyword": "乐山LESHAN13588889999" + }, + { + "name": "凉山", + "mobile": "13588889999", + "keyword": "凉山LIANGSHAN13588889999" + }, + { + "name": "连云港", + "mobile": "13588889999", + "keyword": "连云港LIANYUNGANG13588889999" + }, + { + "name": "聊城", + "mobile": "18322223333", + "keyword": "聊城LIAOCHENG18322223333" + }, + { + "name": "辽阳", + "mobile": "18322223333", + "keyword": "辽阳LIAOYANG18322223333" + }, + { + "name": "辽源", + "mobile": "18322223333", + "keyword": "辽源LIAOYUAN18322223333" + }, + { + "name": "丽江", + "mobile": "18322223333", + "keyword": "丽江LIJIANG18322223333" + }, + { + "name": "临沧", + "mobile": "18322223333", + "keyword": "临沧LINCANG18322223333" + }, + { + "name": "临汾", + "mobile": "18322223333", + "keyword": "临汾LINFEN18322223333" + }, + { + "name": "临夏", + "mobile": "18322223333", + "keyword": "临夏LINXIA18322223333" + }, + { + "name": "临沂", + "mobile": "18322223333", + "keyword": "临沂LINYI18322223333" + }, + { + "name": "林芝", + "mobile": "18322223333", + "keyword": "林芝LINZHI18322223333" + }, + { + "name": "丽水", + "mobile": "18322223333", + "keyword": "丽水LISHUI18322223333" + } + ] + }, + { + "letter": "M", + "data": [{ + "name": "眉山", + "mobile": "15544448888", + "keyword": "眉山MEISHAN15544448888" + }, + { + "name": "梅州", + "mobile": "15544448888", + "keyword": "梅州MEIZHOU15544448888" + }, + { + "name": "绵阳", + "mobile": "15544448888", + "keyword": "绵阳MIANYANG15544448888" + }, + { + "name": "牡丹江", + "mobile": "15544448888", + "keyword": "牡丹江MUDANJIANG15544448888" + } + ] + }, + { + "letter": "N", + "data": [{ + "name": "南昌", + "mobile": "15544448888", + "keyword": "南昌NANCHANG15544448888" + }, + { + "name": "南充", + "mobile": "15544448888", + "keyword": "南充NANCHONG15544448888" + }, + { + "name": "南京", + "mobile": "15544448888", + "keyword": "南京NANJING15544448888" + }, + { + "name": "南宁", + "mobile": "15544448888", + "keyword": "南宁NANNING15544448888" + }, + { + "name": "南平", + "mobile": "15544448888", + "keyword": "南平NANPING15544448888" + } + ] + }, + { + "letter": "O", + "data": [{ + "name": "欧阳", + "mobile": "15544448888", + "keyword": "欧阳ouyang15544448888" + }] + }, + { + "letter": "P", + "data": [{ + "name": "盘锦", + "mobile": "15544448888", + "keyword": "盘锦PANJIN15544448888" + }, + { + "name": "攀枝花", + "mobile": "15544448888", + "keyword": "攀枝花PANZHIHUA15544448888" + }, + { + "name": "平顶山", + "mobile": "15544448888", + "keyword": "平顶山PINGDINGSHAN15544448888" + }, + { + "name": "平凉", + "mobile": "15544448888", + "keyword": "平凉PINGLIANG15544448888" + }, + { + "name": "萍乡", + "mobile": "15544448888", + "keyword": "萍乡PINGXIANG15544448888" + }, + { + "name": "普洱", + "mobile": "15544448888", + "keyword": "普洱PUER15544448888" + }, + { + "name": "莆田", + "mobile": "15544448888", + "keyword": "莆田PUTIAN15544448888" + }, + { + "name": "濮阳", + "mobile": "15544448888", + "keyword": "濮阳PUYANG15544448888" + } + ] + }, + { + "letter": "Q", + "data": [{ + "name": "黔东南", + "mobile": "15544448888", + "keyword": "黔东南QIANDONGNAN15544448888" + }, + { + "name": "黔南", + "mobile": "15544448888", + "keyword": "黔南QIANNAN15544448888" + }, + { + "name": "黔西南", + "mobile": "15544448888", + "keyword": "黔西南QIANXINAN15544448888" + } + ] + }, + { + "letter": "R", + "data": [{ + "name": "日喀则", + "mobile": "15544448888", + "keyword": "日喀则RIKAZE15544448888" + }, + { + "name": "日照", + "mobile": "15544448888", + "keyword": "日照RIZHAO15544448888" + } + ] + }, + { + "letter": "S", + "data": [{ + "name": "三门峡", + "mobile": "15544448888", + "keyword": "三门峡SANMENXIA15544448888" + }, + { + "name": "三明", + "mobile": "15544448888", + "keyword": "三明SANMING15544448888" + }, + { + "name": "三沙", + "mobile": "15544448888", + "keyword": "三沙SANSHA15544448888" + } + ] + }, + { + "letter": "T", + "data": [{ + "name": "塔城", + "mobile": "15544448888", + "keyword": "塔城TACHENG15544448888" + }, + { + "name": "漯河", + "mobile": "15544448888", + "keyword": "漯河TAHE15544448888" + }, + { + "name": "泰安", + "mobile": "15544448888", + "keyword": "泰安TAIAN15544448888" + } + ] + }, + { + "letter": "W", + "data": [{ + "name": "潍坊", + "mobile": "15544448888", + "keyword": "潍坊WEIFANG15544448888" + }, + { + "name": "威海", + "mobile": "15544448888", + "keyword": "威海WEIHAI15544448888" + }, + { + "name": "渭南", + "mobile": "15544448888", + "keyword": "渭南WEINAN15544448888" + }, + { + "name": "文山", + "mobile": "15544448888", + "keyword": "文山WENSHAN15544448888" + } + ] + }, + { + "letter": "X", + "data": [{ + "name": "厦门", + "mobile": "15544448888", + "keyword": "厦门XIAMEN15544448888" + }, + { + "name": "西安", + "mobile": "15544448888", + "keyword": "西安XIAN15544448888" + }, + { + "name": "湘潭", + "mobile": "15544448888", + "keyword": "湘潭XIANGTAN15544448888" + } + ] + }, + { + "letter": "Y", + "data": [{ + "name": "雅安", + "mobile": "15544448888", + "keyword": "雅安YAAN15544448888" + }, + { + "name": "延安", + "mobile": "15544448888", + "keyword": "延安YANAN15544448888" + }, + { + "name": "延边", + "mobile": "15544448888", + "keyword": "延边YANBIAN15544448888" + }, + { + "name": "盐城", + "mobile": "15544448888", + "keyword": "盐城YANCHENG15544448888" + } + ] + }, + { + "letter": "Z", + "data": [{ + "name": "枣庄", + "mobile": "15544448888", + "keyword": "枣庄ZAOZHUANG15544448888" + }, + { + "name": "张家界", + "mobile": "15544448888", + "keyword": "张家界ZHANGJIAJIE15544448888" + }, + { + "name": "张家口", + "mobile": "15544448888", + "keyword": "张家口ZHANGJIAKOU15544448888" + } + ] + }, + { + "letter": "#", + "data": [{ + "name": "其他.", + "mobile": "16666666666", + "keyword": "echo16666666666" + }] + } + ] +} diff --git a/common/locales/en.js b/common/locales/en.js new file mode 100644 index 0000000..5bd6f7a --- /dev/null +++ b/common/locales/en.js @@ -0,0 +1,21 @@ +export default { + // 可以以页面为单位来写,比如首页的内容,写在index字段,个人中心写在center,共同部分写在common部分 + components: { + desc: 'Numerous components cover the various requirements of the development process, and the components are rich in functions and compatible with multiple terminals. Let you integrate quickly, out of the box' + }, + js: { + desc: 'Numerous intimate gadgets are a weapon that you can call upon during the development process, allowing you to dart in your hand and pierce the Yang with a hundred steps' + }, + template: { + desc: 'Collection of many commonly used pages and layouts, reducing the repetitive work of developers, allowing you to focus on logic and get twice the result with half the effort' + }, + nav: { + components: 'Components', + js: 'JS', + template: 'Template' + }, + common: { + intro: 'UI framework for rapid development of multiple platforms', + title: 'uView UI', + }, +} \ No newline at end of file diff --git a/common/locales/zh.js b/common/locales/zh.js new file mode 100644 index 0000000..1c6b15c --- /dev/null +++ b/common/locales/zh.js @@ -0,0 +1,21 @@ +export default { + // 可以以页面为单位来写,比如首页的内容,写在index字段,个人中心写在center,共同部分写在common部分 + components: { + desc: '众多组件覆盖开发过程的各个需求,组件功能丰富,多端兼容。让你快速集成,开箱即用' + }, + js: { + desc: '众多的贴心小工具,是你开发过程中召之即来的利器,让你飞镖在手,百步穿杨' + }, + template: { + desc: '收集众多的常用页面和布局,减少开发者的重复工作,让你专注逻辑,事半功倍' + }, + nav: { + components: '组件', + js: '工具', + template: '模板' + }, + common: { + intro: '多平台快速开发的UI框架', + title: 'uView UI', + }, +} \ No newline at end of file diff --git a/common/utils.js b/common/utils.js new file mode 100644 index 0000000..6f5da6b --- /dev/null +++ b/common/utils.js @@ -0,0 +1,16 @@ +export const Debounce = (fn, wait) => { + let delay = wait|| 500 + let timer + return function () { + let args = arguments; + if (timer) { + clearTimeout(timer) + } + + let callNow = !timer + timer = setTimeout(() => { + timer = null + }, delay) + if (callNow) fn.apply(this, args) + } +} diff --git a/common/vue-i18n.min.js b/common/vue-i18n.min.js new file mode 100644 index 0000000..8d0a5c0 --- /dev/null +++ b/common/vue-i18n.min.js @@ -0,0 +1,6 @@ +/*! + * vue-i18n v8.20.0 + * (c) 2020 kazuya kawaguchi + * Released under the MIT License. + */ +var t,e;t=this,e=function(){"use strict";var t=["style","currency","currencyDisplay","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","localeMatcher","formatMatcher","unit"];function e(t,e){"undefined"!=typeof console&&(console.warn("[vue-i18n] "+t),e&&console.warn(e.stack))}var n=Array.isArray;function r(t){return null!==t&&"object"==typeof t}function a(t){return"string"==typeof t}var i=Object.prototype.toString,o="[object Object]";function s(t){return i.call(t)===o}function l(t){return null==t}function c(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var n=null,a=null;return 1===t.length?r(t[0])||Array.isArray(t[0])?a=t[0]:"string"==typeof t[0]&&(n=t[0]):2===t.length&&("string"==typeof t[0]&&(n=t[0]),(r(t[1])||Array.isArray(t[1]))&&(a=t[1])),{locale:n,params:a}}function u(t){return JSON.parse(JSON.stringify(t))}function h(t,e){return!!~t.indexOf(e)}var f=Object.prototype.hasOwnProperty;function p(t,e){return f.call(t,e)}function m(t){for(var e=arguments,n=Object(t),a=1;a0;)e[n]=arguments[n+1];var r=this.$i18n;return r._t.apply(r,[t,r.locale,r._getMessages(),this].concat(e))},t.prototype.$tc=function(t,e){for(var n=[],r=arguments.length-2;r-- >0;)n[r]=arguments[r+2];var a=this.$i18n;return a._tc.apply(a,[t,a.locale,a._getMessages(),this,e].concat(n))},t.prototype.$te=function(t,e){var n=this.$i18n;return n._te(t,n.locale,n._getMessages(),e)},t.prototype.$d=function(t){for(var e,n=[],r=arguments.length-1;r-- >0;)n[r]=arguments[r+1];return(e=this.$i18n).d.apply(e,[t].concat(n))},t.prototype.$n=function(t){for(var e,n=[],r=arguments.length-1;r-- >0;)n[r]=arguments[r+1];return(e=this.$i18n).n.apply(e,[t].concat(n))}}(F),F.mixin(g),F.directive("t",{bind:w,update:$,unbind:M}),F.component(v.name,v),F.component(k.name,k),F.config.optionMergeStrategies.i18n=function(t,e){return void 0===e?t:e}}var D=function(){this._caches=Object.create(null)};D.prototype.interpolate=function(t,e){if(!e)return[t];var n=this._caches[t];return n||(n=function(t){var e=[],n=0,r="";for(;n0)h--,u=R,f[W]();else{if(h=0,void 0===n)return!1;if(!1===(n=J(n)))return!1;f[j]()}};null!==u;)if("\\"!==(e=t[++c])||!p()){if(a=U(e),(i=(s=z[u])[a]||s.else||E)===E)return;if(u=i[0],(o=f[i[1]])&&(r=void 0===(r=i[2])?e:r,!1===o()))return;if(u===V)return l}}(t))&&(this._cache[t]=e),e||[]},q.prototype.getPathValue=function(t,e){if(!r(t))return null;var n=this.parsePath(e);if(0===n.length)return null;for(var a=n.length,i=t,o=0;o/,Z=/(?:@(?:\.[a-z]+)?:(?:[\w\-_|.]+|\([\w\-_|.]+\)))/g,K=/^@(?:\.([a-z]+))?:/,Q=/[()]/g,Y={upper:function(t){return t.toLocaleUpperCase()},lower:function(t){return t.toLocaleLowerCase()},capitalize:function(t){return""+t.charAt(0).toLocaleUpperCase()+t.substr(1)}},tt=new D,et=function(t){var e=this;void 0===t&&(t={}),!F&&"undefined"!=typeof window&&window.Vue&&I(window.Vue);var n=t.locale||"en-US",r=!1!==t.fallbackLocale&&(t.fallbackLocale||"en-US"),a=t.messages||{},i=t.dateTimeFormats||{},o=t.numberFormats||{};this._vm=null,this._formatter=t.formatter||tt,this._modifiers=t.modifiers||{},this._missing=t.missing||null,this._root=t.root||null,this._sync=void 0===t.sync||!!t.sync,this._fallbackRoot=void 0===t.fallbackRoot||!!t.fallbackRoot,this._formatFallbackMessages=void 0!==t.formatFallbackMessages&&!!t.formatFallbackMessages,this._silentTranslationWarn=void 0!==t.silentTranslationWarn&&t.silentTranslationWarn,this._silentFallbackWarn=void 0!==t.silentFallbackWarn&&!!t.silentFallbackWarn,this._dateTimeFormatters={},this._numberFormatters={},this._path=new q,this._dataListeners=[],this._componentInstanceCreatedListener=t.componentInstanceCreatedListener||null,this._preserveDirectiveContent=void 0!==t.preserveDirectiveContent&&!!t.preserveDirectiveContent,this.pluralizationRules=t.pluralizationRules||{},this._warnHtmlInMessage=t.warnHtmlInMessage||"off",this._postTranslation=t.postTranslation||null,this.getChoiceIndex=function(t,n){var r=Object.getPrototypeOf(e);if(r&&r.getChoiceIndex)return r.getChoiceIndex.call(e,t,n);var a,i;return e.locale in e.pluralizationRules?e.pluralizationRules[e.locale].apply(e,[t,n]):(a=t,i=n,a=Math.abs(a),2===i?a?a>1?1:0:1:a?Math.min(a,2):0)},this._exist=function(t,n){return!(!t||!n)&&(!l(e._path.getPathValue(t,n))||!!t[n])},"warn"!==this._warnHtmlInMessage&&"error"!==this._warnHtmlInMessage||Object.keys(a).forEach(function(t){e._checkLocaleMessage(t,e._warnHtmlInMessage,a[t])}),this._initVM({locale:n,fallbackLocale:r,messages:a,dateTimeFormats:i,numberFormats:o})},nt={vm:{configurable:!0},messages:{configurable:!0},dateTimeFormats:{configurable:!0},numberFormats:{configurable:!0},availableLocales:{configurable:!0},locale:{configurable:!0},fallbackLocale:{configurable:!0},formatFallbackMessages:{configurable:!0},missing:{configurable:!0},formatter:{configurable:!0},silentTranslationWarn:{configurable:!0},silentFallbackWarn:{configurable:!0},preserveDirectiveContent:{configurable:!0},warnHtmlInMessage:{configurable:!0},postTranslation:{configurable:!0}};return et.prototype._checkLocaleMessage=function(t,n,r){var i=function(t,n,r,o){if(s(r))Object.keys(r).forEach(function(e){var a=r[e];s(a)?(o.push(e),o.push("."),i(t,n,a,o),o.pop(),o.pop()):(o.push(e),i(t,n,a,o),o.pop())});else if(Array.isArray(r))r.forEach(function(e,r){s(e)?(o.push("["+r+"]"),o.push("."),i(t,n,e,o),o.pop(),o.pop()):(o.push("["+r+"]"),i(t,n,e,o),o.pop())});else if(a(r)){if(X.test(r)){var l="Detected HTML in message '"+r+"' of keypath '"+o.join("")+"' at '"+n+"'. Consider component interpolation with '' to avoid XSS. See https://bit.ly/2ZqJzkp";"warn"===t?e(l):"error"===t&&function(t,e){"undefined"!=typeof console&&(console.error("[vue-i18n] "+t),e&&console.error(e.stack))}(l)}}};i(n,t,r,[])},et.prototype._initVM=function(t){var e=F.config.silent;F.config.silent=!0,this._vm=new F({data:t}),F.config.silent=e},et.prototype.destroyVM=function(){this._vm.$destroy()},et.prototype.subscribeDataChanging=function(t){this._dataListeners.push(t)},et.prototype.unsubscribeDataChanging=function(t){!function(t,e){if(t.length){var n=t.indexOf(e);if(n>-1)t.splice(n,1)}}(this._dataListeners,t)},et.prototype.watchI18nData=function(){var t=this;return this._vm.$watch("$data",function(){for(var e=t._dataListeners.length;e--;)F.nextTick(function(){t._dataListeners[e]&&t._dataListeners[e].$forceUpdate()})},{deep:!0})},et.prototype.watchLocale=function(){if(!this._sync||!this._root)return null;var t=this._vm;return this._root.$i18n.vm.$watch("locale",function(e){t.$set(t,"locale",e),t.$forceUpdate()},{immediate:!0})},et.prototype.onComponentInstanceCreated=function(t){this._componentInstanceCreatedListener&&this._componentInstanceCreatedListener(t,this)},nt.vm.get=function(){return this._vm},nt.messages.get=function(){return u(this._getMessages())},nt.dateTimeFormats.get=function(){return u(this._getDateTimeFormats())},nt.numberFormats.get=function(){return u(this._getNumberFormats())},nt.availableLocales.get=function(){return Object.keys(this.messages).sort()},nt.locale.get=function(){return this._vm.locale},nt.locale.set=function(t){this._vm.$set(this._vm,"locale",t)},nt.fallbackLocale.get=function(){return this._vm.fallbackLocale},nt.fallbackLocale.set=function(t){this._localeChainCache={},this._vm.$set(this._vm,"fallbackLocale",t)},nt.formatFallbackMessages.get=function(){return this._formatFallbackMessages},nt.formatFallbackMessages.set=function(t){this._formatFallbackMessages=t},nt.missing.get=function(){return this._missing},nt.missing.set=function(t){this._missing=t},nt.formatter.get=function(){return this._formatter},nt.formatter.set=function(t){this._formatter=t},nt.silentTranslationWarn.get=function(){return this._silentTranslationWarn},nt.silentTranslationWarn.set=function(t){this._silentTranslationWarn=t},nt.silentFallbackWarn.get=function(){return this._silentFallbackWarn},nt.silentFallbackWarn.set=function(t){this._silentFallbackWarn=t},nt.preserveDirectiveContent.get=function(){return this._preserveDirectiveContent},nt.preserveDirectiveContent.set=function(t){this._preserveDirectiveContent=t},nt.warnHtmlInMessage.get=function(){return this._warnHtmlInMessage},nt.warnHtmlInMessage.set=function(t){var e=this,n=this._warnHtmlInMessage;if(this._warnHtmlInMessage=t,n!==t&&("warn"===t||"error"===t)){var r=this._getMessages();Object.keys(r).forEach(function(t){e._checkLocaleMessage(t,e._warnHtmlInMessage,r[t])})}},nt.postTranslation.get=function(){return this._postTranslation},nt.postTranslation.set=function(t){this._postTranslation=t},et.prototype._getMessages=function(){return this._vm.messages},et.prototype._getDateTimeFormats=function(){return this._vm.dateTimeFormats},et.prototype._getNumberFormats=function(){return this._vm.numberFormats},et.prototype._warnDefault=function(t,e,n,r,i,o){if(!l(n))return n;if(this._missing){var s=this._missing.apply(null,[t,e,r,i]);if(a(s))return s}if(this._formatFallbackMessages){var u=c.apply(void 0,i);return this._render(e,o,u.params,e)}return e},et.prototype._isFallbackRoot=function(t){return!t&&!l(this._root)&&this._fallbackRoot},et.prototype._isSilentFallbackWarn=function(t){return this._silentFallbackWarn instanceof RegExp?this._silentFallbackWarn.test(t):this._silentFallbackWarn},et.prototype._isSilentFallback=function(t,e){return this._isSilentFallbackWarn(e)&&(this._isFallbackRoot()||t!==this.fallbackLocale)},et.prototype._isSilentTranslationWarn=function(t){return this._silentTranslationWarn instanceof RegExp?this._silentTranslationWarn.test(t):this._silentTranslationWarn},et.prototype._interpolate=function(t,e,n,r,i,o,c){if(!e)return null;var u,h=this._path.getPathValue(e,n);if(Array.isArray(h)||s(h))return h;if(l(h)){if(!s(e))return null;if(!a(u=e[n]))return null}else{if(!a(h))return null;u=h}return(u.indexOf("@:")>=0||u.indexOf("@.")>=0)&&(u=this._link(t,e,u,r,"raw",o,c)),this._render(u,i,o,n)},et.prototype._link=function(t,e,n,r,a,i,o){var s=n,l=s.match(Z);for(var c in l)if(l.hasOwnProperty(c)){var u=l[c],f=u.match(K),p=f[0],m=f[1],_=u.replace(p,"").replace(Q,"");if(h(o,_))return s;o.push(_);var g=this._interpolate(t,e,_,r,"raw"===a?"string":a,"raw"===a?void 0:i,o);if(this._isFallbackRoot(g)){if(!this._root)throw Error("unexpected error");var v=this._root.$i18n;g=v._translate(v._getMessages(),v.locale,v.fallbackLocale,_,r,a,i)}g=this._warnDefault(t,_,g,r,Array.isArray(i)?i:[i],a),this._modifiers.hasOwnProperty(m)?g=this._modifiers[m](g):Y.hasOwnProperty(m)&&(g=Y[m](g)),o.pop(),s=g?s.replace(u,g):s}return s},et.prototype._render=function(t,e,n,r){var i=this._formatter.interpolate(t,n,r);return i||(i=tt.interpolate(t,n,r)),"string"!==e||a(i)?i:i.join("")},et.prototype._appendItemToChain=function(t,e,n){var r=!1;return h(t,e)||(r=!0,e&&(r="!"!==e[e.length-1],e=e.replace(/!/g,""),t.push(e),n&&n[e]&&(r=n[e]))),r},et.prototype._appendLocaleToChain=function(t,e,n){var r,a=e.split("-");do{var i=a.join("-");r=this._appendItemToChain(t,i,n),a.splice(-1,1)}while(a.length&&!0===r);return r},et.prototype._appendBlockToChain=function(t,e,n){for(var r=!0,i=0;i0;)i[o]=arguments[o+4];if(!t)return"";var s=c.apply(void 0,i),l=s.locale||e,u=this._translate(n,l,this.fallbackLocale,t,r,"string",s.params);if(this._isFallbackRoot(u)){if(!this._root)throw Error("unexpected error");return(a=this._root).$t.apply(a,[t].concat(i))}return u=this._warnDefault(l,t,u,r,i,"string"),this._postTranslation&&null!=u&&(u=this._postTranslation(u,t)),u},et.prototype.t=function(t){for(var e,n=[],r=arguments.length-1;r-- >0;)n[r]=arguments[r+1];return(e=this)._t.apply(e,[t,this.locale,this._getMessages(),null].concat(n))},et.prototype._i=function(t,e,n,r,a){var i=this._translate(n,e,this.fallbackLocale,t,r,"raw",a);if(this._isFallbackRoot(i)){if(!this._root)throw Error("unexpected error");return this._root.$i18n.i(t,e,a)}return this._warnDefault(e,t,i,r,[a],"raw")},et.prototype.i=function(t,e,n){return t?(a(e)||(e=this.locale),this._i(t,e,this._getMessages(),null,n)):""},et.prototype._tc=function(t,e,n,r,a){for(var i,o=[],s=arguments.length-5;s-- >0;)o[s]=arguments[s+5];if(!t)return"";void 0===a&&(a=1);var l={count:a,n:a},u=c.apply(void 0,o);return u.params=Object.assign(l,u.params),o=null===u.locale?[u.params]:[u.locale,u.params],this.fetchChoice((i=this)._t.apply(i,[t,e,n,r].concat(o)),a)},et.prototype.fetchChoice=function(t,e){if(!t&&!a(t))return null;var n=t.split("|");return n[e=this.getChoiceIndex(e,n.length)]?n[e].trim():t},et.prototype.tc=function(t,e){for(var n,r=[],a=arguments.length-2;a-- >0;)r[a]=arguments[a+2];return(n=this)._tc.apply(n,[t,this.locale,this._getMessages(),null,e].concat(r))},et.prototype._te=function(t,e,n){for(var r=[],a=arguments.length-3;a-- >0;)r[a]=arguments[a+3];var i=c.apply(void 0,r).locale||e;return this._exist(n[i],t)},et.prototype.te=function(t,e){return this._te(t,this.locale,this._getMessages(),e)},et.prototype.getLocaleMessage=function(t){return u(this._vm.messages[t]||{})},et.prototype.setLocaleMessage=function(t,e){"warn"!==this._warnHtmlInMessage&&"error"!==this._warnHtmlInMessage||this._checkLocaleMessage(t,this._warnHtmlInMessage,e),this._vm.$set(this._vm.messages,t,e)},et.prototype.mergeLocaleMessage=function(t,e){"warn"!==this._warnHtmlInMessage&&"error"!==this._warnHtmlInMessage||this._checkLocaleMessage(t,this._warnHtmlInMessage,e),this._vm.$set(this._vm.messages,t,m({},this._vm.messages[t]||{},e))},et.prototype.getDateTimeFormat=function(t){return u(this._vm.dateTimeFormats[t]||{})},et.prototype.setDateTimeFormat=function(t,e){this._vm.$set(this._vm.dateTimeFormats,t,e),this._clearDateTimeFormat(t,e)},et.prototype.mergeDateTimeFormat=function(t,e){this._vm.$set(this._vm.dateTimeFormats,t,m(this._vm.dateTimeFormats[t]||{},e)),this._clearDateTimeFormat(t,e)},et.prototype._clearDateTimeFormat=function(t,e){for(var n in e){var r=t+"__"+n;this._dateTimeFormatters.hasOwnProperty(r)&&delete this._dateTimeFormatters[r]}},et.prototype._localizeDateTime=function(t,e,n,r,a){for(var i=e,o=r[i],s=this._getLocaleChain(e,n),c=0;c0;)e[n]=arguments[n+1];var i=this.locale,o=null;return 1===e.length?a(e[0])?o=e[0]:r(e[0])&&(e[0].locale&&(i=e[0].locale),e[0].key&&(o=e[0].key)):2===e.length&&(a(e[0])&&(o=e[0]),a(e[1])&&(i=e[1])),this._d(t,i,o)},et.prototype.getNumberFormat=function(t){return u(this._vm.numberFormats[t]||{})},et.prototype.setNumberFormat=function(t,e){this._vm.$set(this._vm.numberFormats,t,e),this._clearNumberFormat(t,e)},et.prototype.mergeNumberFormat=function(t,e){this._vm.$set(this._vm.numberFormats,t,m(this._vm.numberFormats[t]||{},e)),this._clearNumberFormat(t,e)},et.prototype._clearNumberFormat=function(t,e){for(var n in e){var r=t+"__"+n;this._numberFormatters.hasOwnProperty(r)&&delete this._numberFormatters[r]}},et.prototype._getNumberFormatter=function(t,e,n,r,a,i){for(var o=e,s=r[o],c=this._getLocaleChain(e,n),u=0;u0;)n[i]=arguments[i+1];var o=this.locale,s=null,l=null;return 1===n.length?a(n[0])?s=n[0]:r(n[0])&&(n[0].locale&&(o=n[0].locale),n[0].key&&(s=n[0].key),l=Object.keys(n[0]).reduce(function(e,r){var a;return h(t,r)?Object.assign({},e,((a={})[r]=n[0][r],a)):e},null)):2===n.length&&(a(n[0])&&(s=n[0]),a(n[1])&&(o=n[1])),this._n(e,o,s,l)},et.prototype._ntp=function(t,e,n,r){if(!et.availabilities.numberFormat)return[];if(!n)return(r?new Intl.NumberFormat(e,r):new Intl.NumberFormat(e)).formatToParts(t);var a=this._getNumberFormatter(t,e,this.fallbackLocale,this._getNumberFormats(),n,r),i=a&&a.formatToParts(t);if(this._isFallbackRoot(i)){if(!this._root)throw Error("unexpected error");return this._root.$i18n._ntp(t,e,n,r)}return i||[]},Object.defineProperties(et.prototype,nt),Object.defineProperty(et,"availabilities",{get:function(){if(!G){var t="undefined"!=typeof Intl;G={dateTimeFormat:t&&void 0!==Intl.DateTimeFormat,numberFormat:t&&void 0!==Intl.NumberFormat}}return G}}),et.install=I,et.version="8.20.0",et},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.VueI18n=e(); \ No newline at end of file diff --git a/components/ContentCard.vue b/components/ContentCard.vue new file mode 100644 index 0000000..ffb4b3b --- /dev/null +++ b/components/ContentCard.vue @@ -0,0 +1,722 @@ + + + + + diff --git a/components/Information.vue b/components/Information.vue new file mode 100644 index 0000000..04a9065 --- /dev/null +++ b/components/Information.vue @@ -0,0 +1,698 @@ + + + + + diff --git a/components/NoData copy.vue b/components/NoData copy.vue new file mode 100644 index 0000000..fc58b1c --- /dev/null +++ b/components/NoData copy.vue @@ -0,0 +1,117 @@ + + + + + \ No newline at end of file diff --git a/components/NoData.vue b/components/NoData.vue new file mode 100644 index 0000000..e1887d7 --- /dev/null +++ b/components/NoData.vue @@ -0,0 +1,117 @@ + + + + + \ No newline at end of file diff --git a/components/drag-button.vue b/components/drag-button.vue new file mode 100644 index 0000000..c098665 --- /dev/null +++ b/components/drag-button.vue @@ -0,0 +1,164 @@ + + + + + diff --git a/components/dyw-html2image/canvas2image.js b/components/dyw-html2image/canvas2image.js new file mode 100644 index 0000000..0182910 --- /dev/null +++ b/components/dyw-html2image/canvas2image.js @@ -0,0 +1,277 @@ +/** + * covert canvas to image + * and save the image file + */ + +var Canvas2Image = function () { + + // check if support sth. + var $support = function () { + var canvas = document.createElement('canvas'), + ctx = canvas.getContext('2d'); + + return { + canvas: !!ctx, + imageData: !!ctx.getImageData, + dataURL: !!canvas.toDataURL, + btoa: !!window.btoa + }; + }(); + + var downloadMime = 'image/octet-stream'; + + function scaleCanvas (canvas, width, height) { + var w = canvas.width, + h = canvas.height; + if (width == undefined) { + width = w; + } + if (height == undefined) { + height = h; + } + + var retCanvas = document.createElement('canvas'); + var retCtx = retCanvas.getContext('2d'); + retCanvas.width = width; + retCanvas.height = height; + retCtx.drawImage(canvas, 0, 0, w, h, 0, 0, width, height); + return retCanvas; + } + + function getDataURL (canvas, type, width, height) { + canvas = scaleCanvas(canvas, width, height); + return canvas.toDataURL(type); + } + + function saveFile (strData,filename) { + var save_link = document.createElement('a'); + save_link.href = strData; + save_link.download = filename; + var event = new MouseEvent('click',{"bubbles":false, "cancelable":false}); + save_link.dispatchEvent(event); + + } + + function genImage(strData) { + var img = document.createElement('img'); + img.src = strData; + return img; + } + function fixType (type) { + type = type.toLowerCase().replace(/jpg/i, 'jpeg'); + var r = type.match(/png|jpeg|bmp|gif/)[0]; + return 'image/' + r; + } + function encodeData (data) { + if (!window.btoa) { throw 'btoa undefined' } + var str = ''; + if (typeof data == 'string') { + str = data; + } else { + for (var i = 0; i < data.length; i ++) { + str += String.fromCharCode(data[i]); + } + } + + return btoa(str); + } + function getImageData (canvas) { + var w = canvas.width, + h = canvas.height; + return canvas.getContext('2d').getImageData(0, 0, w, h); + } + function makeURI (strData, type) { + return 'data:' + type + ';base64,' + strData; + } + + + /** + * create bitmap image + * 按照规则生成图片响应头和响应体 + */ + var genBitmapImage = function (oData) { + + // + // BITMAPFILEHEADER: http://msdn.microsoft.com/en-us/library/windows/desktop/dd183374(v=vs.85).aspx + // BITMAPINFOHEADER: http://msdn.microsoft.com/en-us/library/dd183376.aspx + // + + var biWidth = oData.width; + var biHeight = oData.height; + var biSizeImage = biWidth * biHeight * 3; + var bfSize = biSizeImage + 54; // total header size = 54 bytes + + // + // typedef struct tagBITMAPFILEHEADER { + // WORD bfType; + // DWORD bfSize; + // WORD bfReserved1; + // WORD bfReserved2; + // DWORD bfOffBits; + // } BITMAPFILEHEADER; + // + var BITMAPFILEHEADER = [ + // WORD bfType -- The file type signature; must be "BM" + 0x42, 0x4D, + // DWORD bfSize -- The size, in bytes, of the bitmap file + bfSize & 0xff, bfSize >> 8 & 0xff, bfSize >> 16 & 0xff, bfSize >> 24 & 0xff, + // WORD bfReserved1 -- Reserved; must be zero + 0, 0, + // WORD bfReserved2 -- Reserved; must be zero + 0, 0, + // DWORD bfOffBits -- The offset, in bytes, from the beginning of the BITMAPFILEHEADER structure to the bitmap bits. + 54, 0, 0, 0 + ]; + + // + // typedef struct tagBITMAPINFOHEADER { + // DWORD biSize; + // LONG biWidth; + // LONG biHeight; + // WORD biPlanes; + // WORD biBitCount; + // DWORD biCompression; + // DWORD biSizeImage; + // LONG biXPelsPerMeter; + // LONG biYPelsPerMeter; + // DWORD biClrUsed; + // DWORD biClrImportant; + // } BITMAPINFOHEADER, *PBITMAPINFOHEADER; + // + var BITMAPINFOHEADER = [ + // DWORD biSize -- The number of bytes required by the structure + 40, 0, 0, 0, + // LONG biWidth -- The width of the bitmap, in pixels + biWidth & 0xff, biWidth >> 8 & 0xff, biWidth >> 16 & 0xff, biWidth >> 24 & 0xff, + // LONG biHeight -- The height of the bitmap, in pixels + biHeight & 0xff, biHeight >> 8 & 0xff, biHeight >> 16 & 0xff, biHeight >> 24 & 0xff, + // WORD biPlanes -- The number of planes for the target device. This value must be set to 1 + 1, 0, + // WORD biBitCount -- The number of bits-per-pixel, 24 bits-per-pixel -- the bitmap + // has a maximum of 2^24 colors (16777216, Truecolor) + 24, 0, + // DWORD biCompression -- The type of compression, BI_RGB (code 0) -- uncompressed + 0, 0, 0, 0, + // DWORD biSizeImage -- The size, in bytes, of the image. This may be set to zero for BI_RGB bitmaps + biSizeImage & 0xff, biSizeImage >> 8 & 0xff, biSizeImage >> 16 & 0xff, biSizeImage >> 24 & 0xff, + // LONG biXPelsPerMeter, unused + 0,0,0,0, + // LONG biYPelsPerMeter, unused + 0,0,0,0, + // DWORD biClrUsed, the number of color indexes of palette, unused + 0,0,0,0, + // DWORD biClrImportant, unused + 0,0,0,0 + ]; + + var iPadding = (4 - ((biWidth * 3) % 4)) % 4; + + var aImgData = oData.data; + + var strPixelData = ''; + var biWidth4 = biWidth<<2; + var y = biHeight; + var fromCharCode = String.fromCharCode; + + do { + var iOffsetY = biWidth4*(y-1); + var strPixelRow = ''; + for (var x = 0; x < biWidth; x++) { + var iOffsetX = x<<2; + strPixelRow += fromCharCode(aImgData[iOffsetY+iOffsetX+2]) + + fromCharCode(aImgData[iOffsetY+iOffsetX+1]) + + fromCharCode(aImgData[iOffsetY+iOffsetX]); + } + + for (var c = 0; c < iPadding; c++) { + strPixelRow += String.fromCharCode(0); + } + + strPixelData += strPixelRow; + } while (--y); + + var strEncoded = encodeData(BITMAPFILEHEADER.concat(BITMAPINFOHEADER)) + encodeData(strPixelData); + + return strEncoded; + }; + + + /** + * [saveAsImage] + * @param {[obj]} canvas [canvasElement] + * @param {[Number]} width [optional] png width + * @param {[Number]} height [optional] png height + * @param {[String]} type [image type] + * @param {[String]} filename [image filename] + * @return {[type]} [description] + */ + var saveAsImage = function (canvas, width, height, type,filename) { + if ($support.canvas && $support.dataURL) { + if (typeof canvas == "string") { canvas = document.getElementById(canvas); } + if (type == undefined) { type = 'png'; } + filename = filename == undefined||filename.length === 0 ?Date.now()+'.'+type: filename+'.'+type + type = fixType(type); + + if (/bmp/.test(type)) { + var data = getImageData(scaleCanvas(canvas, width, height)); + var strData = genBitmapImage(data); + + saveFile(makeURI(strData, downloadMimedownloadMime),filename); + } else { + var strData = getDataURL(canvas, type, width, height); + saveFile(strData.replace(type, downloadMime),filename); + } + } + }; + + var convertToImage = function (canvas, width, height, type) { + if ($support.canvas && $support.dataURL) { + if (typeof canvas == "string") { canvas = document.getElementById(canvas); } + if (type == undefined) { type = 'png'; } + type = fixType(type); + + if (/bmp/.test(type)) { + var data = getImageData(scaleCanvas(canvas, width, height)); + var strData = genBitmapImage(data); + return genImage(makeURI(strData, 'image/bmp')); + } else { + var strData = getDataURL(canvas, type, width, height); + return genImage(strData); + } + } + }; + + + return { + saveAsImage: saveAsImage, + saveAsPNG: function (canvas, width, height, fileName) { + return saveAsImage(canvas, width, height, 'png',fileName); + }, + saveAsJPEG: function (canvas, width, height, fileName) { + return saveAsImage(canvas, width, height, 'jpeg',fileName); + }, + saveAsGIF: function (canvas, width, height, fileName) { + return saveAsImage(canvas, width, height, 'gif',fileName); + }, + saveAsBMP: function (canvas, width, height, fileName) { + return saveAsImage(canvas, width, height, 'bmp',fileName); + }, + + convertToImage: convertToImage, + convertToPNG: function (canvas, width, height) { + return convertToImage(canvas, width, height, 'png'); + }, + convertToJPEG: function (canvas, width, height) { + return convertToImage(canvas, width, height, 'jpeg'); + }, + convertToGIF: function (canvas, width, height) { + return convertToImage(canvas, width, height, 'gif'); + }, + convertToBMP: function (canvas, width, height) { + return convertToImage(canvas, width, height, 'bmp'); + } + }; + +}(); + +export default Canvas2Image \ No newline at end of file diff --git a/components/dyw-html2image/html2canvas.min.js b/components/dyw-html2image/html2canvas.min.js new file mode 100644 index 0000000..a4a7be8 --- /dev/null +++ b/components/dyw-html2image/html2canvas.min.js @@ -0,0 +1,20 @@ +/*! + * html2canvas 1.0.0-rc.4 + * Copyright (c) 2019 Niklas von Hertzen + * Released under MIT License + */ +!function(A,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(A=A||self).html2canvas=e()}(this,function(){"use strict"; +/*! ***************************************************************************** + Copyright (c) Microsoft Corporation. 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 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */var r=function(A,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,e){A.__proto__=e}||function(A,e){for(var t in e)e.hasOwnProperty(t)&&(A[t]=e[t])})(A,e)};function A(A,e){function t(){this.constructor=A}r(A,e),A.prototype=null===e?Object.create(e):(t.prototype=e.prototype,new t)}var K=function(){return(K=Object.assign||function(A){for(var e,t=1,r=arguments.length;ts[0]&&e[1]>10),s%1024+56320)),(B+1===t||16384>5])<<2)+(31&A),this.data[e];if(A<=65535)return e=((e=this.index[2048+(A-55296>>5)])<<2)+(31&A),this.data[e];if(A>11),e=this.index[e],e+=A>>5&63,e=((e=this.index[e])<<2)+(31&A),this.data[e];if(A<=1114111)return this.data[this.highValueIndex]}return this.errorValue},i);function i(A,e,t,r,B,n){this.initialValue=A,this.errorValue=e,this.highStart=t,this.highValueIndex=r,this.index=B,this.data=n}function C(A,e,t,r){var B=r[t];if(Array.isArray(A)?-1!==A.indexOf(B):A===B)for(var n=t;n<=r.length;){if((i=r[++n])===e)return!0;if(i!==H)break}if(B===H)for(n=t;0>4,c[i++]=(15&r)<<4|B>>2,c[i++]=(3&B)<<6|63&n;return a}("KwAAAAAAAAAACA4AIDoAAPAfAAACAAAAAAAIABAAGABAAEgAUABYAF4AZgBeAGYAYABoAHAAeABeAGYAfACEAIAAiACQAJgAoACoAK0AtQC9AMUAXgBmAF4AZgBeAGYAzQDVAF4AZgDRANkA3gDmAOwA9AD8AAQBDAEUARoBIgGAAIgAJwEvATcBPwFFAU0BTAFUAVwBZAFsAXMBewGDATAAiwGTAZsBogGkAawBtAG8AcIBygHSAdoB4AHoAfAB+AH+AQYCDgIWAv4BHgImAi4CNgI+AkUCTQJTAlsCYwJrAnECeQKBAk0CiQKRApkCoQKoArACuALAAsQCzAIwANQC3ALkAjAA7AL0AvwCAQMJAxADGAMwACADJgMuAzYDPgOAAEYDSgNSA1IDUgNaA1oDYANiA2IDgACAAGoDgAByA3YDfgOAAIQDgACKA5IDmgOAAIAAogOqA4AAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAK8DtwOAAIAAvwPHA88D1wPfAyAD5wPsA/QD/AOAAIAABAQMBBIEgAAWBB4EJgQuBDMEIAM7BEEEXgBJBCADUQRZBGEEaQQwADAAcQQ+AXkEgQSJBJEEgACYBIAAoASoBK8EtwQwAL8ExQSAAIAAgACAAIAAgACgAM0EXgBeAF4AXgBeAF4AXgBeANUEXgDZBOEEXgDpBPEE+QQBBQkFEQUZBSEFKQUxBTUFPQVFBUwFVAVcBV4AYwVeAGsFcwV7BYMFiwWSBV4AmgWgBacFXgBeAF4AXgBeAKsFXgCyBbEFugW7BcIFwgXIBcIFwgXQBdQF3AXkBesF8wX7BQMGCwYTBhsGIwYrBjMGOwZeAD8GRwZNBl4AVAZbBl4AXgBeAF4AXgBeAF4AXgBeAF4AXgBeAGMGXgBqBnEGXgBeAF4AXgBeAF4AXgBeAF4AXgB5BoAG4wSGBo4GkwaAAIADHgR5AF4AXgBeAJsGgABGA4AAowarBrMGswagALsGwwbLBjAA0wbaBtoG3QbaBtoG2gbaBtoG2gblBusG8wb7BgMHCwcTBxsHCwcjBysHMAc1BzUHOgdCB9oGSgdSB1oHYAfaBloHaAfaBlIH2gbaBtoG2gbaBtoG2gbaBjUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHbQdeAF4ANQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQd1B30HNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1B4MH2gaKB68EgACAAIAAgACAAIAAgACAAI8HlwdeAJ8HpweAAIAArwe3B14AXgC/B8UHygcwANAH2AfgB4AA6AfwBz4B+AcACFwBCAgPCBcIogEYAR8IJwiAAC8INwg/CCADRwhPCFcIXwhnCEoDGgSAAIAAgABvCHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIhAiLCI4IMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlggwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAANQc1BzUHNQc1BzUHNQc1BzUHNQc1B54INQc1B6II2gaqCLIIugiAAIAAvgjGCIAAgACAAIAAgACAAIAAgACAAIAAywiHAYAA0wiAANkI3QjlCO0I9Aj8CIAAgACAAAIJCgkSCRoJIgknCTYHLwk3CZYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiAAIAAAAFAAXgBeAGAAcABeAHwAQACQAKAArQC9AJ4AXgBeAE0A3gBRAN4A7AD8AMwBGgEAAKcBNwEFAUwBXAF4QkhCmEKnArcCgAHHAsABz4LAAcABwAHAAd+C6ABoAG+C/4LAAcABwAHAAc+DF4MAAcAB54M3gweDV4Nng3eDaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAEeDqABVg6WDqABoQ6gAaABoAHXDvcONw/3DvcO9w73DvcO9w73DvcO9w73DvcO9w73DvcO9w73DvcO9w73DvcO9w73DvcO9w73DvcO9w73DvcO9w73DncPAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcAB7cPPwlGCU4JMACAAIAAgABWCV4JYQmAAGkJcAl4CXwJgAkwADAAMAAwAIgJgACLCZMJgACZCZ8JowmrCYAAswkwAF4AXgB8AIAAuwkABMMJyQmAAM4JgADVCTAAMAAwADAAgACAAIAAgACAAIAAgACAAIAAqwYWBNkIMAAwADAAMADdCeAJ6AnuCR4E9gkwAP4JBQoNCjAAMACAABUK0wiAAB0KJAosCjQKgAAwADwKQwqAAEsKvQmdCVMKWwowADAAgACAALcEMACAAGMKgABrCjAAMAAwADAAMAAwADAAMAAwADAAMAAeBDAAMAAwADAAMAAwADAAMAAwADAAMAAwAIkEPQFzCnoKiQSCCooKkAqJBJgKoAqkCokEGAGsCrQKvArBCjAAMADJCtEKFQHZCuEK/gHpCvEKMAAwADAAMACAAIwE+QowAIAAPwEBCzAAMAAwADAAMACAAAkLEQswAIAAPwEZCyELgAAOCCkLMAAxCzkLMAAwADAAMAAwADAAXgBeAEELMAAwADAAMAAwADAAMAAwAEkLTQtVC4AAXAtkC4AAiQkwADAAMAAwADAAMAAwADAAbAtxC3kLgAuFC4sLMAAwAJMLlwufCzAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAApwswADAAMACAAIAAgACvC4AAgACAAIAAgACAALcLMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAvwuAAMcLgACAAIAAgACAAIAAyguAAIAAgACAAIAA0QswADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAANkLgACAAIAA4AswADAAMAAwADAAMAAwADAAMAAwADAAMAAwAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACJCR4E6AswADAAhwHwC4AA+AsADAgMEAwwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMACAAIAAGAwdDCUMMAAwAC0MNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQw1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHPQwwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADUHNQc1BzUHNQc1BzUHNQc2BzAAMAA5DDUHNQc1BzUHNQc1BzUHNQc1BzUHNQdFDDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAgACAAIAATQxSDFoMMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAF4AXgBeAF4AXgBeAF4AYgxeAGoMXgBxDHkMfwxeAIUMXgBeAI0MMAAwADAAMAAwAF4AXgCVDJ0MMAAwADAAMABeAF4ApQxeAKsMswy7DF4Awgy9DMoMXgBeAF4AXgBeAF4AXgBeAF4AXgDRDNkMeQBqCeAM3Ax8AOYM7Az0DPgMXgBeAF4AXgBeAF4AXgBeAF4AXgBeAF4AXgBeAF4AXgCgAAANoAAHDQ4NFg0wADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAeDSYNMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAIAAgACAAIAAgACAAC4NMABeAF4ANg0wADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAD4NRg1ODVYNXg1mDTAAbQ0wADAAMAAwADAAMAAwADAA2gbaBtoG2gbaBtoG2gbaBnUNeg3CBYANwgWFDdoGjA3aBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gaUDZwNpA2oDdoG2gawDbcNvw3HDdoG2gbPDdYN3A3fDeYN2gbsDfMN2gbaBvoN/g3aBgYODg7aBl4AXgBeABYOXgBeACUG2gYeDl4AJA5eACwO2w3aBtoGMQ45DtoG2gbaBtoGQQ7aBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gZJDjUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1B1EO2gY1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQdZDjUHNQc1BzUHNQc1B2EONQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHaA41BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1B3AO2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gY1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1B2EO2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gZJDtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBkkOeA6gAKAAoAAwADAAMAAwAKAAoACgAKAAoACgAKAAgA4wADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAD//wQABAAEAAQABAAEAAQABAAEAA0AAwABAAEAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAKABMAFwAeABsAGgAeABcAFgASAB4AGwAYAA8AGAAcAEsASwBLAEsASwBLAEsASwBLAEsAGAAYAB4AHgAeABMAHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAFgAbABIAHgAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABYADQARAB4ABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAkAFgAaABsAGwAbAB4AHQAdAB4ATwAXAB4ADQAeAB4AGgAbAE8ATwAOAFAAHQAdAB0ATwBPABcATwBPAE8AFgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAB4AUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAFAATwBAAE8ATwBPAEAATwBQAFAATwBQAB4AHgAeAB4AHgAeAB0AHQAdAB0AHgAdAB4ADgBQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgBQAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAkACQAJAAkACQAJAAkABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAFAAHgAeAB4AKwArAFAAUABQAFAAGABQACsAKwArACsAHgAeAFAAHgBQAFAAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUAAeAB4AHgAeAB4AHgArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAYAA0AKwArAB4AHgAbACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAB4ABAAEAB4ABAAEABMABAArACsAKwArACsAKwArACsAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAKwArACsAKwArAFYAVgBWAB4AHgArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AGgAaABoAGAAYAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQAEwAEACsAEwATAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABLAEsASwBLAEsASwBLAEsASwBLABoAGQAZAB4AUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABMAUAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABABQAFAABAAEAB4ABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUAAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAFAABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQAUABQAB4AHgAYABMAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAFAABAAEAAQABAAEAFAABAAEAAQAUAAEAAQABAAEAAQAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArACsAHgArAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAABAAEAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAAQABAANAA0ASwBLAEsASwBLAEsASwBLAEsASwAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQAKwBQAFAAUABQAFAAUABQAFAAKwArAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAKwArACsAUABQAFAAUAArACsABABQAAQABAAEAAQABAAEAAQAKwArAAQABAArACsABAAEAAQAUAArACsAKwArACsAKwArACsABAArACsAKwArAFAAUAArAFAAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAGgAaAFAAUABQAFAAUABMAB4AGwBQAB4AKwArACsABAAEAAQAKwBQAFAAUABQAFAAUAArACsAKwArAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAUAArAFAAUAArAFAAUAArACsABAArAAQABAAEAAQABAArACsAKwArAAQABAArACsABAAEAAQAKwArACsABAArACsAKwArACsAKwArAFAAUABQAFAAKwBQACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwAEAAQAUABQAFAABAArACsAKwArACsAKwArACsAKwArACsABAAEAAQAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAUAArAFAAUABQAFAAUAArACsABABQAAQABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQAKwArAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwAeABsAKwArACsAKwArACsAKwBQAAQABAAEAAQABAAEACsABAAEAAQAKwBQAFAAUABQAFAAUABQAFAAKwArAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQAKwArAAQABAArACsABAAEAAQAKwArACsAKwArACsAKwArAAQABAArACsAKwArAFAAUAArAFAAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwAeAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwAEAFAAKwBQAFAAUABQAFAAUAArACsAKwBQAFAAUAArAFAAUABQAFAAKwArACsAUABQACsAUAArAFAAUAArACsAKwBQAFAAKwArACsAUABQAFAAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAAQABAAEAAQAKwArACsABAAEAAQAKwAEAAQABAAEACsAKwBQACsAKwArACsAKwArAAQAKwArACsAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAB4AHgAeAB4AHgAeABsAHgArACsAKwArACsABAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQABAArACsAKwArACsAKwArAAQABAArAFAAUABQACsAKwArACsAKwBQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAB4AUAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQABAArACsAKwArACsAKwArAAQABAArACsAKwArACsAKwArAFAAKwBQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAFAABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQABABQAB4AKwArACsAKwBQAFAAUAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQABoAUABQAFAAUABQAFAAKwArAAQABAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQACsAUAArACsAUABQAFAAUABQAFAAUAArACsAKwAEACsAKwArACsABAAEAAQABAAEAAQAKwAEACsABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArAAQABAAeACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAXAAqACoAKgAqACoAKgAqACsAKwArACsAGwBcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAeAEsASwBLAEsASwBLAEsASwBLAEsADQANACsAKwArACsAKwBcAFwAKwBcACsAKwBcAFwAKwBcACsAKwBcACsAKwArACsAKwArAFwAXABcAFwAKwBcAFwAXABcAFwAXABcACsAXABcAFwAKwBcACsAXAArACsAXABcACsAXABcAFwAXAAqAFwAXAAqACoAKgAqACoAKgArACoAKgBcACsAKwBcAFwAXABcAFwAKwBcACsAKgAqACoAKgAqACoAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArAFwAXABcAFwAUAAOAA4ADgAOAB4ADgAOAAkADgAOAA0ACQATABMAEwATABMACQAeABMAHgAeAB4ABAAEAB4AHgAeAB4AHgAeAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUAANAAQAHgAEAB4ABAAWABEAFgARAAQABABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAANAAQABAAEAAQABAANAAQABABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsADQANAB4AHgAeAB4AHgAeAAQAHgAeAB4AHgAeAB4AKwAeAB4ADgAOAA0ADgAeAB4AHgAeAB4ACQAJACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqAFwASwBLAEsASwBLAEsASwBLAEsASwANAA0AHgAeAB4AHgBcAFwAXABcAFwAXAAqACoAKgAqAFwAXABcAFwAKgAqACoAXAAqACoAKgBcAFwAKgAqACoAKgAqACoAKgBcAFwAXAAqACoAKgAqAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAKgAqACoAKgAqACoAKgAqACoAXAAqAEsASwBLAEsASwBLAEsASwBLAEsAKgAqACoAKgAqACoAUABQAFAAUABQAFAAKwBQACsAKwArACsAKwBQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQACsAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwAEAAQABAAeAA0AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQACsAKwANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABYAEQArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAADQANAA0AUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAABAAEAAQAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAA0ADQArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQACsABAAEACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoADQANABUAXAANAB4ADQAbAFwAKgArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArAB4AHgATABMADQANAA4AHgATABMAHgAEAAQABAAJACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAUABQAFAAUABQAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABABQACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwAeACsAKwArABMAEwBLAEsASwBLAEsASwBLAEsASwBLAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAKwBcAFwAXABcAFwAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBcACsAKwArACoAKgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEACsAKwAeAB4AXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAKgAqACoAKgAqACoAKgArACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgArACsABABLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKgAqACoAKgAqACoAKgBcACoAKgAqACoAKgAqACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQAUABQAFAAUABQAFAAUAArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsADQANAB4ADQANAA0ADQAeAB4AHgAeAB4AHgAeAB4AHgAeAAQABAAEAAQABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeACsAKwArAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAUABQAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAHgAeAB4AHgBQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwANAA0ADQANAA0ASwBLAEsASwBLAEsASwBLAEsASwArACsAKwBQAFAAUABLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAA0AUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsABAAEAAQAHgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAUABQAFAABABQAFAAUABQAAQABAAEAFAAUAAEAAQABAArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwAEAAQABAAEAAQAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUAArAFAAKwBQACsAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAHgAeAB4AHgAeAB4AHgAeAFAAHgAeAB4AUABQAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAKwArAB4AHgAeAB4AHgAeACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAUABQAFAAKwAeAB4AHgAeAB4AHgAeAA4AHgArAA0ADQANAA0ADQANAA0ACQANAA0ADQAIAAQACwAEAAQADQAJAA0ADQAMAB0AHQAeABcAFwAWABcAFwAXABYAFwAdAB0AHgAeABQAFAAUAA0AAQABAAQABAAEAAQABAAJABoAGgAaABoAGgAaABoAGgAeABcAFwAdABUAFQAeAB4AHgAeAB4AHgAYABYAEQAVABUAFQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgANAB4ADQANAA0ADQAeAA0ADQANAAcAHgAeAB4AHgArAAQABAAEAAQABAAEAAQABAAEAAQAUABQACsAKwBPAFAAUABQAFAAUAAeAB4AHgAWABEATwBQAE8ATwBPAE8AUABQAFAAUABQAB4AHgAeABYAEQArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAGwAbABsAGwAbABsAGwAaABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAaABsAGwAbABsAGgAbABsAGgAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgBQABoAHgAdAB4AUAAeABoAHgAeAB4AHgAeAB4AHgAeAB4ATwAeAFAAGwAeAB4AUABQAFAAUABQAB4AHgAeAB0AHQAeAFAAHgBQAB4AUAAeAFAATwBQAFAAHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAB4AUABQAFAAUABPAE8AUABQAFAAUABQAE8AUABQAE8AUABPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBQAFAAUABQAE8ATwBPAE8ATwBPAE8ATwBPAE8AUABQAFAAUABQAFAAUABQAFAAHgAeAFAAUABQAFAATwAeAB4AKwArACsAKwAdAB0AHQAdAB0AHQAdAB0AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAeAB0AHQAeAB4AHgAdAB0AHgAeAB0AHgAeAB4AHQAeAB0AGwAbAB4AHQAeAB4AHgAeAB0AHgAeAB0AHQAdAB0AHgAeAB0AHgAdAB4AHQAdAB0AHQAdAB0AHgAdAB4AHgAeAB4AHgAdAB0AHQAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAdAB4AHgAeAB4AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB4AHgAdAB0AHQAdAB4AHgAdAB0AHgAeAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAeAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHQAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABQAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAlACUAHgAeAB4AHgAeAB4AHgAeAB4AFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBQAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB4AHgAeAB4AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAdAB0AHQAdAB0AHQAdAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAeAB0AHQAeAB4AHgAeAB0AHQAeAB4AHgAeAB0AHQAdAB4AHgAdAB4AHgAdAB0AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB0AHQAeAB4AHQAeAB4AHgAeAB0AHQAeAB4AHgAeACUAJQAdAB0AJQAeACUAJQAlACAAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAHgAeAB4AHgAdAB4AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB4AHQAdAB0AHgAdACUAHQAdAB4AHQAdAB4AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAHQAdAB0AHQAlAB4AJQAlACUAHQAlACUAHQAdAB0AJQAlAB0AHQAlAB0AHQAlACUAJQAeAB0AHgAeAB4AHgAdAB0AJQAdAB0AHQAdAB0AHQAlACUAJQAlACUAHQAlACUAIAAlAB0AHQAlACUAJQAlACUAJQAlACUAHgAeAB4AJQAlACAAIAAgACAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHgAeABcAFwAXABcAFwAXAB4AEwATACUAHgAeAB4AFgARABYAEQAWABEAFgARABYAEQAWABEAFgARAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARABYAEQAWABEAFgARABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB0AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAEAAQABAAeAB4AKwArACsAKwArABMADQANAA0AUAATAA0AUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUAANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAA0ADQANAA0ADQANAA0ADQAeAA0AFgANAB4AHgAXABcAHgAeABcAFwAWABEAFgARABYAEQAWABEADQANAA0ADQATAFAADQANAB4ADQANAB4AHgAeAB4AHgAMAAwADQANAA0AHgANAA0AFgANAA0ADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArAA0AEQARACUAJQBHAFcAVwAWABEAFgARABYAEQAWABEAFgARACUAJQAWABEAFgARABYAEQAWABEAFQAWABEAEQAlAFcAVwBXAFcAVwBXAFcAVwBXAAQABAAEAAQABAAEACUAVwBXAFcAVwA2ACUAJQBXAFcAVwBHAEcAJQAlACUAKwBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBRAFcAUQBXAFEAVwBXAFcAVwBXAFcAUQBXAFcAVwBXAFcAVwBRAFEAKwArAAQABAAVABUARwBHAFcAFQBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBRAFcAVwBXAFcAVwBXAFEAUQBXAFcAVwBXABUAUQBHAEcAVwArACsAKwArACsAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwArACUAJQBXAFcAVwBXACUAJQAlACUAJQAlACUAJQAlACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArACsAKwArACUAJQAlACUAKwArACsAKwArACsAKwArACsAKwArACsAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACsAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAE8ATwBPAE8ATwBPAE8ATwAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlACUAJQAlACUAJQAlACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADQATAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABLAEsASwBLAEsASwBLAEsASwBLAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAABAAEAAQABAAeAAQABAAEAAQABAAEAAQABAAEAAQAHgBQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAeAA0ADQANAA0ADQArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAAQAUABQAFAABABQAFAAUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAeAB4AHgAeACsAKwArACsAUABQAFAAUABQAFAAHgAeABoAHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADgAOABMAEwArACsAKwArACsAKwArACsABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwANAA0ASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUAAeAB4AHgBQAA4AUAArACsAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArAB4AWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYACsAKwArAAQAHgAeAB4AHgAeAB4ADQANAA0AHgAeAB4AHgArAFAASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArAB4AHgBcAFwAXABcAFwAKgBcAFwAXABcAFwAXABcAFwAXABcAEsASwBLAEsASwBLAEsASwBLAEsAXABcAFwAXABcACsAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAFAAUABQAAQAUABQAFAAUABQAFAAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAHgANAA0ADQBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAXAAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAKgAqACoAXABcACoAKgBcAFwAXABcAFwAKgAqAFwAKgBcACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcACoAKgBQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAA0ADQBQAFAAUAAEAAQAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQADQAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAVABVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBUAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVACsAKwArACsAKwArACsAKwArACsAKwArAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAKwArACsAKwBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAKwArACsAKwAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAKwArACsAKwArAFYABABWAFYAVgBWAFYAVgBWAFYAVgBWAB4AVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgArAFYAVgBWAFYAVgArAFYAKwBWAFYAKwBWAFYAKwBWAFYAVgBWAFYAVgBWAFYAVgBWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAEQAWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAaAB4AKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAGAARABEAGAAYABMAEwAWABEAFAArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACUAJQAlACUAJQAWABEAFgARABYAEQAWABEAFgARABYAEQAlACUAFgARACUAJQAlACUAJQAlACUAEQAlABEAKwAVABUAEwATACUAFgARABYAEQAWABEAJQAlACUAJQAlACUAJQAlACsAJQAbABoAJQArACsAKwArAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAcAKwATACUAJQAbABoAJQAlABYAEQAlACUAEQAlABEAJQBXAFcAVwBXAFcAVwBXAFcAVwBXABUAFQAlACUAJQATACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXABYAJQARACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAWACUAEQAlABYAEQARABYAEQARABUAVwBRAFEAUQBRAFEAUQBRAFEAUQBRAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcARwArACsAVwBXAFcAVwBXAFcAKwArAFcAVwBXAFcAVwBXACsAKwBXAFcAVwBXAFcAVwArACsAVwBXAFcAKwArACsAGgAbACUAJQAlABsAGwArAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAAQAB0AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsADQANAA0AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsADQBQAFAAUABQACsAKwArACsAUABQAFAAUABQAFAAUABQAA0AUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUAArACsAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQACsAKwArAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgBQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwBQAFAAUABQAFAABAAEAAQAKwAEAAQAKwArACsAKwArAAQABAAEAAQAUABQAFAAUAArAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsABAAEAAQAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsADQANAA0ADQANAA0ADQANAB4AKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AUABQAFAAUABQAFAAUABQAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwArACsAUABQAFAAUABQAA0ADQANAA0ADQANABQAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwANAA0ADQANAA0ADQANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwBQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAA0ADQAeAB4AHgAeAB4AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsASwBLAEsASwBLAEsASwBLAEsASwANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAeAA4AUAArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAADQANAB4ADQAeAAQABAAEAB4AKwArAEsASwBLAEsASwBLAEsASwBLAEsAUAAOAFAADQANAA0AKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAANAA0AHgANAA0AHgAEACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAA0AKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsABAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAUAArACsAKwArACsAKwAEACsAKwArACsAKwBQAFAAUABQAFAABAAEACsAKwAEAAQABAAEAAQABAAEACsAKwArAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAQABABQAFAAUABQAA0ADQANAA0AHgBLAEsASwBLAEsASwBLAEsASwBLACsADQArAB4AKwArAAQABAAEAAQAUABQAB4AUAArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEACsAKwAEAAQABAAEAAQABAAEAAQABAAOAA0ADQATABMAHgAeAB4ADQANAA0ADQANAA0ADQANAA0ADQANAA0ADQANAA0AUABQAFAAUAAEAAQAKwArAAQADQANAB4AUAArACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAKwAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAXABcAA0ADQANACoASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAFAABAAEAAQABAAOAB4ADQANAA0ADQAOAB4ABAArACsAKwArACsAKwArACsAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAUABQAFAAUAArACsAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAA0ADQANACsADgAOAA4ADQANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAAQABAAEAFAADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAOABMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAArACsAKwAEACsABAAEACsABAAEAAQABAAEAAQABABQAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABIAEgAQwBDAEMAUABQAFAAUABDAFAAUABQAEgAQwBIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABDAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwANAA0AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAANACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAA0ADQANAB4AHgAeAB4AHgAeAFAAUABQAFAADQAeACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAEcARwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwArACsAKwArACsAKwArACsAKwArACsAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQACsAKwAeAAQABAANAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAB4AHgAeAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAHgAeAAQABAAEAAQABAAEAAQAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAEAAQABAAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAFAAUAArACsAUAArACsAUABQACsAKwBQAFAAUABQACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQACsAUABQAFAAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAKwAeAB4AUABQAFAAUABQACsAUAArACsAKwBQAFAAUABQAFAAUABQACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AKwArAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAEAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAeAB4ADQANAA0ADQAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABAArAAQABAArAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAEAAQABAAEAAQABAAEACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAFgAWAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArAFAAKwArAFAAKwBQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUAArAFAAKwBQACsAKwArACsAKwArAFAAKwArACsAKwBQACsAUAArAFAAKwBQAFAAUAArAFAAUAArAFAAKwArAFAAKwBQACsAUAArAFAAKwBQACsAUABQACsAUAArACsAUABQAFAAUAArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQACsAUABQAFAAUAArAFAAKwBQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwBQAFAAUAArAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAlACUAJQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeACUAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeACUAJQAlACUAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQAlACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeACUAJQAlACUAJQAeACUAJQAlACUAJQAgACAAIAAlACUAIAAlACUAIAAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAIQAhACEAIQAhACUAJQAgACAAJQAlACAAIAAgACAAIAAgACAAIAAgACAAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAIAAgACAAIAAlACUAJQAlACAAJQAgACAAIAAgACAAIAAgACAAIAAlACUAJQAgACUAJQAlACUAIAAgACAAJQAgACAAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeACUAHgAlAB4AJQAlACUAJQAlACAAJQAlACUAJQAeACUAHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAIAAgACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAIAAlACUAJQAlACAAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAIAAgACAAJQAlACUAIAAgACAAIAAgAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFwAXABcAFQAVABUAHgAeAB4AHgAlACUAJQAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAIAAgACAAJQAlACUAJQAlACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACAAIAAlACAAIAAlACUAJQAlACUAJQAgACUAJQAlACUAJQAlACUAJQAlACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAIAAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACsAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsA"),U=Array.isArray(a)?function(A){for(var e=A.length,t=[],r=0;r=this._value.length?-1:this._value[A]},yA.prototype.consumeUnicodeRangeToken=function(){for(var A=[],e=this.consumeCodePoint();aA(e)&&A.length<6;)A.push(e),e=this.consumeCodePoint();for(var t=!1;63===e&&A.length<6;)A.push(e),e=this.consumeCodePoint(),t=!0;if(t){var r=parseInt(l.apply(void 0,A.map(function(A){return 63===A?48:A})),16),B=parseInt(l.apply(void 0,A.map(function(A){return 63===A?70:A})),16);return{type:sA.UNICODE_RANGE_TOKEN,start:r,end:B}}var n=parseInt(l.apply(void 0,A),16);if(45===this.peekCodePoint(0)&&aA(this.peekCodePoint(1))){this.consumeCodePoint(),e=this.consumeCodePoint();for(var s=[];aA(e)&&s.length<6;)s.push(e),e=this.consumeCodePoint();return B=parseInt(l.apply(void 0,s),16),{type:sA.UNICODE_RANGE_TOKEN,start:n,end:B}}return{type:sA.UNICODE_RANGE_TOKEN,start:n,end:n}},yA.prototype.consumeIdentLikeToken=function(){var A=this.consumeName();return"url"===A.toLowerCase()&&40===this.peekCodePoint(0)?(this.consumeCodePoint(),this.consumeUrlToken()):40===this.peekCodePoint(0)?(this.consumeCodePoint(),{type:sA.FUNCTION_TOKEN,value:A}):{type:sA.IDENT_TOKEN,value:A}},yA.prototype.consumeUrlToken=function(){var A=[];if(this.consumeWhiteSpace(),-1===this.peekCodePoint(0))return{type:sA.URL_TOKEN,value:""};var e,t=this.peekCodePoint(0);if(39===t||34===t){var r=this.consumeStringToken(this.consumeCodePoint());return r.type===sA.STRING_TOKEN&&(this.consumeWhiteSpace(),-1===this.peekCodePoint(0)||41===this.peekCodePoint(0))?(this.consumeCodePoint(),{type:sA.URL_TOKEN,value:r.value}):(this.consumeBadUrlRemnants(),IA)}for(;;){var B=this.consumeCodePoint();if(-1===B||41===B)return{type:sA.URL_TOKEN,value:l.apply(void 0,A)};if(cA(B))return this.consumeWhiteSpace(),-1===this.peekCodePoint(0)||41===this.peekCodePoint(0)?(this.consumeCodePoint(),{type:sA.URL_TOKEN,value:l.apply(void 0,A)}):(this.consumeBadUrlRemnants(),IA);if(34===B||39===B||40===B||0<=(e=B)&&e<=8||11===e||14<=e&&e<=31||127===e)return this.consumeBadUrlRemnants(),IA;if(92===B){if(!uA(B,this.peekCodePoint(0)))return this.consumeBadUrlRemnants(),IA;A.push(this.consumeEscapedCodePoint())}else A.push(B)}},yA.prototype.consumeWhiteSpace=function(){for(;cA(this.peekCodePoint(0));)this.consumeCodePoint()},yA.prototype.consumeBadUrlRemnants=function(){for(;;){var A=this.consumeCodePoint();if(41===A||-1===A)return;uA(A,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},yA.prototype.consumeStringSlice=function(A){for(var e="";0>8,r=255&A>>16,B=255&A>>24;return e<255?"rgba("+B+","+r+","+t+","+e/255+")":"rgb("+B+","+r+","+t+")"}function re(A,e){if(A.type===sA.NUMBER_TOKEN)return A.number;if(A.type!==sA.PERCENTAGE_TOKEN)return 0;var t=3===e?1:255;return 3===e?A.number/100*t:Math.round(A.number/100*t)}function Be(A){var e=A.filter(kA);if(3===e.length){var t=e.map(re),r=t[0],B=t[1],n=t[2];return ue(r,B,n,1)}if(4!==e.length)return 0;var s=e.map(re),o=(r=s[0],B=s[1],n=s[2],s[3]);return ue(r,B,n,o)}var ne=function(A,e){return e===sA.LEFT_CURLY_BRACKET_TOKEN&&A.type===sA.RIGHT_CURLY_BRACKET_TOKEN||(e===sA.LEFT_SQUARE_BRACKET_TOKEN&&A.type===sA.RIGHT_SQUARE_BRACKET_TOKEN||e===sA.LEFT_PARENTHESIS_TOKEN&&A.type===sA.RIGHT_PARENTHESIS_TOKEN)},se={type:sA.NUMBER_TOKEN,number:0,flags:4},oe={type:sA.PERCENTAGE_TOKEN,number:50,flags:4},ie={type:sA.PERCENTAGE_TOKEN,number:100,flags:4},ae=function(A,e){if(A.type===sA.PERCENTAGE_TOKEN)return A.number/100*e;if(xA(A))switch(A.unit){case"rem":case"em":return 16*A.number;case"px":default:return A.number}return A.number},ce=function(A){if(A.type===sA.DIMENSION_TOKEN)switch(A.unit){case"deg":return Math.PI*A.number/180;case"grad":return Math.PI/200*A.number;case"rad":return A.number;case"turn":return 2*Math.PI*A.number}throw new Error("Unsupported angle type")},Qe=function(A){return Math.PI*A/180},we=function(A){if(A.type===sA.FUNCTION){var e=he[A.name];if(void 0===e)throw new Error('Attempting to parse an unsupported color function "'+A.name+'"');return e(A.values)}if(A.type===sA.HASH_TOKEN){if(3===A.value.length){var t=A.value.substring(0,1),r=A.value.substring(1,2),B=A.value.substring(2,3);return ue(parseInt(t+t,16),parseInt(r+r,16),parseInt(B+B,16),1)}if(4===A.value.length){t=A.value.substring(0,1),r=A.value.substring(1,2),B=A.value.substring(2,3);var n=A.value.substring(3,4);return ue(parseInt(t+t,16),parseInt(r+r,16),parseInt(B+B,16),parseInt(n+n,16)/255)}if(6===A.value.length){t=A.value.substring(0,2),r=A.value.substring(2,4),B=A.value.substring(4,6);return ue(parseInt(t,16),parseInt(r,16),parseInt(B,16),1)}if(8===A.value.length){t=A.value.substring(0,2),r=A.value.substring(2,4),B=A.value.substring(4,6),n=A.value.substring(6,8);return ue(parseInt(t,16),parseInt(r,16),parseInt(B,16),parseInt(n,16)/255)}}if(A.type===sA.IDENT_TOKEN){var s=He[A.value.toUpperCase()];if(void 0!==s)return s}return He.TRANSPARENT},ue=function(A,e,t,r){return(A<<24|e<<16|t<<8|Math.round(255*r)<<0)>>>0};function Ue(A,e,t){return t<0&&(t+=1),1<=t&&(t-=1),t<1/6?(e-A)*t*6+A:t<.5?e:t<2/3?6*(e-A)*(2/3-t)+A:A}function le(A){var e=A.filter(kA),t=e[0],r=e[1],B=e[2],n=e[3],s=(t.type===sA.NUMBER_TOKEN?Qe(t.number):ce(t))/(2*Math.PI),o=qA(r)?r.number/100:0,i=qA(B)?B.number/100:0,a=void 0!==n&&qA(n)?ae(n,1):1;if(0==o)return ue(255*i,255*i,255*i,1);var c=i<=.5?i*(1+o):i+o-i*o,Q=2*i-c,w=Ue(Q,c,s+1/3),u=Ue(Q,c,s),U=Ue(Q,c,s-1/3);return ue(255*w,255*u,255*U,a)}var Ce,ge,Ee,Fe,he={hsl:le,hsla:le,rgb:Be,rgba:Be},He={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199};(ge=Ce||(Ce={}))[ge.VALUE=0]="VALUE",ge[ge.LIST=1]="LIST",ge[ge.IDENT_VALUE=2]="IDENT_VALUE",ge[ge.TYPE_VALUE=3]="TYPE_VALUE",ge[ge.TOKEN_VALUE=4]="TOKEN_VALUE",(Fe=Ee||(Ee={}))[Fe.BORDER_BOX=0]="BORDER_BOX",Fe[Fe.PADDING_BOX=1]="PADDING_BOX";function de(A){var e=we(A[0]),t=A[1];return t&&qA(t)?{color:e,stop:t}:{color:e,stop:null}}function fe(A,t){var e=A[0],r=A[A.length-1];null===e.stop&&(e.stop=se),null===r.stop&&(r.stop=ie);for(var B=[],n=0,s=0;sA.optimumDistance)?{optimumCorner:e,optimumDistance:B}:A},{optimumDistance:o?1/0:-1/0,optimumCorner:null}).optimumCorner}function Ie(A){var B=Qe(180),n=[];return WA(A).forEach(function(A,e){if(0===e){var t=A[0];if(t.type===sA.IDENT_TOKEN&&-1!==["top","left","right","bottom"].indexOf(t.value))return void(B=Ae(A));if($A(t))return void(B=(ce(t)+Qe(270))%Qe(360))}var r=de(A);n.push(r)}),{angle:B,stops:n,type:xe.LINEAR_GRADIENT}}function Te(A){return 0===A[0]&&255===A[1]&&0===A[2]&&255===A[3]}var me={name:"background-clip",initialValue:"border-box",prefix:!(Fe[Fe.CONTENT_BOX=2]="CONTENT_BOX"),type:Ce.LIST,parse:function(A){return A.map(function(A){if(zA(A))switch(A.value){case"padding-box":return Ee.PADDING_BOX;case"content-box":return Ee.CONTENT_BOX}return Ee.BORDER_BOX})}},Re={name:"background-color",initialValue:"transparent",prefix:!1,type:Ce.TYPE_VALUE,format:"color"},Le=function(A,e,t,r,B){var n="http://www.w3.org/2000/svg",s=document.createElementNS(n,"svg"),o=document.createElementNS(n,"foreignObject");return s.setAttributeNS(null,"width",A.toString()),s.setAttributeNS(null,"height",e.toString()),o.setAttributeNS(null,"width","100%"),o.setAttributeNS(null,"height","100%"),o.setAttributeNS(null,"x",t.toString()),o.setAttributeNS(null,"y",r.toString()),o.setAttributeNS(null,"externalResourcesRequired","true"),s.appendChild(o),o.appendChild(B),s},Oe=function(r){return new Promise(function(A,e){var t=new Image;t.onload=function(){return A(t)},t.onerror=e,t.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent((new XMLSerializer).serializeToString(r))})},ve={get SUPPORT_RANGE_BOUNDS(){var A=function(A){if(A.createRange){var e=A.createRange();if(e.getBoundingClientRect){var t=A.createElement("boundtest");t.style.height="123px",t.style.display="block",A.body.appendChild(t),e.selectNode(t);var r=e.getBoundingClientRect(),B=Math.round(r.height);if(A.body.removeChild(t),123===B)return!0}}return!1}(document);return Object.defineProperty(ve,"SUPPORT_RANGE_BOUNDS",{value:A}),A},get SUPPORT_SVG_DRAWING(){var A=function(A){var e=new Image,t=A.createElement("canvas"),r=t.getContext("2d");if(!r)return!1;e.src="data:image/svg+xml,";try{r.drawImage(e,0,0),t.toDataURL()}catch(A){return!1}return!0}(document);return Object.defineProperty(ve,"SUPPORT_SVG_DRAWING",{value:A}),A},get SUPPORT_FOREIGNOBJECT_DRAWING(){var A="function"==typeof Array.from&&"function"==typeof window.fetch?function(r){var A=r.createElement("canvas"),B=100;A.width=B,A.height=B;var n=A.getContext("2d");if(!n)return Promise.reject(!1);n.fillStyle="rgb(0, 255, 0)",n.fillRect(0,0,B,B);var e=new Image,s=A.toDataURL();e.src=s;var t=Le(B,B,0,0,e);return n.fillStyle="red",n.fillRect(0,0,B,B),Oe(t).then(function(A){n.drawImage(A,0,0);var e=n.getImageData(0,0,B,B).data;n.fillStyle="red",n.fillRect(0,0,B,B);var t=r.createElement("div");return t.style.backgroundImage="url("+s+")",t.style.height="100px",Te(e)?Oe(Le(B,B,0,0,t)):Promise.reject(!1)}).then(function(A){return n.drawImage(A,0,0),Te(n.getImageData(0,0,B,B).data)}).catch(function(){return!1})}(document):Promise.resolve(!1);return Object.defineProperty(ve,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:A}),A},get SUPPORT_CORS_IMAGES(){var A=void 0!==(new Image).crossOrigin;return Object.defineProperty(ve,"SUPPORT_CORS_IMAGES",{value:A}),A},get SUPPORT_RESPONSE_TYPE(){var A="string"==typeof(new XMLHttpRequest).responseType;return Object.defineProperty(ve,"SUPPORT_RESPONSE_TYPE",{value:A}),A},get SUPPORT_CORS_XHR(){var A="withCredentials"in new XMLHttpRequest;return Object.defineProperty(ve,"SUPPORT_CORS_XHR",{value:A}),A}},De=(Se.prototype.debug=function(){for(var A=[],e=0;eA.height?new I(A.left+(A.width-A.height)/2,A.top,A.height,A.height):A.width"),Wn(this.referenceElement.ownerDocument,B,n),o.replaceChild(o.adoptNode(this.documentElement),o.documentElement),o.close(),i},xn.prototype.createElementClone=function(A){return Fn(A)?this.createCanvasClone(A):rn(A)?this.createStyleClone(A):A.cloneNode(!1)},xn.prototype.createStyleClone=function(A){try{var e=A.sheet;if(e&&e.cssRules){var t=[].slice.call(e.cssRules,0).reduce(function(A,e){return e&&"string"==typeof e.cssText?A+e.cssText:A},""),r=A.cloneNode(!1);return r.textContent=t,r}}catch(A){if(De.getInstance(this.options.id).error("Unable to access cssRules property",A),"SecurityError"!==A.name)throw A}return A.cloneNode(!1)},xn.prototype.createCanvasClone=function(A){if(this.options.inlineImages&&A.ownerDocument){var e=A.ownerDocument.createElement("img");try{return e.src=A.toDataURL(),e}catch(A){De.getInstance(this.options.id).info("Unable to clone canvas contents, canvas is tainted")}}var t=A.cloneNode(!1);try{t.width=A.width,t.height=A.height;var r=A.getContext("2d"),B=t.getContext("2d");return B&&(r?B.putImageData(r.getImageData(0,0,A.width,A.height),0,0):B.drawImage(A,0,0)),t}catch(A){}return t},xn.prototype.cloneNode=function(A){if(Qn(A))return document.createTextNode(A.data);if(!A.ownerDocument)return A.cloneNode(!1);var e=A.ownerDocument.defaultView;if(un(A)&&e){var t=this.createElementClone(A),r=e.getComputedStyle(A),B=e.getComputedStyle(A,":before"),n=e.getComputedStyle(A,":after");this.referenceElement===A&&(this.clonedReferenceElement=t),En(t)&&$n(t);for(var s=this.counters.parse(new wB(r)),o=this.resolvePseudoContent(A,t,B,Ln.BEFORE),i=A.firstChild;i;i=i.nextSibling)wn(i)&&("SCRIPT"===i.tagName||i.hasAttribute(_n)||"function"==typeof this.options.ignoreElements&&this.options.ignoreElements(i))||this.options.copyStyles&&wn(i)&&rn(i)||t.appendChild(this.cloneNode(i));o&&t.insertBefore(o,t.firstChild);var a=this.resolvePseudoContent(A,t,n,Ln.AFTER);return a&&t.appendChild(a),this.counters.pop(s),r&&this.options.copyStyles&&!Hn(A)&&Gn(r,t),0===A.scrollTop&&0===A.scrollLeft||this.scrolledElements.push([t,A.scrollLeft,A.scrollTop]),(dn(A)||fn(A))&&(dn(t)||fn(t))&&(t.value=A.value),t}return A.cloneNode(!1)},xn.prototype.resolvePseudoContent=function(U,A,e,t){var l=this;if(e){var r=e.content,C=A.ownerDocument;if(C&&r&&"none"!==r&&"-moz-alt-content"!==r&&"none"!==e.display){this.counters.parse(new wB(e));var g=new QB(e),E=C.createElement("html2canvaspseudoelement");return Gn(e,E),g.content.forEach(function(A){if(A.type===sA.STRING_TOKEN)E.appendChild(C.createTextNode(A.value));else if(A.type===sA.URL_TOKEN){var e=C.createElement("img");e.src=A.value,e.style.opacity="1",E.appendChild(e)}else if(A.type===sA.FUNCTION){if("attr"===A.name){var t=A.values.filter(zA);t.length&&E.appendChild(C.createTextNode(U.getAttribute(t[0].value)||""))}else if("counter"===A.name){var r=A.values.filter(kA),B=r[0],n=r[1];if(B&&zA(B)){var s=l.counters.getCounterValue(B.value),o=n&&zA(n)?ir.parse(n.value):tr.DECIMAL;E.appendChild(C.createTextNode(yn(s,o,!1)))}}else if("counters"===A.name){var i=A.values.filter(kA),a=(B=i[0],i[1]);if(n=i[2],B&&zA(B)){var c=l.counters.getCounterValues(B.value),Q=n&&zA(n)?ir.parse(n.value):tr.DECIMAL,w=a&&a.type===sA.STRING_TOKEN?a.value:"",u=c.map(function(A){return yn(A,Q,!1)}).join(w);E.appendChild(C.createTextNode(u))}}}else if(A.type===sA.IDENT_TOKEN)switch(A.value){case"open-quote":E.appendChild(C.createTextNode(eB(g.quotes,l.quoteDepth++,!0)));break;case"close-quote":E.appendChild(C.createTextNode(eB(g.quotes,--l.quoteDepth,!1)))}}),E.className=qn+" "+Zn,A.className+=t===Ln.BEFORE?" "+qn:" "+Zn,E}}},xn);function xn(A,e){if(this.options=e,this.scrolledElements=[],this.referenceElement=A,this.counters=new pn,this.quoteDepth=0,!A.ownerDocument)throw new Error("Cloned element does not have an owner document");this.documentElement=this.cloneNode(A.ownerDocument.documentElement)}(On=Ln||(Ln={}))[On.BEFORE=0]="BEFORE",On[On.AFTER=1]="AFTER";var Vn,zn,Xn=function(A,e){var t=A.createElement("iframe");return t.className="html2canvas-container",t.style.visibility="hidden",t.style.position="fixed",t.style.left="-10000px",t.style.top="0px",t.style.border="0",t.width=e.width.toString(),t.height=e.height.toString(),t.scrolling="no",t.setAttribute(_n,"true"),A.body.appendChild(t),t},Jn=function(B){return new Promise(function(e,A){var t=B.contentWindow;if(!t)return A("No window assigned for iframe");var r=t.document;t.onload=B.onload=r.onreadystatechange=function(){t.onload=B.onload=r.onreadystatechange=null;var A=setInterval(function(){0"),e},Wn=function(A,e,t){A&&A.defaultView&&(e!==A.defaultView.pageXOffset||t!==A.defaultView.pageYOffset)&&A.defaultView.scrollTo(e,t)},Yn=function(A){var e=A[0],t=A[1],r=A[2];e.scrollLeft=t,e.scrollTop=r},qn="___html2canvas___pseudoelement_before",Zn="___html2canvas___pseudoelement_after",jn='{\n content: "" !important;\n display: none !important;\n}',$n=function(A){As(A,"."+qn+":before"+jn+"\n ."+Zn+":after"+jn)},As=function(A,e){var t=A.ownerDocument;if(t){var r=t.createElement("style");r.textContent=e,A.appendChild(r)}};(zn=Vn||(Vn={}))[zn.VECTOR=0]="VECTOR",zn[zn.BEZIER_CURVE=1]="BEZIER_CURVE";function es(A,t){return A.length===t.length&&A.some(function(A,e){return A===t[e]})}var ts=(rs.prototype.add=function(A,e){return new rs(this.x+A,this.y+e)},rs);function rs(A,e){this.type=Vn.VECTOR,this.x=A,this.y=e}function Bs(A,e,t){return new ts(A.x+(e.x-A.x)*t,A.y+(e.y-A.y)*t)}var ns=(ss.prototype.subdivide=function(A,e){var t=Bs(this.start,this.startControl,A),r=Bs(this.startControl,this.endControl,A),B=Bs(this.endControl,this.end,A),n=Bs(t,r,A),s=Bs(r,B,A),o=Bs(n,s,A);return e?new ss(this.start,t,n,o):new ss(o,s,B,this.end)},ss.prototype.add=function(A,e){return new ss(this.start.add(A,e),this.startControl.add(A,e),this.endControl.add(A,e),this.end.add(A,e))},ss.prototype.reverse=function(){return new ss(this.end,this.endControl,this.startControl,this.start)},ss);function ss(A,e,t,r){this.type=Vn.BEZIER_CURVE,this.start=A,this.startControl=e,this.endControl=t,this.end=r}function os(A){return A.type===Vn.BEZIER_CURVE}var is,as,cs=function(A){var e=A.styles,t=A.bounds,r=jA(e.borderTopLeftRadius,t.width,t.height),B=r[0],n=r[1],s=jA(e.borderTopRightRadius,t.width,t.height),o=s[0],i=s[1],a=jA(e.borderBottomRightRadius,t.width,t.height),c=a[0],Q=a[1],w=jA(e.borderBottomLeftRadius,t.width,t.height),u=w[0],U=w[1],l=[];l.push((B+o)/t.width),l.push((u+c)/t.width),l.push((n+U)/t.height),l.push((i+Q)/t.height);var C=Math.max.apply(Math,l);1t.width+p?0:o-p,i-H,is.TOP_RIGHT):new ts(t.left+t.width-d,t.top+H),this.bottomRightPaddingBox=0t.width+p+T?0:o-p+T,i-(H+N),is.TOP_RIGHT):new ts(t.left+t.width-(d+K),t.top+H+N),this.bottomRightContentBox=0A.element.container.styles.zIndex.order?(i=e,!1):0A.element.container.styles.zIndex.order?(a=e+1,!1):0 { + var imageWidth = canvas.width + var imageHeight = canvas.height + console.log(canvas.toDataURL('image/jpeg')) + console.log('测试') + if(saveType=== 'download'){ + canvas2Image.saveAsImage(canvas, imageWidth, imageHeight, imageName, type) + resolve() + } else if(saveType === 'src'){ + var result = canvas2Image.convertToImage(canvas, imageWidth, imageHeight,type) + console.log(result) + resolve(result) + } + }).catch(err=> { + reject(err) + }) + }) + return result + } + +export default htmlToCavas \ No newline at end of file diff --git a/components/dyw-html2image/readme.md b/components/dyw-html2image/readme.md new file mode 100644 index 0000000..0d16d5a --- /dev/null +++ b/components/dyw-html2image/readme.md @@ -0,0 +1,19 @@ +# html2canvas + +### 使用方法 + +``` + import htmlToCavas from '@/components/html2image/html2image' + + htmlToCavas(element, { + useCORS: true, + logging: true, + backgroundColor: '#982121', + scale: 2, + dpi: 350}).then(res=> { + this.imageSrc = res.src + }).catch(err=> { + console.log(err) + }) +``` + diff --git a/components/messageBox.vue b/components/messageBox.vue new file mode 100644 index 0000000..b9bbd64 --- /dev/null +++ b/components/messageBox.vue @@ -0,0 +1,318 @@ + + + + + diff --git a/components/page-nav/page-nav.vue b/components/page-nav/page-nav.vue new file mode 100644 index 0000000..39f118a --- /dev/null +++ b/components/page-nav/page-nav.vue @@ -0,0 +1,99 @@ + + + + + diff --git a/enums/index.js b/enums/index.js new file mode 100644 index 0000000..e922c5d --- /dev/null +++ b/enums/index.js @@ -0,0 +1,24 @@ +// 返校核验状态枚举 + +export const AuditStateEnumMap = new Map([ + [0, '待审核'], + [1, '通过'], + [2, '未通过'], +]) + +// +export const PrebookStateEnumMap = new Map([ + [0, '待核验'], + [1, '已取消'], + [2, '已驳回'], + [3, '已核验'], + [4, '未返校'], +]) + +// 彭剑提供的枚举 +export const glyTypeEnumMap = new Map([ + [0,'校级管理员'], + [1,'教职工管理员'], + [2,'学生管理员'], + [3,'普通人员'], +]) \ No newline at end of file diff --git a/js_sdk/wxmp-qqmap/qqmap-wx-jssdk.js b/js_sdk/wxmp-qqmap/qqmap-wx-jssdk.js new file mode 100644 index 0000000..298e1dc --- /dev/null +++ b/js_sdk/wxmp-qqmap/qqmap-wx-jssdk.js @@ -0,0 +1,462 @@ +/** + * 微信小程序JavaScriptSDK + * + * @version 1.0 + * @date 2017-01-10 + * @author jaysonzhou@tencent.com + */ + +var ERROR_CONF = { + KEY_ERR: 311, + KEY_ERR_MSG: 'key格式错误', + PARAM_ERR: 310, + PARAM_ERR_MSG: '请求参数信息有误', + SYSTEM_ERR: 600, + SYSTEM_ERR_MSG: '系统错误', + WX_ERR_CODE: 1000, + WX_OK_CODE: 200 +}; +var BASE_URL = 'https://apis.map.qq.com/ws/'; +var URL_SEARCH = BASE_URL + 'place/v1/search'; +var URL_SUGGESTION = BASE_URL + 'place/v1/suggestion'; +var URL_GET_GEOCODER = BASE_URL + 'geocoder/v1/'; +var URL_CITY_LIST = BASE_URL + 'district/v1/list'; +var URL_AREA_LIST = BASE_URL + 'district/v1/getchildren'; +var URL_DISTANCE = BASE_URL + 'distance/v1/'; +var Utils = { + /** + * 得到终点query字符串 + * @param {Array|String} 检索数据 + */ + location2query(data) { + if (typeof data == 'string') { + return data; + } + var query = ''; + for (var i = 0; i < data.length; i++) { + var d = data[i]; + if (!!query) { + query += ';'; + } + if (d.location) { + query = query + d.location.lat + ',' + d.location.lng; + } + if (d.latitude && d.longitude) { + query = query + d.latitude + ',' + d.longitude; + } + } + return query; + }, + + /** + * 使用微信接口进行定位 + */ + getWXLocation(success, fail, complete) { + wx.getLocation({ + type: 'gcj02', + success: success, + fail: fail, + complete: complete + }); + }, + + /** + * 获取location参数 + */ + getLocationParam(location) { + if (typeof location == 'string') { + var locationArr = location.split(','); + if (locationArr.length === 2) { + location = { + latitude: location.split(',')[0], + longitude: location.split(',')[1] + }; + } else { + location = {}; + } + } + return location; + }, + + /** + * 回调函数默认处理 + */ + polyfillParam(param) { + param.success = param.success || function () { }; + param.fail = param.fail || function () { }; + param.complete = param.complete || function () { }; + }, + + /** + * 验证param对应的key值是否为空 + * + * @param {Object} param 接口参数 + * @param {String} key 对应参数的key + */ + checkParamKeyEmpty(param, key) { + if (!param[key]) { + var errconf = this.buildErrorConfig(ERROR_CONF.PARAM_ERR, ERROR_CONF.PARAM_ERR_MSG + key +'参数格式有误'); + param.fail(errconf); + param.complete(errconf); + return true; + } + return false; + }, + + /** + * 验证参数中是否存在检索词keyword + * + * @param {Object} param 接口参数 + */ + checkKeyword(param){ + return !this.checkParamKeyEmpty(param, 'keyword'); + }, + + /** + * 验证location值 + * + * @param {Object} param 接口参数 + */ + checkLocation(param) { + var location = this.getLocationParam(param.location); + if (!location || !location.latitude || !location.longitude) { + var errconf = this.buildErrorConfig(ERROR_CONF.PARAM_ERR, ERROR_CONF.PARAM_ERR_MSG + ' location参数格式有误') + param.fail(errconf); + param.complete(errconf); + return false; + } + return true; + }, + + /** + * 构造错误数据结构 + * @param {Number} errCode 错误码 + * @param {Number} errMsg 错误描述 + */ + buildErrorConfig(errCode, errMsg) { + return { + status: errCode, + message: errMsg + }; + }, + + /** + * 构造微信请求参数,公共属性处理 + * + * @param {Object} param 接口参数 + * @param {Object} param 配置项 + */ + buildWxRequestConfig(param, options) { + var that = this; + options.header = { "content-type": "application/json" }; + options.method = 'GET'; + options.success = function (res) { + var data = res.data; + if (data.status === 0) { + param.success(data); + } else { + param.fail(data); + } + }; + options.fail = function (res) { + res.statusCode = ERROR_CONF.WX_ERR_CODE; + param.fail(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, result.errMsg)); + }; + options.complete = function (res) { + var statusCode = +res.statusCode; + switch(statusCode) { + case ERROR_CONF.WX_ERR_CODE: { + param.complete(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg)); + break; + } + case ERROR_CONF.WX_OK_CODE: { + var data = res.data; + if (data.status === 0) { + param.complete(data); + } else { + param.complete(that.buildErrorConfig(data.status, data.message)); + } + break; + } + default:{ + param.complete(that.buildErrorConfig(ERROR_CONF.SYSTEM_ERR, ERROR_CONF.SYSTEM_ERR_MSG)); + } + + } + } + return options; + }, + + /** + * 处理用户参数是否传入坐标进行不同的处理 + */ + locationProcess(param, locationsuccess, locationfail, locationcomplete) { + var that = this; + locationfail = locationfail || function (res) { + res.statusCode = ERROR_CONF.WX_ERR_CODE; + param.fail(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg)); + }; + locationcomplete = locationcomplete || function (res) { + if (res.statusCode == ERROR_CONF.WX_ERR_CODE) { + param.complete(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg)); + } + }; + if (!param.location) { + that.getWXLocation(locationsuccess, locationfail, locationcomplete); + } else if (that.checkLocation(param)) { + var location = Utils.getLocationParam(param.location); + locationsuccess(location); + } + } +} + + +class QQMapWX { + + /** + * 构造函数 + * + * @param {Object} options 接口参数,key 为必选参数 + */ + constructor(options) { + if (!options.key) { + throw Error('key值不能为空'); + } + this.key = options.key; + } + + /** + * POI周边检索 + * + * @param {Object} options 接口参数对象 + * + * 参数对象结构可以参考 + * @see http://lbs.qq.com/webservice_v1/guide-search.html + */ + search(options) { + var that = this; + options = options || {}; + + Utils.polyfillParam(options); + + if (!Utils.checkKeyword(options)) { + return; + } + + var requestParam = { + keyword: options.keyword, + orderby: options.orderby || '_distance', + page_size: options.page_size || 10, + page_index: options.page_index || 1, + output: 'json', + key: that.key + }; + + if (options.address_format) { + requestParam.address_format = options.address_format; + } + + if (options.filter) { + requestParam.filter = options.filter; + } + + var distance = options.distance || "1000"; + var auto_extend = options.auto_extend || 1; + + var locationsuccess = function (result) { + requestParam.boundary = "nearby(" + result.latitude + "," + result.longitude + "," + distance + "," + auto_extend +")"; + wx.request(Utils.buildWxRequestConfig(options, { + url: URL_SEARCH, + data: requestParam + })); + } + Utils.locationProcess(options, locationsuccess); + } + + /** + * sug模糊检索 + * + * @param {Object} options 接口参数对象 + * + * 参数对象结构可以参考 + * http://lbs.qq.com/webservice_v1/guide-suggestion.html + */ + getSuggestion(options) { + var that = this; + options = options || {}; + Utils.polyfillParam(options); + + if (!Utils.checkKeyword(options)) { + return; + } + + var requestParam = { + keyword: options.keyword, + region: options.region || '全国', + region_fix: options.region_fix || 0, + policy: options.policy || 0, + output: 'json', + key: that.key + }; + wx.request(Utils.buildWxRequestConfig(options, { + url: URL_SUGGESTION, + data: requestParam + })); + } + + /** + * 逆地址解析 + * + * @param {Object} options 接口参数对象 + * + * 请求参数结构可以参考 + * http://lbs.qq.com/webservice_v1/guide-gcoder.html + */ + reverseGeocoder(options) { + var that = this; + options = options || {}; + Utils.polyfillParam(options); + var requestParam = { + coord_type: options.coord_type || 5, + get_poi: options.get_poi || 0, + output: 'json', + key: that.key + }; + if (options.poi_options) { + requestParam.poi_options = options.poi_options + } + + var locationsuccess = function (result) { + requestParam.location = result.latitude + ',' + result.longitude; + wx.request(Utils.buildWxRequestConfig(options, { + url: URL_GET_GEOCODER, + data: requestParam + })); + }; + Utils.locationProcess(options, locationsuccess); + } + + /** + * 地址解析 + * + * @param {Object} options 接口参数对象 + * + * 请求参数结构可以参考 + * http://lbs.qq.com/webservice_v1/guide-geocoder.html + */ + geocoder(options) { + var that = this; + options = options || {}; + Utils.polyfillParam(options); + + if (Utils.checkParamKeyEmpty(options, 'address')) { + return; + } + + var requestParam = { + address: options.address, + output: 'json', + key: that.key + }; + + wx.request(Utils.buildWxRequestConfig(options, { + url: URL_GET_GEOCODER, + data: requestParam + })); + } + + + /** + * 获取城市列表 + * + * @param {Object} options 接口参数对象 + * + * 请求参数结构可以参考 + * http://lbs.qq.com/webservice_v1/guide-region.html + */ + getCityList(options) { + var that = this; + options = options || {}; + Utils.polyfillParam(options); + var requestParam = { + output: 'json', + key: that.key + }; + + wx.request(Utils.buildWxRequestConfig(options, { + url: URL_CITY_LIST, + data: requestParam + })); + } + + /** + * 获取对应城市ID的区县列表 + * + * @param {Object} options 接口参数对象 + * + * 请求参数结构可以参考 + * http://lbs.qq.com/webservice_v1/guide-region.html + */ + getDistrictByCityId(options) { + var that = this; + options = options || {}; + Utils.polyfillParam(options); + + if (Utils.checkParamKeyEmpty(options, 'id')) { + return; + } + + var requestParam = { + id: options.id || '', + output: 'json', + key: that.key + }; + + wx.request(Utils.buildWxRequestConfig(options, { + url: URL_AREA_LIST, + data: requestParam + })); + } + + /** + * 用于单起点到多终点的路线距离(非直线距离)计算: + * 支持两种距离计算方式:步行和驾车。 + * 起点到终点最大限制直线距离10公里。 + * + * @param {Object} options 接口参数对象 + * + * 请求参数结构可以参考 + * http://lbs.qq.com/webservice_v1/guide-distance.html + */ + calculateDistance(options) { + var that = this; + options = options || {}; + Utils.polyfillParam(options); + + if (Utils.checkParamKeyEmpty(options, 'to')) { + return; + } + + var requestParam = { + mode: options.mode || 'walking', + to: Utils.location2query(options.to), + output: 'json', + key: that.key + }; + + var locationsuccess = function (result) { + requestParam.from = result.latitude + ',' + result.longitude; + wx.request(Utils.buildWxRequestConfig(options, { + url: URL_DISTANCE, + data: requestParam + })); + } + if (options.from) { + options.location = options.from; + } + + Utils.locationProcess(options, locationsuccess); + } +} + +module.exports = QQMapWX; \ No newline at end of file diff --git a/js_sdk/wxmp-qqmap/qqmap-wx-jssdk.min.js b/js_sdk/wxmp-qqmap/qqmap-wx-jssdk.min.js new file mode 100644 index 0000000..3323249 --- /dev/null +++ b/js_sdk/wxmp-qqmap/qqmap-wx-jssdk.min.js @@ -0,0 +1,2 @@ +var _createClass=function(){function a(e,c){for(var b=0;b", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "abiFilters" : [ "armeabi-v7a", "arm64-v8a" ] + }, + "ios" : {}, + "sdkConfigs" : { + "ad" : {} + }, + "icons" : { + "android" : { + "hdpi" : "unpackage/res/icons/72x72.png", + "xhdpi" : "unpackage/res/icons/96x96.png", + "xxhdpi" : "unpackage/res/icons/144x144.png", + "xxxhdpi" : "unpackage/res/icons/192x192.png" + }, + "ios" : { + "appstore" : "unpackage/res/icons/1024x1024.png", + "ipad" : { + "app" : "unpackage/res/icons/76x76.png", + "app@2x" : "unpackage/res/icons/152x152.png", + "notification" : "unpackage/res/icons/20x20.png", + "notification@2x" : "unpackage/res/icons/40x40.png", + "proapp@2x" : "unpackage/res/icons/167x167.png", + "settings" : "unpackage/res/icons/29x29.png", + "settings@2x" : "unpackage/res/icons/58x58.png", + "spotlight" : "unpackage/res/icons/40x40.png", + "spotlight@2x" : "unpackage/res/icons/80x80.png" + }, + "iphone" : { + "app@2x" : "unpackage/res/icons/120x120.png", + "app@3x" : "unpackage/res/icons/180x180.png", + "notification@2x" : "unpackage/res/icons/40x40.png", + "notification@3x" : "unpackage/res/icons/60x60.png", + "settings@2x" : "unpackage/res/icons/58x58.png", + "settings@3x" : "unpackage/res/icons/87x87.png", + "spotlight@2x" : "unpackage/res/icons/80x80.png", + "spotlight@3x" : "unpackage/res/icons/120x120.png" + } + } + } + } + }, + "quickapp" : {}, + "mp-weixin" : { + "appid" : "", + "setting" : { + "urlCheck" : true, + "es6" : false, + "minified" : true, + "postcss" : true + }, + "optimization" : { + "subPackages" : true + }, + "usingComponents" : true, + "permission" : {}, + "secureNetwork" : { + "enable" : false + } + }, + "mp-alipay" : { + "usingComponents" : true, + "component2" : true + }, + "mp-qq" : { + "optimization" : { + "subPackages" : true + }, + "appid" : "15646153" + }, + "mp-baidu" : { + "usingComponents" : true, + "appid" : "" + }, + "mp-toutiao" : { + "usingComponents" : true, + "appid" : "" + }, + "h5" : { + "devServer" : { + "port" : 8080, + "disableHostCheck" : true, + // "proxy" : { + // "/api" : { + // "target" : "https://apis.map.qq.com", + // "changeOrigin" : true, + // "secure" : false, + // "pathRewrite" : { + // "^/api" : "" + // } + // }, + // "/dpa" : { + // "target" : "http://pv.sohu.com", + // "changeOrigin" : true, + // "secure" : false, + // "pathRewrite" : { + // "^/dpa" : "" + // } + // } + // }, + "https" : false + }, + "template" : "template.h5.html", + "router" : { + "mode" : "hash", + "base" : "./" + }, + "optimization" : { + "treeShaking" : { + "enable" : true + } + }, + "title" : "笑柚", + "sdkConfigs" : { + "maps" : { + "qqmap" : { + "key" : "2OLBZ-OOSRQ-RYZ5A-GMCM2-DJ43O-3QFLS" + }, + "tencent" : { + "key" : "2OLBZ-OOSRQ-RYZ5A-GMCM2-DJ43O-3QFLS" + } + } + } + } +} diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json new file mode 100644 index 0000000..4d5b8eb --- /dev/null +++ b/node_modules/.package-lock.json @@ -0,0 +1,77 @@ +{ + "name": "uView", + "version": "1.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "node_modules/base64-arraybuffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz", + "integrity": "sha512-I3yl4r9QB5ZRY3XuJVEPfc2XhZO6YweFPI+UovAzn+8/hb3oJ6lnysaFcjVpkCPfVWFUDvoZ8kmVDP7WyRtYtQ==", + "engines": { + "node": ">= 0.6.0" + } + }, + "node_modules/crypto-js": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.2.0.tgz", + "integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q==" + }, + "node_modules/css-line-break": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/css-line-break/-/css-line-break-2.1.0.tgz", + "integrity": "sha512-FHcKFCZcAha3LwfVBhCQbW2nCNbkZXn7KVUJcsT5/P8YmfsVja0FMPJr0B903j/E69HUphKiV9iQArX8SDYA4w==", + "dependencies": { + "utrie": "^1.0.2" + } + }, + "node_modules/html2canvas": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/html2canvas/-/html2canvas-1.4.1.tgz", + "integrity": "sha512-fPU6BHNpsyIhr8yyMpTLLxAbkaK8ArIBcmZIRiBLiDhjeqvXolaEmDGmELFuX9I4xDcaKKcJl+TKZLqruBbmWA==", + "dependencies": { + "css-line-break": "^2.1.0", + "text-segmentation": "^1.0.3" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/js-md5": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/js-md5/-/js-md5-0.8.3.tgz", + "integrity": "sha512-qR0HB5uP6wCuRMrWPTrkMaev7MJZwJuuw4fnwAzRgP4J4/F8RwtodOKpGp4XpqsLBFzzgqIO42efFAyz2Et6KQ==" + }, + "node_modules/jweixin-module": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/jweixin-module/-/jweixin-module-1.6.0.tgz", + "integrity": "sha512-dGk9cf+ipipHmtzYmKZs5B2toX+p4hLyllGLF6xuC8t+B05oYxd8fYoaRz0T30U2n3RUv8a4iwvjhA+OcYz52w==" + }, + "node_modules/text-segmentation": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/text-segmentation/-/text-segmentation-1.0.3.tgz", + "integrity": "sha512-iOiPUo/BGnZ6+54OsWxZidGCsdU8YbE4PSpdPinp7DeMtUJNJBoJ/ouUSTJjHkh1KntHaltHl/gDs2FC4i5+Nw==", + "dependencies": { + "utrie": "^1.0.2" + } + }, + "node_modules/utrie": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/utrie/-/utrie-1.0.2.tgz", + "integrity": "sha512-1MLa5ouZiOmQzUbjbu9VmjLzn1QLXBhwpUa7kdLUQK+KQ5KA9I1vk5U4YHe/X2Ch7PYnJfWuWT+VbuxbGwljhw==", + "dependencies": { + "base64-arraybuffer": "^1.0.2" + } + }, + "node_modules/vue-i18n": { + "version": "8.20.0", + "resolved": "https://registry.npmjs.org/vue-i18n/-/vue-i18n-8.20.0.tgz", + "integrity": "sha512-ZiAOoeR4d/JtKpbjipx3I80ey7cYG1ki5gQ7HwzWm4YFio9brA15BEYHjalEoBaEfzF5OBEZP+Y2MvAaWnyXXg==" + }, + "node_modules/vue-jsonp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/vue-jsonp/-/vue-jsonp-2.0.0.tgz", + "integrity": "sha512-Mzd9GNeuKP5hHFDWZNMWOsCuMILSkA6jo2l4A02wheFz3qqBzH7aSEFTey1BRCZCLizlaf1EqJ5YUtF392KspA==" + } + } +} diff --git a/node_modules/jweixin-module/README.md b/node_modules/jweixin-module/README.md new file mode 100644 index 0000000..7c91d7b --- /dev/null +++ b/node_modules/jweixin-module/README.md @@ -0,0 +1,30 @@ +# jweixin-module + +微信JS-SDK + +## 安装 + +### NPM + +```shell +npm install jweixin-module --save +``` + +### UMD + +```http +https://unpkg.com/jweixin-module/out/index.js +``` + +## 使用 + +```js +var jweixin = require('jweixin-module') +jweixin.ready(function(){ + // TODO +}); +``` + +## 完整API + +>[微信JS-SDK说明文档](https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141115) diff --git a/node_modules/jweixin-module/lib/index.js b/node_modules/jweixin-module/lib/index.js new file mode 100644 index 0000000..1b5014b --- /dev/null +++ b/node_modules/jweixin-module/lib/index.js @@ -0,0 +1 @@ +!function(e,n){"function"==typeof define&&(define.amd||define.cmd)?define(function(){return n(e)}):n(e,!0)}(window,function(o,e){if(!o.jWeixin){var n,c={config:"preVerifyJSAPI",onMenuShareTimeline:"menu:share:timeline",onMenuShareAppMessage:"menu:share:appmessage",onMenuShareQQ:"menu:share:qq",onMenuShareWeibo:"menu:share:weiboApp",onMenuShareQZone:"menu:share:QZone",previewImage:"imagePreview",getLocation:"geoLocation",openProductSpecificView:"openProductViewWithPid",addCard:"batchAddCard",openCard:"batchViewCard",chooseWXPay:"getBrandWCPayRequest",openEnterpriseRedPacket:"getRecevieBizHongBaoRequest",startSearchBeacons:"startMonitoringBeacons",stopSearchBeacons:"stopMonitoringBeacons",onSearchBeacons:"onBeaconsInRange",consumeAndShareCard:"consumedShareCard",openAddress:"editAddress"},a=function(){var e={};for(var n in c)e[c[n]]=n;return e}(),i=o.document,t=i.title,r=navigator.userAgent.toLowerCase(),s=navigator.platform.toLowerCase(),d=!(!s.match("mac")&&!s.match("win")),u=-1!=r.indexOf("wxdebugger"),l=-1!=r.indexOf("micromessenger"),p=-1!=r.indexOf("android"),f=-1!=r.indexOf("iphone")||-1!=r.indexOf("ipad"),m=(n=r.match(/micromessenger\/(\d+\.\d+\.\d+)/)||r.match(/micromessenger\/(\d+\.\d+)/))?n[1]:"",g={initStartTime:L(),initEndTime:0,preVerifyStartTime:0,preVerifyEndTime:0},h={version:1,appId:"",initTime:0,preVerifyTime:0,networkType:"",isPreVerifyOk:1,systemType:f?1:p?2:-1,clientVersion:m,url:encodeURIComponent(location.href)},v={},S={_completes:[]},y={state:0,data:{}};O(function(){g.initEndTime=L()});var I=!1,_=[],w={config:function(e){B("config",v=e);var t=!1!==v.check;O(function(){if(t)M(c.config,{verifyJsApiList:C(v.jsApiList),verifyOpenTagList:C(v.openTagList)},function(){S._complete=function(e){g.preVerifyEndTime=L(),y.state=1,y.data=e},S.success=function(e){h.isPreVerifyOk=0},S.fail=function(e){S._fail?S._fail(e):y.state=-1};var t=S._completes;return t.push(function(){!function(){if(!(d||u||v.debug||m<"6.0.2"||h.systemType<0)){var i=new Image;h.appId=v.appId,h.initTime=g.initEndTime-g.initStartTime,h.preVerifyTime=g.preVerifyEndTime-g.preVerifyStartTime,w.getNetworkType({isInnerInvoke:!0,success:function(e){h.networkType=e.networkType;var n="https://open.weixin.qq.com/sdk/report?v="+h.version+"&o="+h.isPreVerifyOk+"&s="+h.systemType+"&c="+h.clientVersion+"&a="+h.appId+"&n="+h.networkType+"&i="+h.initTime+"&p="+h.preVerifyTime+"&u="+h.url;i.src=n}})}}()}),S.complete=function(e){for(var n=0,i=t.length;n +## [8.15.4](https://github.com/kazupon/vue-i18n/compare/v8.15.3...v8.15.4) (2020-02-25) + + +### :bug: Bug Fixes + +* **index:** improve formatFallbackMessages code (#779) (#783) by [@masongzhi](https://github.com/masongzhi) ([53895b9](https://github.com/kazupon/vue-i18n/commit/53895b9))) + +### :up: Updates + +* some fixes ([8a9a950](https://github.com/kazupon/vue-i18n/commit/8a9a950)) + + + + +## [8.15.3](https://github.com/kazupon/vue-i18n/compare/v8.15.2...v8.15.3) (2019-12-18) + + +### :zap: Improvements + +* **index:** fix mergeLocaleMessage. add changes notification on merging with an empty target object ([#752](https://github.com/kazupon/vue-i18n/issues/752)) by [@jekill](https://github.com/jekill) ([048eac5](https://github.com/kazupon/vue-i18n/commit/048eac5)), closes [#752](https://github.com/kazupon/vue-i18n/issues/752) + + + + +## [8.15.2](https://github.com/kazupon/vue-i18n/compare/v8.15.1...v8.15.2) (2019-12-18) + + +### :bug: Bug Fixes + +* **index:** Fix exception when using unit number formatting by [@simonjodet](https://github.com/simonjodet) ([194b801](https://github.com/kazupon/vue-i18n/commit/194b801)), closes [#750](https://github.com/kazupon/vue-i18n/issues/750) [#751](https://github.com/kazupon/vue-i18n/issues/751) + + + + +## [8.15.1](https://github.com/kazupon/vue-i18n/compare/v8.15.0...v8.15.1) (2019-11-27) + + +### :zap: Improvements + +* **mixin:** change to custom blocks parse error ([a9858be](https://github.com/kazupon/vue-i18n/commit/a9858be)) + + + + +# [8.15.0](https://github.com/kazupon/vue-i18n/compare/v8.14.1...v8.15.0) (2019-10-16) + + +### :star: New Features + +* Add constructor option for custom modifiers ([#724](https://github.com/kazupon/vue-i18n/issues/724)) by [@epaezrubio](https://github.com/epaezrubio) ([3217212](https://github.com/kazupon/vue-i18n/commit/3217212)), closes [#724](https://github.com/kazupon/vue-i18n/issues/724) + + + + +## [8.14.1](https://github.com/kazupon/vue-i18n/compare/v8.14.0...v8.14.1) (2019-09-12) + + +### :bug: Bug Fixes + +* **path:** fix branket key error ([8d2aba7](https://github.com/kazupon/vue-i18n/commit/8d2aba7)) +* **component:** Fix interpolation component when there are empty text nodes ([547cdd1](https://github.com/kazupon/vue-i18n/commit/547cdd1)) by [@Demivan](https://github.com/Demivan) + + + + +# [8.14.0](https://github.com/kazupon/vue-i18n/compare/v8.13.0...v8.14.0) (2019-08-12) + + +### :star: New Features + +* fallback formatting ([#637](https://github.com/kazupon/vue-i18n/issues/637)) by [@sebwas](https://github.com/sebwas) ([bf9929c](https://github.com/kazupon/vue-i18n/commit/bf9929c)), closes [#637](https://github.com/kazupon/vue-i18n/issues/637) +* support slots syntax for component interpolation ([#685](https://github.com/kazupon/vue-i18n/issues/685)) by [@aavondet](https://github.com/aavondet) ([71ca843](https://github.com/kazupon/vue-i18n/commit/71ca843)), closes [#685](https://github.com/kazupon/vue-i18n/issues/685) + + + + +# [8.13.0](https://github.com/kazupon/vue-i18n/compare/v8.12.0...v8.13.0) (2019-08-09) + + +### :star: New Features + +* datetime/number formats fallback warning filter ([46de19e](https://github.com/kazupon/vue-i18n/commit/46de19e)), closes [#558](https://github.com/kazupon/vue-i18n/issues/558) +* fallback translation warning filter ([69fc798](https://github.com/kazupon/vue-i18n/commit/69fc798)) +* translation missing warning filter ([666dc9d](https://github.com/kazupon/vue-i18n/commit/666dc9d)) + + + + +# [8.12.0](https://github.com/kazupon/vue-i18n/compare/v8.11.2...v8.12.0) (2019-07-09) + + +### :star: New Features + +* **mixin:** shared locale messages feature ([82543de](https://github.com/kazupon/vue-i18n/commit/82543de)) + + +### :zap: Improvements + +* **typing:** sharedMessages option type ([6967a15](https://github.com/kazupon/vue-i18n/commit/6967a15)) + + + + +## [8.11.2](https://github.com/kazupon/vue-i18n/compare/v8.11.1...v8.11.2) (2019-04-30) + + +### :bug: Bug Fixes + +* bug(mixin): fix SSR memory leak by moving subscribeDataChanging calls into beforeMount ([#572](https://github.com/kazupon/vue-i18n/issues/572)) by [@Pindar](https://github.com/Pindar) ([32b5795](https://github.com/kazupon/vue-i18n/commit/32b5795)), closes [#572](https://github.com/kazupon/vue-i18n/issues/572) + + + + +## [8.11.1](https://github.com/kazupon/vue-i18n/compare/v8.11.0...v8.11.1) (2019-04-26) + + +### :bug: Bug Fixes + +* fix ES Modules distribution ([bb631a1](https://github.com/kazupon/vue-i18n/commit/bb631a1)) + + + + +# [8.11.0](https://github.com/kazupon/vue-i18n/compare/v8.10.0...v8.11.0) (2019-04-26) + + +### :star: New Features + +* ES modules for browser ([#561](https://github.com/kazupon/vue-i18n/issues/561)) ([c9b9adf](https://github.com/kazupon/vue-i18n/commit/c9b9adf)), closes [#561](https://github.com/kazupon/vue-i18n/issues/561) +* HTML locale message warning option ([#567](https://github.com/kazupon/vue-i18n/issues/567)) ([4aecf03](https://github.com/kazupon/vue-i18n/commit/4aecf03)), closes [#567](https://github.com/kazupon/vue-i18n/issues/567) + + + + +# [8.10.0](https://github.com/kazupon/vue-i18n/compare/v8.9.0...v8.10.0) (2019-03-28) + + +### :star: New Features + +* **number:** i18n-n functional component ([#541](https://github.com/kazupon/vue-i18n/issues/541)) by [@bponomarenko](https://github.com/bponomarenko) ([b33579d](https://github.com/kazupon/vue-i18n/commit/b33579d)), closes [#541](https://github.com/kazupon/vue-i18n/issues/541) +* **path:** Keypath should parse if sub path contains spaces. ([#533](https://github.com/kazupon/vue-i18n/issues/533)) by [@exoego](https://github.com/exoego) ([640daaf](https://github.com/kazupon/vue-i18n/commit/640daaf)), closes [#533](https://github.com/kazupon/vue-i18n/issues/533) + + +### :zap: Improvements + +* **number:** support data fall through in i18n-n ([#545](https://github.com/kazupon/vue-i18n/issues/545)) ([71cadbf](https://github.com/kazupon/vue-i18n/commit/71cadbf)), closes [#545](https://github.com/kazupon/vue-i18n/issues/545) + + +### :pencil: docs + +* **vuepress:** translate documents for chinese ([#536](https://github.com/kazupon/vue-i18n/issues/536)) by [@xuhongbo](https://github.com/xuhongbo) ([ccf29f8](https://github.com/kazupon/vue-i18n/commit/ccf29f8)), closes [#536](https://github.com/kazupon/vue-i18n/issues/536) [#531](https://github.com/kazupon/vue-i18n/issues/531) [#1](https://github.com/kazupon/vue-i18n/issues/1) [#533](https://github.com/kazupon/vue-i18n/issues/533) [#540](https://github.com/kazupon/vue-i18n/issues/540) [#541](https://github.com/kazupon/vue-i18n/issues/541) [#1](https://github.com/kazupon/vue-i18n/issues/1) [#2](https://github.com/kazupon/vue-i18n/issues/2) + + + +# [8.9.0](https://github.com/kazupon/vue-i18n/compare/v8.8.2...v8.9.0) (2019-03-08) + + +### :bug: Bug Fixes + +* **index:** Fix [#515](https://github.com/kazupon/vue-i18n/issues/515) empty string not returning true ([#525](https://github.com/kazupon/vue-i18n/issues/525)) by [@kimuraz](https://github.com/kimuraz) ([396c5ca](https://github.com/kazupon/vue-i18n/commit/396c5ca)), closes [#515](https://github.com/kazupon/vue-i18n/issues/515) [#525](https://github.com/kazupon/vue-i18n/issues/525) [#515](https://github.com/kazupon/vue-i18n/issues/515) + + +### :star: New Features + +* **index:** add availableLocales (related issue [#193](https://github.com/kazupon/vue-i18n/issues/193), PR [#528](https://github.com/kazupon/vue-i18n/issues/528)) by [@exoego](https://github.com/exoego) ([8f75b1f](https://github.com/kazupon/vue-i18n/commit/8f75b1f)), closes [#193](https://github.com/kazupon/vue-i18n/issues/193) [#528](https://github.com/kazupon/vue-i18n/issues/528) [#193](https://github.com/kazupon/vue-i18n/issues/193) [#193](https://github.com/kazupon/vue-i18n/issues/193) [#193](https://github.com/kazupon/vue-i18n/issues/193) [#193](https://github.com/kazupon/vue-i18n/issues/193) + + +### :zap: Improvements + +* **flowtype:** Fix missing type declarations in flow type ([#529](https://github.com/kazupon/vue-i18n/issues/529)) by [@exoego](https://github.com/exoego) ([4173764](https://github.com/kazupon/vue-i18n/commit/4173764)), closes [#529](https://github.com/kazupon/vue-i18n/issues/529) + + + + +## [8.8.2](https://github.com/kazupon/vue-i18n/compare/v8.8.1...v8.8.2) (2019-02-17) + + +### :bug: Bug Fixes + +* **mixin:** fix memory leak ([135058d](https://github.com/kazupon/vue-i18n/commit/135058d)), closes [#514](https://github.com/kazupon/vue-i18n/issues/514) + + + + +## [8.8.1](https://github.com/kazupon/vue-i18n/compare/v8.8.0...v8.8.1) (2019-02-10) + + +### :bug: Bug Fixes + +* **index:** fixed [#478](https://github.com/kazupon/vue-i18n/issues/478) ([#518](https://github.com/kazupon/vue-i18n/issues/518)) by [@stroncium](https://github.com/stroncium) ([469edd9](https://github.com/kazupon/vue-i18n/commit/469edd9)), closes [#478](https://github.com/kazupon/vue-i18n/issues/478) [#518](https://github.com/kazupon/vue-i18n/issues/518) [#478](https://github.com/kazupon/vue-i18n/issues/478) + + +### :zap: Improvements + +* **flowtype:** update typings ([44e04e7](https://github.com/kazupon/vue-i18n/commit/44e04e7)) +* **typescript:** update typings ([dee35b9](https://github.com/kazupon/vue-i18n/commit/dee35b9)) + + + + +# [8.8.0](https://github.com/kazupon/vue-i18n/compare/v8.7.0...v8.8.0) (2019-01-29) + + +### :bug: Bug Fixes + +* **index:** fix flat path based key issue ([bed9c39](https://github.com/kazupon/vue-i18n/commit/bed9c39)), closes [#349](https://github.com/kazupon/vue-i18n/issues/349) +* **mixin:** fix beforeDestroy can not find this.$t ([#500](https://github.com/kazupon/vue-i18n/issues/500)) by [@masongzhi](https://github.com/masongzhi) ([311b8f3](https://github.com/kazupon/vue-i18n/commit/311b8f3)), closes [#500](https://github.com/kazupon/vue-i18n/issues/500) + + +### :zap: Improvements + +* **directive:** Fix typo on warning message ([#509](https://github.com/kazupon/vue-i18n/issues/509)) by [@kimuraz](https://github.com/kimuraz) ([e879024](https://github.com/kazupon/vue-i18n/commit/e879024)), closes [#509](https://github.com/kazupon/vue-i18n/issues/509) +* **index:** silence fallback warnings ([#510](https://github.com/kazupon/vue-i18n/issues/510)) by [@SzNagyMisu](https://github.com/SzNagyMisu) ([ddc0c79](https://github.com/kazupon/vue-i18n/commit/ddc0c79)), closes [#510](https://github.com/kazupon/vue-i18n/issues/510) [#139](https://github.com/kazupon/vue-i18n/issues/139) + + + + +# [8.7.0](https://github.com/kazupon/vue-i18n/compare/v8.6.0...v8.7.0) (2019-01-02) + + +### :zap: Improvements + +* **directive:** Preserve directive content ([#495](https://github.com/kazupon/vue-i18n/issues/495)) by [@bponomarenko](https://github.com/bponomarenko) ([c29edba](https://github.com/kazupon/vue-i18n/commit/c29edba)), closes [#495](https://github.com/kazupon/vue-i18n/issues/495) [#408](https://github.com/kazupon/vue-i18n/issues/408) [#408](https://github.com/kazupon/vue-i18n/issues/408) + + + + +# [8.6.0](https://github.com/kazupon/vue-i18n/compare/v8.5.0...v8.6.0) (2018-12-25) + + +### :bug: Bug Fixes + +* **pluralization:** inherit pluralization rules ⚠ ([#493](https://github.com/kazupon/vue-i18n/issues/493)) by [@Raiondesu](https://github.com/Raiondesu) ([7a23f32](https://github.com/kazupon/vue-i18n/commit/7a23f32)), closes [#493](https://github.com/kazupon/vue-i18n/issues/493) + + +### :zap: Improvements + +* **format:** Add the path as argument to the custom formatter ([#489](https://github.com/kazupon/vue-i18n/issues/489)) by [@Raiondesu](https://github.com/Raiondesu) ([b9437ea](https://github.com/kazupon/vue-i18n/commit/b9437ea)), closes [#489](https://github.com/kazupon/vue-i18n/issues/489) [#484](https://github.com/kazupon/vue-i18n/issues/484) [#484](https://github.com/kazupon/vue-i18n/issues/484) + + + + +# [8.5.0](https://github.com/kazupon/vue-i18n/compare/v8.4.0...v8.5.0) (2018-12-17) + + +### :bug: Bug Fixes + +* **index:** evaluate availabilities lazily (fix [#477](https://github.com/kazupon/vue-i18n/issues/477)) ([#483](https://github.com/kazupon/vue-i18n/issues/483)) by [@gamtiq](https://github.com/gamtiq) ([b66f02e](https://github.com/kazupon/vue-i18n/commit/b66f02e)), closes [#477](https://github.com/kazupon/vue-i18n/issues/477) [#483](https://github.com/kazupon/vue-i18n/issues/483) + + +### :zap: Improvements + +* **index:** Allow pluralization customization via constructor options (closes [#464](https://github.com/kazupon/vue-i18n/issues/464)) ([#482](https://github.com/kazupon/vue-i18n/issues/482)) by [@Raiondesu](https://github.com/Raiondesu) ([ef4b1a6](https://github.com/kazupon/vue-i18n/commit/ef4b1a6)), closes [#464](https://github.com/kazupon/vue-i18n/issues/464) [#482](https://github.com/kazupon/vue-i18n/issues/482) [#464](https://github.com/kazupon/vue-i18n/issues/464) [#464](https://github.com/kazupon/vue-i18n/issues/464) [#464](https://github.com/kazupon/vue-i18n/issues/464) [#464](https://github.com/kazupon/vue-i18n/issues/464) [#451](https://github.com/kazupon/vue-i18n/issues/451) +* **index:** make silentTranslationWarn work for dates and numbers too ([#481](https://github.com/kazupon/vue-i18n/issues/481)) by [@Raiondesu](https://github.com/Raiondesu) ([402092b](https://github.com/kazupon/vue-i18n/commit/402092b)), closes [#481](https://github.com/kazupon/vue-i18n/issues/481) +* **types:** typed autocomplete in date and number format options ([#485](https://github.com/kazupon/vue-i18n/issues/485)) by [@Raiondesu](https://github.com/Raiondesu) ([e2e5993](https://github.com/kazupon/vue-i18n/commit/e2e5993)), closes [#485](https://github.com/kazupon/vue-i18n/issues/485) + + + + +# [8.4.0](https://github.com/kazupon/vue-i18n/compare/v8.3.2...v8.4.0) (2018-11-30) + + +### :star: New Features + +* **index:** Add linked message formatting ([#467](https://github.com/kazupon/vue-i18n/issues/467)) by [@exoego](https://github.com/exoego) ([776b81b](https://github.com/kazupon/vue-i18n/commit/776b81b)), closes [#467](https://github.com/kazupon/vue-i18n/issues/467) + + + + +## [8.3.2](https://github.com/kazupon/vue-i18n/compare/v8.3.1...v8.3.2) (2018-11-16) + + +### :chart_with_upwards_trend: Performance Fixes + +* **index:** Optimize unnecessary capturing. ([#462](https://github.com/kazupon/vue-i18n/issues/462)) by [@exoego](https://github.com/exoego) ([116845e](https://github.com/kazupon/vue-i18n/commit/116845e)), closes [#462](https://github.com/kazupon/vue-i18n/issues/462) + + + + +## [8.3.1](https://github.com/kazupon/vue-i18n/compare/v8.3.0...v8.3.1) (2018-11-08) + + +### :bug: Bug Fixes + +* **directive:** fix cannnot update with v-t when had been changed locale message ([4895a2e](https://github.com/kazupon/vue-i18n/commit/4895a2e)), closes [#450](https://github.com/kazupon/vue-i18n/issues/450) +* **index:** fix merge bug ([1798490](https://github.com/kazupon/vue-i18n/commit/1798490)), closes [#458](https://github.com/kazupon/vue-i18n/issues/458) +* **missing:** fix vm argument passing ([dc48099](https://github.com/kazupon/vue-i18n/commit/dc48099)), closes [#453](https://github.com/kazupon/vue-i18n/issues/453) + + +### :zap: Improvements + +* Optimize path.js and format.js ([#456](https://github.com/kazupon/vue-i18n/issues/456)) by [@exoego](https://github.com/exoego) ([639453c](https://github.com/kazupon/vue-i18n/commit/639453c)), closes [#456](https://github.com/kazupon/vue-i18n/issues/456) + + + + +# [8.3.0](https://github.com/kazupon/vue-i18n/compare/v8.2.1...v8.3.0) (2018-10-29) + + +### :zap: Improvements + +* **pluralization:** Extendable pluralization by [@Raiondesu](https://github.com/Raiondesu) ([bbab90b](https://github.com/kazupon/vue-i18n/commit/bbab90b)) + + + + +## [8.2.1](https://github.com/kazupon/vue-i18n/compare/v8.2.0...v8.2.1) (2018-10-15) + + +### :bug: Bug Fixes + +* **extend:** fix TypeError: Cannot redefine property: $i18n ([#422](https://github.com/kazupon/vue-i18n/issues/422)) by [@HadiChen](https://github.com/HadiChen) ([cb19082](https://github.com/kazupon/vue-i18n/commit/cb19082)), closes [#422](https://github.com/kazupon/vue-i18n/issues/422) + + +### :zap: Improvements + +* **index:** Suppress some warnings in production: smaller min.js and performance gain. ([#441](https://github.com/kazupon/vue-i18n/issues/441)) by @ exoego ([43931f5](https://github.com/kazupon/vue-i18n/commit/43931f5)), closes [#441](https://github.com/kazupon/vue-i18n/issues/441) + + + + +# [8.2.0](https://github.com/kazupon/vue-i18n/compare/v8.1.1...v8.2.0) (2018-10-13) + + +### :bug: Bug Fixes + +* **index:** Add warning for circular reference in linked message ([#438](https://github.com/kazupon/vue-i18n/issues/438)) by [@exoego](https://github.com/exoego) ([7583485](https://github.com/kazupon/vue-i18n/commit/7583485)), closes [#438](https://github.com/kazupon/vue-i18n/issues/438) + + +### :zap: Improvements + +* **index:** Allow escaping link key like @:(foo.bar). ([#437](https://github.com/kazupon/vue-i18n/issues/437)) by [@exoego](https://github.com/exoego) ([acfc458](https://github.com/kazupon/vue-i18n/commit/acfc458)), closes [#437](https://github.com/kazupon/vue-i18n/issues/437) +* **index:** Pre-defined named arguments for Pluraization ([#440](https://github.com/kazupon/vue-i18n/issues/440)) by [@exoego](https://github.com/exoego) ([e84f0fb](https://github.com/kazupon/vue-i18n/commit/e84f0fb)), closes [#440](https://github.com/kazupon/vue-i18n/issues/440) +* **path:** Allow non-ascii chars including numbers. ([#436](https://github.com/kazupon/vue-i18n/issues/436)) by [@exoego](https://github.com/exoego) ([a556c58](https://github.com/kazupon/vue-i18n/commit/a556c58)), closes [#436](https://github.com/kazupon/vue-i18n/issues/436) + + + + +## [8.1.1](https://github.com/kazupon/vue-i18n/compare/v8.1.0...v8.1.1) (2018-10-12) + + +### :bug: Bug Fixes + +* **build:** fix rollup building issues ([1a1958a](https://github.com/kazupon/vue-i18n/commit/1a1958a)) +* **format:** Should warn as unknown if named format is not closed. ([#435](https://github.com/kazupon/vue-i18n/issues/435)) by [@exoego](https://github.com/exoego) ([d1f6ed0](https://github.com/kazupon/vue-i18n/commit/d1f6ed0)), closes [#435](https://github.com/kazupon/vue-i18n/issues/435) +* **install:** fix cannot redfine error ([6d5ec61](https://github.com/kazupon/vue-i18n/commit/6d5ec61)) + + +### :zap: Improvements + +* **package.json:** tree shaking optimization ([38948c5](https://github.com/kazupon/vue-i18n/commit/38948c5)) + + + + +# [8.1.0](https://github.com/kazupon/vue-i18n/compare/v8.0.0...v8.1.0) (2018-09-03) + + +### :bug: Bug Fixes + +* **install:** add support for Vue.extend vue-i18n instance ([#420](https://github.com/kazupon/vue-i18n/issues/420)) by [@jaredzhu1993](https://github.com/jaredzhu1993) ([a60ea8b](https://github.com/kazupon/vue-i18n/commit/a60ea8b)), closes [#420](https://github.com/kazupon/vue-i18n/issues/420) + + +### :zap: Improvements + +* **warnings:** make warning messages clearer ([#396](https://github.com/kazupon/vue-i18n/issues/396)) by [@kimuraz](https://github.com/kimuraz) ([79eee1b](https://github.com/kazupon/vue-i18n/commit/79eee1b)), closes [#396](https://github.com/kazupon/vue-i18n/issues/396) + + + + +# [8.0.0](https://github.com/kazupon/vue-i18n/compare/v7.8.1...v8.0.0) (2018-06-23) + + +### :boom: Breaking changes + +* **extend:** fix this context binding ([aa0e831](https://github.com/kazupon/vue-i18n/commit/aa0e831)), closes [#306](https://github.com/kazupon/vue-i18n/issues/306) [#286](https://github.com/kazupon/vue-i18n/issues/286) [#259](https://github.com/kazupon/vue-i18n/issues/259), revert [#260](https://github.com/kazupon/vue-i18n/issues/260) + +Note that you need to guarantee this context equal to component instance in lifecycle methods (e.g. in `data` options, `const $t = this.$t.bind(this)`). + +```js +export default { + data () { + const $t = this.$t.bind(this) + return { msg: $t('msg') } + } +} +``` + +see the [API docs](https://kazupon.github.io/vue-i18n/api/) + +### :bug: Bug Fixes + +* bug(directive): fix guard checking at unbind ([c74888c](https://github.com/kazupon/vue-i18n/commit/c74888c)), closes [#340](https://github.com/kazupon/vue-i18n/issues/340) + + +### NOTE + +* extend: + + + + +## [7.8.1](https://github.com/kazupon/vue-i18n/compare/v7.8.0...v7.8.1) (2018-06-18) + + +### :bug: Bug Fixes + +* **directive:** fix cannot unbind bug ([105888d](https://github.com/kazupon/vue-i18n/commit/105888d)), closes [#377](https://github.com/kazupon/vue-i18n/issues/377) + + + + +# [7.8.0](https://github.com/kazupon/vue-i18n/compare/v7.7.0...v7.8.0) (2018-06-01) + + +### :zap: Improvements + +* **typescript:** add type exportings ([a7cb8da](https://github.com/kazupon/vue-i18n/commit/a7cb8da)) + + + + +# [7.7.0](https://github.com/kazupon/vue-i18n/compare/v7.6.0...v7.7.0) (2018-05-20) + + +### :zap: Improvements + +* **index:** resource reactivity ([887a137](https://github.com/kazupon/vue-i18n/commit/887a137)), closes [#253](https://github.com/kazupon/vue-i18n/issues/253) +* **typescript:** Fix typings in components ([#344](https://github.com/kazupon/vue-i18n/issues/344)) by [@Demivan](https://github.com/Demivan) ([2402893](https://github.com/kazupon/vue-i18n/commit/2402893)), closes [#344](https://github.com/kazupon/vue-i18n/issues/344) + + + + +# [7.6.0](https://github.com/kazupon/vue-i18n/compare/v7.5.0...v7.6.0) (2018-03-13) + + +### :zap: Improvements + +* **index:** support retunable missing handler ([#256](https://github.com/kazupon/vue-i18n/issues/256)) by [@houd1ni](https://github.com/houd1ni) ([9fbe467](https://github.com/kazupon/vue-i18n/commit/9fbe467)) +* **typescript:** update TranslateResult type interface ([dffc678](https://github.com/kazupon/vue-i18n/commit/dffc678)) + + + + +# [7.5.0](https://github.com/kazupon/vue-i18n/compare/v7.4.2...v7.5.0) (2018-03-11) + + +### :star: New Features + +* **directive:** Add pluralization feature to directive ([#304](https://github.com/kazupon/vue-i18n/issues/304)) by [@SirLamer](https://github.com/SirLamer) ([8378859](https://github.com/kazupon/vue-i18n/commit/8378859)) + + +### :zap: Improvements + +* **flow:** update TranslateResult type interface ([59f4658](https://github.com/kazupon/vue-i18n/commit/59f4658)) +* **index:** support object localization ([#311](https://github.com/kazupon/vue-i18n/issues/311)) by [@manniL](https://github.com/manniL) ([99e5006](https://github.com/kazupon/vue-i18n/commit/99e5006)) +* **missing:** Add interpolation values to missing handler ([#308](https://github.com/kazupon/vue-i18n/issues/308)) by [@sebwas](https://github.com/sebwas) ([b912d8a](https://github.com/kazupon/vue-i18n/commit/b912d8a)) +* **numberformat:** Explicit number format options ([#305](https://github.com/kazupon/vue-i18n/issues/305)) by [@bponomarenko](https://github.com/bponomarenko) ([aa07450](https://github.com/kazupon/vue-i18n/commit/aa07450)) + + + + +## [7.4.2](https://github.com/kazupon/vue-i18n/compare/v7.4.1...v7.4.2) (2018-02-01) + + +### :zap: Improvements + +* **index:** Fixes global auto installation ([#291](https://github.com/kazupon/vue-i18n/issues/291)) by [@emileber](https://github.com/emileber) ([2f016ff](https://github.com/kazupon/vue-i18n/commit/2f016ff)), closes [#291](https://github.com/kazupon/vue-i18n/issues/291) + + + + +## [7.4.1](https://github.com/kazupon/vue-i18n/compare/v7.4.0...v7.4.1) (2018-01-25) + + +### :bug: Bug Fixes + +* fix cannot react ([2a8ea1c](https://github.com/kazupon/vue-i18n/commit/2a8ea1c)), closes [#261](https://github.com/kazupon/vue-i18n/issues/261) + + +### :zap: Improvements + +* **formatter:** interpolate messages without values ([#282](https://github.com/kazupon/vue-i18n/issues/282)) by [@cb8](https://github.com/cb8) ([b792ce2](https://github.com/kazupon/vue-i18n/commit/b792ce2)) + + + + +# [7.4.0](https://github.com/kazupon/vue-i18n/compare/v7.3.4...v7.4.0) (2018-01-10) + + +### :star: New Features + +* **typescript:** Allow module augmentation ([#273](https://github.com/kazupon/vue-i18n/issues/273)) by [@CKGrafico](https://github.com/CKGrafico) ([4371344](https://github.com/kazupon/vue-i18n/commit/4371344)) + + + + +## [7.3.4](https://github.com/kazupon/vue-i18n/compare/v7.3.3...v7.3.4) (2018-01-07) + + +### :bug: Bug Fixes + +* **formatter:** Inherit formatter ([#269](https://github.com/kazupon/vue-i18n/issues/269)) by [@podkot](https://github.com/podkot) ([26a33ad](https://github.com/kazupon/vue-i18n/commit/26a33ad)) + + + + +## [7.3.3](https://github.com/kazupon/vue-i18n/compare/v7.3.2...v7.3.3) (2017-12-19) + + +### :bug: Bug Fixes + +* **extend:** Fix this not found [#259](https://github.com/kazupon/vue-i18n/issues/259) ([#260](https://github.com/kazupon/vue-i18n/issues/260)) by [@lzxb](https://github.com/lzxb) ([c29007e](https://github.com/kazupon/vue-i18n/commit/c29007e)), closes [#259](https://github.com/kazupon/vue-i18n/issues/259) [#260](https://github.com/kazupon/vue-i18n/issues/260) +* **types:** fix using old export ([#263](https://github.com/kazupon/vue-i18n/issues/263)) by [@jmigual](https://github.com/jmigual) ([b295fee](https://github.com/kazupon/vue-i18n/commit/b295fee)), closes [#263](https://github.com/kazupon/vue-i18n/issues/263) + + + +## [7.3.2](https://github.com/kazupon/vue-i18n/compare/v7.3.1...v7.3.2) (2017-10-19) + + +### :zap: Improvements + +* **typescript:** fix import problem of vue2.5 because of the types update ([#238](https://github.com/kazupon/vue-i18n/issues/238)) by [@peterchealse](https://github.com/peterchealse) ([cb98347](https://github.com/kazupon/vue-i18n/commit/cb98347)), closes [#238](https://github.com/kazupon/vue-i18n/issues/238) + + + + +## [7.3.1](https://github.com/kazupon/vue-i18n/compare/v7.3.0...v7.3.1) (2017-10-04) + + +### :bug: Bug Fixes + +* **directive:** fix cannot locale reactivity ([e1fc12e](https://github.com/kazupon/vue-i18n/commit/e1fc12e)), closes [#227](https://github.com/kazupon/vue-i18n/issues/227) + + + + +# [7.3.0](https://github.com/kazupon/vue-i18n/compare/v7.2.0...v7.3.0) (2017-09-22) + + +### :star: New Features + +* **directives:** support v-t custom directive (welcome back!) ([af9a2e7](https://github.com/kazupon/vue-i18n/commit/af9a2e7)) + + +### :up: Updates + +* **typing:** fix flowtype ([fa06f44](https://github.com/kazupon/vue-i18n/commit/fa06f44)) + + + + +# [7.2.0](https://github.com/kazupon/vue-i18n/compare/v7.1.2...v7.2.0) (2017-08-28) + + +### :star: New Features + +* **interpolation:** list formatting refactor and places/place feature ([#218](https://github.com/kazupon/vue-i18n/issues/218)) by [@myst729](https://github.com/myst729) ([0f0f3ff](https://github.com/kazupon/vue-i18n/commit/0f0f3ff)) + + + + +## [7.1.2](https://github.com/kazupon/vue-i18n/compare/v7.1.1...v7.1.2) (2017-08-25) + + +### :zap: Improvements + +* **interpolation:** skip non-element VNode in interpolation ([#211](https://github.com/kazupon/vue-i18n/issues/211)) by [@myst729](https://github.com/myst729) ([6be1756](https://github.com/kazupon/vue-i18n/commit/6be1756)) + + + + +## [7.1.1](https://github.com/kazupon/vue-i18n/compare/v7.1.0...v7.1.1) (2017-08-03) + + +### :bug: Bug Fixes + +* **mixin:** fix cannot setup VueI18n instance ([13585a4](https://github.com/kazupon/vue-i18n/commit/13585a4)), closes [#203](https://github.com/kazupon/vue-i18n/issues/203) + + + + +# [7.1.0](https://github.com/kazupon/vue-i18n/compare/v7.0.5...v7.1.0) (2017-07-30) + + +### :zap: Improvements + +* **custom-block:** support multiple custom blocks ([ab955a5](https://github.com/kazupon/vue-i18n/commit/ab955a5)), closes [#189](https://github.com/kazupon/vue-i18n/issues/189) + + + + +## [7.0.5](https://github.com/kazupon/vue-i18n/compare/v7.0.4...v7.0.5) (2017-07-08) + + +### :bug: Bug Fixes + +* **format:** fix cannot collectly parse percent ([fc71eda](https://github.com/kazupon/vue-i18n/commit/fc71eda)), closes [#191](https://github.com/kazupon/vue-i18n/issues/191) + + + + +## [7.0.4](https://github.com/kazupon/vue-i18n/compare/v7.0.3...v7.0.4) (2017-07-01) + + +### :bug: Bug Fixes + +* **link:** fix ie traverse custom Array.prototype method ([#188](https://github.com/kazupon/vue-i18n/issues/188)) by [@632781460](https://github.com/632781460) ([d3b308b](https://github.com/kazupon/vue-i18n/commit/d3b308b)), closes [#188](https://github.com/kazupon/vue-i18n/issues/188) + + +### :chart_with_upwards_trend: Performance Fixes + +* fix blocking at beforeDestroy ([570b215](https://github.com/kazupon/vue-i18n/commit/570b215)), closes [#187](https://github.com/kazupon/vue-i18n/issues/187) + + + + +## [7.0.3](https://github.com/kazupon/vue-i18n/compare/v7.0.2...v7.0.3) (2017-06-13) + + +### :bug: Bug Fixes + +* **fallback:** fix cannot fallabck localization ([694e6f2](https://github.com/kazupon/vue-i18n/commit/694e6f2)), closes [#176](https://github.com/kazupon/vue-i18n/issues/176) +* **fallback:** fix fallback locale issue ([d9ceddc](https://github.com/kazupon/vue-i18n/commit/d9ceddc)), closes [#174](https://github.com/kazupon/vue-i18n/issues/174) +* **linked:** fix cannot fallback linked localization ([0c572f3](https://github.com/kazupon/vue-i18n/commit/0c572f3)), closes [#172](https://github.com/kazupon/vue-i18n/issues/172) + + + + +## [7.0.2](https://github.com/kazupon/vue-i18n/compare/v7.0.1...v7.0.2) (2017-06-10) + + +### :bug: Bug Fixes + +* **sfc:** fix cannot parse custom block locale messages ([32eb3a7](https://github.com/kazupon/vue-i18n/commit/32eb3a7)), closes [#173](https://github.com/kazupon/vue-i18n/issues/173) + + + + +## [7.0.1](https://github.com/kazupon/vue-i18n/compare/v7.0.0...v7.0.1) (2017-06-04) + + +### :bug: Bug Fixes + +* fix cannat single file component translation ([687d406](https://github.com/kazupon/vue-i18n/commit/687d406)), closes [#169](https://github.com/kazupon/vue-i18n/issues/169) +* fix cannnot resolve linked localization with component interpolation ([c973619](https://github.com/kazupon/vue-i18n/commit/c973619)), closes [#171](https://github.com/kazupon/vue-i18n/issues/171) +* fix datetime and number fallback localization ([be9e1bd](https://github.com/kazupon/vue-i18n/commit/be9e1bd)), closes [#168](https://github.com/kazupon/vue-i18n/issues/168) +* fix linked translation with using hyphen or underscore keypath ([6e9f151](https://github.com/kazupon/vue-i18n/commit/6e9f151)), closes [#170](https://github.com/kazupon/vue-i18n/issues/170) + + + +# [7.0.0](https://github.com/kazupon/vue-i18n/compare/v7.0.0-rc.1...v7.0.0) (2017-05-29) + +:tada: :tada: :tada: + +See the [docs](https://kazupon.github.io/vue-i18n/en/) + + +### :star: New Features + +* **datetime localization:** + * [documentation](https://github.com/kazupon/vue-i18n/blob/dev/gitbook/en/datetime.md) + * [example](https://github.com/kazupon/vue-i18n/tree/dev/examples/datetime) +* **number localization:** + * [documentation](https://github.com/kazupon/vue-i18n/blob/dev/gitbook/en/number.md) + * [example](https://github.com/kazupon/vue-i18n/tree/dev/examples/number) +* **component interpolation:** + * [documentation](https://github.com/kazupon/vue-i18n/blob/dev/gitbook/en/interpolation.md) + * [example](https://github.com/kazupon/vue-i18n/tree/dev/examples/interpolation) +* **typescript:** + * [type definitions](https://github.com/kazupon/vue-i18n/blob/dev/types/index.d.ts) + + +### :chart_with_upwards_trend: Performance Fixes + +* fix translation performance issue ([6032a51](https://github.com/kazupon/vue-i18n/commit/6032a51)) + + +### :zap: Improvements + +* **path:** tweak for ssr + + +### :boom: Breaking changes + +* **format:** re-impelement formatter +* **formatter:** change method nam +* **flowtype:** fix locale message related type changing and remove underscore type + + +### :bug: Bug Fixes + +* **examples:** fix ssr demo ([059034f](https://github.com/kazupon/vue-i18n/commit/059034f)) +* **pluralization:** fix default choice ([240cfed](https://github.com/kazupon/vue-i18n/commit/240cfed)) + + + +# [7.0.0-rc.1](https://github.com/kazupon/vue-i18n/compare/v7.0.0-beta.4...v7.0.0-rc.1) (2017-05-26) + + +### :chart_with_upwards_trend: Performance Fixes + +* fix translation performance issue ([6032a51](https://github.com/kazupon/vue-i18n/commit/6032a51)), closes [#165](https://github.com/kazupon/vue-i18n/issues/165) + + +### :up: Updates + +* **flowtype:** remove unneccesary type ([eb60156](https://github.com/kazupon/vue-i18n/commit/eb60156)) + + + + +# [7.0.0-beta.4](https://github.com/kazupon/vue-i18n/compare/v7.0.0-beta.3...v7.0.0-beta.4) (2017-05-23) + + +### :bug: Bug Fixes + +* **pluralization:** fix default choice ([240cfed](https://github.com/kazupon/vue-i18n/commit/240cfed)), closes [#164](https://github.com/kazupon/vue-i18n/issues/164) + + + + +# [7.0.0-beta.3](https://github.com/kazupon/vue-i18n/compare/v7.0.0-beta.2...v7.0.0-beta.3) (2017-05-15) + +### :up: Updates + +* bring back from bug fix ([95be4ea](https://github.com/kazupon/vue-i18n/commit/95be4ea)) + + + +# [7.0.0-beta.2](https://github.com/kazupon/vue-i18n/compare/v7.0.0-beta.1...v7.0.0-beta.2) (2017-05-14) + + +### :zap: Improvements + +* **path:** tweak for ssr ([eb21921](https://github.com/kazupon/vue-i18n/commit/eb21921)) +* **typescript:** change custom formatter method name ([c5f043f](https://github.com/kazupon/vue-i18n/commit/c5f043f)) + + + + +# [7.0.0-beta.1](https://github.com/kazupon/vue-i18n/compare/v6.1.1...v7.0.0-beta.1) (2017-05-11) + +### :star: New Features + +* **datetime localization:** add datetime localization ([3282075](https://github.com/kazupon/vue-i18n/commit/3282075)) + * [documentation](https://github.com/kazupon/vue-i18n/blob/dev/gitbook/en/datetime.md) + * [example](https://github.com/kazupon/vue-i18n/tree/dev/examples/datetime) +* **number localization:** add number localization ([87ee7b3](https://github.com/kazupon/vue-i18n/commit/87ee7b3)) + * [documentation](https://github.com/kazupon/vue-i18n/blob/dev/gitbook/en/number.md) + * [example](https://github.com/kazupon/vue-i18n/tree/dev/examples/number) +* **component interpolation:** ([23f7d34](https://github.com/kazupon/vue-i18n/commit/23f7d34)), closes [#145](https://github.com/kazupon/vue-i18n/issues/145) [#144](https://github.com/kazupon/vue-i18n/issues/144) [#37](https://github.com/kazupon/vue-i18n/issues/37) + * [documentation](https://github.com/kazupon/vue-i18n/blob/dev/gitbook/en/interpolation.md) + * [example](https://github.com/kazupon/vue-i18n/tree/dev/examples/interpolation) +* **typescript:** add TypeScript type definitions ([#161](https://github.com/kazupon/vue-i18n/issues/161)) by [@aicest](https://github.com/aicest) ([61cebca](https://github.com/kazupon/vue-i18n/commit/61cebca)) + * [type definitions](https://github.com/kazupon/vue-i18n/blob/dev/types/index.d.ts) + + +### :boom: Breaking changes + +* **format:** re-impelement formatter ([a8c046d](https://github.com/kazupon/vue-i18n/commit/a8c046d)) +* **formatter:** change method name ([6eed51c](https://github.com/kazupon/vue-i18n/commit/6eed51c)) +* **flowtype:** fix locale message related type changing ([c30d576](https://github.com/kazupon/vue-i18n/commit/c30d576)) + + +### :bug: Bug Fixes + +* **examples:** fix ssr demo ([059034f](https://github.com/kazupon/vue-i18n/commit/059034f)), closes [#151](https://github.com/kazupon/vue-i18n/issues/151) + + + +## [6.1.3](https://github.com/kazupon/vue-i18n/compare/v6.1.1...v6.1.3) (2017-05-15) + + +### :bug: Bug Fixes + +* fix memory leaks ([95be4ea](https://github.com/kazupon/vue-i18n/commit/95be4ea)), closes [#162](https://github.com/kazupon/vue-i18n/issues/162) + + + + +## [6.1.2](https://github.com/kazupon/vue-i18n/compare/v6.1.1...v6.1.2) (2017-05-15) + + + +## [6.1.1](https://github.com/kazupon/vue-i18n/compare/v6.1.0...v6.1.1) (2017-04-19) + + +### :bug: Bug Fixes + +* **te:** Fix `te()` that always uses `this.locale`, even when `locale` supplied ([#147](https://github.com/kazupon/vue-i18n/issues/147)) by [@aicest](https://github.com/aicest) ([bf15eeb](https://github.com/kazupon/vue-i18n/commit/bf15eeb)), closes [#147](https://github.com/kazupon/vue-i18n/issues/147) + + + + +# [6.1.0](https://github.com/kazupon/vue-i18n/compare/v6.0.0...v6.1.0) (2017-04-14) + + +### :star: New Features + +* **api:** add 'mergeLocaleMessage' method ([ef21621](https://github.com/kazupon/vue-i18n/commit/ef21621)), closes [#131](https://github.com/kazupon/vue-i18n/issues/131) +* **silent:** add silent translation missing option ([29b3a17](https://github.com/kazupon/vue-i18n/commit/29b3a17)), closes [#139](https://github.com/kazupon/vue-i18n/issues/139) + + +### :zap: Improvements + +* change to method from computed property ([9135a59](https://github.com/kazupon/vue-i18n/commit/9135a59)), closes [#141](https://github.com/kazupon/vue-i18n/issues/141) + + + + +# [6.0.0](https://github.com/kazupon/vue-i18n/compare/v6.0.0-beta.1...v6.0.0) (2017-04-05) + +:tada: :tada: :tada: + +See the [docs](https://kazupon.github.io/vue-i18n/en/) + +### :zap: Improvements + +- Server-Side Rendering: [example](https://github.com/kazupon/vue-i18n/tree/dev/examples/ssr) +- Custom formatter: [example](https://github.com/kazupon/vue-i18n/tree/dev/examples/formatting/custom) + + +### :star: NEW Features + +- Single File Components: [example](https://github.com/kazupon/vue-i18n/tree/dev/examples/sfc) + + +### :boom: Breaking changes + +- API +- Dynamic locale DEPRECATED + + + +# [6.0.0-beta.1](https://github.com/kazupon/vue-i18n/compare/v6.0.0-alpha.6...v6.0.0-beta.1) (2017-03-22) + + +### :boom: Breaking changes + +* change `fallbackRoot` and `sync` option default `true` value ([0890b44](https://github.com/kazupon/vue-i18n/commit/0890b44)) +* remove messages settter, and add getLocaleMessage API ([0f0914d](https://github.com/kazupon/vue-i18n/commit/0f0914d)) + + +### :bug: Bug Fixes + +* **mixin:** fix computed props errors ([a6b7e37](https://github.com/kazupon/vue-i18n/commit/a6b7e37)) + + +### :up: Updates + +* **flowtype:** argument names ([cf14425](https://github.com/kazupon/vue-i18n/commit/cf14425)) + + +### :zap: Improvements + +* **fallbackLocale:** support reactivity ([ed758be](https://github.com/kazupon/vue-i18n/commit/ed758be)) +* **warn:** suppress warning messages for production ([6e417d2](https://github.com/kazupon/vue-i18n/commit/6e417d2)) + + + + +# [6.0.0-alpha.6](https://github.com/kazupon/vue-i18n/compare/v6.0.0-alpha.5...v6.0.0-alpha.6) (2017-03-16) + + +### :star: New Features + +* add 'setLocaleMessage' API ([8b71eda](https://github.com/kazupon/vue-i18n/commit/8b71eda)) + + + + +# [6.0.0-alpha.5](https://github.com/kazupon/vue-i18n/compare/v6.0.0-alpha.3...v6.0.0-alpha.5) (2017-03-11) + + +### :bug: Bug Fixes + +* **mixin:** fix cannot create VueI18n instance error for minify production ([7eeb29f](https://github.com/kazupon/vue-i18n/commit/7eeb29f)) + + + + +# [6.0.0-alpha.4](https://github.com/kazupon/vue-i18n/compare/v6.0.0-alpha.3...v6.0.0-alpha.4) (2017-03-11) + + + + +# [6.0.0-alpha.3](https://github.com/kazupon/vue-i18n/compare/v6.0.0-alpha.2...v6.0.0-alpha.3) (2017-03-08) + + +### :star: New Features + +* add `sync` option ([5c46c07](https://github.com/kazupon/vue-i18n/commit/5c46c07)) + + +### :zap: Improvements + +* **mixin:** add error throwings and a warning ([0e4ac39](https://github.com/kazupon/vue-i18n/commit/0e4ac39)) + + + + +# [6.0.0-alpha.2](https://github.com/kazupon/vue-i18n/compare/v6.0.0-alpha.1...v6.0.0-alpha.2) (2017-02-27) + + +### :zap: Improvements + +* **mixin:** release i18n instance ([cc362a3](https://github.com/kazupon/vue-i18n/commit/cc362a3)) +* **vue:** support vue 2.2 ([5e7bf5e](https://github.com/kazupon/vue-i18n/commit/5e7bf5e)) + + + + +# [6.0.0-alpha.1](https://github.com/kazupon/vue-i18n/compare/v5.0.2...v6.0.0-alpha.1) (2017-02-23) + +This is the first release of 6.0. +In this version, we are some big breaking changes. + +- Recommended for: experiments, prototypes, upgrading small, non-critical apps +- **NOT** recommended for: production use, upgrading production apps + +:warning: Documentation still needs to be worked on. And also, we might change some APIs and features. + +In the examples, please refer to this [examples](https://github.com/kazupon/vue-i18n/tree/dev/examples) directory. + + +## Improvements +- Server-Side Rendering: [example](https://github.com/kazupon/vue-i18n/tree/dev/examples/formatting/custom) +- Custom formatter: [example](https://github.com/kazupon/vue-i18n/tree/dev/examples/ssr) + +## Features +- Formatting support +- Pluralization support +- Locale and KeyPath Syntax support +- Linked translation support +- Fallback translation support +- Component locale support +- Dynamic locale DEPRECATED +- Hot reload support + +## API + +### Global Config +- Vue.config.lang DEPRECATED, use VueI18n constructor `locale` option, or VueI18n#locale +- Vue.config.fallbackLang DEPRECATED, use VueI18n constructor `fallbackLocale` option, or VueI18n#fallbackLocale +- Vue.config.missingHandler DEPRECATED, use VueI18n constructor `missing` option, or VueI18n#missing +- Vue.config.i18nFormatter DEPRECATED, use VueI18n constructor `formatter` option, or VueI18n#formatter + +### Global Method +- Vue.locale DEPRECATED, use VueI18n constructor `messages` option, or VueI18n#messages +- Vue.t DEPRECATED, use VueI18n#t +- Vue.tc DEPRECATED, use VueI18n#tc +- Vue.te DEPRECATED, use VueI18n#te + +### Constructor Options +- locales DEPRECATED, use `messages` of `i18n` option (e.g `{ i18n: { messaes: ... } }`) + +### Instance Properties +- $lang DEPRECATED, use `locale` of Vue instance property `$i18n` (e.g `vm.$i18n.locale = 'en'`) + +### VueI18n class NEW +- constructor options: See the [`I18nOptions` type](https://github.com/kazupon/vue-i18n/blob/dev/decls/i18n.js#L7-L15) of flowtype. +- methods / properties: See the [`I18n` interface definition](https://github.com/kazupon/vue-i18n/blob/dev/decls/i18n.js#L17-L33) of flowtype. + + + +## [5.0.2](https://github.com/kazupon/vue-i18n/compare/v5.0.1...v5.0.2) (2017-02-18) + + +### :zap: Improvements + +* **npm:** revert node >= 6.0 engine restriction ([#110](https://github.com/kazupon/vue-i18n/issues/110)) by [@syxolk](https://github.com/syxolk) ([92b1bd1](https://github.com/kazupon/vue-i18n/commit/92b1bd1)), closes [#109](https://github.com/kazupon/vue-i18n/issues/109) + + + + +## [5.0.1](https://github.com/kazupon/vue-i18n/compare/v5.0.0...v5.0.1) (2017-02-16) + + +### :zap: Improvements + +* **asset:** update locale reactivity setting ([b42fd9a](https://github.com/kazupon/vue-i18n/commit/b42fd9a)) + + + + +# [5.0.0](https://github.com/kazupon/vue-i18n/compare/v4.10.0...v5.0.0) (2017-02-04) + + +### :boom: Breaking changes + +* drop vue 1.0 supporting ([4da26cf](https://github.com/kazupon/vue-i18n/commit/4da26cf)), closes [#105](https://github.com/kazupon/vue-i18n/issues/105) + + + + +# [4.10.0](https://github.com/kazupon/vue-i18n/compare/v4.9.0...v4.10.0) (2017-01-01) + + +### :star: New Features + +* `$lang` property for all component ([#99](https://github.com/kazupon/vue-i18n/issues/99)) by [@albert](https://github.com/albert)-zhang ([5ed69f8](https://github.com/kazupon/vue-i18n/commit/5ed69f8)) + + +### :up: Updates + +* **override:** change langVM keeping variable name ([3ec1bb2](https://github.com/kazupon/vue-i18n/commit/3ec1bb2)) + + + + +# [4.9.0](https://github.com/kazupon/vue-i18n/compare/v4.8.0...v4.9.0) (2016-12-17) + + +### :bug: Bug Fixes + +* **path:** fix nested key translation ([e15ead4](https://github.com/kazupon/vue-i18n/commit/e15ead4)), closes [#97](https://github.com/kazupon/vue-i18n/issues/97) + + +### :star: New Features + +* add globally locale checking ([4cac8b9](https://github.com/kazupon/vue-i18n/commit/4cac8b9)) +* locale checking ([#98](https://github.com/kazupon/vue-i18n/issues/98)) by [@long](https://github.com/long)-long-float ([0bc0a6b](https://github.com/kazupon/vue-i18n/commit/0bc0a6b)) + + + +# [4.8.0](https://github.com/kazupon/vue-i18n/compare/v4.7.4...v4.8.0) (2016-12-08) + + +### :zap: Improvements + +* **extend:** disable no translation warning when set missingHandler ([168a97c](https://github.com/kazupon/vue-i18n/commit/168a97c)), closes [#96](https://github.com/kazupon/vue-i18n/issues/96) + + + + +## [4.7.4](https://github.com/kazupon/vue-i18n/compare/v4.7.3...v4.7.4) (2016-11-29) + + +### :bug: Bug Fixes + +* **extend:** fix interpolate error [@tariq86](https://github.com/tariq86) ([5f24e17](https://github.com/kazupon/vue-i18n/commit/5f24e17)) + + + + +## [4.7.3](https://github.com/kazupon/vue-i18n/compare/v4.7.2...v4.7.3) (2016-11-24) + + +### :bug: Bug Fixes + +* **extend:** fix array local ([35c268a](https://github.com/kazupon/vue-i18n/commit/35c268a)), closes [#91](https://github.com/kazupon/vue-i18n/issues/91) [#59](https://github.com/kazupon/vue-i18n/issues/59) + + + + +## [4.7.2](https://github.com/kazupon/vue-i18n/compare/v4.7.1...v4.7.2) (2016-11-19) + + +### :bug: Bug Fixes + +* **observer:** fix dep undefined error ([#88](https://github.com/kazupon/vue-i18n/issues/88)) by [@fandaa](https://github.com/fandaa) ([724974e](https://github.com/kazupon/vue-i18n/commit/724974e)), closes [#88](https://github.com/kazupon/vue-i18n/issues/88) + + +### :zap: Improvements + +* **extend:** support translate empty string ([#86](https://github.com/kazupon/vue-i18n/issues/86)) by [@QingWei](https://github.com/QingWei)-Li ([8e6d154](https://github.com/kazupon/vue-i18n/commit/8e6d154)) + + + + +## [4.7.1](https://github.com/kazupon/vue-i18n/compare/v4.7.0...v4.7.1) (2016-10-29) + + +### :bug: Bug Fixes + +* **interpolate:** named formatting: use name if value is missing ([#77](https://github.com/kazupon/vue-i18n/issues/77)) by [@SebastianS90](https://github.com/SebastianS90) ([a0cc343](https://github.com/kazupon/vue-i18n/commit/a0cc343)) + + +### :zap: Improvements + +* **named:** using default use nmae when value is missing ([c34e8f1](https://github.com/kazupon/vue-i18n/commit/c34e8f1)) + + + + +# [4.7.0](https://github.com/kazupon/vue-i18n/compare/v4.6.0...v4.7.0) (2016-10-28) + + +### :star: New Features + +* hot reloading ([#71](https://github.com/kazupon/vue-i18n/issues/71)) by [@gglnx](https://github.com/gglnx) ([7bb94ac](https://github.com/kazupon/vue-i18n/commit/7bb94ac)) + + +### :zap: Improvements + +* **pluralization:** zero choice ([#70](https://github.com/kazupon/vue-i18n/issues/70)) by [@sebwas](https://github.com/sebwas) ([5f0004f](https://github.com/kazupon/vue-i18n/commit/5f0004f)) + + + + +# [4.6.0](https://github.com/kazupon/vue-i18n/compare/v4.5.0...v4.6.0) (2016-09-24) + + +### :star: New Features + +* **config:** custom message formatter ([#57](https://github.com/kazupon/vue-i18n/issues/57)) by [@jvmccarthy](https://github.com/jvmccarthy) ([2748eb4](https://github.com/kazupon/vue-i18n/commit/2748eb4)) + + + + +# [4.5.0](https://github.com/kazupon/vue-i18n/compare/v4.4.1...v4.5.0) (2016-09-15) + + +### :star: New Features + +* **config:** translation miss capturing configration ([aca0ed6](https://github.com/kazupon/vue-i18n/commit/aca0ed6)), closes [#54](https://github.com/kazupon/vue-i18n/issues/54) + + + + +## [4.4.1](https://github.com/kazupon/vue-i18n/compare/v4.4.0...v4.4.1) (2016-09-10) + + +### :zap: Improvements + +* **translate:** support hyphenated key ([#52](https://github.com/kazupon/vue-i18n/issues/52)) by [@tariq86](https://github.com/tariq86) ([a40acfd](https://github.com/kazupon/vue-i18n/commit/a40acfd)) + + + + +# [4.4.0](https://github.com/kazupon/vue-i18n/compare/v4.3.1...v4.4.0) (2016-08-29) + + +### :star: New Features + +* add linked translations ([#50](https://github.com/kazupon/vue-i18n/issues/50)) by [@mmochetti](https://github.com/mmochetti) ([f7ae073](https://github.com/kazupon/vue-i18n/commit/f7ae073)) + + + + +## [4.3.1](https://github.com/kazupon/vue-i18n/compare/v4.3.0...v4.3.1) (2016-08-26) + + +### :bug: Bug Fixes + +* **npm:** fix installing bug ([57e66aa](https://github.com/kazupon/vue-i18n/commit/57e66aa)), closes [#46](https://github.com/kazupon/vue-i18n/issues/46) + + + + +# [4.3.0](https://github.com/kazupon/vue-i18n/compare/v4.2.3...v4.3.0) (2016-08-26) + + +### :star: New Features + +* add pluralization ([#44](https://github.com/kazupon/vue-i18n/issues/44)) by [@mmochetti](https://github.com/mmochetti) ([b5b84d8](https://github.com/kazupon/vue-i18n/commit/b5b84d8)) + + + + +## [4.2.3](https://github.com/kazupon/vue-i18n/compare/v4.2.2...v4.2.3) (2016-08-23) + + +### :chart_with_upwards_trend: Performance Fixes + +* improve re-rendering cost when change the lang ([0707338](https://github.com/kazupon/vue-i18n/commit/0707338)) + + + + +## [4.2.2](https://github.com/kazupon/vue-i18n/compare/v4.2.1...v4.2.2) (2016-08-15) + + +### :bug: Bug Fixes + +* **path:** fix array path syntax error ([bc9dbee](https://github.com/kazupon/vue-i18n/commit/bc9dbee)), closes [#42](https://github.com/kazupon/vue-i18n/issues/42) [#43](https://github.com/kazupon/vue-i18n/issues/43) + + + + +## [4.2.1](https://github.com/kazupon/vue-i18n/compare/v4.2.0...v4.2.1) (2016-08-13) + + +### :zap: Improvements + +* **translate:** fallback translation warning ([5f6b271](https://github.com/kazupon/vue-i18n/commit/5f6b271)) + + + + +# [4.2.0](https://github.com/kazupon/vue-i18n/compare/v4.1.0...v4.2.0) (2016-08-12) + + +### :chart_with_upwards_trend: Performance Fixes + +* **format:** use hasOwn function of Vue.util ([a8a19a0](https://github.com/kazupon/vue-i18n/commit/a8a19a0)) + + +### :star: New Features + +* **fallback:** add fallback translation feature ([1d1f0f2](https://github.com/kazupon/vue-i18n/commit/1d1f0f2)), closes [#36](https://github.com/kazupon/vue-i18n/issues/36) + + + + +# [4.1.0](https://github.com/kazupon/vue-i18n/compare/v4.0.1...v4.1.0) (2016-07-25) + + +### :bug: Bug Fixes + +* **util:** fixed isArray reference errors ([0c6f6a0](https://github.com/kazupon/vue-i18n/commit/0c6f6a0)) + + +### :star: New Features + +* support vue 2.0.0.beta later ([0e1d2f7](https://github.com/kazupon/vue-i18n/commit/0e1d2f7)) + + + + +## [4.0.1](https://github.com/kazupon/vue-i18n/compare/v4.0.0...v4.0.1) (2016-06-06) + + +### :bug: Bug Fixes + +* **translate:** fix underscore named argument translate issue ([eeaf936](https://github.com/kazupon/vue-i18n/commit/eeaf936)) + + + + +# [4.0.0](https://github.com/kazupon/vue-i18n/compare/v3.1.1...v4.0.0) (2016-05-10) + + +### :zap: Improvements + +* support vue 2.0-pre-alpha ([f6517bc](https://github.com/kazupon/vue-i18n/commit/f6517bc)) + + + + +## [3.1.1](https://github.com/kazupon/vue-i18n/compare/v3.1.0...v3.1.1) (2016-05-09) + + +### :star: New Features + +* auto installation for standalone ([2b0dc09](https://github.com/kazupon/vue-i18n/commit/2b0dc09)) + + + + +# [3.1.0](https://github.com/kazupon/vue-i18n/compare/v3.0.0...v3.1.0) (2016-05-09) + + +### :star: New Features + +* component locales ([12fe695](https://github.com/kazupon/vue-i18n/commit/12fe695)), closes [#29](https://github.com/kazupon/vue-i18n/issues/29) + + +### :warning: Depcreted + +* **options:** remove Vue.use options ([d87b59b](https://github.com/kazupon/vue-i18n/commit/d87b59b)) + + +### :zap: Improvements + +* **keypath:** port the object path parser ([3ae04b7](https://github.com/kazupon/vue-i18n/commit/3ae04b7)) +* **translation:** fix hypenate included key translating ([d0a415f](https://github.com/kazupon/vue-i18n/commit/d0a415f)), closes [#24](https://github.com/kazupon/vue-i18n/issues/24) +* **translation:** warning outputing when cannot translate with keypath ([b4c7c0e](https://github.com/kazupon/vue-i18n/commit/b4c7c0e)), closes [#22](https://github.com/kazupon/vue-i18n/issues/22) + + + + +# [3.0.0](https://github.com/kazupon/vue-i18n/compare/v2.4.1...v3.0.0) (2016-04-18) + + +### Features + +* **lang:** support lang reactive changing ([203ee85](https://github.com/kazupon/vue-i18n/commit/203ee85)), closes [#2](https://github.com/kazupon/vue-i18n/issues/2) [#15](https://github.com/kazupon/vue-i18n/issues/15) +* **locale:** support dynamic local ([4d61e8d](https://github.com/kazupon/vue-i18n/commit/4d61e8d)), closes [#6](https://github.com/kazupon/vue-i18n/issues/6) [#21](https://github.com/kazupon/vue-i18n/issues/21) + +### DEPRECATED + +* **index:** plugin install `Vue.use` options (`options.locales`, `options.lang`). See [README](https://github.com/kazupon/vue-i18n/blob/dev/README.md) + + + +## [2.4.1](https://github.com/kazupon/vue-i18n/compare/v2.4.0...v2.4.1) (2016-02-29) + +### Features + +* **i18n:** support ruby on rails i18n interpolation format ([b6b2490](https://github.com/kazupon/vue-i18n/commit/b6b2490)) + + + + +# [2.4.0](https://github.com/kazupon/vue-i18n/compare/v2.3.3...v2.4.0) (2016-02-06) + + +### Features + +* **i18n:** add Vue.t function ([68935e3](https://github.com/kazupon/vue-i18n/commit/68935e3)), closes [#17](https://github.com/kazupon/vue-i18n/issues/17) + + + + +## [2.3.3](https://github.com/kazupon/vue-i18n/compare/v2.3.2...v2.3.3) (2015-12-09) + + +### Bug Fixes + +* **npm:** npm install error ([e31e89e](https://github.com/kazupon/vue-i18n/commit/e31e89e)) + +### Features + +* **bower:** good-bye bower :wink: ([d99eb15](https://github.com/kazupon/vue-i18n/commit/d99eb15)) + + +### BREAKING CHANGES + +* bower: not support `bower` package manager + +I think that bower is dead. :no_good: + + + + +## [2.3.2](https://github.com/kazupon/vue-i18n/compare/v2.3.1...v2.3.2) (2015-12-09) + + +### Features + +* **bundle:** more compact the vue-i18n distribution file ([2f32ecc](https://github.com/kazupon/vue-i18n/commit/2f32ecc)) + + + + +## [2.3.1](https://github.com/kazupon/vue-i18n/compare/v2.3.0...v2.3.1) (2015-12-01) + +### Reverts + +* **index:** automatically install for standalone ([25b8059](https://github.com/kazupon/vue-i18n/commit/25b8059)) + + + + +# [2.3.0](https://github.com/kazupon/vue-i18n/compare/v2.2.0...v2.3.0) (2015-11-26) + + +### Bug Fixes + +* **index:** cannot work at Vue 1.0.10 later ([6fd543e](https://github.com/kazupon/vue-i18n/commit/6fd543e)), closes [#9](https://github.com/kazupon/vue-i18n/issues/9) + +### Features + +* **index:** support automatically install for standalone ([ada2673](https://github.com/kazupon/vue-i18n/commit/ada2673)) + + + +# v2.2.0 / 2015-09-16 + +* Re-implemetation with ES6 (babel) + +# v2.1.0 / 2015-07-03 + +* Add global local language setting with `Vue.config.lang` + +# v2.0.0 / 2015-06-29 + +* Support Vue.js 0.12 +* Remove the followings (Breaking Changes) + * `Vue.t` function + * `v-t` directive + +# v1.1.1 / 2015-04-21 + +* Fix unit test error + +# v1.1.0 / 2015-01-10 + +* Support template string in `$t` method +* Support language changing in `$t` method + +# v1.0.0 / 2015-01-10 + +* Add `$t` method + +# v0.11.0 / 2014-11-07 + +* Bump to 0.11.0 + +# v0.2.0 / 2014-10-08 + +* Support Vue.js 0.11.0-rc + +# v0.1.2 / 2014-10-07 + +* Support bower + +# v0.1.1 / 2014-10-06 + +* Add `Vue.t` function + +# v0.1.0 / 2014-05-06 + +* Release first + +# v0.0.0 / 2014-05-03 + +* Initial project diff --git a/node_modules/vue-i18n/LICENSE b/node_modules/vue-i18n/LICENSE new file mode 100644 index 0000000..398540b --- /dev/null +++ b/node_modules/vue-i18n/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2016 kazuya kawaguchi + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/vue-i18n/README.md b/node_modules/vue-i18n/README.md new file mode 100644 index 0000000..cbc79b7 --- /dev/null +++ b/node_modules/vue-i18n/README.md @@ -0,0 +1,73 @@ +

Vue I18n logo

+

vue-i18n

+

+ Build Status + Coverage Status + NPM version + vue-i18n channel on Discord + vue-i18n Dev Token +

+ +

Internationalization plugin for Vue.js

+ +
+ +

Silver Sponsors

+ +

+ + + +

+ +

Bronze Sponsors

+ +

+ + + +

+ +
+ +

+ + Become a Patreon + +

+ +
+ +## :loudspeaker: Notice + +vue-i18n will soon be transferred to [intlify organization](https://github.com/intlify). After that, it will be developed and maintained on intlify. + +The `vue-i18n` that has been released on npm will be released as `@intlify/vue-i18n` in near future. + +`@intlify/vue-i18n` repo is [here](https://github.com/intlify/vue-i18n-next) + +Intlify is a new i18n project kickoff by @kazupon. 😉 + +## :book: Documentation + +See [here](http://kazupon.github.io/vue-i18n/) + + +## :scroll: Changelog + +Detailed changes for each release are documented in the [CHANGELOG.md](https://github.com/kazupon/vue-i18n/blob/dev/CHANGELOG.md). + + +## :exclamation: Issues + +Please make sure to read the [Issue Reporting Checklist](https://github.com/kazupon/vue-i18n/blob/dev/CONTRIBUTING.md#issue-reporting-guidelines) before opening an issue. Issues not conforming to the guidelines may be closed immediately. + + +## :muscle: Contribution + +Please make sure to read the [Contributing Guide](https://github.com/kazupon/vue-i18n/blob/dev/CONTRIBUTING.md) before making a pull request. + + +## :copyright: License + +[MIT](http://opensource.org/licenses/MIT) diff --git a/node_modules/vue-i18n/decls/i18n.js b/node_modules/vue-i18n/decls/i18n.js new file mode 100644 index 0000000..d89ba9a --- /dev/null +++ b/node_modules/vue-i18n/decls/i18n.js @@ -0,0 +1,155 @@ +declare var Intl: any; + +declare type Path = string; +declare type Locale = string; +declare type FallbackLocale = string | string[] | false | { [locale: string]: string[] }; +declare type LocaleMessage = string | LocaleMessageObject | LocaleMessageArray; +declare type LocaleMessageObject = { [key: Path]: LocaleMessage }; +declare type LocaleMessageArray = Array; +declare type LocaleMessages = { [key: Locale]: LocaleMessageObject }; + +// This options is the same as Intl.DateTimeFormat constructor options: +// http://www.ecma-international.org/ecma-402/2.0/#sec-intl-datetimeformat-constructor +declare type DateTimeFormatOptions = { + year?: 'numeric' | '2-digit', + month?: 'numeric' | '2-digit' | 'narrow' | 'short' | 'long', + day?: 'numeric' | '2-digit', + hour?: 'numeric' | '2-digit', + minute?: 'numeric' | '2-digit', + second?: 'numeric' | '2-digit', + weekday?: 'narrow' | 'short' | 'long', + hour12?: boolean, + era?: 'narrow' | 'short' | 'long', + timeZone?: string, // IANA time zone + timeZoneName?: 'short' | 'long', + localeMatcher?: 'lookup' | 'best fit', + formatMatcher?: 'basic' | 'best fit' +}; +declare type DateTimeFormat = { [key: string]: DateTimeFormatOptions }; +declare type DateTimeFormats = { [key: Locale]: DateTimeFormat }; + +// This options is the same as Intl.NumberFormat constructor options: +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat +declare type NumberFormatOptions = { + style?: 'decimal' | 'currency' | 'percent', + currency?: string, // ISO 4217 currency codes + currencyDisplay?: 'symbol' | 'code' | 'name', + useGrouping?: boolean, + minimumIntegerDigits?: number, + minimumFractionDigits?: number, + maximumFractionDigits?: number, + minimumSignificantDigits?: number, + maximumSignificantDigits?: number, + localeMatcher?: 'lookup' | 'best fit', + formatMatcher?: 'basic' | 'best fit' +}; +declare type NumberFormat = { [key: string]: NumberFormatOptions }; +declare type NumberFormats = { [key: Locale]: NumberFormat }; +declare type Modifiers = { [key: string]: (str: string) => string }; + +declare type TranslateResult = string | LocaleMessages; +declare type DateTimeFormatResult = string; +declare type NumberFormatResult = string; +declare type MissingHandler = (locale: Locale, key: Path, vm?: any) => string | void; +declare type PostTranslationHandler = (str: string, key?: string) => string; +declare type GetChoiceIndex = (choice: number, choicesLength: number) => number +declare type ComponentInstanceCreatedListener = (newI18n: I18n, rootI18n: I18n) => void; + +declare type FormattedNumberPartType = 'currency' | 'decimal' | 'fraction' | 'group' | 'infinity' | 'integer' | 'literal' | 'minusSign' | 'nan' | 'plusSign' | 'percentSign'; +declare type FormattedNumberPart = { + type: FormattedNumberPartType, + value: string, +}; +// This array is the same as Intl.NumberFormat.formatToParts() return value: +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat/formatToParts#Return_value +declare type NumberFormatToPartsResult = Array; + +declare type WarnHtmlInMessageLevel = 'off' | 'warn' | 'error'; + +declare type I18nOptions = { + locale?: Locale, + fallbackLocale?: FallbackLocale, + messages?: LocaleMessages, + dateTimeFormats?: DateTimeFormats, + numberFormats?: NumberFormats, + formatter?: Formatter, + missing?: MissingHandler, + modifiers?: Modifiers, + root?: I18n, // for internal + fallbackRoot?: boolean, + formatFallbackMessages?: boolean, + sync?: boolean, + silentTranslationWarn?: boolean | RegExp, + silentFallbackWarn?: boolean | RegExp, + pluralizationRules?: PluralizationRules, + preserveDirectiveContent?: boolean, + warnHtmlInMessage?: WarnHtmlInMessageLevel, + sharedMessages?: LocaleMessage, + postTranslation?: PostTranslationHandler, + componentInstanceCreatedListener?: ComponentInstanceCreatedListener, +}; + +declare type IntlAvailability = { + dateTimeFormat: boolean, + numberFormat: boolean +}; + +declare type PluralizationRules = { + [lang: string]: GetChoiceIndex, +} + +declare interface I18n { + static install: () => void, // for Vue plugin interface + static version: string, + static availabilities: IntlAvailability, + get vm (): any, // for internal + get locale (): Locale, + set locale (locale: Locale): void, + get fallbackLocale (): FallbackLocale, + set fallbackLocale (locale: FallbackLocale): void, + get messages (): LocaleMessages, + get dateTimeFormats (): DateTimeFormats, + get numberFormats (): NumberFormats, + get availableLocales (): Locale[], + get missing (): ?MissingHandler, + set missing (handler: MissingHandler): void, + get formatter (): Formatter, + set formatter (formatter: Formatter): void, + get formatFallbackMessages (): boolean, + set formatFallbackMessages (fallback: boolean): void, + get silentTranslationWarn (): boolean | RegExp, + set silentTranslationWarn (silent: boolean | RegExp): void, + get silentFallbackWarn (): boolean | RegExp, + set silentFallbackWarn (slient: boolean | RegExp): void, + get pluralizationRules (): PluralizationRules, + set pluralizationRules (rules: PluralizationRules): void, + get preserveDirectiveContent (): boolean, + set preserveDirectiveContent (preserve: boolean): void, + get warnHtmlInMessage (): WarnHtmlInMessageLevel, + set warnHtmlInMessage (level: WarnHtmlInMessageLevel): void, + get postTranslation (): ?PostTranslationHandler, + set postTranslation (handler: PostTranslationHandler): void, + + getLocaleMessage (locale: Locale): LocaleMessageObject, + setLocaleMessage (locale: Locale, message: LocaleMessageObject): void, + mergeLocaleMessage (locale: Locale, message: LocaleMessageObject): void, + t (key: Path, ...values: any): TranslateResult, + i (key: Path, locale: Locale, values: Object): TranslateResult, + tc (key: Path, choice?: number, ...values: any): TranslateResult, + te (key: Path, locale?: Locale): boolean, + getDateTimeFormat (locale: Locale): DateTimeFormat, + setDateTimeFormat (locale: Locale, format: DateTimeFormat): void, + mergeDateTimeFormat (locale: Locale, format: DateTimeFormat): void, + d (value: number | Date, ...args: any): DateTimeFormatResult, + getNumberFormat (locale: Locale): NumberFormat, + setNumberFormat (locale: Locale, format: NumberFormat): void, + mergeNumberFormat (locale: Locale, format: NumberFormat): void, + n (value: number, ...args: any): NumberFormatResult, + getChoiceIndex: GetChoiceIndex, + pluralizationRules: PluralizationRules, + preserveDirectiveContent: boolean +}; + +declare interface Formatter { + interpolate (message: string, values: any, path: string): (Array | null) +}; diff --git a/node_modules/vue-i18n/decls/module.js b/node_modules/vue-i18n/decls/module.js new file mode 100644 index 0000000..da1873d --- /dev/null +++ b/node_modules/vue-i18n/decls/module.js @@ -0,0 +1,30 @@ +declare type $npm$Vue$Dictionaly = { [key: string]: T } + +declare type Util = { + extend: (to: Object, from: ?Object) => Object, + hasOwn: (obj: Object, key: string) => boolean, + isPlainObject: (obj: any) => boolean, + isObject: (obj: mixed) => boolean, +} + +declare type Config = { + optionMergeStrategies: $npm$Vue$Dictionaly, + silent: boolean, + productionTip: boolean, + performance: boolean, + devtools: boolean, + errorHandler: ?(err: Error, vm: Vue, info: string) => void, + ignoredElements: Array, + keyCodes: $npm$Vue$Dictionaly, + isReservedTag: (x?: string) => boolean, + parsePlatformTagName: (x: string) => string, + isUnknownElement: (x?: string) => boolean, + getTagNamespace: (x?: string) => string | void, + mustUseProp: (tag: string, type: ?string, name: string) => boolean, +} + +declare interface Vue { + static config: Config, + static util: Util, + static version: string, +} diff --git a/node_modules/vue-i18n/dist/vue-i18n.common.js b/node_modules/vue-i18n/dist/vue-i18n.common.js new file mode 100644 index 0000000..48e2000 --- /dev/null +++ b/node_modules/vue-i18n/dist/vue-i18n.common.js @@ -0,0 +1,2132 @@ +/*! + * vue-i18n v8.20.0 + * (c) 2020 kazuya kawaguchi + * Released under the MIT License. + */ +'use strict'; + +/* */ + +/** + * constants + */ + +var numberFormatKeys = [ + 'style', + 'currency', + 'currencyDisplay', + 'useGrouping', + 'minimumIntegerDigits', + 'minimumFractionDigits', + 'maximumFractionDigits', + 'minimumSignificantDigits', + 'maximumSignificantDigits', + 'localeMatcher', + 'formatMatcher', + 'unit' +]; + +/** + * utilities + */ + +function warn (msg, err) { + if (typeof console !== 'undefined') { + console.warn('[vue-i18n] ' + msg); + /* istanbul ignore if */ + if (err) { + console.warn(err.stack); + } + } +} + +function error (msg, err) { + if (typeof console !== 'undefined') { + console.error('[vue-i18n] ' + msg); + /* istanbul ignore if */ + if (err) { + console.error(err.stack); + } + } +} + +var isArray = Array.isArray; + +function isObject (obj) { + return obj !== null && typeof obj === 'object' +} + +function isBoolean (val) { + return typeof val === 'boolean' +} + +function isString (val) { + return typeof val === 'string' +} + +var toString = Object.prototype.toString; +var OBJECT_STRING = '[object Object]'; +function isPlainObject (obj) { + return toString.call(obj) === OBJECT_STRING +} + +function isNull (val) { + return val === null || val === undefined +} + +function parseArgs () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + var locale = null; + var params = null; + if (args.length === 1) { + if (isObject(args[0]) || Array.isArray(args[0])) { + params = args[0]; + } else if (typeof args[0] === 'string') { + locale = args[0]; + } + } else if (args.length === 2) { + if (typeof args[0] === 'string') { + locale = args[0]; + } + /* istanbul ignore if */ + if (isObject(args[1]) || Array.isArray(args[1])) { + params = args[1]; + } + } + + return { locale: locale, params: params } +} + +function looseClone (obj) { + return JSON.parse(JSON.stringify(obj)) +} + +function remove (arr, item) { + if (arr.length) { + var index = arr.indexOf(item); + if (index > -1) { + return arr.splice(index, 1) + } + } +} + +function includes (arr, item) { + return !!~arr.indexOf(item) +} + +var hasOwnProperty = Object.prototype.hasOwnProperty; +function hasOwn (obj, key) { + return hasOwnProperty.call(obj, key) +} + +function merge (target) { + var arguments$1 = arguments; + + var output = Object(target); + for (var i = 1; i < arguments.length; i++) { + var source = arguments$1[i]; + if (source !== undefined && source !== null) { + var key = (void 0); + for (key in source) { + if (hasOwn(source, key)) { + if (isObject(source[key])) { + output[key] = merge(output[key], source[key]); + } else { + output[key] = source[key]; + } + } + } + } + } + return output +} + +function looseEqual (a, b) { + if (a === b) { return true } + var isObjectA = isObject(a); + var isObjectB = isObject(b); + if (isObjectA && isObjectB) { + try { + var isArrayA = Array.isArray(a); + var isArrayB = Array.isArray(b); + if (isArrayA && isArrayB) { + return a.length === b.length && a.every(function (e, i) { + return looseEqual(e, b[i]) + }) + } else if (!isArrayA && !isArrayB) { + var keysA = Object.keys(a); + var keysB = Object.keys(b); + return keysA.length === keysB.length && keysA.every(function (key) { + return looseEqual(a[key], b[key]) + }) + } else { + /* istanbul ignore next */ + return false + } + } catch (e) { + /* istanbul ignore next */ + return false + } + } else if (!isObjectA && !isObjectB) { + return String(a) === String(b) + } else { + return false + } +} + +/* */ + +function extend (Vue) { + if (!Vue.prototype.hasOwnProperty('$i18n')) { + // $FlowFixMe + Object.defineProperty(Vue.prototype, '$i18n', { + get: function get () { return this._i18n } + }); + } + + Vue.prototype.$t = function (key) { + var values = [], len = arguments.length - 1; + while ( len-- > 0 ) values[ len ] = arguments[ len + 1 ]; + + var i18n = this.$i18n; + return i18n._t.apply(i18n, [ key, i18n.locale, i18n._getMessages(), this ].concat( values )) + }; + + Vue.prototype.$tc = function (key, choice) { + var values = [], len = arguments.length - 2; + while ( len-- > 0 ) values[ len ] = arguments[ len + 2 ]; + + var i18n = this.$i18n; + return i18n._tc.apply(i18n, [ key, i18n.locale, i18n._getMessages(), this, choice ].concat( values )) + }; + + Vue.prototype.$te = function (key, locale) { + var i18n = this.$i18n; + return i18n._te(key, i18n.locale, i18n._getMessages(), locale) + }; + + Vue.prototype.$d = function (value) { + var ref; + + var args = [], len = arguments.length - 1; + while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ]; + return (ref = this.$i18n).d.apply(ref, [ value ].concat( args )) + }; + + Vue.prototype.$n = function (value) { + var ref; + + var args = [], len = arguments.length - 1; + while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ]; + return (ref = this.$i18n).n.apply(ref, [ value ].concat( args )) + }; +} + +/* */ + +var mixin = { + beforeCreate: function beforeCreate () { + var options = this.$options; + options.i18n = options.i18n || (options.__i18n ? {} : null); + + if (options.i18n) { + if (options.i18n instanceof VueI18n) { + // init locale messages via custom blocks + if (options.__i18n) { + try { + var localeMessages = {}; + options.__i18n.forEach(function (resource) { + localeMessages = merge(localeMessages, JSON.parse(resource)); + }); + Object.keys(localeMessages).forEach(function (locale) { + options.i18n.mergeLocaleMessage(locale, localeMessages[locale]); + }); + } catch (e) { + if (process.env.NODE_ENV !== 'production') { + error("Cannot parse locale messages via custom blocks.", e); + } + } + } + this._i18n = options.i18n; + this._i18nWatcher = this._i18n.watchI18nData(); + } else if (isPlainObject(options.i18n)) { + var rootI18n = this.$root && this.$root.$i18n && this.$root.$i18n instanceof VueI18n + ? this.$root.$i18n + : null; + // component local i18n + if (rootI18n) { + options.i18n.root = this.$root; + options.i18n.formatter = rootI18n.formatter; + options.i18n.fallbackLocale = rootI18n.fallbackLocale; + options.i18n.formatFallbackMessages = rootI18n.formatFallbackMessages; + options.i18n.silentTranslationWarn = rootI18n.silentTranslationWarn; + options.i18n.silentFallbackWarn = rootI18n.silentFallbackWarn; + options.i18n.pluralizationRules = rootI18n.pluralizationRules; + options.i18n.preserveDirectiveContent = rootI18n.preserveDirectiveContent; + } + + // init locale messages via custom blocks + if (options.__i18n) { + try { + var localeMessages$1 = {}; + options.__i18n.forEach(function (resource) { + localeMessages$1 = merge(localeMessages$1, JSON.parse(resource)); + }); + options.i18n.messages = localeMessages$1; + } catch (e) { + if (process.env.NODE_ENV !== 'production') { + warn("Cannot parse locale messages via custom blocks.", e); + } + } + } + + var ref = options.i18n; + var sharedMessages = ref.sharedMessages; + if (sharedMessages && isPlainObject(sharedMessages)) { + options.i18n.messages = merge(options.i18n.messages, sharedMessages); + } + + this._i18n = new VueI18n(options.i18n); + this._i18nWatcher = this._i18n.watchI18nData(); + + if (options.i18n.sync === undefined || !!options.i18n.sync) { + this._localeWatcher = this.$i18n.watchLocale(); + } + + if (rootI18n) { + rootI18n.onComponentInstanceCreated(this._i18n); + } + } else { + if (process.env.NODE_ENV !== 'production') { + warn("Cannot be interpreted 'i18n' option."); + } + } + } else if (this.$root && this.$root.$i18n && this.$root.$i18n instanceof VueI18n) { + // root i18n + this._i18n = this.$root.$i18n; + } else if (options.parent && options.parent.$i18n && options.parent.$i18n instanceof VueI18n) { + // parent i18n + this._i18n = options.parent.$i18n; + } + }, + + beforeMount: function beforeMount () { + var options = this.$options; + options.i18n = options.i18n || (options.__i18n ? {} : null); + + if (options.i18n) { + if (options.i18n instanceof VueI18n) { + // init locale messages via custom blocks + this._i18n.subscribeDataChanging(this); + this._subscribing = true; + } else if (isPlainObject(options.i18n)) { + this._i18n.subscribeDataChanging(this); + this._subscribing = true; + } else { + if (process.env.NODE_ENV !== 'production') { + warn("Cannot be interpreted 'i18n' option."); + } + } + } else if (this.$root && this.$root.$i18n && this.$root.$i18n instanceof VueI18n) { + this._i18n.subscribeDataChanging(this); + this._subscribing = true; + } else if (options.parent && options.parent.$i18n && options.parent.$i18n instanceof VueI18n) { + this._i18n.subscribeDataChanging(this); + this._subscribing = true; + } + }, + + beforeDestroy: function beforeDestroy () { + if (!this._i18n) { return } + + var self = this; + this.$nextTick(function () { + if (self._subscribing) { + self._i18n.unsubscribeDataChanging(self); + delete self._subscribing; + } + + if (self._i18nWatcher) { + self._i18nWatcher(); + self._i18n.destroyVM(); + delete self._i18nWatcher; + } + + if (self._localeWatcher) { + self._localeWatcher(); + delete self._localeWatcher; + } + }); + } +}; + +/* */ + +var interpolationComponent = { + name: 'i18n', + functional: true, + props: { + tag: { + type: [String, Boolean, Object], + default: 'span' + }, + path: { + type: String, + required: true + }, + locale: { + type: String + }, + places: { + type: [Array, Object] + } + }, + render: function render (h, ref) { + var data = ref.data; + var parent = ref.parent; + var props = ref.props; + var slots = ref.slots; + + var $i18n = parent.$i18n; + if (!$i18n) { + if (process.env.NODE_ENV !== 'production') { + warn('Cannot find VueI18n instance!'); + } + return + } + + var path = props.path; + var locale = props.locale; + var places = props.places; + var params = slots(); + var children = $i18n.i( + path, + locale, + onlyHasDefaultPlace(params) || places + ? useLegacyPlaces(params.default, places) + : params + ); + + var tag = (!!props.tag && props.tag !== true) || props.tag === false ? props.tag : 'span'; + return tag ? h(tag, data, children) : children + } +}; + +function onlyHasDefaultPlace (params) { + var prop; + for (prop in params) { + if (prop !== 'default') { return false } + } + return Boolean(prop) +} + +function useLegacyPlaces (children, places) { + var params = places ? createParamsFromPlaces(places) : {}; + + if (!children) { return params } + + // Filter empty text nodes + children = children.filter(function (child) { + return child.tag || child.text.trim() !== '' + }); + + var everyPlace = children.every(vnodeHasPlaceAttribute); + if (process.env.NODE_ENV !== 'production' && everyPlace) { + warn('`place` attribute is deprecated in next major version. Please switch to Vue slots.'); + } + + return children.reduce( + everyPlace ? assignChildPlace : assignChildIndex, + params + ) +} + +function createParamsFromPlaces (places) { + if (process.env.NODE_ENV !== 'production') { + warn('`places` prop is deprecated in next major version. Please switch to Vue slots.'); + } + + return Array.isArray(places) + ? places.reduce(assignChildIndex, {}) + : Object.assign({}, places) +} + +function assignChildPlace (params, child) { + if (child.data && child.data.attrs && child.data.attrs.place) { + params[child.data.attrs.place] = child; + } + return params +} + +function assignChildIndex (params, child, index) { + params[index] = child; + return params +} + +function vnodeHasPlaceAttribute (vnode) { + return Boolean(vnode.data && vnode.data.attrs && vnode.data.attrs.place) +} + +/* */ + +var numberComponent = { + name: 'i18n-n', + functional: true, + props: { + tag: { + type: [String, Boolean, Object], + default: 'span' + }, + value: { + type: Number, + required: true + }, + format: { + type: [String, Object] + }, + locale: { + type: String + } + }, + render: function render (h, ref) { + var props = ref.props; + var parent = ref.parent; + var data = ref.data; + + var i18n = parent.$i18n; + + if (!i18n) { + if (process.env.NODE_ENV !== 'production') { + warn('Cannot find VueI18n instance!'); + } + return null + } + + var key = null; + var options = null; + + if (isString(props.format)) { + key = props.format; + } else if (isObject(props.format)) { + if (props.format.key) { + key = props.format.key; + } + + // Filter out number format options only + options = Object.keys(props.format).reduce(function (acc, prop) { + var obj; + + if (includes(numberFormatKeys, prop)) { + return Object.assign({}, acc, ( obj = {}, obj[prop] = props.format[prop], obj )) + } + return acc + }, null); + } + + var locale = props.locale || i18n.locale; + var parts = i18n._ntp(props.value, locale, key, options); + + var values = parts.map(function (part, index) { + var obj; + + var slot = data.scopedSlots && data.scopedSlots[part.type]; + return slot ? slot(( obj = {}, obj[part.type] = part.value, obj.index = index, obj.parts = parts, obj )) : part.value + }); + + var tag = (!!props.tag && props.tag !== true) || props.tag === false ? props.tag : 'span'; + return tag + ? h(tag, { + attrs: data.attrs, + 'class': data['class'], + staticClass: data.staticClass + }, values) + : values + } +}; + +/* */ + +function bind (el, binding, vnode) { + if (!assert(el, vnode)) { return } + + t(el, binding, vnode); +} + +function update (el, binding, vnode, oldVNode) { + if (!assert(el, vnode)) { return } + + var i18n = vnode.context.$i18n; + if (localeEqual(el, vnode) && + (looseEqual(binding.value, binding.oldValue) && + looseEqual(el._localeMessage, i18n.getLocaleMessage(i18n.locale)))) { return } + + t(el, binding, vnode); +} + +function unbind (el, binding, vnode, oldVNode) { + var vm = vnode.context; + if (!vm) { + warn('Vue instance does not exists in VNode context'); + return + } + + var i18n = vnode.context.$i18n || {}; + if (!binding.modifiers.preserve && !i18n.preserveDirectiveContent) { + el.textContent = ''; + } + el._vt = undefined; + delete el['_vt']; + el._locale = undefined; + delete el['_locale']; + el._localeMessage = undefined; + delete el['_localeMessage']; +} + +function assert (el, vnode) { + var vm = vnode.context; + if (!vm) { + warn('Vue instance does not exists in VNode context'); + return false + } + + if (!vm.$i18n) { + warn('VueI18n instance does not exists in Vue instance'); + return false + } + + return true +} + +function localeEqual (el, vnode) { + var vm = vnode.context; + return el._locale === vm.$i18n.locale +} + +function t (el, binding, vnode) { + var ref$1, ref$2; + + var value = binding.value; + + var ref = parseValue(value); + var path = ref.path; + var locale = ref.locale; + var args = ref.args; + var choice = ref.choice; + if (!path && !locale && !args) { + warn('value type not supported'); + return + } + + if (!path) { + warn('`path` is required in v-t directive'); + return + } + + var vm = vnode.context; + if (choice != null) { + el._vt = el.textContent = (ref$1 = vm.$i18n).tc.apply(ref$1, [ path, choice ].concat( makeParams(locale, args) )); + } else { + el._vt = el.textContent = (ref$2 = vm.$i18n).t.apply(ref$2, [ path ].concat( makeParams(locale, args) )); + } + el._locale = vm.$i18n.locale; + el._localeMessage = vm.$i18n.getLocaleMessage(vm.$i18n.locale); +} + +function parseValue (value) { + var path; + var locale; + var args; + var choice; + + if (isString(value)) { + path = value; + } else if (isPlainObject(value)) { + path = value.path; + locale = value.locale; + args = value.args; + choice = value.choice; + } + + return { path: path, locale: locale, args: args, choice: choice } +} + +function makeParams (locale, args) { + var params = []; + + locale && params.push(locale); + if (args && (Array.isArray(args) || isPlainObject(args))) { + params.push(args); + } + + return params +} + +var Vue; + +function install (_Vue) { + /* istanbul ignore if */ + if (process.env.NODE_ENV !== 'production' && install.installed && _Vue === Vue) { + warn('already installed.'); + return + } + install.installed = true; + + Vue = _Vue; + + var version = (Vue.version && Number(Vue.version.split('.')[0])) || -1; + /* istanbul ignore if */ + if (process.env.NODE_ENV !== 'production' && version < 2) { + warn(("vue-i18n (" + (install.version) + ") need to use Vue 2.0 or later (Vue: " + (Vue.version) + ").")); + return + } + + extend(Vue); + Vue.mixin(mixin); + Vue.directive('t', { bind: bind, update: update, unbind: unbind }); + Vue.component(interpolationComponent.name, interpolationComponent); + Vue.component(numberComponent.name, numberComponent); + + // use simple mergeStrategies to prevent i18n instance lose '__proto__' + var strats = Vue.config.optionMergeStrategies; + strats.i18n = function (parentVal, childVal) { + return childVal === undefined + ? parentVal + : childVal + }; +} + +/* */ + +var BaseFormatter = function BaseFormatter () { + this._caches = Object.create(null); +}; + +BaseFormatter.prototype.interpolate = function interpolate (message, values) { + if (!values) { + return [message] + } + var tokens = this._caches[message]; + if (!tokens) { + tokens = parse(message); + this._caches[message] = tokens; + } + return compile(tokens, values) +}; + + + +var RE_TOKEN_LIST_VALUE = /^(?:\d)+/; +var RE_TOKEN_NAMED_VALUE = /^(?:\w)+/; + +function parse (format) { + var tokens = []; + var position = 0; + + var text = ''; + while (position < format.length) { + var char = format[position++]; + if (char === '{') { + if (text) { + tokens.push({ type: 'text', value: text }); + } + + text = ''; + var sub = ''; + char = format[position++]; + while (char !== undefined && char !== '}') { + sub += char; + char = format[position++]; + } + var isClosed = char === '}'; + + var type = RE_TOKEN_LIST_VALUE.test(sub) + ? 'list' + : isClosed && RE_TOKEN_NAMED_VALUE.test(sub) + ? 'named' + : 'unknown'; + tokens.push({ value: sub, type: type }); + } else if (char === '%') { + // when found rails i18n syntax, skip text capture + if (format[(position)] !== '{') { + text += char; + } + } else { + text += char; + } + } + + text && tokens.push({ type: 'text', value: text }); + + return tokens +} + +function compile (tokens, values) { + var compiled = []; + var index = 0; + + var mode = Array.isArray(values) + ? 'list' + : isObject(values) + ? 'named' + : 'unknown'; + if (mode === 'unknown') { return compiled } + + while (index < tokens.length) { + var token = tokens[index]; + switch (token.type) { + case 'text': + compiled.push(token.value); + break + case 'list': + compiled.push(values[parseInt(token.value, 10)]); + break + case 'named': + if (mode === 'named') { + compiled.push((values)[token.value]); + } else { + if (process.env.NODE_ENV !== 'production') { + warn(("Type of token '" + (token.type) + "' and format of value '" + mode + "' don't match!")); + } + } + break + case 'unknown': + if (process.env.NODE_ENV !== 'production') { + warn("Detect 'unknown' type of token!"); + } + break + } + index++; + } + + return compiled +} + +/* */ + +/** + * Path parser + * - Inspired: + * Vue.js Path parser + */ + +// actions +var APPEND = 0; +var PUSH = 1; +var INC_SUB_PATH_DEPTH = 2; +var PUSH_SUB_PATH = 3; + +// states +var BEFORE_PATH = 0; +var IN_PATH = 1; +var BEFORE_IDENT = 2; +var IN_IDENT = 3; +var IN_SUB_PATH = 4; +var IN_SINGLE_QUOTE = 5; +var IN_DOUBLE_QUOTE = 6; +var AFTER_PATH = 7; +var ERROR = 8; + +var pathStateMachine = []; + +pathStateMachine[BEFORE_PATH] = { + 'ws': [BEFORE_PATH], + 'ident': [IN_IDENT, APPEND], + '[': [IN_SUB_PATH], + 'eof': [AFTER_PATH] +}; + +pathStateMachine[IN_PATH] = { + 'ws': [IN_PATH], + '.': [BEFORE_IDENT], + '[': [IN_SUB_PATH], + 'eof': [AFTER_PATH] +}; + +pathStateMachine[BEFORE_IDENT] = { + 'ws': [BEFORE_IDENT], + 'ident': [IN_IDENT, APPEND], + '0': [IN_IDENT, APPEND], + 'number': [IN_IDENT, APPEND] +}; + +pathStateMachine[IN_IDENT] = { + 'ident': [IN_IDENT, APPEND], + '0': [IN_IDENT, APPEND], + 'number': [IN_IDENT, APPEND], + 'ws': [IN_PATH, PUSH], + '.': [BEFORE_IDENT, PUSH], + '[': [IN_SUB_PATH, PUSH], + 'eof': [AFTER_PATH, PUSH] +}; + +pathStateMachine[IN_SUB_PATH] = { + "'": [IN_SINGLE_QUOTE, APPEND], + '"': [IN_DOUBLE_QUOTE, APPEND], + '[': [IN_SUB_PATH, INC_SUB_PATH_DEPTH], + ']': [IN_PATH, PUSH_SUB_PATH], + 'eof': ERROR, + 'else': [IN_SUB_PATH, APPEND] +}; + +pathStateMachine[IN_SINGLE_QUOTE] = { + "'": [IN_SUB_PATH, APPEND], + 'eof': ERROR, + 'else': [IN_SINGLE_QUOTE, APPEND] +}; + +pathStateMachine[IN_DOUBLE_QUOTE] = { + '"': [IN_SUB_PATH, APPEND], + 'eof': ERROR, + 'else': [IN_DOUBLE_QUOTE, APPEND] +}; + +/** + * Check if an expression is a literal value. + */ + +var literalValueRE = /^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/; +function isLiteral (exp) { + return literalValueRE.test(exp) +} + +/** + * Strip quotes from a string + */ + +function stripQuotes (str) { + var a = str.charCodeAt(0); + var b = str.charCodeAt(str.length - 1); + return a === b && (a === 0x22 || a === 0x27) + ? str.slice(1, -1) + : str +} + +/** + * Determine the type of a character in a keypath. + */ + +function getPathCharType (ch) { + if (ch === undefined || ch === null) { return 'eof' } + + var code = ch.charCodeAt(0); + + switch (code) { + case 0x5B: // [ + case 0x5D: // ] + case 0x2E: // . + case 0x22: // " + case 0x27: // ' + return ch + + case 0x5F: // _ + case 0x24: // $ + case 0x2D: // - + return 'ident' + + case 0x09: // Tab + case 0x0A: // Newline + case 0x0D: // Return + case 0xA0: // No-break space + case 0xFEFF: // Byte Order Mark + case 0x2028: // Line Separator + case 0x2029: // Paragraph Separator + return 'ws' + } + + return 'ident' +} + +/** + * Format a subPath, return its plain form if it is + * a literal string or number. Otherwise prepend the + * dynamic indicator (*). + */ + +function formatSubPath (path) { + var trimmed = path.trim(); + // invalid leading 0 + if (path.charAt(0) === '0' && isNaN(path)) { return false } + + return isLiteral(trimmed) ? stripQuotes(trimmed) : '*' + trimmed +} + +/** + * Parse a string path into an array of segments + */ + +function parse$1 (path) { + var keys = []; + var index = -1; + var mode = BEFORE_PATH; + var subPathDepth = 0; + var c; + var key; + var newChar; + var type; + var transition; + var action; + var typeMap; + var actions = []; + + actions[PUSH] = function () { + if (key !== undefined) { + keys.push(key); + key = undefined; + } + }; + + actions[APPEND] = function () { + if (key === undefined) { + key = newChar; + } else { + key += newChar; + } + }; + + actions[INC_SUB_PATH_DEPTH] = function () { + actions[APPEND](); + subPathDepth++; + }; + + actions[PUSH_SUB_PATH] = function () { + if (subPathDepth > 0) { + subPathDepth--; + mode = IN_SUB_PATH; + actions[APPEND](); + } else { + subPathDepth = 0; + if (key === undefined) { return false } + key = formatSubPath(key); + if (key === false) { + return false + } else { + actions[PUSH](); + } + } + }; + + function maybeUnescapeQuote () { + var nextChar = path[index + 1]; + if ((mode === IN_SINGLE_QUOTE && nextChar === "'") || + (mode === IN_DOUBLE_QUOTE && nextChar === '"')) { + index++; + newChar = '\\' + nextChar; + actions[APPEND](); + return true + } + } + + while (mode !== null) { + index++; + c = path[index]; + + if (c === '\\' && maybeUnescapeQuote()) { + continue + } + + type = getPathCharType(c); + typeMap = pathStateMachine[mode]; + transition = typeMap[type] || typeMap['else'] || ERROR; + + if (transition === ERROR) { + return // parse error + } + + mode = transition[0]; + action = actions[transition[1]]; + if (action) { + newChar = transition[2]; + newChar = newChar === undefined + ? c + : newChar; + if (action() === false) { + return + } + } + + if (mode === AFTER_PATH) { + return keys + } + } +} + + + + + +var I18nPath = function I18nPath () { + this._cache = Object.create(null); +}; + +/** + * External parse that check for a cache hit first + */ +I18nPath.prototype.parsePath = function parsePath (path) { + var hit = this._cache[path]; + if (!hit) { + hit = parse$1(path); + if (hit) { + this._cache[path] = hit; + } + } + return hit || [] +}; + +/** + * Get path value from path string + */ +I18nPath.prototype.getPathValue = function getPathValue (obj, path) { + if (!isObject(obj)) { return null } + + var paths = this.parsePath(path); + if (paths.length === 0) { + return null + } else { + var length = paths.length; + var last = obj; + var i = 0; + while (i < length) { + var value = last[paths[i]]; + if (value === undefined) { + return null + } + last = value; + i++; + } + + return last + } +}; + +/* */ + + + +var htmlTagMatcher = /<\/?[\w\s="/.':;#-\/]+>/; +var linkKeyMatcher = /(?:@(?:\.[a-z]+)?:(?:[\w\-_|.]+|\([\w\-_|.]+\)))/g; +var linkKeyPrefixMatcher = /^@(?:\.([a-z]+))?:/; +var bracketsMatcher = /[()]/g; +var defaultModifiers = { + 'upper': function (str) { return str.toLocaleUpperCase(); }, + 'lower': function (str) { return str.toLocaleLowerCase(); }, + 'capitalize': function (str) { return ("" + (str.charAt(0).toLocaleUpperCase()) + (str.substr(1))); } +}; + +var defaultFormatter = new BaseFormatter(); + +var VueI18n = function VueI18n (options) { + var this$1 = this; + if ( options === void 0 ) options = {}; + + // Auto install if it is not done yet and `window` has `Vue`. + // To allow users to avoid auto-installation in some cases, + // this code should be placed here. See #290 + /* istanbul ignore if */ + if (!Vue && typeof window !== 'undefined' && window.Vue) { + install(window.Vue); + } + + var locale = options.locale || 'en-US'; + var fallbackLocale = options.fallbackLocale === false + ? false + : options.fallbackLocale || 'en-US'; + var messages = options.messages || {}; + var dateTimeFormats = options.dateTimeFormats || {}; + var numberFormats = options.numberFormats || {}; + + this._vm = null; + this._formatter = options.formatter || defaultFormatter; + this._modifiers = options.modifiers || {}; + this._missing = options.missing || null; + this._root = options.root || null; + this._sync = options.sync === undefined ? true : !!options.sync; + this._fallbackRoot = options.fallbackRoot === undefined + ? true + : !!options.fallbackRoot; + this._formatFallbackMessages = options.formatFallbackMessages === undefined + ? false + : !!options.formatFallbackMessages; + this._silentTranslationWarn = options.silentTranslationWarn === undefined + ? false + : options.silentTranslationWarn; + this._silentFallbackWarn = options.silentFallbackWarn === undefined + ? false + : !!options.silentFallbackWarn; + this._dateTimeFormatters = {}; + this._numberFormatters = {}; + this._path = new I18nPath(); + this._dataListeners = []; + this._componentInstanceCreatedListener = options.componentInstanceCreatedListener || null; + this._preserveDirectiveContent = options.preserveDirectiveContent === undefined + ? false + : !!options.preserveDirectiveContent; + this.pluralizationRules = options.pluralizationRules || {}; + this._warnHtmlInMessage = options.warnHtmlInMessage || 'off'; + this._postTranslation = options.postTranslation || null; + + /** + * @param choice {number} a choice index given by the input to $tc: `$tc('path.to.rule', choiceIndex)` + * @param choicesLength {number} an overall amount of available choices + * @returns a final choice index + */ + this.getChoiceIndex = function (choice, choicesLength) { + var thisPrototype = Object.getPrototypeOf(this$1); + if (thisPrototype && thisPrototype.getChoiceIndex) { + var prototypeGetChoiceIndex = (thisPrototype.getChoiceIndex); + return (prototypeGetChoiceIndex).call(this$1, choice, choicesLength) + } + + // Default (old) getChoiceIndex implementation - english-compatible + var defaultImpl = function (_choice, _choicesLength) { + _choice = Math.abs(_choice); + + if (_choicesLength === 2) { + return _choice + ? _choice > 1 + ? 1 + : 0 + : 1 + } + + return _choice ? Math.min(_choice, 2) : 0 + }; + + if (this$1.locale in this$1.pluralizationRules) { + return this$1.pluralizationRules[this$1.locale].apply(this$1, [choice, choicesLength]) + } else { + return defaultImpl(choice, choicesLength) + } + }; + + + this._exist = function (message, key) { + if (!message || !key) { return false } + if (!isNull(this$1._path.getPathValue(message, key))) { return true } + // fallback for flat key + if (message[key]) { return true } + return false + }; + + if (this._warnHtmlInMessage === 'warn' || this._warnHtmlInMessage === 'error') { + Object.keys(messages).forEach(function (locale) { + this$1._checkLocaleMessage(locale, this$1._warnHtmlInMessage, messages[locale]); + }); + } + + this._initVM({ + locale: locale, + fallbackLocale: fallbackLocale, + messages: messages, + dateTimeFormats: dateTimeFormats, + numberFormats: numberFormats + }); +}; + +var prototypeAccessors = { vm: { configurable: true },messages: { configurable: true },dateTimeFormats: { configurable: true },numberFormats: { configurable: true },availableLocales: { configurable: true },locale: { configurable: true },fallbackLocale: { configurable: true },formatFallbackMessages: { configurable: true },missing: { configurable: true },formatter: { configurable: true },silentTranslationWarn: { configurable: true },silentFallbackWarn: { configurable: true },preserveDirectiveContent: { configurable: true },warnHtmlInMessage: { configurable: true },postTranslation: { configurable: true } }; + +VueI18n.prototype._checkLocaleMessage = function _checkLocaleMessage (locale, level, message) { + var paths = []; + + var fn = function (level, locale, message, paths) { + if (isPlainObject(message)) { + Object.keys(message).forEach(function (key) { + var val = message[key]; + if (isPlainObject(val)) { + paths.push(key); + paths.push('.'); + fn(level, locale, val, paths); + paths.pop(); + paths.pop(); + } else { + paths.push(key); + fn(level, locale, val, paths); + paths.pop(); + } + }); + } else if (Array.isArray(message)) { + message.forEach(function (item, index) { + if (isPlainObject(item)) { + paths.push(("[" + index + "]")); + paths.push('.'); + fn(level, locale, item, paths); + paths.pop(); + paths.pop(); + } else { + paths.push(("[" + index + "]")); + fn(level, locale, item, paths); + paths.pop(); + } + }); + } else if (isString(message)) { + var ret = htmlTagMatcher.test(message); + if (ret) { + var msg = "Detected HTML in message '" + message + "' of keypath '" + (paths.join('')) + "' at '" + locale + "'. Consider component interpolation with '' to avoid XSS. See https://bit.ly/2ZqJzkp"; + if (level === 'warn') { + warn(msg); + } else if (level === 'error') { + error(msg); + } + } + } + }; + + fn(level, locale, message, paths); +}; + +VueI18n.prototype._initVM = function _initVM (data) { + var silent = Vue.config.silent; + Vue.config.silent = true; + this._vm = new Vue({ data: data }); + Vue.config.silent = silent; +}; + +VueI18n.prototype.destroyVM = function destroyVM () { + this._vm.$destroy(); +}; + +VueI18n.prototype.subscribeDataChanging = function subscribeDataChanging (vm) { + this._dataListeners.push(vm); +}; + +VueI18n.prototype.unsubscribeDataChanging = function unsubscribeDataChanging (vm) { + remove(this._dataListeners, vm); +}; + +VueI18n.prototype.watchI18nData = function watchI18nData () { + var self = this; + return this._vm.$watch('$data', function () { + var i = self._dataListeners.length; + while (i--) { + Vue.nextTick(function () { + self._dataListeners[i] && self._dataListeners[i].$forceUpdate(); + }); + } + }, { deep: true }) +}; + +VueI18n.prototype.watchLocale = function watchLocale () { + /* istanbul ignore if */ + if (!this._sync || !this._root) { return null } + var target = this._vm; + return this._root.$i18n.vm.$watch('locale', function (val) { + target.$set(target, 'locale', val); + target.$forceUpdate(); + }, { immediate: true }) +}; + +VueI18n.prototype.onComponentInstanceCreated = function onComponentInstanceCreated (newI18n) { + if (this._componentInstanceCreatedListener) { + this._componentInstanceCreatedListener(newI18n, this); + } +}; + +prototypeAccessors.vm.get = function () { return this._vm }; + +prototypeAccessors.messages.get = function () { return looseClone(this._getMessages()) }; +prototypeAccessors.dateTimeFormats.get = function () { return looseClone(this._getDateTimeFormats()) }; +prototypeAccessors.numberFormats.get = function () { return looseClone(this._getNumberFormats()) }; +prototypeAccessors.availableLocales.get = function () { return Object.keys(this.messages).sort() }; + +prototypeAccessors.locale.get = function () { return this._vm.locale }; +prototypeAccessors.locale.set = function (locale) { + this._vm.$set(this._vm, 'locale', locale); +}; + +prototypeAccessors.fallbackLocale.get = function () { return this._vm.fallbackLocale }; +prototypeAccessors.fallbackLocale.set = function (locale) { + this._localeChainCache = {}; + this._vm.$set(this._vm, 'fallbackLocale', locale); +}; + +prototypeAccessors.formatFallbackMessages.get = function () { return this._formatFallbackMessages }; +prototypeAccessors.formatFallbackMessages.set = function (fallback) { this._formatFallbackMessages = fallback; }; + +prototypeAccessors.missing.get = function () { return this._missing }; +prototypeAccessors.missing.set = function (handler) { this._missing = handler; }; + +prototypeAccessors.formatter.get = function () { return this._formatter }; +prototypeAccessors.formatter.set = function (formatter) { this._formatter = formatter; }; + +prototypeAccessors.silentTranslationWarn.get = function () { return this._silentTranslationWarn }; +prototypeAccessors.silentTranslationWarn.set = function (silent) { this._silentTranslationWarn = silent; }; + +prototypeAccessors.silentFallbackWarn.get = function () { return this._silentFallbackWarn }; +prototypeAccessors.silentFallbackWarn.set = function (silent) { this._silentFallbackWarn = silent; }; + +prototypeAccessors.preserveDirectiveContent.get = function () { return this._preserveDirectiveContent }; +prototypeAccessors.preserveDirectiveContent.set = function (preserve) { this._preserveDirectiveContent = preserve; }; + +prototypeAccessors.warnHtmlInMessage.get = function () { return this._warnHtmlInMessage }; +prototypeAccessors.warnHtmlInMessage.set = function (level) { + var this$1 = this; + + var orgLevel = this._warnHtmlInMessage; + this._warnHtmlInMessage = level; + if (orgLevel !== level && (level === 'warn' || level === 'error')) { + var messages = this._getMessages(); + Object.keys(messages).forEach(function (locale) { + this$1._checkLocaleMessage(locale, this$1._warnHtmlInMessage, messages[locale]); + }); + } +}; + +prototypeAccessors.postTranslation.get = function () { return this._postTranslation }; +prototypeAccessors.postTranslation.set = function (handler) { this._postTranslation = handler; }; + +VueI18n.prototype._getMessages = function _getMessages () { return this._vm.messages }; +VueI18n.prototype._getDateTimeFormats = function _getDateTimeFormats () { return this._vm.dateTimeFormats }; +VueI18n.prototype._getNumberFormats = function _getNumberFormats () { return this._vm.numberFormats }; + +VueI18n.prototype._warnDefault = function _warnDefault (locale, key, result, vm, values, interpolateMode) { + if (!isNull(result)) { return result } + if (this._missing) { + var missingRet = this._missing.apply(null, [locale, key, vm, values]); + if (isString(missingRet)) { + return missingRet + } + } else { + if (process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key)) { + warn( + "Cannot translate the value of keypath '" + key + "'. " + + 'Use the value of keypath as default.' + ); + } + } + + if (this._formatFallbackMessages) { + var parsedArgs = parseArgs.apply(void 0, values); + return this._render(key, interpolateMode, parsedArgs.params, key) + } else { + return key + } +}; + +VueI18n.prototype._isFallbackRoot = function _isFallbackRoot (val) { + return !val && !isNull(this._root) && this._fallbackRoot +}; + +VueI18n.prototype._isSilentFallbackWarn = function _isSilentFallbackWarn (key) { + return this._silentFallbackWarn instanceof RegExp + ? this._silentFallbackWarn.test(key) + : this._silentFallbackWarn +}; + +VueI18n.prototype._isSilentFallback = function _isSilentFallback (locale, key) { + return this._isSilentFallbackWarn(key) && (this._isFallbackRoot() || locale !== this.fallbackLocale) +}; + +VueI18n.prototype._isSilentTranslationWarn = function _isSilentTranslationWarn (key) { + return this._silentTranslationWarn instanceof RegExp + ? this._silentTranslationWarn.test(key) + : this._silentTranslationWarn +}; + +VueI18n.prototype._interpolate = function _interpolate ( + locale, + message, + key, + host, + interpolateMode, + values, + visitedLinkStack +) { + if (!message) { return null } + + var pathRet = this._path.getPathValue(message, key); + if (Array.isArray(pathRet) || isPlainObject(pathRet)) { return pathRet } + + var ret; + if (isNull(pathRet)) { + /* istanbul ignore else */ + if (isPlainObject(message)) { + ret = message[key]; + if (!isString(ret)) { + if (process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallback(locale, key)) { + warn(("Value of key '" + key + "' is not a string!")); + } + return null + } + } else { + return null + } + } else { + /* istanbul ignore else */ + if (isString(pathRet)) { + ret = pathRet; + } else { + if (process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallback(locale, key)) { + warn(("Value of key '" + key + "' is not a string!")); + } + return null + } + } + + // Check for the existence of links within the translated string + if (ret.indexOf('@:') >= 0 || ret.indexOf('@.') >= 0) { + ret = this._link(locale, message, ret, host, 'raw', values, visitedLinkStack); + } + + return this._render(ret, interpolateMode, values, key) +}; + +VueI18n.prototype._link = function _link ( + locale, + message, + str, + host, + interpolateMode, + values, + visitedLinkStack +) { + var ret = str; + + // Match all the links within the local + // We are going to replace each of + // them with its translation + var matches = ret.match(linkKeyMatcher); + for (var idx in matches) { + // ie compatible: filter custom array + // prototype method + if (!matches.hasOwnProperty(idx)) { + continue + } + var link = matches[idx]; + var linkKeyPrefixMatches = link.match(linkKeyPrefixMatcher); + var linkPrefix = linkKeyPrefixMatches[0]; + var formatterName = linkKeyPrefixMatches[1]; + + // Remove the leading @:, @.case: and the brackets + var linkPlaceholder = link.replace(linkPrefix, '').replace(bracketsMatcher, ''); + + if (includes(visitedLinkStack, linkPlaceholder)) { + if (process.env.NODE_ENV !== 'production') { + warn(("Circular reference found. \"" + link + "\" is already visited in the chain of " + (visitedLinkStack.reverse().join(' <- ')))); + } + return ret + } + visitedLinkStack.push(linkPlaceholder); + + // Translate the link + var translated = this._interpolate( + locale, message, linkPlaceholder, host, + interpolateMode === 'raw' ? 'string' : interpolateMode, + interpolateMode === 'raw' ? undefined : values, + visitedLinkStack + ); + + if (this._isFallbackRoot(translated)) { + if (process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(linkPlaceholder)) { + warn(("Fall back to translate the link placeholder '" + linkPlaceholder + "' with root locale.")); + } + /* istanbul ignore if */ + if (!this._root) { throw Error('unexpected error') } + var root = this._root.$i18n; + translated = root._translate( + root._getMessages(), root.locale, root.fallbackLocale, + linkPlaceholder, host, interpolateMode, values + ); + } + translated = this._warnDefault( + locale, linkPlaceholder, translated, host, + Array.isArray(values) ? values : [values], + interpolateMode + ); + + if (this._modifiers.hasOwnProperty(formatterName)) { + translated = this._modifiers[formatterName](translated); + } else if (defaultModifiers.hasOwnProperty(formatterName)) { + translated = defaultModifiers[formatterName](translated); + } + + visitedLinkStack.pop(); + + // Replace the link with the translated + ret = !translated ? ret : ret.replace(link, translated); + } + + return ret +}; + +VueI18n.prototype._render = function _render (message, interpolateMode, values, path) { + var ret = this._formatter.interpolate(message, values, path); + + // If the custom formatter refuses to work - apply the default one + if (!ret) { + ret = defaultFormatter.interpolate(message, values, path); + } + + // if interpolateMode is **not** 'string' ('row'), + // return the compiled data (e.g. ['foo', VNode, 'bar']) with formatter + return interpolateMode === 'string' && !isString(ret) ? ret.join('') : ret +}; + +VueI18n.prototype._appendItemToChain = function _appendItemToChain (chain, item, blocks) { + var follow = false; + if (!includes(chain, item)) { + follow = true; + if (item) { + follow = item[item.length - 1] !== '!'; + item = item.replace(/!/g, ''); + chain.push(item); + if (blocks && blocks[item]) { + follow = blocks[item]; + } + } + } + return follow +}; + +VueI18n.prototype._appendLocaleToChain = function _appendLocaleToChain (chain, locale, blocks) { + var follow; + var tokens = locale.split('-'); + do { + var item = tokens.join('-'); + follow = this._appendItemToChain(chain, item, blocks); + tokens.splice(-1, 1); + } while (tokens.length && (follow === true)) + return follow +}; + +VueI18n.prototype._appendBlockToChain = function _appendBlockToChain (chain, block, blocks) { + var follow = true; + for (var i = 0; (i < block.length) && (isBoolean(follow)); i++) { + var locale = block[i]; + if (isString(locale)) { + follow = this._appendLocaleToChain(chain, locale, blocks); + } + } + return follow +}; + +VueI18n.prototype._getLocaleChain = function _getLocaleChain (start, fallbackLocale) { + if (start === '') { return [] } + + if (!this._localeChainCache) { + this._localeChainCache = {}; + } + + var chain = this._localeChainCache[start]; + if (!chain) { + if (!fallbackLocale) { + fallbackLocale = this.fallbackLocale; + } + chain = []; + + // first block defined by start + var block = [start]; + + // while any intervening block found + while (isArray(block)) { + block = this._appendBlockToChain( + chain, + block, + fallbackLocale + ); + } + + // last block defined by default + var defaults; + if (isArray(fallbackLocale)) { + defaults = fallbackLocale; + } else if (isObject(fallbackLocale)) { + /* $FlowFixMe */ + if (fallbackLocale['default']) { + defaults = fallbackLocale['default']; + } else { + defaults = null; + } + } else { + defaults = fallbackLocale; + } + + // convert defaults to array + if (isString(defaults)) { + block = [defaults]; + } else { + block = defaults; + } + if (block) { + this._appendBlockToChain( + chain, + block, + null + ); + } + this._localeChainCache[start] = chain; + } + return chain +}; + +VueI18n.prototype._translate = function _translate ( + messages, + locale, + fallback, + key, + host, + interpolateMode, + args +) { + var chain = this._getLocaleChain(locale, fallback); + var res; + for (var i = 0; i < chain.length; i++) { + var step = chain[i]; + res = + this._interpolate(step, messages[step], key, host, interpolateMode, args, [key]); + if (!isNull(res)) { + if (step !== locale && process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) { + warn(("Fall back to translate the keypath '" + key + "' with '" + step + "' locale.")); + } + return res + } + } + return null +}; + +VueI18n.prototype._t = function _t (key, _locale, messages, host) { + var ref; + + var values = [], len = arguments.length - 4; + while ( len-- > 0 ) values[ len ] = arguments[ len + 4 ]; + if (!key) { return '' } + + var parsedArgs = parseArgs.apply(void 0, values); + var locale = parsedArgs.locale || _locale; + + var ret = this._translate( + messages, locale, this.fallbackLocale, key, + host, 'string', parsedArgs.params + ); + if (this._isFallbackRoot(ret)) { + if (process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) { + warn(("Fall back to translate the keypath '" + key + "' with root locale.")); + } + /* istanbul ignore if */ + if (!this._root) { throw Error('unexpected error') } + return (ref = this._root).$t.apply(ref, [ key ].concat( values )) + } else { + ret = this._warnDefault(locale, key, ret, host, values, 'string'); + if (this._postTranslation && ret !== null && ret !== undefined) { + ret = this._postTranslation(ret, key); + } + return ret + } +}; + +VueI18n.prototype.t = function t (key) { + var ref; + + var values = [], len = arguments.length - 1; + while ( len-- > 0 ) values[ len ] = arguments[ len + 1 ]; + return (ref = this)._t.apply(ref, [ key, this.locale, this._getMessages(), null ].concat( values )) +}; + +VueI18n.prototype._i = function _i (key, locale, messages, host, values) { + var ret = + this._translate(messages, locale, this.fallbackLocale, key, host, 'raw', values); + if (this._isFallbackRoot(ret)) { + if (process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key)) { + warn(("Fall back to interpolate the keypath '" + key + "' with root locale.")); + } + if (!this._root) { throw Error('unexpected error') } + return this._root.$i18n.i(key, locale, values) + } else { + return this._warnDefault(locale, key, ret, host, [values], 'raw') + } +}; + +VueI18n.prototype.i = function i (key, locale, values) { + /* istanbul ignore if */ + if (!key) { return '' } + + if (!isString(locale)) { + locale = this.locale; + } + + return this._i(key, locale, this._getMessages(), null, values) +}; + +VueI18n.prototype._tc = function _tc ( + key, + _locale, + messages, + host, + choice +) { + var ref; + + var values = [], len = arguments.length - 5; + while ( len-- > 0 ) values[ len ] = arguments[ len + 5 ]; + if (!key) { return '' } + if (choice === undefined) { + choice = 1; + } + + var predefined = { 'count': choice, 'n': choice }; + var parsedArgs = parseArgs.apply(void 0, values); + parsedArgs.params = Object.assign(predefined, parsedArgs.params); + values = parsedArgs.locale === null ? [parsedArgs.params] : [parsedArgs.locale, parsedArgs.params]; + return this.fetchChoice((ref = this)._t.apply(ref, [ key, _locale, messages, host ].concat( values )), choice) +}; + +VueI18n.prototype.fetchChoice = function fetchChoice (message, choice) { + /* istanbul ignore if */ + if (!message && !isString(message)) { return null } + var choices = message.split('|'); + + choice = this.getChoiceIndex(choice, choices.length); + if (!choices[choice]) { return message } + return choices[choice].trim() +}; + +VueI18n.prototype.tc = function tc (key, choice) { + var ref; + + var values = [], len = arguments.length - 2; + while ( len-- > 0 ) values[ len ] = arguments[ len + 2 ]; + return (ref = this)._tc.apply(ref, [ key, this.locale, this._getMessages(), null, choice ].concat( values )) +}; + +VueI18n.prototype._te = function _te (key, locale, messages) { + var args = [], len = arguments.length - 3; + while ( len-- > 0 ) args[ len ] = arguments[ len + 3 ]; + + var _locale = parseArgs.apply(void 0, args).locale || locale; + return this._exist(messages[_locale], key) +}; + +VueI18n.prototype.te = function te (key, locale) { + return this._te(key, this.locale, this._getMessages(), locale) +}; + +VueI18n.prototype.getLocaleMessage = function getLocaleMessage (locale) { + return looseClone(this._vm.messages[locale] || {}) +}; + +VueI18n.prototype.setLocaleMessage = function setLocaleMessage (locale, message) { + if (this._warnHtmlInMessage === 'warn' || this._warnHtmlInMessage === 'error') { + this._checkLocaleMessage(locale, this._warnHtmlInMessage, message); + } + this._vm.$set(this._vm.messages, locale, message); +}; + +VueI18n.prototype.mergeLocaleMessage = function mergeLocaleMessage (locale, message) { + if (this._warnHtmlInMessage === 'warn' || this._warnHtmlInMessage === 'error') { + this._checkLocaleMessage(locale, this._warnHtmlInMessage, message); + } + this._vm.$set(this._vm.messages, locale, merge({}, this._vm.messages[locale] || {}, message)); +}; + +VueI18n.prototype.getDateTimeFormat = function getDateTimeFormat (locale) { + return looseClone(this._vm.dateTimeFormats[locale] || {}) +}; + +VueI18n.prototype.setDateTimeFormat = function setDateTimeFormat (locale, format) { + this._vm.$set(this._vm.dateTimeFormats, locale, format); + this._clearDateTimeFormat(locale, format); +}; + +VueI18n.prototype.mergeDateTimeFormat = function mergeDateTimeFormat (locale, format) { + this._vm.$set(this._vm.dateTimeFormats, locale, merge(this._vm.dateTimeFormats[locale] || {}, format)); + this._clearDateTimeFormat(locale, format); +}; + +VueI18n.prototype._clearDateTimeFormat = function _clearDateTimeFormat (locale, format) { + for (var key in format) { + var id = locale + "__" + key; + + if (!this._dateTimeFormatters.hasOwnProperty(id)) { + continue + } + + delete this._dateTimeFormatters[id]; + } +}; + +VueI18n.prototype._localizeDateTime = function _localizeDateTime ( + value, + locale, + fallback, + dateTimeFormats, + key +) { + var _locale = locale; + var formats = dateTimeFormats[_locale]; + + var chain = this._getLocaleChain(locale, fallback); + for (var i = 0; i < chain.length; i++) { + var current = _locale; + var step = chain[i]; + formats = dateTimeFormats[step]; + _locale = step; + // fallback locale + if (isNull(formats) || isNull(formats[key])) { + if (step !== locale && process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) { + warn(("Fall back to '" + step + "' datetime formats from '" + current + "' datetime formats.")); + } + } else { + break + } + } + + if (isNull(formats) || isNull(formats[key])) { + return null + } else { + var format = formats[key]; + var id = _locale + "__" + key; + var formatter = this._dateTimeFormatters[id]; + if (!formatter) { + formatter = this._dateTimeFormatters[id] = new Intl.DateTimeFormat(_locale, format); + } + return formatter.format(value) + } +}; + +VueI18n.prototype._d = function _d (value, locale, key) { + /* istanbul ignore if */ + if (process.env.NODE_ENV !== 'production' && !VueI18n.availabilities.dateTimeFormat) { + warn('Cannot format a Date value due to not supported Intl.DateTimeFormat.'); + return '' + } + + if (!key) { + return new Intl.DateTimeFormat(locale).format(value) + } + + var ret = + this._localizeDateTime(value, locale, this.fallbackLocale, this._getDateTimeFormats(), key); + if (this._isFallbackRoot(ret)) { + if (process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) { + warn(("Fall back to datetime localization of root: key '" + key + "'.")); + } + /* istanbul ignore if */ + if (!this._root) { throw Error('unexpected error') } + return this._root.$i18n.d(value, key, locale) + } else { + return ret || '' + } +}; + +VueI18n.prototype.d = function d (value) { + var args = [], len = arguments.length - 1; + while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ]; + + var locale = this.locale; + var key = null; + + if (args.length === 1) { + if (isString(args[0])) { + key = args[0]; + } else if (isObject(args[0])) { + if (args[0].locale) { + locale = args[0].locale; + } + if (args[0].key) { + key = args[0].key; + } + } + } else if (args.length === 2) { + if (isString(args[0])) { + key = args[0]; + } + if (isString(args[1])) { + locale = args[1]; + } + } + + return this._d(value, locale, key) +}; + +VueI18n.prototype.getNumberFormat = function getNumberFormat (locale) { + return looseClone(this._vm.numberFormats[locale] || {}) +}; + +VueI18n.prototype.setNumberFormat = function setNumberFormat (locale, format) { + this._vm.$set(this._vm.numberFormats, locale, format); + this._clearNumberFormat(locale, format); +}; + +VueI18n.prototype.mergeNumberFormat = function mergeNumberFormat (locale, format) { + this._vm.$set(this._vm.numberFormats, locale, merge(this._vm.numberFormats[locale] || {}, format)); + this._clearNumberFormat(locale, format); +}; + +VueI18n.prototype._clearNumberFormat = function _clearNumberFormat (locale, format) { + for (var key in format) { + var id = locale + "__" + key; + + if (!this._numberFormatters.hasOwnProperty(id)) { + continue + } + + delete this._numberFormatters[id]; + } +}; + +VueI18n.prototype._getNumberFormatter = function _getNumberFormatter ( + value, + locale, + fallback, + numberFormats, + key, + options +) { + var _locale = locale; + var formats = numberFormats[_locale]; + + var chain = this._getLocaleChain(locale, fallback); + for (var i = 0; i < chain.length; i++) { + var current = _locale; + var step = chain[i]; + formats = numberFormats[step]; + _locale = step; + // fallback locale + if (isNull(formats) || isNull(formats[key])) { + if (step !== locale && process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) { + warn(("Fall back to '" + step + "' number formats from '" + current + "' number formats.")); + } + } else { + break + } + } + + if (isNull(formats) || isNull(formats[key])) { + return null + } else { + var format = formats[key]; + + var formatter; + if (options) { + // If options specified - create one time number formatter + formatter = new Intl.NumberFormat(_locale, Object.assign({}, format, options)); + } else { + var id = _locale + "__" + key; + formatter = this._numberFormatters[id]; + if (!formatter) { + formatter = this._numberFormatters[id] = new Intl.NumberFormat(_locale, format); + } + } + return formatter + } +}; + +VueI18n.prototype._n = function _n (value, locale, key, options) { + /* istanbul ignore if */ + if (!VueI18n.availabilities.numberFormat) { + if (process.env.NODE_ENV !== 'production') { + warn('Cannot format a Number value due to not supported Intl.NumberFormat.'); + } + return '' + } + + if (!key) { + var nf = !options ? new Intl.NumberFormat(locale) : new Intl.NumberFormat(locale, options); + return nf.format(value) + } + + var formatter = this._getNumberFormatter(value, locale, this.fallbackLocale, this._getNumberFormats(), key, options); + var ret = formatter && formatter.format(value); + if (this._isFallbackRoot(ret)) { + if (process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) { + warn(("Fall back to number localization of root: key '" + key + "'.")); + } + /* istanbul ignore if */ + if (!this._root) { throw Error('unexpected error') } + return this._root.$i18n.n(value, Object.assign({}, { key: key, locale: locale }, options)) + } else { + return ret || '' + } +}; + +VueI18n.prototype.n = function n (value) { + var args = [], len = arguments.length - 1; + while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ]; + + var locale = this.locale; + var key = null; + var options = null; + + if (args.length === 1) { + if (isString(args[0])) { + key = args[0]; + } else if (isObject(args[0])) { + if (args[0].locale) { + locale = args[0].locale; + } + if (args[0].key) { + key = args[0].key; + } + + // Filter out number format options only + options = Object.keys(args[0]).reduce(function (acc, key) { + var obj; + + if (includes(numberFormatKeys, key)) { + return Object.assign({}, acc, ( obj = {}, obj[key] = args[0][key], obj )) + } + return acc + }, null); + } + } else if (args.length === 2) { + if (isString(args[0])) { + key = args[0]; + } + if (isString(args[1])) { + locale = args[1]; + } + } + + return this._n(value, locale, key, options) +}; + +VueI18n.prototype._ntp = function _ntp (value, locale, key, options) { + /* istanbul ignore if */ + if (!VueI18n.availabilities.numberFormat) { + if (process.env.NODE_ENV !== 'production') { + warn('Cannot format to parts a Number value due to not supported Intl.NumberFormat.'); + } + return [] + } + + if (!key) { + var nf = !options ? new Intl.NumberFormat(locale) : new Intl.NumberFormat(locale, options); + return nf.formatToParts(value) + } + + var formatter = this._getNumberFormatter(value, locale, this.fallbackLocale, this._getNumberFormats(), key, options); + var ret = formatter && formatter.formatToParts(value); + if (this._isFallbackRoot(ret)) { + if (process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key)) { + warn(("Fall back to format number to parts of root: key '" + key + "' .")); + } + /* istanbul ignore if */ + if (!this._root) { throw Error('unexpected error') } + return this._root.$i18n._ntp(value, locale, key, options) + } else { + return ret || [] + } +}; + +Object.defineProperties( VueI18n.prototype, prototypeAccessors ); + +var availabilities; +// $FlowFixMe +Object.defineProperty(VueI18n, 'availabilities', { + get: function get () { + if (!availabilities) { + var intlDefined = typeof Intl !== 'undefined'; + availabilities = { + dateTimeFormat: intlDefined && typeof Intl.DateTimeFormat !== 'undefined', + numberFormat: intlDefined && typeof Intl.NumberFormat !== 'undefined' + }; + } + + return availabilities + } +}); + +VueI18n.install = install; +VueI18n.version = '8.20.0'; + +module.exports = VueI18n; diff --git a/node_modules/vue-i18n/dist/vue-i18n.esm.browser.js b/node_modules/vue-i18n/dist/vue-i18n.esm.browser.js new file mode 100644 index 0000000..d996b59 --- /dev/null +++ b/node_modules/vue-i18n/dist/vue-i18n.esm.browser.js @@ -0,0 +1,2085 @@ +/* */ + +/** + * constants + */ + +const numberFormatKeys = [ + 'style', + 'currency', + 'currencyDisplay', + 'useGrouping', + 'minimumIntegerDigits', + 'minimumFractionDigits', + 'maximumFractionDigits', + 'minimumSignificantDigits', + 'maximumSignificantDigits', + 'localeMatcher', + 'formatMatcher', + 'unit' +]; + +/** + * utilities + */ + +function warn (msg, err) { + if (typeof console !== 'undefined') { + console.warn('[vue-i18n] ' + msg); + /* istanbul ignore if */ + if (err) { + console.warn(err.stack); + } + } +} + +function error (msg, err) { + if (typeof console !== 'undefined') { + console.error('[vue-i18n] ' + msg); + /* istanbul ignore if */ + if (err) { + console.error(err.stack); + } + } +} + +const isArray = Array.isArray; + +function isObject (obj) { + return obj !== null && typeof obj === 'object' +} + +function isBoolean (val) { + return typeof val === 'boolean' +} + +function isString (val) { + return typeof val === 'string' +} + +const toString = Object.prototype.toString; +const OBJECT_STRING = '[object Object]'; +function isPlainObject (obj) { + return toString.call(obj) === OBJECT_STRING +} + +function isNull (val) { + return val === null || val === undefined +} + +function parseArgs (...args) { + let locale = null; + let params = null; + if (args.length === 1) { + if (isObject(args[0]) || Array.isArray(args[0])) { + params = args[0]; + } else if (typeof args[0] === 'string') { + locale = args[0]; + } + } else if (args.length === 2) { + if (typeof args[0] === 'string') { + locale = args[0]; + } + /* istanbul ignore if */ + if (isObject(args[1]) || Array.isArray(args[1])) { + params = args[1]; + } + } + + return { locale, params } +} + +function looseClone (obj) { + return JSON.parse(JSON.stringify(obj)) +} + +function remove (arr, item) { + if (arr.length) { + const index = arr.indexOf(item); + if (index > -1) { + return arr.splice(index, 1) + } + } +} + +function includes (arr, item) { + return !!~arr.indexOf(item) +} + +const hasOwnProperty = Object.prototype.hasOwnProperty; +function hasOwn (obj, key) { + return hasOwnProperty.call(obj, key) +} + +function merge (target) { + const output = Object(target); + for (let i = 1; i < arguments.length; i++) { + const source = arguments[i]; + if (source !== undefined && source !== null) { + let key; + for (key in source) { + if (hasOwn(source, key)) { + if (isObject(source[key])) { + output[key] = merge(output[key], source[key]); + } else { + output[key] = source[key]; + } + } + } + } + } + return output +} + +function looseEqual (a, b) { + if (a === b) { return true } + const isObjectA = isObject(a); + const isObjectB = isObject(b); + if (isObjectA && isObjectB) { + try { + const isArrayA = Array.isArray(a); + const isArrayB = Array.isArray(b); + if (isArrayA && isArrayB) { + return a.length === b.length && a.every((e, i) => { + return looseEqual(e, b[i]) + }) + } else if (!isArrayA && !isArrayB) { + const keysA = Object.keys(a); + const keysB = Object.keys(b); + return keysA.length === keysB.length && keysA.every((key) => { + return looseEqual(a[key], b[key]) + }) + } else { + /* istanbul ignore next */ + return false + } + } catch (e) { + /* istanbul ignore next */ + return false + } + } else if (!isObjectA && !isObjectB) { + return String(a) === String(b) + } else { + return false + } +} + +/* */ + +function extend (Vue) { + if (!Vue.prototype.hasOwnProperty('$i18n')) { + // $FlowFixMe + Object.defineProperty(Vue.prototype, '$i18n', { + get () { return this._i18n } + }); + } + + Vue.prototype.$t = function (key, ...values) { + const i18n = this.$i18n; + return i18n._t(key, i18n.locale, i18n._getMessages(), this, ...values) + }; + + Vue.prototype.$tc = function (key, choice, ...values) { + const i18n = this.$i18n; + return i18n._tc(key, i18n.locale, i18n._getMessages(), this, choice, ...values) + }; + + Vue.prototype.$te = function (key, locale) { + const i18n = this.$i18n; + return i18n._te(key, i18n.locale, i18n._getMessages(), locale) + }; + + Vue.prototype.$d = function (value, ...args) { + return this.$i18n.d(value, ...args) + }; + + Vue.prototype.$n = function (value, ...args) { + return this.$i18n.n(value, ...args) + }; +} + +/* */ + +var mixin = { + beforeCreate () { + const options = this.$options; + options.i18n = options.i18n || (options.__i18n ? {} : null); + + if (options.i18n) { + if (options.i18n instanceof VueI18n) { + // init locale messages via custom blocks + if (options.__i18n) { + try { + let localeMessages = {}; + options.__i18n.forEach(resource => { + localeMessages = merge(localeMessages, JSON.parse(resource)); + }); + Object.keys(localeMessages).forEach((locale) => { + options.i18n.mergeLocaleMessage(locale, localeMessages[locale]); + }); + } catch (e) { + { + error(`Cannot parse locale messages via custom blocks.`, e); + } + } + } + this._i18n = options.i18n; + this._i18nWatcher = this._i18n.watchI18nData(); + } else if (isPlainObject(options.i18n)) { + const rootI18n = this.$root && this.$root.$i18n && this.$root.$i18n instanceof VueI18n + ? this.$root.$i18n + : null; + // component local i18n + if (rootI18n) { + options.i18n.root = this.$root; + options.i18n.formatter = rootI18n.formatter; + options.i18n.fallbackLocale = rootI18n.fallbackLocale; + options.i18n.formatFallbackMessages = rootI18n.formatFallbackMessages; + options.i18n.silentTranslationWarn = rootI18n.silentTranslationWarn; + options.i18n.silentFallbackWarn = rootI18n.silentFallbackWarn; + options.i18n.pluralizationRules = rootI18n.pluralizationRules; + options.i18n.preserveDirectiveContent = rootI18n.preserveDirectiveContent; + } + + // init locale messages via custom blocks + if (options.__i18n) { + try { + let localeMessages = {}; + options.__i18n.forEach(resource => { + localeMessages = merge(localeMessages, JSON.parse(resource)); + }); + options.i18n.messages = localeMessages; + } catch (e) { + { + warn(`Cannot parse locale messages via custom blocks.`, e); + } + } + } + + const { sharedMessages } = options.i18n; + if (sharedMessages && isPlainObject(sharedMessages)) { + options.i18n.messages = merge(options.i18n.messages, sharedMessages); + } + + this._i18n = new VueI18n(options.i18n); + this._i18nWatcher = this._i18n.watchI18nData(); + + if (options.i18n.sync === undefined || !!options.i18n.sync) { + this._localeWatcher = this.$i18n.watchLocale(); + } + + if (rootI18n) { + rootI18n.onComponentInstanceCreated(this._i18n); + } + } else { + { + warn(`Cannot be interpreted 'i18n' option.`); + } + } + } else if (this.$root && this.$root.$i18n && this.$root.$i18n instanceof VueI18n) { + // root i18n + this._i18n = this.$root.$i18n; + } else if (options.parent && options.parent.$i18n && options.parent.$i18n instanceof VueI18n) { + // parent i18n + this._i18n = options.parent.$i18n; + } + }, + + beforeMount () { + const options = this.$options; + options.i18n = options.i18n || (options.__i18n ? {} : null); + + if (options.i18n) { + if (options.i18n instanceof VueI18n) { + // init locale messages via custom blocks + this._i18n.subscribeDataChanging(this); + this._subscribing = true; + } else if (isPlainObject(options.i18n)) { + this._i18n.subscribeDataChanging(this); + this._subscribing = true; + } else { + { + warn(`Cannot be interpreted 'i18n' option.`); + } + } + } else if (this.$root && this.$root.$i18n && this.$root.$i18n instanceof VueI18n) { + this._i18n.subscribeDataChanging(this); + this._subscribing = true; + } else if (options.parent && options.parent.$i18n && options.parent.$i18n instanceof VueI18n) { + this._i18n.subscribeDataChanging(this); + this._subscribing = true; + } + }, + + beforeDestroy () { + if (!this._i18n) { return } + + const self = this; + this.$nextTick(() => { + if (self._subscribing) { + self._i18n.unsubscribeDataChanging(self); + delete self._subscribing; + } + + if (self._i18nWatcher) { + self._i18nWatcher(); + self._i18n.destroyVM(); + delete self._i18nWatcher; + } + + if (self._localeWatcher) { + self._localeWatcher(); + delete self._localeWatcher; + } + }); + } +}; + +/* */ + +var interpolationComponent = { + name: 'i18n', + functional: true, + props: { + tag: { + type: [String, Boolean, Object], + default: 'span' + }, + path: { + type: String, + required: true + }, + locale: { + type: String + }, + places: { + type: [Array, Object] + } + }, + render (h, { data, parent, props, slots }) { + const { $i18n } = parent; + if (!$i18n) { + { + warn('Cannot find VueI18n instance!'); + } + return + } + + const { path, locale, places } = props; + const params = slots(); + const children = $i18n.i( + path, + locale, + onlyHasDefaultPlace(params) || places + ? useLegacyPlaces(params.default, places) + : params + ); + + const tag = (!!props.tag && props.tag !== true) || props.tag === false ? props.tag : 'span'; + return tag ? h(tag, data, children) : children + } +}; + +function onlyHasDefaultPlace (params) { + let prop; + for (prop in params) { + if (prop !== 'default') { return false } + } + return Boolean(prop) +} + +function useLegacyPlaces (children, places) { + const params = places ? createParamsFromPlaces(places) : {}; + + if (!children) { return params } + + // Filter empty text nodes + children = children.filter(child => { + return child.tag || child.text.trim() !== '' + }); + + const everyPlace = children.every(vnodeHasPlaceAttribute); + if (everyPlace) { + warn('`place` attribute is deprecated in next major version. Please switch to Vue slots.'); + } + + return children.reduce( + everyPlace ? assignChildPlace : assignChildIndex, + params + ) +} + +function createParamsFromPlaces (places) { + { + warn('`places` prop is deprecated in next major version. Please switch to Vue slots.'); + } + + return Array.isArray(places) + ? places.reduce(assignChildIndex, {}) + : Object.assign({}, places) +} + +function assignChildPlace (params, child) { + if (child.data && child.data.attrs && child.data.attrs.place) { + params[child.data.attrs.place] = child; + } + return params +} + +function assignChildIndex (params, child, index) { + params[index] = child; + return params +} + +function vnodeHasPlaceAttribute (vnode) { + return Boolean(vnode.data && vnode.data.attrs && vnode.data.attrs.place) +} + +/* */ + +var numberComponent = { + name: 'i18n-n', + functional: true, + props: { + tag: { + type: [String, Boolean, Object], + default: 'span' + }, + value: { + type: Number, + required: true + }, + format: { + type: [String, Object] + }, + locale: { + type: String + } + }, + render (h, { props, parent, data }) { + const i18n = parent.$i18n; + + if (!i18n) { + { + warn('Cannot find VueI18n instance!'); + } + return null + } + + let key = null; + let options = null; + + if (isString(props.format)) { + key = props.format; + } else if (isObject(props.format)) { + if (props.format.key) { + key = props.format.key; + } + + // Filter out number format options only + options = Object.keys(props.format).reduce((acc, prop) => { + if (includes(numberFormatKeys, prop)) { + return Object.assign({}, acc, { [prop]: props.format[prop] }) + } + return acc + }, null); + } + + const locale = props.locale || i18n.locale; + const parts = i18n._ntp(props.value, locale, key, options); + + const values = parts.map((part, index) => { + const slot = data.scopedSlots && data.scopedSlots[part.type]; + return slot ? slot({ [part.type]: part.value, index, parts }) : part.value + }); + + const tag = (!!props.tag && props.tag !== true) || props.tag === false ? props.tag : 'span'; + return tag + ? h(tag, { + attrs: data.attrs, + 'class': data['class'], + staticClass: data.staticClass + }, values) + : values + } +}; + +/* */ + +function bind (el, binding, vnode) { + if (!assert(el, vnode)) { return } + + t(el, binding, vnode); +} + +function update (el, binding, vnode, oldVNode) { + if (!assert(el, vnode)) { return } + + const i18n = vnode.context.$i18n; + if (localeEqual(el, vnode) && + (looseEqual(binding.value, binding.oldValue) && + looseEqual(el._localeMessage, i18n.getLocaleMessage(i18n.locale)))) { return } + + t(el, binding, vnode); +} + +function unbind (el, binding, vnode, oldVNode) { + const vm = vnode.context; + if (!vm) { + warn('Vue instance does not exists in VNode context'); + return + } + + const i18n = vnode.context.$i18n || {}; + if (!binding.modifiers.preserve && !i18n.preserveDirectiveContent) { + el.textContent = ''; + } + el._vt = undefined; + delete el['_vt']; + el._locale = undefined; + delete el['_locale']; + el._localeMessage = undefined; + delete el['_localeMessage']; +} + +function assert (el, vnode) { + const vm = vnode.context; + if (!vm) { + warn('Vue instance does not exists in VNode context'); + return false + } + + if (!vm.$i18n) { + warn('VueI18n instance does not exists in Vue instance'); + return false + } + + return true +} + +function localeEqual (el, vnode) { + const vm = vnode.context; + return el._locale === vm.$i18n.locale +} + +function t (el, binding, vnode) { + const value = binding.value; + + const { path, locale, args, choice } = parseValue(value); + if (!path && !locale && !args) { + warn('value type not supported'); + return + } + + if (!path) { + warn('`path` is required in v-t directive'); + return + } + + const vm = vnode.context; + if (choice != null) { + el._vt = el.textContent = vm.$i18n.tc(path, choice, ...makeParams(locale, args)); + } else { + el._vt = el.textContent = vm.$i18n.t(path, ...makeParams(locale, args)); + } + el._locale = vm.$i18n.locale; + el._localeMessage = vm.$i18n.getLocaleMessage(vm.$i18n.locale); +} + +function parseValue (value) { + let path; + let locale; + let args; + let choice; + + if (isString(value)) { + path = value; + } else if (isPlainObject(value)) { + path = value.path; + locale = value.locale; + args = value.args; + choice = value.choice; + } + + return { path, locale, args, choice } +} + +function makeParams (locale, args) { + const params = []; + + locale && params.push(locale); + if (args && (Array.isArray(args) || isPlainObject(args))) { + params.push(args); + } + + return params +} + +let Vue; + +function install (_Vue) { + /* istanbul ignore if */ + if (install.installed && _Vue === Vue) { + warn('already installed.'); + return + } + install.installed = true; + + Vue = _Vue; + + const version = (Vue.version && Number(Vue.version.split('.')[0])) || -1; + /* istanbul ignore if */ + if (version < 2) { + warn(`vue-i18n (${install.version}) need to use Vue 2.0 or later (Vue: ${Vue.version}).`); + return + } + + extend(Vue); + Vue.mixin(mixin); + Vue.directive('t', { bind, update, unbind }); + Vue.component(interpolationComponent.name, interpolationComponent); + Vue.component(numberComponent.name, numberComponent); + + // use simple mergeStrategies to prevent i18n instance lose '__proto__' + const strats = Vue.config.optionMergeStrategies; + strats.i18n = function (parentVal, childVal) { + return childVal === undefined + ? parentVal + : childVal + }; +} + +/* */ + +class BaseFormatter { + + + constructor () { + this._caches = Object.create(null); + } + + interpolate (message, values) { + if (!values) { + return [message] + } + let tokens = this._caches[message]; + if (!tokens) { + tokens = parse(message); + this._caches[message] = tokens; + } + return compile(tokens, values) + } +} + + + +const RE_TOKEN_LIST_VALUE = /^(?:\d)+/; +const RE_TOKEN_NAMED_VALUE = /^(?:\w)+/; + +function parse (format) { + const tokens = []; + let position = 0; + + let text = ''; + while (position < format.length) { + let char = format[position++]; + if (char === '{') { + if (text) { + tokens.push({ type: 'text', value: text }); + } + + text = ''; + let sub = ''; + char = format[position++]; + while (char !== undefined && char !== '}') { + sub += char; + char = format[position++]; + } + const isClosed = char === '}'; + + const type = RE_TOKEN_LIST_VALUE.test(sub) + ? 'list' + : isClosed && RE_TOKEN_NAMED_VALUE.test(sub) + ? 'named' + : 'unknown'; + tokens.push({ value: sub, type }); + } else if (char === '%') { + // when found rails i18n syntax, skip text capture + if (format[(position)] !== '{') { + text += char; + } + } else { + text += char; + } + } + + text && tokens.push({ type: 'text', value: text }); + + return tokens +} + +function compile (tokens, values) { + const compiled = []; + let index = 0; + + const mode = Array.isArray(values) + ? 'list' + : isObject(values) + ? 'named' + : 'unknown'; + if (mode === 'unknown') { return compiled } + + while (index < tokens.length) { + const token = tokens[index]; + switch (token.type) { + case 'text': + compiled.push(token.value); + break + case 'list': + compiled.push(values[parseInt(token.value, 10)]); + break + case 'named': + if (mode === 'named') { + compiled.push((values)[token.value]); + } else { + { + warn(`Type of token '${token.type}' and format of value '${mode}' don't match!`); + } + } + break + case 'unknown': + { + warn(`Detect 'unknown' type of token!`); + } + break + } + index++; + } + + return compiled +} + +/* */ + +/** + * Path parser + * - Inspired: + * Vue.js Path parser + */ + +// actions +const APPEND = 0; +const PUSH = 1; +const INC_SUB_PATH_DEPTH = 2; +const PUSH_SUB_PATH = 3; + +// states +const BEFORE_PATH = 0; +const IN_PATH = 1; +const BEFORE_IDENT = 2; +const IN_IDENT = 3; +const IN_SUB_PATH = 4; +const IN_SINGLE_QUOTE = 5; +const IN_DOUBLE_QUOTE = 6; +const AFTER_PATH = 7; +const ERROR = 8; + +const pathStateMachine = []; + +pathStateMachine[BEFORE_PATH] = { + 'ws': [BEFORE_PATH], + 'ident': [IN_IDENT, APPEND], + '[': [IN_SUB_PATH], + 'eof': [AFTER_PATH] +}; + +pathStateMachine[IN_PATH] = { + 'ws': [IN_PATH], + '.': [BEFORE_IDENT], + '[': [IN_SUB_PATH], + 'eof': [AFTER_PATH] +}; + +pathStateMachine[BEFORE_IDENT] = { + 'ws': [BEFORE_IDENT], + 'ident': [IN_IDENT, APPEND], + '0': [IN_IDENT, APPEND], + 'number': [IN_IDENT, APPEND] +}; + +pathStateMachine[IN_IDENT] = { + 'ident': [IN_IDENT, APPEND], + '0': [IN_IDENT, APPEND], + 'number': [IN_IDENT, APPEND], + 'ws': [IN_PATH, PUSH], + '.': [BEFORE_IDENT, PUSH], + '[': [IN_SUB_PATH, PUSH], + 'eof': [AFTER_PATH, PUSH] +}; + +pathStateMachine[IN_SUB_PATH] = { + "'": [IN_SINGLE_QUOTE, APPEND], + '"': [IN_DOUBLE_QUOTE, APPEND], + '[': [IN_SUB_PATH, INC_SUB_PATH_DEPTH], + ']': [IN_PATH, PUSH_SUB_PATH], + 'eof': ERROR, + 'else': [IN_SUB_PATH, APPEND] +}; + +pathStateMachine[IN_SINGLE_QUOTE] = { + "'": [IN_SUB_PATH, APPEND], + 'eof': ERROR, + 'else': [IN_SINGLE_QUOTE, APPEND] +}; + +pathStateMachine[IN_DOUBLE_QUOTE] = { + '"': [IN_SUB_PATH, APPEND], + 'eof': ERROR, + 'else': [IN_DOUBLE_QUOTE, APPEND] +}; + +/** + * Check if an expression is a literal value. + */ + +const literalValueRE = /^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/; +function isLiteral (exp) { + return literalValueRE.test(exp) +} + +/** + * Strip quotes from a string + */ + +function stripQuotes (str) { + const a = str.charCodeAt(0); + const b = str.charCodeAt(str.length - 1); + return a === b && (a === 0x22 || a === 0x27) + ? str.slice(1, -1) + : str +} + +/** + * Determine the type of a character in a keypath. + */ + +function getPathCharType (ch) { + if (ch === undefined || ch === null) { return 'eof' } + + const code = ch.charCodeAt(0); + + switch (code) { + case 0x5B: // [ + case 0x5D: // ] + case 0x2E: // . + case 0x22: // " + case 0x27: // ' + return ch + + case 0x5F: // _ + case 0x24: // $ + case 0x2D: // - + return 'ident' + + case 0x09: // Tab + case 0x0A: // Newline + case 0x0D: // Return + case 0xA0: // No-break space + case 0xFEFF: // Byte Order Mark + case 0x2028: // Line Separator + case 0x2029: // Paragraph Separator + return 'ws' + } + + return 'ident' +} + +/** + * Format a subPath, return its plain form if it is + * a literal string or number. Otherwise prepend the + * dynamic indicator (*). + */ + +function formatSubPath (path) { + const trimmed = path.trim(); + // invalid leading 0 + if (path.charAt(0) === '0' && isNaN(path)) { return false } + + return isLiteral(trimmed) ? stripQuotes(trimmed) : '*' + trimmed +} + +/** + * Parse a string path into an array of segments + */ + +function parse$1 (path) { + const keys = []; + let index = -1; + let mode = BEFORE_PATH; + let subPathDepth = 0; + let c; + let key; + let newChar; + let type; + let transition; + let action; + let typeMap; + const actions = []; + + actions[PUSH] = function () { + if (key !== undefined) { + keys.push(key); + key = undefined; + } + }; + + actions[APPEND] = function () { + if (key === undefined) { + key = newChar; + } else { + key += newChar; + } + }; + + actions[INC_SUB_PATH_DEPTH] = function () { + actions[APPEND](); + subPathDepth++; + }; + + actions[PUSH_SUB_PATH] = function () { + if (subPathDepth > 0) { + subPathDepth--; + mode = IN_SUB_PATH; + actions[APPEND](); + } else { + subPathDepth = 0; + if (key === undefined) { return false } + key = formatSubPath(key); + if (key === false) { + return false + } else { + actions[PUSH](); + } + } + }; + + function maybeUnescapeQuote () { + const nextChar = path[index + 1]; + if ((mode === IN_SINGLE_QUOTE && nextChar === "'") || + (mode === IN_DOUBLE_QUOTE && nextChar === '"')) { + index++; + newChar = '\\' + nextChar; + actions[APPEND](); + return true + } + } + + while (mode !== null) { + index++; + c = path[index]; + + if (c === '\\' && maybeUnescapeQuote()) { + continue + } + + type = getPathCharType(c); + typeMap = pathStateMachine[mode]; + transition = typeMap[type] || typeMap['else'] || ERROR; + + if (transition === ERROR) { + return // parse error + } + + mode = transition[0]; + action = actions[transition[1]]; + if (action) { + newChar = transition[2]; + newChar = newChar === undefined + ? c + : newChar; + if (action() === false) { + return + } + } + + if (mode === AFTER_PATH) { + return keys + } + } +} + + + + + +class I18nPath { + + + constructor () { + this._cache = Object.create(null); + } + + /** + * External parse that check for a cache hit first + */ + parsePath (path) { + let hit = this._cache[path]; + if (!hit) { + hit = parse$1(path); + if (hit) { + this._cache[path] = hit; + } + } + return hit || [] + } + + /** + * Get path value from path string + */ + getPathValue (obj, path) { + if (!isObject(obj)) { return null } + + const paths = this.parsePath(path); + if (paths.length === 0) { + return null + } else { + const length = paths.length; + let last = obj; + let i = 0; + while (i < length) { + const value = last[paths[i]]; + if (value === undefined) { + return null + } + last = value; + i++; + } + + return last + } + } +} + +/* */ + + + +const htmlTagMatcher = /<\/?[\w\s="/.':;#-\/]+>/; +const linkKeyMatcher = /(?:@(?:\.[a-z]+)?:(?:[\w\-_|.]+|\([\w\-_|.]+\)))/g; +const linkKeyPrefixMatcher = /^@(?:\.([a-z]+))?:/; +const bracketsMatcher = /[()]/g; +const defaultModifiers = { + 'upper': str => str.toLocaleUpperCase(), + 'lower': str => str.toLocaleLowerCase(), + 'capitalize': str => `${str.charAt(0).toLocaleUpperCase()}${str.substr(1)}` +}; + +const defaultFormatter = new BaseFormatter(); + +class VueI18n { + + + + + + + + + + + + + + + + + + + + + + + + + + + + constructor (options = {}) { + // Auto install if it is not done yet and `window` has `Vue`. + // To allow users to avoid auto-installation in some cases, + // this code should be placed here. See #290 + /* istanbul ignore if */ + if (!Vue && typeof window !== 'undefined' && window.Vue) { + install(window.Vue); + } + + const locale = options.locale || 'en-US'; + const fallbackLocale = options.fallbackLocale === false + ? false + : options.fallbackLocale || 'en-US'; + const messages = options.messages || {}; + const dateTimeFormats = options.dateTimeFormats || {}; + const numberFormats = options.numberFormats || {}; + + this._vm = null; + this._formatter = options.formatter || defaultFormatter; + this._modifiers = options.modifiers || {}; + this._missing = options.missing || null; + this._root = options.root || null; + this._sync = options.sync === undefined ? true : !!options.sync; + this._fallbackRoot = options.fallbackRoot === undefined + ? true + : !!options.fallbackRoot; + this._formatFallbackMessages = options.formatFallbackMessages === undefined + ? false + : !!options.formatFallbackMessages; + this._silentTranslationWarn = options.silentTranslationWarn === undefined + ? false + : options.silentTranslationWarn; + this._silentFallbackWarn = options.silentFallbackWarn === undefined + ? false + : !!options.silentFallbackWarn; + this._dateTimeFormatters = {}; + this._numberFormatters = {}; + this._path = new I18nPath(); + this._dataListeners = []; + this._componentInstanceCreatedListener = options.componentInstanceCreatedListener || null; + this._preserveDirectiveContent = options.preserveDirectiveContent === undefined + ? false + : !!options.preserveDirectiveContent; + this.pluralizationRules = options.pluralizationRules || {}; + this._warnHtmlInMessage = options.warnHtmlInMessage || 'off'; + this._postTranslation = options.postTranslation || null; + + /** + * @param choice {number} a choice index given by the input to $tc: `$tc('path.to.rule', choiceIndex)` + * @param choicesLength {number} an overall amount of available choices + * @returns a final choice index + */ + this.getChoiceIndex = (choice, choicesLength) => { + const thisPrototype = Object.getPrototypeOf(this); + if (thisPrototype && thisPrototype.getChoiceIndex) { + const prototypeGetChoiceIndex = (thisPrototype.getChoiceIndex); + return (prototypeGetChoiceIndex).call(this, choice, choicesLength) + } + + // Default (old) getChoiceIndex implementation - english-compatible + const defaultImpl = (_choice, _choicesLength) => { + _choice = Math.abs(_choice); + + if (_choicesLength === 2) { + return _choice + ? _choice > 1 + ? 1 + : 0 + : 1 + } + + return _choice ? Math.min(_choice, 2) : 0 + }; + + if (this.locale in this.pluralizationRules) { + return this.pluralizationRules[this.locale].apply(this, [choice, choicesLength]) + } else { + return defaultImpl(choice, choicesLength) + } + }; + + + this._exist = (message, key) => { + if (!message || !key) { return false } + if (!isNull(this._path.getPathValue(message, key))) { return true } + // fallback for flat key + if (message[key]) { return true } + return false + }; + + if (this._warnHtmlInMessage === 'warn' || this._warnHtmlInMessage === 'error') { + Object.keys(messages).forEach(locale => { + this._checkLocaleMessage(locale, this._warnHtmlInMessage, messages[locale]); + }); + } + + this._initVM({ + locale, + fallbackLocale, + messages, + dateTimeFormats, + numberFormats + }); + } + + _checkLocaleMessage (locale, level, message) { + const paths = []; + + const fn = (level, locale, message, paths) => { + if (isPlainObject(message)) { + Object.keys(message).forEach(key => { + const val = message[key]; + if (isPlainObject(val)) { + paths.push(key); + paths.push('.'); + fn(level, locale, val, paths); + paths.pop(); + paths.pop(); + } else { + paths.push(key); + fn(level, locale, val, paths); + paths.pop(); + } + }); + } else if (Array.isArray(message)) { + message.forEach((item, index) => { + if (isPlainObject(item)) { + paths.push(`[${index}]`); + paths.push('.'); + fn(level, locale, item, paths); + paths.pop(); + paths.pop(); + } else { + paths.push(`[${index}]`); + fn(level, locale, item, paths); + paths.pop(); + } + }); + } else if (isString(message)) { + const ret = htmlTagMatcher.test(message); + if (ret) { + const msg = `Detected HTML in message '${message}' of keypath '${paths.join('')}' at '${locale}'. Consider component interpolation with '' to avoid XSS. See https://bit.ly/2ZqJzkp`; + if (level === 'warn') { + warn(msg); + } else if (level === 'error') { + error(msg); + } + } + } + }; + + fn(level, locale, message, paths); + } + + _initVM (data) { + const silent = Vue.config.silent; + Vue.config.silent = true; + this._vm = new Vue({ data }); + Vue.config.silent = silent; + } + + destroyVM () { + this._vm.$destroy(); + } + + subscribeDataChanging (vm) { + this._dataListeners.push(vm); + } + + unsubscribeDataChanging (vm) { + remove(this._dataListeners, vm); + } + + watchI18nData () { + const self = this; + return this._vm.$watch('$data', () => { + let i = self._dataListeners.length; + while (i--) { + Vue.nextTick(() => { + self._dataListeners[i] && self._dataListeners[i].$forceUpdate(); + }); + } + }, { deep: true }) + } + + watchLocale () { + /* istanbul ignore if */ + if (!this._sync || !this._root) { return null } + const target = this._vm; + return this._root.$i18n.vm.$watch('locale', (val) => { + target.$set(target, 'locale', val); + target.$forceUpdate(); + }, { immediate: true }) + } + + onComponentInstanceCreated (newI18n) { + if (this._componentInstanceCreatedListener) { + this._componentInstanceCreatedListener(newI18n, this); + } + } + + get vm () { return this._vm } + + get messages () { return looseClone(this._getMessages()) } + get dateTimeFormats () { return looseClone(this._getDateTimeFormats()) } + get numberFormats () { return looseClone(this._getNumberFormats()) } + get availableLocales () { return Object.keys(this.messages).sort() } + + get locale () { return this._vm.locale } + set locale (locale) { + this._vm.$set(this._vm, 'locale', locale); + } + + get fallbackLocale () { return this._vm.fallbackLocale } + set fallbackLocale (locale) { + this._localeChainCache = {}; + this._vm.$set(this._vm, 'fallbackLocale', locale); + } + + get formatFallbackMessages () { return this._formatFallbackMessages } + set formatFallbackMessages (fallback) { this._formatFallbackMessages = fallback; } + + get missing () { return this._missing } + set missing (handler) { this._missing = handler; } + + get formatter () { return this._formatter } + set formatter (formatter) { this._formatter = formatter; } + + get silentTranslationWarn () { return this._silentTranslationWarn } + set silentTranslationWarn (silent) { this._silentTranslationWarn = silent; } + + get silentFallbackWarn () { return this._silentFallbackWarn } + set silentFallbackWarn (silent) { this._silentFallbackWarn = silent; } + + get preserveDirectiveContent () { return this._preserveDirectiveContent } + set preserveDirectiveContent (preserve) { this._preserveDirectiveContent = preserve; } + + get warnHtmlInMessage () { return this._warnHtmlInMessage } + set warnHtmlInMessage (level) { + const orgLevel = this._warnHtmlInMessage; + this._warnHtmlInMessage = level; + if (orgLevel !== level && (level === 'warn' || level === 'error')) { + const messages = this._getMessages(); + Object.keys(messages).forEach(locale => { + this._checkLocaleMessage(locale, this._warnHtmlInMessage, messages[locale]); + }); + } + } + + get postTranslation () { return this._postTranslation } + set postTranslation (handler) { this._postTranslation = handler; } + + _getMessages () { return this._vm.messages } + _getDateTimeFormats () { return this._vm.dateTimeFormats } + _getNumberFormats () { return this._vm.numberFormats } + + _warnDefault (locale, key, result, vm, values, interpolateMode) { + if (!isNull(result)) { return result } + if (this._missing) { + const missingRet = this._missing.apply(null, [locale, key, vm, values]); + if (isString(missingRet)) { + return missingRet + } + } else { + if (!this._isSilentTranslationWarn(key)) { + warn( + `Cannot translate the value of keypath '${key}'. ` + + 'Use the value of keypath as default.' + ); + } + } + + if (this._formatFallbackMessages) { + const parsedArgs = parseArgs(...values); + return this._render(key, interpolateMode, parsedArgs.params, key) + } else { + return key + } + } + + _isFallbackRoot (val) { + return !val && !isNull(this._root) && this._fallbackRoot + } + + _isSilentFallbackWarn (key) { + return this._silentFallbackWarn instanceof RegExp + ? this._silentFallbackWarn.test(key) + : this._silentFallbackWarn + } + + _isSilentFallback (locale, key) { + return this._isSilentFallbackWarn(key) && (this._isFallbackRoot() || locale !== this.fallbackLocale) + } + + _isSilentTranslationWarn (key) { + return this._silentTranslationWarn instanceof RegExp + ? this._silentTranslationWarn.test(key) + : this._silentTranslationWarn + } + + _interpolate ( + locale, + message, + key, + host, + interpolateMode, + values, + visitedLinkStack + ) { + if (!message) { return null } + + const pathRet = this._path.getPathValue(message, key); + if (Array.isArray(pathRet) || isPlainObject(pathRet)) { return pathRet } + + let ret; + if (isNull(pathRet)) { + /* istanbul ignore else */ + if (isPlainObject(message)) { + ret = message[key]; + if (!isString(ret)) { + if (!this._isSilentTranslationWarn(key) && !this._isSilentFallback(locale, key)) { + warn(`Value of key '${key}' is not a string!`); + } + return null + } + } else { + return null + } + } else { + /* istanbul ignore else */ + if (isString(pathRet)) { + ret = pathRet; + } else { + if (!this._isSilentTranslationWarn(key) && !this._isSilentFallback(locale, key)) { + warn(`Value of key '${key}' is not a string!`); + } + return null + } + } + + // Check for the existence of links within the translated string + if (ret.indexOf('@:') >= 0 || ret.indexOf('@.') >= 0) { + ret = this._link(locale, message, ret, host, 'raw', values, visitedLinkStack); + } + + return this._render(ret, interpolateMode, values, key) + } + + _link ( + locale, + message, + str, + host, + interpolateMode, + values, + visitedLinkStack + ) { + let ret = str; + + // Match all the links within the local + // We are going to replace each of + // them with its translation + const matches = ret.match(linkKeyMatcher); + for (let idx in matches) { + // ie compatible: filter custom array + // prototype method + if (!matches.hasOwnProperty(idx)) { + continue + } + const link = matches[idx]; + const linkKeyPrefixMatches = link.match(linkKeyPrefixMatcher); + const [linkPrefix, formatterName] = linkKeyPrefixMatches; + + // Remove the leading @:, @.case: and the brackets + const linkPlaceholder = link.replace(linkPrefix, '').replace(bracketsMatcher, ''); + + if (includes(visitedLinkStack, linkPlaceholder)) { + { + warn(`Circular reference found. "${link}" is already visited in the chain of ${visitedLinkStack.reverse().join(' <- ')}`); + } + return ret + } + visitedLinkStack.push(linkPlaceholder); + + // Translate the link + let translated = this._interpolate( + locale, message, linkPlaceholder, host, + interpolateMode === 'raw' ? 'string' : interpolateMode, + interpolateMode === 'raw' ? undefined : values, + visitedLinkStack + ); + + if (this._isFallbackRoot(translated)) { + if (!this._isSilentTranslationWarn(linkPlaceholder)) { + warn(`Fall back to translate the link placeholder '${linkPlaceholder}' with root locale.`); + } + /* istanbul ignore if */ + if (!this._root) { throw Error('unexpected error') } + const root = this._root.$i18n; + translated = root._translate( + root._getMessages(), root.locale, root.fallbackLocale, + linkPlaceholder, host, interpolateMode, values + ); + } + translated = this._warnDefault( + locale, linkPlaceholder, translated, host, + Array.isArray(values) ? values : [values], + interpolateMode + ); + + if (this._modifiers.hasOwnProperty(formatterName)) { + translated = this._modifiers[formatterName](translated); + } else if (defaultModifiers.hasOwnProperty(formatterName)) { + translated = defaultModifiers[formatterName](translated); + } + + visitedLinkStack.pop(); + + // Replace the link with the translated + ret = !translated ? ret : ret.replace(link, translated); + } + + return ret + } + + _render (message, interpolateMode, values, path) { + let ret = this._formatter.interpolate(message, values, path); + + // If the custom formatter refuses to work - apply the default one + if (!ret) { + ret = defaultFormatter.interpolate(message, values, path); + } + + // if interpolateMode is **not** 'string' ('row'), + // return the compiled data (e.g. ['foo', VNode, 'bar']) with formatter + return interpolateMode === 'string' && !isString(ret) ? ret.join('') : ret + } + + _appendItemToChain (chain, item, blocks) { + let follow = false; + if (!includes(chain, item)) { + follow = true; + if (item) { + follow = item[item.length - 1] !== '!'; + item = item.replace(/!/g, ''); + chain.push(item); + if (blocks && blocks[item]) { + follow = blocks[item]; + } + } + } + return follow + } + + _appendLocaleToChain (chain, locale, blocks) { + let follow; + const tokens = locale.split('-'); + do { + const item = tokens.join('-'); + follow = this._appendItemToChain(chain, item, blocks); + tokens.splice(-1, 1); + } while (tokens.length && (follow === true)) + return follow + } + + _appendBlockToChain (chain, block, blocks) { + let follow = true; + for (let i = 0; (i < block.length) && (isBoolean(follow)); i++) { + const locale = block[i]; + if (isString(locale)) { + follow = this._appendLocaleToChain(chain, locale, blocks); + } + } + return follow + } + + _getLocaleChain (start, fallbackLocale) { + if (start === '') { return [] } + + if (!this._localeChainCache) { + this._localeChainCache = {}; + } + + let chain = this._localeChainCache[start]; + if (!chain) { + if (!fallbackLocale) { + fallbackLocale = this.fallbackLocale; + } + chain = []; + + // first block defined by start + let block = [start]; + + // while any intervening block found + while (isArray(block)) { + block = this._appendBlockToChain( + chain, + block, + fallbackLocale + ); + } + + // last block defined by default + let defaults; + if (isArray(fallbackLocale)) { + defaults = fallbackLocale; + } else if (isObject(fallbackLocale)) { + /* $FlowFixMe */ + if (fallbackLocale['default']) { + defaults = fallbackLocale['default']; + } else { + defaults = null; + } + } else { + defaults = fallbackLocale; + } + + // convert defaults to array + if (isString(defaults)) { + block = [defaults]; + } else { + block = defaults; + } + if (block) { + this._appendBlockToChain( + chain, + block, + null + ); + } + this._localeChainCache[start] = chain; + } + return chain + } + + _translate ( + messages, + locale, + fallback, + key, + host, + interpolateMode, + args + ) { + const chain = this._getLocaleChain(locale, fallback); + let res; + for (let i = 0; i < chain.length; i++) { + const step = chain[i]; + res = + this._interpolate(step, messages[step], key, host, interpolateMode, args, [key]); + if (!isNull(res)) { + if (step !== locale && "development" !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) { + warn(("Fall back to translate the keypath '" + key + "' with '" + step + "' locale.")); + } + return res + } + } + return null + } + + _t (key, _locale, messages, host, ...values) { + if (!key) { return '' } + + const parsedArgs = parseArgs(...values); + const locale = parsedArgs.locale || _locale; + + let ret = this._translate( + messages, locale, this.fallbackLocale, key, + host, 'string', parsedArgs.params + ); + if (this._isFallbackRoot(ret)) { + if (!this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) { + warn(`Fall back to translate the keypath '${key}' with root locale.`); + } + /* istanbul ignore if */ + if (!this._root) { throw Error('unexpected error') } + return this._root.$t(key, ...values) + } else { + ret = this._warnDefault(locale, key, ret, host, values, 'string'); + if (this._postTranslation && ret !== null && ret !== undefined) { + ret = this._postTranslation(ret, key); + } + return ret + } + } + + t (key, ...values) { + return this._t(key, this.locale, this._getMessages(), null, ...values) + } + + _i (key, locale, messages, host, values) { + const ret = + this._translate(messages, locale, this.fallbackLocale, key, host, 'raw', values); + if (this._isFallbackRoot(ret)) { + if (!this._isSilentTranslationWarn(key)) { + warn(`Fall back to interpolate the keypath '${key}' with root locale.`); + } + if (!this._root) { throw Error('unexpected error') } + return this._root.$i18n.i(key, locale, values) + } else { + return this._warnDefault(locale, key, ret, host, [values], 'raw') + } + } + + i (key, locale, values) { + /* istanbul ignore if */ + if (!key) { return '' } + + if (!isString(locale)) { + locale = this.locale; + } + + return this._i(key, locale, this._getMessages(), null, values) + } + + _tc ( + key, + _locale, + messages, + host, + choice, + ...values + ) { + if (!key) { return '' } + if (choice === undefined) { + choice = 1; + } + + const predefined = { 'count': choice, 'n': choice }; + const parsedArgs = parseArgs(...values); + parsedArgs.params = Object.assign(predefined, parsedArgs.params); + values = parsedArgs.locale === null ? [parsedArgs.params] : [parsedArgs.locale, parsedArgs.params]; + return this.fetchChoice(this._t(key, _locale, messages, host, ...values), choice) + } + + fetchChoice (message, choice) { + /* istanbul ignore if */ + if (!message && !isString(message)) { return null } + const choices = message.split('|'); + + choice = this.getChoiceIndex(choice, choices.length); + if (!choices[choice]) { return message } + return choices[choice].trim() + } + + tc (key, choice, ...values) { + return this._tc(key, this.locale, this._getMessages(), null, choice, ...values) + } + + _te (key, locale, messages, ...args) { + const _locale = parseArgs(...args).locale || locale; + return this._exist(messages[_locale], key) + } + + te (key, locale) { + return this._te(key, this.locale, this._getMessages(), locale) + } + + getLocaleMessage (locale) { + return looseClone(this._vm.messages[locale] || {}) + } + + setLocaleMessage (locale, message) { + if (this._warnHtmlInMessage === 'warn' || this._warnHtmlInMessage === 'error') { + this._checkLocaleMessage(locale, this._warnHtmlInMessage, message); + } + this._vm.$set(this._vm.messages, locale, message); + } + + mergeLocaleMessage (locale, message) { + if (this._warnHtmlInMessage === 'warn' || this._warnHtmlInMessage === 'error') { + this._checkLocaleMessage(locale, this._warnHtmlInMessage, message); + } + this._vm.$set(this._vm.messages, locale, merge({}, this._vm.messages[locale] || {}, message)); + } + + getDateTimeFormat (locale) { + return looseClone(this._vm.dateTimeFormats[locale] || {}) + } + + setDateTimeFormat (locale, format) { + this._vm.$set(this._vm.dateTimeFormats, locale, format); + this._clearDateTimeFormat(locale, format); + } + + mergeDateTimeFormat (locale, format) { + this._vm.$set(this._vm.dateTimeFormats, locale, merge(this._vm.dateTimeFormats[locale] || {}, format)); + this._clearDateTimeFormat(locale, format); + } + + _clearDateTimeFormat (locale, format) { + for (let key in format) { + const id = `${locale}__${key}`; + + if (!this._dateTimeFormatters.hasOwnProperty(id)) { + continue + } + + delete this._dateTimeFormatters[id]; + } + } + + _localizeDateTime ( + value, + locale, + fallback, + dateTimeFormats, + key + ) { + let _locale = locale; + let formats = dateTimeFormats[_locale]; + + const chain = this._getLocaleChain(locale, fallback); + for (let i = 0; i < chain.length; i++) { + const current = _locale; + const step = chain[i]; + formats = dateTimeFormats[step]; + _locale = step; + // fallback locale + if (isNull(formats) || isNull(formats[key])) { + if (step !== locale && "development" !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) { + warn(`Fall back to '${step}' datetime formats from '${current}' datetime formats.`); + } + } else { + break + } + } + + if (isNull(formats) || isNull(formats[key])) { + return null + } else { + const format = formats[key]; + const id = `${_locale}__${key}`; + let formatter = this._dateTimeFormatters[id]; + if (!formatter) { + formatter = this._dateTimeFormatters[id] = new Intl.DateTimeFormat(_locale, format); + } + return formatter.format(value) + } + } + + _d (value, locale, key) { + /* istanbul ignore if */ + if (!VueI18n.availabilities.dateTimeFormat) { + warn('Cannot format a Date value due to not supported Intl.DateTimeFormat.'); + return '' + } + + if (!key) { + return new Intl.DateTimeFormat(locale).format(value) + } + + const ret = + this._localizeDateTime(value, locale, this.fallbackLocale, this._getDateTimeFormats(), key); + if (this._isFallbackRoot(ret)) { + if (!this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) { + warn(`Fall back to datetime localization of root: key '${key}'.`); + } + /* istanbul ignore if */ + if (!this._root) { throw Error('unexpected error') } + return this._root.$i18n.d(value, key, locale) + } else { + return ret || '' + } + } + + d (value, ...args) { + let locale = this.locale; + let key = null; + + if (args.length === 1) { + if (isString(args[0])) { + key = args[0]; + } else if (isObject(args[0])) { + if (args[0].locale) { + locale = args[0].locale; + } + if (args[0].key) { + key = args[0].key; + } + } + } else if (args.length === 2) { + if (isString(args[0])) { + key = args[0]; + } + if (isString(args[1])) { + locale = args[1]; + } + } + + return this._d(value, locale, key) + } + + getNumberFormat (locale) { + return looseClone(this._vm.numberFormats[locale] || {}) + } + + setNumberFormat (locale, format) { + this._vm.$set(this._vm.numberFormats, locale, format); + this._clearNumberFormat(locale, format); + } + + mergeNumberFormat (locale, format) { + this._vm.$set(this._vm.numberFormats, locale, merge(this._vm.numberFormats[locale] || {}, format)); + this._clearNumberFormat(locale, format); + } + + _clearNumberFormat (locale, format) { + for (let key in format) { + const id = `${locale}__${key}`; + + if (!this._numberFormatters.hasOwnProperty(id)) { + continue + } + + delete this._numberFormatters[id]; + } + } + + _getNumberFormatter ( + value, + locale, + fallback, + numberFormats, + key, + options + ) { + let _locale = locale; + let formats = numberFormats[_locale]; + + const chain = this._getLocaleChain(locale, fallback); + for (let i = 0; i < chain.length; i++) { + const current = _locale; + const step = chain[i]; + formats = numberFormats[step]; + _locale = step; + // fallback locale + if (isNull(formats) || isNull(formats[key])) { + if (step !== locale && "development" !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) { + warn(`Fall back to '${step}' number formats from '${current}' number formats.`); + } + } else { + break + } + } + + if (isNull(formats) || isNull(formats[key])) { + return null + } else { + const format = formats[key]; + + let formatter; + if (options) { + // If options specified - create one time number formatter + formatter = new Intl.NumberFormat(_locale, Object.assign({}, format, options)); + } else { + const id = `${_locale}__${key}`; + formatter = this._numberFormatters[id]; + if (!formatter) { + formatter = this._numberFormatters[id] = new Intl.NumberFormat(_locale, format); + } + } + return formatter + } + } + + _n (value, locale, key, options) { + /* istanbul ignore if */ + if (!VueI18n.availabilities.numberFormat) { + { + warn('Cannot format a Number value due to not supported Intl.NumberFormat.'); + } + return '' + } + + if (!key) { + const nf = !options ? new Intl.NumberFormat(locale) : new Intl.NumberFormat(locale, options); + return nf.format(value) + } + + const formatter = this._getNumberFormatter(value, locale, this.fallbackLocale, this._getNumberFormats(), key, options); + const ret = formatter && formatter.format(value); + if (this._isFallbackRoot(ret)) { + if (!this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) { + warn(`Fall back to number localization of root: key '${key}'.`); + } + /* istanbul ignore if */ + if (!this._root) { throw Error('unexpected error') } + return this._root.$i18n.n(value, Object.assign({}, { key, locale }, options)) + } else { + return ret || '' + } + } + + n (value, ...args) { + let locale = this.locale; + let key = null; + let options = null; + + if (args.length === 1) { + if (isString(args[0])) { + key = args[0]; + } else if (isObject(args[0])) { + if (args[0].locale) { + locale = args[0].locale; + } + if (args[0].key) { + key = args[0].key; + } + + // Filter out number format options only + options = Object.keys(args[0]).reduce((acc, key) => { + if (includes(numberFormatKeys, key)) { + return Object.assign({}, acc, { [key]: args[0][key] }) + } + return acc + }, null); + } + } else if (args.length === 2) { + if (isString(args[0])) { + key = args[0]; + } + if (isString(args[1])) { + locale = args[1]; + } + } + + return this._n(value, locale, key, options) + } + + _ntp (value, locale, key, options) { + /* istanbul ignore if */ + if (!VueI18n.availabilities.numberFormat) { + { + warn('Cannot format to parts a Number value due to not supported Intl.NumberFormat.'); + } + return [] + } + + if (!key) { + const nf = !options ? new Intl.NumberFormat(locale) : new Intl.NumberFormat(locale, options); + return nf.formatToParts(value) + } + + const formatter = this._getNumberFormatter(value, locale, this.fallbackLocale, this._getNumberFormats(), key, options); + const ret = formatter && formatter.formatToParts(value); + if (this._isFallbackRoot(ret)) { + if (!this._isSilentTranslationWarn(key)) { + warn(`Fall back to format number to parts of root: key '${key}' .`); + } + /* istanbul ignore if */ + if (!this._root) { throw Error('unexpected error') } + return this._root.$i18n._ntp(value, locale, key, options) + } else { + return ret || [] + } + } +} + +let availabilities; +// $FlowFixMe +Object.defineProperty(VueI18n, 'availabilities', { + get () { + if (!availabilities) { + const intlDefined = typeof Intl !== 'undefined'; + availabilities = { + dateTimeFormat: intlDefined && typeof Intl.DateTimeFormat !== 'undefined', + numberFormat: intlDefined && typeof Intl.NumberFormat !== 'undefined' + }; + } + + return availabilities + } +}); + +VueI18n.install = install; +VueI18n.version = '8.20.0'; + +export default VueI18n; diff --git a/node_modules/vue-i18n/dist/vue-i18n.esm.browser.min.js b/node_modules/vue-i18n/dist/vue-i18n.esm.browser.min.js new file mode 100644 index 0000000..fa3c3cd --- /dev/null +++ b/node_modules/vue-i18n/dist/vue-i18n.esm.browser.min.js @@ -0,0 +1 @@ +const t=["style","currency","currencyDisplay","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","localeMatcher","formatMatcher","unit"];function e(t,e){"undefined"!=typeof console&&(console.warn("[vue-i18n] "+t),e&&console.warn(e.stack))}const n=Array.isArray;function s(t){return null!==t&&"object"==typeof t}function r(t){return"string"==typeof t}const a=Object.prototype.toString,i="[object Object]";function o(t){return a.call(t)===i}function l(t){return null==t}function c(...t){let e=null,n=null;return 1===t.length?s(t[0])||Array.isArray(t[0])?n=t[0]:"string"==typeof t[0]&&(e=t[0]):2===t.length&&("string"==typeof t[0]&&(e=t[0]),(s(t[1])||Array.isArray(t[1]))&&(n=t[1])),{locale:e,params:n}}function h(t){return JSON.parse(JSON.stringify(t))}function u(t,e){return!!~t.indexOf(e)}const m=Object.prototype.hasOwnProperty;function _(t,e){return m.call(t,e)}function f(t){const e=Object(t);for(let t=1;tp(t,e[n]));if(n||s)return!1;{const n=Object.keys(t),s=Object.keys(e);return n.length===s.length&&n.every(n=>p(t[n],e[n]))}}catch(t){return!1}}var g={beforeCreate(){const t=this.$options;if(t.i18n=t.i18n||(t.__i18n?{}:null),t.i18n){if(t.i18n instanceof Y){if(t.__i18n)try{let e={};t.__i18n.forEach(t=>{e=f(e,JSON.parse(t))}),Object.keys(e).forEach(n=>{t.i18n.mergeLocaleMessage(n,e[n])})}catch(t){}this._i18n=t.i18n,this._i18nWatcher=this._i18n.watchI18nData()}else if(o(t.i18n)){const e=this.$root&&this.$root.$i18n&&this.$root.$i18n instanceof Y?this.$root.$i18n:null;if(e&&(t.i18n.root=this.$root,t.i18n.formatter=e.formatter,t.i18n.fallbackLocale=e.fallbackLocale,t.i18n.formatFallbackMessages=e.formatFallbackMessages,t.i18n.silentTranslationWarn=e.silentTranslationWarn,t.i18n.silentFallbackWarn=e.silentFallbackWarn,t.i18n.pluralizationRules=e.pluralizationRules,t.i18n.preserveDirectiveContent=e.preserveDirectiveContent),t.__i18n)try{let e={};t.__i18n.forEach(t=>{e=f(e,JSON.parse(t))}),t.i18n.messages=e}catch(t){}const{sharedMessages:n}=t.i18n;n&&o(n)&&(t.i18n.messages=f(t.i18n.messages,n)),this._i18n=new Y(t.i18n),this._i18nWatcher=this._i18n.watchI18nData(),(void 0===t.i18n.sync||t.i18n.sync)&&(this._localeWatcher=this.$i18n.watchLocale()),e&&e.onComponentInstanceCreated(this._i18n)}}else this.$root&&this.$root.$i18n&&this.$root.$i18n instanceof Y?this._i18n=this.$root.$i18n:t.parent&&t.parent.$i18n&&t.parent.$i18n instanceof Y&&(this._i18n=t.parent.$i18n)},beforeMount(){const t=this.$options;t.i18n=t.i18n||(t.__i18n?{}:null),t.i18n?t.i18n instanceof Y?(this._i18n.subscribeDataChanging(this),this._subscribing=!0):o(t.i18n)&&(this._i18n.subscribeDataChanging(this),this._subscribing=!0):this.$root&&this.$root.$i18n&&this.$root.$i18n instanceof Y?(this._i18n.subscribeDataChanging(this),this._subscribing=!0):t.parent&&t.parent.$i18n&&t.parent.$i18n instanceof Y&&(this._i18n.subscribeDataChanging(this),this._subscribing=!0)},beforeDestroy(){if(!this._i18n)return;const t=this;this.$nextTick(()=>{t._subscribing&&(t._i18n.unsubscribeDataChanging(t),delete t._subscribing),t._i18nWatcher&&(t._i18nWatcher(),t._i18n.destroyVM(),delete t._i18nWatcher),t._localeWatcher&&(t._localeWatcher(),delete t._localeWatcher)})}},d={name:"i18n",functional:!0,props:{tag:{type:[String,Boolean,Object],default:"span"},path:{type:String,required:!0},locale:{type:String},places:{type:[Array,Object]}},render(t,{data:e,parent:n,props:s,slots:r}){const{$i18n:a}=n;if(!a)return;const{path:i,locale:o,places:l}=s,c=r(),h=a.i(i,o,function(t){let e;for(e in t)if("default"!==e)return!1;return Boolean(e)}(c)||l?function(t,e){const n=e?function(t){return Array.isArray(t)?t.reduce(v,{}):Object.assign({},t)}(e):{};if(!t)return n;const s=(t=t.filter(t=>t.tag||""!==t.text.trim())).every(y);return t.reduce(s?b:v,n)}(c.default,l):c),u=s.tag&&!0!==s.tag||!1===s.tag?s.tag:"span";return u?t(u,e,h):h}};function b(t,e){return e.data&&e.data.attrs&&e.data.attrs.place&&(t[e.data.attrs.place]=e),t}function v(t,e,n){return t[n]=e,t}function y(t){return Boolean(t.data&&t.data.attrs&&t.data.attrs.place)}var F={name:"i18n-n",functional:!0,props:{tag:{type:[String,Boolean,Object],default:"span"},value:{type:Number,required:!0},format:{type:[String,Object]},locale:{type:String}},render(e,{props:n,parent:a,data:i}){const o=a.$i18n;if(!o)return null;let l=null,c=null;r(n.format)?l=n.format:s(n.format)&&(n.format.key&&(l=n.format.key),c=Object.keys(n.format).reduce((e,s)=>u(t,s)?Object.assign({},e,{[s]:n.format[s]}):e,null));const h=n.locale||o.locale,m=o._ntp(n.value,h,l,c),_=m.map((t,e)=>{const n=i.scopedSlots&&i.scopedSlots[t.type];return n?n({[t.type]:t.value,index:e,parts:m}):t.value}),f=n.tag&&!0!==n.tag||!1===n.tag?n.tag:"span";return f?e(f,{attrs:i.attrs,class:i.class,staticClass:i.staticClass},_):_}};function k(t,e,n){M(t,n)&&C(t,e,n)}function $(t,e,n,s){if(!M(t,n))return;const r=n.context.$i18n;(function(t,e){const n=e.context;return t._locale===n.$i18n.locale})(t,n)&&p(e.value,e.oldValue)&&p(t._localeMessage,r.getLocaleMessage(r.locale))||C(t,e,n)}function w(t,n,s,r){if(!s.context)return void e("Vue instance does not exists in VNode context");const a=s.context.$i18n||{};n.modifiers.preserve||a.preserveDirectiveContent||(t.textContent=""),t._vt=void 0,delete t._vt,t._locale=void 0,delete t._locale,t._localeMessage=void 0,delete t._localeMessage}function M(t,n){const s=n.context;return s?!!s.$i18n||(e("VueI18n instance does not exists in Vue instance"),!1):(e("Vue instance does not exists in VNode context"),!1)}function C(t,n,s){const a=n.value,{path:i,locale:l,args:c,choice:h}=function(t){let e,n,s,a;r(t)?e=t:o(t)&&(e=t.path,n=t.locale,s=t.args,a=t.choice);return{path:e,locale:n,args:s,choice:a}}(a);if(!i&&!l&&!c)return void e("value type not supported");if(!i)return void e("`path` is required in v-t directive");const u=s.context;t._vt=t.textContent=null!=h?u.$i18n.tc(i,h,...T(l,c)):u.$i18n.t(i,...T(l,c)),t._locale=u.$i18n.locale,t._localeMessage=u.$i18n.getLocaleMessage(u.$i18n.locale)}function T(t,e){const n=[];return t&&n.push(t),e&&(Array.isArray(e)||o(e))&&n.push(e),n}let L;function D(t){D.installed=!0;(L=t).version&&Number(L.version.split(".")[0]);!function(t){t.prototype.hasOwnProperty("$i18n")||Object.defineProperty(t.prototype,"$i18n",{get(){return this._i18n}}),t.prototype.$t=function(t,...e){const n=this.$i18n;return n._t(t,n.locale,n._getMessages(),this,...e)},t.prototype.$tc=function(t,e,...n){const s=this.$i18n;return s._tc(t,s.locale,s._getMessages(),this,e,...n)},t.prototype.$te=function(t,e){const n=this.$i18n;return n._te(t,n.locale,n._getMessages(),e)},t.prototype.$d=function(t,...e){return this.$i18n.d(t,...e)},t.prototype.$n=function(t,...e){return this.$i18n.n(t,...e)}}(L),L.mixin(g),L.directive("t",{bind:k,update:$,unbind:w}),L.component(d.name,d),L.component(F.name,F),L.config.optionMergeStrategies.i18n=function(t,e){return void 0===e?t:e}}const I=/^(?:\d)+/,O=/^(?:\w)+/;const x=0,W=1,j=2,N=3,A=0,S=4,R=5,H=6,P=7,V=8,E=[];E[A]={ws:[A],ident:[3,x],"[":[S],eof:[P]},E[1]={ws:[1],".":[2],"[":[S],eof:[P]},E[2]={ws:[2],ident:[3,x],0:[3,x],number:[3,x]},E[3]={ident:[3,x],0:[3,x],number:[3,x],ws:[1,W],".":[2,W],"[":[S,W],eof:[P,W]},E[S]={"'":[R,x],'"':[H,x],"[":[S,j],"]":[1,N],eof:V,else:[S,x]},E[R]={"'":[S,x],eof:V,else:[R,x]},E[H]={'"':[S,x],eof:V,else:[H,x]};const z=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function B(t){if(null==t)return"eof";switch(t.charCodeAt(0)){case 91:case 93:case 46:case 34:case 39:return t;case 95:case 36:case 45:return"ident";case 9:case 10:case 13:case 160:case 65279:case 8232:case 8233:return"ws"}return"ident"}function U(t){const e=t.trim();return("0"!==t.charAt(0)||!isNaN(t))&&(n=e,z.test(n)?function(t){const e=t.charCodeAt(0);return e!==t.charCodeAt(t.length-1)||34!==e&&39!==e?t:t.slice(1,-1)}(e):"*"+e);var n}class J{constructor(){this._cache=Object.create(null)}parsePath(t){let e=this._cache[t];return e||(e=function(t){const e=[];let n,s,r,a,i,o,l,c=-1,h=A,u=0;const m=[];function _(){const e=t[c+1];if(h===R&&"'"===e||h===H&&'"'===e)return c++,r="\\"+e,m[x](),!0}for(m[W]=function(){void 0!==s&&(e.push(s),s=void 0)},m[x]=function(){void 0===s?s=r:s+=r},m[j]=function(){m[x](),u++},m[N]=function(){if(u>0)u--,h=S,m[x]();else{if(u=0,void 0===s)return!1;if(!1===(s=U(s)))return!1;m[W]()}};null!==h;)if("\\"!==(n=t[++c])||!_()){if(a=B(n),(i=(l=E[h])[a]||l.else||V)===V)return;if(h=i[0],(o=m[i[1]])&&(r=void 0===(r=i[2])?n:r,!1===o()))return;if(h===P)return e}}(t))&&(this._cache[t]=e),e||[]}getPathValue(t,e){if(!s(t))return null;const n=this.parsePath(e);if(0===n.length)return null;{const e=n.length;let s=t,r=0;for(;r/,G=/(?:@(?:\.[a-z]+)?:(?:[\w\-_|.]+|\([\w\-_|.]+\)))/g,X=/^@(?:\.([a-z]+))?:/,Z=/[()]/g,K={upper:t=>t.toLocaleUpperCase(),lower:t=>t.toLocaleLowerCase(),capitalize:t=>`${t.charAt(0).toLocaleUpperCase()}${t.substr(1)}`},Q=new class{constructor(){this._caches=Object.create(null)}interpolate(t,e){if(!e)return[t];let n=this._caches[t];return n||(n=function(t){const e=[];let n=0,s="";for(;n{const n=Object.getPrototypeOf(this);if(n&&n.getChoiceIndex){return n.getChoiceIndex.call(this,t,e)}return this.locale in this.pluralizationRules?this.pluralizationRules[this.locale].apply(this,[t,e]):((t,e)=>(t=Math.abs(t),2===e?t?t>1?1:0:1:t?Math.min(t,2):0))(t,e)}),this._exist=((t,e)=>!(!t||!e)&&(!l(this._path.getPathValue(t,e))||!!t[e])),"warn"!==this._warnHtmlInMessage&&"error"!==this._warnHtmlInMessage||Object.keys(s).forEach(t=>{this._checkLocaleMessage(t,this._warnHtmlInMessage,s[t])}),this._initVM({locale:e,fallbackLocale:n,messages:s,dateTimeFormats:r,numberFormats:a})}_checkLocaleMessage(t,n,s){const a=(t,n,s,i)=>{if(o(s))Object.keys(s).forEach(e=>{const r=s[e];o(r)?(i.push(e),i.push("."),a(t,n,r,i),i.pop(),i.pop()):(i.push(e),a(t,n,r,i),i.pop())});else if(Array.isArray(s))s.forEach((e,s)=>{o(e)?(i.push(`[${s}]`),i.push("."),a(t,n,e,i),i.pop(),i.pop()):(i.push(`[${s}]`),a(t,n,e,i),i.pop())});else if(r(s)){if(q.test(s)){const r=`Detected HTML in message '${s}' of keypath '${i.join("")}' at '${n}'. Consider component interpolation with '' to avoid XSS. See https://bit.ly/2ZqJzkp`;"warn"===t?e(r):"error"===t&&function(t,e){"undefined"!=typeof console&&(console.error("[vue-i18n] "+t),e&&console.error(e.stack))}(r)}}};a(n,t,s,[])}_initVM(t){const e=L.config.silent;L.config.silent=!0,this._vm=new L({data:t}),L.config.silent=e}destroyVM(){this._vm.$destroy()}subscribeDataChanging(t){this._dataListeners.push(t)}unsubscribeDataChanging(t){!function(t,e){if(t.length){const n=t.indexOf(e);if(n>-1)t.splice(n,1)}}(this._dataListeners,t)}watchI18nData(){const t=this;return this._vm.$watch("$data",()=>{let e=t._dataListeners.length;for(;e--;)L.nextTick(()=>{t._dataListeners[e]&&t._dataListeners[e].$forceUpdate()})},{deep:!0})}watchLocale(){if(!this._sync||!this._root)return null;const t=this._vm;return this._root.$i18n.vm.$watch("locale",e=>{t.$set(t,"locale",e),t.$forceUpdate()},{immediate:!0})}onComponentInstanceCreated(t){this._componentInstanceCreatedListener&&this._componentInstanceCreatedListener(t,this)}get vm(){return this._vm}get messages(){return h(this._getMessages())}get dateTimeFormats(){return h(this._getDateTimeFormats())}get numberFormats(){return h(this._getNumberFormats())}get availableLocales(){return Object.keys(this.messages).sort()}get locale(){return this._vm.locale}set locale(t){this._vm.$set(this._vm,"locale",t)}get fallbackLocale(){return this._vm.fallbackLocale}set fallbackLocale(t){this._localeChainCache={},this._vm.$set(this._vm,"fallbackLocale",t)}get formatFallbackMessages(){return this._formatFallbackMessages}set formatFallbackMessages(t){this._formatFallbackMessages=t}get missing(){return this._missing}set missing(t){this._missing=t}get formatter(){return this._formatter}set formatter(t){this._formatter=t}get silentTranslationWarn(){return this._silentTranslationWarn}set silentTranslationWarn(t){this._silentTranslationWarn=t}get silentFallbackWarn(){return this._silentFallbackWarn}set silentFallbackWarn(t){this._silentFallbackWarn=t}get preserveDirectiveContent(){return this._preserveDirectiveContent}set preserveDirectiveContent(t){this._preserveDirectiveContent=t}get warnHtmlInMessage(){return this._warnHtmlInMessage}set warnHtmlInMessage(t){const e=this._warnHtmlInMessage;if(this._warnHtmlInMessage=t,e!==t&&("warn"===t||"error"===t)){const t=this._getMessages();Object.keys(t).forEach(e=>{this._checkLocaleMessage(e,this._warnHtmlInMessage,t[e])})}}get postTranslation(){return this._postTranslation}set postTranslation(t){this._postTranslation=t}_getMessages(){return this._vm.messages}_getDateTimeFormats(){return this._vm.dateTimeFormats}_getNumberFormats(){return this._vm.numberFormats}_warnDefault(t,e,n,s,a,i){if(!l(n))return n;if(this._missing){const n=this._missing.apply(null,[t,e,s,a]);if(r(n))return n}if(this._formatFallbackMessages){const t=c(...a);return this._render(e,i,t.params,e)}return e}_isFallbackRoot(t){return!t&&!l(this._root)&&this._fallbackRoot}_isSilentFallbackWarn(t){return this._silentFallbackWarn instanceof RegExp?this._silentFallbackWarn.test(t):this._silentFallbackWarn}_isSilentFallback(t,e){return this._isSilentFallbackWarn(e)&&(this._isFallbackRoot()||t!==this.fallbackLocale)}_isSilentTranslationWarn(t){return this._silentTranslationWarn instanceof RegExp?this._silentTranslationWarn.test(t):this._silentTranslationWarn}_interpolate(t,e,n,s,a,i,c){if(!e)return null;const h=this._path.getPathValue(e,n);if(Array.isArray(h)||o(h))return h;let u;if(l(h)){if(!o(e))return null;if(!r(u=e[n]))return null}else{if(!r(h))return null;u=h}return(u.indexOf("@:")>=0||u.indexOf("@.")>=0)&&(u=this._link(t,e,u,s,"raw",i,c)),this._render(u,a,i,n)}_link(t,e,n,s,r,a,i){let o=n;const l=o.match(G);for(let n in l){if(!l.hasOwnProperty(n))continue;const c=l[n],h=c.match(X),[m,_]=h,f=c.replace(m,"").replace(Z,"");if(u(i,f))return o;i.push(f);let p=this._interpolate(t,e,f,s,"raw"===r?"string":r,"raw"===r?void 0:a,i);if(this._isFallbackRoot(p)){if(!this._root)throw Error("unexpected error");const t=this._root.$i18n;p=t._translate(t._getMessages(),t.locale,t.fallbackLocale,f,s,r,a)}p=this._warnDefault(t,f,p,s,Array.isArray(a)?a:[a],r),this._modifiers.hasOwnProperty(_)?p=this._modifiers[_](p):K.hasOwnProperty(_)&&(p=K[_](p)),i.pop(),o=p?o.replace(c,p):o}return o}_render(t,e,n,s){let a=this._formatter.interpolate(t,n,s);return a||(a=Q.interpolate(t,n,s)),"string"!==e||r(a)?a:a.join("")}_appendItemToChain(t,e,n){let s=!1;return u(t,e)||(s=!0,e&&(s="!"!==e[e.length-1],e=e.replace(/!/g,""),t.push(e),n&&n[e]&&(s=n[e]))),s}_appendLocaleToChain(t,e,n){let s;const r=e.split("-");do{const e=r.join("-");s=this._appendItemToChain(t,e,n),r.splice(-1,1)}while(r.length&&!0===s);return s}_appendBlockToChain(t,e,n){let s=!0;for(let a=0;au(t,s)?Object.assign({},e,{[s]:n[0][s]}):e,null)):2===n.length&&(r(n[0])&&(i=n[0]),r(n[1])&&(a=n[1])),this._n(e,a,i,o)}_ntp(t,e,n,s){if(!Y.availabilities.numberFormat)return[];if(!n){return(s?new Intl.NumberFormat(e,s):new Intl.NumberFormat(e)).formatToParts(t)}const r=this._getNumberFormatter(t,e,this.fallbackLocale,this._getNumberFormats(),n,s),a=r&&r.formatToParts(t);if(this._isFallbackRoot(a)){if(!this._root)throw Error("unexpected error");return this._root.$i18n._ntp(t,e,n,s)}return a||[]}}let tt;Object.defineProperty(Y,"availabilities",{get(){if(!tt){const t="undefined"!=typeof Intl;tt={dateTimeFormat:t&&void 0!==Intl.DateTimeFormat,numberFormat:t&&void 0!==Intl.NumberFormat}}return tt}}),Y.install=D,Y.version="8.20.0";export default Y; \ No newline at end of file diff --git a/node_modules/vue-i18n/dist/vue-i18n.esm.js b/node_modules/vue-i18n/dist/vue-i18n.esm.js new file mode 100644 index 0000000..676850a --- /dev/null +++ b/node_modules/vue-i18n/dist/vue-i18n.esm.js @@ -0,0 +1,2130 @@ +/*! + * vue-i18n v8.20.0 + * (c) 2020 kazuya kawaguchi + * Released under the MIT License. + */ +/* */ + +/** + * constants + */ + +var numberFormatKeys = [ + 'style', + 'currency', + 'currencyDisplay', + 'useGrouping', + 'minimumIntegerDigits', + 'minimumFractionDigits', + 'maximumFractionDigits', + 'minimumSignificantDigits', + 'maximumSignificantDigits', + 'localeMatcher', + 'formatMatcher', + 'unit' +]; + +/** + * utilities + */ + +function warn (msg, err) { + if (typeof console !== 'undefined') { + console.warn('[vue-i18n] ' + msg); + /* istanbul ignore if */ + if (err) { + console.warn(err.stack); + } + } +} + +function error (msg, err) { + if (typeof console !== 'undefined') { + console.error('[vue-i18n] ' + msg); + /* istanbul ignore if */ + if (err) { + console.error(err.stack); + } + } +} + +var isArray = Array.isArray; + +function isObject (obj) { + return obj !== null && typeof obj === 'object' +} + +function isBoolean (val) { + return typeof val === 'boolean' +} + +function isString (val) { + return typeof val === 'string' +} + +var toString = Object.prototype.toString; +var OBJECT_STRING = '[object Object]'; +function isPlainObject (obj) { + return toString.call(obj) === OBJECT_STRING +} + +function isNull (val) { + return val === null || val === undefined +} + +function parseArgs () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + var locale = null; + var params = null; + if (args.length === 1) { + if (isObject(args[0]) || Array.isArray(args[0])) { + params = args[0]; + } else if (typeof args[0] === 'string') { + locale = args[0]; + } + } else if (args.length === 2) { + if (typeof args[0] === 'string') { + locale = args[0]; + } + /* istanbul ignore if */ + if (isObject(args[1]) || Array.isArray(args[1])) { + params = args[1]; + } + } + + return { locale: locale, params: params } +} + +function looseClone (obj) { + return JSON.parse(JSON.stringify(obj)) +} + +function remove (arr, item) { + if (arr.length) { + var index = arr.indexOf(item); + if (index > -1) { + return arr.splice(index, 1) + } + } +} + +function includes (arr, item) { + return !!~arr.indexOf(item) +} + +var hasOwnProperty = Object.prototype.hasOwnProperty; +function hasOwn (obj, key) { + return hasOwnProperty.call(obj, key) +} + +function merge (target) { + var arguments$1 = arguments; + + var output = Object(target); + for (var i = 1; i < arguments.length; i++) { + var source = arguments$1[i]; + if (source !== undefined && source !== null) { + var key = (void 0); + for (key in source) { + if (hasOwn(source, key)) { + if (isObject(source[key])) { + output[key] = merge(output[key], source[key]); + } else { + output[key] = source[key]; + } + } + } + } + } + return output +} + +function looseEqual (a, b) { + if (a === b) { return true } + var isObjectA = isObject(a); + var isObjectB = isObject(b); + if (isObjectA && isObjectB) { + try { + var isArrayA = Array.isArray(a); + var isArrayB = Array.isArray(b); + if (isArrayA && isArrayB) { + return a.length === b.length && a.every(function (e, i) { + return looseEqual(e, b[i]) + }) + } else if (!isArrayA && !isArrayB) { + var keysA = Object.keys(a); + var keysB = Object.keys(b); + return keysA.length === keysB.length && keysA.every(function (key) { + return looseEqual(a[key], b[key]) + }) + } else { + /* istanbul ignore next */ + return false + } + } catch (e) { + /* istanbul ignore next */ + return false + } + } else if (!isObjectA && !isObjectB) { + return String(a) === String(b) + } else { + return false + } +} + +/* */ + +function extend (Vue) { + if (!Vue.prototype.hasOwnProperty('$i18n')) { + // $FlowFixMe + Object.defineProperty(Vue.prototype, '$i18n', { + get: function get () { return this._i18n } + }); + } + + Vue.prototype.$t = function (key) { + var values = [], len = arguments.length - 1; + while ( len-- > 0 ) values[ len ] = arguments[ len + 1 ]; + + var i18n = this.$i18n; + return i18n._t.apply(i18n, [ key, i18n.locale, i18n._getMessages(), this ].concat( values )) + }; + + Vue.prototype.$tc = function (key, choice) { + var values = [], len = arguments.length - 2; + while ( len-- > 0 ) values[ len ] = arguments[ len + 2 ]; + + var i18n = this.$i18n; + return i18n._tc.apply(i18n, [ key, i18n.locale, i18n._getMessages(), this, choice ].concat( values )) + }; + + Vue.prototype.$te = function (key, locale) { + var i18n = this.$i18n; + return i18n._te(key, i18n.locale, i18n._getMessages(), locale) + }; + + Vue.prototype.$d = function (value) { + var ref; + + var args = [], len = arguments.length - 1; + while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ]; + return (ref = this.$i18n).d.apply(ref, [ value ].concat( args )) + }; + + Vue.prototype.$n = function (value) { + var ref; + + var args = [], len = arguments.length - 1; + while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ]; + return (ref = this.$i18n).n.apply(ref, [ value ].concat( args )) + }; +} + +/* */ + +var mixin = { + beforeCreate: function beforeCreate () { + var options = this.$options; + options.i18n = options.i18n || (options.__i18n ? {} : null); + + if (options.i18n) { + if (options.i18n instanceof VueI18n) { + // init locale messages via custom blocks + if (options.__i18n) { + try { + var localeMessages = {}; + options.__i18n.forEach(function (resource) { + localeMessages = merge(localeMessages, JSON.parse(resource)); + }); + Object.keys(localeMessages).forEach(function (locale) { + options.i18n.mergeLocaleMessage(locale, localeMessages[locale]); + }); + } catch (e) { + if (process.env.NODE_ENV !== 'production') { + error("Cannot parse locale messages via custom blocks.", e); + } + } + } + this._i18n = options.i18n; + this._i18nWatcher = this._i18n.watchI18nData(); + } else if (isPlainObject(options.i18n)) { + var rootI18n = this.$root && this.$root.$i18n && this.$root.$i18n instanceof VueI18n + ? this.$root.$i18n + : null; + // component local i18n + if (rootI18n) { + options.i18n.root = this.$root; + options.i18n.formatter = rootI18n.formatter; + options.i18n.fallbackLocale = rootI18n.fallbackLocale; + options.i18n.formatFallbackMessages = rootI18n.formatFallbackMessages; + options.i18n.silentTranslationWarn = rootI18n.silentTranslationWarn; + options.i18n.silentFallbackWarn = rootI18n.silentFallbackWarn; + options.i18n.pluralizationRules = rootI18n.pluralizationRules; + options.i18n.preserveDirectiveContent = rootI18n.preserveDirectiveContent; + } + + // init locale messages via custom blocks + if (options.__i18n) { + try { + var localeMessages$1 = {}; + options.__i18n.forEach(function (resource) { + localeMessages$1 = merge(localeMessages$1, JSON.parse(resource)); + }); + options.i18n.messages = localeMessages$1; + } catch (e) { + if (process.env.NODE_ENV !== 'production') { + warn("Cannot parse locale messages via custom blocks.", e); + } + } + } + + var ref = options.i18n; + var sharedMessages = ref.sharedMessages; + if (sharedMessages && isPlainObject(sharedMessages)) { + options.i18n.messages = merge(options.i18n.messages, sharedMessages); + } + + this._i18n = new VueI18n(options.i18n); + this._i18nWatcher = this._i18n.watchI18nData(); + + if (options.i18n.sync === undefined || !!options.i18n.sync) { + this._localeWatcher = this.$i18n.watchLocale(); + } + + if (rootI18n) { + rootI18n.onComponentInstanceCreated(this._i18n); + } + } else { + if (process.env.NODE_ENV !== 'production') { + warn("Cannot be interpreted 'i18n' option."); + } + } + } else if (this.$root && this.$root.$i18n && this.$root.$i18n instanceof VueI18n) { + // root i18n + this._i18n = this.$root.$i18n; + } else if (options.parent && options.parent.$i18n && options.parent.$i18n instanceof VueI18n) { + // parent i18n + this._i18n = options.parent.$i18n; + } + }, + + beforeMount: function beforeMount () { + var options = this.$options; + options.i18n = options.i18n || (options.__i18n ? {} : null); + + if (options.i18n) { + if (options.i18n instanceof VueI18n) { + // init locale messages via custom blocks + this._i18n.subscribeDataChanging(this); + this._subscribing = true; + } else if (isPlainObject(options.i18n)) { + this._i18n.subscribeDataChanging(this); + this._subscribing = true; + } else { + if (process.env.NODE_ENV !== 'production') { + warn("Cannot be interpreted 'i18n' option."); + } + } + } else if (this.$root && this.$root.$i18n && this.$root.$i18n instanceof VueI18n) { + this._i18n.subscribeDataChanging(this); + this._subscribing = true; + } else if (options.parent && options.parent.$i18n && options.parent.$i18n instanceof VueI18n) { + this._i18n.subscribeDataChanging(this); + this._subscribing = true; + } + }, + + beforeDestroy: function beforeDestroy () { + if (!this._i18n) { return } + + var self = this; + this.$nextTick(function () { + if (self._subscribing) { + self._i18n.unsubscribeDataChanging(self); + delete self._subscribing; + } + + if (self._i18nWatcher) { + self._i18nWatcher(); + self._i18n.destroyVM(); + delete self._i18nWatcher; + } + + if (self._localeWatcher) { + self._localeWatcher(); + delete self._localeWatcher; + } + }); + } +}; + +/* */ + +var interpolationComponent = { + name: 'i18n', + functional: true, + props: { + tag: { + type: [String, Boolean, Object], + default: 'span' + }, + path: { + type: String, + required: true + }, + locale: { + type: String + }, + places: { + type: [Array, Object] + } + }, + render: function render (h, ref) { + var data = ref.data; + var parent = ref.parent; + var props = ref.props; + var slots = ref.slots; + + var $i18n = parent.$i18n; + if (!$i18n) { + if (process.env.NODE_ENV !== 'production') { + warn('Cannot find VueI18n instance!'); + } + return + } + + var path = props.path; + var locale = props.locale; + var places = props.places; + var params = slots(); + var children = $i18n.i( + path, + locale, + onlyHasDefaultPlace(params) || places + ? useLegacyPlaces(params.default, places) + : params + ); + + var tag = (!!props.tag && props.tag !== true) || props.tag === false ? props.tag : 'span'; + return tag ? h(tag, data, children) : children + } +}; + +function onlyHasDefaultPlace (params) { + var prop; + for (prop in params) { + if (prop !== 'default') { return false } + } + return Boolean(prop) +} + +function useLegacyPlaces (children, places) { + var params = places ? createParamsFromPlaces(places) : {}; + + if (!children) { return params } + + // Filter empty text nodes + children = children.filter(function (child) { + return child.tag || child.text.trim() !== '' + }); + + var everyPlace = children.every(vnodeHasPlaceAttribute); + if (process.env.NODE_ENV !== 'production' && everyPlace) { + warn('`place` attribute is deprecated in next major version. Please switch to Vue slots.'); + } + + return children.reduce( + everyPlace ? assignChildPlace : assignChildIndex, + params + ) +} + +function createParamsFromPlaces (places) { + if (process.env.NODE_ENV !== 'production') { + warn('`places` prop is deprecated in next major version. Please switch to Vue slots.'); + } + + return Array.isArray(places) + ? places.reduce(assignChildIndex, {}) + : Object.assign({}, places) +} + +function assignChildPlace (params, child) { + if (child.data && child.data.attrs && child.data.attrs.place) { + params[child.data.attrs.place] = child; + } + return params +} + +function assignChildIndex (params, child, index) { + params[index] = child; + return params +} + +function vnodeHasPlaceAttribute (vnode) { + return Boolean(vnode.data && vnode.data.attrs && vnode.data.attrs.place) +} + +/* */ + +var numberComponent = { + name: 'i18n-n', + functional: true, + props: { + tag: { + type: [String, Boolean, Object], + default: 'span' + }, + value: { + type: Number, + required: true + }, + format: { + type: [String, Object] + }, + locale: { + type: String + } + }, + render: function render (h, ref) { + var props = ref.props; + var parent = ref.parent; + var data = ref.data; + + var i18n = parent.$i18n; + + if (!i18n) { + if (process.env.NODE_ENV !== 'production') { + warn('Cannot find VueI18n instance!'); + } + return null + } + + var key = null; + var options = null; + + if (isString(props.format)) { + key = props.format; + } else if (isObject(props.format)) { + if (props.format.key) { + key = props.format.key; + } + + // Filter out number format options only + options = Object.keys(props.format).reduce(function (acc, prop) { + var obj; + + if (includes(numberFormatKeys, prop)) { + return Object.assign({}, acc, ( obj = {}, obj[prop] = props.format[prop], obj )) + } + return acc + }, null); + } + + var locale = props.locale || i18n.locale; + var parts = i18n._ntp(props.value, locale, key, options); + + var values = parts.map(function (part, index) { + var obj; + + var slot = data.scopedSlots && data.scopedSlots[part.type]; + return slot ? slot(( obj = {}, obj[part.type] = part.value, obj.index = index, obj.parts = parts, obj )) : part.value + }); + + var tag = (!!props.tag && props.tag !== true) || props.tag === false ? props.tag : 'span'; + return tag + ? h(tag, { + attrs: data.attrs, + 'class': data['class'], + staticClass: data.staticClass + }, values) + : values + } +}; + +/* */ + +function bind (el, binding, vnode) { + if (!assert(el, vnode)) { return } + + t(el, binding, vnode); +} + +function update (el, binding, vnode, oldVNode) { + if (!assert(el, vnode)) { return } + + var i18n = vnode.context.$i18n; + if (localeEqual(el, vnode) && + (looseEqual(binding.value, binding.oldValue) && + looseEqual(el._localeMessage, i18n.getLocaleMessage(i18n.locale)))) { return } + + t(el, binding, vnode); +} + +function unbind (el, binding, vnode, oldVNode) { + var vm = vnode.context; + if (!vm) { + warn('Vue instance does not exists in VNode context'); + return + } + + var i18n = vnode.context.$i18n || {}; + if (!binding.modifiers.preserve && !i18n.preserveDirectiveContent) { + el.textContent = ''; + } + el._vt = undefined; + delete el['_vt']; + el._locale = undefined; + delete el['_locale']; + el._localeMessage = undefined; + delete el['_localeMessage']; +} + +function assert (el, vnode) { + var vm = vnode.context; + if (!vm) { + warn('Vue instance does not exists in VNode context'); + return false + } + + if (!vm.$i18n) { + warn('VueI18n instance does not exists in Vue instance'); + return false + } + + return true +} + +function localeEqual (el, vnode) { + var vm = vnode.context; + return el._locale === vm.$i18n.locale +} + +function t (el, binding, vnode) { + var ref$1, ref$2; + + var value = binding.value; + + var ref = parseValue(value); + var path = ref.path; + var locale = ref.locale; + var args = ref.args; + var choice = ref.choice; + if (!path && !locale && !args) { + warn('value type not supported'); + return + } + + if (!path) { + warn('`path` is required in v-t directive'); + return + } + + var vm = vnode.context; + if (choice != null) { + el._vt = el.textContent = (ref$1 = vm.$i18n).tc.apply(ref$1, [ path, choice ].concat( makeParams(locale, args) )); + } else { + el._vt = el.textContent = (ref$2 = vm.$i18n).t.apply(ref$2, [ path ].concat( makeParams(locale, args) )); + } + el._locale = vm.$i18n.locale; + el._localeMessage = vm.$i18n.getLocaleMessage(vm.$i18n.locale); +} + +function parseValue (value) { + var path; + var locale; + var args; + var choice; + + if (isString(value)) { + path = value; + } else if (isPlainObject(value)) { + path = value.path; + locale = value.locale; + args = value.args; + choice = value.choice; + } + + return { path: path, locale: locale, args: args, choice: choice } +} + +function makeParams (locale, args) { + var params = []; + + locale && params.push(locale); + if (args && (Array.isArray(args) || isPlainObject(args))) { + params.push(args); + } + + return params +} + +var Vue; + +function install (_Vue) { + /* istanbul ignore if */ + if (process.env.NODE_ENV !== 'production' && install.installed && _Vue === Vue) { + warn('already installed.'); + return + } + install.installed = true; + + Vue = _Vue; + + var version = (Vue.version && Number(Vue.version.split('.')[0])) || -1; + /* istanbul ignore if */ + if (process.env.NODE_ENV !== 'production' && version < 2) { + warn(("vue-i18n (" + (install.version) + ") need to use Vue 2.0 or later (Vue: " + (Vue.version) + ").")); + return + } + + extend(Vue); + Vue.mixin(mixin); + Vue.directive('t', { bind: bind, update: update, unbind: unbind }); + Vue.component(interpolationComponent.name, interpolationComponent); + Vue.component(numberComponent.name, numberComponent); + + // use simple mergeStrategies to prevent i18n instance lose '__proto__' + var strats = Vue.config.optionMergeStrategies; + strats.i18n = function (parentVal, childVal) { + return childVal === undefined + ? parentVal + : childVal + }; +} + +/* */ + +var BaseFormatter = function BaseFormatter () { + this._caches = Object.create(null); +}; + +BaseFormatter.prototype.interpolate = function interpolate (message, values) { + if (!values) { + return [message] + } + var tokens = this._caches[message]; + if (!tokens) { + tokens = parse(message); + this._caches[message] = tokens; + } + return compile(tokens, values) +}; + + + +var RE_TOKEN_LIST_VALUE = /^(?:\d)+/; +var RE_TOKEN_NAMED_VALUE = /^(?:\w)+/; + +function parse (format) { + var tokens = []; + var position = 0; + + var text = ''; + while (position < format.length) { + var char = format[position++]; + if (char === '{') { + if (text) { + tokens.push({ type: 'text', value: text }); + } + + text = ''; + var sub = ''; + char = format[position++]; + while (char !== undefined && char !== '}') { + sub += char; + char = format[position++]; + } + var isClosed = char === '}'; + + var type = RE_TOKEN_LIST_VALUE.test(sub) + ? 'list' + : isClosed && RE_TOKEN_NAMED_VALUE.test(sub) + ? 'named' + : 'unknown'; + tokens.push({ value: sub, type: type }); + } else if (char === '%') { + // when found rails i18n syntax, skip text capture + if (format[(position)] !== '{') { + text += char; + } + } else { + text += char; + } + } + + text && tokens.push({ type: 'text', value: text }); + + return tokens +} + +function compile (tokens, values) { + var compiled = []; + var index = 0; + + var mode = Array.isArray(values) + ? 'list' + : isObject(values) + ? 'named' + : 'unknown'; + if (mode === 'unknown') { return compiled } + + while (index < tokens.length) { + var token = tokens[index]; + switch (token.type) { + case 'text': + compiled.push(token.value); + break + case 'list': + compiled.push(values[parseInt(token.value, 10)]); + break + case 'named': + if (mode === 'named') { + compiled.push((values)[token.value]); + } else { + if (process.env.NODE_ENV !== 'production') { + warn(("Type of token '" + (token.type) + "' and format of value '" + mode + "' don't match!")); + } + } + break + case 'unknown': + if (process.env.NODE_ENV !== 'production') { + warn("Detect 'unknown' type of token!"); + } + break + } + index++; + } + + return compiled +} + +/* */ + +/** + * Path parser + * - Inspired: + * Vue.js Path parser + */ + +// actions +var APPEND = 0; +var PUSH = 1; +var INC_SUB_PATH_DEPTH = 2; +var PUSH_SUB_PATH = 3; + +// states +var BEFORE_PATH = 0; +var IN_PATH = 1; +var BEFORE_IDENT = 2; +var IN_IDENT = 3; +var IN_SUB_PATH = 4; +var IN_SINGLE_QUOTE = 5; +var IN_DOUBLE_QUOTE = 6; +var AFTER_PATH = 7; +var ERROR = 8; + +var pathStateMachine = []; + +pathStateMachine[BEFORE_PATH] = { + 'ws': [BEFORE_PATH], + 'ident': [IN_IDENT, APPEND], + '[': [IN_SUB_PATH], + 'eof': [AFTER_PATH] +}; + +pathStateMachine[IN_PATH] = { + 'ws': [IN_PATH], + '.': [BEFORE_IDENT], + '[': [IN_SUB_PATH], + 'eof': [AFTER_PATH] +}; + +pathStateMachine[BEFORE_IDENT] = { + 'ws': [BEFORE_IDENT], + 'ident': [IN_IDENT, APPEND], + '0': [IN_IDENT, APPEND], + 'number': [IN_IDENT, APPEND] +}; + +pathStateMachine[IN_IDENT] = { + 'ident': [IN_IDENT, APPEND], + '0': [IN_IDENT, APPEND], + 'number': [IN_IDENT, APPEND], + 'ws': [IN_PATH, PUSH], + '.': [BEFORE_IDENT, PUSH], + '[': [IN_SUB_PATH, PUSH], + 'eof': [AFTER_PATH, PUSH] +}; + +pathStateMachine[IN_SUB_PATH] = { + "'": [IN_SINGLE_QUOTE, APPEND], + '"': [IN_DOUBLE_QUOTE, APPEND], + '[': [IN_SUB_PATH, INC_SUB_PATH_DEPTH], + ']': [IN_PATH, PUSH_SUB_PATH], + 'eof': ERROR, + 'else': [IN_SUB_PATH, APPEND] +}; + +pathStateMachine[IN_SINGLE_QUOTE] = { + "'": [IN_SUB_PATH, APPEND], + 'eof': ERROR, + 'else': [IN_SINGLE_QUOTE, APPEND] +}; + +pathStateMachine[IN_DOUBLE_QUOTE] = { + '"': [IN_SUB_PATH, APPEND], + 'eof': ERROR, + 'else': [IN_DOUBLE_QUOTE, APPEND] +}; + +/** + * Check if an expression is a literal value. + */ + +var literalValueRE = /^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/; +function isLiteral (exp) { + return literalValueRE.test(exp) +} + +/** + * Strip quotes from a string + */ + +function stripQuotes (str) { + var a = str.charCodeAt(0); + var b = str.charCodeAt(str.length - 1); + return a === b && (a === 0x22 || a === 0x27) + ? str.slice(1, -1) + : str +} + +/** + * Determine the type of a character in a keypath. + */ + +function getPathCharType (ch) { + if (ch === undefined || ch === null) { return 'eof' } + + var code = ch.charCodeAt(0); + + switch (code) { + case 0x5B: // [ + case 0x5D: // ] + case 0x2E: // . + case 0x22: // " + case 0x27: // ' + return ch + + case 0x5F: // _ + case 0x24: // $ + case 0x2D: // - + return 'ident' + + case 0x09: // Tab + case 0x0A: // Newline + case 0x0D: // Return + case 0xA0: // No-break space + case 0xFEFF: // Byte Order Mark + case 0x2028: // Line Separator + case 0x2029: // Paragraph Separator + return 'ws' + } + + return 'ident' +} + +/** + * Format a subPath, return its plain form if it is + * a literal string or number. Otherwise prepend the + * dynamic indicator (*). + */ + +function formatSubPath (path) { + var trimmed = path.trim(); + // invalid leading 0 + if (path.charAt(0) === '0' && isNaN(path)) { return false } + + return isLiteral(trimmed) ? stripQuotes(trimmed) : '*' + trimmed +} + +/** + * Parse a string path into an array of segments + */ + +function parse$1 (path) { + var keys = []; + var index = -1; + var mode = BEFORE_PATH; + var subPathDepth = 0; + var c; + var key; + var newChar; + var type; + var transition; + var action; + var typeMap; + var actions = []; + + actions[PUSH] = function () { + if (key !== undefined) { + keys.push(key); + key = undefined; + } + }; + + actions[APPEND] = function () { + if (key === undefined) { + key = newChar; + } else { + key += newChar; + } + }; + + actions[INC_SUB_PATH_DEPTH] = function () { + actions[APPEND](); + subPathDepth++; + }; + + actions[PUSH_SUB_PATH] = function () { + if (subPathDepth > 0) { + subPathDepth--; + mode = IN_SUB_PATH; + actions[APPEND](); + } else { + subPathDepth = 0; + if (key === undefined) { return false } + key = formatSubPath(key); + if (key === false) { + return false + } else { + actions[PUSH](); + } + } + }; + + function maybeUnescapeQuote () { + var nextChar = path[index + 1]; + if ((mode === IN_SINGLE_QUOTE && nextChar === "'") || + (mode === IN_DOUBLE_QUOTE && nextChar === '"')) { + index++; + newChar = '\\' + nextChar; + actions[APPEND](); + return true + } + } + + while (mode !== null) { + index++; + c = path[index]; + + if (c === '\\' && maybeUnescapeQuote()) { + continue + } + + type = getPathCharType(c); + typeMap = pathStateMachine[mode]; + transition = typeMap[type] || typeMap['else'] || ERROR; + + if (transition === ERROR) { + return // parse error + } + + mode = transition[0]; + action = actions[transition[1]]; + if (action) { + newChar = transition[2]; + newChar = newChar === undefined + ? c + : newChar; + if (action() === false) { + return + } + } + + if (mode === AFTER_PATH) { + return keys + } + } +} + + + + + +var I18nPath = function I18nPath () { + this._cache = Object.create(null); +}; + +/** + * External parse that check for a cache hit first + */ +I18nPath.prototype.parsePath = function parsePath (path) { + var hit = this._cache[path]; + if (!hit) { + hit = parse$1(path); + if (hit) { + this._cache[path] = hit; + } + } + return hit || [] +}; + +/** + * Get path value from path string + */ +I18nPath.prototype.getPathValue = function getPathValue (obj, path) { + if (!isObject(obj)) { return null } + + var paths = this.parsePath(path); + if (paths.length === 0) { + return null + } else { + var length = paths.length; + var last = obj; + var i = 0; + while (i < length) { + var value = last[paths[i]]; + if (value === undefined) { + return null + } + last = value; + i++; + } + + return last + } +}; + +/* */ + + + +var htmlTagMatcher = /<\/?[\w\s="/.':;#-\/]+>/; +var linkKeyMatcher = /(?:@(?:\.[a-z]+)?:(?:[\w\-_|.]+|\([\w\-_|.]+\)))/g; +var linkKeyPrefixMatcher = /^@(?:\.([a-z]+))?:/; +var bracketsMatcher = /[()]/g; +var defaultModifiers = { + 'upper': function (str) { return str.toLocaleUpperCase(); }, + 'lower': function (str) { return str.toLocaleLowerCase(); }, + 'capitalize': function (str) { return ("" + (str.charAt(0).toLocaleUpperCase()) + (str.substr(1))); } +}; + +var defaultFormatter = new BaseFormatter(); + +var VueI18n = function VueI18n (options) { + var this$1 = this; + if ( options === void 0 ) options = {}; + + // Auto install if it is not done yet and `window` has `Vue`. + // To allow users to avoid auto-installation in some cases, + // this code should be placed here. See #290 + /* istanbul ignore if */ + if (!Vue && typeof window !== 'undefined' && window.Vue) { + install(window.Vue); + } + + var locale = options.locale || 'en-US'; + var fallbackLocale = options.fallbackLocale === false + ? false + : options.fallbackLocale || 'en-US'; + var messages = options.messages || {}; + var dateTimeFormats = options.dateTimeFormats || {}; + var numberFormats = options.numberFormats || {}; + + this._vm = null; + this._formatter = options.formatter || defaultFormatter; + this._modifiers = options.modifiers || {}; + this._missing = options.missing || null; + this._root = options.root || null; + this._sync = options.sync === undefined ? true : !!options.sync; + this._fallbackRoot = options.fallbackRoot === undefined + ? true + : !!options.fallbackRoot; + this._formatFallbackMessages = options.formatFallbackMessages === undefined + ? false + : !!options.formatFallbackMessages; + this._silentTranslationWarn = options.silentTranslationWarn === undefined + ? false + : options.silentTranslationWarn; + this._silentFallbackWarn = options.silentFallbackWarn === undefined + ? false + : !!options.silentFallbackWarn; + this._dateTimeFormatters = {}; + this._numberFormatters = {}; + this._path = new I18nPath(); + this._dataListeners = []; + this._componentInstanceCreatedListener = options.componentInstanceCreatedListener || null; + this._preserveDirectiveContent = options.preserveDirectiveContent === undefined + ? false + : !!options.preserveDirectiveContent; + this.pluralizationRules = options.pluralizationRules || {}; + this._warnHtmlInMessage = options.warnHtmlInMessage || 'off'; + this._postTranslation = options.postTranslation || null; + + /** + * @param choice {number} a choice index given by the input to $tc: `$tc('path.to.rule', choiceIndex)` + * @param choicesLength {number} an overall amount of available choices + * @returns a final choice index + */ + this.getChoiceIndex = function (choice, choicesLength) { + var thisPrototype = Object.getPrototypeOf(this$1); + if (thisPrototype && thisPrototype.getChoiceIndex) { + var prototypeGetChoiceIndex = (thisPrototype.getChoiceIndex); + return (prototypeGetChoiceIndex).call(this$1, choice, choicesLength) + } + + // Default (old) getChoiceIndex implementation - english-compatible + var defaultImpl = function (_choice, _choicesLength) { + _choice = Math.abs(_choice); + + if (_choicesLength === 2) { + return _choice + ? _choice > 1 + ? 1 + : 0 + : 1 + } + + return _choice ? Math.min(_choice, 2) : 0 + }; + + if (this$1.locale in this$1.pluralizationRules) { + return this$1.pluralizationRules[this$1.locale].apply(this$1, [choice, choicesLength]) + } else { + return defaultImpl(choice, choicesLength) + } + }; + + + this._exist = function (message, key) { + if (!message || !key) { return false } + if (!isNull(this$1._path.getPathValue(message, key))) { return true } + // fallback for flat key + if (message[key]) { return true } + return false + }; + + if (this._warnHtmlInMessage === 'warn' || this._warnHtmlInMessage === 'error') { + Object.keys(messages).forEach(function (locale) { + this$1._checkLocaleMessage(locale, this$1._warnHtmlInMessage, messages[locale]); + }); + } + + this._initVM({ + locale: locale, + fallbackLocale: fallbackLocale, + messages: messages, + dateTimeFormats: dateTimeFormats, + numberFormats: numberFormats + }); +}; + +var prototypeAccessors = { vm: { configurable: true },messages: { configurable: true },dateTimeFormats: { configurable: true },numberFormats: { configurable: true },availableLocales: { configurable: true },locale: { configurable: true },fallbackLocale: { configurable: true },formatFallbackMessages: { configurable: true },missing: { configurable: true },formatter: { configurable: true },silentTranslationWarn: { configurable: true },silentFallbackWarn: { configurable: true },preserveDirectiveContent: { configurable: true },warnHtmlInMessage: { configurable: true },postTranslation: { configurable: true } }; + +VueI18n.prototype._checkLocaleMessage = function _checkLocaleMessage (locale, level, message) { + var paths = []; + + var fn = function (level, locale, message, paths) { + if (isPlainObject(message)) { + Object.keys(message).forEach(function (key) { + var val = message[key]; + if (isPlainObject(val)) { + paths.push(key); + paths.push('.'); + fn(level, locale, val, paths); + paths.pop(); + paths.pop(); + } else { + paths.push(key); + fn(level, locale, val, paths); + paths.pop(); + } + }); + } else if (Array.isArray(message)) { + message.forEach(function (item, index) { + if (isPlainObject(item)) { + paths.push(("[" + index + "]")); + paths.push('.'); + fn(level, locale, item, paths); + paths.pop(); + paths.pop(); + } else { + paths.push(("[" + index + "]")); + fn(level, locale, item, paths); + paths.pop(); + } + }); + } else if (isString(message)) { + var ret = htmlTagMatcher.test(message); + if (ret) { + var msg = "Detected HTML in message '" + message + "' of keypath '" + (paths.join('')) + "' at '" + locale + "'. Consider component interpolation with '' to avoid XSS. See https://bit.ly/2ZqJzkp"; + if (level === 'warn') { + warn(msg); + } else if (level === 'error') { + error(msg); + } + } + } + }; + + fn(level, locale, message, paths); +}; + +VueI18n.prototype._initVM = function _initVM (data) { + var silent = Vue.config.silent; + Vue.config.silent = true; + this._vm = new Vue({ data: data }); + Vue.config.silent = silent; +}; + +VueI18n.prototype.destroyVM = function destroyVM () { + this._vm.$destroy(); +}; + +VueI18n.prototype.subscribeDataChanging = function subscribeDataChanging (vm) { + this._dataListeners.push(vm); +}; + +VueI18n.prototype.unsubscribeDataChanging = function unsubscribeDataChanging (vm) { + remove(this._dataListeners, vm); +}; + +VueI18n.prototype.watchI18nData = function watchI18nData () { + var self = this; + return this._vm.$watch('$data', function () { + var i = self._dataListeners.length; + while (i--) { + Vue.nextTick(function () { + self._dataListeners[i] && self._dataListeners[i].$forceUpdate(); + }); + } + }, { deep: true }) +}; + +VueI18n.prototype.watchLocale = function watchLocale () { + /* istanbul ignore if */ + if (!this._sync || !this._root) { return null } + var target = this._vm; + return this._root.$i18n.vm.$watch('locale', function (val) { + target.$set(target, 'locale', val); + target.$forceUpdate(); + }, { immediate: true }) +}; + +VueI18n.prototype.onComponentInstanceCreated = function onComponentInstanceCreated (newI18n) { + if (this._componentInstanceCreatedListener) { + this._componentInstanceCreatedListener(newI18n, this); + } +}; + +prototypeAccessors.vm.get = function () { return this._vm }; + +prototypeAccessors.messages.get = function () { return looseClone(this._getMessages()) }; +prototypeAccessors.dateTimeFormats.get = function () { return looseClone(this._getDateTimeFormats()) }; +prototypeAccessors.numberFormats.get = function () { return looseClone(this._getNumberFormats()) }; +prototypeAccessors.availableLocales.get = function () { return Object.keys(this.messages).sort() }; + +prototypeAccessors.locale.get = function () { return this._vm.locale }; +prototypeAccessors.locale.set = function (locale) { + this._vm.$set(this._vm, 'locale', locale); +}; + +prototypeAccessors.fallbackLocale.get = function () { return this._vm.fallbackLocale }; +prototypeAccessors.fallbackLocale.set = function (locale) { + this._localeChainCache = {}; + this._vm.$set(this._vm, 'fallbackLocale', locale); +}; + +prototypeAccessors.formatFallbackMessages.get = function () { return this._formatFallbackMessages }; +prototypeAccessors.formatFallbackMessages.set = function (fallback) { this._formatFallbackMessages = fallback; }; + +prototypeAccessors.missing.get = function () { return this._missing }; +prototypeAccessors.missing.set = function (handler) { this._missing = handler; }; + +prototypeAccessors.formatter.get = function () { return this._formatter }; +prototypeAccessors.formatter.set = function (formatter) { this._formatter = formatter; }; + +prototypeAccessors.silentTranslationWarn.get = function () { return this._silentTranslationWarn }; +prototypeAccessors.silentTranslationWarn.set = function (silent) { this._silentTranslationWarn = silent; }; + +prototypeAccessors.silentFallbackWarn.get = function () { return this._silentFallbackWarn }; +prototypeAccessors.silentFallbackWarn.set = function (silent) { this._silentFallbackWarn = silent; }; + +prototypeAccessors.preserveDirectiveContent.get = function () { return this._preserveDirectiveContent }; +prototypeAccessors.preserveDirectiveContent.set = function (preserve) { this._preserveDirectiveContent = preserve; }; + +prototypeAccessors.warnHtmlInMessage.get = function () { return this._warnHtmlInMessage }; +prototypeAccessors.warnHtmlInMessage.set = function (level) { + var this$1 = this; + + var orgLevel = this._warnHtmlInMessage; + this._warnHtmlInMessage = level; + if (orgLevel !== level && (level === 'warn' || level === 'error')) { + var messages = this._getMessages(); + Object.keys(messages).forEach(function (locale) { + this$1._checkLocaleMessage(locale, this$1._warnHtmlInMessage, messages[locale]); + }); + } +}; + +prototypeAccessors.postTranslation.get = function () { return this._postTranslation }; +prototypeAccessors.postTranslation.set = function (handler) { this._postTranslation = handler; }; + +VueI18n.prototype._getMessages = function _getMessages () { return this._vm.messages }; +VueI18n.prototype._getDateTimeFormats = function _getDateTimeFormats () { return this._vm.dateTimeFormats }; +VueI18n.prototype._getNumberFormats = function _getNumberFormats () { return this._vm.numberFormats }; + +VueI18n.prototype._warnDefault = function _warnDefault (locale, key, result, vm, values, interpolateMode) { + if (!isNull(result)) { return result } + if (this._missing) { + var missingRet = this._missing.apply(null, [locale, key, vm, values]); + if (isString(missingRet)) { + return missingRet + } + } else { + if (process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key)) { + warn( + "Cannot translate the value of keypath '" + key + "'. " + + 'Use the value of keypath as default.' + ); + } + } + + if (this._formatFallbackMessages) { + var parsedArgs = parseArgs.apply(void 0, values); + return this._render(key, interpolateMode, parsedArgs.params, key) + } else { + return key + } +}; + +VueI18n.prototype._isFallbackRoot = function _isFallbackRoot (val) { + return !val && !isNull(this._root) && this._fallbackRoot +}; + +VueI18n.prototype._isSilentFallbackWarn = function _isSilentFallbackWarn (key) { + return this._silentFallbackWarn instanceof RegExp + ? this._silentFallbackWarn.test(key) + : this._silentFallbackWarn +}; + +VueI18n.prototype._isSilentFallback = function _isSilentFallback (locale, key) { + return this._isSilentFallbackWarn(key) && (this._isFallbackRoot() || locale !== this.fallbackLocale) +}; + +VueI18n.prototype._isSilentTranslationWarn = function _isSilentTranslationWarn (key) { + return this._silentTranslationWarn instanceof RegExp + ? this._silentTranslationWarn.test(key) + : this._silentTranslationWarn +}; + +VueI18n.prototype._interpolate = function _interpolate ( + locale, + message, + key, + host, + interpolateMode, + values, + visitedLinkStack +) { + if (!message) { return null } + + var pathRet = this._path.getPathValue(message, key); + if (Array.isArray(pathRet) || isPlainObject(pathRet)) { return pathRet } + + var ret; + if (isNull(pathRet)) { + /* istanbul ignore else */ + if (isPlainObject(message)) { + ret = message[key]; + if (!isString(ret)) { + if (process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallback(locale, key)) { + warn(("Value of key '" + key + "' is not a string!")); + } + return null + } + } else { + return null + } + } else { + /* istanbul ignore else */ + if (isString(pathRet)) { + ret = pathRet; + } else { + if (process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallback(locale, key)) { + warn(("Value of key '" + key + "' is not a string!")); + } + return null + } + } + + // Check for the existence of links within the translated string + if (ret.indexOf('@:') >= 0 || ret.indexOf('@.') >= 0) { + ret = this._link(locale, message, ret, host, 'raw', values, visitedLinkStack); + } + + return this._render(ret, interpolateMode, values, key) +}; + +VueI18n.prototype._link = function _link ( + locale, + message, + str, + host, + interpolateMode, + values, + visitedLinkStack +) { + var ret = str; + + // Match all the links within the local + // We are going to replace each of + // them with its translation + var matches = ret.match(linkKeyMatcher); + for (var idx in matches) { + // ie compatible: filter custom array + // prototype method + if (!matches.hasOwnProperty(idx)) { + continue + } + var link = matches[idx]; + var linkKeyPrefixMatches = link.match(linkKeyPrefixMatcher); + var linkPrefix = linkKeyPrefixMatches[0]; + var formatterName = linkKeyPrefixMatches[1]; + + // Remove the leading @:, @.case: and the brackets + var linkPlaceholder = link.replace(linkPrefix, '').replace(bracketsMatcher, ''); + + if (includes(visitedLinkStack, linkPlaceholder)) { + if (process.env.NODE_ENV !== 'production') { + warn(("Circular reference found. \"" + link + "\" is already visited in the chain of " + (visitedLinkStack.reverse().join(' <- ')))); + } + return ret + } + visitedLinkStack.push(linkPlaceholder); + + // Translate the link + var translated = this._interpolate( + locale, message, linkPlaceholder, host, + interpolateMode === 'raw' ? 'string' : interpolateMode, + interpolateMode === 'raw' ? undefined : values, + visitedLinkStack + ); + + if (this._isFallbackRoot(translated)) { + if (process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(linkPlaceholder)) { + warn(("Fall back to translate the link placeholder '" + linkPlaceholder + "' with root locale.")); + } + /* istanbul ignore if */ + if (!this._root) { throw Error('unexpected error') } + var root = this._root.$i18n; + translated = root._translate( + root._getMessages(), root.locale, root.fallbackLocale, + linkPlaceholder, host, interpolateMode, values + ); + } + translated = this._warnDefault( + locale, linkPlaceholder, translated, host, + Array.isArray(values) ? values : [values], + interpolateMode + ); + + if (this._modifiers.hasOwnProperty(formatterName)) { + translated = this._modifiers[formatterName](translated); + } else if (defaultModifiers.hasOwnProperty(formatterName)) { + translated = defaultModifiers[formatterName](translated); + } + + visitedLinkStack.pop(); + + // Replace the link with the translated + ret = !translated ? ret : ret.replace(link, translated); + } + + return ret +}; + +VueI18n.prototype._render = function _render (message, interpolateMode, values, path) { + var ret = this._formatter.interpolate(message, values, path); + + // If the custom formatter refuses to work - apply the default one + if (!ret) { + ret = defaultFormatter.interpolate(message, values, path); + } + + // if interpolateMode is **not** 'string' ('row'), + // return the compiled data (e.g. ['foo', VNode, 'bar']) with formatter + return interpolateMode === 'string' && !isString(ret) ? ret.join('') : ret +}; + +VueI18n.prototype._appendItemToChain = function _appendItemToChain (chain, item, blocks) { + var follow = false; + if (!includes(chain, item)) { + follow = true; + if (item) { + follow = item[item.length - 1] !== '!'; + item = item.replace(/!/g, ''); + chain.push(item); + if (blocks && blocks[item]) { + follow = blocks[item]; + } + } + } + return follow +}; + +VueI18n.prototype._appendLocaleToChain = function _appendLocaleToChain (chain, locale, blocks) { + var follow; + var tokens = locale.split('-'); + do { + var item = tokens.join('-'); + follow = this._appendItemToChain(chain, item, blocks); + tokens.splice(-1, 1); + } while (tokens.length && (follow === true)) + return follow +}; + +VueI18n.prototype._appendBlockToChain = function _appendBlockToChain (chain, block, blocks) { + var follow = true; + for (var i = 0; (i < block.length) && (isBoolean(follow)); i++) { + var locale = block[i]; + if (isString(locale)) { + follow = this._appendLocaleToChain(chain, locale, blocks); + } + } + return follow +}; + +VueI18n.prototype._getLocaleChain = function _getLocaleChain (start, fallbackLocale) { + if (start === '') { return [] } + + if (!this._localeChainCache) { + this._localeChainCache = {}; + } + + var chain = this._localeChainCache[start]; + if (!chain) { + if (!fallbackLocale) { + fallbackLocale = this.fallbackLocale; + } + chain = []; + + // first block defined by start + var block = [start]; + + // while any intervening block found + while (isArray(block)) { + block = this._appendBlockToChain( + chain, + block, + fallbackLocale + ); + } + + // last block defined by default + var defaults; + if (isArray(fallbackLocale)) { + defaults = fallbackLocale; + } else if (isObject(fallbackLocale)) { + /* $FlowFixMe */ + if (fallbackLocale['default']) { + defaults = fallbackLocale['default']; + } else { + defaults = null; + } + } else { + defaults = fallbackLocale; + } + + // convert defaults to array + if (isString(defaults)) { + block = [defaults]; + } else { + block = defaults; + } + if (block) { + this._appendBlockToChain( + chain, + block, + null + ); + } + this._localeChainCache[start] = chain; + } + return chain +}; + +VueI18n.prototype._translate = function _translate ( + messages, + locale, + fallback, + key, + host, + interpolateMode, + args +) { + var chain = this._getLocaleChain(locale, fallback); + var res; + for (var i = 0; i < chain.length; i++) { + var step = chain[i]; + res = + this._interpolate(step, messages[step], key, host, interpolateMode, args, [key]); + if (!isNull(res)) { + if (step !== locale && process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) { + warn(("Fall back to translate the keypath '" + key + "' with '" + step + "' locale.")); + } + return res + } + } + return null +}; + +VueI18n.prototype._t = function _t (key, _locale, messages, host) { + var ref; + + var values = [], len = arguments.length - 4; + while ( len-- > 0 ) values[ len ] = arguments[ len + 4 ]; + if (!key) { return '' } + + var parsedArgs = parseArgs.apply(void 0, values); + var locale = parsedArgs.locale || _locale; + + var ret = this._translate( + messages, locale, this.fallbackLocale, key, + host, 'string', parsedArgs.params + ); + if (this._isFallbackRoot(ret)) { + if (process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) { + warn(("Fall back to translate the keypath '" + key + "' with root locale.")); + } + /* istanbul ignore if */ + if (!this._root) { throw Error('unexpected error') } + return (ref = this._root).$t.apply(ref, [ key ].concat( values )) + } else { + ret = this._warnDefault(locale, key, ret, host, values, 'string'); + if (this._postTranslation && ret !== null && ret !== undefined) { + ret = this._postTranslation(ret, key); + } + return ret + } +}; + +VueI18n.prototype.t = function t (key) { + var ref; + + var values = [], len = arguments.length - 1; + while ( len-- > 0 ) values[ len ] = arguments[ len + 1 ]; + return (ref = this)._t.apply(ref, [ key, this.locale, this._getMessages(), null ].concat( values )) +}; + +VueI18n.prototype._i = function _i (key, locale, messages, host, values) { + var ret = + this._translate(messages, locale, this.fallbackLocale, key, host, 'raw', values); + if (this._isFallbackRoot(ret)) { + if (process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key)) { + warn(("Fall back to interpolate the keypath '" + key + "' with root locale.")); + } + if (!this._root) { throw Error('unexpected error') } + return this._root.$i18n.i(key, locale, values) + } else { + return this._warnDefault(locale, key, ret, host, [values], 'raw') + } +}; + +VueI18n.prototype.i = function i (key, locale, values) { + /* istanbul ignore if */ + if (!key) { return '' } + + if (!isString(locale)) { + locale = this.locale; + } + + return this._i(key, locale, this._getMessages(), null, values) +}; + +VueI18n.prototype._tc = function _tc ( + key, + _locale, + messages, + host, + choice +) { + var ref; + + var values = [], len = arguments.length - 5; + while ( len-- > 0 ) values[ len ] = arguments[ len + 5 ]; + if (!key) { return '' } + if (choice === undefined) { + choice = 1; + } + + var predefined = { 'count': choice, 'n': choice }; + var parsedArgs = parseArgs.apply(void 0, values); + parsedArgs.params = Object.assign(predefined, parsedArgs.params); + values = parsedArgs.locale === null ? [parsedArgs.params] : [parsedArgs.locale, parsedArgs.params]; + return this.fetchChoice((ref = this)._t.apply(ref, [ key, _locale, messages, host ].concat( values )), choice) +}; + +VueI18n.prototype.fetchChoice = function fetchChoice (message, choice) { + /* istanbul ignore if */ + if (!message && !isString(message)) { return null } + var choices = message.split('|'); + + choice = this.getChoiceIndex(choice, choices.length); + if (!choices[choice]) { return message } + return choices[choice].trim() +}; + +VueI18n.prototype.tc = function tc (key, choice) { + var ref; + + var values = [], len = arguments.length - 2; + while ( len-- > 0 ) values[ len ] = arguments[ len + 2 ]; + return (ref = this)._tc.apply(ref, [ key, this.locale, this._getMessages(), null, choice ].concat( values )) +}; + +VueI18n.prototype._te = function _te (key, locale, messages) { + var args = [], len = arguments.length - 3; + while ( len-- > 0 ) args[ len ] = arguments[ len + 3 ]; + + var _locale = parseArgs.apply(void 0, args).locale || locale; + return this._exist(messages[_locale], key) +}; + +VueI18n.prototype.te = function te (key, locale) { + return this._te(key, this.locale, this._getMessages(), locale) +}; + +VueI18n.prototype.getLocaleMessage = function getLocaleMessage (locale) { + return looseClone(this._vm.messages[locale] || {}) +}; + +VueI18n.prototype.setLocaleMessage = function setLocaleMessage (locale, message) { + if (this._warnHtmlInMessage === 'warn' || this._warnHtmlInMessage === 'error') { + this._checkLocaleMessage(locale, this._warnHtmlInMessage, message); + } + this._vm.$set(this._vm.messages, locale, message); +}; + +VueI18n.prototype.mergeLocaleMessage = function mergeLocaleMessage (locale, message) { + if (this._warnHtmlInMessage === 'warn' || this._warnHtmlInMessage === 'error') { + this._checkLocaleMessage(locale, this._warnHtmlInMessage, message); + } + this._vm.$set(this._vm.messages, locale, merge({}, this._vm.messages[locale] || {}, message)); +}; + +VueI18n.prototype.getDateTimeFormat = function getDateTimeFormat (locale) { + return looseClone(this._vm.dateTimeFormats[locale] || {}) +}; + +VueI18n.prototype.setDateTimeFormat = function setDateTimeFormat (locale, format) { + this._vm.$set(this._vm.dateTimeFormats, locale, format); + this._clearDateTimeFormat(locale, format); +}; + +VueI18n.prototype.mergeDateTimeFormat = function mergeDateTimeFormat (locale, format) { + this._vm.$set(this._vm.dateTimeFormats, locale, merge(this._vm.dateTimeFormats[locale] || {}, format)); + this._clearDateTimeFormat(locale, format); +}; + +VueI18n.prototype._clearDateTimeFormat = function _clearDateTimeFormat (locale, format) { + for (var key in format) { + var id = locale + "__" + key; + + if (!this._dateTimeFormatters.hasOwnProperty(id)) { + continue + } + + delete this._dateTimeFormatters[id]; + } +}; + +VueI18n.prototype._localizeDateTime = function _localizeDateTime ( + value, + locale, + fallback, + dateTimeFormats, + key +) { + var _locale = locale; + var formats = dateTimeFormats[_locale]; + + var chain = this._getLocaleChain(locale, fallback); + for (var i = 0; i < chain.length; i++) { + var current = _locale; + var step = chain[i]; + formats = dateTimeFormats[step]; + _locale = step; + // fallback locale + if (isNull(formats) || isNull(formats[key])) { + if (step !== locale && process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) { + warn(("Fall back to '" + step + "' datetime formats from '" + current + "' datetime formats.")); + } + } else { + break + } + } + + if (isNull(formats) || isNull(formats[key])) { + return null + } else { + var format = formats[key]; + var id = _locale + "__" + key; + var formatter = this._dateTimeFormatters[id]; + if (!formatter) { + formatter = this._dateTimeFormatters[id] = new Intl.DateTimeFormat(_locale, format); + } + return formatter.format(value) + } +}; + +VueI18n.prototype._d = function _d (value, locale, key) { + /* istanbul ignore if */ + if (process.env.NODE_ENV !== 'production' && !VueI18n.availabilities.dateTimeFormat) { + warn('Cannot format a Date value due to not supported Intl.DateTimeFormat.'); + return '' + } + + if (!key) { + return new Intl.DateTimeFormat(locale).format(value) + } + + var ret = + this._localizeDateTime(value, locale, this.fallbackLocale, this._getDateTimeFormats(), key); + if (this._isFallbackRoot(ret)) { + if (process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) { + warn(("Fall back to datetime localization of root: key '" + key + "'.")); + } + /* istanbul ignore if */ + if (!this._root) { throw Error('unexpected error') } + return this._root.$i18n.d(value, key, locale) + } else { + return ret || '' + } +}; + +VueI18n.prototype.d = function d (value) { + var args = [], len = arguments.length - 1; + while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ]; + + var locale = this.locale; + var key = null; + + if (args.length === 1) { + if (isString(args[0])) { + key = args[0]; + } else if (isObject(args[0])) { + if (args[0].locale) { + locale = args[0].locale; + } + if (args[0].key) { + key = args[0].key; + } + } + } else if (args.length === 2) { + if (isString(args[0])) { + key = args[0]; + } + if (isString(args[1])) { + locale = args[1]; + } + } + + return this._d(value, locale, key) +}; + +VueI18n.prototype.getNumberFormat = function getNumberFormat (locale) { + return looseClone(this._vm.numberFormats[locale] || {}) +}; + +VueI18n.prototype.setNumberFormat = function setNumberFormat (locale, format) { + this._vm.$set(this._vm.numberFormats, locale, format); + this._clearNumberFormat(locale, format); +}; + +VueI18n.prototype.mergeNumberFormat = function mergeNumberFormat (locale, format) { + this._vm.$set(this._vm.numberFormats, locale, merge(this._vm.numberFormats[locale] || {}, format)); + this._clearNumberFormat(locale, format); +}; + +VueI18n.prototype._clearNumberFormat = function _clearNumberFormat (locale, format) { + for (var key in format) { + var id = locale + "__" + key; + + if (!this._numberFormatters.hasOwnProperty(id)) { + continue + } + + delete this._numberFormatters[id]; + } +}; + +VueI18n.prototype._getNumberFormatter = function _getNumberFormatter ( + value, + locale, + fallback, + numberFormats, + key, + options +) { + var _locale = locale; + var formats = numberFormats[_locale]; + + var chain = this._getLocaleChain(locale, fallback); + for (var i = 0; i < chain.length; i++) { + var current = _locale; + var step = chain[i]; + formats = numberFormats[step]; + _locale = step; + // fallback locale + if (isNull(formats) || isNull(formats[key])) { + if (step !== locale && process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) { + warn(("Fall back to '" + step + "' number formats from '" + current + "' number formats.")); + } + } else { + break + } + } + + if (isNull(formats) || isNull(formats[key])) { + return null + } else { + var format = formats[key]; + + var formatter; + if (options) { + // If options specified - create one time number formatter + formatter = new Intl.NumberFormat(_locale, Object.assign({}, format, options)); + } else { + var id = _locale + "__" + key; + formatter = this._numberFormatters[id]; + if (!formatter) { + formatter = this._numberFormatters[id] = new Intl.NumberFormat(_locale, format); + } + } + return formatter + } +}; + +VueI18n.prototype._n = function _n (value, locale, key, options) { + /* istanbul ignore if */ + if (!VueI18n.availabilities.numberFormat) { + if (process.env.NODE_ENV !== 'production') { + warn('Cannot format a Number value due to not supported Intl.NumberFormat.'); + } + return '' + } + + if (!key) { + var nf = !options ? new Intl.NumberFormat(locale) : new Intl.NumberFormat(locale, options); + return nf.format(value) + } + + var formatter = this._getNumberFormatter(value, locale, this.fallbackLocale, this._getNumberFormats(), key, options); + var ret = formatter && formatter.format(value); + if (this._isFallbackRoot(ret)) { + if (process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) { + warn(("Fall back to number localization of root: key '" + key + "'.")); + } + /* istanbul ignore if */ + if (!this._root) { throw Error('unexpected error') } + return this._root.$i18n.n(value, Object.assign({}, { key: key, locale: locale }, options)) + } else { + return ret || '' + } +}; + +VueI18n.prototype.n = function n (value) { + var args = [], len = arguments.length - 1; + while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ]; + + var locale = this.locale; + var key = null; + var options = null; + + if (args.length === 1) { + if (isString(args[0])) { + key = args[0]; + } else if (isObject(args[0])) { + if (args[0].locale) { + locale = args[0].locale; + } + if (args[0].key) { + key = args[0].key; + } + + // Filter out number format options only + options = Object.keys(args[0]).reduce(function (acc, key) { + var obj; + + if (includes(numberFormatKeys, key)) { + return Object.assign({}, acc, ( obj = {}, obj[key] = args[0][key], obj )) + } + return acc + }, null); + } + } else if (args.length === 2) { + if (isString(args[0])) { + key = args[0]; + } + if (isString(args[1])) { + locale = args[1]; + } + } + + return this._n(value, locale, key, options) +}; + +VueI18n.prototype._ntp = function _ntp (value, locale, key, options) { + /* istanbul ignore if */ + if (!VueI18n.availabilities.numberFormat) { + if (process.env.NODE_ENV !== 'production') { + warn('Cannot format to parts a Number value due to not supported Intl.NumberFormat.'); + } + return [] + } + + if (!key) { + var nf = !options ? new Intl.NumberFormat(locale) : new Intl.NumberFormat(locale, options); + return nf.formatToParts(value) + } + + var formatter = this._getNumberFormatter(value, locale, this.fallbackLocale, this._getNumberFormats(), key, options); + var ret = formatter && formatter.formatToParts(value); + if (this._isFallbackRoot(ret)) { + if (process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key)) { + warn(("Fall back to format number to parts of root: key '" + key + "' .")); + } + /* istanbul ignore if */ + if (!this._root) { throw Error('unexpected error') } + return this._root.$i18n._ntp(value, locale, key, options) + } else { + return ret || [] + } +}; + +Object.defineProperties( VueI18n.prototype, prototypeAccessors ); + +var availabilities; +// $FlowFixMe +Object.defineProperty(VueI18n, 'availabilities', { + get: function get () { + if (!availabilities) { + var intlDefined = typeof Intl !== 'undefined'; + availabilities = { + dateTimeFormat: intlDefined && typeof Intl.DateTimeFormat !== 'undefined', + numberFormat: intlDefined && typeof Intl.NumberFormat !== 'undefined' + }; + } + + return availabilities + } +}); + +VueI18n.install = install; +VueI18n.version = '8.20.0'; + +export default VueI18n; diff --git a/node_modules/vue-i18n/dist/vue-i18n.js b/node_modules/vue-i18n/dist/vue-i18n.js new file mode 100644 index 0000000..9509917 --- /dev/null +++ b/node_modules/vue-i18n/dist/vue-i18n.js @@ -0,0 +1,2138 @@ +/*! + * vue-i18n v8.20.0 + * (c) 2020 kazuya kawaguchi + * Released under the MIT License. + */ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global.VueI18n = factory()); +}(this, (function () { 'use strict'; + + /* */ + + /** + * constants + */ + + var numberFormatKeys = [ + 'style', + 'currency', + 'currencyDisplay', + 'useGrouping', + 'minimumIntegerDigits', + 'minimumFractionDigits', + 'maximumFractionDigits', + 'minimumSignificantDigits', + 'maximumSignificantDigits', + 'localeMatcher', + 'formatMatcher', + 'unit' + ]; + + /** + * utilities + */ + + function warn (msg, err) { + if (typeof console !== 'undefined') { + console.warn('[vue-i18n] ' + msg); + /* istanbul ignore if */ + if (err) { + console.warn(err.stack); + } + } + } + + function error (msg, err) { + if (typeof console !== 'undefined') { + console.error('[vue-i18n] ' + msg); + /* istanbul ignore if */ + if (err) { + console.error(err.stack); + } + } + } + + var isArray = Array.isArray; + + function isObject (obj) { + return obj !== null && typeof obj === 'object' + } + + function isBoolean (val) { + return typeof val === 'boolean' + } + + function isString (val) { + return typeof val === 'string' + } + + var toString = Object.prototype.toString; + var OBJECT_STRING = '[object Object]'; + function isPlainObject (obj) { + return toString.call(obj) === OBJECT_STRING + } + + function isNull (val) { + return val === null || val === undefined + } + + function parseArgs () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + var locale = null; + var params = null; + if (args.length === 1) { + if (isObject(args[0]) || Array.isArray(args[0])) { + params = args[0]; + } else if (typeof args[0] === 'string') { + locale = args[0]; + } + } else if (args.length === 2) { + if (typeof args[0] === 'string') { + locale = args[0]; + } + /* istanbul ignore if */ + if (isObject(args[1]) || Array.isArray(args[1])) { + params = args[1]; + } + } + + return { locale: locale, params: params } + } + + function looseClone (obj) { + return JSON.parse(JSON.stringify(obj)) + } + + function remove (arr, item) { + if (arr.length) { + var index = arr.indexOf(item); + if (index > -1) { + return arr.splice(index, 1) + } + } + } + + function includes (arr, item) { + return !!~arr.indexOf(item) + } + + var hasOwnProperty = Object.prototype.hasOwnProperty; + function hasOwn (obj, key) { + return hasOwnProperty.call(obj, key) + } + + function merge (target) { + var arguments$1 = arguments; + + var output = Object(target); + for (var i = 1; i < arguments.length; i++) { + var source = arguments$1[i]; + if (source !== undefined && source !== null) { + var key = (void 0); + for (key in source) { + if (hasOwn(source, key)) { + if (isObject(source[key])) { + output[key] = merge(output[key], source[key]); + } else { + output[key] = source[key]; + } + } + } + } + } + return output + } + + function looseEqual (a, b) { + if (a === b) { return true } + var isObjectA = isObject(a); + var isObjectB = isObject(b); + if (isObjectA && isObjectB) { + try { + var isArrayA = Array.isArray(a); + var isArrayB = Array.isArray(b); + if (isArrayA && isArrayB) { + return a.length === b.length && a.every(function (e, i) { + return looseEqual(e, b[i]) + }) + } else if (!isArrayA && !isArrayB) { + var keysA = Object.keys(a); + var keysB = Object.keys(b); + return keysA.length === keysB.length && keysA.every(function (key) { + return looseEqual(a[key], b[key]) + }) + } else { + /* istanbul ignore next */ + return false + } + } catch (e) { + /* istanbul ignore next */ + return false + } + } else if (!isObjectA && !isObjectB) { + return String(a) === String(b) + } else { + return false + } + } + + /* */ + + function extend (Vue) { + if (!Vue.prototype.hasOwnProperty('$i18n')) { + // $FlowFixMe + Object.defineProperty(Vue.prototype, '$i18n', { + get: function get () { return this._i18n } + }); + } + + Vue.prototype.$t = function (key) { + var values = [], len = arguments.length - 1; + while ( len-- > 0 ) values[ len ] = arguments[ len + 1 ]; + + var i18n = this.$i18n; + return i18n._t.apply(i18n, [ key, i18n.locale, i18n._getMessages(), this ].concat( values )) + }; + + Vue.prototype.$tc = function (key, choice) { + var values = [], len = arguments.length - 2; + while ( len-- > 0 ) values[ len ] = arguments[ len + 2 ]; + + var i18n = this.$i18n; + return i18n._tc.apply(i18n, [ key, i18n.locale, i18n._getMessages(), this, choice ].concat( values )) + }; + + Vue.prototype.$te = function (key, locale) { + var i18n = this.$i18n; + return i18n._te(key, i18n.locale, i18n._getMessages(), locale) + }; + + Vue.prototype.$d = function (value) { + var ref; + + var args = [], len = arguments.length - 1; + while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ]; + return (ref = this.$i18n).d.apply(ref, [ value ].concat( args )) + }; + + Vue.prototype.$n = function (value) { + var ref; + + var args = [], len = arguments.length - 1; + while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ]; + return (ref = this.$i18n).n.apply(ref, [ value ].concat( args )) + }; + } + + /* */ + + var mixin = { + beforeCreate: function beforeCreate () { + var options = this.$options; + options.i18n = options.i18n || (options.__i18n ? {} : null); + + if (options.i18n) { + if (options.i18n instanceof VueI18n) { + // init locale messages via custom blocks + if (options.__i18n) { + try { + var localeMessages = {}; + options.__i18n.forEach(function (resource) { + localeMessages = merge(localeMessages, JSON.parse(resource)); + }); + Object.keys(localeMessages).forEach(function (locale) { + options.i18n.mergeLocaleMessage(locale, localeMessages[locale]); + }); + } catch (e) { + { + error("Cannot parse locale messages via custom blocks.", e); + } + } + } + this._i18n = options.i18n; + this._i18nWatcher = this._i18n.watchI18nData(); + } else if (isPlainObject(options.i18n)) { + var rootI18n = this.$root && this.$root.$i18n && this.$root.$i18n instanceof VueI18n + ? this.$root.$i18n + : null; + // component local i18n + if (rootI18n) { + options.i18n.root = this.$root; + options.i18n.formatter = rootI18n.formatter; + options.i18n.fallbackLocale = rootI18n.fallbackLocale; + options.i18n.formatFallbackMessages = rootI18n.formatFallbackMessages; + options.i18n.silentTranslationWarn = rootI18n.silentTranslationWarn; + options.i18n.silentFallbackWarn = rootI18n.silentFallbackWarn; + options.i18n.pluralizationRules = rootI18n.pluralizationRules; + options.i18n.preserveDirectiveContent = rootI18n.preserveDirectiveContent; + } + + // init locale messages via custom blocks + if (options.__i18n) { + try { + var localeMessages$1 = {}; + options.__i18n.forEach(function (resource) { + localeMessages$1 = merge(localeMessages$1, JSON.parse(resource)); + }); + options.i18n.messages = localeMessages$1; + } catch (e) { + { + warn("Cannot parse locale messages via custom blocks.", e); + } + } + } + + var ref = options.i18n; + var sharedMessages = ref.sharedMessages; + if (sharedMessages && isPlainObject(sharedMessages)) { + options.i18n.messages = merge(options.i18n.messages, sharedMessages); + } + + this._i18n = new VueI18n(options.i18n); + this._i18nWatcher = this._i18n.watchI18nData(); + + if (options.i18n.sync === undefined || !!options.i18n.sync) { + this._localeWatcher = this.$i18n.watchLocale(); + } + + if (rootI18n) { + rootI18n.onComponentInstanceCreated(this._i18n); + } + } else { + { + warn("Cannot be interpreted 'i18n' option."); + } + } + } else if (this.$root && this.$root.$i18n && this.$root.$i18n instanceof VueI18n) { + // root i18n + this._i18n = this.$root.$i18n; + } else if (options.parent && options.parent.$i18n && options.parent.$i18n instanceof VueI18n) { + // parent i18n + this._i18n = options.parent.$i18n; + } + }, + + beforeMount: function beforeMount () { + var options = this.$options; + options.i18n = options.i18n || (options.__i18n ? {} : null); + + if (options.i18n) { + if (options.i18n instanceof VueI18n) { + // init locale messages via custom blocks + this._i18n.subscribeDataChanging(this); + this._subscribing = true; + } else if (isPlainObject(options.i18n)) { + this._i18n.subscribeDataChanging(this); + this._subscribing = true; + } else { + { + warn("Cannot be interpreted 'i18n' option."); + } + } + } else if (this.$root && this.$root.$i18n && this.$root.$i18n instanceof VueI18n) { + this._i18n.subscribeDataChanging(this); + this._subscribing = true; + } else if (options.parent && options.parent.$i18n && options.parent.$i18n instanceof VueI18n) { + this._i18n.subscribeDataChanging(this); + this._subscribing = true; + } + }, + + beforeDestroy: function beforeDestroy () { + if (!this._i18n) { return } + + var self = this; + this.$nextTick(function () { + if (self._subscribing) { + self._i18n.unsubscribeDataChanging(self); + delete self._subscribing; + } + + if (self._i18nWatcher) { + self._i18nWatcher(); + self._i18n.destroyVM(); + delete self._i18nWatcher; + } + + if (self._localeWatcher) { + self._localeWatcher(); + delete self._localeWatcher; + } + }); + } + }; + + /* */ + + var interpolationComponent = { + name: 'i18n', + functional: true, + props: { + tag: { + type: [String, Boolean, Object], + default: 'span' + }, + path: { + type: String, + required: true + }, + locale: { + type: String + }, + places: { + type: [Array, Object] + } + }, + render: function render (h, ref) { + var data = ref.data; + var parent = ref.parent; + var props = ref.props; + var slots = ref.slots; + + var $i18n = parent.$i18n; + if (!$i18n) { + { + warn('Cannot find VueI18n instance!'); + } + return + } + + var path = props.path; + var locale = props.locale; + var places = props.places; + var params = slots(); + var children = $i18n.i( + path, + locale, + onlyHasDefaultPlace(params) || places + ? useLegacyPlaces(params.default, places) + : params + ); + + var tag = (!!props.tag && props.tag !== true) || props.tag === false ? props.tag : 'span'; + return tag ? h(tag, data, children) : children + } + }; + + function onlyHasDefaultPlace (params) { + var prop; + for (prop in params) { + if (prop !== 'default') { return false } + } + return Boolean(prop) + } + + function useLegacyPlaces (children, places) { + var params = places ? createParamsFromPlaces(places) : {}; + + if (!children) { return params } + + // Filter empty text nodes + children = children.filter(function (child) { + return child.tag || child.text.trim() !== '' + }); + + var everyPlace = children.every(vnodeHasPlaceAttribute); + if (everyPlace) { + warn('`place` attribute is deprecated in next major version. Please switch to Vue slots.'); + } + + return children.reduce( + everyPlace ? assignChildPlace : assignChildIndex, + params + ) + } + + function createParamsFromPlaces (places) { + { + warn('`places` prop is deprecated in next major version. Please switch to Vue slots.'); + } + + return Array.isArray(places) + ? places.reduce(assignChildIndex, {}) + : Object.assign({}, places) + } + + function assignChildPlace (params, child) { + if (child.data && child.data.attrs && child.data.attrs.place) { + params[child.data.attrs.place] = child; + } + return params + } + + function assignChildIndex (params, child, index) { + params[index] = child; + return params + } + + function vnodeHasPlaceAttribute (vnode) { + return Boolean(vnode.data && vnode.data.attrs && vnode.data.attrs.place) + } + + /* */ + + var numberComponent = { + name: 'i18n-n', + functional: true, + props: { + tag: { + type: [String, Boolean, Object], + default: 'span' + }, + value: { + type: Number, + required: true + }, + format: { + type: [String, Object] + }, + locale: { + type: String + } + }, + render: function render (h, ref) { + var props = ref.props; + var parent = ref.parent; + var data = ref.data; + + var i18n = parent.$i18n; + + if (!i18n) { + { + warn('Cannot find VueI18n instance!'); + } + return null + } + + var key = null; + var options = null; + + if (isString(props.format)) { + key = props.format; + } else if (isObject(props.format)) { + if (props.format.key) { + key = props.format.key; + } + + // Filter out number format options only + options = Object.keys(props.format).reduce(function (acc, prop) { + var obj; + + if (includes(numberFormatKeys, prop)) { + return Object.assign({}, acc, ( obj = {}, obj[prop] = props.format[prop], obj )) + } + return acc + }, null); + } + + var locale = props.locale || i18n.locale; + var parts = i18n._ntp(props.value, locale, key, options); + + var values = parts.map(function (part, index) { + var obj; + + var slot = data.scopedSlots && data.scopedSlots[part.type]; + return slot ? slot(( obj = {}, obj[part.type] = part.value, obj.index = index, obj.parts = parts, obj )) : part.value + }); + + var tag = (!!props.tag && props.tag !== true) || props.tag === false ? props.tag : 'span'; + return tag + ? h(tag, { + attrs: data.attrs, + 'class': data['class'], + staticClass: data.staticClass + }, values) + : values + } + }; + + /* */ + + function bind (el, binding, vnode) { + if (!assert(el, vnode)) { return } + + t(el, binding, vnode); + } + + function update (el, binding, vnode, oldVNode) { + if (!assert(el, vnode)) { return } + + var i18n = vnode.context.$i18n; + if (localeEqual(el, vnode) && + (looseEqual(binding.value, binding.oldValue) && + looseEqual(el._localeMessage, i18n.getLocaleMessage(i18n.locale)))) { return } + + t(el, binding, vnode); + } + + function unbind (el, binding, vnode, oldVNode) { + var vm = vnode.context; + if (!vm) { + warn('Vue instance does not exists in VNode context'); + return + } + + var i18n = vnode.context.$i18n || {}; + if (!binding.modifiers.preserve && !i18n.preserveDirectiveContent) { + el.textContent = ''; + } + el._vt = undefined; + delete el['_vt']; + el._locale = undefined; + delete el['_locale']; + el._localeMessage = undefined; + delete el['_localeMessage']; + } + + function assert (el, vnode) { + var vm = vnode.context; + if (!vm) { + warn('Vue instance does not exists in VNode context'); + return false + } + + if (!vm.$i18n) { + warn('VueI18n instance does not exists in Vue instance'); + return false + } + + return true + } + + function localeEqual (el, vnode) { + var vm = vnode.context; + return el._locale === vm.$i18n.locale + } + + function t (el, binding, vnode) { + var ref$1, ref$2; + + var value = binding.value; + + var ref = parseValue(value); + var path = ref.path; + var locale = ref.locale; + var args = ref.args; + var choice = ref.choice; + if (!path && !locale && !args) { + warn('value type not supported'); + return + } + + if (!path) { + warn('`path` is required in v-t directive'); + return + } + + var vm = vnode.context; + if (choice != null) { + el._vt = el.textContent = (ref$1 = vm.$i18n).tc.apply(ref$1, [ path, choice ].concat( makeParams(locale, args) )); + } else { + el._vt = el.textContent = (ref$2 = vm.$i18n).t.apply(ref$2, [ path ].concat( makeParams(locale, args) )); + } + el._locale = vm.$i18n.locale; + el._localeMessage = vm.$i18n.getLocaleMessage(vm.$i18n.locale); + } + + function parseValue (value) { + var path; + var locale; + var args; + var choice; + + if (isString(value)) { + path = value; + } else if (isPlainObject(value)) { + path = value.path; + locale = value.locale; + args = value.args; + choice = value.choice; + } + + return { path: path, locale: locale, args: args, choice: choice } + } + + function makeParams (locale, args) { + var params = []; + + locale && params.push(locale); + if (args && (Array.isArray(args) || isPlainObject(args))) { + params.push(args); + } + + return params + } + + var Vue; + + function install (_Vue) { + /* istanbul ignore if */ + if (install.installed && _Vue === Vue) { + warn('already installed.'); + return + } + install.installed = true; + + Vue = _Vue; + + var version = (Vue.version && Number(Vue.version.split('.')[0])) || -1; + /* istanbul ignore if */ + if (version < 2) { + warn(("vue-i18n (" + (install.version) + ") need to use Vue 2.0 or later (Vue: " + (Vue.version) + ").")); + return + } + + extend(Vue); + Vue.mixin(mixin); + Vue.directive('t', { bind: bind, update: update, unbind: unbind }); + Vue.component(interpolationComponent.name, interpolationComponent); + Vue.component(numberComponent.name, numberComponent); + + // use simple mergeStrategies to prevent i18n instance lose '__proto__' + var strats = Vue.config.optionMergeStrategies; + strats.i18n = function (parentVal, childVal) { + return childVal === undefined + ? parentVal + : childVal + }; + } + + /* */ + + var BaseFormatter = function BaseFormatter () { + this._caches = Object.create(null); + }; + + BaseFormatter.prototype.interpolate = function interpolate (message, values) { + if (!values) { + return [message] + } + var tokens = this._caches[message]; + if (!tokens) { + tokens = parse(message); + this._caches[message] = tokens; + } + return compile(tokens, values) + }; + + + + var RE_TOKEN_LIST_VALUE = /^(?:\d)+/; + var RE_TOKEN_NAMED_VALUE = /^(?:\w)+/; + + function parse (format) { + var tokens = []; + var position = 0; + + var text = ''; + while (position < format.length) { + var char = format[position++]; + if (char === '{') { + if (text) { + tokens.push({ type: 'text', value: text }); + } + + text = ''; + var sub = ''; + char = format[position++]; + while (char !== undefined && char !== '}') { + sub += char; + char = format[position++]; + } + var isClosed = char === '}'; + + var type = RE_TOKEN_LIST_VALUE.test(sub) + ? 'list' + : isClosed && RE_TOKEN_NAMED_VALUE.test(sub) + ? 'named' + : 'unknown'; + tokens.push({ value: sub, type: type }); + } else if (char === '%') { + // when found rails i18n syntax, skip text capture + if (format[(position)] !== '{') { + text += char; + } + } else { + text += char; + } + } + + text && tokens.push({ type: 'text', value: text }); + + return tokens + } + + function compile (tokens, values) { + var compiled = []; + var index = 0; + + var mode = Array.isArray(values) + ? 'list' + : isObject(values) + ? 'named' + : 'unknown'; + if (mode === 'unknown') { return compiled } + + while (index < tokens.length) { + var token = tokens[index]; + switch (token.type) { + case 'text': + compiled.push(token.value); + break + case 'list': + compiled.push(values[parseInt(token.value, 10)]); + break + case 'named': + if (mode === 'named') { + compiled.push((values)[token.value]); + } else { + { + warn(("Type of token '" + (token.type) + "' and format of value '" + mode + "' don't match!")); + } + } + break + case 'unknown': + { + warn("Detect 'unknown' type of token!"); + } + break + } + index++; + } + + return compiled + } + + /* */ + + /** + * Path parser + * - Inspired: + * Vue.js Path parser + */ + + // actions + var APPEND = 0; + var PUSH = 1; + var INC_SUB_PATH_DEPTH = 2; + var PUSH_SUB_PATH = 3; + + // states + var BEFORE_PATH = 0; + var IN_PATH = 1; + var BEFORE_IDENT = 2; + var IN_IDENT = 3; + var IN_SUB_PATH = 4; + var IN_SINGLE_QUOTE = 5; + var IN_DOUBLE_QUOTE = 6; + var AFTER_PATH = 7; + var ERROR = 8; + + var pathStateMachine = []; + + pathStateMachine[BEFORE_PATH] = { + 'ws': [BEFORE_PATH], + 'ident': [IN_IDENT, APPEND], + '[': [IN_SUB_PATH], + 'eof': [AFTER_PATH] + }; + + pathStateMachine[IN_PATH] = { + 'ws': [IN_PATH], + '.': [BEFORE_IDENT], + '[': [IN_SUB_PATH], + 'eof': [AFTER_PATH] + }; + + pathStateMachine[BEFORE_IDENT] = { + 'ws': [BEFORE_IDENT], + 'ident': [IN_IDENT, APPEND], + '0': [IN_IDENT, APPEND], + 'number': [IN_IDENT, APPEND] + }; + + pathStateMachine[IN_IDENT] = { + 'ident': [IN_IDENT, APPEND], + '0': [IN_IDENT, APPEND], + 'number': [IN_IDENT, APPEND], + 'ws': [IN_PATH, PUSH], + '.': [BEFORE_IDENT, PUSH], + '[': [IN_SUB_PATH, PUSH], + 'eof': [AFTER_PATH, PUSH] + }; + + pathStateMachine[IN_SUB_PATH] = { + "'": [IN_SINGLE_QUOTE, APPEND], + '"': [IN_DOUBLE_QUOTE, APPEND], + '[': [IN_SUB_PATH, INC_SUB_PATH_DEPTH], + ']': [IN_PATH, PUSH_SUB_PATH], + 'eof': ERROR, + 'else': [IN_SUB_PATH, APPEND] + }; + + pathStateMachine[IN_SINGLE_QUOTE] = { + "'": [IN_SUB_PATH, APPEND], + 'eof': ERROR, + 'else': [IN_SINGLE_QUOTE, APPEND] + }; + + pathStateMachine[IN_DOUBLE_QUOTE] = { + '"': [IN_SUB_PATH, APPEND], + 'eof': ERROR, + 'else': [IN_DOUBLE_QUOTE, APPEND] + }; + + /** + * Check if an expression is a literal value. + */ + + var literalValueRE = /^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/; + function isLiteral (exp) { + return literalValueRE.test(exp) + } + + /** + * Strip quotes from a string + */ + + function stripQuotes (str) { + var a = str.charCodeAt(0); + var b = str.charCodeAt(str.length - 1); + return a === b && (a === 0x22 || a === 0x27) + ? str.slice(1, -1) + : str + } + + /** + * Determine the type of a character in a keypath. + */ + + function getPathCharType (ch) { + if (ch === undefined || ch === null) { return 'eof' } + + var code = ch.charCodeAt(0); + + switch (code) { + case 0x5B: // [ + case 0x5D: // ] + case 0x2E: // . + case 0x22: // " + case 0x27: // ' + return ch + + case 0x5F: // _ + case 0x24: // $ + case 0x2D: // - + return 'ident' + + case 0x09: // Tab + case 0x0A: // Newline + case 0x0D: // Return + case 0xA0: // No-break space + case 0xFEFF: // Byte Order Mark + case 0x2028: // Line Separator + case 0x2029: // Paragraph Separator + return 'ws' + } + + return 'ident' + } + + /** + * Format a subPath, return its plain form if it is + * a literal string or number. Otherwise prepend the + * dynamic indicator (*). + */ + + function formatSubPath (path) { + var trimmed = path.trim(); + // invalid leading 0 + if (path.charAt(0) === '0' && isNaN(path)) { return false } + + return isLiteral(trimmed) ? stripQuotes(trimmed) : '*' + trimmed + } + + /** + * Parse a string path into an array of segments + */ + + function parse$1 (path) { + var keys = []; + var index = -1; + var mode = BEFORE_PATH; + var subPathDepth = 0; + var c; + var key; + var newChar; + var type; + var transition; + var action; + var typeMap; + var actions = []; + + actions[PUSH] = function () { + if (key !== undefined) { + keys.push(key); + key = undefined; + } + }; + + actions[APPEND] = function () { + if (key === undefined) { + key = newChar; + } else { + key += newChar; + } + }; + + actions[INC_SUB_PATH_DEPTH] = function () { + actions[APPEND](); + subPathDepth++; + }; + + actions[PUSH_SUB_PATH] = function () { + if (subPathDepth > 0) { + subPathDepth--; + mode = IN_SUB_PATH; + actions[APPEND](); + } else { + subPathDepth = 0; + if (key === undefined) { return false } + key = formatSubPath(key); + if (key === false) { + return false + } else { + actions[PUSH](); + } + } + }; + + function maybeUnescapeQuote () { + var nextChar = path[index + 1]; + if ((mode === IN_SINGLE_QUOTE && nextChar === "'") || + (mode === IN_DOUBLE_QUOTE && nextChar === '"')) { + index++; + newChar = '\\' + nextChar; + actions[APPEND](); + return true + } + } + + while (mode !== null) { + index++; + c = path[index]; + + if (c === '\\' && maybeUnescapeQuote()) { + continue + } + + type = getPathCharType(c); + typeMap = pathStateMachine[mode]; + transition = typeMap[type] || typeMap['else'] || ERROR; + + if (transition === ERROR) { + return // parse error + } + + mode = transition[0]; + action = actions[transition[1]]; + if (action) { + newChar = transition[2]; + newChar = newChar === undefined + ? c + : newChar; + if (action() === false) { + return + } + } + + if (mode === AFTER_PATH) { + return keys + } + } + } + + + + + + var I18nPath = function I18nPath () { + this._cache = Object.create(null); + }; + + /** + * External parse that check for a cache hit first + */ + I18nPath.prototype.parsePath = function parsePath (path) { + var hit = this._cache[path]; + if (!hit) { + hit = parse$1(path); + if (hit) { + this._cache[path] = hit; + } + } + return hit || [] + }; + + /** + * Get path value from path string + */ + I18nPath.prototype.getPathValue = function getPathValue (obj, path) { + if (!isObject(obj)) { return null } + + var paths = this.parsePath(path); + if (paths.length === 0) { + return null + } else { + var length = paths.length; + var last = obj; + var i = 0; + while (i < length) { + var value = last[paths[i]]; + if (value === undefined) { + return null + } + last = value; + i++; + } + + return last + } + }; + + /* */ + + + + var htmlTagMatcher = /<\/?[\w\s="/.':;#-\/]+>/; + var linkKeyMatcher = /(?:@(?:\.[a-z]+)?:(?:[\w\-_|.]+|\([\w\-_|.]+\)))/g; + var linkKeyPrefixMatcher = /^@(?:\.([a-z]+))?:/; + var bracketsMatcher = /[()]/g; + var defaultModifiers = { + 'upper': function (str) { return str.toLocaleUpperCase(); }, + 'lower': function (str) { return str.toLocaleLowerCase(); }, + 'capitalize': function (str) { return ("" + (str.charAt(0).toLocaleUpperCase()) + (str.substr(1))); } + }; + + var defaultFormatter = new BaseFormatter(); + + var VueI18n = function VueI18n (options) { + var this$1 = this; + if ( options === void 0 ) options = {}; + + // Auto install if it is not done yet and `window` has `Vue`. + // To allow users to avoid auto-installation in some cases, + // this code should be placed here. See #290 + /* istanbul ignore if */ + if (!Vue && typeof window !== 'undefined' && window.Vue) { + install(window.Vue); + } + + var locale = options.locale || 'en-US'; + var fallbackLocale = options.fallbackLocale === false + ? false + : options.fallbackLocale || 'en-US'; + var messages = options.messages || {}; + var dateTimeFormats = options.dateTimeFormats || {}; + var numberFormats = options.numberFormats || {}; + + this._vm = null; + this._formatter = options.formatter || defaultFormatter; + this._modifiers = options.modifiers || {}; + this._missing = options.missing || null; + this._root = options.root || null; + this._sync = options.sync === undefined ? true : !!options.sync; + this._fallbackRoot = options.fallbackRoot === undefined + ? true + : !!options.fallbackRoot; + this._formatFallbackMessages = options.formatFallbackMessages === undefined + ? false + : !!options.formatFallbackMessages; + this._silentTranslationWarn = options.silentTranslationWarn === undefined + ? false + : options.silentTranslationWarn; + this._silentFallbackWarn = options.silentFallbackWarn === undefined + ? false + : !!options.silentFallbackWarn; + this._dateTimeFormatters = {}; + this._numberFormatters = {}; + this._path = new I18nPath(); + this._dataListeners = []; + this._componentInstanceCreatedListener = options.componentInstanceCreatedListener || null; + this._preserveDirectiveContent = options.preserveDirectiveContent === undefined + ? false + : !!options.preserveDirectiveContent; + this.pluralizationRules = options.pluralizationRules || {}; + this._warnHtmlInMessage = options.warnHtmlInMessage || 'off'; + this._postTranslation = options.postTranslation || null; + + /** + * @param choice {number} a choice index given by the input to $tc: `$tc('path.to.rule', choiceIndex)` + * @param choicesLength {number} an overall amount of available choices + * @returns a final choice index + */ + this.getChoiceIndex = function (choice, choicesLength) { + var thisPrototype = Object.getPrototypeOf(this$1); + if (thisPrototype && thisPrototype.getChoiceIndex) { + var prototypeGetChoiceIndex = (thisPrototype.getChoiceIndex); + return (prototypeGetChoiceIndex).call(this$1, choice, choicesLength) + } + + // Default (old) getChoiceIndex implementation - english-compatible + var defaultImpl = function (_choice, _choicesLength) { + _choice = Math.abs(_choice); + + if (_choicesLength === 2) { + return _choice + ? _choice > 1 + ? 1 + : 0 + : 1 + } + + return _choice ? Math.min(_choice, 2) : 0 + }; + + if (this$1.locale in this$1.pluralizationRules) { + return this$1.pluralizationRules[this$1.locale].apply(this$1, [choice, choicesLength]) + } else { + return defaultImpl(choice, choicesLength) + } + }; + + + this._exist = function (message, key) { + if (!message || !key) { return false } + if (!isNull(this$1._path.getPathValue(message, key))) { return true } + // fallback for flat key + if (message[key]) { return true } + return false + }; + + if (this._warnHtmlInMessage === 'warn' || this._warnHtmlInMessage === 'error') { + Object.keys(messages).forEach(function (locale) { + this$1._checkLocaleMessage(locale, this$1._warnHtmlInMessage, messages[locale]); + }); + } + + this._initVM({ + locale: locale, + fallbackLocale: fallbackLocale, + messages: messages, + dateTimeFormats: dateTimeFormats, + numberFormats: numberFormats + }); + }; + + var prototypeAccessors = { vm: { configurable: true },messages: { configurable: true },dateTimeFormats: { configurable: true },numberFormats: { configurable: true },availableLocales: { configurable: true },locale: { configurable: true },fallbackLocale: { configurable: true },formatFallbackMessages: { configurable: true },missing: { configurable: true },formatter: { configurable: true },silentTranslationWarn: { configurable: true },silentFallbackWarn: { configurable: true },preserveDirectiveContent: { configurable: true },warnHtmlInMessage: { configurable: true },postTranslation: { configurable: true } }; + + VueI18n.prototype._checkLocaleMessage = function _checkLocaleMessage (locale, level, message) { + var paths = []; + + var fn = function (level, locale, message, paths) { + if (isPlainObject(message)) { + Object.keys(message).forEach(function (key) { + var val = message[key]; + if (isPlainObject(val)) { + paths.push(key); + paths.push('.'); + fn(level, locale, val, paths); + paths.pop(); + paths.pop(); + } else { + paths.push(key); + fn(level, locale, val, paths); + paths.pop(); + } + }); + } else if (Array.isArray(message)) { + message.forEach(function (item, index) { + if (isPlainObject(item)) { + paths.push(("[" + index + "]")); + paths.push('.'); + fn(level, locale, item, paths); + paths.pop(); + paths.pop(); + } else { + paths.push(("[" + index + "]")); + fn(level, locale, item, paths); + paths.pop(); + } + }); + } else if (isString(message)) { + var ret = htmlTagMatcher.test(message); + if (ret) { + var msg = "Detected HTML in message '" + message + "' of keypath '" + (paths.join('')) + "' at '" + locale + "'. Consider component interpolation with '' to avoid XSS. See https://bit.ly/2ZqJzkp"; + if (level === 'warn') { + warn(msg); + } else if (level === 'error') { + error(msg); + } + } + } + }; + + fn(level, locale, message, paths); + }; + + VueI18n.prototype._initVM = function _initVM (data) { + var silent = Vue.config.silent; + Vue.config.silent = true; + this._vm = new Vue({ data: data }); + Vue.config.silent = silent; + }; + + VueI18n.prototype.destroyVM = function destroyVM () { + this._vm.$destroy(); + }; + + VueI18n.prototype.subscribeDataChanging = function subscribeDataChanging (vm) { + this._dataListeners.push(vm); + }; + + VueI18n.prototype.unsubscribeDataChanging = function unsubscribeDataChanging (vm) { + remove(this._dataListeners, vm); + }; + + VueI18n.prototype.watchI18nData = function watchI18nData () { + var self = this; + return this._vm.$watch('$data', function () { + var i = self._dataListeners.length; + while (i--) { + Vue.nextTick(function () { + self._dataListeners[i] && self._dataListeners[i].$forceUpdate(); + }); + } + }, { deep: true }) + }; + + VueI18n.prototype.watchLocale = function watchLocale () { + /* istanbul ignore if */ + if (!this._sync || !this._root) { return null } + var target = this._vm; + return this._root.$i18n.vm.$watch('locale', function (val) { + target.$set(target, 'locale', val); + target.$forceUpdate(); + }, { immediate: true }) + }; + + VueI18n.prototype.onComponentInstanceCreated = function onComponentInstanceCreated (newI18n) { + if (this._componentInstanceCreatedListener) { + this._componentInstanceCreatedListener(newI18n, this); + } + }; + + prototypeAccessors.vm.get = function () { return this._vm }; + + prototypeAccessors.messages.get = function () { return looseClone(this._getMessages()) }; + prototypeAccessors.dateTimeFormats.get = function () { return looseClone(this._getDateTimeFormats()) }; + prototypeAccessors.numberFormats.get = function () { return looseClone(this._getNumberFormats()) }; + prototypeAccessors.availableLocales.get = function () { return Object.keys(this.messages).sort() }; + + prototypeAccessors.locale.get = function () { return this._vm.locale }; + prototypeAccessors.locale.set = function (locale) { + this._vm.$set(this._vm, 'locale', locale); + }; + + prototypeAccessors.fallbackLocale.get = function () { return this._vm.fallbackLocale }; + prototypeAccessors.fallbackLocale.set = function (locale) { + this._localeChainCache = {}; + this._vm.$set(this._vm, 'fallbackLocale', locale); + }; + + prototypeAccessors.formatFallbackMessages.get = function () { return this._formatFallbackMessages }; + prototypeAccessors.formatFallbackMessages.set = function (fallback) { this._formatFallbackMessages = fallback; }; + + prototypeAccessors.missing.get = function () { return this._missing }; + prototypeAccessors.missing.set = function (handler) { this._missing = handler; }; + + prototypeAccessors.formatter.get = function () { return this._formatter }; + prototypeAccessors.formatter.set = function (formatter) { this._formatter = formatter; }; + + prototypeAccessors.silentTranslationWarn.get = function () { return this._silentTranslationWarn }; + prototypeAccessors.silentTranslationWarn.set = function (silent) { this._silentTranslationWarn = silent; }; + + prototypeAccessors.silentFallbackWarn.get = function () { return this._silentFallbackWarn }; + prototypeAccessors.silentFallbackWarn.set = function (silent) { this._silentFallbackWarn = silent; }; + + prototypeAccessors.preserveDirectiveContent.get = function () { return this._preserveDirectiveContent }; + prototypeAccessors.preserveDirectiveContent.set = function (preserve) { this._preserveDirectiveContent = preserve; }; + + prototypeAccessors.warnHtmlInMessage.get = function () { return this._warnHtmlInMessage }; + prototypeAccessors.warnHtmlInMessage.set = function (level) { + var this$1 = this; + + var orgLevel = this._warnHtmlInMessage; + this._warnHtmlInMessage = level; + if (orgLevel !== level && (level === 'warn' || level === 'error')) { + var messages = this._getMessages(); + Object.keys(messages).forEach(function (locale) { + this$1._checkLocaleMessage(locale, this$1._warnHtmlInMessage, messages[locale]); + }); + } + }; + + prototypeAccessors.postTranslation.get = function () { return this._postTranslation }; + prototypeAccessors.postTranslation.set = function (handler) { this._postTranslation = handler; }; + + VueI18n.prototype._getMessages = function _getMessages () { return this._vm.messages }; + VueI18n.prototype._getDateTimeFormats = function _getDateTimeFormats () { return this._vm.dateTimeFormats }; + VueI18n.prototype._getNumberFormats = function _getNumberFormats () { return this._vm.numberFormats }; + + VueI18n.prototype._warnDefault = function _warnDefault (locale, key, result, vm, values, interpolateMode) { + if (!isNull(result)) { return result } + if (this._missing) { + var missingRet = this._missing.apply(null, [locale, key, vm, values]); + if (isString(missingRet)) { + return missingRet + } + } else { + if (!this._isSilentTranslationWarn(key)) { + warn( + "Cannot translate the value of keypath '" + key + "'. " + + 'Use the value of keypath as default.' + ); + } + } + + if (this._formatFallbackMessages) { + var parsedArgs = parseArgs.apply(void 0, values); + return this._render(key, interpolateMode, parsedArgs.params, key) + } else { + return key + } + }; + + VueI18n.prototype._isFallbackRoot = function _isFallbackRoot (val) { + return !val && !isNull(this._root) && this._fallbackRoot + }; + + VueI18n.prototype._isSilentFallbackWarn = function _isSilentFallbackWarn (key) { + return this._silentFallbackWarn instanceof RegExp + ? this._silentFallbackWarn.test(key) + : this._silentFallbackWarn + }; + + VueI18n.prototype._isSilentFallback = function _isSilentFallback (locale, key) { + return this._isSilentFallbackWarn(key) && (this._isFallbackRoot() || locale !== this.fallbackLocale) + }; + + VueI18n.prototype._isSilentTranslationWarn = function _isSilentTranslationWarn (key) { + return this._silentTranslationWarn instanceof RegExp + ? this._silentTranslationWarn.test(key) + : this._silentTranslationWarn + }; + + VueI18n.prototype._interpolate = function _interpolate ( + locale, + message, + key, + host, + interpolateMode, + values, + visitedLinkStack + ) { + if (!message) { return null } + + var pathRet = this._path.getPathValue(message, key); + if (Array.isArray(pathRet) || isPlainObject(pathRet)) { return pathRet } + + var ret; + if (isNull(pathRet)) { + /* istanbul ignore else */ + if (isPlainObject(message)) { + ret = message[key]; + if (!isString(ret)) { + if (!this._isSilentTranslationWarn(key) && !this._isSilentFallback(locale, key)) { + warn(("Value of key '" + key + "' is not a string!")); + } + return null + } + } else { + return null + } + } else { + /* istanbul ignore else */ + if (isString(pathRet)) { + ret = pathRet; + } else { + if (!this._isSilentTranslationWarn(key) && !this._isSilentFallback(locale, key)) { + warn(("Value of key '" + key + "' is not a string!")); + } + return null + } + } + + // Check for the existence of links within the translated string + if (ret.indexOf('@:') >= 0 || ret.indexOf('@.') >= 0) { + ret = this._link(locale, message, ret, host, 'raw', values, visitedLinkStack); + } + + return this._render(ret, interpolateMode, values, key) + }; + + VueI18n.prototype._link = function _link ( + locale, + message, + str, + host, + interpolateMode, + values, + visitedLinkStack + ) { + var ret = str; + + // Match all the links within the local + // We are going to replace each of + // them with its translation + var matches = ret.match(linkKeyMatcher); + for (var idx in matches) { + // ie compatible: filter custom array + // prototype method + if (!matches.hasOwnProperty(idx)) { + continue + } + var link = matches[idx]; + var linkKeyPrefixMatches = link.match(linkKeyPrefixMatcher); + var linkPrefix = linkKeyPrefixMatches[0]; + var formatterName = linkKeyPrefixMatches[1]; + + // Remove the leading @:, @.case: and the brackets + var linkPlaceholder = link.replace(linkPrefix, '').replace(bracketsMatcher, ''); + + if (includes(visitedLinkStack, linkPlaceholder)) { + { + warn(("Circular reference found. \"" + link + "\" is already visited in the chain of " + (visitedLinkStack.reverse().join(' <- ')))); + } + return ret + } + visitedLinkStack.push(linkPlaceholder); + + // Translate the link + var translated = this._interpolate( + locale, message, linkPlaceholder, host, + interpolateMode === 'raw' ? 'string' : interpolateMode, + interpolateMode === 'raw' ? undefined : values, + visitedLinkStack + ); + + if (this._isFallbackRoot(translated)) { + if (!this._isSilentTranslationWarn(linkPlaceholder)) { + warn(("Fall back to translate the link placeholder '" + linkPlaceholder + "' with root locale.")); + } + /* istanbul ignore if */ + if (!this._root) { throw Error('unexpected error') } + var root = this._root.$i18n; + translated = root._translate( + root._getMessages(), root.locale, root.fallbackLocale, + linkPlaceholder, host, interpolateMode, values + ); + } + translated = this._warnDefault( + locale, linkPlaceholder, translated, host, + Array.isArray(values) ? values : [values], + interpolateMode + ); + + if (this._modifiers.hasOwnProperty(formatterName)) { + translated = this._modifiers[formatterName](translated); + } else if (defaultModifiers.hasOwnProperty(formatterName)) { + translated = defaultModifiers[formatterName](translated); + } + + visitedLinkStack.pop(); + + // Replace the link with the translated + ret = !translated ? ret : ret.replace(link, translated); + } + + return ret + }; + + VueI18n.prototype._render = function _render (message, interpolateMode, values, path) { + var ret = this._formatter.interpolate(message, values, path); + + // If the custom formatter refuses to work - apply the default one + if (!ret) { + ret = defaultFormatter.interpolate(message, values, path); + } + + // if interpolateMode is **not** 'string' ('row'), + // return the compiled data (e.g. ['foo', VNode, 'bar']) with formatter + return interpolateMode === 'string' && !isString(ret) ? ret.join('') : ret + }; + + VueI18n.prototype._appendItemToChain = function _appendItemToChain (chain, item, blocks) { + var follow = false; + if (!includes(chain, item)) { + follow = true; + if (item) { + follow = item[item.length - 1] !== '!'; + item = item.replace(/!/g, ''); + chain.push(item); + if (blocks && blocks[item]) { + follow = blocks[item]; + } + } + } + return follow + }; + + VueI18n.prototype._appendLocaleToChain = function _appendLocaleToChain (chain, locale, blocks) { + var follow; + var tokens = locale.split('-'); + do { + var item = tokens.join('-'); + follow = this._appendItemToChain(chain, item, blocks); + tokens.splice(-1, 1); + } while (tokens.length && (follow === true)) + return follow + }; + + VueI18n.prototype._appendBlockToChain = function _appendBlockToChain (chain, block, blocks) { + var follow = true; + for (var i = 0; (i < block.length) && (isBoolean(follow)); i++) { + var locale = block[i]; + if (isString(locale)) { + follow = this._appendLocaleToChain(chain, locale, blocks); + } + } + return follow + }; + + VueI18n.prototype._getLocaleChain = function _getLocaleChain (start, fallbackLocale) { + if (start === '') { return [] } + + if (!this._localeChainCache) { + this._localeChainCache = {}; + } + + var chain = this._localeChainCache[start]; + if (!chain) { + if (!fallbackLocale) { + fallbackLocale = this.fallbackLocale; + } + chain = []; + + // first block defined by start + var block = [start]; + + // while any intervening block found + while (isArray(block)) { + block = this._appendBlockToChain( + chain, + block, + fallbackLocale + ); + } + + // last block defined by default + var defaults; + if (isArray(fallbackLocale)) { + defaults = fallbackLocale; + } else if (isObject(fallbackLocale)) { + /* $FlowFixMe */ + if (fallbackLocale['default']) { + defaults = fallbackLocale['default']; + } else { + defaults = null; + } + } else { + defaults = fallbackLocale; + } + + // convert defaults to array + if (isString(defaults)) { + block = [defaults]; + } else { + block = defaults; + } + if (block) { + this._appendBlockToChain( + chain, + block, + null + ); + } + this._localeChainCache[start] = chain; + } + return chain + }; + + VueI18n.prototype._translate = function _translate ( + messages, + locale, + fallback, + key, + host, + interpolateMode, + args + ) { + var chain = this._getLocaleChain(locale, fallback); + var res; + for (var i = 0; i < chain.length; i++) { + var step = chain[i]; + res = + this._interpolate(step, messages[step], key, host, interpolateMode, args, [key]); + if (!isNull(res)) { + if (step !== locale && "development" !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) { + warn(("Fall back to translate the keypath '" + key + "' with '" + step + "' locale.")); + } + return res + } + } + return null + }; + + VueI18n.prototype._t = function _t (key, _locale, messages, host) { + var ref; + + var values = [], len = arguments.length - 4; + while ( len-- > 0 ) values[ len ] = arguments[ len + 4 ]; + if (!key) { return '' } + + var parsedArgs = parseArgs.apply(void 0, values); + var locale = parsedArgs.locale || _locale; + + var ret = this._translate( + messages, locale, this.fallbackLocale, key, + host, 'string', parsedArgs.params + ); + if (this._isFallbackRoot(ret)) { + if (!this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) { + warn(("Fall back to translate the keypath '" + key + "' with root locale.")); + } + /* istanbul ignore if */ + if (!this._root) { throw Error('unexpected error') } + return (ref = this._root).$t.apply(ref, [ key ].concat( values )) + } else { + ret = this._warnDefault(locale, key, ret, host, values, 'string'); + if (this._postTranslation && ret !== null && ret !== undefined) { + ret = this._postTranslation(ret, key); + } + return ret + } + }; + + VueI18n.prototype.t = function t (key) { + var ref; + + var values = [], len = arguments.length - 1; + while ( len-- > 0 ) values[ len ] = arguments[ len + 1 ]; + return (ref = this)._t.apply(ref, [ key, this.locale, this._getMessages(), null ].concat( values )) + }; + + VueI18n.prototype._i = function _i (key, locale, messages, host, values) { + var ret = + this._translate(messages, locale, this.fallbackLocale, key, host, 'raw', values); + if (this._isFallbackRoot(ret)) { + if (!this._isSilentTranslationWarn(key)) { + warn(("Fall back to interpolate the keypath '" + key + "' with root locale.")); + } + if (!this._root) { throw Error('unexpected error') } + return this._root.$i18n.i(key, locale, values) + } else { + return this._warnDefault(locale, key, ret, host, [values], 'raw') + } + }; + + VueI18n.prototype.i = function i (key, locale, values) { + /* istanbul ignore if */ + if (!key) { return '' } + + if (!isString(locale)) { + locale = this.locale; + } + + return this._i(key, locale, this._getMessages(), null, values) + }; + + VueI18n.prototype._tc = function _tc ( + key, + _locale, + messages, + host, + choice + ) { + var ref; + + var values = [], len = arguments.length - 5; + while ( len-- > 0 ) values[ len ] = arguments[ len + 5 ]; + if (!key) { return '' } + if (choice === undefined) { + choice = 1; + } + + var predefined = { 'count': choice, 'n': choice }; + var parsedArgs = parseArgs.apply(void 0, values); + parsedArgs.params = Object.assign(predefined, parsedArgs.params); + values = parsedArgs.locale === null ? [parsedArgs.params] : [parsedArgs.locale, parsedArgs.params]; + return this.fetchChoice((ref = this)._t.apply(ref, [ key, _locale, messages, host ].concat( values )), choice) + }; + + VueI18n.prototype.fetchChoice = function fetchChoice (message, choice) { + /* istanbul ignore if */ + if (!message && !isString(message)) { return null } + var choices = message.split('|'); + + choice = this.getChoiceIndex(choice, choices.length); + if (!choices[choice]) { return message } + return choices[choice].trim() + }; + + VueI18n.prototype.tc = function tc (key, choice) { + var ref; + + var values = [], len = arguments.length - 2; + while ( len-- > 0 ) values[ len ] = arguments[ len + 2 ]; + return (ref = this)._tc.apply(ref, [ key, this.locale, this._getMessages(), null, choice ].concat( values )) + }; + + VueI18n.prototype._te = function _te (key, locale, messages) { + var args = [], len = arguments.length - 3; + while ( len-- > 0 ) args[ len ] = arguments[ len + 3 ]; + + var _locale = parseArgs.apply(void 0, args).locale || locale; + return this._exist(messages[_locale], key) + }; + + VueI18n.prototype.te = function te (key, locale) { + return this._te(key, this.locale, this._getMessages(), locale) + }; + + VueI18n.prototype.getLocaleMessage = function getLocaleMessage (locale) { + return looseClone(this._vm.messages[locale] || {}) + }; + + VueI18n.prototype.setLocaleMessage = function setLocaleMessage (locale, message) { + if (this._warnHtmlInMessage === 'warn' || this._warnHtmlInMessage === 'error') { + this._checkLocaleMessage(locale, this._warnHtmlInMessage, message); + } + this._vm.$set(this._vm.messages, locale, message); + }; + + VueI18n.prototype.mergeLocaleMessage = function mergeLocaleMessage (locale, message) { + if (this._warnHtmlInMessage === 'warn' || this._warnHtmlInMessage === 'error') { + this._checkLocaleMessage(locale, this._warnHtmlInMessage, message); + } + this._vm.$set(this._vm.messages, locale, merge({}, this._vm.messages[locale] || {}, message)); + }; + + VueI18n.prototype.getDateTimeFormat = function getDateTimeFormat (locale) { + return looseClone(this._vm.dateTimeFormats[locale] || {}) + }; + + VueI18n.prototype.setDateTimeFormat = function setDateTimeFormat (locale, format) { + this._vm.$set(this._vm.dateTimeFormats, locale, format); + this._clearDateTimeFormat(locale, format); + }; + + VueI18n.prototype.mergeDateTimeFormat = function mergeDateTimeFormat (locale, format) { + this._vm.$set(this._vm.dateTimeFormats, locale, merge(this._vm.dateTimeFormats[locale] || {}, format)); + this._clearDateTimeFormat(locale, format); + }; + + VueI18n.prototype._clearDateTimeFormat = function _clearDateTimeFormat (locale, format) { + for (var key in format) { + var id = locale + "__" + key; + + if (!this._dateTimeFormatters.hasOwnProperty(id)) { + continue + } + + delete this._dateTimeFormatters[id]; + } + }; + + VueI18n.prototype._localizeDateTime = function _localizeDateTime ( + value, + locale, + fallback, + dateTimeFormats, + key + ) { + var _locale = locale; + var formats = dateTimeFormats[_locale]; + + var chain = this._getLocaleChain(locale, fallback); + for (var i = 0; i < chain.length; i++) { + var current = _locale; + var step = chain[i]; + formats = dateTimeFormats[step]; + _locale = step; + // fallback locale + if (isNull(formats) || isNull(formats[key])) { + if (step !== locale && "development" !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) { + warn(("Fall back to '" + step + "' datetime formats from '" + current + "' datetime formats.")); + } + } else { + break + } + } + + if (isNull(formats) || isNull(formats[key])) { + return null + } else { + var format = formats[key]; + var id = _locale + "__" + key; + var formatter = this._dateTimeFormatters[id]; + if (!formatter) { + formatter = this._dateTimeFormatters[id] = new Intl.DateTimeFormat(_locale, format); + } + return formatter.format(value) + } + }; + + VueI18n.prototype._d = function _d (value, locale, key) { + /* istanbul ignore if */ + if (!VueI18n.availabilities.dateTimeFormat) { + warn('Cannot format a Date value due to not supported Intl.DateTimeFormat.'); + return '' + } + + if (!key) { + return new Intl.DateTimeFormat(locale).format(value) + } + + var ret = + this._localizeDateTime(value, locale, this.fallbackLocale, this._getDateTimeFormats(), key); + if (this._isFallbackRoot(ret)) { + if (!this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) { + warn(("Fall back to datetime localization of root: key '" + key + "'.")); + } + /* istanbul ignore if */ + if (!this._root) { throw Error('unexpected error') } + return this._root.$i18n.d(value, key, locale) + } else { + return ret || '' + } + }; + + VueI18n.prototype.d = function d (value) { + var args = [], len = arguments.length - 1; + while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ]; + + var locale = this.locale; + var key = null; + + if (args.length === 1) { + if (isString(args[0])) { + key = args[0]; + } else if (isObject(args[0])) { + if (args[0].locale) { + locale = args[0].locale; + } + if (args[0].key) { + key = args[0].key; + } + } + } else if (args.length === 2) { + if (isString(args[0])) { + key = args[0]; + } + if (isString(args[1])) { + locale = args[1]; + } + } + + return this._d(value, locale, key) + }; + + VueI18n.prototype.getNumberFormat = function getNumberFormat (locale) { + return looseClone(this._vm.numberFormats[locale] || {}) + }; + + VueI18n.prototype.setNumberFormat = function setNumberFormat (locale, format) { + this._vm.$set(this._vm.numberFormats, locale, format); + this._clearNumberFormat(locale, format); + }; + + VueI18n.prototype.mergeNumberFormat = function mergeNumberFormat (locale, format) { + this._vm.$set(this._vm.numberFormats, locale, merge(this._vm.numberFormats[locale] || {}, format)); + this._clearNumberFormat(locale, format); + }; + + VueI18n.prototype._clearNumberFormat = function _clearNumberFormat (locale, format) { + for (var key in format) { + var id = locale + "__" + key; + + if (!this._numberFormatters.hasOwnProperty(id)) { + continue + } + + delete this._numberFormatters[id]; + } + }; + + VueI18n.prototype._getNumberFormatter = function _getNumberFormatter ( + value, + locale, + fallback, + numberFormats, + key, + options + ) { + var _locale = locale; + var formats = numberFormats[_locale]; + + var chain = this._getLocaleChain(locale, fallback); + for (var i = 0; i < chain.length; i++) { + var current = _locale; + var step = chain[i]; + formats = numberFormats[step]; + _locale = step; + // fallback locale + if (isNull(formats) || isNull(formats[key])) { + if (step !== locale && "development" !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) { + warn(("Fall back to '" + step + "' number formats from '" + current + "' number formats.")); + } + } else { + break + } + } + + if (isNull(formats) || isNull(formats[key])) { + return null + } else { + var format = formats[key]; + + var formatter; + if (options) { + // If options specified - create one time number formatter + formatter = new Intl.NumberFormat(_locale, Object.assign({}, format, options)); + } else { + var id = _locale + "__" + key; + formatter = this._numberFormatters[id]; + if (!formatter) { + formatter = this._numberFormatters[id] = new Intl.NumberFormat(_locale, format); + } + } + return formatter + } + }; + + VueI18n.prototype._n = function _n (value, locale, key, options) { + /* istanbul ignore if */ + if (!VueI18n.availabilities.numberFormat) { + { + warn('Cannot format a Number value due to not supported Intl.NumberFormat.'); + } + return '' + } + + if (!key) { + var nf = !options ? new Intl.NumberFormat(locale) : new Intl.NumberFormat(locale, options); + return nf.format(value) + } + + var formatter = this._getNumberFormatter(value, locale, this.fallbackLocale, this._getNumberFormats(), key, options); + var ret = formatter && formatter.format(value); + if (this._isFallbackRoot(ret)) { + if (!this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) { + warn(("Fall back to number localization of root: key '" + key + "'.")); + } + /* istanbul ignore if */ + if (!this._root) { throw Error('unexpected error') } + return this._root.$i18n.n(value, Object.assign({}, { key: key, locale: locale }, options)) + } else { + return ret || '' + } + }; + + VueI18n.prototype.n = function n (value) { + var args = [], len = arguments.length - 1; + while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ]; + + var locale = this.locale; + var key = null; + var options = null; + + if (args.length === 1) { + if (isString(args[0])) { + key = args[0]; + } else if (isObject(args[0])) { + if (args[0].locale) { + locale = args[0].locale; + } + if (args[0].key) { + key = args[0].key; + } + + // Filter out number format options only + options = Object.keys(args[0]).reduce(function (acc, key) { + var obj; + + if (includes(numberFormatKeys, key)) { + return Object.assign({}, acc, ( obj = {}, obj[key] = args[0][key], obj )) + } + return acc + }, null); + } + } else if (args.length === 2) { + if (isString(args[0])) { + key = args[0]; + } + if (isString(args[1])) { + locale = args[1]; + } + } + + return this._n(value, locale, key, options) + }; + + VueI18n.prototype._ntp = function _ntp (value, locale, key, options) { + /* istanbul ignore if */ + if (!VueI18n.availabilities.numberFormat) { + { + warn('Cannot format to parts a Number value due to not supported Intl.NumberFormat.'); + } + return [] + } + + if (!key) { + var nf = !options ? new Intl.NumberFormat(locale) : new Intl.NumberFormat(locale, options); + return nf.formatToParts(value) + } + + var formatter = this._getNumberFormatter(value, locale, this.fallbackLocale, this._getNumberFormats(), key, options); + var ret = formatter && formatter.formatToParts(value); + if (this._isFallbackRoot(ret)) { + if (!this._isSilentTranslationWarn(key)) { + warn(("Fall back to format number to parts of root: key '" + key + "' .")); + } + /* istanbul ignore if */ + if (!this._root) { throw Error('unexpected error') } + return this._root.$i18n._ntp(value, locale, key, options) + } else { + return ret || [] + } + }; + + Object.defineProperties( VueI18n.prototype, prototypeAccessors ); + + var availabilities; + // $FlowFixMe + Object.defineProperty(VueI18n, 'availabilities', { + get: function get () { + if (!availabilities) { + var intlDefined = typeof Intl !== 'undefined'; + availabilities = { + dateTimeFormat: intlDefined && typeof Intl.DateTimeFormat !== 'undefined', + numberFormat: intlDefined && typeof Intl.NumberFormat !== 'undefined' + }; + } + + return availabilities + } + }); + + VueI18n.install = install; + VueI18n.version = '8.20.0'; + + return VueI18n; + +}))); diff --git a/node_modules/vue-i18n/dist/vue-i18n.min.js b/node_modules/vue-i18n/dist/vue-i18n.min.js new file mode 100644 index 0000000..8d0a5c0 --- /dev/null +++ b/node_modules/vue-i18n/dist/vue-i18n.min.js @@ -0,0 +1,6 @@ +/*! + * vue-i18n v8.20.0 + * (c) 2020 kazuya kawaguchi + * Released under the MIT License. + */ +var t,e;t=this,e=function(){"use strict";var t=["style","currency","currencyDisplay","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","localeMatcher","formatMatcher","unit"];function e(t,e){"undefined"!=typeof console&&(console.warn("[vue-i18n] "+t),e&&console.warn(e.stack))}var n=Array.isArray;function r(t){return null!==t&&"object"==typeof t}function a(t){return"string"==typeof t}var i=Object.prototype.toString,o="[object Object]";function s(t){return i.call(t)===o}function l(t){return null==t}function c(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var n=null,a=null;return 1===t.length?r(t[0])||Array.isArray(t[0])?a=t[0]:"string"==typeof t[0]&&(n=t[0]):2===t.length&&("string"==typeof t[0]&&(n=t[0]),(r(t[1])||Array.isArray(t[1]))&&(a=t[1])),{locale:n,params:a}}function u(t){return JSON.parse(JSON.stringify(t))}function h(t,e){return!!~t.indexOf(e)}var f=Object.prototype.hasOwnProperty;function p(t,e){return f.call(t,e)}function m(t){for(var e=arguments,n=Object(t),a=1;a0;)e[n]=arguments[n+1];var r=this.$i18n;return r._t.apply(r,[t,r.locale,r._getMessages(),this].concat(e))},t.prototype.$tc=function(t,e){for(var n=[],r=arguments.length-2;r-- >0;)n[r]=arguments[r+2];var a=this.$i18n;return a._tc.apply(a,[t,a.locale,a._getMessages(),this,e].concat(n))},t.prototype.$te=function(t,e){var n=this.$i18n;return n._te(t,n.locale,n._getMessages(),e)},t.prototype.$d=function(t){for(var e,n=[],r=arguments.length-1;r-- >0;)n[r]=arguments[r+1];return(e=this.$i18n).d.apply(e,[t].concat(n))},t.prototype.$n=function(t){for(var e,n=[],r=arguments.length-1;r-- >0;)n[r]=arguments[r+1];return(e=this.$i18n).n.apply(e,[t].concat(n))}}(F),F.mixin(g),F.directive("t",{bind:w,update:$,unbind:M}),F.component(v.name,v),F.component(k.name,k),F.config.optionMergeStrategies.i18n=function(t,e){return void 0===e?t:e}}var D=function(){this._caches=Object.create(null)};D.prototype.interpolate=function(t,e){if(!e)return[t];var n=this._caches[t];return n||(n=function(t){var e=[],n=0,r="";for(;n0)h--,u=R,f[W]();else{if(h=0,void 0===n)return!1;if(!1===(n=J(n)))return!1;f[j]()}};null!==u;)if("\\"!==(e=t[++c])||!p()){if(a=U(e),(i=(s=z[u])[a]||s.else||E)===E)return;if(u=i[0],(o=f[i[1]])&&(r=void 0===(r=i[2])?e:r,!1===o()))return;if(u===V)return l}}(t))&&(this._cache[t]=e),e||[]},q.prototype.getPathValue=function(t,e){if(!r(t))return null;var n=this.parsePath(e);if(0===n.length)return null;for(var a=n.length,i=t,o=0;o/,Z=/(?:@(?:\.[a-z]+)?:(?:[\w\-_|.]+|\([\w\-_|.]+\)))/g,K=/^@(?:\.([a-z]+))?:/,Q=/[()]/g,Y={upper:function(t){return t.toLocaleUpperCase()},lower:function(t){return t.toLocaleLowerCase()},capitalize:function(t){return""+t.charAt(0).toLocaleUpperCase()+t.substr(1)}},tt=new D,et=function(t){var e=this;void 0===t&&(t={}),!F&&"undefined"!=typeof window&&window.Vue&&I(window.Vue);var n=t.locale||"en-US",r=!1!==t.fallbackLocale&&(t.fallbackLocale||"en-US"),a=t.messages||{},i=t.dateTimeFormats||{},o=t.numberFormats||{};this._vm=null,this._formatter=t.formatter||tt,this._modifiers=t.modifiers||{},this._missing=t.missing||null,this._root=t.root||null,this._sync=void 0===t.sync||!!t.sync,this._fallbackRoot=void 0===t.fallbackRoot||!!t.fallbackRoot,this._formatFallbackMessages=void 0!==t.formatFallbackMessages&&!!t.formatFallbackMessages,this._silentTranslationWarn=void 0!==t.silentTranslationWarn&&t.silentTranslationWarn,this._silentFallbackWarn=void 0!==t.silentFallbackWarn&&!!t.silentFallbackWarn,this._dateTimeFormatters={},this._numberFormatters={},this._path=new q,this._dataListeners=[],this._componentInstanceCreatedListener=t.componentInstanceCreatedListener||null,this._preserveDirectiveContent=void 0!==t.preserveDirectiveContent&&!!t.preserveDirectiveContent,this.pluralizationRules=t.pluralizationRules||{},this._warnHtmlInMessage=t.warnHtmlInMessage||"off",this._postTranslation=t.postTranslation||null,this.getChoiceIndex=function(t,n){var r=Object.getPrototypeOf(e);if(r&&r.getChoiceIndex)return r.getChoiceIndex.call(e,t,n);var a,i;return e.locale in e.pluralizationRules?e.pluralizationRules[e.locale].apply(e,[t,n]):(a=t,i=n,a=Math.abs(a),2===i?a?a>1?1:0:1:a?Math.min(a,2):0)},this._exist=function(t,n){return!(!t||!n)&&(!l(e._path.getPathValue(t,n))||!!t[n])},"warn"!==this._warnHtmlInMessage&&"error"!==this._warnHtmlInMessage||Object.keys(a).forEach(function(t){e._checkLocaleMessage(t,e._warnHtmlInMessage,a[t])}),this._initVM({locale:n,fallbackLocale:r,messages:a,dateTimeFormats:i,numberFormats:o})},nt={vm:{configurable:!0},messages:{configurable:!0},dateTimeFormats:{configurable:!0},numberFormats:{configurable:!0},availableLocales:{configurable:!0},locale:{configurable:!0},fallbackLocale:{configurable:!0},formatFallbackMessages:{configurable:!0},missing:{configurable:!0},formatter:{configurable:!0},silentTranslationWarn:{configurable:!0},silentFallbackWarn:{configurable:!0},preserveDirectiveContent:{configurable:!0},warnHtmlInMessage:{configurable:!0},postTranslation:{configurable:!0}};return et.prototype._checkLocaleMessage=function(t,n,r){var i=function(t,n,r,o){if(s(r))Object.keys(r).forEach(function(e){var a=r[e];s(a)?(o.push(e),o.push("."),i(t,n,a,o),o.pop(),o.pop()):(o.push(e),i(t,n,a,o),o.pop())});else if(Array.isArray(r))r.forEach(function(e,r){s(e)?(o.push("["+r+"]"),o.push("."),i(t,n,e,o),o.pop(),o.pop()):(o.push("["+r+"]"),i(t,n,e,o),o.pop())});else if(a(r)){if(X.test(r)){var l="Detected HTML in message '"+r+"' of keypath '"+o.join("")+"' at '"+n+"'. Consider component interpolation with '' to avoid XSS. See https://bit.ly/2ZqJzkp";"warn"===t?e(l):"error"===t&&function(t,e){"undefined"!=typeof console&&(console.error("[vue-i18n] "+t),e&&console.error(e.stack))}(l)}}};i(n,t,r,[])},et.prototype._initVM=function(t){var e=F.config.silent;F.config.silent=!0,this._vm=new F({data:t}),F.config.silent=e},et.prototype.destroyVM=function(){this._vm.$destroy()},et.prototype.subscribeDataChanging=function(t){this._dataListeners.push(t)},et.prototype.unsubscribeDataChanging=function(t){!function(t,e){if(t.length){var n=t.indexOf(e);if(n>-1)t.splice(n,1)}}(this._dataListeners,t)},et.prototype.watchI18nData=function(){var t=this;return this._vm.$watch("$data",function(){for(var e=t._dataListeners.length;e--;)F.nextTick(function(){t._dataListeners[e]&&t._dataListeners[e].$forceUpdate()})},{deep:!0})},et.prototype.watchLocale=function(){if(!this._sync||!this._root)return null;var t=this._vm;return this._root.$i18n.vm.$watch("locale",function(e){t.$set(t,"locale",e),t.$forceUpdate()},{immediate:!0})},et.prototype.onComponentInstanceCreated=function(t){this._componentInstanceCreatedListener&&this._componentInstanceCreatedListener(t,this)},nt.vm.get=function(){return this._vm},nt.messages.get=function(){return u(this._getMessages())},nt.dateTimeFormats.get=function(){return u(this._getDateTimeFormats())},nt.numberFormats.get=function(){return u(this._getNumberFormats())},nt.availableLocales.get=function(){return Object.keys(this.messages).sort()},nt.locale.get=function(){return this._vm.locale},nt.locale.set=function(t){this._vm.$set(this._vm,"locale",t)},nt.fallbackLocale.get=function(){return this._vm.fallbackLocale},nt.fallbackLocale.set=function(t){this._localeChainCache={},this._vm.$set(this._vm,"fallbackLocale",t)},nt.formatFallbackMessages.get=function(){return this._formatFallbackMessages},nt.formatFallbackMessages.set=function(t){this._formatFallbackMessages=t},nt.missing.get=function(){return this._missing},nt.missing.set=function(t){this._missing=t},nt.formatter.get=function(){return this._formatter},nt.formatter.set=function(t){this._formatter=t},nt.silentTranslationWarn.get=function(){return this._silentTranslationWarn},nt.silentTranslationWarn.set=function(t){this._silentTranslationWarn=t},nt.silentFallbackWarn.get=function(){return this._silentFallbackWarn},nt.silentFallbackWarn.set=function(t){this._silentFallbackWarn=t},nt.preserveDirectiveContent.get=function(){return this._preserveDirectiveContent},nt.preserveDirectiveContent.set=function(t){this._preserveDirectiveContent=t},nt.warnHtmlInMessage.get=function(){return this._warnHtmlInMessage},nt.warnHtmlInMessage.set=function(t){var e=this,n=this._warnHtmlInMessage;if(this._warnHtmlInMessage=t,n!==t&&("warn"===t||"error"===t)){var r=this._getMessages();Object.keys(r).forEach(function(t){e._checkLocaleMessage(t,e._warnHtmlInMessage,r[t])})}},nt.postTranslation.get=function(){return this._postTranslation},nt.postTranslation.set=function(t){this._postTranslation=t},et.prototype._getMessages=function(){return this._vm.messages},et.prototype._getDateTimeFormats=function(){return this._vm.dateTimeFormats},et.prototype._getNumberFormats=function(){return this._vm.numberFormats},et.prototype._warnDefault=function(t,e,n,r,i,o){if(!l(n))return n;if(this._missing){var s=this._missing.apply(null,[t,e,r,i]);if(a(s))return s}if(this._formatFallbackMessages){var u=c.apply(void 0,i);return this._render(e,o,u.params,e)}return e},et.prototype._isFallbackRoot=function(t){return!t&&!l(this._root)&&this._fallbackRoot},et.prototype._isSilentFallbackWarn=function(t){return this._silentFallbackWarn instanceof RegExp?this._silentFallbackWarn.test(t):this._silentFallbackWarn},et.prototype._isSilentFallback=function(t,e){return this._isSilentFallbackWarn(e)&&(this._isFallbackRoot()||t!==this.fallbackLocale)},et.prototype._isSilentTranslationWarn=function(t){return this._silentTranslationWarn instanceof RegExp?this._silentTranslationWarn.test(t):this._silentTranslationWarn},et.prototype._interpolate=function(t,e,n,r,i,o,c){if(!e)return null;var u,h=this._path.getPathValue(e,n);if(Array.isArray(h)||s(h))return h;if(l(h)){if(!s(e))return null;if(!a(u=e[n]))return null}else{if(!a(h))return null;u=h}return(u.indexOf("@:")>=0||u.indexOf("@.")>=0)&&(u=this._link(t,e,u,r,"raw",o,c)),this._render(u,i,o,n)},et.prototype._link=function(t,e,n,r,a,i,o){var s=n,l=s.match(Z);for(var c in l)if(l.hasOwnProperty(c)){var u=l[c],f=u.match(K),p=f[0],m=f[1],_=u.replace(p,"").replace(Q,"");if(h(o,_))return s;o.push(_);var g=this._interpolate(t,e,_,r,"raw"===a?"string":a,"raw"===a?void 0:i,o);if(this._isFallbackRoot(g)){if(!this._root)throw Error("unexpected error");var v=this._root.$i18n;g=v._translate(v._getMessages(),v.locale,v.fallbackLocale,_,r,a,i)}g=this._warnDefault(t,_,g,r,Array.isArray(i)?i:[i],a),this._modifiers.hasOwnProperty(m)?g=this._modifiers[m](g):Y.hasOwnProperty(m)&&(g=Y[m](g)),o.pop(),s=g?s.replace(u,g):s}return s},et.prototype._render=function(t,e,n,r){var i=this._formatter.interpolate(t,n,r);return i||(i=tt.interpolate(t,n,r)),"string"!==e||a(i)?i:i.join("")},et.prototype._appendItemToChain=function(t,e,n){var r=!1;return h(t,e)||(r=!0,e&&(r="!"!==e[e.length-1],e=e.replace(/!/g,""),t.push(e),n&&n[e]&&(r=n[e]))),r},et.prototype._appendLocaleToChain=function(t,e,n){var r,a=e.split("-");do{var i=a.join("-");r=this._appendItemToChain(t,i,n),a.splice(-1,1)}while(a.length&&!0===r);return r},et.prototype._appendBlockToChain=function(t,e,n){for(var r=!0,i=0;i0;)i[o]=arguments[o+4];if(!t)return"";var s=c.apply(void 0,i),l=s.locale||e,u=this._translate(n,l,this.fallbackLocale,t,r,"string",s.params);if(this._isFallbackRoot(u)){if(!this._root)throw Error("unexpected error");return(a=this._root).$t.apply(a,[t].concat(i))}return u=this._warnDefault(l,t,u,r,i,"string"),this._postTranslation&&null!=u&&(u=this._postTranslation(u,t)),u},et.prototype.t=function(t){for(var e,n=[],r=arguments.length-1;r-- >0;)n[r]=arguments[r+1];return(e=this)._t.apply(e,[t,this.locale,this._getMessages(),null].concat(n))},et.prototype._i=function(t,e,n,r,a){var i=this._translate(n,e,this.fallbackLocale,t,r,"raw",a);if(this._isFallbackRoot(i)){if(!this._root)throw Error("unexpected error");return this._root.$i18n.i(t,e,a)}return this._warnDefault(e,t,i,r,[a],"raw")},et.prototype.i=function(t,e,n){return t?(a(e)||(e=this.locale),this._i(t,e,this._getMessages(),null,n)):""},et.prototype._tc=function(t,e,n,r,a){for(var i,o=[],s=arguments.length-5;s-- >0;)o[s]=arguments[s+5];if(!t)return"";void 0===a&&(a=1);var l={count:a,n:a},u=c.apply(void 0,o);return u.params=Object.assign(l,u.params),o=null===u.locale?[u.params]:[u.locale,u.params],this.fetchChoice((i=this)._t.apply(i,[t,e,n,r].concat(o)),a)},et.prototype.fetchChoice=function(t,e){if(!t&&!a(t))return null;var n=t.split("|");return n[e=this.getChoiceIndex(e,n.length)]?n[e].trim():t},et.prototype.tc=function(t,e){for(var n,r=[],a=arguments.length-2;a-- >0;)r[a]=arguments[a+2];return(n=this)._tc.apply(n,[t,this.locale,this._getMessages(),null,e].concat(r))},et.prototype._te=function(t,e,n){for(var r=[],a=arguments.length-3;a-- >0;)r[a]=arguments[a+3];var i=c.apply(void 0,r).locale||e;return this._exist(n[i],t)},et.prototype.te=function(t,e){return this._te(t,this.locale,this._getMessages(),e)},et.prototype.getLocaleMessage=function(t){return u(this._vm.messages[t]||{})},et.prototype.setLocaleMessage=function(t,e){"warn"!==this._warnHtmlInMessage&&"error"!==this._warnHtmlInMessage||this._checkLocaleMessage(t,this._warnHtmlInMessage,e),this._vm.$set(this._vm.messages,t,e)},et.prototype.mergeLocaleMessage=function(t,e){"warn"!==this._warnHtmlInMessage&&"error"!==this._warnHtmlInMessage||this._checkLocaleMessage(t,this._warnHtmlInMessage,e),this._vm.$set(this._vm.messages,t,m({},this._vm.messages[t]||{},e))},et.prototype.getDateTimeFormat=function(t){return u(this._vm.dateTimeFormats[t]||{})},et.prototype.setDateTimeFormat=function(t,e){this._vm.$set(this._vm.dateTimeFormats,t,e),this._clearDateTimeFormat(t,e)},et.prototype.mergeDateTimeFormat=function(t,e){this._vm.$set(this._vm.dateTimeFormats,t,m(this._vm.dateTimeFormats[t]||{},e)),this._clearDateTimeFormat(t,e)},et.prototype._clearDateTimeFormat=function(t,e){for(var n in e){var r=t+"__"+n;this._dateTimeFormatters.hasOwnProperty(r)&&delete this._dateTimeFormatters[r]}},et.prototype._localizeDateTime=function(t,e,n,r,a){for(var i=e,o=r[i],s=this._getLocaleChain(e,n),c=0;c0;)e[n]=arguments[n+1];var i=this.locale,o=null;return 1===e.length?a(e[0])?o=e[0]:r(e[0])&&(e[0].locale&&(i=e[0].locale),e[0].key&&(o=e[0].key)):2===e.length&&(a(e[0])&&(o=e[0]),a(e[1])&&(i=e[1])),this._d(t,i,o)},et.prototype.getNumberFormat=function(t){return u(this._vm.numberFormats[t]||{})},et.prototype.setNumberFormat=function(t,e){this._vm.$set(this._vm.numberFormats,t,e),this._clearNumberFormat(t,e)},et.prototype.mergeNumberFormat=function(t,e){this._vm.$set(this._vm.numberFormats,t,m(this._vm.numberFormats[t]||{},e)),this._clearNumberFormat(t,e)},et.prototype._clearNumberFormat=function(t,e){for(var n in e){var r=t+"__"+n;this._numberFormatters.hasOwnProperty(r)&&delete this._numberFormatters[r]}},et.prototype._getNumberFormatter=function(t,e,n,r,a,i){for(var o=e,s=r[o],c=this._getLocaleChain(e,n),u=0;u0;)n[i]=arguments[i+1];var o=this.locale,s=null,l=null;return 1===n.length?a(n[0])?s=n[0]:r(n[0])&&(n[0].locale&&(o=n[0].locale),n[0].key&&(s=n[0].key),l=Object.keys(n[0]).reduce(function(e,r){var a;return h(t,r)?Object.assign({},e,((a={})[r]=n[0][r],a)):e},null)):2===n.length&&(a(n[0])&&(s=n[0]),a(n[1])&&(o=n[1])),this._n(e,o,s,l)},et.prototype._ntp=function(t,e,n,r){if(!et.availabilities.numberFormat)return[];if(!n)return(r?new Intl.NumberFormat(e,r):new Intl.NumberFormat(e)).formatToParts(t);var a=this._getNumberFormatter(t,e,this.fallbackLocale,this._getNumberFormats(),n,r),i=a&&a.formatToParts(t);if(this._isFallbackRoot(i)){if(!this._root)throw Error("unexpected error");return this._root.$i18n._ntp(t,e,n,r)}return i||[]},Object.defineProperties(et.prototype,nt),Object.defineProperty(et,"availabilities",{get:function(){if(!G){var t="undefined"!=typeof Intl;G={dateTimeFormat:t&&void 0!==Intl.DateTimeFormat,numberFormat:t&&void 0!==Intl.NumberFormat}}return G}}),et.install=I,et.version="8.20.0",et},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.VueI18n=e(); \ No newline at end of file diff --git a/node_modules/vue-i18n/package.json b/node_modules/vue-i18n/package.json new file mode 100644 index 0000000..42cd7ae --- /dev/null +++ b/node_modules/vue-i18n/package.json @@ -0,0 +1,176 @@ +{ + "_args": [ + [ + "vue-i18n@8.20.0", + "C:\\Users\\Administrator\\Documents\\HBuilderProjects\\uView示例" + ] + ], + "_from": "vue-i18n@8.20.0", + "_id": "vue-i18n@8.20.0", + "_inBundle": false, + "_integrity": "sha512-ZiAOoeR4d/JtKpbjipx3I80ey7cYG1ki5gQ7HwzWm4YFio9brA15BEYHjalEoBaEfzF5OBEZP+Y2MvAaWnyXXg==", + "_location": "/vue-i18n", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "vue-i18n@8.20.0", + "name": "vue-i18n", + "escapedName": "vue-i18n", + "rawSpec": "8.20.0", + "saveSpec": null, + "fetchSpec": "8.20.0" + }, + "_requiredBy": [ + "/" + ], + "_resolved": "https://registry.npmjs.org/vue-i18n/-/vue-i18n-8.20.0.tgz", + "_spec": "8.20.0", + "_where": "C:\\Users\\Administrator\\Documents\\HBuilderProjects\\uView示例", + "author": { + "name": "kazuya kawaguchi", + "email": "kawakazu80@gmail.com" + }, + "bugs": { + "url": "https://github.com/kazupon/vue-i18n/issues" + }, + "changelog": { + "labels": { + "Type: Feature": ":star: New Features", + "Type: Bug": ":bug: Bug Fixes", + "Type: Security": ":lock: Security Fixes", + "Type: Performance": ":chart_with_upwards_trend: Performance Fixes", + "Type: Improvement": ":zap: Improved Features", + "Type: Breaking": ":boom: Breaking Change", + "Type: Deprecated": ":warning: Deprecated Features", + "Type: I18n": ":globe_with_meridians: Internationalization", + "Type: A11y": ":wheelchair: Accessibility", + "Type: Documentation": ":pencil: Documentation" + } + }, + "description": "Internationalization plugin for Vue.js", + "devDependencies": { + "@babel/core": "^7.1.0", + "@babel/plugin-proposal-class-properties": "^7.1.0", + "@babel/plugin-syntax-flow": "^7.0.0", + "@babel/plugin-transform-flow-strip-types": "^7.0.0", + "@typescript-eslint/eslint-plugin": "^3.0.0", + "@typescript-eslint/parser": "^3.0.0", + "@vue/babel-preset-app": "^4.4.1", + "babel-eslint": "^10.1.0", + "babel-loader": "^8.1.0", + "babel-plugin-istanbul": "^6.0.0", + "babel-preset-power-assert": "^3.0.0", + "buble": "^0.19.3", + "chromedriver": "^83.0.0", + "core-js": "^3.6.5", + "cross-env": "^7.0.2", + "cross-spawn": "^7.0.3", + "eslint": "^6.8.0", + "eslint-loader": "^4.0.2", + "eslint-plugin-flowtype": "^4.7.0", + "eslint-plugin-ie11": "^1.0.0", + "eslint-plugin-no-autofix": "^1.0.1", + "eslint-plugin-vue": "^6.2.2", + "eslint-plugin-vue-libs": "^4.0.0", + "flow-bin": "^0.38.0", + "http-server": "^0.12.3", + "intl": "^1.2.5", + "karma": "^5.0.9", + "karma-chrome-launcher": "^3.1.0", + "karma-coverage": "^2.0.2", + "karma-firefox-launcher": "^1.1.0", + "karma-mocha": "^2.0.1", + "karma-mocha-reporter": "^2.2.5", + "karma-safari-launcher": "^1.0.0", + "karma-sauce-launcher": "^4.1.5", + "karma-sourcemap-loader": "^0.3.7", + "karma-webpack": "^4.0.2", + "lerna-changelog": "^1.0.0", + "lerna-changelog-label-schema": "^3.0.0", + "mocha": "^7.2.0", + "mocha-loader": "^5.0.0", + "nightwatch": "^1.3.5", + "nightwatch-helpers": "^1.2.0", + "power-assert": "^1.6.0", + "rollup": "^0.66.0", + "rollup-plugin-buble": "^0.19.2", + "rollup-plugin-commonjs": "^9.1.8", + "rollup-plugin-flow-no-whitespace": "^1.0.0", + "rollup-plugin-node-resolve": "^3.4.0", + "rollup-plugin-replace": "^2.0.0", + "selenium-server": "^3.141.59", + "shipjs": "^0.17.0", + "sinon": "^9.0.2", + "terser": "^3.17.0", + "typescript": "^3.9.3", + "vue": "^2.5.17", + "vue-github-button": "^1.1.2", + "vue-template-compiler": "^2.5.17", + "vuepress": "^1.5.0", + "webpack": "^4.43.0", + "webpack-cli": "^3.1.1", + "webpack-dev-middleware": "^3.7.2", + "webpack-dev-server": "^3.11.0" + }, + "files": [ + "dist/vue-i18n.js", + "dist/vue-i18n.min.js", + "dist/vue-i18n.common.js", + "dist/vue-i18n.esm.js", + "dist/vue-i18n.esm.browser.js", + "dist/vue-i18n.esm.browser.min.js", + "src/**/*.js", + "types/*.d.ts", + "decls", + "vetur/tags.json", + "vetur/attributes.json" + ], + "homepage": "https://github.com/kazupon/vue-i18n#readme", + "keywords": [ + "i18n", + "internationalization", + "plugin", + "vue", + "vue.js" + ], + "license": "MIT", + "main": "dist/vue-i18n.common.js", + "module": "dist/vue-i18n.esm.js", + "name": "vue-i18n", + "repository": { + "type": "git", + "url": "git+https://github.com/kazupon/vue-i18n.git" + }, + "scripts": { + "build": "node config/build.js", + "clean": "rm -rf coverage && rm -rf dist/*.js* && rm ./*.log", + "coverage": "cat ./coverage/lcov.info", + "dev": "cross-env BABEL_ENV=test webpack-dev-server --inline --hot --open --content-base ./test/unit/ --config config/webpack.dev.conf.js", + "docs:build": "cross-env NODE_ENV=production node config/version.js && cross-env NODE_ENV=production vuepress build vuepress -d docs", + "docs:clean": "rm -rf docs/**", + "docs:dev": "vuepress dev vuepress", + "flow": "flow check", + "lint": "eslint --fix src test types/**/*.ts", + "release:prepare": "shipjs prepare", + "release:trigger": "shipjs trigger", + "sauce": "npm run sauce:coolkids && npm run sauce:ie && npm run sauce:mobile", + "sauce:coolkids": "karma start config/karma.sauce.conf.js -- 0", + "sauce:ie": "karma start config/karma.sauce.conf.js -- 1", + "sauce:mobile": "karma start config/karma.sauce.conf.js -- 2", + "test": "npm run lint && npm run flow && npm run test:types && npm run test:cover && npm run test:e2e", + "test:cover": "cross-env BABEL_ENV=test karma start config/karma.cover.conf.js", + "test:e2e": "npm run build && node test/e2e/runner.js", + "test:types": "tsc -p types", + "test:unit": "cross-env BABEL_ENV=test karma start config/karma.unit.conf.js", + "test:unit:ci": "cross-env BABEL_ENV=test karma start config/karma.unit.ci.conf.js" + }, + "sideEffects": false, + "types": "types/index.d.ts", + "unpkg": "dist/vue-i18n.js", + "version": "8.20.0", + "vetur": { + "tags": "vetur/tags.json", + "attributes": "vetur/attributes.json" + } +} diff --git a/node_modules/vue-i18n/src/components/interpolation.js b/node_modules/vue-i18n/src/components/interpolation.js new file mode 100644 index 0000000..7d31457 --- /dev/null +++ b/node_modules/vue-i18n/src/components/interpolation.js @@ -0,0 +1,101 @@ +/* @flow */ + +import { warn } from '../util' + +export default { + name: 'i18n', + functional: true, + props: { + tag: { + type: [String, Boolean, Object], + default: 'span' + }, + path: { + type: String, + required: true + }, + locale: { + type: String + }, + places: { + type: [Array, Object] + } + }, + render (h: Function, { data, parent, props, slots }: Object) { + const { $i18n } = parent + if (!$i18n) { + if (process.env.NODE_ENV !== 'production') { + warn('Cannot find VueI18n instance!') + } + return + } + + const { path, locale, places } = props + const params = slots() + const children = $i18n.i( + path, + locale, + onlyHasDefaultPlace(params) || places + ? useLegacyPlaces(params.default, places) + : params + ) + + const tag = (!!props.tag && props.tag !== true) || props.tag === false ? props.tag : 'span' + return tag ? h(tag, data, children) : children + } +} + +function onlyHasDefaultPlace (params) { + let prop + for (prop in params) { + if (prop !== 'default') { return false } + } + return Boolean(prop) +} + +function useLegacyPlaces (children, places) { + const params = places ? createParamsFromPlaces(places) : {} + + if (!children) { return params } + + // Filter empty text nodes + children = children.filter(child => { + return child.tag || child.text.trim() !== '' + }) + + const everyPlace = children.every(vnodeHasPlaceAttribute) + if (process.env.NODE_ENV !== 'production' && everyPlace) { + warn('`place` attribute is deprecated in next major version. Please switch to Vue slots.') + } + + return children.reduce( + everyPlace ? assignChildPlace : assignChildIndex, + params + ) +} + +function createParamsFromPlaces (places) { + if (process.env.NODE_ENV !== 'production') { + warn('`places` prop is deprecated in next major version. Please switch to Vue slots.') + } + + return Array.isArray(places) + ? places.reduce(assignChildIndex, {}) + : Object.assign({}, places) +} + +function assignChildPlace (params, child) { + if (child.data && child.data.attrs && child.data.attrs.place) { + params[child.data.attrs.place] = child + } + return params +} + +function assignChildIndex (params, child, index) { + params[index] = child + return params +} + +function vnodeHasPlaceAttribute (vnode) { + return Boolean(vnode.data && vnode.data.attrs && vnode.data.attrs.place) +} diff --git a/node_modules/vue-i18n/src/components/number.js b/node_modules/vue-i18n/src/components/number.js new file mode 100644 index 0000000..bb7c6ff --- /dev/null +++ b/node_modules/vue-i18n/src/components/number.js @@ -0,0 +1,70 @@ +/* @flow */ + +import { warn, isString, isObject, includes, numberFormatKeys } from '../util' + +export default { + name: 'i18n-n', + functional: true, + props: { + tag: { + type: [String, Boolean, Object], + default: 'span' + }, + value: { + type: Number, + required: true + }, + format: { + type: [String, Object] + }, + locale: { + type: String + } + }, + render (h: Function, { props, parent, data }: Object) { + const i18n = parent.$i18n + + if (!i18n) { + if (process.env.NODE_ENV !== 'production') { + warn('Cannot find VueI18n instance!') + } + return null + } + + let key: ?string = null + let options: ?NumberFormatOptions = null + + if (isString(props.format)) { + key = props.format + } else if (isObject(props.format)) { + if (props.format.key) { + key = props.format.key + } + + // Filter out number format options only + options = Object.keys(props.format).reduce((acc, prop) => { + if (includes(numberFormatKeys, prop)) { + return Object.assign({}, acc, { [prop]: props.format[prop] }) + } + return acc + }, null) + } + + const locale: Locale = props.locale || i18n.locale + const parts: NumberFormatToPartsResult = i18n._ntp(props.value, locale, key, options) + + const values = parts.map((part, index) => { + const slot: ?Function = data.scopedSlots && data.scopedSlots[part.type] + return slot ? slot({ [part.type]: part.value, index, parts }) : part.value + }) + + const tag = (!!props.tag && props.tag !== true) || props.tag === false ? props.tag : 'span' + return tag + ? h(tag, { + attrs: data.attrs, + 'class': data['class'], + staticClass: data.staticClass + }, values) + : values + } +} diff --git a/node_modules/vue-i18n/src/directive.js b/node_modules/vue-i18n/src/directive.js new file mode 100644 index 0000000..ea1b2a8 --- /dev/null +++ b/node_modules/vue-i18n/src/directive.js @@ -0,0 +1,112 @@ +/* @flow */ + +import { warn, isString, isPlainObject, looseEqual } from './util' + +export function bind (el: any, binding: Object, vnode: any): void { + if (!assert(el, vnode)) { return } + + t(el, binding, vnode) +} + +export function update (el: any, binding: Object, vnode: any, oldVNode: any): void { + if (!assert(el, vnode)) { return } + + const i18n: any = vnode.context.$i18n + if (localeEqual(el, vnode) && + (looseEqual(binding.value, binding.oldValue) && + looseEqual(el._localeMessage, i18n.getLocaleMessage(i18n.locale)))) { return } + + t(el, binding, vnode) +} + +export function unbind (el: any, binding: Object, vnode: any, oldVNode: any): void { + const vm: any = vnode.context + if (!vm) { + warn('Vue instance does not exists in VNode context') + return + } + + const i18n: any = vnode.context.$i18n || {} + if (!binding.modifiers.preserve && !i18n.preserveDirectiveContent) { + el.textContent = '' + } + el._vt = undefined + delete el['_vt'] + el._locale = undefined + delete el['_locale'] + el._localeMessage = undefined + delete el['_localeMessage'] +} + +function assert (el: any, vnode: any): boolean { + const vm: any = vnode.context + if (!vm) { + warn('Vue instance does not exists in VNode context') + return false + } + + if (!vm.$i18n) { + warn('VueI18n instance does not exists in Vue instance') + return false + } + + return true +} + +function localeEqual (el: any, vnode: any): boolean { + const vm: any = vnode.context + return el._locale === vm.$i18n.locale +} + +function t (el: any, binding: Object, vnode: any): void { + const value: any = binding.value + + const { path, locale, args, choice } = parseValue(value) + if (!path && !locale && !args) { + warn('value type not supported') + return + } + + if (!path) { + warn('`path` is required in v-t directive') + return + } + + const vm: any = vnode.context + if (choice != null) { + el._vt = el.textContent = vm.$i18n.tc(path, choice, ...makeParams(locale, args)) + } else { + el._vt = el.textContent = vm.$i18n.t(path, ...makeParams(locale, args)) + } + el._locale = vm.$i18n.locale + el._localeMessage = vm.$i18n.getLocaleMessage(vm.$i18n.locale) +} + +function parseValue (value: any): Object { + let path: ?string + let locale: ?Locale + let args: any + let choice: ?number + + if (isString(value)) { + path = value + } else if (isPlainObject(value)) { + path = value.path + locale = value.locale + args = value.args + choice = value.choice + } + + return { path, locale, args, choice } +} + +function makeParams (locale: Locale, args: any): Array { + const params: Array = [] + + locale && params.push(locale) + if (args && (Array.isArray(args) || isPlainObject(args))) { + params.push(args) + } + + return params +} diff --git a/node_modules/vue-i18n/src/extend.js b/node_modules/vue-i18n/src/extend.js new file mode 100644 index 0000000..c845d7c --- /dev/null +++ b/node_modules/vue-i18n/src/extend.js @@ -0,0 +1,33 @@ +/* @flow */ + +export default function extend (Vue: any): void { + if (!Vue.prototype.hasOwnProperty('$i18n')) { + // $FlowFixMe + Object.defineProperty(Vue.prototype, '$i18n', { + get () { return this._i18n } + }) + } + + Vue.prototype.$t = function (key: Path, ...values: any): TranslateResult { + const i18n = this.$i18n + return i18n._t(key, i18n.locale, i18n._getMessages(), this, ...values) + } + + Vue.prototype.$tc = function (key: Path, choice?: number, ...values: any): TranslateResult { + const i18n = this.$i18n + return i18n._tc(key, i18n.locale, i18n._getMessages(), this, choice, ...values) + } + + Vue.prototype.$te = function (key: Path, locale?: Locale): boolean { + const i18n = this.$i18n + return i18n._te(key, i18n.locale, i18n._getMessages(), locale) + } + + Vue.prototype.$d = function (value: number | Date, ...args: any): DateTimeFormatResult { + return this.$i18n.d(value, ...args) + } + + Vue.prototype.$n = function (value: number, ...args: any): NumberFormatResult { + return this.$i18n.n(value, ...args) + } +} diff --git a/node_modules/vue-i18n/src/format.js b/node_modules/vue-i18n/src/format.js new file mode 100644 index 0000000..5b26d11 --- /dev/null +++ b/node_modules/vue-i18n/src/format.js @@ -0,0 +1,114 @@ +/* @flow */ + +import { warn, isObject } from './util' + +export default class BaseFormatter { + _caches: { [key: string]: Array } + + constructor () { + this._caches = Object.create(null) + } + + interpolate (message: string, values: any): Array { + if (!values) { + return [message] + } + let tokens: Array = this._caches[message] + if (!tokens) { + tokens = parse(message) + this._caches[message] = tokens + } + return compile(tokens, values) + } +} + +type Token = { + type: 'text' | 'named' | 'list' | 'unknown', + value: string +} + +const RE_TOKEN_LIST_VALUE: RegExp = /^(?:\d)+/ +const RE_TOKEN_NAMED_VALUE: RegExp = /^(?:\w)+/ + +export function parse (format: string): Array { + const tokens: Array = [] + let position: number = 0 + + let text: string = '' + while (position < format.length) { + let char: string = format[position++] + if (char === '{') { + if (text) { + tokens.push({ type: 'text', value: text }) + } + + text = '' + let sub: string = '' + char = format[position++] + while (char !== undefined && char !== '}') { + sub += char + char = format[position++] + } + const isClosed = char === '}' + + const type = RE_TOKEN_LIST_VALUE.test(sub) + ? 'list' + : isClosed && RE_TOKEN_NAMED_VALUE.test(sub) + ? 'named' + : 'unknown' + tokens.push({ value: sub, type }) + } else if (char === '%') { + // when found rails i18n syntax, skip text capture + if (format[(position)] !== '{') { + text += char + } + } else { + text += char + } + } + + text && tokens.push({ type: 'text', value: text }) + + return tokens +} + +export function compile (tokens: Array, values: Object | Array): Array { + const compiled: Array = [] + let index: number = 0 + + const mode: string = Array.isArray(values) + ? 'list' + : isObject(values) + ? 'named' + : 'unknown' + if (mode === 'unknown') { return compiled } + + while (index < tokens.length) { + const token: Token = tokens[index] + switch (token.type) { + case 'text': + compiled.push(token.value) + break + case 'list': + compiled.push(values[parseInt(token.value, 10)]) + break + case 'named': + if (mode === 'named') { + compiled.push((values: any)[token.value]) + } else { + if (process.env.NODE_ENV !== 'production') { + warn(`Type of token '${token.type}' and format of value '${mode}' don't match!`) + } + } + break + case 'unknown': + if (process.env.NODE_ENV !== 'production') { + warn(`Detect 'unknown' type of token!`) + } + break + } + index++ + } + + return compiled +} diff --git a/node_modules/vue-i18n/src/index.js b/node_modules/vue-i18n/src/index.js new file mode 100644 index 0000000..c5f6ed4 --- /dev/null +++ b/node_modules/vue-i18n/src/index.js @@ -0,0 +1,1049 @@ +/* @flow */ + +import { install, Vue } from './install' +import { + warn, + error, + isNull, + parseArgs, + isPlainObject, + isObject, + isArray, + isBoolean, + isString, + looseClone, + remove, + includes, + merge, + numberFormatKeys +} from './util' +import BaseFormatter from './format' +import I18nPath from './path' + +import type { PathValue } from './path' + +const htmlTagMatcher = /<\/?[\w\s="/.':;#-\/]+>/ +const linkKeyMatcher = /(?:@(?:\.[a-z]+)?:(?:[\w\-_|.]+|\([\w\-_|.]+\)))/g +const linkKeyPrefixMatcher = /^@(?:\.([a-z]+))?:/ +const bracketsMatcher = /[()]/g +const defaultModifiers = { + 'upper': str => str.toLocaleUpperCase(), + 'lower': str => str.toLocaleLowerCase(), + 'capitalize': str => `${str.charAt(0).toLocaleUpperCase()}${str.substr(1)}` +} + +const defaultFormatter = new BaseFormatter() + +export default class VueI18n { + static install: () => void + static version: string + static availabilities: IntlAvailability + + _vm: any + _formatter: Formatter + _modifiers: Modifiers + _root: any + _sync: boolean + _fallbackRoot: boolean + _localeChainCache: { [key: string]: Array; } + _missing: ?MissingHandler + _exist: Function + _silentTranslationWarn: boolean | RegExp + _silentFallbackWarn: boolean | RegExp + _formatFallbackMessages: boolean + _dateTimeFormatters: Object + _numberFormatters: Object + _path: I18nPath + _dataListeners: Array + _componentInstanceCreatedListener: ?ComponentInstanceCreatedListener + _preserveDirectiveContent: boolean + _warnHtmlInMessage: WarnHtmlInMessageLevel + _postTranslation: ?PostTranslationHandler + pluralizationRules: { + [lang: string]: (choice: number, choicesLength: number) => number + } + getChoiceIndex: GetChoiceIndex + + constructor (options: I18nOptions = {}) { + // Auto install if it is not done yet and `window` has `Vue`. + // To allow users to avoid auto-installation in some cases, + // this code should be placed here. See #290 + /* istanbul ignore if */ + if (!Vue && typeof window !== 'undefined' && window.Vue) { + install(window.Vue) + } + + const locale: Locale = options.locale || 'en-US' + const fallbackLocale: FallbackLocale = options.fallbackLocale === false + ? false + : options.fallbackLocale || 'en-US' + const messages: LocaleMessages = options.messages || {} + const dateTimeFormats = options.dateTimeFormats || {} + const numberFormats = options.numberFormats || {} + + this._vm = null + this._formatter = options.formatter || defaultFormatter + this._modifiers = options.modifiers || {} + this._missing = options.missing || null + this._root = options.root || null + this._sync = options.sync === undefined ? true : !!options.sync + this._fallbackRoot = options.fallbackRoot === undefined + ? true + : !!options.fallbackRoot + this._formatFallbackMessages = options.formatFallbackMessages === undefined + ? false + : !!options.formatFallbackMessages + this._silentTranslationWarn = options.silentTranslationWarn === undefined + ? false + : options.silentTranslationWarn + this._silentFallbackWarn = options.silentFallbackWarn === undefined + ? false + : !!options.silentFallbackWarn + this._dateTimeFormatters = {} + this._numberFormatters = {} + this._path = new I18nPath() + this._dataListeners = [] + this._componentInstanceCreatedListener = options.componentInstanceCreatedListener || null + this._preserveDirectiveContent = options.preserveDirectiveContent === undefined + ? false + : !!options.preserveDirectiveContent + this.pluralizationRules = options.pluralizationRules || {} + this._warnHtmlInMessage = options.warnHtmlInMessage || 'off' + this._postTranslation = options.postTranslation || null + + /** + * @param choice {number} a choice index given by the input to $tc: `$tc('path.to.rule', choiceIndex)` + * @param choicesLength {number} an overall amount of available choices + * @returns a final choice index + */ + this.getChoiceIndex = (choice: number, choicesLength: number): number => { + const thisPrototype = Object.getPrototypeOf(this) + if (thisPrototype && thisPrototype.getChoiceIndex) { + const prototypeGetChoiceIndex = (thisPrototype.getChoiceIndex: any) + return (prototypeGetChoiceIndex: GetChoiceIndex).call(this, choice, choicesLength) + } + + // Default (old) getChoiceIndex implementation - english-compatible + const defaultImpl = (_choice: number, _choicesLength: number) => { + _choice = Math.abs(_choice) + + if (_choicesLength === 2) { + return _choice + ? _choice > 1 + ? 1 + : 0 + : 1 + } + + return _choice ? Math.min(_choice, 2) : 0 + } + + if (this.locale in this.pluralizationRules) { + return this.pluralizationRules[this.locale].apply(this, [choice, choicesLength]) + } else { + return defaultImpl(choice, choicesLength) + } + } + + + this._exist = (message: Object, key: Path): boolean => { + if (!message || !key) { return false } + if (!isNull(this._path.getPathValue(message, key))) { return true } + // fallback for flat key + if (message[key]) { return true } + return false + } + + if (this._warnHtmlInMessage === 'warn' || this._warnHtmlInMessage === 'error') { + Object.keys(messages).forEach(locale => { + this._checkLocaleMessage(locale, this._warnHtmlInMessage, messages[locale]) + }) + } + + this._initVM({ + locale, + fallbackLocale, + messages, + dateTimeFormats, + numberFormats + }) + } + + _checkLocaleMessage (locale: Locale, level: WarnHtmlInMessageLevel, message: LocaleMessageObject): void { + const paths: Array = [] + + const fn = (level: WarnHtmlInMessageLevel, locale: Locale, message: any, paths: Array) => { + if (isPlainObject(message)) { + Object.keys(message).forEach(key => { + const val = message[key] + if (isPlainObject(val)) { + paths.push(key) + paths.push('.') + fn(level, locale, val, paths) + paths.pop() + paths.pop() + } else { + paths.push(key) + fn(level, locale, val, paths) + paths.pop() + } + }) + } else if (Array.isArray(message)) { + message.forEach((item, index) => { + if (isPlainObject(item)) { + paths.push(`[${index}]`) + paths.push('.') + fn(level, locale, item, paths) + paths.pop() + paths.pop() + } else { + paths.push(`[${index}]`) + fn(level, locale, item, paths) + paths.pop() + } + }) + } else if (isString(message)) { + const ret = htmlTagMatcher.test(message) + if (ret) { + const msg = `Detected HTML in message '${message}' of keypath '${paths.join('')}' at '${locale}'. Consider component interpolation with '' to avoid XSS. See https://bit.ly/2ZqJzkp` + if (level === 'warn') { + warn(msg) + } else if (level === 'error') { + error(msg) + } + } + } + } + + fn(level, locale, message, paths) + } + + _initVM (data: { + locale: Locale, + fallbackLocale: FallbackLocale, + messages: LocaleMessages, + dateTimeFormats: DateTimeFormats, + numberFormats: NumberFormats + }): void { + const silent = Vue.config.silent + Vue.config.silent = true + this._vm = new Vue({ data }) + Vue.config.silent = silent + } + + destroyVM (): void { + this._vm.$destroy() + } + + subscribeDataChanging (vm: any): void { + this._dataListeners.push(vm) + } + + unsubscribeDataChanging (vm: any): void { + remove(this._dataListeners, vm) + } + + watchI18nData (): Function { + const self = this + return this._vm.$watch('$data', () => { + let i = self._dataListeners.length + while (i--) { + Vue.nextTick(() => { + self._dataListeners[i] && self._dataListeners[i].$forceUpdate() + }) + } + }, { deep: true }) + } + + watchLocale (): ?Function { + /* istanbul ignore if */ + if (!this._sync || !this._root) { return null } + const target: any = this._vm + return this._root.$i18n.vm.$watch('locale', (val) => { + target.$set(target, 'locale', val) + target.$forceUpdate() + }, { immediate: true }) + } + + onComponentInstanceCreated (newI18n: I18n) { + if (this._componentInstanceCreatedListener) { + this._componentInstanceCreatedListener(newI18n, this) + } + } + + get vm (): any { return this._vm } + + get messages (): LocaleMessages { return looseClone(this._getMessages()) } + get dateTimeFormats (): DateTimeFormats { return looseClone(this._getDateTimeFormats()) } + get numberFormats (): NumberFormats { return looseClone(this._getNumberFormats()) } + get availableLocales (): Locale[] { return Object.keys(this.messages).sort() } + + get locale (): Locale { return this._vm.locale } + set locale (locale: Locale): void { + this._vm.$set(this._vm, 'locale', locale) + } + + get fallbackLocale (): FallbackLocale { return this._vm.fallbackLocale } + set fallbackLocale (locale: FallbackLocale): void { + this._localeChainCache = {} + this._vm.$set(this._vm, 'fallbackLocale', locale) + } + + get formatFallbackMessages (): boolean { return this._formatFallbackMessages } + set formatFallbackMessages (fallback: boolean): void { this._formatFallbackMessages = fallback } + + get missing (): ?MissingHandler { return this._missing } + set missing (handler: MissingHandler): void { this._missing = handler } + + get formatter (): Formatter { return this._formatter } + set formatter (formatter: Formatter): void { this._formatter = formatter } + + get silentTranslationWarn (): boolean | RegExp { return this._silentTranslationWarn } + set silentTranslationWarn (silent: boolean | RegExp): void { this._silentTranslationWarn = silent } + + get silentFallbackWarn (): boolean | RegExp { return this._silentFallbackWarn } + set silentFallbackWarn (silent: boolean | RegExp): void { this._silentFallbackWarn = silent } + + get preserveDirectiveContent (): boolean { return this._preserveDirectiveContent } + set preserveDirectiveContent (preserve: boolean): void { this._preserveDirectiveContent = preserve } + + get warnHtmlInMessage (): WarnHtmlInMessageLevel { return this._warnHtmlInMessage } + set warnHtmlInMessage (level: WarnHtmlInMessageLevel): void { + const orgLevel = this._warnHtmlInMessage + this._warnHtmlInMessage = level + if (orgLevel !== level && (level === 'warn' || level === 'error')) { + const messages = this._getMessages() + Object.keys(messages).forEach(locale => { + this._checkLocaleMessage(locale, this._warnHtmlInMessage, messages[locale]) + }) + } + } + + get postTranslation (): ?PostTranslationHandler { return this._postTranslation } + set postTranslation (handler: PostTranslationHandler): void { this._postTranslation = handler } + + _getMessages (): LocaleMessages { return this._vm.messages } + _getDateTimeFormats (): DateTimeFormats { return this._vm.dateTimeFormats } + _getNumberFormats (): NumberFormats { return this._vm.numberFormats } + + _warnDefault (locale: Locale, key: Path, result: ?any, vm: ?any, values: any, interpolateMode: string): ?string { + if (!isNull(result)) { return result } + if (this._missing) { + const missingRet = this._missing.apply(null, [locale, key, vm, values]) + if (isString(missingRet)) { + return missingRet + } + } else { + if (process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key)) { + warn( + `Cannot translate the value of keypath '${key}'. ` + + 'Use the value of keypath as default.' + ) + } + } + + if (this._formatFallbackMessages) { + const parsedArgs = parseArgs(...values) + return this._render(key, interpolateMode, parsedArgs.params, key) + } else { + return key + } + } + + _isFallbackRoot (val: any): boolean { + return !val && !isNull(this._root) && this._fallbackRoot + } + + _isSilentFallbackWarn (key: Path): boolean { + return this._silentFallbackWarn instanceof RegExp + ? this._silentFallbackWarn.test(key) + : this._silentFallbackWarn + } + + _isSilentFallback (locale: Locale, key: Path): boolean { + return this._isSilentFallbackWarn(key) && (this._isFallbackRoot() || locale !== this.fallbackLocale) + } + + _isSilentTranslationWarn (key: Path): boolean { + return this._silentTranslationWarn instanceof RegExp + ? this._silentTranslationWarn.test(key) + : this._silentTranslationWarn + } + + _interpolate ( + locale: Locale, + message: LocaleMessageObject, + key: Path, + host: any, + interpolateMode: string, + values: any, + visitedLinkStack: Array + ): any { + if (!message) { return null } + + const pathRet: PathValue = this._path.getPathValue(message, key) + if (Array.isArray(pathRet) || isPlainObject(pathRet)) { return pathRet } + + let ret: mixed + if (isNull(pathRet)) { + /* istanbul ignore else */ + if (isPlainObject(message)) { + ret = message[key] + if (!isString(ret)) { + if (process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallback(locale, key)) { + warn(`Value of key '${key}' is not a string!`) + } + return null + } + } else { + return null + } + } else { + /* istanbul ignore else */ + if (isString(pathRet)) { + ret = pathRet + } else { + if (process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallback(locale, key)) { + warn(`Value of key '${key}' is not a string!`) + } + return null + } + } + + // Check for the existence of links within the translated string + if (ret.indexOf('@:') >= 0 || ret.indexOf('@.') >= 0) { + ret = this._link(locale, message, ret, host, 'raw', values, visitedLinkStack) + } + + return this._render(ret, interpolateMode, values, key) + } + + _link ( + locale: Locale, + message: LocaleMessageObject, + str: string, + host: any, + interpolateMode: string, + values: any, + visitedLinkStack: Array + ): any { + let ret: string = str + + // Match all the links within the local + // We are going to replace each of + // them with its translation + const matches: any = ret.match(linkKeyMatcher) + for (let idx in matches) { + // ie compatible: filter custom array + // prototype method + if (!matches.hasOwnProperty(idx)) { + continue + } + const link: string = matches[idx] + const linkKeyPrefixMatches: any = link.match(linkKeyPrefixMatcher) + const [linkPrefix, formatterName] = linkKeyPrefixMatches + + // Remove the leading @:, @.case: and the brackets + const linkPlaceholder: string = link.replace(linkPrefix, '').replace(bracketsMatcher, '') + + if (includes(visitedLinkStack, linkPlaceholder)) { + if (process.env.NODE_ENV !== 'production') { + warn(`Circular reference found. "${link}" is already visited in the chain of ${visitedLinkStack.reverse().join(' <- ')}`) + } + return ret + } + visitedLinkStack.push(linkPlaceholder) + + // Translate the link + let translated: any = this._interpolate( + locale, message, linkPlaceholder, host, + interpolateMode === 'raw' ? 'string' : interpolateMode, + interpolateMode === 'raw' ? undefined : values, + visitedLinkStack + ) + + if (this._isFallbackRoot(translated)) { + if (process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(linkPlaceholder)) { + warn(`Fall back to translate the link placeholder '${linkPlaceholder}' with root locale.`) + } + /* istanbul ignore if */ + if (!this._root) { throw Error('unexpected error') } + const root: any = this._root.$i18n + translated = root._translate( + root._getMessages(), root.locale, root.fallbackLocale, + linkPlaceholder, host, interpolateMode, values + ) + } + translated = this._warnDefault( + locale, linkPlaceholder, translated, host, + Array.isArray(values) ? values : [values], + interpolateMode + ) + + if (this._modifiers.hasOwnProperty(formatterName)) { + translated = this._modifiers[formatterName](translated) + } else if (defaultModifiers.hasOwnProperty(formatterName)) { + translated = defaultModifiers[formatterName](translated) + } + + visitedLinkStack.pop() + + // Replace the link with the translated + ret = !translated ? ret : ret.replace(link, translated) + } + + return ret + } + + _render (message: string, interpolateMode: string, values: any, path: string): any { + let ret = this._formatter.interpolate(message, values, path) + + // If the custom formatter refuses to work - apply the default one + if (!ret) { + ret = defaultFormatter.interpolate(message, values, path) + } + + // if interpolateMode is **not** 'string' ('row'), + // return the compiled data (e.g. ['foo', VNode, 'bar']) with formatter + return interpolateMode === 'string' && !isString(ret) ? ret.join('') : ret + } + + _appendItemToChain (chain: Array, item: Locale, blocks: any): any { + let follow = false + if (!includes(chain, item)) { + follow = true + if (item) { + follow = item[item.length - 1] !== '!' + item = item.replace(/!/g, '') + chain.push(item) + if (blocks && blocks[item]) { + follow = blocks[item] + } + } + } + return follow + } + + _appendLocaleToChain (chain: Array, locale: Locale, blocks: any): any { + let follow + const tokens = locale.split('-') + do { + const item = tokens.join('-') + follow = this._appendItemToChain(chain, item, blocks) + tokens.splice(-1, 1) + } while (tokens.length && (follow === true)) + return follow + } + + _appendBlockToChain (chain: Array, block: Array | Object, blocks: any): any { + let follow = true + for (let i = 0; (i < block.length) && (isBoolean(follow)); i++) { + const locale = block[i] + if (isString(locale)) { + follow = this._appendLocaleToChain(chain, locale, blocks) + } + } + return follow + } + + _getLocaleChain (start: Locale, fallbackLocale: FallbackLocale): Array { + if (start === '') { return [] } + + if (!this._localeChainCache) { + this._localeChainCache = {} + } + + let chain = this._localeChainCache[start] + if (!chain) { + if (!fallbackLocale) { + fallbackLocale = this.fallbackLocale + } + chain = [] + + // first block defined by start + let block = [start] + + // while any intervening block found + while (isArray(block)) { + block = this._appendBlockToChain( + chain, + block, + fallbackLocale + ) + } + + // last block defined by default + let defaults + if (isArray(fallbackLocale)) { + defaults = fallbackLocale + } else if (isObject(fallbackLocale)) { + /* $FlowFixMe */ + if (fallbackLocale['default']) { + defaults = fallbackLocale['default'] + } else { + defaults = null + } + } else { + defaults = fallbackLocale + } + + // convert defaults to array + if (isString(defaults)) { + block = [defaults] + } else { + block = defaults + } + if (block) { + this._appendBlockToChain( + chain, + block, + null + ) + } + this._localeChainCache[start] = chain + } + return chain + } + + _translate ( + messages: LocaleMessages, + locale: Locale, + fallback: FallbackLocale, + key: Path, + host: any, + interpolateMode: string, + args: any + ): any { + const chain = this._getLocaleChain(locale, fallback) + let res + for (let i = 0; i < chain.length; i++) { + const step = chain[i] + res = + this._interpolate(step, messages[step], key, host, interpolateMode, args, [key]) + if (!isNull(res)) { + if (step !== locale && process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) { + warn(("Fall back to translate the keypath '" + key + "' with '" + step + "' locale.")) + } + return res + } + } + return null + } + + _t (key: Path, _locale: Locale, messages: LocaleMessages, host: any, ...values: any): any { + if (!key) { return '' } + + const parsedArgs = parseArgs(...values) + const locale: Locale = parsedArgs.locale || _locale + + let ret: any = this._translate( + messages, locale, this.fallbackLocale, key, + host, 'string', parsedArgs.params + ) + if (this._isFallbackRoot(ret)) { + if (process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) { + warn(`Fall back to translate the keypath '${key}' with root locale.`) + } + /* istanbul ignore if */ + if (!this._root) { throw Error('unexpected error') } + return this._root.$t(key, ...values) + } else { + ret = this._warnDefault(locale, key, ret, host, values, 'string') + if (this._postTranslation && ret !== null && ret !== undefined) { + ret = this._postTranslation(ret, key) + } + return ret + } + } + + t (key: Path, ...values: any): TranslateResult { + return this._t(key, this.locale, this._getMessages(), null, ...values) + } + + _i (key: Path, locale: Locale, messages: LocaleMessages, host: any, values: Object): any { + const ret: any = + this._translate(messages, locale, this.fallbackLocale, key, host, 'raw', values) + if (this._isFallbackRoot(ret)) { + if (process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key)) { + warn(`Fall back to interpolate the keypath '${key}' with root locale.`) + } + if (!this._root) { throw Error('unexpected error') } + return this._root.$i18n.i(key, locale, values) + } else { + return this._warnDefault(locale, key, ret, host, [values], 'raw') + } + } + + i (key: Path, locale: Locale, values: Object): TranslateResult { + /* istanbul ignore if */ + if (!key) { return '' } + + if (!isString(locale)) { + locale = this.locale + } + + return this._i(key, locale, this._getMessages(), null, values) + } + + _tc ( + key: Path, + _locale: Locale, + messages: LocaleMessages, + host: any, + choice?: number, + ...values: any + ): any { + if (!key) { return '' } + if (choice === undefined) { + choice = 1 + } + + const predefined = { 'count': choice, 'n': choice } + const parsedArgs = parseArgs(...values) + parsedArgs.params = Object.assign(predefined, parsedArgs.params) + values = parsedArgs.locale === null ? [parsedArgs.params] : [parsedArgs.locale, parsedArgs.params] + return this.fetchChoice(this._t(key, _locale, messages, host, ...values), choice) + } + + fetchChoice (message: string, choice: number): ?string { + /* istanbul ignore if */ + if (!message && !isString(message)) { return null } + const choices: Array = message.split('|') + + choice = this.getChoiceIndex(choice, choices.length) + if (!choices[choice]) { return message } + return choices[choice].trim() + } + + tc (key: Path, choice?: number, ...values: any): TranslateResult { + return this._tc(key, this.locale, this._getMessages(), null, choice, ...values) + } + + _te (key: Path, locale: Locale, messages: LocaleMessages, ...args: any): boolean { + const _locale: Locale = parseArgs(...args).locale || locale + return this._exist(messages[_locale], key) + } + + te (key: Path, locale?: Locale): boolean { + return this._te(key, this.locale, this._getMessages(), locale) + } + + getLocaleMessage (locale: Locale): LocaleMessageObject { + return looseClone(this._vm.messages[locale] || {}) + } + + setLocaleMessage (locale: Locale, message: LocaleMessageObject): void { + if (this._warnHtmlInMessage === 'warn' || this._warnHtmlInMessage === 'error') { + this._checkLocaleMessage(locale, this._warnHtmlInMessage, message) + } + this._vm.$set(this._vm.messages, locale, message) + } + + mergeLocaleMessage (locale: Locale, message: LocaleMessageObject): void { + if (this._warnHtmlInMessage === 'warn' || this._warnHtmlInMessage === 'error') { + this._checkLocaleMessage(locale, this._warnHtmlInMessage, message) + } + this._vm.$set(this._vm.messages, locale, merge({}, this._vm.messages[locale] || {}, message)) + } + + getDateTimeFormat (locale: Locale): DateTimeFormat { + return looseClone(this._vm.dateTimeFormats[locale] || {}) + } + + setDateTimeFormat (locale: Locale, format: DateTimeFormat): void { + this._vm.$set(this._vm.dateTimeFormats, locale, format) + this._clearDateTimeFormat(locale, format) + } + + mergeDateTimeFormat (locale: Locale, format: DateTimeFormat): void { + this._vm.$set(this._vm.dateTimeFormats, locale, merge(this._vm.dateTimeFormats[locale] || {}, format)) + this._clearDateTimeFormat(locale, format) + } + + _clearDateTimeFormat (locale: Locale, format: DateTimeFormat): void { + for (let key in format) { + const id = `${locale}__${key}` + + if (!this._dateTimeFormatters.hasOwnProperty(id)) { + continue + } + + delete this._dateTimeFormatters[id] + } + } + + _localizeDateTime ( + value: number | Date, + locale: Locale, + fallback: FallbackLocale, + dateTimeFormats: DateTimeFormats, + key: string + ): ?DateTimeFormatResult { + let _locale: Locale = locale + let formats: DateTimeFormat = dateTimeFormats[_locale] + + const chain = this._getLocaleChain(locale, fallback) + for (let i = 0; i < chain.length; i++) { + const current = _locale + const step = chain[i] + formats = dateTimeFormats[step] + _locale = step + // fallback locale + if (isNull(formats) || isNull(formats[key])) { + if (step !== locale && process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) { + warn(`Fall back to '${step}' datetime formats from '${current}' datetime formats.`) + } + } else { + break + } + } + + if (isNull(formats) || isNull(formats[key])) { + return null + } else { + const format: ?DateTimeFormatOptions = formats[key] + const id = `${_locale}__${key}` + let formatter = this._dateTimeFormatters[id] + if (!formatter) { + formatter = this._dateTimeFormatters[id] = new Intl.DateTimeFormat(_locale, format) + } + return formatter.format(value) + } + } + + _d (value: number | Date, locale: Locale, key: ?string): DateTimeFormatResult { + /* istanbul ignore if */ + if (process.env.NODE_ENV !== 'production' && !VueI18n.availabilities.dateTimeFormat) { + warn('Cannot format a Date value due to not supported Intl.DateTimeFormat.') + return '' + } + + if (!key) { + return new Intl.DateTimeFormat(locale).format(value) + } + + const ret: ?DateTimeFormatResult = + this._localizeDateTime(value, locale, this.fallbackLocale, this._getDateTimeFormats(), key) + if (this._isFallbackRoot(ret)) { + if (process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) { + warn(`Fall back to datetime localization of root: key '${key}'.`) + } + /* istanbul ignore if */ + if (!this._root) { throw Error('unexpected error') } + return this._root.$i18n.d(value, key, locale) + } else { + return ret || '' + } + } + + d (value: number | Date, ...args: any): DateTimeFormatResult { + let locale: Locale = this.locale + let key: ?string = null + + if (args.length === 1) { + if (isString(args[0])) { + key = args[0] + } else if (isObject(args[0])) { + if (args[0].locale) { + locale = args[0].locale + } + if (args[0].key) { + key = args[0].key + } + } + } else if (args.length === 2) { + if (isString(args[0])) { + key = args[0] + } + if (isString(args[1])) { + locale = args[1] + } + } + + return this._d(value, locale, key) + } + + getNumberFormat (locale: Locale): NumberFormat { + return looseClone(this._vm.numberFormats[locale] || {}) + } + + setNumberFormat (locale: Locale, format: NumberFormat): void { + this._vm.$set(this._vm.numberFormats, locale, format) + this._clearNumberFormat(locale, format) + } + + mergeNumberFormat (locale: Locale, format: NumberFormat): void { + this._vm.$set(this._vm.numberFormats, locale, merge(this._vm.numberFormats[locale] || {}, format)) + this._clearNumberFormat(locale, format) + } + + _clearNumberFormat (locale: Locale, format: NumberFormat): void { + for (let key in format) { + const id = `${locale}__${key}` + + if (!this._numberFormatters.hasOwnProperty(id)) { + continue + } + + delete this._numberFormatters[id] + } + } + + _getNumberFormatter ( + value: number, + locale: Locale, + fallback: FallbackLocale, + numberFormats: NumberFormats, + key: string, + options: ?NumberFormatOptions + ): ?Object { + let _locale: Locale = locale + let formats: NumberFormat = numberFormats[_locale] + + const chain = this._getLocaleChain(locale, fallback) + for (let i = 0; i < chain.length; i++) { + const current = _locale + const step = chain[i] + formats = numberFormats[step] + _locale = step + // fallback locale + if (isNull(formats) || isNull(formats[key])) { + if (step !== locale && process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) { + warn(`Fall back to '${step}' number formats from '${current}' number formats.`) + } + } else { + break + } + } + + if (isNull(formats) || isNull(formats[key])) { + return null + } else { + const format: ?NumberFormatOptions = formats[key] + + let formatter + if (options) { + // If options specified - create one time number formatter + formatter = new Intl.NumberFormat(_locale, Object.assign({}, format, options)) + } else { + const id = `${_locale}__${key}` + formatter = this._numberFormatters[id] + if (!formatter) { + formatter = this._numberFormatters[id] = new Intl.NumberFormat(_locale, format) + } + } + return formatter + } + } + + _n (value: number, locale: Locale, key: ?string, options: ?NumberFormatOptions): NumberFormatResult { + /* istanbul ignore if */ + if (!VueI18n.availabilities.numberFormat) { + if (process.env.NODE_ENV !== 'production') { + warn('Cannot format a Number value due to not supported Intl.NumberFormat.') + } + return '' + } + + if (!key) { + const nf = !options ? new Intl.NumberFormat(locale) : new Intl.NumberFormat(locale, options) + return nf.format(value) + } + + const formatter: ?Object = this._getNumberFormatter(value, locale, this.fallbackLocale, this._getNumberFormats(), key, options) + const ret: ?NumberFormatResult = formatter && formatter.format(value) + if (this._isFallbackRoot(ret)) { + if (process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) { + warn(`Fall back to number localization of root: key '${key}'.`) + } + /* istanbul ignore if */ + if (!this._root) { throw Error('unexpected error') } + return this._root.$i18n.n(value, Object.assign({}, { key, locale }, options)) + } else { + return ret || '' + } + } + + n (value: number, ...args: any): NumberFormatResult { + let locale: Locale = this.locale + let key: ?string = null + let options: ?NumberFormatOptions = null + + if (args.length === 1) { + if (isString(args[0])) { + key = args[0] + } else if (isObject(args[0])) { + if (args[0].locale) { + locale = args[0].locale + } + if (args[0].key) { + key = args[0].key + } + + // Filter out number format options only + options = Object.keys(args[0]).reduce((acc, key) => { + if (includes(numberFormatKeys, key)) { + return Object.assign({}, acc, { [key]: args[0][key] }) + } + return acc + }, null) + } + } else if (args.length === 2) { + if (isString(args[0])) { + key = args[0] + } + if (isString(args[1])) { + locale = args[1] + } + } + + return this._n(value, locale, key, options) + } + + _ntp (value: number, locale: Locale, key: ?string, options: ?NumberFormatOptions): NumberFormatToPartsResult { + /* istanbul ignore if */ + if (!VueI18n.availabilities.numberFormat) { + if (process.env.NODE_ENV !== 'production') { + warn('Cannot format to parts a Number value due to not supported Intl.NumberFormat.') + } + return [] + } + + if (!key) { + const nf = !options ? new Intl.NumberFormat(locale) : new Intl.NumberFormat(locale, options) + return nf.formatToParts(value) + } + + const formatter: ?Object = this._getNumberFormatter(value, locale, this.fallbackLocale, this._getNumberFormats(), key, options) + const ret: ?NumberFormatToPartsResult = formatter && formatter.formatToParts(value) + if (this._isFallbackRoot(ret)) { + if (process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key)) { + warn(`Fall back to format number to parts of root: key '${key}' .`) + } + /* istanbul ignore if */ + if (!this._root) { throw Error('unexpected error') } + return this._root.$i18n._ntp(value, locale, key, options) + } else { + return ret || [] + } + } +} + +let availabilities: IntlAvailability +// $FlowFixMe +Object.defineProperty(VueI18n, 'availabilities', { + get () { + if (!availabilities) { + const intlDefined = typeof Intl !== 'undefined' + availabilities = { + dateTimeFormat: intlDefined && typeof Intl.DateTimeFormat !== 'undefined', + numberFormat: intlDefined && typeof Intl.NumberFormat !== 'undefined' + } + } + + return availabilities + } +}) + +VueI18n.install = install +VueI18n.version = '__VERSION__' diff --git a/node_modules/vue-i18n/src/install.js b/node_modules/vue-i18n/src/install.js new file mode 100644 index 0000000..62edbc2 --- /dev/null +++ b/node_modules/vue-i18n/src/install.js @@ -0,0 +1,40 @@ +import { warn } from './util' +import extend from './extend' +import mixin from './mixin' +import interpolationComponent from './components/interpolation' +import numberComponent from './components/number' +import { bind, update, unbind } from './directive' + +export let Vue + +export function install (_Vue) { + /* istanbul ignore if */ + if (process.env.NODE_ENV !== 'production' && install.installed && _Vue === Vue) { + warn('already installed.') + return + } + install.installed = true + + Vue = _Vue + + const version = (Vue.version && Number(Vue.version.split('.')[0])) || -1 + /* istanbul ignore if */ + if (process.env.NODE_ENV !== 'production' && version < 2) { + warn(`vue-i18n (${install.version}) need to use Vue 2.0 or later (Vue: ${Vue.version}).`) + return + } + + extend(Vue) + Vue.mixin(mixin) + Vue.directive('t', { bind, update, unbind }) + Vue.component(interpolationComponent.name, interpolationComponent) + Vue.component(numberComponent.name, numberComponent) + + // use simple mergeStrategies to prevent i18n instance lose '__proto__' + const strats = Vue.config.optionMergeStrategies + strats.i18n = function (parentVal, childVal) { + return childVal === undefined + ? parentVal + : childVal + } +} diff --git a/node_modules/vue-i18n/src/mixin.js b/node_modules/vue-i18n/src/mixin.js new file mode 100644 index 0000000..0190b16 --- /dev/null +++ b/node_modules/vue-i18n/src/mixin.js @@ -0,0 +1,139 @@ +/* @flow */ + +import VueI18n from './index' +import { isPlainObject, warn, error, merge } from './util' + +export default { + beforeCreate (): void { + const options: any = this.$options + options.i18n = options.i18n || (options.__i18n ? {} : null) + + if (options.i18n) { + if (options.i18n instanceof VueI18n) { + // init locale messages via custom blocks + if (options.__i18n) { + try { + let localeMessages = {} + options.__i18n.forEach(resource => { + localeMessages = merge(localeMessages, JSON.parse(resource)) + }) + Object.keys(localeMessages).forEach((locale: Locale) => { + options.i18n.mergeLocaleMessage(locale, localeMessages[locale]) + }) + } catch (e) { + if (process.env.NODE_ENV !== 'production') { + error(`Cannot parse locale messages via custom blocks.`, e) + } + } + } + this._i18n = options.i18n + this._i18nWatcher = this._i18n.watchI18nData() + } else if (isPlainObject(options.i18n)) { + const rootI18n = this.$root && this.$root.$i18n && this.$root.$i18n instanceof VueI18n + ? this.$root.$i18n + : null + // component local i18n + if (rootI18n) { + options.i18n.root = this.$root + options.i18n.formatter = rootI18n.formatter + options.i18n.fallbackLocale = rootI18n.fallbackLocale + options.i18n.formatFallbackMessages = rootI18n.formatFallbackMessages + options.i18n.silentTranslationWarn = rootI18n.silentTranslationWarn + options.i18n.silentFallbackWarn = rootI18n.silentFallbackWarn + options.i18n.pluralizationRules = rootI18n.pluralizationRules + options.i18n.preserveDirectiveContent = rootI18n.preserveDirectiveContent + } + + // init locale messages via custom blocks + if (options.__i18n) { + try { + let localeMessages = {} + options.__i18n.forEach(resource => { + localeMessages = merge(localeMessages, JSON.parse(resource)) + }) + options.i18n.messages = localeMessages + } catch (e) { + if (process.env.NODE_ENV !== 'production') { + warn(`Cannot parse locale messages via custom blocks.`, e) + } + } + } + + const { sharedMessages } = options.i18n + if (sharedMessages && isPlainObject(sharedMessages)) { + options.i18n.messages = merge(options.i18n.messages, sharedMessages) + } + + this._i18n = new VueI18n(options.i18n) + this._i18nWatcher = this._i18n.watchI18nData() + + if (options.i18n.sync === undefined || !!options.i18n.sync) { + this._localeWatcher = this.$i18n.watchLocale() + } + + if (rootI18n) { + rootI18n.onComponentInstanceCreated(this._i18n) + } + } else { + if (process.env.NODE_ENV !== 'production') { + warn(`Cannot be interpreted 'i18n' option.`) + } + } + } else if (this.$root && this.$root.$i18n && this.$root.$i18n instanceof VueI18n) { + // root i18n + this._i18n = this.$root.$i18n + } else if (options.parent && options.parent.$i18n && options.parent.$i18n instanceof VueI18n) { + // parent i18n + this._i18n = options.parent.$i18n + } + }, + + beforeMount (): void { + const options: any = this.$options + options.i18n = options.i18n || (options.__i18n ? {} : null) + + if (options.i18n) { + if (options.i18n instanceof VueI18n) { + // init locale messages via custom blocks + this._i18n.subscribeDataChanging(this) + this._subscribing = true + } else if (isPlainObject(options.i18n)) { + this._i18n.subscribeDataChanging(this) + this._subscribing = true + } else { + if (process.env.NODE_ENV !== 'production') { + warn(`Cannot be interpreted 'i18n' option.`) + } + } + } else if (this.$root && this.$root.$i18n && this.$root.$i18n instanceof VueI18n) { + this._i18n.subscribeDataChanging(this) + this._subscribing = true + } else if (options.parent && options.parent.$i18n && options.parent.$i18n instanceof VueI18n) { + this._i18n.subscribeDataChanging(this) + this._subscribing = true + } + }, + + beforeDestroy (): void { + if (!this._i18n) { return } + + const self = this + this.$nextTick(() => { + if (self._subscribing) { + self._i18n.unsubscribeDataChanging(self) + delete self._subscribing + } + + if (self._i18nWatcher) { + self._i18nWatcher() + self._i18n.destroyVM() + delete self._i18nWatcher + } + + if (self._localeWatcher) { + self._localeWatcher() + delete self._localeWatcher + } + }) + } +} diff --git a/node_modules/vue-i18n/src/path.js b/node_modules/vue-i18n/src/path.js new file mode 100644 index 0000000..3be65af --- /dev/null +++ b/node_modules/vue-i18n/src/path.js @@ -0,0 +1,302 @@ +/* @flow */ + +import { isObject } from './util' + +/** + * Path parser + * - Inspired: + * Vue.js Path parser + */ + +// actions +const APPEND = 0 +const PUSH = 1 +const INC_SUB_PATH_DEPTH = 2 +const PUSH_SUB_PATH = 3 + +// states +const BEFORE_PATH = 0 +const IN_PATH = 1 +const BEFORE_IDENT = 2 +const IN_IDENT = 3 +const IN_SUB_PATH = 4 +const IN_SINGLE_QUOTE = 5 +const IN_DOUBLE_QUOTE = 6 +const AFTER_PATH = 7 +const ERROR = 8 + +const pathStateMachine: any = [] + +pathStateMachine[BEFORE_PATH] = { + 'ws': [BEFORE_PATH], + 'ident': [IN_IDENT, APPEND], + '[': [IN_SUB_PATH], + 'eof': [AFTER_PATH] +} + +pathStateMachine[IN_PATH] = { + 'ws': [IN_PATH], + '.': [BEFORE_IDENT], + '[': [IN_SUB_PATH], + 'eof': [AFTER_PATH] +} + +pathStateMachine[BEFORE_IDENT] = { + 'ws': [BEFORE_IDENT], + 'ident': [IN_IDENT, APPEND], + '0': [IN_IDENT, APPEND], + 'number': [IN_IDENT, APPEND] +} + +pathStateMachine[IN_IDENT] = { + 'ident': [IN_IDENT, APPEND], + '0': [IN_IDENT, APPEND], + 'number': [IN_IDENT, APPEND], + 'ws': [IN_PATH, PUSH], + '.': [BEFORE_IDENT, PUSH], + '[': [IN_SUB_PATH, PUSH], + 'eof': [AFTER_PATH, PUSH] +} + +pathStateMachine[IN_SUB_PATH] = { + "'": [IN_SINGLE_QUOTE, APPEND], + '"': [IN_DOUBLE_QUOTE, APPEND], + '[': [IN_SUB_PATH, INC_SUB_PATH_DEPTH], + ']': [IN_PATH, PUSH_SUB_PATH], + 'eof': ERROR, + 'else': [IN_SUB_PATH, APPEND] +} + +pathStateMachine[IN_SINGLE_QUOTE] = { + "'": [IN_SUB_PATH, APPEND], + 'eof': ERROR, + 'else': [IN_SINGLE_QUOTE, APPEND] +} + +pathStateMachine[IN_DOUBLE_QUOTE] = { + '"': [IN_SUB_PATH, APPEND], + 'eof': ERROR, + 'else': [IN_DOUBLE_QUOTE, APPEND] +} + +/** + * Check if an expression is a literal value. + */ + +const literalValueRE: RegExp = /^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/ +function isLiteral (exp: string): boolean { + return literalValueRE.test(exp) +} + +/** + * Strip quotes from a string + */ + +function stripQuotes (str: string): string | boolean { + const a: number = str.charCodeAt(0) + const b: number = str.charCodeAt(str.length - 1) + return a === b && (a === 0x22 || a === 0x27) + ? str.slice(1, -1) + : str +} + +/** + * Determine the type of a character in a keypath. + */ + +function getPathCharType (ch: ?string): string { + if (ch === undefined || ch === null) { return 'eof' } + + const code: number = ch.charCodeAt(0) + + switch (code) { + case 0x5B: // [ + case 0x5D: // ] + case 0x2E: // . + case 0x22: // " + case 0x27: // ' + return ch + + case 0x5F: // _ + case 0x24: // $ + case 0x2D: // - + return 'ident' + + case 0x09: // Tab + case 0x0A: // Newline + case 0x0D: // Return + case 0xA0: // No-break space + case 0xFEFF: // Byte Order Mark + case 0x2028: // Line Separator + case 0x2029: // Paragraph Separator + return 'ws' + } + + return 'ident' +} + +/** + * Format a subPath, return its plain form if it is + * a literal string or number. Otherwise prepend the + * dynamic indicator (*). + */ + +function formatSubPath (path: string): boolean | string { + const trimmed: string = path.trim() + // invalid leading 0 + if (path.charAt(0) === '0' && isNaN(path)) { return false } + + return isLiteral(trimmed) ? stripQuotes(trimmed) : '*' + trimmed +} + +/** + * Parse a string path into an array of segments + */ + +function parse (path: Path): ?Array { + const keys: Array = [] + let index: number = -1 + let mode: number = BEFORE_PATH + let subPathDepth: number = 0 + let c: ?string + let key: any + let newChar: any + let type: string + let transition: number + let action: Function + let typeMap: any + const actions: Array = [] + + actions[PUSH] = function () { + if (key !== undefined) { + keys.push(key) + key = undefined + } + } + + actions[APPEND] = function () { + if (key === undefined) { + key = newChar + } else { + key += newChar + } + } + + actions[INC_SUB_PATH_DEPTH] = function () { + actions[APPEND]() + subPathDepth++ + } + + actions[PUSH_SUB_PATH] = function () { + if (subPathDepth > 0) { + subPathDepth-- + mode = IN_SUB_PATH + actions[APPEND]() + } else { + subPathDepth = 0 + if (key === undefined) { return false } + key = formatSubPath(key) + if (key === false) { + return false + } else { + actions[PUSH]() + } + } + } + + function maybeUnescapeQuote (): ?boolean { + const nextChar: string = path[index + 1] + if ((mode === IN_SINGLE_QUOTE && nextChar === "'") || + (mode === IN_DOUBLE_QUOTE && nextChar === '"')) { + index++ + newChar = '\\' + nextChar + actions[APPEND]() + return true + } + } + + while (mode !== null) { + index++ + c = path[index] + + if (c === '\\' && maybeUnescapeQuote()) { + continue + } + + type = getPathCharType(c) + typeMap = pathStateMachine[mode] + transition = typeMap[type] || typeMap['else'] || ERROR + + if (transition === ERROR) { + return // parse error + } + + mode = transition[0] + action = actions[transition[1]] + if (action) { + newChar = transition[2] + newChar = newChar === undefined + ? c + : newChar + if (action() === false) { + return + } + } + + if (mode === AFTER_PATH) { + return keys + } + } +} + +export type PathValue = PathValueObject | PathValueArray | string | number | boolean | null +export type PathValueObject = { [key: string]: PathValue } +export type PathValueArray = Array + +export default class I18nPath { + _cache: Object + + constructor () { + this._cache = Object.create(null) + } + + /** + * External parse that check for a cache hit first + */ + parsePath (path: Path): Array { + let hit: ?Array = this._cache[path] + if (!hit) { + hit = parse(path) + if (hit) { + this._cache[path] = hit + } + } + return hit || [] + } + + /** + * Get path value from path string + */ + getPathValue (obj: mixed, path: Path): PathValue { + if (!isObject(obj)) { return null } + + const paths: Array = this.parsePath(path) + if (paths.length === 0) { + return null + } else { + const length: number = paths.length + let last: any = obj + let i: number = 0 + while (i < length) { + const value: any = last[paths[i]] + if (value === undefined) { + return null + } + last = value + i++ + } + + return last + } + } +} diff --git a/node_modules/vue-i18n/src/util.js b/node_modules/vue-i18n/src/util.js new file mode 100644 index 0000000..61b04de --- /dev/null +++ b/node_modules/vue-i18n/src/util.js @@ -0,0 +1,165 @@ +/* @flow */ + +/** + * constants + */ + +export const numberFormatKeys = [ + 'style', + 'currency', + 'currencyDisplay', + 'useGrouping', + 'minimumIntegerDigits', + 'minimumFractionDigits', + 'maximumFractionDigits', + 'minimumSignificantDigits', + 'maximumSignificantDigits', + 'localeMatcher', + 'formatMatcher', + 'unit' +] + +/** + * utilities + */ + +export function warn (msg: string, err: ?Error): void { + if (typeof console !== 'undefined') { + console.warn('[vue-i18n] ' + msg) + /* istanbul ignore if */ + if (err) { + console.warn(err.stack) + } + } +} + +export function error (msg: string, err: ?Error): void { + if (typeof console !== 'undefined') { + console.error('[vue-i18n] ' + msg) + /* istanbul ignore if */ + if (err) { + console.error(err.stack) + } + } +} + +export const isArray = Array.isArray + +export function isObject (obj: mixed): boolean %checks { + return obj !== null && typeof obj === 'object' +} + +export function isBoolean (val: mixed): boolean %checks { + return typeof val === 'boolean' +} + +export function isString (val: mixed): boolean %checks { + return typeof val === 'string' +} + +const toString: Function = Object.prototype.toString +const OBJECT_STRING: string = '[object Object]' +export function isPlainObject (obj: any): boolean { + return toString.call(obj) === OBJECT_STRING +} + +export function isNull (val: mixed): boolean { + return val === null || val === undefined +} + +export function parseArgs (...args: Array): Object { + let locale: ?string = null + let params: mixed = null + if (args.length === 1) { + if (isObject(args[0]) || Array.isArray(args[0])) { + params = args[0] + } else if (typeof args[0] === 'string') { + locale = args[0] + } + } else if (args.length === 2) { + if (typeof args[0] === 'string') { + locale = args[0] + } + /* istanbul ignore if */ + if (isObject(args[1]) || Array.isArray(args[1])) { + params = args[1] + } + } + + return { locale, params } +} + +export function looseClone (obj: Object): Object { + return JSON.parse(JSON.stringify(obj)) +} + +export function remove (arr: Array, item: any): Array | void { + if (arr.length) { + const index = arr.indexOf(item) + if (index > -1) { + return arr.splice(index, 1) + } + } +} + +export function includes (arr: Array, item: any): boolean { + return !!~arr.indexOf(item) +} + +const hasOwnProperty = Object.prototype.hasOwnProperty +export function hasOwn (obj: Object | Array<*>, key: string): boolean { + return hasOwnProperty.call(obj, key) +} + +export function merge (target: Object): Object { + const output = Object(target) + for (let i = 1; i < arguments.length; i++) { + const source = arguments[i] + if (source !== undefined && source !== null) { + let key + for (key in source) { + if (hasOwn(source, key)) { + if (isObject(source[key])) { + output[key] = merge(output[key], source[key]) + } else { + output[key] = source[key] + } + } + } + } + } + return output +} + +export function looseEqual (a: any, b: any): boolean { + if (a === b) { return true } + const isObjectA: boolean = isObject(a) + const isObjectB: boolean = isObject(b) + if (isObjectA && isObjectB) { + try { + const isArrayA: boolean = Array.isArray(a) + const isArrayB: boolean = Array.isArray(b) + if (isArrayA && isArrayB) { + return a.length === b.length && a.every((e: any, i: number): boolean => { + return looseEqual(e, b[i]) + }) + } else if (!isArrayA && !isArrayB) { + const keysA: Array = Object.keys(a) + const keysB: Array = Object.keys(b) + return keysA.length === keysB.length && keysA.every((key: string): boolean => { + return looseEqual(a[key], b[key]) + }) + } else { + /* istanbul ignore next */ + return false + } + } catch (e) { + /* istanbul ignore next */ + return false + } + } else if (!isObjectA && !isObjectB) { + return String(a) === String(b) + } else { + return false + } +} diff --git a/node_modules/vue-i18n/types/index.d.ts b/node_modules/vue-i18n/types/index.d.ts new file mode 100644 index 0000000..03b767c --- /dev/null +++ b/node_modules/vue-i18n/types/index.d.ts @@ -0,0 +1,269 @@ +import Vue, { PluginFunction } from 'vue'; + +declare namespace VueI18n { + type Path = string; + type Locale = string; + type FallbackLocale = string | string[] | false | { [locale: string]: string[] } + type Values = any[] | { [key: string]: any }; + type Choice = number; + type LocaleMessage = string | LocaleMessageObject | LocaleMessageArray; + interface LocaleMessageObject { [key: string]: LocaleMessage; } + interface LocaleMessageArray { [index: number]: LocaleMessage; } + interface LocaleMessages { [key: string]: LocaleMessageObject; } + type TranslateResult = string | LocaleMessages; + + type LocaleMatcher = 'lookup' | 'best-fit'; + type FormatMatcher = 'basic' | 'best-fit'; + + type DateTimeHumanReadable = 'long' | 'short' | 'narrow'; + type DateTimeDigital = 'numeric' | '2-digit'; + + interface SpecificDateTimeFormatOptions extends Intl.DateTimeFormatOptions { + year?: DateTimeDigital; + month?: DateTimeDigital | DateTimeHumanReadable; + day?: DateTimeDigital; + hour?: DateTimeDigital; + minute?: DateTimeDigital; + second?: DateTimeDigital; + weekday?: DateTimeHumanReadable; + era?: DateTimeHumanReadable; + timeZoneName?: 'long' | 'short'; + localeMatcher?: LocaleMatcher; + formatMatcher?: FormatMatcher; + } + + type DateTimeFormatOptions = Intl.DateTimeFormatOptions | SpecificDateTimeFormatOptions; + + interface DateTimeFormat { [key: string]: DateTimeFormatOptions; } + interface DateTimeFormats { [locale: string]: DateTimeFormat; } + type DateTimeFormatResult = string; + + type CurrencyDisplay = 'symbol' | 'code' | 'name'; + + interface SpecificNumberFormatOptions extends Intl.NumberFormatOptions { + style?: 'decimal' | 'percent'; + currency?: string; + currencyDisplay?: CurrencyDisplay; + localeMatcher?: LocaleMatcher; + formatMatcher?: FormatMatcher; + } + + interface CurrencyNumberFormatOptions extends Intl.NumberFormatOptions { + style: 'currency'; + currency: string; // Obligatory if style is 'currency' + currencyDisplay?: CurrencyDisplay; + localeMatcher?: LocaleMatcher; + formatMatcher?: FormatMatcher; + } + + type NumberFormatOptions = Intl.NumberFormatOptions | SpecificNumberFormatOptions | CurrencyNumberFormatOptions; + + interface NumberFormat { [key: string]: NumberFormatOptions; } + interface NumberFormats { [locale: string]: NumberFormat; } + type NumberFormatResult = string; + type PluralizationRulesMap = { + /** + * @param choice {number} a choice index given by the input to $tc: `$tc('path.to.rule', choiceIndex)` + * @param choicesLength {number} an overall amount of available choices + * @returns a final choice index + */ + [lang: string]: (choice: number, choicesLength: number) => number; + }; + type Modifiers = { [key: string]: (str : string) => string }; + + type FormattedNumberPartType = 'currency' | 'decimal' | 'fraction' | 'group' | 'infinity' | 'integer' | 'literal' | 'minusSign' | 'nan' | 'plusSign' | 'percentSign'; + + type WarnHtmlInMessageLevel = 'off' | 'warn' | 'error'; + + interface FormattedNumberPart { + type: FormattedNumberPartType; + value: string; + } + interface NumberFormatToPartsResult { [index: number]: FormattedNumberPart; } + + interface Formatter { + interpolate(message: string, values: Values | undefined, path: string): (any[] | null); + } + + type MissingHandler = (locale: Locale, key: Path, vm: Vue | null, values: any) => string | void; + type PostTranslationHandler = (str: string, key?: string) => string; + type ComponentInstanceCreatedListener = (newVm: VueI18n & IVueI18n, rootVm: VueI18n & IVueI18n) => void; + + interface IntlAvailability { + dateTimeFormat: boolean; + numberFormat: boolean; + } + + // tslint:disable-next-line:interface-name + interface I18nOptions { + locale?: Locale; + fallbackLocale?: FallbackLocale; + messages?: LocaleMessages; + dateTimeFormats?: DateTimeFormats; + numberFormats?: NumberFormats; + formatter?: Formatter; + modifiers?: Modifiers, + missing?: MissingHandler; + fallbackRoot?: boolean; + formatFallbackMessages?: boolean; + sync?: boolean; + silentTranslationWarn?: boolean | RegExp; + silentFallbackWarn?: boolean | RegExp; + preserveDirectiveContent?: boolean; + pluralizationRules?: PluralizationRulesMap; + warnHtmlInMessage?: WarnHtmlInMessageLevel; + sharedMessages?: LocaleMessages; + postTranslation?: PostTranslationHandler; + componentInstanceCreatedListener?: ComponentInstanceCreatedListener; + } +} + +export type Path = VueI18n.Path; +export type Locale = VueI18n.Locale; +export type FallbackLocale = VueI18n.FallbackLocale; +export type Values = VueI18n.Values; +export type Choice = VueI18n.Choice; +export type LocaleMessage = VueI18n.LocaleMessage; +export type LocaleMessageObject = VueI18n.LocaleMessageObject; +export type LocaleMessageArray = VueI18n.LocaleMessageArray; +export type LocaleMessages = VueI18n.LocaleMessages; +export type TranslateResult = VueI18n.TranslateResult; +export type DateTimeFormatOptions = VueI18n.DateTimeFormatOptions; +export type DateTimeFormat = VueI18n.DateTimeFormat; +export type DateTimeFormats = VueI18n.DateTimeFormats; +export type DateTimeFormatResult = VueI18n.DateTimeFormatResult; +export type NumberFormatOptions = VueI18n.NumberFormatOptions; +export type NumberFormat = VueI18n.NumberFormat; +export type NumberFormats = VueI18n.NumberFormats; +export type NumberFormatResult = VueI18n.NumberFormatResult; +export type NumberFormatToPartsResult = VueI18n.NumberFormatToPartsResult; +export type WarnHtmlInMessageLevel = VueI18n.WarnHtmlInMessageLevel; +export type Formatter = VueI18n.Formatter; +export type MissingHandler = VueI18n.MissingHandler; +export type PostTranslationHandler = VueI18n.PostTranslationHandler; +export type IntlAvailability = VueI18n.IntlAvailability; +export type I18nOptions = VueI18n.I18nOptions; + +export declare interface IVueI18n { + readonly messages: VueI18n.LocaleMessages; + readonly dateTimeFormats: VueI18n.DateTimeFormats; + readonly numberFormats: VueI18n.NumberFormats; + + locale: VueI18n.Locale; + fallbackLocale: VueI18n.FallbackLocale; + missing: VueI18n.MissingHandler; + formatter: VueI18n.Formatter; + formatFallbackMessages: boolean; + silentTranslationWarn: boolean | RegExp; + silentFallbackWarn: boolean | RegExp; + preserveDirectiveContent: boolean; + pluralizationRules: VueI18n.PluralizationRulesMap; + warnHtmlInMessage: VueI18n.WarnHtmlInMessageLevel; + postTranslation: VueI18n.PostTranslationHandler; + t(key: VueI18n.Path, values?: VueI18n.Values): VueI18n.TranslateResult; + t(key: VueI18n.Path, locale: VueI18n.Locale, values?: VueI18n.Values): VueI18n.TranslateResult; + tc(key: VueI18n.Path, choice?: VueI18n.Choice, values?: VueI18n.Values): string; + tc( + key: VueI18n.Path, + choice: VueI18n.Choice, + locale: VueI18n.Locale, + values?: VueI18n.Values, + ): string; + te(key: VueI18n.Path, locale?: VueI18n.Locale): boolean; + d( + value: number | Date, + key?: VueI18n.Path, + locale?: VueI18n.Locale, + ): VueI18n.DateTimeFormatResult; + d(value: number | Date, args?: { [key: string]: string }): VueI18n.DateTimeFormatResult; + n(value: number, key?: VueI18n.Path, locale?: VueI18n.Locale): VueI18n.NumberFormatResult; + n(value: number, args?: { [key: string]: string }): VueI18n.NumberFormatResult; + getLocaleMessage(locale: VueI18n.Locale): VueI18n.LocaleMessageObject; + setLocaleMessage(locale: VueI18n.Locale, message: VueI18n.LocaleMessageObject): void; + mergeLocaleMessage(locale: VueI18n.Locale, message: VueI18n.LocaleMessageObject): void; + getDateTimeFormat(locale: VueI18n.Locale): VueI18n.DateTimeFormat; + setDateTimeFormat(locale: VueI18n.Locale, format: VueI18n.DateTimeFormat): void; + mergeDateTimeFormat(locale: VueI18n.Locale, format: VueI18n.DateTimeFormat): void; + getNumberFormat(locale: VueI18n.Locale): VueI18n.NumberFormat; + setNumberFormat(locale: VueI18n.Locale, format: VueI18n.NumberFormat): void; + mergeNumberFormat(locale: VueI18n.Locale, format: VueI18n.NumberFormat): void; + getChoiceIndex: (choice: number, choicesLength: number) => number; +} + +declare class VueI18n { + constructor(options?: VueI18n.I18nOptions) + + readonly messages: VueI18n.LocaleMessages; + readonly dateTimeFormats: VueI18n.DateTimeFormats; + readonly numberFormats: VueI18n.NumberFormats; + readonly availableLocales: VueI18n.Locale[]; + + locale: VueI18n.Locale; + fallbackLocale: VueI18n.FallbackLocale; + missing: VueI18n.MissingHandler; + formatter: VueI18n.Formatter; + formatFallbackMessages: boolean; + silentTranslationWarn: boolean | RegExp; + silentFallbackWarn: boolean | RegExp; + preserveDirectiveContent: boolean; + pluralizationRules: VueI18n.PluralizationRulesMap; + warnHtmlInMessage: VueI18n.WarnHtmlInMessageLevel; + postTranslation: VueI18n.PostTranslationHandler; + + t(key: VueI18n.Path, values?: VueI18n.Values): VueI18n.TranslateResult; + t(key: VueI18n.Path, locale: VueI18n.Locale, values?: VueI18n.Values): VueI18n.TranslateResult; + tc(key: VueI18n.Path, choice?: VueI18n.Choice, values?: VueI18n.Values): string; + tc(key: VueI18n.Path, choice: VueI18n.Choice, locale: VueI18n.Locale, values?: VueI18n.Values): string; + te(key: VueI18n.Path, locale?: VueI18n.Locale): boolean; + d(value: number | Date, key?: VueI18n.Path, locale?: VueI18n.Locale): VueI18n.DateTimeFormatResult; + d(value: number | Date, args?: { [key: string]: string }): VueI18n.DateTimeFormatResult; + n(value: number, key?: VueI18n.Path, locale?: VueI18n.Locale): VueI18n.NumberFormatResult; + n(value: number, args?: { [key: string]: string }): VueI18n.NumberFormatResult; + + getLocaleMessage(locale: VueI18n.Locale): VueI18n.LocaleMessageObject; + setLocaleMessage(locale: VueI18n.Locale, message: VueI18n.LocaleMessageObject): void; + mergeLocaleMessage(locale: VueI18n.Locale, message: VueI18n.LocaleMessageObject): void; + + getDateTimeFormat(locale: VueI18n.Locale): VueI18n.DateTimeFormat; + setDateTimeFormat(locale: VueI18n.Locale, format: VueI18n.DateTimeFormat): void; + mergeDateTimeFormat(locale: VueI18n.Locale, format: VueI18n.DateTimeFormat): void; + + getNumberFormat(locale: VueI18n.Locale): VueI18n.NumberFormat; + setNumberFormat(locale: VueI18n.Locale, format: VueI18n.NumberFormat): void; + mergeNumberFormat(locale: VueI18n.Locale, format: VueI18n.NumberFormat): void; + + /** + * @param choice {number} a choice index given by the input to $tc: `$tc('path.to.rule', choiceIndex)` + * @param choicesLength {number} an overall amount of available choices + * @returns a final choice index + */ + getChoiceIndex: (choice: number, choicesLength: number) => number; + + static install: PluginFunction; + static version: string; + static availabilities: VueI18n.IntlAvailability; +} + +declare module 'vue/types/vue' { + interface Vue { + readonly $i18n: VueI18n & IVueI18n; + $t: typeof VueI18n.prototype.t; + $tc: typeof VueI18n.prototype.tc; + $te: typeof VueI18n.prototype.te; + $d: typeof VueI18n.prototype.d; + $n: typeof VueI18n.prototype.n; + } +} + +declare module 'vue/types/options' { + interface ComponentOptions { + i18n?: { + messages?: VueI18n.LocaleMessages; + dateTimeFormats?: VueI18n.DateTimeFormats; + numberFormats?: VueI18n.NumberFormats; + sharedMessages?: VueI18n.LocaleMessages; + }; + } +} + +export default VueI18n; diff --git a/node_modules/vue-i18n/vetur/attributes.json b/node_modules/vue-i18n/vetur/attributes.json new file mode 100644 index 0000000..2b64f23 --- /dev/null +++ b/node_modules/vue-i18n/vetur/attributes.json @@ -0,0 +1,34 @@ +{ + "i18n/path" : { + "description": "[required]\nKeypath of the locale message", + "type": "string" + }, + "i18n/locale" : { + "description": "[optional]\nLocale to be used in this translation", + "type": "string" + }, + "i18n/tag" : { + "description": "[optional]\nWhich tag to render, default is \"span\"", + "type": "string" + }, + "i18n/places": { + "description": "[optional after v8.14]\nWill be removed in the next major version, use the slot syntax instead\n\nhttp://kazupon.github.io/vue-i18n/guide/interpolation.html#slots-syntax-usage", + "type": "array|object" + }, + "i18n-n/value" : { + "description": "[required]\nNumber to be used in formatting", + "type": "number" + }, + "i18n-n/format": { + "description": "[optional]\nNumber format name or object with explicit format options", + "type": "string|object" + }, + "i18n-n/locale" : { + "description": "[optional]\nLocale to be used in this translation", + "type": "string" + }, + "i18n-n/tag" : { + "description": "[optional]\nWhich tag to render, default is `span`", + "type": "string" + } +} diff --git a/node_modules/vue-i18n/vetur/tags.json b/node_modules/vue-i18n/vetur/tags.json new file mode 100644 index 0000000..f6f4222 --- /dev/null +++ b/node_modules/vue-i18n/vetur/tags.json @@ -0,0 +1,20 @@ +{ + "i18n": { + "attributes": [ + "path", + "locale", + "tag", + "places" + ], + "description": "This is a functional component that can be used when HTML interpolation is needed.\n\nhttp://kazupon.github.io/vue-i18n/guide/interpolation.html#basic-usage" + }, + "i18n-n": { + "attributes": [ + "value", + "format", + "locale", + "tag" + ], + "description": "This functional component provides a way to use HTML interpolation in pair with number formatting.\n\nhttp://kazupon.github.io/vue-i18n/guide/number.html#custom-formatting" + } +} diff --git a/node_modules/vue-jsonp/LICENSE b/node_modules/vue-jsonp/LICENSE new file mode 100644 index 0000000..794bf00 --- /dev/null +++ b/node_modules/vue-jsonp/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 LancerComet + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/vue-jsonp/README.md b/node_modules/vue-jsonp/README.md new file mode 100644 index 0000000..d1f1a9e --- /dev/null +++ b/node_modules/vue-jsonp/README.md @@ -0,0 +1,153 @@ +# Vue-jsonp + +[![VueJsonp](https://github.com/LancerComet/vue-jsonp/workflows/Test/badge.svg)](https://github.com/LancerComet/vue-jsonp/actions) + +A tiny library for handling JSONP request. + +## Quick Start + +As Vue plugin: + +```ts +import { VueJsonp } from 'vue-jsonp' + +// Vue Plugin. +Vue.use(VueJsonp) + +// Now you can use this.$jsonp in Vue components. +const vm = new Vue() +vm.$jsonp('/some-jsonp-url', { + myCustomUrlParam: 'veryNice' +}) +``` + +Use function directly: + +```ts +import { jsonp } from 'vue-jsonp' + +jsonp('/some-jsonp-url', { + myCustomUrlParam: 'veryNice' +}) +``` + +## Send data and set query & function name + +### Send data + +```ts +// The request url will be "/some-jsonp-url?name=LancerComet&age=100&callback=jsonp_{RANDOM_STR}". +jsonp('/some-jsonp-url', { + name: 'LancerComet', + age: 100 +}) +``` + +### Custom query & function name + +The url uniform is `/url?{callbackQuery}={callbackName}&...`, the default is `/url?callback=jsonp_{RANDOM_STRING}&...`. + +And you can change it like this: + +```ts +// The request url will be "/some-jsonp-url?name=LancerComet&age=100&cb=jsonp_func". +jsonp('/some-jsonp-url', { + callbackQuery: 'cb', + callbackName: 'jsonp_func', + name: 'LancerComet', + age: 100 +}) +``` + +## Module exports + + - `VueJsonp: PluginObject` + + - `jsonp: (url: string, param?: IJsonpParam, timeout?: number) => Promise` + +## API + +### IJsonpParam + +IJsonpParam is the type of param for jsonp function. + +```ts +/** + * JSONP parameter declaration. + */ +interface IJsonpParam { + /** + * Callback query name. + * This param is used to define the query name of the callback function. + * + * @example + * // The request url will be "/some-url?myCallback=jsonp_func&myCustomUrlParam=veryNice" + * jsonp('/some-url', { + * callbackQuery: 'myCallback', + * callbackName: 'jsonp_func', + * myCustomUrlParam: 'veryNice' + * }) + * + * @default callback + */ + callbackQuery?: string + + /** + * Callback function name. + * This param is used to define the jsonp function name. + * + * @example + * // The request url will be "/some-url?myCallback=jsonp_func&myCustomUrlParam=veryNice" + * jsonp('/some-url', { + * callbackQuery: 'myCallback', + * callbackName: 'jsonp_func', + * myCustomUrlParam: 'veryNice' + * }) + * + * @default jsonp_ + randomStr() + */ + callbackName?: string + + /** + * Custom data. + */ + [key: string]: any +} +``` + +## Example + +```ts +import Vue from 'vue' +import { VueJsonp } from 'vue-jsonp' + +Vue.use(VueJsonp) + +const vm = new Vue() +const { code, data, message } = await vm.$jsonp<{ + code: number, + message: string, + data: { + id: number, + nickname: string + } +}>('/my-awesome-url', { + name: 'MyName', age: 20 +}) + +assert(code === 0) +assert(message === 'ok') +assert(data.id === 1) +assert(data.nickname === 'John Smith') +``` + +```ts +import { jsonp } from 'vue-jsonp' + +const result = await jsonp('/my-awesome-url') +assert(result === 'such a jsonp') +``` + +## License + +MIT diff --git a/node_modules/vue-jsonp/dist/index.d.ts b/node_modules/vue-jsonp/dist/index.d.ts new file mode 100644 index 0000000..4f3f502 --- /dev/null +++ b/node_modules/vue-jsonp/dist/index.d.ts @@ -0,0 +1,73 @@ +/** + * Vue Jsonp. + * # Carry Your World # + * + * @author: LancerComet + * @license: MIT + */ +import { PluginObject } from 'vue/types/plugin'; +declare module 'vue/types/vue' { + interface Vue { + $jsonp: typeof jsonp; + } +} +/** + * Vue JSONP. + */ +declare const VueJsonp: PluginObject; +/** + * JSONP function. + * + * @param { string } url Target URL address. + * @param { IJsonpParam } param Querying params object. + * @param { number } timeout Timeout setting (ms). + * + * @example + * jsonp('/url', { + * callbackQuery: '' + * callbackName: '', + * name: 'LancerComet', + * age: 26 + * }, 1000) + */ +declare function jsonp(url: string, param?: IJsonpParam, timeout?: number): Promise; +export { VueJsonp, jsonp }; +/** + * JSONP parameter declaration. + */ +interface IJsonpParam { + /** + * Callback query name. + * This param is used to define the query name of the callback function. + * + * @example + * // The request url will be "/some-url?myCallback=jsonp_func&myCustomUrlParam=veryNice" + * jsonp('/some-url', { + * callbackQuery: 'myCallback', + * callbackName: 'jsonp_func', + * myCustomUrlParam: 'veryNice' + * }) + * + * @default callback + */ + callbackQuery?: string; + /** + * Callback function name. + * This param is used to define the jsonp function name. + * + * @example + * // The request url will be "/some-url?myCallback=jsonp_func&myCustomUrlParam=veryNice" + * jsonp('/some-url', { + * callbackQuery: 'myCallback', + * callbackName: 'jsonp_func', + * myCustomUrlParam: 'veryNice' + * }) + * + * @default jsonp_ + randomStr() + */ + callbackName?: string; + /** + * Custom data. + */ + [key: string]: any; +} diff --git a/node_modules/vue-jsonp/dist/index.esm.js b/node_modules/vue-jsonp/dist/index.esm.js new file mode 100644 index 0000000..893bec4 --- /dev/null +++ b/node_modules/vue-jsonp/dist/index.esm.js @@ -0,0 +1,8 @@ +function e(t,n){t=t.replace(/=/g,"");var o=[];switch(n.constructor){case String:case Number:case Boolean:o.push(encodeURIComponent(t)+"="+encodeURIComponent(n));break;case Array:n.forEach((function(n){o=o.concat(e(t+"[]=",n))}));break;case Object:Object.keys(n).forEach((function(r){var a=n[r];o=o.concat(e(t+"["+r+"]",a))}))}return o}function t(e){var n=[];return e.forEach((function(e){"string"==typeof e?n.push(e):n=n.concat(t(e))})),n} +/** + * Vue Jsonp. + * # Carry Your World # + * + * @author: LancerComet + * @license: MIT + */var n={install:function(e){e.prototype.$jsonp=o}};function o(n,o,r){if(void 0===o&&(o={}),"string"!=typeof n)throw new Error('[Vue-jsonp] Type of param "url" is not string.');if("object"!=typeof o||!o)throw new Error("[Vue-jsonp] Invalid params, should be an object.");return r="number"==typeof r?r:5e3,new Promise((function(a,c){var u="string"==typeof o.callbackQuery?o.callbackQuery:"callback",i="string"==typeof o.callbackName?o.callbackName:"jsonp_"+(Math.floor(1e5*Math.random())*Date.now()).toString(16);o[u]=i,delete o.callbackQuery,delete o.callbackName;var s=[];Object.keys(o).forEach((function(t){s=s.concat(e(t,o[t]))}));var l=t(s).join("&"),f=function(){p(),clearTimeout(m),c({status:400,statusText:"Bad Request"})},p=function(){b.removeEventListener("error",f)},d=function(){document.body.removeChild(b),delete window[i]},m=null;r>-1&&(m=setTimeout((function(){p(),d(),c({statusText:"Request Timeout",status:408})}),r)),window[i]=function(e){clearTimeout(m),p(),d(),a(e)};var b=document.createElement("script");b.addEventListener("error",f),b.src=n+(/\?/.test(n)?"&":"?")+l,document.body.appendChild(b)}))}export{n as VueJsonp,o as jsonp}; diff --git a/node_modules/vue-jsonp/dist/index.js b/node_modules/vue-jsonp/dist/index.js new file mode 100644 index 0000000..c5e0aee --- /dev/null +++ b/node_modules/vue-jsonp/dist/index.js @@ -0,0 +1,8 @@ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).VueJsonp={})}(this,(function(e){"use strict";function t(e,o){e=e.replace(/=/g,"");var n=[];switch(o.constructor){case String:case Number:case Boolean:n.push(encodeURIComponent(e)+"="+encodeURIComponent(o));break;case Array:o.forEach((function(o){n=n.concat(t(e+"[]=",o))}));break;case Object:Object.keys(o).forEach((function(r){var c=o[r];n=n.concat(t(e+"["+r+"]",c))}))}return n}function o(e){var t=[];return e.forEach((function(e){"string"==typeof e?t.push(e):t=t.concat(o(e))})),t} +/** + * Vue Jsonp. + * # Carry Your World # + * + * @author: LancerComet + * @license: MIT + */var n={install:function(e){e.prototype.$jsonp=r}};function r(e,n,r){if(void 0===n&&(n={}),"string"!=typeof e)throw new Error('[Vue-jsonp] Type of param "url" is not string.');if("object"!=typeof n||!n)throw new Error("[Vue-jsonp] Invalid params, should be an object.");return r="number"==typeof r?r:5e3,new Promise((function(c,a){var i="string"==typeof n.callbackQuery?n.callbackQuery:"callback",s="string"==typeof n.callbackName?n.callbackName:"jsonp_"+(Math.floor(1e5*Math.random())*Date.now()).toString(16);n[i]=s,delete n.callbackQuery,delete n.callbackName;var u=[];Object.keys(n).forEach((function(e){u=u.concat(t(e,n[e]))}));var f=o(u).join("&"),l=function(){p(),clearTimeout(b),a({status:400,statusText:"Bad Request"})},p=function(){m.removeEventListener("error",l)},d=function(){document.body.removeChild(m),delete window[s]},b=null;r>-1&&(b=setTimeout((function(){p(),d(),a({statusText:"Request Timeout",status:408})}),r)),window[s]=function(e){clearTimeout(b),p(),d(),c(e)};var m=document.createElement("script");m.addEventListener("error",l),m.src=e+(/\?/.test(e)?"&":"?")+f,document.body.appendChild(m)}))}e.VueJsonp=n,e.jsonp=r,Object.defineProperty(e,"__esModule",{value:!0})})); diff --git a/node_modules/vue-jsonp/dist/utils/index.d.ts b/node_modules/vue-jsonp/dist/utils/index.d.ts new file mode 100644 index 0000000..e78bb4b --- /dev/null +++ b/node_modules/vue-jsonp/dist/utils/index.d.ts @@ -0,0 +1,20 @@ +/** + * Generate random string. + * + * @return { string } + */ +declare function randomStr(): string; +/** + * Format params into querying string. + * + * @return {string[]} + */ +declare function formatParams(queryKey: string, value: any): string[]; +/** + * Flat querys. + * + * @param {string[] | (string[])[]} array + * @returns + */ +declare function flatten(array: string[] | (string[])[]): string[]; +export { formatParams, flatten, randomStr }; diff --git a/node_modules/vue-jsonp/package.json b/node_modules/vue-jsonp/package.json new file mode 100644 index 0000000..c268779 --- /dev/null +++ b/node_modules/vue-jsonp/package.json @@ -0,0 +1,50 @@ +{ + "name": "vue-jsonp", + "version": "2.0.0", + "description": "A tiny library for handling JSONP request.", + "main": "./dist/index.js", + "module": "./dist/index.esm.js", + "keywords": [ + "Vue", + "JSONP" + ], + "files": [ + "dist/", + "index.d.ts", + "README.md" + ], + "scripts": { + "build": "rollup -c", + "test": "jest", + "pretest": "npm run build", + "preversion": "npm run test", + "prepublish": "npm run test" + }, + "author": { + "name": "LancerComet", + "email": "chw644@hotmail.com" + }, + "repository": { + "type": "git", + "url": "https://github.com/LancerComet/vue-jsonp.git" + }, + "license": "MIT", + "devDependencies": { + "@types/expect-puppeteer": "^4.4.3", + "@types/jest": "^26.0.14", + "@types/jest-environment-puppeteer": "^4.4.0", + "@types/puppeteer": "^3.0.2", + "jest": "^26.4.2", + "jest-puppeteer": "^4.4.0", + "puppeteer": "^5.3.1", + "rollup": "^2.28.2", + "rollup-plugin-cleanup": "^3.2.1", + "rollup-plugin-delete": "^2.0.0", + "rollup-plugin-terser": "^7.0.2", + "rollup-plugin-typescript2": "^0.27.3", + "ts-jest": "^26.4.1", + "tslint": "^6.1.3", + "typescript": "^4.0.3", + "vue": "^2.6.12" + } +} diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..8f8ab19 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,155 @@ +{ + "name": "uView", + "version": "1.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "uView", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "crypto-js": "^4.2.0", + "html2canvas": "^1.4.1", + "js-md5": "^0.8.3", + "jweixin-module": "^1.6.0", + "vue-i18n": "^8.20.0", + "vue-jsonp": "^2.0.0" + } + }, + "node_modules/base64-arraybuffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz", + "integrity": "sha512-I3yl4r9QB5ZRY3XuJVEPfc2XhZO6YweFPI+UovAzn+8/hb3oJ6lnysaFcjVpkCPfVWFUDvoZ8kmVDP7WyRtYtQ==", + "engines": { + "node": ">= 0.6.0" + } + }, + "node_modules/crypto-js": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.2.0.tgz", + "integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q==" + }, + "node_modules/css-line-break": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/css-line-break/-/css-line-break-2.1.0.tgz", + "integrity": "sha512-FHcKFCZcAha3LwfVBhCQbW2nCNbkZXn7KVUJcsT5/P8YmfsVja0FMPJr0B903j/E69HUphKiV9iQArX8SDYA4w==", + "dependencies": { + "utrie": "^1.0.2" + } + }, + "node_modules/html2canvas": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/html2canvas/-/html2canvas-1.4.1.tgz", + "integrity": "sha512-fPU6BHNpsyIhr8yyMpTLLxAbkaK8ArIBcmZIRiBLiDhjeqvXolaEmDGmELFuX9I4xDcaKKcJl+TKZLqruBbmWA==", + "dependencies": { + "css-line-break": "^2.1.0", + "text-segmentation": "^1.0.3" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/js-md5": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/js-md5/-/js-md5-0.8.3.tgz", + "integrity": "sha512-qR0HB5uP6wCuRMrWPTrkMaev7MJZwJuuw4fnwAzRgP4J4/F8RwtodOKpGp4XpqsLBFzzgqIO42efFAyz2Et6KQ==" + }, + "node_modules/jweixin-module": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/jweixin-module/-/jweixin-module-1.6.0.tgz", + "integrity": "sha512-dGk9cf+ipipHmtzYmKZs5B2toX+p4hLyllGLF6xuC8t+B05oYxd8fYoaRz0T30U2n3RUv8a4iwvjhA+OcYz52w==" + }, + "node_modules/text-segmentation": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/text-segmentation/-/text-segmentation-1.0.3.tgz", + "integrity": "sha512-iOiPUo/BGnZ6+54OsWxZidGCsdU8YbE4PSpdPinp7DeMtUJNJBoJ/ouUSTJjHkh1KntHaltHl/gDs2FC4i5+Nw==", + "dependencies": { + "utrie": "^1.0.2" + } + }, + "node_modules/utrie": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/utrie/-/utrie-1.0.2.tgz", + "integrity": "sha512-1MLa5ouZiOmQzUbjbu9VmjLzn1QLXBhwpUa7kdLUQK+KQ5KA9I1vk5U4YHe/X2Ch7PYnJfWuWT+VbuxbGwljhw==", + "dependencies": { + "base64-arraybuffer": "^1.0.2" + } + }, + "node_modules/vue-i18n": { + "version": "8.20.0", + "resolved": "https://registry.npmjs.org/vue-i18n/-/vue-i18n-8.20.0.tgz", + "integrity": "sha512-ZiAOoeR4d/JtKpbjipx3I80ey7cYG1ki5gQ7HwzWm4YFio9brA15BEYHjalEoBaEfzF5OBEZP+Y2MvAaWnyXXg==" + }, + "node_modules/vue-jsonp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/vue-jsonp/-/vue-jsonp-2.0.0.tgz", + "integrity": "sha512-Mzd9GNeuKP5hHFDWZNMWOsCuMILSkA6jo2l4A02wheFz3qqBzH7aSEFTey1BRCZCLizlaf1EqJ5YUtF392KspA==" + } + }, + "dependencies": { + "base64-arraybuffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz", + "integrity": "sha512-I3yl4r9QB5ZRY3XuJVEPfc2XhZO6YweFPI+UovAzn+8/hb3oJ6lnysaFcjVpkCPfVWFUDvoZ8kmVDP7WyRtYtQ==" + }, + "crypto-js": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.2.0.tgz", + "integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q==" + }, + "css-line-break": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/css-line-break/-/css-line-break-2.1.0.tgz", + "integrity": "sha512-FHcKFCZcAha3LwfVBhCQbW2nCNbkZXn7KVUJcsT5/P8YmfsVja0FMPJr0B903j/E69HUphKiV9iQArX8SDYA4w==", + "requires": { + "utrie": "^1.0.2" + } + }, + "html2canvas": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/html2canvas/-/html2canvas-1.4.1.tgz", + "integrity": "sha512-fPU6BHNpsyIhr8yyMpTLLxAbkaK8ArIBcmZIRiBLiDhjeqvXolaEmDGmELFuX9I4xDcaKKcJl+TKZLqruBbmWA==", + "requires": { + "css-line-break": "^2.1.0", + "text-segmentation": "^1.0.3" + } + }, + "js-md5": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/js-md5/-/js-md5-0.8.3.tgz", + "integrity": "sha512-qR0HB5uP6wCuRMrWPTrkMaev7MJZwJuuw4fnwAzRgP4J4/F8RwtodOKpGp4XpqsLBFzzgqIO42efFAyz2Et6KQ==" + }, + "jweixin-module": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/jweixin-module/-/jweixin-module-1.6.0.tgz", + "integrity": "sha512-dGk9cf+ipipHmtzYmKZs5B2toX+p4hLyllGLF6xuC8t+B05oYxd8fYoaRz0T30U2n3RUv8a4iwvjhA+OcYz52w==" + }, + "text-segmentation": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/text-segmentation/-/text-segmentation-1.0.3.tgz", + "integrity": "sha512-iOiPUo/BGnZ6+54OsWxZidGCsdU8YbE4PSpdPinp7DeMtUJNJBoJ/ouUSTJjHkh1KntHaltHl/gDs2FC4i5+Nw==", + "requires": { + "utrie": "^1.0.2" + } + }, + "utrie": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/utrie/-/utrie-1.0.2.tgz", + "integrity": "sha512-1MLa5ouZiOmQzUbjbu9VmjLzn1QLXBhwpUa7kdLUQK+KQ5KA9I1vk5U4YHe/X2Ch7PYnJfWuWT+VbuxbGwljhw==", + "requires": { + "base64-arraybuffer": "^1.0.2" + } + }, + "vue-i18n": { + "version": "8.20.0", + "resolved": "https://registry.npmjs.org/vue-i18n/-/vue-i18n-8.20.0.tgz", + "integrity": "sha512-ZiAOoeR4d/JtKpbjipx3I80ey7cYG1ki5gQ7HwzWm4YFio9brA15BEYHjalEoBaEfzF5OBEZP+Y2MvAaWnyXXg==" + }, + "vue-jsonp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/vue-jsonp/-/vue-jsonp-2.0.0.tgz", + "integrity": "sha512-Mzd9GNeuKP5hHFDWZNMWOsCuMILSkA6jo2l4A02wheFz3qqBzH7aSEFTey1BRCZCLizlaf1EqJ5YUtF392KspA==" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..60d1f82 --- /dev/null +++ b/package.json @@ -0,0 +1,28 @@ +{ + "name": "uView", + "version": "1.0.0", + "description": "

\r \"logo\"\r

\r

uView

\r

多平台快速开发的UI框架

", + "main": "main.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/YanxinNet/uView.git" + }, + "keywords": [], + "author": "", + "license": "ISC", + "bugs": { + "url": "https://github.com/YanxinNet/uView/issues" + }, + "homepage": "https://github.com/YanxinNet/uView#readme", + "dependencies": { + "crypto-js": "^4.2.0", + "html2canvas": "^1.4.1", + "js-md5": "^0.8.3", + "jweixin-module": "^1.6.0", + "vue-i18n": "^8.20.0", + "vue-jsonp": "^2.0.0" + } +} diff --git a/pages.json b/pages.json new file mode 100644 index 0000000..dbd1b97 --- /dev/null +++ b/pages.json @@ -0,0 +1,678 @@ +{ + "easycom": { + "^u-(.*)": "@/uview-ui/components/u-$1/u-$1.vue" + }, + "condition": { + //模式配置,仅开发期间生效 + "current": 0, + //当前激活的模式(list 的索引项) + "list": [ + { + "name": "test", + //模式名称 + "path": "pages/login/login/login" + //启动页面,必选 + // "query": "uuid=c4bba940-f69e-11ea-a419-6bafda9d095e&__id__=1" //启动参数,在页面的onLoad函数里面得到 + } + ] + }, + "pages": [ + // 登录 + { + "path": "pages/login/login/login", + "style": { + "navigationBarTitleText": "登录", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + } + }, + // 注册, + { + "path": "pages/login/register/register", + "style": { + "navigationBarTitleText": "注册", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + //实名验证 + // 完善信息 + { + "path": "pages/login/perfect/perfect", + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + // 毕业生认证 + { + "path": "pages/login/graduateCertification/graduateCertification", + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + // 首页, + { + "path": "pages/home/home/home", + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + // 全部服务, + { + "path": "pages/home/home/components/recommend/allServices", + "style": { + "navigationBarTitleText": "全部服务", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + // 更多好友, + { + "path": "pages/home/home/components/recommend/moreFriends", + "style": { + "navigationBarTitleText": "更多好友", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + // 话题广场, + { + "path": "pages/home/home/components/topic/topicSquare", + "style": { + "navigationBarTitleText": "话题广场", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + // 话题详情, + { + "path": "pages/home/home/components/topic/topicDetail", + "style": { + "navigationBarTitleText": "话题详情", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + // 搜索页, + { + "path": "pages/home/home/components/searchPage/index", + "style": { + "navigationBarTitleText": "搜索", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + // 帖子详情, + { + "path": "pages/home/home/components/contentDetail/index", + "style": { + "navigationBarTitleText": "详情", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + // 找校友, + { + "path": "pages/main/index/index", + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + // 消息列表, + { + "path": "pages/message/msgList/msgList", + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + // 校友圈, + { + "path": "pages/AlumniCircle/alumnus/alumnus", + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + { + "path": "pages/AlumniCircle/forward/forward", + "style": { + "navigationBarTitleText": "转发", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + // 我的, + { + "path": "pages/my/my/my", + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + // 查看实名信息 + // { + // "path": "pages/my/realDetail/realDetail", + // "style": { + // "navigationBarTitleText": "实名认证", + // "enablePullDownRefresh": false + // } + // }, + // 添加教育经历 + { + "path": "pages/my/AddEducation/AddEducation", + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + // 对话框, + { + "path": "pages/message/dialogBox/dialogBox", + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + // 互动消息, + { + "path": "pages/message/interactionList/interactionList", + "style": { + "navigationBarTitleText": "互动消息", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + // 管理列表, + { + "path": "pages/message/adminList/adminList", + "style": { + "navigationBarTitleText": "管理列表", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + // 系统消息, + { + "path": "pages/message/sysList/sysList", + "style": { + "navigationBarTitleText": "系统消息", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + // 新增关注, + { + "path": "pages/message/attentionList/attentionList", + "style": { + "navigationBarTitleText": "新增关注", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + // 搜索校友圈, + { + "path": "pages/AlumniCircle/searchAlumnus/searchAlumnus", + "style": { + "navigationBarTitleText": "搜索", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + // 设置, + { + "path": "pages/my/mySeting/mySeting", + "style": { + "navigationBarTitleText": "设置", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + // 我的信息详情, + { + "path": "pages/my/myDetails/myDetails", + "style": { + "navigationBarTitleText": "我的", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + // 头像裁剪 + { + "path": "uview-ui/components/u-avatar-cropper/u-avatar-cropper", + "style": { + "navigationBarTitleText": "头像裁剪", + "navigationBarBackgroundColor": "#000000", + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + // 官方认证, + { + "path": "pages/my/authentication/authentication", + "style": { + "navigationBarTitleText": "官方认证", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + //认证详情, + { + "path": "pages/my/certificationDetails/certificationDetails", + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + // 搜索, + { + "path": "pages/main/search/search", + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + // 忘记密码, + { + "path": "pages/login/ForgetPassword/ForgetPassword", + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + // 文章详情, + { + "path": "pages/AlumniCircle/ArticleDetails/ArticleDetails", + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + // 评论详情, + { + "path": "pages/AlumniCircle/ReplyDetails/ReplyDetails", + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + // 文章发布页面, + { + "path": "pages/AlumniCircle/release/release", + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + { + "path": "pages/AlumniCircle/Alumni/Alumni", + "style": { + "navigationBarTitleText": "校友", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + { + "path": "pages/AlumniCircle/userDetail/userDetail", + "style": { + "navigationBarTitleText": "个人主页", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + { + "path": "pages/login/confirmPwd/confirmPwd", + "style": { + "navigationBarTitleText": "确认密码", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + { + "path": "pages/my/ShoolList/ShoolList", + "style": { + "navigationBarTitleText": "教育经历", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + { + "path": "pages/my/TeacherList/TeacherList", + "style": { + "navigationBarTitleText": "任职院校", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + { + "path": "pages/my/shoolAuthentication/shoolAuthentication", + "style": { + "navigationBarTitleText": "学历认证", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + { + "path": "pages/my/ReleaseList/ReleaseList", + "style": { + "navigationBarTitleText": "我的发布", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + { + "path": "pages/my/examine/examine", + "style": { + "navigationBarTitleText": "审核", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + { + "path": "pages/my/AuditDeatil/AuditDeatil", + "style": { + "navigationBarTitleText": "审核资料", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + { + "path": "pages/my/Feedback/Feedback", + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + { + "path": "pages/my/wishlist/wishlist", + "style": { + "navigationBarTitleText": "心愿单", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + { + "path": "pages/my/wishlist/addwishlist", + "style": { + "navigationBarTitleText": "添加心愿", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + { + "path": "pages/my/BackSchool/BackSchool", + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + { + "path": "pages/my/BackApply/BackApply", + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + { + "path": "pages/my/BackDetail/BackDetail", + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + { + "path": "pages/my/BackCode/BackCode", + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + { + "path": "pages/my/BackSuccess/BackSuccess", + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + { + "path": "pages/my/personalResume/personalResume", + "style": { + "navigationBarTitleText": "个人简历", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + { + "path": "pages/my/personalResume/online", + "style": { + "navigationBarTitleText": "在线简历", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + { + "path": "pages/my/personalResume/workPage", + "style": { + "navigationBarTitleText": "工作经历", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + { + "path": "pages/my/personalResume/proPage", + "style": { + "navigationBarTitleText": "工作经历", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + { + "path": "pages/my/BackCodeLook/BackCodeLook", + "style": { + "navigationBarTitleText": "返校核验", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + { + "path": "pages/my/fileAcc/fileAcc", + "style": { + "navigationBarTitleText": "附件简历", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + { + "path": "pages/login/roleSelection", + "style": { + "navigationBarTitleText": "角色选择", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + { + "path": "pages/login/teacherCertification", + "style": { + "navigationBarTitleText": "教职工认证", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + } + }, + { + "path": "pages/webview/index", + "style": { + "navigationBarTitleText": "网页链接", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + { + "path": "pages/login/recognitionResult/recognitionResult", + "style": { + "navigationBarTitleText": "提示", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + { + "path": "pages/login/recognitionResult/recognitionFailed", + "style": { + "navigationBarTitleText": "认证失败", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + { + "path": "pages/my/mySeting/mySetPwd", + "style": { + "navigationBarTitleText": "设置密码", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + }, + { + "path": "pages/my/myDetails/myInterest", + "style": { + "navigationBarTitleText": "兴趣爱好", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + // 隐藏系统导航栏 + } + } + ], + "subPackages": [], + // "preloadRule": { + // "pages/example/components": { + // "network": "all", + // "packages": ["pages/componentsA", "pages/componentsB", "pages/componentsC"] + // } + // }, + "globalStyle": { + "navigationBarTextStyle": "black", + "navigationBarTitleText": "uView", + "navigationBarBackgroundColor": "#FFFFFF", + "backgroundColor": "#FFFFFF" + }, + "tabBar": { + "color": "#909399", + "selectedColor": "#303133", + "backgroundColor": "#FFFFFF", + "borderStyle": "black", + "list": [ + { + "pagePath": "pages/home/home/home", + "iconPath": "/static/common/tabbar/index.png", + "selectedIconPath": "/static/common/tabbar/selectindex.png", + "text": "首页" + }, + { + "pagePath": "pages/message/msgList/msgList", + "iconPath": "static/common/tabbar/message.png", + "selectedIconPath": "static/common/tabbar/selectmessage.png", + "text": "消息" + }, + { + "pagePath": "pages/main/index/index", + "iconPath": "/static/common/tabbar/findFriends.png", + "selectedIconPath": "/static/common/tabbar/selectFindFridend.png", + "text": "找校友" + }, + { + "pagePath": "pages/AlumniCircle/alumnus/alumnus", + "iconPath": "static/common/tabbar/AlumniCircle.png", + "selectedIconPath": "static/common/tabbar/selectAlumniCircle.png", + "text": "校友圈" + }, + { + "pagePath": "pages/my/my/my", + "iconPath": "static/common/tabbar/my.png", + "selectedIconPath": "static/common/tabbar/selectmy.png", + "text": "我的" + } + ] + } +} diff --git a/pages/AlumniCircle/Alumni/Alumni copy.vue b/pages/AlumniCircle/Alumni/Alumni copy.vue new file mode 100644 index 0000000..2df3e2b --- /dev/null +++ b/pages/AlumniCircle/Alumni/Alumni copy.vue @@ -0,0 +1,249 @@ + + + + + diff --git a/pages/AlumniCircle/Alumni/Alumni.vue b/pages/AlumniCircle/Alumni/Alumni.vue new file mode 100644 index 0000000..74bbe90 --- /dev/null +++ b/pages/AlumniCircle/Alumni/Alumni.vue @@ -0,0 +1,349 @@ + + + + + diff --git a/pages/AlumniCircle/ArticleDetails/ArticleDetails.vue b/pages/AlumniCircle/ArticleDetails/ArticleDetails.vue new file mode 100644 index 0000000..3ee5aae --- /dev/null +++ b/pages/AlumniCircle/ArticleDetails/ArticleDetails.vue @@ -0,0 +1,1221 @@ + + + + + diff --git a/pages/AlumniCircle/ReplyDetails/ReplyDetails.vue b/pages/AlumniCircle/ReplyDetails/ReplyDetails.vue new file mode 100644 index 0000000..7b7114f --- /dev/null +++ b/pages/AlumniCircle/ReplyDetails/ReplyDetails.vue @@ -0,0 +1,349 @@ + + + + + \ No newline at end of file diff --git a/pages/AlumniCircle/alumnus/alumnus.vue b/pages/AlumniCircle/alumnus/alumnus.vue new file mode 100644 index 0000000..a033726 --- /dev/null +++ b/pages/AlumniCircle/alumnus/alumnus.vue @@ -0,0 +1,1281 @@ + + + + + diff --git a/pages/AlumniCircle/forward/forward.vue b/pages/AlumniCircle/forward/forward.vue new file mode 100644 index 0000000..ecad3cb --- /dev/null +++ b/pages/AlumniCircle/forward/forward.vue @@ -0,0 +1,276 @@ + + + + + \ No newline at end of file diff --git a/pages/AlumniCircle/release/release.vue b/pages/AlumniCircle/release/release.vue new file mode 100644 index 0000000..e738e56 --- /dev/null +++ b/pages/AlumniCircle/release/release.vue @@ -0,0 +1,565 @@ + + + + + diff --git a/pages/AlumniCircle/searchAlumnus/searchAlumnus.vue b/pages/AlumniCircle/searchAlumnus/searchAlumnus.vue new file mode 100644 index 0000000..e998424 --- /dev/null +++ b/pages/AlumniCircle/searchAlumnus/searchAlumnus.vue @@ -0,0 +1,854 @@ + + + + + diff --git a/pages/AlumniCircle/userDetail/userDetail copy.vue b/pages/AlumniCircle/userDetail/userDetail copy.vue new file mode 100644 index 0000000..ba1dc84 --- /dev/null +++ b/pages/AlumniCircle/userDetail/userDetail copy.vue @@ -0,0 +1,1179 @@ + + + + + diff --git a/pages/AlumniCircle/userDetail/userDetail.vue b/pages/AlumniCircle/userDetail/userDetail.vue new file mode 100644 index 0000000..cb2d627 --- /dev/null +++ b/pages/AlumniCircle/userDetail/userDetail.vue @@ -0,0 +1,812 @@ + + + + + diff --git a/pages/home/data/index copy.js b/pages/home/data/index copy.js new file mode 100644 index 0000000..171fac2 --- /dev/null +++ b/pages/home/data/index copy.js @@ -0,0 +1,367 @@ +const SCHOOL_CONFIG = { + 南昌理工: { + ai: { + name: "南小翼", + icon: "/static/common/img/homepage/icon_南小翼.png", + icon2: "/static/common/img/homepage/icon_南小翼_gray.png", + url: "http://sl.vrgon.com:2222/", + type: "http", + index: 0, + }, + welcome: { + name: "迎新", + icon: "/static/common/img/homepage/icon_迎新.png", + icon2: "/static/common/img/homepage/icon_迎新_gray.png", + url: "https://yxxt.nut.edu.cn:8090/#/", + type: "http", + index: 4, + }, + repair: { + name: "报修", + icon: "/static/common/img/homepage/icon_报修.png", + icon2: "/static/common/img/homepage/icon_报修_gray.png", + url: "https://bx.nut.edu.cn/#/", + type: "http", + index: 7, + }, + score: { + name: "成绩查询", + icon: "/static/common/img/homepage/icon_就业帮助.png", + icon2: "/static/common/img/homepage/icon_就业帮助_gray.png", + url: "https://iwglxt.nut.edu.cn/", + type: "http", + index: 5, + }, + oldStudent: { + name: "老生缴费", + icon: "/static/common/img/homepage/icon_缴费.png", + icon2: "/static/common/img/homepage/icon_缴费_gray.png", + url: "https://pay.nut.edu.cn/", + type: "http", + index: 1, + }, + electricityBill: { + name: "网上购电", + icon: "/static/common/img/homepage/icon_网上购电.png", + icon2: "/static/common/img/homepage/icon_网上购电_gray.png", + url: "https://if.nut.edu.cn/", + type: "http", + index: 6, + }, + }, + 新能源: { + ai: { + name: "源小新", + icon: "/static/common/img/homepage/icon_南小翼.png", + icon2: "/static/common/img/homepage/icon_南小翼_gray.png", + url: "http://ai.tynxy.com:8001/", + type: "http", + index: 0, + }, + welcome: { + name: "迎新", + icon: "/static/common/img/homepage/icon_迎新.png", + icon2: "/static/common/img/homepage/icon_迎新_gray.png", + url: "https://yx.tynxy.com:8090/#/login", + type: "http", + index: 4, + }, + library: { + name: "图书馆", + icon: "/static/common/img/homepage/icon_图书借阅.png", + icon2: "/static/common/img/homepage/icon_图书借阅_gray.png", + url: "https://a.xiumi.us/stage/v5/33A6c/151995615#/", + type: "http", + index: 10, + }, + score: { + name: "成绩查询", + icon: "/static/common/img/homepage/icon_就业帮助.png", + icon2: "/static/common/img/homepage/icon_就业帮助_gray.png", + url: "http://cas.tynxy.com:7171/cas/login/", + type: "http", + index: 5, + }, + electricityBill: { + name: "网上购电", + icon: "/static/common/img/homepage/icon_网上购电.png", + icon2: "/static/common/img/homepage/icon_网上购电_gray.png", + url: "http://vpn.tynxy.com:10081/", + type: "http", + index: 6, + }, + }, + 亚视: { + repair: { + name: "报修", + icon: "/static/common/img/homepage/icon_报修.png", + icon2: "/static/common/img/homepage/icon_报修_gray.png", + url: "http://gdysyx.gdatv.edu.cn:8099/#/", + type: "http", + index: 7, + }, + }, +}; + +/** + * 获取特定学校的所有功能配置 + * @param {string} schoolName - 学校名称 + * @returns {Object} - 该学校的所有功能配置 + */ +export const getSchoolConfig = (schoolName = "") => { + // 查找匹配的学校配置 + const matchedSchool = Object.keys(SCHOOL_CONFIG).find((key) => + schoolName.includes(key) + ); + return matchedSchool ? SCHOOL_CONFIG[matchedSchool] : {}; +}; + +// 保留之前的单项获取函数,以便向后兼容(首页使用) +export const getAIAssistantConfig = (schoolName = "") => { + const config = getSchoolConfig(schoolName); + return ( + config.ai || { + name: "ai智能", + icon: "/static/common/img/homepage/icon_南小翼.png", + icon2: "/static/common/img/homepage/icon_南小翼_gray.png", + url: "", + } + ); +}; +export const getOldStudentConfig = (schoolName = "") => { + const config = getSchoolConfig(schoolName); + return ( + config.oldStudent || { + name: "缴费", + icon: "/static/common/img/homepage/icon_缴费.png", + icon2: "/static/common/img/homepage/icon_缴费_gray.png", + url: "", + type: "page", + } + ); +}; +/** + * 首页功能列表数据 + */ +export const functionListing = [ + { + name: "ai智能", + icon: "/static/common/img/homepage/icon_南小翼.png", + icon2: "/static/common/img/homepage/icon_南小翼_gray.png", + url: "", + }, + { + name: "缴费", + icon: "/static/common/img/homepage/icon_缴费.png", + icon2: "/static/common/img/homepage/icon_缴费_gray.png", + url: "", + type: "page", + }, + { + name: "返校预约", + icon: "/static/common/img/homepage/icon_返校预约.png", + icon2: "/static/common/img/homepage/icon_返校预约_gray.png", + url: "/pages/my/BackSchool/BackSchool", + type: "page", + }, + { + name: "心愿单", + icon: "/static/common/img/homepage/icon_心愿单.png", + icon2: "/static/common/img/homepage/icon_心愿单_gray.png", + url: "/pages/my/wishlist/wishlist", + type: "page", + }, + // { + // name: "查询档案", + // icon: "/static/common/img/homepage/icon_查询档案.png", + // url: "", + // type: "page", + // }, + { + name: "全部服务", + icon: "/static/common/img/homepage/icon_全部服务.png", + icon2: "/static/common/img/homepage/icon_全部服务.png", + }, +]; + +// 教师首页配置 vuex_user.userType==1 +export const TEACHER_CONFIG = [ + { + name: "南小翼", + icon: "/static/common/img/homepage/icon_南小翼.png", + icon2: "/static/common/img/homepage/icon_南小翼_gray.png", + url: "http://sl.vrgon.com:2222/", + type: "http", + index: 0, + }, + { + name: "心愿单", + icon: "/static/common/img/homepage/icon_心愿单.png", + icon2: "/static/common/img/homepage/icon_心愿单_gray.png", + url: "/pages/my/wishlist/wishlist", + type: "page", + }, + { + name: "报修", + icon: "/static/common/img/homepage/icon_报修.png", + icon2: "/static/common/img/homepage/icon_报修_gray.png", + url: "https://bx.nut.edu.cn/#/", + type: "http", + index: 7, + }, + { + name: "DL", + icon: "/static/common/img/homepage/icon_DL.png", + icon2: "/static/common/img/homepage/icon_DL_gray.png", + url: "", + type: "page", + }, +]; + +/** + * 全部服务 + */ +export const functionListing2 = [ + { + name: "ai智能", + icon: "/static/common/img/homepage/icon_南小翼.png", + icon2: "/static/common/img/homepage/icon_南小翼_gray.png", + url: "", + }, + { + name: "缴费", + icon: "/static/common/img/homepage/icon_缴费.png", + icon2: "/static/common/img/homepage/icon_缴费_gray.png", + url: "", + type: "page", + }, + { + name: "返校预约", + icon: "/static/common/img/homepage/icon_返校预约.png", + icon2: "/static/common/img/homepage/icon_返校预约_gray.png", + url: "/pages/my/BackSchool/BackSchool", + type: "page", + }, + { + name: "心愿单", + icon: "/static/common/img/homepage/icon_心愿单.png", + icon2: "/static/common/img/homepage/icon_心愿单_gray.png", + url: "/pages/my/wishlist/wishlist", + type: "page", + }, + { + name: "迎新", + icon: "/static/common/img/homepage/icon_迎新.png", + icon2: "/static/common/img/homepage/icon_迎新_gray.png", + url: "", + type: "http", + }, + { + name: "就业帮助", + icon: "/static/common/img/homepage/icon_就业帮助.png", + icon2: "/static/common/img/homepage/icon_就业帮助_gray.png", + url: "", + type: "page", + }, + { + name: "活动报名", + icon: "/static/common/img/homepage/icon_活动报名.png", + icon2: "/static/common/img/homepage/icon_活动报名_gray.png", + url: "", + type: "page", + }, + { + name: "报修", + icon: "/static/common/img/homepage/icon_报修.png", + icon2: "/static/common/img/homepage/icon_报修_gray.png", + url: "", + type: "http", + }, + { + name: "勤工俭学", + icon: "/static/common/img/homepage/icon_勤工俭学.png", + icon2: "/static/common/img/homepage/icon_勤工俭学_gray.png", + url: "", + type: "page", + }, + { + name: "办事指南", + icon: "/static/common/img/homepage/icon_办事指南.png", + icon2: "/static/common/img/homepage/icon_办事指南_gray.png", + url: "", + type: "page", + }, + { + name: "图书借阅", + icon: "/static/common/img/homepage/icon_图书借阅.png", + icon2: "/static/common/img/homepage/icon_图书借阅_gray.png", + url: "", + type: "page", + }, + { + name: "查询档案", + icon: "/static/common/img/homepage/icon_查询档案.png", + icon2: "/static/common/img/homepage/icon_查询档案_gray.png", + url: "", + type: "page", + }, + { + name: "选课", + icon: "/static/common/img/homepage/icon_选课.png", + icon2: "/static/common/img/homepage/icon_选课_gray.png", + url: "", + type: "page", + }, + { + name: "DL", + icon: "/static/common/img/homepage/icon_DL.png", + icon2: "/static/common/img/homepage/icon_DL_gray.png", + url: "", + type: "page", + }, + { + name: "校园跑", + icon: "/static/common/img/homepage/icon_校园跑.png", + icon2: "/static/common/img/homepage/icon_校园跑_gray.png", + url: "", + type: "page", + }, +]; + +export const functionListing3 = [ + { + name: "校友名片", + icon: "/static/common/img/homepage/icon_校友名片.png", + icon2: "/static/common/img/homepage/icon_校友名片_gray.png", + url: "", + type: "page", + }, + { + name: "校友活动", + icon: "/static/common/img/homepage/icon_校友活动.png", + icon2: "/static/common/img/homepage/icon_校友活动_gray.png", + url: "", + type: "page", + }, + { + name: "电子校友卡", + icon: "/static/common/img/homepage/icon_电子校友卡.png", + icon2: "/static/common/img/homepage/icon_电子校友卡_gray.png", + url: "", + type: "page", + }, + { + name: "校友会组织", + icon: "/static/common/img/homepage/icon_校友会组织.png", + icon2: "/static/common/img/homepage/icon_校友会组织_gray.png", + url: "", + type: "page", + }, + { + name: "助力母校", + icon: "/static/common/img/homepage/icon_助力母校.png", + icon2: "/static/common/img/homepage/icon_助力母校_gray.png", + url: "", + type: "page", + }, +]; diff --git a/pages/home/data/index.js b/pages/home/data/index.js new file mode 100644 index 0000000..bf38296 --- /dev/null +++ b/pages/home/data/index.js @@ -0,0 +1,596 @@ +const SCHOOL_CONFIG = { + 南昌理工: { + ai: { + name: "南小翼", + icon: "/static/common/img/homepage/icon_南小翼.png", + icon2: "/static/common/img/homepage/icon_南小翼_gray.png", + url: "http://sl.vrgon.com:2222/", + type: "http", + index: 0, + }, + // welcome: { + // name: "迎新", + // icon: "/static/common/img/homepage/icon_迎新.png", + // icon2: "/static/common/img/homepage/icon_迎新_gray.png", + // url: "https://yxxt.nut.edu.cn:8090/#/", + // type: "http", + // index: 4, + // }, + repair: { + name: "报修", + icon: "/static/common/img/homepage/icon_报修.png", + icon2: "/static/common/img/homepage/icon_报修_gray.png", + url: "https://bx.nut.edu.cn/#/", + type: "http", + index: 6, + }, + score: { + name: "成绩查询", + icon: "/static/common/img/homepage/icon_就业帮助.png", + icon2: "/static/common/img/homepage/icon_就业帮助_gray.png", + url: "https://iwglxt.nut.edu.cn/", + type: "http", + index: 4, + }, + oldStudent: { + name: "老生缴费", + icon: "/static/common/img/homepage/icon_缴费.png", + icon2: "/static/common/img/homepage/icon_缴费_gray.png", + url: "https://pay.nut.edu.cn/", + type: "http", + index: 1, + }, + electricityBill: { + name: "网上购电", + icon: "/static/common/img/homepage/icon_网上购电.png", + icon2: "/static/common/img/homepage/icon_网上购电_gray.png", + url: "https://if.nut.edu.cn/", + type: "http", + index: 5, + }, + }, + 新能源: { + ai: { + name: "源小新", + icon: "/static/common/img/homepage/icon_南小翼.png", + icon2: "/static/common/img/homepage/icon_南小翼_gray.png", + url: "http://ai.tynxy.com:8001/", + type: "http", + index: 0, + }, + // welcome: { + // name: "迎新", + // icon: "/static/common/img/homepage/icon_迎新.png", + // icon2: "/static/common/img/homepage/icon_迎新_gray.png", + // url: "https://yx.tynxy.com:8090/#/login", + // type: "http", + // index: 4, + // }, + library: { + name: "图书馆", + icon: "/static/common/img/homepage/icon_图书借阅.png", + icon2: "/static/common/img/homepage/icon_图书借阅_gray.png", + url: "https://a.xiumi.us/stage/v5/33A6c/151995615#/", + type: "http", + index: 9, + }, + score: { + name: "成绩查询", + icon: "/static/common/img/homepage/icon_就业帮助.png", + icon2: "/static/common/img/homepage/icon_就业帮助_gray.png", + url: "http://cas.tynxy.com:7171/cas/login/", + type: "http", + index: 4, + }, + electricityBill: { + name: "网上购电", + icon: "/static/common/img/homepage/icon_网上购电.png", + icon2: "/static/common/img/homepage/icon_网上购电_gray.png", + url: "http://vpn.tynxy.com:10081/", + type: "http", + index: 5, + }, + }, + 亚视: { + ai: { + name: "广小演", + icon: "/static/common/img/homepage/icon_南小翼.png", + icon2: "/static/common/img/homepage/icon_南小翼_gray.png", + url: "http://gxy.gdatv.edu.cn:8103/", + type: "http", + index: 0, + }, + electricityBill: { + name: "网上购电", + icon: "/static/common/img/homepage/icon_网上购电.png", + icon2: "/static/common/img/homepage/icon_网上购电_gray.png", + url: "https://payment.gdatv.edu.cn/df?code=021aLZZv3Knm753sCR0w3k1W7w3aLZZu&state=1", + type: "http", + index: 5, + }, + repair: { + name: "报修", + icon: "/static/common/img/homepage/icon_报修.png", + icon2: "/static/common/img/homepage/icon_报修_gray.png", + url: "http://gdysyx.gdatv.edu.cn:8099/#/", + type: "http", + index: 6, + }, + library: { + name: "图书馆", + icon: "/static/common/img/homepage/icon_图书借阅.png", + icon2: "/static/common/img/homepage/icon_图书借阅_gray.png", + url: "https://v1.chaoxing.com/wechatSet/mobileIndex?fidEnc=edb7ce62838ef070&pageId=2572", + type: "http", + index: 9, + }, + }, +}; + +/** + * 获取特定学校的所有功能配置 + * @param {string} schoolName - 学校名称 + * @returns {Object} - 该学校的所有功能配置 + */ +export const getSchoolConfig = (schoolName = "") => { + // 查找匹配的学校配置 + const matchedSchool = Object.keys(SCHOOL_CONFIG).find((key) => + schoolName.includes(key) + ); + return matchedSchool ? SCHOOL_CONFIG[matchedSchool] : {}; +}; + +// 保留之前的单项获取函数,以便向后兼容(首页使用) +export const getAIAssistantConfig = (schoolName = "") => { + const config = getSchoolConfig(schoolName); + return ( + config.ai || { + name: "ai智能", + icon: "/static/common/img/homepage/icon_南小翼.png", + icon2: "/static/common/img/homepage/icon_南小翼_gray.png", + url: "", + } + ); +}; +export const getOldStudentConfig = (schoolName = "") => { + const config = getSchoolConfig(schoolName); + return ( + config.oldStudent || { + name: "缴费", + icon: "/static/common/img/homepage/icon_缴费.png", + icon2: "/static/common/img/homepage/icon_缴费_gray.png", + url: "", + type: "page", + } + ); +}; +/** + * 首页功能列表数据 + */ +export const functionListing = [ + { + name: "ai智能", + icon: "/static/common/img/homepage/icon_南小翼.png", + icon2: "/static/common/img/homepage/icon_南小翼_gray.png", + url: "", + }, + { + name: "缴费", + icon: "/static/common/img/homepage/icon_缴费.png", + icon2: "/static/common/img/homepage/icon_缴费_gray.png", + url: "", + type: "page", + }, + { + name: "返校预约", + icon: "/static/common/img/homepage/icon_返校预约.png", + icon2: "/static/common/img/homepage/icon_返校预约_gray.png", + url: "/pages/my/BackSchool/BackSchool", + type: "page", + }, + { + name: "心愿单", + icon: "/static/common/img/homepage/icon_心愿单.png", + icon2: "/static/common/img/homepage/icon_心愿单_gray.png", + url: "/pages/my/wishlist/wishlist", + type: "page", + }, + { + name: "全部服务", + icon: "/static/common/img/homepage/icon_全部服务.png", + icon2: "/static/common/img/homepage/icon_全部服务.png", + }, +]; + +// 教师首页配置 vuex_user.userType==1 +export const TEACHER_CONFIG = [ + { + name: "南小翼", + icon: "/static/common/img/homepage/icon_南小翼.png", + icon2: "/static/common/img/homepage/icon_南小翼_gray.png", + url: "http://sl.vrgon.com:2222/", + type: "http", + index: 0, + }, + { + name: "心愿单", + icon: "/static/common/img/homepage/icon_心愿单.png", + icon2: "/static/common/img/homepage/icon_心愿单_gray.png", + url: "/pages/my/wishlist/wishlist", + type: "page", + }, + { + name: "报修", + icon: "/static/common/img/homepage/icon_报修.png", + icon2: "/static/common/img/homepage/icon_报修_gray.png", + url: "https://bx.nut.edu.cn/#/", + type: "http", + index: 7, + }, + { + name: "图书馆", + icon: "/static/common/img/homepage/icon_图书借阅.png", + icon2: "/static/common/img/homepage/icon_图书借阅_gray.png", + url: "https://book.nut.edu.cn/", + type: "http", + index: 9, + }, +]; + +// 南昌理工学院配置 +export const NANCHANG_CONFIG = { + 在校生: [ + { + name: "南小翼", + icon: "/static/common/img/homepage/icon_南小翼.png", + icon2: "/static/common/img/homepage/icon_南小翼_gray.png", + url: "http://sl.vrgon.com:2222/", + type: "http", + }, + { + name: "老生缴费", + icon: "/static/common/img/homepage/icon_缴费.png", + icon2: "/static/common/img/homepage/icon_缴费_gray.png", + url: "https://pay.nut.edu.cn/", + type: "http", + index: 1, + }, + { + name: "网上购电", + icon: "/static/common/img/homepage/icon_网上购电.png", + icon2: "/static/common/img/homepage/icon_网上购电_gray.png", + url: "https://if.nut.edu.cn/", + type: "http", + index: 5, + }, + { + name: "成绩查询", + icon: "/static/common/img/homepage/icon_就业帮助.png", + icon2: "/static/common/img/homepage/icon_就业帮助_gray.png", + url: "https://iwglxt.nut.edu.cn/", + type: "http", + index: 4, + }, + { + name: "报修", + icon: "/static/common/img/homepage/icon_报修.png", + icon2: "/static/common/img/homepage/icon_报修_gray.png", + url: "https://bx.nut.edu.cn/#/", + type: "http", + index: 6, + }, + { + name: "心愿单", + icon: "/static/common/img/homepage/icon_心愿单.png", + icon2: "/static/common/img/homepage/icon_心愿单_gray.png", + url: "/pages/my/wishlist/wishlist", + type: "page", + }, + { + name: "图书馆", + icon: "/static/common/img/homepage/icon_图书借阅.png", + icon2: "/static/common/img/homepage/icon_图书借阅_gray.png", + url: "https://book.nut.edu.cn/", + type: "http", + index: 9, + }, + { + name: "选课", + icon: "/static/common/img/homepage/icon_选课.png", + icon2: "/static/common/img/homepage/icon_选课_gray.png", + url: "", + type: "page", + }, + { + name: "办事指南", + icon: "/static/common/img/homepage/icon_办事指南.png", + icon2: "/static/common/img/homepage/icon_办事指南_gray.png", + url: "", + type: "page", + }, + { + name: "勤工俭学", + icon: "/static/common/img/homepage/icon_勤工俭学.png", + icon2: "/static/common/img/homepage/icon_勤工俭学_gray.png", + url: "", + type: "page", + }, + { + name: "校园跑", + icon: "/static/common/img/homepage/icon_校园跑.png", + icon2: "/static/common/img/homepage/icon_校园跑_gray.png", + url: "", + type: "page", + }, + { + name: "查询档案", + icon: "/static/common/img/homepage/icon_查询档案.png", + icon2: "/static/common/img/homepage/icon_查询档案_gray.png", + url: "", + type: "page", + }, + ], + 毕业生: [ + { + name: "南小翼", + icon: "/static/common/img/homepage/icon_南小翼.png", + icon2: "/static/common/img/homepage/icon_南小翼_gray.png", + url: "http://sl.vrgon.com:2222/", + type: "http", + }, + { + name: "返校预约", + icon: "/static/common/img/homepage/icon_返校预约.png", + icon2: "/static/common/img/homepage/icon_返校预约_gray.png", + url: "/pages/my/BackSchool/BackSchool", + type: "page", + }, + { + name: "图书馆", + icon: "/static/common/img/homepage/icon_图书借阅.png", + icon2: "/static/common/img/homepage/icon_图书借阅_gray.png", + url: "https://book.nut.edu.cn/", + type: "http", + index: 9, + }, + { + name: "心愿单", + icon: "/static/common/img/homepage/icon_心愿单.png", + icon2: "/static/common/img/homepage/icon_心愿单_gray.png", + url: "/pages/my/wishlist/wishlist", + type: "page", + }, + { + name: "DL", + icon: "/static/common/img/homepage/icon_DL.png", + icon2: "/static/common/img/homepage/icon_DL_gray.png", + url: "", + type: "page", + }, + { + name: "校友名片", + icon: "/static/common/img/homepage/icon_校友名片.png", + icon2: "/static/common/img/homepage/icon_校友名片_gray.png", + url: "", + type: "page", + }, + { + name: "校友活动", + icon: "/static/common/img/homepage/icon_校友活动.png", + icon2: "/static/common/img/homepage/icon_校友活动_gray.png", + url: "", + type: "page", + }, + { + name: "电子校友卡", + icon: "/static/common/img/homepage/icon_电子校友卡.png", + icon2: "/static/common/img/homepage/icon_电子校友卡_gray.png", + url: "", + type: "page", + }, + { + name: "校友会组织", + icon: "/static/common/img/homepage/icon_校友会组织.png", + icon2: "/static/common/img/homepage/icon_校友会组织_gray.png", + url: "", + type: "page", + }, + { + name: "助力母校", + icon: "/static/common/img/homepage/icon_助力母校.png", + icon2: "/static/common/img/homepage/icon_助力母校_gray.png", + url: "", + type: "page", + }, + ], + 教师: [ + { + name: "南小翼", + icon: "/static/common/img/homepage/icon_南小翼.png", + icon2: "/static/common/img/homepage/icon_南小翼_gray.png", + url: "http://sl.vrgon.com:2222/", + type: "http", + index: 0, + }, + { + name: "心愿单", + icon: "/static/common/img/homepage/icon_心愿单.png", + icon2: "/static/common/img/homepage/icon_心愿单_gray.png", + url: "/pages/my/wishlist/wishlist", + type: "page", + }, + { + name: "报修", + icon: "/static/common/img/homepage/icon_报修.png", + icon2: "/static/common/img/homepage/icon_报修_gray.png", + url: "https://bx.nut.edu.cn/#/", + type: "http", + index: 7, + }, + { + name: "图书馆", + icon: "/static/common/img/homepage/icon_图书借阅.png", + icon2: "/static/common/img/homepage/icon_图书借阅_gray.png", + url: "https://book.nut.edu.cn/", + type: "http", + index: 9, + }, + // { + // name: "DL", + // icon: "/static/common/img/homepage/icon_DL.png", + // icon2: "/static/common/img/homepage/icon_DL_gray.png", + // url: "", + // type: "page", + // }, + ], +}; + +/** + * 全部服务 + */ +export const functionListing2 = [ + { + name: "ai智能", + icon: "/static/common/img/homepage/icon_南小翼.png", + icon2: "/static/common/img/homepage/icon_南小翼_gray.png", + url: "", + }, + { + name: "缴费", + icon: "/static/common/img/homepage/icon_缴费.png", + icon2: "/static/common/img/homepage/icon_缴费_gray.png", + url: "", + type: "page", + }, + { + name: "返校预约", + icon: "/static/common/img/homepage/icon_返校预约.png", + icon2: "/static/common/img/homepage/icon_返校预约_gray.png", + url: "/pages/my/BackSchool/BackSchool", + type: "page", + }, + { + name: "心愿单", + icon: "/static/common/img/homepage/icon_心愿单.png", + icon2: "/static/common/img/homepage/icon_心愿单_gray.png", + url: "/pages/my/wishlist/wishlist", + type: "page", + }, + // { + // name: "迎新", + // icon: "/static/common/img/homepage/icon_迎新.png", + // icon2: "/static/common/img/homepage/icon_迎新_gray.png", + // url: "", + // type: "http", + // }, + { + name: "就业帮助", + icon: "/static/common/img/homepage/icon_就业帮助.png", + icon2: "/static/common/img/homepage/icon_就业帮助_gray.png", + url: "", + type: "page", + }, + { + name: "活动报名", + icon: "/static/common/img/homepage/icon_活动报名.png", + icon2: "/static/common/img/homepage/icon_活动报名_gray.png", + url: "", + type: "page", + }, + { + name: "报修", + icon: "/static/common/img/homepage/icon_报修.png", + icon2: "/static/common/img/homepage/icon_报修_gray.png", + url: "", + type: "http", + }, + { + name: "勤工俭学", + icon: "/static/common/img/homepage/icon_勤工俭学.png", + icon2: "/static/common/img/homepage/icon_勤工俭学_gray.png", + url: "", + type: "page", + }, + { + name: "办事指南", + icon: "/static/common/img/homepage/icon_办事指南.png", + icon2: "/static/common/img/homepage/icon_办事指南_gray.png", + url: "", + type: "page", + }, + { + name: "图书馆", + icon: "/static/common/img/homepage/icon_图书借阅.png", + icon2: "/static/common/img/homepage/icon_图书借阅_gray.png", + url: "", + type: "page", + }, + { + name: "查询档案", + icon: "/static/common/img/homepage/icon_查询档案.png", + icon2: "/static/common/img/homepage/icon_查询档案_gray.png", + url: "", + type: "page", + }, + { + name: "选课", + icon: "/static/common/img/homepage/icon_选课.png", + icon2: "/static/common/img/homepage/icon_选课_gray.png", + url: "", + type: "page", + }, + { + name: "DL", + icon: "/static/common/img/homepage/icon_DL.png", + icon2: "/static/common/img/homepage/icon_DL_gray.png", + url: "", + type: "page", + }, + { + name: "校园跑", + icon: "/static/common/img/homepage/icon_校园跑.png", + icon2: "/static/common/img/homepage/icon_校园跑_gray.png", + url: "", + type: "page", + }, + // {}, +]; + +// 毕业生敬请期待 +export const functionListing3 = [ + { + name: "校友名片", + icon: "/static/common/img/homepage/icon_校友名片.png", + icon2: "/static/common/img/homepage/icon_校友名片_gray.png", + url: "", + type: "page", + }, + { + name: "校友活动", + icon: "/static/common/img/homepage/icon_校友活动.png", + icon2: "/static/common/img/homepage/icon_校友活动_gray.png", + url: "", + type: "page", + }, + { + name: "电子校友卡", + icon: "/static/common/img/homepage/icon_电子校友卡.png", + icon2: "/static/common/img/homepage/icon_电子校友卡_gray.png", + url: "", + type: "page", + }, + { + name: "校友会组织", + icon: "/static/common/img/homepage/icon_校友会组织.png", + icon2: "/static/common/img/homepage/icon_校友会组织_gray.png", + url: "", + type: "page", + }, + { + name: "助力母校", + icon: "/static/common/img/homepage/icon_助力母校.png", + icon2: "/static/common/img/homepage/icon_助力母校_gray.png", + url: "", + type: "page", + }, +]; diff --git a/pages/home/home/components/campusInfo/index.vue b/pages/home/home/components/campusInfo/index.vue new file mode 100644 index 0000000..8df5474 --- /dev/null +++ b/pages/home/home/components/campusInfo/index.vue @@ -0,0 +1,85 @@ + + + + + diff --git a/pages/home/home/components/contentDetail/commentSection.vue b/pages/home/home/components/contentDetail/commentSection.vue new file mode 100644 index 0000000..8d6a277 --- /dev/null +++ b/pages/home/home/components/contentDetail/commentSection.vue @@ -0,0 +1,668 @@ + + + + + diff --git a/pages/home/home/components/contentDetail/index.vue b/pages/home/home/components/contentDetail/index.vue new file mode 100644 index 0000000..9110705 --- /dev/null +++ b/pages/home/home/components/contentDetail/index.vue @@ -0,0 +1,337 @@ + + + + + diff --git a/pages/home/home/components/contentDetail/replySection.vue b/pages/home/home/components/contentDetail/replySection.vue new file mode 100644 index 0000000..673839c --- /dev/null +++ b/pages/home/home/components/contentDetail/replySection.vue @@ -0,0 +1,3 @@ + diff --git a/pages/home/home/components/ourSchool/index.vue b/pages/home/home/components/ourSchool/index.vue new file mode 100644 index 0000000..468f490 --- /dev/null +++ b/pages/home/home/components/ourSchool/index.vue @@ -0,0 +1,206 @@ + + + + + diff --git a/pages/home/home/components/recommend/allServices copy.vue b/pages/home/home/components/recommend/allServices copy.vue new file mode 100644 index 0000000..0beb092 --- /dev/null +++ b/pages/home/home/components/recommend/allServices copy.vue @@ -0,0 +1,244 @@ + + + + + diff --git a/pages/home/home/components/recommend/allServices.vue b/pages/home/home/components/recommend/allServices.vue new file mode 100644 index 0000000..1136ea0 --- /dev/null +++ b/pages/home/home/components/recommend/allServices.vue @@ -0,0 +1,346 @@ + + + + + diff --git a/pages/home/home/components/recommend/index.vue b/pages/home/home/components/recommend/index.vue new file mode 100644 index 0000000..9ccd49a --- /dev/null +++ b/pages/home/home/components/recommend/index.vue @@ -0,0 +1,885 @@ + + + + + diff --git a/pages/home/home/components/recommend/moreFriends.vue b/pages/home/home/components/recommend/moreFriends.vue new file mode 100644 index 0000000..fcbbf2a --- /dev/null +++ b/pages/home/home/components/recommend/moreFriends.vue @@ -0,0 +1,254 @@ + + + + + diff --git a/pages/home/home/components/searchPage/index.vue b/pages/home/home/components/searchPage/index.vue new file mode 100644 index 0000000..5a0144c --- /dev/null +++ b/pages/home/home/components/searchPage/index.vue @@ -0,0 +1,346 @@ + + + + + diff --git a/pages/home/home/components/topic/index.vue b/pages/home/home/components/topic/index.vue new file mode 100644 index 0000000..828fef0 --- /dev/null +++ b/pages/home/home/components/topic/index.vue @@ -0,0 +1,310 @@ + + + + + diff --git a/pages/home/home/components/topic/topicDetail.vue b/pages/home/home/components/topic/topicDetail.vue new file mode 100644 index 0000000..ee9891f --- /dev/null +++ b/pages/home/home/components/topic/topicDetail.vue @@ -0,0 +1,300 @@ + + + + + diff --git a/pages/home/home/components/topic/topicSquare.vue b/pages/home/home/components/topic/topicSquare.vue new file mode 100644 index 0000000..5940cb6 --- /dev/null +++ b/pages/home/home/components/topic/topicSquare.vue @@ -0,0 +1,345 @@ + + + + + diff --git a/pages/home/home/home.vue b/pages/home/home/home.vue new file mode 100644 index 0000000..27c519e --- /dev/null +++ b/pages/home/home/home.vue @@ -0,0 +1,243 @@ + + + + + diff --git a/pages/login/ForgetPassword/ForgetPassword.vue b/pages/login/ForgetPassword/ForgetPassword.vue new file mode 100644 index 0000000..9684b1a --- /dev/null +++ b/pages/login/ForgetPassword/ForgetPassword.vue @@ -0,0 +1,425 @@ + + + + diff --git a/pages/login/authentication/authentication.vue b/pages/login/authentication/authentication.vue new file mode 100644 index 0000000..aa652c0 --- /dev/null +++ b/pages/login/authentication/authentication.vue @@ -0,0 +1,177 @@ + + + + + diff --git a/pages/login/confirmPwd/confirmPwd.vue b/pages/login/confirmPwd/confirmPwd.vue new file mode 100644 index 0000000..174801f --- /dev/null +++ b/pages/login/confirmPwd/confirmPwd.vue @@ -0,0 +1,338 @@ + + + + + diff --git a/pages/login/graduateCertification/graduateCertification.vue b/pages/login/graduateCertification/graduateCertification.vue new file mode 100644 index 0000000..0a0477e --- /dev/null +++ b/pages/login/graduateCertification/graduateCertification.vue @@ -0,0 +1,1104 @@ + + + + + diff --git a/pages/login/login/login.vue b/pages/login/login/login.vue new file mode 100644 index 0000000..068d4da --- /dev/null +++ b/pages/login/login/login.vue @@ -0,0 +1,532 @@ + + + + + \ No newline at end of file diff --git a/pages/login/perfect/perfect.vue b/pages/login/perfect/perfect.vue new file mode 100644 index 0000000..2090c2e --- /dev/null +++ b/pages/login/perfect/perfect.vue @@ -0,0 +1,1344 @@ + + + + + diff --git a/pages/login/perfectPersonal/perfectPersonal.vue b/pages/login/perfectPersonal/perfectPersonal.vue new file mode 100644 index 0000000..629c652 --- /dev/null +++ b/pages/login/perfectPersonal/perfectPersonal.vue @@ -0,0 +1,158 @@ + + + + + diff --git a/pages/login/recognitionResult/recognitionFailed.vue b/pages/login/recognitionResult/recognitionFailed.vue new file mode 100644 index 0000000..6ce53b8 --- /dev/null +++ b/pages/login/recognitionResult/recognitionFailed.vue @@ -0,0 +1,147 @@ + + + + + diff --git a/pages/login/recognitionResult/recognitionResult.vue b/pages/login/recognitionResult/recognitionResult.vue new file mode 100644 index 0000000..e7a2d35 --- /dev/null +++ b/pages/login/recognitionResult/recognitionResult.vue @@ -0,0 +1,155 @@ + + + + + diff --git a/pages/login/register/register.vue b/pages/login/register/register.vue new file mode 100644 index 0000000..56899e7 --- /dev/null +++ b/pages/login/register/register.vue @@ -0,0 +1,633 @@ + + + + + + + + + diff --git a/pages/login/roleSelection.vue b/pages/login/roleSelection.vue new file mode 100644 index 0000000..ae11eb1 --- /dev/null +++ b/pages/login/roleSelection.vue @@ -0,0 +1,242 @@ + + + + + diff --git a/pages/login/teacherCertification.vue b/pages/login/teacherCertification.vue new file mode 100644 index 0000000..bbde529 --- /dev/null +++ b/pages/login/teacherCertification.vue @@ -0,0 +1,1609 @@ + + + + + diff --git a/pages/main/index/index.vue b/pages/main/index/index.vue new file mode 100644 index 0000000..2ee7a50 --- /dev/null +++ b/pages/main/index/index.vue @@ -0,0 +1,1633 @@ + + + + + diff --git a/pages/main/search/search.vue b/pages/main/search/search.vue new file mode 100644 index 0000000..49d790d --- /dev/null +++ b/pages/main/search/search.vue @@ -0,0 +1,736 @@ + + + + + diff --git a/pages/message/adminList/adminList.vue b/pages/message/adminList/adminList.vue new file mode 100644 index 0000000..4746800 --- /dev/null +++ b/pages/message/adminList/adminList.vue @@ -0,0 +1,234 @@ + + + + + diff --git a/pages/message/attentionList/attentionList.vue b/pages/message/attentionList/attentionList.vue new file mode 100644 index 0000000..8d7f412 --- /dev/null +++ b/pages/message/attentionList/attentionList.vue @@ -0,0 +1,673 @@ + + + + + diff --git a/pages/message/dialogBox/dialogBox.vue b/pages/message/dialogBox/dialogBox.vue new file mode 100644 index 0000000..3110bd5 --- /dev/null +++ b/pages/message/dialogBox/dialogBox.vue @@ -0,0 +1,1351 @@ + + + + + diff --git a/pages/message/interactionList/interactionList.vue b/pages/message/interactionList/interactionList.vue new file mode 100644 index 0000000..9d14a80 --- /dev/null +++ b/pages/message/interactionList/interactionList.vue @@ -0,0 +1,438 @@ + + + + + diff --git a/pages/message/msgList/msgList copy.vue b/pages/message/msgList/msgList copy.vue new file mode 100644 index 0000000..a40640c --- /dev/null +++ b/pages/message/msgList/msgList copy.vue @@ -0,0 +1,938 @@ + + + + + diff --git a/pages/message/msgList/msgList.vue b/pages/message/msgList/msgList.vue new file mode 100644 index 0000000..f7689f9 --- /dev/null +++ b/pages/message/msgList/msgList.vue @@ -0,0 +1,910 @@ + + + + + diff --git a/pages/message/sysList/sysList.vue b/pages/message/sysList/sysList.vue new file mode 100644 index 0000000..3b14681 --- /dev/null +++ b/pages/message/sysList/sysList.vue @@ -0,0 +1,175 @@ + + + + + diff --git a/pages/my/AddEducation/AddEducation.vue b/pages/my/AddEducation/AddEducation.vue new file mode 100644 index 0000000..a289e30 --- /dev/null +++ b/pages/my/AddEducation/AddEducation.vue @@ -0,0 +1,477 @@ + + + + + diff --git a/pages/my/AuditDeatil/AuditDeatil.vue b/pages/my/AuditDeatil/AuditDeatil.vue new file mode 100644 index 0000000..024778d --- /dev/null +++ b/pages/my/AuditDeatil/AuditDeatil.vue @@ -0,0 +1,533 @@ + + + + + diff --git a/pages/my/BackApply/BackApply.vue b/pages/my/BackApply/BackApply.vue new file mode 100644 index 0000000..9ab080c --- /dev/null +++ b/pages/my/BackApply/BackApply.vue @@ -0,0 +1,799 @@ + + + + + diff --git a/pages/my/BackCode/BackCode.vue b/pages/my/BackCode/BackCode.vue new file mode 100644 index 0000000..4a8d6ed --- /dev/null +++ b/pages/my/BackCode/BackCode.vue @@ -0,0 +1,359 @@ + + + + + diff --git a/pages/my/BackCodeLook/BackCodeLook.vue b/pages/my/BackCodeLook/BackCodeLook.vue new file mode 100644 index 0000000..e2e2d9c --- /dev/null +++ b/pages/my/BackCodeLook/BackCodeLook.vue @@ -0,0 +1,675 @@ + + + + + diff --git a/pages/my/BackDetail/BackDetail.vue b/pages/my/BackDetail/BackDetail.vue new file mode 100644 index 0000000..97aec5e --- /dev/null +++ b/pages/my/BackDetail/BackDetail.vue @@ -0,0 +1,741 @@ + + + + + diff --git a/pages/my/BackSchool/BackSchool.vue b/pages/my/BackSchool/BackSchool.vue new file mode 100644 index 0000000..eef11ff --- /dev/null +++ b/pages/my/BackSchool/BackSchool.vue @@ -0,0 +1,387 @@ + + + + + diff --git a/pages/my/BackSuccess/BackSuccess.vue b/pages/my/BackSuccess/BackSuccess.vue new file mode 100644 index 0000000..4779592 --- /dev/null +++ b/pages/my/BackSuccess/BackSuccess.vue @@ -0,0 +1,80 @@ + + + + + diff --git a/pages/my/Feedback/Feedback.vue b/pages/my/Feedback/Feedback.vue new file mode 100644 index 0000000..d9e2867 --- /dev/null +++ b/pages/my/Feedback/Feedback.vue @@ -0,0 +1,309 @@ + + + + + diff --git a/pages/my/ReleaseList/ReleaseList.vue b/pages/my/ReleaseList/ReleaseList.vue new file mode 100644 index 0000000..d7606d5 --- /dev/null +++ b/pages/my/ReleaseList/ReleaseList.vue @@ -0,0 +1,477 @@ + + + + + diff --git a/pages/my/ShoolList/ShoolList.vue b/pages/my/ShoolList/ShoolList.vue new file mode 100644 index 0000000..82974cc --- /dev/null +++ b/pages/my/ShoolList/ShoolList.vue @@ -0,0 +1,348 @@ + + + + + diff --git a/pages/my/TeacherList/TeacherList.vue b/pages/my/TeacherList/TeacherList.vue new file mode 100644 index 0000000..60efcae --- /dev/null +++ b/pages/my/TeacherList/TeacherList.vue @@ -0,0 +1,317 @@ + + + + + diff --git a/pages/my/authentication/authentication.vue b/pages/my/authentication/authentication.vue new file mode 100644 index 0000000..5705d3c --- /dev/null +++ b/pages/my/authentication/authentication.vue @@ -0,0 +1,276 @@ + + + + + diff --git a/pages/my/certificationDetails/certificationDetails.vue b/pages/my/certificationDetails/certificationDetails.vue new file mode 100644 index 0000000..e303deb --- /dev/null +++ b/pages/my/certificationDetails/certificationDetails.vue @@ -0,0 +1,1244 @@ + + + + + diff --git a/pages/my/examine/examine.vue b/pages/my/examine/examine.vue new file mode 100644 index 0000000..0e3d8bb --- /dev/null +++ b/pages/my/examine/examine.vue @@ -0,0 +1,555 @@ + + + + + diff --git a/pages/my/fileAcc/fileAcc.vue b/pages/my/fileAcc/fileAcc.vue new file mode 100644 index 0000000..d31b29b --- /dev/null +++ b/pages/my/fileAcc/fileAcc.vue @@ -0,0 +1,489 @@ + + + + + diff --git a/pages/my/my/my copy.vue b/pages/my/my/my copy.vue new file mode 100644 index 0000000..b08cd47 --- /dev/null +++ b/pages/my/my/my copy.vue @@ -0,0 +1,1952 @@ + + + + + diff --git a/pages/my/my/my.vue b/pages/my/my/my.vue new file mode 100644 index 0000000..032d3e9 --- /dev/null +++ b/pages/my/my/my.vue @@ -0,0 +1,1072 @@ + + + + + diff --git a/pages/my/myDetails/myDetails.vue b/pages/my/myDetails/myDetails.vue new file mode 100644 index 0000000..4bae7ca --- /dev/null +++ b/pages/my/myDetails/myDetails.vue @@ -0,0 +1,609 @@ + + + + + diff --git a/pages/my/myDetails/myInterest.vue b/pages/my/myDetails/myInterest.vue new file mode 100644 index 0000000..03d57b6 --- /dev/null +++ b/pages/my/myDetails/myInterest.vue @@ -0,0 +1,280 @@ + + + + \ No newline at end of file diff --git a/pages/my/mySeting/mySetPwd.vue b/pages/my/mySeting/mySetPwd.vue new file mode 100644 index 0000000..cc8781a --- /dev/null +++ b/pages/my/mySeting/mySetPwd.vue @@ -0,0 +1,204 @@ + + + + + diff --git a/pages/my/mySeting/mySeting.vue b/pages/my/mySeting/mySeting.vue new file mode 100644 index 0000000..c88ddea --- /dev/null +++ b/pages/my/mySeting/mySeting.vue @@ -0,0 +1,567 @@ + + + + + diff --git a/pages/my/personalResume/online.vue b/pages/my/personalResume/online.vue new file mode 100644 index 0000000..ff877b1 --- /dev/null +++ b/pages/my/personalResume/online.vue @@ -0,0 +1,441 @@ + + + + + diff --git a/pages/my/personalResume/personalResume.vue b/pages/my/personalResume/personalResume.vue new file mode 100644 index 0000000..00dd948 --- /dev/null +++ b/pages/my/personalResume/personalResume.vue @@ -0,0 +1,73 @@ + + + + + diff --git a/pages/my/personalResume/proPage.vue b/pages/my/personalResume/proPage.vue new file mode 100644 index 0000000..018b4db --- /dev/null +++ b/pages/my/personalResume/proPage.vue @@ -0,0 +1,374 @@ + + + + + diff --git a/pages/my/personalResume/workPage.vue b/pages/my/personalResume/workPage.vue new file mode 100644 index 0000000..9e89171 --- /dev/null +++ b/pages/my/personalResume/workPage.vue @@ -0,0 +1,375 @@ + + + + + diff --git a/pages/my/shoolAuthentication/shoolAuthentication.vue b/pages/my/shoolAuthentication/shoolAuthentication.vue new file mode 100644 index 0000000..1248600 --- /dev/null +++ b/pages/my/shoolAuthentication/shoolAuthentication.vue @@ -0,0 +1,491 @@ + + + + + diff --git a/pages/my/wishlist/addwishlist.vue b/pages/my/wishlist/addwishlist.vue new file mode 100644 index 0000000..5dd4b41 --- /dev/null +++ b/pages/my/wishlist/addwishlist.vue @@ -0,0 +1,189 @@ + + + + + diff --git a/pages/my/wishlist/leftIcon.png b/pages/my/wishlist/leftIcon.png new file mode 100644 index 0000000..004de66 Binary files /dev/null and b/pages/my/wishlist/leftIcon.png differ diff --git a/pages/my/wishlist/wishlist.vue b/pages/my/wishlist/wishlist.vue new file mode 100644 index 0000000..6cc4edf --- /dev/null +++ b/pages/my/wishlist/wishlist.vue @@ -0,0 +1,296 @@ + + + + + diff --git a/pages/webview/index.vue b/pages/webview/index.vue new file mode 100644 index 0000000..f54be6c --- /dev/null +++ b/pages/webview/index.vue @@ -0,0 +1,32 @@ + + + diff --git a/static/common/css/font.css b/static/common/css/font.css new file mode 100644 index 0000000..c5d2715 --- /dev/null +++ b/static/common/css/font.css @@ -0,0 +1,4 @@ +@font-face { + font-family: 'pingfang'; + src: url(./pingfang.mini3.otf); +} diff --git a/static/common/css/pingfang.mini1.otf b/static/common/css/pingfang.mini1.otf new file mode 100644 index 0000000..b03fdc5 Binary files /dev/null and b/static/common/css/pingfang.mini1.otf differ diff --git a/static/common/css/pingfang.mini2.otf b/static/common/css/pingfang.mini2.otf new file mode 100644 index 0000000..3594c29 Binary files /dev/null and b/static/common/css/pingfang.mini2.otf differ diff --git a/static/common/css/pingfang.mini3.otf b/static/common/css/pingfang.mini3.otf new file mode 100644 index 0000000..a177d15 Binary files /dev/null and b/static/common/css/pingfang.mini3.otf differ diff --git a/static/common/css/pingfang.otf b/static/common/css/pingfang.otf new file mode 100644 index 0000000..f40327f Binary files /dev/null and b/static/common/css/pingfang.otf differ diff --git a/static/common/css/readme.txt b/static/common/css/readme.txt new file mode 100644 index 0000000..8aba2ba --- /dev/null +++ b/static/common/css/readme.txt @@ -0,0 +1,12 @@ +应字体过大分出3个版本 +原版 pingfang.otf 10.3MB +包含一、二、三级通用规范汉字8105常用字 pingfang.mini1.otf 2.58MB +包含一、二级通用规范汉字6500常用字 pingfang.mini2.otf 2.09MB +只包含一级通用规范汉字3500常用字 pingfang.mini3.otf 1.05MB + +一级字表 3500字 +https://baike.baidu.com/item/%E4%B8%80%E7%BA%A7%E5%AD%97 +二级字表 3000字 +https://baike.baidu.com/item/%E4%BA%8C%E7%BA%A7%E5%AD%97 +三级字表 1605字 +https://baike.baidu.com/item/%E4%B8%89%E7%BA%A7%E5%AD%97 \ No newline at end of file diff --git a/static/common/icon/icon-1.png b/static/common/icon/icon-1.png new file mode 100644 index 0000000..52ba237 Binary files /dev/null and b/static/common/icon/icon-1.png differ diff --git a/static/common/icon/icon-10.png b/static/common/icon/icon-10.png new file mode 100644 index 0000000..f43cb99 Binary files /dev/null and b/static/common/icon/icon-10.png differ diff --git a/static/common/icon/icon-11.png b/static/common/icon/icon-11.png new file mode 100644 index 0000000..ffc5e79 Binary files /dev/null and b/static/common/icon/icon-11.png differ diff --git a/static/common/icon/icon-12.png b/static/common/icon/icon-12.png new file mode 100644 index 0000000..a1e2722 Binary files /dev/null and b/static/common/icon/icon-12.png differ diff --git a/static/common/icon/icon-13.png b/static/common/icon/icon-13.png new file mode 100644 index 0000000..2918039 Binary files /dev/null and b/static/common/icon/icon-13.png differ diff --git a/static/common/icon/icon-14.png b/static/common/icon/icon-14.png new file mode 100644 index 0000000..6c27452 Binary files /dev/null and b/static/common/icon/icon-14.png differ diff --git a/static/common/icon/icon-2.png b/static/common/icon/icon-2.png new file mode 100644 index 0000000..d517b94 Binary files /dev/null and b/static/common/icon/icon-2.png differ diff --git a/static/common/icon/icon-3.png b/static/common/icon/icon-3.png new file mode 100644 index 0000000..f8fb1a6 Binary files /dev/null and b/static/common/icon/icon-3.png differ diff --git a/static/common/icon/icon-4.png b/static/common/icon/icon-4.png new file mode 100644 index 0000000..58b8690 Binary files /dev/null and b/static/common/icon/icon-4.png differ diff --git a/static/common/icon/icon-5.png b/static/common/icon/icon-5.png new file mode 100644 index 0000000..4253e33 Binary files /dev/null and b/static/common/icon/icon-5.png differ diff --git a/static/common/icon/icon-6.png b/static/common/icon/icon-6.png new file mode 100644 index 0000000..74579fa Binary files /dev/null and b/static/common/icon/icon-6.png differ diff --git a/static/common/icon/icon-7.png b/static/common/icon/icon-7.png new file mode 100644 index 0000000..9d59b14 Binary files /dev/null and b/static/common/icon/icon-7.png differ diff --git a/static/common/icon/icon-8.png b/static/common/icon/icon-8.png new file mode 100644 index 0000000..df07d4b Binary files /dev/null and b/static/common/icon/icon-8.png differ diff --git a/static/common/icon/icon-9.png b/static/common/icon/icon-9.png new file mode 100644 index 0000000..f9de8dc Binary files /dev/null and b/static/common/icon/icon-9.png differ diff --git a/static/common/icon/min-icon-1.png b/static/common/icon/min-icon-1.png new file mode 100644 index 0000000..dd79144 Binary files /dev/null and b/static/common/icon/min-icon-1.png differ diff --git a/static/common/icon/min-icon-10.png b/static/common/icon/min-icon-10.png new file mode 100644 index 0000000..361eb05 Binary files /dev/null and b/static/common/icon/min-icon-10.png differ diff --git a/static/common/icon/min-icon-11.png b/static/common/icon/min-icon-11.png new file mode 100644 index 0000000..66fc8d3 Binary files /dev/null and b/static/common/icon/min-icon-11.png differ diff --git a/static/common/icon/min-icon-12.png b/static/common/icon/min-icon-12.png new file mode 100644 index 0000000..a165c04 Binary files /dev/null and b/static/common/icon/min-icon-12.png differ diff --git a/static/common/icon/min-icon-13.png b/static/common/icon/min-icon-13.png new file mode 100644 index 0000000..e0b5cda Binary files /dev/null and b/static/common/icon/min-icon-13.png differ diff --git a/static/common/icon/min-icon-14.png b/static/common/icon/min-icon-14.png new file mode 100644 index 0000000..787cdc0 Binary files /dev/null and b/static/common/icon/min-icon-14.png differ diff --git a/static/common/icon/min-icon-2.png b/static/common/icon/min-icon-2.png new file mode 100644 index 0000000..5850818 Binary files /dev/null and b/static/common/icon/min-icon-2.png differ diff --git a/static/common/icon/min-icon-3.png b/static/common/icon/min-icon-3.png new file mode 100644 index 0000000..80d5155 Binary files /dev/null and b/static/common/icon/min-icon-3.png differ diff --git a/static/common/icon/min-icon-4.png b/static/common/icon/min-icon-4.png new file mode 100644 index 0000000..ea3079a Binary files /dev/null and b/static/common/icon/min-icon-4.png differ diff --git a/static/common/icon/min-icon-5.png b/static/common/icon/min-icon-5.png new file mode 100644 index 0000000..2dc1301 Binary files /dev/null and b/static/common/icon/min-icon-5.png differ diff --git a/static/common/icon/min-icon-6.png b/static/common/icon/min-icon-6.png new file mode 100644 index 0000000..715c40b Binary files /dev/null and b/static/common/icon/min-icon-6.png differ diff --git a/static/common/icon/min-icon-7.png b/static/common/icon/min-icon-7.png new file mode 100644 index 0000000..56d7a41 Binary files /dev/null and b/static/common/icon/min-icon-7.png differ diff --git a/static/common/icon/min-icon-8.png b/static/common/icon/min-icon-8.png new file mode 100644 index 0000000..858ed87 Binary files /dev/null and b/static/common/icon/min-icon-8.png differ diff --git a/static/common/icon/min-icon-9.png b/static/common/icon/min-icon-9.png new file mode 100644 index 0000000..42e600f Binary files /dev/null and b/static/common/icon/min-icon-9.png differ diff --git a/static/common/img/16462770928974838161.png b/static/common/img/16462770928974838161.png new file mode 100644 index 0000000..2b0cbc1 Binary files /dev/null and b/static/common/img/16462770928974838161.png differ diff --git a/static/common/img/16466166399439803895.png b/static/common/img/16466166399439803895.png new file mode 100644 index 0000000..163998d Binary files /dev/null and b/static/common/img/16466166399439803895.png differ diff --git a/static/common/img/16466166400468141735.png b/static/common/img/16466166400468141735.png new file mode 100644 index 0000000..24c9bb9 Binary files /dev/null and b/static/common/img/16466166400468141735.png differ diff --git a/static/common/img/16466166410428220572.png b/static/common/img/16466166410428220572.png new file mode 100644 index 0000000..d6ae41c Binary files /dev/null and b/static/common/img/16466166410428220572.png differ diff --git a/static/common/img/16466166424139703844.png b/static/common/img/16466166424139703844.png new file mode 100644 index 0000000..139d5a8 Binary files /dev/null and b/static/common/img/16466166424139703844.png differ diff --git a/static/common/img/16480040186931842252.png b/static/common/img/16480040186931842252.png new file mode 100644 index 0000000..1fbf00f Binary files /dev/null and b/static/common/img/16480040186931842252.png differ diff --git a/static/common/img/16486275579950463634.png b/static/common/img/16486275579950463634.png new file mode 100644 index 0000000..6bde7ea Binary files /dev/null and b/static/common/img/16486275579950463634.png differ diff --git a/static/common/img/16486275582930866915.png b/static/common/img/16486275582930866915.png new file mode 100644 index 0000000..e36f43a Binary files /dev/null and b/static/common/img/16486275582930866915.png differ diff --git a/static/common/img/16486275583591942621.png b/static/common/img/16486275583591942621.png new file mode 100644 index 0000000..40e5b33 Binary files /dev/null and b/static/common/img/16486275583591942621.png differ diff --git a/static/common/img/16486275583636337201.png b/static/common/img/16486275583636337201.png new file mode 100644 index 0000000..1c27d19 Binary files /dev/null and b/static/common/img/16486275583636337201.png differ diff --git a/static/common/img/16486282410596443868.png b/static/common/img/16486282410596443868.png new file mode 100644 index 0000000..5173a45 Binary files /dev/null and b/static/common/img/16486282410596443868.png differ diff --git a/static/common/img/16486282410612625532.png b/static/common/img/16486282410612625532.png new file mode 100644 index 0000000..76df7fd Binary files /dev/null and b/static/common/img/16486282410612625532.png differ diff --git a/static/common/img/16486291276444032321.png b/static/common/img/16486291276444032321.png new file mode 100644 index 0000000..96b6bef Binary files /dev/null and b/static/common/img/16486291276444032321.png differ diff --git a/static/common/img/16486889538940144558 (1).png b/static/common/img/16486889538940144558 (1).png new file mode 100644 index 0000000..f45bb68 Binary files /dev/null and b/static/common/img/16486889538940144558 (1).png differ diff --git a/static/common/img/16486889538940144558.png b/static/common/img/16486889538940144558.png new file mode 100644 index 0000000..f45bb68 Binary files /dev/null and b/static/common/img/16486889538940144558.png differ diff --git a/static/common/img/16486889538992004733.png b/static/common/img/16486889538992004733.png new file mode 100644 index 0000000..7dbdcd4 Binary files /dev/null and b/static/common/img/16486889538992004733.png differ diff --git a/static/common/img/16530269846087107196.png b/static/common/img/16530269846087107196.png new file mode 100644 index 0000000..a1bd12d Binary files /dev/null and b/static/common/img/16530269846087107196.png differ diff --git a/static/common/img/16535374500735010318.png b/static/common/img/16535374500735010318.png new file mode 100644 index 0000000..28946b2 Binary files /dev/null and b/static/common/img/16535374500735010318.png differ diff --git a/static/common/img/16535374500948048054.png b/static/common/img/16535374500948048054.png new file mode 100644 index 0000000..147fb54 Binary files /dev/null and b/static/common/img/16535374500948048054.png differ diff --git a/static/common/img/16535374508974128453.png b/static/common/img/16535374508974128453.png new file mode 100644 index 0000000..aa3df38 Binary files /dev/null and b/static/common/img/16535374508974128453.png differ diff --git a/static/common/img/16535374509810688026.png b/static/common/img/16535374509810688026.png new file mode 100644 index 0000000..7743e3d Binary files /dev/null and b/static/common/img/16535374509810688026.png differ diff --git a/static/common/img/16535374509868908590.png b/static/common/img/16535374509868908590.png new file mode 100644 index 0000000..42a9e41 Binary files /dev/null and b/static/common/img/16535374509868908590.png differ diff --git a/static/common/img/Faculty.png b/static/common/img/Faculty.png new file mode 100644 index 0000000..7219488 Binary files /dev/null and b/static/common/img/Faculty.png differ diff --git a/static/common/img/FacultyBj.png b/static/common/img/FacultyBj.png new file mode 100644 index 0000000..7fa25e4 Binary files /dev/null and b/static/common/img/FacultyBj.png differ diff --git a/static/common/img/ServiceIcon1.png b/static/common/img/ServiceIcon1.png new file mode 100644 index 0000000..a3576be Binary files /dev/null and b/static/common/img/ServiceIcon1.png differ diff --git a/static/common/img/ServiceIcon2.png b/static/common/img/ServiceIcon2.png new file mode 100644 index 0000000..780e045 Binary files /dev/null and b/static/common/img/ServiceIcon2.png differ diff --git a/static/common/img/ServiceIcon3.png b/static/common/img/ServiceIcon3.png new file mode 100644 index 0000000..52faf06 Binary files /dev/null and b/static/common/img/ServiceIcon3.png differ diff --git a/static/common/img/ServiceIcon4.png b/static/common/img/ServiceIcon4.png new file mode 100644 index 0000000..d5d49da Binary files /dev/null and b/static/common/img/ServiceIcon4.png differ diff --git a/static/common/img/StudentCard.png b/static/common/img/StudentCard.png new file mode 100644 index 0000000..4efc163 Binary files /dev/null and b/static/common/img/StudentCard.png differ diff --git a/static/common/img/add-circle.png b/static/common/img/add-circle.png new file mode 100644 index 0000000..0d42bbc Binary files /dev/null and b/static/common/img/add-circle.png differ diff --git a/static/common/img/add.svg b/static/common/img/add.svg new file mode 100644 index 0000000..b0d5397 --- /dev/null +++ b/static/common/img/add.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/static/common/img/admin.png b/static/common/img/admin.png new file mode 100644 index 0000000..1e3c277 Binary files /dev/null and b/static/common/img/admin.png differ diff --git a/static/common/img/adminBj.png b/static/common/img/adminBj.png new file mode 100644 index 0000000..6557f9f Binary files /dev/null and b/static/common/img/adminBj.png differ diff --git a/static/common/img/adminHeaderImg.png b/static/common/img/adminHeaderImg.png new file mode 100644 index 0000000..ea913d3 Binary files /dev/null and b/static/common/img/adminHeaderImg.png differ diff --git a/static/common/img/adminIcon.png b/static/common/img/adminIcon.png new file mode 100644 index 0000000..05304e7 Binary files /dev/null and b/static/common/img/adminIcon.png differ diff --git a/static/common/img/back-to-location.png b/static/common/img/back-to-location.png new file mode 100644 index 0000000..719f6b7 Binary files /dev/null and b/static/common/img/back-to-location.png differ diff --git a/static/common/img/change1.png b/static/common/img/change1.png new file mode 100644 index 0000000..68c98d5 Binary files /dev/null and b/static/common/img/change1.png differ diff --git a/static/common/img/changeCard.png b/static/common/img/changeCard.png new file mode 100644 index 0000000..3e98b0e Binary files /dev/null and b/static/common/img/changeCard.png differ diff --git a/static/common/img/chats.png b/static/common/img/chats.png new file mode 100644 index 0000000..b316648 Binary files /dev/null and b/static/common/img/chats.png differ diff --git a/static/common/img/close.png b/static/common/img/close.png new file mode 100644 index 0000000..1d59777 Binary files /dev/null and b/static/common/img/close.png differ diff --git a/static/common/img/del.svg b/static/common/img/del.svg new file mode 100644 index 0000000..13afd1f --- /dev/null +++ b/static/common/img/del.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/common/img/delete.png b/static/common/img/delete.png new file mode 100644 index 0000000..7f9b758 Binary files /dev/null and b/static/common/img/delete.png differ diff --git a/static/common/img/delete.svg b/static/common/img/delete.svg new file mode 100644 index 0000000..777ab03 --- /dev/null +++ b/static/common/img/delete.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/static/common/img/empty.png b/static/common/img/empty.png new file mode 100644 index 0000000..b9cb379 Binary files /dev/null and b/static/common/img/empty.png differ diff --git a/static/common/img/enterprise.png b/static/common/img/enterprise.png new file mode 100644 index 0000000..582ce69 Binary files /dev/null and b/static/common/img/enterprise.png differ diff --git a/static/common/img/enterpriseBj.png b/static/common/img/enterpriseBj.png new file mode 100644 index 0000000..ce7591e Binary files /dev/null and b/static/common/img/enterpriseBj.png differ diff --git a/static/common/img/exchangeBjImg.png b/static/common/img/exchangeBjImg.png new file mode 100644 index 0000000..b531228 Binary files /dev/null and b/static/common/img/exchangeBjImg.png differ diff --git a/static/common/img/female.png b/static/common/img/female.png new file mode 100644 index 0000000..4ff0992 Binary files /dev/null and b/static/common/img/female.png differ diff --git a/static/common/img/graduate.png b/static/common/img/graduate.png new file mode 100644 index 0000000..7ab5fdd Binary files /dev/null and b/static/common/img/graduate.png differ diff --git a/static/common/img/handDelete.png b/static/common/img/handDelete.png new file mode 100644 index 0000000..96a6e4d Binary files /dev/null and b/static/common/img/handDelete.png differ diff --git a/static/common/img/headerImg.png b/static/common/img/headerImg.png new file mode 100644 index 0000000..d657e0e Binary files /dev/null and b/static/common/img/headerImg.png differ diff --git a/static/common/img/homepage/activity-default.png b/static/common/img/homepage/activity-default.png new file mode 100644 index 0000000..9549489 Binary files /dev/null and b/static/common/img/homepage/activity-default.png differ diff --git a/static/common/img/homepage/avatar.png b/static/common/img/homepage/avatar.png new file mode 100644 index 0000000..c36c352 Binary files /dev/null and b/static/common/img/homepage/avatar.png differ diff --git a/static/common/img/homepage/avatar2.png b/static/common/img/homepage/avatar2.png new file mode 100644 index 0000000..17802c4 Binary files /dev/null and b/static/common/img/homepage/avatar2.png differ diff --git a/static/common/img/homepage/avatar3.png b/static/common/img/homepage/avatar3.png new file mode 100644 index 0000000..e8e9b03 Binary files /dev/null and b/static/common/img/homepage/avatar3.png differ diff --git a/static/common/img/homepage/banner.jpg b/static/common/img/homepage/banner.jpg new file mode 100644 index 0000000..96a0390 Binary files /dev/null and b/static/common/img/homepage/banner.jpg differ diff --git a/static/common/img/homepage/comment.png b/static/common/img/homepage/comment.png new file mode 100644 index 0000000..4e0b9f8 Binary files /dev/null and b/static/common/img/homepage/comment.png differ diff --git a/static/common/img/homepage/frame.png b/static/common/img/homepage/frame.png new file mode 100644 index 0000000..1c20447 Binary files /dev/null and b/static/common/img/homepage/frame.png differ diff --git a/static/common/img/homepage/icon-back.png b/static/common/img/homepage/icon-back.png new file mode 100644 index 0000000..10110dc Binary files /dev/null and b/static/common/img/homepage/icon-back.png differ diff --git a/static/common/img/homepage/icon-close-circle.png b/static/common/img/homepage/icon-close-circle.png new file mode 100644 index 0000000..41412da Binary files /dev/null and b/static/common/img/homepage/icon-close-circle.png differ diff --git a/static/common/img/homepage/icon-delete.png b/static/common/img/homepage/icon-delete.png new file mode 100644 index 0000000..6252a14 Binary files /dev/null and b/static/common/img/homepage/icon-delete.png differ diff --git a/static/common/img/homepage/icon-expand.png b/static/common/img/homepage/icon-expand.png new file mode 100644 index 0000000..5481876 Binary files /dev/null and b/static/common/img/homepage/icon-expand.png differ diff --git a/static/common/img/homepage/icon-follow.png b/static/common/img/homepage/icon-follow.png new file mode 100644 index 0000000..8796785 Binary files /dev/null and b/static/common/img/homepage/icon-follow.png differ diff --git a/static/common/img/homepage/icon-message.png b/static/common/img/homepage/icon-message.png new file mode 100644 index 0000000..c4bc696 Binary files /dev/null and b/static/common/img/homepage/icon-message.png differ diff --git a/static/common/img/homepage/icon-refresh.png b/static/common/img/homepage/icon-refresh.png new file mode 100644 index 0000000..45fb990 Binary files /dev/null and b/static/common/img/homepage/icon-refresh.png differ diff --git a/static/common/img/homepage/icon-send.png b/static/common/img/homepage/icon-send.png new file mode 100644 index 0000000..e5de14e Binary files /dev/null and b/static/common/img/homepage/icon-send.png differ diff --git a/static/common/img/homepage/icon_DL.png b/static/common/img/homepage/icon_DL.png new file mode 100644 index 0000000..9261b3f Binary files /dev/null and b/static/common/img/homepage/icon_DL.png differ diff --git a/static/common/img/homepage/icon_DL_gray.png b/static/common/img/homepage/icon_DL_gray.png new file mode 100644 index 0000000..fbf5871 Binary files /dev/null and b/static/common/img/homepage/icon_DL_gray.png differ diff --git a/static/common/img/homepage/icon_全部服务.png b/static/common/img/homepage/icon_全部服务.png new file mode 100644 index 0000000..1ba0c3c Binary files /dev/null and b/static/common/img/homepage/icon_全部服务.png differ diff --git a/static/common/img/homepage/icon_办事指南.png b/static/common/img/homepage/icon_办事指南.png new file mode 100644 index 0000000..3686434 Binary files /dev/null and b/static/common/img/homepage/icon_办事指南.png differ diff --git a/static/common/img/homepage/icon_办事指南_gray.png b/static/common/img/homepage/icon_办事指南_gray.png new file mode 100644 index 0000000..ec923cc Binary files /dev/null and b/static/common/img/homepage/icon_办事指南_gray.png differ diff --git a/static/common/img/homepage/icon_助力母校.png b/static/common/img/homepage/icon_助力母校.png new file mode 100644 index 0000000..3403e99 Binary files /dev/null and b/static/common/img/homepage/icon_助力母校.png differ diff --git a/static/common/img/homepage/icon_助力母校_gray.png b/static/common/img/homepage/icon_助力母校_gray.png new file mode 100644 index 0000000..0f1dec8 Binary files /dev/null and b/static/common/img/homepage/icon_助力母校_gray.png differ diff --git a/static/common/img/homepage/icon_勤工俭学.png b/static/common/img/homepage/icon_勤工俭学.png new file mode 100644 index 0000000..a44ef13 Binary files /dev/null and b/static/common/img/homepage/icon_勤工俭学.png differ diff --git a/static/common/img/homepage/icon_勤工俭学_gray.png b/static/common/img/homepage/icon_勤工俭学_gray.png new file mode 100644 index 0000000..3a5be74 Binary files /dev/null and b/static/common/img/homepage/icon_勤工俭学_gray.png differ diff --git a/static/common/img/homepage/icon_南小翼.png b/static/common/img/homepage/icon_南小翼.png new file mode 100644 index 0000000..1ef422f Binary files /dev/null and b/static/common/img/homepage/icon_南小翼.png differ diff --git a/static/common/img/homepage/icon_南小翼_gray.png b/static/common/img/homepage/icon_南小翼_gray.png new file mode 100644 index 0000000..d510aef Binary files /dev/null and b/static/common/img/homepage/icon_南小翼_gray.png differ diff --git a/static/common/img/homepage/icon_图书借阅.png b/static/common/img/homepage/icon_图书借阅.png new file mode 100644 index 0000000..b36f76a Binary files /dev/null and b/static/common/img/homepage/icon_图书借阅.png differ diff --git a/static/common/img/homepage/icon_图书借阅_gray.png b/static/common/img/homepage/icon_图书借阅_gray.png new file mode 100644 index 0000000..5ee6720 Binary files /dev/null and b/static/common/img/homepage/icon_图书借阅_gray.png differ diff --git a/static/common/img/homepage/icon_就业帮助.png b/static/common/img/homepage/icon_就业帮助.png new file mode 100644 index 0000000..c09d6bd Binary files /dev/null and b/static/common/img/homepage/icon_就业帮助.png differ diff --git a/static/common/img/homepage/icon_就业帮助_gray.png b/static/common/img/homepage/icon_就业帮助_gray.png new file mode 100644 index 0000000..f32c755 Binary files /dev/null and b/static/common/img/homepage/icon_就业帮助_gray.png differ diff --git a/static/common/img/homepage/icon_心愿单.png b/static/common/img/homepage/icon_心愿单.png new file mode 100644 index 0000000..711acc4 Binary files /dev/null and b/static/common/img/homepage/icon_心愿单.png differ diff --git a/static/common/img/homepage/icon_心愿单_gray.png b/static/common/img/homepage/icon_心愿单_gray.png new file mode 100644 index 0000000..17e1d0e Binary files /dev/null and b/static/common/img/homepage/icon_心愿单_gray.png differ diff --git a/static/common/img/homepage/icon_报修.png b/static/common/img/homepage/icon_报修.png new file mode 100644 index 0000000..2f57146 Binary files /dev/null and b/static/common/img/homepage/icon_报修.png differ diff --git a/static/common/img/homepage/icon_报修_gray.png b/static/common/img/homepage/icon_报修_gray.png new file mode 100644 index 0000000..fb9ebb1 Binary files /dev/null and b/static/common/img/homepage/icon_报修_gray.png differ diff --git a/static/common/img/homepage/icon_查询档案.png b/static/common/img/homepage/icon_查询档案.png new file mode 100644 index 0000000..5a21217 Binary files /dev/null and b/static/common/img/homepage/icon_查询档案.png differ diff --git a/static/common/img/homepage/icon_查询档案_gray.png b/static/common/img/homepage/icon_查询档案_gray.png new file mode 100644 index 0000000..fd207a6 Binary files /dev/null and b/static/common/img/homepage/icon_查询档案_gray.png differ diff --git a/static/common/img/homepage/icon_校友会组织.png b/static/common/img/homepage/icon_校友会组织.png new file mode 100644 index 0000000..9d01d40 Binary files /dev/null and b/static/common/img/homepage/icon_校友会组织.png differ diff --git a/static/common/img/homepage/icon_校友会组织_gray.png b/static/common/img/homepage/icon_校友会组织_gray.png new file mode 100644 index 0000000..8e53679 Binary files /dev/null and b/static/common/img/homepage/icon_校友会组织_gray.png differ diff --git a/static/common/img/homepage/icon_校友卡.png b/static/common/img/homepage/icon_校友卡.png new file mode 100644 index 0000000..a079290 Binary files /dev/null and b/static/common/img/homepage/icon_校友卡.png differ diff --git a/static/common/img/homepage/icon_校友名片.png b/static/common/img/homepage/icon_校友名片.png new file mode 100644 index 0000000..f9e45d0 Binary files /dev/null and b/static/common/img/homepage/icon_校友名片.png differ diff --git a/static/common/img/homepage/icon_校友名片_gray.png b/static/common/img/homepage/icon_校友名片_gray.png new file mode 100644 index 0000000..6353f07 Binary files /dev/null and b/static/common/img/homepage/icon_校友名片_gray.png differ diff --git a/static/common/img/homepage/icon_校友活动.png b/static/common/img/homepage/icon_校友活动.png new file mode 100644 index 0000000..33ced0d Binary files /dev/null and b/static/common/img/homepage/icon_校友活动.png differ diff --git a/static/common/img/homepage/icon_校友活动_gray.png b/static/common/img/homepage/icon_校友活动_gray.png new file mode 100644 index 0000000..4871006 Binary files /dev/null and b/static/common/img/homepage/icon_校友活动_gray.png differ diff --git a/static/common/img/homepage/icon_校园跑.png b/static/common/img/homepage/icon_校园跑.png new file mode 100644 index 0000000..dd5e06d Binary files /dev/null and b/static/common/img/homepage/icon_校园跑.png differ diff --git a/static/common/img/homepage/icon_校园跑_gray.png b/static/common/img/homepage/icon_校园跑_gray.png new file mode 100644 index 0000000..267da8e Binary files /dev/null and b/static/common/img/homepage/icon_校园跑_gray.png differ diff --git a/static/common/img/homepage/icon_活动报名.png b/static/common/img/homepage/icon_活动报名.png new file mode 100644 index 0000000..7e59ea6 Binary files /dev/null and b/static/common/img/homepage/icon_活动报名.png differ diff --git a/static/common/img/homepage/icon_活动报名_gray.png b/static/common/img/homepage/icon_活动报名_gray.png new file mode 100644 index 0000000..8d967e6 Binary files /dev/null and b/static/common/img/homepage/icon_活动报名_gray.png differ diff --git a/static/common/img/homepage/icon_电子校友卡.png b/static/common/img/homepage/icon_电子校友卡.png new file mode 100644 index 0000000..cec4531 Binary files /dev/null and b/static/common/img/homepage/icon_电子校友卡.png differ diff --git a/static/common/img/homepage/icon_电子校友卡_gray.png b/static/common/img/homepage/icon_电子校友卡_gray.png new file mode 100644 index 0000000..12c2fec Binary files /dev/null and b/static/common/img/homepage/icon_电子校友卡_gray.png differ diff --git a/static/common/img/homepage/icon_缴费.png b/static/common/img/homepage/icon_缴费.png new file mode 100644 index 0000000..0bf20d3 Binary files /dev/null and b/static/common/img/homepage/icon_缴费.png differ diff --git a/static/common/img/homepage/icon_缴费_gray.png b/static/common/img/homepage/icon_缴费_gray.png new file mode 100644 index 0000000..1b8b5fd Binary files /dev/null and b/static/common/img/homepage/icon_缴费_gray.png differ diff --git a/static/common/img/homepage/icon_网上购电.png b/static/common/img/homepage/icon_网上购电.png new file mode 100644 index 0000000..b40fd74 Binary files /dev/null and b/static/common/img/homepage/icon_网上购电.png differ diff --git a/static/common/img/homepage/icon_网上购电_gray.png b/static/common/img/homepage/icon_网上购电_gray.png new file mode 100644 index 0000000..d2ebccb Binary files /dev/null and b/static/common/img/homepage/icon_网上购电_gray.png differ diff --git a/static/common/img/homepage/icon_迎新.png b/static/common/img/homepage/icon_迎新.png new file mode 100644 index 0000000..3d59635 Binary files /dev/null and b/static/common/img/homepage/icon_迎新.png differ diff --git a/static/common/img/homepage/icon_迎新_gray.png b/static/common/img/homepage/icon_迎新_gray.png new file mode 100644 index 0000000..3b7ec8e Binary files /dev/null and b/static/common/img/homepage/icon_迎新_gray.png differ diff --git a/static/common/img/homepage/icon_返校预约.png b/static/common/img/homepage/icon_返校预约.png new file mode 100644 index 0000000..4fc887c Binary files /dev/null and b/static/common/img/homepage/icon_返校预约.png differ diff --git a/static/common/img/homepage/icon_返校预约_gray.png b/static/common/img/homepage/icon_返校预约_gray.png new file mode 100644 index 0000000..c568f07 Binary files /dev/null and b/static/common/img/homepage/icon_返校预约_gray.png differ diff --git a/static/common/img/homepage/icon_选课.png b/static/common/img/homepage/icon_选课.png new file mode 100644 index 0000000..b35c8ef Binary files /dev/null and b/static/common/img/homepage/icon_选课.png differ diff --git a/static/common/img/homepage/icon_选课_gray.png b/static/common/img/homepage/icon_选课_gray.png new file mode 100644 index 0000000..be1659c Binary files /dev/null and b/static/common/img/homepage/icon_选课_gray.png differ diff --git a/static/common/img/homepage/image-photo1.png b/static/common/img/homepage/image-photo1.png new file mode 100644 index 0000000..df4cf87 Binary files /dev/null and b/static/common/img/homepage/image-photo1.png differ diff --git a/static/common/img/homepage/image-photo2.png b/static/common/img/homepage/image-photo2.png new file mode 100644 index 0000000..643ea84 Binary files /dev/null and b/static/common/img/homepage/image-photo2.png differ diff --git a/static/common/img/homepage/image-photo3.png b/static/common/img/homepage/image-photo3.png new file mode 100644 index 0000000..67e8f6f Binary files /dev/null and b/static/common/img/homepage/image-photo3.png differ diff --git a/static/common/img/homepage/image-topic-avatar.png b/static/common/img/homepage/image-topic-avatar.png new file mode 100644 index 0000000..f00d985 Binary files /dev/null and b/static/common/img/homepage/image-topic-avatar.png differ diff --git a/static/common/img/homepage/image-topic-bg.png b/static/common/img/homepage/image-topic-bg.png new file mode 100644 index 0000000..681b411 Binary files /dev/null and b/static/common/img/homepage/image-topic-bg.png differ diff --git a/static/common/img/homepage/like-active.png b/static/common/img/homepage/like-active.png new file mode 100644 index 0000000..f8a6bb0 Binary files /dev/null and b/static/common/img/homepage/like-active.png differ diff --git a/static/common/img/homepage/like.png b/static/common/img/homepage/like.png new file mode 100644 index 0000000..6e6689a Binary files /dev/null and b/static/common/img/homepage/like.png differ diff --git a/static/common/img/homepage/message.png b/static/common/img/homepage/message.png new file mode 100644 index 0000000..1bae5eb Binary files /dev/null and b/static/common/img/homepage/message.png differ diff --git a/static/common/img/homepage/person-selected.png b/static/common/img/homepage/person-selected.png new file mode 100644 index 0000000..5443640 Binary files /dev/null and b/static/common/img/homepage/person-selected.png differ diff --git a/static/common/img/homepage/person.png b/static/common/img/homepage/person.png new file mode 100644 index 0000000..b5124b2 Binary files /dev/null and b/static/common/img/homepage/person.png differ diff --git a/static/common/img/homepage/released-selected.png b/static/common/img/homepage/released-selected.png new file mode 100644 index 0000000..d55831b Binary files /dev/null and b/static/common/img/homepage/released-selected.png differ diff --git a/static/common/img/homepage/released.png b/static/common/img/homepage/released.png new file mode 100644 index 0000000..6f16869 Binary files /dev/null and b/static/common/img/homepage/released.png differ diff --git a/static/common/img/homepage/reply.png b/static/common/img/homepage/reply.png new file mode 100644 index 0000000..3c076bb Binary files /dev/null and b/static/common/img/homepage/reply.png differ diff --git a/static/common/img/homepage/star.png b/static/common/img/homepage/star.png new file mode 100644 index 0000000..cf83699 Binary files /dev/null and b/static/common/img/homepage/star.png differ diff --git a/static/common/img/homepage/trash.png b/static/common/img/homepage/trash.png new file mode 100644 index 0000000..78fedc2 Binary files /dev/null and b/static/common/img/homepage/trash.png differ diff --git a/static/common/img/icon-happy-face.png b/static/common/img/icon-happy-face.png new file mode 100644 index 0000000..9ed9571 Binary files /dev/null and b/static/common/img/icon-happy-face.png differ diff --git a/static/common/img/icon-lineRounded.png b/static/common/img/icon-lineRounded.png new file mode 100644 index 0000000..f63e2b9 Binary files /dev/null and b/static/common/img/icon-lineRounded.png differ diff --git a/static/common/img/icon.png b/static/common/img/icon.png new file mode 100644 index 0000000..aa3df38 Binary files /dev/null and b/static/common/img/icon.png differ diff --git a/static/common/img/img.svg b/static/common/img/img.svg new file mode 100644 index 0000000..e9e6591 --- /dev/null +++ b/static/common/img/img.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/common/img/infoCircle.png b/static/common/img/infoCircle.png new file mode 100644 index 0000000..d530808 Binary files /dev/null and b/static/common/img/infoCircle.png differ diff --git a/static/common/img/interactionhiderimg.png b/static/common/img/interactionhiderimg.png new file mode 100644 index 0000000..783914e Binary files /dev/null and b/static/common/img/interactionhiderimg.png differ diff --git a/static/common/img/location.png b/static/common/img/location.png new file mode 100644 index 0000000..0fcec47 Binary files /dev/null and b/static/common/img/location.png differ diff --git a/static/common/img/location.svg b/static/common/img/location.svg new file mode 100644 index 0000000..b846af3 --- /dev/null +++ b/static/common/img/location.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/static/common/img/loginBg.png b/static/common/img/loginBg.png new file mode 100644 index 0000000..2a64e74 Binary files /dev/null and b/static/common/img/loginBg.png differ diff --git a/static/common/img/logo.png b/static/common/img/logo.png new file mode 100644 index 0000000..b5771e2 Binary files /dev/null and b/static/common/img/logo.png differ diff --git a/static/common/img/male.png b/static/common/img/male.png new file mode 100644 index 0000000..68db854 Binary files /dev/null and b/static/common/img/male.png differ diff --git a/static/common/img/map1.png b/static/common/img/map1.png new file mode 100644 index 0000000..76717b4 Binary files /dev/null and b/static/common/img/map1.png differ diff --git a/static/common/img/map_center.png b/static/common/img/map_center.png new file mode 100644 index 0000000..09b9d6c Binary files /dev/null and b/static/common/img/map_center.png differ diff --git a/static/common/img/map_click.png b/static/common/img/map_click.png new file mode 100644 index 0000000..5dcdfad Binary files /dev/null and b/static/common/img/map_click.png differ diff --git a/static/common/img/map_icon.png b/static/common/img/map_icon.png new file mode 100644 index 0000000..fcf9cef Binary files /dev/null and b/static/common/img/map_icon.png differ diff --git a/static/common/img/map_new.png b/static/common/img/map_new.png new file mode 100644 index 0000000..db31a16 Binary files /dev/null and b/static/common/img/map_new.png differ diff --git a/static/common/img/message/admin.png b/static/common/img/message/admin.png new file mode 100644 index 0000000..1f77de2 Binary files /dev/null and b/static/common/img/message/admin.png differ diff --git a/static/common/img/message/attention.png b/static/common/img/message/attention.png new file mode 100644 index 0000000..ca9c4bd Binary files /dev/null and b/static/common/img/message/attention.png differ diff --git a/static/common/img/message/interactive.png b/static/common/img/message/interactive.png new file mode 100644 index 0000000..ac85dd5 Binary files /dev/null and b/static/common/img/message/interactive.png differ diff --git a/static/common/img/message/system.png b/static/common/img/message/system.png new file mode 100644 index 0000000..1a2d25b Binary files /dev/null and b/static/common/img/message/system.png differ diff --git a/static/common/img/msgclose.png b/static/common/img/msgclose.png new file mode 100644 index 0000000..884a693 Binary files /dev/null and b/static/common/img/msgclose.png differ diff --git a/static/common/img/msgopen.png b/static/common/img/msgopen.png new file mode 100644 index 0000000..e657918 Binary files /dev/null and b/static/common/img/msgopen.png differ diff --git a/static/common/img/my/account.png b/static/common/img/my/account.png new file mode 100644 index 0000000..f9d4771 Binary files /dev/null and b/static/common/img/my/account.png differ diff --git a/static/common/img/my/agreement.png b/static/common/img/my/agreement.png new file mode 100644 index 0000000..0e86927 Binary files /dev/null and b/static/common/img/my/agreement.png differ diff --git a/static/common/img/my/authenticated.png b/static/common/img/my/authenticated.png new file mode 100644 index 0000000..104c972 Binary files /dev/null and b/static/common/img/my/authenticated.png differ diff --git a/static/common/img/my/evaluation.png b/static/common/img/my/evaluation.png new file mode 100644 index 0000000..3734b4a Binary files /dev/null and b/static/common/img/my/evaluation.png differ diff --git a/static/common/img/my/my-admin.png b/static/common/img/my/my-admin.png new file mode 100644 index 0000000..0b999f3 Binary files /dev/null and b/static/common/img/my/my-admin.png differ diff --git a/static/common/img/my/my-bg.png b/static/common/img/my/my-bg.png new file mode 100644 index 0000000..56cb5e0 Binary files /dev/null and b/static/common/img/my/my-bg.png differ diff --git a/static/common/img/my/my-certification.png b/static/common/img/my/my-certification.png new file mode 100644 index 0000000..7b36950 Binary files /dev/null and b/static/common/img/my/my-certification.png differ diff --git a/static/common/img/my/my-collection.png b/static/common/img/my/my-collection.png new file mode 100644 index 0000000..586023d Binary files /dev/null and b/static/common/img/my/my-collection.png differ diff --git a/static/common/img/my/my-draft-box.png b/static/common/img/my/my-draft-box.png new file mode 100644 index 0000000..01d9868 Binary files /dev/null and b/static/common/img/my/my-draft-box.png differ diff --git a/static/common/img/my/my-education.png b/static/common/img/my/my-education.png new file mode 100644 index 0000000..b720a38 Binary files /dev/null and b/static/common/img/my/my-education.png differ diff --git a/static/common/img/my/my-enterprises.png b/static/common/img/my/my-enterprises.png new file mode 100644 index 0000000..6a0fc18 Binary files /dev/null and b/static/common/img/my/my-enterprises.png differ diff --git a/static/common/img/my/my-history.png b/static/common/img/my/my-history.png new file mode 100644 index 0000000..4da9427 Binary files /dev/null and b/static/common/img/my/my-history.png differ diff --git a/static/common/img/my/my-identity.png b/static/common/img/my/my-identity.png new file mode 100644 index 0000000..6571822 Binary files /dev/null and b/static/common/img/my/my-identity.png differ diff --git a/static/common/img/my/my-publish.png b/static/common/img/my/my-publish.png new file mode 100644 index 0000000..249b83f Binary files /dev/null and b/static/common/img/my/my-publish.png differ diff --git a/static/common/img/my/my-resume.png b/static/common/img/my/my-resume.png new file mode 100644 index 0000000..3fb7459 Binary files /dev/null and b/static/common/img/my/my-resume.png differ diff --git a/static/common/img/my/my-return-school.png b/static/common/img/my/my-return-school.png new file mode 100644 index 0000000..94cd4de Binary files /dev/null and b/static/common/img/my/my-return-school.png differ diff --git a/static/common/img/my/my-setting.png b/static/common/img/my/my-setting.png new file mode 100644 index 0000000..645af9f Binary files /dev/null and b/static/common/img/my/my-setting.png differ diff --git a/static/common/img/my/my-wish.png b/static/common/img/my/my-wish.png new file mode 100644 index 0000000..69292d0 Binary files /dev/null and b/static/common/img/my/my-wish.png differ diff --git a/static/common/img/my/mybg1.png b/static/common/img/my/mybg1.png new file mode 100644 index 0000000..d7fcff3 Binary files /dev/null and b/static/common/img/my/mybg1.png differ diff --git a/static/common/img/my/mybg10.png b/static/common/img/my/mybg10.png new file mode 100644 index 0000000..ec28f26 Binary files /dev/null and b/static/common/img/my/mybg10.png differ diff --git a/static/common/img/my/mybg11.png b/static/common/img/my/mybg11.png new file mode 100644 index 0000000..aaeb411 Binary files /dev/null and b/static/common/img/my/mybg11.png differ diff --git a/static/common/img/my/mybg12.png b/static/common/img/my/mybg12.png new file mode 100644 index 0000000..70ea7dd Binary files /dev/null and b/static/common/img/my/mybg12.png differ diff --git a/static/common/img/my/mybg13.png b/static/common/img/my/mybg13.png new file mode 100644 index 0000000..360cbf7 Binary files /dev/null and b/static/common/img/my/mybg13.png differ diff --git a/static/common/img/my/mybg14.png b/static/common/img/my/mybg14.png new file mode 100644 index 0000000..26dfd1c Binary files /dev/null and b/static/common/img/my/mybg14.png differ diff --git a/static/common/img/my/mybg15.png b/static/common/img/my/mybg15.png new file mode 100644 index 0000000..90639b6 Binary files /dev/null and b/static/common/img/my/mybg15.png differ diff --git a/static/common/img/my/mybg16.png b/static/common/img/my/mybg16.png new file mode 100644 index 0000000..935427a Binary files /dev/null and b/static/common/img/my/mybg16.png differ diff --git a/static/common/img/my/mybg17.png b/static/common/img/my/mybg17.png new file mode 100644 index 0000000..79ca872 Binary files /dev/null and b/static/common/img/my/mybg17.png differ diff --git a/static/common/img/my/mybg18.png b/static/common/img/my/mybg18.png new file mode 100644 index 0000000..7419d90 Binary files /dev/null and b/static/common/img/my/mybg18.png differ diff --git a/static/common/img/my/mybg19.png b/static/common/img/my/mybg19.png new file mode 100644 index 0000000..8226e74 Binary files /dev/null and b/static/common/img/my/mybg19.png differ diff --git a/static/common/img/my/mybg2.png b/static/common/img/my/mybg2.png new file mode 100644 index 0000000..ea4538d Binary files /dev/null and b/static/common/img/my/mybg2.png differ diff --git a/static/common/img/my/mybg20.png b/static/common/img/my/mybg20.png new file mode 100644 index 0000000..d8f41b2 Binary files /dev/null and b/static/common/img/my/mybg20.png differ diff --git a/static/common/img/my/mybg3.png b/static/common/img/my/mybg3.png new file mode 100644 index 0000000..afaefd1 Binary files /dev/null and b/static/common/img/my/mybg3.png differ diff --git a/static/common/img/my/mybg4.png b/static/common/img/my/mybg4.png new file mode 100644 index 0000000..de6eb57 Binary files /dev/null and b/static/common/img/my/mybg4.png differ diff --git a/static/common/img/my/mybg5.png b/static/common/img/my/mybg5.png new file mode 100644 index 0000000..9053582 Binary files /dev/null and b/static/common/img/my/mybg5.png differ diff --git a/static/common/img/my/mybg6.png b/static/common/img/my/mybg6.png new file mode 100644 index 0000000..4c3cbc3 Binary files /dev/null and b/static/common/img/my/mybg6.png differ diff --git a/static/common/img/my/mybg7.png b/static/common/img/my/mybg7.png new file mode 100644 index 0000000..77faba4 Binary files /dev/null and b/static/common/img/my/mybg7.png differ diff --git a/static/common/img/my/mybg8.png b/static/common/img/my/mybg8.png new file mode 100644 index 0000000..ac481c6 Binary files /dev/null and b/static/common/img/my/mybg8.png differ diff --git a/static/common/img/my/mybg9.png b/static/common/img/my/mybg9.png new file mode 100644 index 0000000..b99b71f Binary files /dev/null and b/static/common/img/my/mybg9.png differ diff --git a/static/common/img/my/person.png b/static/common/img/my/person.png new file mode 100644 index 0000000..68cd7ad Binary files /dev/null and b/static/common/img/my/person.png differ diff --git a/static/common/img/my/privacy.png b/static/common/img/my/privacy.png new file mode 100644 index 0000000..8d75e21 Binary files /dev/null and b/static/common/img/my/privacy.png differ diff --git a/static/common/img/my/setting.png b/static/common/img/my/setting.png new file mode 100644 index 0000000..3660005 Binary files /dev/null and b/static/common/img/my/setting.png differ diff --git a/static/common/img/my/unauthenticated.png b/static/common/img/my/unauthenticated.png new file mode 100644 index 0000000..14f37ed Binary files /dev/null and b/static/common/img/my/unauthenticated.png differ diff --git a/static/common/img/mybackimg.png b/static/common/img/mybackimg.png new file mode 100644 index 0000000..d7ec223 Binary files /dev/null and b/static/common/img/mybackimg.png differ diff --git a/static/common/img/noData/error-data.png b/static/common/img/noData/error-data.png new file mode 100644 index 0000000..5feadb3 Binary files /dev/null and b/static/common/img/noData/error-data.png differ diff --git a/static/common/img/noData/error-net.png b/static/common/img/noData/error-net.png new file mode 100644 index 0000000..38728e4 Binary files /dev/null and b/static/common/img/noData/error-net.png differ diff --git a/static/common/img/noData/maintenance.png b/static/common/img/noData/maintenance.png new file mode 100644 index 0000000..7ac4d57 Binary files /dev/null and b/static/common/img/noData/maintenance.png differ diff --git a/static/common/img/noData/no-attachment-resume.png b/static/common/img/noData/no-attachment-resume.png new file mode 100644 index 0000000..c3e7b33 Binary files /dev/null and b/static/common/img/noData/no-attachment-resume.png differ diff --git a/static/common/img/noData/no-collection.png b/static/common/img/noData/no-collection.png new file mode 100644 index 0000000..1b1b564 Binary files /dev/null and b/static/common/img/noData/no-collection.png differ diff --git a/static/common/img/noData/no-comments.png b/static/common/img/noData/no-comments.png new file mode 100644 index 0000000..0833c3a Binary files /dev/null and b/static/common/img/noData/no-comments.png differ diff --git a/static/common/img/noData/no-content.png b/static/common/img/noData/no-content.png new file mode 100644 index 0000000..fba7d7a Binary files /dev/null and b/static/common/img/noData/no-content.png differ diff --git a/static/common/img/noData/no-data.png b/static/common/img/noData/no-data.png new file mode 100644 index 0000000..de4b9c9 Binary files /dev/null and b/static/common/img/noData/no-data.png differ diff --git a/static/common/img/noData/no-file.png b/static/common/img/noData/no-file.png new file mode 100644 index 0000000..d2768af Binary files /dev/null and b/static/common/img/noData/no-file.png differ diff --git a/static/common/img/noData/no-friends.png b/static/common/img/noData/no-friends.png new file mode 100644 index 0000000..bf90ee3 Binary files /dev/null and b/static/common/img/noData/no-friends.png differ diff --git a/static/common/img/noData/no-internet.png b/static/common/img/noData/no-internet.png new file mode 100644 index 0000000..1820a12 Binary files /dev/null and b/static/common/img/noData/no-internet.png differ diff --git a/static/common/img/noData/no-message.png b/static/common/img/noData/no-message.png new file mode 100644 index 0000000..434a4f1 Binary files /dev/null and b/static/common/img/noData/no-message.png differ diff --git a/static/common/img/noData/no-permissions.png b/static/common/img/noData/no-permissions.png new file mode 100644 index 0000000..e6a0e6e Binary files /dev/null and b/static/common/img/noData/no-permissions.png differ diff --git a/static/common/img/noData/no-picture.png b/static/common/img/noData/no-picture.png new file mode 100644 index 0000000..adc984c Binary files /dev/null and b/static/common/img/noData/no-picture.png differ diff --git a/static/common/img/noData/no-search.png b/static/common/img/noData/no-search.png new file mode 100644 index 0000000..cc9a5a2 Binary files /dev/null and b/static/common/img/noData/no-search.png differ diff --git a/static/common/img/noDataNew/error-data.png b/static/common/img/noDataNew/error-data.png new file mode 100644 index 0000000..1be79c6 Binary files /dev/null and b/static/common/img/noDataNew/error-data.png differ diff --git a/static/common/img/noDataNew/error-net.png b/static/common/img/noDataNew/error-net.png new file mode 100644 index 0000000..9de7ec4 Binary files /dev/null and b/static/common/img/noDataNew/error-net.png differ diff --git a/static/common/img/noDataNew/maintenance.png b/static/common/img/noDataNew/maintenance.png new file mode 100644 index 0000000..386affd Binary files /dev/null and b/static/common/img/noDataNew/maintenance.png differ diff --git a/static/common/img/noDataNew/no-attachment-resume.png b/static/common/img/noDataNew/no-attachment-resume.png new file mode 100644 index 0000000..948dcb4 Binary files /dev/null and b/static/common/img/noDataNew/no-attachment-resume.png differ diff --git a/static/common/img/noDataNew/no-collection.png b/static/common/img/noDataNew/no-collection.png new file mode 100644 index 0000000..2067652 Binary files /dev/null and b/static/common/img/noDataNew/no-collection.png differ diff --git a/static/common/img/noDataNew/no-comments.png b/static/common/img/noDataNew/no-comments.png new file mode 100644 index 0000000..db72e09 Binary files /dev/null and b/static/common/img/noDataNew/no-comments.png differ diff --git a/static/common/img/noDataNew/no-content.png b/static/common/img/noDataNew/no-content.png new file mode 100644 index 0000000..216580d Binary files /dev/null and b/static/common/img/noDataNew/no-content.png differ diff --git a/static/common/img/noDataNew/no-data.png b/static/common/img/noDataNew/no-data.png new file mode 100644 index 0000000..00dc8b0 Binary files /dev/null and b/static/common/img/noDataNew/no-data.png differ diff --git a/static/common/img/noDataNew/no-file.png b/static/common/img/noDataNew/no-file.png new file mode 100644 index 0000000..dd84027 Binary files /dev/null and b/static/common/img/noDataNew/no-file.png differ diff --git a/static/common/img/noDataNew/no-friends.png b/static/common/img/noDataNew/no-friends.png new file mode 100644 index 0000000..b08e669 Binary files /dev/null and b/static/common/img/noDataNew/no-friends.png differ diff --git a/static/common/img/noDataNew/no-internet.png b/static/common/img/noDataNew/no-internet.png new file mode 100644 index 0000000..ad0ebb3 Binary files /dev/null and b/static/common/img/noDataNew/no-internet.png differ diff --git a/static/common/img/noDataNew/no-message.png b/static/common/img/noDataNew/no-message.png new file mode 100644 index 0000000..718e338 Binary files /dev/null and b/static/common/img/noDataNew/no-message.png differ diff --git a/static/common/img/noDataNew/no-permissions.png b/static/common/img/noDataNew/no-permissions.png new file mode 100644 index 0000000..b720457 Binary files /dev/null and b/static/common/img/noDataNew/no-permissions.png differ diff --git a/static/common/img/noDataNew/no-picture.png b/static/common/img/noDataNew/no-picture.png new file mode 100644 index 0000000..65f1874 Binary files /dev/null and b/static/common/img/noDataNew/no-picture.png differ diff --git a/static/common/img/noDataNew/no-search.png b/static/common/img/noDataNew/no-search.png new file mode 100644 index 0000000..a293a97 Binary files /dev/null and b/static/common/img/noDataNew/no-search.png differ diff --git a/static/common/img/pdf.svg b/static/common/img/pdf.svg new file mode 100644 index 0000000..678098e --- /dev/null +++ b/static/common/img/pdf.svg @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/static/common/img/picture.png b/static/common/img/picture.png new file mode 100644 index 0000000..b2e4d85 Binary files /dev/null and b/static/common/img/picture.png differ diff --git a/static/common/img/qiyeicon.png b/static/common/img/qiyeicon.png new file mode 100644 index 0000000..b9c7e45 Binary files /dev/null and b/static/common/img/qiyeicon.png differ diff --git a/static/common/img/refresh.png b/static/common/img/refresh.png new file mode 100644 index 0000000..45fb990 Binary files /dev/null and b/static/common/img/refresh.png differ diff --git a/static/common/img/result-error.png b/static/common/img/result-error.png new file mode 100644 index 0000000..44e1bb7 Binary files /dev/null and b/static/common/img/result-error.png differ diff --git a/static/common/img/result-success.png b/static/common/img/result-success.png new file mode 100644 index 0000000..0f2099a Binary files /dev/null and b/static/common/img/result-success.png differ diff --git a/static/common/img/resume.svg b/static/common/img/resume.svg new file mode 100644 index 0000000..7f5f408 --- /dev/null +++ b/static/common/img/resume.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/common/img/right-arrow.png b/static/common/img/right-arrow.png new file mode 100644 index 0000000..a150921 Binary files /dev/null and b/static/common/img/right-arrow.png differ diff --git a/static/common/img/role1.png b/static/common/img/role1.png new file mode 100644 index 0000000..06c5d8f Binary files /dev/null and b/static/common/img/role1.png differ diff --git a/static/common/img/role2.png b/static/common/img/role2.png new file mode 100644 index 0000000..d117545 Binary files /dev/null and b/static/common/img/role2.png differ diff --git a/static/common/img/role3.png b/static/common/img/role3.png new file mode 100644 index 0000000..065b718 Binary files /dev/null and b/static/common/img/role3.png differ diff --git a/static/common/img/row_right.png b/static/common/img/row_right.png new file mode 100644 index 0000000..2abe8a6 Binary files /dev/null and b/static/common/img/row_right.png differ diff --git a/static/common/img/search.png b/static/common/img/search.png new file mode 100644 index 0000000..5086ef7 Binary files /dev/null and b/static/common/img/search.png differ diff --git a/static/common/img/search.svg b/static/common/img/search.svg new file mode 100644 index 0000000..e400fa3 --- /dev/null +++ b/static/common/img/search.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/static/common/img/select.png b/static/common/img/select.png new file mode 100644 index 0000000..a6fd875 Binary files /dev/null and b/static/common/img/select.png differ diff --git a/static/common/img/setingIcon.png b/static/common/img/setingIcon.png new file mode 100644 index 0000000..eccbace Binary files /dev/null and b/static/common/img/setingIcon.png differ diff --git a/static/common/img/sheet.svg b/static/common/img/sheet.svg new file mode 100644 index 0000000..93abf1f --- /dev/null +++ b/static/common/img/sheet.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/common/img/shoolIcon.png b/static/common/img/shoolIcon.png new file mode 100644 index 0000000..b872a3c Binary files /dev/null and b/static/common/img/shoolIcon.png differ diff --git a/static/common/img/student.png b/static/common/img/student.png new file mode 100644 index 0000000..517f03b Binary files /dev/null and b/static/common/img/student.png differ diff --git a/static/common/img/systemHeaderimg.png b/static/common/img/systemHeaderimg.png new file mode 100644 index 0000000..321f5df Binary files /dev/null and b/static/common/img/systemHeaderimg.png differ diff --git a/static/common/img/teacher.png b/static/common/img/teacher.png new file mode 100644 index 0000000..852b8eb Binary files /dev/null and b/static/common/img/teacher.png differ diff --git a/static/common/img/teacherIcon.png b/static/common/img/teacherIcon.png new file mode 100644 index 0000000..c8c1c27 Binary files /dev/null and b/static/common/img/teacherIcon.png differ diff --git a/static/common/img/upload.svg b/static/common/img/upload.svg new file mode 100644 index 0000000..e4f091c --- /dev/null +++ b/static/common/img/upload.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/common/img/wenjuan.png b/static/common/img/wenjuan.png new file mode 100644 index 0000000..532f84a Binary files /dev/null and b/static/common/img/wenjuan.png differ diff --git a/static/common/img/wishlistBackImg.png b/static/common/img/wishlistBackImg.png new file mode 100644 index 0000000..b3747dc Binary files /dev/null and b/static/common/img/wishlistBackImg.png differ diff --git a/static/common/img/word.svg b/static/common/img/word.svg new file mode 100644 index 0000000..eeb757b --- /dev/null +++ b/static/common/img/word.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/common/img/上传个人工作证.png b/static/common/img/上传个人工作证.png new file mode 100644 index 0000000..bb59589 Binary files /dev/null and b/static/common/img/上传个人工作证.png differ diff --git a/static/common/img/上传营业执照.png b/static/common/img/上传营业执照.png new file mode 100644 index 0000000..d937423 Binary files /dev/null and b/static/common/img/上传营业执照.png differ diff --git a/static/common/img/上传身份证反面.png b/static/common/img/上传身份证反面.png new file mode 100644 index 0000000..7f90c6e Binary files /dev/null and b/static/common/img/上传身份证反面.png differ diff --git a/static/common/img/上传身份证正面.png b/static/common/img/上传身份证正面.png new file mode 100644 index 0000000..6c4071a Binary files /dev/null and b/static/common/img/上传身份证正面.png differ diff --git a/static/common/img/个人工作证.png b/static/common/img/个人工作证.png new file mode 100644 index 0000000..345ac90 Binary files /dev/null and b/static/common/img/个人工作证.png differ diff --git a/static/common/img/企业营业执照.png b/static/common/img/企业营业执照.png new file mode 100644 index 0000000..6a14ed0 Binary files /dev/null and b/static/common/img/企业营业执照.png differ diff --git a/static/common/img/学生证.png b/static/common/img/学生证.png new file mode 100644 index 0000000..125263b Binary files /dev/null and b/static/common/img/学生证.png differ diff --git a/static/common/img/录取通知书.png b/static/common/img/录取通知书.png new file mode 100644 index 0000000..8c08aff Binary files /dev/null and b/static/common/img/录取通知书.png differ diff --git a/static/common/img/校园卡.png b/static/common/img/校园卡.png new file mode 100644 index 0000000..88ec73b Binary files /dev/null and b/static/common/img/校园卡.png differ diff --git a/static/common/img/毕业证.png b/static/common/img/毕业证.png new file mode 100644 index 0000000..340e6af Binary files /dev/null and b/static/common/img/毕业证.png differ diff --git a/static/common/img/身份证反面.png b/static/common/img/身份证反面.png new file mode 100644 index 0000000..74f6dcf Binary files /dev/null and b/static/common/img/身份证反面.png differ diff --git a/static/common/img/身份证正面.png b/static/common/img/身份证正面.png new file mode 100644 index 0000000..6c8aca1 Binary files /dev/null and b/static/common/img/身份证正面.png differ diff --git a/static/common/js/common.js b/static/common/js/common.js new file mode 100644 index 0000000..a8716f9 --- /dev/null +++ b/static/common/js/common.js @@ -0,0 +1,30 @@ +// base64转文件流 +function base64toFile(dataurl, filename = 'file') { + let arr = dataurl.split(',') + let mime = arr[0].match(/:(.*?);/)[1] + let suffix = mime.split('/')[1] + let bstr = atob(arr[1]) + let n = bstr.length + let u8arr = new Uint8Array(n) + while (n--) { + u8arr[n] = bstr.charCodeAt(n) + } + + return new File([u8arr], `${filename}.${suffix}`, { + type: mime + }) +} + +// 文件流转base64 +function filetoBase64(file) { + let reader = new FileReader(); //实例化文件读取对象 + reader.readAsDataURL(file); //将文件读取为 DataURL,也就是base64编码 + reader.onload = (e) => { //文件读取成功完成时触发 + let dataURL = e.target.result; //获得文件读取成功后的DataURL,也就是base64编码 + // console.log(dataURL); + } +} +export default { + base64toFile, + filetoBase64 +} \ No newline at end of file diff --git a/static/common/js/config.js b/static/common/js/config.js new file mode 100644 index 0000000..200f1db --- /dev/null +++ b/static/common/js/config.js @@ -0,0 +1,18 @@ +export default { + //不需要登录的页面,白名单 + whiteList: [ + "/pages/login/login/login", + "/pages/login/register/register", + "/pages/login/confirmPwd/confirmPwd", + "/pages/login/ForgetPassword/ForgetPassword", + "/pages/my/BackCodeLook/BackCodeLook", + "/pages/my/BackSuccess/BackSuccess", + //...... + + '/pages/webview/index', + "/pages/login/recognitionResult/recognitionResult", + '/pages/login/recognitionResult/recognitionFailed' + ], + //登录页 + loginPage:"/pages/login/login/login" +} \ No newline at end of file diff --git a/static/common/js/emoji.js b/static/common/js/emoji.js new file mode 100644 index 0000000..d7e9281 --- /dev/null +++ b/static/common/js/emoji.js @@ -0,0 +1,1422 @@ +export default[ + "😀", + "😁", + "😂", + "😃", + "😄", + "😅", + "😆", + "😇", + "😈", + "😉", + "😊", + "😋", + "😌", + "😍", + "😎", + "😏", + "😐", + "😑", + "😒", + "😓", + "😔", + "😕", + "😖", + "😗", + "😘", + "😙", + "😚", + "😛", + "😜", + "😝", + "😞", + "😟", + "😠", + "😡", + "😢", + "😣", + "😤", + "😥", + "😦", + "😧", + "😨", + "😩", + "😪", + "😫", + "😬", + "😭", + "😮", + "😯", + "😰", + "😱", + "😲", + "😳", + "😴", + "😵", + "😶", + "😷", + "😸", + "😹", + "😺", + "😻", + "😼", + "😽", + "😾", + "😿", + "🙀", + "🙁", + "🙂", + "🙃", + "🙄", + "#️⃣", + "*️⃣", + "0️⃣", + "1️⃣", + "2️⃣", + "3️⃣", + "4️⃣", + "5️⃣", + "6️⃣", + "7️⃣", + "8️⃣", + "9️⃣", + "©️", + "®️", + "🀄", + "🃏", + "🅰️", + "🅱️", + "🅾️", + "🅿️", + "🆎", + "🆑", + "🆒", + "🆓", + "🆔", + "🆕", + "🆖", + "🆗", + "🆘", + "🆙", + "🆚", + "🈁", + "🈂️", + "🉐", + "🉑", + "🌀", + "🌁", + "🌂", + "🌃", + "🌄", + // "🈚", + // "🈯", + // "🈲", + // "🈳", + // "🈴", + // "🈵", + // "🈶", + // "🈷️", + // "🈸", + // "🈹", + // "🈺", + // "🌅", + // "🌆", + // "🌇", + // "🌈", + // "🌉", + // "🌊", + // "🌋", + // "🌌", + // "🌍", + // "🌎", + // "🌏", + // "🌐", + // "🌑", + // "🌒", + // "🌓", + // "🌔", + // "🌕", + // "🌖", + // "🌗", + // "🌘", + // "🌙", + // "🌚", + // "🌛", + // "🌜", + // "🌝", + // "🌞", + // "🌟", + // "🌠", + // "🌡️", + // "🌤️", + // "🌥️", + // "🌦️", + // "🌧️", + // "🌨️", + // "🌩️", + // "🌪️", + // "🌫️", + // "🌬️", + // "🌭", + // "🌮", + // "🌯", + // "🌰", + // "🌱", + // "🌲", + // "🌳", + // "🌴", + // "🌵", + // "🌶️", + // "🌷", + // "🌸", + // "🌹", + // "🌺", + // "🌻", + // "🌼", + // "🌽", + // "🌾", + // "🌿", + // "🍀", + // "🍁", + // "🍂", + // "🍃", + // "🍄", + // "🍅", + // "🍆", + // "🍇", + // "🍈", + // "🍉", + // "🍊", + // "🍋", + // "🍌", + // "🍍", + // "🍎", + // "🍏", + // "🍐", + // "🍑", + // "🍒", + // "🍓", + // "🍔", + // "🍕", + // "🍖", + // "🍗", + // "🍘", + // "🍙", + // "🍚", + // "🍛", + // "🍜", + // "🍝", + // "🍞", + // "🍟", + // "🍠", + // "🍡", + // "🍢", + // "🍣", + // "🍤", + // "🍥", + // "🍦", + // "🍧", + // "🍨", + // "🍩", + // "🍪", + // "🍫", + // "🍬", + // "🍭", + // "🍮", + // "🍯", + // "🍰", + // "🍱", + // "🍲", + // "🍳", + // "🍴", + // "🍵", + // "🍶", + // "🍷", + // "🍸", + // "🍹", + // "🍺", + // "🍻", + // "🍼", + // "🍽️", + // "🍾", + // "🍿", + // "🎀", + // "🎁", + // "🎂", + // "🎃", + // "🎄", + // "🎅", + // "🎆", + // "🎇", + // "🎈", + // "🎉", + // "🎊", + // "🎋", + // "🎌", + // "🎍", + // "🎎", + // "🎏", + // "🎐", + // "🎑", + // "🎒", + // "🎓", + // "🎖️", + // "🎗️", + // "🎙️", + // "🎚️", + // "🎛️", + // "🎞️", + // "🎟️", + // "🎠", + // "🎡", + // "🎢", + // "🎣", + // "🎤", + // "🎥", + // "🎦", + // "🎧", + // "🎨", + // "🎩", + // "🎪", + // "🎫", + // "🎬", + // "🎭", + // "🎮", + // "🎯", + // "🎰", + // "🎱", + // "🎲", + // "🎳", + // "🎴", + // "🎵", + // "🎶", + // "🎷", + // "🎸", + // "🎹", + // "🎺", + // "🎻", + // "🎼", + // "🎽", + // "🎾", + // "🎿", + // "🏀", + // "🏁", + // "🏂", + // "🏃‍♀️", + // "🏃‍♂️", + // "🏃", + // "🏄‍♀️", + // "🏄‍♂️", + // "🏄", + // "🏅", + // "🏆", + // "🏇", + // "🏈", + // "🏉", + // "🏊‍♀️", + // "🏊‍♂️", + // "🏊", + // "🏋️‍♀️", + // "🏋️‍♂️", + // "🏋️", + // "🏌️‍♀️", + // "🏌️‍♂️", + // "🏌️", + // "🏍️", + // "🏎️", + // "🏏", + // "🏐", + // "🏑", + // "🏒", + // "🏓", + // "🏔️", + // "🏕️", + // "🏖️", + // "🏗️", + // "🏘️", + // "🏙️", + // "🏚️", + // "🏛️", + // "🏜️", + // "🏝️", + // "🏞️", + // "🏟️", + // "🏠", + // "🏡", + // "🏢", + // "🏣", + // "🏤", + // "🏥", + // "🏦", + // "🏧", + // "🏨", + // "🏩", + // "🏪", + // "🏫", + // "🏬", + // "🏭", + // "🏮", + // "🏯", + // "🏰", + // "🏳️‍🌈", + // "🏳️‍⚧️", + // "🏳️", + // "🏴‍☠️", + // "🏴󠁧󠁢󠁥󠁮󠁧󠁿", + // "🏴󠁧󠁢󠁳󠁣󠁴󠁿", + // "🏴󠁧󠁢󠁷󠁬󠁳󠁿", + // "🏴", + // "🏵️", + // "🏷️", + // "🏸", + // "🏹", + // "🏺", + // "🐀", + // "🐁", + // "🐂", + // "🐃", + // "🐄", + // "🐅", + // "🐆", + // "🐇", + // "🐈‍", + // "🐈", + // "🐉", + // "🐊", + // "🐋", + // "🐌", + // "🐍", + // "🐎", + // "🐏", + // "🐐", + // "🐑", + // "🐒", + // "🐓", + // "🐔", + // "🐕‍🦺", + // "🐕", + // "🐖", + // "🐗", + // "🐘", + // "🐙", + // "🐚", + // "🐛", + // "🐜", + // "🐝", + // "🐞", + // "🐟", + // "🐠", + // "🐡", + // "🐢", + // "🐣", + // "🐤", + // "🐥", + // "🐦", + // "🐧", + // "🐨", + // "🐩", + // "🐪", + // "🐫", + // "🐬", + // "🐭", + // "🐮", + // "🐯", + // "🐰", + // "🐱", + // "🐲", + // "🐳", + // "🐴", + // "🐵", + // "🐶", + // "🐷", + // "🐸", + // "🐹", + // "🐺", + // "🐻‍", + // "❄️", + // "🐼", + // "🐽", + // "🐾", + // "🐿️", + // "👀", + // "👁️‍🗨️", + // "👁️", + // "👂", + // "👃", + // "👄", + // "👅", + // "👆", + // "👇", + // "👈", + // "👉", + // "👊", + // "👋", + // "👌", + // "👍", + // "👎", + // "👏", + // "👐", + // "👑", + // "👒", + // "👓", + // "👔", + // "👕", + // "👖", + // "👗", + // "👘", + // "👙", + // "👚", + // "👛", + // "👜", + // "👝", + // "👞", + // "👟", + // "👠", + // "👡", + // "👢", + // "👣", + // "👤", + // "👥", + // "👦", + // "👧", + // "👨‍🌾", + // "👨‍🍳", + // "👨‍🍼", + // "👨‍🎓", + // "👨‍🎤", + // "👨‍🎨", + // "👨‍🏫", + // "👨‍🏭", + // "👨‍👦‍👦", + // "👨‍👦", + // "👨‍👧‍👦", + // "👨‍👧‍👧", + // "👨‍👧", + // "👨‍👨‍👦", + // "👨‍👨‍👦‍👦", + // "👨‍👨‍👧", + // "👨‍👨‍👧‍👦", + // "👨‍👨‍👧‍👧", + // "👨‍👩‍👦", + // "👨‍👩‍👦‍👦", + // "👨‍👩‍👧", + // "👨‍👩‍👧‍👦", + // "👨‍👩‍👧‍👧", + // "👨‍💻", + // "👨‍💼", + // "👨‍🔧", + // "👨‍🔬", + // "👨‍🚀", + // "👨‍🚒", + // "👨‍🦯", + // "👨‍🦰", + // "👨‍🦱", + // "👨‍🦲", + // "👨‍🦳", + // "👨‍🦼", + // "👨‍🦽", + // "👨‍⚕️", + // "👨‍⚖️", + // "👨‍✈️", + // "👨‍❤️‍👨", + // "👨‍❤️‍💋‍👨", + // "👨", + // "👩‍🌾", + // "👩‍🍳", + // "👩‍🍼", + // "👩‍🎓", + // "👩‍🎤", + // "👩‍🎨", + // "👩‍🏫", + // "👩‍🏭", + // "👩‍👦‍👦", + // "👩‍👦", + // "👩‍👧‍👦", + // "👩‍👧‍👧", + // "👩‍👧", + // "👩‍👩‍👦", + // "👩‍👩‍👦‍👦", + // "👩‍👩‍👧", + // "👩‍👩‍👧‍👦", + // "👩‍👩‍👧‍👧", + // "👩‍💻", + // "👩‍💼", + // "👩‍🔧", + // "👩‍🔬", + // "👩‍🚀", + // "👩‍🚒", + // "👩‍🦰", + // "👩‍🦱", + // "👩‍🦲", + // "👩‍🦳", + // "👩‍⚕️", + // "👩‍⚖️", + // "👩‍✈️", + // "👩‍❤️‍👨", + // "👩‍❤️‍👩", + // "👩‍❤️‍💋‍👨", + // "👩‍❤️‍💋‍👩", + // "👩", + // "👪", + // "👫", + // "👬", + // "👭", + // "👮‍♀️", + // "👮‍♂️", + // "👮", + // "👯‍♀️", + // "👯‍♂️", + // "👯", + // "‍♀️", + // "👰", + // "👱‍♀️", + // "👱‍♂️", + // "👱", + // "👲", + // "👳‍♀️", + // "👳‍♂️", + // "👳", + // "👴", + // "👵", + // "👶", + // "👷‍♀️", + // "👷‍♂️", + // "👷", + // "👸", + // "👹", + // "👺", + // "👻", + // "👼", + // "👽", + // "👾", + // "👿", + // "💀", + // "💁‍♀️", + // "💁‍♂️", + // "💁", + // "💂‍♀️", + // "💂‍♂️", + // "💂", + // "💃", + // "💄", + // "💅", + // "💆‍♀️", + // "💆‍♂️", + // "💆", + // "💇‍♀️", + // "💇‍♂️", + // "💇", + // "💈", + // "💉", + // "💊", + // "💋", + // "💌", + // "💍", + // "💎", + // "💏", + // "💐", + // "💑", + // "💒", + // "💓", + // "💔", + // "💕", + // "💖", + // "💗", + // "💘", + // "💙", + // "💚", + // "💛", + // "💜", + // "💝", + // "💞", + // "💟", + // "💠", + // "💡", + // "💢", + // "💣", + // "💤", + // "💥", + // "💦", + // "💧", + // "💨", + // "💩", + // "💪", + // "💫", + // "💬", + // "💭", + // "💮", + // "💯", + // "💰", + // "💱", + // "💲", + // "💳", + // "💴", + // "💵", + // "💶", + // "💷", + // "💸", + // "💹", + // "💺", + // "💻", + // "💼", + // "💽", + // "💾", + // "💿", + // "📀", + // "📁", + // "📂", + // "📃", + // "📄", + // "📅", + // "📆", + // "📇", + // "📈", + // "📉", + // "📊", + // "📋", + // "📌", + // "📍", + // "📎", + // "📏", + // "📐", + // "📑", + // "📒", + // "📓", + // "📔", + // "📕", + // "📖", + // "📗", + // "📘", + // "📙", + // "📚", + // "📛", + // "📜", + // "📝", + // "📞", + // "📟", + // "📠", + // "📡", + // "📢", + // "📣", + // "📤", + // "📥", + // "📦", + // "📧", + // "📨", + // "📩", + // "📪", + // "📫", + // "📬", + // "📭", + // "📮", + // "📯", + // "📰", + // "📱", + // "📲", + // "📳", + // "📴", + // "📵", + // "📶", + // "📷", + // "📸", + // "📹", + // "📺", + // "📻", + // "📼", + // "📽️", + // "📿", + // "🔀", + // "🔁", + // "🔂", + // "🔃", + // "🔄", + // "🔅", + // "🔆", + // "🔇", + // "🔈", + // "🔉", + // "🔊", + // "🔋", + // "🔌", + // "🔍", + // "🔎", + // "🔏", + // "🔐", + // "🔑", + // "🔒", + // "🔓", + // "🔔", + // "🔕", + // "🔖", + // "🔗", + // "🔘", + // "🔙", + // "🔚", + // "🔛", + // "🔜", + // "🔝", + // "🔞", + // "🔟", + // "🔠", + // "🔡", + // "🔢", + // "🔣", + // "🔤", + // "🔥", + // "🔦", + // "🔧", + // "🔨", + // "🔩", + // "🔪", + // "🔫", + // "🔬", + // "🔭", + // "🔮", + // "🔯", + // "🔰", + // "🔱", + // "🔲", + // "🔳", + // "🔴", + // "🔵", + // "🔶", + // "🔷", + // "🔸", + // "🔹", + // "🔺", + // "🔻", + // "🔼", + // "🔽", + // "🕉️", + // "🕊️", + // "🕋", + // "🕌", + // "🕍", + // "🕎", + // "🕐", + // "🕑", + // "🕒", + // "🕓", + // "🕔", + // "🕕", + // "🕖", + // "🕗", + // "🕘", + // "🕙", + // "🕚", + // "🕛", + // "🕜", + // "🕝", + // "🕞", + // "🕟", + // "🕠", + // "🕡", + // "🕢", + // "🕣", + // "🕤", + // "🕥", + // "🕦", + // "🕧", + // "🕯️", + // "🕰️", + // "🕳️", + // "🕴️", + // "🕵️‍♀️", + // "🕵️‍♂️", + // "🕵️", + // "🕶️", + // "🕷️", + // "🕸️", + // "🕹️", + // "🕺", + // "🖇️", + // "🖊️", + // "🖋️", + // "🖌️", + // "🖍️", + // "🖐️", + // "🖕", + // "🖖", + // "🖤", + // "🖥️", + // "🖨️", + // "🖱️", + // "🖲️", + // "🖼️", + // "🗂️", + // "🗃️", + // "🗄️", + // "🗑️", + // "🗒️", + // "🗓️", + // "🗜️", + // "🗝️", + // "🗞️", + // "🗡️", + // "🗣️", + // "🗨️", + // "🗯️", + // "🗳️", + // "🗺️", + // "🗻", + // "🗼", + // "🗽", + // "🗾", + // "🗿", + // "🙅‍♀️", + // "🙅‍♂️", + // "🙅", + // "🙆‍♀️", + // "🙆‍♂️", + // "🙆", + // "🙇‍♀️", + // "🙇‍♂️", + // "🙇", + // "🙈", + // "🙉", + // "🙊", + // "🙋‍♀️", + // "🙋‍♂️", + // "🙋", + // "🙌", + // "🙍‍♀️", + // "🙍‍♂️", + // "🙍", + // "🙎‍♀️", + // "🙎‍♂️", + // "🙎", + // "🙏", + // "🚀", + // "🚁", + // "🚂", + // "🚃", + // "🚄", + // "🚅", + // "🚆", + // "🚇", + // "🚈", + // "🚉", + // "🚊", + // "🚋", + // "🚌", + // "🚍", + // "🚎", + // "🚏", + // "🚐", + // "🚑", + // "🚒", + // "🚓", + // "🚔", + // "🚕", + // "🚖", + // "🚗", + // "🚘", + // "🚙", + // "🚚", + // "🚛", + // "🚜", + // "🚝", + // "🚞", + // "🚟", + // "🚠", + // "🚡", + // "🚢", + // "🚣‍♀️", + // "🚣‍♂️", + // "🚣", + // "🚤", + // "🚥", + // "🚦", + // "🚧", + // "🚨", + // "🚩", + // "🚪", + // "🚫", + // "🚬", + // "🚭", + // "🚮", + // "🚯", + // "🚰", + // "🚱", + // "🚲", + // "🚳", + // "🚴‍♀️", + // "🚴‍♂️", + // "🚴", + // "🚵‍♀️", + // "🚵‍♂️", + // "🚵", + // "🚶‍♀️", + // "🚶‍♂️", + // "🚶", + // "🚷", + // "🚸", + // "🚹", + // "🚺", + // "🚻", + // "🚼", + // "🚽", + // "🚾", + // "🚿", + // "🛀", + // "🛁", + // "🛂", + // "🛃", + // "🛄", + // "🛅", + // "🛋️", + // "🛌", + // "🛍️", + // "🛎️", + // "🛏️", + // "🛐", + // "🛑", + // "🛒", + // "🛠️", + // "🛡️", + // "🛢️", + // "🛣️", + // "🛤️", + // "🛥️", + // "🛩️", + // "🛫", + // "🛬", + // "🛰️", + // "🛳️", + // "🛴", + // "🛵", + // "🛶", + // "🛷", + // "🛸", + // "🛹", + // "🤐", + // "🤑", + // "🤒", + // "🤓", + // "🤔", + // "🤕", + // "🤖", + // "🤗", + // "🤘", + // "🤙", + // "🤚", + // "🤛", + // "🤜", + // "🤝", + // "🤞", + // "🤟", + // "🤠", + // "🤡", + // "🤢", + // "🤣", + // "🤤", + // "🤥", + // "🤦‍♀️", + // "🤦‍♂️", + // "🤦", + // "🤧", + // "🤨", + // "🤩", + // "🤪", + // "🤫", + // "🤬", + // "🤭", + // "🤮", + // "🤯", + // "🤰", + // "🤱", + // "🤲", + // "🤳", + // "🤴", + // "🤵‍♀️", + // "🤵‍♂️", + // "🤵", + // "🤶", + // "🤷‍♀️", + // "🤷‍♂️", + // "🤷", + // "🤸‍♀️", + // "🤸‍♂️", + // "🤸", + // "🤹‍♀️", + // "🤹‍♂️", + // "🤹", + // "🤺", + // "🤼‍♀️", + // "🤼‍♂️", + // "🤼", + // "🤽‍♀️", + // "🤽‍♂️", + // "🤽", + // "🤾‍♀️", + // "🤾‍♂️", + // "🤾", + // "🥀", + // "🥁", + // "🥂", + // "🥃", + // "🥄", + // "🥅", + // "🥇", + // "🥈", + // "🥉", + // "🥊", + // "🥋", + // "🥌", + // "🥍", + // "🥎", + // "🥏", + // "🥐", + // "🥑", + // "🥒", + // "🥓", + // "🥔", + // "🥕", + // "🥖", + // "🥗", + // "🥘", + // "🥙", + // "🥚", + // "🥛", + // "🥜", + // "🥝", + // "🥞", + // "🥟", + // "🥠", + // "🥡", + // "🥢", + // "🥣", + // "🥤", + // "🥥", + // "🥦", + // "🥧", + // "🥨", + // "🥩", + // "🥪", + // "🥫", + // "🥬", + // "🥭", + // "🥮", + // "🥯", + // "🥰", + // "🥳", + // "🥴", + // "🥵", + // "🥶", + // "🥺", + // "🥼", + // "🥽", + // "🥾", + // "🥿", + // "🦀", + // "🦁", + // "🦂", + // "🦃", + // "🦄", + // "🦅", + // "🦆", + // "🦇", + // "🦈", + // "🦉", + // "🦊", + // "🦋", + // "🦌", + // "🦍", + // "🦎", + // "🦏", + // "🦐", + // "🦑", + // "🦒", + // "🦓", + // "🦔", + // "🦕", + // "🦖", + // "🦗", + // "🦘", + // "🦙", + // "🦚", + // "🦛", + // "🦜", + // "🦝", + // "🦞", + // "🦟", + // "🦠", + // "🦡", + // "🦢", + // "🦴", + // "🦵", + // "🦶", + // "🦷", + // "🦸‍♀️", + // "🦸‍♂️", + // "🦸", + // "🦹‍♀️", + // "🦹‍♂️", + // "🦹", + // "🧀", + // "🧁", + // "🧂", + // "🧐", + // "‍🌾", + // "‍🍳", + // "‍🍼", + // "‍🎄", + // "‍🎓", + // "‍🎤", + // "‍🎨", + // "‍🏫", + // "‍🏭", + // "‍💻", + // "‍💼", + // "‍🔧", + // "‍🔬", + // "‍🚀", + // "‍🚒", + // "‍🤝‍🧑", + // "‍🦯", + // "‍🦰", + // "‍🦱", + // "‍🦲", + // "‍🦳", + // "‍🦼", + // "‍🦽", + // "‍⚕️", + // "‍⚖️", + // "‍✈️", + // "🧑", + // "🧒", + // "🧓", + // "🧔", + // "🧕", + // "🧖‍♀️", + // "🧖‍♂️", + // "🧖", + // "🧗‍♀️", + // "🧗‍♂️", + // "🧗", + // "🧘‍♀️", + // "🧘‍♂️", + // "🧘", + // "🧙‍♀️", + // "🧙‍♂️", + // "🧙", + // "🧚‍♀️", + // "🧚‍♂️", + // "🧚", + // "🧛‍♀️", + // "🧛‍♂️", + // "🧛", + // "🧜‍♀️", + // "🧜‍♂️", + // "🧜", + // "🧝‍♀️", + // "🧝‍♂️", + // "🧝", + // "🧞‍♀️", + // "🧞‍♂️", + // "🧞", + // "🧟‍♀️", + // "🧟‍♂️", + // "🧟", + // "🧠", + // "🧡", + // "🧢", + // "🧣", + // "🧤", + // "🧥", + // "🧦", + // "🧧", + // "🧨", + // "🧩", + // "🧪", + // "🧫", + // "🧬", + // "🧭", + // "🧮", + // "🧯", + // "🧰", + // "🧱", + // "🧲", + // "🧳", + // "🧴", + // "🧵", + // "🧶", + // "🧷", + // "🧸", + // "🧹", + // "🧺", + // "🧻", + // "🧼", + // "🧽", + // "🧾", + // "🧿", + // "⁉️", + // "™️", + // "ℹ️", + // "↔️", + // "↕️", + // "↖️", + // "↗️", + // "↘️", + // "↙️", + // "↩️", + // "↪️", + // "⌚", + // "⌛", + // "⌨️", + // "⏏️", + // "⏩", + // "⏪", + // "⏫", + // "⏬", + // "⏭️", + // "⏮️", + // "⏯️", + // "⏰", + // "⏱️", + // "⏲️", + // "⏳", + // "⏸️", + // "⏹️", + // "⏺️", + // "Ⓜ️", + // "▪️", + // "▫️", + // "▶️", + // "◀️", + // "◻️", + // "◼️", + // "◽", + // "◾", + // "☀️", + // "☁️", + // "☂️", + // "☃️", + // "☄️", + // "☎️", + // "☑️", + // "☔", + // "☕", + // "☘️", + // "☝️", + // "☠️", + // "☢️", + // "☣️", + // "☦️", + // "☪️", + // "☮️", + // "☯️", + // "☸️", + // "☹️", + // "☺️", + // "♀️", + // "♂️", + // "♈", + // "♉", + // "♊", + // "♋", + // "♌", + // "♍", + // "♎", + // "♏", + // "♐", + // "♑", + // "♒", + // "♓", + // "♟️", + // "♠️", + // "♣️", + // "♥️", + // "♦️", + // "♨️", + // "♻️", + // "♾️", + // "♿", + // "⚒️", + // "⚓", + // "⚔️", + // "⚕️", + // "⚖️", + // "⚗️", + // "⚙️", + // "⚛️", + // "⚜️", + // "⚠️", + // "⚡", + // "⚧️", + // "⚪", + // "⚫", + // "⚰️", + // "⚱️", + // "⚽", + // "⚾", + // "⛄", + // "⛅", + // "⛈️", + // "⛎", + // "⛏️", + // "⛑️", + // "⛓️", + // "⛔", + // "⛩️", + // "⛪", + // "⛰️", + // "⛱️", + // "⛲", + // "⛳", + // "⛴️", + // "⛵", + // "⛷️", + // "⛸️", + // "⛹️‍♀️", + // "⛹️‍♂️", + // "⛹️", + // "⛺", + // "⛽", + // "✂️", + // "✅", + // "✈️", + // "✉️", + // "✊", + // "✋", + // "✌️", + // "✍️", + // "✏️", + // "✒️", + // "✔️", + // "✖️", + // "✝️", + // "✡️", + // "✨", + // "✳️", + // "✴️", + // "❄️", + // "❇️", + // "❌", + // "❎", + // "❓", + // "❔", + // "❕", + // "❗", + // "❣️", + // "❤️", + // "➕", + // "➖", + // "➗", + // "➡️", + // "➰", + // "➿", + // "⤴️", + // "⤵️", + // "⬅️", + // "⬆️", + // "⬇️", + // "⬛", + // "⬜", + // "⭐", + // "⭕", + // "〰️", + // "〽️", + // "㊗️", + // "㊙️" +] diff --git a/static/common/js/jweixin.js b/static/common/js/jweixin.js new file mode 100644 index 0000000..6002712 --- /dev/null +++ b/static/common/js/jweixin.js @@ -0,0 +1,284 @@ +! function(e, n) { "object" == typeof exports && "object" == typeof module ? module.exports = n(e) : "function" == typeof define && (define.amd || define.cmd) ? define(function() { return n(e) }) : n(e, !0) }(window, function(o, e) { + function c(n, e, i) { o.WeixinJSBridge ? WeixinJSBridge.invoke(n, r(e), function(e) { a(n, e, i) }) : d(n, i) } + + function i(n, i, t) { o.WeixinJSBridge ? WeixinJSBridge.on(n, function(e) { t && t.trigger && t.trigger(e), a(n, e, i) }) : d(n, t || i) } + + function r(e) { return (e = e || {}).appId = M.appId, e.verifyAppId = M.appId, e.verifySignType = "sha1", e.verifyTimestamp = M.timestamp + "", e.verifyNonceStr = M.nonceStr, e.verifySignature = M.signature, e } + + function n(e) { return { timeStamp: e.timestamp + "", nonceStr: e.nonceStr, package: e.package, paySign: e.paySign, signType: e.signType || "SHA1" } } + + function a(e, n, i) { + "openEnterpriseChat" == e && (n.errCode = n.err_code), delete n.err_code, delete n.err_desc, delete n.err_detail; + var t = n.errMsg; + t || (t = n.err_msg, delete n.err_msg, t = function(e, n) { + var i = e, + t = f[i]; + t && (i = t); + var o = "ok"; + if (n) { var r = n.indexOf(":"); "confirm" == (o = n.substring(r + 1)) && (o = "ok"), "failed" == o && (o = "fail"), -1 != o.indexOf("failed_") && (o = o.substring(7)), -1 != o.indexOf("fail_") && (o = o.substring(5)), "access denied" != (o = (o = o.replace(/_/g, " ")).toLowerCase()) && "no permission to execute" != o || (o = "permission denied"), "config" == i && "function not exist" == o && (o = "ok"), "" == o && (o = "fail") } + return n = i + ":" + o + }(e, t), n.errMsg = t), (i = i || {})._complete && (i._complete(n), delete i._complete), t = n.errMsg || "", M.debug && !i.isInnerInvoke && alert(JSON.stringify(n)); + var o = t.indexOf(":"); + switch (t.substring(o + 1)) { + case "ok": + i.success && i.success(n); + break; + case "cancel": + i.cancel && i.cancel(n); + break; + default: + i.fail && i.fail(n) + } + i.complete && i.complete(n) + } + + function s(e) { + if (e) { + for (var n = 0, i = e.length; n < i; ++n) { + var t = e[n], + o = p[t]; + o && (e[n] = o) + } + return e + } + } + + function d(e, n) { + if (!(!M.debug || n && n.isInnerInvoke)) { + var i = f[e]; + i && (e = i), n && n._complete && delete n._complete, + } + } + + function l() { return (new Date).getTime() } + + function u(e) { I && (o.WeixinJSBridge ? e() : t.addEventListener && t.addEventListener("WeixinJSBridgeReady", e, !1)) } + if (!o.jWeixin) { + var p = { config: "preVerifyJSAPI", onMenuShareTimeline: "menu:share:timeline", onMenuShareAppMessage: "menu:share:appmessage", onMenuShareQQ: "menu:share:qq", onMenuShareWeibo: "menu:share:weiboApp", onMenuShareQZone: "menu:share:QZone", previewImage: "imagePreview", getLocation: "geoLocation", openProductSpecificView: "openProductViewWithPid", addCard: "batchAddCard", openCard: "batchViewCard", chooseWXPay: "getBrandWCPayRequest", openEnterpriseRedPacket: "getRecevieBizHongBaoRequest", startSearchBeacons: "startMonitoringBeacons", stopSearchBeacons: "stopMonitoringBeacons", onSearchBeacons: "onBeaconsInRange", consumeAndShareCard: "consumedShareCard", openAddress: "editAddress" }, + f = function() { var e = {}; for (var n in p) e[p[n]] = n; return e }(), + t = o.document, + m = t.title, + g = navigator.userAgent.toLowerCase(), + h = navigator.platform.toLowerCase(), + v = !(!h.match("mac") && !h.match("win")), + S = -1 != g.indexOf("wxdebugger"), + I = -1 != g.indexOf("micromessenger"), + y = -1 != g.indexOf("android"), + _ = -1 != g.indexOf("iphone") || -1 != g.indexOf("ipad"), + w = (O = g.match(/micromessenger\/(\d+\.\d+\.\d+)/) || g.match(/micromessenger\/(\d+\.\d+)/)) ? O[1] : "", + k = { initStartTime: l(), initEndTime: 0, preVerifyStartTime: 0, preVerifyEndTime: 0 }, + T = { version: 1, appId: "", initTime: 0, preVerifyTime: 0, networkType: "", isPreVerifyOk: 1, systemType: _ ? 1 : y ? 2 : -1, clientVersion: w, url: encodeURIComponent(location.href) }, + M = {}, + P = { _completes: [] }, + x = { state: 0, data: {} }; + u(function() { k.initEndTime = l() }); + var A = !1, + V = [], + C = { + config: function(e) { + d("config", M = e); + var t = !1 !== M.check; + u(function() { + if (t) c(p.config, { verifyJsApiList: s(M.jsApiList) }, function() { + P._complete = function(e) { k.preVerifyEndTime = l(), x.state = 1, x.data = e }, P.success = function(e) { T.isPreVerifyOk = 0 }, P.fail = function(e) { P._fail ? P._fail(e) : x.state = -1 }; + var t = P._completes; + return t.push(function() { + ! function(e) { + if (!(v || S || M.debug || w < "6.0.2" || T.systemType < 0)) { + var i = new Image; + T.appId = M.appId, T.initTime = k.initEndTime - k.initStartTime, T.preVerifyTime = k.preVerifyEndTime - k.preVerifyStartTime, C.getNetworkType({ + isInnerInvoke: !0, + success: function(e) { + T.networkType = e.networkType; + var n = "https://open.weixin.qq.com/sdk/report?v=" + T.version + "&o=" + T.isPreVerifyOk + "&s=" + T.systemType + "&c=" + T.clientVersion + "&a=" + T.appId + "&n=" + T.networkType + "&i=" + T.initTime + "&p=" + T.preVerifyTime + "&u=" + T.url; + i.src = n + } + }) + } + }() + }), P.complete = function(e) { + for (var n = 0, i = t.length; n < i; ++n) t[n](); + P._completes = [] + }, P + }()), k.preVerifyStartTime = l(); + else { + x.state = 1; + for (var e = P._completes, n = 0, i = e.length; n < i; ++n) e[n](); + P._completes = [] + } + }), C.invoke || (C.invoke = function(e, n, i) { o.WeixinJSBridge && WeixinJSBridge.invoke(e, r(n), i) }, C.on = function(e, n) { o.WeixinJSBridge && WeixinJSBridge.on(e, n) }) + }, + ready: function(e) { 0 != x.state ? e() : (P._completes.push(e), !I && M.debug && e()) }, + error: function(e) { w < "6.0.2" || (-1 == x.state ? e(x.data) : P._fail = e) }, + checkJsApi: function(e) { + c("checkJsApi", { jsApiList: s(e.jsApiList) }, (e._complete = function(e) { + if (y) { + var n = e.checkResult; + n && (e.checkResult = JSON.parse(n)) + } + e = function(e) { + var n = e.checkResult; + for (var i in n) { + var t = f[i]; + t && (n[t] = n[i], delete n[i]) + } + return e + }(e) + }, e)) + }, + onMenuShareTimeline: function(e) { i(p.onMenuShareTimeline, { complete: function() { c("shareTimeline", { title: e.title || m, desc: e.title || m, img_url: e.imgUrl || "", link: e.link || location.href, type: e.type || "link", data_url: e.dataUrl || "" }, e) } }, e) }, + onMenuShareAppMessage: function(n) { i(p.onMenuShareAppMessage, { complete: function(e) { "favorite" === e.scene ? c("sendAppMessage", { title: n.title || m, desc: n.desc || "", link: n.link || location.href, img_url: n.imgUrl || "", type: n.type || "link", data_url: n.dataUrl || "" }) : c("sendAppMessage", { title: n.title || m, desc: n.desc || "", link: n.link || location.href, img_url: n.imgUrl || "", type: n.type || "link", data_url: n.dataUrl || "" }, n) } }, n) }, + onMenuShareQQ: function(e) { i(p.onMenuShareQQ, { complete: function() { c("shareQQ", { title: e.title || m, desc: e.desc || "", img_url: e.imgUrl || "", link: e.link || location.href }, e) } }, e) }, + onMenuShareWeibo: function(e) { i(p.onMenuShareWeibo, { complete: function() { c("shareWeiboApp", { title: e.title || m, desc: e.desc || "", img_url: e.imgUrl || "", link: e.link || location.href }, e) } }, e) }, + onMenuShareQZone: function(e) { i(p.onMenuShareQZone, { complete: function() { c("shareQZone", { title: e.title || m, desc: e.desc || "", img_url: e.imgUrl || "", link: e.link || location.href }, e) } }, e) }, + updateTimelineShareData: function(e) { c("updateTimelineShareData", { title: e.title, link: e.link, imgUrl: e.imgUrl }, e) }, + updateAppMessageShareData: function(e) { c("updateAppMessageShareData", { title: e.title, desc: e.desc, link: e.link, imgUrl: e.imgUrl }, e) }, + startRecord: function(e) { c("startRecord", {}, e) }, + stopRecord: function(e) { c("stopRecord", {}, e) }, + onVoiceRecordEnd: function(e) { i("onVoiceRecordEnd", e) }, + playVoice: function(e) { c("playVoice", { localId: e.localId }, e) }, + pauseVoice: function(e) { c("pauseVoice", { localId: e.localId }, e) }, + stopVoice: function(e) { c("stopVoice", { localId: e.localId }, e) }, + onVoicePlayEnd: function(e) { i("onVoicePlayEnd", e) }, + uploadVoice: function(e) { c("uploadVoice", { localId: e.localId, isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1 }, e) }, + downloadVoice: function(e) { c("downloadVoice", { serverId: e.serverId, isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1 }, e) }, + translateVoice: function(e) { c("translateVoice", { localId: e.localId, isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1 }, e) }, + chooseImage: function(e) { c("chooseImage", { scene: "1|2", count: e.count || 9, sizeType: e.sizeType || ["original", "compressed"], sourceType: e.sourceType || ["album", "camera"] }, (e._complete = function(e) { if (y) { var n = e.localIds; try { n && (e.localIds = JSON.parse(n)) } catch (e) {} } }, e)) }, + getLocation: function(e) {}, + previewImage: function(e) { c(p.previewImage, { current: e.current, urls: e.urls }, e) }, + uploadImage: function(e) { c("uploadImage", { localId: e.localId, isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1 }, e) }, + downloadImage: function(e) { c("downloadImage", { serverId: e.serverId, isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1 }, e) }, + getLocalImgData: function(e) { + !1 === A ? (A = !0, c("getLocalImgData", { localId: e.localId }, (e._complete = function(e) { + if (A = !1, 0 < V.length) { + var n = V.shift(); + wx.getLocalImgData(n) + } + }, e))) : V.push(e) + }, + getNetworkType: function(e) { + c("getNetworkType", {}, (e._complete = function(e) { + e = function(e) { + var n = e.errMsg; + e.errMsg = "getNetworkType:ok"; + var i = e.subtype; + if (delete e.subtype, i) e.networkType = i; + else { + var t = n.indexOf(":"), + o = n.substring(t + 1); + switch (o) { + case "wifi": + case "edge": + case "wwan": + e.networkType = o; + break; + default: + e.errMsg = "getNetworkType:fail" + } + } + return e + }(e) + }, e)) + }, + openLocation: function(e) { c("openLocation", { latitude: e.latitude, longitude: e.longitude, name: e.name || "", address: e.address || "", scale: e.scale || 28, infoUrl: e.infoUrl || "" }, e) }, + getLocation: function(e) { c(p.getLocation, { type: (e = e || {}).type || "wgs84" }, (e._complete = function(e) { delete e.type }, e)) }, + hideOptionMenu: function(e) { c("hideOptionMenu", {}, e) }, + showOptionMenu: function(e) { c("showOptionMenu", {}, e) }, + closeWindow: function(e) { c("closeWindow", {}, e = e || {}) }, + hideMenuItems: function(e) { c("hideMenuItems", { menuList: e.menuList }, e) }, + showMenuItems: function(e) { c("showMenuItems", { menuList: e.menuList }, e) }, + hideAllNonBaseMenuItem: function(e) { c("hideAllNonBaseMenuItem", {}, e) }, + showAllNonBaseMenuItem: function(e) { c("showAllNonBaseMenuItem", {}, e) }, + scanQRCode: function(e) { + c("scanQRCode", { needResult: (e = e || {}).needResult || 0, scanType: e.scanType || ["qrCode", "barCode"] }, (e._complete = function(e) { + if (_) { + var n = e.resultStr; + if (n) { + var i = JSON.parse(n); + e.resultStr = i && i.scan_code && i.scan_code.scan_result + } + } + }, e)) + }, + openAddress: function(e) { + c(p.openAddress, {}, (e._complete = function(e) { + var n; + (n = e).postalCode = n.addressPostalCode, delete n.addressPostalCode, n.provinceName = n.proviceFirstStageName, delete n.proviceFirstStageName, n.cityName = n.addressCitySecondStageName, delete n.addressCitySecondStageName, n.countryName = n.addressCountiesThirdStageName, delete n.addressCountiesThirdStageName, n.detailInfo = n.addressDetailInfo, delete n.addressDetailInfo, e = n + }, e)) + }, + openProductSpecificView: function(e) { c(p.openProductSpecificView, { pid: e.productId, view_type: e.viewType || 0, ext_info: e.extInfo }, e) }, + addCard: function(e) { + for (var n = e.cardList, i = [], t = 0, o = n.length; t < o; ++t) { + var r = n[t], + a = { card_id: r.cardId, card_ext: r.cardExt }; + i.push(a) + } + c(p.addCard, { card_list: i }, (e._complete = function(e) { + var n = e.card_list; + if (n) { + for (var i = 0, t = (n = JSON.parse(n)).length; i < t; ++i) { + var o = n[i]; + o.cardId = o.card_id, o.cardExt = o.card_ext, o.isSuccess = !!o.is_succ, delete o.card_id, delete o.card_ext, delete o.is_succ + } + e.cardList = n, delete e.card_list + } + }, e)) + }, + chooseCard: function(e) { c("chooseCard", { app_id: M.appId, location_id: e.shopId || "", sign_type: e.signType || "SHA1", card_id: e.cardId || "", card_type: e.cardType || "", card_sign: e.cardSign, time_stamp: e.timestamp + "", nonce_str: e.nonceStr }, (e._complete = function(e) { e.cardList = e.choose_card_info, delete e.choose_card_info }, e)) }, + openCard: function(e) { + for (var n = e.cardList, i = [], t = 0, o = n.length; t < o; ++t) { + var r = n[t], + a = { card_id: r.cardId, code: r.code }; + i.push(a) + } + c(p.openCard, { card_list: i }, e) + }, + consumeAndShareCard: function(e) { c(p.consumeAndShareCard, { consumedCardId: e.cardId, consumedCode: e.code }, e) }, + chooseWXPay: function(e) { c(p.chooseWXPay, n(e), e) }, + openEnterpriseRedPacket: function(e) { c(p.openEnterpriseRedPacket, n(e), e) }, + startSearchBeacons: function(e) { c(p.startSearchBeacons, { ticket: e.ticket }, e) }, + stopSearchBeacons: function(e) { c(p.stopSearchBeacons, {}, e) }, + onSearchBeacons: function(e) { i(p.onSearchBeacons, e) }, + openEnterpriseChat: function(e) { c("openEnterpriseChat", { useridlist: e.userIds, chatname: e.groupName }, e) }, + launchMiniProgram: function(e) { + c("launchMiniProgram", { + targetAppId: e.targetAppId, + path: function(e) { + if ("string" == typeof e && 0 < e.length) { + var n = e.split("?")[0], + i = e.split("?")[1]; + return n += ".html", void 0 !== i ? n + "?" + i : n + } + }(e.path), + envVersion: e.envVersion + }, e) + }, + miniProgram: { navigateBack: function(e) { e = e || {}, u(function() { c("invokeMiniProgramAPI", { name: "navigateBack", arg: { delta: e.delta || 1 } }, e) }) }, navigateTo: function(e) { u(function() { c("invokeMiniProgramAPI", { name: "navigateTo", arg: { url: e.url } }, e) }) }, redirectTo: function(e) { u(function() { c("invokeMiniProgramAPI", { name: "redirectTo", arg: { url: e.url } }, e) }) }, switchTab: function(e) { u(function() { c("invokeMiniProgramAPI", { name: "switchTab", arg: { url: e.url } }, e) }) }, reLaunch: function(e) { u(function() { c("invokeMiniProgramAPI", { name: "reLaunch", arg: { url: e.url } }, e) }) }, postMessage: function(e) { u(function() { c("invokeMiniProgramAPI", { name: "postMessage", arg: e.data || {} }, e) }) }, getEnv: function(e) { u(function() { e({ miniprogram: "miniprogram" === o.__wxjs_environment }) }) } } + }, + L = 1, + B = {}; + return t.addEventListener("error", function(e) { + if (!y) { + var n = e.target, + i = n.tagName, + t = n.src; + if (("IMG" == i || "VIDEO" == i || "AUDIO" == i || "SOURCE" == i) && -1 != t.indexOf("wxlocalresource://")) { + e.preventDefault(), e.stopPropagation(); + var o = n["wx-id"]; + if (o || (o = L++, n["wx-id"] = o), B[o]) return; + B[o] = !0, wx.ready(function() { wx.getLocalImgData({ localId: t, success: function(e) { n.src = e.localData } }) }) + } + } + }, !0), t.addEventListener("load", function(e) { + if (!y) { + var n = e.target, + i = n.tagName; + if (n.src, "IMG" == i || "VIDEO" == i || "AUDIO" == i || "SOURCE" == i) { + var t = n["wx-id"]; + t && (B[t] = !1) + } + } + }, !0), e && (o.wx = o.jWeixin = C), C + } + var O +}); \ No newline at end of file diff --git a/static/common/js/router.js b/static/common/js/router.js new file mode 100644 index 0000000..bf2d8ac --- /dev/null +++ b/static/common/js/router.js @@ -0,0 +1,53 @@ +import config from "./config.js" +const initApp = function(vm) { + /** + * 页面跳转拦截器 + */ + let that = vm; + let list = ["navigateTo", "redirectTo", "reLaunch", "switchTab"]; + list.forEach(item => { //用遍历的方式分别为,uni.navigateTo,uni.redirectTo,uni.reLaunch,uni.switchTab这4个路由方法添加拦截器 + uni.addInterceptor(item, { + invoke(e) { // 调用前拦截 + //获取用户的token + // console.log(e) + const token = that.vuex_token, + //获取要跳转的页面路径(url去掉"?"和"?"后的参数) + url = e.url.split('?')[0]; + let notNeed = config.whiteList.includes(url) + // 如果在whiteList里面就不需要登录 + // console.log(notNeed) + + if (notNeed) { + return e + } else { + //需要登录 + if (token == '') { + // uni.showToast({ + // title: '请先登录', + // icon: 'none' + // }) + uni.navigateTo({ + url: config.loginPage + }) + return false + } else { + return e + } + } + + }, + fail(err) { // 失败回调拦截 + console.log(err) + // if (Debug) { + // uni.showModal({ + // content: JSON.stringify(err), + // showCancel: false + // }); + // } + } + }) + }) +} +export default { + initApp: initApp +} \ No newline at end of file diff --git a/static/common/js/touch-emulator.js b/static/common/js/touch-emulator.js new file mode 100644 index 0000000..9632413 --- /dev/null +++ b/static/common/js/touch-emulator.js @@ -0,0 +1,363 @@ +(function(window, document, exportName, undefined) { + "use strict"; + + var isMultiTouch = false; + var multiTouchStartPos; + var eventTarget; + var touchElements = {}; + + // polyfills + if(!document.createTouch) { + document.createTouch = function(view, target, identifier, pageX, pageY, screenX, screenY, clientX, clientY) { + // auto set + if(clientX == undefined || clientY == undefined) { + clientX = pageX - window.pageXOffset; + clientY = pageY - window.pageYOffset; + } + + return new Touch(target, identifier, { + pageX: pageX, + pageY: pageY, + screenX: screenX, + screenY: screenY, + clientX: clientX, + clientY: clientY + }); + }; + } + + if(!document.createTouchList) { + document.createTouchList = function() { + var touchList = new TouchList(); + for (var i = 0; i < arguments.length; i++) { + touchList[i] = arguments[i]; + } + touchList.length = arguments.length; + return touchList; + }; + } + + /** + * create an touch point + * @constructor + * @param target + * @param identifier + * @param pos + * @param deltaX + * @param deltaY + * @returns {Object} touchPoint + */ + function Touch(target, identifier, pos, deltaX, deltaY) { + deltaX = deltaX || 0; + deltaY = deltaY || 0; + + this.identifier = identifier; + this.target = target; + this.clientX = pos.clientX + deltaX; + this.clientY = pos.clientY + deltaY; + this.screenX = pos.screenX + deltaX; + this.screenY = pos.screenY + deltaY; + this.pageX = pos.pageX + deltaX; + this.pageY = pos.pageY + deltaY; + } + + /** + * create empty touchlist with the methods + * @constructor + * @returns touchList + */ + function TouchList() { + var touchList = []; + + touchList.item = function(index) { + return this[index] || null; + }; + + // specified by Mozilla + touchList.identifiedTouch = function(id) { + return this[id + 1] || null; + }; + + return touchList; + } + + + /** + * Simple trick to fake touch event support + * this is enough for most libraries like Modernizr and Hammer + */ + function fakeTouchSupport() { + var objs = [window, document.documentElement]; + var props = ['ontouchstart', 'ontouchmove', 'ontouchcancel', 'ontouchend']; + + for(var o=0; o 2; // pointer events + } + + /** + * disable mouseevents on the page + * @param ev + */ + function preventMouseEvents(ev) { + // 注释启用默认事件 + // ev.preventDefault(); + // ev.stopPropagation(); + } + + /** + * only trigger touches when the left mousebutton has been pressed + * @param touchType + * @returns {Function} + */ + function onMouse(touchType) { + return function(ev) { + // prevent mouse events + preventMouseEvents(ev); + + if (ev.which !== 1) { + return; + } + + // The EventTarget on which the touch point started when it was first placed on the surface, + // even if the touch point has since moved outside the interactive area of that element. + // also, when the target doesnt exist anymore, we update it + if (ev.type == 'mousedown' || !eventTarget || (eventTarget && !eventTarget.dispatchEvent)) { + eventTarget = ev.target; + } + + // shiftKey has been lost, so trigger a touchend + if (isMultiTouch && !ev.shiftKey) { + triggerTouch('touchend', ev); + isMultiTouch = false; + } + + triggerTouch(touchType, ev); + + // we're entering the multi-touch mode! + if (!isMultiTouch && ev.shiftKey) { + isMultiTouch = true; + multiTouchStartPos = { + pageX: ev.pageX, + pageY: ev.pageY, + clientX: ev.clientX, + clientY: ev.clientY, + screenX: ev.screenX, + screenY: ev.screenY + }; + triggerTouch('touchstart', ev); + } + + // reset + if (ev.type == 'mouseup') { + multiTouchStartPos = null; + isMultiTouch = false; + eventTarget = null; + } + } + } + + /** + * trigger a touch event + * @param eventName + * @param mouseEv + */ + function triggerTouch(eventName, mouseEv) { + var touchEvent = document.createEvent('Event'); + touchEvent.initEvent(eventName, true, true); + + touchEvent.altKey = mouseEv.altKey; + touchEvent.ctrlKey = mouseEv.ctrlKey; + touchEvent.metaKey = mouseEv.metaKey; + touchEvent.shiftKey = mouseEv.shiftKey; + + touchEvent.touches = getActiveTouches(mouseEv, eventName); + touchEvent.targetTouches = getActiveTouches(mouseEv, eventName); + touchEvent.changedTouches = getChangedTouches(mouseEv, eventName); + + eventTarget.dispatchEvent(touchEvent); + } + + /** + * create a touchList based on the mouse event + * @param mouseEv + * @returns {TouchList} + */ + function createTouchList(mouseEv) { + var touchList = new TouchList(); + + if (isMultiTouch) { + var f = TouchEmulator.multiTouchOffset; + var deltaX = multiTouchStartPos.pageX - mouseEv.pageX; + var deltaY = multiTouchStartPos.pageY - mouseEv.pageY; + + touchList.push(new Touch(eventTarget, 1, multiTouchStartPos, (deltaX*-1) - f, (deltaY*-1) + f)); + touchList.push(new Touch(eventTarget, 2, multiTouchStartPos, deltaX+f, deltaY-f)); + } else { + touchList.push(new Touch(eventTarget, 1, mouseEv, 0, 0)); + } + + return touchList; + } + + /** + * receive all active touches + * @param mouseEv + * @returns {TouchList} + */ + function getActiveTouches(mouseEv, eventName) { + // empty list + if (mouseEv.type == 'mouseup') { + return new TouchList(); + } + + var touchList = createTouchList(mouseEv); + if(isMultiTouch && mouseEv.type != 'mouseup' && eventName == 'touchend') { + touchList.splice(1, 1); + } + return touchList; + } + + /** + * receive a filtered set of touches with only the changed pointers + * @param mouseEv + * @param eventName + * @returns {TouchList} + */ + function getChangedTouches(mouseEv, eventName) { + var touchList = createTouchList(mouseEv); + + // we only want to return the added/removed item on multitouch + // which is the second pointer, so remove the first pointer from the touchList + // + // but when the mouseEv.type is mouseup, we want to send all touches because then + // no new input will be possible + if(isMultiTouch && mouseEv.type != 'mouseup' && + (eventName == 'touchstart' || eventName == 'touchend')) { + touchList.splice(0, 1); + } + + return touchList; + } + + /** + * show the touchpoints on the screen + */ + function showTouches(ev) { + var touch, i, el, styles; + + // first all visible touches + for(i = 0; i < ev.touches.length; i++) { + touch = ev.touches[i]; + el = touchElements[touch.identifier]; + if(!el) { + el = touchElements[touch.identifier] = document.createElement("div"); + document.body.appendChild(el); + } + + styles = TouchEmulator.template(touch); + for(var prop in styles) { + el.style[prop] = styles[prop]; + } + } + + // remove all ended touches + if(ev.type == 'touchend' || ev.type == 'touchcancel') { + for(i = 0; i < ev.changedTouches.length; i++) { + touch = ev.changedTouches[i]; + el = touchElements[touch.identifier]; + if(el) { + el.parentNode.removeChild(el); + delete touchElements[touch.identifier]; + } + } + } + } + + /** + * TouchEmulator initializer + */ + function TouchEmulator() { + if (hasTouchSupport()) { + return; + } + + fakeTouchSupport(); + + window.addEventListener("mousedown", onMouse('touchstart'), true); + window.addEventListener("mousemove", onMouse('touchmove'), true); + window.addEventListener("mouseup", onMouse('touchend'), true); + + window.addEventListener("mouseenter", preventMouseEvents, true); + window.addEventListener("mouseleave", preventMouseEvents, true); + window.addEventListener("mouseout", preventMouseEvents, true); + window.addEventListener("mouseover", preventMouseEvents, true); + + // it uses itself! + window.addEventListener("touchstart", showTouches, true); + window.addEventListener("touchmove", showTouches, true); + window.addEventListener("touchend", showTouches, true); + window.addEventListener("touchcancel", showTouches, true); + } + + // start distance when entering the multitouch mode + TouchEmulator.multiTouchOffset = 75; + + /** + * css template for the touch rendering + * @param touch + * @returns object + */ + TouchEmulator.template = function(touch) { + var size = 0; + var transform = 'translate('+ (touch.clientX-(size/2)) +'px, '+ (touch.clientY-(size/2)) +'px)'; + return { + position: 'fixed', + left: 0, + top: 0, + background: '#fff', + border: 'solid 1px #999', + opacity: .6, + borderRadius: '100%', + height: size + 'px', + width: size + 'px', + padding: 0, + margin: 0, + display: 'block', + overflow: 'hidden', + pointerEvents: 'none', + webkitUserSelect: 'none', + mozUserSelect: 'none', + userSelect: 'none', + webkitTransform: transform, + mozTransform: transform, + transform: transform, + zIndex: 100 + } + }; + + // export + if (typeof define == "function" && define.amd) { + define(function() { + return TouchEmulator; + }); + } else if (typeof module != "undefined" && module.exports) { + module.exports = TouchEmulator; + } else { + window[exportName] = TouchEmulator; + } +})(window, document, "TouchEmulator"); \ No newline at end of file diff --git a/static/common/tabbar/AlumniCircle.png b/static/common/tabbar/AlumniCircle.png new file mode 100644 index 0000000..ec09563 Binary files /dev/null and b/static/common/tabbar/AlumniCircle.png differ diff --git a/static/common/tabbar/findFriends.png b/static/common/tabbar/findFriends.png new file mode 100644 index 0000000..5c1e894 Binary files /dev/null and b/static/common/tabbar/findFriends.png differ diff --git a/static/common/tabbar/index.png b/static/common/tabbar/index.png new file mode 100644 index 0000000..b016fa1 Binary files /dev/null and b/static/common/tabbar/index.png differ diff --git a/static/common/tabbar/message.png b/static/common/tabbar/message.png new file mode 100644 index 0000000..f3f62f5 Binary files /dev/null and b/static/common/tabbar/message.png differ diff --git a/static/common/tabbar/my.png b/static/common/tabbar/my.png new file mode 100644 index 0000000..5d1e582 Binary files /dev/null and b/static/common/tabbar/my.png differ diff --git a/static/common/tabbar/selectAlumniCircle.png b/static/common/tabbar/selectAlumniCircle.png new file mode 100644 index 0000000..dd61469 Binary files /dev/null and b/static/common/tabbar/selectAlumniCircle.png differ diff --git a/static/common/tabbar/selectFindFridend.png b/static/common/tabbar/selectFindFridend.png new file mode 100644 index 0000000..776da53 Binary files /dev/null and b/static/common/tabbar/selectFindFridend.png differ diff --git a/static/common/tabbar/selectindex.png b/static/common/tabbar/selectindex.png new file mode 100644 index 0000000..3421b85 Binary files /dev/null and b/static/common/tabbar/selectindex.png differ diff --git a/static/common/tabbar/selectmessage.png b/static/common/tabbar/selectmessage.png new file mode 100644 index 0000000..0e9072d Binary files /dev/null and b/static/common/tabbar/selectmessage.png differ diff --git a/static/common/tabbar/selectmy.png b/static/common/tabbar/selectmy.png new file mode 100644 index 0000000..11dab5f Binary files /dev/null and b/static/common/tabbar/selectmy.png differ diff --git a/static/uview/common/favicon.ico b/static/uview/common/favicon.ico new file mode 100644 index 0000000..e0af368 Binary files /dev/null and b/static/uview/common/favicon.ico differ diff --git a/static/uview/common/logo.png b/static/uview/common/logo.png new file mode 100644 index 0000000..05b3aed Binary files /dev/null and b/static/uview/common/logo.png differ diff --git a/static/uview/example/component.png b/static/uview/example/component.png new file mode 100644 index 0000000..09bd020 Binary files /dev/null and b/static/uview/example/component.png differ diff --git a/static/uview/example/component_select.png b/static/uview/example/component_select.png new file mode 100644 index 0000000..3d704a8 Binary files /dev/null and b/static/uview/example/component_select.png differ diff --git a/static/uview/example/js.png b/static/uview/example/js.png new file mode 100644 index 0000000..b904664 Binary files /dev/null and b/static/uview/example/js.png differ diff --git a/static/uview/example/js_bak.png b/static/uview/example/js_bak.png new file mode 100644 index 0000000..d280e3d Binary files /dev/null and b/static/uview/example/js_bak.png differ diff --git a/static/uview/example/js_select.png b/static/uview/example/js_select.png new file mode 100644 index 0000000..9411c91 Binary files /dev/null and b/static/uview/example/js_select.png differ diff --git a/static/uview/example/js_select_bak.png b/static/uview/example/js_select_bak.png new file mode 100644 index 0000000..2ea6122 Binary files /dev/null and b/static/uview/example/js_select_bak.png differ diff --git a/static/uview/example/min_button.png b/static/uview/example/min_button.png new file mode 100644 index 0000000..077eb43 Binary files /dev/null and b/static/uview/example/min_button.png differ diff --git a/static/uview/example/min_button_select.png b/static/uview/example/min_button_select.png new file mode 100644 index 0000000..703a8bd Binary files /dev/null and b/static/uview/example/min_button_select.png differ diff --git a/static/uview/example/template.png b/static/uview/example/template.png new file mode 100644 index 0000000..5d27f97 Binary files /dev/null and b/static/uview/example/template.png differ diff --git a/static/uview/example/template_select.png b/static/uview/example/template_select.png new file mode 100644 index 0000000..be4b338 Binary files /dev/null and b/static/uview/example/template_select.png differ diff --git a/store/$u.mixin.js b/store/$u.mixin.js new file mode 100644 index 0000000..61ae187 --- /dev/null +++ b/store/$u.mixin.js @@ -0,0 +1,27 @@ +import { mapState } from 'vuex' +import store from "@/store" + +// 尝试将用户在根目录中的store/index.js的vuex的state变量,全部加载到全局变量中 +let $uStoreKey = []; +try{ + $uStoreKey = store.state ? Object.keys(store.state) : []; +}catch(e){ + +} + +module.exports = { + beforeCreate() { + // 将vuex方法挂在到$u中 + // 使用方法为:如果要修改vuex的state中的user.name变量为"史诗" => this.$u.vuex('user.name', '史诗') + // 如果要修改vuex的state的version变量为1.0.1 => this.$u.vuex('version', '1.0.1') + this.$u.vuex = (name, value) => { + this.$store.commit('$uStore', { + name,value + }) + } + }, + computed: { + // 将vuex的state中的所有变量,解构到全局混入的mixin中 + ...mapState($uStoreKey) + } +} \ No newline at end of file diff --git a/store/index.js b/store/index.js new file mode 100644 index 0000000..92c522d --- /dev/null +++ b/store/index.js @@ -0,0 +1,113 @@ +import Vue from 'vue' +import Vuex from 'vuex' + +Vue.use(Vuex) + +let lifeData = {}; + +try { + // 尝试获取本地是否存在lifeData变量,第一次启动APP时是不存在的 + lifeData = uni.getStorageSync('lifeData'); +} catch (e) { + +} + +// 需要永久存储,且下次APP启动需要取出的,在state中的变量名 +let saveStateKeys = ['vuex_user', 'vuex_token', 'vuex_msgList', 'vuex_glyType', 'vuex_userLocation','vuex_userInfo','vuex_user_hobby']; + +// 保存变量到本地存储中 +const saveLifeData = function (key, value) { + // 判断变量名是否在需要存储的数组中 + if (saveStateKeys.indexOf(key) != -1) { + // 获取本地存储的lifeData对象,将变量添加到对象中 + let tmp = uni.getStorageSync('lifeData'); + // 第一次打开APP,不存在lifeData变量,故放一个{}空对象 + tmp = tmp ? tmp : {}; + tmp[key] = value; + // 执行这一步后,所有需要存储的变量,都挂载在本地的lifeData对象中 + uni.setStorageSync('lifeData', tmp); + } +} +const store = new Vuex.Store({ + state: { + // 如果上面从本地获取的lifeData对象下有对应的属性,就赋值给state中对应的变量 + // 加上vuex_前缀,是防止变量名冲突,也让人一目了然 + vuex_user: lifeData.vuex_user ? lifeData.vuex_user : '', + vuex_token: lifeData.vuex_token ? lifeData.vuex_token : '', + vuex_glyType: lifeData.vuex_glyType ? lifeData.vuex_glyType : '', + vuex_userLocation: lifeData.vuex_userLocation ? lifeData.vuex_userLocation : '', + vuex_user_hobby:lifeData.vuex_user_hobby?lifeData.vuex_user_hobby:'', + vuex_hobby:'', + // 如果vuex_version无需保存到本地永久存储,无需lifeData.vuex_version方式 + vuex_version: '1.0.1', + vuex_msgList: lifeData.vuex_msgList ? lifeData.vuex_msgList : '', + // 自定义tabbar数据 + vuex_iPhone: lifeData.vuex_iPhone ? lifeData.vuex_iPhone : false, + // tabbar相关配置 + vuex_tabbar_config: { + activeColor: '#3CB5FB', + inactiveColor: '#666666' + }, + vuex_tabbar: [{ + pagePath: "/pages/home/home/home", + iconPath: "/static/common/tabbar/index.png", + selectedIconPath: "/static/common/tabbar/selectindex.png", + text: "首页" + }, + { + pagePath: "/pages/message/msgList/msgList", + iconPath: "/static/common/tabbar/message.png", + selectedIconPath: "/static/common/tabbar/selectmessage.png", + // count: 2, //提示数量 + isDot: lifeData.vuex_msgList ? true : false, //显示红色小点 + text: "消息" + }, + { + pagePath: "/pages/main/index/index", + iconPath: "/static/common/tabbar/findFriends.png", + selectedIconPath: "/static/common/tabbar/selectFindFridend.png", + text: "找校友" + }, + { + pagePath: "/pages/AlumniCircle/alumnus/alumnus", + iconPath: "/static/common/tabbar/AlumniCircle.png", + selectedIconPath: "/static/common/tabbar/selectAlumniCircle.png", + text: "校友圈" + }, + + { + pagePath: "/pages/my/my/my", + iconPath: "/static/common/tabbar/my.png", + selectedIconPath: "/static/common/tabbar/selectmy.png", + text: "我的" + } + ], + vuex_education: [], + vuex_schoolName: "", + vuex_userInfo: lifeData.vuex_userInfo ? lifeData.vuex_userInfo :'' + }, + mutations: { + $uStore(state, payload) { + // 判断是否多层级调用,state中为对象存在的情况,诸如user.info.score = 1 + let nameArr = payload.name.split('.'); + let saveKey = ''; + let len = nameArr.length; + if (len >= 2) { + let obj = state[nameArr[0]]; + for (let i = 1; i < len - 1; i++) { + obj = obj[nameArr[i]]; + } + obj[nameArr[len - 1]] = payload.value; + saveKey = nameArr[0]; + } else { + // 单层级变量,在state就是一个普通变量的情况 + state[payload.name] = payload.value; + saveKey = payload.name; + } + // 保存变量到本地,见顶部函数定义 + saveLifeData(saveKey, state[saveKey]) + } + } +}) + +export default store diff --git a/template.h5.html b/template.h5.html new file mode 100644 index 0000000..aa677bd --- /dev/null +++ b/template.h5.html @@ -0,0 +1,54 @@ + + + + + + + + + <%= htmlWebpackPlugin.options.title %> + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + diff --git a/uni.scss b/uni.scss new file mode 100644 index 0000000..8c223a7 --- /dev/null +++ b/uni.scss @@ -0,0 +1,7 @@ +/** + * 下方引入的为uView UI的集成样式文件,为scss预处理器,其中包含了一些"u-"开头的自定义变量 + * 使用的时候,请将下面的一行复制到您的uniapp项目根目录的uni.scss中即可 + * uView自定义的css类名和scss变量,均以"u-"开头,不会造成冲突,请放心使用 + */ +@import 'uview-ui/theme.scss'; + diff --git a/uni_modules/Lyuan-SignalR/changelog.md b/uni_modules/Lyuan-SignalR/changelog.md new file mode 100644 index 0000000..37d932e --- /dev/null +++ b/uni_modules/Lyuan-SignalR/changelog.md @@ -0,0 +1,12 @@ +## 1.3.5(2021-12-03) +更新文档,新增链接失败,断开重试示例 +## 1.3.4(2021-12-03) +更新文档 +## 1.3.3(2021-12-02) +更新文档,新增链接失败,断开重试示例 +## 1.3.2(2021-12-02) +更新文档,新增链接失败,断开重试示例 +## 1.3.1(2021-02-26) +* 更新兼容SSE, LongPolling +* 更新支持uni_modules, +* 更新示例项目 diff --git a/uni_modules/Lyuan-SignalR/js_sdk/signalr.js b/uni_modules/Lyuan-SignalR/js_sdk/signalr.js new file mode 100644 index 0000000..fc56d4b --- /dev/null +++ b/uni_modules/Lyuan-SignalR/js_sdk/signalr.js @@ -0,0 +1,9 @@ +/** + * @overview ASP.NET Core SignalR JavaScript Client. + * @version 0.0.0-DEV_BUILD. + * @license + * Copyright (c) .NET Foundation. All rights reserved. + * Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + */ +(function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?module.exports=factory():typeof define==="function"&&define.amd?define(factory):global.signalR=factory()})(this,function(){"use strict";function unwrapExports(x){return x&&x.__esModule&&Object.prototype.hasOwnProperty.call(x,"default")?x["default"]:x}function createCommonjsModule(fn,module){return module={exports:{}},fn(module,module.exports),module.exports}var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return extendStatics(d,b)};function __extends(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}var __assign=function(){__assign=Object.assign||function __assign(t){for(var s,i=1,n=arguments.length;i=0;i--)if(d=decorators[i])r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r;return c>3&&r&&Object.defineProperty(target,key,r),r}function __param(paramIndex,decorator){return function(target,key){decorator(target,key,paramIndex)}}function __metadata(metadataKey,metadataValue){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(metadataKey,metadataValue)}function __awaiter(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator["throw"](value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})}function __generator(thisArg,body){var _={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},f,y,t,g;return g={next:verb(0),throw:verb(1),return:verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]=o.length)o=void 0;return{value:o&&o[i++],done:!o}}};throw new TypeError(s?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read(o,n){var m=typeof Symbol==="function"&&o[Symbol.iterator];if(!m)return o;var i=m.call(o),r,ar=[],e;try{while((n===void 0||n-- >0)&&!(r=i.next()).done)ar.push(r.value)}catch(error){e={error:error}}finally{try{if(r&&!r.done&&(m=i["return"]))m.call(i)}finally{if(e)throw e.error}}return ar}function __spread(){for(var ar=[],i=0;i1||resume(n,v)})}}function resume(n,v){try{step(g[n](v))}catch(e){settle(q[0][3],e)}}function step(r){r.value instanceof __await?Promise.resolve(r.value.v).then(fulfill,reject):settle(q[0][2],r)}function fulfill(value){resume("next",value)}function reject(value){resume("throw",value)}function settle(f,v){if(f(v),q.shift(),q.length)resume(q[0][0],q[0][1])}}function __asyncDelegator(o){var i,p;return i={},verb("next"),verb("throw",function(e){throw e}),verb("return"),i[Symbol.iterator]=function(){return this},i;function verb(n,f){i[n]=o[n]?function(v){return(p=!p)?{value:__await(o[n](v)),done:n==="return"}:f?f(v):v}:f}}function __asyncValues(o){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var m=o[Symbol.asyncIterator],i;return m?m.call(o):(o=typeof __values==="function"?__values(o):o[Symbol.iterator](),i={},verb("next"),verb("throw"),verb("return"),i[Symbol.asyncIterator]=function(){return this},i);function verb(n){i[n]=o[n]&&function(v){return new Promise(function(resolve,reject){v=o[n](v),settle(resolve,reject,v.done,v.value)})}}function settle(resolve,reject,d,v){Promise.resolve(v).then(function(v){resolve({value:v,done:d})},reject)}}function __makeTemplateObject(cooked,raw){if(Object.defineProperty){Object.defineProperty(cooked,"raw",{value:raw})}else{cooked.raw=raw}return cooked}function __importStar(mod){if(mod&&mod.__esModule)return mod;var result={};if(mod!=null)for(var k in mod)if(Object.hasOwnProperty.call(mod,k))result[k]=mod[k];result.default=mod;return result}function __importDefault(mod){return mod&&mod.__esModule?mod:{default:mod}}function __classPrivateFieldGet(receiver,privateMap){if(!privateMap.has(receiver)){throw new TypeError("attempted to get private field on non-instance")}return privateMap.get(receiver)}function __classPrivateFieldSet(receiver,privateMap,value){if(!privateMap.has(receiver)){throw new TypeError("attempted to set private field on non-instance")}privateMap.set(receiver,value);return value}var tslib_1=Object.freeze({__extends:__extends,get __assign(){return __assign},__rest:__rest,__decorate:__decorate,__param:__param,__metadata:__metadata,__awaiter:__awaiter,__generator:__generator,__createBinding:__createBinding,__exportStar:__exportStar,__values:__values,__read:__read,__spread:__spread,__spreadArrays:__spreadArrays,__await:__await,__asyncGenerator:__asyncGenerator,__asyncDelegator:__asyncDelegator,__asyncValues:__asyncValues,__makeTemplateObject:__makeTemplateObject,__importStar:__importStar,__importDefault:__importDefault,__classPrivateFieldGet:__classPrivateFieldGet,__classPrivateFieldSet:__classPrivateFieldSet});var Errors=createCommonjsModule(function(module,exports){Object.defineProperty(exports,"__esModule",{value:true});var HttpError=function(_super){tslib_1.__extends(HttpError,_super);function HttpError(errorMessage,statusCode){var _newTarget=this.constructor;var _this=this;var trueProto=_newTarget.prototype;_this=_super.call(this,errorMessage)||this;_this.statusCode=statusCode;_this.__proto__=trueProto;return _this}return HttpError}(Error);exports.HttpError=HttpError;var TimeoutError=function(_super){tslib_1.__extends(TimeoutError,_super);function TimeoutError(errorMessage){var _newTarget=this.constructor;if(errorMessage===void 0){errorMessage="A timeout occurred."}var _this=this;var trueProto=_newTarget.prototype;_this=_super.call(this,errorMessage)||this;_this.__proto__=trueProto;return _this}return TimeoutError}(Error);exports.TimeoutError=TimeoutError});unwrapExports(Errors);var Errors_1=Errors.HttpError;var Errors_2=Errors.TimeoutError;var ILogger=createCommonjsModule(function(module,exports){Object.defineProperty(exports,"__esModule",{value:true});var LogLevel;(function(LogLevel){LogLevel[LogLevel["Trace"]=0]="Trace";LogLevel[LogLevel["Debug"]=1]="Debug";LogLevel[LogLevel["Information"]=2]="Information";LogLevel[LogLevel["Warning"]=3]="Warning";LogLevel[LogLevel["Error"]=4]="Error";LogLevel[LogLevel["Critical"]=5]="Critical";LogLevel[LogLevel["None"]=6]="None"})(LogLevel=exports.LogLevel||(exports.LogLevel={}))});unwrapExports(ILogger);var ILogger_1=ILogger.LogLevel;var HttpClient_1=createCommonjsModule(function(module,exports){Object.defineProperty(exports,"__esModule",{value:true});var HttpResponse=function(){function HttpResponse(statusCode,statusText,content){this.statusCode=statusCode;this.statusText=statusText;this.content=content}return HttpResponse}();exports.HttpResponse=HttpResponse;var HttpClient=function(){function HttpClient(){}HttpClient.prototype.get=function(url,options){return this.send(tslib_1.__assign({},options,{method:"GET",url:url}))};HttpClient.prototype.post=function(url,options){return this.send(tslib_1.__assign({},options,{method:"POST",url:url}))};HttpClient.prototype.delete=function(url,options){return this.send(tslib_1.__assign({},options,{method:"DELETE",url:url}))};return HttpClient}();exports.HttpClient=HttpClient;var DefaultHttpClient=function(_super){tslib_1.__extends(DefaultHttpClient,_super);function DefaultHttpClient(logger){var _this=_super.call(this)||this;_this.logger=logger;return _this}DefaultHttpClient.prototype.send=function(request){var _this=this;return new Promise(function(resolve,reject){var headers={"X-Requested-With":"XMLHttpRequest"};var responseType="text";if(request.headers){Object.keys(request.headers).forEach(function(header){headers[header]=request.headers[header]})}if(request.responseType){responseType=request.responseType}uni.request({url:request.url,data:request.content||"",header:headers,method:request.method,responseType:responseType,withCredentials:true,timeout:request.timeout||5e3,success:function(res){if(request.abortSignal){request.abortSignal.onabort=null}var statusText=res.errMsg.split(":")[1];var responseText=JSON.stringify(res.data);if(typeof res.data=="object"){responseText=JSON.stringify(res.data)}else{responseText=res.data}if(res.statusCode>=200&&res.statusCode<300){resolve(new HttpResponse(res.statusCode,statusText,responseText))}else{reject(new Errors.HttpError(responseText,res.statusCode))}},fail:function(res){if(res.errMsg.includes("timeout")){_this.logger.log(ILogger.LogLevel.Warning,"Timeout from HTTP request.");reject(new Errors.TimeoutError)}else{_this.logger.log(ILogger.LogLevel.Warning,"Error from HTTP request. "+res.statusCode+": "+res.errMsg);reject(new Errors.HttpError(res.errMsg,res.statusCode))}},complete:function(){}})})};return DefaultHttpClient}(HttpClient);exports.DefaultHttpClient=DefaultHttpClient});unwrapExports(HttpClient_1);var HttpClient_2=HttpClient_1.HttpResponse;var HttpClient_3=HttpClient_1.HttpClient;var HttpClient_4=HttpClient_1.DefaultHttpClient;var TextMessageFormat_1=createCommonjsModule(function(module,exports){Object.defineProperty(exports,"__esModule",{value:true});var TextMessageFormat=function(){function TextMessageFormat(){}TextMessageFormat.write=function(output){return""+output+TextMessageFormat.RecordSeparator};TextMessageFormat.parse=function(input){if(input[input.length-1]!==TextMessageFormat.RecordSeparator){throw new Error("Message is incomplete.")}var messages=input.split(TextMessageFormat.RecordSeparator);messages.pop();return messages};TextMessageFormat.RecordSeparatorCode=30;TextMessageFormat.RecordSeparator=String.fromCharCode(TextMessageFormat.RecordSeparatorCode);return TextMessageFormat}();exports.TextMessageFormat=TextMessageFormat});unwrapExports(TextMessageFormat_1);var TextMessageFormat_2=TextMessageFormat_1.TextMessageFormat;var HandshakeProtocol_1=createCommonjsModule(function(module,exports){Object.defineProperty(exports,"__esModule",{value:true});var HandshakeProtocol=function(){function HandshakeProtocol(){}HandshakeProtocol.prototype.writeHandshakeRequest=function(handshakeRequest){return TextMessageFormat_1.TextMessageFormat.write(JSON.stringify(handshakeRequest))};HandshakeProtocol.prototype.parseHandshakeResponse=function(data){var responseMessage;var messageData;var remainingData;if(data instanceof ArrayBuffer){var binaryData=new Uint8Array(data);var separatorIndex=binaryData.indexOf(TextMessageFormat_1.TextMessageFormat.RecordSeparatorCode);if(separatorIndex===-1){throw new Error("Message is incomplete.")}var responseLength=separatorIndex+1;messageData=String.fromCharCode.apply(null,binaryData.slice(0,responseLength));remainingData=binaryData.byteLength>responseLength?binaryData.slice(responseLength).buffer:null}else{var textData=data;var separatorIndex=textData.indexOf(TextMessageFormat_1.TextMessageFormat.RecordSeparator);if(separatorIndex===-1){throw new Error("Message is incomplete.")}var responseLength=separatorIndex+1;messageData=textData.substring(0,responseLength);remainingData=textData.length>responseLength?textData.substring(responseLength):null}var messages=TextMessageFormat_1.TextMessageFormat.parse(messageData);responseMessage=JSON.parse(messages[0]);return[remainingData,responseMessage]};return HandshakeProtocol}();exports.HandshakeProtocol=HandshakeProtocol});unwrapExports(HandshakeProtocol_1);var HandshakeProtocol_2=HandshakeProtocol_1.HandshakeProtocol;var IHubProtocol=createCommonjsModule(function(module,exports){Object.defineProperty(exports,"__esModule",{value:true});var MessageType;(function(MessageType){MessageType[MessageType["Invocation"]=1]="Invocation";MessageType[MessageType["StreamItem"]=2]="StreamItem";MessageType[MessageType["Completion"]=3]="Completion";MessageType[MessageType["StreamInvocation"]=4]="StreamInvocation";MessageType[MessageType["CancelInvocation"]=5]="CancelInvocation";MessageType[MessageType["Ping"]=6]="Ping";MessageType[MessageType["Close"]=7]="Close"})(MessageType=exports.MessageType||(exports.MessageType={}))});unwrapExports(IHubProtocol);var IHubProtocol_1=IHubProtocol.MessageType;var Loggers=createCommonjsModule(function(module,exports){Object.defineProperty(exports,"__esModule",{value:true});var NullLogger=function(){function NullLogger(){}NullLogger.prototype.log=function(logLevel,message){};NullLogger.instance=new NullLogger;return NullLogger}();exports.NullLogger=NullLogger});unwrapExports(Loggers);var Loggers_1=Loggers.NullLogger;var Utils=createCommonjsModule(function(module,exports){Object.defineProperty(exports,"__esModule",{value:true});var Arg=function(){function Arg(){}Arg.isRequired=function(val,name){if(val===null||val===undefined){throw new Error("The '"+name+"' argument is required.")}};Arg.isIn=function(val,values,name){if(!(val in values)){throw new Error("Unknown "+name+" value: "+val+".")}};return Arg}();exports.Arg=Arg;function getDataDetail(data,includeContent){var length=null;if(data instanceof ArrayBuffer){length="Binary data of length "+data.byteLength;if(includeContent){length+=". Content: '"+formatArrayBuffer(data)+"'"}}else if(typeof data==="string"){length="String data of length "+data.length;if(includeContent){length+=". Content: '"+data+"'."}}return length}exports.getDataDetail=getDataDetail;function formatArrayBuffer(data){var view=new Uint8Array(data);var str="";view.forEach(function(num){var pad=num<16?"0":"";str+="0x"+pad+num.toString(16)+" "});return str.substr(0,str.length-1)}exports.formatArrayBuffer=formatArrayBuffer;function sendMessage(logger,transportName,httpClient,url,accessTokenFactory,content,logMessageContent){return tslib_1.__awaiter(this,void 0,void 0,function(){var _a,headers,token,response;return tslib_1.__generator(this,function(_b){switch(_b.label){case 0:return[4,accessTokenFactory()];case 1:token=_b.sent();if(token){headers=(_a={},_a["Authorization"]="Bearer "+token,_a)}logger.log(ILogger.LogLevel.Trace,"("+transportName+" transport) sending data. "+getDataDetail(content,logMessageContent)+".");return[4,httpClient.post(url,{content:content,headers:headers})];case 2:response=_b.sent();logger.log(ILogger.LogLevel.Trace,"("+transportName+" transport) request complete. Response status: "+response.statusCode+".");return[2]}})})}exports.sendMessage=sendMessage;function createLogger(logger){if(logger===undefined){return new ConsoleLogger(ILogger.LogLevel.Information)}if(logger===null){return Loggers.NullLogger.instance}if(logger.log){return logger}return new ConsoleLogger(logger)}exports.createLogger=createLogger;var Subject=function(){function Subject(cancelCallback){this.observers=[];this.cancelCallback=cancelCallback}Subject.prototype.next=function(item){for(var _i=0,_a=this.observers;_i<_a.length;_i++){var observer=_a[_i];observer.next(item)}};Subject.prototype.error=function(err){for(var _i=0,_a=this.observers;_i<_a.length;_i++){var observer=_a[_i];if(observer.error){observer.error(err)}}};Subject.prototype.complete=function(){for(var _i=0,_a=this.observers;_i<_a.length;_i++){var observer=_a[_i];if(observer.complete){observer.complete()}}};Subject.prototype.subscribe=function(observer){this.observers.push(observer);return new SubjectSubscription(this,observer)};return Subject}();exports.Subject=Subject;var SubjectSubscription=function(){function SubjectSubscription(subject,observer){this.subject=subject;this.observer=observer}SubjectSubscription.prototype.dispose=function(){var index=this.subject.observers.indexOf(this.observer);if(index>-1){this.subject.observers.splice(index,1)}if(this.subject.observers.length===0){this.subject.cancelCallback().catch(function(_){})}};return SubjectSubscription}();exports.SubjectSubscription=SubjectSubscription;var ConsoleLogger=function(){function ConsoleLogger(minimumLogLevel){this.minimumLogLevel=minimumLogLevel}ConsoleLogger.prototype.log=function(logLevel,message){if(logLevel>=this.minimumLogLevel){switch(logLevel){case ILogger.LogLevel.Critical:case ILogger.LogLevel.Error:console.error(ILogger.LogLevel[logLevel]+": "+message);break;case ILogger.LogLevel.Warning:console.warn(ILogger.LogLevel[logLevel]+": "+message);break;case ILogger.LogLevel.Information:console.info(ILogger.LogLevel[logLevel]+": "+message);break;default:console.log(ILogger.LogLevel[logLevel]+": "+message);break}}};return ConsoleLogger}();exports.ConsoleLogger=ConsoleLogger});unwrapExports(Utils);var Utils_1=Utils.Arg;var Utils_2=Utils.getDataDetail;var Utils_3=Utils.formatArrayBuffer;var Utils_4=Utils.sendMessage;var Utils_5=Utils.createLogger;var Utils_6=Utils.Subject;var Utils_7=Utils.SubjectSubscription;var Utils_8=Utils.ConsoleLogger;var HubConnection_1=createCommonjsModule(function(module,exports){Object.defineProperty(exports,"__esModule",{value:true});var DEFAULT_TIMEOUT_IN_MS=30*1e3;var HubConnection=function(){function HubConnection(connection,logger,protocol){var _this=this;Utils.Arg.isRequired(connection,"connection");Utils.Arg.isRequired(logger,"logger");Utils.Arg.isRequired(protocol,"protocol");this.serverTimeoutInMilliseconds=DEFAULT_TIMEOUT_IN_MS;this.logger=logger;this.protocol=protocol;this.connection=connection;this.handshakeProtocol=new HandshakeProtocol_1.HandshakeProtocol;this.connection.onreceive=function(data){return _this.processIncomingData(data)};this.connection.onclose=function(error){return _this.connectionClosed(error)};this.callbacks={};this.methods={};this.closedCallbacks=[];this.id=0}HubConnection.create=function(connection,logger,protocol){return new HubConnection(connection,logger,protocol)};HubConnection.prototype.start=function(){return tslib_1.__awaiter(this,void 0,void 0,function(){var handshakeRequest;return tslib_1.__generator(this,function(_a){switch(_a.label){case 0:handshakeRequest={protocol:this.protocol.name,version:this.protocol.version};this.logger.log(ILogger.LogLevel.Debug,"Starting HubConnection.");this.receivedHandshakeResponse=false;return[4,this.connection.start(this.protocol.transferFormat)];case 1:_a.sent();this.logger.log(ILogger.LogLevel.Debug,"Sending handshake request.");return[4,this.connection.send(this.handshakeProtocol.writeHandshakeRequest(handshakeRequest))];case 2:_a.sent();this.logger.log(ILogger.LogLevel.Information,"Using HubProtocol '"+this.protocol.name+"'.");this.cleanupTimeout();this.configureTimeout();return[2]}})})};HubConnection.prototype.stop=function(){this.logger.log(ILogger.LogLevel.Debug,"Stopping HubConnection.");this.cleanupTimeout();return this.connection.stop()};HubConnection.prototype.stream=function(methodName){var _this=this;var args=[];for(var _i=1;_i"));this.onclose(closeError)}this.logger.log(ILogger.LogLevel.Trace,"(LongPolling transport) Transport finished.");return[7];case 9:return[2]}})})};LongPollingTransport.prototype.send=function(data){return tslib_1.__awaiter(this,void 0,void 0,function(){return tslib_1.__generator(this,function(_a){if(!this.running){return[2,Promise.reject(new Error("Cannot send until the transport is connected"))]}return[2,Utils.sendMessage(this.logger,"LongPolling",this.httpClient,this.url,this.accessTokenFactory,data,this.logMessageContent)]})})};LongPollingTransport.prototype.stop=function(){return tslib_1.__awaiter(this,void 0,void 0,function(){var deleteOptions,token,response;var _this=this;return tslib_1.__generator(this,function(_a){switch(_a.label){case 0:_a.trys.push([0,,3,4]);this.running=false;this.logger.log(ILogger.LogLevel.Trace,"(LongPolling transport) sending DELETE request to "+this.url+".");deleteOptions={headers:{}};return[4,this.accessTokenFactory()];case 1:token=_a.sent();this.updateHeaderToken(deleteOptions,token);return[4,this.httpClient.delete(this.url,deleteOptions)];case 2:response=_a.sent();this.logger.log(ILogger.LogLevel.Trace,"(LongPolling transport) DELETE request accepted.");return[3,4];case 3:if(!this.stopped){this.shutdownTimer=setTimeout(function(){_this.logger.log(ILogger.LogLevel.Warning,"(LongPolling transport) server did not terminate after DELETE request, canceling poll.");_this.pollAbort.abort()},this.shutdownTimeout)}return[7];case 4:return[2]}})})};return LongPollingTransport}();exports.LongPollingTransport=LongPollingTransport});unwrapExports(LongPollingTransport_1);var LongPollingTransport_2=LongPollingTransport_1.LongPollingTransport;var ServerSentEventsTransport_1=createCommonjsModule(function(module,exports){Object.defineProperty(exports,"__esModule",{value:true});var ServerSentEventsTransport=function(){function ServerSentEventsTransport(httpClient,accessTokenFactory,logger,logMessageContent){this.httpClient=httpClient;this.accessTokenFactory=accessTokenFactory||function(){return null};this.logger=logger;this.logMessageContent=logMessageContent}ServerSentEventsTransport.prototype.connect=function(url,transferFormat){return tslib_1.__awaiter(this,void 0,void 0,function(){var token;var _this=this;return tslib_1.__generator(this,function(_a){switch(_a.label){case 0:Utils.Arg.isRequired(url,"url");Utils.Arg.isRequired(transferFormat,"transferFormat");Utils.Arg.isIn(transferFormat,ITransport.TransferFormat,"transferFormat");if(typeof EventSource==="undefined"){throw new Error("'EventSource' is not supported in your environment.")}this.logger.log(ILogger.LogLevel.Trace,"(SSE transport) Connecting");return[4,this.accessTokenFactory()];case 1:token=_a.sent();if(token){url+=(url.indexOf("?")<0?"?":"&")+("access_token="+encodeURIComponent(token))}this.url=url;return[2,new Promise(function(resolve,reject){var opened=false;if(transferFormat!==ITransport.TransferFormat.Text){reject(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"))}var eventSource=new EventSource(url,{withCredentials:true});try{eventSource.onmessage=function(e){if(_this.onreceive){try{_this.logger.log(ILogger.LogLevel.Trace,"(SSE transport) data received. "+Utils.getDataDetail(e.data,_this.logMessageContent)+".");_this.onreceive(e.data)}catch(error){if(_this.onclose){_this.onclose(error)}return}}};eventSource.onerror=function(e){var error=new Error(e.message||"Error occurred");if(opened){_this.close(error)}else{reject(error)}};eventSource.onopen=function(){_this.logger.log(ILogger.LogLevel.Information,"SSE connected to "+_this.url);_this.eventSource=eventSource;opened=true;resolve()}}catch(e){return Promise.reject(e)}})]}})})};ServerSentEventsTransport.prototype.send=function(data){return tslib_1.__awaiter(this,void 0,void 0,function(){return tslib_1.__generator(this,function(_a){if(!this.eventSource){return[2,Promise.reject(new Error("Cannot send until the transport is connected"))]}return[2,Utils.sendMessage(this.logger,"SSE",this.httpClient,this.url,this.accessTokenFactory,data,this.logMessageContent)]})})};ServerSentEventsTransport.prototype.stop=function(){this.close();return Promise.resolve()};ServerSentEventsTransport.prototype.close=function(e){if(this.eventSource){this.eventSource.close();this.eventSource=null;if(this.onclose){this.onclose(e)}}};return ServerSentEventsTransport}();exports.ServerSentEventsTransport=ServerSentEventsTransport});unwrapExports(ServerSentEventsTransport_1);var ServerSentEventsTransport_2=ServerSentEventsTransport_1.ServerSentEventsTransport;var WebSocketTransport_1=createCommonjsModule(function(module,exports){Object.defineProperty(exports,"__esModule",{value:true});var WebSocketTransport=function(){function WebSocketTransport(accessTokenFactory,logger,logMessageContent){this.logger=logger;this.accessTokenFactory=accessTokenFactory||function(){return null};this.logMessageContent=logMessageContent}WebSocketTransport.prototype.connect=function(url,transferFormat){return tslib_1.__awaiter(this,void 0,void 0,function(){var token;var _this=this;return tslib_1.__generator(this,function(_a){switch(_a.label){case 0:Utils.Arg.isRequired(url,"url");Utils.Arg.isRequired(transferFormat,"transferFormat");Utils.Arg.isIn(transferFormat,ITransport.TransferFormat,"transferFormat");if(typeof WebSocket==="undefined"){throw new Error("'WebSocket' is not supported in your environment.")}this.logger.log(ILogger.LogLevel.Trace,"(WebSockets transport) Connecting");return[4,this.accessTokenFactory()];case 1:token=_a.sent();if(token){url+=(url.indexOf("?")<0?"?":"&")+("access_token="+encodeURIComponent(token))}return[2,new Promise(function(resolve,reject){url=url.replace(/^http/,"ws");var webSocket=uni.connectSocket({url:url,complete:function(){console.log("uniapp websocket connect completed")}});if(transferFormat===ITransport.TransferFormat.Binary){webSocket.binaryType="arraybuffer"}webSocket.onOpen(function(event){_this.logger.log(ILogger.LogLevel.Information,"WebSocket connected to "+url);_this.webSocket=webSocket;resolve()});webSocket.onError(function(event){reject(event.error)});webSocket.onMessage(function(message){_this.logger.log(ILogger.LogLevel.Trace,"(WebSockets transport) data received. "+Utils.getDataDetail(message.data,_this.logMessageContent)+".");if(_this.onreceive){_this.onreceive(message.data)}});webSocket.onClose(function(event){_this.logger.log(ILogger.LogLevel.Trace,"(WebSockets transport) socket closed.");if(_this.onclose){if(event.wasClean===false||event.code!==1e3){_this.onclose(new Error("Websocket closed with status code: "+event.code+" ("+event.reason+")"))}else{_this.onclose()}}})})]}})})};WebSocketTransport.prototype.send=function(data){if(this.webSocket&&this.webSocket.readyState===WebSocket.OPEN){this.logger.log(ILogger.LogLevel.Trace,"(WebSockets transport) sending data. "+Utils.getDataDetail(data,this.logMessageContent)+".");this.webSocket.send({data:data});return Promise.resolve()}return Promise.reject("WebSocket is not in the OPEN state")};WebSocketTransport.prototype.stop=function(){if(this.webSocket){this.webSocket.close();this.webSocket=null}return Promise.resolve()};return WebSocketTransport}();exports.WebSocketTransport=WebSocketTransport});unwrapExports(WebSocketTransport_1);var WebSocketTransport_2=WebSocketTransport_1.WebSocketTransport;var HttpConnection_1=createCommonjsModule(function(module,exports){Object.defineProperty(exports,"__esModule",{value:true});var MAX_REDIRECTS=100;var HttpConnection=function(){function HttpConnection(url,options){if(options===void 0){options={}}this.features={};Utils.Arg.isRequired(url,"url");this.logger=Utils.createLogger(options.logger);this.baseUrl=this.resolveUrl(url);options=options||{};options.accessTokenFactory=options.accessTokenFactory||function(){return null};options.logMessageContent=options.logMessageContent||false;this.httpClient=options.httpClient||new HttpClient_1.DefaultHttpClient(this.logger);this.connectionState=2;this.options=options}HttpConnection.prototype.start=function(transferFormat){transferFormat=transferFormat||ITransport.TransferFormat.Binary;Utils.Arg.isIn(transferFormat,ITransport.TransferFormat,"transferFormat");this.logger.log(ILogger.LogLevel.Debug,"Starting connection with transfer format '"+ITransport.TransferFormat[transferFormat]+"'.");if(this.connectionState!==2){return Promise.reject(new Error("Cannot start a connection that is not in the 'Disconnected' state."))}this.connectionState=0;this.startPromise=this.startInternal(transferFormat);return this.startPromise};HttpConnection.prototype.send=function(data){if(this.connectionState!==1){throw new Error("Cannot send data if the connection is not in the 'Connected' State.")}return this.transport.send(data)};HttpConnection.prototype.stop=function(error){return tslib_1.__awaiter(this,void 0,void 0,function(){var e_1;return tslib_1.__generator(this,function(_a){switch(_a.label){case 0:this.connectionState=2;_a.label=1;case 1:_a.trys.push([1,3,,4]);return[4,this.startPromise];case 2:_a.sent();return[3,4];case 3:e_1=_a.sent();return[3,4];case 4:if(!this.transport)return[3,6];this.stopError=error;return[4,this.transport.stop()];case 5:_a.sent();this.transport=null;_a.label=6;case 6:return[2]}})})};HttpConnection.prototype.startInternal=function(transferFormat){return tslib_1.__awaiter(this,void 0,void 0,function(){var url,negotiateResponse,redirects,_loop_1,this_1,state_1,e_2;var _this=this;return tslib_1.__generator(this,function(_a){switch(_a.label){case 0:url=this.baseUrl;this.accessTokenFactory=this.options.accessTokenFactory;_a.label=1;case 1:_a.trys.push([1,12,,13]);if(!this.options.skipNegotiation)return[3,5];if(!(this.options.transport===ITransport.HttpTransportType.WebSockets))return[3,3];this.transport=this.constructTransport(ITransport.HttpTransportType.WebSockets);return[4,this.transport.connect(url,transferFormat)];case 2:_a.sent();return[3,4];case 3:throw Error("Negotiation can only be skipped when using the WebSocket transport directly.");case 4:return[3,11];case 5:negotiateResponse=null;redirects=0;_loop_1=function(){var accessToken_1;return tslib_1.__generator(this,function(_a){switch(_a.label){case 0:return[4,this_1.getNegotiationResponse(url)];case 1:negotiateResponse=_a.sent();if(this_1.connectionState===2){return[2,{value:void 0}]}if(negotiateResponse.url){url=negotiateResponse.url}if(negotiateResponse.accessToken){accessToken_1=negotiateResponse.accessToken;this_1.accessTokenFactory=function(){return accessToken_1}}redirects++;return[2]}})};this_1=this;_a.label=6;case 6:return[5,_loop_1()];case 7:state_1=_a.sent();if(typeof state_1==="object")return[2,state_1.value];_a.label=8;case 8:if(negotiateResponse.url&&redirects=0){if(transport===ITransport.HttpTransportType.WebSockets&&typeof WebSocket==="undefined"||transport===ITransport.HttpTransportType.ServerSentEvents&&typeof EventSource==="undefined"){this.logger.log(ILogger.LogLevel.Debug,"Skipping transport '"+ITransport.HttpTransportType[transport]+"' because it is not supported in your environment.'")}else{this.logger.log(ILogger.LogLevel.Debug,"Selecting transport '"+ITransport.HttpTransportType[transport]+"'");return transport}}else{this.logger.log(ILogger.LogLevel.Debug,"Skipping transport '"+ITransport.HttpTransportType[transport]+"' because it does not support the requested transfer format '"+ITransport.TransferFormat[requestedTransferFormat]+"'.")}}else{this.logger.log(ILogger.LogLevel.Debug,"Skipping transport '"+ITransport.HttpTransportType[transport]+"' because it was disabled by the client.")}}return null};HttpConnection.prototype.isITransport=function(transport){return transport&&typeof transport==="object"&&"connect"in transport};HttpConnection.prototype.changeState=function(from,to){if(this.connectionState===from){this.connectionState=to;return true}return false};HttpConnection.prototype.stopConnection=function(error){return tslib_1.__awaiter(this,void 0,void 0,function(){return tslib_1.__generator(this,function(_a){this.transport=null;error=this.stopError||error;if(error){this.logger.log(ILogger.LogLevel.Error,"Connection disconnected with error '"+error+"'.")}else{this.logger.log(ILogger.LogLevel.Information,"Connection disconnected.")}this.connectionState=2;if(this.onclose){this.onclose(error)}return[2]})})};HttpConnection.prototype.resolveUrl=function(url){if(url.lastIndexOf("https://",0)===0||url.lastIndexOf("http://",0)===0){return url}if(typeof window==="undefined"||!window||!window.document){throw new Error("Cannot resolve '"+url+"'.")}var aTag=window.document.createElement("a");aTag.href=url;this.logger.log(ILogger.LogLevel.Information,"Normalizing '"+url+"' to '"+aTag.href+"'.");return aTag.href};HttpConnection.prototype.resolveNegotiateUrl=function(url){var index=url.indexOf("?");var negotiateUrl=url.substring(0,index===-1?url.length:index);if(negotiateUrl[negotiateUrl.length-1]!=="/"){negotiateUrl+="/"}negotiateUrl+="negotiate";negotiateUrl+=index===-1?"":url.substring(index);return negotiateUrl};return HttpConnection}();exports.HttpConnection=HttpConnection;function transportMatches(requestedTransport,actualTransport){return!requestedTransport||(actualTransport&requestedTransport)!==0}});unwrapExports(HttpConnection_1);var HttpConnection_2=HttpConnection_1.HttpConnection;var JsonHubProtocol_1=createCommonjsModule(function(module,exports){Object.defineProperty(exports,"__esModule",{value:true});var JSON_HUB_PROTOCOL_NAME="json";var JsonHubProtocol=function(){function JsonHubProtocol(){this.name=JSON_HUB_PROTOCOL_NAME;this.version=1;this.transferFormat=ITransport.TransferFormat.Text}JsonHubProtocol.prototype.parseMessages=function(input,logger){if(typeof input!=="string"){throw new Error("Invalid input for JSON hub protocol. Expected a string.")}if(!input){return[]}if(logger===null){logger=Loggers.NullLogger.instance}var messages=TextMessageFormat_1.TextMessageFormat.parse(input);var hubMessages=[];for(var _i=0,messages_1=messages;_i { + // return 'token'; + // } + }) + .configureLogging(LogLevel.Trace) + .build(); + + //接收消息 + connection.on("ReceiveMessage", function (user, message) { + ; + }); + + //发送消息, 需在链接成功后调用 + //connection.invoke('方法名',参数) + + //链接断开 + connection.on/close(function () { //去掉斜杠 + ; + //重试 + start(ms); + }); + + const ms = 5000; + const start = (timer) => { + setTimeout(() => { + try { + connection + .start() + .then(() => { + ; + }) + .catch((e) => { + //重试 + // console.log("websocket连接失败", e); + start(ms); + }); + } catch (e) { + //重试 + start(ms); + } + }, timer); + }; + + //开始连接 + start(0); + +``` + + +###觉得有用的话,可直接打赏或微信 + \ No newline at end of file diff --git a/uni_modules/Sansnn-uQRCode/LICENSE.md b/uni_modules/Sansnn-uQRCode/LICENSE.md new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/uni_modules/Sansnn-uQRCode/LICENSE.md @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + 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: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) 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 + + (d) 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 + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. diff --git a/uni_modules/Sansnn-uQRCode/README.md b/uni_modules/Sansnn-uQRCode/README.md new file mode 100644 index 0000000..77d7925 --- /dev/null +++ b/uni_modules/Sansnn-uQRCode/README.md @@ -0,0 +1,392 @@ +# 介绍 + +`uQRCode`是一款基于`Javascript`环境开发的二维码生成插件,适用所有`Javascript`运行环境的前端应用和`Node.js`应用。 + +`uQRCode`可扩展性高,它支持自定义渲染二维码,可通过`uQRCode API`得到二维码绘制关键信息后,使用`canvas`、`svg`或`js`操作`dom`的方式绘制二维码图案。还可自定义二维码样式,如随机颜色、圆点、方块、块与块之间的间距等。 + +欢迎加入群聊【uQRCode交流群】:[695070434](https://jq.qq.com/?_wv=1027&k=JRjzDqiw)。 + +# 设计器 + +uQRCode发布了配套的可视化设计器,可根据自己喜好在设计器中设计二维码样式,一键生成配置代码复制到项目中,详情请在微信小程序搜索“柚子二维码”,或扫描下方小程序码体验。 + +![uQRCode设计器](https://uqrcode.cn/mp_weixin_code.jpg) + +## 设计器模板示例 + +![uQRCode设计器](https://uqrcode.cn/yz_1.png) +![uQRCode设计器](https://uqrcode.cn/yz_2.png) +![uQRCode设计器](https://uqrcode.cn/yz_3.png) +![uQRCode设计器](https://uqrcode.cn/yz_4.png) +![uQRCode设计器](https://uqrcode.cn/yz_5.png) +![uQRCode设计器](https://uqrcode.cn/yz_6.png) +![uQRCode设计器](https://uqrcode.cn/yz_7.png) +![uQRCode设计器](https://uqrcode.cn/yz_8.png) +![uQRCode设计器](https://uqrcode.cn/yz_9.png) + +# 快速上手 + +> 在`uni-app`中,我们更推荐使用组件方式来生成二维码,组件方式大大提高了页面的可读性以及避开了一些平台容易出问题的地方,当组件无法满足需求的时候,再考虑切换成原生方式。 + +官方文档:[https://uqrcode.cn/doc](https://uqrcode.cn/doc)。 + +github地址:[https://github.com/Sansnn/uQRCode](https://github.com/Sansnn/uQRCode)。 + +npm地址:[https://www.npmjs.com/package/uqrcodejs](https://www.npmjs.com/package/uqrcodejs)。 + +uni-app插件市场地址:[https://ext.dcloud.net.cn/plugin?id=1287](https://ext.dcloud.net.cn/plugin?id=1287)。 + +## 原生方式 + +原生方式仅需要获取`uqrcode.js`文件便可使用。详细配置请移步到:文档 > [原生](https://uqrcode.cn/doc/document/native.html)。 + +### 安装 + +1. 通过`npm`安装,成功后即可使用`import`或`require`进行引用。 +``` bash +# npm安装 +npm install uqrcodejs +# 或者 +npm install @uqrcode/js +``` + +2. 通过项目开源地址获取`uqrcode.js`,下载`uqrcode.js`后,将其复制到您项目指定目录,在页面中引入`uqrcode.js`文件即可开始使用。 + +### 引入 + +- 通过`import`引入。 +``` javascript +// npm安装 +import UQRCode from 'uqrcodejs'; // npm install uqrcodejs +// 或者 +import UQRCode from '@uqrcode/js'; // npm install @uqrcode/js +``` + +- `Node.js`通过`require`引入。 +``` javascript +// npm安装 +const UQRCode = require('uqrcodejs'); // npm install uqrcodejs +// 或者 +const UQRCode = require('@uqrcode/js'); // npm install @uqrcode/js +``` + +- 原生浏览器环境,在js脚本加载时添加到`window`。 +``` html + + +``` + +### 简单用法 + +`uQRCode`基于`Canvas API`封装了一套方法,建议开发者使用`canvas`生成,一键调用,非常方便。以下是示例: + +- HTML示例 + - DOM部分 + ``` html + + ``` + + - JS部分 + ``` javascript + // 获取uQRCode实例 + var qr = new UQRCode(); + // 设置二维码内容 + qr.data = "https://uqrcode.cn/doc"; + // 设置二维码大小,必须与canvas设置的宽高一致 + qr.size = 200; + // 调用制作二维码方法 + qr.make(); + // 获取canvas元素 + var canvas = document.getElementById("qrcode"); + // 获取canvas上下文 + var canvasContext = canvas.getContext("2d"); + // 设置uQRCode实例的canvas上下文 + qr.canvasContext = canvasContext; + // 调用绘制方法将二维码图案绘制到canvas上 + qr.drawCanvas(); + ``` + +- uni-app示例 + - Template部分 + ``` html + + ``` + + - JS部分 + ``` javascript + onReady() { + // 获取uQRCode实例 + var qr = new UQRCode(); + // 设置二维码内容 + qr.data = "https://uqrcode.cn/doc"; + // 设置二维码大小,必须与canvas设置的宽高一致 + qr.size = 200; + // 调用制作二维码方法 + qr.make(); + // 获取canvas上下文 + var canvasContext = uni.createCanvasContext('qrcode', this); // 如果是组件,this必须传入 + // 设置uQRCode实例的canvas上下文 + qr.canvasContext = canvasContext; + // 调用绘制方法将二维码图案绘制到canvas上 + qr.drawCanvas(); + } + ``` + +- 微信小程序,推荐使用Canvas 2D,关于Canvas 2D的使用请参考微信开放文档。 + +### 高级用法 + +考虑到部分平台可能不支持`canvas`,所以`uQRCode`并没有强制要求和`canvas`一起使用,您还可以选择其他方式来生成二维码,例如使用`js`操作`dom`进行绘制或是使用`svg`绘制等。以下是示例: + +- uni-app v-for+view + +```html + + + +``` + +- js操作dom + +``` html + + + + + uQRCode二维码生成 + + +
+ + + + +``` + +- svg +``` html + + + + + uQRCode二维码生成 + + + + + + + +``` + +> 更多用法大家自行探索咯,期待分享哟~ + +### 导出临时文件路径 + +原生方式基于`Canvas`的,请自行参阅各平台`Canvas`的导出方式。以下是部分示例: + +- uni-app +```javascript +// 通过uni.createCanvasContext方式创建绘制上下文的,对应导出API为uni.canvasToTempFilePath +// 调用完ctx.draw()方法后不能第一时间导出,否则会异常,需要有一定的延时 +setTimeout(() => { + uni.canvasToTempFilePath( + { + canvasId: this.canvasId, + fileType: this.fileType, + width: this.canvasWidth, + height: this.canvasHeight, + success: res => { + console.log(res); + }, + fail: err => { + console.log(err); + } + }, + // this // 组件内使用必传当前实例 + ); +}, 300); +``` + +- Canvas2D +```javascript +// 得到base64 +console.log(canvas.toDataURL()); +// 得到buffer +console.log(canvas.toBuffer()); +``` + +### 保存二维码到本地相册 + +必须在导出临时文件路径成功后再执行保存。uni-app通用保存方式(H5除外): +```javascript +uni.saveImageToPhotosAlbum({ + filePath: tempFilePath, + success: res => { + console.log(res); + }, + fail: err => { + console.log(err); + } +}); +``` + +H5可以通过设置``标签`href`属性的方式进行保存: +```javascript +const aEle = document.createElement('a'); +aEle.download = 'uQRCode'; // 设置下载的文件名,默认是'下载' +aEle.href = tempFilePath; +document.body.appendChild(aEle); +aEle.click(); +aEle.remove(); // 下载之后把创建的元素删除 +``` +经过测试,PC端浏览器可以下载,部分安卓自带或第三方浏览器可以下载,安卓微信浏览器不适用,移动端iOS所有浏览器均不适用,差异较大,还是推荐各位导出文件给图片组件显示,然后提示用户通过长按图片进行保存这种方式。 + +## uni-app组件方式 + +### 安装 + +通过uni-app插件市场地址安装:[https://ext.dcloud.net.cn/plugin?id=1287](https://ext.dcloud.net.cn/plugin?id=1287)。详细配置请移步到:文档 > [uni-app组件](https://uqrcode.cn/doc/document/uni-app.html)。 + +### 引入 + +uni-app默认为easycom模式,可直接键入``标签。 + +### 简单用法 + +安装`uqrcode`组件后,在`template`中键入``。设置`ref`属性可使用组件内部方法,`canvas-id`属性为组件内部的canvas组件标识,`value`属性为二维码生成对应内容,`options`为配置选项,可配置二维码样式,绘制Logo等,详见:[options](https://uqrcode.cn/doc/document/uni-app.html#options) 。 + +``` html + +``` + +### 导出临时文件路径 + +为了保证方法调用成功,请在 [complete](https://uqrcode.cn/doc/document/uni-app.html#complete) 事件返回`success=true`后调用。 + +```javascript +// uqrcode为组件的ref名称 +this.$refs.uqrcode.toTempFilePath({ + success: res => { + console.log(res); + } +}); +``` + +### 保存二维码到本地相册 + +为了保证方法调用成功,请在 [complete](https://uqrcode.cn/doc/document/uni-app.html#complete) 事件返回`success=true`后调用。 + +```javascript +// uqrcode为组件的ref名称 +this.$refs.uqrcode.save({ + success: () => { + uni.showToast({ + icon: 'success', + title: '保存成功' + }); + } +}); +``` + +## 更多使用说明请前往官方文档查看:[https://uqrcode.cn/doc](https://uqrcode.cn/doc)。 \ No newline at end of file diff --git a/uni_modules/Sansnn-uQRCode/changelog.md b/uni_modules/Sansnn-uQRCode/changelog.md new file mode 100644 index 0000000..74a6e4c --- /dev/null +++ b/uni_modules/Sansnn-uQRCode/changelog.md @@ -0,0 +1,12 @@ +## 4.0.6(2022-12-12) +修复`getDrawModules`,第一次获取结果正常,后续获取`tile`模块不存在的问题; +修复安卓type:normal因Canvas API使用了小数或为0的参数导致生成异常的问题(注:安卓非2d Canvas部分API参数不支持携带小数,部分API参数必须大于0)。 +## 4.0.1(2022-11-28) +优化组件loading属性的表现; +新增组件type选项normal,以便于在某些条件编译初始为type=2d时还可以选择使用非2d组件类型; +修复组件条件编译在其他编辑器语法提示报错; +修复原生对es5的支持。 +## 4.0.0(2022-11-21) +v4版本源代码全面开放,开源地址:[https://github.com/Sansnn/uQRCode](https://github.com/Sansnn/uQRCode); + +升级说明:v4为大版本更新,虽然已尽可能兼容上一代版本,但不可避免的还是存在一些细节差异,若更新后出现问题,请参考对照[v3 文档](https://uqrcode.cn/doc/v3),[v4 文档](https://uqrcode.cn/doc)进行修改。 diff --git a/uni_modules/Sansnn-uQRCode/common/cache.js b/uni_modules/Sansnn-uQRCode/common/cache.js new file mode 100644 index 0000000..d897d26 --- /dev/null +++ b/uni_modules/Sansnn-uQRCode/common/cache.js @@ -0,0 +1 @@ +export const cacheImageList = []; \ No newline at end of file diff --git a/uni_modules/Sansnn-uQRCode/common/queue.js b/uni_modules/Sansnn-uQRCode/common/queue.js new file mode 100644 index 0000000..be6b1d2 --- /dev/null +++ b/uni_modules/Sansnn-uQRCode/common/queue.js @@ -0,0 +1,41 @@ +function Queue() { + let waitingQueue = this.waitingQueue = []; + let isRunning = this.isRunning = false; // 记录是否有未完成的任务 + + function execute(task, resolve, reject) { + task() + .then((data) => { + resolve(data); + }) + .catch((e) => { + reject(e); + }) + .finally(() => { + // 等待任务队列中如果有任务,则触发它;否则设置isRunning = false,表示无任务状态 + if (waitingQueue.length) { + const next = waitingQueue.shift(); + execute(next.task, next.resolve, next.reject); + } else { + isRunning = false; + } + }); + } + this.exec = function(task) { + return new Promise((resolve, reject) => { + if (isRunning) { + waitingQueue.push({ + task, + resolve, + reject + }); + } else { + isRunning = true; + execute(task, resolve, reject); + } + }); + } +} + +/* 队列实例,某些平台一起使用多个组件时需要通过队列逐一绘制,否则部分绘制方法异常,nvue端的iOS gcanvas尤其明显,在不通过队列绘制时会出现图片丢失的情况 */ +export const queueDraw = new Queue(); +export const queueLoadImage = new Queue(); \ No newline at end of file diff --git a/uni_modules/Sansnn-uQRCode/common/types/cache.d.ts b/uni_modules/Sansnn-uQRCode/common/types/cache.d.ts new file mode 100644 index 0000000..9b6c3ce --- /dev/null +++ b/uni_modules/Sansnn-uQRCode/common/types/cache.d.ts @@ -0,0 +1,3 @@ +declare module '*/common/cache' { + export const cacheImageList: Array; +} \ No newline at end of file diff --git a/uni_modules/Sansnn-uQRCode/common/types/queue.d.ts b/uni_modules/Sansnn-uQRCode/common/types/queue.d.ts new file mode 100644 index 0000000..f81ab97 --- /dev/null +++ b/uni_modules/Sansnn-uQRCode/common/types/queue.d.ts @@ -0,0 +1,4 @@ +declare module '*/common/queue' { + export const queueDraw: any; + export const queueLoadImage: any; +} \ No newline at end of file diff --git a/uni_modules/Sansnn-uQRCode/components/u-qrcode/u-qrcode.vue b/uni_modules/Sansnn-uQRCode/components/u-qrcode/u-qrcode.vue new file mode 100644 index 0000000..4fefaac --- /dev/null +++ b/uni_modules/Sansnn-uQRCode/components/u-qrcode/u-qrcode.vue @@ -0,0 +1,1131 @@ + + + + + diff --git a/uni_modules/Sansnn-uQRCode/components/uqrcode/uqrcode.vue b/uni_modules/Sansnn-uQRCode/components/uqrcode/uqrcode.vue new file mode 100644 index 0000000..4fefaac --- /dev/null +++ b/uni_modules/Sansnn-uQRCode/components/uqrcode/uqrcode.vue @@ -0,0 +1,1131 @@ + + + + + diff --git a/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/bridge/bridge-weex.js b/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/bridge/bridge-weex.js new file mode 100644 index 0000000..27086ec --- /dev/null +++ b/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/bridge/bridge-weex.js @@ -0,0 +1,241 @@ +const isWeex = typeof WXEnvironment !== 'undefined'; +const isWeexIOS = isWeex && /ios/i.test(WXEnvironment.platform); +const isWeexAndroid = isWeex && !isWeexIOS; + +import GLmethod from '../context-webgl/GLmethod'; + +const GCanvasModule = + (typeof weex !== 'undefined' && weex.requireModule) ? (weex.requireModule('gcanvas')) : + (typeof __weex_require__ !== 'undefined') ? (__weex_require__('@weex-module/gcanvas')) : {}; + +let isDebugging = false; + +let isComboDisabled = false; + +const logCommand = (function () { + const methodQuery = []; + Object.keys(GLmethod).forEach(key => { + methodQuery[GLmethod[key]] = key; + }) + const queryMethod = (id) => { + return methodQuery[parseInt(id)] || 'NotFoundMethod'; + } + const logCommand = (id, cmds) => { + const mId = cmds.split(',')[0]; + const mName = queryMethod(mId); + console.log(`=== callNative - componentId:${id}; method: ${mName}; cmds: ${cmds}`); + } + return logCommand; +})(); + +function joinArray(arr, sep) { + let res = ''; + for (let i = 0; i < arr.length; i++) { + if (i !== 0) { + res += sep; + } + res += arr[i]; + } + return res; +} + +const commandsCache = {} + +const GBridge = { + + callEnable: (ref, configArray) => { + + commandsCache[ref] = []; + + return GCanvasModule.enable({ + componentId: ref, + config: configArray + }); + }, + + callEnableDebug: () => { + isDebugging = true; + }, + + callEnableDisableCombo: () => { + isComboDisabled = true; + }, + + callSetContextType: function (componentId, context_type) { + GCanvasModule.setContextType(context_type, componentId); + }, + + callReset: function(id){ + GCanvasModule.resetComponent && canvasModule.resetComponent(componentId); + }, + + render: isWeexIOS ? function (componentId) { + return GCanvasModule.extendCallNative({ + contextId: componentId, + type: 0x60000001 + }); + } : function (componentId) { + return callGCanvasLinkNative(componentId, 0x60000001, 'render'); + }, + + render2d: isWeexIOS ? function (componentId, commands, callback) { + + if (isDebugging) { + console.log('>>> >>> render2d ==='); + console.log('>>> commands: ' + commands); + } + + GCanvasModule.render([commands, callback?true:false], componentId, callback); + + } : function (componentId, commands,callback) { + + if (isDebugging) { + console.log('>>> >>> render2d ==='); + console.log('>>> commands: ' + commands); + } + + callGCanvasLinkNative(componentId, 0x20000001, commands); + if(callback){ + callback(); + } + }, + + callExtendCallNative: isWeexIOS ? function (componentId, cmdArgs) { + + throw 'should not be here anymore ' + cmdArgs; + + } : function (componentId, cmdArgs) { + + throw 'should not be here anymore ' + cmdArgs; + + }, + + + flushNative: isWeexIOS ? function (componentId) { + + const cmdArgs = joinArray(commandsCache[componentId], ';'); + commandsCache[componentId] = []; + + if (isDebugging) { + console.log('>>> >>> flush native ==='); + console.log('>>> commands: ' + cmdArgs); + } + + const result = GCanvasModule.extendCallNative({ + "contextId": componentId, + "type": 0x60000000, + "args": cmdArgs + }); + + const res = result && result.result; + + if (isDebugging) { + console.log('>>> result: ' + res); + } + + return res; + + } : function (componentId) { + + const cmdArgs = joinArray(commandsCache[componentId], ';'); + commandsCache[componentId] = []; + + if (isDebugging) { + console.log('>>> >>> flush native ==='); + console.log('>>> commands: ' + cmdArgs); + } + + const result = callGCanvasLinkNative(componentId, 0x60000000, cmdArgs); + + if (isDebugging) { + console.log('>>> result: ' + result); + } + + return result; + }, + + callNative: function (componentId, cmdArgs, cache) { + + if (isDebugging) { + logCommand(componentId, cmdArgs); + } + + commandsCache[componentId].push(cmdArgs); + + if (!cache || isComboDisabled) { + return GBridge.flushNative(componentId); + } else { + return undefined; + } + }, + + texImage2D(componentId, ...args) { + if (isWeexIOS) { + if (args.length === 6) { + const [target, level, internalformat, format, type, image] = args; + GBridge.callNative( + componentId, + GLmethod.texImage2D + ',' + 6 + ',' + target + ',' + level + ',' + internalformat + ',' + format + ',' + type + ',' + image.src + ) + } else if (args.length === 9) { + const [target, level, internalformat, width, height, border, format, type, image] = args; + GBridge.callNative( + componentId, + GLmethod.texImage2D + ',' + 9 + ',' + target + ',' + level + ',' + internalformat + ',' + width + ',' + height + ',' + border + ',' + + + format + ',' + type + ',' + (image ? image.src : 0) + ) + } + } else if (isWeexAndroid) { + if (args.length === 6) { + const [target, level, internalformat, format, type, image] = args; + GCanvasModule.texImage2D(componentId, target, level, internalformat, format, type, image.src); + } else if (args.length === 9) { + const [target, level, internalformat, width, height, border, format, type, image] = args; + GCanvasModule.texImage2D(componentId, target, level, internalformat, width, height, border, format, type, (image ? image.src : 0)); + } + } + }, + + texSubImage2D(componentId, target, level, xoffset, yoffset, format, type, image) { + if (isWeexIOS) { + if (arguments.length === 8) { + GBridge.callNative( + componentId, + GLmethod.texSubImage2D + ',' + 6 + ',' + target + ',' + level + ',' + xoffset + ',' + yoffset, + ',' + format + ',' + type + ',' + image.src + ) + } + } else if (isWeexAndroid) { + GCanvasModule.texSubImage2D(componentId, target, level, xoffset, yoffset, format, type, image.src); + } + }, + + bindImageTexture(componentId, src, imageId) { + GCanvasModule.bindImageTexture([src, imageId], componentId); + }, + + perloadImage([url, id], callback) { + GCanvasModule.preLoadImage([url, id], function (image) { + image.url = url; + image.id = id; + callback(image); + }); + }, + + measureText(text, fontStyle, componentId) { + return GCanvasModule.measureText([text, fontStyle], componentId); + }, + + getImageData (componentId, x, y, w, h, callback) { + GCanvasModule.getImageData([x, y,w,h],componentId,callback); + }, + + putImageData (componentId, data, x, y, w, h, callback) { + GCanvasModule.putImageData([x, y,w,h,data],componentId,callback); + }, + + toTempFilePath(componentId, x, y, width, height, destWidth, destHeight, fileType, quality, callback){ + GCanvasModule.toTempFilePath([x, y, width,height, destWidth, destHeight, fileType, quality], componentId, callback); + } +} + +export default GBridge; \ No newline at end of file diff --git a/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-2d/FillStyleLinearGradient.js b/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-2d/FillStyleLinearGradient.js new file mode 100644 index 0000000..3e7f03a --- /dev/null +++ b/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-2d/FillStyleLinearGradient.js @@ -0,0 +1,18 @@ +class FillStyleLinearGradient { + + constructor(x0, y0, x1, y1) { + this._start_pos = { _x: x0, _y: y0 }; + this._end_pos = { _x: x1, _y: y1 }; + this._stop_count = 0; + this._stops = [0, 0, 0, 0, 0]; + } + + addColorStop = function (pos, color) { + if (this._stop_count < 5 && 0.0 <= pos && pos <= 1.0) { + this._stops[this._stop_count] = { _pos: pos, _color: color }; + this._stop_count++; + } + } +} + +export default FillStyleLinearGradient; \ No newline at end of file diff --git a/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-2d/FillStylePattern.js b/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-2d/FillStylePattern.js new file mode 100644 index 0000000..6e4f646 --- /dev/null +++ b/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-2d/FillStylePattern.js @@ -0,0 +1,8 @@ +class FillStylePattern { + constructor(img, pattern) { + this._style = pattern; + this._img = img; + } +} + +export default FillStylePattern; \ No newline at end of file diff --git a/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-2d/FillStyleRadialGradient.js b/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-2d/FillStyleRadialGradient.js new file mode 100644 index 0000000..7790596 --- /dev/null +++ b/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-2d/FillStyleRadialGradient.js @@ -0,0 +1,17 @@ +class FillStyleRadialGradient { + constructor(x0, y0, r0, x1, y1, r1) { + this._start_pos = { _x: x0, _y: y0, _r: r0 }; + this._end_pos = { _x: x1, _y: y1, _r: r1 }; + this._stop_count = 0; + this._stops = [0, 0, 0, 0, 0]; + } + + addColorStop(pos, color) { + if (this._stop_count < 5 && 0.0 <= pos && pos <= 1.0) { + this._stops[this._stop_count] = { _pos: pos, _color: color }; + this._stop_count++; + } + } +} + +export default FillStyleRadialGradient; \ No newline at end of file diff --git a/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-2d/RenderingContext.js b/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-2d/RenderingContext.js new file mode 100644 index 0000000..e6b8f48 --- /dev/null +++ b/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-2d/RenderingContext.js @@ -0,0 +1,666 @@ +import FillStylePattern from './FillStylePattern'; +import FillStyleLinearGradient from './FillStyleLinearGradient'; +import FillStyleRadialGradient from './FillStyleRadialGradient'; +import GImage from '../env/image.js'; +import { + ArrayBufferToBase64, + Base64ToUint8ClampedArray +} from '../env/tool.js'; + +export default class CanvasRenderingContext2D { + + _drawCommands = ''; + + _globalAlpha = 1.0; + + _fillStyle = 'rgb(0,0,0)'; + _strokeStyle = 'rgb(0,0,0)'; + + _lineWidth = 1; + _lineCap = 'butt'; + _lineJoin = 'miter'; + + _miterLimit = 10; + + _globalCompositeOperation = 'source-over'; + + _textAlign = 'start'; + _textBaseline = 'alphabetic'; + + _font = '10px sans-serif'; + + _savedGlobalAlpha = []; + + timer = null; + componentId = null; + + _notCommitDrawImageCache = []; + _needRedrawImageCache = []; + _redrawCommands = ''; + _autoSaveContext = true; + // _imageMap = new GHashMap(); + // _textureMap = new GHashMap(); + + constructor() { + this.className = 'CanvasRenderingContext2D'; + //this.save() + } + + setFillStyle(value) { + this.fillStyle = value; + } + + set fillStyle(value) { + this._fillStyle = value; + + if (typeof(value) == 'string') { + this._drawCommands = this._drawCommands.concat("F" + value + ";"); + } else if (value instanceof FillStylePattern) { + const image = value._img; + if (!image.complete) { + image.onload = () => { + var index = this._needRedrawImageCache.indexOf(image); + if (index > -1) { + this._needRedrawImageCache.splice(index, 1); + CanvasRenderingContext2D.GBridge.bindImageTexture(this.componentId, image.src, image._id); + this._redrawflush(true); + } + } + this._notCommitDrawImageCache.push(image); + } else { + CanvasRenderingContext2D.GBridge.bindImageTexture(this.componentId, image.src, image._id); + } + + //CanvasRenderingContext2D.GBridge.bindImageTexture(this.componentId, image.src, image._id); + this._drawCommands = this._drawCommands.concat("G" + image._id + "," + value._style + ";"); + } else if (value instanceof FillStyleLinearGradient) { + var command = "D" + value._start_pos._x.toFixed(2) + "," + value._start_pos._y.toFixed(2) + "," + + value._end_pos._x.toFixed(2) + "," + value._end_pos._y.toFixed(2) + "," + + value._stop_count; + for (var i = 0; i < value._stop_count; ++i) { + command += ("," + value._stops[i]._pos + "," + value._stops[i]._color); + } + this._drawCommands = this._drawCommands.concat(command + ";"); + } else if (value instanceof FillStyleRadialGradient) { + var command = "H" + value._start_pos._x.toFixed(2) + "," + value._start_pos._y.toFixed(2) + "," + value._start_pos._r + .toFixed(2) + "," + + value._end_pos._x.toFixed(2) + "," + value._end_pos._y.toFixed(2) + "," + value._end_pos._r.toFixed(2) + "," + + value._stop_count; + for (var i = 0; i < value._stop_count; ++i) { + command += ("," + value._stops[i]._pos + "," + value._stops[i]._color); + } + this._drawCommands = this._drawCommands.concat(command + ";"); + } + } + + get fillStyle() { + return this._fillStyle; + } + + get globalAlpha() { + return this._globalAlpha; + } + + setGlobalAlpha(value) { + this.globalAlpha = value; + } + + set globalAlpha(value) { + this._globalAlpha = value; + this._drawCommands = this._drawCommands.concat("a" + value.toFixed(2) + ";"); + } + + + get strokeStyle() { + return this._strokeStyle; + } + + setStrokeStyle(value) { + this.strokeStyle = value; + } + + set strokeStyle(value) { + + this._strokeStyle = value; + + if (typeof(value) == 'string') { + this._drawCommands = this._drawCommands.concat("S" + value + ";"); + } else if (value instanceof FillStylePattern) { + CanvasRenderingContext2D.GBridge.bindImageTexture(this.componentId, image.src, image._id); + this._drawCommands = this._drawCommands.concat("G" + image._id + "," + value._style + ";"); + } else if (value instanceof FillStyleLinearGradient) { + var command = "D" + value._start_pos._x.toFixed(2) + "," + value._start_pos._y.toFixed(2) + "," + + value._end_pos._x.toFixed(2) + "," + value._end_pos._y.toFixed(2) + "," + + value._stop_count; + + for (var i = 0; i < value._stop_count; ++i) { + command += ("," + value._stops[i]._pos + "," + value._stops[i]._color); + } + this._drawCommands = this._drawCommands.concat(command + ";"); + } else if (value instanceof FillStyleRadialGradient) { + var command = "H" + value._start_pos._x.toFixed(2) + "," + value._start_pos._y.toFixed(2) + "," + value._start_pos._r + .toFixed(2) + "," + + value._end_pos._x.toFixed(2) + "," + value._end_pos._y + ",".toFixed(2) + value._end_pos._r.toFixed(2) + "," + + value._stop_count; + + for (var i = 0; i < value._stop_count; ++i) { + command += ("," + value._stops[i]._pos + "," + value._stops[i]._color); + } + this._drawCommands = this._drawCommands.concat(command + ";"); + } + } + + get lineWidth() { + return this._lineWidth; + } + + setLineWidth(value) { + this.lineWidth = value; + } + + set lineWidth(value) { + this._lineWidth = value; + this._drawCommands = this._drawCommands.concat("W" + value + ";"); + } + + get lineCap() { + return this._lineCap; + } + + setLineCap(value) { + this.lineCap = value; + } + + set lineCap(value) { + this._lineCap = value; + this._drawCommands = this._drawCommands.concat("C" + value + ";"); + } + + get lineJoin() { + return this._lineJoin; + } + + setLineJoin(value) { + this.lineJoin = value + } + + set lineJoin(value) { + this._lineJoin = value; + this._drawCommands = this._drawCommands.concat("J" + value + ";"); + } + + get miterLimit() { + return this._miterLimit; + } + + setMiterLimit(value) { + this.miterLimit = value + } + + set miterLimit(value) { + this._miterLimit = value; + this._drawCommands = this._drawCommands.concat("M" + value + ";"); + } + + get globalCompositeOperation() { + return this._globalCompositeOperation; + } + + set globalCompositeOperation(value) { + + this._globalCompositeOperation = value; + let mode = 0; + switch (value) { + case "source-over": + mode = 0; + break; + case "source-atop": + mode = 5; + break; + case "source-in": + mode = 0; + break; + case "source-out": + mode = 2; + break; + case "destination-over": + mode = 4; + break; + case "destination-atop": + mode = 4; + break; + case "destination-in": + mode = 4; + break; + case "destination-out": + mode = 3; + break; + case "lighter": + mode = 1; + break; + case "copy": + mode = 2; + break; + case "xor": + mode = 6; + break; + default: + mode = 0; + } + + this._drawCommands = this._drawCommands.concat("B" + mode + ";"); + } + + get textAlign() { + return this._textAlign; + } + + setTextAlign(value) { + this.textAlign = value + } + + set textAlign(value) { + + this._textAlign = value; + let Align = 0; + switch (value) { + case "start": + Align = 0; + break; + case "end": + Align = 1; + break; + case "left": + Align = 2; + break; + case "center": + Align = 3; + break; + case "right": + Align = 4; + break; + default: + Align = 0; + } + + this._drawCommands = this._drawCommands.concat("A" + Align + ";"); + } + + get textBaseline() { + return this._textBaseline; + } + + setTextBaseline(value) { + this.textBaseline = value + } + + set textBaseline(value) { + this._textBaseline = value; + let baseline = 0; + switch (value) { + case "alphabetic": + baseline = 0; + break; + case "middle": + baseline = 1; + break; + case "top": + baseline = 2; + break; + case "hanging": + baseline = 3; + break; + case "bottom": + baseline = 4; + break; + case "ideographic": + baseline = 5; + break; + default: + baseline = 0; + break; + } + + this._drawCommands = this._drawCommands.concat("E" + baseline + ";"); + } + + get font() { + return this._font; + } + + setFontSize(size) { + var str = this._font; + var strs = str.trim().split(/\s+/); + for (var i = 0; i < strs.length; i++) { + var values = ["normal", "italic", "oblique", "normal", "small-caps", "normal", "bold", + "bolder", "lighter", "100", "200", "300", "400", "500", "600", "700", "800", "900", + "normal", "ultra-condensed", "extra-condensed", "condensed", "semi-condensed", + "semi-expanded", "expanded", "extra-expanded", "ultra-expanded" + ]; + + if (-1 == values.indexOf(strs[i].trim())) { + if (typeof size === 'string') { + strs[i] = size; + } else if (typeof size === 'number') { + strs[i] = String(size) + 'px'; + } + break; + } + } + this.font = strs.join(" "); + } + + set font(value) { + this._font = value; + this._drawCommands = this._drawCommands.concat("j" + value + ";"); + } + + setTransform(a, b, c, d, tx, ty) { + this._drawCommands = this._drawCommands.concat("t" + + (a === 1 ? "1" : a.toFixed(2)) + "," + + (b === 0 ? "0" : b.toFixed(2)) + "," + + (c === 0 ? "0" : c.toFixed(2)) + "," + + (d === 1 ? "1" : d.toFixed(2)) + "," + tx.toFixed(2) + "," + ty.toFixed(2) + ";"); + } + + transform(a, b, c, d, tx, ty) { + this._drawCommands = this._drawCommands.concat("f" + + (a === 1 ? "1" : a.toFixed(2)) + "," + + (b === 0 ? "0" : b.toFixed(2)) + "," + + (c === 0 ? "0" : c.toFixed(2)) + "," + + (d === 1 ? "1" : d.toFixed(2)) + "," + tx + "," + ty + ";"); + } + + resetTransform() { + this._drawCommands = this._drawCommands.concat("m;"); + } + + scale(a, d) { + this._drawCommands = this._drawCommands.concat("k" + a.toFixed(2) + "," + + d.toFixed(2) + ";"); + } + + rotate(angle) { + this._drawCommands = this._drawCommands + .concat("r" + angle.toFixed(6) + ";"); + } + + translate(tx, ty) { + this._drawCommands = this._drawCommands.concat("l" + tx.toFixed(2) + "," + ty.toFixed(2) + ";"); + } + + save() { + this._savedGlobalAlpha.push(this._globalAlpha); + this._drawCommands = this._drawCommands.concat("v;"); + } + + restore() { + this._drawCommands = this._drawCommands.concat("e;"); + this._globalAlpha = this._savedGlobalAlpha.pop(); + } + + createPattern(img, pattern) { + if (typeof img === 'string') { + var imgObj = new GImage(); + imgObj.src = img; + img = imgObj; + } + return new FillStylePattern(img, pattern); + } + + createLinearGradient(x0, y0, x1, y1) { + return new FillStyleLinearGradient(x0, y0, x1, y1); + } + + createRadialGradient = function(x0, y0, r0, x1, y1, r1) { + return new FillStyleRadialGradient(x0, y0, r0, x1, y1, r1); + }; + + createCircularGradient = function(x0, y0, r0) { + return new FillStyleRadialGradient(x0, y0, 0, x0, y0, r0); + }; + + strokeRect(x, y, w, h) { + this._drawCommands = this._drawCommands.concat("s" + x + "," + y + "," + w + "," + h + ";"); + } + + + clearRect(x, y, w, h) { + this._drawCommands = this._drawCommands.concat("c" + x + "," + y + "," + w + + "," + h + ";"); + } + + clip() { + this._drawCommands = this._drawCommands.concat("p;"); + } + + resetClip() { + this._drawCommands = this._drawCommands.concat("q;"); + } + + closePath() { + this._drawCommands = this._drawCommands.concat("o;"); + } + + moveTo(x, y) { + this._drawCommands = this._drawCommands.concat("g" + x.toFixed(2) + "," + y.toFixed(2) + ";"); + } + + lineTo(x, y) { + this._drawCommands = this._drawCommands.concat("i" + x.toFixed(2) + "," + y.toFixed(2) + ";"); + } + + quadraticCurveTo = function(cpx, cpy, x, y) { + this._drawCommands = this._drawCommands.concat("u" + cpx + "," + cpy + "," + x + "," + y + ";"); + } + + bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y, ) { + this._drawCommands = this._drawCommands.concat( + "z" + cp1x.toFixed(2) + "," + cp1y.toFixed(2) + "," + cp2x.toFixed(2) + "," + cp2y.toFixed(2) + "," + + x.toFixed(2) + "," + y.toFixed(2) + ";"); + } + + arcTo(x1, y1, x2, y2, radius) { + this._drawCommands = this._drawCommands.concat("h" + x1 + "," + y1 + "," + x2 + "," + y2 + "," + radius + ";"); + } + + beginPath() { + this._drawCommands = this._drawCommands.concat("b;"); + } + + + fillRect(x, y, w, h) { + this._drawCommands = this._drawCommands.concat("n" + x + "," + y + "," + w + + "," + h + ";"); + } + + rect(x, y, w, h) { + this._drawCommands = this._drawCommands.concat("w" + x + "," + y + "," + w + "," + h + ";"); + } + + fill() { + this._drawCommands = this._drawCommands.concat("L;"); + } + + stroke(path) { + this._drawCommands = this._drawCommands.concat("x;"); + } + + arc(x, y, radius, startAngle, endAngle, anticlockwise) { + + let ianticlockwise = 0; + if (anticlockwise) { + ianticlockwise = 1; + } + + this._drawCommands = this._drawCommands.concat( + "y" + x.toFixed(2) + "," + y.toFixed(2) + "," + + radius.toFixed(2) + "," + startAngle + "," + endAngle + "," + ianticlockwise + + ";" + ); + } + + fillText(text, x, y) { + let tmptext = text.replace(/!/g, "!!"); + tmptext = tmptext.replace(/,/g, "!,"); + tmptext = tmptext.replace(/;/g, "!;"); + this._drawCommands = this._drawCommands.concat("T" + tmptext + "," + x + "," + y + ",0.0;"); + } + + strokeText = function(text, x, y) { + let tmptext = text.replace(/!/g, "!!"); + tmptext = tmptext.replace(/,/g, "!,"); + tmptext = tmptext.replace(/;/g, "!;"); + this._drawCommands = this._drawCommands.concat("U" + tmptext + "," + x + "," + y + ",0.0;"); + } + + measureText(text) { + return CanvasRenderingContext2D.GBridge.measureText(text, this.font, this.componentId); + } + + isPointInPath = function(x, y) { + throw new Error('GCanvas not supported yet'); + } + + drawImage(image, sx, sy, sw, sh, dx, dy, dw, dh) { + if (typeof image === 'string') { + var imgObj = new GImage(); + imgObj.src = image; + image = imgObj; + } + if (image instanceof GImage) { + if (!image.complete) { + imgObj.onload = () => { + var index = this._needRedrawImageCache.indexOf(image); + if (index > -1) { + this._needRedrawImageCache.splice(index, 1); + CanvasRenderingContext2D.GBridge.bindImageTexture(this.componentId, image.src, image._id); + this._redrawflush(true); + } + } + this._notCommitDrawImageCache.push(image); + } else { + CanvasRenderingContext2D.GBridge.bindImageTexture(this.componentId, image.src, image._id); + } + var srcArgs = [image, sx, sy, sw, sh, dx, dy, dw, dh]; + var args = []; + for (var arg in srcArgs) { + if (typeof(srcArgs[arg]) != 'undefined') { + args.push(srcArgs[arg]); + } + } + this.__drawImage.apply(this, args); + //this.__drawImage(image,sx, sy, sw, sh, dx, dy, dw, dh); + } + } + + __drawImage(image, sx, sy, sw, sh, dx, dy, dw, dh) { + const numArgs = arguments.length; + + function drawImageCommands() { + + if (numArgs === 3) { + const x = parseFloat(sx) || 0.0; + const y = parseFloat(sy) || 0.0; + + return ("d" + image._id + ",0,0," + + image.width + "," + image.height + "," + + x + "," + y + "," + image.width + "," + image.height + ";"); + } else if (numArgs === 5) { + const x = parseFloat(sx) || 0.0; + const y = parseFloat(sy) || 0.0; + const width = parseInt(sw) || image.width; + const height = parseInt(sh) || image.height; + + return ("d" + image._id + ",0,0," + + image.width + "," + image.height + "," + + x + "," + y + "," + width + "," + height + ";"); + } else if (numArgs === 9) { + sx = parseFloat(sx) || 0.0; + sy = parseFloat(sy) || 0.0; + sw = parseInt(sw) || image.width; + sh = parseInt(sh) || image.height; + dx = parseFloat(dx) || 0.0; + dy = parseFloat(dy) || 0.0; + dw = parseInt(dw) || image.width; + dh = parseInt(dh) || image.height; + + return ("d" + image._id + "," + + sx + "," + sy + "," + sw + "," + sh + "," + + dx + "," + dy + "," + dw + "," + dh + ";"); + } + } + this._drawCommands += drawImageCommands(); + } + + _flush(reserve, callback) { + const commands = this._drawCommands; + this._drawCommands = ''; + CanvasRenderingContext2D.GBridge.render2d(this.componentId, commands, callback); + this._needRender = false; + } + + _redrawflush(reserve, callback) { + const commands = this._redrawCommands; + CanvasRenderingContext2D.GBridge.render2d(this.componentId, commands, callback); + if (this._needRedrawImageCache.length == 0) { + this._redrawCommands = ''; + } + } + + draw(reserve, callback) { + if (!reserve) { + this._globalAlpha = this._savedGlobalAlpha.pop(); + this._savedGlobalAlpha.push(this._globalAlpha); + this._redrawCommands = this._drawCommands; + this._needRedrawImageCache = this._notCommitDrawImageCache; + if (this._autoSaveContext) { + this._drawCommands = ("v;" + this._drawCommands); + this._autoSaveContext = false; + } else { + this._drawCommands = ("e;X;v;" + this._drawCommands); + } + } else { + this._needRedrawImageCache = this._needRedrawImageCache.concat(this._notCommitDrawImageCache); + this._redrawCommands += this._drawCommands; + if (this._autoSaveContext) { + this._drawCommands = ("v;" + this._drawCommands); + this._autoSaveContext = false; + } + } + this._notCommitDrawImageCache = []; + if (this._flush) { + this._flush(reserve, callback); + } + } + + getImageData(x, y, w, h, callback) { + CanvasRenderingContext2D.GBridge.getImageData(this.componentId, x, y, w, h, function(res) { + res.data = Base64ToUint8ClampedArray(res.data); + if (typeof(callback) == 'function') { + callback(res); + } + }); + } + + putImageData(data, x, y, w, h, callback) { + if (data instanceof Uint8ClampedArray) { + data = ArrayBufferToBase64(data); + CanvasRenderingContext2D.GBridge.putImageData(this.componentId, data, x, y, w, h, function(res) { + if (typeof(callback) == 'function') { + callback(res); + } + }); + } + } + + toTempFilePath(x, y, width, height, destWidth, destHeight, fileType, quality, callback) { + CanvasRenderingContext2D.GBridge.toTempFilePath(this.componentId, x, y, width, height, destWidth, destHeight, + fileType, quality, + function(res) { + if (typeof(callback) == 'function') { + callback(res); + } + }); + } +} diff --git a/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-webgl/ActiveInfo.js b/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-webgl/ActiveInfo.js new file mode 100644 index 0000000..b495129 --- /dev/null +++ b/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-webgl/ActiveInfo.js @@ -0,0 +1,11 @@ +export default class WebGLActiveInfo { + className = 'WebGLActiveInfo'; + + constructor({ + type, name, size + }) { + this.type = type; + this.name = name; + this.size = size; + } +} \ No newline at end of file diff --git a/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-webgl/Buffer.js b/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-webgl/Buffer.js new file mode 100644 index 0000000..4800f67 --- /dev/null +++ b/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-webgl/Buffer.js @@ -0,0 +1,21 @@ +import {getTransferedObjectUUID} from './classUtils'; + +const name = 'WebGLBuffer'; + +function uuid(id) { + return getTransferedObjectUUID(name, id); +} + +export default class WebGLBuffer { + className = name; + + constructor(id) { + this.id = id; + } + + static uuid = uuid; + + uuid() { + return uuid(this.id); + } +} \ No newline at end of file diff --git a/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-webgl/Framebuffer.js b/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-webgl/Framebuffer.js new file mode 100644 index 0000000..28b46d3 --- /dev/null +++ b/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-webgl/Framebuffer.js @@ -0,0 +1,21 @@ +import {getTransferedObjectUUID} from './classUtils'; + +const name = 'WebGLFrameBuffer'; + +function uuid(id) { + return getTransferedObjectUUID(name, id); +} + +export default class WebGLFramebuffer { + className = name; + + constructor(id) { + this.id = id; + } + + static uuid = uuid; + + uuid() { + return uuid(this.id); + } +} \ No newline at end of file diff --git a/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-webgl/GLenum.js b/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-webgl/GLenum.js new file mode 100644 index 0000000..ac5544d --- /dev/null +++ b/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-webgl/GLenum.js @@ -0,0 +1,298 @@ +export default { + "DEPTH_BUFFER_BIT": 256, + "STENCIL_BUFFER_BIT": 1024, + "COLOR_BUFFER_BIT": 16384, + "POINTS": 0, + "LINES": 1, + "LINE_LOOP": 2, + "LINE_STRIP": 3, + "TRIANGLES": 4, + "TRIANGLE_STRIP": 5, + "TRIANGLE_FAN": 6, + "ZERO": 0, + "ONE": 1, + "SRC_COLOR": 768, + "ONE_MINUS_SRC_COLOR": 769, + "SRC_ALPHA": 770, + "ONE_MINUS_SRC_ALPHA": 771, + "DST_ALPHA": 772, + "ONE_MINUS_DST_ALPHA": 773, + "DST_COLOR": 774, + "ONE_MINUS_DST_COLOR": 775, + "SRC_ALPHA_SATURATE": 776, + "FUNC_ADD": 32774, + "BLEND_EQUATION": 32777, + "BLEND_EQUATION_RGB": 32777, + "BLEND_EQUATION_ALPHA": 34877, + "FUNC_SUBTRACT": 32778, + "FUNC_REVERSE_SUBTRACT": 32779, + "BLEND_DST_RGB": 32968, + "BLEND_SRC_RGB": 32969, + "BLEND_DST_ALPHA": 32970, + "BLEND_SRC_ALPHA": 32971, + "CONSTANT_COLOR": 32769, + "ONE_MINUS_CONSTANT_COLOR": 32770, + "CONSTANT_ALPHA": 32771, + "ONE_MINUS_CONSTANT_ALPHA": 32772, + "BLEND_COLOR": 32773, + "ARRAY_BUFFER": 34962, + "ELEMENT_ARRAY_BUFFER": 34963, + "ARRAY_BUFFER_BINDING": 34964, + "ELEMENT_ARRAY_BUFFER_BINDING": 34965, + "STREAM_DRAW": 35040, + "STATIC_DRAW": 35044, + "DYNAMIC_DRAW": 35048, + "BUFFER_SIZE": 34660, + "BUFFER_USAGE": 34661, + "CURRENT_VERTEX_ATTRIB": 34342, + "FRONT": 1028, + "BACK": 1029, + "FRONT_AND_BACK": 1032, + "TEXTURE_2D": 3553, + "CULL_FACE": 2884, + "BLEND": 3042, + "DITHER": 3024, + "STENCIL_TEST": 2960, + "DEPTH_TEST": 2929, + "SCISSOR_TEST": 3089, + "POLYGON_OFFSET_FILL": 32823, + "SAMPLE_ALPHA_TO_COVERAGE": 32926, + "SAMPLE_COVERAGE": 32928, + "NO_ERROR": 0, + "INVALID_ENUM": 1280, + "INVALID_VALUE": 1281, + "INVALID_OPERATION": 1282, + "OUT_OF_MEMORY": 1285, + "CW": 2304, + "CCW": 2305, + "LINE_WIDTH": 2849, + "ALIASED_POINT_SIZE_RANGE": 33901, + "ALIASED_LINE_WIDTH_RANGE": 33902, + "CULL_FACE_MODE": 2885, + "FRONT_FACE": 2886, + "DEPTH_RANGE": 2928, + "DEPTH_WRITEMASK": 2930, + "DEPTH_CLEAR_VALUE": 2931, + "DEPTH_FUNC": 2932, + "STENCIL_CLEAR_VALUE": 2961, + "STENCIL_FUNC": 2962, + "STENCIL_FAIL": 2964, + "STENCIL_PASS_DEPTH_FAIL": 2965, + "STENCIL_PASS_DEPTH_PASS": 2966, + "STENCIL_REF": 2967, + "STENCIL_VALUE_MASK": 2963, + "STENCIL_WRITEMASK": 2968, + "STENCIL_BACK_FUNC": 34816, + "STENCIL_BACK_FAIL": 34817, + "STENCIL_BACK_PASS_DEPTH_FAIL": 34818, + "STENCIL_BACK_PASS_DEPTH_PASS": 34819, + "STENCIL_BACK_REF": 36003, + "STENCIL_BACK_VALUE_MASK": 36004, + "STENCIL_BACK_WRITEMASK": 36005, + "VIEWPORT": 2978, + "SCISSOR_BOX": 3088, + "COLOR_CLEAR_VALUE": 3106, + "COLOR_WRITEMASK": 3107, + "UNPACK_ALIGNMENT": 3317, + "PACK_ALIGNMENT": 3333, + "MAX_TEXTURE_SIZE": 3379, + "MAX_VIEWPORT_DIMS": 3386, + "SUBPIXEL_BITS": 3408, + "RED_BITS": 3410, + "GREEN_BITS": 3411, + "BLUE_BITS": 3412, + "ALPHA_BITS": 3413, + "DEPTH_BITS": 3414, + "STENCIL_BITS": 3415, + "POLYGON_OFFSET_UNITS": 10752, + "POLYGON_OFFSET_FACTOR": 32824, + "TEXTURE_BINDING_2D": 32873, + "SAMPLE_BUFFERS": 32936, + "SAMPLES": 32937, + "SAMPLE_COVERAGE_VALUE": 32938, + "SAMPLE_COVERAGE_INVERT": 32939, + "COMPRESSED_TEXTURE_FORMATS": 34467, + "DONT_CARE": 4352, + "FASTEST": 4353, + "NICEST": 4354, + "GENERATE_MIPMAP_HINT": 33170, + "BYTE": 5120, + "UNSIGNED_BYTE": 5121, + "SHORT": 5122, + "UNSIGNED_SHORT": 5123, + "INT": 5124, + "UNSIGNED_INT": 5125, + "FLOAT": 5126, + "DEPTH_COMPONENT": 6402, + "ALPHA": 6406, + "RGB": 6407, + "RGBA": 6408, + "LUMINANCE": 6409, + "LUMINANCE_ALPHA": 6410, + "UNSIGNED_SHORT_4_4_4_4": 32819, + "UNSIGNED_SHORT_5_5_5_1": 32820, + "UNSIGNED_SHORT_5_6_5": 33635, + "FRAGMENT_SHADER": 35632, + "VERTEX_SHADER": 35633, + "MAX_VERTEX_ATTRIBS": 34921, + "MAX_VERTEX_UNIFORM_VECTORS": 36347, + "MAX_VARYING_VECTORS": 36348, + "MAX_COMBINED_TEXTURE_IMAGE_UNITS": 35661, + "MAX_VERTEX_TEXTURE_IMAGE_UNITS": 35660, + "MAX_TEXTURE_IMAGE_UNITS": 34930, + "MAX_FRAGMENT_UNIFORM_VECTORS": 36349, + "SHADER_TYPE": 35663, + "DELETE_STATUS": 35712, + "LINK_STATUS": 35714, + "VALIDATE_STATUS": 35715, + "ATTACHED_SHADERS": 35717, + "ACTIVE_UNIFORMS": 35718, + "ACTIVE_ATTRIBUTES": 35721, + "SHADING_LANGUAGE_VERSION": 35724, + "CURRENT_PROGRAM": 35725, + "NEVER": 512, + "LESS": 513, + "EQUAL": 514, + "LEQUAL": 515, + "GREATER": 516, + "NOTEQUAL": 517, + "GEQUAL": 518, + "ALWAYS": 519, + "KEEP": 7680, + "REPLACE": 7681, + "INCR": 7682, + "DECR": 7683, + "INVERT": 5386, + "INCR_WRAP": 34055, + "DECR_WRAP": 34056, + "VENDOR": 7936, + "RENDERER": 7937, + "VERSION": 7938, + "NEAREST": 9728, + "LINEAR": 9729, + "NEAREST_MIPMAP_NEAREST": 9984, + "LINEAR_MIPMAP_NEAREST": 9985, + "NEAREST_MIPMAP_LINEAR": 9986, + "LINEAR_MIPMAP_LINEAR": 9987, + "TEXTURE_MAG_FILTER": 10240, + "TEXTURE_MIN_FILTER": 10241, + "TEXTURE_WRAP_S": 10242, + "TEXTURE_WRAP_T": 10243, + "TEXTURE": 5890, + "TEXTURE_CUBE_MAP": 34067, + "TEXTURE_BINDING_CUBE_MAP": 34068, + "TEXTURE_CUBE_MAP_POSITIVE_X": 34069, + "TEXTURE_CUBE_MAP_NEGATIVE_X": 34070, + "TEXTURE_CUBE_MAP_POSITIVE_Y": 34071, + "TEXTURE_CUBE_MAP_NEGATIVE_Y": 34072, + "TEXTURE_CUBE_MAP_POSITIVE_Z": 34073, + "TEXTURE_CUBE_MAP_NEGATIVE_Z": 34074, + "MAX_CUBE_MAP_TEXTURE_SIZE": 34076, + "TEXTURE0": 33984, + "TEXTURE1": 33985, + "TEXTURE2": 33986, + "TEXTURE3": 33987, + "TEXTURE4": 33988, + "TEXTURE5": 33989, + "TEXTURE6": 33990, + "TEXTURE7": 33991, + "TEXTURE8": 33992, + "TEXTURE9": 33993, + "TEXTURE10": 33994, + "TEXTURE11": 33995, + "TEXTURE12": 33996, + "TEXTURE13": 33997, + "TEXTURE14": 33998, + "TEXTURE15": 33999, + "TEXTURE16": 34000, + "TEXTURE17": 34001, + "TEXTURE18": 34002, + "TEXTURE19": 34003, + "TEXTURE20": 34004, + "TEXTURE21": 34005, + "TEXTURE22": 34006, + "TEXTURE23": 34007, + "TEXTURE24": 34008, + "TEXTURE25": 34009, + "TEXTURE26": 34010, + "TEXTURE27": 34011, + "TEXTURE28": 34012, + "TEXTURE29": 34013, + "TEXTURE30": 34014, + "TEXTURE31": 34015, + "ACTIVE_TEXTURE": 34016, + "REPEAT": 10497, + "CLAMP_TO_EDGE": 33071, + "MIRRORED_REPEAT": 33648, + "FLOAT_VEC2": 35664, + "FLOAT_VEC3": 35665, + "FLOAT_VEC4": 35666, + "INT_VEC2": 35667, + "INT_VEC3": 35668, + "INT_VEC4": 35669, + "BOOL": 35670, + "BOOL_VEC2": 35671, + "BOOL_VEC3": 35672, + "BOOL_VEC4": 35673, + "FLOAT_MAT2": 35674, + "FLOAT_MAT3": 35675, + "FLOAT_MAT4": 35676, + "SAMPLER_2D": 35678, + "SAMPLER_CUBE": 35680, + "VERTEX_ATTRIB_ARRAY_ENABLED": 34338, + "VERTEX_ATTRIB_ARRAY_SIZE": 34339, + "VERTEX_ATTRIB_ARRAY_STRIDE": 34340, + "VERTEX_ATTRIB_ARRAY_TYPE": 34341, + "VERTEX_ATTRIB_ARRAY_NORMALIZED": 34922, + "VERTEX_ATTRIB_ARRAY_POINTER": 34373, + "VERTEX_ATTRIB_ARRAY_BUFFER_BINDING": 34975, + "IMPLEMENTATION_COLOR_READ_TYPE": 35738, + "IMPLEMENTATION_COLOR_READ_FORMAT": 35739, + "COMPILE_STATUS": 35713, + "LOW_FLOAT": 36336, + "MEDIUM_FLOAT": 36337, + "HIGH_FLOAT": 36338, + "LOW_INT": 36339, + "MEDIUM_INT": 36340, + "HIGH_INT": 36341, + "FRAMEBUFFER": 36160, + "RENDERBUFFER": 36161, + "RGBA4": 32854, + "RGB5_A1": 32855, + "RGB565": 36194, + "DEPTH_COMPONENT16": 33189, + "STENCIL_INDEX8": 36168, + "DEPTH_STENCIL": 34041, + "RENDERBUFFER_WIDTH": 36162, + "RENDERBUFFER_HEIGHT": 36163, + "RENDERBUFFER_INTERNAL_FORMAT": 36164, + "RENDERBUFFER_RED_SIZE": 36176, + "RENDERBUFFER_GREEN_SIZE": 36177, + "RENDERBUFFER_BLUE_SIZE": 36178, + "RENDERBUFFER_ALPHA_SIZE": 36179, + "RENDERBUFFER_DEPTH_SIZE": 36180, + "RENDERBUFFER_STENCIL_SIZE": 36181, + "FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE": 36048, + "FRAMEBUFFER_ATTACHMENT_OBJECT_NAME": 36049, + "FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL": 36050, + "FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE": 36051, + "COLOR_ATTACHMENT0": 36064, + "DEPTH_ATTACHMENT": 36096, + "STENCIL_ATTACHMENT": 36128, + "DEPTH_STENCIL_ATTACHMENT": 33306, + "NONE": 0, + "FRAMEBUFFER_COMPLETE": 36053, + "FRAMEBUFFER_INCOMPLETE_ATTACHMENT": 36054, + "FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT": 36055, + "FRAMEBUFFER_INCOMPLETE_DIMENSIONS": 36057, + "FRAMEBUFFER_UNSUPPORTED": 36061, + "FRAMEBUFFER_BINDING": 36006, + "RENDERBUFFER_BINDING": 36007, + "MAX_RENDERBUFFER_SIZE": 34024, + "INVALID_FRAMEBUFFER_OPERATION": 1286, + "UNPACK_FLIP_Y_WEBGL": 37440, + "UNPACK_PREMULTIPLY_ALPHA_WEBGL": 37441, + "CONTEXT_LOST_WEBGL": 37442, + "UNPACK_COLORSPACE_CONVERSION_WEBGL": 37443, + "BROWSER_DEFAULT_WEBGL": 37444 +}; \ No newline at end of file diff --git a/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-webgl/GLmethod.js b/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-webgl/GLmethod.js new file mode 100644 index 0000000..f2659be --- /dev/null +++ b/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-webgl/GLmethod.js @@ -0,0 +1,142 @@ +let i = 1; + +const GLmethod = {}; + +GLmethod.activeTexture = i++; //1 +GLmethod.attachShader = i++; +GLmethod.bindAttribLocation = i++; +GLmethod.bindBuffer = i++; +GLmethod.bindFramebuffer = i++; +GLmethod.bindRenderbuffer = i++; +GLmethod.bindTexture = i++; +GLmethod.blendColor = i++; +GLmethod.blendEquation = i++; +GLmethod.blendEquationSeparate = i++; //10 +GLmethod.blendFunc = i++; +GLmethod.blendFuncSeparate = i++; +GLmethod.bufferData = i++; +GLmethod.bufferSubData = i++; +GLmethod.checkFramebufferStatus = i++; +GLmethod.clear = i++; +GLmethod.clearColor = i++; +GLmethod.clearDepth = i++; +GLmethod.clearStencil = i++; +GLmethod.colorMask = i++; //20 +GLmethod.compileShader = i++; +GLmethod.compressedTexImage2D = i++; +GLmethod.compressedTexSubImage2D = i++; +GLmethod.copyTexImage2D = i++; +GLmethod.copyTexSubImage2D = i++; +GLmethod.createBuffer = i++; +GLmethod.createFramebuffer = i++; +GLmethod.createProgram = i++; +GLmethod.createRenderbuffer = i++; +GLmethod.createShader = i++; //30 +GLmethod.createTexture = i++; +GLmethod.cullFace = i++; +GLmethod.deleteBuffer = i++; +GLmethod.deleteFramebuffer = i++; +GLmethod.deleteProgram = i++; +GLmethod.deleteRenderbuffer = i++; +GLmethod.deleteShader = i++; +GLmethod.deleteTexture = i++; +GLmethod.depthFunc = i++; +GLmethod.depthMask = i++; //40 +GLmethod.depthRange = i++; +GLmethod.detachShader = i++; +GLmethod.disable = i++; +GLmethod.disableVertexAttribArray = i++; +GLmethod.drawArrays = i++; +GLmethod.drawArraysInstancedANGLE = i++; +GLmethod.drawElements = i++; +GLmethod.drawElementsInstancedANGLE = i++; +GLmethod.enable = i++; +GLmethod.enableVertexAttribArray = i++; //50 +GLmethod.flush = i++; +GLmethod.framebufferRenderbuffer = i++; +GLmethod.framebufferTexture2D = i++; +GLmethod.frontFace = i++; +GLmethod.generateMipmap = i++; +GLmethod.getActiveAttrib = i++; +GLmethod.getActiveUniform = i++; +GLmethod.getAttachedShaders = i++; +GLmethod.getAttribLocation = i++; +GLmethod.getBufferParameter = i++; //60 +GLmethod.getContextAttributes = i++; +GLmethod.getError = i++; +GLmethod.getExtension = i++; +GLmethod.getFramebufferAttachmentParameter = i++; +GLmethod.getParameter = i++; +GLmethod.getProgramInfoLog = i++; +GLmethod.getProgramParameter = i++; +GLmethod.getRenderbufferParameter = i++; +GLmethod.getShaderInfoLog = i++; +GLmethod.getShaderParameter = i++; //70 +GLmethod.getShaderPrecisionFormat = i++; +GLmethod.getShaderSource = i++; +GLmethod.getSupportedExtensions = i++; +GLmethod.getTexParameter = i++; +GLmethod.getUniform = i++; +GLmethod.getUniformLocation = i++; +GLmethod.getVertexAttrib = i++; +GLmethod.getVertexAttribOffset = i++; +GLmethod.isBuffer = i++; +GLmethod.isContextLost = i++; //80 +GLmethod.isEnabled = i++; +GLmethod.isFramebuffer = i++; +GLmethod.isProgram = i++; +GLmethod.isRenderbuffer = i++; +GLmethod.isShader = i++; +GLmethod.isTexture = i++; +GLmethod.lineWidth = i++; +GLmethod.linkProgram = i++; +GLmethod.pixelStorei = i++; +GLmethod.polygonOffset = i++; //90 +GLmethod.readPixels = i++; +GLmethod.renderbufferStorage = i++; +GLmethod.sampleCoverage = i++; +GLmethod.scissor = i++; +GLmethod.shaderSource = i++; +GLmethod.stencilFunc = i++; +GLmethod.stencilFuncSeparate = i++; +GLmethod.stencilMask = i++; +GLmethod.stencilMaskSeparate = i++; +GLmethod.stencilOp = i++; //100 +GLmethod.stencilOpSeparate = i++; +GLmethod.texImage2D = i++; +GLmethod.texParameterf = i++; +GLmethod.texParameteri = i++; +GLmethod.texSubImage2D = i++; +GLmethod.uniform1f = i++; +GLmethod.uniform1fv = i++; +GLmethod.uniform1i = i++; +GLmethod.uniform1iv = i++; +GLmethod.uniform2f = i++; //110 +GLmethod.uniform2fv = i++; +GLmethod.uniform2i = i++; +GLmethod.uniform2iv = i++; +GLmethod.uniform3f = i++; +GLmethod.uniform3fv = i++; +GLmethod.uniform3i = i++; +GLmethod.uniform3iv = i++; +GLmethod.uniform4f = i++; +GLmethod.uniform4fv = i++; +GLmethod.uniform4i = i++; //120 +GLmethod.uniform4iv = i++; +GLmethod.uniformMatrix2fv = i++; +GLmethod.uniformMatrix3fv = i++; +GLmethod.uniformMatrix4fv = i++; +GLmethod.useProgram = i++; +GLmethod.validateProgram = i++; +GLmethod.vertexAttrib1f = i++; //new +GLmethod.vertexAttrib2f = i++; //new +GLmethod.vertexAttrib3f = i++; //new +GLmethod.vertexAttrib4f = i++; //new //130 +GLmethod.vertexAttrib1fv = i++; //new +GLmethod.vertexAttrib2fv = i++; //new +GLmethod.vertexAttrib3fv = i++; //new +GLmethod.vertexAttrib4fv = i++; //new +GLmethod.vertexAttribPointer = i++; +GLmethod.viewport = i++; + +export default GLmethod; \ No newline at end of file diff --git a/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-webgl/GLtype.js b/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-webgl/GLtype.js new file mode 100644 index 0000000..695abcb --- /dev/null +++ b/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-webgl/GLtype.js @@ -0,0 +1,23 @@ +const GLtype = {}; + +[ + "GLbitfield", + "GLboolean", + "GLbyte", + "GLclampf", + "GLenum", + "GLfloat", + "GLint", + "GLintptr", + "GLsizei", + "GLsizeiptr", + "GLshort", + "GLubyte", + "GLuint", + "GLushort" +].sort().map((typeName, i) => GLtype[typeName] = 1 >> (i + 1)); + +export default GLtype; + + + diff --git a/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-webgl/Program.js b/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-webgl/Program.js new file mode 100644 index 0000000..6f5691c --- /dev/null +++ b/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-webgl/Program.js @@ -0,0 +1,21 @@ +import {getTransferedObjectUUID} from './classUtils'; + +const name = 'WebGLProgram'; + +function uuid(id) { + return getTransferedObjectUUID(name, id); +} + +export default class WebGLProgram { + className = name; + + constructor(id) { + this.id = id; + } + + static uuid = uuid; + + uuid() { + return uuid(this.id); + } +} \ No newline at end of file diff --git a/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-webgl/Renderbuffer.js b/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-webgl/Renderbuffer.js new file mode 100644 index 0000000..d3182ae --- /dev/null +++ b/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-webgl/Renderbuffer.js @@ -0,0 +1,21 @@ +import {getTransferedObjectUUID} from './classUtils'; + +const name = 'WebGLRenderBuffer'; + +function uuid(id) { + return getTransferedObjectUUID(name, id); +} + +export default class WebGLRenderbuffer { + className = name; + + constructor(id) { + this.id = id; + } + + static uuid = uuid; + + uuid() { + return uuid(this.id); + } +} \ No newline at end of file diff --git a/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-webgl/RenderingContext.js b/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-webgl/RenderingContext.js new file mode 100644 index 0000000..5f9608f --- /dev/null +++ b/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-webgl/RenderingContext.js @@ -0,0 +1,1191 @@ +import GLenum from './GLenum'; +import ActiveInfo from './ActiveInfo'; +import Buffer from './Buffer'; +import Framebuffer from './Framebuffer'; +import Renderbuffer from './Renderbuffer'; +import Texture from './Texture'; +import Program from './Program'; +import Shader from './Shader'; +import ShaderPrecisionFormat from './ShaderPrecisionFormat'; +import UniformLocation from './UniformLocation'; +import GLmethod from './GLmethod'; + +const processArray = (array, checkArrayType = false) => { + + function joinArray(arr, sep) { + let res = ''; + for (let i = 0; i < arr.length; i++) { + if (i !== 0) { + res += sep; + } + res += arr[i]; + } + return res; + } + + let type = 'Float32Array'; + if (checkArrayType) { + if (array instanceof Uint8Array) { + type = 'Uint8Array' + } else if (array instanceof Uint16Array) { + type = 'Uint16Array'; + } else if (array instanceof Uint32Array) { + type = 'Uint32Array'; + } else if (array instanceof Float32Array) { + type = 'Float32Array'; + } else { + throw new Error('Check array type failed. Array type is ' + typeof array); + } + } + + const ArrayTypes = { + Uint8Array: 1, + Uint16Array: 2, + Uint32Array: 4, + Float32Array: 14 + }; + return ArrayTypes[type] + ',' + btoa(joinArray(array, ',')) +} + +export default class WebGLRenderingContext { + + // static GBridge = null; + + className = 'WebGLRenderingContext'; + + constructor(canvas, type, attrs) { + this._canvas = canvas; + this._type = type; + this._version = 'WebGL 1.0'; + this._attrs = attrs; + this._map = new Map(); + + Object.keys(GLenum) + .forEach(name => Object.defineProperty(this, name, { + value: GLenum[name] + })); + } + + get canvas() { + return this._canvas; + } + + activeTexture = function (textureUnit) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.activeTexture + ',' + textureUnit, + true + ); + } + + attachShader = function (progarm, shader) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.attachShader + ',' + progarm.id + ',' + shader.id, + true + ); + } + + bindAttribLocation = function (program, index, name) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.bindAttribLocation + ',' + program.id + ',' + index + ',' + name, + true + ) + } + + bindBuffer = function (target, buffer) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.bindBuffer + ',' + target + ',' + (buffer ? buffer.id : 0), + true + ); + } + + bindFramebuffer = function (target, framebuffer) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.bindFramebuffer + ',' + target + ',' + (framebuffer ? framebuffer.id : 0), + true + ) + } + + bindRenderbuffer = function (target, renderBuffer) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.bindRenderbuffer + ',' + target + ',' + (renderBuffer ? renderBuffer.id : 0), + true + ) + } + + bindTexture = function (target, texture) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.bindTexture + ',' + target + ',' + (texture ? texture.id : 0), + true + ) + } + + blendColor = function (r, g, b, a) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.blendColor + ',' + target + ',' + r + ',' + g + ',' + b + ',' + a, + true + ) + } + + blendEquation = function (mode) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.blendEquation + ',' + mode, + true + ) + } + + blendEquationSeparate = function (modeRGB, modeAlpha) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.blendEquationSeparate + ',' + modeRGB + ',' + modeAlpha, + true + ) + } + + + blendFunc = function (sfactor, dfactor) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.blendFunc + ',' + sfactor + ',' + dfactor, + true + ); + } + + blendFuncSeparate = function (srcRGB, dstRGB, srcAlpha, dstAlpha) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.blendFuncSeparate + ',' + srcRGB + ',' + dstRGB + ',' + srcAlpha + ',' + dstAlpha, + true + ); + } + + bufferData = function (target, data, usage) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.bufferData + ',' + target + ',' + processArray(data, true) + ',' + usage, + true + ) + } + + bufferSubData = function (target, offset, data) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.bufferSubData + ',' + target + ',' + offset + ',' + processArray(data, true), + true + ) + } + + checkFramebufferStatus = function (target) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.checkFramebufferStatus + ',' + target + ); + return Number(result); + } + + clear = function (mask) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.clear + ',' + mask + ); + this._canvas._needRender = true; + } + + clearColor = function (r, g, b, a) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.clearColor + ',' + r + ',' + g + ',' + b, + true + ) + } + + clearDepth = function (depth) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.clearDepth + ',' + depth, + true + ) + } + + clearStencil = function (s) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.clearStencil + ',' + s + ); + } + + colorMask = function (r, g, b, a) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.colorMask + ',' + r + ',' + g + ',' + b + ',' + a + ) + } + + compileShader = function (shader) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.compileShader + ',' + shader.id, + true + ) + } + + compressedTexImage2D = function (target, level, internalformat, width, height, border, pixels) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.compressedTexImage2D + ',' + target + ',' + level + ',' + internalformat + ',' + + width + ',' + height + ',' + border + ',' + processArray(pixels), + true + ) + } + + compressedTexSubImage2D = function (target, level, xoffset, yoffset, width, height, format, pixels) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.compressedTexSubImage2D + ',' + target + ',' + level + ',' + xoffset + ',' + yoffset + ',' + + width + ',' + height + ',' + format + ',' + processArray(pixels), + true + ) + } + + + copyTexImage2D = function (target, level, internalformat, x, y, width, height, border) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.copyTexImage2D + ',' + target + ',' + level + ',' + internalformat + ',' + x + ',' + y + ',' + + width + ',' + height + ',' + border, + true + ); + } + + copyTexSubImage2D = function (target, level, xoffset, yoffset, x, y, width, height) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.copyTexSubImage2D + ',' + target + ',' + level + ',' + xoffset + ',' + yoffset + ',' + x + ',' + y + ',' + + width + ',' + height + ); + } + + createBuffer = function () { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.createBuffer + '' + ); + const buffer = new Buffer(result); + this._map.set(buffer.uuid(), buffer); + return buffer; + } + + createFramebuffer = function () { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.createFramebuffer + '' + ); + const framebuffer = new Framebuffer(result); + this._map.set(framebuffer.uuid(), framebuffer); + return framebuffer; + } + + + createProgram = function () { + const id = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.createProgram + '' + ); + const program = new Program(id); + this._map.set(program.uuid(), program); + return program; + } + + createRenderbuffer = function () { + const id = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.createRenderbuffer + '' + ) + const renderBuffer = new Renderbuffer(id); + this._map.set(renderBuffer.uuid(), renderBuffer); + return renderBuffer; + } + + createShader = function (type) { + const id = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.createShader + ',' + type + ) + const shader = new Shader(id, type); + this._map.set(shader.uuid(), shader); + return shader; + } + + createTexture = function () { + const id = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.createTexture + '' + ); + const texture = new Texture(id); + this._map.set(texture.uuid(), texture); + return texture; + } + + cullFace = function (mode) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.cullFace + ',' + mode, + true + ) + } + + + deleteBuffer = function (buffer) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.deleteBuffer + ',' + buffer.id, + true + ) + } + + deleteFramebuffer = function (framebuffer) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.deleteFramebuffer + ',' + framebuffer.id, + true + ) + } + + deleteProgram = function (program) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.deleteProgram + ',' + program.id, + true + ) + } + + deleteRenderbuffer = function (renderbuffer) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.deleteRenderbuffer + ',' + renderbuffer.id, + true + ) + } + + deleteShader = function (shader) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.deleteShader + ',' + shader.id, + true + ) + } + + deleteTexture = function (texture) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.deleteTexture + ',' + texture.id, + true + ) + } + + depthFunc = function (func) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.depthFunc + ',' + func + ) + } + + depthMask = function (flag) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.depthMask + ',' + Number(flag), + true + ) + } + + depthRange = function (zNear, zFar) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.depthRange + ',' + zNear + ',' + zFar, + true + ) + } + + detachShader = function (program, shader) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.detachShader + ',' + program.id + ',' + shader.id, + true + ) + } + + disable = function (cap) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.disable + ',' + cap, + true + ) + } + + disableVertexAttribArray = function (index) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.disableVertexAttribArray + ',' + index, + true + ); + } + + drawArrays = function (mode, first, count) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.drawArrays + ',' + mode + ',' + first + ',' + count + ) + this._canvas._needRender = true; + } + + drawElements = function (mode, count, type, offset) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.drawElements + ',' + mode + ',' + count + ',' + type + ',' + offset + ';' + ); + this._canvas._needRender = true; + } + + enable = function (cap) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.enable + ',' + cap, + true + ); + } + + enableVertexAttribArray = function (index) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.enableVertexAttribArray + ',' + index, + true + ) + } + + + flush = function () { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.flush + '' + ) + } + + framebufferRenderbuffer = function (target, attachment, textarget, texture, level) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.framebufferRenderbuffer + ',' + target + ',' + attachment + ',' + textarget + ',' + (texture ? texture.id : 0) + ',' + level, + true + ) + } + + framebufferTexture2D = function (target, attachment, textarget, texture, level) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.framebufferTexture2D + ',' + target + ',' + attachment + ',' + textarget + ',' + (texture ? texture.id : 0) + ',' + level, + true + ) + } + + frontFace = function (mode) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.frontFace + ',' + mode, + true + ) + } + + generateMipmap = function (target) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.generateMipmap + ',' + target, + true + ) + } + + getActiveAttrib = function (progarm, index) { + const resultString = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getActiveAttrib + ',' + progarm.id + ',' + index + ) + const [type, size, name] = resultString.split(','); + return new ActiveInfo({ + type: Number(type), + size: Number(size), + name + }); + } + + getActiveUniform = function (progarm, index) { + const resultString = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getActiveUniform + ',' + progarm.id + ',' + index + ); + const [type, size, name] = resultString.split(','); + return new ActiveInfo({ + type: Number(type), + size: Number(size), + name + }) + } + + getAttachedShaders = function (progarm) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getAttachedShaders + ',' + progarm.id + ); + const [type, ...ids] = result; + return ids.map(id => this._map.get(Shader.uuid(id))); + } + + getAttribLocation = function (progarm, name) { + return WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getAttribLocation + ',' + progarm.id + ',' + name + ) + } + + getBufferParameter = function (target, pname) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getBufferParameter + ',' + target + ',' + pname + ); + const [type, res] = getBufferParameter; + return res; + } + + getError = function () { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getError + '' + ) + return result; + } + + getExtension = function (name) { + return null; + } + + getFramebufferAttachmentParameter = function (target, attachment, pname) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getFramebufferAttachmentParameter + ',' + target + ',' + attachment + ',' + pname + ) + switch (pname) { + case GLenum.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: + return this._map.get(Renderbuffer.uuid(result)) || this._map.get(Texture.uuid(result)) || null; + default: + return result; + } + } + + getParameter = function (pname) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getParameter + ',' + pname + ) + switch (pname) { + case GLenum.VERSION: + return this._version; + case GLenum.ARRAY_BUFFER_BINDING: // buffer + case GLenum.ELEMENT_ARRAY_BUFFER_BINDING: // buffer + return this._map.get(Buffer.uuid(result)) || null; + case GLenum.CURRENT_PROGRAM: // program + return this._map.get(Program.uuid(result)) || null; + case GLenum.FRAMEBUFFER_BINDING: // framebuffer + return this._map.get(Framebuffer.uuid(result)) || null; + case GLenum.RENDERBUFFER_BINDING: // renderbuffer + return this._map.get(Renderbuffer.uuid(result)) || null; + case GLenum.TEXTURE_BINDING_2D: // texture + case GLenum.TEXTURE_BINDING_CUBE_MAP: // texture + return this._map.get(Texture.uuid(result)) || null; + case GLenum.ALIASED_LINE_WIDTH_RANGE: // Float32Array + case GLenum.ALIASED_POINT_SIZE_RANGE: // Float32Array + case GLenum.BLEND_COLOR: // Float32Array + case GLenum.COLOR_CLEAR_VALUE: // Float32Array + case GLenum.DEPTH_RANGE: // Float32Array + case GLenum.MAX_VIEWPORT_DIMS: // Int32Array + case GLenum.SCISSOR_BOX: // Int32Array + case GLenum.VIEWPORT: // Int32Array + case GLenum.COMPRESSED_TEXTURE_FORMATS: // Uint32Array + default: + const [type, ...res] = result.split(','); + if (res.length === 1) { + return Number(res[0]); + } else { + return res.map(Number); + } + } + } + + getProgramInfoLog = function (progarm) { + return WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getProgramInfoLog + ',' + progarm.id + ) + } + + getProgramParameter = function (program, pname) { + const res = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getProgramParameter + ',' + program.id + ',' + pname + ); + + const [type, result] = res.split(',').map(i => parseInt(i)); + + if (type === 1) { + return Boolean(result); + } else if (type === 2) { + return result; + } else { + throw new Error('Unrecongized program paramater ' + res + ', type: ' + typeof res); + } + } + + + getRenderbufferParameter = function (target, pname) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getRenderbufferParameter + ',' + target + ',' + pname + ) + return result; + } + + + getShaderInfoLog = function (shader) { + return WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getShaderInfoLog + ',' + shader.id + ); + } + + getShaderParameter = function (shader, pname) { + return WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getShaderParameter + ',' + shader.id + ',' + pname + ) + } + + getShaderPrecisionFormat = function (shaderType, precisionType) { + const [rangeMin, rangeMax, precision] = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getShaderPrecisionFormat + ',' + shaderType + ',' + precisionType + ); + const shaderPrecisionFormat = new ShaderPrecisionFormat({ + rangeMin: Number(rangeMin), + rangeMax: Number(rangeMax), + precision: Number(precision) + }); + return shaderPrecisionFormat; + } + + getShaderSource = function (shader) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getShaderSource + ',' + shader.id + ); + return result; + } + + getSupportedExtensions = function () { + return Object.keys({}); + } + + getTexParameter = function (target, pname) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getTexParameter + ',' + target + ',' + pname + ) + return result; + } + + getUniformLocation = function (program, name) { + const id = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getUniformLocation + ',' + program.id + ',' + name + ); + if (id === -1) { + return null; + } else { + return new UniformLocation(Number(id)); + } + } + + getVertexAttrib = function (index, pname) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getVertexAttrib + ',' + index + ',' + pname + ); + switch (pname) { + case GLenum.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: + return this._map.get(Buffer.uuid(result)) || null; + case GLenum.CURRENT_VERTEX_ATTRIB: // Float32Array + default: + return result; + } + } + + getVertexAttribOffset = function (index, pname) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getVertexAttribOffset + ',' + index + ',' + pname + ) + return Number(result); + } + + isBuffer = function (buffer) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.isBuffer + ',' + buffer.id + ) + return Boolean(result); + } + + isContextLost = function () { + return false; + } + + isEnabled = function (cap) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.isEnabled + ',' + cap + ) + return Boolean(result); + } + + isFramebuffer = function (framebuffer) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.isFramebuffer + ',' + framebuffer.id + ) + return Boolean(result); + } + + isProgram = function (program) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.isProgram + ',' + program.id + ) + return Boolean(result); + } + + isRenderbuffer = function (renderBuffer) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.isRenderbuffer + ',' + renderbuffer.id + ) + return Boolean(result); + } + + isShader = function (shader) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.isShader + ',' + shader.id + ) + return Boolean(result); + } + + isTexture = function (texture) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.isTexture + ',' + texture.id + ); + return Boolean(result); + } + + lineWidth = function (width) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.lineWidth + ',' + width, + true + ) + } + + linkProgram = function (program) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.linkProgram + ',' + program.id, + true + ); + } + + + pixelStorei = function (pname, param) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.pixelStorei + ',' + pname + ',' + Number(param) + ) + } + + polygonOffset = function (factor, units) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.polygonOffset + ',' + factor + ',' + units + ) + } + + readPixels = function (x, y, width, height, format, type, pixels) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.readPixels + ',' + x + ',' + y + ',' + width + ',' + height + ',' + format + ',' + type + ) + return result; + } + + renderbufferStorage = function (target, internalFormat, width, height) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.renderbufferStorage + ',' + target + ',' + internalFormat + ',' + width + ',' + height, + true + ) + } + + sampleCoverage = function (value, invert) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.sampleCoverage + ',' + value + ',' + Number(invert), + true + ) + } + + scissor = function (x, y, width, height) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.scissor + ',' + x + ',' + y + ',' + width + ',' + height, + true + ) + } + + shaderSource = function (shader, source) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.shaderSource + ',' + shader.id + ',' + source + ) + } + + stencilFunc = function (func, ref, mask) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.stencilFunc + ',' + func + ',' + ref + ',' + mask, + true + ) + } + + stencilFuncSeparate = function (face, func, ref, mask) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.stencilFuncSeparate + ',' + face + ',' + func + ',' + ref + ',' + mask, + true + ) + } + + stencilMask = function (mask) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.stencilMask + ',' + mask, + true + ) + } + + stencilMaskSeparate = function (face, mask) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.stencilMaskSeparate + ',' + face + ',' + mask, + true + ) + } + + stencilOp = function (fail, zfail, zpass) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.stencilOp + ',' + fail + ',' + zfail + ',' + zpass + ) + } + + stencilOpSeparate = function (face, fail, zfail, zpass) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.stencilOp + ',' + face + ',' + fail + ',' + zfail + ',' + zpass, + true + ) + } + + texImage2D = function (...args) { + WebGLRenderingContext.GBridge.texImage2D(this._canvas.id, ...args); + } + + + texParameterf = function (target, pname, param) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.texParameterf + ',' + target + ',' + pname + ',' + param, + true + ) + } + + texParameteri = function (target, pname, param) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.texParameteri + ',' + target + ',' + pname + ',' + param + ) + } + + texSubImage2D = function (...args) { + WebGLRenderingContext.GBridge.texSubImage2D(this._canvas.id, ...args); + } + + uniform1f = function (location, v0) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform1f + ',' + location.id + ',' + v0 + ) + } + + uniform1fv = function (location, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform1fv + ',' + location.id + ',' + processArray(value), + true + ) + } + + uniform1i = function (location, v0) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform1i + ',' + location.id + ',' + v0, + // true + ) + } + + uniform1iv = function (location, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform1iv + ',' + location.id + ',' + processArray(value), + true + ) + } + + uniform2f = function (location, v0, v1) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform2f + ',' + location.id + ',' + v0 + ',' + v1, + true + ) + } + + uniform2fv = function (location, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform2fv + ',' + location.id + ',' + processArray(value), + true + ) + } + + uniform2i = function (location, v0, v1) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform2i + ',' + location.id + ',' + v0 + ',' + v1, + true + ) + } + + uniform2iv = function (location, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform2iv + ',' + location.id + ',' + processArray(value), + true + ) + } + + uniform3f = function (location, v0, v1, v2) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform3f + ',' + location.id + ',' + v0 + ',' + v1 + ',' + v2, + true + ) + } + + uniform3fv = function (location, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform3fv + ',' + location.id + ',' + processArray(value), + true + ) + } + + uniform3i = function (location, v0, v1, v2) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform3i + ',' + location.id + ',' + v0 + ',' + v1 + ',' + v2, + true + ) + } + + uniform3iv = function (location, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform3iv + ',' + location.id + ',' + processArray(value), + true + ) + } + + uniform4f = function (location, v0, v1, v2, v3) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform4f + ',' + location.id + ',' + v0 + ',' + v1 + ',' + v2 + ',' + v3, + true + ) + } + + uniform4fv = function (location, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform4fv + ',' + location.id + ',' + processArray(value), + true + ) + } + + uniform4i = function (location, v0, v1, v2, v3) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform4i + ',' + location.id + ',' + v0 + ',' + v1 + ',' + v2 + ',' + v3, + true + ) + } + + uniform4iv = function (location, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform4iv + ',' + location.id + ',' + processArray(value, true), + true + ) + } + + uniformMatrix2fv = function (location, transpose, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniformMatrix2fv + ',' + location.id + ',' + Number(transpose) + ',' + processArray(value), + true + ) + } + + uniformMatrix3fv = function (location, transpose, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniformMatrix3fv + ',' + location.id + ',' + Number(transpose) + ',' + processArray(value), + true + ) + } + + uniformMatrix4fv = function (location, transpose, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniformMatrix4fv + ',' + location.id + ',' + Number(transpose) + ',' + processArray(value), + true + ); + } + + useProgram = function (progarm) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.useProgram + ',' + progarm.id + '', + true + ) + } + + + validateProgram = function (program) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.validateProgram + ',' + program.id, + true + ) + } + + vertexAttrib1f = function (index, v0) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.vertexAttrib1f + ',' + index + ',' + v0, + true + ) + } + + vertexAttrib2f = function (index, v0, v1) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.vertexAttrib2f + ',' + index + ',' + v0 + ',' + v1, + true + ) + } + + vertexAttrib3f = function (index, v0, v1, v2) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.vertexAttrib3f + ',' + index + ',' + v0 + ',' + v1 + ',' + v2, + true + ) + } + + vertexAttrib4f = function (index, v0, v1, v2, v3) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.vertexAttrib4f + ',' + index + ',' + v0 + ',' + v1 + ',' + v2 + ',' + v3, + true + ) + } + + vertexAttrib1fv = function (index, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.vertexAttrib1fv + ',' + index + ',' + processArray(value), + true + ) + } + + vertexAttrib2fv = function (index, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.vertexAttrib2fv + ',' + index + ',' + processArray(value), + true + ) + } + + vertexAttrib3fv = function (index, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.vertexAttrib3fv + ',' + index + ',' + processArray(value), + true + ) + } + + vertexAttrib4fv = function (index, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.vertexAttrib4fv + ',' + index + ',' + processArray(value), + true + ) + } + + vertexAttribPointer = function (index, size, type, normalized, stride, offset) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.vertexAttribPointer + ',' + index + ',' + size + ',' + type + ',' + Number(normalized) + ',' + stride + ',' + offset, + true + ) + } + + viewport = function (x, y, width, height) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.viewport + ',' + x + ',' + y + ',' + width + ',' + height, + true + ) + } +} \ No newline at end of file diff --git a/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-webgl/Shader.js b/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-webgl/Shader.js new file mode 100644 index 0000000..a763886 --- /dev/null +++ b/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-webgl/Shader.js @@ -0,0 +1,22 @@ +import {getTransferedObjectUUID} from './classUtils'; + +const name = 'WebGLShader'; + +function uuid(id) { + return getTransferedObjectUUID(name, id); +} + +export default class WebGLShader { + className = name; + + constructor(id, type) { + this.id = id; + this.type = type; + } + + static uuid = uuid; + + uuid() { + return uuid(this.id); + } +} \ No newline at end of file diff --git a/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-webgl/ShaderPrecisionFormat.js b/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-webgl/ShaderPrecisionFormat.js new file mode 100644 index 0000000..208d6c1 --- /dev/null +++ b/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-webgl/ShaderPrecisionFormat.js @@ -0,0 +1,11 @@ +export default class WebGLShaderPrecisionFormat { + className = 'WebGLShaderPrecisionFormat'; + + constructor({ + rangeMin, rangeMax, precision + }) { + this.rangeMin = rangeMin; + this.rangeMax = rangeMax; + this.precision = precision; + } +} \ No newline at end of file diff --git a/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-webgl/Texture.js b/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-webgl/Texture.js new file mode 100644 index 0000000..de4d806 --- /dev/null +++ b/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-webgl/Texture.js @@ -0,0 +1,22 @@ +import {getTransferedObjectUUID} from './classUtils'; + +const name = 'WebGLTexture'; + +function uuid(id) { + return getTransferedObjectUUID(name, id); +} + +export default class WebGLTexture { + className = name; + + constructor(id, type) { + this.id = id; + this.type = type; + } + + static uuid = uuid; + + uuid() { + return uuid(this.id); + } +} \ No newline at end of file diff --git a/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-webgl/UniformLocation.js b/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-webgl/UniformLocation.js new file mode 100644 index 0000000..f5e99dc --- /dev/null +++ b/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-webgl/UniformLocation.js @@ -0,0 +1,22 @@ +import {getTransferedObjectUUID} from './classUtils'; + +const name = 'WebGLUniformLocation'; + +function uuid(id) { + return getTransferedObjectUUID(name, id); +} + +export default class WebGLUniformLocation { + className = name; + + constructor(id, type) { + this.id = id; + this.type = type; + } + + static uuid = uuid; + + uuid() { + return uuid(this.id); + } +} \ No newline at end of file diff --git a/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-webgl/classUtils.js b/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-webgl/classUtils.js new file mode 100644 index 0000000..88716be --- /dev/null +++ b/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/context-webgl/classUtils.js @@ -0,0 +1,3 @@ +export function getTransferedObjectUUID(name, id) { + return `${name.toLowerCase()}-${id}`; +} \ No newline at end of file diff --git a/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/env/canvas.js b/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/env/canvas.js new file mode 100644 index 0000000..a8d9bb9 --- /dev/null +++ b/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/env/canvas.js @@ -0,0 +1,74 @@ +import GContext2D from '../context-2d/RenderingContext'; +import GContextWebGL from '../context-webgl/RenderingContext'; + +export default class GCanvas { + + // static GBridge = null; + + id = null; + + _needRender = true; + + constructor(id, { disableAutoSwap }) { + this.id = id; + + this._disableAutoSwap = disableAutoSwap; + if (disableAutoSwap) { + this._swapBuffers = () => { + GCanvas.GBridge.render(this.id); + } + } + } + + getContext(type) { + + let context = null; + + if (type.match(/webgl/i)) { + context = new GContextWebGL(this); + + context.componentId = this.id; + + if (!this._disableAutoSwap) { + const render = () => { + if (this._needRender) { + GCanvas.GBridge.render(this.id); + this._needRender = false; + } + } + setInterval(render, 16); + } + + GCanvas.GBridge.callSetContextType(this.id, 1); // 0 for 2d; 1 for webgl + } else if (type.match(/2d/i)) { + context = new GContext2D(this); + + context.componentId = this.id; + +// const render = ( callback ) => { +// +// const commands = context._drawCommands; +// context._drawCommands = ''; +// +// GCanvas.GBridge.render2d(this.id, commands, callback); +// this._needRender = false; +// } +// //draw方法触发 +// context._flush = render; +// //setInterval(render, 16); + + GCanvas.GBridge.callSetContextType(this.id, 0); + } else { + throw new Error('not supported context ' + type); + } + + return context; + + } + + reset() { + GCanvas.GBridge.callReset(this.id); + } + + +} \ No newline at end of file diff --git a/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/env/image.js b/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/env/image.js new file mode 100644 index 0000000..9499a51 --- /dev/null +++ b/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/env/image.js @@ -0,0 +1,96 @@ +let incId = 1; + +const noop = function () { }; + +class GImage { + + static GBridge = null; + + constructor() { + this._id = incId++; + this._width = 0; + this._height = 0; + this._src = undefined; + this._onload = noop; + this._onerror = noop; + this.complete = false; + } + + get width() { + return this._width; + } + set width(v) { + this._width = v; + } + + get height() { + return this._height; + } + + set height(v) { + this._height = v; + } + + get src() { + return this._src; + } + + set src(v) { + + if (v.startsWith('//')) { + v = 'http:' + v; + } + + this._src = v; + + GImage.GBridge.perloadImage([this._src, this._id], (data) => { + if (typeof data === 'string') { + data = JSON.parse(data); + } + if (data.error) { + var evt = { type: 'error', target: this }; + this.onerror(evt); + } else { + this.complete = true; + this.width = typeof data.width === 'number' ? data.width : 0; + this.height = typeof data.height === 'number' ? data.height : 0; + var evt = { type: 'load', target: this }; + this.onload(evt); + } + }); + } + + addEventListener(name, listener) { + if (name === 'load') { + this.onload = listener; + } else if (name === 'error') { + this.onerror = listener; + } + } + + removeEventListener(name, listener) { + if (name === 'load') { + this.onload = noop; + } else if (name === 'error') { + this.onerror = noop; + } + } + + get onload() { + return this._onload; + } + + set onload(v) { + this._onload = v; + } + + get onerror() { + return this._onerror; + } + + set onerror(v) { + this._onerror = v; + } +} + +export default GImage; \ No newline at end of file diff --git a/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/env/tool.js b/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/env/tool.js new file mode 100644 index 0000000..d3fb398 --- /dev/null +++ b/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/env/tool.js @@ -0,0 +1,24 @@ + +export function ArrayBufferToBase64 (buffer) { + var binary = ''; + var bytes = new Uint8ClampedArray(buffer); + for (var len = bytes.byteLength, i = 0; i < len; i++) { + binary += String.fromCharCode(bytes[i]); + } + return btoa(binary); +} + +export function Base64ToUint8ClampedArray(base64String) { + const padding = '='.repeat((4 - base64String.length % 4) % 4); + const base64 = (base64String + padding) + .replace(/\-/g, '+') + .replace(/_/g, '/'); + + const rawData = atob(base64); + const outputArray = new Uint8ClampedArray(rawData.length); + + for (let i = 0; i < rawData.length; ++i) { + outputArray[i] = rawData.charCodeAt(i); + } + return outputArray; +} \ No newline at end of file diff --git a/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/index.js b/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/index.js new file mode 100644 index 0000000..a34ad58 --- /dev/null +++ b/uni_modules/Sansnn-uQRCode/js_sdk/gcanvas/index.js @@ -0,0 +1,39 @@ +import GCanvas from './env/canvas'; +import GImage from './env/image'; + +import GWebGLRenderingContext from './context-webgl/RenderingContext'; +import GContext2D from './context-2d/RenderingContext'; + +import GBridgeWeex from './bridge/bridge-weex'; + +export let Image = GImage; + +export let WeexBridge = GBridgeWeex; + +export function enable(el, { bridge, debug, disableAutoSwap, disableComboCommands } = {}) { + + const GBridge = GImage.GBridge = GCanvas.GBridge = GWebGLRenderingContext.GBridge = GContext2D.GBridge = bridge; + + GBridge.callEnable(el.ref, [ + 0, // renderMode: 0--RENDERMODE_WHEN_DIRTY, 1--RENDERMODE_CONTINUOUSLY + -1, // hybridLayerType: 0--LAYER_TYPE_NONE 1--LAYER_TYPE_SOFTWARE 2--LAYER_TYPE_HARDWARE + false, // supportScroll + false, // newCanvasMode + 1, // compatible + 'white',// clearColor + false // sameLevel: newCanvasMode = true && true => GCanvasView and Webview is same level + ]); + + if (debug === true) { + GBridge.callEnableDebug(); + } + if (disableComboCommands) { + GBridge.callEnableDisableCombo(); + } + + var canvas = new GCanvas(el.ref, { disableAutoSwap }); + canvas.width = el.style.width; + canvas.height = el.style.height; + + return canvas; +}; \ No newline at end of file diff --git a/uni_modules/Sansnn-uQRCode/js_sdk/uqrcode/uqrcode.js b/uni_modules/Sansnn-uQRCode/js_sdk/uqrcode/uqrcode.js new file mode 100644 index 0000000..2290ab3 --- /dev/null +++ b/uni_modules/Sansnn-uQRCode/js_sdk/uqrcode/uqrcode.js @@ -0,0 +1,34 @@ +//--------------------------------------------------------------------- +// uQRCode二维码生成插件 v4.0.6 +// +// uQRCode是一款基于Javascript环境开发的二维码生成插件,适用所有Javascript运行环境的前端应用和Node.js。 +// +// Copyright (c) Sansnn uQRCode All rights reserved. +// +// Licensed under the Apache License, Version 2.0. +// http://www.apache.org/licenses/LICENSE-2.0 +// +// github地址: +// https://github.com/Sansnn/uQRCode +// +// npm地址: +// https://www.npmjs.com/package/uqrcodejs +// +// uni-app插件市场地址: +// https://ext.dcloud.net.cn/plugin?id=1287 +// +// 复制使用请保留本段注释,感谢支持开源! +// +//--------------------------------------------------------------------- + +//--------------------------------------------------------------------- +// 当前文件格式为 es,将 bundle 保留为 ES 模块文件,适用于其他打包工具以及支持 + + diff --git a/uview-ui/components/u-alert-tips/u-alert-tips.vue b/uview-ui/components/u-alert-tips/u-alert-tips.vue new file mode 100644 index 0000000..e81fc37 --- /dev/null +++ b/uview-ui/components/u-alert-tips/u-alert-tips.vue @@ -0,0 +1,256 @@ + + + + + diff --git a/uview-ui/components/u-avatar-cropper/u-avatar-cropper.vue b/uview-ui/components/u-avatar-cropper/u-avatar-cropper.vue new file mode 100644 index 0000000..c0992dd --- /dev/null +++ b/uview-ui/components/u-avatar-cropper/u-avatar-cropper.vue @@ -0,0 +1,290 @@ + + + + + diff --git a/uview-ui/components/u-avatar-cropper/weCropper.js b/uview-ui/components/u-avatar-cropper/weCropper.js new file mode 100644 index 0000000..df02483 --- /dev/null +++ b/uview-ui/components/u-avatar-cropper/weCropper.js @@ -0,0 +1,1265 @@ +/** + * we-cropper v1.3.9 + * (c) 2020 dlhandsome + * @license MIT + */ +(function(global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global.WeCropper = factory()); +}(this, (function() { + 'use strict'; + + var device = void 0; + var TOUCH_STATE = ['touchstarted', 'touchmoved', 'touchended']; + + function firstLetterUpper(str) { + return str.charAt(0).toUpperCase() + str.slice(1) + } + + function setTouchState(instance) { + var arg = [], + len = arguments.length - 1; + while (len-- > 0) arg[len] = arguments[len + 1]; + + TOUCH_STATE.forEach(function(key, i) { + if (arg[i] !== undefined) { + instance[key] = arg[i]; + } + }); + } + + function validator(instance, o) { + Object.defineProperties(instance, o); + } + + function getDevice() { + if (!device) { + device = uni.getSystemInfoSync(); + } + return device + } + + var tmp = {}; + + var ref = getDevice(); + var pixelRatio = ref.pixelRatio; + + var DEFAULT = { + id: { + default: 'cropper', + get: function get() { + return tmp.id + }, + set: function set(value) { + if (typeof(value) !== 'string') { + console.error(("id:" + value + " is invalid")); + } + tmp.id = value; + } + }, + width: { + default: 750, + get: function get() { + return tmp.width + }, + set: function set(value) { + if (typeof(value) !== 'number') { + console.error(("width:" + value + " is invalid")); + } + tmp.width = value; + } + }, + height: { + default: 750, + get: function get() { + return tmp.height + }, + set: function set(value) { + if (typeof(value) !== 'number') { + console.error(("height:" + value + " is invalid")); + } + tmp.height = value; + } + }, + pixelRatio: { + default: pixelRatio, + get: function get() { + return tmp.pixelRatio + }, + set: function set(value) { + if (typeof(value) !== 'number') { + console.error(("pixelRatio:" + value + " is invalid")); + } + tmp.pixelRatio = value; + } + }, + scale: { + default: 2.5, + get: function get() { + return tmp.scale + }, + set: function set(value) { + if (typeof(value) !== 'number') { + console.error(("scale:" + value + " is invalid")); + } + tmp.scale = value; + } + }, + zoom: { + default: 5, + get: function get() { + return tmp.zoom + }, + set: function set(value) { + if (typeof(value) !== 'number') { + console.error(("zoom:" + value + " is invalid")); + } else if (value < 0 || value > 10) { + console.error("zoom should be ranged in 0 ~ 10"); + } + tmp.zoom = value; + } + }, + src: { + default: '', + get: function get() { + return tmp.src + }, + set: function set(value) { + if (typeof(value) !== 'string') { + console.error(("src:" + value + " is invalid")); + } + tmp.src = value; + } + }, + cut: { + default: {}, + get: function get() { + return tmp.cut + }, + set: function set(value) { + if (typeof(value) !== 'object') { + console.error(("cut:" + value + " is invalid")); + } + tmp.cut = value; + } + }, + boundStyle: { + default: {}, + get: function get() { + return tmp.boundStyle + }, + set: function set(value) { + if (typeof(value) !== 'object') { + console.error(("boundStyle:" + value + " is invalid")); + } + tmp.boundStyle = value; + } + }, + onReady: { + default: null, + get: function get() { + return tmp.ready + }, + set: function set(value) { + tmp.ready = value; + } + }, + onBeforeImageLoad: { + default: null, + get: function get() { + return tmp.beforeImageLoad + }, + set: function set(value) { + tmp.beforeImageLoad = value; + } + }, + onImageLoad: { + default: null, + get: function get() { + return tmp.imageLoad + }, + set: function set(value) { + tmp.imageLoad = value; + } + }, + onBeforeDraw: { + default: null, + get: function get() { + return tmp.beforeDraw + }, + set: function set(value) { + tmp.beforeDraw = value; + } + } + }; + + var ref$1 = getDevice(); + var windowWidth = ref$1.windowWidth; + + function prepare() { + var self = this; + + // v1.4.0 版本中将不再自动绑定we-cropper实例 + self.attachPage = function() { + var pages = getCurrentPages(); + // 获取到当前page上下文 + var pageContext = pages[pages.length - 1]; + // 把this依附在Page上下文的wecropper属性上,便于在page钩子函数中访问 + Object.defineProperty(pageContext, 'wecropper', { + get: function get() { + console.warn( + 'Instance will not be automatically bound to the page after v1.4.0\n\n' + + 'Please use a custom instance name instead\n\n' + + 'Example: \n' + + 'this.mycropper = new WeCropper(options)\n\n' + + '// ...\n' + + 'this.mycropper.getCropperImage()' + ); + return self + }, + configurable: true + }); + }; + + self.createCtx = function() { + var id = self.id; + var targetId = self.targetId; + + if (id) { + self.ctx = self.ctx || uni.createCanvasContext(id); + self.targetCtx = self.targetCtx || uni.createCanvasContext(targetId); + } else { + console.error("constructor: create canvas context failed, 'id' must be valuable"); + } + }; + + self.deviceRadio = windowWidth / 750; + } + + var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== + 'undefined' ? self : {}; + + + + + + function createCommonjsModule(fn, module) { + return module = { + exports: {} + }, fn(module, module.exports), module.exports; + } + + var tools = createCommonjsModule(function(module, exports) { + /** + * String type check + */ + exports.isStr = function(v) { + return typeof v === 'string'; + }; + /** + * Number type check + */ + exports.isNum = function(v) { + return typeof v === 'number'; + }; + /** + * Array type check + */ + exports.isArr = Array.isArray; + /** + * undefined type check + */ + exports.isUndef = function(v) { + return v === undefined; + }; + + exports.isTrue = function(v) { + return v === true; + }; + + exports.isFalse = function(v) { + return v === false; + }; + /** + * Function type check + */ + exports.isFunc = function(v) { + return typeof v === 'function'; + }; + /** + * Quick object check - this is primarily used to tell + * Objects from primitive values when we know the value + * is a JSON-compliant type. + */ + exports.isObj = exports.isObject = function(obj) { + return obj !== null && typeof obj === 'object' + }; + + /** + * Strict object type check. Only returns true + * for plain JavaScript objects. + */ + var _toString = Object.prototype.toString; + exports.isPlainObject = function(obj) { + return _toString.call(obj) === '[object Object]' + }; + + /** + * Check whether the object has the property. + */ + var hasOwnProperty = Object.prototype.hasOwnProperty; + exports.hasOwn = function(obj, key) { + return hasOwnProperty.call(obj, key) + }; + + /** + * Perform no operation. + * Stubbing args to make Flow happy without leaving useless transpiled code + * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/) + */ + exports.noop = function(a, b, c) {}; + + /** + * Check if val is a valid array index. + */ + exports.isValidArrayIndex = function(val) { + var n = parseFloat(String(val)); + return n >= 0 && Math.floor(n) === n && isFinite(val) + }; + }); + + var tools_7 = tools.isFunc; + var tools_10 = tools.isPlainObject; + + var EVENT_TYPE = ['ready', 'beforeImageLoad', 'beforeDraw', 'imageLoad']; + + function observer() { + var self = this; + + self.on = function(event, fn) { + if (EVENT_TYPE.indexOf(event) > -1) { + if (tools_7(fn)) { + event === 'ready' ? + fn(self) : + self[("on" + (firstLetterUpper(event)))] = fn; + } + } else { + console.error(("event: " + event + " is invalid")); + } + return self + }; + } + + function wxPromise(fn) { + return function(obj) { + var args = [], + len = arguments.length - 1; + while (len-- > 0) args[len] = arguments[len + 1]; + + if (obj === void 0) obj = {}; + return new Promise(function(resolve, reject) { + obj.success = function(res) { + resolve(res); + }; + obj.fail = function(err) { + reject(err); + }; + fn.apply(void 0, [obj].concat(args)); + }) + } + } + + function draw(ctx, reserve) { + if (reserve === void 0) reserve = false; + + return new Promise(function(resolve) { + ctx.draw(reserve, resolve); + }) + } + + var getImageInfo = wxPromise(uni.getImageInfo); + + var canvasToTempFilePath = wxPromise(uni.canvasToTempFilePath); + + var base64 = createCommonjsModule(function(module, exports) { + /*! http://mths.be/base64 v0.1.0 by @mathias | MIT license */ + (function(root) { + + // Detect free variables `exports`. + var freeExports = 'object' == 'object' && exports; + + // Detect free variable `module`. + var freeModule = 'object' == 'object' && module && + module.exports == freeExports && module; + + // Detect free variable `global`, from Node.js or Browserified code, and use + // it as `root`. + var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal; + if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) { + root = freeGlobal; + } + + /*--------------------------------------------------------------------------*/ + + var InvalidCharacterError = function(message) { + this.message = message; + }; + InvalidCharacterError.prototype = new Error; + InvalidCharacterError.prototype.name = 'InvalidCharacterError'; + + var error = function(message) { + // Note: the error messages used throughout this file match those used by + // the native `atob`/`btoa` implementation in Chromium. + throw new InvalidCharacterError(message); + }; + + var TABLE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; + // http://whatwg.org/html/common-microsyntaxes.html#space-character + var REGEX_SPACE_CHARACTERS = /[\t\n\f\r ]/g; + + // `decode` is designed to be fully compatible with `atob` as described in the + // HTML Standard. http://whatwg.org/html/webappapis.html#dom-windowbase64-atob + // The optimized base64-decoding algorithm used is based on @atk’s excellent + // implementation. https://gist.github.com/atk/1020396 + var decode = function(input) { + input = String(input) + .replace(REGEX_SPACE_CHARACTERS, ''); + var length = input.length; + if (length % 4 == 0) { + input = input.replace(/==?$/, ''); + length = input.length; + } + if ( + length % 4 == 1 || + // http://whatwg.org/C#alphanumeric-ascii-characters + /[^+a-zA-Z0-9/]/.test(input) + ) { + error( + 'Invalid character: the string to be decoded is not correctly encoded.' + ); + } + var bitCounter = 0; + var bitStorage; + var buffer; + var output = ''; + var position = -1; + while (++position < length) { + buffer = TABLE.indexOf(input.charAt(position)); + bitStorage = bitCounter % 4 ? bitStorage * 64 + buffer : buffer; + // Unless this is the first of a group of 4 characters… + if (bitCounter++ % 4) { + // …convert the first 8 bits to a single ASCII character. + output += String.fromCharCode( + 0xFF & bitStorage >> (-2 * bitCounter & 6) + ); + } + } + return output; + }; + + // `encode` is designed to be fully compatible with `btoa` as described in the + // HTML Standard: http://whatwg.org/html/webappapis.html#dom-windowbase64-btoa + var encode = function(input) { + input = String(input); + if (/[^\0-\xFF]/.test(input)) { + // Note: no need to special-case astral symbols here, as surrogates are + // matched, and the input is supposed to only contain ASCII anyway. + error( + 'The string to be encoded contains characters outside of the ' + + 'Latin1 range.' + ); + } + var padding = input.length % 3; + var output = ''; + var position = -1; + var a; + var b; + var c; + var buffer; + // Make sure any padding is handled outside of the loop. + var length = input.length - padding; + + while (++position < length) { + // Read three bytes, i.e. 24 bits. + a = input.charCodeAt(position) << 16; + b = input.charCodeAt(++position) << 8; + c = input.charCodeAt(++position); + buffer = a + b + c; + // Turn the 24 bits into four chunks of 6 bits each, and append the + // matching character for each of them to the output. + output += ( + TABLE.charAt(buffer >> 18 & 0x3F) + + TABLE.charAt(buffer >> 12 & 0x3F) + + TABLE.charAt(buffer >> 6 & 0x3F) + + TABLE.charAt(buffer & 0x3F) + ); + } + + if (padding == 2) { + a = input.charCodeAt(position) << 8; + b = input.charCodeAt(++position); + buffer = a + b; + output += ( + TABLE.charAt(buffer >> 10) + + TABLE.charAt((buffer >> 4) & 0x3F) + + TABLE.charAt((buffer << 2) & 0x3F) + + '=' + ); + } else if (padding == 1) { + buffer = input.charCodeAt(position); + output += ( + TABLE.charAt(buffer >> 2) + + TABLE.charAt((buffer << 4) & 0x3F) + + '==' + ); + } + + return output; + }; + + var base64 = { + 'encode': encode, + 'decode': decode, + 'version': '0.1.0' + }; + + // Some AMD build optimizers, like r.js, check for specific condition patterns + // like the following: + if ( + typeof undefined == 'function' && + typeof undefined.amd == 'object' && + undefined.amd + ) { + undefined(function() { + return base64; + }); + } else if (freeExports && !freeExports.nodeType) { + if (freeModule) { // in Node.js or RingoJS v0.8.0+ + freeModule.exports = base64; + } else { // in Narwhal or RingoJS v0.7.0- + for (var key in base64) { + base64.hasOwnProperty(key) && (freeExports[key] = base64[key]); + } + } + } else { // in Rhino or a web browser + root.base64 = base64; + } + + }(commonjsGlobal)); + }); + + function makeURI(strData, type) { + return 'data:' + type + ';base64,' + strData + } + + function fixType(type) { + type = type.toLowerCase().replace(/jpg/i, 'jpeg'); + var r = type.match(/png|jpeg|bmp|gif/)[0]; + return 'image/' + r + } + + function encodeData(data) { + var str = ''; + if (typeof data === 'string') { + str = data; + } else { + for (var i = 0; i < data.length; i++) { + str += String.fromCharCode(data[i]); + } + } + return base64.encode(str) + } + + /** + * 获取图像区域隐含的像素数据 + * @param canvasId canvas标识 + * @param x 将要被提取的图像数据矩形区域的左上角 x 坐标 + * @param y 将要被提取的图像数据矩形区域的左上角 y 坐标 + * @param width 将要被提取的图像数据矩形区域的宽度 + * @param height 将要被提取的图像数据矩形区域的高度 + * @param done 完成回调 + */ + function getImageData(canvasId, x, y, width, height, done) { + uni.canvasGetImageData({ + canvasId: canvasId, + x: x, + y: y, + width: width, + height: height, + success: function success(res) { + done(res, null); + }, + fail: function fail(res) { + done(null, res); + } + }); + } + + /** + * 生成bmp格式图片 + * 按照规则生成图片响应头和响应体 + * @param oData 用来描述 canvas 区域隐含的像素数据 { data, width, height } = oData + * @returns {*} base64字符串 + */ + function genBitmapImage(oData) { + // + // BITMAPFILEHEADER: http://msdn.microsoft.com/en-us/library/windows/desktop/dd183374(v=vs.85).aspx + // BITMAPINFOHEADER: http://msdn.microsoft.com/en-us/library/dd183376.aspx + // + var biWidth = oData.width; + var biHeight = oData.height; + var biSizeImage = biWidth * biHeight * 3; + var bfSize = biSizeImage + 54; // total header size = 54 bytes + + // + // typedef struct tagBITMAPFILEHEADER { + // WORD bfType; + // DWORD bfSize; + // WORD bfReserved1; + // WORD bfReserved2; + // DWORD bfOffBits; + // } BITMAPFILEHEADER; + // + var BITMAPFILEHEADER = [ + // WORD bfType -- The file type signature; must be "BM" + 0x42, 0x4D, + // DWORD bfSize -- The size, in bytes, of the bitmap file + bfSize & 0xff, bfSize >> 8 & 0xff, bfSize >> 16 & 0xff, bfSize >> 24 & 0xff, + // WORD bfReserved1 -- Reserved; must be zero + 0, 0, + // WORD bfReserved2 -- Reserved; must be zero + 0, 0, + // DWORD bfOffBits -- The offset, in bytes, from the beginning of the BITMAPFILEHEADER structure to the bitmap bits. + 54, 0, 0, 0 + ]; + + // + // typedef struct tagBITMAPINFOHEADER { + // DWORD biSize; + // LONG biWidth; + // LONG biHeight; + // WORD biPlanes; + // WORD biBitCount; + // DWORD biCompression; + // DWORD biSizeImage; + // LONG biXPelsPerMeter; + // LONG biYPelsPerMeter; + // DWORD biClrUsed; + // DWORD biClrImportant; + // } BITMAPINFOHEADER, *PBITMAPINFOHEADER; + // + var BITMAPINFOHEADER = [ + // DWORD biSize -- The number of bytes required by the structure + 40, 0, 0, 0, + // LONG biWidth -- The width of the bitmap, in pixels + biWidth & 0xff, biWidth >> 8 & 0xff, biWidth >> 16 & 0xff, biWidth >> 24 & 0xff, + // LONG biHeight -- The height of the bitmap, in pixels + biHeight & 0xff, biHeight >> 8 & 0xff, biHeight >> 16 & 0xff, biHeight >> 24 & 0xff, + // WORD biPlanes -- The number of planes for the target device. This value must be set to 1 + 1, 0, + // WORD biBitCount -- The number of bits-per-pixel, 24 bits-per-pixel -- the bitmap + // has a maximum of 2^24 colors (16777216, Truecolor) + 24, 0, + // DWORD biCompression -- The type of compression, BI_RGB (code 0) -- uncompressed + 0, 0, 0, 0, + // DWORD biSizeImage -- The size, in bytes, of the image. This may be set to zero for BI_RGB bitmaps + biSizeImage & 0xff, biSizeImage >> 8 & 0xff, biSizeImage >> 16 & 0xff, biSizeImage >> 24 & 0xff, + // LONG biXPelsPerMeter, unused + 0, 0, 0, 0, + // LONG biYPelsPerMeter, unused + 0, 0, 0, 0, + // DWORD biClrUsed, the number of color indexes of palette, unused + 0, 0, 0, 0, + // DWORD biClrImportant, unused + 0, 0, 0, 0 + ]; + + var iPadding = (4 - ((biWidth * 3) % 4)) % 4; + + var aImgData = oData.data; + + var strPixelData = ''; + var biWidth4 = biWidth << 2; + var y = biHeight; + var fromCharCode = String.fromCharCode; + + do { + var iOffsetY = biWidth4 * (y - 1); + var strPixelRow = ''; + for (var x = 0; x < biWidth; x++) { + var iOffsetX = x << 2; + strPixelRow += fromCharCode(aImgData[iOffsetY + iOffsetX + 2]) + + fromCharCode(aImgData[iOffsetY + iOffsetX + 1]) + + fromCharCode(aImgData[iOffsetY + iOffsetX]); + } + + for (var c = 0; c < iPadding; c++) { + strPixelRow += String.fromCharCode(0); + } + + strPixelData += strPixelRow; + } while (--y) + + var strEncoded = encodeData(BITMAPFILEHEADER.concat(BITMAPINFOHEADER)) + encodeData(strPixelData); + + return strEncoded + } + + /** + * 转换为图片base64 + * @param canvasId canvas标识 + * @param x 将要被提取的图像数据矩形区域的左上角 x 坐标 + * @param y 将要被提取的图像数据矩形区域的左上角 y 坐标 + * @param width 将要被提取的图像数据矩形区域的宽度 + * @param height 将要被提取的图像数据矩形区域的高度 + * @param type 转换图片类型 + * @param done 完成回调 + */ + function convertToImage(canvasId, x, y, width, height, type, done) { + if (done === void 0) done = function() {}; + + if (type === undefined) { + type = 'png'; + } + type = fixType(type); + if (/bmp/.test(type)) { + getImageData(canvasId, x, y, width, height, function(data, err) { + var strData = genBitmapImage(data); + tools_7(done) && done(makeURI(strData, 'image/' + type), err); + }); + } else { + console.error('暂不支持生成\'' + type + '\'类型的base64图片'); + } + } + + var CanvasToBase64 = { + convertToImage: convertToImage, + // convertToPNG: function (width, height, done) { + // return convertToImage(width, height, 'png', done) + // }, + // convertToJPEG: function (width, height, done) { + // return convertToImage(width, height, 'jpeg', done) + // }, + // convertToGIF: function (width, height, done) { + // return convertToImage(width, height, 'gif', done) + // }, + convertToBMP: function(ref, done) { + if (ref === void 0) ref = {}; + var canvasId = ref.canvasId; + var x = ref.x; + var y = ref.y; + var width = ref.width; + var height = ref.height; + if (done === void 0) done = function() {}; + + return convertToImage(canvasId, x, y, width, height, 'bmp', done) + } + }; + + function methods() { + var self = this; + + var boundWidth = self.width; // 裁剪框默认宽度,即整个画布宽度 + var boundHeight = self.height; // 裁剪框默认高度,即整个画布高度 + + var id = self.id; + var targetId = self.targetId; + var pixelRatio = self.pixelRatio; + + var ref = self.cut; + var x = ref.x; + if (x === void 0) x = 0; + var y = ref.y; + if (y === void 0) y = 0; + var width = ref.width; + if (width === void 0) width = boundWidth; + var height = ref.height; + if (height === void 0) height = boundHeight; + + self.updateCanvas = function(done) { + if (self.croperTarget) { + // 画布绘制图片 + self.ctx.drawImage( + self.croperTarget, + self.imgLeft, + self.imgTop, + self.scaleWidth, + self.scaleHeight + ); + } + tools_7(self.onBeforeDraw) && self.onBeforeDraw(self.ctx, self); + + self.setBoundStyle(self.boundStyle); // 设置边界样式 + + self.ctx.draw(false, done); + return self + }; + + self.pushOrigin = self.pushOrign = function(src) { + self.src = src; + + tools_7(self.onBeforeImageLoad) && self.onBeforeImageLoad(self.ctx, self); + + return getImageInfo({ + src: src + }) + .then(function(res) { + var innerAspectRadio = res.width / res.height; + var customAspectRadio = width / height; + + self.croperTarget = res.path; + + if (innerAspectRadio < customAspectRadio) { + self.rectX = x; + self.baseWidth = width; + self.baseHeight = width / innerAspectRadio; + self.rectY = y - Math.abs((height - self.baseHeight) / 2); + } else { + self.rectY = y; + self.baseWidth = height * innerAspectRadio; + self.baseHeight = height; + self.rectX = x - Math.abs((width - self.baseWidth) / 2); + } + + self.imgLeft = self.rectX; + self.imgTop = self.rectY; + self.scaleWidth = self.baseWidth; + self.scaleHeight = self.baseHeight; + + self.update(); + + return new Promise(function(resolve) { + self.updateCanvas(resolve); + }) + }) + .then(function() { + tools_7(self.onImageLoad) && self.onImageLoad(self.ctx, self); + }) + }; + + self.removeImage = function() { + self.src = ''; + self.croperTarget = ''; + return draw(self.ctx) + }; + + self.getCropperBase64 = function(done) { + if (done === void 0) done = function() {}; + + CanvasToBase64.convertToBMP({ + canvasId: id, + x: x, + y: y, + width: width, + height: height + }, done); + }; + + self.getCropperImage = function(opt, fn) { + var customOptions = opt; + + var canvasOptions = { + canvasId: id, + x: x, + y: y, + width: width, + height: height + }; + + var task = function() { + return Promise.resolve(); + }; + + if ( + tools_10(customOptions) && + customOptions.original + ) { + // original mode + task = function() { + self.targetCtx.drawImage( + self.croperTarget, + self.imgLeft * pixelRatio, + self.imgTop * pixelRatio, + self.scaleWidth * pixelRatio, + self.scaleHeight * pixelRatio + ); + + canvasOptions = { + canvasId: targetId, + x: x * pixelRatio, + y: y * pixelRatio, + width: width * pixelRatio, + height: height * pixelRatio + }; + + return draw(self.targetCtx) + }; + } + + return task() + .then(function() { + if (tools_10(customOptions)) { + canvasOptions = Object.assign({}, canvasOptions, customOptions); + } + + if (tools_7(customOptions)) { + fn = customOptions; + } + + var arg = canvasOptions.componentContext ? + [canvasOptions, canvasOptions.componentContext] : + [canvasOptions]; + + return canvasToTempFilePath.apply(null, arg) + }) + .then(function(res) { + var tempFilePath = res.tempFilePath; + + return tools_7(fn) ? + fn.call(self, tempFilePath, null) : + tempFilePath + }) + .catch(function(err) { + if (tools_7(fn)) { + fn.call(self, null, err); + } else { + throw err + } + }) + }; + } + + /** + * 获取最新缩放值 + * @param oldScale 上一次触摸结束后的缩放值 + * @param oldDistance 上一次触摸结束后的双指距离 + * @param zoom 缩放系数 + * @param touch0 第一指touch对象 + * @param touch1 第二指touch对象 + * @returns {*} + */ + var getNewScale = function(oldScale, oldDistance, zoom, touch0, touch1) { + var xMove, yMove, newDistance; + // 计算二指最新距离 + xMove = Math.round(touch1.x - touch0.x); + yMove = Math.round(touch1.y - touch0.y); + newDistance = Math.round(Math.sqrt(xMove * xMove + yMove * yMove)); + + return oldScale + 0.001 * zoom * (newDistance - oldDistance) + }; + + function update() { + var self = this; + + if (!self.src) { + return + } + + self.__oneTouchStart = function(touch) { + self.touchX0 = Math.round(touch.x); + self.touchY0 = Math.round(touch.y); + }; + + self.__oneTouchMove = function(touch) { + var xMove, yMove; + // 计算单指移动的距离 + if (self.touchended) { + return self.updateCanvas() + } + xMove = Math.round(touch.x - self.touchX0); + yMove = Math.round(touch.y - self.touchY0); + + var imgLeft = Math.round(self.rectX + xMove); + var imgTop = Math.round(self.rectY + yMove); + + self.outsideBound(imgLeft, imgTop); + + self.updateCanvas(); + }; + + self.__twoTouchStart = function(touch0, touch1) { + var xMove, yMove, oldDistance; + + self.touchX1 = Math.round(self.rectX + self.scaleWidth / 2); + self.touchY1 = Math.round(self.rectY + self.scaleHeight / 2); + + // 计算两指距离 + xMove = Math.round(touch1.x - touch0.x); + yMove = Math.round(touch1.y - touch0.y); + oldDistance = Math.round(Math.sqrt(xMove * xMove + yMove * yMove)); + + self.oldDistance = oldDistance; + }; + + self.__twoTouchMove = function(touch0, touch1) { + var oldScale = self.oldScale; + var oldDistance = self.oldDistance; + var scale = self.scale; + var zoom = self.zoom; + + self.newScale = getNewScale(oldScale, oldDistance, zoom, touch0, touch1); + + // 设定缩放范围 + self.newScale <= 1 && (self.newScale = 1); + self.newScale >= scale && (self.newScale = scale); + + self.scaleWidth = Math.round(self.newScale * self.baseWidth); + self.scaleHeight = Math.round(self.newScale * self.baseHeight); + var imgLeft = Math.round(self.touchX1 - self.scaleWidth / 2); + var imgTop = Math.round(self.touchY1 - self.scaleHeight / 2); + + self.outsideBound(imgLeft, imgTop); + + self.updateCanvas(); + }; + + self.__xtouchEnd = function() { + self.oldScale = self.newScale; + self.rectX = self.imgLeft; + self.rectY = self.imgTop; + }; + } + + var handle = { + // 图片手势初始监测 + touchStart: function touchStart(e) { + var self = this; + var ref = e.touches; + var touch0 = ref[0]; + var touch1 = ref[1]; + + if (!self.src) { + return + } + + setTouchState(self, true, null, null); + + // 计算第一个触摸点的位置,并参照改点进行缩放 + self.__oneTouchStart(touch0); + + // 两指手势触发 + if (e.touches.length >= 2) { + self.__twoTouchStart(touch0, touch1); + } + }, + + // 图片手势动态缩放 + touchMove: function touchMove(e) { + var self = this; + var ref = e.touches; + var touch0 = ref[0]; + var touch1 = ref[1]; + + if (!self.src) { + return + } + + setTouchState(self, null, true); + + // 单指手势时触发 + if (e.touches.length === 1) { + self.__oneTouchMove(touch0); + } + // 两指手势触发 + if (e.touches.length >= 2) { + self.__twoTouchMove(touch0, touch1); + } + }, + + touchEnd: function touchEnd(e) { + var self = this; + + if (!self.src) { + return + } + + setTouchState(self, false, false, true); + self.__xtouchEnd(); + } + }; + + function cut() { + var self = this; + var boundWidth = self.width; // 裁剪框默认宽度,即整个画布宽度 + var boundHeight = self.height; + // 裁剪框默认高度,即整个画布高度 + var ref = self.cut; + var x = ref.x; + if (x === void 0) x = 0; + var y = ref.y; + if (y === void 0) y = 0; + var width = ref.width; + if (width === void 0) width = boundWidth; + var height = ref.height; + if (height === void 0) height = boundHeight; + + /** + * 设置边界 + * @param imgLeft 图片左上角横坐标值 + * @param imgTop 图片左上角纵坐标值 + */ + self.outsideBound = function(imgLeft, imgTop) { + self.imgLeft = imgLeft >= x ? + x : + self.scaleWidth + imgLeft - x <= width ? + x + width - self.scaleWidth : + imgLeft; + + self.imgTop = imgTop >= y ? + y : + self.scaleHeight + imgTop - y <= height ? + y + height - self.scaleHeight : + imgTop; + }; + + /** + * 设置边界样式 + * @param color 边界颜色 + */ + self.setBoundStyle = function(ref) { + if (ref === void 0) ref = {}; + var color = ref.color; + if (color === void 0) color = '#04b00f'; + var mask = ref.mask; + if (mask === void 0) mask = 'rgba(0, 0, 0, 0.3)'; + var lineWidth = ref.lineWidth; + if (lineWidth === void 0) lineWidth = 1; + + var half = lineWidth / 2; + var boundOption = [{ + start: { + x: x - half, + y: y + 10 - half + }, + step1: { + x: x - half, + y: y - half + }, + step2: { + x: x + 10 - half, + y: y - half + } + }, + { + start: { + x: x - half, + y: y + height - 10 + half + }, + step1: { + x: x - half, + y: y + height + half + }, + step2: { + x: x + 10 - half, + y: y + height + half + } + }, + { + start: { + x: x + width - 10 + half, + y: y - half + }, + step1: { + x: x + width + half, + y: y - half + }, + step2: { + x: x + width + half, + y: y + 10 - half + } + }, + { + start: { + x: x + width + half, + y: y + height - 10 + half + }, + step1: { + x: x + width + half, + y: y + height + half + }, + step2: { + x: x + width - 10 + half, + y: y + height + half + } + } + ]; + + // 绘制半透明层 + self.ctx.beginPath(); + self.ctx.setFillStyle(mask); + self.ctx.fillRect(0, 0, x, boundHeight); + self.ctx.fillRect(x, 0, width, y); + self.ctx.fillRect(x, y + height, width, boundHeight - y - height); + self.ctx.fillRect(x + width, 0, boundWidth - x - width, boundHeight); + self.ctx.fill(); + + boundOption.forEach(function(op) { + self.ctx.beginPath(); + self.ctx.setStrokeStyle(color); + self.ctx.setLineWidth(lineWidth); + self.ctx.moveTo(op.start.x, op.start.y); + self.ctx.lineTo(op.step1.x, op.step1.y); + self.ctx.lineTo(op.step2.x, op.step2.y); + self.ctx.stroke(); + }); + }; + } + + var version = "1.3.9"; + + var WeCropper = function WeCropper(params) { + var self = this; + var _default = {}; + + validator(self, DEFAULT); + + Object.keys(DEFAULT).forEach(function(key) { + _default[key] = DEFAULT[key].default; + }); + Object.assign(self, _default, params); + + self.prepare(); + self.attachPage(); + self.createCtx(); + self.observer(); + self.cutt(); + self.methods(); + self.init(); + self.update(); + + return self + }; + + WeCropper.prototype.init = function init() { + var self = this; + var src = self.src; + + self.version = version; + + typeof self.onReady === 'function' && self.onReady(self.ctx, self); + + if (src) { + self.pushOrign(src); + } else { + self.updateCanvas(); + } + setTouchState(self, false, false, false); + + self.oldScale = 1; + self.newScale = 1; + + return self + }; + + Object.assign(WeCropper.prototype, handle); + + WeCropper.prototype.prepare = prepare; + WeCropper.prototype.observer = observer; + WeCropper.prototype.methods = methods; + WeCropper.prototype.cutt = cut; + WeCropper.prototype.update = update; + + return WeCropper; + +}))); diff --git a/uview-ui/components/u-avatar/u-avatar.vue b/uview-ui/components/u-avatar/u-avatar.vue new file mode 100644 index 0000000..289b9b0 --- /dev/null +++ b/uview-ui/components/u-avatar/u-avatar.vue @@ -0,0 +1,244 @@ + + + + + diff --git a/uview-ui/components/u-back-top/u-back-top.vue b/uview-ui/components/u-back-top/u-back-top.vue new file mode 100644 index 0000000..7970fc7 --- /dev/null +++ b/uview-ui/components/u-back-top/u-back-top.vue @@ -0,0 +1,153 @@ + + + + + diff --git a/uview-ui/components/u-badge/u-badge.vue b/uview-ui/components/u-badge/u-badge.vue new file mode 100644 index 0000000..e85b133 --- /dev/null +++ b/uview-ui/components/u-badge/u-badge.vue @@ -0,0 +1,216 @@ + + + + + \ No newline at end of file diff --git a/uview-ui/components/u-button/u-button.vue b/uview-ui/components/u-button/u-button.vue new file mode 100644 index 0000000..82c3a6f --- /dev/null +++ b/uview-ui/components/u-button/u-button.vue @@ -0,0 +1,596 @@ + + + + + diff --git a/uview-ui/components/u-calendar/u-calendar.vue b/uview-ui/components/u-calendar/u-calendar.vue new file mode 100644 index 0000000..2b30184 --- /dev/null +++ b/uview-ui/components/u-calendar/u-calendar.vue @@ -0,0 +1,639 @@ + + + + \ No newline at end of file diff --git a/uview-ui/components/u-calendarWeek/u-calendarWeek.vue b/uview-ui/components/u-calendarWeek/u-calendarWeek.vue new file mode 100644 index 0000000..137640b --- /dev/null +++ b/uview-ui/components/u-calendarWeek/u-calendarWeek.vue @@ -0,0 +1,705 @@ + + + + \ No newline at end of file diff --git a/uview-ui/components/u-car-keyboard/u-car-keyboard.vue b/uview-ui/components/u-car-keyboard/u-car-keyboard.vue new file mode 100644 index 0000000..84b1467 --- /dev/null +++ b/uview-ui/components/u-car-keyboard/u-car-keyboard.vue @@ -0,0 +1,257 @@ + + + + + diff --git a/uview-ui/components/u-card/u-card.vue b/uview-ui/components/u-card/u-card.vue new file mode 100644 index 0000000..a3cb2aa --- /dev/null +++ b/uview-ui/components/u-card/u-card.vue @@ -0,0 +1,299 @@ + + + + + diff --git a/uview-ui/components/u-cell-group/u-cell-group.vue b/uview-ui/components/u-cell-group/u-cell-group.vue new file mode 100644 index 0000000..3fbca72 --- /dev/null +++ b/uview-ui/components/u-cell-group/u-cell-group.vue @@ -0,0 +1,70 @@ + + + + + diff --git a/uview-ui/components/u-cell-item/u-cell-item.vue b/uview-ui/components/u-cell-item/u-cell-item.vue new file mode 100644 index 0000000..055af3a --- /dev/null +++ b/uview-ui/components/u-cell-item/u-cell-item.vue @@ -0,0 +1,316 @@ + + + + + diff --git a/uview-ui/components/u-checkbox-group/u-checkbox-group.vue b/uview-ui/components/u-checkbox-group/u-checkbox-group.vue new file mode 100644 index 0000000..6a149b3 --- /dev/null +++ b/uview-ui/components/u-checkbox-group/u-checkbox-group.vue @@ -0,0 +1,123 @@ + + + + + diff --git a/uview-ui/components/u-checkbox/u-checkbox.vue b/uview-ui/components/u-checkbox/u-checkbox.vue new file mode 100644 index 0000000..9414461 --- /dev/null +++ b/uview-ui/components/u-checkbox/u-checkbox.vue @@ -0,0 +1,284 @@ + + + + + diff --git a/uview-ui/components/u-circle-progress/u-circle-progress.vue b/uview-ui/components/u-circle-progress/u-circle-progress.vue new file mode 100644 index 0000000..46e7c18 --- /dev/null +++ b/uview-ui/components/u-circle-progress/u-circle-progress.vue @@ -0,0 +1,220 @@ + + + + + diff --git a/uview-ui/components/u-circle-progress/u-line-progress/u-line-progress.vue b/uview-ui/components/u-circle-progress/u-line-progress/u-line-progress.vue new file mode 100644 index 0000000..77e2da2 --- /dev/null +++ b/uview-ui/components/u-circle-progress/u-line-progress/u-line-progress.vue @@ -0,0 +1,147 @@ + + + + + diff --git a/uview-ui/components/u-col/u-col.vue b/uview-ui/components/u-col/u-col.vue new file mode 100644 index 0000000..3b6cc64 --- /dev/null +++ b/uview-ui/components/u-col/u-col.vue @@ -0,0 +1,156 @@ + + + + + diff --git a/uview-ui/components/u-collapse-item/u-collapse-item.vue b/uview-ui/components/u-collapse-item/u-collapse-item.vue new file mode 100644 index 0000000..6656657 --- /dev/null +++ b/uview-ui/components/u-collapse-item/u-collapse-item.vue @@ -0,0 +1,205 @@ + + + + + diff --git a/uview-ui/components/u-collapse/u-collapse.vue b/uview-ui/components/u-collapse/u-collapse.vue new file mode 100644 index 0000000..8572957 --- /dev/null +++ b/uview-ui/components/u-collapse/u-collapse.vue @@ -0,0 +1,99 @@ + + + + + diff --git a/uview-ui/components/u-column-notice/u-column-notice.vue b/uview-ui/components/u-column-notice/u-column-notice.vue new file mode 100644 index 0000000..dd8bd31 --- /dev/null +++ b/uview-ui/components/u-column-notice/u-column-notice.vue @@ -0,0 +1,237 @@ + + + + + diff --git a/uview-ui/components/u-count-down/u-count-down.vue b/uview-ui/components/u-count-down/u-count-down.vue new file mode 100644 index 0000000..7285d67 --- /dev/null +++ b/uview-ui/components/u-count-down/u-count-down.vue @@ -0,0 +1,318 @@ + + + + + diff --git a/uview-ui/components/u-count-to/u-count-to.vue b/uview-ui/components/u-count-to/u-count-to.vue new file mode 100644 index 0000000..053dc5f --- /dev/null +++ b/uview-ui/components/u-count-to/u-count-to.vue @@ -0,0 +1,241 @@ + + + + + diff --git a/uview-ui/components/u-divider/u-divider.vue b/uview-ui/components/u-divider/u-divider.vue new file mode 100644 index 0000000..6f8d7e6 --- /dev/null +++ b/uview-ui/components/u-divider/u-divider.vue @@ -0,0 +1,153 @@ + + + + + diff --git a/uview-ui/components/u-dropdown-item/u-dropdown-item.vue b/uview-ui/components/u-dropdown-item/u-dropdown-item.vue new file mode 100644 index 0000000..ba60d8f --- /dev/null +++ b/uview-ui/components/u-dropdown-item/u-dropdown-item.vue @@ -0,0 +1,132 @@ + + + + + diff --git a/uview-ui/components/u-dropdown/u-dropdown.vue b/uview-ui/components/u-dropdown/u-dropdown.vue new file mode 100644 index 0000000..a62e469 --- /dev/null +++ b/uview-ui/components/u-dropdown/u-dropdown.vue @@ -0,0 +1,298 @@ + + + + + diff --git a/uview-ui/components/u-empty/u-empty.vue b/uview-ui/components/u-empty/u-empty.vue new file mode 100644 index 0000000..2c77b24 --- /dev/null +++ b/uview-ui/components/u-empty/u-empty.vue @@ -0,0 +1,193 @@ + + + + + diff --git a/uview-ui/components/u-field/u-field.vue b/uview-ui/components/u-field/u-field.vue new file mode 100644 index 0000000..b562798 --- /dev/null +++ b/uview-ui/components/u-field/u-field.vue @@ -0,0 +1,384 @@ +